blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 616 | content_id stringlengths 40 40 | detected_licenses listlengths 0 69 | license_type stringclasses 2 values | repo_name stringlengths 5 118 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 63 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 2.91k 686M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 220 values | src_encoding stringclasses 30 values | language stringclasses 1 value | is_vendor bool 2 classes | is_generated bool 2 classes | length_bytes int64 2 10.3M | extension stringclasses 257 values | content stringlengths 2 10.3M | authors listlengths 1 1 | author_id stringlengths 0 212 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0c3d842557c9376a3e85eb48319735d211b4170d | 487ce91881032c1de16e35ed8bc187d6034205f7 | /codes/CodeJamCrawler/16_0_1/Naca/main.py | 5645aca52186859c629e2d833d00d1e431940170 | [] | no_license | DaHuO/Supergraph | 9cd26d8c5a081803015d93cf5f2674009e92ef7e | c88059dc66297af577ad2b8afa4e0ac0ad622915 | refs/heads/master | 2021-06-14T16:07:52.405091 | 2016-08-21T13:39:13 | 2016-08-21T13:39:13 | 49,829,508 | 2 | 0 | null | 2021-03-19T21:55:46 | 2016-01-17T18:23:00 | Python | UTF-8 | Python | false | false | 432 | py | T = int(input());
data = [];
for i in range(T) :
data.append(int(input()));
for i in range(T) :
if (data[i] == 0) :
print("Case #" + str(i + 1) + ": INSOMNIA");
else :
digits = [];
sumN = data[i];
while (len(digits) < 10) :
tmp = sumN;
while (tmp > 0) :
if (tmp % 10 not in digits) :
digits.append(tmp % 10);
tmp //= 10;
sumN += data[i];
print("Case #" + str(i + 1) + ": " + str(sumN - data[i])); | [
"[dhuo@tcd.ie]"
] | [dhuo@tcd.ie] |
dee08669b1d02ebe27c6c89f6953a3892a7f80ac | bd8a9afcf75a0a4048bffdfd37089d4e44299301 | /node_modules/mongoose/node_modules/mongodb/node_modules/bson/build/config.gypi | d5e44d8de6462d315d8f2caf33ad03d6f3716250 | [
"Apache-2.0",
"MIT"
] | permissive | deanvlue/meantest | f0c836692903e83c205bc3934c9f81170ff6f5c3 | 5c4a0e039085cd8216202f18f49fba64b93dbc0d | refs/heads/master | 2016-09-05T23:52:23.269296 | 2015-04-24T04:44:27 | 2015-04-24T04:44:27 | 34,538,954 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,385 | gypi | # Do not edit. File was generated by node-gyp's "configure" step
{
"target_defaults": {
"cflags": [],
"default_configuration": "Release",
"defines": [],
"include_dirs": [],
"libraries": []
},
"variables": {
"clang": 0,
"gcc_version": 49,
"host_arch": "ia32",
"icu_small": "false",
"node_install_npm": "true",
"node_prefix": "/usr",
"node_shared_cares": "false",
"node_shared_http_parser": "false",
"node_shared_libuv": "false",
"node_shared_openssl": "false",
"node_shared_v8": "false",
"node_shared_zlib": "false",
"node_tag": "",
"node_use_dtrace": "false",
"node_use_etw": "false",
"node_use_mdb": "false",
"node_use_openssl": "true",
"node_use_perfctr": "false",
"openssl_no_asm": 0,
"python": "/usr/bin/python",
"target_arch": "ia32",
"uv_library": "static_library",
"uv_parent_path": "/deps/uv/",
"uv_use_dtrace": "false",
"v8_enable_gdbjit": 0,
"v8_enable_i18n_support": 0,
"v8_no_strict_aliasing": 1,
"v8_optimized_debug": 0,
"v8_random_seed": 0,
"v8_use_snapshot": "false",
"want_separate_host_toolset": 0,
"nodedir": "/home/deploy/.node-gyp/0.12.2",
"copy_dev_lib": "true",
"standalone_static_library": 1,
"cache_lock_stale": "60000",
"sign_git_tag": "",
"user_agent": "npm/2.7.4 node/v0.12.2 linux ia32",
"always_auth": "",
"bin_links": "true",
"key": "",
"description": "true",
"fetch_retries": "2",
"heading": "npm",
"if_present": "",
"init_version": "1.0.0",
"user": "1000",
"force": "",
"cache_min": "10",
"init_license": "ISC",
"editor": "vi",
"rollback": "true",
"cache_max": "Infinity",
"userconfig": "/home/deploy/.npmrc",
"engine_strict": "",
"init_author_name": "",
"init_author_url": "",
"tmp": "/tmp",
"depth": "Infinity",
"save_dev": "",
"usage": "",
"cafile": "",
"https_proxy": "",
"onload_script": "",
"rebuild_bundle": "true",
"save_bundle": "",
"shell": "/bin/bash",
"prefix": "/usr",
"browser": "",
"cache_lock_wait": "10000",
"registry": "https://registry.npmjs.org/",
"save_optional": "",
"scope": "",
"searchopts": "",
"versions": "",
"cache": "/home/deploy/.npm",
"ignore_scripts": "",
"searchsort": "name",
"version": "",
"local_address": "",
"viewer": "man",
"color": "true",
"fetch_retry_mintimeout": "10000",
"umask": "0022",
"fetch_retry_maxtimeout": "60000",
"message": "%s",
"ca": "",
"cert": "",
"global": "",
"link": "",
"access": "",
"save": "",
"unicode": "true",
"long": "",
"production": "",
"unsafe_perm": "",
"node_version": "0.12.2",
"tag": "latest",
"git_tag_version": "true",
"shrinkwrap": "true",
"fetch_retry_factor": "10",
"npat": "",
"proprietary_attribs": "true",
"save_exact": "",
"strict_ssl": "true",
"dev": "",
"globalconfig": "/usr/etc/npmrc",
"init_module": "/home/deploy/.npm-init.js",
"parseable": "",
"globalignorefile": "/usr/etc/npmignore",
"cache_lock_retries": "10",
"save_prefix": "^",
"group": "1000",
"init_author_email": "",
"searchexclude": "",
"git": "git",
"optional": "true",
"json": "",
"spin": "true"
}
}
| [
"munoz.josecarlos@gmail.com"
] | munoz.josecarlos@gmail.com |
8988be20a22fb57d4719c31b7d397fab4a3163b1 | 7adecd15af359d19a611ce24b3ae8765b7af2a46 | /reset_db.py | b3e0e8d8e3eae2acf91da93a40e1f8e255bd9183 | [] | no_license | jkrovitz/MovieRatingSite | 83996ec6856a31a04d59cadc89196d9819d022ed | bc9f1930595d578268e754078d4d374a0fbcedc5 | refs/heads/master | 2020-04-05T14:22:50.341159 | 2019-09-13T22:55:48 | 2019-09-13T22:55:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 164 | py | print('Resetting database...')
from server import db
# Reset the database
db.db.drop_all()
# Create the tables
db.db.create_all()
print('Database reset: success!')
| [
"jkrovitz@macalester.edu"
] | jkrovitz@macalester.edu |
92c1bf03bc0279955a5ec39a71b9ec7617f7296f | 27e8bb104c3b102d433f910561ffa80461c4887a | /spamNN.py | 5aee9f09dc3c692da0f5d70cb3b67adcea0a473a | [] | no_license | entradajuan/spam2 | fdcaa3aa2f2ddeff31ef7b9bc7ae64e5bb10ffd5 | 993f4042397910c75506e1c4fc318cb4ce98a70e | refs/heads/master | 2023-05-31T03:32:31.820147 | 2021-06-06T18:59:55 | 2021-06-06T18:59:55 | 373,096,172 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,559 | py | %tensorflow_version 2.x
import tensorflow as tf
#from tf.keras.models import Sequential
#from tf.keras.layers import Dense
import os
import io
import numpy as np
tf.__version__
#path_to_zip = tf.keras.utils.get_file("smsspamcollection.zip",
# origin="https://archive.ics.uci.edu/ml/machine-learning-databases/00228/smsspamcollection.zip",
# extract=True)
#print(path_to_zip)
#print(type(path_to_zip))
#!unzip $path_to_zip -d data
#lines = io.open('/content/spam2/data/SMSSpamCollection').read().strip().split('\n')
lines = io.open('data/SMSSpamCollection').read().strip().split('\n')
print(lines)
print(type(lines))
print(lines[0])
data = []
count = 0
for e in lines:
label, text = e.split('\t')
if (label.lower().strip() =='spam'):
data.append((1, text.strip()))
else:
data.append((0, text.strip()))
print(data)
print(len(data))
print(data[0][1])
print(type(data[0]))
import pandas as pd
df = pd.DataFrame(data, columns=['spam', 'text'])
print(df.head())
print(df.shape)
import re
def message_length(x):
return len(x)
def num_capitals(x):
_, count = re.subn(r'[A-Z]' , '', x)
return count
cap_count = num_capitals('Adsd Aggggg')
print(cap_count)
def num_punctuation(x):
_, num = re.subn(r'\W', '', x)
return num
df['long'] = df['text'].apply(message_length)
df['caps'] = df['text'].apply(num_capitals)
df['punct'] = df['text'].apply(num_punctuation)
print(df.head().to_string)
train = df.sample(frac=0.8, random_state=42)
test = df.drop(train.index)
print()
print(train.describe())
def make_model(inputs=3, num_units=12):
model = tf.keras.Sequential()
model.add(tf.keras.layers.Dense(num_units, input_dim=inputs, activation='relu'))
model.add(tf.keras.layers.Dense(1, activation='relu'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
return model
x_train = train[['long', 'punct', 'caps']]
y_train = train[['spam']]
print(y_train)
print(y_train.shape)
print(y_train['spam'].sum())
print(type(y_train))
# Pay attention, the 2 DataFrames do NOT share memo!!
ser1 = train[['spam']]
print(ser1.head)
#print(ser1.iloc[0:3].index)
print(ser1.loc[ser1.iloc[0:3].index, 'spam'])
ser1.loc[ser1.iloc[0:3].index, 'spam'] = np.nan
print('train spam shape', train[['spam']].isna().sum())
print('serie spam shape', ser1[['spam']].isna().sum())
x_test = test[['long', 'punct', 'caps']]
y_test = test[['spam']]
model = make_model(inputs=3, num_units=12)
print(type(model))
model.fit(x_train, y_train, epochs=10, batch_size=10)
model.evaluate(x_test, y_test)
y_train_pred = model.predict(x_train)
print(y_train_pred)
print(tf.math.confusion_matrix(tf.constant(y_train.spam), y_train_pred))
y_test_pred = model.predict_classes(x_test)
print(y_test_pred)
print(tf.math.confusion_matrix(tf.constant(y_test.spam), y_test_pred))
!pip install stanza
import stanza
snlp = stanza.download('en')
en = stanza.Pipeline(lang='en', processors='tokenize')
def word_counts(x, pipeline=en):
docu = pipeline(x)
count = sum([len(sen.tokens) for sen in docu.sentences])
return count
df['words'] = df['text'].apply(word_counts)
train['words'] = train['text'].apply(word_counts)
test['words'] = test['text'].apply(word_counts)
x_train = train[[ 'long', 'caps', 'punct', 'words']]
y_train = train[['spam']]
x_test = test[[ 'long', 'caps', 'punct', 'words']]
y_test = test[['spam']]
#model = make_model(inputs=4)
model = make_model(inputs=4, num_units=1200)
model.fit(x_train, y_train, epochs=40, batch_size=100)
model.evaluate(x_test, y_test)
| [
"entradajuan@yahoo.es"
] | entradajuan@yahoo.es |
5c373349176db66ba2f7617dfca9fa2c18ee4d78 | 94724578994ab1438dcefb51b7ef4d8570da5d4c | /calibre/draveness.recipe | 361ce64106650ddf8643557d49369ebfec882386 | [] | no_license | PegasusWang/collection_python | 6648d83203634abf44fd42c0b37b0bf7cc406d8f | 9ef019a737a0817860d3184924c67a0833bd1252 | refs/heads/master | 2023-09-01T23:15:39.813635 | 2023-08-24T06:46:12 | 2023-08-24T06:46:12 | 43,693,872 | 130 | 90 | null | 2021-04-26T15:12:55 | 2015-10-05T15:28:15 | JavaScript | UTF-8 | Python | false | false | 2,028 | recipe | #!/usr/bin/python
# encoding: utf-8
from calibre.web.feeds.recipes import BasicNewsRecipe # 引入 Recipe 基础类
"""
教程:
- https://bookfere.com/tools#calibre
- https://www.jianshu.com/p/0bcb92509309
- https://snowdreams1006.github.io/myGitbook/advance/export.html
命令:
ebook-convert draveness.recipe draveness.mobi --output-profile=kindle
"""
class DravenessBlog(BasicNewsRecipe): # 继承 BasicNewsRecipe 类的新类名
# ///////////////////
# 设置电子书元数据
# ///////////////////
title = "draveness" # 电子书名
description = u"draveness的博客" # 电子书简介
# cover_url = '' # 电子书封面
# masthead_url = '' # 页头图片
__author__ = "draveness" # 作者
language = "zh" # 语言
encoding = "utf-8" # 编码
# ///////////////////
# 抓取页面内容设置
# ///////////////////
# keep_only_tags = [{ 'class': 'example' }] # 仅保留指定选择器包含的内容
no_stylesheets = True # 去除 CSS 样式
remove_javascript = True # 去除 JavaScript 脚本
auto_cleanup = True # 自动清理 HTML 代码
delay = 5 # 抓取页面间隔秒数
max_articles_per_feed = 100 # 抓取文章数量
timeout = 10
# ///////////////////
# 页面内容解析方法
# ///////////////////
def parse_index(self):
site = "https://draveness.me/whys-the-design/"
soup = self.index_to_soup(site) # 解析列表页返回 BeautifulSoup 对象
articles = [] # 定义空文章资源数组
ultag = soup.findAll("ul")[6]
urls = ultag.findAll("li")
urls.reverse()
for link in urls:
title = link.a.contents[0].strip() # 提取文章标题
url = link.a.get("href") # 提取文章链接
print(title, url)
articles.append({"title": title, "url": url})
ans = [(self.title, articles)] # 组成最终的数据结构
return ans # 返回可供 Calibre 转换的数据结构
| [
"291374108@qq.com"
] | 291374108@qq.com |
1fdebe6ed9f7b1888ae11d36cdcefdc246e740f5 | 543b0bcb81b16674c81be082824adca4d8ac509a | /apps/urls.py | a36a6454ca4fd7f22b2812aa610b1b12488eb2e9 | [] | no_license | alxpolyakov/test-apps | a85d2a3828cdde056c3320be6f4a9c0fb52bb170 | 254a535c278ae34ec0e1d177eec2fac84b12daef | refs/heads/master | 2020-09-15T12:24:59.963107 | 2019-11-25T04:39:03 | 2019-11-25T04:39:03 | 223,444,183 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 927 | py | """apps URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from api.views import AppsListView, CreateAPIKeyView
urlpatterns = [
path('admin/', admin.site.urls),
path('apps/', AppsListView.as_view(), name='apps'),
path('api-key/', CreateAPIKeyView.as_view(), name='create-api-key')
]
| [
"alx.polyakov@gmail.com"
] | alx.polyakov@gmail.com |
5adc121c249783a3723d7534db002449e0dd665f | 48bdf7214235a2d60787fa8c5312f0461f688dde | /src/test_01.py | 7f4e802f6ec4b9f4f09ebb16784db702f558eb91 | [] | no_license | hechangfei1123/FaceRecognition | 148b16a21b781bc915c131f92341012e54f4f0d3 | 6010f5c68aa7d4043dc256f19f3d53e192683e8d | refs/heads/master | 2020-03-28T12:43:48.807655 | 2018-11-11T03:48:47 | 2018-11-11T03:48:47 | 148,328,122 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,780 | py | from PIL import Image
from PIL import ImageDraw
# im = Image.open(r"E:\BaiduNetdiskDownload\CelebA\Img\img_align_celeba\000011.jpg")
# imDraw = ImageDraw.Draw(im)
# imDraw.ellipse((68,111,69,112),fill="red")
# im.show(im)
import utils
import numpy as np
import os
import numpy.random as npr
import cv2
anno_file = r"E:\save_path\landmarks\0\landark.txt"
data_file = r"E:\save_path\landmarks\0\images"
save_path = r'E:\save_path\landmarks'
for size in [48]:
# size = 48
image_id = 0
landmark_imgs_save_dir = os.path.join(save_path,str(size))
if not os.path.exists(landmark_imgs_save_dir):
os.makedirs(landmark_imgs_save_dir)
landmark_imgs_save_dir_img = os.path.join(landmark_imgs_save_dir,"images")
if not os.path.exists(landmark_imgs_save_dir_img):
os.makedirs(landmark_imgs_save_dir_img)
save_landmark_anno = os.path.join(landmark_imgs_save_dir,"landark.txt")
f = open(save_landmark_anno, 'w')
# dstdir = "train_landmark_few"
with open(anno_file, 'r') as f2:
annotations = f2.readlines()
num = len(annotations)
print("%d total images" % num)
l_idx =0
idx = 0
# image_path bbox landmark(5*2)
for annotation in annotations:
# print imgPath
annotation = annotation.strip().split(' ')
assert len(annotation)==15,"each line should have 15 element"
im_path = os.path.join(data_file,annotation[0])
# gt_box = map(float, annotation[1:5])
# gt_box = [gt_box[0], gt_box[2], gt_box[1], gt_box[3]]
# gt_box = np.array(gt_box, dtype=np.int32)
gt_box = np.array(annotation[1:5], dtype=np.int32)
# landmark = map(float, annotation[5:])
landmark = np.array(annotation[5:], dtype=np.float)
img = cv2.imread(im_path)
assert (img is not None)
height, width, channel = img.shape
# crop_face = img[gt_box[1]:gt_box[3]+1, gt_box[0]:gt_box[2]+1]
# crop_face = cv2.resize(crop_face,(size,size))
idx = idx + 1
if idx % 100 == 0:
print("%d images done, landmark images: %d"%(idx,l_idx))
x1, y1, x2, y2 = gt_box
# gt's width
w = x2 - x1 + 1
# gt's height
h = y2 - y1 + 1
if max(w, h) < 40 or x1 < 0 or y1 < 0:
continue
# random shift
for i in range(10):
bbox_size = npr.randint(int(min(w, h) * 0.8), np.ceil(1.25 * max(w, h)))
delta_x = npr.randint(-w * 0.2, w * 0.2)
delta_y = npr.randint(-h * 0.2, h * 0.2)
nx1 = max(x1 + w / 2 - bbox_size / 2 + delta_x, 0)
ny1 = max(y1 + h / 2 - bbox_size / 2 + delta_y, 0)
nx2 = nx1 + bbox_size
ny2 = ny1 + bbox_size
if nx2 > width or ny2 > height:
continue
crop_box = np.array([nx1, ny1, nx2, ny2])
cropped_im = img[int(ny1):int(ny2 + 1), int(nx1):int(nx2 + 1), :]
resized_im = cv2.resize(cropped_im, (size, size),interpolation=cv2.INTER_LINEAR)
offset_x1 = (x1 - nx1) / float(bbox_size)
offset_y1 = (y1 - ny1) / float(bbox_size)
offset_x2 = (x2 - nx2) / float(bbox_size)
offset_y2 = (y2 - ny2) / float(bbox_size)
offset_left_eye_x = (landmark[0] - nx1) / float(bbox_size)
offset_left_eye_y = (landmark[1] - ny1) / float(bbox_size)
offset_right_eye_x = (landmark[2] - nx1) / float(bbox_size)
offset_right_eye_y = (landmark[3] - ny1) / float(bbox_size)
offset_nose_x = (landmark[4] - nx1) / float(bbox_size)
offset_nose_y = (landmark[5] - ny1) / float(bbox_size)
offset_left_mouth_x = (landmark[6] - nx1) / float(bbox_size)
offset_left_mouth_y = (landmark[7] - ny1) / float(bbox_size)
offset_right_mouth_x = (landmark[8] - nx1) / float(bbox_size)
offset_right_mouth_y = (landmark[9] - ny1) / float(bbox_size)
# cal iou
# iou = utils.IoU(crop_box.astype(np.float), np.expand_dims(gt_box.astype(np.float), 0))
box_ = gt_box.reshape(1, -1)
iou = utils.iou(crop_box,box_)
if iou > 0.65:
save_file = os.path.join(landmark_imgs_save_dir_img, "%s.jpg" % l_idx)
cv2.imwrite(save_file, resized_im)
f.write(save_file + ' 1 %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f \n' % \
(offset_x1, offset_y1, offset_x2, offset_y2, \
offset_left_eye_x,offset_left_eye_y,offset_right_eye_x,offset_right_eye_y,offset_nose_x,offset_nose_y,offset_left_mouth_x,offset_left_mouth_y,offset_right_mouth_x,offset_right_mouth_y))
l_idx += 1
f.close() | [
"569594060@qq.com"
] | 569594060@qq.com |
3490b1bb4e1c131229f6c34d0a5be01c481e3222 | f7dd967f82902ecfcd4825a579bbd9d1f05d8fbd | /TwitterTrends/urls.py | 93e0ef3a2eec347d7870b478c1cf38b448105789 | [] | no_license | Pravin-Rathod/TwitterTrends | 1f55d7134a400dd9b2c137a4af4b43b93d2681d1 | 54112039b0ff23cc19820ae3bce5940aaf135d17 | refs/heads/master | 2022-09-15T20:23:07.908981 | 2022-07-24T18:31:02 | 2022-07-24T18:31:02 | 517,396,931 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 867 | py | """TwitterTrends URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
urlpatterns = [
path('TwitterTrends/',include('Index.urls')),
path('TwitterTrends/',include('Dashboard.urls')),
path('admin/', admin.site.urls),
]
| [
"43312928+Pravin-Rathod@users.noreply.github.com"
] | 43312928+Pravin-Rathod@users.noreply.github.com |
048dd77d7a67072915ca12a4be0d9bb4cc71a927 | 5d68003304258314eab41444bc27be45921787cb | /aws_token_refresh.py | 14da8c89abbbf2428c9cb7f308107eb5abe85798 | [] | no_license | manas86/aws-auto-token-refresh | b921b19070e921cb058bcc0b28dffd2081ab0e13 | 9e04b35de3c531fa60fa3126b7ea1041c1cb781b | refs/heads/master | 2022-11-12T22:24:49.755310 | 2020-07-05T21:40:37 | 2020-07-05T21:40:37 | 277,386,890 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,241 | py | import boto3
from botocore.credentials import RefreshableCredentials
from botocore.session import get_session
from boto3 import Session
aws_region="eu-west-1"
sts_client = boto3.client("sts", region_name=aws_region)
role_name="dummy-role-1"
session_name="Session_name"
def _refresh():
" Refresh tokens by calling assume_role again "
params = {
"RoleArn": role_name,
"RoleSessionName": session_name,
"DurationSeconds": 3600,
}
response = sts_client.assume_role(**params).get("Credentials")
credentials = {
"access_key": response.get("AccessKeyId"),
"secret_key": response.get("SecretAccessKey"),
"token": response.get("SessionToken"),
"expiry_time": response.get("Expiration").isoformat(),
}
return credentials
session_credentials = RefreshableCredentials.create_from_metadata(
metadata=_refresh(),
refresh_using=_refresh,
method="sts-assume-role",
)
# Now we can use this as long as possible
session = get_session()
session._credentials = session_credentials
session.set_config_variable("region", aws_region)
autorefresh_session = Session(botocore_session=session)
ec2_client = autorefresh_session.client("ec2", region_name=aws_region)
| [
"manassamantaray@Manass-MacBook-Air.local"
] | manassamantaray@Manass-MacBook-Air.local |
eec8efa198fdd6ce3ad3070fc8265762caf05d1c | 58141d7fc37854efad4ad64c74891a12908192ed | /tests/test_storage2.py | b09918d1388d18d6fb7fb62fa653799306d5de22 | [] | no_license | stanleylio/fishie | b028a93b2093f59a8ceee4f78b55a91bb1f69506 | 0685045c07e4105934d713a0fd58c4bc28821ed6 | refs/heads/master | 2022-08-14T13:08:55.548830 | 2022-07-29T01:32:28 | 2022-07-29T01:32:28 | 30,433,819 | 8 | 1 | null | null | null | null | UTF-8 | Python | false | false | 569 | py | import unittest,sys
from os.path import expanduser
sys.path.append(expanduser('~'))
from node.storage.storage2 import storage
class TestStorage2(unittest.TestCase):
def test_read_latest_non_null(self):
s = storage()
self.assertTrue(s.read_latest_non_null('node-008', 'ReceptionTime', 'idx'))
#self.assertTrue(parse_SeaFET(m) is not None)
def test_read_last_N_minutes(self):
s = storage()
self.assertTrue(s.read_last_N_minutes('node-007', 'ReceptionTime', 1, 'T_280'))
if __name__ == '__main__':
unittest.main()
| [
"stanleylio@gmail.com"
] | stanleylio@gmail.com |
e5f6e54c65a454755c25967480e4273cf37e6070 | 50339c2df5be1dc9812c0d986872b877b5904340 | /data_import/liusinuo/sql_time.py | 33332860c879dbef4bceb58475d4d44124bd0773 | [] | no_license | hashuang/managesys | affcbe16ee54f1dd1bfb4a20f73118c071afee51 | 67c9c6a395f61842083ae16bb59410c77ba44d21 | refs/heads/master | 2020-12-25T11:52:33.844031 | 2017-08-02T02:40:24 | 2017-08-02T02:40:24 | 75,186,487 | 0 | 0 | null | 2016-11-30T12:50:14 | 2016-11-30T12:50:14 | null | UTF-8 | Python | false | false | 12,475 | py | '''
2016-10-21
对应 space.py 代码
控制 空间分析 的 sql 语句
'''
from . import mysql
conn_mysql=mysql.MySQL();
import datetime
#=====================【 SQL 语 句 查 询 】==================================
def time_sql(sql_date1,sql_date2,sql_ctry_prov_cty,tradeNo_list,space_name,aspect_name,dateChoose,aspect):
print("\n 时间:",sql_date1,"-",sql_date2,"\n","钢种:",tradeNo_list,"\n","地点:",space_name,"\n","分析内容:",aspect_name,"\n")
sql_date1 = datetime.datetime.strptime(sql_date1, '%Y%m%d')
sql_date2 = datetime.datetime.strptime(sql_date2, '%Y%m%d')
xDay = (sql_date2 - sql_date1).days
#print (xDay)
aDay = datetime.timedelta(days=1)
#print (aDay)
i = 0
time_dict = {}
# time_dict_day = {}
# time_dict_allDay = {}
rtn_sum_dict = {}
weight_sum_dict ={}
passOrNot = 0
tradeNo_rtn_reason_print = []
while i <= xDay:
#每次将日期更新为后一天
if i == 0:
sql_date = sql_date1.strftime('%Y%m%d')
#print (sql_date1.strftime('%Y%m%d'))
i += 1
else:
sql_date = datetime.datetime.strptime(sql_date, '%Y%m%d') + aDay
#print (sql_date.strftime('%Y%m%d'))
sql_date = sql_date.strftime('%Y%m%d') #格式转换
i += 1
if dateChoose == 1: #订单时间
#订单时间、总销量
sql_wgt = "select c.tradeNo,sum(c.orderWeight) from data_import_sales_orderno a,data_import_sales_custplace b,data_import_sales2_orderno_orderitem c where a.orderDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.custNo = b.custNo and c.orderNo = a.orderNo group by c.tradeNo"
#print (sql_wgt)
#订单时间、总销售额
sql_amt = "select c.tradeNo,sum(c.orderWeight * c.basePrice) from data_import_sales_orderno a,data_import_sales_custplace b,data_import_sales2_orderno_orderitem c where a.orderDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.custNo = b.custNo and c.orderNo = a.orderNo group by c.tradeNo"
#订单时间、总退货率、质量问题个数
elif dateChoose == 2: #发货时间 【很慢】,平均查询时间为10s左右,查询本身就很慢
#发货时间、总销量
sql_wgt = "select d.tradeNo,sum(a.realDeliWgt) from data_import_sales_displistno a,data_import_sales_orderno b,data_import_sales_custplace c,data_import_sales2_orderno_orderitem d where a.createDate1 = " + sql_date + " and a.orderNo = b.orderNo and c." + sql_ctry_prov_cty + " = '" + space_name + "' and b.custNo = c.custNo and d.orderNo = a.orderNo and d.orderItem = a.orderItem group by d.tradeNo"
#发货时间、总销售额
sql_amt = "select d.tradeNo,sum(a.prodAmt) from data_import_sales_displistno a,data_import_sales_orderno b,data_import_sales_custplace c,data_import_sales2_orderno_orderitem d where a.createDate1 = " + sql_date + " and a.orderNo = b.orderNo and c." + sql_ctry_prov_cty + " = '" + space_name + "' and b.custNo = c.custNo and d.orderNo = a.orderNo and d.orderItem = a.orderItem group by d.tradeNo"
elif dateChoose == 3: #派车履运时间(出货销账日期)
#派车履运时间、总销量
sql_wgt = "select a.tradeNo,sum(a.realWgt) from data_import_sales_loadno a,data_import_sales_custplace b where a.shipDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.custNo = b.custNo group by a.tradeNo"
#派车履运时间、总销售额
sql_amt = "select a.tradeNo,sum(a.realWgt * a.unitPrice) from data_import_sales_loadno a,data_import_sales_custplace b where a.shipDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.custNo = b.custNo group by a.tradeNo"
elif dateChoose == 4: #派车履运时间(结算时间)
#派车履运时间、总销量
sql_wgt = "select a.tradeNo,sum(a.realWgt) from data_import_sales_loadno a,data_import_sales_custplace b where a.settleDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.custNo = b.custNo group by a.tradeNo"
#派车履运时间、总销售额
sql_amt = "select a.tradeNo,sum(a.realWgt * a.unitPrice) from data_import_sales_loadno a,data_import_sales_custplace b where a.settleDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.custNo = b.custNo group by a.tradeNo"
elif dateChoose == 5: #装车通知时间
#装车通知时间、总销量
sql_wgt = "select c.tradeNo,sum(c.realWgt) from data_import_sales_collectno a,data_import_sales_custplace b,data_import_sales_loadno c where a.effectDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and c.custNo = b.custNo and a.collectNo = c.collectNo group by c.tradeNo"
#装车通知时间、总销售额
sql_amt = "select c.tradeNo,sum(c.realWgt * c.unitPrice) from data_import_sales_collectno a,data_import_sales_custplace b,data_import_sales_loadno c where a.effectDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and c.custNo = b.custNo and a.collectNo = c.collectNo group by c.tradeNo"
elif dateChoose == 6: #订单存货档建立时间 ######## 数据导的不全,需要重新导这个表
#订单存货档建立时间、总销量
sql_wgt = "select a.tradeNo,sum(a.labelWgt) from data_import_sales_labelno a,data_import_sales_custplace b,data_import_sales2_orderno_orderitem c where a.createDate121 = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.orderNo = c.orderNo and a.orderItem = c.orderItem and a.customerNo = b.custNo group by a.tradeNo"
#订单存货档建立时间、总销售额
sql_amt = "select a.tradeNo,sum(a.labelWgt * c.basePrice) from data_import_sales_labelno a,data_import_sales_custplace b,data_import_sales2_orderno_orderitem c where a.createDate121 = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.orderNo = c.orderNo and a.orderItem = c.orderItem and a.customerNo = b.custNo group by a.tradeNo"
elif dateChoose == 7: #质保书时间
#质保书时间、总销量
sql_wgt = "select a.tradeNo,sum(c.orderWeight) from data_import_sales_millsheetno a,data_import_sales_custplace b,data_import_sales2_orderno_orderitem c where a.reviseDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.customerNo = b.custNo and c.orderNo = a.orderNo and a.item = c.orderItem group by a.tradeNo"
#质保书时间、总销售额
sql_amt = "select a.tradeNo,sum(c.orderWeight * c.basePrice) from data_import_sales_millsheetno a,data_import_sales_custplace b,data_import_sales2_orderno_orderitem c where a.reviseDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.customerNo = b.custNo and c.orderNo = a.orderNo and a.item = c.orderItem group by a.tradeNo"
else: #外库接收时间 ######### 搞清楚 外库接收 与 派车履运 的关系,他们是互斥关系,现在需要重新导labelno表,以使得此时间可以得出结果
#外库接收时间、总销量
sql_wgt = "select c.tradeNo,sum(a.receiveWgt) from data_import_sales_receiveno a,data_import_sales_custplace b,data_import_sales_loadno c where a.updateDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and c.custNo = b.custNo and a.loadNo = c.loadNo group by c.tradeNo"
#外库接收时间、总销售额
sql_amt = "select c.tradeNo,sum(a.receiveWgt * c.unitPrice) from data_import_sales_receiveno a,data_import_sales_custplace b,data_import_sales_loadno c where a.updateDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and c.custNo = b.custNo and a.loadNo = c.loadNo group by c.tradeNo"
#总退货率、质量问题个数 不分时间
sql_rtn = "select a.tradeNo,sum(a.rtnWgt) from data_import_sales_rtnno a,data_import_sales_custplace b where a.createDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.custNo = b.custNo group by a.tradeNo"
sql_rtn_reason = "select a.rtnNo,a.orderNo,a.custNo,a.tradeNo,a.rtnWgt,a.unitPrice,a.rtnReason from data_import_sales_rtnno a,data_import_sales_custplace b where a.createDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.custNo = b.custNo"
sql_rtn_reason_count = "select a.tradeNo,a.orderNo,a.orderItem,a.rtnReason from data_import_sales_rtnno a,data_import_sales_custplace b where a.createDate = " + sql_date + " and b." + sql_ctry_prov_cty + " = '" + space_name + "' and a.custNo = b.custNo group by a.orderNo,a.orderItem,a.rtnReason"
#=====================【 求 和 存 入 字 典 】==================================
if aspect == 1 :
tradeNo_wgt_list = conn_mysql.select(sql_wgt)
weight_sum = 0
for tradeNo in tradeNo_list: #所选钢种
for tradeNo_wgt in tradeNo_wgt_list:
if tradeNo_wgt[0] == tradeNo: #如果订单中有这个钢种
weight_sum += tradeNo_wgt[1] #重量求和
else:
pass
#print ("总销量:\t",sql_date,weight_sum)
#print ("\n")
time_dict[sql_date] = weight_sum
elif aspect == 2:
tradeNo_amt_list = conn_mysql.select(sql_amt)
amount_sum = 0
for tradeNo in tradeNo_list: #所选钢种
for tradeNo_amt in tradeNo_amt_list:
if tradeNo_amt[0] == tradeNo: #如果订单中有这个钢种
amount_sum += tradeNo_amt[1] #重量求和
else:
pass
#print ("总销售额:\t",sql_date,amount_sum)
#print ("\n")
time_dict[sql_date] = amount_sum
elif aspect == 3:
#总销量
tradeNo_wgt_list = conn_mysql.select(sql_wgt)
weight_sum = 0
for tradeNo in tradeNo_list: #所选钢种
for tradeNo_wgt in tradeNo_wgt_list:
if tradeNo_wgt[0] == tradeNo: #如果订单中有这个钢种
weight_sum += tradeNo_wgt[1] #重量求和
else:
pass
#求总退货
tradeNo_rtn_list = conn_mysql.select(sql_rtn)
rtn_sum = 0
rtn_rate = 0
for tradeNo in tradeNo_list: #所选钢种
for tradeNo_rtn in tradeNo_rtn_list:
if tradeNo_rtn[0] == tradeNo: #如果订单中有这个钢种
rtn_sum += tradeNo_rtn[1] #重量求和
else:
pass
if weight_sum != 0:
rtn_rate = ( rtn_sum / weight_sum ) * 100
rtn_rate = float(str(rtn_rate)[0:8])
# print ("总退货率:\t%s%.5f" % (sql_date,rtn_rate),"%")
else:
# print ("总退货率:\t总销量为0,无法计算退货率!")
rtn_rate = "总销量为0,无法计算退货率!"
#tradeNo_rtn_rsn_list = conn_mysql.select(sql_rtn_reason)
#print ("退货原因:\t",tradeNo_rtn_rsn_list)
#print ("\n")
time_dict[sql_date] = rtn_rate
#每日的退货重量与总重量的结果存储起来
rtn_sum_dict[sql_date] = rtn_sum #每日退货重量
weight_sum_dict[sql_date] = weight_sum #每日总销量
# #每日结果存储起来
# time_dict_day['rtn_rate'] = rtn_rate
# time_dict_day['rtn_sum'] = rtn_sum
# time_dict_day['weight_sum'] = weight_sum
# #将每日结果存到一个大字典中
# time_dict_allDay[sql_date] = time_dict_day
else:
count = 0
tradeNo_rtn_reason_count_list = conn_mysql.select(sql_rtn_reason_count)
for tradeNo in tradeNo_list:
for tradeNo_rtn_count_reason in tradeNo_rtn_reason_count_list:
if tradeNo == tradeNo_rtn_count_reason[0]:
count = count + 1
#print ("质量问题个数:",sql_date,count)
time_dict[sql_date] = count
if aspect == 3 or aspect == 4:
tradeNo_rtn_reason_list = conn_mysql.select(sql_rtn_reason)
#print (tradeNo_rtn_reason_list)
for tradeNo in tradeNo_list: #所选钢种
for tradeNo_rtn_reason in tradeNo_rtn_reason_list:
if tradeNo_rtn_reason[3] == tradeNo:
tradeNo_rtn_reason_print.append(tradeNo_rtn_reason)
#print ("质量问题原因",tradeNo_rtn_reason_print)
else:
pass
if len(tradeNo_rtn_reason_print) == 0:
passOrNot = 1
else:
pass
#print (tradeNo_rtn_reason_print)
#print (passOrNot)
#如果是退货率的话,需要存储每日的退货量与总销量,以保证后续计算结果正确
if aspect == 3:
time_dict_rtn = {} #将全部结果存储到同一个dictionary中
time_dict_rtn['time_dict'] = time_dict #最原始得到的退货率
time_dict_rtn['rtn_sum_dict'] = rtn_sum_dict #退货重量
time_dict_rtn['weight_sum_dict'] = weight_sum_dict #总销量
#print (time_dict_rtn)
return time_dict_rtn,passOrNot,tradeNo_rtn_reason_print
else:
return time_dict,passOrNot,tradeNo_rtn_reason_print
#return sql_wgt,sql_amt,sql_rtn,sql_rtn_reason,sql_rtn_reason_count
| [
"787666673@qq.com"
] | 787666673@qq.com |
018d19b621c159f89c4517aa9df136159ebc55b2 | 997645d6bb9c404f2f195328f29afa0eaa3c55b4 | /profiling/run_profile.py | 9dc53e081ca3be9c68699ab3a3bd28528130a0b7 | [
"MIT"
] | permissive | piccolo-orm/piccolo | e43ea13c05c53ac00d9d20474c53ad2c49a40e80 | 83ea66323ef5a8e4010ea3ee19f34163bc881ace | refs/heads/master | 2023-08-08T19:31:37.783445 | 2023-07-28T06:19:35 | 2023-07-28T06:19:35 | 155,008,334 | 1,139 | 90 | MIT | 2023-09-08T16:54:45 | 2018-10-27T20:53:26 | Python | UTF-8 | Python | false | false | 829 | py | import asyncio
from viztracer import VizTracer
from piccolo.columns.column_types import Varchar
from piccolo.engine.postgres import PostgresEngine
from piccolo.table import Table
DB = PostgresEngine(config={"database": "piccolo_profile"})
class Band(Table, db=DB):
name = Varchar()
async def setup():
await Band.alter().drop_table(if_exists=True)
await Band.create_table(if_not_exists=True)
await Band.insert(*[Band(name="test") for _ in range(1000)])
class Trace:
def __enter__(self):
self.tracer = VizTracer(log_async=True)
self.tracer.start()
def __exit__(self, *args):
self.tracer.stop()
self.tracer.save()
async def run_queries():
await setup()
with Trace():
await Band.select()
if __name__ == "__main__":
asyncio.run(run_queries())
| [
"noreply@github.com"
] | piccolo-orm.noreply@github.com |
7f06aa3882b4fc1e0e5f3f8bc66e51bcb16b8038 | 5730e8d500a65992bb21094ffed26e21ccc7c0fd | /augment_dnase_pipeline_outputs/metadata/aggregate_ataqc.py | 2963e434753969d97146b33d89c1eb86a8843a62 | [] | no_license | kundajelab/atlas_resources | 35f1df4c09356d7256a6667700b88020396d5642 | 89bcde11921526b9956be48bf367617db4974d31 | refs/heads/master | 2021-10-25T07:01:30.127405 | 2021-10-25T00:55:25 | 2021-10-25T00:55:25 | 160,546,622 | 2 | 1 | null | null | null | null | UTF-8 | Python | false | false | 2,942 | py | import argparse
import collections
import json
import pdb
def parse_args():
parser=argparse.ArgumentParser(description="aggregate ataqc metrics for all samples in a single report")
parser.add_argument("--ataqc_files",default="/oak/stanford/groups/akundaje/projects/atlas/dnase_processed/aggregate_outputs/qc.json.txt")
parser.add_argument("--outf",default="atlas.metadata.report.txt")
parser.add_argument("--mitra_prefix",default="http://mitra.stanford.edu/kundaje/projects/atlas/")
parser.add_argument("--prefix_to_drop_for_oak",default="/oak/stanford/groups/akundaje/projects/atlas/")
parser.add_argument("--hash_to_id",default="/oak/stanford/groups/akundaje/projects/atlas/dnase_processed/processed_all.txt")
parser.add_argument("--fname_hash_index",type=int,default=9)
return parser.parse_args()
def flatten(d, parent_key='', sep='.'):
items = []
for k, v in d.items():
new_key = parent_key + sep + k if parent_key else k
if isinstance(v, collections.MutableMapping):
items.extend(flatten(v, new_key, sep=sep).items())
else:
items.append((new_key, v))
return dict(items)
def iterate_json(data,val_dict,all_keys,cur_id):
flat_data=flatten(data)
for key in flat_data:
if key not in all_keys:
all_keys.add(key)
val_dict[cur_id][key]=flat_data[key]
return val_dict,all_keys
def main():
args=parse_args()
ataqc_files=open(args.ataqc_files,'r').read().strip().split('\n')
val_dict=dict()
all_keys=set([])
outf=open(args.outf,'w')
hash_to_id=open(args.hash_to_id,'r').read().strip().split('\n')
hash_to_id_dict=dict()
for line in hash_to_id:
tokens=line.split('\t')
cur_hash=tokens[0]
cur_id=tokens[1]
hash_to_id_dict[cur_hash]=cur_id
for fname in ataqc_files:
with open(fname,'r') as cur_f:
data=json.load(cur_f)
#get the report title
report_title=fname.replace(args.prefix_to_drop_for_oak,args.mitra_prefix).replace(".json",".html")
#get the hash
cur_hash=fname.split('/')[args.fname_hash_index]
cur_id=hash_to_id_dict[cur_hash]
print(cur_id+" : "+report_title)
val_dict[cur_id]=dict()
val_dict[cur_id]['path']=report_title
all_keys.add('path')
#iterate through the json file recursively
val_dict,all_keys=iterate_json(data,val_dict,all_keys,cur_id)
outf.write('Dataset')
all_keys=list(all_keys)
for key in all_keys:
outf.write('\t'+key)
outf.write('\n')
for dataset in val_dict:
outf.write(dataset)
for key in all_keys:
if key in val_dict[dataset]:
outf.write('\t'+str(val_dict[dataset][key]))
else:
outf.write('\tNA')
outf.write('\n')
outf.close()
if __name__=="__main__":
main()
| [
"annashcherbina@gmail.com"
] | annashcherbina@gmail.com |
59344cfbae1c333672ea43675c4735706ee9ee76 | 3089066acea6edac48ad1fd4a48c958cc7fc8049 | /src/training/mlp.py | 4e80ecedc29891163fe1abcd5cc0095aac2b6eae | [] | no_license | kevinkoste/university-load-forecasting | a527e52e009916fe7d7b230cbc39d379c45b6b0e | 0498a3886582a96f89348498bc412655c7b0bfe2 | refs/heads/main | 2023-08-03T09:24:27.108126 | 2021-01-21T04:04:22 | 2021-01-21T04:04:22 | 171,188,408 | 6 | 2 | null | 2023-07-06T21:27:06 | 2019-02-18T00:21:27 | Python | UTF-8 | Python | false | false | 2,573 | py | import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
def DayAheadMLP(endog, exog, date,
lags=range(1,169),
hoursAhead=38,
epochs=200,
activation='relu',
optimizer='adam',
loss='mse',
verbose=0):
"""
Trains a fresh MLP and returns a day-ahead forecast
endog(pd.Series): Series (usually corresponding to a cluster) of hourly indexed load data
exog(pd.DataFrame): DataFrame of covariates if applicable
date(date-like obj): Hour after which to begin 38-hour-ahead forecast
lags(List): List of lag features to generate (default=range(1,169))
hoursAhead(int): number of hours ahead to predict (default=38)
epochs(int): number of epochs for training (default=200)
activation(str): key for activation function (default='relu')
optimizer(str): key for optimizer (default='adam')
loss(str): key for loss function (default='mse')
"""
# force DataFrame dtype for y, copy X
y = pd.DataFrame(endog)
X = exog.copy(deep=True)
testDate = pd.to_datetime(date)
# scale y (0,1) on annual min and max, important assumption
scaler = MinMaxScaler().fit(y)
y = pd.DataFrame(data=scaler.transform(y), index=y.index, columns=y.columns)
for i in lags:
X['t-'+str(i)] = y.iloc[:,0].shift(i)
for j in range(1,38):
y['t+'+str(j)] = y.iloc[:,0].shift(-j)
# truncate on both sides to remove NaNs
X.dropna(inplace=True)
y = y.reindex(X.index, axis=0).dropna()
X = X.reindex(y.index, axis=0).dropna()
# train/test split, train range includes all available data up to two days prior to test date
y_train = y.loc[y.index < testDate-pd.Timedelta(days=2)].values
X_train = X.loc[X.index < testDate-pd.Timedelta(days=2)].values
X_test = X.loc[X.index == testDate].values
# set input and hidden layer dimensions
inputDim = X_train.shape[1]
hiddenDim = (inputDim-38)//2 + 38
# define model based on hyperparameters
model = Sequential()
model.add(Dense(hiddenDim, activation=activation, input_dim=inputDim))
model.add(Dense(38))
model.compile(optimizer=optimizer, loss=loss)
# fit the model and make a prediction
model.fit(X_train, y_train, epochs=epochs)
y_pred = model.predict(X_test, verbose=0)
# return result after reverse scaling
return scaler.inverse_transform(y_pred).flatten()
| [
"kevin.koste@yale.edu"
] | kevin.koste@yale.edu |
44c07e30ca5523015f24e844a3fdda7a79daddbf | 9fbb987c920cafaaf3a0c5aa8b8ac2a8abfaa887 | /Eat/eat_mt/yts/html_get.py | c990abd4ce4b9781e8ecd83e6c00ceb34b94560d | [] | no_license | lwd1132438569/Data_baby | 11f82a488bad86d46780b4a9df3de6b7c325ea27 | 94a068302555635325b43608b0e3e955e0196864 | refs/heads/master | 2021-01-23T07:37:51.833744 | 2017-09-18T09:47:37 | 2017-09-18T09:47:37 | 86,433,465 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,858 | py | # -*- coding: utf-8 -*-
import requests
import time
import random
import sys
# from imp import reload
#
# reload(sys)
# sys.setdefaultencoding('utf-8')
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
'Accept':'*/*',
'Accept-Language':'zh-CN,zh;q=0.8',
'Connection':'keep-alive',
'Referer':'https://item.jd.com/3219817.html'
}
cookie = {
'unpl':'V2_ZzNtbRBeQhciCxUAKE5YBmIARQ0SAkMccVgUVisQWQYzUBtdclRCFXMUR1FnGFoUZwIZXkRcQhdFCHZXchBYAWcCGllyBBNNIEwHDCRSBUE3XHxcFVUWF3RaTwEoSVoAYwtBDkZUFBYhW0IAKElVVTUFR21yVEMldQl2VH0RVQZvABRdQ2dzEkU4dlJ4Gl4MYzMTbUNnAUEpC0RRexxcSGcFGlRBX0ATdQl2VUsa',
'__jdv':'122270672|baidu-pinzhuan|t_288551095_baidupinzhuan|cpc|0f3d30c8dba7459bb52f2eb5eba8ac7d_0_c803f2bebf5242faad185ac3a842eb81|1491532024032',
'ipLoc-djd':'1-72-2799-0',
'ipLocation':'%u5317%u4EAC',
'user-key':'e0dd75a9-a9a1-4b83-a107-cafa54043b74',
'cn':'0',
'__jda':'122270672.1798292710.1491532023.1491532023.1491532024.1',
'__jdb':'122270672.14.1798292710|1.1491532024',
'__jdc':'122270672',
'__jdu':'1798292710'
}
url1 = "http://i.meituan.com/poi/6374048/feedbacks/page_"
ran_num = random.sample(range(214), 214)
for i in ran_num:
a = ran_num[0]
if i == a:
i = str(i)
url = (url1 + i)
r = requests.get(url = url,headers = headers,cookies=cookie)
# r = requests.get(url=url, headers=headers, cookies=cookie)
html = r.content
else:
i = str(i)
url = (url1 + i)
r = requests.get(url=url, headers=headers,cookies=cookie)
html2 = r.content
html = html + html2
time.sleep(5)
print("当前抓取页面" + url + "状态" + str(r))
html = str(html)
file = open("D:\\yts.txt", "w")
file.write(html)
file.close() | [
"1132438569@qq.com"
] | 1132438569@qq.com |
0ce8d2ab48fab5b95445e205d1b406f8dbfdb76e | 0ba1393b6c472000ccd16297915843377fb16338 | /venv/space_ship.py | 85bc8ee70126af92a544cee64f742a2a749dc44c | [] | no_license | Gautham116006/Alien_Invasion1 | 5fa8d6916b2a119d736b4cdfe48983f85dced728 | e3f47db90b1e99e2f1b69b3c948a992ede1f756d | refs/heads/master | 2022-12-11T14:15:07.358962 | 2020-09-11T18:06:53 | 2020-09-11T18:06:53 | 294,343,421 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,282 | py | import pygame
class Ship():
def __init__(self,game_settings,screen):
# initialize the ship and set it's starting position
self.screen = screen
self.game_settings = game_settings
#load ship image and get its rectangle
self.image = pygame.image.load("Include\images\space_ship.jpeg")
self.ship_rect = self.image.get_rect()
self.screen_rect = self.screen.get_rect()
#start each ship at bottom centre of screen
self.ship_rect.centerx = self.screen_rect.centerx
self.ship_rect.bottom = self.screen_rect.bottom
#store a decimal value for the ships center
self.center = float(self.ship_rect.centerx)
self.moving_right = False
self.moving_left = False
def update(self):
if self.moving_right == True:
if self.ship_rect.centerx<=1050:
self.center+= self.game_settings.ship_speed
elif self.moving_left == True:
if self.ship_rect.centerx >= 50 :
self.center -= self.game_settings.ship_speed
# update rectangle from self.center
self.ship_rect.centerx = self.center
def blitme(self):
#draw ship at current location
self.screen.blit(self.image,self.ship_rect)
| [
"63862992+Gautham116006@users.noreply.github.com"
] | 63862992+Gautham116006@users.noreply.github.com |
fbce3d599059e069660f8427732a950cda10ff90 | 27046ec5d4d644ca099e4e6b3e711a9fe1f210bb | /part_2_train.py | a2197dfa0ad5367098150ab440e595fc0f32affd | [] | no_license | RobertFielding/fraud-pandas-plotly | d5d9405f967fbbef00164aefe7a96912c296ea58 | 2d8eaaa3f7014a9de8e6c7c085b506dcfcb5fab5 | refs/heads/master | 2023-03-25T19:14:12.238219 | 2021-03-14T13:23:31 | 2021-03-14T13:23:31 | 342,892,256 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,500 | py | import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import roc_curve, roc_auc_score
from sklearn.model_selection import train_test_split
import numpy as np
data_filename = 'creditcard.csv'
df = pd.read_csv(data_filename)
train, test = train_test_split(df, test_size=0.2)
train_features, train_labels = train.iloc[:, :-1], train.iloc[:, -1]
test_features, test_labels = test.iloc[:, :-1], test.iloc[:, -1]
# Configure Random Forest Classifier, then train and test
rf_classifer = RandomForestRegressor(max_depth=4, random_state=0)
rf_classifer = rf_classifer.fit(train_features, train_labels)
rf_predictions = rf_classifer.predict(test_features)
# Make rf_df dataframe
test["Prediction Percentile"] = rf_predictions
## Performance metrics
# ROC and auc
rf_fpr, rf_tpr, _ = roc_curve(test_labels, test["Prediction Percentile"])
rf_auc = roc_auc_score(test_labels, test["Prediction Percentile"], multi_class='ovr')
np.savetxt("ROC_rf_fpr", rf_fpr)
np.savetxt("ROC_rf_tpr", rf_tpr)
with open("ROC_rf_auc.txt", mode='w') as f:
f.write(str(rf_auc))
# Plot ROC Curve
plt.plot(rf_fpr, rf_tpr, label="Random Forest ROC Curve")
# plt.show()
# Distribution of prediction scores
test["Label"] = "Genuine"
test.loc[test["Class"] == 1, "Label"] = "Fraud"
for data_type in ["Genuine", "Fraud"]:
sns.histplot(data=test[test["Label"] == data_type],
common_norm=False,
x="Prediction Percentile",
stat="density",
)
plt.title(data_type + "_Predictions")
# plt.show()
plt.savefig(f"Figures/Random_Forest_{data_type}.png")
plt.clf()
test.loc[test["Label"] == "Fraud", "Amount"].sum()
## Creation of scorecard
score_df = test[["Label", "Amount", "Prediction Percentile"]]
score_df["Genuine Volume"] = (score_df["Label"] == "Genuine").astype(int)
score_df["Fraud Volume"] = (score_df["Label"] == "Fraud").astype(int)
score_df["Genuine Amount"] = np.where(score_df["Label"] == "Genuine", score_df["Amount"], 0)
score_df["Fraud Amount"] = np.where(score_df["Label"] == "Fraud", score_df["Amount"], 0)
scorecard = (score_df[["Genuine Volume", "Fraud Volume", "Genuine Amount", "Fraud Amount"]]
.groupby((100 * score_df["Prediction Percentile"]).astype(int))
.sum())
scorecard = scorecard.reindex(range(0, 100, 1), fill_value=0)
scorecard = scorecard[::-1].cumsum()[::-1]
pd.DataFrame.to_csv(scorecard, "Scorecard.csv")
| [
"robert.fielding@hotmail.co.uk"
] | robert.fielding@hotmail.co.uk |
f8de786a0f3c8b0ba99882fe7407050b11316930 | 55b57d64ec547869835334318f3059fbb507558c | /Fred2/Data/pssms/tepitopepan/mat/DRB5_0111_9.py | fd2bb78b87e863070732f2fef744ff47908e3877 | [
"BSD-3-Clause"
] | permissive | FRED-2/Fred2 | 9845f6678d4011cb746c7a5a6f283eea68077a02 | b3e54c8c4ed12b780b61f74672e9667245a7bb78 | refs/heads/master | 2021-07-12T05:05:54.515427 | 2020-05-25T06:56:25 | 2020-05-25T06:56:25 | 16,275,425 | 42 | 35 | null | 2021-07-07T12:05:11 | 2014-01-27T10:08:11 | Python | UTF-8 | Python | false | false | 2,095 | py | DRB5_0111_9 = {0: {'A': -999.0, 'E': -999.0, 'D': -999.0, 'G': -999.0, 'F': -0.004754, 'I': -0.99525, 'H': -999.0, 'K': -999.0, 'M': -0.99525, 'L': -0.99525, 'N': -999.0, 'Q': -999.0, 'P': -999.0, 'S': -999.0, 'R': -999.0, 'T': -999.0, 'W': -0.004754, 'V': -0.99525, 'Y': -0.004754}, 1: {'A': 0.0, 'E': 0.1, 'D': -1.3, 'G': 0.5, 'F': 0.8, 'I': 1.1, 'H': 0.8, 'K': 1.1, 'M': 1.1, 'L': 1.0, 'N': 0.8, 'Q': 1.2, 'P': -0.5, 'S': -0.3, 'R': 2.2, 'T': 0.0, 'W': -0.1, 'V': 2.1, 'Y': 0.9}, 2: {'A': 0.0, 'E': -1.2, 'D': -1.3, 'G': 0.2, 'F': 0.8, 'I': 1.5, 'H': 0.2, 'K': 0.0, 'M': 1.4, 'L': 1.0, 'N': 0.5, 'Q': 0.0, 'P': 0.3, 'S': 0.2, 'R': 0.7, 'T': 0.0, 'W': 0.0, 'V': 0.5, 'Y': 0.8}, 3: {'A': 0.0, 'E': -1.2876, 'D': -1.8782, 'G': -1.5864, 'F': -0.56917, 'I': 1.2917, 'H': -1.3705, 'K': -1.69, 'M': 1.6918, 'L': 0.60019, 'N': -1.6785, 'Q': -0.69644, 'P': -1.4887, 'S': -0.4961, 'R': -1.6837, 'T': 0.29244, 'W': -1.3798, 'V': 1.0861, 'Y': -0.57262}, 4: {'A': 0.0, 'E': 0.0, 'D': 0.0, 'G': 0.0, 'F': 0.0, 'I': 0.0, 'H': 0.0, 'K': 0.0, 'M': 0.0, 'L': 0.0, 'N': 0.0, 'Q': 0.0, 'P': 0.0, 'S': 0.0, 'R': 0.0, 'T': 0.0, 'W': 0.0, 'V': 0.0, 'Y': 0.0}, 5: {'A': 0.0, 'E': -2.0, 'D': -2.0, 'G': -0.30001, 'F': -1.7, 'I': -1.4, 'H': -1.2, 'K': -1.5, 'M': -1.5, 'L': -1.0, 'N': -1.3, 'Q': -1.4, 'P': 0.19998, 'S': -0.49997, 'R': -1.3, 'T': -0.79998, 'W': -1.7, 'V': -1.3, 'Y': -1.0}, 6: {'A': 0.0, 'E': -0.89606, 'D': -1.4918, 'G': 0.58996, 'F': 1.4949, 'I': 1.2005, 'H': 1.1907, 'K': 0.88503, 'M': 0.41266, 'L': 0.61161, 'N': 0.50177, 'Q': 0.68943, 'P': -0.59131, 'S': -0.1948, 'R': 1.2786, 'T': 0.29867, 'W': 0.39933, 'V': -0.29253, 'Y': 1.1918}, 7: {'A': 0.0, 'E': 0.0, 'D': 0.0, 'G': 0.0, 'F': 0.0, 'I': 0.0, 'H': 0.0, 'K': 0.0, 'M': 0.0, 'L': 0.0, 'N': 0.0, 'Q': 0.0, 'P': 0.0, 'S': 0.0, 'R': 0.0, 'T': 0.0, 'W': 0.0, 'V': 0.0, 'Y': 0.0}, 8: {'A': 0.0, 'E': -0.60069, 'D': -1.4932, 'G': 0.39612, 'F': 1.1915, 'I': 1.1912, 'H': 0.98443, 'K': 2.6667, 'M': 0.50264, 'L': 1.283, 'N': -0.0088368, 'Q': 0.69103, 'P': -0.79719, 'S': 0.70285, 'R': 2.4734, 'T': -0.20486, 'W': -0.70351, 'V': -0.19682, 'Y': 1.2852}} | [
"schubert@informatik.uni-tuebingen.de"
] | schubert@informatik.uni-tuebingen.de |
b03da968a1665b5afb8ffa3fc0d43782537fb80b | 8669dde5ed094cc597b2d7e1768cfba94a432d50 | /lib_sarscov2.py | 3a27c1f5bda74eb200cdbbffc90215511b2337f4 | [
"MIT"
] | permissive | Campeanu/COVID-19 | 22bc69a81b24cbed5afe75db715f316fb5f6494e | ee2442b24e30406d57646e6387ca7a970f9cd162 | refs/heads/master | 2021-05-26T22:07:35.435709 | 2020-04-09T09:51:08 | 2020-04-09T09:51:08 | 254,173,432 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,310 | py | # Asn or Asp / B AAU, AAC; GAU, GAC
# Gln or Glu / Z CAA, CAG; GAA, GAG
# START AUG
translation_table = """Ala / A GCU, GCC, GCA, GCG
Ile / I AUU, AUC, AUA
Arg / R CGU, CGC, CGA, CGG; AGA, AGG
Leu / L CUU, CUC, CUA, CUG; UUA, UUG
Asn / N AAU, AAC
Lys / K AAA, AAG
Asp / D GAU, GAC
Met / M AUG
Phe / F UUU, UUC
Cys / C UGU, UGC
Pro / P CCU, CCC, CCA, CCG
Gln / Q CAA, CAG
Ser / S UCU, UCC, UCA, UCG; AGU, AGC
Glu / E GAA, GAG
Thr / T ACU, ACC, ACA, ACG
Trp / W UGG
Gly / G GGU, GGC, GGA, GGG
Tyr / Y UAU, UAC
His / H CAU, CAC
Val / V GUU, GUC, GUA, GUG
STOP UAA, UGA, UAG
""".strip()
dec = {}
for t in translation_table.split("\n"):
k = t[:len("Val / V") ].strip()
v = t[ len("Val / V"):]
if '/' in k:
k = k.split("/")[-1].strip()
k = k.replace("STOP", "*")
v = v.replace(",", "").replace(";", "").lower().replace("u", "t").split(" ")
for vv in v:
if vv in dec:
print("dup", vv)
dec[vv.strip()] = k # !!!!
def translate(x, protein=False):
x = x.lower()
aa = []
for i in range(0, len(x)-2, 3):
aa.append(dec[x[i:i+3]])
aa = ''.join(aa)
if protein:
if aa[0] != "M" or aa[-1] != "*":
print("BAD PROTEIN")
print(aa)
return None
aa = aa[:-1]
return aa.split("*") # !!! | [
"campeanu.it@yahoo.com"
] | campeanu.it@yahoo.com |
883d9dc211bbc3f3eed188ffcb37ceb8e89ab2b4 | 60bd2e1cce82fc831f029def9c507e3cde2e2bc5 | /Vezba1/Zadatak8.py | e7ce8940ccffc4bd9c19caada5705e991ea4f42b | [] | no_license | AndjelaStevanovic/GIS_programiranje_domaci | 427b2910b848d1404f31dd050b693f539fca971f | bcff3a6d9df0388a049920ed6f74181580f4fc16 | refs/heads/master | 2021-05-13T11:44:34.004144 | 2018-01-11T18:31:21 | 2018-01-11T18:31:21 | 117,137,457 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 760 | py | #Zadatak 8 - Vezba 1
# -*- coding: utf-8 -*-
import random
broj_pogadjanja = 0
print('Zdravo! Kako se zoves?')
ime = raw_input()
broj = random.randint(0, 100)
while broj_pogadjanja < 10:
print('Uneti broj:')
pogadjanje = input()
pogadjanje = int(pogadjanje)
broj_pogadjanja = broj_pogadjanja + 1
if pogadjanje < broj:
print('Uneti broj je manji od zamisljenog broj.')
if pogadjanje > broj:
print('Broj je veci od zamisljenog broja.')
if pogadjanje == broj:
break
if pogadjanje == broj:
broj_pogadjanja = str(broj_pogadjanja)
print('Bravo, ' + ime + '! Pogodili ste broj iz ' + broj_pogadjanja + ' pokusaja!')
if pogadjanje!= broj:
broj = str(broj)
print('Pogresili ste. Zamisljeni broj je: ' + broj) | [
"andjelastevanovic@ymail.com"
] | andjelastevanovic@ymail.com |
58950f55ea5a2b7fae6b323bfc181434c02aaaee | 305d25e1d2084761e889057077706b1ba3f9122d | /nmigen_boards/arty_z7.py | ba432b642cc9588c44c7e5037b12b600668f5a6b | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | nicolas-robin/nmigen-boards | d7d8fe29d788f8b1fdcf8da0cf7202a1f0fa741a | 6fc91b491214b80c56b2b2d031da1a50c7254c56 | refs/heads/master | 2020-12-10T15:43:43.358008 | 2020-01-17T21:54:48 | 2020-01-17T21:54:48 | 233,314,458 | 0 | 0 | NOASSERTION | 2020-01-12T00:01:57 | 2020-01-12T00:01:57 | null | UTF-8 | Python | false | false | 5,359 | py | import os
import subprocess
from nmigen.build import *
from nmigen.vendor.xilinx_7series import *
from .resources import *
__all__ = ["ArtyZ720Platform"]
class ArtyZ720Platform(Xilinx7SeriesPlatform):
device = "xc7z020"
package = "clg400"
speed = "1"
default_clk = "clk125"
resources = [
Resource("clk125", 0,
Pins("H16", dir="i"), Clock(125e6), Attrs(IOSTANDARD="LVCMOS33")),
*SwitchResources(
pins="M20 M19",
attrs=Attrs(IOSTANDARD="LVCMOS33")),
RGBLEDResource(0,
r="N15", g="G17", b="L15", # LD4
attrs=Attrs(IOSTANDARD="LVCMOS33")),
RGBLEDResource(1, # LD5
r="M15", g="L14", b="G14",
attrs=Attrs(IOSTANDARD="LVCMOS33")),
*LEDResources(
pins="R14 P14 N16 M14",
attrs=Attrs(IOSTANDARD="LVCMOS33")),
*ButtonResources(
pins="D19 D20 L20 L19",
attrs=Attrs(IOSTANDARD="LVCMOS33")),
Resource("audio", 0,
Subsignal("pwm", Pins("R18", dir="o")),
Subsignal("sd", PinsN("T17", dir="o")),
Attrs(IOSTANDARD="LVCMOS33")),
Resource("crypto_sda", 0, # ATSHA204A
Pins("J15", dir="io"),
Attrs(IOSTANDARD="LVCMOS33")),
Resource("hdmi_rx", 0, # J10
Subsignal("cec", Pins("H17", dir="io")),
Subsignal("clk", DiffPairs("N18", "P19", dir="i"),
Attrs(IO_TYPE="TMDS_33")),
Subsignal("d", DiffPairs("V20 T20 N20", "W20 U20 P20", dir="i"),
Attrs(IO_TYPE="TMDS_33")),
Subsignal("hpd", Pins("T19", dir="o")),
Subsignal("scl", Pins("U14", dir="io")),
Subsignal("sda", Pins("U15", dir="io")),
Attrs(IOSTANDARD="LVCMOS33")),
Resource("hdmi_tx", 0, # J11
Subsignal("cec", Pins("G15", dir="io")),
Subsignal("clk", DiffPairs("L16", "L17", dir="o"),
Attrs(IO_TYPE="TMDS_33")),
Subsignal("d", DiffPairs("K17 K19 J18", "K18 J19 H18", dir="o"),
Attrs(IO_TYPE="TMDS_33")),
Subsignal("hpd", PinsN("R19", dir="i")),
Subsignal("scl", Pins("M17", dir="io")),
Subsignal("sda", Pins("M18", dir="io")),
Attrs(IOSTANDARD="LVCMOS33"))
]
connectors = [
Connector("pmod", 0, "Y18 Y19 Y16 Y17 - - U18 U19 W18 W19 - -"), # JA
Connector("pmod", 1, "Y14 W14 T10 T11 - - W16 V16 W13 V12 - -"), # JB
Connector("ck_io", 0, {
# Outer Digital Header
"io0": "T14",
"io1": "U12",
"io2": "U13",
"io3": "V13",
"io4": "V15",
"io5": "T15",
"io6": "R16",
"io7": "U17",
"io8": "V17",
"io9": "V18",
"io10": "T16",
"io11": "R17",
"io12": "P18",
"io13": "N17",
# Inner Digital Header
"io26": "U5",
"io27": "V5",
"io28": "V6",
"io29": "U7",
"io30": "V7",
"io31": "U8",
"io32": "V8",
"io33": "V10",
"io34": "W10",
"io35": "W6",
"io36": "Y6",
"io37": "Y7",
"io38": "W8",
"io39": "Y8",
"io40": "W9",
"io41": "Y9",
# Outer Analog Header as Digital IO
"a0": "Y11",
"a1": "Y12",
"a2": "W11",
"a3": "V11",
"a4": "T5",
"a5": "U10",
# Inner Analog Header as Digital IO
"a6": "F19",
"a7": "F20",
"a8": "C20",
"a9": "B20",
"a10": "B19",
"a11": "A20",
# Misc.
"a": "Y13"
}),
Connector("ck_spi", 0, {
"miso": "W15",
"mosi": "T12",
"sck": "H15",
"ss": "F16"
}),
Connector("ck_i2c", 0, {
"scl": "P16",
"sda": "P15"
}),
Connector("xadc", 0, {
# Outer Analog Header
"vaux1_n": "D18",
"vaux1_p": "E17",
"vaux9_n": "E19",
"vaux9_p": "E18",
"vaux6_n": "J14",
"vaux6_p": "K14",
"vaux15_n": "J16",
"vaux15_p": "K16",
"vaux5_n": "H20",
"vaux5_p": "J20",
"vaux13_n": "G20",
"vaux13_p": "G19",
# Inner Analog Header
"vaux12_n": "F20",
"vaux12_p": "F19",
"vaux0_n": "B20",
"vaux0_p": "C20",
"vaux8_n": "A20",
"vaux8_p": "B19"
})
]
def toolchain_program(self, products, name, **kwargs):
xc3sprog = os.environ.get("XC3SPROG", "xc3sprog")
with products.extract("{}.bit".format(name)) as bitstream_filename:
subprocess.run([xc3sprog, "-c", "jtaghs1_fast", "-p", "1", bitstream_filename], check=True)
if __name__ == "__main__":
from .test.blinky import *
ArtyZ720Platform().build(Blinky(), do_program=True)
| [
"whitequark@whitequark.org"
] | whitequark@whitequark.org |
8c7c442705664c9f9d05136d7029682ac4793785 | f14e95cb9df97570759699092c171743cc3e00c8 | /keyword_dreamvector.py | 640e1af4adea2f876c3a6dfc69225b8957163131 | [] | no_license | DallasAutumn/ChinaDream | b92b5de62a0973988b9673e120e8dac5bcf6050d | 2d6c6f45290add74d4daf02f2c2f51e9b4d69c92 | refs/heads/master | 2020-06-17T18:51:30.657908 | 2019-05-16T07:54:03 | 2019-05-16T07:54:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 79,760 | py | # -*- coding: utf-8 -*-
"""
-------------------------------
Time : 2019-04-09 16:19
Author : diw
Email : di.W@hotmail.com
File : keyword_dreamvector.py
Desc: 构建中国梦向量
-------------------------------
"""
import warnings
import math
warnings.filterwarnings("ignore")
from sklearn.metrics.cluster import calinski_harabaz_score
import pandas as pd
import numpy as np
from pandas.plotting import parallel_coordinates
import matplotlib.pyplot as plt
import matplotlib.collections
from sklearn.cluster import KMeans
from sklearn import metrics
from sklearn.manifold import TSNE
import seaborn as sns
from sklearn.mixture import GaussianMixture
from sklearn.decomposition import PCA
from sklearn.cluster import SpectralClustering
from mpl_toolkits.mplot3d import Axes3D #3D图表需要使用“mpl_toolkits”模块
import random
plt.rcParams['font.family'] = ['Arial Unicode MS'] #用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False #用来正常显示负号
dreamvector_list = {}
def merge_list(list1,list2):
temp_list = []
for i in range(len(list1)):
temp_list.append(list1[i] + list2[i])
return temp_list
def province_dic(province_list, keyword_location):
#output_dic['省份'] = {'keyword_name': [(sorted according to city list)]}
output_dic = {}
for current_location,current_location_list in keyword_location.items():
for current_province in province_list:
if(current_province in current_location):
if(current_province not in output_dic.keys()):
output_dic[current_province] = current_location_list
break
else:
temp_list = merge_list(output_dic[current_province],current_location_list)
output_dic[current_province] = temp_list
break
else:
continue
return output_dic
def keyword_province_emotion(province_list,keyword_location_emotion):
#output_dic['keyword_name'] = {'省份': [(sorted according to emotion list)]}
output_dic = {}
for current_keyword,current_keyword_dic in keyword_location_emotion.items():
output_dic[current_keyword] = {}
for current_location,current_location_emotion_list in current_keyword_dic.items():
for current_province in province_list:
if(current_province in current_location):
if(current_province not in output_dic[current_keyword].keys()):
output_dic[current_keyword][current_province] = current_location_emotion_list
break
else:
temp_list = merge_list(output_dic[current_keyword][current_province],current_location_emotion_list)
output_dic[current_keyword][current_province] = temp_list
break
else:
continue
return output_dic
# result_dic['keyword'] = [省1,省2,...,省31,情感0,情感1,情感3,情感4,情感5,]
def generate_dreamvector(keyword_list, province_list,keyword_province,emotion_list,keyword_location_emotion):
result_dic = {}
for current_keyword in keyword_list:
result_dic[current_keyword] = []
# 省份数据
for current_province in province_list:
result_dic[current_keyword].append(keyword_province[current_province][keyword_list.index(current_keyword)])
for current_emotion in emotion_list:
result_dic[current_keyword].append(keyword_location_emotion[current_keyword][current_province][emotion_list.index(current_emotion)])
return result_dic
def read_keyword_location_emotion(keyword_location_emotion_file):
with open(keyword_location_emotion_file) as f:
return_dic = eval(f.read())
return return_dic
# 将按省提及次数转成百分比 将情感值转为百分比
def dreamvector_dic_topercent(province_list,emotion_list,dreamvector_dic):
dreamvector_percent_dic = {}
for current_keyword,current_original_dreamvector in dreamvector_dic.items():
dreamvector_percent_dic[current_keyword] = []
province_num = len(province_list)
emotion_num = len(emotion_list)
current_province_total = 0
current_emotion_total = 0
for i in range(province_num):
current_province_total += current_original_dreamvector[i]
for i in range(emotion_num):
current_emotion_total += current_original_dreamvector[i+province_num]
for i in range(province_num):
dreamvector_percent_dic[current_keyword].append(float(current_original_dreamvector[i])/current_province_total)
for i in range(emotion_num):
dreamvector_percent_dic[current_keyword].append(float(current_original_dreamvector[i+province_num])/current_emotion_total)
# print(dreamvector_percent_dic)
return dreamvector_percent_dic
def draw_parallel_coordinate(dreamvector_dataframe,n_cluster):
plt.rcParams['figure.figsize'] = (16, 8) # 设置figure_size尺寸
plt.figure()
# plt.title(str(n_cluster) + '_classes')
parallel_coordinates(dreamvector_dataframe,'聚类类别',colormap='hsv')
plt.savefig('result/dreamvector/parallel_coordinates' + str(n_cluster) + '_cluster' + '.png')
plt.show()
def imple_kmeans(dreamvector_dataframe,k):
model = KMeans(n_clusters=k, n_jobs=4) # 分为k类,并发数4
model.fit(dreamvector_dataframe) # 开始聚类
# 简单打印结果
r1 = pd.Series(model.labels_).value_counts() # 统计各个类别的数目
r2 = pd.DataFrame(model.cluster_centers_) # 找出聚类中心
r = pd.concat([r2, r1], axis=1) # 横向连接(0是纵向),得到聚类中心对应的类别下的数目
r.columns = list(dreamvector_dataframe.columns) + [u'类别数目'] # 重命名表头
# print(r)
# 详细输出原始数据及其类别
r = pd.concat([dreamvector_dataframe, pd.Series(model.labels_, index=dreamvector_dataframe.index)], axis=1) # 详细输出每个样本对应的类别
r.columns = list(dreamvector_dataframe.columns) + [u'聚类类别'] # 重命名表头
ch_index = calinski_harabaz_score(r.iloc[:, 0:-1], r['聚类类别'])
print(str(k) + ' class calinski_harabaz_score:' + str(ch_index))
show_pca(r,2,k)
# show_pca(r,3,k)
# show_tsne(r,2,k)
# show_tsne(r,3,k)
# draw_parallel_coordinate(r,k)
return ch_index
def imple_GMM(dreamvector_dataframe,k):
model = GaussianMixture(n_components=k) # 分为k类,并发数4
model.fit(dreamvector_dataframe) # 开始聚类
# 简单打印结果
labels = model.predict(dreamvector_dataframe)
# print(r)
# 详细输出原始数据及其类别
dreamvector_dataframe['聚类类别'] = labels
ch_index = calinski_harabaz_score(dreamvector_dataframe.iloc[:,0:-1], labels)
print(str(k)+' class calinski_harabaz_score:' +str(ch_index))
show_pca(dreamvector_dataframe,2,k)
show_pca(dreamvector_dataframe,3,k)
show_tsne(dreamvector_dataframe,2,k)
show_tsne(dreamvector_dataframe,3,k)
draw_parallel_coordinate(dreamvector_dataframe,k)
return ch_index
def imple_SpectralClustering(dreamvector_dataframe,k):
model = SpectralClustering(n_clusters=k) # 分为k类, 使用默认的高斯核
# 简单打印结果
labels = model.fit_predict(dreamvector_dataframe)
# print(r)
# 详细输出原始数据及其类别
dreamvector_dataframe['聚类类别'] = labels
ch_index = calinski_harabaz_score(dreamvector_dataframe.iloc[:,0:-1], labels)
print(str(k) + ' class calinski_harabaz_score:' +str(ch_index))
show_pca(dreamvector_dataframe,2,k)
show_pca(dreamvector_dataframe,3,k)
show_tsne(dreamvector_dataframe,2,k)
show_tsne(dreamvector_dataframe,3,k)
draw_parallel_coordinate(dreamvector_dataframe,k)
return ch_index
def show_pca(dreamvector_dataframe,num_components,n_cluster):
pca = PCA(n_components=num_components)
newData = pca.fit_transform(dreamvector_dataframe.iloc[:,0:-1])
print(pca.explained_variance_ratio_)
pca_data = pd.DataFrame(newData,index=dreamvector_dataframe._stat_axis.values.tolist())
pca_data['class'] = dreamvector_dataframe['聚类类别']
#2d
if(num_components==2):
# 不同类别用不同颜色和样式绘图
plt.rcParams['figure.figsize'] = (8, 6) # 设置figure_size尺寸
# hue指色彩,是散点不同颜色的来源
# print(pca_data)
# plt.title(str(n_cluster) + '_classes')
dream_list = dreamvector_dataframe._stat_axis.values.tolist()
plt.scatter(pca_data.iloc[:, 0], pca_data.iloc[:, 1], c=pca_data['class'], cmap='hsv', linewidth=0.65)
for i in range(len(dreamvector_dataframe['聚类类别'])):
random_x = -1 + 2*np.random.random()
random_y = -1 + 2*np.random.random()
if(dream_list[i] == '祖国强大'):
plt.annotate(dream_list[i], xy=(pca_data.iloc[i, 0], pca_data.iloc[i, 1]),
xytext=(-(45 + random_x), +(5 + random_y)), textcoords='offset points') # 这里xy是需要标记
elif(dream_list[i] == '生活幸福' or dream_list[i] == '白手起家' or dream_list[i] == '发展机会' ):
plt.annotate(dream_list[i], xy=(pca_data.iloc[i, 0], pca_data.iloc[i, 1]), xytext=(-(45+random_x),-(5+random_y)),textcoords='offset points') # 这里xy是需要标记
elif(dream_list[i] == '出名'):
plt.annotate(dream_list[i], xy=(pca_data.iloc[i, 0], pca_data.iloc[i, 1]),
xytext=(-(25 + random_x), -(5 + random_y)), textcoords='offset points') # 这里xy是需要标记
elif (dream_list[i] == '好工作'):
plt.annotate(dream_list[i], xy=(pca_data.iloc[i, 0], pca_data.iloc[i, 1]),
xytext=(+(3 + random_x), +(5 + random_y)), textcoords='offset points') # 这里xy是需要标记
else:
plt.annotate(dream_list[i], xy=(pca_data.iloc[i, 0], pca_data.iloc[i, 1]), xytext=(+(3+random_x),+(2+random_y)),textcoords='offset points') # 这里xy是需要标记
plt.grid(True)
plt.savefig('result/dreamvector/pca_2d_'+str(n_cluster)+'cluster'+'.png')
plt.show()
elif(num_components==3):
# 3d
plt.rcParams['figure.figsize'] = (8, 4) # 设置figure_size尺寸
fig = plt.figure('3D scatter plot')
ax = fig.add_subplot(111, projection='3d') # 3d图需要加projection='3d'
# ax.set_title(str(n_cluster) + '_classes')
# print(pca_data)
ax.scatter(pca_data.iloc[:, 0], pca_data.iloc[:, 1], pca_data.iloc[:, 2], c=pca_data['class'], cmap='hsv', label = '')
plt.savefig('result/dreamvector/pca_3d_'+str(n_cluster)+'cluster'+'.png')
plt.show()
def show_tsne(dreamvector_dataframe,num_components,n_cluster):
tsne = TSNE(n_components=num_components)
#:表示所有行
# print(dreamvector_dataframe.iloc[:,0:-1])
tsne.fit(dreamvector_dataframe.iloc[:,0:-1])
tsne = pd.DataFrame(tsne.embedding_, index=dreamvector_dataframe.iloc[:,0:-1].index) # 转换数据格式
tsne['class'] = dreamvector_dataframe['聚类类别']
# print(tsne)
#2d
if (num_components == 2):
# 不同类别用不同颜色和样式绘图
plt.rcParams['figure.figsize'] = (8, 6) # 设置figure_size尺寸
# hue指色彩,是散点不同颜色的来源
# print(pca_data)
# plt.title(str(n_cluster) + '_classes')
dream_list = dreamvector_dataframe._stat_axis.values.tolist()
plt.scatter(tsne.iloc[:, 0], tsne.iloc[:, 1], c=tsne['class'], cmap='hsv', linewidth=0.65)
for i in range(len(dreamvector_dataframe['聚类类别'])):
random_int = random.randint(1,2)
plt.annotate(dream_list[i], xy=(tsne.iloc[i, 0], tsne.iloc[i, 1]), xytext=(+(3+random_int), +(2+random_int)),textcoords='offset points') # 这里xy是需要标记
plt.grid(True)
plt.savefig('result/dreamvector/tsne_2d_'+str(n_cluster)+'cluster'+'.png')
plt.show()
#3d
elif(num_components==3):
plt.rcParams['figure.figsize'] = (8, 4) # 设置figure_size尺寸
fig = plt.figure('3D scatter plot')
ax = fig.add_subplot(111, projection='3d') # 3d图需要加projection='3d'
# ax.set_title(str(n_cluster) + '_classes')
# print(pca_data)
ax.scatter(tsne.iloc[:, 0], tsne.iloc[:, 1], tsne.iloc[:, 2], c=tsne['class'], cmap='hsv')
plt.savefig('result/dreamvector/tsne_3d_'+str(n_cluster)+'cluster'+'.png')
plt.show()
# output_dic['dream'] = {'province_shang':x,'emotion_shang':y}
def province_emotion_shang(dreamvector_dic,province_number,emotion_number):
output_dic = {}
for current_dream,current_dreamvector in dreamvector_dic.items():
output_dic[current_dream] = {}
temp_total_province = 0
temp_total_emotion = 0
for i in range(province_number):
temp_total_province += current_dreamvector[i]
for j in range(emotion_number):
temp_total_emotion += current_dreamvector[j+province_number]
#calc shang
province_shang = 0.0
emotion_shang = 0.0
for i in range(province_number):
p_i = float(current_dreamvector[i])/temp_total_province
if (p_i != 0):
province_shang -= p_i * math.log(p_i, 2)
else:
continue
for j in range(emotion_number):
p_i = float(current_dreamvector[j+province_number]) / temp_total_emotion
if(p_i != 0):
emotion_shang -= p_i * math.log(p_i, 2)
else:
continue
output_dic[current_dream]['province_shang'] = province_shang
output_dic[current_dream]['emotion_shang'] = emotion_shang
print(output_dic)
return output_dic
if __name__=='__main__':
keyword_location_emotion_file = 'data/city_keyword_emotion/result.txt'
keyword_list = ['健康','事业有成','发展机会','生活幸福','有房','出名','家庭幸福','好工作','平等机会','白手起家','成为富人','个体自由','安享晚年','收入足够','个人努力','祖国强大','中国经济持续发展','父辈更好']
emotion_list = ['愤怒', '厌恶', '高兴', '悲伤', '恐惧']
# keyword_emotion = {'健康': {'3': 10431113, '2': 26792199, '4': 2580746, '0': 4043353, '-1': 1177096, '1': 2913965}, '事业有成': {'2': 182625, '3': 93729, '-1': 2200, '0': 9446, '1': 10420, '4': 1338}, '发展机会': {'1': 35078, '2': 240583, '3': 25407, '4': 102948, '0': 30883, '-1': 1673}, '生活幸福': {'2': 5620765, '3': 2260554, '0': 107260, '1': 210780, '4': 598263, '-1': 76305}, '有房': {'2': 585255, '4': 23221, '0': 239103, '1': 88429, '3': 242650, '-1': 20816}, '出名': {'1': 179269, '0': 265398, '2': 779865, '-1': 45724, '3': 176544, '4': 53626}, '家庭幸福': {'0': 30577, '2': 898104, '1': 46120, '-1': 13928, '3': 334588, '4': 67132}, '好工作': {'2': 361045, '0': 61684, '1': 42414, '3': 224019, '-1': 10240, '4': 16839}, '平等机会': {'0': 6292, '2': 28517, '1': 13302, '3': 7778, '4': 18844, '-1': 532}, '白手起家': {'2': 99983, '1': 14435, '0': 6935, '4': 3537, '3': 51325, '-1': 2124}, '成为富人': {'0': 4720, '2': 27105, '4': 4514, '3': 6976, '1': 2062, '-1': 241}, '个体自由': {'4': 186214, '2': 13971, '-1': 499, '0': 2549, '3': 2767, '1': 25807}, '安享晚年': {'3': 22815, '0': 4039, '2': 13059, '1': 4846, '-1': 1116, '4': 503}, '收入足够': {'1': 2521, '2': 8989, '0': 2120, '3': 2275, '4': 3063, '-1': 69}, '个人努力': {'2': 59979, '3': 89586, '4': 6187, '-1': 794, '0': 1407, '1': 4688}, '祖国强大': {'2': 8334, '3': 5633, '0': 2391, '4': 1845, '1': 508, '-1': 547}, '中国经济持续发展': {'2': 2323, '4': 1208, '0': 470, '1': 308, '3': 47, '-1': 11}, '父辈更好': {'2': 571, '3': 234, '0': 142, '4': 329, '1': 28, '-1': 4}}
keyword_location = {'广西 河池': [34951, 240, 410, 7301, 796, 1125, 752, 427, 36, 127, 28, 127, 27, 4, 123, 7, 1, 0], '海外 澳大利亚': [139477, 486, 833, 12435, 8290, 5497, 1722, 1730, 161, 336, 147, 263, 99, 46, 249, 60, 4, 7], '上海 黄浦区': [295300, 1473, 4089, 41795, 6505, 9633, 4385, 3692, 584, 1001, 246, 890, 217, 141, 446, 82, 44, 8], '北京 朝阳区': [572916, 3518, 6255, 81276, 13588, 19765, 10366, 9809, 1132, 2572, 493, 1868, 628, 317, 1030, 288, 80, 16], '香港': [143944, 649, 1028, 24400, 3405, 4914, 2478, 2298, 105, 780, 73, 586, 113, 69, 467, 33, 6, 3], '福建 福州': [349113, 1873, 2532, 45366, 7770, 10950, 5684, 5747, 417, 1113, 184, 837, 443, 105, 843, 126, 18, 11], '北京 西城区': [157549, 860, 1717, 23223, 4102, 5511, 2946, 2640, 292, 506, 136, 731, 241, 83, 223, 120, 50, 6], '台湾 台北市': [155328, 881, 1587, 26565, 3159, 5228, 4144, 1979, 191, 481, 99, 425, 112, 45, 1512, 26, 3, 8], '陕西 宝鸡': [63239, 395, 623, 12628, 1246, 1721, 1255, 758, 107, 176, 27, 178, 60, 26, 94, 26, 2, 4], '山东 潍坊': [171208, 1253, 2028, 33911, 3693, 5869, 3546, 2237, 298, 636, 150, 476, 117, 70, 282, 72, 6, 4], '湖南 岳阳': [55835, 434, 477, 11540, 1146, 1772, 1317, 992, 59, 186, 37, 144, 94, 12, 129, 15, 2, 0], '安徽 宣城': [33665, 205, 295, 6904, 1478, 1197, 712, 470, 37, 97, 16, 246, 28, 8, 56, 16, 3, 0], '广西 百色': [36106, 233, 428, 6837, 697, 1157, 719, 470, 42, 99, 24, 109, 32, 21, 69, 3, 0, 0], '上海': [430581, 2254, 4031, 64763, 13047, 14617, 7498, 6007, 676, 1862, 334, 3226, 394, 219, 3409, 179, 62, 5], '河南': [158716, 1769, 1405, 26426, 3128, 4097, 3225, 1902, 221, 621, 86, 522, 189, 47, 1011, 56, 7, 2], '吉林 辽源': [77223, 311, 500, 10425, 956, 1381, 1005, 534, 50, 126, 30, 151, 30, 10, 85, 16, 1, 1], '北京': [778117, 4084, 6362, 120671, 20783, 21292, 13514, 9334, 1557, 3351, 504, 5744, 569, 280, 1427, 349, 98, 18], '海南 其他': [102273, 951, 1181, 25059, 2189, 3352, 2316, 1162, 178, 313, 54, 347, 57, 43, 205, 38, 2, 4], '山西 太原': [174466, 994, 1254, 28274, 3811, 5299, 3137, 2715, 288, 761, 123, 444, 164, 56, 308, 109, 13, 6], '广西 南宁': [251500, 1695, 1913, 30559, 5489, 8055, 4265, 3765, 277, 761, 138, 557, 379, 90, 724, 76, 13, 9], '吉林 长春': [221334, 1285, 1712, 36709, 5082, 6984, 4442, 3294, 305, 904, 125, 835, 227, 63, 411, 85, 12, 6], '广东 惠州': [150596, 896, 1136, 22540, 3425, 4224, 2994, 1884, 123, 608, 62, 664, 202, 51, 424, 42, 2, 5], '广东 深圳': [935347, 5658, 8358, 143264, 27775, 28338, 17221, 13364, 1197, 3888, 718, 7655, 1000, 501, 1399, 323, 88, 25], '重庆 双桥区': [26859, 159, 208, 5324, 533, 531, 601, 288, 38, 47, 15, 132, 5, 7, 525, 3, 1, 0], '澳门 其他': [254931, 1783, 3462, 52939, 5922, 8668, 5284, 2971, 499, 709, 237, 1372, 126, 113, 720, 36, 4, 7], '广东 广州': [1365479, 6989, 10207, 259708, 77454, 42558, 23903, 19309, 1910, 5233, 834, 39344, 1817, 1029, 2787, 488, 105, 40], '辽宁 大连': [318460, 1467, 5317, 97195, 6292, 7909, 13249, 4109, 312, 1040, 119, 702, 236, 104, 404, 141, 673, 4], '山东 泰安': [60007, 373, 433, 10541, 1550, 1939, 1163, 919, 80, 229, 40, 158, 47, 18, 90, 21, 4, 4], '新疆 克拉玛依': [25856, 182, 276, 5758, 527, 886, 595, 339, 29, 71, 17, 90, 25, 6, 36, 8, 1, 0], '浙江 杭州': [689010, 3028, 6573, 120690, 30310, 20954, 11646, 12647, 839, 3266, 328, 10244, 698, 264, 3820, 248, 56, 20], '上海 杨浦区': [90582, 517, 863, 13068, 1995, 3780, 1559, 1724, 165, 282, 68, 366, 91, 56, 118, 55, 19, 8], '江苏 苏州': [417830, 2465, 2495, 63523, 9712, 13547, 7595, 6553, 510, 2112, 255, 1250, 434, 159, 1147, 172, 32, 18], '陕西 渭南': [61832, 345, 519, 11116, 1021, 1571, 1112, 720, 73, 175, 29, 145, 47, 16, 218, 23, 1, 0], '河北 石家庄': [268452, 1259, 2006, 42243, 6894, 7054, 5528, 3894, 318, 917, 157, 644, 275, 74, 456, 105, 19, 10], '北京 通州区': [65576, 398, 494, 10401, 1685, 1809, 1171, 787, 83, 786, 39, 398, 49, 20, 100, 28, 2, 1], '山东 青岛': [303463, 1523, 3141, 46543, 6178, 10308, 5656, 4802, 366, 1246, 185, 832, 388, 105, 558, 177, 24, 8], '广东 东莞': [289156, 2047, 2223, 36912, 4448, 7837, 5336, 3498, 252, 1165, 136, 709, 276, 78, 367, 81, 10, 6], '河南 新乡': [87852, 447, 607, 13179, 1584, 2232, 1492, 1151, 118, 317, 45, 217, 70, 13, 171, 32, 8, 1], '辽宁 沈阳': [341588, 1779, 2031, 48575, 6851, 9141, 5771, 5146, 421, 1324, 197, 843, 326, 102, 500, 156, 21, 4], '河北 邯郸': [88468, 556, 721, 15372, 1914, 2565, 1882, 1191, 91, 483, 46, 247, 84, 44, 197, 42, 10, 2], '湖南 长沙': [377151, 1856, 3033, 56963, 7819, 11668, 8253, 14722, 489, 1225, 226, 1185, 554, 115, 487, 179, 42, 10], '其他': [4808645, 30822, 30241, 849805, 114819, 143278, 97633, 73268, 6006, 17868, 1985, 19544, 4338, 1526, 14872, 2076, 318, 126], '辽宁': [121723, 631, 894, 27676, 2839, 3430, 2828, 1521, 106, 485, 72, 403, 79, 43, 999, 56, 7, 0], '天津 红桥区': [27529, 652, 288, 5622, 605, 889, 537, 414, 36, 81, 15, 99, 18, 14, 51, 13, 0, 0], '山西 吕梁': [40664, 289, 414, 8935, 801, 1178, 820, 465, 65, 160, 19, 117, 26, 17, 128, 15, 0, 1], '四川 成都': [689723, 3372, 4793, 91777, 14275, 23892, 14198, 12013, 1100, 2502, 377, 1955, 963, 276, 1063, 303, 62, 31], '北京 昌平区': [67752, 414, 625, 13119, 1896, 2316, 1287, 1056, 103, 284, 38, 426, 69, 28, 126, 32, 9, 2], '贵州 贵阳': [121518, 822, 1061, 21458, 2648, 4485, 2413, 1992, 184, 505, 65, 347, 137, 46, 298, 53, 11, 4], '北京 东城区': [866491, 4761, 9322, 139938, 19459, 26592, 16079, 11406, 2976, 2798, 594, 2834, 879, 358, 2061, 390, 476, 22], '河北 保定': [100833, 768, 831, 17555, 2298, 3095, 2126, 1571, 147, 510, 80, 282, 106, 23, 251, 50, 5, 7], '河北 唐山': [119516, 698, 798, 18747, 2554, 3192, 2763, 1668, 157, 431, 81, 289, 136, 29, 145, 46, 6, 3], '江苏 无锡': [221325, 1120, 1598, 33709, 5474, 7483, 3832, 3674, 280, 980, 113, 1279, 234, 64, 618, 71, 22, 8], '江西': [103211, 609, 720, 18531, 2299, 2896, 2072, 1443, 110, 307, 45, 399, 90, 29, 772, 47, 3, 0], '重庆 九龙坡区': [36002, 187, 263, 6093, 842, 1427, 590, 691, 45, 119, 20, 161, 42, 5, 64, 17, 1, 4], '北京 怀柔区': [31234, 275, 245, 6749, 880, 864, 620, 388, 39, 71, 12, 307, 19, 16, 47, 8, 1, 0], '黑龙江 黑河': [33198, 244, 347, 7360, 774, 1030, 687, 409, 60, 99, 24, 122, 16, 11, 89, 11, 1, 0], '浙江 台州': [113047, 721, 890, 19531, 2379, 3692, 1988, 1891, 142, 489, 59, 302, 101, 46, 183, 45, 8, 4], '湖北 武汉': [529992, 3239, 4559, 96880, 11419, 18088, 9989, 10974, 907, 2134, 396, 1688, 692, 205, 851, 224, 44, 29], '重庆 沙坪坝区': [73638, 393, 464, 8848, 1114, 2418, 1032, 1224, 93, 203, 36, 190, 77, 18, 136, 37, 5, 5], '山东 东营': [67493, 351, 504, 12683, 1200, 1985, 1415, 1068, 92, 205, 33, 236, 60, 17, 128, 25, 2, 2], '北京 海淀区': [403345, 2221, 6725, 68724, 10279, 16898, 8547, 8606, 2238, 1707, 388, 1748, 478, 275, 818, 266, 226, 32], '海外 美国': [251744, 1386, 2527, 29116, 5826, 14286, 4337, 4633, 868, 1221, 247, 842, 271, 180, 632, 168, 20, 12], '安徽': [114225, 666, 927, 19002, 2672, 3259, 2129, 1864, 3082, 470, 57, 443, 124, 35, 3051, 49, 8, 4], '重庆 涪陵区': [25432, 117, 160, 4326, 395, 647, 394, 260, 18, 56, 14, 77, 21, 11, 33, 7, 0, 0], '海外 加拿大': [77423, 470, 674, 10697, 1944, 4632, 1474, 1457, 174, 327, 70, 272, 104, 36, 134, 56, 6, 2], '江苏 南京': [516864, 3800, 3471, 77543, 12261, 18265, 9939, 9244, 888, 1744, 336, 1913, 680, 187, 2059, 248, 184, 23], '浙江 宁波': [282669, 1597, 1723, 43045, 18808, 8216, 4669, 5819, 324, 1006, 129, 1853, 330, 81, 1220, 164, 17, 7], '北京 丰台区': [105782, 626, 839, 16739, 2739, 3537, 2013, 1608, 160, 367, 84, 517, 136, 34, 135, 62, 9, 5], '安徽 六安': [40628, 262, 382, 7632, 999, 1322, 837, 619, 49, 152, 24, 196, 51, 12, 156, 24, 0, 0], '广东 中山': [135528, 839, 1189, 20898, 2452, 4052, 2892, 1770, 164, 669, 56, 442, 133, 39, 188, 43, 5, 3], '青海 西宁': [66552, 508, 761, 13605, 4309, 2146, 1329, 892, 87, 185, 37, 170, 51, 22, 350, 21, 5, 3], '河北 秦皇岛': [79960, 497, 695, 14220, 1663, 2355, 1467, 1112, 184, 297, 53, 236, 46, 26, 120, 27, 3, 4], '山东 济南': [305884, 1757, 2349, 47560, 6631, 9468, 5398, 4966, 517, 1114, 204, 708, 359, 104, 786, 166, 41, 15], '山东 威海': [65580, 390, 599, 10939, 1426, 2150, 1217, 810, 77, 205, 56, 184, 59, 20, 83, 29, 2, 1], '湖南 邵阳': [44742, 291, 494, 8548, 938, 1332, 932, 616, 63, 176, 37, 150, 39, 15, 67, 19, 2, 1], '上海 浦东新区': [243752, 1282, 2769, 35702, 6705, 10051, 4271, 4136, 500, 976, 246, 890, 302, 145, 325, 127, 37, 9], '香港 东区': [4918, 21, 48, 1066, 104, 207, 83, 65, 11, 26, 1, 12, 8, 8, 9, 2, 3, 0], '上海 徐汇区': [164137, 887, 1758, 29683, 3446, 5623, 2762, 2590, 247, 630, 108, 504, 218, 72, 221, 72, 13, 6], '宁夏 银川': [128799, 860, 1257, 29263, 2724, 3510, 2493, 1591, 159, 370, 90, 335, 96, 47, 359, 43, 6, 2], '北京 崇文区': [48565, 281, 403, 8873, 1374, 1485, 909, 537, 69, 130, 15, 366, 40, 16, 73, 24, 0, 2], '贵州 黔西南': [43200, 335, 456, 9624, 809, 1255, 866, 463, 88, 113, 21, 135, 30, 15, 167, 12, 2, 0], '江苏 常州': [145786, 748, 1037, 20813, 2587, 4696, 2512, 1979, 152, 443, 93, 380, 179, 313, 195, 61, 3, 2], '福建 莆田': [105647, 642, 948, 17938, 2086, 3293, 2056, 1172, 113, 324, 42, 366, 85, 26, 384, 28, 4, 0], '海外 韩国': [69878, 234, 389, 5781, 799, 3657, 741, 1113, 72, 235, 52, 89, 40, 13, 61, 18, 2, 0], '辽宁 盘锦': [41924, 289, 361, 8267, 919, 1183, 819, 477, 56, 160, 33, 112, 22, 10, 102, 19, 4, 0], '湖北 宜昌': [75149, 466, 595, 12693, 1427, 2500, 1370, 1080, 79, 258, 42, 194, 76, 27, 108, 32, 7, 1], '陕西 榆林': [54989, 388, 545, 10580, 1157, 1412, 1092, 655, 85, 188, 27, 129, 67, 19, 83, 26, 2, 1], '江苏 泰州': [68740, 459, 567, 15322, 1516, 2219, 1314, 924, 76, 286, 31, 170, 84, 15, 424, 27, 6, 2], '重庆': [190197, 895, 1268, 28705, 6603, 6390, 2740, 2627, 211, 669, 83, 3177, 157, 57, 399, 65, 12, 3], '上海 闵行区': [104495, 617, 1030, 15159, 2524, 4392, 1918, 1676, 183, 380, 74, 352, 167, 43, 136, 39, 11, 2], '浙江 温州': [236704, 1325, 1560, 31795, 4646, 7003, 3865, 3231, 271, 1141, 147, 520, 264, 85, 677, 53, 7, 7], '广东 汕头': [276803, 1354, 1382, 36753, 3593, 7148, 4250, 2601, 171, 707, 87, 506, 197, 51, 336, 43, 7, 4], '江苏 盐城': [78866, 552, 728, 13829, 1684, 2893, 1474, 1105, 103, 310, 45, 210, 86, 45, 405, 42, 6, 3], '天津': [146414, 858, 1012, 24635, 3903, 4325, 2613, 1905, 199, 488, 73, 1109, 163, 54, 620, 70, 12, 3], '贵州 遵义': [71507, 497, 706, 14156, 1538, 2394, 1489, 941, 99, 265, 43, 252, 86, 24, 228, 34, 1, 0], '上海 嘉定区': [52788, 327, 465, 8513, 1109, 1893, 1063, 735, 63, 215, 27, 199, 59, 17, 75, 15, 4, 2], '广东 江门': [147461, 869, 1110, 44222, 13904, 3815, 2686, 1904, 114, 797, 52, 8387, 151, 123, 818, 21, 6, 2], '福建': [173048, 1088, 1565, 31922, 3791, 5345, 3432, 1895, 203, 615, 67, 733, 155, 173, 426, 63, 5, 2], '浙江 绍兴': [114815, 738, 943, 19826, 2805, 4039, 2206, 1864, 125, 431, 63, 385, 124, 44, 189, 45, 4, 0], '黑龙江 哈尔滨': [265306, 1528, 1621, 41407, 5786, 8227, 4746, 3943, 361, 1255, 148, 630, 263, 84, 530, 110, 9, 11], '广东 河源': [76547, 532, 682, 13569, 1546, 2070, 1588, 860, 60, 208, 39, 226, 49, 15, 97, 23, 1, 0], '天津 武清区': [26218, 184, 231, 5125, 528, 689, 548, 304, 28, 78, 14, 68, 18, 9, 30, 7, 0, 1], '福建 漳州': [111568, 725, 1137, 20924, 1990, 3976, 2173, 1362, 142, 385, 79, 347, 119, 37, 1469, 34, 3, 3], '广东': [485558, 3645, 3686, 81986, 17836, 13620, 8640, 5222, 574, 1846, 280, 5945, 437, 218, 1460, 169, 23, 8], '河北 张家口': [51922, 359, 459, 10692, 1072, 1551, 1077, 662, 64, 181, 32, 146, 49, 22, 107, 25, 0, 1], '北京 石景山区': [43856, 340, 429, 9048, 1360, 1555, 877, 614, 91, 152, 36, 370, 38, 26, 68, 23, 4, 1], '江苏': [247518, 1146, 1640, 32951, 4339, 7268, 3945, 2943, 274, 724, 136, 717, 246, 555, 1010, 121, 9, 5], '山东 烟台': [111711, 895, 703, 17860, 2362, 3737, 2121, 1772, 167, 448, 82, 269, 103, 48, 154, 43, 9, 9], '内蒙古 包头': [59706, 403, 514, 11815, 1291, 1843, 1245, 830, 76, 200, 34, 203, 40, 32, 118, 26, 2, 4], '湖南 娄底': [36916, 400, 387, 7827, 813, 1138, 879, 583, 45, 149, 27, 119, 33, 10, 227, 17, 3, 0], '西藏 林芝': [42080, 284, 548, 9262, 874, 1309, 815, 432, 83, 128, 31, 129, 18, 19, 68, 13, 1, 0], '西藏 拉萨': [52142, 345, 591, 11686, 1107, 1651, 1086, 676, 80, 161, 33, 170, 43, 16, 138, 12, 3, 2], '山东': [211107, 1188, 1908, 37232, 4556, 6190, 4032, 2705, 311, 1159, 148, 756, 168, 71, 608, 93, 19, 5], '山西 运城': [55037, 397, 523, 10204, 1177, 1602, 1096, 709, 62, 235, 35, 150, 42, 25, 84, 16, 5, 2], '新疆 哈密': [27013, 194, 299, 6099, 626, 874, 578, 290, 82, 88, 19, 85, 19, 9, 48, 9, 1, 0], '海南 海口': [194471, 1413, 1937, 36800, 4501, 6041, 3710, 2573, 717, 611, 122, 615, 151, 104, 1451, 84, 10, 6], '青海 玉树': [40663, 331, 508, 9615, 885, 1364, 884, 439, 65, 129, 35, 143, 19, 11, 60, 5, 0, 1], '广西 柳州': [104400, 608, 802, 15154, 1944, 2988, 1712, 1315, 153, 283, 59, 269, 100, 43, 1318, 34, 1, 2], '湖南': [130348, 576, 953, 20112, 2339, 3292, 2184, 2262, 163, 394, 52, 426, 119, 36, 598, 55, 10, 1], '湖北': [148340, 904, 1137, 27056, 2975, 4112, 2579, 2075, 244, 507, 71, 491, 151, 60, 542, 55, 8, 1], '重庆 渝中区': [52696, 257, 505, 8363, 1368, 2120, 900, 735, 69, 203, 38, 407, 43, 20, 133, 21, 2, 1], '安徽 合肥': [260311, 1590, 1801, 41364, 8265, 7751, 5089, 4585, 1260, 875, 146, 1908, 347, 82, 396, 101, 14, 8], '安徽 阜阳': [48550, 361, 487, 10351, 1230, 1568, 1048, 754, 58, 196, 38, 202, 57, 26, 116, 23, 2, 2], '上海 长宁区': [87964, 603, 843, 13077, 1959, 3382, 1595, 1546, 152, 267, 65, 313, 87, 34, 121, 50, 8, 3], '海外 其他': [263663, 1261, 1548, 27139, 4798, 12458, 4050, 5364, 469, 1057, 183, 628, 324, 84, 1577, 154, 11, 12], '河南 安阳': [61691, 339, 446, 12050, 1296, 1630, 1354, 886, 95, 249, 31, 160, 123, 15, 100, 26, 0, 1], '宁夏 吴忠': [81228, 656, 1117, 19399, 1800, 2490, 1906, 861, 113, 249, 68, 311, 51, 36, 217, 22, 1, 1], '浙江 嘉兴': [133837, 783, 943, 23511, 2792, 4768, 2227, 1842, 169, 434, 75, 344, 173, 50, 180, 42, 12, 7], '北京 大兴区': [59798, 315, 478, 10510, 1655, 1646, 1100, 789, 82, 215, 31, 384, 58, 21, 100, 25, 3, 1], '上海 静安区': [74115, 450, 904, 12207, 1989, 3225, 1382, 1299, 145, 296, 53, 267, 82, 41, 111, 30, 20, 4], '黑龙江 绥化': [38124, 279, 331, 7897, 780, 1200, 810, 404, 35, 131, 20, 128, 35, 9, 58, 22, 2, 0], '广东 珠海': [138299, 770, 1311, 21891, 2801, 4308, 3218, 2191, 169, 481, 71, 427, 144, 44, 536, 43, 7, 4], '山东 菏泽': [48336, 312, 409, 8682, 1103, 1312, 942, 649, 78, 187, 23, 132, 77, 14, 82, 18, 7, 0], '河北': [146272, 770, 1184, 25332, 3032, 4058, 2698, 1607, 148, 466, 65, 548, 108, 308, 544, 63, 3, 2], '四川 宜宾': [35879, 235, 314, 6411, 743, 1254, 807, 482, 50, 148, 15, 93, 37, 7, 107, 13, 0, 4], '江西 宜春': [69692, 498, 558, 14932, 1364, 1923, 1515, 802, 70, 183, 38, 199, 67, 11, 126, 21, 1, 3], '陕西 西安': [462430, 2601, 3251, 71889, 10681, 13241, 8305, 8257, 710, 1770, 291, 1149, 579, 162, 979, 256, 36, 19], '河南 开封': [59237, 360, 456, 10109, 1079, 1494, 1167, 764, 71, 215, 31, 143, 113, 19, 337, 26, 3, 3], '海外 荷兰': [5821, 28, 53, 871, 182, 428, 105, 137, 19, 34, 2, 45, 14, 7, 7, 3, 0, 0], '海外 马来西亚': [47222, 228, 334, 6756, 719, 1491, 903, 582, 52, 132, 26, 102, 30, 10, 103, 6, 2, 0], '江苏 淮安': [60883, 381, 702, 10543, 1291, 2065, 1290, 811, 79, 224, 35, 193, 71, 18, 1134, 18, 3, 1], '山东 滨州': [246554, 1983, 3867, 58297, 5333, 9107, 5302, 3148, 447, 821, 261, 695, 67, 96, 472, 76, 1, 5], '浙江 金华': [125116, 743, 858, 18901, 2611, 3698, 2026, 1762, 177, 594, 80, 274, 128, 35, 1523, 54, 7, 4], '海外': [386207, 1658, 1817, 36186, 5823, 14187, 5004, 4993, 1104, 1121, 178, 795, 282, 134, 561, 153, 20, 13], '新疆 昌吉': [32376, 180, 289, 5980, 655, 860, 622, 366, 28, 104, 25, 88, 20, 13, 55, 9, 1, 1], '福建 厦门': [316789, 1996, 2518, 51194, 6900, 10332, 7957, 5032, 365, 1090, 186, 850, 348, 166, 755, 139, 28, 6], '广西 贵港': [33832, 249, 386, 6664, 724, 1065, 685, 456, 38, 121, 16, 139, 42, 7, 56, 12, 2, 0], '上海 普陀区': [101969, 481, 705, 12830, 1918, 3394, 1445, 1460, 121, 245, 71, 311, 92, 30, 113, 30, 8, 5], '福建 泉州': [211817, 1248, 1485, 32652, 4165, 7076, 3860, 2935, 360, 1013, 118, 489, 260, 71, 1540, 62, 11, 2], '黑龙江 鹤岗': [35192, 262, 368, 7450, 708, 1046, 766, 377, 99, 148, 19, 128, 24, 15, 49, 10, 2, 0], '辽宁 丹东': [45071, 315, 385, 8651, 942, 1496, 937, 579, 60, 145, 35, 162, 32, 8, 197, 16, 1, 2], '贵州 安顺': [40742, 350, 471, 9053, 935, 1265, 839, 437, 50, 104, 31, 165, 41, 14, 153, 10, 2, 2], '香港 其他': [349688, 2144, 3880, 62534, 7013, 11880, 6632, 4351, 425, 1128, 252, 1212, 192, 130, 487, 65, 8, 7], '天津 东丽区': [24860, 168, 271, 5265, 545, 707, 487, 320, 39, 87, 15, 75, 27, 13, 41, 6, 1, 0], '江西 上饶': [54856, 413, 489, 11200, 1194, 1815, 1187, 802, 78, 633, 41, 181, 92, 23, 182, 25, 1, 0], '浙江': [213745, 1062, 1513, 31622, 5964, 5788, 3695, 2472, 255, 842, 109, 965, 188, 70, 4082, 75, 11, 2], '甘肃 白银': [34177, 246, 329, 6968, 649, 999, 701, 329, 34, 102, 19, 107, 29, 11, 57, 14, 0, 1], '四川 雅安': [25242, 145, 240, 8802, 489, 838, 506, 343, 41, 75, 14, 62, 31, 8, 59, 15, 3, 0], '云南 大理': [38021, 263, 371, 7555, 908, 1319, 729, 518, 55, 123, 30, 131, 46, 8, 72, 11, 1, 0], '江苏 徐州': [122265, 741, 863, 18937, 2772, 3727, 2278, 1837, 168, 481, 64, 348, 138, 45, 177, 66, 9, 3], '海外 新加坡': [55390, 344, 517, 8472, 1585, 2407, 1090, 970, 101, 224, 38, 166, 57, 29, 102, 29, 3, 4], '澳门': [36508, 245, 361, 7451, 854, 1563, 798, 469, 52, 155, 29, 115, 26, 16, 215, 12, 0, 0], '北京 宣武区': [58230, 346, 492, 10949, 1690, 2108, 1172, 659, 86, 188, 42, 378, 59, 28, 82, 35, 9, 1], '黑龙江': [91395, 506, 654, 15665, 1898, 2566, 1779, 984, 126, 428, 46, 347, 75, 29, 488, 25, 5, 1], '云南': [87179, 498, 652, 14422, 1785, 2390, 1536, 1216, 87, 242, 45, 252, 98, 21, 626, 29, 3, 6], '内蒙古 呼和浩特': [86769, 521, 4428, 16602, 1920, 3101, 1667, 1253, 124, 298, 50, 252, 103, 30, 156, 41, 13, 0], '福建 南平': [79963, 521, 844, 15651, 1639, 2642, 1689, 907, 87, 251, 35, 252, 74, 19, 547, 215, 4, 0], '河南 郑州': [441159, 2629, 3741, 75959, 10092, 12416, 8881, 7525, 614, 2001, 332, 1084, 588, 164, 1434, 214, 36, 14], '青海 海东': [43128, 328, 555, 10192, 955, 1270, 945, 434, 72, 99, 32, 168, 22, 17, 118, 9, 0, 0], '山西 阳泉': [41374, 293, 449, 9183, 899, 1156, 874, 543, 55, 122, 32, 152, 24, 9, 185, 15, 0, 2], '江西 新余': [50192, 275, 422, 9172, 883, 1289, 908, 481, 67, 114, 30, 135, 35, 19, 146, 14, 1, 0], '香港 九龙城区': [14070, 81, 76, 3630, 264, 634, 219, 178, 17, 73, 10, 76, 11, 3, 188, 4, 0, 0], '山东 临沂': [96701, 506, 706, 16167, 2503, 2587, 1815, 1267, 150, 567, 41, 330, 129, 23, 217, 46, 10, 2], '河南 平顶山': [53818, 319, 676, 10197, 1089, 1481, 1084, 659, 82, 182, 35, 178, 45, 20, 83, 31, 1, 1], '河南 洛阳': [119067, 648, 723, 18717, 2247, 3347, 2096, 2326, 161, 429, 69, 233, 129, 28, 1114, 67, 11, 6], '天津 西青区': [44756, 318, 412, 9602, 1073, 1408, 999, 804, 76, 185, 24, 170, 26, 8, 306, 14, 3, 1], '上海 卢湾区': [64194, 297, 390, 7909, 1005, 1800, 802, 578, 84, 136, 26, 182, 31, 13, 61, 15, 7, 1], '四川 泸州': [37514, 225, 333, 6247, 718, 1162, 671, 487, 42, 94, 20, 124, 41, 7, 39, 17, 4, 0], '广西 来宾': [7757, 31, 39, 1668, 152, 181, 133, 75, 9, 19, 4, 33, 6, 3, 12, 2, 0, 0], '山东 枣庄': [126023, 965, 1612, 28669, 2822, 4085, 2645, 1554, 193, 432, 111, 349, 53, 44, 279, 31, 5, 3], '新疆 乌鲁木齐': [102701, 646, 949, 18558, 2326, 3468, 2537, 1646, 189, 422, 74, 528, 112, 36, 201, 70, 8, 4], '西藏 阿里': [42511, 310, 545, 10410, 941, 1393, 918, 510, 64, 124, 43, 148, 28, 17, 81, 14, 0, 2], '台湾 台中市': [11679, 32, 36, 1731, 149, 261, 160, 86, 12, 29, 4, 26, 4, 0, 4, 0, 1, 0], '北京 房山区': [58419, 430, 1534, 11503, 1513, 1436, 1167, 672, 81, 185, 29, 435, 41, 14, 462, 25, 1, 1], '上海 金山区': [35216, 237, 381, 7077, 633, 1024, 1113, 522, 31, 103, 23, 105, 41, 34, 55, 10, 2, 1], '湖北 咸宁': [36892, 276, 405, 8046, 838, 1212, 777, 488, 41, 132, 35, 128, 29, 11, 88, 12, 1, 2], '辽宁 朝阳': [38322, 267, 339, 8274, 865, 1107, 815, 466, 53, 354, 23, 129, 22, 12, 69, 21, 2, 0], '新疆 巴音郭楞': [28844, 183, 314, 5900, 687, 879, 605, 349, 34, 83, 17, 103, 16, 5, 95, 18, 3, 0], '浙江 舟山': [62813, 343, 472, 10442, 1191, 1733, 980, 685, 213, 141, 30, 167, 47, 11, 137, 28, 1, 1], '重庆 南岸区': [60230, 259, 426, 8015, 1264, 2134, 852, 986, 76, 162, 26, 344, 56, 11, 100, 22, 3, 0], '甘肃 兰州': [120602, 761, 942, 22030, 2406, 3387, 2277, 1679, 211, 418, 70, 332, 144, 48, 187, 73, 7, 8], '澳门 花地玛堂区': [12356, 53, 52, 2205, 176, 418, 139, 111, 17, 22, 4, 25, 12, 1, 176, 1, 1, 1], '北京 顺义区': [41413, 275, 348, 8654, 1254, 1219, 810, 519, 62, 107, 25, 355, 34, 19, 68, 19, 0, 0], '甘肃 酒泉': [27608, 210, 299, 6268, 711, 849, 606, 328, 37, 73, 22, 105, 25, 11, 407, 10, 0, 0], '天津 河东区': [37566, 264, 406, 7374, 910, 1318, 773, 550, 39, 168, 19, 123, 39, 14, 62, 18, 1, 1], '云南 临沧': [22724, 170, 241, 5156, 513, 711, 447, 256, 28, 63, 24, 62, 16, 11, 48, 11, 0, 0], '宁夏 固原': [79550, 670, 1033, 19077, 1723, 2444, 1743, 810, 120, 349, 58, 310, 44, 20, 519, 26, 2, 1], '陕西 汉中': [50603, 348, 494, 10122, 1004, 1436, 1022, 576, 58, 130, 51, 129, 46, 14, 154, 14, 1, 4], '河北 廊坊': [72262, 472, 641, 13117, 1602, 2174, 1338, 984, 113, 310, 59, 185, 78, 17, 118, 33, 7, 2], '天津 和平区': [100184, 512, 709, 13983, 2046, 3019, 1592, 1266, 131, 265, 58, 248, 82, 37, 130, 42, 11, 5], '山东 德州': [58940, 410, 580, 11403, 1177, 1814, 1125, 751, 78, 182, 39, 179, 45, 20, 95, 29, 10, 3], '安徽 亳州': [32887, 225, 316, 6953, 834, 1072, 667, 386, 48, 132, 18, 130, 33, 18, 59, 9, 1, 2], '湖南 株洲': [57882, 404, 479, 10081, 1248, 1824, 1158, 890, 74, 184, 31, 195, 60, 19, 91, 17, 3, 5], '上海 松江区': [59496, 369, 591, 9406, 1325, 2205, 1086, 1002, 89, 240, 41, 201, 59, 19, 98, 18, 2, 1], '山西 临汾': [52527, 374, 468, 10505, 1250, 1571, 1156, 694, 71, 194, 25, 172, 36, 26, 112, 14, 3, 1], '黑龙江 大庆': [56011, 409, 435, 11007, 1298, 1925, 1157, 854, 89, 242, 29, 172, 52, 18, 208, 27, 3, 7], '天津 宝坻区': [21217, 185, 240, 4476, 474, 597, 440, 255, 31, 62, 15, 74, 15, 8, 40, 5, 0, 0], '四川 绵阳': [62443, 377, 473, 10015, 1456, 2234, 1131, 916, 86, 245, 39, 190, 73, 20, 115, 28, 1, 2], '河南 信阳': [49669, 378, 517, 9674, 1134, 1586, 1173, 774, 89, 228, 32, 159, 64, 19, 90, 26, 1, 2], '辽宁 辽阳': [35951, 298, 337, 7454, 875, 1144, 796, 380, 48, 89, 21, 144, 21, 18, 57, 7, 5, 3], '海外 德国': [15459, 88, 164, 2116, 1080, 1116, 261, 303, 41, 65, 28, 87, 18, 7, 21, 26, 1, 1], '山东 济宁': [74154, 441, 534, 12300, 1514, 2099, 1483, 969, 120, 309, 68, 198, 65, 47, 116, 55, 6, 3], '湖北 随州': [34617, 256, 356, 7433, 749, 1055, 754, 458, 39, 111, 25, 139, 30, 9, 124, 9, 1, 1], '河南 漯河': [64936, 435, 832, 14121, 1190, 1810, 2364, 844, 186, 225, 62, 246, 101, 18, 112, 18, 2, 0], '江西 南昌': [248582, 1158, 1549, 33616, 4643, 6069, 3953, 3493, 318, 2613, 112, 995, 292, 75, 2714, 121, 16, 5], '香港 中西区': [32526, 119, 345, 4399, 492, 1375, 470, 429, 49, 133, 25, 84, 35, 31, 69, 13, 1, 1], '新疆 塔城': [22264, 167, 264, 4908, 462, 662, 456, 249, 42, 66, 8, 70, 11, 2, 38, 3, 2, 0], '吉林 松原': [46092, 349, 528, 10087, 1019, 1395, 1024, 538, 65, 128, 26, 140, 41, 19, 90, 13, 1, 0], '山西': [87331, 459, 734, 15883, 1828, 2332, 1779, 1165, 116, 328, 52, 278, 49, 33, 781, 23, 3, 1], '海外 法国': [59497, 380, 494, 10072, 1370, 3234, 1187, 1126, 121, 249, 41, 195, 56, 29, 109, 37, 3, 3], '广东 梅州': [88817, 552, 715, 14044, 1422, 2271, 1683, 1065, 64, 265, 35, 231, 62, 15, 94, 14, 2, 4], '湖南 常德': [47365, 327, 421, 8641, 1169, 1550, 977, 888, 75, 179, 30, 150, 51, 15, 89, 18, 3, 1], '天津 河北区': [30585, 199, 275, 6001, 716, 1046, 602, 425, 48, 78, 19, 122, 22, 10, 56, 13, 1, 1], '广西 桂林': [91002, 481, 625, 13352, 1727, 2660, 1517, 1355, 116, 296, 40, 232, 92, 33, 176, 35, 3, 2], '四川 南充': [53447, 262, 319, 7877, 944, 1576, 939, 808, 54, 173, 30, 118, 48, 15, 129, 14, 5, 0], '上海 崇明县': [23969, 171, 223, 5132, 464, 651, 441, 292, 38, 65, 23, 62, 17, 8, 41, 8, 0, 1], '海外 英国': [89884, 542, 897, 13679, 2336, 5382, 1740, 2204, 236, 380, 70, 292, 126, 44, 255, 58, 9, 3], '陕西 安康': [41223, 309, 440, 8934, 889, 1270, 926, 559, 45, 109, 27, 118, 41, 17, 142, 18, 1, 2], '北京 平谷区': [29610, 190, 282, 6582, 881, 824, 563, 358, 121, 85, 17, 269, 17, 10, 50, 8, 1, 1], '吉林 吉林': [82993, 479, 698, 14882, 1693, 2420, 1638, 988, 105, 293, 43, 206, 73, 29, 168, 28, 7, 1], '广东 佛山': [282547, 1631, 2160, 38985, 5479, 8844, 6426, 5485, 303, 1011, 131, 959, 351, 102, 342, 78, 16, 6], '北京 密云县': [27534, 266, 254, 6465, 861, 718, 582, 307, 23, 73, 21, 313, 17, 8, 35, 9, 0, 1], '河北 衡水': [45510, 336, 430, 12302, 1081, 1418, 885, 648, 55, 171, 34, 155, 31, 11, 80, 25, 0, 0], '江苏 宿迁': [50007, 312, 419, 9875, 1149, 1457, 917, 664, 57, 254, 49, 184, 49, 25, 617, 14, 1, 1], '四川 凉山': [22771, 146, 218, 4810, 468, 736, 462, 272, 51, 80, 20, 66, 26, 5, 40, 8, 0, 0], '四川': [143020, 782, 1031, 22441, 2730, 4776, 2603, 1805, 162, 518, 68, 477, 122, 46, 656, 62, 3, 0], '广西': [109337, 811, 1224, 19988, 2640, 3509, 2168, 1332, 127, 394, 66, 440, 116, 33, 798, 43, 0, 3], '辽宁 鞍山': [66423, 408, 512, 11559, 1347, 1893, 1251, 768, 59, 265, 48, 200, 61, 12, 221, 34, 5, 0], '重庆 江北区': [49426, 304, 476, 7808, 1188, 2017, 944, 790, 73, 202, 30, 237, 55, 20, 90, 18, 4, 2], '云南 保山': [24979, 250, 271, 5596, 534, 747, 536, 306, 29, 63, 14, 80, 20, 8, 49, 7, 2, 0], '贵州 毕节': [38508, 341, 413, 8866, 898, 1316, 841, 484, 64, 126, 35, 128, 21, 6, 929, 16, 0, 0], '湖北 荆州': [57398, 392, 534, 11647, 1279, 1933, 1247, 881, 91, 203, 35, 177, 52, 27, 122, 20, 3, 7], '陕西 咸阳': [62095, 472, 527, 12479, 1159, 1775, 1207, 838, 95, 221, 35, 165, 66, 23, 399, 22, 4, 0], '云南 昆明': [180194, 1048, 1392, 28870, 4092, 6135, 3397, 2853, 278, 1126, 147, 468, 255, 57, 311, 102, 10, 9], '上海 虹口区': [74209, 382, 694, 10960, 1853, 3168, 1389, 1275, 201, 249, 62, 273, 85, 32, 116, 30, 4, 3], '辽宁 铁岭': [38212, 288, 357, 7719, 837, 1098, 789, 412, 52, 110, 24, 137, 27, 16, 1152, 26, 3, 1], '江苏 扬州': [93457, 593, 685, 15463, 2162, 3561, 1817, 1549, 147, 288, 66, 311, 116, 30, 193, 59, 7, 0], '吉林': [80296, 508, 674, 15462, 1810, 2376, 1716, 909, 86, 246, 31, 383, 61, 18, 362, 32, 1, 0], '重庆 万州区': [73167, 259, 401, 8362, 925, 1472, 850, 661, 115, 161, 24, 140, 47, 20, 109, 114, 2, 1], '山西 长治': [46023, 341, 469, 9351, 1063, 1366, 1094, 597, 125, 156, 26, 157, 33, 15, 114, 15, 1, 0], '黑龙江 牡丹江': [43732, 339, 387, 9029, 977, 1475, 896, 610, 58, 204, 23, 145, 48, 12, 1956, 21, 1, 0], '河南 鹤壁': [30613, 231, 307, 6235, 658, 891, 653, 379, 23, 108, 25, 103, 29, 10, 122, 13, 0, 1], '四川 阿坝': [19867, 165, 217, 4499, 390, 609, 379, 218, 28, 50, 19, 72, 14, 6, 25, 3, 0, 0], '湖北 孝感': [43702, 335, 389, 9089, 883, 1273, 903, 683, 65, 156, 21, 139, 40, 16, 75, 17, 0, 2], '浙江 衢州': [52661, 345, 460, 10281, 2437, 1590, 1110, 696, 63, 144, 38, 184, 39, 18, 71, 9, 5, 1], '广东 肇庆': [141093, 682, 760, 31258, 1819, 2619, 1910, 1183, 83, 286, 39, 258, 82, 21, 116, 17, 2, 1], '湖北 襄阳': [57549, 387, 575, 11340, 1367, 2279, 1221, 949, 72, 243, 29, 180, 79, 16, 93, 29, 3, 2], '安徽 滁州': [40597, 281, 362, 7721, 864, 1216, 827, 578, 58, 121, 22, 151, 48, 13, 396, 19, 2, 1], '安徽 淮北': [33724, 232, 336, 7126, 825, 1119, 712, 465, 49, 138, 22, 129, 38, 14, 59, 16, 0, 4], '云南 怒江': [22743, 187, 255, 5212, 518, 696, 510, 256, 32, 59, 18, 76, 17, 8, 116, 3, 0, 0], '江苏 南通': [112214, 625, 752, 17550, 2262, 3603, 2601, 1909, 143, 428, 60, 306, 135, 41, 209, 47, 5, 2], '广东 湛江': [95259, 625, 858, 17006, 1899, 3022, 2061, 1378, 79, 374, 109, 295, 74, 39, 135, 25, 7, 3], '四川 乐山': [38690, 243, 320, 6552, 811, 1410, 750, 535, 59, 120, 23, 108, 37, 13, 87, 15, 2, 2], '甘肃 天水': [45220, 274, 376, 7778, 705, 1088, 763, 538, 46, 103, 19, 120, 36, 8, 936, 17, 2, 1], '重庆 渝北区': [41638, 252, 303, 5849, 912, 1768, 714, 693, 59, 141, 56, 132, 47, 10, 46, 16, 2, 3], '福建 宁德': [58859, 420, 494, 11596, 1207, 2017, 1060, 787, 81, 205, 36, 188, 66, 27, 97, 20, 4, 2], '江西 景德镇': [50283, 313, 491, 9890, 1036, 1578, 982, 590, 72, 154, 34, 197, 41, 11, 528, 17, 2, 1], '安徽 黄山': [37940, 255, 357, 8668, 1094, 1187, 875, 469, 40, 121, 21, 271, 78, 12, 849, 16, 2, 2], '天津 津南区': [22219, 167, 247, 4915, 522, 805, 863, 330, 53, 99, 18, 73, 16, 12, 39, 8, 0, 0], '湖南 永州': [49958, 335, 391, 7889, 804, 1140, 896, 531, 58, 150, 28, 128, 68, 20, 401, 14, 3, 2], '湖北 十堰': [46334, 340, 441, 9022, 1026, 1443, 1020, 768, 61, 194, 39, 125, 73, 15, 71, 22, 2, 1], '河南 商丘': [48344, 312, 429, 9192, 1138, 1415, 963, 664, 117, 203, 21, 158, 51, 13, 110, 19, 0, 1], '安徽 蚌埠': [55881, 324, 447, 10444, 1286, 1386, 948, 1107, 61, 167, 27, 251, 74, 20, 238, 16, 0, 4], '黑龙江 佳木斯': [39170, 292, 330, 7907, 852, 1285, 804, 497, 58, 166, 27, 140, 33, 13, 84, 13, 4, 1], '福建 三明': [95813, 574, 935, 17370, 1913, 2760, 2059, 1066, 111, 271, 53, 301, 127, 38, 261, 35, 2, 2], '黑龙江 伊春': [31552, 236, 344, 7319, 692, 954, 764, 359, 48, 108, 20, 119, 20, 8, 78, 10, 0, 1], '青海 海西': [39199, 308, 493, 9027, 853, 1158, 784, 385, 65, 111, 30, 121, 21, 7, 79, 15, 0, 2], '辽宁 抚顺': [52891, 304, 485, 9627, 1055, 1413, 1094, 746, 63, 135, 27, 185, 39, 14, 275, 25, 4, 0], '湖北 黄冈': [43499, 322, 441, 8925, 982, 1347, 930, 690, 57, 143, 36, 135, 39, 16, 289, 17, 2, 5], '河南 焦作': [52839, 473, 404, 9717, 1201, 1527, 1223, 729, 65, 196, 28, 126, 51, 19, 118, 28, 4, 0], '海外 日本': [114364, 515, 555, 11249, 2016, 6233, 1545, 1938, 142, 332, 45, 251, 117, 45, 162, 56, 6, 3], '甘肃 甘南': [21561, 181, 246, 5413, 437, 644, 514, 217, 36, 59, 11, 72, 10, 7, 44, 3, 0, 0], '海外 瑞士': [8952, 20, 73, 6153, 210, 343, 385, 153, 15, 31, 6, 53, 5, 7, 12, 4, 7, 0], '江西 鹰潭': [37036, 276, 408, 7918, 776, 1170, 801, 444, 51, 103, 29, 130, 20, 11, 981, 10, 0, 2], '吉林 延边朝鲜族自治州': [47470, 376, 461, 9919, 999, 1512, 1061, 591, 65, 177, 24, 143, 32, 14, 85, 14, 1, 4], '云南 玉溪': [31058, 193, 318, 6544, 619, 1033, 605, 392, 42, 118, 28, 97, 18, 11, 53, 13, 1, 0], '贵州 六盘水': [42178, 336, 516, 9822, 1025, 1531, 1002, 513, 57, 133, 34, 184, 31, 16, 146, 6, 2, 1], '新疆': [71446, 653, 582, 11998, 1344, 1787, 1268, 669, 80, 183, 26, 264, 36, 18, 719, 27, 3, 1], '河南 濮阳': [44939, 350, 489, 8562, 1537, 1264, 1069, 602, 49, 171, 26, 117, 51, 19, 80, 24, 5, 0], '江西 萍乡': [49426, 330, 464, 9223, 954, 1324, 1098, 615, 59, 146, 24, 158, 45, 19, 95, 18, 0, 0], '陕西 铜川': [41974, 287, 404, 8784, 738, 1168, 833, 409, 42, 99, 16, 114, 34, 7, 77, 14, 1, 0], '台湾 台南市': [4473, 23, 22, 1148, 93, 114, 89, 51, 5, 16, 1, 10, 3, 1, 6, 2, 0, 0], '广东 云浮': [29945, 180, 253, 5399, 648, 878, 630, 424, 32, 103, 19, 112, 29, 9, 56, 6, 0, 0], '四川 内江': [29602, 397, 302, 6168, 591, 1002, 653, 415, 40, 78, 22, 97, 33, 10, 70, 8, 3, 1], '广西 防城港': [27872, 190, 317, 6569, 655, 919, 614, 323, 44, 117, 25, 96, 25, 19, 37, 5, 0, 0], '河南 许昌': [46070, 323, 396, 9405, 1158, 1367, 998, 892, 59, 184, 15, 130, 65, 16, 78, 23, 2, 1], '黑龙江 七台河': [28106, 198, 323, 6350, 603, 886, 578, 316, 46, 106, 24, 115, 16, 16, 50, 12, 0, 1], '内蒙古 鄂尔多斯': [44233, 287, 430, 9203, 940, 1235, 1037, 596, 67, 198, 25, 139, 52, 9, 291, 18, 0, 4], '新疆 克孜勒苏': [18813, 156, 248, 4854, 448, 621, 453, 218, 25, 64, 21, 67, 9, 8, 83, 8, 2, 0], '陕西': [108301, 669, 868, 19816, 2405, 2936, 2060, 1403, 135, 365, 69, 363, 82, 25, 797, 47, 4, 2], '河南 三门峡': [36209, 229, 325, 6832, 796, 1042, 742, 392, 49, 160, 31, 122, 26, 10, 923, 10, 1, 1], '山东 日照': [49062, 301, 1783, 9068, 1094, 1394, 860, 669, 60, 168, 42, 110, 43, 18, 105, 14, 2, 0], '安徽 芜湖': [74556, 431, 540, 12340, 2059, 2444, 1425, 1254, 88, 249, 32, 441, 99, 26, 260, 29, 3, 1], '山西 忻州': [38079, 302, 453, 8399, 836, 1174, 844, 465, 65, 131, 36, 135, 29, 13, 113, 18, 0, 0], '浙江 湖州': [90064, 453, 651, 14326, 1556, 2533, 1511, 1190, 117, 322, 44, 224, 61, 15, 535, 31, 10, 3], '湖南 张家界': [32053, 218, 345, 7093, 694, 1030, 721, 444, 45, 97, 20, 95, 14, 18, 72, 5, 0, 1], '西藏 昌都': [43270, 347, 579, 10660, 952, 1393, 919, 465, 77, 123, 35, 152, 26, 13, 646, 6, 2, 0], '福建 龙岩': [82886, 552, 844, 15900, 1681, 2530, 1734, 1035, 94, 244, 49, 278, 78, 22, 713, 36, 0, 2], '安徽 马鞍山': [53603, 280, 401, 8565, 1168, 1457, 855, 643, 54, 135, 40, 172, 67, 18, 69, 67, 0, 3], '江西 吉安': [56201, 373, 456, 10405, 1080, 1424, 1035, 659, 68, 147, 36, 156, 41, 17, 98, 18, 1, 1], '安徽 池州': [29173, 226, 348, 6581, 862, 910, 647, 421, 59, 80, 21, 269, 21, 10, 53, 11, 1, 0], '浙江 丽水': [74292, 454, 560, 13691, 1543, 1956, 1324, 1046, 109, 295, 31, 208, 33, 21, 167, 21, 7, 4], '香港 沙田区': [5181, 36, 30, 1200, 83, 256, 86, 68, 10, 14, 3, 14, 2, 1, 6, 3, 0, 0], '北京 门头沟区': [26167, 218, 240, 6452, 909, 790, 598, 305, 35, 77, 15, 296, 14, 14, 39, 14, 0, 2], '陕西 商洛': [34089, 286, 381, 7921, 724, 1015, 738, 376, 171, 92, 19, 103, 24, 13, 65, 15, 1, 0], '广西 玉林': [43149, 318, 464, 7982, 994, 1523, 902, 657, 62, 209, 30, 156, 57, 15, 74, 18, 1, 1], '内蒙古 通辽': [42302, 314, 425, 9063, 1012, 1294, 873, 494, 58, 249, 27, 153, 44, 15, 70, 6, 2, 0], '新疆 伊犁': [32331, 204, 327, 6658, 655, 931, 754, 426, 64, 99, 15, 80, 22, 8, 105, 16, 4, 0], '云南 德宏': [25383, 299, 300, 5687, 513, 804, 578, 304, 27, 92, 12, 75, 20, 12, 106, 10, 0, 1], '西藏': [70092, 334, 418, 10599, 1123, 1476, 1032, 534, 52, 358, 25, 183, 28, 12, 506, 9, 1, 0], '天津 北辰区': [26971, 205, 277, 5554, 505, 801, 510, 351, 44, 72, 10, 83, 25, 3, 59, 7, 3, 2], '重庆 綦江县': [9924, 77, 102, 2228, 200, 357, 212, 130, 13, 32, 7, 30, 11, 2, 13, 0, 0, 0], '天津 河西区': [53606, 390, 430, 9143, 1192, 1938, 1028, 823, 95, 182, 39, 182, 58, 21, 75, 24, 0, 1], '天津 蓟县': [18122, 144, 176, 4209, 408, 577, 404, 232, 28, 52, 14, 64, 14, 4, 36, 6, 0, 0], '江西 抚州': [42498, 345, 447, 8611, 911, 1296, 914, 514, 70, 134, 25, 180, 32, 17, 65, 14, 0, 0], '江苏 镇江': [67431, 446, 549, 11688, 1418, 2446, 1366, 987, 92, 217, 46, 204, 84, 20, 108, 33, 1, 0], '河南 南阳': [66535, 366, 520, 11862, 1316, 1938, 1401, 1364, 102, 254, 53, 165, 92, 26, 229, 48, 3, 0], '甘肃 陇南': [34089, 222, 393, 7912, 598, 924, 674, 336, 53, 94, 15, 91, 19, 7, 42, 17, 3, 1], '安徽 安庆': [51312, 280, 391, 9823, 1716, 1656, 1026, 723, 76, 167, 32, 553, 57, 14, 135, 27, 5, 0], '贵州 黔南': [38445, 293, 444, 8339, 842, 1166, 809, 454, 62, 99, 33, 116, 21, 13, 157, 20, 1, 0], '广西 钦州': [33725, 255, 334, 6645, 756, 1070, 649, 443, 56, 120, 19, 105, 52, 23, 59, 11, 1, 0], '云南 曲靖': [34053, 221, 301, 6577, 720, 986, 681, 405, 64, 114, 15, 91, 31, 6, 51, 19, 3, 2], '四川 德阳': [39878, 293, 322, 7167, 942, 1517, 906, 606, 61, 146, 33, 151, 55, 15, 68, 19, 4, 2], '贵州 黔东南': [46452, 327, 432, 9491, 855, 1420, 917, 503, 50, 110, 37, 141, 31, 21, 117, 7, 1, 1], '新疆 吐鲁番': [20335, 145, 260, 5100, 448, 664, 411, 217, 17, 66, 12, 73, 13, 12, 68, 10, 0, 1], '河南 周口': [46861, 292, 412, 8376, 926, 1137, 837, 553, 45, 174, 24, 129, 47, 12, 91, 29, 2, 1], '宁夏': [53667, 357, 552, 11971, 1318, 1640, 1190, 603, 71, 286, 23, 220, 29, 10, 513, 20, 1, 0], '香港 油尖旺区': [4867, 26, 28, 895, 59, 217, 49, 45, 15, 12, 6, 7, 3, 1, 3, 0, 1, 0], '广东 揭阳': [179087, 1577, 906, 18292, 1863, 3407, 2601, 1422, 84, 494, 41, 292, 135, 14, 256, 11, 3, 3], '广东 潮州': [109940, 561, 807, 19160, 3607, 3181, 1909, 1651, 153, 599, 43, 919, 68, 16, 112, 13, 2, 2], '贵州': [69539, 438, 698, 13169, 1499, 2068, 1325, 784, 91, 324, 28, 261, 45, 21, 510, 14, 3, 1], '海外 俄罗斯': [24487, 218, 299, 5562, 579, 1187, 530, 379, 41, 96, 13, 97, 21, 6, 40, 13, 3, 0], '山西 朔州': [33644, 273, 394, 7811, 864, 1063, 786, 395, 52, 110, 26, 128, 18, 16, 94, 21, 3, 1], '重庆 江津市': [12421, 81, 133, 2474, 242, 393, 264, 184, 16, 32, 10, 40, 8, 2, 16, 6, 3, 0], '吉林 通化': [60202, 371, 518, 11457, 1153, 1651, 1073, 576, 63, 129, 45, 191, 31, 18, 100, 12, 1, 0], '重庆 合川区': [13671, 194, 140, 2965, 302, 460, 288, 241, 15, 40, 10, 40, 12, 8, 20, 11, 0, 1], '天津 滨海新区': [17255, 110, 203, 3075, 301, 454, 318, 291, 24, 61, 9, 45, 31, 3, 18, 16, 0, 0], '山东 淄博': [86623, 450, 590, 13656, 1531, 2514, 1538, 1113, 135, 330, 54, 253, 105, 31, 190, 37, 6, 4], '甘肃 定西': [24911, 203, 269, 6125, 528, 715, 589, 307, 40, 77, 17, 74, 13, 5, 46, 9, 0, 0], '河北 沧州': [72074, 547, 575, 15830, 1406, 1953, 1547, 874, 94, 277, 45, 192, 82, 20, 118, 29, 3, 2], '内蒙古 巴彦淖尔盟': [33927, 274, 376, 7410, 734, 990, 702, 400, 55, 98, 24, 99, 18, 10, 78, 15, 0, 1], '山东 莱芜': [29541, 208, 257, 6180, 567, 935, 573, 319, 41, 86, 20, 101, 30, 11, 58, 8, 1, 0], '上海 奉贤区': [35130, 221, 319, 6726, 814, 1223, 704, 522, 50, 109, 30, 142, 52, 8, 38, 14, 0, 0], '内蒙古 呼伦贝尔': [40923, 328, 414, 9155, 917, 1313, 923, 552, 80, 135, 25, 157, 43, 16, 75, 21, 3, 1], '内蒙古 锡林郭勒盟': [30267, 275, 367, 7163, 649, 963, 665, 420, 59, 92, 16, 118, 23, 10, 52, 13, 1, 1], '台湾 其他': [95712, 616, 1400, 18251, 1957, 3206, 1873, 1118, 141, 298, 69, 356, 50, 30, 1299, 19, 1, 2], '内蒙古 乌海': [41386, 240, 403, 8438, 801, 1089, 812, 397, 45, 100, 26, 127, 20, 6, 136, 7, 0, 0], '重庆 大足县': [9695, 81, 92, 2235, 202, 344, 234, 139, 18, 43, 7, 21, 7, 4, 12, 6, 0, 0], '广东 阳江': [76547, 562, 710, 14899, 1325, 2476, 1614, 830, 48, 247, 34, 300, 45, 18, 91, 13, 1, 1], '新疆 博尔塔拉': [21986, 195, 295, 5320, 496, 677, 502, 262, 33, 88, 20, 72, 10, 6, 37, 9, 3, 0], '台湾 台东县': [7529, 44, 17, 1142, 87, 79, 70, 48, 11, 13, 3, 18, 2, 0, 312, 0, 0, 0], '河北 邢台': [72190, 419, 568, 12021, 1488, 1855, 1307, 802, 96, 238, 35, 167, 50, 23, 233, 22, 2, 0], '山西 晋城': [44679, 345, 423, 9296, 1177, 1460, 936, 556, 73, 153, 37, 167, 46, 19, 80, 9, 1, 0], '江西 赣州': [110639, 773, 925, 22059, 2354, 2981, 2388, 1427, 145, 377, 57, 300, 141, 29, 224, 57, 10, 4], '青海 黄南': [40283, 297, 517, 9657, 859, 1265, 828, 437, 143, 82, 32, 122, 14, 18, 824, 11, 1, 3], '青海 果洛': [41314, 305, 521, 9901, 835, 1370, 882, 423, 66, 108, 40, 153, 22, 12, 242, 12, 2, 1], '宁夏 石嘴山': [88484, 695, 1105, 19829, 1909, 2661, 1961, 986, 115, 218, 51, 312, 66, 23, 154, 21, 3, 0], '天津 塘沽区': [30922, 239, 263, 6143, 686, 987, 791, 422, 43, 128, 20, 104, 26, 12, 60, 18, 1, 0], '云南 文山': [25256, 201, 317, 5514, 543, 835, 513, 293, 49, 90, 12, 86, 20, 12, 41, 5, 2, 2], '重庆 黔江区': [9676, 70, 100, 2202, 213, 336, 208, 129, 12, 23, 5, 28, 8, 4, 17, 4, 1, 1], '广西 北海': [43397, 273, 408, 7797, 778, 1285, 819, 534, 46, 129, 27, 146, 42, 14, 296, 13, 0, 0], '四川 达州': [33841, 197, 287, 6027, 728, 1181, 725, 472, 47, 126, 19, 89, 29, 9, 173, 20, 1, 3], '甘肃 庆阳': [28057, 202, 301, 6582, 627, 856, 637, 306, 39, 92, 11, 99, 19, 7, 98, 7, 0, 0], '湖北 荆门': [40467, 266, 419, 7769, 844, 1191, 851, 472, 46, 112, 28, 136, 33, 15, 62, 21, 0, 0], '云南 红河': [33222, 203, 294, 6390, 693, 1056, 627, 425, 48, 100, 22, 114, 34, 4, 60, 15, 0, 2], '西藏 那曲': [41527, 271, 541, 9865, 867, 1290, 861, 415, 65, 95, 40, 166, 30, 45, 143, 6, 0, 1], '上海 南汇区': [26273, 209, 302, 5732, 545, 852, 588, 299, 36, 62, 13, 103, 29, 11, 37, 5, 1, 2], '安徽 宿州': [54277, 241, 377, 7403, 894, 1159, 807, 533, 55, 135, 19, 134, 59, 10, 138, 14, 2, 0], '台湾 嘉义市': [2856, 22, 23, 1067, 119, 83, 45, 29, 8, 6, 2, 25, 3, 0, 2, 0, 0, 0], '广东 韶关': [100653, 547, 805, 16493, 1701, 2601, 2688, 1121, 69, 264, 34, 305, 76, 12, 148, 21, 1, 1], '辽宁 营口': [43229, 300, 389, 8837, 961, 1339, 876, 485, 61, 202, 20, 110, 31, 15, 63, 16, 1, 2], '江西 九江': [76359, 479, 653, 13236, 1492, 2122, 1432, 1345, 90, 233, 43, 230, 71, 14, 216, 28, 3, 3], '湖南 湘西土家族苗族自治州': [29361, 243, 317, 6622, 673, 904, 604, 423, 50, 99, 13, 103, 23, 5, 57, 10, 0, 1], '四川 甘孜': [21994, 167, 224, 5223, 477, 793, 464, 216, 36, 59, 19, 58, 17, 4, 214, 7, 1, 1], '云南 迪庆': [26066, 181, 309, 5138, 464, 669, 506, 227, 34, 50, 10, 84, 10, 2, 123, 2, 1, 0], '上海 青浦区': [38028, 232, 346, 7049, 775, 1156, 680, 462, 62, 112, 29, 134, 33, 16, 46, 13, 1, 1], '江苏 连云港': [66734, 503, 504, 11042, 1421, 1808, 1240, 851, 82, 234, 40, 198, 58, 25, 155, 26, 0, 4], '甘肃 武威': [27292, 206, 284, 6493, 582, 734, 610, 286, 43, 68, 13, 100, 15, 8, 48, 10, 0, 0], '吉林 白山': [48808, 329, 458, 10332, 894, 1340, 975, 536, 48, 2291, 30, 177, 33, 8, 82, 15, 2, 1], '吉林 白城': [44171, 356, 455, 9785, 1005, 1338, 903, 518, 58, 111, 34, 162, 35, 22, 62, 20, 2, 1], '湖南 湘潭': [59563, 379, 489, 10143, 1038, 1614, 1080, 900, 62, 165, 30, 159, 59, 25, 183, 18, 4, 1], '天津 静海县': [20909, 139, 222, 4697, 465, 656, 438, 246, 25, 73, 13, 70, 16, 9, 24, 5, 3, 0], '海外 巴西': [22221, 138, 233, 4110, 435, 759, 434, 247, 41, 76, 13, 94, 13, 5, 42, 7, 1, 0], '湖北 恩施土家族苗族自治州': [37944, 275, 338, 7538, 782, 1208, 701, 490, 53, 135, 25, 105, 35, 11, 49, 9, 1, 2], '广东 清远': [81474, 544, 674, 14952, 1509, 2324, 1733, 1107, 65, 232, 37, 266, 71, 21, 180, 10, 1, 1], '广东 茂名': [90113, 625, 823, 17121, 2466, 2461, 1780, 1137, 87, 327, 43, 445, 78, 33, 152, 27, 1, 1], '重庆 巴南区': [16536, 93, 152, 3038, 374, 553, 330, 289, 29, 46, 14, 47, 22, 10, 30, 4, 0, 1], '湖北 鄂州': [37677, 272, 338, 6465, 620, 959, 634, 371, 37, 81, 20, 89, 24, 7, 49, 11, 0, 1], '安徽 巢湖': [26730, 181, 259, 5909, 679, 937, 617, 323, 39, 88, 23, 196, 37, 13, 144, 7, 0, 1], '山东 聊城': [51509, 310, 389, 9115, 992, 1353, 1775, 635, 65, 190, 34, 159, 33, 14, 63, 22, 1, 0], '辽宁 葫芦岛': [39562, 286, 367, 8267, 909, 1380, 776, 504, 51, 143, 30, 147, 29, 11, 181, 13, 3, 1], '湖南 益阳': [34180, 234, 356, 7306, 722, 1186, 757, 544, 42, 124, 22, 92, 29, 11, 176, 12, 1, 0], '海外 蒙古': [1176, 11, 7, 482, 86, 92, 26, 28, 3, 4, 0, 34, 3, 0, 5, 1, 0, 0], '甘肃 嘉峪关': [47670, 234, 369, 7066, 694, 913, 694, 308, 41, 85, 16, 128, 24, 6, 69, 11, 2, 1], '广西 贺州': [30973, 261, 302, 6554, 686, 927, 630, 379, 213, 113, 19, 132, 22, 11, 113, 13, 2, 1], '辽宁 本溪': [44511, 320, 384, 8096, 778, 1341, 904, 494, 48, 133, 23, 112, 33, 11, 69, 10, 2, 2], '香港 湾仔区': [4945, 19, 53, 1063, 112, 211, 79, 77, 9, 24, 1, 11, 6, 3, 7, 2, 0, 0], '海南 三亚': [139085, 1026, 1551, 31061, 3042, 4264, 2910, 1616, 177, 411, 83, 488, 99, 49, 280, 47, 5, 3], '重庆 石柱土家族自治县': [8735, 68, 109, 2004, 192, 289, 166, 109, 11, 22, 11, 22, 5, 3, 12, 2, 0, 0], '青海 海南': [44303, 363, 580, 10146, 928, 1285, 1000, 455, 51, 113, 36, 138, 28, 15, 199, 6, 3, 1], '辽宁 阜新': [33885, 252, 362, 7525, 784, 1035, 747, 424, 58, 119, 22, 127, 23, 25, 70, 13, 0, 0], '台湾': [51053, 294, 498, 9660, 1023, 1728, 1734, 626, 60, 162, 24, 135, 35, 16, 93, 12, 0, 1], '湖南 衡阳': [62725, 423, 438, 11766, 1243, 1930, 1290, 1010, 122, 206, 42, 192, 80, 36, 1034, 20, 6, 1], '海外 西班牙': [6914, 48, 42, 1310, 253, 436, 133, 176, 20, 135, 3, 62, 8, 1, 12, 4, 0, 0], '湖南 郴州': [49369, 317, 409, 8694, 959, 1338, 916, 700, 56, 128, 26, 142, 39, 21, 61, 18, 0, 1], '上海 宝山区': [64496, 378, 514, 10320, 1586, 2596, 1114, 1067, 87, 255, 40, 220, 74, 22, 115, 35, 6, 3], '重庆 荣昌县': [9868, 80, 87, 2282, 214, 372, 206, 105, 14, 33, 6, 24, 8, 3, 15, 6, 0, 0], '贵州 铜仁': [42945, 307, 491, 9762, 914, 1370, 1008, 521, 60, 126, 35, 157, 35, 22, 179, 9, 0, 0], '四川 攀枝花': [24736, 200, 234, 4786, 596, 830, 517, 264, 39, 67, 21, 90, 24, 16, 34, 7, 0, 0], '辽宁 锦州': [46818, 334, 418, 9633, 1079, 1517, 960, 700, 54, 181, 30, 130, 30, 14, 156, 16, 2, 2], '云南 西双版纳': [28622, 205, 333, 6184, 626, 946, 606, 318, 48, 90, 17, 105, 19, 8, 57, 13, 2, 1], '青海': [62298, 350, 501, 11593, 3190, 1562, 1166, 569, 53, 139, 28, 199, 22, 13, 435, 23, 1, 0], '重庆 酉阳土家族苗族自治县': [8856, 76, 94, 2112, 201, 302, 222, 86, 68, 23, 12, 30, 6, 5, 12, 7, 0, 1], '上海 闸北区': [58462, 389, 520, 9813, 1554, 2320, 1113, 905, 86, 173, 42, 250, 58, 27, 65, 28, 4, 1], '海外 泰国': [100712, 644, 300, 8436, 775, 4410, 1400, 475, 52, 109, 17, 109, 28, 6, 42, 11, 3, 1], '湖北 天门': [6276, 35, 37, 1788, 124, 164, 130, 77, 8, 20, 2, 37, 4, 2, 135, 2, 0, 0], '安徽 铜陵': [31174, 226, 303, 6678, 839, 930, 673, 409, 47, 99, 31, 174, 28, 7, 921, 16, 6, 0], '黑龙江 齐齐哈尔': [62444, 321, 476, 11053, 1164, 1768, 1121, 739, 67, 201, 40, 201, 64, 19, 269, 29, 2, 2], '吉林 四平': [56821, 424, 523, 11804, 1166, 1653, 1220, 606, 57, 175, 33, 180, 49, 18, 385, 21, 3, 0], '山西 大同': [54777, 387, 538, 10646, 1067, 1547, 1032, 664, 99, 190, 39, 166, 75, 17, 486, 23, 3, 5], '甘肃 金昌': [41424, 295, 499, 8021, 769, 1078, 811, 385, 56, 98, 25, 127, 16, 11, 85, 8, 0, 2], '内蒙古 兴安盟': [30851, 248, 332, 7255, 685, 971, 752, 347, 39, 97, 40, 119, 29, 8, 130, 17, 1, 1], '新疆 石河子': [6058, 50, 45, 2054, 172, 259, 151, 135, 10, 30, 22, 23, 9, 7, 10, 5, 1, 0], '四川 遂宁': [27111, 179, 240, 6261, 586, 988, 609, 363, 40, 87, 20, 114, 28, 16, 45, 10, 0, 0], '内蒙古 赤峰': [55301, 365, 446, 10592, 987, 1454, 1056, 585, 52, 309, 31, 127, 33, 16, 74, 19, 1, 1], '黑龙江 大兴安岭': [24997, 214, 299, 5933, 564, 790, 574, 258, 41, 84, 21, 80, 6, 8, 43, 9, 1, 0], '西藏 山南': [42087, 285, 473, 9628, 847, 1217, 825, 409, 63, 85, 24, 150, 19, 9, 168, 11, 0, 1], '山西 晋中': [53068, 346, 478, 10192, 1073, 1514, 1166, 603, 70, 178, 40, 163, 45, 16, 88, 22, 2, 1], '新疆 阿克苏': [24459, 154, 286, 5495, 583, 767, 484, 267, 48, 86, 12, 93, 14, 6, 78, 8, 1, 1], '天津 南开区': [69455, 434, 540, 10048, 1415, 2383, 1173, 1080, 103, 202, 47, 215, 78, 25, 92, 37, 3, 1], '重庆 璧山县': [9666, 78, 77, 2200, 217, 323, 201, 127, 16, 27, 15, 31, 4, 1, 17, 2, 0, 1], '广西 梧州': [43419, 677, 416, 8246, 873, 1298, 886, 529, 41, 156, 29, 118, 56, 11, 72, 14, 2, 1], '重庆 梁平县': [8795, 79, 91, 2070, 178, 291, 212, 99, 15, 31, 2, 31, 11, 3, 10, 3, 0, 0], '台湾 高雄市': [92910, 692, 1211, 18359, 1893, 3081, 1945, 1099, 126, 242, 65, 255, 56, 39, 158, 25, 3, 2], '广东 汕尾': [73967, 541, 676, 13285, 1264, 2022, 1515, 876, 70, 235, 32, 211, 51, 10, 114, 7, 2, 3], '海南': [78761, 448, 662, 14888, 1702, 2196, 1417, 791, 93, 211, 39, 339, 43, 18, 1209, 33, 3, 0], '重庆 忠县': [9290, 74, 109, 2030, 178, 315, 200, 97, 15, 35, 8, 30, 4, 3, 16, 0, 1, 0], '云南 丽江': [37117, 222, 280, 7345, 807, 1070, 686, 426, 58, 93, 35, 99, 30, 9, 402, 10, 1, 0], '内蒙古 阿拉善盟': [26435, 179, 319, 6065, 556, 784, 524, 279, 37, 74, 15, 92, 17, 9, 48, 10, 0, 1], '甘肃 临夏': [23488, 186, 283, 5464, 530, 691, 513, 249, 60, 55, 21, 87, 15, 7, 369, 8, 2, 0], '重庆 长寿区': [10436, 63, 128, 2371, 212, 404, 221, 165, 17, 45, 6, 37, 11, 5, 68, 4, 1, 0], '湖南 怀化': [42858, 325, 406, 8478, 924, 1417, 860, 696, 61, 147, 34, 160, 43, 11, 117, 12, 2, 1], '四川 广元': [32232, 197, 244, 5329, 632, 848, 565, 341, 32, 117, 8, 97, 20, 8, 45, 7, 2, 2], '天津 大港区': [21967, 166, 216, 4969, 494, 752, 486, 283, 24, 74, 13, 86, 16, 2, 25, 4, 0, 2], '甘肃 张掖': [25232, 233, 302, 6208, 563, 825, 589, 316, 33, 85, 26, 94, 10, 10, 43, 7, 1, 1], '重庆 云阳县': [9312, 70, 109, 2115, 208, 299, 213, 138, 8, 21, 8, 24, 8, 1, 20, 2, 0, 0], '新疆 和田': [20945, 164, 291, 5201, 438, 658, 440, 230, 25, 65, 15, 80, 15, 9, 37, 5, 1, 0], '四川 眉山': [27555, 195, 260, 5466, 605, 895, 604, 312, 41, 97, 12, 81, 28, 4, 32, 16, 0, 0], '重庆 彭水苗族土家族自治县': [8997, 62, 101, 2101, 182, 272, 211, 124, 9, 20, 4, 21, 7, 3, 12, 2, 1, 0], '黑龙江 鸡西': [50251, 262, 354, 8323, 827, 1163, 826, 421, 48, 114, 27, 117, 25, 18, 116, 11, 1, 1], '甘肃 平凉': [29955, 225, 278, 6135, 627, 848, 646, 301, 36, 74, 29, 107, 14, 8, 148, 6, 1, 1], '四川 资阳': [28370, 198, 251, 5039, 569, 841, 525, 337, 38, 80, 12, 77, 25, 6, 87, 11, 1, 1], '澳门 氹仔': [4171, 35, 31, 1675, 87, 166, 73, 40, 16, 13, 3, 13, 1, 4, 2, 2, 1, 0], '香港 离岛区': [53693, 309, 146, 4997, 444, 388, 415, 413, 14, 55, 3, 110, 1, 1, 1513, 7, 0, 0], '海外 瑞典': [3956, 17, 46, 772, 125, 231, 83, 92, 21, 26, 6, 43, 2, 0, 8, 3, 0, 1], '四川 自贡': [29263, 226, 259, 5561, 667, 1055, 610, 439, 33, 96, 24, 94, 34, 11, 36, 13, 0, 1], '陕西 延安': [42821, 320, 433, 9345, 984, 1233, 889, 539, 71, 132, 28, 123, 39, 13, 141, 12, 1, 1], '安徽 淮南': [45775, 331, 398, 8903, 1293, 1457, 984, 623, 45, 149, 24, 258, 46, 15, 76, 24, 1, 0], '青海 海北': [41214, 292, 494, 9479, 816, 1204, 831, 425, 61, 110, 22, 150, 23, 14, 141, 10, 1, 0], '台湾 彰化县': [5069, 35, 19, 1279, 102, 78, 90, 56, 8, 12, 2, 20, 0, 1, 197, 0, 0, 0], '海外 越南': [19968, 117, 231, 4345, 480, 728, 451, 298, 38, 47, 14, 89, 14, 13, 30, 2, 0, 0], '云南 楚雄': [25724, 197, 267, 5639, 557, 783, 534, 308, 38, 80, 21, 102, 22, 6, 113, 14, 0, 1], '海外 菲律宾': [19311, 134, 232, 3835, 433, 654, 430, 237, 85, 60, 8, 82, 7, 5, 33, 2, 2, 0], '海外 印尼': [20612, 139, 232, 4287, 434, 698, 413, 223, 21, 65, 14, 70, 16, 6, 39, 6, 0, 0], '海外 挪威': [5500, 34, 22, 3935, 135, 226, 332, 116, 12, 21, 2, 49, 6, 0, 10, 4, 1, 0], '西藏 日喀则': [42807, 310, 502, 10299, 978, 1271, 962, 486, 67, 120, 35, 157, 24, 17, 76, 7, 2, 0], '天津 汉沽区': [17424, 142, 229, 4171, 378, 555, 393, 176, 36, 46, 15, 66, 11, 8, 31, 3, 2, 0], '台湾 新北市': [5635, 14, 29, 1195, 82, 214, 95, 74, 7, 18, 5, 9, 5, 1, 3, 0, 0, 0], '海外 匈牙利': [1223, 9, 14, 438, 62, 82, 16, 28, 1, 10, 1, 18, 4, 2, 3, 1, 0, 0], '重庆 巫山县': [5837, 54, 73, 1481, 103, 181, 123, 78, 10, 12, 3, 15, 7, 0, 11, 2, 0, 0], '重庆 奉节县': [11687, 87, 149, 2236, 238, 316, 215, 143, 13, 25, 7, 30, 3, 5, 23, 2, 1, 0], '台湾 南投县': [7759, 26, 26, 1009, 96, 85, 85, 38, 9, 14, 2, 10, 1, 1, 95, 2, 0, 0], '重庆 大渡口区': [18203, 100, 151, 3408, 367, 581, 335, 196, 20, 49, 17, 68, 21, 5, 19, 10, 0, 0], '海外 土耳其': [6789, 9, 14, 457, 82, 134, 30, 40, 1, 12, 3, 33, 2, 4, 5, 0, 0, 0], '海外 希腊': [4204, 32, 18, 884, 128, 266, 64, 104, 5, 16, 4, 51, 7, 1, 6, 2, 0, 1], '河南 驻马店': [40340, 251, 350, 7912, 879, 1216, 804, 534, 57, 152, 26, 119, 37, 15, 75, 15, 1, 1], '云南 普洱': [28164, 199, 256, 6245, 534, 851, 629, 309, 37, 99, 13, 66, 27, 12, 67, 12, 2, 2], '重庆 北碚区': [25250, 119, 351, 10138, 474, 694, 1159, 351, 22, 72, 15, 106, 23, 3, 33, 15, 51, 11], '黑龙江 双鸭山': [38485, 267, 326, 7535, 710, 1069, 768, 370, 51, 92, 21, 120, 26, 6, 96, 8, 1, 0], '海外 乌克兰': [1298, 7, 5, 457, 71, 79, 24, 28, 6, 15, 0, 32, 1, 1, 1, 1, 0, 0], '内蒙古 乌兰察布市': [29080, 226, 341, 6921, 605, 885, 643, 303, 58, 113, 18, 104, 15, 9, 332, 17, 1, 1], '内蒙古': [74319, 480, 650, 15594, 1733, 2156, 1573, 905, 93, 266, 42, 308, 38, 19, 424, 24, 1, 1], '海外 意大利': [10870, 64, 52, 1924, 245, 730, 171, 233, 16, 49, 7, 59, 15, 3, 18, 8, 0, 1], '海外 爱尔兰': [5784, 25, 31, 1043, 201, 257, 115, 137, 10, 44, 3, 48, 9, 7, 4, 6, 0, 0], '海外 沙特阿拉伯': [4671, 32, 38, 851, 211, 368, 95, 144, 18, 27, 3, 57, 8, 4, 10, 8, 1, 1], '海外 印度': [18881, 145, 300, 4302, 486, 646, 412, 270, 35, 59, 19, 80, 14, 11, 40, 8, 0, 0], '河南 济源': [5724, 32, 42, 1581, 111, 129, 108, 84, 8, 15, 1, 27, 12, 3, 11, 4, 1, 0], '香港 北区': [2503, 16, 13, 741, 37, 88, 28, 26, 14, 5, 0, 10, 0, 1, 3, 1, 0, 0], '湖北 仙桃': [7708, 61, 57, 1945, 170, 224, 159, 110, 4, 27, 9, 34, 14, 0, 31, 1, 0, 0], '重庆 潼南县': [9851, 97, 114, 2110, 202, 308, 193, 99, 14, 30, 6, 29, 4, 4, 19, 4, 0, 0], '海外 埃及': [2207, 14, 16, 657, 107, 210, 35, 42, 5, 25, 3, 37, 5, 0, 4, 1, 0, 0], '重庆 永川区': [14139, 92, 156, 2895, 301, 495, 320, 245, 22, 43, 8, 40, 11, 8, 15, 3, 1, 1], '云南 昭通': [25546, 215, 355, 5641, 565, 924, 546, 312, 32, 86, 15, 94, 23, 9, 35, 10, 1, 1], '河北 承德': [47791, 344, 533, 10300, 1046, 1445, 1022, 697, 71, 164, 29, 149, 40, 21, 151, 24, 5, 2], '湖北 神农架': [5535, 55, 35, 2037, 110, 119, 121, 95, 7, 10, 2, 19, 4, 0, 11, 3, 0, 0], '重庆 城口县': [7820, 66, 83, 1887, 147, 253, 146, 94, 12, 29, 9, 27, 8, 1, 13, 1, 0, 0], '海外 哥伦比亚': [1360, 8, 9, 543, 141, 60, 26, 34, 10, 14, 0, 23, 0, 1, 3, 3, 0, 0], '海外 丹麦': [3471, 18, 26, 761, 135, 181, 74, 90, 12, 19, 3, 30, 2, 1, 11, 4, 0, 0], '新疆 阿勒泰': [21060, 148, 264, 5057, 470, 776, 439, 270, 276, 56, 24, 120, 14, 7, 104, 7, 0, 0], '湖北 黄石': [44434, 316, 427, 8652, 967, 1303, 975, 686, 52, 144, 22, 130, 42, 19, 117, 33, 6, 2], '台湾 新竹县': [3492, 58, 23, 1091, 80, 75, 85, 174, 11, 16, 0, 21, 1, 0, 18, 0, 0, 0], '重庆 武隆县': [8683, 81, 83, 1938, 189, 288, 214, 87, 5, 19, 4, 23, 4, 4, 10, 5, 0, 0], '海外 新西兰': [15620, 69, 75, 1626, 303, 644, 236, 233, 19, 54, 7, 65, 20, 8, 25, 11, 1, 0], '北京 延庆县': [21219, 127, 232, 4565, 473, 669, 446, 236, 33, 50, 14, 84, 14, 13, 31, 11, 1, 1], '重庆 垫江县': [8757, 75, 101, 1898, 192, 308, 189, 99, 14, 30, 5, 26, 5, 1, 16, 2, 0, 0], '香港 观塘区': [3554, 23, 25, 983, 66, 192, 61, 37, 6, 8, 7, 7, 4, 2, 6, 1, 0, 0], '新疆 喀什': [26245, 157, 289, 5429, 493, 774, 522, 277, 45, 74, 17, 73, 23, 10, 1046, 4, 1, 1], '重庆 丰都县': [9555, 63, 109, 1956, 186, 311, 191, 101, 11, 40, 4, 23, 4, 4, 7, 3, 1, 0], '四川 广安': [27966, 215, 262, 5415, 526, 844, 578, 354, 43, 108, 15, 80, 26, 6, 167, 9, 0, 1], '宁夏 中卫': [7159, 46, 39, 2624, 184, 166, 126, 63, 7, 24, 3, 34, 12, 2, 8, 3, 0, 0], '天津 保税区': [3771, 42, 29, 1485, 69, 59, 70, 38, 1, 10, 2, 9, 2, 0, 8, 2, 0, 0], '天津 宁河县': [17887, 152, 208, 4148, 378, 606, 389, 206, 84, 74, 15, 49, 12, 3, 29, 2, 0, 0], '重庆 铜梁县': [9730, 172, 117, 2235, 217, 356, 201, 110, 17, 26, 7, 31, 7, 2, 16, 1, 0, 0], '广西 崇左': [5796, 44, 49, 1721, 131, 144, 116, 70, 8, 21, 0, 28, 9, 0, 9, 0, 0, 0], '四川 巴中': [23204, 173, 234, 4807, 540, 756, 519, 331, 70, 69, 21, 56, 28, 9, 31, 10, 2, 0], '重庆 开县': [10442, 90, 118, 2392, 226, 382, 249, 152, 14, 50, 7, 28, 7, 3, 14, 2, 0, 0], '海外 芬兰': [2749, 16, 30, 610, 132, 193, 60, 99, 11, 21, 1, 37, 7, 2, 5, 2, 0, 0], '甘肃': [82808, 432, 649, 14156, 1493, 1946, 1346, 1196, 86, 239, 35, 265, 40, 20, 1078, 42, 3, 0], '海外 墨西哥': [824, 9, 1, 385, 63, 49, 23, 12, 5, 3, 0, 21, 0, 1, 4, 0, 0, 0], '重庆 南川区': [9916, 84, 90, 2041, 173, 333, 199, 152, 9, 25, 5, 27, 6, 4, 20, 3, 0, 0], '台湾 基隆市': [2957, 22, 14, 889, 75, 109, 71, 50, 1, 3, 1, 10, 4, 0, 1, 0, 0, 0], '台湾 新竹市': [3698, 37, 22, 988, 105, 111, 68, 41, 8, 8, 2, 7, 2, 1, 5, 1, 0, 2], '海外 比利时': [2346, 13, 18, 537, 110, 146, 31, 42, 6, 25, 3, 28, 6, 7, 7, 5, 0, 0], '海外 阿根廷': [1806, 8, 8, 487, 80, 127, 37, 50, 4, 18, 3, 40, 3, 0, 3, 0, 0, 0], '海外 南非': [1268, 13, 10, 507, 76, 72, 33, 25, 2, 2, 0, 40, 0, 1, 2, 0, 0, 0], '香港 西贡区': [3237, 4, 12, 742, 45, 116, 40, 35, 6, 8, 1, 4, 2, 0, 2, 4, 0, 0], '香港 深水埗区': [3527, 16, 19, 969, 50, 73, 41, 19, 6, 11, 1, 6, 0, 0, 103, 2, 0, 0], '香港 黄大仙区': [4542, 15, 21, 862, 52, 94, 43, 29, 13, 14, 1, 17, 3, 0, 4, 0, 0, 1], '澳门 大堂区': [2542, 26, 18, 1690, 60, 71, 63, 15, 13, 6, 1, 3, 1, 0, 2, 0, 1, 0], '湖北 潜江': [8646, 41, 47, 1836, 131, 196, 124, 75, 6, 18, 1, 22, 4, 5, 74, 2, 0, 0], '台湾 台中县': [4312, 30, 34, 1125, 68, 66, 67, 65, 4, 15, 0, 8, 1, 0, 517, 1, 0, 0], '重庆 秀山土家族苗族自治县': [8708, 72, 121, 2059, 172, 258, 192, 104, 17, 28, 10, 25, 2, 3, 11, 0, 1, 1], '重庆 巫溪县': [8271, 82, 92, 1891, 176, 251, 173, 95, 15, 33, 4, 35, 5, 2, 11, 2, 0, 0], '重庆 万盛区': [12022, 60, 92, 2076, 195, 271, 207, 106, 19, 25, 6, 39, 7, 1, 22, 2, 0, 0], '澳门 风顺堂区': [2487, 27, 16, 1493, 57, 58, 39, 35, 19, 1, 2, 3, 4, 0, 4, 1, 4, 0], '澳门 路环': [2264, 15, 3, 1383, 66, 39, 37, 11, 11, 3, 1, 5, 0, 2, 2, 0, 0, 0], '香港 屯门区': [2321, 22, 6, 801, 42, 90, 51, 31, 8, 8, 0, 5, 2, 0, 5, 2, 0, 0], '香港 元朗区': [3554, 20, 12, 906, 56, 170, 76, 41, 6, 7, 1, 5, 6, 0, 81, 1, 1, 0], '台湾 花莲县': [1213, 5, 9, 510, 57, 74, 37, 14, 3, 3, 0, 3, 0, 0, 0, 0, 0, 0], '香港 荃湾区': [2532, 11, 11, 710, 42, 103, 37, 24, 3, 11, 1, 10, 1, 1, 4, 3, 0, 0], '海外 奥地利': [2360, 16, 14, 560, 94, 133, 50, 47, 5, 15, 2, 38, 3, 1, 5, 1, 0, 0], '海外 伊朗': [1166, 5, 14, 394, 93, 76, 16, 28, 4, 5, 0, 30, 1, 1, 0, 0, 0, 0], '台湾 桃园县': [3358, 6, 22, 897, 72, 107, 58, 68, 5, 8, 0, 11, 8, 0, 2, 1, 0, 0], '海外 白俄罗斯': [1465, 8, 21, 463, 70, 45, 10, 30, 3, 17, 0, 26, 1, 0, 1, 0, 0, 0], '台湾 屏东县': [1565, 9, 4, 586, 32, 33, 26, 19, 2, 4, 1, 6, 0, 0, 0, 0, 0, 0], '香港 大埔区': [1558, 17, 12, 587, 28, 64, 33, 33, 4, 5, 4, 7, 2, 1, 0, 1, 0, 0], '香港 葵青区': [2732, 9, 11, 674, 32, 68, 36, 34, 2, 7, 1, 1, 2, 0, 2, 1, 0, 0], '台湾 嘉义县': [1279, 5, 4, 663, 29, 28, 19, 11, 2, 0, 1, 3, 1, 0, 1, 0, 0, 0], '海外 葡萄牙': [1192, 5, 5, 445, 72, 80, 17, 36, 5, 21, 0, 30, 3, 0, 2, 0, 0, 0], '香港 南区': [1918, 12, 17, 728, 55, 73, 43, 29, 8, 9, 2, 3, 2, 0, 4, 0, 0, 0], '澳门 望德堂区': [2138, 15, 10, 1456, 50, 36, 39, 18, 7, 4, 1, 1, 0, 0, 3, 0, 0, 0], '台湾 高雄县': [1285, 7, 7, 631, 19, 21, 22, 16, 2, 4, 0, 1, 0, 0, 0, 0, 1, 0], '澳门 圣安多尼堂区': [2813, 27, 11, 1390, 61, 82, 62, 35, 16, 8, 1, 4, 2, 0, 4, 2, 0, 0], '台湾 宜兰县': [1391, 6, 8, 588, 32, 41, 27, 10, 0, 3, 3, 4, 3, 0, 1, 2, 1, 0], '台湾 苗栗县': [10642, 57, 23, 1005, 85, 68, 81, 174, 9, 16, 0, 15, 2, 0, 135, 1, 1, 0], '海外 古巴': [1410, 8, 17, 454, 115, 113, 32, 52, 5, 18, 0, 35, 2, 1, 1, 3, 0, 0], '海外 波兰': [1492, 11, 6, 362, 65, 61, 27, 32, 3, 23, 0, 28, 0, 0, 0, 0, 0, 0], '台湾 云林县': [1214, 16, 4, 651, 32, 23, 14, 6, 4, 6, 1, 3, 2, 1, 0, 0, 0, 0], '台湾 台南县': [1007, 11, 6, 596, 28, 30, 17, 14, 5, 3, 0, 1, 1, 0, 2, 0, 0, 0], '台湾 澎湖县': [5624, 40, 21, 1036, 83, 54, 81, 25, 4, 13, 1, 16, 0, 0, 281, 0, 0, 0], '': [202, 1, 0, 48, 3, 11, 4, 9, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0]}
province_list = ['北京', '天津', '内蒙古', '新疆', '河北', '甘肃', '宁夏', '山西', '陕西', '青海', '山东', '河南', '安徽', '辽宁', '吉林', '黑龙江', '江苏',
'浙江', '上海', '湖北', '湖南', '四川', '重庆', '贵州', '云南', '广西', '江西', '福建', '广东', '海南', '西藏']
keyword_province = province_dic(province_list,keyword_location)
keyword_location_emotion = read_keyword_location_emotion(keyword_location_emotion_file)
keyword_province_emotion_dic = keyword_province_emotion(province_list,keyword_location_emotion)
# print(keyword_province_emotion_dic)
dreamvector_dic = generate_dreamvector(keyword_list,province_list,keyword_province,emotion_list,keyword_province_emotion_dic)
print(dreamvector_dic)
dreamvector_percent_dic = dreamvector_dic_topercent(province_list,emotion_list,dreamvector_dic)
#shang
# shang_dic = province_emotion_shang(dreamvector_dic,len(province_list),len(emotion_list))
# shang_dic = {'健康': {'province_shang': 4.614931341259213, 'emotion_shang': 1.7425643297013043},'事业有成': {'province_shang': 4.6637099637881985, 'emotion_shang': 1.330961168845477},'发展机会': {'province_shang': 4.646693383284832, 'emotion_shang': 1.6815369339421364},'生活幸福': {'province_shang': 4.676081956069652, 'emotion_shang': 1.326266607438356},'有房': {'province_shang': 4.450996265928352, 'emotion_shang': 1.8512545823922906},'出名': {'province_shang': 4.60629078639634, 'emotion_shang': 1.7926907030973753},'家庭幸福': {'province_shang': 4.645193087395395, 'emotion_shang': 1.4111918296202708},'好工作': {'province_shang': 4.5806270617437725, 'emotion_shang': 1.699848118852902},'平等机会': {'province_shang': 4.535844884956961, 'emotion_shang': 1.8934531097785894},'白手起家': {'province_shang': 4.576773617415558, 'emotion_shang': 1.4671189161848104},'成为富人': {'province_shang': 4.610419305107782, 'emotion_shang': 1.806871317347328},'个体自由': {'province_shang': 3.8793067156561394, 'emotion_shang': 1.3132859350989219},'安享晚年': {'province_shang': 4.532088162152894, 'emotion_shang': 1.7959849012260913},'收入足够': {'province_shang': 4.44449133972484, 'emotion_shang': 1.8576476312107724},'个人努力': {'province_shang': 4.724085178174252, 'emotion_shang': 1.1191634015490641},'祖国强大': {'province_shang': 4.611218815596922, 'emotion_shang': 1.549148587597116},'中国经济持续发展': {'province_shang': 3.82186193262807, 'emotion_shang': 1.5304930567574826},'父辈更好': {'province_shang': 4.541929022026666, 'emotion_shang': 1.9182958340544896}}
#columns name
columns_name = []
for current_province in province_list:
columns_name.append(current_province)
for current_emotion in emotion_list:
columns_name.append(current_emotion)
# dreamvector [省1,省2,...,省31,情感0,情感1,情感3,情感4,情感5]
dreamvector_dataframe = pd.DataFrame.from_dict(dreamvector_percent_dic, orient='index',columns = columns_name)
print(dreamvector_dataframe)
# 不需要列标准化
#列标准化的梦向量
# dreamvector_dataframe_standardized = dreamvector_dataframe.apply(lambda x: (x-np.mean(x))/np.std(x,ddof=1))
# print(dreamvector_dataframe_standardized)
## Parallel Coordinate
# draw_parallel_coordinate(dreamvector_dataframe_standardized)
#ch指标
ch_list = []
x_list = []
temp_n = 1
xticks_list = []
for i in range(2,16):
# current_ch = imple_kmeans(dreamvector_dataframe,i+1)
current_ch = imple_GMM(dreamvector_dataframe,i+1)
# current_ch = imple_SpectralClustering(dreamvector_dataframe,i+1)
x_list.append(i+1)
ch_list.append(current_ch)
xticks_list.append(temp_n)
temp_n+=1
plt.plot(xticks_list, ch_list)
plt.xticks(xticks_list, x_list)
plt.title('calinski harabaz score')
plt.xlabel('类目数')
plt.show()
plt.savefig('result/dreamvector/ch_score.png') | [
"di.w@hotmail.com"
] | di.w@hotmail.com |
d155f26c15d744cdfd16276623f1b50bcc247c91 | ab9151dc5f98feaff5ad8971f3ace43f4b1feb09 | /buildbad.py | 3523be2fb5182eb8d1ddd4d4dca1bc48403b6821 | [] | no_license | evangambit/Codex | c889d5d9dd601d09d9941e28ae6a08ab33205451 | 004609f0bf31add72d3101efe7fd47544342cf83 | refs/heads/master | 2022-12-31T19:21:03.545226 | 2020-10-24T20:03:46 | 2020-10-24T20:03:46 | 257,159,652 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 481 | py | import json, sqlite3
conn = sqlite3.connect('new.db')
c = conn.cursor()
c.execute('SELECT json FROM comments')
F = {}
n = 100000
for it in range(n):
j = json.loads(c.fetchone()[0])
for token in j['tokens'].split(' '):
F[token] = F.get(token, 0) + 1
badkeys = []
for token in F:
F[token] /= n
if F[token] < 0.01:
badkeys.append(token)
for key in badkeys:
del F[key]
A = list(zip(F.values(), F.keys()))
A.sort(key=lambda x:-x[0])
for a in A[:64]:
print(a) | [
"morganfredding@gmail.com"
] | morganfredding@gmail.com |
e8a8f4d0229e4d340b624c0df984722ccbca9816 | f62e0baeb105997af682c3d22384c99545ccdf15 | /python_projects/love_calculator.py | 45902f9ca7c3f7dc3d3ec4ada80c7fcd1d3b6282 | [] | no_license | Brad-ONeill/Website | 88d85a4299aef79bc0fbc926295703c37d1473e9 | 64e3314b9a1851fdeb705b798573b6c670af8385 | refs/heads/master | 2023-04-29T13:20:38.470382 | 2023-04-18T20:32:25 | 2023-04-18T20:32:25 | 184,084,912 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 742 | py | print("Welcome to the Love Calculator!")
name1 = input("What is your name? \n")
name2 = input("What is their name? \n")
combined_string = name1 + name2
names = combined_string.lower()
t = names.count("t")
r = names.count("r")
u = names.count("u")
e = names.count("e")
true = t + r + u + e
l = names.count("l")
o = names.count("o")
v = names.count("v")
e = names.count("e")
love = l + o + v + e
score = int(str(true) + str(love))
if score > 90:
print(f"Your score is {score}, you go together pretty well.")
elif score >= 40 and score <= 50:
print(f"Your score is {score}, you are alright together.")
elif score <= 10:
print(f"your score is {score}, maybe reconsider your options")
else:
print(f"Your score is {score}.")
| [
"49478841+Brad-ONeill@users.noreply.github.com"
] | 49478841+Brad-ONeill@users.noreply.github.com |
c5c7c9fa51eaaec171b3b32e2cb18f6d63866966 | 8a82a83655f118208692e55d7804d9fa480ad4b6 | /book/apress/Beginning.Python.Visualization.Crafting.Visual.Transformation.Scripts/Chapter04/src/read_ini.py | bf4374d1f2c6de9b410eea7d36a061bd6b2c38a7 | [] | no_license | xenron/sandbox-da-python | 0814159da9a91923e4b66c5e40057e381f765e96 | ab8f1c0d57fdc6006355f613012b84165068c315 | refs/heads/master | 2020-04-12T05:41:33.182110 | 2016-12-14T22:57:33 | 2016-12-14T22:57:33 | 60,324,979 | 5 | 2 | null | null | null | null | UTF-8 | Python | false | false | 292 | py | # read an INI (config) file
import ConfigParser
read_opts=ConfigParser.ConfigParser()
read_opts.read('../data/options.ini')
# print parameters and values
for section in read_opts.sections():
print "[%s]" % section
for param in read_opts.items(section):
print param
| [
"xenron@outlook.com"
] | xenron@outlook.com |
85ee743b57fa57b5f097d7c44528ca83bfbafbc4 | ca7aa979e7059467e158830b76673f5b77a0f5a3 | /Python_codes/p03250/s433353636.py | 15a9e1142e1ac04131cec60d4882b0b4d8b16ff5 | [] | no_license | Aasthaengg/IBMdataset | 7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901 | f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8 | refs/heads/main | 2023-04-22T10:22:44.763102 | 2021-05-13T17:27:22 | 2021-05-13T17:27:22 | 367,112,348 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 70 | py | a=list(map(int,input().split()))
a=sorted(a)
print(a[-1]*10+a[1]+a[0]) | [
"66529651+Aastha2104@users.noreply.github.com"
] | 66529651+Aastha2104@users.noreply.github.com |
1c1c810b779e1a8b626c59a69872d8d026f44862 | f153cbfc77cfe4ace1eadf8f1cf4c7d17248c228 | /minified.py | 07ff2f5d7332a922de6ad9c50ee645e5c16ad32b | [] | no_license | aadityarengarajan/POS-System | 1846a84576920bc925da9969fc5e4b074164e330 | dbe43d8496aca42a5a5a2af451eb8ff1c0e3b107 | refs/heads/main | 2023-08-03T08:45:55.439442 | 2021-03-30T19:19:19 | 2021-03-30T19:19:19 | 405,992,069 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 15,685 | py | from pickle import dump,load
from random import random
from datetime import datetime as dt
from os import listdir
if "items.dat" not in listdir():
with open("items.dat","wb"):
pass
if "sales.dat" not in listdir():
with open("sales.dat","wb"):
pass
def read_items():
objects = []
with (open("items.dat", "rb")) as openfile:
while True:
try:
objects.append(load(openfile))
except EOFError:
break
try:
return objects[0]
except IndexError:
return {"items":[]}
def write_items(data):
with open("items.dat","wb") as f:
dump(data,f)
return True
def read_sales():
objects = []
with (open("sales.dat", "rb")) as openfile:
while True:
try:
objects.append(load(openfile))
except EOFError:
break
try:
return objects[0]
except IndexError:
return {"sales":[]}
def write_sales(data):
with open("sales.dat","wb") as f:
dump(data,f)
return True
def add_item():
particular = input("PARTICULAR : ")
rate = float(input("RATE (in Rupees) : "))
qt = 0
while qt<=0:
qt = float(input("QUANTITY (PCS/UNITS) : "))
if qt<=0:
print("QUANTITY MUST BE MORE THAN 0")
items = read_items()
codes = []
for i in items["items"]:
codes.append(int(i["code"]))
try:
code = (max(codes)+1)
except ValueError:
code = 1
items["items"].append({"code":code,
"particular":particular,
"rate":rate,
"quantity":qt})
write_items(items)
i = {"code":code,
"particular":particular,
"rate":rate,
"quantity":qt}
print(f'''
ITEM CODE {i["code"]}
PARTICULAR : {i["particular"]}
RATE : {i["rate"]}
CURRENT QUANTITY : {i["quantity"]}
''')
print("\n\nNEW ITEM ADDED.")
def add_stock():
code = int(input("ITEM CODE : "))
items = read_items()
for i in items["items"]:
if int(i["code"])==int(code):
print(f'''ITEM CODE {i["code"]}
PARTICULAR : {i["particular"]}
RATE : {i["rate"]}
CURRENT QUANTITY : {i["quantity"]}
''')
qty = -1
while qty<0:
qty = float(input("ENTER ADDITIONAL QUANTITY (PCS/UNITS) : "))
if qty<0:
print("QUANTITY MUST BE MORE THAN OR EQUAL TO 0")
print("\n"*2)
print(f'''ITEM CODE {i["code"]}
PARTICULAR : {i["particular"]}
RATE : {i["rate"]}
CURRENT QUANTITY : {i["quantity"]}
NEW QUANTITY : {qty}
TOTAL QUANTITY : {i["quantity"]+qty}
''')
if input("ARE YOU SURE YOU WOULD LIKE TO AMEND CHANGES? (Y/N [Default : Y]) : ") in "Yy":
new_item = ({"code":i["code"],
"particular":i["particular"],
"rate":i["rate"],
"quantity":i["quantity"]+qty})
items["items"].remove(i)
items["items"].append(new_item)
write_items(items)
print("\n\nSTOCK INCREASED.")
return True
else:
print("\n\nSTOCK UNCHANGED.")
return True
print("\n\nITEM NOT FOUND.")
return False
def reduce_stock(code,qt):
items = read_items()
for i in items["items"]:
if int(i["code"])==int(code):
new_item = ({"code":i["code"],
"particular":i["particular"],
"rate":i["rate"],
"quantity":i["quantity"]-qt})
items["items"].remove(i)
items["items"].append(new_item)
write_items(items)
return True
return False
def check_exists(code):
items = read_items()
code_exists = False
stock_exists = False
stock_pcs = 0
for i in items["items"]:
if int(i["code"])==int(code):
code_exists = True
if int(i["quantity"])>=1:
stock_exists = True
stock_pcs = int(i["quantity"])
return {"code_exists":code_exists,"stock_exists":stock_exists,"stock_pcs":stock_pcs}
def get_item(code):
items = read_items()
code_exists = False
stock_exists = False
for i in items["items"]:
if int(i["code"])==int(code):
return i
return False
def code_gen():
exists = True
while exists == True:
code = int(random()*(10**8))
exists = check_exists(code)["code_exists"]
return code
def bill():
datetime = dt.now().strftime("%d/%m/%y %H:%M:%S")
cash_memo = {"date":datetime, "number":code_gen()}
purchased_items = []
c = 0
total_amt = 0
while 1:
if input("ADD ANOTHER ITEM? (Y/N [Default : Y]) : ") in "Yy":
print('''
ADD ITEM
========
''')
item = int(input("CODE : "))
if check_exists(item)["code_exists"] == False:
print("Code doesn't exist :(")
continue
elif check_exists(item)["stock_exists"] == False:
print("Item is out of stock :(")
continue
else:
qt = 0
while qt<=0 or int(qt)>int(check_exists(item)["stock_pcs"]):
qt = float(input("QUANTITY (PCS/UNITS) : "))
if qt<=0:
print("QUANTITY MUST BE MORE THAN 0")
if int(qt)>int(check_exists(item)["stock_pcs"]):
print(f'THERE ARE ONLY {check_exists(item)["stock_pcs"]} PCS/UNITS IN STOCK. PLEASE ENTER A NUMBER LESSER THAN THE SAME.')
c += 1
item = get_item(item)
code = item["code"]
particular = item["particular"]
rate = item["rate"]
quantity = qt
amount = rate*qt
purchased_items.append({"sno":c,
"code":code,
"particular":particular,
"rate":rate,
"quantity":quantity,
"amount":amount})
total_amt += amount
else:
break
cash_memo.update({"items":purchased_items,"total":total_amt})
print(f'''
================================================================================
Date : {cash_memo["date"]} Cash Memo Number : {cash_memo["number"]}
================================================================================
S. No. Item Code Particular Rate Quantity Amt
''')
for i in cash_memo["items"]:
print(f"{i['sno']} {i['code']} {i['particular']} Rs. {i['rate']} {i['quantity']} Rs. {i['amount']}")
print(f'''
================================================================================
Grand Total Rs. {cash_memo["total"]}
================================================================================''')
print("\n"*3)
if input("ARE YOU SURE YOU WOULD LIKE TO COMPLETE BILLING? (Y/N [N to Cancel Bill, Default : Y]) : ") in "Yy":
for i in cash_memo["items"]:
reduce_stock(i["code"],i["quantity"])
current_sales = read_sales()
current_sales["sales"].append(cash_memo)
write_sales(current_sales)
print("\n\nBILLING COMPLETE.")
else:
print("\n\nBILLING CANCELED.")
def cash_memo():
billno = int(input("Enter Cash Memo Number : "))
all_sales = read_sales()
for i in all_sales["sales"]:
if i["number"] == billno:
cash_memo = i
print(f'''
================================================================================
Date : {cash_memo["date"]} Cash Memo Number : {cash_memo["number"]}
================================================================================
S. No. Item Code Particular Rate Quantity Amt
''')
for j in cash_memo["items"]:
print(f"{j['sno']} {j['code']} {j['particular']} Rs. {j['rate']} {j['quantity']} Rs. {j['amount']}")
print(f'''
================================================================================
Grand Total Rs. {cash_memo["total"]}
================================================================================''')
print("\n"*3)
return True
print("Cash Memo Not Found. Invalid Number :(")
def daily_sales_report():
while 1:
try:
date = dt.strptime(input("ENTER DATE AS 'DD/MM/YYYY' (WITHOUT QUOTES) : "),"%d/%m/%Y")
break
except:
print("INVALID.")
continue
all_sales = read_sales()
items_list = []
amount = 0
for i in all_sales["sales"]:
if dt.strptime(i["date"], "%d/%m/%y %H:%M:%S").strftime("%d/%m/%Y") == date.strftime("%d/%m/%Y"):
for x in i["items"]:
item_added = False
for z in items_list:
if z["name"] == x["particular"]:
z["amount"] += x["amount"]
item_added = True
if item_added == False:
items_list.append({"name":x["particular"],"amount":x["amount"]})
amount += i["total"]
print(f"""
==========================================================
DAILY SALES REPORT FOR DAY : {date.strftime("%d/%m/%Y")}
==========================================================
LIST OF ITEMS SOLD
==================""")
for i in items_list:
print(f"{i['name']} - Rs. {i['amount']}")
print(f"""
==================
TOTAL AMOUNT EARNT : Rs. {amount}""")
def monthly_sales_report():
while 1:
try:
date = dt.strptime(input("ENTER MONTH AS 'MM/YYYY' (WITHOUT QUOTES) : "),"%m/%Y")
break
except:
print("INVALID.")
continue
all_sales = read_sales()
items_list = []
amount = 0
for i in all_sales["sales"]:
if dt.strptime(i["date"], "%d/%m/%y %H:%M:%S").strftime("%m/%Y") == date.strftime("%m/%Y"):
for x in i["items"]:
item_added = False
for z in items_list:
if z["name"] == x["particular"]:
z["amount"] += x["amount"]
item_added = True
if item_added == False:
items_list.append({"name":x["particular"],"amount":x["amount"]})
amount += i["total"]
print(f"""
==========================================================
MONTHLY SALES REPORT FOR MONTH : {date.strftime("%B, %Y")}
==========================================================
LIST OF ITEMS SOLD
==================""")
for i in items_list:
print(f"{i['name']} : Rs. {i['amount']}")
print(f"""
==================
TOTAL AMOUNT EARNT : Rs. {amount}""")
def yearly_sales_report():
while 1:
try:
date = dt.strptime(input("ENTER YEAR AS 'YYYY' (WITHOUT QUOTES) : "),"%Y")
break
except:
print("INVALID.")
continue
all_sales = read_sales()
items_list = []
amount = 0
for i in all_sales["sales"]:
if dt.strptime(i["date"], "%d/%m/%y %H:%M:%S").strftime("%Y") == date.strftime("%Y"):
for x in i["items"]:
item_added = False
for z in items_list:
if z["name"] == x["particular"]:
z["amount"] += x["amount"]
item_added = True
if item_added == False:
items_list.append({"name":x["particular"],"amount":x["amount"]})
amount += i["total"]
print(f"""
==========================================================
MONTHLY SALES REPORT FOR YEAR : {date.strftime("%Y")}
==========================================================
LIST OF ITEMS SOLD
==================""")
for i in items_list:
print(f"{i['name']} : Rs. {i['amount']}")
print(f"""
==================
TOTAL AMOUNT EARNT : Rs. {amount}""")
def item_wise_report():
all_sales = read_sales()
items_list = []
amount = 0
for i in all_sales["sales"]:
for x in i["items"]:
item_added = False
for z in items_list:
if z["name"] == x["particular"]:
z["amount"] += x["amount"]
item_added = True
if item_added == False:
items_list.append({"name":x["particular"],"amount":x["amount"]})
amount += i["total"]
print("""
==========================================================
ITEM-WISE SALES REPORT
==========================================================
LIST OF ITEMS SOLD
==================""")
for i in items_list:
print(f"{i['name']} : Rs. {i['amount']}")
print(f"""
==================
TOTAL AMOUNT EARNT : Rs. {amount}""")
def items_available():
items = read_items()
print("""
==========================================================
LIST OF ITEMS AVAILABLE / STOCK REPORT
==========================================================
CODE PARTICULAR QUANTITY AVAILABILITY
""")
for i in items["items"]:
print(i["code"],i["particular"],i["quantity"],end=" ")
if int(i["quantity"])>=1:
print(" AVAILABLE")
else:
print(" UNAVAILABLE")
print("\n")
def order_stock_list():
items = read_items()
order_list = []
print("""
==========================================================
LIST OF ITEMS<20 / TO ORDER
==========================================================
CODE PARTICULAR QUANTITY
""")
for i in items["items"]:
if int(i["quantity"])<20:
print(i["code"],i["particular"],i["quantity"])
menu = """
==========================================
SALES MANAGEMENT SYSTEM FOR STORES
==========================================
WHAT WOULD YOU LIKE TO DO?
(1) ADD NEW ITEM TO INVENTORY
(2) ADD NEW STOCK TO INVENTORY
(3) PERFORM BILLING FOR CUSTOMER
(4) VIEW CASH MEMO GIVEN CODE
(5) VIEW SALES REPORT(S)
(6) VIEW LIST OF AVAILABLE ITEMS
(7) GENERATE ORDER LIST FOR ITEMS WHERE STOCK < 20
(0) EXIT
YOUR CHOICE : """
report_menu = """
==========================================
VIEW SALES REPORT(S)
==========================================
WHAT TYPE OF SALES REPORT WOULD YOU LIKE TO VIEW?
(1) DAILY SALES REPORT
(2) MONTHLY SALES REPORT
(3) YEARLY SALES REPORT
(4) ITEM-WISE SALES REPORT
(0) BACK TO MAIN MENU
YOUR CHOICE : """
while True:
while 1:
try:
ch = int(input(menu))
break
except:
print("PLEASE ENTER A VALID INTEGER")
continue
if ch==1:
add_item()
print("\n"*2)
elif ch==2:
add_stock()
print("\n"*2)
elif ch==3:
bill()
print("\n"*2)
elif ch==4:
cash_memo()
print("\n"*2)
elif ch==5:
while 1:
try:
ch = int(input(report_menu))
break
except:
print("PLEASE ENTER A VALID INTEGER")
continue
if ch==1:
daily_sales_report()
elif ch==2:
monthly_sales_report()
elif ch==3:
yearly_sales_report()
elif ch==4:
item_wise_report()
print("\n"*2)
elif ch==6:
items_available()
print("\n"*2)
elif ch==7:
order_stock_list()
print("\n"*2)
elif ch==0:
break | [
"aadit.xo@gmail.com"
] | aadit.xo@gmail.com |
db3596b8480850b3718c2c9d08671fd49db81831 | 0543faeee9f493260e8cbd8a9155a96a8cbb0df2 | /main_app/migrations/0018_profile.py | 9f188815d07ced745fd5193ceebf36edd8813264 | [] | no_license | tanveerahmad1517/Treasuregram | 134853f298628c161ebe741864cdb581ce80db8f | 797e0ff1460eb50d90aa385f6fb25990ed7766fa | refs/heads/master | 2020-03-10T13:58:43.912795 | 2018-04-13T14:32:31 | 2018-04-13T14:32:31 | 129,413,871 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 697 | py | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2018-02-13 13:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main_app', '0017_remove_treasure_date'),
]
operations = [
migrations.CreateModel(
name='Profile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(db_column='first_name', max_length=50)),
('last_name', models.CharField(db_column='last_name', max_length=50)),
],
),
]
| [
"tanveerobjects@gmail.com"
] | tanveerobjects@gmail.com |
084ccfc5ffcd100f2f98fb3e75c4f6b676d5d3f8 | 09d4c110161520c2ed8bab9f19e2a07f23d66b46 | /wordvector/migrations/0002_auto_20161031_0252.py | 0f0e11ca6dc638d5054b1f4a4c29c7e564bcdd13 | [] | no_license | lunrongchen/SWR | 0565df4d62b4198d9dabcc7de760f78e9ff43c7e | fd5cc45e1351b20f7b09ea1c82ddb3bc14930575 | refs/heads/master | 2021-01-12T14:09:08.125125 | 2016-11-07T16:51:24 | 2016-11-07T16:51:24 | 69,759,201 | 1 | 0 | null | 2016-11-05T17:12:50 | 2016-10-01T19:34:08 | Python | UTF-8 | Python | false | false | 928 | py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wordvector', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='WordVectorFile',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('data_src', models.CharField(max_length=100)),
('dimension', models.IntegerField(default=50)),
('data_count', models.IntegerField(default=0)),
('data_link', models.FileField(default=b'data_link/None/No-data_link.zip', upload_to=b'data_link/')),
],
),
migrations.AlterUniqueTogether(
name='wordvectorfile',
unique_together=set([('data_src', 'dimension')]),
),
]
| [
"lunrongchen@163.com"
] | lunrongchen@163.com |
5aef6dd981da9ff255c7995ba9489e29d410523f | 034abf3ad29001e01e3c3ca8106647ac9992e5db | /rock-paper-scissor.py | 7880d66590f1442ae8ea694a8021cfe95fe4465a | [] | no_license | gunjeet210/Rock-Paper-Scissors | b1b0c3db0fd6caaf5354924f06f6ce0e35951d86 | a07cbc2eaf6dfd494a8e4d8933bb4023a1914c73 | refs/heads/master | 2021-01-08T15:59:33.132018 | 2020-02-21T07:13:41 | 2020-02-21T07:13:41 | 242,073,752 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,519 | py | import random, time
print("Let us play RPS game")
while True:
print("Enter choice \n1. Rock\n2. Paper\n3. Scissor")
choice=int(input("User turn: "))
while choice > 3 or choice < 1:
choice=int(input("enter valid input: "))
if choice == 1:
choice_name = "Rock"
elif choice == 2:
choice_name = "Paper"
else:
choice_name = "Scissor"
print("User Choice is: "+ choice_name)
print("Now its computerji's turn....")
comp_choice = random.randint(1,3)
time.sleep(1)
while comp_choice == choice:
comp_choice = random.randint(1,3)
if comp_choice == 1:
comp_choice_name = "Rock"
elif comp_choice == 2:
comp_choice_name = "Paper"
else:
comp_choice_name = "Scissors"
print("ComputerJi's Choice is: "+ comp_choice_name)
#Gameplay
print(choice_name + " V/S " + comp_choice_name)
time.sleep(1)
if((choice == 1 and comp_choice == 2) or (choice == 2 and comp_choice == 1)):
print("Paper Wins.")
result = "paper"
elif((choice==1 and comp_choice == 3) or (choice == 3 and comp_choice == 1)):
print("Rock Wins.")
result = "rock"
else:
print("Scissor Wins.")
result = "scissor"
time.sleep(1)
if result == choice_name:
print("User Wins.")
else:
print("ComputerJi Wins.")
print("Do you want to play again? (Y/N)")
ans = input()
if ans == 'n' or ans == 'N':
break
print("\nThanks for playing along.")
| [
"noreply@github.com"
] | gunjeet210.noreply@github.com |
d054580c3aeb4fc7763d77e069fc957b1ef93a28 | 60ea9e854d224a1c0034c8ef85ef2736eb38c1a6 | /bayes/debug.py | 5350506b44683984914efabba23a8959fe3dba42 | [] | no_license | SunnyWiki/PY-bayesian | f926d500d47470e6899620da3cae0668b230efb7 | 5007f40ec7035e9670ec2f8f649d8d3d4f009e6c | refs/heads/master | 2021-01-22T23:48:19.141358 | 2017-03-22T06:58:46 | 2017-03-22T06:58:46 | 85,670,643 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,164 | py | #-*- coding: UTF-8 -*-
import os
import jieba
import numpy as np
from sklearn.naive_bayes import MultinomialNB
# from sklearn import datasets
# iris = datasets.load_iris()
# from sklearn.naive_bayes import GaussianNB
# gnb = GaussianNB()
# y_pred = gnb.fit(iris.data, iris.target).predict(iris.data)
# print("Number of mislabeled points out of a total %d points : %d"% (iris.data.shape[0],(iris.target != y_pred).sum()))
trainPath = "/opt/app/highlevel/training/data/TRAIN"
testPath = "/opt/app/highlevel/training/data/TEST"
stopwordsPath = "/home/hldev/Work/PYproject/bayes/stopwords.txt"
categoryDir = os.listdir(trainPath)
testCatDir = os.listdir(testPath)
vocab_set = set([])
vocab_list = []
stopwords_list = []
stopwords_set = set([])
stopwords_raw = [line.strip() for line in open(stopwordsPath).readlines()]
for s in stopwords_raw:
stopwords_list.append(s.decode('gbk'))
stopwords_set = set(stopwords_list)
for cat in categoryDir:
if cat == "负面":
negativePaths = os.listdir(trainPath + "/" + cat)
if cat == "正面":
positivePaths = os.listdir(trainPath + "/" + cat)
for text in negativePaths:
f = open(trainPath + "/负面/" + text, "r")
try:
content = f.read()
words_list = jieba.cut(content)
print(", ".join(words_list))
for word in words_list:
if word not in stopwords_set:
vocab_set.add(word)
finally:
f.close()
for text in positivePaths:
f = open(trainPath + "/正面/" + text, "r")
try:
content = f.read()
words_list = jieba.cut(content)
for word in words_list:
if word not in stopwords_set:
vocab_set.add(word)
finally:
f.close()
vocab_list = list(vocab_set)
train_vector = []
trainTarget_vector = []
for text in negativePaths:
content_vector = [0] * len(vocab_list)
f = open(trainPath + "/负面/" + text, "r")
try:
content = f.read()
words_list = jieba.cut(content)
for word in words_list:
if word in vocab_list:
content_vector[vocab_list.index(word)] = content_vector[vocab_list.index(word)] + 1
train_vector.append(content_vector)
trainTarget_vector.append(int(0))
finally:
f.close()
for text in positivePaths:
content_vector = [0] * len(vocab_list)
f = open(trainPath + "/正面/" + text, "r")
try:
content = f.read()
words_list = jieba.cut(content)
for word in words_list:
if word in vocab_list:
content_vector[vocab_list.index(word)] = content_vector[vocab_list.index(word)] + 1
train_vector.append(content_vector)
trainTarget_vector.append(int(1))
finally:
f.close()
test_vector = []
testTarget_vector = []
for cat in testCatDir:
if cat == "负面":
t_negativePaths = os.listdir(testPath + "/" + cat)
if cat == "正面":
t_positivePaths = os.listdir(testPath + "/" + cat)
for text in t_negativePaths:
content_vector = [0] * len(vocab_list)
f = open(testPath + "/负面/" + text, "r")
try:
content = f.read()
words_list = jieba.cut(content)
print(", ".join(words_list))
for word in words_list:
if word in vocab_list:
content_vector[vocab_list.index(word)] = content_vector[vocab_list.index(word)] + 1
test_vector.append(content_vector)
testTarget_vector.append(int(0))
finally:
f.close()
for text in t_positivePaths:
content_vector = [0] * len(vocab_list)
f = open(testPath + "/正面/" + text, "r")
try:
content = f.read()
words_list = jieba.cut(content)
for word in words_list:
if word in vocab_list:
content_vector[vocab_list.index(word)] = content_vector[vocab_list.index(word)] + 1
test_vector.append(content_vector)
testTarget_vector.append(int(1))
finally:
f.close()
train_vector = np.array(train_vector)
trainTarget_vector = np.array(trainTarget_vector)
test_vector = np.array(test_vector)
testTarget_vector = np.array(testTarget_vector)
clf = MultinomialNB().fit(train_vector, trainTarget_vector)
bayesian_predict = clf.predict(test_vector)
wrongNumber = (testTarget_vector != bayesian_predict).sum()
rightRate = 1 - (float(wrongNumber) / test_vector.shape[0])
conditional_prob = clf.__dict__.get("feature_log_prob_")
prior_prob = clf.__dict__.get("class_log_prior_")
negativeCp_list = list(conditional_prob[0])
positiveCp_list = list(conditional_prob[1])
negativePrior = prior_prob[0]
positivePrior = prior_prob[1]
negativeKeywords_list = []
positiveKeywords_list = []
for i in range(len(vocab_list)):
negativeKeywords_list.append((vocab_list[i], negativeCp_list[i]))
positiveKeywords_list.append((vocab_list[i], positiveCp_list[i]))
negativeKeywords_list = sorted(negativeKeywords_list, key=lambda pair: pair[1], reverse=True)
positiveKeywords_list = sorted(positiveKeywords_list, key=lambda pair: pair[1], reverse=True)
print("Right rate out of a total %d is : %f" % (test_vector.shape[0], rightRate))
| [
"1935508351@qq.com"
] | 1935508351@qq.com |
ce3577da94f38a365616e8374df42eec5835d6cf | 48c038e381aa0e276ee08d7bd93479522597b561 | /JiewuOnline/settings.py | 86ee150b1e68be4da612b060ff05ddfbb0e969a8 | [] | no_license | niuniu20160626/JiewuOnline | 263afbbbb98225264e387fd77e4b12d429377101 | 51fa260df654a8e59cf694fc1c8b095b217093a0 | refs/heads/master | 2023-05-04T22:15:41.962693 | 2021-05-30T07:56:44 | 2021-05-30T07:56:44 | 341,800,004 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,704 | py | """
Django settings for JiewuOnline project.
Generated by 'django-admin startproject' using Django 3.0.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '1gn76s3&unjga7ma21luh@)vtvi(aty(xmeji31xt$9fu)n6op'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'apps.courses.apps.CoursesConfig',
'apps.users.apps.UsersConfig',
'apps.organizations.apps.OrganizationsConfig',
'apps.operations.apps.OperationsConfig',
'xadmin.apps.XAdminConfig',
'crispy_forms',
'DjangoUeditor',
'captcha',
'pure_pagination',
'import_export',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'JiewuOnline.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.media',
'apps.users.views.message_nums',
],
},
},
]
WSGI_APPLICATION = 'JiewuOnline.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': '127.0.0.1',
'PORT': '3306',
'NAME': 'jiewuonlinedb',
'USER': 'root',
'PASSWORD': 'wenjian52',
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
"init_command": "SET foreign_key_checks = 0;",
},
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
AUTH_USER_MODEL = "users.UserProfile"
# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Calcutta'
USE_I18N = True
USE_L10N = True
USE_TZ = False
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
# media files (JPG, mp4等等)
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
#STATIC_ROOT = os.path.join(BASE_DIR, 'static')
yp_apikey = "0c86ece8d860b75c40b1ed204cb29e63"
#code_dict = {
# "mobile":"code"
#}
#redis 配置
REDIS_HOST = "127.0.0.1"
REDIS_PORT = 6379
#1.如果重启django,变量不存在
#2.随着验证越来越多,内存占用越来越大
#3.使用redis k,v存储
#Linux 或mac下面安装 redis
#sudo apt-get install redis-server
#sudo apt-get install redis-cli
#windows 安装
#在github中下载,安装
#编写view的步骤
#1.view代码
#2.配置url
#3.修改html界面中相关地址
#分页相关设置
PAGINATION_SETTINGS = {
'PAGE_RANGE_DISPLAYED': 6,
'MARGIN_PAGES_DISPLAYED': 2,
'SHOW_FIRST_PAGE_WHEN_INVALID': True,
} | [
"1714885031@qq.com"
] | 1714885031@qq.com |
983dcd62c2be5d68fa2354efe39fd201726c82be | 469aaddd0e22041e7fc4ec12553258f1d7a2092c | /0x10-python-network_1/5-hbtn_header.py | e29c2e76d7349c26d94f79763ae0be09d51145c1 | [] | no_license | youmnaz/holbertonschool-python | 80dba488d9e62cfcd260e349f3b036299cec4b17 | e6de933f7d5501ea2393729157fd82e776a4a357 | refs/heads/master | 2023-01-13T20:31:59.258910 | 2020-11-20T08:30:09 | 2020-11-20T08:30:09 | 291,691,627 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 185 | py | #!/usr/bin/python3
"""
5-hbtn_header.py
"""
import requests
from sys import argv
if __name__ == "__main__":
r = requests.get(argv[1])
print(r.headers.get("X-Request-Id"))
| [
"youmna.zogheib@gmail.com"
] | youmna.zogheib@gmail.com |
53171e07178a012d3d4820a34f4a4926dbf039f9 | 909afe0216a37bdc19683d81e533fa6c094329c1 | /python/fluent_python/17-futures/flags_threadpool.py | 06c33a7643ddd6282576bba9507f4a1c595c79bf | [] | no_license | wxnacy/study | af7fdcd9915d668be73c6db81bdc961247e24c73 | 7bca9dc8ec211be15c12f89bffbb680d639f87bf | refs/heads/master | 2023-04-08T17:57:40.801687 | 2023-03-29T08:02:20 | 2023-03-29T08:02:20 | 118,090,886 | 18 | 22 | null | 2022-12-16T03:11:43 | 2018-01-19T07:14:02 | HTML | UTF-8 | Python | false | false | 481 | py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: wxnacy(wxnacy@gmail.com)
# Description: 使用多线程下载
from concurrent.futures import ThreadPoolExecutor
from flags import download_one, main
MAX_WORKERS = 20
def download_many(suffixs):
workers = min(MAX_WORKERS, len(suffixs))
with ThreadPoolExecutor(workers) as executor:
res = executor.map(download_one, suffixs)
return len(list(res))
if __name__ == "__main__":
main(download_many)
| [
"371032668@qq.com"
] | 371032668@qq.com |
7a25619ac5eff44c957cd979158b601393eb548e | 725d06cd4ff104efc089e13b9a06ca5b6dd3b342 | /Hangman.py | 2aed0d44dd37d3d0e6fc9781e2bc622ec54ed412 | [] | no_license | prathmeshpatel/hangman-game | 30fd088c143cd617c14a1876fd7d4d6dac402c75 | c0b3692a3c70b69f78cec1a85b62cb53a579694a | refs/heads/master | 2021-04-30T17:39:37.657034 | 2017-01-27T21:36:14 | 2017-01-27T21:36:14 | 80,247,952 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,029 | py | '''
Created on Oct 16, 2016
@author: Prathmesh Patel
'''
import random
def fileToStringList(filename):
#opens file and returns a list of strings(words)
wordlist = []
f = open(filename)
for line in f:
line = line.strip()
wordlist.append(line)
f.close()
return wordlist
def getPossibleWords(wordlist,length):
# returns a list of words from wordlist having a specified length
return[word for word in wordlist if len(word)==length]
def displayGuess(wordList):
#list of characters with letters correctly guessed and '_' for letters not quessed yet: returns the list as a String
return ' '.join(wordList)
def guessStart(word):
#returns a list of single characters '_' the same size as the wordToGuess
return ['_']*len(word)
def miss(guessList,wordToGuess, letter):
# helper function to use as an update for a counter for number of user misses
misses = 0
if letter in wordToGuess:
misses += 0
else:
misses +=1
return misses
def updateLetter(guessList,wordToGuess, letter):
# updates _ to the letter guessed if guessed correctly and then prints if this happens. If this doesn't happen, it prints as a miss, return updated guessList
for x in range(len(wordToGuess)):
if wordToGuess[x]==letter:
guessList[x]= letter
if letter in wordToGuess:
print "You guessed a letter!"
else:
print "That's a MISS"
return guessList
def playGame(words):
#setup for game, uses raw_inputs
guessLength = int(raw_input("how many letters in word to guess? ")) #how many letters in the word you want to guess
numberMisses = int(raw_input("how many misses allowed? ")) #how many misses can you allow in the game
wordsOfLength = getPossibleWords(words,guessLength) # creates list of all possible words with length inputted
wordToGuess = random.choice(wordsOfLength) # random choice from above list
guessList = guessStart(wordToGuess) # creates guessList as underscores for every letter in word
count = 0 #counter for number of guesses
misses = 0 #counter for number of misses
strAlphabet = "abcdefghijklmnopqrstuvwxyz" #will remove letters as they are guessed
while True:
if guessList.count('_') == 0: # all letters guessed
break
print "guessed so far:", displayGuess(guessList)
letter = raw_input("guess a letter: ") #guess
if letter == "+": #guess the word if inputted
guess = raw_input("guess the word:")
if guess == wordToGuess:
print "THAT'S RIGHT! YOU WIN!"
break #game ends
else:
print "That's wrong. BUMMER. You lose. The word was:", wordToGuess
break #game ends
updateLetter(guessList, wordToGuess, letter) #updates guesslist
strAlphabet = strAlphabet.replace(letter,"") #removes guessed letter from string of alphabet
print "letters not guessed:", strAlphabet
count +=1 #count +1 for number of guesses
misses += miss (guessList, wordToGuess, letter) #updates number of misses
if misses == numberMisses: #number of misses used up
break #game ends
print numberMisses - misses, "misses left" #total misses inputted minus how many you missed
print "guess a letter or enter + to guess the word"
# prints game over based on spaces cleared or misses used up
if guessList.count('_') == 0 and misses < numberMisses:
print "You win. You guessed the word", wordToGuess
print "You guessed", count," times"
elif misses == numberMisses:
print "You lost, word was", wordToGuess
print "You guessed incorrectly", misses, "times, smh"
if __name__ == '__main__':
words = fileToStringList('lowerwords.txt')
playGame(words)
| [
"noreply@github.com"
] | prathmeshpatel.noreply@github.com |
fd9d88ea405216244963a2f1d054b06ca60ec7cb | f73c18586be66640a362c19ca1fe6816bcc34ca6 | /ml_pipeline/tests/test_mlflow.py | 55da1a65a54e8db8327c607f1ab2a9d20f4598e9 | [
"MIT"
] | permissive | TianhaoFu/cloud_ml_platform | 1b46034ef5aada154180938a58319fa7d67cf732 | 66508abbffdda1b75dd4267e3da1838ecb59c423 | refs/heads/main | 2023-06-05T17:11:05.685864 | 2021-06-24T05:08:13 | 2021-06-24T05:08:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 476 | py | import mlflow
import os
from random import random, randint
from mlflow import log_metric, log_param
def test_mlflow():
base_uri = os.environ.get('BASE_URI')
tracking_uri = base_uri + '/mlflow' if base_uri else ''
mlflow.set_tracking_uri(tracking_uri)
# Log a parameter (key-value pair)
log_param("param1", randint(0, 100))
# Log a metric; metrics can be updated throughout the run
log_metric("foo", random())
log_metric("foo", random() + 1)
| [
"myoilbox@gmail.com"
] | myoilbox@gmail.com |
c655ec659eb34d34fc137ef60ca4dd3dcf62b5ec | 0f39e47e2538c8469b558fdf14e06781d8b390a3 | /playground/detection/coco/yolof/yolof.res101.C5.1x/config.py | 78088d11fc7eaea988b0ee97f3e5cd6d73fad74c | [
"Apache-2.0",
"MIT"
] | permissive | baodijun/YOLOF | d1bdaee4de22acc0290edc5951943739c1971e88 | 905209bfd58d1ed67908cfa0685de05a89d3fd6c | refs/heads/main | 2023-03-25T05:03:11.998150 | 2021-03-19T15:03:01 | 2021-03-19T15:03:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,790 | py | from cvpods.configs.base_detection_config import BaseDetectionConfig
_config_dict = dict(
MODEL=dict(
# Backbone NAME: "build_resnet_backbone"
RESNETS=dict(DEPTH=101, OUT_FEATURES=["res5"]),
ANCHOR_GENERATOR=dict(
SIZES=[[32, 64, 128, 256, 512]],
ASPECT_RATIOS=[[1.0]]
),
YOLOF=dict(
ENCODER=dict(
IN_FEATURES=["res5"],
NUM_CHANNELS=512,
BLOCK_MID_CHANNELS=128,
NUM_RESIDUAL_BLOCKS=4,
BLOCK_DILATIONS=[2, 4, 6, 8],
NORM="BN",
ACTIVATION="ReLU"
),
DECODER=dict(
IN_CHANNELS=512,
NUM_CLASSES=80,
NUM_ANCHORS=5,
CLS_NUM_CONVS=2,
REG_NUM_CONVS=4,
NORM="BN",
ACTIVATION="ReLU",
PRIOR_PROB=0.01
),
BBOX_REG_WEIGHTS=(1.0, 1.0, 1.0, 1.0),
ADD_CTR_CLAMP=True,
CTR_CLAMP=32,
MATCHER_TOPK=4,
POS_IGNORE_THRESHOLD=0.15,
NEG_IGNORE_THRESHOLD=0.7,
FOCAL_LOSS_GAMMA=2.0,
FOCAL_LOSS_ALPHA=0.25,
SCORE_THRESH_TEST=0.05,
TOPK_CANDIDATES_TEST=1000,
NMS_THRESH_TEST=0.6
),
),
DATASETS=dict(
TRAIN=("coco_2017_train",),
TEST=("coco_2017_val",),
),
DATALOADER=dict(NUM_WORKERS=8),
SOLVER=dict(
LR_SCHEDULER=dict(
STEPS=(15000, 20000),
MAX_ITER=22500,
WARMUP_FACTOR=0.00066667,
WARMUP_ITERS=1500
),
OPTIMIZER=dict(
NAME="D2SGD",
BASE_LR=0.12,
BIAS_LR_FACTOR=1.0,
WEIGHT_DECAY=0.0001,
WEIGHT_DECAY_NORM=0.0,
MOMENTUM=0.9,
BACKBONE_LR_FACTOR=0.334
),
IMS_PER_BATCH=64,
IMS_PER_DEVICE=8,
),
INPUT=dict(
AUG=dict(
TRAIN_PIPELINES=[
("ResizeShortestEdge", dict(
short_edge_length=(800,), max_size=1333,
sample_style="choice")),
("RandomFlip", dict()),
("RandomShift", dict(max_shifts=32))
],
TEST_PIPELINES=[
("ResizeShortestEdge", dict(
short_edge_length=800, max_size=1333,
sample_style="choice")),
],
),
# Whether the model needs RGB, YUV, HSV etc.
FORMAT="BGR",
),
)
class YOLOFConfig(BaseDetectionConfig):
def __init__(self, d=None, **kwargs):
super().__init__(d, **kwargs)
self._register_configuration(_config_dict)
config = YOLOFConfig()
| [
"qiang.chen@nlpr.ia.ac.cn"
] | qiang.chen@nlpr.ia.ac.cn |
1998f40d200a554665e76178c4a6f06101755f94 | 74d11e4000d99e43dc4c53c93ac59782ebbe1802 | /portrait/deeplab/model_test.py | c586ccd0ea5c6626ab32562bec21e041fdf8b7cc | [
"Apache-2.0"
] | permissive | hiepgaf/portrait | f450971e8881e9bcd1f386966651a9a01c1d11ce | 930a167cbb368cdc2cf906b06b70c035d87e6938 | refs/heads/master | 2020-03-19T00:14:06.916160 | 2018-05-14T05:57:29 | 2018-05-14T05:57:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 941 | py | """Tests for encoder"""
import numpy as np
import tensorflow as tf
from model import deeplab_v3_plus_model
def create_test_inputs(batch, height, width, channels):
"""Create mock Images """
if None in [batch, height, width, channels]:
return tf.placeholder(tf.float32, (batch, height, width, channels))
else:
return tf.to_float(
np.tile(np.reshape(
np.reshape(np.arange(height), [height, 1]) +
np.reshape(np.arange(width), [1, width]),
[1, height, width, 1]),
[batch, 1, 1, channels]))
class DeepLabV3PlusTest(tf.test.TestCase):
def testBuildDeepLabV3Plus(self):
""""Encoder Constructor Test"""
images = create_test_inputs(2, 224, 224, 3)
encoded_features, _ = deeplab_v3_plus_model(
images=images)
self.assertListEqual(
encoded_features.get_shape().as_list(),
[2, 28, 28, 256])
if __name__ == '__main__':
tf.test.main()
| [
"tdat.nguyen93@gmail.com"
] | tdat.nguyen93@gmail.com |
37c3ab3420c73bbf6ec48d698d397aa157c521b6 | 4013b4b4e513a6ecccaa88fbda7d8c427a28b481 | /openemory/accounts/migrations/0015_add_data_archive.py | 2a46effd658b541276e18167710b8556882b8b5e | [
"Apache-2.0"
] | permissive | alexBLR/OpenEmory | 1d4922a986c1e872bd9dd2656abb030bdc43d0a7 | d5306c7b60003d7681340786d115c78fc6f34661 | refs/heads/master | 2020-12-25T10:10:13.138691 | 2015-08-12T15:21:54 | 2015-08-12T15:21:54 | 40,536,243 | 0 | 0 | null | 2015-08-11T10:35:44 | 2015-08-11T10:35:44 | null | UTF-8 | Python | false | false | 12,931 | py | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.flatpages.models import FlatPage, Site
# This a acutally a FlatPage data migration but there was not good place to put it outer than here.
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Don't use "from appname.models import ModelName".
# Use orm.ModelName to refer to models in this application,
# and orm['appname.ModelName'] for models in other applications.
s = Site.objects.get(id='1')
f = FlatPage(url='/data-archiving/', title='Data Archiving', content='(info about data archiving)')
f.save()
f.sites.add(s)
f.save()
def backwards(self, orm):
"Write your backwards methods here."
models = {
'accounts.announcement': {
'Meta': {'object_name': 'Announcement'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'end': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {'max_length': '500'}),
'start': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
},
'accounts.bookmark': {
'Meta': {'object_name': 'Bookmark'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'pid': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'accounts.degree': {
'Meta': {'object_name': 'Degree'},
'holder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['accounts.UserProfile']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'institution': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
'year': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'})
},
'accounts.esdperson': {
'Meta': {'object_name': 'EsdPerson', 'db_table': '\'"esdv"."v_oem_fclt"\'', 'managed': 'False', 'db_tablespace': "'esdv'"},
'_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True', 'db_column': "'prsn_i'"}),
'ad_name': ('django.db.models.fields.CharField', [], {'max_length': '75', 'db_column': "'prsn_n_dspl_acdr'"}),
'department_id': ('django.db.models.fields.CharField', [], {'max_length': '10', 'db_column': "'dprt_c'"}),
'department_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'db_column': "'dprt8dtry_n'"}),
'directory_name': ('django.db.models.fields.CharField', [], {'max_length': '75', 'db_column': "'prsn_n_full_dtry'"}),
'directory_suppressed': ('openemory.accounts.fields.YesNoBooleanField', [], {'default': 'False', 'db_column': "'prsn_f_sprs_dtry'"}),
'division_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'db_column': "'dvsn_i'"}),
'division_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'db_column': "'dvsn8dtry_n'"}),
'email': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_column': "'emad_n'"}),
'email_forward': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_column': "'emad8frwd_n'"}),
'employee_status': ('django.db.models.fields.CharField', [], {'max_length': '1', 'db_column': "'emjo_c_stts_empe'"}),
'faculty_flag': ('openemory.accounts.fields.YesNoBooleanField', [], {'default': 'False', 'max_length': '1', 'db_column': "'empe_f_fclt'"}),
'fax': ('django.db.models.fields.CharField', [], {'max_length': '12', 'db_column': "'prad_a_fax_empe_fmtt'"}),
'firstmid_name': ('django.db.models.fields.CharField', [], {'max_length': '20', 'db_column': "'prsn_n_fm_dtry'"}),
'information_suppressed': ('openemory.accounts.fields.YesNoBooleanField', [], {'default': 'False', 'db_column': "'prsn_f_sprs_infr'"}),
'internet_suppressed': ('openemory.accounts.fields.YesNoBooleanField', [], {'default': 'False', 'db_column': "'prsn_f_sprs_intt'"}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '25', 'db_column': "'prsn_n_last_dtry'"}),
'mailstop_code': ('django.db.models.fields.CharField', [], {'max_length': '12', 'db_column': "'mlst_i'"}),
'mailstop_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'db_column': "'mlst_n'"}),
'name_suffix': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_column': "'prsn_n_sufx_dtry'"}),
'netid': ('django.db.models.fields.CharField', [], {'max_length': '8', 'db_column': "'logn8ntwr_i'"}),
'person_type': ('django.db.models.fields.CharField', [], {'max_length': '1', 'db_column': "'prsn_c_type'"}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '12', 'db_column': "'prad_a_tlph_empe_fmtt'"}),
'ppid': ('django.db.models.fields.CharField', [], {'max_length': '8', 'db_column': "'prsn_i_pblc'"}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '70', 'db_column': "'prsn_e_titl_dtry'"})
},
'accounts.externallink': {
'Meta': {'object_name': 'ExternalLink'},
'holder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['accounts.UserProfile']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
},
'accounts.grant': {
'Meta': {'object_name': 'Grant'},
'grantee': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['accounts.UserProfile']"}),
'grantor': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}),
'project_title': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}),
'year': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'})
},
'accounts.position': {
'Meta': {'object_name': 'Position'},
'holder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['accounts.UserProfile']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '200'})
},
'accounts.userprofile': {
'Meta': {'ordering': "['user__username']", 'object_name': 'UserProfile'},
'biography': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'dept_num': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'employee_num': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'full_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'hr_id': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nonfaculty_profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'photo': ('django.db.models.fields.files.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}),
'show_suppressed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'subdept_code': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'})
},
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}
complete_apps = ['accounts']
symmetrical = True
| [
"athom09@emory.edu"
] | athom09@emory.edu |
b69e51e5659b5d82c82d2fd63ceaef1eb4b4624b | 3da9b0ebd7f4378e1f0a0fe60b943e041d760719 | /simplemooc/courses/migrations/0007_auto_20211026_1450.py | 45d89225d95d2be94b6d1fc008887de946c7efda | [] | no_license | gabriel-valenga/Python3NaWebComDjangoUdemy | b9f5d3f5127eff0247f5a89ff82a04c441dd7332 | 381c0dda61ef7984154686fcd1858b9eb9655a18 | refs/heads/master | 2023-08-21T04:38:52.119456 | 2021-10-28T21:30:05 | 2021-10-28T21:30:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 537 | py | # Generated by Django 3.2.8 on 2021-10-26 17:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0006_remove_course_about'),
]
operations = [
migrations.RemoveField(
model_name='course',
name='description',
),
migrations.AddField(
model_name='course',
name='start_date',
field=models.DateField(blank=True, null=True, verbose_name='Data de ínicio'),
),
]
| [
"gabrielvalengalemos@yahoo.com"
] | gabrielvalengalemos@yahoo.com |
ec16e406e8d72d362730558816a5f89cd01e3f47 | 5127f3db0b6eaf658273925a2b44321d8b4067f3 | /bases/models.py | 4181b6b12ba7886956392284fdae5b5803e9019e | [] | no_license | AlejooRob/SistemcomprasfacturasDjango | bce611417c05e770eda692ca66e8f320ac8cbbc7 | 98053a73b2f063c24676c8bf5632ef75233e20a6 | refs/heads/main | 2023-05-02T00:02:02.308681 | 2021-05-19T15:29:35 | 2021-05-19T15:29:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 903 | py | from django.db import models
from django.contrib.auth.models import User
from django_userforeignkey.models.fields import UserForeignKey
class ClassModel(models.Model):
estado = models.BooleanField(default=True)
fc = models.DateTimeField(auto_now_add=True)
fm = models.DateTimeField(auto_now=True)
uc = models.ForeignKey(User, on_delete=models.CASCADE)
um = models.IntegerField(blank=True,null=True)
class Meta:
abstract=True
class ClassModel2(models.Model):
estado = models.BooleanField(default=True)
fc = models.DateTimeField(auto_now_add=True)
fm = models.DateTimeField(auto_now=True)
# uc = models.ForeignKey(User, on_delete=models.CASCADE)
# um = models.IntegerField(blank=True,null=True)
uc= UserForeignKey(auto_user_add=True,related_name='+')
um= UserForeignKey(auto_user=True,related_name='+')
class Meta:
abstract=True | [
"alejolink001@gmail.com"
] | alejolink001@gmail.com |
5486a88353c3ff9a71da6e4fb6e0dd86a820b8d9 | 2d4821fb383287080eacc70941ba43c12c9cb73f | /RepairService/welcome/views.py | 15c39fe09773f7f9224780c5a4ef306713098701 | [] | no_license | chirag12357/school_django | 2b2b5e1496d6c488550963c791c906ec98e19093 | 702fa7b030d6cdeb7f4821129af0f19af7b142ee | refs/heads/master | 2020-09-07T20:11:30.117230 | 2019-11-12T13:28:47 | 2019-11-12T13:28:47 | 220,901,228 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 128 | py | from django.shortcuts import render
# Create your views here.
def welcfunc(request):
return render(request,"welcome.html")
| [
"noreply@github.com"
] | chirag12357.noreply@github.com |
1596a3bc363dc0db81d5748b98371958e64dd2d8 | f63fa6561b3c3f39fae8a7e3a37e7862b7103e70 | /loop.py | b24f1de5ac9959e594eb83112757c1586b014d7e | [
"MIT"
] | permissive | maxreciprocate/Looper | eebbea08f6e96917c3f3a4162b0961d42b0b958d | 0f7c56a52a540b768054fd174bab940992906e93 | refs/heads/master | 2023-06-07T15:40:27.985275 | 2019-10-30T03:55:00 | 2019-10-30T03:55:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 6,715 | py | import os
import sys
import numpy as np
from mpg123 import Mpg123, Out123
class MusicFile:
def __init__(self, filename):
# Load the file, if it exists and is an mp3 file
if os.path.exists(filename) and os.path.isfile(filename):
if filename[-3:].lower() == 'mp3':
mp3 = Mpg123(filename)
else:
raise TypeError(
"This script can currently only handle MP3 files.")
else:
raise FileNotFoundError("Specified file not found.")
# Get the waveform data from the mp3 file
frames = list(mp3.iter_frames())
self.frames = frames
# Get the metadata from the mp3 file
self.rate, self.channels, self.encoding = mp3.get_format()
def calculate_max_frequencies(self):
"""Uses the real Fourier transform to get the frequencies over
time for the file. Records the strongest frequency over time from
a "fingerprint" region associated with the song's melody.
"""
# Fourier transform each frame of the file
frame_ffts = []
# The first 1 and last 2 frames are omitted since they are
# frequently of different lengths than the rest of the file
start_frame, end_frame = (1, len(self.frames) - 2)
for i in range(start_frame, end_frame):
# Decode the frame (stored as a byte array)
# into a numpy int16 array
# (NOTE: this assumes a 16-bit encoding, which was true
# for the files tested, but won't necessarily always be true
arr = np.frombuffer(self.frames[i], dtype=np.int16)
# Take just the first channel, so that we only need
# to work with one time series
arr = arr[::self.channels]
# Perform the Fourier transform
frame_fft = np.abs(np.fft.rfft(arr))
frame_ffts.append(frame_fft)
# Convert the list of ffts to a numpy.ndarray (easier to work with)
fft_2d = np.stack(frame_ffts)
# Get frequency information
# (Should be identical for each frame, except sometimes
# the first and last frames, which we omitted)
frame_freq = np.fft.rfftfreq(len(arr))
# Clip the data to a smaller range of frequencies. For the files
# tested, this range corresponded to a "fingerprint" region
# where the actual melody resides.
clip_start, clip_end = (1, 25)
frame_freq_sub = frame_freq[clip_start:clip_end]
fft_2d_sub = fft_2d[:, clip_start:clip_end]
# Mask out low-amplitude frequencies so that we don't match to noise
# (this is done on a proportional threshold
# since absolute magnitudes vary)
fft_2d_denoise = np.ma.masked_where(
(fft_2d_sub.T < fft_2d_sub.max() * 0.25),
fft_2d_sub.T, 0)
# Finally, get the dominant frequency for each frame
# (and mask it to omit any points where the dominant frequency is
# just the baseline frequency)
max_freq = frame_freq_sub[np.argmax(fft_2d_denoise, axis=0)]
self.max_freq = np.ma.masked_where(max_freq == frame_freq_sub[0],
max_freq)
def sig_corr(self, s1, s2, comp_length):
"""Calculates the auto-correlation of the track (as compressed into
max_freq) with itself, based on sub-samples starting at frames
s1 and s2, each comp_length frames long."""
# np.corrcoef returns an array of coefficients -
# the simple 'R' value is at row 1, col 0
return np.corrcoef(
self.max_freq[s1:s1+comp_length],
self.max_freq[s2:s2+comp_length])[1, 0]
def pct_match(self, s1, s2, comp_length):
"""Calculates the percentage of matching notes between
two subsamples of self.max_freq, each one comp_length notes long,
one starting at s1 and one starting at s2
"""
matches = (self.max_freq[s1:s1+comp_length] ==
self.max_freq[s2:s2+comp_length])
return np.ma.sum(matches) / np.ma.count(matches)
def find_loop_point(self, start_offset=200, test_len=500):
"""Finds matches based on auto-correlation over a portion
of the music track."""
# Using heuristics for the test length and "loop to" point.
# NOTE: this algorithm is arbitrary and could certainly be improved,
# especially for cases where the loop point is not totally clear
max_corr = 0
best_start = None
best_end = None
for start in range(200, len(self.max_freq) - test_len,
int(len(self.max_freq) / 10)):
for end in range(start + 500, len(self.max_freq) - test_len):
sc = self.sig_corr(start, end, test_len)
if sc > max_corr:
best_start = start
best_end = end
max_corr = sc
return (best_start, best_end, max_corr)
def time_of_frame(self, frame):
samples_per_sec = self.rate * self.channels
# NOTE: division by 2 assumes 16-bit encoding
samples_per_frame = len(self.frames[1]) / 2
frames_per_sec = samples_per_sec / samples_per_frame
time_sec = frame / frames_per_sec
return "{:02.0f}:{:06.3f}".format(
time_sec // 60,
time_sec % 60
)
def play_looping(self, start_offset, loop_offset):
out = Out123()
out.start(self.rate, self.channels, self.encoding)
i = 0
try:
while True:
out.play(self.frames[i])
i += 1
if i == loop_offset:
i = start_offset
except KeyboardInterrupt:
print() # so that the program ends on a newline
def loop_track(filename):
try:
# Load the file
print("Loading {}...".format(filename))
track = MusicFile(filename)
track.calculate_max_frequencies()
start_offset, best_offset, best_corr = track.find_loop_point()
print("Playing with loop from {} back to {} ({:.0f}% match)".format(
track.time_of_frame(best_offset),
track.time_of_frame(start_offset),
best_corr * 100))
print("(press Ctrl+C to exit)")
track.play_looping(start_offset, best_offset)
except (TypeError, FileNotFoundError) as e:
print("Error: {}".format(e))
if __name__ == '__main__':
# Load the file
if len(sys.argv) == 2:
loop_track(sys.argv[1])
else:
print("Error: No file specified.",
"\nUsage: python3 loop.py file.mp3")
| [
"nolananicholson@gmail.com"
] | nolananicholson@gmail.com |
9c798312fb973574870b50564f097af475b494c3 | 9b5715ad23991bd94d0cf6257683af69638be534 | /faceRec/utils.py | 8e9a8e87f93bda945015b70134501ac9608b9d7e | [] | no_license | amessadiqi/facerec | 7364be109f21d52a3477977b371814185a3d7ae2 | f363798a182e7f17e843bd413cf3fdc38c90846b | refs/heads/master | 2022-12-10T21:54:57.962493 | 2020-09-17T15:18:58 | 2020-09-17T15:18:58 | 296,343,019 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,566 | py | import os
import random
import string
import face_recognition
from faceRec.models import db, User
def add_user(email, password, first_name, last_name, gender, profile_picture, birthday, address):
user = User(email=email,
password=password,
first_name=first_name,
last_name=last_name,
gender=gender,
profile_picture=profile_picture,
birthday=birthday,
address=address)
db.session.add(user)
db.session.commit()
def find_user_by_email(email):
return User.query.filter_by(email=email).first()
def find_user_by_id(id):
return User.query.filter_by(id=id).first()
def get_users():
return User.query.all()
# Return User object or False if not found
def find_user_by_image(image):
users = get_users()
for user in users:
known_image = face_recognition.load_image_file(os.path.dirname(__file__) + user.profile_picture)
unknown_image = face_recognition.load_image_file(image)
biden_encoding = face_recognition.face_encodings(known_image)[0]
unknown_encoding = face_recognition.face_encodings(unknown_image)[0]
results = face_recognition.compare_faces([biden_encoding], unknown_encoding)
if results[0] == True:
return user
return False
def save_uploaded_image(image, dir):
image_filename = ''.join(
random.choices(string.ascii_uppercase + string.digits, k=5)) + image.filename
image_uri = dir + image_filename
image_path = os.path.dirname(__file__) + image_uri
image.save(image_path)
return image_path, image_uri, image_filename
def compare_faces(img1, img2):
image1 = face_recognition.load_image_file(img1)
image2 = face_recognition.load_image_file(img2)
encoding1 = face_recognition.face_encodings(image1)[0]
encoding2 = face_recognition.face_encodings(image2)[0]
return face_recognition.compare_faces([encoding1], encoding2)
def detect_faces(img_path, img_filename, scaleFactor=1.1):
import cv2
colored_img = cv2.imread(img_path)
f_cascade = cv2.CascadeClassifier(r'C:\Users\lenovo\Desktop\faceRec\faceRec\haarcascade_frontalface_alt.xml')
img_copy = colored_img.copy()
gray = cv2.cvtColor(img_copy, cv2.COLOR_BGR2GRAY)
faces = f_cascade.detectMultiScale(gray, scaleFactor=scaleFactor, minNeighbors=5)
for (x, y, w, h) in faces:
cv2.rectangle(img_copy, (x, y), (x + w, y + h), (0, 255, 0), 2)
cv2.imwrite(img_path, img_copy)
return img_filename
| [
"amessadiqi@gmail.com"
] | amessadiqi@gmail.com |
3091099fee02328c00c32ce85434caa6c2918a00 | d2fdd6b10b0467913971d1408a9a4053f0be9ffb | /datahub/investment/project/migrations/0033_add_investment_document_permission.py | 87a514117458d20c8bf84bc4f1155a3ce0c0b8eb | [] | no_license | jakub-kozlowski/data-hub-leeloo | fc5ecebb5e4d885c824fc7c85acad8837fcc5c76 | 7f033fcbcfb2f7c1c0e10bec51620742d3d929df | refs/heads/master | 2020-05-18T13:29:14.145251 | 2019-04-30T12:12:50 | 2019-04-30T12:12:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 728 | py | # Generated by Django 2.0.1 on 2018-01-09 16:32
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('investment', '0032_investmentproject_comments'),
]
operations = [
migrations.AlterModelOptions(
name='investmentproject',
options={'default_permissions': ('add', 'change_all', 'delete'), 'permissions': (('read_all_investmentproject', 'Can read all investment project'), ('read_associated_investmentproject', 'Can read associated investment project'), ('change_associated_investmentproject', 'Can change associated investment project'), ('read_investmentproject_document', 'Can read investment project document'))},
),
]
| [
"reupen@users.noreply.github.com"
] | reupen@users.noreply.github.com |
63067b766fec7b99acd1864cd7e39787c0f755b8 | 50bd87708a19ac7003c2cc3e2834047acc684eb9 | /网络通信/009_协程_greenlet.py | 2c58a061e2d437e27cd1f328ba6a45a786b1f80c | [] | no_license | lzxysf/python | db30bef343bb02d99c3f2a0f96c4c942b69b8b52 | 7d1f09b788eec293ae0bddcc0117e2dcd8a79f0b | refs/heads/master | 2020-12-05T06:43:24.461101 | 2020-04-08T13:21:02 | 2020-04-08T13:21:02 | 232,037,659 | 0 | 0 | null | 2020-04-08T13:14:39 | 2020-01-06T06:23:20 | Python | UTF-8 | Python | false | false | 443 | py | '''
为了更好使用协程来完成多任务,python中的greenlet模块对其封装,从而使得切换任务变的更加简单
'''
from greenlet import greenlet
import time
def test1():
while True:
print('----A----')
time.sleep(0.5)
gr2.switch()
def test2():
while True:
print('----B----')
time.sleep(0.5)
gr1.switch()
gr1 = greenlet(test1)
gr2 = greenlet(test2)
gr1.switch()
| [
"lzxysf@qq.com"
] | lzxysf@qq.com |
41399fad248b0a0094d4e199dd1c4adfebedd1a3 | fbfd842136ce51a598801d1db8a383633f6ef65b | /CP/Competetive Programming And DSA/codechef5.py | 0c25e1b5b9fa3b2bd3d58fe41d022c3b5ad4f14c | [] | no_license | jayz25/MiniProjects-And-CP | 6d74fd1b58d10036235520a1d10d928f45d5d542 | 40eb2f0f3449e77e02424fcc8fa80597f2a83bf6 | refs/heads/master | 2023-06-11T03:04:50.348564 | 2021-06-20T18:42:55 | 2021-06-20T18:42:55 | 366,385,384 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,043 | py | '''
2
8 38
7 8 19 7 8 7 10 20
4 5
2 10 4 9
7
2
'''
def some(N,K,l):
if sum(l)<=(2*K):
return -1
S = K
res = []
for i in range(N):
if l[i]<=S:
S = S - l[i]
count+=1
res.append(i)
if S<=0:
break
for i in res:
del l[i]
for i in range(1,len(l)+1):
if sum[:i]>=K:
count+=i
return count
return -1
def co(N,K,l):
K=K*2
subs = ([[0 for i in range(K+1)]for i in range(N+1)])
for i in range(1,K+1):
subs[0][i] = 10**9-1
for i in range(1,N+1):
for j in range(1,K+1):
if l[i-1] > j:
subs[i][j] = subs[i-1][j]
else:
subs[i][j] = min(subs[i-1][j],subs[i][j-l[i-1]]+1)
return subs[N][K]
T = int(input())
while T!=0:
N, K = map(int,input().split())
l = list(map(int,input().split()))
l.sort(reverse=True)
print(co(N,K,l))
T-=1
| [
"patiljayesh026@gmail.com"
] | patiljayesh026@gmail.com |
3c5c13bc7708b7f1f902b92f1224968214201cf3 | 110e46dfe166dd00854ef70549e942c644a8775b | /Python_ Ejercicios/Ingreso_Linkedin.py | 60586d80479683aa40a8652b9dd681c5d8cdab60 | [] | no_license | silvina84/TrabajosPython | 1b573cd594b998cee8f5c73fb4de924ac0f13998 | afe2fdf2662229b8f2d98af0211638b03e12e690 | refs/heads/master | 2023-03-02T11:55:14.722338 | 2021-02-10T22:55:58 | 2021-02-10T22:55:58 | 337,839,896 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,880 | py | #Login con usuario y contraseña en Linkedin
import xlrd #Para leer archivos excel
import pandas
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait #Llama a un subpaquete dentro de selenium , es para esperar
from selenium.webdriver.support import expected_conditions as ec
from selenium.common.exceptions import NoSuchElementException
excel_credenciales = 'C:\\Users\\silvina\\Documents\\Datos_Linkedin.xlsx'
df = pandas.read_excel(excel_credenciales)
user = df['usuario'][0]
psw = df['contraseña'][0]
url = 'https://www.linkedin.com/'
#Selectores
boton_iniciar_sesion = 'body > nav > div > a.nav__button-secondary'
ingreso_usuario = '#username'
ingreso_contrasenia = '#password'
boton_login = '#app__container > main > div:nth-child(2) > form > div.login__form_action_container > button'
error_contrasenia ='#error-for-password'
xpath_error_psw = '//*[@id="error-for-password"]'
#Abrir navegador
driver = webdriver.Chrome("C:\\chromedriver_win32\\chromedriver.exe")
#Maximizar pantalla
driver.maximize_window()
driver.get(url)
#Busco el elemento de Iniciar Sesion
driver.find_element_by_css_selector(boton_iniciar_sesion).click()
#Ahora nos logueamos, utilizo un bloque try-except para atrapar excepciones
try:
driver.find_element_by_css_selector(ingreso_usuario).send_keys(user)
driver.find_element_by_css_selector(ingreso_contrasenia).send_keys(psw)
driver.find_element_by_css_selector(boton_login).click()
driver.find_element_by_xpath(xpath_error_psw)
except Exception as ex:
print(ex)
print("Ingreso correcto a la página")
else:
print("La contrasenia ingresada es incorrecta")
#Le damos un tiempo de 3 segundos para que cargue la página
time.sleep(3)
#Cerramos el driver
driver.quit()
| [
"silvinacace@gmail.com"
] | silvinacace@gmail.com |
88e209e71bd5abada8fca06441598115041c3409 | 00b9d05d36e403aafe33becfd738bedb4e6927ae | /Day3/DbConnectionDemo.py | 1adcbed723c57dedaae5901a1e36c11a8aa64490 | [] | no_license | ShahUjval/Python | 9383b2b4f5c519096a4496db3862d1adaffc2ea2 | e49d9f148a08b8e8bd8e5d58aa5c2b9ee1984523 | refs/heads/master | 2021-01-20T20:18:06.616409 | 2016-06-03T09:37:38 | 2016-06-03T09:37:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 271 | py | import MySQLdb
conn = MySQLdb.connect('localhost','root','katieholmes123','python')
conn.autocommit(True)
query = "Select version()"
cur = conn.cursor()
cur.execute(query)
print cur.description[0][0]
print '-' * 22
print cur.fetchone()[0]
cur.close() | [
"shah.ujval@gmail.com"
] | shah.ujval@gmail.com |
1a1c0596441aa2d97790c1857301e569d6e85134 | c5ba9519273bf864c91f3564c8a63e4a7fd729fb | /xitongguanli/xitongdemo/user/urls.py | cf3e991f0e16acb7b8133ed48f43a42353760154 | [] | no_license | tainsir/xitongguanli | b318e8c8b708192f79106ec9d4f64804e4875e3e | 8c619bf8c5e5f665bc1e0d1b9d8700eb1249f00c | refs/heads/master | 2020-08-03T12:16:24.656311 | 2019-09-30T05:08:59 | 2019-09-30T05:08:59 | 211,750,152 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,821 | py | from django.conf.urls import url
from . import views
app_name = "user"
urlpatterns = [
# ------------------- 用户登陆url ----------------------------
url(r'^login/$', views.login, name='login'), # 用户登陆
url(r'^login_out/$', views.login_out, name="login_out"), # 用户退出
# ------------------- 系统首页的url ----------------------------
url(r"^choice/$", views.choice, name="choice"), # 选择用户和组织
url(r'^starter/$', views.starter, name='starter'), # 系统首页
#---------------------搜索-------------------------------
url(r"^search/$" , views.search , name = "search"),
# ------------------- 用户CRUD的url ----------------------------
url(r'^user/$', views.show_all_user, name="show_all_user"), # 点击用户进入用户界面
url(r'^(?P<u_id>\d+)/user_details/', views.user_details, name="user_details"), # 展示用户详情页面
url(r'^add_user/$', views.add_user, name='add_user'), # 新增用户
url(r'^(?P<u_id>\d+)/edit_user/$', views.edit_user, name='edit_user'), # 修改用户
url(r'^(?P<u_id>\d+)/delete/$', views.delete, name='delete'), # 删除用户
# ------------------- 角色CRUD的url ----------------------------
url(r'^role/$', views.show_all_role, name='show_all_role'), # 显示所有操作项和角色
url(r'^new_role/$', views.new_role, name='new_role'), # 新建角色
url(r'^edit_role/(?P<rid>\d+)/$', views.edit_role, name='edit_role'), # 编辑角色
url(r'^del_role/$', views.del_role, name='del_role'), # 删除(停用)角色
#---------------------角色权限--------------------------------------
url(r'^show_opeartion/$' , views.show_opeartion , name = "show_opeartion"),
url(r'^show_role/$' , views.show_role , name = "show_role"),
]
| [
"noreply@github.com"
] | tainsir.noreply@github.com |
6ae67fd3e9663fc9ea82a6080b85773cce01b42f | b485f7721e01cd55c9043b3ca4dde374216384fc | /task1/cgi/show.py | 7f23ab0fa42bb35c9777cf777b7ca15eaa2d167c | [] | no_license | anastasiarudenko/lab3_3.9 | 4a01194cfd967d4110621e8a85b221db1efd1bd8 | b794c01e0d795c160f3919aca73ed9f9549329e4 | refs/heads/master | 2022-09-04T10:29:42.477377 | 2020-05-25T10:46:27 | 2020-05-25T10:46:27 | 266,750,756 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 241 | py | #!/usr/bin/env python3
import cgi
import html
f = open('data.txt', 'r')
text = f.read()
f.close()
print("Content-type:text/html\r\n\r\n")
print("<h2>With escaping: %s</h2>" % html.escape(text))
print("<h2>Without escaping: %s</h2>" % text)
| [
"cyanidecalcium@yandex.ru"
] | cyanidecalcium@yandex.ru |
7c819f3f0a6e6339a8d5382922dddc7f7b4c6af1 | ddfb9db447f098485b1c9672de08ca97aeea3501 | /trespalabras.py | fdd484147e5240f7ef22bf291766e47e21cb756f | [] | no_license | AlbertoFido/fido1 | 7a1e9ffc87263ae2ad9cf0491aa94dfe9b299561 | ef5ba4e9eb6456e8612908b049a3e6ec57e4e7f9 | refs/heads/master | 2016-09-01T14:41:36.814675 | 2016-03-17T19:46:02 | 2016-03-17T19:46:02 | 43,089,293 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 495 | py | def checkio(words):
cad2=words.split(' ')
contador=0
salida = False
for ele in cad2:
if ele.isalpha():
contador+=1
else:
contador = 0
if contador >= 3:
salida = True
return salida
print checkio("start 5 one two three 7 end")
#True
print checkio("Hello World hello")
#== True, "Hello"
print checkio("He is 123 man")
#== False, "123 man"
print checkio("1 2 3 4")
# == False, "Digits"
print checkio("bla bla bla bla")
# == True, "Bla Bla"
print checkio("Hi")
# == False, "Hi"
| [
"albertofido92@gmail.com"
] | albertofido92@gmail.com |
1fcd94d623978daffea0a24521a7a469988c6c4a | 743d2aa865b22d7707a845fb2a015096d62778b5 | /embed2geo.py | 59cf41ea45050b90e01d3e96c66f392e5859cbe0 | [] | no_license | Yonghui56/coord2geo_GMSH | dcab900497da350cec7f95278ba5e3b11742b35a | 82d35b2533efbfb2798b63ce0301fb6daff26960 | refs/heads/master | 2020-06-20T00:33:37.256259 | 2019-07-15T05:34:25 | 2019-07-15T05:34:25 | 196,929,602 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,130 | py | # Python Program for quick gmsh grid gen
import string,sys
def convert_pts_togmsh(filename,outputname,startpoint):
# Read in data using this bit
fin=open(filename, 'r')
i=0
x = []; y = []; z = [];
lines = fin.readlines()
for line in lines:
# comments indicated by #
if line[0] != '#' or line[0] != '':
i=i+1
data = str.split(line)
x.append(float(data[0]))
y.append(float(data[1]))
z.append(float(data[2]))
n_lines = int(i)
# Write data out with this;
fout = open(outputname,'w')
lc_name = "%s_lc" % filename[0:3]
# Format
# Point(1) = {0, 0, 0, lc};
fout.write("%s = 0.005;\n" % lc_name)
j = startpoint
for i in range(n_lines):
outputline = "Point{%i} In Surface{1};\n " \
% (j)
j = j + 1
fout.write(outputline)
# gmsh bspline format
# Write out splinefit line
#fout.write("Spline(%i) = {%i:%i};\n" \
# % (startpoint,startpoint,startpoint+n_lines-1))
fout.close
fin.close
def main():
inputfile = sys.argv[1]
convert_pts_togmsh(inputfile,inputfile+".geo",1)
if __name__ == "__main__":
main()
| [
"noreply@github.com"
] | Yonghui56.noreply@github.com |
343c17bb1ca6baf99ce4f13cd5186e9c00b5d09a | 1201b15c891116d0475926d3db707a053f480ab3 | /config.py | 898ffc64792fb9a2aaa9ae4b2d92c8060f4ec5e7 | [
"MIT"
] | permissive | PeARSearch/PeARS | 701708be4525c47c2ffed750adf1688a4ddfc419 | f97f416071a22826798188bcd75ce4d3e4f2623d | refs/heads/master | 2020-04-05T03:18:34.334948 | 2017-07-22T12:33:18 | 2017-07-22T12:33:18 | 50,421,624 | 64 | 14 | null | 2017-07-22T12:33:19 | 2016-01-26T10:30:24 | DM | UTF-8 | Python | false | false | 434 | py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
# db configurations - not using now
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')
SQLALCHEMY_BINDS = {
'wikiwoods': 'sqlite:///' + os.path.join(basedir, 'wikiwoods.db')
}
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
CSRF_ENABLED = True
SECRET_KEY='parayan-manasilla'
| [
"hrishi.kb@gmail.com"
] | hrishi.kb@gmail.com |
4a2f9b5baa86079690190cf78a776554744e8271 | c5cad31bfc771d3261d1eead8e31856c19eb5e74 | /publishTool/assembleTest_D05_7.py | 3bf657b7e122eea1a22d8512b50fc9ff0a277b9e | [] | no_license | alpha0080/mayaTool | 61b649825d85b88de2d24e9260e23f5c5aa559cb | 153da6e987d13fb7311ee55a2a3e635bc8c7afde | refs/heads/master | 2021-01-19T11:52:03.715437 | 2018-05-07T10:30:23 | 2018-05-07T10:30:23 | 88,001,018 | 0 | 0 | null | null | null | null | BIG5 | Python | false | false | 190,588 | py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:/Users/alpha.DESKTOP-1S1STEK/Documents/GitHub/mayaTool/publishTool/assembleTest_B01.ui'
#
# Created: Thu Jul 06 16:28:26 2017
# by: pyside2-uic running on PySide2 2.0.0~alpha0
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore, QtGui, QtWidgets
import maya.cmds as cmds
import pymel.core as pm
import json
import os
#from pprint import pprint
import datetime
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(650, 860)
MainWindow.setMinimumSize(QtCore.QSize(650, 860))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(41, 61, 55))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(61, 91, 82))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(51, 76, 68))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(20, 30, 27))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(27, 40, 36))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(41, 61, 55))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(20, 30, 27))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(41, 61, 55))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(61, 91, 82))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(51, 76, 68))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(20, 30, 27))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(27, 40, 36))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(41, 61, 55))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(20, 30, 27))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(20, 30, 27))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(41, 61, 55))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(61, 91, 82))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(51, 76, 68))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(20, 30, 27))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(27, 40, 36))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(20, 30, 27))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(20, 30, 27))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(41, 61, 55))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(41, 61, 55))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(41, 61, 55))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
MainWindow.setPalette(palette)
MainWindow.setAutoFillBackground(False)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.frame_21 = QtWidgets.QFrame(self.centralwidget)
self.frame_21.setGeometry(QtCore.QRect(590, 31, 56, 56))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
self.frame_21.setPalette(palette)
self.frame_21.setFrameShape(QtWidgets.QFrame.Box)
self.frame_21.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_21.setLineWidth(1)
self.frame_21.setMidLineWidth(0)
self.frame_21.setObjectName("frame_21")
self.pushButton_P3_changePageA = QtWidgets.QPushButton(self.frame_21)
self.pushButton_P3_changePageA.setEnabled(True)
self.pushButton_P3_changePageA.setGeometry(QtCore.QRect(2, 3, 25, 25))
self.pushButton_P3_changePageA.setText("")
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/connerA.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3_changePageA.setIcon(icon)
self.pushButton_P3_changePageA.setIconSize(QtCore.QSize(25, 25))
self.pushButton_P3_changePageA.setCheckable(True)
self.pushButton_P3_changePageA.setAutoDefault(False)
self.pushButton_P3_changePageA.setDefault(False)
self.pushButton_P3_changePageA.setFlat(True)
self.pushButton_P3_changePageA.setObjectName("pushButton_P3_changePageA")
self.pushButton_P3_changePageB = QtWidgets.QPushButton(self.frame_21)
self.pushButton_P3_changePageB.setEnabled(True)
self.pushButton_P3_changePageB.setGeometry(QtCore.QRect(27, 3, 25, 25))
self.pushButton_P3_changePageB.setText("")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/connerB.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3_changePageB.setIcon(icon1)
self.pushButton_P3_changePageB.setIconSize(QtCore.QSize(25, 25))
self.pushButton_P3_changePageB.setCheckable(True)
self.pushButton_P3_changePageB.setAutoDefault(False)
self.pushButton_P3_changePageB.setDefault(False)
self.pushButton_P3_changePageB.setFlat(True)
self.pushButton_P3_changePageB.setObjectName("pushButton_P3_changePageB")
self.pushButton_P3_changePageC = QtWidgets.QPushButton(self.frame_21)
self.pushButton_P3_changePageC.setEnabled(True)
self.pushButton_P3_changePageC.setGeometry(QtCore.QRect(2, 28, 25, 25))
self.pushButton_P3_changePageC.setText("")
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/connerC.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3_changePageC.setIcon(icon2)
self.pushButton_P3_changePageC.setIconSize(QtCore.QSize(25, 25))
self.pushButton_P3_changePageC.setCheckable(True)
self.pushButton_P3_changePageC.setAutoDefault(False)
self.pushButton_P3_changePageC.setDefault(False)
self.pushButton_P3_changePageC.setFlat(True)
self.pushButton_P3_changePageC.setObjectName("pushButton_P3_changePageC")
self.pushButton_P3_changePageD = QtWidgets.QPushButton(self.frame_21)
self.pushButton_P3_changePageD.setEnabled(True)
self.pushButton_P3_changePageD.setGeometry(QtCore.QRect(27, 28, 25, 25))
self.pushButton_P3_changePageD.setText("")
icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/connerD.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3_changePageD.setIcon(icon3)
self.pushButton_P3_changePageD.setIconSize(QtCore.QSize(25, 25))
self.pushButton_P3_changePageD.setCheckable(True)
self.pushButton_P3_changePageD.setAutoDefault(False)
self.pushButton_P3_changePageD.setDefault(False)
self.pushButton_P3_changePageD.setFlat(True)
self.pushButton_P3_changePageD.setObjectName("pushButton_P3_changePageD")
self.frame_5 = QtWidgets.QFrame(self.centralwidget)
self.frame_5.setGeometry(QtCore.QRect(435, 32, 151, 56))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
self.frame_5.setPalette(palette)
self.frame_5.setFrameShape(QtWidgets.QFrame.Box)
self.frame_5.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_5.setLineWidth(1)
self.frame_5.setMidLineWidth(0)
self.frame_5.setObjectName("frame_5")
self.label_fileData_19 = QtWidgets.QLabel(self.frame_5)
self.label_fileData_19.setGeometry(QtCore.QRect(50, 0, 20, 20))
font = QtGui.QFont()
font.setFamily("Calibri")
font.setPointSize(8)
self.label_fileData_19.setFont(font)
self.label_fileData_19.setAlignment(QtCore.Qt.AlignCenter)
self.label_fileData_19.setObjectName("label_fileData_19")
self.label_fileData_20 = QtWidgets.QLabel(self.frame_5)
self.label_fileData_20.setGeometry(QtCore.QRect(15, 0, 20, 20))
font = QtGui.QFont()
font.setFamily("Calibri")
font.setPointSize(8)
self.label_fileData_20.setFont(font)
self.label_fileData_20.setAlignment(QtCore.Qt.AlignCenter)
self.label_fileData_20.setObjectName("label_fileData_20")
self.label_fileData_21 = QtWidgets.QLabel(self.frame_5)
self.label_fileData_21.setGeometry(QtCore.QRect(85, 0, 20, 20))
font = QtGui.QFont()
font.setFamily("Calibri")
font.setPointSize(8)
self.label_fileData_21.setFont(font)
self.label_fileData_21.setAlignment(QtCore.Qt.AlignCenter)
self.label_fileData_21.setObjectName("label_fileData_21")
self.label_fileData_22 = QtWidgets.QLabel(self.frame_5)
self.label_fileData_22.setGeometry(QtCore.QRect(120, 0, 20, 20))
font = QtGui.QFont()
font.setFamily("Calibri")
font.setPointSize(8)
self.label_fileData_22.setFont(font)
self.label_fileData_22.setAlignment(QtCore.Qt.AlignCenter)
self.label_fileData_22.setObjectName("label_fileData_22")
self.pushButton_P3_largeIcon = QtWidgets.QPushButton(self.frame_5)
self.pushButton_P3_largeIcon.setEnabled(True)
self.pushButton_P3_largeIcon.setGeometry(QtCore.QRect(10, 20, 30, 30))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
self.pushButton_P3_largeIcon.setPalette(palette)
self.pushButton_P3_largeIcon.setAutoFillBackground(False)
self.pushButton_P3_largeIcon.setText("")
icon4 = QtGui.QIcon()
icon4.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChoose_Large_Close.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon4.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseLarge.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon4.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseLarge.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
icon4.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseLarge.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
self.pushButton_P3_largeIcon.setIcon(icon4)
self.pushButton_P3_largeIcon.setIconSize(QtCore.QSize(30, 30))
self.pushButton_P3_largeIcon.setCheckable(True)
self.pushButton_P3_largeIcon.setChecked(False)
self.pushButton_P3_largeIcon.setAutoRepeat(False)
self.pushButton_P3_largeIcon.setAutoExclusive(False)
self.pushButton_P3_largeIcon.setAutoDefault(False)
self.pushButton_P3_largeIcon.setDefault(False)
self.pushButton_P3_largeIcon.setFlat(True)
self.pushButton_P3_largeIcon.setObjectName("pushButton_P3_largeIcon")
self.pushButton_P3_MidIcon = QtWidgets.QPushButton(self.frame_5)
self.pushButton_P3_MidIcon.setEnabled(True)
self.pushButton_P3_MidIcon.setGeometry(QtCore.QRect(45, 20, 30, 30))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
self.pushButton_P3_MidIcon.setPalette(palette)
self.pushButton_P3_MidIcon.setAutoFillBackground(False)
self.pushButton_P3_MidIcon.setText("")
icon5 = QtGui.QIcon()
icon5.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChoose_Mid_Close.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon5.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseMid.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon5.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseMid.png"), QtGui.QIcon.Active, QtGui.QIcon.On)
icon5.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseMid.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
icon5.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseMid.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
self.pushButton_P3_MidIcon.setIcon(icon5)
self.pushButton_P3_MidIcon.setIconSize(QtCore.QSize(30, 30))
self.pushButton_P3_MidIcon.setCheckable(True)
self.pushButton_P3_MidIcon.setChecked(False)
self.pushButton_P3_MidIcon.setAutoRepeat(False)
self.pushButton_P3_MidIcon.setAutoExclusive(False)
self.pushButton_P3_MidIcon.setAutoDefault(False)
self.pushButton_P3_MidIcon.setDefault(False)
self.pushButton_P3_MidIcon.setFlat(True)
self.pushButton_P3_MidIcon.setObjectName("pushButton_P3_MidIcon")
self.pushButton_P3_smallIcon = QtWidgets.QPushButton(self.frame_5)
self.pushButton_P3_smallIcon.setEnabled(True)
self.pushButton_P3_smallIcon.setGeometry(QtCore.QRect(80, 20, 30, 30))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
self.pushButton_P3_smallIcon.setPalette(palette)
self.pushButton_P3_smallIcon.setAutoFillBackground(False)
self.pushButton_P3_smallIcon.setText("")
icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChoose_Small_Close.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon6.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseSmall.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon6.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseSmall.png"), QtGui.QIcon.Active, QtGui.QIcon.On)
icon6.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseSmall.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
icon6.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseSmall.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
self.pushButton_P3_smallIcon.setIcon(icon6)
self.pushButton_P3_smallIcon.setIconSize(QtCore.QSize(30, 30))
self.pushButton_P3_smallIcon.setCheckable(True)
self.pushButton_P3_smallIcon.setChecked(False)
self.pushButton_P3_smallIcon.setAutoRepeat(False)
self.pushButton_P3_smallIcon.setAutoExclusive(False)
self.pushButton_P3_smallIcon.setAutoDefault(False)
self.pushButton_P3_smallIcon.setDefault(False)
self.pushButton_P3_smallIcon.setFlat(True)
self.pushButton_P3_smallIcon.setObjectName("pushButton_P3_smallIcon")
self.pushButton_P3_text = QtWidgets.QPushButton(self.frame_5)
self.pushButton_P3_text.setEnabled(True)
self.pushButton_P3_text.setGeometry(QtCore.QRect(115, 20, 30, 30))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
self.pushButton_P3_text.setPalette(palette)
self.pushButton_P3_text.setAutoFillBackground(False)
self.pushButton_P3_text.setText("")
icon7 = QtGui.QIcon()
icon7.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChoose_Text_Close.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon7.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseText.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon7.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseText.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
icon7.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/sizeChooseText.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
self.pushButton_P3_text.setIcon(icon7)
self.pushButton_P3_text.setIconSize(QtCore.QSize(30, 30))
self.pushButton_P3_text.setCheckable(True)
self.pushButton_P3_text.setChecked(False)
self.pushButton_P3_text.setAutoRepeat(False)
self.pushButton_P3_text.setAutoExclusive(False)
self.pushButton_P3_text.setAutoDefault(False)
self.pushButton_P3_text.setDefault(False)
self.pushButton_P3_text.setFlat(True)
self.pushButton_P3_text.setObjectName("pushButton_P3_text")
self.frame_6 = QtWidgets.QFrame(self.centralwidget)
self.frame_6.setGeometry(QtCore.QRect(5, 32, 221, 56))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
self.frame_6.setPalette(palette)
self.frame_6.setFrameShape(QtWidgets.QFrame.Box)
self.frame_6.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_6.setLineWidth(1)
self.frame_6.setMidLineWidth(0)
self.frame_6.setObjectName("frame_6")
self.pushButton_P3_deletSelectItem = QtWidgets.QPushButton(self.frame_6)
self.pushButton_P3_deletSelectItem.setGeometry(QtCore.QRect(150, 20, 30, 30))
self.pushButton_P3_deletSelectItem.setText("")
icon8 = QtGui.QIcon()
icon8.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/deletePublishB.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3_deletSelectItem.setIcon(icon8)
self.pushButton_P3_deletSelectItem.setIconSize(QtCore.QSize(30, 30))
self.pushButton_P3_deletSelectItem.setFlat(True)
self.pushButton_P3_deletSelectItem.setObjectName("pushButton_P3_deletSelectItem")
self.pushButton_P3_selectItem = QtWidgets.QPushButton(self.frame_6)
self.pushButton_P3_selectItem.setGeometry(QtCore.QRect(50, 15, 35, 35))
self.pushButton_P3_selectItem.setText("")
icon9 = QtGui.QIcon()
icon9.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/getSelectItemPublishB.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3_selectItem.setIcon(icon9)
self.pushButton_P3_selectItem.setIconSize(QtCore.QSize(35, 35))
self.pushButton_P3_selectItem.setFlat(True)
self.pushButton_P3_selectItem.setObjectName("pushButton_P3_selectItem")
self.label_fileData_43 = QtWidgets.QLabel(self.frame_6)
self.label_fileData_43.setGeometry(QtCore.QRect(145, 0, 46, 20))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(248, 255, 235))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(248, 255, 235))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(85, 127, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
self.label_fileData_43.setPalette(palette)
font = QtGui.QFont()
font.setFamily("Calibri")
font.setPointSize(8)
self.label_fileData_43.setFont(font)
self.label_fileData_43.setAlignment(QtCore.Qt.AlignCenter)
self.label_fileData_43.setObjectName("label_fileData_43")
self.label_fileData_40 = QtWidgets.QLabel(self.frame_6)
self.label_fileData_40.setGeometry(QtCore.QRect(45, -3, 46, 20))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(248, 255, 235))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(248, 255, 235))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(85, 127, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
self.label_fileData_40.setPalette(palette)
font = QtGui.QFont()
font.setFamily("Calibri")
font.setPointSize(8)
self.label_fileData_40.setFont(font)
self.label_fileData_40.setAlignment(QtCore.Qt.AlignCenter)
self.label_fileData_40.setObjectName("label_fileData_40")
self.pushButton_P3_refreshInputItem = QtWidgets.QPushButton(self.frame_6)
self.pushButton_P3_refreshInputItem.setGeometry(QtCore.QRect(5, 15, 35, 35))
self.pushButton_P3_refreshInputItem.setText("")
icon10 = QtGui.QIcon()
icon10.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/refreshPublishB.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3_refreshInputItem.setIcon(icon10)
self.pushButton_P3_refreshInputItem.setIconSize(QtCore.QSize(35, 35))
self.pushButton_P3_refreshInputItem.setFlat(True)
self.pushButton_P3_refreshInputItem.setObjectName("pushButton_P3_refreshInputItem")
self.label_fileData_39 = QtWidgets.QLabel(self.frame_6)
self.label_fileData_39.setGeometry(QtCore.QRect(0, -3, 46, 20))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(248, 255, 235))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(248, 255, 235))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(85, 127, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
self.label_fileData_39.setPalette(palette)
font = QtGui.QFont()
font.setFamily("Calibri")
font.setPointSize(8)
self.label_fileData_39.setFont(font)
self.label_fileData_39.setAlignment(QtCore.Qt.AlignCenter)
self.label_fileData_39.setObjectName("label_fileData_39")
self.frame_8 = QtWidgets.QFrame(self.centralwidget)
self.frame_8.setGeometry(QtCore.QRect(609, 90, 36, 531))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
self.frame_8.setPalette(palette)
self.frame_8.setFrameShape(QtWidgets.QFrame.Box)
self.frame_8.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_8.setLineWidth(1)
self.frame_8.setMidLineWidth(0)
self.frame_8.setObjectName("frame_8")
self.pushButton_P3_openBranchJson = QtWidgets.QPushButton(self.frame_8)
self.pushButton_P3_openBranchJson.setEnabled(True)
self.pushButton_P3_openBranchJson.setGeometry(QtCore.QRect(3, 472, 25, 25))
self.pushButton_P3_openBranchJson.setText("")
icon11 = QtGui.QIcon()
icon11.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/option2-512.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3_openBranchJson.setIcon(icon11)
self.pushButton_P3_openBranchJson.setIconSize(QtCore.QSize(25, 25))
self.pushButton_P3_openBranchJson.setCheckable(True)
self.pushButton_P3_openBranchJson.setAutoDefault(False)
self.pushButton_P3_openBranchJson.setDefault(False)
self.pushButton_P3_openBranchJson.setFlat(True)
self.pushButton_P3_openBranchJson.setObjectName("pushButton_P3_openBranchJson")
self.pushButton_P3_loadFile = QtWidgets.QPushButton(self.frame_8)
self.pushButton_P3_loadFile.setEnabled(True)
self.pushButton_P3_loadFile.setGeometry(QtCore.QRect(3, 440, 25, 25))
self.pushButton_P3_loadFile.setText("")
icon12 = QtGui.QIcon()
icon12.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/load60.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3_loadFile.setIcon(icon12)
self.pushButton_P3_loadFile.setIconSize(QtCore.QSize(27, 25))
self.pushButton_P3_loadFile.setCheckable(True)
self.pushButton_P3_loadFile.setAutoDefault(False)
self.pushButton_P3_loadFile.setDefault(False)
self.pushButton_P3_loadFile.setFlat(True)
self.pushButton_P3_loadFile.setObjectName("pushButton_P3_loadFile")
self.pushButton_P3_processModeling = QtWidgets.QPushButton(self.frame_8)
self.pushButton_P3_processModeling.setEnabled(True)
self.pushButton_P3_processModeling.setGeometry(QtCore.QRect(5, 5, 25, 25))
self.pushButton_P3_processModeling.setText("")
icon13 = QtGui.QIcon()
icon13.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processMod_C_OFF.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon13.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processMod_C_ON.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon13.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processMod_C_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.Off)
icon13.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processMod_C_ON.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
icon13.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processMod_C_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
self.pushButton_P3_processModeling.setIcon(icon13)
self.pushButton_P3_processModeling.setIconSize(QtCore.QSize(25, 25))
self.pushButton_P3_processModeling.setCheckable(True)
self.pushButton_P3_processModeling.setAutoDefault(False)
self.pushButton_P3_processModeling.setDefault(False)
self.pushButton_P3_processModeling.setFlat(True)
self.pushButton_P3_processModeling.setObjectName("pushButton_P3_processModeling")
self.pushButton_P3_processTexture = QtWidgets.QPushButton(self.frame_8)
self.pushButton_P3_processTexture.setEnabled(True)
self.pushButton_P3_processTexture.setGeometry(QtCore.QRect(5, 31, 25, 25))
self.pushButton_P3_processTexture.setText("")
icon14 = QtGui.QIcon()
icon14.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processTex_C_ON.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon14.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processText_C_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
icon14.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processText_C_OFF.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon14.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processText_C_OFF.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
icon14.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processText_C_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.Off)
icon14.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processTex_C_ON.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
icon14.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processTex_C_ON.png"), QtGui.QIcon.Active, QtGui.QIcon.On)
self.pushButton_P3_processTexture.setIcon(icon14)
self.pushButton_P3_processTexture.setIconSize(QtCore.QSize(25, 25))
self.pushButton_P3_processTexture.setCheckable(True)
self.pushButton_P3_processTexture.setAutoDefault(False)
self.pushButton_P3_processTexture.setDefault(False)
self.pushButton_P3_processTexture.setFlat(True)
self.pushButton_P3_processTexture.setObjectName("pushButton_P3_processTexture")
self.pushButton_P3_processRigging = QtWidgets.QPushButton(self.frame_8)
self.pushButton_P3_processRigging.setEnabled(True)
self.pushButton_P3_processRigging.setGeometry(QtCore.QRect(5, 57, 25, 25))
self.pushButton_P3_processRigging.setText("")
icon15 = QtGui.QIcon()
icon15.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processRig_C_ON.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon15.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processRig_C_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
icon15.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processRig_C_OFF.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon15.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processRig_C_OFF.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
icon15.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processRig_C_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.Off)
icon15.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processRig_C_ON.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
self.pushButton_P3_processRigging.setIcon(icon15)
self.pushButton_P3_processRigging.setIconSize(QtCore.QSize(25, 25))
self.pushButton_P3_processRigging.setCheckable(True)
self.pushButton_P3_processRigging.setAutoDefault(False)
self.pushButton_P3_processRigging.setDefault(False)
self.pushButton_P3_processRigging.setFlat(True)
self.pushButton_P3_processRigging.setObjectName("pushButton_P3_processRigging")
self.pushButton_P3_inputMayaOn = QtWidgets.QPushButton(self.frame_8)
self.pushButton_P3_inputMayaOn.setEnabled(True)
self.pushButton_P3_inputMayaOn.setGeometry(QtCore.QRect(3, 230, 25, 25))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
self.pushButton_P3_inputMayaOn.setPalette(palette)
self.pushButton_P3_inputMayaOn.setAutoFillBackground(False)
self.pushButton_P3_inputMayaOn.setText("")
icon16 = QtGui.QIcon()
icon16.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOption_Maya_ON.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon16.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOption_maya_Off.png"), QtGui.QIcon.Active, QtGui.QIcon.Off)
icon16.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOption_maya_Off.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
icon16.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOption_maya_Off.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon16.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOption_Maya_ON.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
icon16.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOption_maya_Off.png"), QtGui.QIcon.Disabled, QtGui.QIcon.Off)
icon16.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOption_Maya_ON.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
icon16.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOption_Maya_ON.png"), QtGui.QIcon.Active, QtGui.QIcon.On)
self.pushButton_P3_inputMayaOn.setIcon(icon16)
self.pushButton_P3_inputMayaOn.setIconSize(QtCore.QSize(25, 25))
self.pushButton_P3_inputMayaOn.setCheckable(True)
self.pushButton_P3_inputMayaOn.setChecked(False)
self.pushButton_P3_inputMayaOn.setAutoRepeat(False)
self.pushButton_P3_inputMayaOn.setAutoExclusive(False)
self.pushButton_P3_inputMayaOn.setAutoDefault(False)
self.pushButton_P3_inputMayaOn.setDefault(False)
self.pushButton_P3_inputMayaOn.setFlat(True)
self.pushButton_P3_inputMayaOn.setObjectName("pushButton_P3_inputMayaOn")
self.pushButton_P3_inputRibOn = QtWidgets.QPushButton(self.frame_8)
self.pushButton_P3_inputRibOn.setEnabled(True)
self.pushButton_P3_inputRibOn.setGeometry(QtCore.QRect(3, 265, 25, 25))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
self.pushButton_P3_inputRibOn.setPalette(palette)
self.pushButton_P3_inputRibOn.setAutoFillBackground(False)
self.pushButton_P3_inputRibOn.setText("")
icon17 = QtGui.QIcon()
icon17.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOptionRIB_On.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon17.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOption_Rib_Off.png"), QtGui.QIcon.Active, QtGui.QIcon.Off)
icon17.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOption_Rib_Off.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
icon17.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOption_Rib_Off.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon17.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOptionRIB_On.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
icon17.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOption_Rib_Off.png"), QtGui.QIcon.Disabled, QtGui.QIcon.Off)
icon17.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOptionRIB_On.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
icon17.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/InputOptionRIB_On.png"), QtGui.QIcon.Active, QtGui.QIcon.On)
self.pushButton_P3_inputRibOn.setIcon(icon17)
self.pushButton_P3_inputRibOn.setIconSize(QtCore.QSize(25, 25))
self.pushButton_P3_inputRibOn.setCheckable(True)
self.pushButton_P3_inputRibOn.setChecked(False)
self.pushButton_P3_inputRibOn.setAutoRepeat(False)
self.pushButton_P3_inputRibOn.setAutoExclusive(False)
self.pushButton_P3_inputRibOn.setAutoDefault(False)
self.pushButton_P3_inputRibOn.setDefault(False)
self.pushButton_P3_inputRibOn.setFlat(True)
self.pushButton_P3_inputRibOn.setObjectName("pushButton_P3_inputRibOn")
self.pushButton_P3_NA = QtWidgets.QPushButton(self.frame_8)
self.pushButton_P3_NA.setEnabled(True)
self.pushButton_P3_NA.setGeometry(QtCore.QRect(5, 83, 25, 25))
self.pushButton_P3_NA.setText("")
icon18 = QtGui.QIcon()
icon18.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processNA_C_ON.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon18.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processNA_C_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
icon18.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processNA_C_OFF.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon18.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processNA_C_OFF.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
icon18.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processNA_C_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.Off)
icon18.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/processNA_C_ON.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
self.pushButton_P3_NA.setIcon(icon18)
self.pushButton_P3_NA.setIconSize(QtCore.QSize(25, 25))
self.pushButton_P3_NA.setCheckable(True)
self.pushButton_P3_NA.setAutoDefault(False)
self.pushButton_P3_NA.setDefault(False)
self.pushButton_P3_NA.setFlat(True)
self.pushButton_P3_NA.setObjectName("pushButton_P3_NA")
self.pushButton_P3_packageAll = QtWidgets.QPushButton(self.frame_8)
self.pushButton_P3_packageAll.setGeometry(QtCore.QRect(3, 501, 25, 25))
self.pushButton_P3_packageAll.setText("")
icon19 = QtGui.QIcon()
icon19.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/package.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3_packageAll.setIcon(icon19)
self.pushButton_P3_packageAll.setIconSize(QtCore.QSize(25, 25))
self.pushButton_P3_packageAll.setFlat(True)
self.pushButton_P3_packageAll.setObjectName("pushButton_P3_packageAll")
self.comboBox = QtWidgets.QComboBox(self.centralwidget)
self.comboBox.setGeometry(QtCore.QRect(360, 5, 286, 22))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(19, 29, 26))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(14, 21, 19))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(19, 29, 26))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(14, 21, 19))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(19, 29, 26))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(14, 21, 19))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(14, 21, 19))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
self.comboBox.setPalette(palette)
self.comboBox.setObjectName("comboBox")
self.comboBox.addItem("")
self.frame_11 = QtWidgets.QFrame(self.centralwidget)
self.frame_11.setGeometry(QtCore.QRect(227, 32, 206, 56))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
self.frame_11.setPalette(palette)
self.frame_11.setFrameShape(QtWidgets.QFrame.Box)
self.frame_11.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_11.setLineWidth(1)
self.frame_11.setMidLineWidth(0)
self.frame_11.setObjectName("frame_11")
self.pushButton_page3_other = QtWidgets.QPushButton(self.frame_11)
self.pushButton_page3_other.setEnabled(True)
self.pushButton_page3_other.setGeometry(QtCore.QRect(170, 20, 30, 30))
self.pushButton_page3_other.setText("")
icon20 = QtGui.QIcon()
icon20.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_other_ON.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon20.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_other_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
icon20.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_other_OFF.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon20.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_other_OFF.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
icon20.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_other_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.Off)
icon20.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_other_ON.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
self.pushButton_page3_other.setIcon(icon20)
self.pushButton_page3_other.setIconSize(QtCore.QSize(30, 30))
self.pushButton_page3_other.setCheckable(True)
self.pushButton_page3_other.setAutoDefault(False)
self.pushButton_page3_other.setDefault(False)
self.pushButton_page3_other.setFlat(True)
self.pushButton_page3_other.setObjectName("pushButton_page3_other")
self.pushButton_page3_vehicle = QtWidgets.QPushButton(self.frame_11)
self.pushButton_page3_vehicle.setEnabled(True)
self.pushButton_page3_vehicle.setGeometry(QtCore.QRect(77, 20, 30, 30))
self.pushButton_page3_vehicle.setText("")
icon21 = QtGui.QIcon()
icon21.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_veh_ON.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon21.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_veh_OFF.png"), QtGui.QIcon.Active, QtGui.QIcon.Off)
icon21.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_veh_OFF.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
icon21.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_veh_OFF.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon21.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_veh_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
icon21.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_veh_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.Off)
icon21.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_veh_ON.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
icon21.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_veh_ON.png"), QtGui.QIcon.Active, QtGui.QIcon.On)
self.pushButton_page3_vehicle.setIcon(icon21)
self.pushButton_page3_vehicle.setIconSize(QtCore.QSize(30, 30))
self.pushButton_page3_vehicle.setCheckable(True)
self.pushButton_page3_vehicle.setAutoDefault(False)
self.pushButton_page3_vehicle.setDefault(False)
self.pushButton_page3_vehicle.setFlat(True)
self.pushButton_page3_vehicle.setObjectName("pushButton_page3_vehicle")
self.pushButton_page3_all = QtWidgets.QPushButton(self.frame_11)
self.pushButton_page3_all.setEnabled(True)
self.pushButton_page3_all.setGeometry(QtCore.QRect(10, 20, 30, 30))
self.pushButton_page3_all.setText("")
icon22 = QtGui.QIcon()
icon22.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_all_ON.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon22.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_all_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
icon22.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_all_OFF.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon22.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_all_OFF.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
icon22.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_all_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.Off)
icon22.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_all_ON.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
self.pushButton_page3_all.setIcon(icon22)
self.pushButton_page3_all.setIconSize(QtCore.QSize(30, 30))
self.pushButton_page3_all.setCheckable(True)
self.pushButton_page3_all.setAutoDefault(False)
self.pushButton_page3_all.setDefault(False)
self.pushButton_page3_all.setFlat(True)
self.pushButton_page3_all.setObjectName("pushButton_page3_all")
self.pushButton_page3_props = QtWidgets.QPushButton(self.frame_11)
self.pushButton_page3_props.setEnabled(True)
self.pushButton_page3_props.setGeometry(QtCore.QRect(139, 20, 30, 30))
self.pushButton_page3_props.setText("")
icon23 = QtGui.QIcon()
icon23.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_prop_ON.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon23.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_prop_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
icon23.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_prop_OFF.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon23.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_prop_OFF.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
icon23.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_prop_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.Off)
icon23.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_prop_ON.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
self.pushButton_page3_props.setIcon(icon23)
self.pushButton_page3_props.setIconSize(QtCore.QSize(30, 30))
self.pushButton_page3_props.setCheckable(True)
self.pushButton_page3_props.setAutoDefault(False)
self.pushButton_page3_props.setDefault(False)
self.pushButton_page3_props.setFlat(True)
self.pushButton_page3_props.setObjectName("pushButton_page3_props")
self.pushButton_page3_character = QtWidgets.QPushButton(self.frame_11)
self.pushButton_page3_character.setEnabled(True)
self.pushButton_page3_character.setGeometry(QtCore.QRect(46, 20, 30, 30))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
self.pushButton_page3_character.setPalette(palette)
self.pushButton_page3_character.setAutoFillBackground(False)
self.pushButton_page3_character.setText("")
icon24 = QtGui.QIcon()
icon24.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_cha_ON.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon24.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_cha_OFF.png"), QtGui.QIcon.Active, QtGui.QIcon.Off)
icon24.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_cha_OFF.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
icon24.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_cha_OFF.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon24.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_cha_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
icon24.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_cha_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.Off)
icon24.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_cha_ON.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
icon24.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_cha_ON.png"), QtGui.QIcon.Active, QtGui.QIcon.On)
self.pushButton_page3_character.setIcon(icon24)
self.pushButton_page3_character.setIconSize(QtCore.QSize(30, 30))
self.pushButton_page3_character.setCheckable(True)
self.pushButton_page3_character.setChecked(False)
self.pushButton_page3_character.setAutoRepeat(False)
self.pushButton_page3_character.setAutoExclusive(False)
self.pushButton_page3_character.setAutoDefault(False)
self.pushButton_page3_character.setDefault(False)
self.pushButton_page3_character.setFlat(True)
self.pushButton_page3_character.setObjectName("pushButton_page3_character")
self.pushButton_page3_set = QtWidgets.QPushButton(self.frame_11)
self.pushButton_page3_set.setEnabled(True)
self.pushButton_page3_set.setGeometry(QtCore.QRect(108, 20, 30, 30))
self.pushButton_page3_set.setText("")
icon25 = QtGui.QIcon()
icon25.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_set_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.On)
icon25.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_set_OFF.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon25.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_set_OFF.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
icon25.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_set_OFF.png"), QtGui.QIcon.Disabled, QtGui.QIcon.Off)
icon25.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_set_ON.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
icon25.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/assetType_set_ON.png"), QtGui.QIcon.Active, QtGui.QIcon.On)
self.pushButton_page3_set.setIcon(icon25)
self.pushButton_page3_set.setIconSize(QtCore.QSize(30, 30))
self.pushButton_page3_set.setCheckable(True)
self.pushButton_page3_set.setAutoDefault(False)
self.pushButton_page3_set.setDefault(False)
self.pushButton_page3_set.setFlat(True)
self.pushButton_page3_set.setObjectName("pushButton_page3_set")
self.plainTextEdit_assetMetaData = QtWidgets.QPlainTextEdit(self.centralwidget)
self.plainTextEdit_assetMetaData.setGeometry(QtCore.QRect(226, 625, 381, 210))
self.plainTextEdit_assetMetaData.setObjectName("plainTextEdit_assetMetaData")
self.tableWidget_AssetItemList = QtWidgets.QTableWidget(self.centralwidget)
self.tableWidget_AssetItemList.setGeometry(QtCore.QRect(226, 90, 381, 530))
self.tableWidget_AssetItemList.setLayoutDirection(QtCore.Qt.LeftToRight)
self.tableWidget_AssetItemList.setInputMethodHints(QtCore.Qt.ImhNone)
self.tableWidget_AssetItemList.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.tableWidget_AssetItemList.setDragEnabled(True)
self.tableWidget_AssetItemList.setDragDropMode(QtWidgets.QAbstractItemView.DragOnly)
self.tableWidget_AssetItemList.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.tableWidget_AssetItemList.setIconSize(QtCore.QSize(60, 60))
self.tableWidget_AssetItemList.setTextElideMode(QtCore.Qt.ElideNone)
self.tableWidget_AssetItemList.setRowCount(2)
self.tableWidget_AssetItemList.setColumnCount(2)
self.tableWidget_AssetItemList.setObjectName("tableWidget_AssetItemList")
self.tableWidget_AssetItemList.setColumnCount(2)
self.tableWidget_AssetItemList.setRowCount(2)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_AssetItemList.setItem(0, 0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_AssetItemList.setItem(0, 1, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_AssetItemList.setItem(1, 0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_AssetItemList.setItem(1, 1, item)
self.tableWidget_AssetItemList.horizontalHeader().setVisible(False)
self.tableWidget_AssetItemList.horizontalHeader().setCascadingSectionResizes(False)
self.tableWidget_AssetItemList.horizontalHeader().setDefaultSectionSize(120)
self.tableWidget_AssetItemList.horizontalHeader().setMinimumSectionSize(25)
self.tableWidget_AssetItemList.horizontalHeader().setSortIndicatorShown(False)
self.tableWidget_AssetItemList.horizontalHeader().setStretchLastSection(False)
self.tableWidget_AssetItemList.verticalHeader().setVisible(False)
self.tableWidget_AssetItemList.verticalHeader().setCascadingSectionResizes(False)
self.tableWidget_AssetItemList.verticalHeader().setDefaultSectionSize(120)
self.tableWidget_AssetItemList.verticalHeader().setHighlightSections(True)
self.tableWidget_AssetItemList.verticalHeader().setMinimumSectionSize(25)
self.frame_7 = QtWidgets.QFrame(self.centralwidget)
self.frame_7.setGeometry(QtCore.QRect(5, 625, 220, 210))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(185, 198, 185))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(121, 182, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(101, 151, 136))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(54, 80, 72))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(40, 60, 54))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(81, 121, 109))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
self.frame_7.setPalette(palette)
self.frame_7.setFrameShape(QtWidgets.QFrame.Box)
self.frame_7.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_7.setLineWidth(1)
self.frame_7.setMidLineWidth(0)
self.frame_7.setObjectName("frame_7")
self.label_showImage_2 = QtWidgets.QLabel(self.frame_7)
self.label_showImage_2.setGeometry(QtCore.QRect(10, 0, 211, 191))
self.label_showImage_2.setText("")
self.label_showImage_2.setPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/picture-01-150.png"))
self.label_showImage_2.setObjectName("label_showImage_2")
self.pushButton_P3addItemToLeftA = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_P3addItemToLeftA.setGeometry(QtCore.QRect(205, 90, 20, 60))
self.pushButton_P3addItemToLeftA.setText("")
icon26 = QtGui.QIcon()
icon26.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/addToLeftA.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3addItemToLeftA.setIcon(icon26)
self.pushButton_P3addItemToLeftA.setIconSize(QtCore.QSize(30, 120))
self.pushButton_P3addItemToLeftA.setFlat(True)
self.pushButton_P3addItemToLeftA.setObjectName("pushButton_P3addItemToLeftA")
self.pushButton_P3addItemToLeftB = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_P3addItemToLeftB.setGeometry(QtCore.QRect(205, 151, 20, 60))
self.pushButton_P3addItemToLeftB.setText("")
icon27 = QtGui.QIcon()
icon27.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/addToLeftB.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3addItemToLeftB.setIcon(icon27)
self.pushButton_P3addItemToLeftB.setIconSize(QtCore.QSize(25, 120))
self.pushButton_P3addItemToLeftB.setFlat(True)
self.pushButton_P3addItemToLeftB.setObjectName("pushButton_P3addItemToLeftB")
self.pushButton_P3addItemToLeftC = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_P3addItemToLeftC.setGeometry(QtCore.QRect(205, 212, 20, 60))
self.pushButton_P3addItemToLeftC.setText("")
icon28 = QtGui.QIcon()
icon28.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/addToLeftC.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3addItemToLeftC.setIcon(icon28)
self.pushButton_P3addItemToLeftC.setIconSize(QtCore.QSize(25, 120))
self.pushButton_P3addItemToLeftC.setFlat(True)
self.pushButton_P3addItemToLeftC.setObjectName("pushButton_P3addItemToLeftC")
self.pushButton_P3_addItem = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_P3_addItem.setGeometry(QtCore.QRect(205, 499, 20, 60))
self.pushButton_P3_addItem.setText("")
icon29 = QtGui.QIcon()
icon29.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/addB.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3_addItem.setIcon(icon29)
self.pushButton_P3_addItem.setIconSize(QtCore.QSize(20, 80))
self.pushButton_P3_addItem.setFlat(True)
self.pushButton_P3_addItem.setObjectName("pushButton_P3_addItem")
self.pushButton_P3_deleteItem = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_P3_deleteItem.setGeometry(QtCore.QRect(205, 560, 20, 60))
self.pushButton_P3_deleteItem.setText("")
icon30 = QtGui.QIcon()
icon30.addPixmap(QtGui.QPixmap("//mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/deleteB.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_P3_deleteItem.setIcon(icon30)
self.pushButton_P3_deleteItem.setIconSize(QtCore.QSize(20, 80))
self.pushButton_P3_deleteItem.setFlat(True)
self.pushButton_P3_deleteItem.setObjectName("pushButton_P3_deleteItem")
self.pushButton_P3_aux1 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_P3_aux1.setGeometry(QtCore.QRect(205, 273, 20, 60))
self.pushButton_P3_aux1.setText("")
self.pushButton_P3_aux1.setIcon(icon29)
self.pushButton_P3_aux1.setIconSize(QtCore.QSize(20, 80))
self.pushButton_P3_aux1.setFlat(True)
self.pushButton_P3_aux1.setObjectName("pushButton_P3_aux1")
self.pushButton_P3_aux2 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_P3_aux2.setGeometry(QtCore.QRect(205, 334, 20, 60))
self.pushButton_P3_aux2.setText("")
self.pushButton_P3_aux2.setIcon(icon29)
self.pushButton_P3_aux2.setIconSize(QtCore.QSize(20, 80))
self.pushButton_P3_aux2.setFlat(True)
self.pushButton_P3_aux2.setObjectName("pushButton_P3_aux2")
self.pushButton_P3_aux3 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_P3_aux3.setGeometry(QtCore.QRect(205, 395, 20, 60))
self.pushButton_P3_aux3.setText("")
self.pushButton_P3_aux3.setIcon(icon29)
self.pushButton_P3_aux3.setIconSize(QtCore.QSize(20, 80))
self.pushButton_P3_aux3.setFlat(True)
self.pushButton_P3_aux3.setObjectName("pushButton_P3_aux3")
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QtWidgets.QApplication.translate("MainWindow", "MainWindow", None, -1))
self.label_fileData_19.setText(QtWidgets.QApplication.translate("MainWindow", "M", None, -1))
self.label_fileData_20.setText(QtWidgets.QApplication.translate("MainWindow", "L", None, -1))
self.label_fileData_21.setText(QtWidgets.QApplication.translate("MainWindow", "S", None, -1))
self.label_fileData_22.setText(QtWidgets.QApplication.translate("MainWindow", "T", None, -1))
self.label_fileData_43.setText(QtWidgets.QApplication.translate("MainWindow", "Delete", None, -1))
self.label_fileData_40.setText(QtWidgets.QApplication.translate("MainWindow", "Select", None, -1))
self.label_fileData_39.setText(QtWidgets.QApplication.translate("MainWindow", "Refresh", None, -1))
self.comboBox.setItemText(0, QtWidgets.QApplication.translate("MainWindow", "Select Asset Pref Table", None, -1))
__sortingEnabled = self.tableWidget_AssetItemList.isSortingEnabled()
self.tableWidget_AssetItemList.setSortingEnabled(False)
self.tableWidget_AssetItemList.item(0, 0).setText(QtWidgets.QApplication.translate("MainWindow", "a", None, -1))
self.tableWidget_AssetItemList.item(0, 1).setText(QtWidgets.QApplication.translate("MainWindow", "a", None, -1))
self.tableWidget_AssetItemList.item(1, 0).setText(QtWidgets.QApplication.translate("MainWindow", "a", None, -1))
self.tableWidget_AssetItemList.item(1, 1).setText(QtWidgets.QApplication.translate("MainWindow", "a", None, -1))
self.tableWidget_AssetItemList.setSortingEnabled(__sortingEnabled)
# item = self.itemAt(event.pos())
#print item
# QtWidgets.QTreeWidget.mousePressEvent(self, event)
#if event.button() == QtCore.Qt.LeftButton:
# print 'press'
# selectItem = self.treeWidget_sceneAssembleTree.currentItem()
# self.treeWidget_sceneAssembleTree.mousePressEvent(selectItem)
# self.treeWidget_sceneAssembleTree.inde QtGui
class mod_MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self, parent= QtWidgets.QApplication.activeWindow()):
super(mod_MainWindow, self).__init__(parent)
#super(MyTreeWidget, self).__init__(parent)
# MyTreeWidget.__init__(self)
self.setupUi(self)
# tree = self.treeWidget_sceneAssembleTree
self.treeWidget_sceneAssembleTree = assetTreeInTheWorld(self)
#dir( self.setupUi(self))
self.typeListAllowDict = {'transform':[255,255,255], #item list could be move and edit
'mesh':[100,190,70],
'RenderManArchive':[200,100,100],
'gpuCache':[30,230,230],
'moreThanOneItemTheSameName':[255,0,0]
}
self.topLayerItemIndexDict = {'0':'character',
'1':'vehicle',
'2':'set',
'3':'prop',
'4':'other',
'5':'effect'}
#self.treeWidget_sceneAssembleTree.itemClicked.connect(self.treeItemClick)
#self.treeWidget_sceneAssembleTree.itemPressed.connect(self.treeItemClick) #
self.pushButton_P3_largeIcon.clicked.connect(self.setLargeAssetIcon)
self.pushButton_P3_MidIcon.clicked.connect(self.setMidAssetIcon)
self.pushButton_P3_smallIcon.clicked.connect(self.setSmallAssetIcon)
self.pushButton_P3_text.clicked.connect(self.setTextAssetMain)
self.tableWidget_AssetItemList.itemClicked.connect(self.showAssetMetaDataFromSelect)
self.itemDict ={}
self.iconFile = QtGui.QIcon("//mcd-one/database/assets/scripts/maya_scripts///mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/NA120ENPTY.png")
self.currentIconSize = 'large' #default set to large size icon
#self.tableWidget_AssetItemList.setSortingEnabled(True)
# self.tableWidget_AssetItemList.pressed.connect(self.dragTest)
# drag = QtGui.QDrag(self)
# # print'dragTest',drag.mimeData()
## printdrag,type(drag)
# initial button checked
self.pushButton_page3_all.setChecked(True)
self.pushButton_P3_processModeling.setChecked(True)
self.pushButton_P3_processTexture.setChecked(True)
self.pushButton_P3_processRigging.setChecked(True)
self.pushButton_P3_inputMayaOn.setChecked(True)
self.pushButton_P3_NA.setChecked(False)
self.clickAssetFilletAll()
# self.allAssetClassFillet = ['character','vehicle','set','prop','other']
#button click sing
self.pushButton_page3_all.clicked.connect(self.clickAssetFilletAll)
self.pushButton_page3_character.clicked.connect(self.clickAssetFilletCharacter)
self.pushButton_page3_vehicle.clicked.connect(self.clickAssetFilletVehicle)
self.pushButton_page3_set.clicked.connect(self.clickAssetFilletSet)
self.pushButton_page3_props.clicked.connect(self.clickAssetFilletProps)
self.pushButton_page3_other.clicked.connect(self.clickAssetFilletOther)
self.pushButton_P3_addItem.clicked.connect(self.addOutlineGroup)
self.pushButton_P3_processModeling.clicked.connect(self.clickProcessFilletChange)
self.pushButton_P3_processTexture.clicked.connect(self.clickProcessFilletChange)
self.pushButton_P3_processRigging.clicked.connect(self.clickProcessFilletChange)
self.pushButton_P3_NA.clicked.connect(self.clickProcessFilletChange)
self.pushButton_P3_refreshInputItem.clicked.connect(self.reflashOutLinerTree)
# self.pushButton_P3addItemToLeftA.clicked.connect(self.runBuildItemLevelTree)
# self.pushButton_P3addItemToLeftB.clicked.connect(self.storeOutLineStructure)
self.pushButton_P3addItemToLeftC.clicked.connect(self.ttt)
## modify treeWidget_sceneAssembleTree start----------------------------------------------------
#self.treeWidget_sceneAssembleTree.itemChanged.connect(self.itemChangedName)
self.treeWidget_sceneAssembleTree.setColumnCount(1)
self.treeWidget_sceneAssembleTree.header().setDefaultSectionSize(350)
self.treeWidget_sceneAssembleTree.header().setMinimumSectionSize(25)
self.storeOutLineStructure() # 整理
self.runBuildItemLevelTree() # 整理 itemCollapsed
self.treeWidget_sceneAssembleTree.doubleClicked.connect(self.editItem)
# self.treeWidget_sceneAssembleTree.itemEntered.connect(self.asdf)
# self.treeWidget_sceneAssembleTree.itemPressed.connect(self.pressTest)
self.pushButton_P3_deletSelectItem.clicked.connect(self.deleteSelectTreeItem)
self.pushButton_P3_selectItem.clicked.connect(self.selectAssetTreeItem)
#self.treeWidget_sceneAssembleTree.dra press
## modify treeWidget_sceneAssembleTree end----------------------------------------------------
self.setFontC()
# pressItem = QtWidgets.QTreeWidgetItem(self.treeWidget_sceneAssembleTree)
# self.pushButton_P3_packageAll.clicked.connect(self.testTest)
'''
class mod_MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self, parent= QtWidgets.QApplication.activeWindow()):
super(mod_MainWindow, self).__init__(parent)
self.setupUi(self)
'''
def selectAssetTreeItem(self) :
# print 'selectAssetTreeItem'
selectItem = self.treeWidget_sceneAssembleTree.selectItems()
print selectItem
cmds.select(cl=True)
for i in selectItem:
print i
cmds.select(i,tgl=True)
'''
if self.treeWidget_sceneAssembleTree.indexOfTopLevelItem(selectItem) == -1:
selectItemFullNameList = [selectItem.text(0)]
while self.treeWidget_sceneAssembleTree.indexOfTopLevelItem(selectItem) == -1:
selectItem = selectItem.parent()
selectItemFullNameList.append(selectItem.text(0).split('__')[0])
selectItemInOutLiner = '|'.join(reversed(selectItemFullNameList))
else:
topLayerItemIndex = self.treeWidget_sceneAssembleTree.indexOfTopLevelItem(selectItem)
selectItemInOutLiner = self.topLayerItemIndexDict[str(topLayerItemIndex)]
cmds.select(selectItemInOutLiner)
'''
def deleteSelectTreeItem(self):
selectItem = self.treeWidget_sceneAssembleTree.selectItems()
print selectItem
for i in selectItem:
print i
cmds.delete(i)
self.reflashOutLinerTree()
def getFullName(self,childItem):
# print'getFullName'
if self.treeWidget_sceneAssembleTree.indexOfTopLevelItem(childItem) == -1:
parentItem = childItem.parent()
parentItemName = childItem.parent().text(0)
self.selectItemFullNameLis.append(parentItemName)
else:
pass
def reflashOutLinerTree(self):
# print'reflash tree'
self.storeItemDateInDict (3)
#self.treeWidget_sceneAssembleTree.clear()
self.storeOutLineStructure()
self.runBuildItemLevelTree()
def runChangeItemName(self):
# print'runChangeItemName'
try:
if self.treeWidget_sceneAssembleTree.currentItem().text(0) == self.newGroupName:
pass
else:
self.itemChangedName()
except:
pass
def treeItemClick(self):
# self.treeWidget_sceneAssembleTree = QtWidgets.QTreeWidget(self.frame_9)
selectItem = self.treeWidget_sceneAssembleTree.currentItem()
# self.treeWidget_sceneAssembleTree.mouseMoveEvent(QtGui.QMouseEvent(selectItem))
# print selectItem
#self.treeWidget_sceneAssembleTree.
# print selectItem.text(0)
# print QtCore.QMimeData(selectItem).text()
# print self.treeWidget_sceneAssembleTree.dropMimeData(0,'ef',1,2)
# self.treeWidget_sceneAssembleTree.itemChanged.connect(self.itemMove)
#PySide2.QtWidgets.QTreeWidget.dropMimeData(PySide2.QtWidgets.QTreeWidgetItem, int, PySide2.QtCore.QMimeData, PySide2.QtCore.Qt.DropAction)
# self.dropEvent()
#def mouseMoveEvent(self, event):
# print 'cc'
'''
def mouseMoveEvent(self, event):
mimeData = QtCore.QMimeData()
mimeData.setText(self.mimeText)
drag = QtGui.QDrag(self)
drag.setMimeData(mimeData)
drag.exec_(QtCore.Qt.CopyAction | QtCore.Qt.MoveAction, QtCore.Qt.CopyAction)
# print 'gggg'
'''
# self.treeWidget_sceneAssembleTree = QtWidgets.QTreeWidget(self.frame_9)
# def mousePressEvent(treeWidget_sceneAssembleTree):
# print 'sds'
# selectItem = self.treeWidget_sceneAssembleTree.currentItem()
# print selectItem.text(0)
def itemMove(self):
print 'bbbbb'
selectItem = self.treeWidget_sceneAssembleTree.currentItem()
print selectItem.parent().text(0)
def treeItemClickB(self):
# print'check 01'
# print'treeItemClick'
takeItem = self.treeWidget_sceneAssembleTree.currentItem()
## printself.treeWidget_sceneAssembleTree.currentItem().text(0)
self.getTreeLocation(takeItem)
def getTreeLocation(self,takeItem):
# print'check 02'
# print'run getTreeLocation'
# printtakeItem.text(0)#.currentColumn()
getTopLayerIndex = self.treeWidget_sceneAssembleTree.indexOfTopLevelItem(takeItem) # get toplayerIndex
if getTopLayerIndex == -1:
getParent = takeItem.parent().text(0)
else:
getParent = 'none'
print takeItem.childCount()
print getParent
#cmds.select('aa4')
def runBuildItemLevelTree(self):
# print'check 03'
# self.storeOutLineStructure()
# self.getOutLinerStructure()
# print'start to build itemTree'
# self.addOutlineGroup()
# self.storeOutLineStructure()
self.treeWidget_sceneAssembleTree.clear()
self.buildDefaultTopLayerItem()
# print'build tree'
totalIteCount = len(self.allAssetGrpDepthDict.keys()) # get how many items in self.allAssetGrpDepthDict ,獲得outline中所有層級的名稱總數量
self.errorItem = {'character':{'0':[]},'vehicle':{'1':[]},'set':{'2':[]},'prop':{'3':[]},'other':{'4':[]},'effect':{'5':[]}}
for i in range(0,totalIteCount):
# # printi
eachItemFullName = self.allAssetGrpDepthDict.keys()[i] #獲得每個層級group名稱,fullName 完整名稱
eachItemShortName = eachItemFullName.split('|')[-1]
eachItemDepthList = self.allAssetGrpDepthDict[self.allAssetGrpDepthDict.keys()[i]] #獲得每個層級group 所對應的層級List
eachItemFullDepth = len(eachItemDepthList) #獲得物件所在層級, 每個物件的總層級
topLayerItemIndex = int(eachItemDepthList[0])
topLayerItemSelect = self.treeWidget_sceneAssembleTree.topLevelItem(topLayerItemIndex)
parentItem = topLayerItemSelect
parentItemForSetName = topLayerItemSelect
for depth in range(1,eachItemFullDepth):
# # print'depth',depth
currentCount = parentItem.childCount()
maxCount = int(eachItemDepthList[depth])+1
placeIndex = int(eachItemDepthList[depth])
delta = maxCount - currentCount
if delta <= 0:
parentItem = parentItem.child(placeIndex)
else:
self.createChildItem(delta,currentCount,parentItem,eachItemShortName)
#try:
parentItem = self.childItem.parent().child(placeIndex) #回傳在第幾個分支
moreThanOne = 0
self.checkIsMoreThanOne(eachItemShortName)
# # print'moreThanOne',self.moreThanOne
#
self.defineItemAddress(parentItemForSetName,eachItemDepthList,eachItemShortName,topLayerItemSelect,topLayerItemIndex)
# printself.errorItem
self.changeTopLayerItemName()
def changeTopLayerItemName(self):
# print'check 04'
for i in range(0,len(self.errorItem.keys())):
# printself.errorItem[self.errorItem.keys()[i]]#.keys()[0]#,self.errorItem[self.errorItem.keys()[i]]
topLayerItem = self.treeWidget_sceneAssembleTree.topLevelItem(i)
errorCount = len(self.errorItem[topLayerItem.text(0)][self.errorItem[topLayerItem.text(0)].keys()[0]])
newTopLayerItemName = topLayerItem.text(0) +'__('+str(errorCount)+')'
# printnewTopLayerItemName
# # printtopLayerItem.text(0)
topLayerItem.setText(0,newTopLayerItemName)
#self.treeWidget_sceneAssembleTree.itemChanged.connect(self.itemChangedName)
# # printself.errorItem[topLayerItem.text(0)][self.errorItem[topLayerItem.text(0)].keys()[0]]
def checkIsMoreThanOne(self,eachItemShortName):
# print'check 05'
# # print'checkIsMoreThanOne'
checkList = cmds.ls(eachItemShortName)
# # printcheckList
if len(checkList) >1 :
self.moreThanOne = 1
else:
self.moreThanOne = 0
# return moreThanOne
# # printmoreThanOne errorCount
def defineItemAddress(self,parentItemForSetName,eachItemDepthList,eachItemShortName,topLayerItemSelect,topLayerItemIndex): #定義物件的位置,如果是有重複名稱的物件會顯示紅色
# print'check 06'
depthLength = len(eachItemDepthList)
itemSelect = parentItemForSetName
for childIndex in range(1,depthLength):
itemSelect = itemSelect.child(int(eachItemDepthList[childIndex]))
itemSelect.setText(0,eachItemShortName)
if self.moreThanOne == 0:
pass
else:
itemTypeColor = self.typeListAllowDict['moreThanOneItemTheSameName']
itemSelect.setForeground(0,QtGui.QBrush(QtGui.QColor(int(itemTypeColor[0]), int(itemTypeColor[1]), int(itemTypeColor[2]))))#.setFont(0,self.fontLevelThree)
# # printitemSelect.topLayerItem()
# # printself.treeWidget_sceneAssembleTree.topLevelWidget(itemSelect)
# # print'topLayerItem',topLayerItemSelect.text(0),topLayerItemIndex
self.errorItem[topLayerItemSelect.text(0)][self.errorItem[topLayerItemSelect.text(0)].keys()[0]].append(eachItemShortName)
def buildDefaultTopLayerItem(self):
# print'check 07'
defaultTopLayerItem = ['character','vehicle','set','prop','other','effect']
for i in defaultTopLayerItem:
#itemName = defaultTopLayerItem[i]
topLayerItem = QtWidgets.QTreeWidgetItem(self.treeWidget_sceneAssembleTree)
topLayerItem.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsDropEnabled|QtCore.Qt.ItemIsUserCheckable|QtCore.Qt.ItemIsEnabled)
topLayerItem.setText(0,'%s'%i)
def createChildItem(self,delta,currentCount,parentItem,eachItemShortName): # maxCount 為該層級需要創建幾個物件
# print'check 08'
for i in range(0,delta):
self.childItem = QtWidgets.QTreeWidgetItem(parentItem)
self.childItem.setText(0,eachItemShortName)
def getOutLinerStructure(self,searchAsset):
# print'check 09'
tempBuildDefaultGrpList = []
tempBuildDefaultGrpList.append(searchAsset)
countList= []
allInTransformGrp = cmds.listRelatives(searchAsset, children=True, pa=True,ad=True)
if allInTransformGrp == None:
pass
else:
for j in allInTransformGrp:
grpLingName = cmds.ls(j,l=True)[0]
tempBuildDefaultGrpList.append(grpLingName)
countList.append(len(grpLingName.split('|')))
maxDepth = sorted(countList)[-1]-1
elementEveryLevelCount = {}
itemHierarchy = {}
depthDict = {}
for i in range(0, maxDepth):
depthDict.update({i:{}})
for i in range(1,maxDepth):
elementEveryLevelCount.update({i:[]})
allItemReleationShipDist = {}
refChildDict = {}
for i in tempBuildDefaultGrpList:
refChild = cmds.listRelatives(i, children=True, pa=True,ad=0)
refChildList = []
try:
refMaxCount= len(refChild)
for j in range(0,refMaxCount):
indexOfItem = refChild[j].split('|')[-1]+'.'+str(j)
refChildList.append(indexOfItem)
objNodeType = cmds.nodeType(refChild[j])
self.itemLevelDict.update({refChild[j].split('|')[-1]:[str(j),objNodeType]})
refChildDict.update({i.split('|')[-1]:refChildList})
except:
refMaxCount = 'none'
refChildDict.update({i.split('|')[-1]:'None'})
refParent = cmds.listRelatives(i, children=True, p=True,ad=0)
refChildSerNum = []
def getItemStructure(self,searchAsset,assetIndex):
# print'check 10'
allItemInTopLayerItem = cmds.listRelatives(searchAsset, children=True, pa=True,ad=True,f=True)
for i in allItemInTopLayerItem:
tempItemLevelList = [assetIndex]
#check i not in except list
nodeTypeExceptList= ['joint','airField','nucleus','vortexField','turbulenceField','pointEmitter','dragField','gravityField','newtonField','uniformField','volumeAxisField']
if i in nodeTypeExceptList:
pass
else:
for j in i.split('|'):
try:
getPartDepthLevel = self.itemLevelDict[j][0] #get index of each depth level #itemLevelDict
tempItemLevelList.append(str(getPartDepthLevel))
except:
pass
self.allAssetGrpDepthDict.update({i:tempItemLevelList})
def storeOutLineStructure(self):
# print'check 12'
# # print'aaaa'
self.itemLevelDict = {} #create empty itemLevelDict ,item dictionary
self.allAssetGrpDepthDict = {} #create empty dict, that reference group depth and index to each item and grp
self.defaultAssetBuildDict = {'character':'0','vehicle':'1','set':'2','prop':'3','other':'4','effect':'5'}
for i in self.defaultAssetBuildDict:
try:
self.getOutLinerStructure(i)
## printi
except:
pass
# print'itemLevelDict',self.itemLevelDict
for i in self.defaultAssetBuildDict.keys():
try:
self.getItemStructure(i,self.defaultAssetBuildDict[i])
except:
pass
# print'self.allAssetGrpDepthDict', self.allAssetGrpDepthDict
def getOutLinerStructure(self,searchAsset):
# print'check 13'
tempBuildDefaultGrpList = []
tempBuildDefaultGrpList.append(searchAsset)
countList= []
allInTransformGrp = cmds.listRelatives(searchAsset, children=True, pa=True,ad=True)
if allInTransformGrp == None:
pass
else:
for j in allInTransformGrp:
grpLingName = cmds.ls(j,l=True)[0]
tempBuildDefaultGrpList.append(grpLingName)
# # printgrpLingName
countList.append(len(grpLingName.split('|')))
maxDepth = sorted(countList)[-1]-1
# # print'maxDepth',maxDepth
elementEveryLevelCount = {}
itemHierarchy = {}
depthDict = {}
for i in range(0, maxDepth):
depthDict.update({i:{}})
## printdepthDict
for i in range(1,maxDepth):
elementEveryLevelCount.update({i:[]})
allItemReleationShipDist = {}
#for i in tempBuildDefaultGrpList:
# # printi
refChildDict = {}
for i in tempBuildDefaultGrpList:
# # printi
#chaList = i.split('|')
refChild = cmds.listRelatives(i, children=True, pa=True,ad=0)
## print'refChild',refChild,type(refChild)
refChildList = []
try:
refMaxCount= len(refChild)
# # print'refMaxCount',refMaxCount
for j in range(0,refMaxCount):
indexOfItem = refChild[j].split('|')[-1]+'.'+str(j)
## printj ,refChild[j]
# # printindexOfItem
refChildList.append(indexOfItem)
objNodeType = cmds.nodeType(refChild[j])
# # printobjNodeType
self.itemLevelDict.update({refChild[j].split('|')[-1]:[str(j),objNodeType]})
refChildDict.update({i.split('|')[-1]:refChildList})
except:
refMaxCount = 'none'
refChildDict.update({i.split('|')[-1]:'None'})
refParent = cmds.listRelatives(i, children=True, p=True,ad=0)
refChildSerNum = []
##--------------get info from maya group structure END ---------------------------------------------------------------------------------------------------------------------
def setFontC(self):
# print'check 14'
self.fontC = QtGui.QFont()
self.fontC.setFamily("Calibri")
self.fontC.setPointSize(10)
self.brushC = QtGui.QBrush(QtGui.QColor(255, 0, 0))
self.brushC.setStyle(QtCore.Qt.NoBrush)
def addOutlineGroup(self):
# print'check 15'
# print'addOutlineGroup'
currentSelectItem = self.treeWidget_sceneAssembleTree.currentItem()
newItemTheSameNameList = []
for i in cmds.ls(typ= 'transform'):
## printi[0:7]
if i[0:7] == 'newItem':
# printi
newItemTheSameNameList.append(i)
# print'newItemTheSameNameList',newItemTheSameNameList
newItemTheSameNameCount = len(newItemTheSameNameList)
newItemName = 'newItem'+'%04d'%(newItemTheSameNameCount+1)
# print'newItemName '+ newItemName
# # print'newItemTheSameNameCount', newItemTheSameNameCount
# cmd
if currentSelectItem.isSelected() == False:
# print'create A new Group in TopLayer'
allTopLayerCount = int(self.treeWidget_sceneAssembleTree.topLevelItemCount())
# printallTopLayerCount
newItem = QtWidgets.QTreeWidgetItem(self.treeWidget_sceneAssembleTree)
newItemInOutLine = self.treeWidget_sceneAssembleTree.topLevelItem(allTopLayerCount).setText(0, QtWidgets.QApplication.translate("MainWindow", newItemName, None, -1))
if newItemName not in self.allTopLayerItemsInOutline:
cmds.createNode('transform', n=newItemName)
self.allTopLayerItemsInOutline.append(newItemName)
else:
pass
#self.allTopLayerItemsInOutline
else:
# printcurrentSelectItem.text(0)
# printself.treeWidget_sceneAssembleTree.indexOfTopLevelItem(currentSelectItem) #get selectItem topLayerIndex
if self.treeWidget_sceneAssembleTree.indexOfTopLevelItem(currentSelectItem) == -1:
print'currentSelectItem.parent()',currentSelectItem.parent().text(0)
else:
pass
def editItem(self): ## modify item name in tree ,修改物件名稱 doubleClick run
# print'check 17'
checkTopLayerIndex = self.treeWidget_sceneAssembleTree.indexOfTopLevelItem(self.treeWidget_sceneAssembleTree.currentItem())
if checkTopLayerIndex == -1 : # 檢查是否為第一層物件
item = self.treeWidget_sceneAssembleTree.itemFromIndex(self.treeWidget_sceneAssembleTree.selectedIndexes()[0]) #get select Item Name
self.origialGroupName = item.text(0)
item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsEditable)
# self.newGroupName = self.treeWidget_sceneAssembleTree.currentItem().text(0)
# # printself.origialGroupName
# self.moreThanOneList = cmds.ls(self.newGroupName)
# self.moreThanOneListCount = len(self.moreThanOneList)
else:
# print'it count not change name'
pass
# self.runBuildItemLevelTree()
self.newGroupName = self.treeWidget_sceneAssembleTree.currentItem().text(0)
self.treeWidget_sceneAssembleTree.itemChanged.connect(self.runChangeItemName)
def itemChangedName(self):
# print'check 18'
# print'chaned item Name'
# self.newGroupName = self.treeWidget_sceneAssembleTree.currentItem().text(0)
self.moreThanOneList = cmds.ls(self.newGroupName)
# print'self.moreThanOneList',self.moreThanOneList
self.moreThanOneListCount = len(self.moreThanOneList)
# print'self.moreThanOneListCount',self.moreThanOneListCount
if self.moreThanOneListCount > 1:
#tempName = self.newGroupName
tempName = self.treeWidget_sceneAssembleTree.currentItem().text(0)
for i in range(0,self.moreThanOneListCount):
self.origialGroupName = self.moreThanOneList[i]
self.newGroupName = tempName + '_' +'%04d'%i
# print'self.origialGroupName,self.newGroupName',self.origialGroupName,self.newGroupName
cmds.rename(self.origialGroupName,self.newGroupName)
else:
self.newGroupName = self.treeWidget_sceneAssembleTree.currentItem().text(0)
# print'self.origialGroupName,self.newGroupName',self.origialGroupName,self.newGroupName
cmds.rename(self.origialGroupName,self.newGroupName)
# except:
# pass
# self.runBuildItemLevelTree()
# self.runBuildItemLevelTree()itemChangedName
def ttt(self):
print 'check 19'
# # printself.treeWidget_sceneAssembleTree.currentItem().text(1)
# # printself.treeWidget_sceneAssembleTree.currentItem().text(0)
# # printself.treeWidget_sceneAssembleTree.currentItem().text(2)
# # printself.treeWidget_sceneAssembleTree.currentItem().icon(0).name()
# # printself.treeWidget_sceneAssembleTree.currentItem().icon(0)
# printself.treeWidget_sceneAssembleTree.currentItem().text(0)
# iconFile =QtGui.QIcon('//mcd-one/database/assets/scripts/maya_scripts///mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/NA120B.png')
# self.tableWidget_AssetItemList.item(row, column).setIcon(iconFile)
def dragTest(self):
# print'check 21'
## printself.treeWidget_sceneAssembleTree.currentItem
#searchKey = self.tableWidget_AssetItemList.currentItem().text()
selectedAssetItemColumn = self.tableWidget_AssetItemList.currentColumn()
selectedAssetItemRow = self.tableWidget_AssetItemList.currentRow()
searchKey = str(selectedAssetItemColumn)+'_._'+str(selectedAssetItemRow)
# # printsearchKey
data = self.tableItemListInfoDict[searchKey]
# # printdata.keys()[0]
#mimeData = QtCore.QMimeData()
# # printmimeData.
# drag = QtGui.QDrag(self)
self.itemDrag = self.tableWidget_AssetItemList.currentItem().text()
## printself.treeWidget_sceneAssembleTree.findItems(itemDrag)
# # printitemDrag
#self.treeWidget_sceneAssembleTree.indexFromItem(itemDrag,0)
# # printself.treeWidget_sceneAssembleTree.findItems(itemDrag,QtCore.Qt.MatchExactly)
#self.table.findItems(
#self.edit.text(), QtCore.Qt.MatchExactly)
def test(self):
print'check 22'
# printself.pushButton_P3_processModeling.isChecked()
# printself.pushButton_P3_processTexture.isChecked()
# printself.pushButton_P3_processRigging.isChecked()
# printself.pushButton_P3_NA.isChecked()
def clickProcessFilletChange(self):
# print'check 23_0'
self.clickAssetClass(self.assetClassSelectMode)
def clickAssetFilletAll(self):
# print'check 23_0'
self.assetClassSelectMode = 'all'
self.clickAssetClass('all')
def clickAssetFilletCharacter(self):
# print'check 23_0'
self.clickAssetClass('character')
self.assetClassSelectMode = 'character'
def clickAssetFilletVehicle(self):
# print'check 23_0'
self.clickAssetClass('vehicle')
self.assetClassSelectMode = 'vehicle'
def clickAssetFilletSet(self):
# print'check 23_0'
self.clickAssetClass('set')
self.assetClassSelectMode = 'set'
def clickAssetFilletProps(self):
# print'check 23_0'
self.clickAssetClass('props')
self.assetClassSelectMode = 'props'
def clickAssetFilletOther(self):
# print'check 23_0'
self.clickAssetClass('other')
self.assetClassSelectMode = 'other'
def clickAssetClass(self,classMode):
# print'check 23'
# printclassMode
self.pushButton_page3_all.setChecked(False)
self.pushButton_page3_character.setChecked(False)
self.pushButton_page3_vehicle.setChecked(False)
self.pushButton_page3_set.setChecked(False)
self.pushButton_page3_props.setChecked(False)
self.pushButton_page3_other.setChecked(False)
if classMode == 'all':
self.pushButton_page3_all.setChecked(True)
self.allAssetClassFillet = ['character','vehicle','set','prop','other']
if classMode == 'character':
self.pushButton_page3_character.setChecked(True)
self.allAssetClassFillet = ['character']
if classMode == 'vehicle':
self.pushButton_page3_vehicle.setChecked(True)
self.allAssetClassFillet = ['vehicle']
if classMode == 'set':
self.pushButton_page3_set.setChecked(True)
self.allAssetClassFillet = ['set']
if classMode == 'props':
self.pushButton_page3_props.setChecked(True)
self.allAssetClassFillet = ['prop']
if classMode == 'other':
self.pushButton_page3_other.setChecked(True)
self.allAssetClassFillet = ['other']
self.loadPublishedData()
if self.currentIconSize == 'large':
self.setLargeAssetIcon()
if self.currentIconSize == 'mid':
self.setMidAssetIcon()
if self.currentIconSize == 'small':
self.setSmallAssetIcon()
if self.currentIconSize == 'text':
self.setTextAssetMain()
def showAssetMetaDataFromSelect(self):
# print'check 24'
# print'showAssetMetaDataFromSelect start'
#searchKey = self.tableWidget_AssetItemList.currentItem().text()
selectedAssetItemColumn = self.tableWidget_AssetItemList.currentColumn()
selectedAssetItemRow = self.tableWidget_AssetItemList.currentRow()
searchKey = str(selectedAssetItemColumn)+'_._'+str(selectedAssetItemRow)
# printsearchKey
data = self.tableItemListInfoDict[searchKey]
# printdata
# for i in data
showItemName = 'asset Name : %s'%data.keys()[0].split('.')[0] +'\n'
showItemAssetType = 'asset Type : %s'%data.keys()[0].split('.')[1] +'\n'
showItemAssetProcessNow = 'asset Progress Now : %s'%data.keys()[0].split('.')[2] +'\n'+'\n'
showFileName = 'asset File Name : %s'%data[data.keys()[0]]['fileName'] +'\n'+'\n'
showAssetCreator = 'asset Creator :%s'%data[data.keys()[0]]['user'] +'\n'
filePublishTime = 'asset Publish Time :%s'%datetime.datetime.fromtimestamp(os.path.getmtime(data[data.keys()[0]]['fileName']))+'\n'
showRibArchive = 'asset RibArchive :%s'%data[data.keys()[0]]['ribArchive']['ribArchivePath'] +'\n'
showRibArchive = 'asset RibArchive :%s'%data[data.keys()[0]]['ribArchive']['ribArchivePath'] +'\n'
publishTimeFromFile = str(datetime.datetime.fromtimestamp(os.path.getmtime(data[data.keys()[0]]['fileName'])))
filePublishTime = 'asset Publish Time :%s'%publishTimeFromFile.split('.')[0]+'\n'
iconFileName = data[data.keys()[0]]['fileIcon']
## printfilePublishTime,type(filePublishTime)
self.checkFileSize(data[data.keys()[0]]['fileName'])
# printself.fileSize
showAssetMayaFileSize = 'asset mayaFileSize :%s'%self.fileSize +'\n'
# self.checkFileSize(data[data.keys()[0]]['fileName'])
showList = [showItemName,showItemAssetType,showItemAssetProcessNow,showFileName,showAssetCreator,filePublishTime,showAssetMayaFileSize,showRibArchive]
showInPlainText = ''
for i in showList:
showInPlainText = showInPlainText +i
# printshowInPlainText
self.plainTextEdit_assetMetaData.setPlainText(showInPlainText)
self.label_showImage_2.setGeometry(QtCore.QRect(5, 5, 200, 200))
self.label_showImage_2.setPixmap(QtGui.QPixmap(iconFileName))
def checkFileSize(self,fileName):
# print'check 25'
fileSizeBt = os.stat(fileName).st_size /1024
if fileSizeBt < 1024:
fileSize = str(fileSizeBt) +'KB'
elif fileSizeBt <1024*1024:
fileSize = '%.3f'%(fileSizeBt/1024.0) +'MB'
else:
fileSize='%.3f'%(fileSizeBt/1024.0/1024.0) +'GB'
self.fileSize = fileSize
def loadPublishedData(self):
# print'check 26'
file = '//mcd-one/3d_project/ocean_world_2016_cf/publish/global/ocean_world_2016_cf_publishAnnonce.json'
with open(file) as data_file:
data = json.load(data_file)
# self.allAssetClassFillet = ['character','vehicle','set','prop','other'] #allAssetClass
allProcesType = ['layout','animation','lighting','effects','simulation']
allItemDict = {}
assetTempDict ={}
shotTempDict = {}
for i in self.allAssetClassFillet:
for j in data['assets'][i].keys():
# # print'jjjjj',j
if len(data['assets'][i][j]) == 0:
assetTempDict.update({j+'.'+'not available':{}})
else:
for k in data['assets'][i][j].keys():
assetTempDict.update({j+'.'+k:data['assets'][i][j][k]['state']})
for i in data['shot'].keys(): #shotName.shot.processType:{}
for j in allProcesType:
if len(data['shot'][i]) == 0:
itemKey = i +'.shot.not available'
shotTempDict.update({itemKey:{}})
else:
itemKey = i + '.shot.'+ j
if j in data['shot'][i].keys():
shotTempDict.update({itemKey:data['shot'][i][j]['state']})
allItemDict.update(assetTempDict)
# allItemDict.update(shotTempDict) #if want to show shot use this line
## print'allItemDict',allItemDict
#is 'texture','model','rigging' icon is checked
textureTempDict = {}
for i in allItemDict.keys():
if i.split('.')[2] == 'texture':
textureTempDict.update({i:allItemDict[i]})
modelTempDict = {}
for i in allItemDict.keys():
if i.split('.')[2] == 'model':
modelTempDict.update({i:allItemDict[i]})
riggingTempDict = {}
for i in allItemDict.keys():
if i.split('.')[2] == 'rigging':
riggingTempDict.update({i:allItemDict[i]})
NATempDict = {}
for i in allItemDict.keys():
if i.split('.')[2] == 'not available':
NATempDict.update({i:allItemDict[i]})
## print'hjghfjg',self.pushButton_P3_processModeling.isChecked()
# self.pushButton_P3_processModeling
## print'self.pushButton_P3_NA.isChecked()',self.pushButton_P3_NA.isChecked()
#self.test()
newItemDict={}
if self.pushButton_P3_processModeling.isChecked() == True:
newItemDict.update(modelTempDict)
if self.pushButton_P3_processTexture.isChecked() == True:
newItemDict.update(textureTempDict)
if self.pushButton_P3_processRigging.isChecked() == True:
newItemDict.update(riggingTempDict)
if self.pushButton_P3_NA.isChecked() == True:
newItemDict.update(NATempDict)
self.itemDict = newItemDict
self.totalItemCount = len(self.itemDict)
# # print'self.itemDict',self.itemDict
# # print'newItemDict',newItemDict
## printsorted(newItemDict)
def storeItemDateInDict(self,cloumnCount):
# print'check 27'
# print'storeItemDateInDict start'
infoSearchList = ['fileName','fileIcon','gpuCache','ribArchive','user','publishTime','metaData']
rowCount = 0
self.tableItemListInfoDict= {}
tempItemInDictList = []
notAvailableItem = []
# # print'self.itemDict.keys()',self.itemDict.keys()
for i in self.itemDict.keys():
if i.split('.')[2] == 'not available':
notAvailableItem.append(i)
else:
tempItemInDictList.append(i)
sortedTempItemList = sorted(tempItemInDictList) + notAvailableItem
# # print'sortedTempItemList',sortedTempItemList
for i in range(0,self.totalItemCount ):
self.tempInfoDictPreItem = {}
if cloumnCount == 1:
column = 2
row = i
else:
column = i % cloumnCount
row = i/cloumnCount *2
tempKey = str(column) +'_._'+ str(row)
# # print'tempKey',tempKey
item = sortedTempItemList[i]
# # print'item',item
tempItemList = {}
for j in infoSearchList:
try:
secondItem = self.itemDict[sortedTempItemList[i]][j]
except:
secondItem = {}
tempItemList.update({j:secondItem})
# # print'secondItem',secondItem
self.tableItemListInfoDict.update({tempKey:{item:tempItemList}})
# # print'self.tableItemListInfoDict',self.tableItemListInfoDict
if cloumnCount == 1:
rowSize = 30
columnSize =400
textRowSize =30
if cloumnCount == 3:
rowSize = 120
columnSize =120
textRowSize =20
if cloumnCount == 4:
rowSize = 80
columnSize =80
textRowSize =20
if cloumnCount == 6:
rowSize = 60
columnSize =60
textRowSize =20
#setItemText(self,cloumnCount,rowSize,columnSize)
self.setItemIcon(columnSize,rowSize)
self.setItemText(cloumnCount,columnSize,textRowSize)
def setItemIcon(self,columnSize,rowSize):
# print'check 28'
# print'setItemIcon start'
## print'self.tableItemListInfoDict',self.tableItemListInfoDict
tempIconFileDict={}
for i in self.tableItemListInfoDict.keys():
row = int(i.split('_._')[1])
column = int(i.split('_._')[0])
if len(self.tableItemListInfoDict[i][self.tableItemListInfoDict[i].keys()[0]]['fileIcon']) == 0:
iconFile =QtGui.QIcon('//mcd-one/database/assets/scripts/maya_scripts///mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/NA120B.png')
else:
iconFile = QtGui.QIcon(self.tableItemListInfoDict[i][self.tableItemListInfoDict[i].keys()[0]]['fileIcon'])#.keys()
item = QtWidgets.QTableWidgetItem()
itemName = self.tableItemListInfoDict[i].keys()[0]
item.setText(itemName)
self.tableWidget_AssetItemList.setItem(row, column, item)
self.tableWidget_AssetItemList.horizontalHeader().setDefaultSectionSize(columnSize)
self.tableWidget_AssetItemList.verticalHeader().setDefaultSectionSize(rowSize)
self.tableWidget_AssetItemList.item(row, column).setIcon(iconFile)
def setItemText(self,cloumnCount,columnSize,textRowSize):
# print'check 29'
## printself.tableItemListInfoDict.keys()
## print'cloumnCount',cloumnCount
for i in self.tableItemListInfoDict.keys():
# # print'self.tableItemListInfoDict.keys()',self.tableItemListInfoDict.keys()
if cloumnCount == 1:
row = int(i.split('_._')[1])
column = 0
else:
row = int(i.split('_._')[1])+1
## print'row',row
column = int(i.split('_._')[0])
itemName = str(self.tableItemListInfoDict[i].keys()[0]).split('.')[0]
# # print'itemText',i,self.tableItemListInfoDict[i]
## printitemName
## printrow ,column
item = QtWidgets.QTableWidgetItem()
self.tableWidget_AssetItemList.setItem(row, column, item)
# self.tableWidget_AssetItemList.setRowHeight(100,60) #set text row height
# self.tableWidget_AssetItemList.setIconSize(QtCore.QSize(40,40))
#self.tableWidget_AssetItemList.horizontalHeader().setDefaultSectionSize(columnSize)
#self.tableWidget_AssetItemList.verticalHeader().setDefaultSectionSize(rowSize)
self.tableWidget_AssetItemList.setRowHeight(row,textRowSize) #set text row height
self.tableWidget_AssetItemList.item(row, column).setText(QtWidgets.QApplication.translate("MainWindow",'aaa', None,-1))
self.tableWidget_AssetItemList.item(row, column).setText(QtWidgets.QApplication.translate("MainWindow",itemName, None,-1))
def setTextMode(self):
# print'check 30'
self.tableWidget_AssetItemList.clear()
self.pushButton_P3_largeIcon.setChecked(True)
self.pushButton_P3_MidIcon.setChecked(False)
self.pushButton_P3_smallIcon.setChecked(False)
self.pushButton_P3_text.setChecked(False)
setRow = self.totalItemCount +1
self.tableWidget_AssetItemList.setColumnCount(3)
self.tableWidget_AssetItemList.setRowCount(setRow)
def setLargeAssetIcon(self):
# print'check 31'
self.tableWidget_AssetItemList.clear()
self.pushButton_P3_largeIcon.setChecked(True)
self.pushButton_P3_MidIcon.setChecked(False)
self.pushButton_P3_smallIcon.setChecked(False)
self.pushButton_P3_text.setChecked(False)
# print'setLargeAssetIcon'
self.tableWidget_AssetItemList.clear()
self.pushButton_P3_largeIcon.setChecked(True)
self.pushButton_P3_MidIcon.setChecked(False)
self.pushButton_P3_smallIcon.setChecked(False)
self.pushButton_P3_text.setChecked(False)
if self.totalItemCount%3 == 0:
setRow = ((self.totalItemCount / 3) *2) +1
else:
setRow = ((self.totalItemCount / 3) *2) +2
# # printsetRow
#setRow = self.totalItemCount / 2 *2 +2
self.tableWidget_AssetItemList.setColumnCount(3)
self.tableWidget_AssetItemList.setRowCount(setRow)
#self.tableWidget_AssetItemList.horizontalHeader().setDefaultSectionSize(120)
#self.tableWidget_AssetItemList.verticalHeader().setDefaultSectionSize(120)
iconFile = self.iconFile
tableItemIndex={}
for column in range(0,3): #set icon
for row in range(0,setRow,2):
self.createTableItem(column,row,iconFile,120)
for column in range(0,3):
for row in range(1,setRow,2):
self.setTableItemText(column,row)
self.storeItemDateInDict (3) # create Item Dict
self.currentIconSize = 'large'
def setMidAssetIcon(self):
# print'check 32'
# print'setMidAssetIcon'
self.tableWidget_AssetItemList.clear()
self.pushButton_P3_largeIcon.setChecked(False)
self.pushButton_P3_MidIcon.setChecked(True)
self.pushButton_P3_smallIcon.setChecked(False)
self.pushButton_P3_text.setChecked(False)
if self.totalItemCount%4 == 0:
setRow = ((self.totalItemCount / 4) *2) +1
else:
setRow = ((self.totalItemCount / 4) *2) +2
# # printsetRow
#
self.tableWidget_AssetItemList.setColumnCount(4)
self.tableWidget_AssetItemList.setRowCount(setRow)
# self.tableWidget_AssetItemList.horizontalHeader().setDefaultSectionSize(80)
# self.tableWidget_AssetItemList.verticalHeader().setDefaultSectionSize(80)
iconFile = self.iconFile
for column in range(0,4): #set icon setItemText
for row in range(0,setRow,2):
# # printrow
self.createTableItem(column,row,iconFile,80)
for column in range(0,4):
for row in range(1,setRow,2):
# # printrow
self.setTableItemText(column,row)
self.storeItemDateInDict (4)
self.currentIconSize = 'mid'
def setSmallAssetIcon(self):
# print'check 33'
# print'setSmallAssetIcon'
self.tableWidget_AssetItemList.clear()
self.pushButton_P3_largeIcon.setChecked(False)
self.pushButton_P3_MidIcon.setChecked(False)
self.pushButton_P3_smallIcon.setChecked(True)
self.pushButton_P3_text.setChecked(False)
if self.totalItemCount%6 == 0:
setRow = ((self.totalItemCount / 6) *2) +1
else:
setRow = ((self.totalItemCount / 6) *2) +2
# # printsetRow
self.tableWidget_AssetItemList.setColumnCount(6)
self.tableWidget_AssetItemList.setRowCount(setRow)
# self.tableWidget_AssetItemList.horizontalHeader().setDefaultSectionSize(60)
# self.tableWidget_AssetItemList.verticalHeader().setDefaultSectionSize(60)
iconFile = self.iconFile
for column in range(0,6): #set icon
for row in range(0,setRow,2):
self.createTableItem(column,row,iconFile,60)
for column in range(0,6):
for row in range(1,setRow,2):
# # printrow
self.setTableItemText(column,row)
self.storeItemDateInDict (6)
self.currentIconSize = 'small'
def setTextAssetMain(self):
# print'check 34'
self.setTextAsset(30)
def setTextAsset(self,size):
# print'check 35'
# print'setTextAsset~~'
self.tableWidget_AssetItemList.clear()
self.pushButton_P3_largeIcon.setChecked(False)
self.pushButton_P3_MidIcon.setChecked(False)
self.pushButton_P3_smallIcon.setChecked(False)
self.pushButton_P3_text.setChecked(True)
setRow = self.totalItemCount #+ 1
self.tableWidget_AssetItemList.setColumnCount(3)
self.tableWidget_AssetItemList.setRowCount(setRow)
self.storeItemDateInDict(1)
# # print'self.tableItemListInfoDict',self.tableItemListInfoDict.keys()
iconFile =self.iconFile
for row in range(0, setRow):
item = QtWidgets.QTableWidgetItem()
self.tableWidget_AssetItemList.setColumnWidth(0,size) #index ser number
self.tableWidget_AssetItemList.setRowHeight(row , size) #set text row height
self.tableWidget_AssetItemList.setItem(row, 0, item)
self.tableWidget_AssetItemList.item(row, 0).setText(QtWidgets.QApplication.translate("MainWindow", "serNum", None,-1))
self.tableWidget_AssetItemList.item(row, 0).setText(QtWidgets.QApplication.translate("MainWindow", str(row), None,-1))
item = QtWidgets.QTableWidgetItem()
self.tableWidget_AssetItemList.setColumnWidth(1,size) #index ser number
self.tableWidget_AssetItemList.setRowHeight(row , size) #set text row height
self.tableWidget_AssetItemList.setItem(row, 1, item)
self.tableWidget_AssetItemList.item(row, 1).setIcon(iconFile)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_AssetItemList.setColumnWidth(2,300) #index ser number
# self.tableWidget_AssetItemList.setRowHeight(row , size) #set text row height
self.tableWidget_AssetItemList.setItem(row, 2, item)
self.tableWidget_AssetItemList.item(row, 2).setText(QtWidgets.QApplication.translate("MainWindow", "icon", None,-1))
for i in self.tableItemListInfoDict.keys() :
row = int(i.split('_._')[1])
self.tableWidget_AssetItemList.setRowHeight(row , size) #set text row height
itemName = str(self.tableItemListInfoDict[i].keys()[0])
self.tableWidget_AssetItemList.item(row, 2).setText(QtWidgets.QApplication.translate("MainWindow", itemName, None,-1))
for i in self.tableItemListInfoDict.keys() :
row = int(i.split('_._')[1])
itemIconFile = str(self.tableItemListInfoDict[i][self.tableItemListInfoDict[i].keys()[0]]['fileIcon'])
# itemIconFile='//mcd-one/database/assets/scripts/maya_scripts///mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/NA120B.png'
if len(itemIconFile) == 2:
# # print'itemIconFile','not available'
itemIconFile = '//mcd-one/database/assets/scripts/maya_scripts///mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/NA120B.png'
self.tableWidget_AssetItemList.item(row, 1).setIcon(QtGui.QIcon(itemIconFile))
self.tableWidget_AssetItemList.setIconSize(QtCore.QSize(size,size))
pass
else:
# # print'itemIconFile'itemIconFile
# # print'itemIconFile',itemIconFile
self.tableWidget_AssetItemList.item(row, 1).setIcon(QtGui.QIcon(itemIconFile))
self.tableWidget_AssetItemList.setIconSize(QtCore.QSize(size,size))
# for row in range(0, setRow):
# item = QtWidgets.QTableWidgetItem()
# self.tableWidget_AssetItemList.setColumnWidth(3,size) #index ser number
# self.tableWidget_AssetItemList.setRowHeight(row , size)
self.currentIconSize = 'text'
def initialTableWidgetAssetList(self):
# print'check 36'
self.tableWidget_AssetItemList.clear()
#self.tableWidget_AssetItemList.setRowCount(2)
#self.tableWidget_AssetItemList.setColumnCount(2)
self.tableWidget_AssetItemList.setColumnCount(3)
self.tableWidget_AssetItemList.setRowCount(4)
self.tableWidget_AssetItemList.horizontalHeader().setDefaultSectionSize(60)
self.tableWidget_AssetItemList.verticalHeader().setDefaultSectionSize(60)
def createTableItem(self,column,row,iconFile,iconSize):
# print'check 37'
item = QtWidgets.QTableWidgetItem()
self.tableWidget_AssetItemList.setItem(row, column, item)
self.tableWidget_AssetItemList.item(row, column).setText(QtWidgets.QApplication.translate("MainWindow", "ItemIconHere", None,-1))
self.tableWidget_AssetItemList.item(row, column).setIcon(iconFile)
self.tableWidget_AssetItemList.setIconSize(QtCore.QSize(iconSize,iconSize))
def createItemB(self,column,row,iconFile):
# print'check 38'
# icon = QtGui.QIcon("C:/Program Files/Autodesk/Maya2017///mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/animation.png")
#iconFile = QtGui.QIcon("C:/Program Files/Autodesk/Maya2017///mcd-one/database/assets/scripts/maya_scripts/icons/publishToolIcon/animation.png")
item = QtWidgets.QTableWidgetItem()
self.tableWidget_AssetItemList.setItem(row, column, item)
#self.tableWidget_AssetItemList.item(row, column).setText(QtWidgets.QApplication.translate("MainWindow", "ItemIcon", None,-1))
self.tableWidget_AssetItemList.item(row, column).setIcon(iconFile)
self.tableWidget_AssetItemList.setIconSize(QtCore.QSize(60,60))
# self.tableWidget.item(1, 2).setIconText('aaa')
# item.
# add text Item
def setTableItemText(self,column,row):
# print'check 39'
item = QtWidgets.QTableWidgetItem()
# textRow = row+1
self.tableWidget_AssetItemList.setRowHeight(row , 20) #set text row height
self.tableWidget_AssetItemList.setItem(row, column, item)
# self.tableWidget_AssetItemList.setIconSize(QtCore.QSize(40,40))
self.tableWidget_AssetItemList.item(row, column).setText(QtWidgets.QApplication.translate("MainWindow", "ItemName", None,-1))
#item.setTextAlignment(-20)
# self.tableWidget.setRowHeight(1 , 20)
class assetTreeInTheWorld(QtWidgets.QTreeWidget,mod_MainWindow):
def __init__(self,parent= QtWidgets.QApplication.activeWindow()):
super(assetTreeInTheWorld, self).__init__(parent)
self.setAcceptDrops(True)
#self.setHeaderLabels(["Select Members"])
self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
self.setGeometry(QtCore.QRect(5, 90, 200, 530))
self.setColumnCount(2)
#self.mousePressPos = QtCore.QPoint(0,0)
self.setObjectName("treeWidget_sceneAssembleTree")
#self.header().setVisible(False)
#self.header().setCascadingSectionResizes(False)
#self.header().setDefaultSectionSize(150)
#self.header().setHighlightSections(False)
#self.header().setMinimumSectionSize(25)
#self.setDragEnabled(True)
#self.setDragDropOverwriteMode(True)
#self.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove)
self.header().setHidden(True)
self.setSelectionMode(self.ExtendedSelection)
self.setDragDropMode(self.InternalMove)
self.setDragEnabled(True)
self.setDropIndicatorShown(True)
# self.itemSelectionChanged.connect(self.selectItems)
self.topLayerItemIndexDict = {'0':'character',
'1':'vehicle',
'2':'set',
'3':'prop',
'4':'other',
'5':'effect'}
#self.pushButton_P3_deletSelectItem.clicked.connect(self.asdf)
def asdf(self):
print 'asdf'
def selectItems(self):
print 'selectItems'
treeItemName = []
treeItemFullNameList = []
treeItem = self.selectedItems()
for i in treeItem:
if self.indexOfTopLevelItem(i) == -1:
treeItemName.append(i.text(0))
self.checkParentFullName(i)
# print 'itemFullName',self.parentItemFullName
treeItemFullNameList.append(self.parentItemFullName)
else:
print 'can not modify toplayer item'
return treeItemFullNameList
def dropEvent(self, event):
print 'dropEvent'
if event.source() == self:
QtWidgets.QAbstractItemView.dropEvent(self, event)
def dropMimeData(self, parent, row, data, action):
print 'dropMimeData'
if action == QtCore.Qt.MoveAction:
#print self.moveSelection(parent, row)
return self.moveSelection(parent, row)
return False
def checkParentFullName(self,parentItem):
print 'checkParentFullName'
# itemLevelIndexList = []
parentItemIndex = self.indexOfTopLevelItem(parentItem)
# print 'parentItemIndex',parentItemIndex
if parentItemIndex == -1:
parentItemFullNameList = [parentItem.text(0)]
while self.indexOfTopLevelItem(parentItem) == -1:
parentItem = parentItem.parent()
# print 'parentItem',parentItem.text(0)
parentItemFullNameList.append(parentItem.text(0).split('__')[0])
parentItemFullName = '|'.join(reversed(parentItemFullNameList))
else:
topLayerItemIndex = parentItemIndex
parentItemFullName = self.topLayerItemIndexDict[str(topLayerItemIndex)]
# print 'parentItemFullName',parentItemFullName
self.parentItemFullName =parentItemFullName
#return parentFullName
#cmds.select(selectItemInOutLiner)
def moveSelection(self, parent, position):
print 'moveSelection'
# save the selected items
dragItem = self.selectItems()
selection = [QtCore.QPersistentModelIndex(i)
for i in self.selectedIndexes()]
parent_index = self.indexFromItem(parent)
if parent_index in selection:
return False
# save the drop location in case it gets moved
target = self.model().index(position, 0, parent_index).row()
if target < 0:
target = position
# remove the selected items
taken = []
for index in reversed(selection):
item = self.itemFromIndex(QtCore.QModelIndex(index))
if item is None or item.parent() is None:
taken.append(self.takeTopLevelItem(index.row()))
else:
taken.append(item.parent().takeChild(index.row()))
self.checkParentFullName(parent)
dropTarget = self.parentItemFullName
print 'dragItem',dragItem
print 'dropTarget',dropTarget
self.moveTreeItem(dragItem,dropTarget)
while taken:
if position == -1:
# append the items if position not specified
if parent_index.isValid():
parent.insertChild(
parent.childCount(), taken.pop(0))
else:
self.insertTopLevelItem(
self.topLevelItemCount(), taken.pop(0))
else:
# insert the items at the specified position
if parent_index.isValid():
parent.insertChild(min(target,
parent.childCount()), taken.pop(0))
else:
self.insertTopLevelItem(min(target,
self.topLevelItemCount()), taken.pop(0))
return True
def moveTreeItem(self,dragItem,dropTarget):
print 'moveTreeItem'
for i in dragItem:
cmds.parent(i,dropTarget)
def main():
global ui
app = QtWidgets.QApplication.instance()
if app == None: app = QtWidgets.QApplication(sys.argv)
try:
ui.close()
ui.deleteLater()
except: pass
ui = mod_MainWindow()
ui.show()
if __name__ == '__main__':
main()
| [
"alpha@mail.chungyo.net"
] | alpha@mail.chungyo.net |
dd38861457d0332d6c9b6322722556eb6f6b3fc6 | b577bd7cee15fc4a9c7b57eac07b532b53f5a890 | /teste.py | 048c8e430f2aaccdbe0cc12bec39aa454a6d551e | [] | no_license | ponsdev/Arch-Timer | 6dcac54e6a43c8f89a1f09dace1d7e9d32a632a2 | ae89915e727c67d66662df3cedaa570d253ac5c7 | refs/heads/master | 2020-03-09T15:39:57.312960 | 2019-05-10T18:27:09 | 2019-05-10T18:27:09 | 128,864,924 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 48 | py | import sys
filePath=sys.argv[1]
print(filePath) | [
"viniciusdev@zoho.com"
] | viniciusdev@zoho.com |
19b41fc5be51639e178372588125d29a461f3787 | aa99ccc7b3dd4a359b2a4c2925bca95e421b759a | /FIG5.2a/g158.py | 2faf0fa0e61ba827de1a93c7908567cf04fc0aed | [] | no_license | ardhendubarman/PROJECT | 7689b083c633d0e543359462f28a60658a3dabe6 | 97a02f3a7a8eee0009c1c465c6df52ffd608cf55 | refs/heads/master | 2021-01-25T11:14:28.710512 | 2017-06-10T10:33:01 | 2017-06-10T10:33:01 | 93,915,610 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,653 | py | """
A freely-propagating, premixed hydrogen flat flame with multicomponent
transport properties.
"""
import cantera as ct
import pickle as pkl
import numpy as np
# Simulation parameters
p = ct.one_atm # pressure [Pa]
S_l=[]
#j=[0.32, 0.34, 0.38, 0.46, 0.62]
i = np.linspace(300, 1350, 30) # unburned gas temperature [K]
np.put(i,18,920)
grid=1.58
for Tin in i:
reactants = 'CH4:1, O2:2, N2:7.52' # premixed gas composition
initial_grid = np.linspace(0.0, grid, 6) # m
tol_ss = [1.0e-5, 1.0e-9] # [rtol atol] for steady-state problem
tol_ts = [1.0e-4, 1.0e-13] # [rtol atol] for time stepping
loglevel = 1 # amount of diagnostic output (0 to 8)
refine_grid = True # 'True' to enable refinement, 'False' to disable
# IdealGasMix object used to compute mixture properties
gas = ct.Solution('gri30.xml')
gas.TPX = Tin, p, reactants
# Flame object
f = ct.FreeFlame(gas, initial_grid)
f.flame.set_steady_tolerances(default=tol_ss)
f.flame.set_transient_tolerances(default=tol_ts)
# Set properties of the upstream fuel-air mixture
f.inlet.T = Tin
f.inlet.X = reactants
## f.show_solution()
# Solve with the energy equation disabled
f.energy_enabled = False
f.set_max_jac_age(10, 10)
f.set_time_step(1e-5, [2, 5, 10, 20])
f.solve(loglevel=loglevel, refine_grid=False)
f.save('adiabatic.xml', 'no_energy', 'solution with the energy equation disabled')
# Solve with the energy equation enabled
f.transport_model= 'Mix'
f.set_refine_criteria(ratio=3, slope=0.04, curve=0.07)
f.energy_enabled = True
f.solve(loglevel=loglevel, refine_grid=refine_grid)
f.save('adiabatic.xml', 'energy', 'solution with mixture-averaged transport')
#f.show_solution()
print('mixture-averaged flamespeed = {0:7f} m/s'.format(f.u[0]))
S_l.append(f.u[0])
#%%
##import matplotlib.pyplot as plt
##plt.loglog(i, S_l)
# Solve with multi-component transport properties
# f.transport_model = 'Multi'
# f.solve(loglevel, refine_grid)
# f.show_solution()
# print('multicomponent flamespeed = {0:7f} m/s'.format(f.u[0]))
# f.save('h2_adiabatic.xml','energy_multi',
# 'solution with multicomponent transport')
# write the velocity, temperature, density, and mole fractions to a CSV file
## f.write_csv('adiabatic.csv', quiet=True)
#%%
#z=[a*b for a,b in zip(f.grid,f.u)]
##z=f.grid
##z=[a*b for a,b in zip(f.grid,f.u)]
##z=f.grid/f.u[0]
##pkl.dump(z,open('data.pkl','wb'))
##pkl.dump(Tin,open('data.pkl','wb'))
##i=len(z)
pkl.dump(S_l,open('vel_'+str(grid)+'.pkl','wb'))
pkl.dump(Tin,open('temp.pkl','wb'))
| [
"ardhendu.1994@gmail.com"
] | ardhendu.1994@gmail.com |
711cad9016bd2b8763f7e58436756578d43a0017 | 0f20fd02b26edda61d911387fae18248a5b387c1 | /smtp/smtpd_senddata/smtpd_senddata.py | 6e7487b46bc852ec71dc94766dc968be74783247 | [] | no_license | jadermcs/networkinglab | fa7660536b39179bc71c1a2caabe7fb3d4043027 | 326d4ce261b2c0a4c684ff7c355992edcf85f5c6 | refs/heads/master | 2020-03-10T02:50:58.834880 | 2018-04-28T14:45:49 | 2018-04-28T14:45:49 | 129,147,873 | 0 | 0 | null | 2018-04-15T14:56:25 | 2018-04-11T20:05:42 | Python | UTF-8 | Python | false | false | 795 | py | import smtplib
import email.utils
from email.mime.text import MIMEText
# Create the message
msg = MIMEText('This is the body of the message.')
msg['To'] = email.utils.formataddr(('Recipient',
'recipient@example.com'),
('Joao',
'joaoud@example.com'))
msg['From'] = email.utils.formataddr(('Author',
'author@example.com'))
msg['Subject'] = 'Simple test message'
server = smtplib.SMTP('172.17.0.2', 1025)
server.set_debuglevel(True) # show communication with the server
try:
server.sendmail('author@example.com',
['recipient@example.com', 'joaoud@example.com'],
msg.as_string())
finally:
server.quit()
| [
"jadermcs94@gmail.com"
] | jadermcs94@gmail.com |
d93a6ea41527ac0523476d0d352ebbf555f433f9 | 702e834fec254abce7f739a8086ba06e976df7ad | /necAnalysis.py | 25c80736cc16dbb670761dd38ba8a99c49678411 | [] | no_license | iamjino/tanimaul | 0a6146fbc2f9e3b0748ce74f014d78c0d0feffb0 | d77d3880edb15654bc683dc069a50ed477b96031 | refs/heads/master | 2023-01-20T14:52:29.354725 | 2020-11-30T19:11:19 | 2020-11-30T19:11:19 | 295,502,667 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 9,069 | py | import pandas as pd
def day_voter(x):
result = ''
if x['사전투표수'] > 0:
result = x['투표수']
return result
class NecAnalysis():
def __init__(self, file_result, file_book):
result_items = pd.read_excel(file_result)
book_items = pd.read_excel(file_book)
nec_result_part = result_items[['읍면동투표구명', '읍면동명', '투표구명', '선거인수', '투표수', '기권수']].copy()
nec_result_part.rename(columns={'읍면동명': '읍면동명_결과', '투표구명': '투표구명_결과'}, inplace=True)
self.na = pd.merge(book_items, nec_result_part, on='읍면동투표구명', how='right')
self.score = result_items.copy()
self.dongs = self.na['읍면동명'].dropna().unique()
self.score_dong_unique = self.score['읍면동명'].unique()
self.score_place_unique = self.score['투표구명'].unique()
def get_place_pre_sum(self):
self.na['당일투표수'] = ''
self.na['사전투표수'] = self.na['확정된 국내선거인수 (A)'] - self.na['선거인수']
self.na['당일투표수'] = self.na.apply(day_voter, axis=1)
self.na.drop(self.na.index[self.na['투표구명'] == '소계'], axis=0, inplace=True)
self.na.set_index(['읍면동명_결과', '투표구명_결과'], inplace=True)
self.na['관내사전투표수'] = ''
for dong in self.dongs:
dong_pre_sum = self.na.loc[(dong, '관내사전투표'), '선거인수']
dong_pre = self.na.loc[dong, '사전투표수'].sum()
dong_pre_in_ratio = dong_pre_sum / dong_pre
for place in self.na.loc[dong].index:
self.na.loc[(dong, place), '관내사전투표수'] = \
self.na.loc[(dong, place), '사전투표수'] * dong_pre_in_ratio
self.na['관외사전투표수'] = self.na['사전투표수'] - self.na['관내사전투표수']
self.na['당일투표율'] = self.na['당일투표수'] / self.na['확정된 국내선거인수 (A)'] * 100
self.na['사전투표율'] = self.na['사전투표수'] / self.na['확정된 국내선거인수 (A)'] * 100
self.na['관내사전투표율'] = self.na['관내사전투표수'] / self.na['확정된 국내선거인수 (A)'] * 100
self.na['관내사전투표 비중'] = self.na['관내사전투표수'] / self.na['사전투표수'] * 100
self.na['투표율'] = self.na['당일투표율'] + self.na['사전투표율']
self.na['기권율'] = self.na['기권수'] / self.na['확정된 국내선거인수 (A)'] * 100
self.na.drop(self.na.index[pd.isna(self.na['투표구명'])], axis=0, inplace=True)
def get_place_pre_score(self):
self.score.drop(['읍면동투표구명', '대수', '선거명', '선거구명'], axis=1, inplace=True)
self.score['유형'] = '당일투표'
score = []
self.score.set_index(['읍면동명', '투표구명', '유형'], inplace=True)
for dong in self.dongs:
dong_pre_score = self.score.loc[(dong, '관내사전투표', '당일투표')].copy()
dong_pre_sum = dong_pre_score['선거인수']
for place in self.na.loc[dong].index:
place_pre_sum = self.na.loc[(dong, place), '관내사전투표수']
place_pre_score = dong_pre_score * (place_pre_sum / dong_pre_sum)
place_pre_score.rename((dong, place, '관내사전투표'), inplace=True)
score.append(place_pre_score)
gu_pre_sum = self.na['관외사전투표수'].sum()
gu_pre_out_score = self.score.loc[('거소·선상투표', '전체', '당일투표')]
gu_pre_out_score = gu_pre_out_score.add(self.score.loc[('관외사전투표', '전체', '당일투표')])
if '국외부재자투표' in self.score_dong_unique:
gu_pre_out_score = gu_pre_out_score.add(self.score.loc[('국외부재자투표', '전체', '당일투표')])
if '재외투표' in self.score_dong_unique:
gu_pre_out_score = gu_pre_out_score.add(self.score.loc[('재외투표', '전체', '당일투표')])
gu_pre_out_score = gu_pre_out_score.add(self.score.loc[('잘못투입·구분된투표지', '전체', '당일투표')])
for dong in self.dongs:
for place in self.na.loc[dong].index:
place_pre_sum = self.na.loc[(dong, place), '관외사전투표수']
place_pre_score = gu_pre_out_score * (place_pre_sum / gu_pre_sum)
place_pre_score.rename((dong, place, '관외사전투표'), inplace=True)
score.append(place_pre_score)
self.score = self.score.append(score)
self.score.rename({'무효 투표수': '무효 투표', '기권수': '기권'}, axis='columns', inplace=True)
self.score.drop(['거소·선상투표', '관외사전투표', '국외부재자투표', '재외투표', '잘못투입·구분된투표지'], axis=0, level=0, inplace=True)
self.score.drop(['소계', '계', '관내사전투표'], axis=0, level=1, inplace=True)
self.score.sort_index(inplace=True)
def copy_series(self, org_list, dong, place):
new_list = org_list.copy()
new_list.rename((dong, place), inplace=True)
return new_list
def concat_list(self, add_list):
df_list = pd.DataFrame(add_list)
df_list.drop(['선거인수', '투표수'], axis=1, inplace=True)
self.na = pd.concat([self.na, df_list], axis=1)
def get_score_analysis(self):
if '국외부재자투표(공관)' in self.score_dong_unique:
total_valid = self.score['투표수'].sum() - self.score.loc[('국외부재자투표(공관)', '전체', '당일투표'), '투표수']
else:
total_valid = self.score['투표수'].sum()
stat_score = []
analysis_total_ratio = []
ratio_sums = []
ratio_pres = []
ratio_days = []
for dong in self.dongs:
for place in self.na.loc[dong].index:
place_score = self.score.loc[(dong, place)]
score_sum = place_score.sum()
score_sum.rename((dong, place, '소계'), inplace=True)
stat_score.append(score_sum)
total_vote = score_sum['투표수']
ratio_sum = score_sum / total_vote * 100
ratio_sum.rename((dong, place, '비율'), inplace=True)
stat_score.append(ratio_sum)
score_pre = self.score.loc[(dong, place, ['관내사전투표', '관외사전투표'])].sum()
score_pre.rename((dong, place, '사전소계'), inplace=True)
stat_score.append(score_pre)
ratio_pre = score_pre / total_vote * 100
ratio_pre.rename((dong, place, '사전비율'), inplace=True)
stat_score.append(ratio_pre)
score_day = self.score.loc[(dong, place, ['당일투표'])].sum()
ratio_day = score_day / total_vote * 100
ratio_day.rename((dong, place, '당일비율'), inplace=True)
stat_score.append(ratio_day)
ratio_sums.append(self.copy_series(ratio_sum, dong, place))
ratio_pres.append(self.copy_series(ratio_pre, dong, place))
ratio_days.append(self.copy_series(ratio_day, dong, place))
score_total_ratio_anlaysis = score_sum / total_valid * 100 * self.na.index.size
score_total_ratio_anlaysis.rename((dong, place), inplace=True)
analysis_total_ratio.append(score_total_ratio_anlaysis)
self.score = self.score.append(stat_score)
self.score.sort_index(inplace=True)
self.concat_list(ratio_sums)
self.concat_list(ratio_pres)
self.concat_list(ratio_days)
def merge_house_info(self, sg_id, doc_poll_house_info):
df_house_infos = pd.read_excel(doc_poll_house_info)
df_house_info_sub1 = df_house_infos.loc[:, [sg_id, '세대수', '동수', '전용면적 60이하', '전용면적 60-85이하', '전용면적 85-135이하', '전용면적 135초과', '단지 전용면적합']]
df_house_info_sub1.rename(columns={'세대수': '공동주택 세대수'}, inplace=True)
df_house_info_summary = df_house_info_sub1.groupby(sg_id).sum()
df_house_info_summary.insert(0, '공동주택 단지수', df_house_info_sub1.groupby(sg_id).size())
self.na = pd.merge(self.na, df_house_info_summary, left_on='투표구명', right_index=True, how='left')
self.na['세대 평균 전용면적'] = self.na['단지 전용면적합'] / self.na['공동주택 세대수']
self.na['공동주택 세대수 커버리지'] = self.na['공동주택 세대수'] / self.na['세대수'] * 100
def run(self, sg_id, doc_poll_house_info):
self.get_place_pre_sum()
self.get_place_pre_score()
self.merge_house_info(sg_id, doc_poll_house_info)
self.get_score_analysis()
| [
"55924206+ryanroypapa@users.noreply.github.com"
] | 55924206+ryanroypapa@users.noreply.github.com |
520225b1b9d44a0d7ef41248511013f812e9c07f | 5ead730e69f1042de1f43ac64e767d6463ffe691 | /basic guess game.py | 6c1bf87b7d5dcc7046f85a7ffb5b79db10b2b3ab | [
"MIT"
] | permissive | ravi9607/basic-program-by-python | 84258d110cdb9f9f285e93ddac5eb411d60fae77 | 534fc4a4c316ba0b8391f72647c4f9c9d33bb8e6 | refs/heads/main | 2022-12-26T05:33:35.965400 | 2020-10-10T13:07:51 | 2020-10-10T13:07:51 | 301,167,757 | 0 | 0 | null | 2020-10-04T15:56:25 | 2020-10-04T15:56:24 | null | UTF-8 | Python | false | false | 356 | py | code_word = "priya"
guess = ""
guess_count= 0
guess_limit= 3
out_of_gusses=False
while guess != code_word and not out_of_gusses :
if guess_count< guess_limit:
guess = input("enter guess : ")
guess_count+=1
else:
out_of_gusses=True
if out_of_gusses:
print("you lose!")
else:
print("congrats, YOU WIN !") | [
"noreply@github.com"
] | ravi9607.noreply@github.com |
3e5b76060a8d08eb9c454a93b5bf91d108e6268c | e2e08d7c97398a42e6554f913ee27340226994d9 | /pyautoTest-master(ICF-7.5.0)/test_case/scg_old/scg_obj_shell_2nd/test_c40343.py | 3c334ff2e3e9d1098cbb335f5426d69ef272f5d0 | [] | no_license | lizhuoya1111/Automated_testing_practice | 88e7be512e831d279324ad710946232377fb4c01 | b3a532d33ddeb8d01fff315bcd59b451befdef23 | refs/heads/master | 2022-12-04T08:19:29.806445 | 2020-08-14T03:51:20 | 2020-08-14T03:51:20 | 287,426,498 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,783 | py | import pytest
import time
import sys
from page_obj.scg.scg_def import *
from page_obj.scg.scg_def_obj import *
from page_obj.scg.scg_def_log import *
from page_obj.common.rail import *
from os.path import dirname, abspath
sys.path.insert(0, dirname(dirname(abspath(__file__))))
test_id = 40343
# 修改以subnet方式添加的一条addr obj,查看log
def test_change_obj_wxw(browser):
try:
login_web(browser, url="10.2.2.81")
# 先添加再修改
add_obj_address_wxw(browser, name='obj_add_343', desc='zhe是yi个描述1', subnetip='11.11.11.1', subnetmask='24')
# 欲修改哪个参数可直接编辑
change_obj_address_wxw(browser, name='obj_add_343', desc='zhe是yi个描述2', subnetip='11.11.11.2', subnetmask='32')
time.sleep(2)
# 切换到默认frame
browser.switch_to.default_content()
get_log(browser, 管理日志)
browser.switch_to.default_content()
# 切换到左侧frame
browser.switch_to.frame("content")
loginfo = browser.find_element_by_xpath('//*[@id="namearea0"]').text
try:
assert "配置地址对象成功,修改内部对象 [obj_add_343]" in loginfo
rail_pass(test_run_id, test_id)
except:
rail_fail(test_run_id, test_id)
assert "配置地址对象成功,修改内部对象 [obj_add_343]" in loginfo
except Exception as err:
# 如果上面的步骤有报错,重新设备,恢复配置
reload(hostip="10.2.2.81")
print(err)
rail_fail(test_run_id, test_id)
time.sleep(70)
assert False
if __name__ == '__main__':
pytest.main(["-v", "-s", "test_c40343.py"]) | [
"15501866985@163.com"
] | 15501866985@163.com |
dc3f80de3fed77fc2506bf296b04f63ce5dd996c | f19c5436c7173835a3f1d064541ee742178e213a | /mah/divide and conquer/[BOJ]1920_수 찾기.py | 9bdd791f8797941a03f185c9f847b8104e5e9e83 | [] | no_license | hongsungheejin/Algo-Study | f1c521d01147a6f74320dbc8efe3c1037e970e73 | d6cb8a2cc6495ccfcfb3477330a3af95895fae32 | refs/heads/main | 2023-07-06T10:58:27.258128 | 2021-07-29T02:11:13 | 2021-07-29T02:11:13 | 379,269,918 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 385 | py | N = int(input())
nums = list(map(int, input().split()))
nums.sort()
M = int(input())
tars = list(map(int, input().split()))
def binary_serach(tar):
l, r = 0, len(nums) - 1
while l<=r:
m = (l+r)//2
if nums[m] == tar: return 1
elif nums[m] < tar: l=m+1
else: r=m-1
return 0
for tar in tars:
print(binary_serach(tar)) | [
"mai.hong0924@gmail.com"
] | mai.hong0924@gmail.com |
39e2d9dbdc83ea68defe4b575e5d0bee237f89bc | 205be8d429df36e27cdfc048bfca9212c5a62a87 | /icu/urls.py | ed2cf073014ebef72cfb33b59762ed1241b9df93 | [] | no_license | KennyChrisUmurundi/HOsto | 16c8f926282fc48c981532447f1685fbbc2b457c | 33fa31524a08934f3deb8f622a1b1554d8ef1af4 | refs/heads/master | 2022-04-01T02:42:39.146227 | 2020-01-07T11:44:08 | 2020-01-07T11:44:08 | 193,458,881 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 478 | py | from django.urls import path
from django.contrib.auth import views as auth_views
from . import views as icu_views
from django.conf.urls.static import static
from django.conf import settings
app_name = 'icu'
urlpatterns = [
path('Medical Update/',icu_views.update_list,name="add-medical"),
path('scan/',icu_views.ScanCode,name="ScanCode"),
path('patient/<slug:code>',icu_views.patient,name="patient"),
path('feedback/<slug:code>/<int:id>',icu_views.feedback,name="feedback"),
]
| [
"ndayikennysmuusic@gmail.com"
] | ndayikennysmuusic@gmail.com |
13daadc403ee347a1877bef70ef64461737e38cc | 5a71ca1f5c964f803350e3c1238cb48986db565c | /coinlibbitfinex/coinlibbitfinex/streamapi.py | d6eb6285f6a324d0a46d8cc40959a345f9c959cd | [] | no_license | tetocode/coinliball | fd644cbc16039ecad7e43228ea4e287ead5c8e5f | 41ebbac13c1fbba98aedaa766b9a505cb157f374 | refs/heads/master | 2022-09-28T21:58:08.130006 | 2020-06-04T03:00:56 | 2020-06-04T03:00:56 | 269,247,318 | 0 | 2 | null | null | null | null | UTF-8 | Python | false | false | 3,624 | py | import json
import logging
from typing import Hashable, Dict
from websocket import WebSocket
from coinlib.datatypes.streamdata import StreamData
from coinlib.trade.websocketstreamapi import WebSocketStreamApi
logger = logging.getLogger(__name__)
class StreamApi(WebSocketStreamApi):
URL = 'wss://api.bitfinex.com/ws'
def __init__(self, **kwargs):
super().__init__(**kwargs)
self._subscriptions = {}
self._channel_id_map: Dict[int, Hashable] = {}
def _process_subscription_q(self, ws: WebSocket):
# process one
if len(self._subscription_q):
op, (key, params) = self._subscription_q.popleft()
if op == 'subscribe':
self._subscriptions[key] = params
self._subscribe_channel(params)
logger.debug(f'subscribe {key} {params}')
elif op == 'unsubscribe':
params = self._subscriptions.pop(key, None)
if params is not None:
for channel_id, v in self._channel_id_map.items():
if v == key:
self._unsubscribe_channel(channel_id)
logger.debug(f'unsubscribe {key} {params} {channel_id}')
break
else:
assert False, f'unknown operation={op}'
def _subscribe_channel(self, params: dict):
request = dict(event='subscribe')
request.update(params)
self.send_message(request)
def _unsubscribe_channel(self, channel_id: int):
self.send_message({
'event': 'unsubscribe',
'chanId': channel_id,
})
def on_message(self, message_data: str):
message = json.loads(message_data)
if isinstance(message, dict):
event = message.get('event')
if event == 'info':
logger.debug(f'event info {message}')
return
elif event == 'subscribed':
self.on_subscribed(message)
return
elif event == 'unsubscribed':
self.on_unsubscribed(message)
return
elif event == 'error':
self.on_error(message)
return
else:
logger.warning(f'event unsupported {message}')
return
if isinstance(message, list):
self.on_channel_data(message)
return
logger.warning(f'unknown message {message}')
def on_subscribed(self, message: dict):
channel_name = message['channel']
for key, params in self._subscriptions.items():
if channel_name == params.get('channel'):
if channel_name == 'book':
# TODO: distinguish between order_book and raw_order_book
if message['pair'].upper() != params.get('pair', '').upper():
continue
channel_id = int(message['chanId'])
self._channel_id_map[channel_id] = key
logger.debug(f'event subscribed {message}')
return
logger.warning('unknown event subscribe {message}')
def on_unsubscribed(self, message: dict):
_ = self
logger.debug(f'event unsubscribed {message}')
def on_error(self, message: dict):
_ = self
logger.error(f'event error {message}')
def on_channel_data(self, data: list):
channel_id = data[0]
key = self._channel_id_map.get(channel_id)
if key:
self.on_raw_data(StreamData(key, data))
| [
"_"
] | _ |
b284a5639417c0f7114f20e3ced9f5d326bbab15 | 699c5894668e07bbb4ddae632730f0d218f72558 | /Yeji-Lee/baekjoon/b_100/두 수 비교하기.py | dba5c432a59ef39ab6eefb04ce05640afbacc605 | [] | no_license | Sumsan38/learning-algorithm | 0914ddbbd8786381dda807562e4529773b4aa987 | 59a1d7b53d4348a0320b0cbf48ee75b5086b3a29 | refs/heads/master | 2023-07-15T08:16:29.896218 | 2021-08-14T11:47:01 | 2021-08-14T11:47:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 154 | py | # https://www.acmicpc.net/problem/1330
A, B = map(int, input().split())
if A > B:
print('>')
elif A < B:
print('<')
elif A == B:
print('==')
| [
"noreply@github.com"
] | Sumsan38.noreply@github.com |
ac036b0c581fd56f8e5a1abc72999ba8a216c0aa | cdfb03781f49a49fca5d0f316ecdffaeda9820ca | /djangohw/settings.py | 43eb61118c966cb2173b36b8192539392bbd3352 | [] | no_license | argocan/djangohw | 8f302697fca27ba6f824fe8536cea0de99233337 | da4b9a12b020a2627e05d131f2d5c7da76f50c3e | refs/heads/main | 2023-02-04T02:06:33.058412 | 2020-12-15T12:18:15 | 2020-12-15T12:18:15 | 321,629,074 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,068 | py | """
Django settings for djangohw project.
Generated by 'django-admin startproject' using Django 3.1.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '(dn-&qaq$k(=5=4d+0)abz#au4#nv@30+_t+@!!i2$gt6g^y23'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'djangohw.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'djangohw.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
| [
"fabrizio.gambelunghe@cdp.it"
] | fabrizio.gambelunghe@cdp.it |
736bedd04ea4ca3c0156959d4853a7f040a14417 | fac02e1c20a0fe9873acbcdb42dadc63f60eb53a | /diming/diming/pipelines.py | f53d0d26dfd3ee5c629c117cfaae1483d9c3b4d3 | [] | no_license | mekhicode/crawler | da56ef6304ae176248759804781847ad8d4c8d7d | 080ad590a2473f747cf37e3cc48a122b959d80ba | refs/heads/master | 2021-01-22T07:06:25.238971 | 2016-09-20T05:50:49 | 2016-09-20T05:50:49 | 68,670,780 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 286 | py | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class DimingPipeline(object):
def process_item(self, item, spider):
return item
| [
"tangmash@163.com"
] | tangmash@163.com |
f0c2651bd1caa32ffae059846f3a13da0a81e91e | 19c6ae914b454dd2e23e364b78fab8734e300316 | /api/migrations/0003_auto_20180414_1541.py | 020b94563bce9b5d0c3044ae773d370daada992d | [] | no_license | deepnirmal/Django-sample | 6e538a6f1acc989302c70459d388e1d49a86944b | 29eed30fec4d3f5f9d53090e6dd54707b45e37ce | refs/heads/master | 2020-03-10T23:29:13.531222 | 2018-04-16T05:17:07 | 2018-04-16T05:17:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 461 | py | # Generated by Django 2.0.4 on 2018-04-14 15:41
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0002_auto_20180414_1524'),
]
operations = [
migrations.AlterField(
model_name='task',
name='status',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Status'),
),
]
| [
"Deep.Nirmal@walmart.com"
] | Deep.Nirmal@walmart.com |
6e15567d6391d71d681cf27964983a4307bacdde | d6d3e49cd07d64c6c59ad101a8a2a8585cb8874a | /DHidasAna/SimpleAna/python/__init__.py | 2499d6cb767ee0f3a69e86799dffd820c9b31ac5 | [] | no_license | dhidas/UserCode | 2bb36c4eb5bd9daa4d71a739a042e4aee9200dea | 04701c732d8acb3042e8967898a789d2b2845da4 | refs/heads/master | 2021-01-18T14:02:11.537626 | 2013-10-25T14:31:27 | 2013-10-25T14:31:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 201 | py | #Automatically created by SCRAM
import os
localrt=os.getenv('LOCALRT', None)
arch=os.getenv('SCRAM_ARCH', None)
if localrt != None:
__path__.append(localrt+'/cfipython/'+arch+'/DHidasAna/SimpleAna')
| [
""
] | |
4272a7d781c422d78e27a838280b038082ef95ab | 57fc5d54f5df359c7a53020fb903f36479d3a322 | /controllers/.history/supervisor/supervisor_20201127194410.py | c91f5cc5bde9a494e19c7adadf4e75e4d0388496 | [] | no_license | shenwuyue-xie/webots_testrobots | 929369b127258d85e66c5275c9366ce1a0eb17c7 | 56e476356f3cf666edad6449e2da874bb4fb4da3 | refs/heads/master | 2023-02-02T11:17:36.017289 | 2020-12-20T08:22:59 | 2020-12-20T08:22:59 | 323,032,362 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 25,059 | py | import math
import numpy as np
from numpy import random
from numpy.core.fromnumeric import size
from numpy.lib.function_base import meshgrid
import utilities as utils
from deepbots.supervisor.controllers.supervisor_emitter_receiver import \
SupervisorCSV
# # from deepbots.supervisor.wrappers.tensorboard_wrapper import TensorboardLogger
from tensorboardX import SummaryWriter
from models.networks import TD3
from controller import Keyboard
import os
Max_robotnum = 6
OBSERVATION_SPACE = (Max_robotnum-1) * 4 + 7 + 9 * Max_robotnum
ACTION_SPACE = Max_robotnum * 2 + 3
MAX_DSNUM = (Max_robotnum-1) * 4 + 7
DIST_SENSORS_MM = {'min': 0, 'max': 1000}
XPOSITION = {'min':-2, 'max':2}
YPOSITION = {'min':-1.5 , 'max':1.5}
ZPOSITION = {'min': -1, 'max' : 8}
MAX_DISTANCE = {'min':0, 'max':10}
MAX_ANGLE = {'min':-math.pi, 'max':math.pi}
# import ptvsd
# print("waiting for debugger attach")
# ptvsd.enable_attach(address=("127.0.0.1",7788))
# ptvsd.wait_for_attach()
class TaskDecisionSupervisor(SupervisorCSV):
def __init__(self,robot,observation_space,log_dir,v_action,v_observation,v_reward,windows=[10,100,200]):
super(TaskDecisionSupervisor,self).__init__()
self.timestep = int(self.supervisor.getBasicTimeStep())
self.keyboard = Keyboard()
self.keyboard.enable(self.timestep)
self.emitter = self.supervisor.getEmitter('emitter')
self.receiver = self.supervisor.getReceiver('receiver')
self.robot_list = robot
self.robot_handles = []
self.observation = [0 for i in range(observation_space)]
self.findThreshold = 0.2
self.steps = 0
self.steps_threshold = 6000
self.endbattery = [50000 for i in range(Max_robotnum)]
self.final_distance = [50 for i in range(Max_robotnum)]
self.final_target = self.supervisor.getFromDef('final_target')
self.should_done = False
self.startbattery = 50000
self.setuprobots()
self.step_cntr = 0
self.step_global = 0
self.step_reset = 0
self.score = 0
self.score_history = []
self.v_action = v_action
self.v_observation = v_observation
self.v_reward = v_reward
self.windows = windows
self.file_writer = SummaryWriter(log_dir, flush_secs=30)
def setuprobots(self):
for defname in self.robot_list:
self.robot_handles.append(self.supervisor.getFromDef(defname))
def handle_receiver(self):
message = []
for i in range(self.robot_num):
if self.receiver.getQueueLength() > 0:
string_message = self.receiver.getData().decode("utf-8")
string_message = string_message.split(",")
for ms in string_message:
message.append(ms)
self.receiver.nextPacket()
return message
def get_observations(self):
self.ds_values = []
self.final_distance = [50 for i in range(Max_robotnum)]
self.message = [1000 for i in range(MAX_DSNUM)]
self.angles = []
observation = []
message = self.handle_receiver()
self.angles = [0 for i in range(Max_robotnum)]
if len(message) != 0:
for i in range(len(message)):
self.message[i] = float(message[i])
self.ds_values.append(float(message[i]))
for j in range(MAX_DSNUM):
observation.append(utils.normalize_to_range(float(self.message[j]),DIST_SENSORS_MM['min'],DIST_SENSORS_MM['max'], 0, 1))
for k in range(0,self.robot_num):
robot_position = []
robot_position = self.robot_handles[k].getPosition()
robot_rotation = []
robot_rotation = self.robot_handles[k].getOrientation()
observation.append(utils.normalize_to_range(float(robot_position[0]),XPOSITION['min'],XPOSITION['max'],0,1))
observation.append(utils.normalize_to_range(float(robot_position[1]),YPOSITION['min'],YPOSITION['max'],0,1))
observation.append(utils.normalize_to_range(float(robot_position[2]),ZPOSITION['min'],ZPOSITION['max'],0,1))
observation.append(utils.normalize_to_range(float(robot_rotation[0]),-1,1,0,1))
observation.append(utils.normalize_to_range(float(robot_rotation[1]),-1,1,0,1))
observation.append(utils.normalize_to_range(float(robot_rotation[2]),-1,1,0,1))
observation.append(utils.normalize_to_range(float(robot_rotation[3]),-math.pi,math.pi,0,1))
self.final_distance[k] = utils.get_distance_from_target(self.robot_handles[k],self.final_target)
observation.append(utils.normalize_to_range(float(self.final_distance[k]),MAX_DISTANCE['min'],MAX_DISTANCE['max'],0,1))
self.angles[k] = utils.get_angle_from_target(self.robot_handles[k],self.final_target)
observation.append(utils.normalize_to_range(float(self.angles[k]),MAX_ANGLE['min'],MAX_ANGLE['max'],0,1))
for m in range(self.robot_num,Max_robotnum):
for n in range(9):
observation.append(0.5)
else :
observation = [0 for i in range(OBSERVATION_SPACE)]
self.observation = observation
return self.observation
# robot_children = self.robot_handles[k].getField('children')
# frontjoint_node = robot_children.getMFNode(3)
# frontjoint = frontjoint_node.getField('jointParameters')
# frontjoint = frontjoint.getSFNode()
# para = frontjoint.getField('position')
# front_hingeposition = para.getSFFloat()
# observation.append(utils.normalize_to_range(float(front_hingeposition),-math.pi/2,math.pi/2,0,1))
# front_ep = frontjoint_node.getField('endPoint')
# front_ep = front_ep.getSFNode()
# frontrotation_field = front_ep.getField('rotation')
# front_rotation = frontrotation_field.getSFRotation()
# for f in range(3):
# observation.append(utils.normalize_to_range(float(front_rotation[f]),-1,1,0,1))
# observation.append(utils.normalize_to_range(float(front_rotation[3]),-math.pi/2,math.pi/2,0,1))
# robot_children = self.robot_handles[k].getField('children')
# rearjoint_node = robot_children.getMFNode(4)
# rearjoint = rearjoint_node.getField('jointParameters')
# rearjoint = rearjoint.getSFNode()
# para = rearjoint.getField('position')
# rear_hingeposition = para.getSFFloat()
# observation.append(utils.normalize_to_range(float(rear_hingeposition),-math.pi/2,math.pi/2,0,1))
# rear_ep = rearjoint_node.getField('endPoint')
# rear_ep = rear_ep.getSFNode()
# rearrotation_field = rear_ep.getField('rotation')
# rear_rotation = rearrotation_field.getSFRotation()
# for r in range(3):
# observation.append(utils.normalize_to_range(float(rear_rotation[r]),-1,1,0,1))
# observation.append(utils.normalize_to_range(float(rear_rotation[3]),-math.pi/2,math.pi/2,0,1))
# final_position = []
# final_position = self.final_target.getPosition()
# observation.append(utils.normalize_to_range(float(final_position[0]),XPOSITION['min'],XPOSITION['max'],0,1))
# observation.append(utils.normalize_to_range(float(final_position[1]),YPOSITION['min'],YPOSITION['max'],0,1))
# observation.append(utils.normalize_to_range(float(final_position[2]),ZPOSITION['min'],ZPOSITION['max'],0,1))
# final_distance = []
# for d in range(self.robot_num):
# final_distance.append(utils.get_distance_from_target(self.robot_handles[d],self.final_target))
# self.final_distance[d] = final_distance[d]
def get_default_observation(self):
self.observation = [0 for i in range(OBSERVATION_SPACE)]
return self.observation
def empty_queue(self):
self.observation = [0 for i in range(OBSERVATION_SPACE)]
# self.shockcount = 0
self.overrangecount = 0
# self.flagadd = False
# self.flagreduce = False
self.dscount = 0
while self.supervisor.step(self.timestep) != -1:
if self.receiver.getQueueLength() > 0:
self.receiver.nextPacket()
else:
break
def get_reward(self,action):
if (self.observation == [0 for i in range(OBSERVATION_SPACE)] or len(self.observation) == 0 ) :
return 0
reward = 0
translations = []
for i in range(len(self.robot_handles)):
translation = self.robot_handles[i].getField('translation').getSFVec3f()
translations.append(translation)
if self.steps >= self.steps_threshold:
return -20
if np.min(self.ds_values) <= 50:
reward = reward -2
self.dscount = self.dscount + 1
if self.dscount > 60:
reward = reward -20
self.should_done = True
if self.dscount > 30:
reward = reward - 5
if np.min(self.ds_values) <= 150:
reward = reward -1
for j in range(len(self.robot_handles)):
if translations[j][2] <= ZPOSITION['min'] or translations[j][2] >= ZPOSITION['max']:
reward = reward - 2
self.overrangecount = self.overrangecount + 1
if translations[j][0] <= XPOSITION['min'] or translations[j][0] >= ZPOSITION['max']:
reward = reward - 2
self.overrangecount = self.overrangecount + 1
if self.overrangecount >40:
reward = reward -20
self.should_done = True
if min(self.final_distance) < self.findThreshold:
reward = reward + 100
for m in range(Max_robotnum):
consumption = self.startbattery - self.endbattery[m]
reward = reward - float(consumption/self.startbattery) * 6
return reward
else :
reward = reward - float(min(self.final_distance))
return reward
# """惩罚不停+-+-的行为 """
# if action[-1] > 0.9 :
# if self.flagreduce == True:
# self.shockcount = self.shockcount + 1
# self.flagadd = True
# self.flagreduce = False
# if action[-1] < 0.1:
# if self.flagadd == True:
# self.shockcount = self.shockcount + 1
# self.flagadd = False
# self.flagreduce =True
# if action[-1] >=0.1 and action[-1] <=0.9:
# self.shockcount = self.shockcount - 1
# self.flagadd = False
# self.flagreduce = False
# if self.shockcount >= 8:
# reward = reward - 4
# if self.shockcount >= 12:
# reward = reward - 8
# self.should_done = True
# """如果ban的动作值有十个值出现在动作区域,不稳定给负的reward,训练到100代左右时,模块几乎不再动自己的前后motor"""
# count = 0
# for k in range(12,24):
# action[k] = utils.normalize_to_range(float(action[k]),-0.2,1.2,0,1)
# if action[k] > 0.95 or action[k] < 0.05:
# count = count + 1
# if count > 9 :
# reward = reward - 2
"""something worse need to be modified"""
"""加机器人时还需要考虑rearmotor的位置,测试后发现是hingejoint的jointParameters域的position参数,需要找到这个参数"""
"""可以只改变相对应的hingejoint参数使两者结合,也可以改变模块位置和角度,但是改变模块位置和角度比较复杂"""
# position = abs(get...)
# 改变hingejoint,只需要改变front hingejoint的position参数
# 改变模块位置和角度
# deltax和deltaz可以根据position来计算,主要是rotation要更改,绕x轴旋转(1,0,0,rad)
# 但是之前寻找模块的位置时已经修改过自己的rotation,所以不好更改,并且更改了rotation,translation也要更改,用这套体姿表征体系更改起来特别复杂
# 另外,因为是往后加模块,所以除非尾巴上翘,否则都不能这样加(陷到地底下了)
# 况且,即便尾巴上翘,可以直接加到后ban上,可能也会因为重力原因把整个构型掀翻
# 综上所述,无论是可行性,还是稳定性原因,都建议只修改front_hingejoint的position值
def robot_step(self,action):
# x = np.random.rand()
# e = 0.8 + ep * 0.2/10000
# if x > e :
# action[-1] = np.random.rand()
if action[-1] > 0 and action[-1] <= 0.1 and self.robot_num < Max_robotnum:
last_translation = self.robot_handles[-1].getField('translation').getSFVec3f()
last_angle = self.robot_handles[-1].getField('rotation').getSFRotation()[3]
last_rotation = self.robot_handles[-1].getField('rotation').getSFRotation()
delta_z = 0.23 * math.cos(last_angle)
delta_x = 0.23 * math.sin(last_angle)
new_translation = []
new_translation.append(last_translation[0] - delta_x)
new_translation.append(last_translation[1])
new_translation.append(last_translation[2] - delta_z)
robot_children = self.robot_handles[-1].getField('children')
rearjoint_node = robot_children.getMFNode(4)
joint = rearjoint_node.getField('jointParameters')
joint = joint.getSFNode()
para = joint.getField('position')
hingeposition = para.getSFFloat()
if hingeposition > 0.8 or hingeposition < -0.8:
delta = 0.03 - 0.03 * math.cos(hingeposition)
delta_z = delta * math.cos(last_angle)
delta_x = delta * math.sin(last_angle)
new_translation[0] = new_translation[0] + delta_x
new_translation[2] = new_translation[2] + delta_z
new_rotation = []
for i in range(4):
new_rotation.append(last_rotation[i])
flag_translation = False
flag_rotation = False
flag_front = False
flag_frontposition = False
flag_frontrotation = False
battery_remain = float(self.endbattery[self.robot_num])
importname = "robot_" + str(self.robot_num) + '.wbo'
new_file =[]
with open(importname,'r') as f:
lines = f.readlines()
for line in lines:
if "translation" in line:
if flag_translation == False:
replace = "translation " + str(new_translation[0]) + " " + str(new_translation[1]) + " " + str(new_translation[2])
line = "\t" + replace +'\n'
flag_translation = True
if "rotation" in line:
if flag_rotation == False:
replace = "rotation " + str(new_rotation[0]) + " " + str(new_rotation[1]) + " " + str(new_rotation[2]) + " " \
+str(new_rotation[3])
line = "\t" + replace +'\n'
flag_rotation = True
if 'front HingeJoint' in line:
flag_front = True
if 'position' in line:
if flag_front == True and flag_frontposition ==False:
repalce = "position "+ str(hingeposition)
line = "\t\t\t\t" + repalce + '\n'
flag_frontposition = True
if 'rotation' in line :
if flag_front == True and flag_frontrotation == False:
replace = "rotation " + str(1)+ ' ' + str(0)+ ' ' + str(0) + ' ' + str(hingeposition)
line
if "50000" in line :
line = "\t\t" + str(battery_remain) + "," + " " + str(50000) + '\n'
new_file.append(line)
with open(importname,'w') as f:
for line in new_file:
f.write(line)
rootNode = self.supervisor.getRoot()
childrenField = rootNode.getField('children')
childrenField.importMFNode(-1,importname)
defname = 'robot_' + str(self.robot_num)
self.robot_handles.append(self.supervisor.getFromDef(defname))
self.robot_num = self.robot_num + 1
# new_translation_field = self.robot_handles[-1].getField('translation')
# new_translation_field.setSFVec3f(new_translation)
# new_rotation_field = self.robot_handles[-1].getField('rotation')
# new_rotation_field.setSFRotation(new_rotation)
# robot_children = self.robot_handles[-1].getField('children')
# frontjoint_node = robot_children.getMFNode(3)
# joint = frontjoint_node.getField('jointParameters')
# joint = joint.getSFNode()
# para = joint.getField('position')
# para.setSFFloat(-hingeposition)
# battery_remain = float(self.endbattery[self.robot_num - 1])
# battery_field = self.robot_handles[-1].getField('battery')
# battery_field.setMFFloat(0,battery_remain)
# battery_field.setMFFloat(1,self.startbattery)
elif action[-1] >= 0.9 and action[-1] < 1 and self.robot_num >1:
battery_field = self.robot_handles[-1].getField('battery')
battery_remain = battery_field.getMFFloat(0)
self.endbattery[self.robot_num - 1] = battery_remain
removerobot = self.robot_handles[-1]
removerobot.remove()
self.robot_num = self.robot_num - 1
del(self.robot_handles[-1])
def step(self,action):
if self.supervisor.step(self.timestep) == -1:
exit()
self.handle_emitter(action)
key = self.keyboard.getKey()
observation = self.get_observations()
reward = self.get_reward(action)
isdone = self.is_done()
info = self.get_info()
if key == Keyboard.CONTROL + ord("A"):
print()
print("Actions: ", action)
if key == ord("R"):
print()
print("Rewards: ", reward)
if key == Keyboard.CONTROL + ord("Y"):
print()
print("Observations: ", observation)
if key == Keyboard.CONTROL + ord("M"):
print()
print("message", self.message)
if (self.v_action > 1):
self.file_writer.add_histogram(
"Actions/Per Global Step",
action,
global_step=self.step_global)
if (self.v_observation > 1):
self.file_writer.add_histogram(
"Observations/Per Global Step",
observation,
global_step=self.step_global)
if (self.v_reward > 1):
self.file_writer.add_scalar("Rewards/Per Global Step", reward,
self.step_global)
if (isdone):
self.file_writer.add_scalar(
"Is Done/Per Reset step",
self.step_cntr,
global_step=self.step_reset)
self.file_writer.flush()
self.score += reward
self.step_cntr += 1
self.step_global += 1
return observation,reward,isdone,info
def is_done(self):
self.steps = self.steps + 1
self.file_writer.flush()
if min(self.final_distance) <= self.findThreshold:
print("======== + Solved + ========")
return True
if self.steps >= self.steps_threshold or self.should_done:
return True
# rotation_field = self.robot_handles[0].getField('rotation').getSFRotation()
# """需要计算出模块完全侧边倒的rotation是多少,遇到这种情况直接进行下一次迭代"""
# # if rotation_field[0] < -0.4 and rotation_field[1] > 0.4 and rotation_field[2] > 0.4 and rotation_field[3] < -1.5708:
# # return True
return False
def reset(self):
print("Reset simulation")
self.respawnRobot()
self.steps = 0
self.should_done = False
self.robot_num = 1
"""observation 源代码wrapper有问题"""
self.score_history.append(self.score)
if (self.v_reward > 0):
self.file_writer.add_scalar(
"Score/Per Reset", self.score, global_step=self.step_reset)
for window in self.windows:
if self.step_reset > window:
self.file_writer.add_scalar(
"Score/With Window {}".format(window),
np.average(self.score_history[-window:]),
global_step=self.step_reset - window)
self.file_writer.flush()
self.step_reset += 1
self.step_cntr = 0
self.score = 0
return self.get_default_observation()
def flush(self):
if self._file_writer is not None:
self._file_writer.flush()
def close(self):
if self._file_writer is not None:
self._file_writer.close()
def get_info(self):
pass
def respawnRobot(self):
for robot in self.robot_handles:
robot.remove()
rootNode = self.supervisor.getRoot()
childrenField = rootNode.getField('children')
childrenField.importMFNode(-1,"robot_0.wbo")
# childrenField.importMFNode(-1,"robot_1.wbo")
# childrenField.importMFNode(-1,"robot_2.wbo")
# childrenField.importMFNode(-1,"robot_3.wbo")
# childrenField.importMFNode(-1,"robot_4.wbo")
# childrenField.importMFNode(-1,"robot_5.wbo")
self.robot_handles = []
for defrobotname in self.robot_list:
self.robot_handles.append(self.supervisor.getFromDef(defrobotname))
self.final_target = self.supervisor.getFromDef('final_target')
self.supervisor.simulationResetPhysics()
self._last_message = None
robot_defnames = ['robot_0']
supervisor_env = TaskDecisionSupervisor(robot_defnames, observation_space=OBSERVATION_SPACE,log_dir="logs/results/ddpg", v_action=1,v_observation=1,v_reward=1,windows=[10,\
10000, 2000])
agent = TD3(lr_actor=0.00025,
lr_critic=0.0025,
input_dims= OBSERVATION_SPACE,
gamma=0.99,
tau=0.001,
env=supervisor_env,
batch_size=512,
layer1_size=400,
layer2_size=300,
layer3_size=200,
layer4_size=400,
layer5_size=300,
layer6_size=200,
n_actions=ACTION_SPACE,
load_models=False,
save_dir='./models/saved/ddpg/')
score_history = []
np.random.seed(0)
for i in range(1, 20000):
done = False
score = 0
obs = list(map(float, supervisor_env.reset()))
supervisor_env.empty_queue()
first_iter = True
if i % 10000 == 0:
print("================= TESTING =================")
while not done:
act = agent.choose_action_test(obs).tolist()
supervisor_env.robot_step(act)
new_state, _, done, _ = supervisor_env.step(act)
obs = list(map(float, new_state))
else:
print("================= TRAINING =================")
while not done:
if (not first_iter):
act = agent.choose_action_train(obs).tolist()
else:
first_iter = False
act = [0,0]
for k in range(0,13):
act.append(0.5)
supervisor_env.robot_step(act)
new_state, reward, done, info = supervisor_env.step(act)
agent.remember(obs, act, reward, new_state, int(done))
agent.learn()
score += reward
obs = list(map(float, new_state))
score_history.append(score)
print("===== Episode", i, "score %.2f" % score,
"100 game average %.2f" % np.mean(score_history[-100:]))
if i % 100 == 0:
agent.save_models() | [
"1092673859@qq.com"
] | 1092673859@qq.com |
1c91383daeead69767d8a3e989bcf2f3fff2bfeb | 1910497a6d0bf8d572ecb933127792c6ee924f26 | /Python/Mutations.py | b71f00ff91cfb5841480d27fd1a3db4b40189081 | [] | no_license | saurabhc24/hackerrank-solutions | 558e56754c11f5f25976df1aa38b33db04b37734 | 3499014a33b3383ee28d48f92063a67bb9e05bfc | refs/heads/master | 2023-08-21T18:05:42.507456 | 2021-10-03T17:42:35 | 2021-10-03T17:42:35 | 260,264,605 | 0 | 2 | null | 2020-10-10T07:31:13 | 2020-04-30T16:40:08 | C | UTF-8 | Python | false | false | 439 | py | def mutate_string(string, position, character):
return"".join(list(string[:position]+character+string[position+1:]))
#first converting the string into list and then using slice [:] to add the desired character at the required position, then using join() string method to convert it back to string
if __name__ == '__main__':
s = raw_input()
i, c = raw_input().split()
s_new = mutate_string(s, int(i), c)
print s_new
| [
"noreply@github.com"
] | saurabhc24.noreply@github.com |
8af84a01d80c776522cf1031d8232f43427a9540 | 66bb3f65f0157a2b5475903c90a54d5173bc4f0a | /djthia/core/views.py | 702cc124bdbc259bc6fdc7f8295d8de0cd43d8fa | [
"MIT"
] | permissive | carthage-college/django-djthia | 691233049bcb05391fd82e390edb717f3bc0588a | 52401592291a980c7226c0573d415e7cdb8c20d3 | refs/heads/master | 2023-03-04T08:22:03.055448 | 2023-02-24T18:33:12 | 2023-02-24T18:33:12 | 249,989,382 | 0 | 0 | MIT | 2023-02-24T18:33:56 | 2020-03-25T13:43:24 | Python | UTF-8 | Python | false | false | 1,886 | py | # -*- coding: utf-8 -*-
import json
import requests
from datetime import datetime
from django.conf import settings
from django.core.cache import cache
from django.http import HttpResponse
from django.shortcuts import render
from django.urls import reverse_lazy
from django.utils.safestring import mark_safe
from django.views.decorators.csrf import csrf_exempt
from djauth.decorators import portal_auth_required
from djthia.core.decorators import eligibility
@portal_auth_required(
session_var='DJTHIA_AUTH',
redirect_url=reverse_lazy('access_denied'),
)
@eligibility
def home(request):
"""Application home."""
return render(request, 'home.html', {'year': datetime.now().year})
@csrf_exempt
@portal_auth_required(
session_var='DJTHIA_AUTH',
redirect_url=reverse_lazy('access_denied'),
)
def clear_cache(request, ctype='blurbs'):
"""Clear the cache for API content."""
cid = request.POST.get('cid')
request_type = 'post'
if not cid:
cid = request.GET.get('cid')
request_type = 'get'
if cid:
key = 'livewhale_{0}_{1}'.format(ctype, cid)
cache.delete(key)
timestamp = datetime.timestamp(datetime.now())
earl = '{0}/live/{1}/{2}@JSON?cache={3}'.format(
settings.LIVEWHALE_API_URL, ctype, cid, timestamp,
)
try:
response = requests.get(earl, headers={'Cache-Control': 'no-cache'})
text = json.loads(response.text)
cache.set(key, text)
api_data = mark_safe(text['body'])
except ValueError:
api_data = "Cache was not cleared."
if request_type == 'post':
content_type = 'text/plain; charset=utf-8'
else:
content_type = 'text/html; charset=utf-8'
else:
api_data = "Requires a content ID"
return HttpResponse(api_data, content_type=content_type)
| [
"plungerman@gmail.com"
] | plungerman@gmail.com |
8b0694bbd0567276a741b8362253e858aa967ba9 | 5b41ca66248cbbfd65f4eec920b8e6b23c4ba64d | /messagebox.py | fca82a8015ad086c1b45f71981d99f410bdb3e97 | [] | no_license | jejaksaid/python-gui | 2bcfd4b9b555a1e684961cee6868f209d78cc4e9 | f59a0e10951c33a866bbd7a7fb75d86e10abcf53 | refs/heads/master | 2022-12-17T06:34:17.342632 | 2020-09-26T12:07:07 | 2020-09-26T12:07:07 | 281,889,510 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,265 | py | import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
#Create a window with a button. If you click the button, the dialog will popup.
def window():
app = QApplication(sys.argv)
win = QWidget()
button1 = QPushButton(win)
button1.setText("Show Dialog!")
button1.move(100,100)
button1.clicked.connect(showDialog)
win.setWindowTitle("Click Button")
win.show()
sys.exit(app.exec_())
'''A dialog is created with QMessageBox(). Don’t forget to import this from PyQt5.
Then use the methods setIcon(), setText(), setWindowTitle() to set the window decoration.
You can configure the dialogs buttons with setStandardButtons().'''
def showDialog():
msgBox = QMessageBox()
msgBox.setIcon(QMessageBox.Information)
msgBox.setText("Message box pop up window")
msgBox.setWindowTitle("QMessageBox Example")
msgBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
msgBox.buttonClicked.connect(msgButtonClick)
returnValue = msgBox.exec()
if returnValue == QMessageBox.Ok:
print('Ok Clicked')
def msgButtonClick(i):
print("Button clicked is:", i.text())
if __name__ == '__main__':
window()
| [
"noreply@github.com"
] | jejaksaid.noreply@github.com |
15964455a90498f40c1b5832baba1979f60603a1 | 487ce91881032c1de16e35ed8bc187d6034205f7 | /codes/CodeJamCrawler/16_0_3_neat/16_0_3_stanm_coin-jam.py | d03fbeb3caa801b73d052e9fa018ecc9ef309635 | [] | no_license | DaHuO/Supergraph | 9cd26d8c5a081803015d93cf5f2674009e92ef7e | c88059dc66297af577ad2b8afa4e0ac0ad622915 | refs/heads/master | 2021-06-14T16:07:52.405091 | 2016-08-21T13:39:13 | 2016-08-21T13:39:13 | 49,829,508 | 2 | 0 | null | 2021-03-19T21:55:46 | 2016-01-17T18:23:00 | Python | UTF-8 | Python | false | false | 945 | py | #! /usr/bin/python
import sys
def rinp():
one = input()
_ = input().split(' ')
N = int(_[0])
J = int(_[1])
return (N, J)
def get_binary(num):
return "{0:b}".format(num)
def in_base(stng, base):
return int(stng, base)
def get_div(x):
for d in range(2, x):
if d * d > x:
return 1
if x % d == 0:
return d
def check_num(x):
bnry = get_binary(x)
divs = []
for base in range(2, 11):
t = in_base(bnry, base)
div = get_div(t)
if div == 1:
return 0
divs.append(div)
print (bnry, " ".join([str(d) for d in divs]))
return 1
def main():
(N, J) = rinp()
start = 2 ** (N - 1) + 1
end = 2 ** N - 1
print ("Case #1:")
count = 0
for x in range(end, start, -2):
get_binary(x)
count += check_num(x)
if count == J:
break
if __name__ == '__main__':
main()
| [
"[dhuo@tcd.ie]"
] | [dhuo@tcd.ie] |
ad8896eded98ca8dd1abc0c510565e4fa348ab17 | 0481ecb46752eea02bbeedbf3ded92c8a6acdc18 | /httprunner_yaosansan/loader.py | 074eb4c8d28c8807ab0e0dee4263ceae0199942d | [] | no_license | whitexie/workwechat-interface | e5d2dae39c7b8569e60d461db09602c8fd273c81 | 145e431bd65351d9244ffa6e1e747809990004be | refs/heads/master | 2020-09-07T13:54:47.376186 | 2019-11-12T04:12:32 | 2019-11-12T04:12:32 | 220,801,763 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 258 | py | import yaml
def load_yaml(yaml_file_path):
"""
read yaml file
:param yaml_file_path: str
:return:
"""
with open(yaml_file_path, 'r') as f:
json_object = yaml.load(f.read(), Loader=yaml.FullLoader)
return json_object
| [
"shieber@163.com"
] | shieber@163.com |
49876f9f114cb015c6ec0352ca7ce0cdded1edee | 0393e64ac4ed8e3d745b31d44836b58571faaabb | /aefingar_forritun/daemi21-while.py | 62b274d4f84b333ad325bb3863b604122476a8e9 | [] | no_license | danielthorr18/forritun_git | c3647e1e6dd35cd55287bb2d51066d8ab55ea931 | b544371664a15dd0660aef83cdf474e506e1b412 | refs/heads/master | 2020-03-28T00:04:50.700712 | 2018-11-15T15:26:42 | 2018-11-15T15:26:42 | 147,368,645 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 197 | py | turns = int(input("Sláðu inn tölu: "))
counter = 0
while counter < turns:
pick = int(input("Sláðu inn tölu: "))
if pick % 2 == 1:
print("þú valdir", pick)
counter += 1 | [
"danielr18@ru.is"
] | danielr18@ru.is |
2271ce0fe39d71d42b7ce4efd6399e6568b37c17 | 165cf5ce4f80ca7037237f3abf59eeef68e3105e | /mkhufftbl.py | 3c301889a940a899069a6c4854abd1413420911d | [
"MIT"
] | permissive | ngtcp2/nghttp3 | 1eb043960397ec5bdd3f704d4ccc9b11613ec99c | dd5d9d55dcb13a1729b7ad1c8c30f8e5ad82c4df | refs/heads/main | 2023-08-31T03:23:38.565595 | 2023-08-30T09:58:04 | 2023-08-30T09:58:04 | 156,868,263 | 693 | 82 | MIT | 2023-08-30T09:55:36 | 2018-11-09T13:49:36 | C | UTF-8 | Python | false | false | 22,404 | py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This script reads Huffman Code table [1] and generates symbol table
# and decoding tables in C language. The resulting code is used in
# lib/nghttp3_qpack_huffman.h and lib/nghttp3_qpack_huffman_data.c
#
# [1] http://http2.github.io/http2-spec/compression.html
import re
import sys
import io
# From [1]
HUFFMAN_CODE_TABLE = """\
( 0) |11111111|11000 1ff8 [13]
( 1) |11111111|11111111|1011000 7fffd8 [23]
( 2) |11111111|11111111|11111110|0010 fffffe2 [28]
( 3) |11111111|11111111|11111110|0011 fffffe3 [28]
( 4) |11111111|11111111|11111110|0100 fffffe4 [28]
( 5) |11111111|11111111|11111110|0101 fffffe5 [28]
( 6) |11111111|11111111|11111110|0110 fffffe6 [28]
( 7) |11111111|11111111|11111110|0111 fffffe7 [28]
( 8) |11111111|11111111|11111110|1000 fffffe8 [28]
( 9) |11111111|11111111|11101010 ffffea [24]
( 10) |11111111|11111111|11111111|111100 3ffffffc [30]
( 11) |11111111|11111111|11111110|1001 fffffe9 [28]
( 12) |11111111|11111111|11111110|1010 fffffea [28]
( 13) |11111111|11111111|11111111|111101 3ffffffd [30]
( 14) |11111111|11111111|11111110|1011 fffffeb [28]
( 15) |11111111|11111111|11111110|1100 fffffec [28]
( 16) |11111111|11111111|11111110|1101 fffffed [28]
( 17) |11111111|11111111|11111110|1110 fffffee [28]
( 18) |11111111|11111111|11111110|1111 fffffef [28]
( 19) |11111111|11111111|11111111|0000 ffffff0 [28]
( 20) |11111111|11111111|11111111|0001 ffffff1 [28]
( 21) |11111111|11111111|11111111|0010 ffffff2 [28]
( 22) |11111111|11111111|11111111|111110 3ffffffe [30]
( 23) |11111111|11111111|11111111|0011 ffffff3 [28]
( 24) |11111111|11111111|11111111|0100 ffffff4 [28]
( 25) |11111111|11111111|11111111|0101 ffffff5 [28]
( 26) |11111111|11111111|11111111|0110 ffffff6 [28]
( 27) |11111111|11111111|11111111|0111 ffffff7 [28]
( 28) |11111111|11111111|11111111|1000 ffffff8 [28]
( 29) |11111111|11111111|11111111|1001 ffffff9 [28]
( 30) |11111111|11111111|11111111|1010 ffffffa [28]
( 31) |11111111|11111111|11111111|1011 ffffffb [28]
' ' ( 32) |010100 14 [ 6]
'!' ( 33) |11111110|00 3f8 [10]
'"' ( 34) |11111110|01 3f9 [10]
'#' ( 35) |11111111|1010 ffa [12]
'$' ( 36) |11111111|11001 1ff9 [13]
'%' ( 37) |010101 15 [ 6]
'&' ( 38) |11111000 f8 [ 8]
''' ( 39) |11111111|010 7fa [11]
'(' ( 40) |11111110|10 3fa [10]
')' ( 41) |11111110|11 3fb [10]
'*' ( 42) |11111001 f9 [ 8]
'+' ( 43) |11111111|011 7fb [11]
',' ( 44) |11111010 fa [ 8]
'-' ( 45) |010110 16 [ 6]
'.' ( 46) |010111 17 [ 6]
'/' ( 47) |011000 18 [ 6]
'0' ( 48) |00000 0 [ 5]
'1' ( 49) |00001 1 [ 5]
'2' ( 50) |00010 2 [ 5]
'3' ( 51) |011001 19 [ 6]
'4' ( 52) |011010 1a [ 6]
'5' ( 53) |011011 1b [ 6]
'6' ( 54) |011100 1c [ 6]
'7' ( 55) |011101 1d [ 6]
'8' ( 56) |011110 1e [ 6]
'9' ( 57) |011111 1f [ 6]
':' ( 58) |1011100 5c [ 7]
';' ( 59) |11111011 fb [ 8]
'<' ( 60) |11111111|1111100 7ffc [15]
'=' ( 61) |100000 20 [ 6]
'>' ( 62) |11111111|1011 ffb [12]
'?' ( 63) |11111111|00 3fc [10]
'@' ( 64) |11111111|11010 1ffa [13]
'A' ( 65) |100001 21 [ 6]
'B' ( 66) |1011101 5d [ 7]
'C' ( 67) |1011110 5e [ 7]
'D' ( 68) |1011111 5f [ 7]
'E' ( 69) |1100000 60 [ 7]
'F' ( 70) |1100001 61 [ 7]
'G' ( 71) |1100010 62 [ 7]
'H' ( 72) |1100011 63 [ 7]
'I' ( 73) |1100100 64 [ 7]
'J' ( 74) |1100101 65 [ 7]
'K' ( 75) |1100110 66 [ 7]
'L' ( 76) |1100111 67 [ 7]
'M' ( 77) |1101000 68 [ 7]
'N' ( 78) |1101001 69 [ 7]
'O' ( 79) |1101010 6a [ 7]
'P' ( 80) |1101011 6b [ 7]
'Q' ( 81) |1101100 6c [ 7]
'R' ( 82) |1101101 6d [ 7]
'S' ( 83) |1101110 6e [ 7]
'T' ( 84) |1101111 6f [ 7]
'U' ( 85) |1110000 70 [ 7]
'V' ( 86) |1110001 71 [ 7]
'W' ( 87) |1110010 72 [ 7]
'X' ( 88) |11111100 fc [ 8]
'Y' ( 89) |1110011 73 [ 7]
'Z' ( 90) |11111101 fd [ 8]
'[' ( 91) |11111111|11011 1ffb [13]
'\' ( 92) |11111111|11111110|000 7fff0 [19]
']' ( 93) |11111111|11100 1ffc [13]
'^' ( 94) |11111111|111100 3ffc [14]
'_' ( 95) |100010 22 [ 6]
'`' ( 96) |11111111|1111101 7ffd [15]
'a' ( 97) |00011 3 [ 5]
'b' ( 98) |100011 23 [ 6]
'c' ( 99) |00100 4 [ 5]
'd' (100) |100100 24 [ 6]
'e' (101) |00101 5 [ 5]
'f' (102) |100101 25 [ 6]
'g' (103) |100110 26 [ 6]
'h' (104) |100111 27 [ 6]
'i' (105) |00110 6 [ 5]
'j' (106) |1110100 74 [ 7]
'k' (107) |1110101 75 [ 7]
'l' (108) |101000 28 [ 6]
'm' (109) |101001 29 [ 6]
'n' (110) |101010 2a [ 6]
'o' (111) |00111 7 [ 5]
'p' (112) |101011 2b [ 6]
'q' (113) |1110110 76 [ 7]
'r' (114) |101100 2c [ 6]
's' (115) |01000 8 [ 5]
't' (116) |01001 9 [ 5]
'u' (117) |101101 2d [ 6]
'v' (118) |1110111 77 [ 7]
'w' (119) |1111000 78 [ 7]
'x' (120) |1111001 79 [ 7]
'y' (121) |1111010 7a [ 7]
'z' (122) |1111011 7b [ 7]
'{' (123) |11111111|1111110 7ffe [15]
'|' (124) |11111111|100 7fc [11]
'}' (125) |11111111|111101 3ffd [14]
'~' (126) |11111111|11101 1ffd [13]
(127) |11111111|11111111|11111111|1100 ffffffc [28]
(128) |11111111|11111110|0110 fffe6 [20]
(129) |11111111|11111111|010010 3fffd2 [22]
(130) |11111111|11111110|0111 fffe7 [20]
(131) |11111111|11111110|1000 fffe8 [20]
(132) |11111111|11111111|010011 3fffd3 [22]
(133) |11111111|11111111|010100 3fffd4 [22]
(134) |11111111|11111111|010101 3fffd5 [22]
(135) |11111111|11111111|1011001 7fffd9 [23]
(136) |11111111|11111111|010110 3fffd6 [22]
(137) |11111111|11111111|1011010 7fffda [23]
(138) |11111111|11111111|1011011 7fffdb [23]
(139) |11111111|11111111|1011100 7fffdc [23]
(140) |11111111|11111111|1011101 7fffdd [23]
(141) |11111111|11111111|1011110 7fffde [23]
(142) |11111111|11111111|11101011 ffffeb [24]
(143) |11111111|11111111|1011111 7fffdf [23]
(144) |11111111|11111111|11101100 ffffec [24]
(145) |11111111|11111111|11101101 ffffed [24]
(146) |11111111|11111111|010111 3fffd7 [22]
(147) |11111111|11111111|1100000 7fffe0 [23]
(148) |11111111|11111111|11101110 ffffee [24]
(149) |11111111|11111111|1100001 7fffe1 [23]
(150) |11111111|11111111|1100010 7fffe2 [23]
(151) |11111111|11111111|1100011 7fffe3 [23]
(152) |11111111|11111111|1100100 7fffe4 [23]
(153) |11111111|11111110|11100 1fffdc [21]
(154) |11111111|11111111|011000 3fffd8 [22]
(155) |11111111|11111111|1100101 7fffe5 [23]
(156) |11111111|11111111|011001 3fffd9 [22]
(157) |11111111|11111111|1100110 7fffe6 [23]
(158) |11111111|11111111|1100111 7fffe7 [23]
(159) |11111111|11111111|11101111 ffffef [24]
(160) |11111111|11111111|011010 3fffda [22]
(161) |11111111|11111110|11101 1fffdd [21]
(162) |11111111|11111110|1001 fffe9 [20]
(163) |11111111|11111111|011011 3fffdb [22]
(164) |11111111|11111111|011100 3fffdc [22]
(165) |11111111|11111111|1101000 7fffe8 [23]
(166) |11111111|11111111|1101001 7fffe9 [23]
(167) |11111111|11111110|11110 1fffde [21]
(168) |11111111|11111111|1101010 7fffea [23]
(169) |11111111|11111111|011101 3fffdd [22]
(170) |11111111|11111111|011110 3fffde [22]
(171) |11111111|11111111|11110000 fffff0 [24]
(172) |11111111|11111110|11111 1fffdf [21]
(173) |11111111|11111111|011111 3fffdf [22]
(174) |11111111|11111111|1101011 7fffeb [23]
(175) |11111111|11111111|1101100 7fffec [23]
(176) |11111111|11111111|00000 1fffe0 [21]
(177) |11111111|11111111|00001 1fffe1 [21]
(178) |11111111|11111111|100000 3fffe0 [22]
(179) |11111111|11111111|00010 1fffe2 [21]
(180) |11111111|11111111|1101101 7fffed [23]
(181) |11111111|11111111|100001 3fffe1 [22]
(182) |11111111|11111111|1101110 7fffee [23]
(183) |11111111|11111111|1101111 7fffef [23]
(184) |11111111|11111110|1010 fffea [20]
(185) |11111111|11111111|100010 3fffe2 [22]
(186) |11111111|11111111|100011 3fffe3 [22]
(187) |11111111|11111111|100100 3fffe4 [22]
(188) |11111111|11111111|1110000 7ffff0 [23]
(189) |11111111|11111111|100101 3fffe5 [22]
(190) |11111111|11111111|100110 3fffe6 [22]
(191) |11111111|11111111|1110001 7ffff1 [23]
(192) |11111111|11111111|11111000|00 3ffffe0 [26]
(193) |11111111|11111111|11111000|01 3ffffe1 [26]
(194) |11111111|11111110|1011 fffeb [20]
(195) |11111111|11111110|001 7fff1 [19]
(196) |11111111|11111111|100111 3fffe7 [22]
(197) |11111111|11111111|1110010 7ffff2 [23]
(198) |11111111|11111111|101000 3fffe8 [22]
(199) |11111111|11111111|11110110|0 1ffffec [25]
(200) |11111111|11111111|11111000|10 3ffffe2 [26]
(201) |11111111|11111111|11111000|11 3ffffe3 [26]
(202) |11111111|11111111|11111001|00 3ffffe4 [26]
(203) |11111111|11111111|11111011|110 7ffffde [27]
(204) |11111111|11111111|11111011|111 7ffffdf [27]
(205) |11111111|11111111|11111001|01 3ffffe5 [26]
(206) |11111111|11111111|11110001 fffff1 [24]
(207) |11111111|11111111|11110110|1 1ffffed [25]
(208) |11111111|11111110|010 7fff2 [19]
(209) |11111111|11111111|00011 1fffe3 [21]
(210) |11111111|11111111|11111001|10 3ffffe6 [26]
(211) |11111111|11111111|11111100|000 7ffffe0 [27]
(212) |11111111|11111111|11111100|001 7ffffe1 [27]
(213) |11111111|11111111|11111001|11 3ffffe7 [26]
(214) |11111111|11111111|11111100|010 7ffffe2 [27]
(215) |11111111|11111111|11110010 fffff2 [24]
(216) |11111111|11111111|00100 1fffe4 [21]
(217) |11111111|11111111|00101 1fffe5 [21]
(218) |11111111|11111111|11111010|00 3ffffe8 [26]
(219) |11111111|11111111|11111010|01 3ffffe9 [26]
(220) |11111111|11111111|11111111|1101 ffffffd [28]
(221) |11111111|11111111|11111100|011 7ffffe3 [27]
(222) |11111111|11111111|11111100|100 7ffffe4 [27]
(223) |11111111|11111111|11111100|101 7ffffe5 [27]
(224) |11111111|11111110|1100 fffec [20]
(225) |11111111|11111111|11110011 fffff3 [24]
(226) |11111111|11111110|1101 fffed [20]
(227) |11111111|11111111|00110 1fffe6 [21]
(228) |11111111|11111111|101001 3fffe9 [22]
(229) |11111111|11111111|00111 1fffe7 [21]
(230) |11111111|11111111|01000 1fffe8 [21]
(231) |11111111|11111111|1110011 7ffff3 [23]
(232) |11111111|11111111|101010 3fffea [22]
(233) |11111111|11111111|101011 3fffeb [22]
(234) |11111111|11111111|11110111|0 1ffffee [25]
(235) |11111111|11111111|11110111|1 1ffffef [25]
(236) |11111111|11111111|11110100 fffff4 [24]
(237) |11111111|11111111|11110101 fffff5 [24]
(238) |11111111|11111111|11111010|10 3ffffea [26]
(239) |11111111|11111111|1110100 7ffff4 [23]
(240) |11111111|11111111|11111010|11 3ffffeb [26]
(241) |11111111|11111111|11111100|110 7ffffe6 [27]
(242) |11111111|11111111|11111011|00 3ffffec [26]
(243) |11111111|11111111|11111011|01 3ffffed [26]
(244) |11111111|11111111|11111100|111 7ffffe7 [27]
(245) |11111111|11111111|11111101|000 7ffffe8 [27]
(246) |11111111|11111111|11111101|001 7ffffe9 [27]
(247) |11111111|11111111|11111101|010 7ffffea [27]
(248) |11111111|11111111|11111101|011 7ffffeb [27]
(249) |11111111|11111111|11111111|1110 ffffffe [28]
(250) |11111111|11111111|11111101|100 7ffffec [27]
(251) |11111111|11111111|11111101|101 7ffffed [27]
(252) |11111111|11111111|11111101|110 7ffffee [27]
(253) |11111111|11111111|11111101|111 7ffffef [27]
(254) |11111111|11111111|11111110|000 7fffff0 [27]
(255) |11111111|11111111|11111011|10 3ffffee [26]
EOS (256) |11111111|11111111|11111111|111111 3fffffff [30]
"""
class Node:
def __init__(self, term = None):
self.term = term
self.left = None
self.right = None
self.trans = []
self.id = None
self.accept = False
class Context:
def __init__(self):
self.next_id_ = 0
self.root = Node()
def next_id(self):
id = self.next_id_
self.next_id_ += 1
return id
def _add(node, sym, bits):
if len(bits) == 0:
node.term = sym
return
else:
if bits[0] == '0':
if node.left is None:
node.left = Node()
child = node.left
else:
if node.right is None:
node.right = Node()
child = node.right
_add(child, sym, bits[1:])
def huffman_tree_add(ctx, sym, bits):
_add(ctx.root, sym, bits)
def _set_node_id(ctx, node, prefix):
if node.term is not None:
return
if len(prefix) <= 7 and [1] * len(prefix) == prefix:
node.accept = True
node.id = ctx.next_id()
_set_node_id(ctx, node.left, prefix + [0])
_set_node_id(ctx, node.right, prefix + [1])
def huffman_tree_set_node_id(ctx):
_set_node_id(ctx, ctx.root, [])
def _traverse(node, sym, start_node, root, left):
if left == 0:
if sym == 256:
sym = None
node = None
start_node.trans.append((node, sym))
return
if node.term is not None:
node = root
def go(node):
if node.term is not None:
assert sym is None
nsym = node.term
else:
nsym = sym
_traverse(node, nsym, start_node, root, left - 1)
go(node.left)
go(node.right)
def _build_transition_table(ctx, node):
if node is None:
return
_traverse(node, None, node, ctx.root, 4)
_build_transition_table(ctx, node.left)
_build_transition_table(ctx, node.right)
def huffman_tree_build_transition_table(ctx):
_build_transition_table(ctx, ctx.root)
NGHTTP3_QPACK_HUFFMAN_ACCEPTED = 1 << 14
NGHTTP3_QPACK_HUFFMAN_SYM = 1 << 15
def _print_transition_table(node):
if node.term is not None:
return
print('/* {} */'.format(node.id))
print('{')
for nd, sym in node.trans:
flags = 0
if sym is None:
out = 0
else:
out = sym
flags |= NGHTTP3_QPACK_HUFFMAN_SYM
if nd is None:
id = 256
else:
id = nd.id
if id is None:
# if nd.id is None, it is a leaf node
id = 0
flags |= NGHTTP3_QPACK_HUFFMAN_ACCEPTED
elif nd.accept:
flags |= NGHTTP3_QPACK_HUFFMAN_ACCEPTED
print(' {{0x{:02x}, {}}},'.format(id | flags, out))
print('},')
_print_transition_table(node.left)
_print_transition_table(node.right)
def huffman_tree_print_transition_table(ctx):
_print_transition_table(ctx.root)
print('/* 256 */')
print('{')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print(' {0x100, 0},')
print('},')
if __name__ == '__main__':
ctx = Context()
symbol_tbl = [(None, 0) for i in range(257)]
for line in io.StringIO(HUFFMAN_CODE_TABLE):
m = re.match(
r'.*\(\s*(\d+)\)\s+([|01]+)\s+(\S+)\s+\[\s*(\d+)\].*', line)
if m:
sym = int(m.group(1))
bits = re.sub(r'\|', '', m.group(2))
code = m.group(3)
nbits = int(m.group(4))
if len(code) > 8:
raise Error('Code is more than 4 bytes long')
assert(len(bits) == nbits)
symbol_tbl[sym] = (nbits, code)
huffman_tree_add(ctx, sym, bits)
huffman_tree_set_node_id(ctx)
huffman_tree_build_transition_table(ctx)
print('''\
typedef struct {
uint32_t nbits;
uint32_t code;
} nghttp3_qpack_huffman_sym;
''')
print('''\
const nghttp3_qpack_huffman_sym huffman_sym_table[] = {''')
for i in range(257):
nbits = symbol_tbl[i][0]
k = int(symbol_tbl[i][1], 16)
k = k << (32 - nbits)
print('''\
{{ {}, 0x{}u }}{}\
'''.format(symbol_tbl[i][0], hex(k)[2:], ',' if i < 256 else ''))
print('};')
print('')
print('''\
enum {{
NGHTTP3_QPACK_HUFFMAN_ACCEPTED = {},
NGHTTP3_QPACK_HUFFMAN_SYM = {},
}} nghttp3_qpack_huffman_decode_flag;
'''.format(NGHTTP3_QPACK_HUFFMAN_ACCEPTED, NGHTTP3_QPACK_HUFFMAN_SYM))
print('''\
typedef struct {
uint16_t fstate;
uint8_t sym;
} nghttp3_qpack_huffman_decode_node;
''')
print('''\
const nghttp3_qpack_huffman_decode_node qpack_huffman_decode_table[][16] = {''')
huffman_tree_print_transition_table(ctx)
print('};')
| [
"tatsuhiro.t@gmail.com"
] | tatsuhiro.t@gmail.com |
4f7d45874caf756b4c49443237a554b3a6d6fa09 | 305eb0000d98d01ac804d50d2f7ec145006f43bf | /agent/bot.py | 14c35fd9059bedf6993aab69ab499b326ab028dc | [
"MIT"
] | permissive | latticetower/dr-derks-mutants | e72109f873118cd2c6323fb15d5780bcc41b679e | 5c3ab86137ecb478a3013985172d160568a86b13 | refs/heads/main | 2023-03-03T00:58:31.167240 | 2021-02-04T04:28:35 | 2021-02-04T04:40:22 | 334,600,980 | 1 | 1 | null | null | null | null | UTF-8 | Python | false | false | 85 | py | import numpy as np
from agent.dqn_bot import DerkPlayer # change this if necessary
| [
"merlettaia@gmail.com"
] | merlettaia@gmail.com |
386a61ea077f264cdd7a36d12cd3aebae50c463d | 305585c6e2e2f9d69603f728f8ac1dd38d12e63b | /plot.py | 4c3271781150d2fdf7fffb86226e9e9bdab11755 | [] | no_license | yingted/scribbler-commander | 87d01e91426a2e2a7f20f8519922f3571d0710f3 | 5072feb6b8bc3126c92fedf2297ef6be72301376 | refs/heads/master | 2021-01-19T15:02:59.844424 | 2013-11-30T00:00:25 | 2013-11-30T00:00:25 | 32,125,465 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 693 | py | from pickle import load
from matplotlib.pyplot import *
from sys import argv
from itertools import cycle
from model import Prior
with open(argv[1])as f:
fig=figure()
ax=fig.add_subplot(111)
#clr=iter(cycle('bgrcmykw'))
clr=iter(cycle('bgrcmyk'))
for ent in sorted(load(f),key=lambda x:x['irp']):
start=ent['data'][0]['t']*1.5-.5*ent['data'][1]['t']
t=[]
v=[]
for sample in ent['data']:
t.append(sample['t']-start)
v.append(sample['v'])
ax.scatter(t,v,c=next(clr),marker='x')
if len(argv)>2:
with open(argv[2])as f:
clr=iter(cycle('bgrcmyk'))
for irp,ent in sorted(load(f).items()):
ax.errorbar(Prior._times,ent['mu'],yerr=ent['sigma'],fmt='-o',c=next(clr))
show()
| [
"yingted@gmail.com@2a0f7078-9aa0-a7c8-291c-ce4e4205d19b"
] | yingted@gmail.com@2a0f7078-9aa0-a7c8-291c-ce4e4205d19b |
fd56c339b78756507aae6c9ee5d01037b3f502bb | ba46763cf8ecd8eb22b8e6033ed68b5a5b2f2395 | /cross-section/read_XSfb_from_data.py | 45fad680282e2669183648f263787d8463aba17e | [] | no_license | kazuki-sakurai/LHC_recast | 92c224f8e27d646675f0faf6d768dded026d88ef | 66bac802d0fe15312177d4143e85758e12212425 | refs/heads/master | 2021-01-09T05:50:26.708261 | 2017-11-17T16:29:56 | 2017-11-17T16:29:56 | 80,840,370 | 2 | 1 | null | 2019-03-14T14:32:18 | 2017-02-03T15:14:29 | Python | UTF-8 | Python | false | false | 1,906 | py | #!/usr/bin/env python
import sys, os
import numpy as np
from scipy import interpolate
def get_xsfb(infile, m_in, unit):
if unit == 'pb': fac = 1000.
if unit == 'fb': fac = 1.
dirname = os.path.dirname(__file__)
infile_path = os.path.join(dirname, infile)
data = np.loadtxt(infile_path)
try:
mass_ar, xspb_ar = np.transpose(data)
except:
mass_ar, xspb_ar, dummy = np.transpose(data)
xspb_data = interpolate.interp1d(mass_ar, xspb_ar)
xspb = xspb_data(m_in)
xsfb = xspb * fac
return xsfb
try:
mode = sys.argv[1]
m_in = float(sys.argv[2])
rs = int(sys.argv[3])
br = float(sys.argv[4])
except:
print '[mode] [mass] [energy] [BR]'
if mode in ['QqN1']: mode = 'QQ4F'
if mode in ['GqqN1', 'GttN1', 'GbbN1', 'GqqN2lLlN1', 'GqqC1wN1', 'GqqC1wN2zN1']: mode = 'GG'
if mode in ['C1lLlN1_C1lLlN1', 'C1lL3lN1_C1lL3lN1']: mode = 'C1C1wino'
if mode in ['C1lLlN1_N2lLlN1', 'C1lL3lN1_N2lL3lN1', 'C1whadN1_N2zlepN1', 'C1wlepN1_N2zlepN1']: mode = 'C1N2wino'
if mode in ['B1tC1wN1', 'B1bN1', 'T1bC1wN1']: mode = 'Q3Q3'
GG_file = 'GGxsec{rs}.dat'.format(rs=rs)
QQ5F_file = 'QQxsec{rs}_5F.dat'.format(rs=rs)
Q3Q3_file = 'Q3Q3xsec{rs}.dat'.format(rs=rs)
C1C1_file = 'C1C1wino{rs}.dat'.format(rs=rs)
C1N2_file = 'C1N2wino{rs}.dat'.format(rs=rs)
if mode == 'GG':
print get_xsfb(GG_file, m_in, 'pb') * br
exit()
if mode == 'QQ5F':
print get_xsfb(QQ5F_file, m_in, 'pb') * br
exit()
if mode == 'Q3Q3':
print get_xsfb(Q3Q3_file, m_in, 'pb') * br
exit()
if mode == 'QQ4F':
QQ5F = get_xsfb(QQ5F_file, m_in, 'pb')
BLBL = BRBR = get_xsfb(Q3Q3_file, m_in, 'pb')
QQ4F = QQ5F - BLBL - BRBR
print QQ4F * br
exit()
if mode == 'C1C1wino':
print get_xsfb(C1C1_file, m_in, 'fb') * br
exit()
if mode == 'C1N2wino':
print get_xsfb(C1N2_file, m_in, 'fb') * br
exit()
| [
"kazuki.sakurai.1225@gmail.com"
] | kazuki.sakurai.1225@gmail.com |
aa589907e356abf2a7b24506f773b839094ef43d | 3a89ee8d30e3df1270482b5dcb2df3e1da60281e | /ember/pssa/model.py | c69715dbde091c09c94bdf1eef1f6ea296e832d2 | [] | no_license | whigg/ember | 71968322cff2ea6e017b3433f8b9cca80bd3f1d5 | d4a6e04b29ab7de7bbce431282b68aa21397351a | refs/heads/master | 2023-01-05T04:13:51.048735 | 2020-11-03T03:30:58 | 2020-11-03T03:36:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 14,294 | py | import random
from collections import deque, defaultdict
from functools import lru_cache
from itertools import combinations
import dwave_networkx as dnx
from networkx import Graph
from ember.hardware.chimera import ChimeraGraph
from ember.hardware.transform import overlap_clique, double_triangle_clique
from ember.hardware.transform_helper import divide_guiding_pattern
from ember.pssa.graph import MutableGraph
__all__ = ["ProbabilisticSwapShiftModel", "CliqueOverlapModel"]
class BaseModel:
def __init__(self, guest: Graph, host: ChimeraGraph):
if host.faulty_nodes or host.faulty_edges:
raise NotImplementedError(
"Chimera graphs with faults are not supported by these algorithms")
self.guest = guest
self.host = host
m, l = host.params
dnx_coords = dnx.chimera_coordinates(m, t=l)
self.linear_to_chimera = dnx_coords.linear_to_chimera
self.chimera_to_linear = dnx_coords.chimera_to_linear
self.forward_embed = None
def _chimera_distance(self, g1: int, g2: int):
if g1 == g2:
return 0
(i1, j1, u1, k1) = self.linear_to_chimera(g1)
(i2, j2, u2, k2) = self.linear_to_chimera(g2)
dist = abs(i1 - i2) + abs(j1 - j2)
dist += 2 if u1 == u2 else 1
if u1 == 0 and u2 == 0 and (j1 - j2) == 0 and k1 == k2:
dist -= 2
if u1 == 1 and u2 == 1 and (i1 - i2) == 0 and k1 == k2:
dist -= 2
return dist
def _create_contact_graph(self, embed):
self.contact_graph = MutableGraph(self.guest, include_edges=False)
self.initial_cost = 0
for n1 in range(len(embed)):
e1 = embed[n1]
for n2 in range(n1):
e2 = embed[n2]
weight = 0
for g1 in e1:
for g2 in e2:
weight += 1 if self._chimera_distance(g1, g2) == 1 else 0
if weight > 0:
self.contact_graph.add_edge(n1, n2, weight)
self.initial_cost += 1 if self.guest.has_edge(n1, n2) else 0
def all_moves(self):
pass
def random_swap_move(self):
pass
def random_shift_move(self, *args):
pass
def delta_swap(self, swap_move):
pass
def swap(self, swap_move):
pass
def delta_shift(self, swap_move):
pass
def shift(self, swap_move):
pass
def randomize(self):
pass
class ProbabilisticSwapShiftModel(BaseModel):
"""
Simulated annealing model which finds an embedding by swapping chains or by shifting nodes
between chains. Uses pssa.hardware.transform.double_triangle_clique as a guiding pattern.
"""
def __init__(self, guest, host: ChimeraGraph):
"""
Initialize model with guest graph and host graph.
Args:
guest (nx.Graph): a guest instance
host (ChimeraGraph): Any Chimera host instance
"""
super().__init__(guest, host)
guiding_pattern = double_triangle_clique(host)
initial_emb = divide_guiding_pattern(guiding_pattern, len(guest))
self.forward_embed = [deque(initial_emb[i]) for i in range(len(initial_emb))]
self.inverse_embed = {l: k for k, ll in initial_emb.items() for l in ll}
self.inverse_guiding_pattern = \
{l: k for k, ll in guiding_pattern.items() for l in ll}
for i in range(len(host)):
if i not in self.inverse_embed:
self.inverse_embed[i] = -1
self._create_contact_graph(initial_emb)
def all_moves(self):
raise NotImplementedError()
def random_swap_move(self):
n1, n1_nb = random.choice(tuple(self.guest.edges))
n2 = random.choice(tuple(
self.contact_graph.nodes[n1_nb].neighbours)).val
return n1, n2
def random_shift_move(self, any_dir=False):
n_to = random.randrange(len(self.guest))
if len(self.forward_embed[n_to]) < 2:
return None
g_to = self.forward_embed[n_to][0] if random.getrandbits(1) == 0 \
else self.forward_embed[n_to][-1]
cand = []
for g_to_nb in iter(self.host[g_to]):
n_to_nb = self.inverse_embed[g_to_nb]
if n_to_nb == -1:
continue
if self.inverse_embed[g_to] == n_to_nb:
continue
if self.forward_embed[n_to_nb][0] != g_to_nb \
and self.forward_embed[n_to_nb][-1] != g_to_nb:
continue
if any_dir:
cand.append(g_to_nb)
elif self.inverse_guiding_pattern[g_to_nb] == \
self.inverse_guiding_pattern[g_to]:
cand.append(g_to_nb)
if len(cand) == 0:
return None
g_from = random.choice(cand)
return g_from, g_to
def delta_swap(self, swap_move):
n1, n2 = swap_move
delta = 0
for n1_nb in self.contact_graph.nodes[n1].neighbours:
if n2 == n1_nb.val:
continue
if self.guest.has_edge(n1, n1_nb.val):
delta -= 1
if self.guest.has_edge(n2, n1_nb.val):
delta += 1
for n2_nb in self.contact_graph.nodes[n2].neighbours:
if n1 == n2_nb.val:
continue
if self.guest.has_edge(n2, n2_nb.val):
delta -= 1
if self.guest.has_edge(n1, n2_nb.val):
delta += 1
return delta
def swap(self, swap_move):
n1, n2 = swap_move
for g1 in self.forward_embed[n1]:
self.inverse_embed[g1] = n2
for g2 in self.forward_embed[n2]:
self.inverse_embed[g2] = n1
self.forward_embed[n1], self.forward_embed[n2] = \
self.forward_embed[n2], self.forward_embed[n1]
self.contact_graph.swap_node(n1, n2)
def delta_shift(self, shift_move):
g_from, g_to = shift_move
n_from = self.inverse_embed[g_from]
n_to = self.inverse_embed[g_to]
n_nb_count = defaultdict(int)
delta = 0
# Consider neighbours of g_to, increment delta for new segments added to n_from
for g_to_nb in iter(self.host[g_to]):
n_to_nb = self.inverse_embed[g_to_nb]
if n_to_nb == -1:
continue
if n_to_nb == n_from or n_to_nb == n_to:
continue
if n_to_nb not in n_nb_count and not self.contact_graph.has_edge(n_from, n_to_nb) \
and self.guest.has_edge(n_from, n_to_nb):
delta += 1
n_nb_count[n_to_nb] += 1
# If g_to is in all edges connecting n_to to n_to_nb then decrement delta
for n_to_nb, count in n_nb_count.items():
assert self.contact_graph.edge_weight(n_to_nb, n_to) >= count # Debug
if self.contact_graph.edge_weight(n_to_nb, n_to) == count \
and self.guest.has_edge(n_to_nb, n_to):
delta -= 1
return delta
def shift(self, shift_move):
g_from, g_to = shift_move
n_from = self.inverse_embed[g_from]
n_to = self.inverse_embed[g_to]
# Update forward embed
if self.forward_embed[n_from][-1] == g_from:
self.forward_embed[n_from].append(g_to)
else:
self.forward_embed[n_from].appendleft(g_to)
if self.forward_embed[n_to][-1] == g_to:
self.forward_embed[n_to].pop()
else:
self.forward_embed[n_to].popleft()
# Update inverse embed
self.inverse_embed[g_to] = n_from
# Update contact hardware
for g_to_nb in iter(self.host[g_to]):
n_to_nb = self.inverse_embed[g_to_nb]
if n_to_nb == -1:
continue
if n_to_nb == n_from:
self.contact_graph.decrement_edge_weight(n_from, n_to)
elif n_to_nb == n_to:
self.contact_graph.increment_edge_weight(n_from, n_to)
else:
self.contact_graph.increment_edge_weight(n_from, n_to_nb)
self.contact_graph.decrement_edge_weight(n_to, n_to_nb)
class CliqueOverlapModel(BaseModel):
"""
Simulated annealing model which finds an embedding by swapping chains or by conversion between
I-shaped chains, L-shaped chains and T-Shaped chains. Uses pssa.hardware.transform.overlap_clique
as a guiding pattern.
"""
def __init__(self, guest, host: ChimeraGraph):
"""
Initialize model with guest graph and host graph.
Args:
guest (nx.Graph): a guest instance
host (ChimeraGraph): Any Chimera host instance
"""
super().__init__(guest, host)
initial_embed = overlap_clique(host)
self.forward_embed = [set(initial_embed[i]) for i in range(len(guest))]
self.inverse_embed = {n: i for i in range(len(guest)) for n in initial_embed[i]}
self._create_contact_graph(self.forward_embed)
def randomize(self):
random.shuffle(self.forward_embed)
self.inverse_embed = \
{n: i for i in range(len(self.guest)) for n in self.forward_embed[i]}
self._create_contact_graph(self.forward_embed)
@lru_cache
def all_moves(self):
m, l = self.host.params
swaps = list(combinations(range(len(self.guest)), 2))
shifts = list(range(len(self.guest) - m * l))
return swaps, shifts
def random_swap_move(self):
n1, n1_nb = random.choice(tuple(self.guest.edges))
n2 = random.choice(tuple(
self.contact_graph.nodes[n1_nb].neighbours)).val
return n1, n2
def random_shift_move(self, *args):
m, l = self.host.params
z_idx = random.randint(0, len(self.guest) - m * l - 1)
return z_idx
def delta_swap(self, swap_move):
n1, n2 = swap_move
delta = 0
for n1_nb in self.contact_graph.nodes[n1].neighbours:
if n2 == n1_nb.val:
continue
if self.guest.has_edge(n1, n1_nb.val):
delta -= 1
if self.guest.has_edge(n2, n1_nb.val):
delta += 1
for n2_nb in self.contact_graph.nodes[n2].neighbours:
if n1 == n2_nb.val:
continue
if self.guest.has_edge(n2, n2_nb.val):
delta -= 1
if self.guest.has_edge(n1, n2_nb.val):
delta += 1
return delta
def swap(self, swap_move):
n1, n2 = swap_move
for g1 in self.forward_embed[n1]:
self.inverse_embed[g1] = n2
for g2 in self.forward_embed[n2]:
self.inverse_embed[g2] = n1
self.forward_embed[n1], self.forward_embed[n2] = \
self.forward_embed[n2], self.forward_embed[n1]
self.contact_graph.swap_node(n1, n2)
def delta_shift(self, shift_move):
delta = 0
n_minor, n_major, n_overlap = self._get_overlap_state(shift_move)
# check ownership status
if n_overlap == n_major: # major loss, minor gain
for n_nb in self._get_n_minors(shift_move):
if n_nb == n_minor:
continue
if self.guest.has_edge(n_major, n_nb):
delta -= 1
if self.guest.has_edge(n_minor, n_nb) \
and not self.contact_graph.has_edge(n_minor, n_nb):
delta += 1
elif n_overlap == n_minor: # major gain, minor loss
for n_nb in self._get_n_minors(shift_move):
if n_nb == n_minor:
continue
if self.guest.has_edge(n_minor, n_nb) \
and self.contact_graph.edge_weight(n_minor, n_nb) == 1:
delta -= 1
if self.guest.has_edge(n_major, n_nb):
delta += 1
else:
raise Exception("Bad state")
return delta
def shift(self, shift_move):
n_minor, n_major, n_overlap = self._get_overlap_state(shift_move)
if n_overlap == n_major: # major loss, minor gain
for g_nb in self._get_g_minors(shift_move):
self.forward_embed[n_major].remove(g_nb)
self.forward_embed[n_minor].add(g_nb)
self.inverse_embed[g_nb] = n_minor
for n_nb in self._get_n_minors(shift_move):
if n_nb == n_minor:
continue
self.contact_graph.decrement_edge_weight(n_major, n_nb)
self.contact_graph.increment_edge_weight(n_minor, n_nb)
elif n_overlap == n_minor: # major gain, minor loss
for g_nb in self._get_g_minors(shift_move):
self.forward_embed[n_major].add(g_nb)
self.forward_embed[n_minor].remove(g_nb)
self.inverse_embed[g_nb] = n_major
for n_nb in self._get_n_minors(shift_move):
if n_nb == n_minor:
continue
self.contact_graph.increment_edge_weight(n_major, n_nb)
self.contact_graph.decrement_edge_weight(n_minor, n_nb)
else:
raise Exception("Bad state")
def _get_g_minors(self, z_idx):
cell, unit = z_idx // 4, z_idx % 4
try:
for c in range(cell + 1):
yield self.chimera_to_linear((1 + cell, c, 1, unit))
except KeyError:
pass
def _get_n_minors(self, z_idx):
cell = z_idx // 4
_, l = self.host.params
try:
for c in range(cell + 1):
for u in range(l):
yield self.inverse_embed[
self.chimera_to_linear((1 + cell, c, 0, u))]
except KeyError:
pass
def _get_overlap_state(self, z_idx):
cell, unit = z_idx // 4, z_idx % 4
m, _ = self.host.params
# minor, major, overlap
return self.inverse_embed[self.chimera_to_linear((1 + cell, cell, 0, unit))], \
self.inverse_embed[self.chimera_to_linear((1 + cell, m - 1, 1, unit))], \
self.inverse_embed[self.chimera_to_linear((1 + cell, cell, 1, unit))]
| [
"ipwnu777@gmail.com"
] | ipwnu777@gmail.com |
cbf2636b58eb80307527d3264435f464bf9c787e | aa2c403a5f333857217685c03e9ca950c315ccc1 | /egs/voxceleb/multitask/nnet/lib/finetune.py | 600edf7d901a7c1a538289d067e3d6b02bdc37d6 | [
"Apache-2.0"
] | permissive | entn-at/tf-kaldi-speaker-master | 5db8984c4bc86d1b3112586c377f926fa9dd3134 | 8392af04cbaee3fb3dd87329ad4b60d710f45d9f | refs/heads/master | 2020-12-06T10:48:41.272114 | 2020-06-30T09:09:25 | 2020-06-30T09:09:25 | 232,444,778 | 0 | 0 | Apache-2.0 | 2020-01-08T00:38:44 | 2020-01-08T00:38:44 | null | UTF-8 | Python | false | false | 9,145 | py | # Fine-tune a pre-trained model to a new model.
# Optimize the entire network after loading the pre-trained model.
# This require that there is no new parameter introduced in the model.
# This is appropriate to train an End-to-end triplet loss (or other) network from a softmax pre-trained network where
# no additional layer is involved.
# If a new softmax layer is added to the pre-trained layer, it is better to train the new softmax first and
# then update the entire network.
import os
import argparse
import random
import sys
import tensorflow as tf
import numpy as np
from misc.utils import get_pretrain_model, load_lr
from misc.utils import ValidLoss, save_codes_and_config, compute_cos_pairwise_eer, load_valid_loss
from model.trainer import Trainer
from dataset.data_loader import KaldiDataRandomQueue
from dataset.kaldi_io import FeatureReader
from six.moves import range
# We don't need to use a `continue` option here, because if we want to resume training, we should simply use train.py.
# In the beginning of finetuning, we want to restore a part of the model rather than the entire graph.
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--cont", action="store_true", help="Continue training from an existing model.")
parser.add_argument("--checkpoint", type=str, default="-1", help="The checkpoint in the pre-trained model. The default is to load the BEST checkpoint (according to valid_loss)")
parser.add_argument("--config", type=str, help="The configuration file.")
parser.add_argument("train_dir", type=str, help="The data directory of the training set.")
parser.add_argument("train_spklist", type=str, help="The spklist file maps the TRAINING speakers to the indices.")
parser.add_argument("valid_dir", type=str, help="The data directory of the validation set.")
parser.add_argument("valid_spklist", type=str, help="The spklist maps the VALID speakers to the indices.")
parser.add_argument("pretrain_model", type=str, help="The pre-trained model directory.")
parser.add_argument("finetune_model", type=str, help="The fine-tuned model directory")
if __name__ == '__main__':
tf.logging.set_verbosity(tf.logging.INFO)
args = parser.parse_args()
params = save_codes_and_config(args.cont, args.finetune_model, args.config)
# Set the random seed. The random operations may appear in data input, batch forming, etc.
tf.set_random_seed(params.seed)
random.seed(params.seed)
np.random.seed(params.seed)
# The model directory always has a folder named nnet
model_dir = os.path.join(args.finetune_model, "nnet")
if args.cont:
# If we continue training, we can figure out how much steps the model has been trained,
# using the index of the checkpoint
import re
ckpt = tf.train.get_checkpoint_state(model_dir)
if ckpt and ckpt.model_checkpoint_path:
ckpt_name = os.path.basename(ckpt.model_checkpoint_path)
step = int(next(re.finditer("(\d+)(?!.*\d)", ckpt_name)).group(0))
else:
sys.exit("Cannot load checkpoint from %s" % model_dir)
start_epoch = int(step / params.num_steps_per_epoch)
else:
# Load the pre-trained model to the target model directory.
# The pre-trained model will be copied as the fine-tuned model and can be loaded from the new directory.
# The pre-trained model is now just like an initialized model.
get_pretrain_model(os.path.join(args.pretrain_model, "nnet"),
os.path.join(args.finetune_model, "nnet"),
args.checkpoint)
start_epoch = 0
learning_rate = params.learning_rate
learning_rate_array = []
if os.path.isfile(str(learning_rate)):
with open(str(learning_rate), "r") as f:
for line in f.readlines():
learning_rate_array.append(float(line.strip()))
# The size of the file should be large enough
assert len(learning_rate_array) > params.num_epochs, "The learning rate file is shorter than the num of epochs."
tf.logging.info("Using specified learning rate decay strategy.")
else:
# The learning rate is determined by the training process. However, if we continue training,
# the code doesn't know the previous learning rate if it is tuned using the validation set.
# To solve that, just save the learning rate to an individual file.
if os.path.isfile(os.path.join(model_dir, "learning_rate")):
learning_rate_array = load_lr(os.path.join(model_dir, "learning_rate"))
assert len(learning_rate_array) == start_epoch + 1, "Not enough learning rates in the learning_rate file."
else:
learning_rate_array = [float(learning_rate)] * (start_epoch + 1)
dim = FeatureReader(args.train_dir).get_dim()
with open(os.path.join(model_dir, "feature_dim"), "w") as f:
f.write("%d\n" % dim)
num_total_train_speakers = KaldiDataRandomQueue(args.train_dir, args.train_spklist).num_total_speakers
tf.logging.info("There are %d speakers in the training set and the dim is %d" % (num_total_train_speakers, dim))
min_valid_loss = ValidLoss()
if os.path.isfile(os.path.join(model_dir, "valid_loss")):
min_valid_loss = load_valid_loss(os.path.join(model_dir, "valid_loss"))
# The trainer is used to control the training process
trainer = Trainer(params, args.finetune_model)
trainer.build("train",
dim=dim,
loss_type=params.loss_func,
num_speakers=num_total_train_speakers,
noupdate_var_list=params.noupdate_var_list)
trainer.build("valid",
dim=dim,
loss_type=params.loss_func,
num_speakers=num_total_train_speakers)
if "early_stop_epochs" not in params.dict:
params.dict["early_stop_epochs"] = 5
if "min_learning_rate" not in params.dict:
params.dict["min_learning_rate"] = 1e-5
if start_epoch == 0:
# Load the pre-trained model and transfer to current model
trainer.get_finetune_model(params.noload_var_list)
# Before any further training, we evaluate the performance of the current model
valid_loss, valid_embeddings, valid_labels = trainer.valid(args.valid_dir, args.valid_spklist,
batch_type=params.batch_type,
output_embeddings=True)
eer = compute_cos_pairwise_eer(valid_embeddings, valid_labels)
tf.logging.info("In the beginning: Valid EER: %f" % eer)
for epoch in range(start_epoch, params.num_epochs):
trainer.train(args.train_dir, args.train_spklist, learning_rate_array[epoch])
valid_loss, valid_embeddings, valid_labels = trainer.valid(args.valid_dir, args.valid_spklist,
batch_type=params.batch_type,
output_embeddings=True)
eer = compute_cos_pairwise_eer(valid_embeddings, valid_labels)
tf.logging.info("[INFO] Valid EER: %f" % eer)
# Tune the learning rate if necessary.
if not os.path.isfile(str(learning_rate)):
new_learning_rate = learning_rate_array[epoch]
if valid_loss < min_valid_loss.min_loss:
min_valid_loss.min_loss = valid_loss
min_valid_loss.min_loss_epoch = epoch
else:
if epoch - min_valid_loss.min_loss_epoch >= params.reduce_lr_epochs:
new_learning_rate /= 2
# If the valid loss in the next epoch still does not reduce, the learning rate will keep reducing.
tf.logging.info("After epoch %d, no improvement. Reduce the learning rate to %f" % (
min_valid_loss.min_loss_epoch, new_learning_rate))
# min_valid_loss.min_loss = valid_loss
min_valid_loss.min_loss_epoch += (params.reduce_lr_epochs / 2)
learning_rate_array.append(new_learning_rate)
if epoch == 0:
# If this is the first epoch, the first learning rate should be recorded
with open(os.path.join(model_dir, "learning_rate"), "a") as f:
f.write("0 %.8f\n" % learning_rate_array[0])
# Save the learning rate and loss for each epoch.
with open(os.path.join(model_dir, "learning_rate"), "a") as f:
f.write("%d %.8f\n" % (epoch + 1, learning_rate_array[epoch + 1]))
with open(os.path.join(model_dir, "valid_loss"), "a") as f:
f.write("%d %f %f\n" % (epoch, valid_loss, eer))
# If the learning rate is too small, the training is actually get stuck.
# Also early stop is applied.
if learning_rate_array[epoch + 1] < (params.min_learning_rate - 1e-12) or \
epoch - min_valid_loss.min_loss_epoch >= params.early_stop_epochs:
break
# Close the session before we exit.
trainer.close()
| [
"ruyun_li@outlook.com"
] | ruyun_li@outlook.com |
e1a5744f6ecf92c626944827d21bdcfcd422a518 | d76d9b9498d028755d7b2b04482ba8c79cb339eb | /Python-Challenge/PyPoll/main.py | 7ab4c7286bad50ea051f1f044584493c76ae662b | [] | no_license | JonZagorski/Python-Challenge- | 9332f2a1bb4dcc89da4ee6938a3a931ca0e0688a | 53080cd5d97d67b9b6cfe351cb4293a3e6a7b499 | refs/heads/master | 2022-12-01T11:57:44.328423 | 2020-08-16T04:13:47 | 2020-08-16T04:13:47 | 286,357,194 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,918 | py | #import the important things
import os
import csv
#variables to store values go here
totalvotes = 0
number_votes = 0
#make a list to store candidates
candidates = []
#make list for vote counts
vote_counts =[]
#set the path to election_data
election_data = os.path.join("resources","election_data.csv")
#open election_data
with open(election_data, newline='', encoding= 'utf-8') as csvfile:
#read csvfile
election_csvreader = csv.reader(csvfile,delimiter=',')
#skip header line
next(election_csvreader, None)
#start for loop
for row in election_csvreader:
#count the total rows
totalvotes += 1
#set candidate list with row[2] values
candidate = row[2]
#add the votes to candidates
if candidate in candidates:
candidate_index = candidates.index(candidate)
vote_counts[candidate_index] = vote_counts[candidate_index] + 1
#add each candidate to the list
else:
candidates.append(candidate)
vote_counts.append(1)
pct = []
max_votes = vote_counts[0]
max_index = 0
for x in range(len(candidates)):
#calculation to get the percentage, x is the looper value
vote_pct = round(vote_counts[x]/totalvotes*100, 2)
pct.append(vote_pct)
if vote_counts[x] > max_votes:
max_votes = vote_counts[x]
max_index = x
winner = candidates[max_index]
#Test the variables
#print(totalvotes)
#print(candidates)
#print(vote_counts)
#print(max_votes)
#print(election_winner)
print('======================================================')
print('| Election Results |')
print('======================================================')
print(f'Total Votes: {totalvotes}')
print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
for x in range(len(candidates)):
print(f'{candidates[x]} : {pct[x]}% ({vote_counts[x]})')
print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
print(f'Election winner: {winner.upper()}')
print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
#Export file name and open as text file
output_file = os.path.join("election_results.txt")
with open(output_file, "w", newline="") as datafile:
# Write results to export text file
datafile.write("Election Results\n")
datafile.write("-----------------------------\n")
datafile.write(f"Total Votes: {number_votes}\n")
datafile.write("-----------------------------\n")
for count in range(len(candidates)):
datafile.write(f"{candidates[count]}: {pct[count]}% ({vote_counts[count]})\n")
datafile.write("-----------------------------\n")
datafile.write(f"Winner: {winner}\n")
datafile.write("-----------------------------\n") | [
"noreply@github.com"
] | JonZagorski.noreply@github.com |
235bea81a7895dc78c4ca7bd704cd9fc6093faec | 7c5fb33929116bb77b438de3ead93b3978b5af71 | /alf/networks/action_encoder.py | 16792ab6d227f26716c18cf61406688f1e6c33a0 | [
"Apache-2.0"
] | permissive | HorizonRobotics/alf | d6dac891322a81ccb7e2a9749139627b1eda28cb | b00ff2fa5e660de31020338ba340263183fbeaa4 | refs/heads/pytorch | 2023-08-21T18:51:41.370566 | 2023-08-16T00:07:22 | 2023-08-16T00:07:22 | 178,459,453 | 288 | 57 | Apache-2.0 | 2023-09-14T20:40:20 | 2019-03-29T18:44:07 | Python | UTF-8 | Python | false | false | 2,719 | py | # Copyright (c) 2019 Horizon Robotics. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""A simple parameterless action encoder."""
import numpy as np
import torch
import torch.nn.functional as F
import alf
from .network import Network
class SimpleActionEncoder(Network):
"""A simple encoder for action.
It encodes discrete action to one hot representation and use the original
continous actions. The output is the concat of all of them after flattening.
"""
def __init__(self, action_spec):
"""
Args:
action_spec (nested BoundedTensorSpec): spec for actions
"""
def check_supported_spec(spec):
if spec.is_discrete:
assert np.min(spec.minimum) == np.max(spec.minimum) == 0
assert np.min(spec.maximum) == np.max(spec.maximum)
alf.nest.map_structure(check_supported_spec, action_spec)
self._action_spec = action_spec
super().__init__(input_tensor_spec=action_spec, name="ActionEncoder")
def forward(self, inputs, state=()):
"""Generate encoded actions.
Args:
inputs (nested Tensor): action tensors.
Returns:
nested Tensor with the same structure as inputs.
"""
alf.nest.assert_same_structure(inputs, self._action_spec)
actions = inputs
outer_rank = alf.nest.utils.get_outer_rank(inputs, self._action_spec)
def _encode_one_action(action, spec):
if spec.is_discrete:
num_actions = spec.maximum - spec.minimum + 1
if num_actions.ndim == 0:
num_actions = int(num_actions)
else:
num_actions = int(num_actins[0])
a = F.one_hot(action, num_actions).to(torch.float32)
else:
a = action
if outer_rank > 0:
return a.reshape(*a.shape[:outer_rank], -1)
else:
return a.reshape(-1)
actions = alf.nest.map_structure(_encode_one_action, actions,
self._action_spec)
return torch.cat(alf.nest.flatten(actions), dim=-1), ()
| [
"noreply@github.com"
] | HorizonRobotics.noreply@github.com |
b9053a14c9ecab360901c53e37eb3ed50d3054f1 | e1c10cc188de604dfbce7403a7612f0c84457db4 | /resources/lecturer.py | 2c4dc1f536de265a9bafc89e569c8a4b714c7e16 | [] | no_license | clemkofi/ccn_directory | 42499e640d098f96e810226b6602c7747e1456af | 50a8818f23e60ca74a075d77270aebfdd613505d | refs/heads/master | 2022-12-09T20:01:21.694835 | 2018-11-09T08:06:50 | 2018-11-09T08:06:50 | 155,115,133 | 0 | 0 | null | 2022-12-08T01:15:42 | 2018-10-28T21:00:12 | Python | UTF-8 | Python | false | false | 10,868 | py | from resources_classes.db import DatabaseReq
from flask import request, jsonify
from flask_restful import Resource, reqparse
from apiapp import pass_generator, get_timestamp, get_current_timestamp, get_date_from_timestamp, get_token_for_user
from notification_service.notification_mail import password_notification
from werkzeug.security import generate_password_hash, check_password_hash
import uuid
from decorators import token_required
# from werkzeug.security import generate_password_hash, check_password_hash
class LecturerResource(Resource):
'''
Request for creating, updating, deleting and getting all information for the lecturers in the system
'''
@token_required
def post(self, currentUser, typeAuth):
ok_pass_go_on = 0
#check from the token authentication to ensure that the user is a lecturer and is allowed to perform this task
if typeAuth == "staff":
if currentUser[0]['privilege'] == "HR":
ok_pass_go_on = 1
elif typeAuth == "admin":
ok_pass_go_on = 1
else:
return jsonify({'Statuscode' : '200', 'message' : 'You are not allowed to add lecturer'})
if ok_pass_go_on == 0:
return jsonify({'Statuscode' : '200', 'message' : 'You are not allowed to add lecturer'})
try:
#parse the arguments for the post request
parser = reqparse.RequestParser()
parser.add_argument('surname', type=str, help='surname of the lecturer')
parser.add_argument('other_names', type=str, help='other names of the lecturer')
parser.add_argument('dob', type=str, help='date of birth of the lecturer')
parser.add_argument('phone', type=str, help='active phone number')
parser.add_argument('email', type=str, help='active email address')
parser.add_argument('Group_id', type=str, help='id for the group the lecturer has been added to')
parser.add_argument('department_id', type=str, help='id for the department the lecturer has been assigned to')
args = parser.parse_args()
#convert the dob to timestamp
args['dob'] = get_timestamp(date=args['dob'])
#generate password for the Lecturer
new_password = pass_generator()
args['vcode'] = new_password
#then hash the password to be stored in the db
hashed_password = generate_password_hash(new_password, method='sha256')
#give the last update time of the Data
args['last_update_time'] = get_current_timestamp()
#get the public id from the uuid
args['public_id'] = str(uuid.uuid4())
#adding the arguemnts to a list
args_to_pass = []
args_to_pass.append(args['surname'])
args_to_pass.append(args['other_names'])
args_to_pass.append(args['dob'])
args_to_pass.append(args['phone'])
args_to_pass.append(args['email'])
args_to_pass.append(args['Group_id'])
args_to_pass.append(args['department_id'])
args_to_pass.append(hashed_password)
args_to_pass.append(args['last_update_time'])
args_to_pass.append(args['public_id'])
#creating a cursor from the db class
arg_data = DatabaseReq().get_cursor(proc_name='spInsertNewLecturer', mode='post', args=args_to_pass)
if arg_data=="success":
password_notification(args)
return jsonify({'Statuscode':'200', 'Message':'Lecturer creation successful'})
else:
return jsonify({'Statuscode':'600', 'Message':arg_data})
except Exception as e:
return{'error' : str(e)}
#/lecturer/ = all lecturers
#/lecturer/?p_id=public_id = one lecturer with public id
@token_required
def get(self, currentUser, typeAuth):
ok_pass_go_on = 0
#check from the token authentication to ensure that the user is a lecturer and is allowed to perform this task
if typeAuth == "staff":
ok_pass_go_on = 1
elif typeAuth == "admin":
ok_pass_go_on = 1
else:
return jsonify({'Statuscode' : '200', 'message' : 'You are not allowed to add lecturer'})
if ok_pass_go_on == 0:
return jsonify({'Statuscode' : '200', 'message' : 'You are not allowed to add lecturer'})
try:
public_id = request.args.get('p_id')
if public_id is None:
#creating a cursor from the db class to get all lecturers
data_all_lecturers = DatabaseReq().get_cursor(proc_name='spGetAllLecturers', mode='get')
else:
#create cursor to get just one lecturer based on his public id
data_all_lecturers = DatabaseReq().get_cursor(proc_name='spGetOneLecturer', mode='get', args=[public_id])
if (len(data_all_lecturers)>0):
lecturerList = []
#use a for loop to iterate through the result
for item in data_all_lecturers:
if item[6] is 1:
continue
i = {
'surname':item[1],
'other_names':item[2],
'dob':item[3],
'phone':item[4],
'email':item[5],
'account_setup':item[7],
'public_id':item[8],
'vcode':item[9],
'Group_id':item[11],
'Department_id':item[12]
}
#change date of birth to readable format
i['dob'] = get_date_from_timestamp(timestamp=i['dob'])
lecturerList.append(i)
print len(lecturerList)
return jsonify({'Statuscode':'200','Lecturers':lecturerList})
else:
return jsonify({'Statuscode':'600', 'Message':'No result found'})
except Exception as e:
return{'error' : str(e)}
def delete(self):
try:
#parse the arguments for the delete request
parser = reqparse.RequestParser()
parser.add_argument('p_id', type=str, help='public_id of the lecturer')
args = parser.parse_args()
public_id = args['p_id']
#create cursor to get just one lecturer based on his public id
data_lecturer_check = DatabaseReq().get_cursor(proc_name='spGetOneLecturer', mode='get', args=[public_id])
if (len(data_lecturer_check)>0):
#create a cursor to delete the user based on his public_id
data_lecturer_delete = DatabaseReq().get_cursor(proc_name='spDeleteOneLecturer', mode='del', args=[public_id])
if data_lecturer_delete=="success":
return jsonify({'Statuscode':'200', 'Message':'Lecturer successfully deleted'})
else:
return jsonify({'Statuscode':'700', 'Message':data_lecturer_delete})
else:
return jsonify({'Statuscode':'600', 'Message':'No such user found'})
except Exception as e:
return{'error': str(e)}
class LecturerLoginResource(Resource):
'''
Request for creating, updating, deleting and getting all information for the lecturers in the system
'''
def post(self):
#parse the arguments for the post request
parser = reqparse.RequestParser()
parser.add_argument('email', type=str, help='active email address')
parser.add_argument('vcode', type=str, help='active vcode to use')
args = parser.parse_args()
#login info for the Lecturer
args_login = []
args_login.append(args['email'])
args_login.append(args['vcode'])
#create cursor to get just one lecturer based on his public id
data_all_lecturers = DatabaseReq().get_cursor(proc_name='spGetLecturerLogin', mode='postget', args=args_login)
if (len(data_all_lecturers)>0):
lecturerinfo = []
#use a for loop to iterate through the result
for item in data_all_lecturers:
if item[6] is 1:
continue
i = {
'surname':item[1],
'other_names':item[2],
'dob':item[3],
'phone':item[4],
'email':item[5],
'account_setup':item[7],
'public_id':item[8],
'vcode':item[9],
'Group_id':item[11],
'Department_name':item[14],
}
#change date of birth to readable format
i['dob'] = get_date_from_timestamp(timestamp=i['dob'])
lecturerinfo.append(i)
return jsonify({'Statuscode':'200','Lecturer':lecturerinfo})
else:
return jsonify({'Statuscode':'600', 'Message':'Authentication Failed ... No such user'})
def get(self):
#this is a function that implements the token authentication when a user logs in
# this gets the auth variables from the request ....
auth = request.authorization
if not auth or not auth.username or not auth.password:
return jsonify({"message" : "Could not verify! Login required!", "Statuscode" : "401"})
#login info for the Lecturer
args_login = auth.username
#create cursor to get just one lecturer based on his public id
data_one_lecturer = DatabaseReq().get_cursor(proc_name='spGetLecturerLogin2', mode='postget', args=[args_login])
if len(data_one_lecturer) > 0:
lecturerinfo = []
hashed_vcode = ""
#use a for loop to iterate through the result
for item in data_one_lecturer:
if item[6] is 1:
continue
i = {
'public_id':item[8],
'Group_id':item[11],
'Department_id':item[13],
}
lecturerinfo.append(i)
hashed_vcode = item[9]
if check_password_hash(hashed_vcode, auth.password):
token_to_give = get_token_for_user(lecturerinfo[0]['public_id'], lecturerinfo[0]['Department_id'], typeAuth='lecturer')
return jsonify({"Statuscode" : "200", "tokenObtained" : token_to_give})
return jsonify({"message" : "Could not verify! Login required!", "Statuscode" : "401"})
| [
"cak.nartey@gmail.com"
] | cak.nartey@gmail.com |
1d9541158f83578238b98dcdfc19ba79daf98b49 | 9ac08da288a54b1b2a2e318cbfd906d30364eac8 | /src/unit3_challenge2.py | 6388b50d56c93b0519a184e13358bb6ab3b9d55e | [] | no_license | bigdatasciencegroup/datalab | 79bac9caf42352eefd0e79977cfb6e28c6af7323 | 83617eba3b9b1170e5f271d12e79ad7c6bcfdd66 | refs/heads/master | 2023-05-09T21:50:58.008163 | 2020-01-01T12:32:56 | 2020-01-01T12:32:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,950 | py | import sys
from sklearn.metrics.cluster import adjusted_mutual_info_score
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from src.base.task import BaseTask
from src.utils.models import FileSizeClusterer
from sklearn.base import TransformerMixin
import numpy as np
from io import BytesIO
from zipfile import ZipFile
from sklearn.pipeline import make_pipeline
from sklearn.cluster import KMeans
from androguard.misc import AnalyzeAPK
from androguard.misc import APK
from src.utils.utils import SavedDict
from src.utils.utils import ElbowPlotter
import os
from src.utils.models import DenseTransformer
from src.utils.models import GmmClusterer
from sklearn.preprocessing import StandardScaler
class FeatureExtractor(TransformerMixin):
def __init__(self, working_dir):
super(FeatureExtractor, self).__init__()
self.json_path = os.path.join(working_dir, 'more_features.json')
self.vectorizer = TfidfVectorizer()
def fit(self, xs, ys=None):
return self
def transform(self, xs, ys=None):
xs_len = len(xs)
transformed = []
with SavedDict(self.json_path) as d:
for i, sample in enumerate(xs):
if i % 10 == 0:
print('{} of {}'.format(i, xs_len))
transformed.append(self.transform_sample(sample, d))
return transformed
def transform_sample(self, sample, cache_dict):
filename, app = sample
if filename not in cache_dict.keys():
cache_dict[filename] = self.extract_features(app)
return cache_dict[filename]
def extract_features(self, app):
features = {}
try:
a, d, dx = AnalyzeAPK(app, raw=True)
features['permissions'] = ' '.join(list(map(lambda x: x.rsplit('.', 1)[1], a.permissions)))
features['min_sdk'] = a.get_min_sdk_version()
features['log_size'] = np.log(sys.getsizeof(app))
except Exception as ex:
pass
return features
class Vectorizer(TransformerMixin):
def __init__(self, text_vectorizer):
self.text_vectorizer = text_vectorizer
def get_texts(self, xs):
return [x['permissions'] if 'permissions' in x.keys() else "" for x in xs]
def fit(self, xs, ys=None):
self.text_vectorizer.fit(self.get_texts(xs))
return self
def transform(self, xs, ys=None):
transformed = [self.transform_sample(x) for x in xs]
return transformed
def transform_sample(self, sample):
text_features = self.text_vectorizer.transform(self.get_texts([sample]))
text_features = list(np.array(text_features.todense())[0])
min_sdk = sample.get('min_sdk', 0)
if min_sdk != min_sdk or min_sdk is None:
min_sdk = 0
log_size = sample.get('log_size', 0)
if log_size != log_size or log_size is None:
log_size = 0
all_features = text_features #+ [min_sdk, log_size]
return all_features
class Task(BaseTask):
def get_model(self):
return make_pipeline(
FeatureExtractor(working_dir=self.path),
Vectorizer(TfidfVectorizer()),
StandardScaler(),
# ElbowPlotter(model=KMeans(), metric=self.metric, k_range=(10, 30), unsupervised=True),
KMeans(n_clusters=30, n_init=50, max_iter=1000)
)
@property
def metric(self):
return adjusted_mutual_info_score
@property
def include_file_names(self):
return True
@property
def mode(self):
return BaseTask.Mode.CLUSTERING
@property
def train_data_link(self):
return 'https://www.sec.cs.tu-bs.de/teaching/ws19/datalab/03-clust/d0f626fb065b9bd661f3f681cf032853478d2f46.zip'
@property
def test_data_link(self):
return "https://www.sec.cs.tu-bs.de/teaching/ws19/datalab/03-clust/813e0f0cffaa77809374d0ce34f170e153c47605.zip" | [
"jonasitzmann@github.com"
] | jonasitzmann@github.com |
ddb9e86f2af78422c26df983d968c40f0bf75e76 | df4d6e326241b044b6de4064fd595be556f14902 | /src/mysite/resources/views.py | 6c8fb593075077c2a543a54423b686fcf0208c1a | [] | no_license | Joelant97/AppLeo-Proyecto_Final | 9218a088991a32ce90ed0a838ef88679d7f846d9 | ee1613d11302b007e254ecb676c8720d9a27d498 | refs/heads/master | 2021-06-24T10:30:56.337788 | 2020-08-26T09:18:24 | 2020-08-26T09:18:24 | 147,465,639 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 9,502 | py | from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import get_object_or_404, render_to_response
from django.views import generic
from django.views.generic.edit import CreateView, UpdateView, DeleteView, View
from django.core.urlresolvers import reverse_lazy
from .models import Estudiante, Profesor
#from django.contrib.auth.models import User
from .forms import RegistroForm
from django.shortcuts import redirect
from django.contrib.auth import login, authenticate
# Librerias para Servicio de Rest:
from rest_framework.views import APIView
from rest_framework.response import Response
# from rest_framework import status
from .models import Evaluacion
from .models import Lectura
from .serializers import EstudianteSerializer
from .serializers import EvaluacionSerializer
# from .models import EvaluacionForm
from django.shortcuts import render
from rest_framework.response import Response
from .fusioncharts import FusionCharts
class RegistrarView(CreateView):
model = Profesor
form_class = RegistroForm
template_name = "resources/registrar.html"
success_url = reverse_lazy('login')
def form_valid(self, form):
'''
En este parte, si el formulario es valido guardamos lo que se obtiene de él
y usamos authenticate para que el usuario incie sesión luego de haberse registrado
y lo redirigimos al index
'''
form.save()
usuario = form.cleaned_data.get('username')
password = form.cleaned_data.get('password1')
usuario = authenticate(username=usuario, password=password)
login(self.request, usuario)
return redirect('/')
# def form_valid(self, form):
# # Add logged-in user as autor of comment THIS IS THE KEY TO THE SOLUTION
# form.instance.profesor = self.request.user
#
# # Call super-class form validation behaviour
# return super(RegistrarView, self).form_valid(form)
def get_context_data(self, **kwargs):
context = super(CreateView, self).get_context_data(**kwargs)
context.update({
'all_profesors': Profesor.objects.all(),
})
return context
def get_queryset(self):
return Profesor.objects.all()
# class RegistroUsuario(CreateView):
# model = User
# template_name = "resources/registrar.html"
# form_class = RegistroForm
# success_url = reverse_lazy('login')
class ListProfesorLogeado(generic.ListView):
template_name = 'resources/profesor-detalles.html'
context_object_name = 'user.is_authenticated'
slug_field = 'profesor'
slug_url_kwarg = 'profesor'
def get_queryset(self):
return Profesor.objects.all()
class DetailViewProfesor(generic.DetailView):
model = Profesor
template_name = 'resources/profesor-detalles.html'
# success_url = reverse_lazy('profesor-update')
'''
Vista para la Lectura, la cual solo sera vista por el estudiante:
'''
# Crea tus Vistas aqui
def busqueda(request):
estudiantes = Estudiante.objects.filter(nombres__icontains=request.GET['nombres']).values('id', 'nombres',
'apellidos')
try:
if estudiantes:
return render_to_response('resources/buscar-resultados.html', {'estudiante': estudiantes})
except:
return HttpResponse("Hubo una excepcion")
else:
return HttpResponse("No hay estudiantes con ese nombre")
# Vista para Realizar Evaluaciones del Modelo "Evaluacion"
class RealizarEvaluacionVista(CreateView):
model = Evaluacion
template_name = "resources/evaluacion_form.html"
success_url = "/estudiante/{estudiante_id}" # Esto es para direcionar hacia los detalles del estudiante
# luego de registrar la evaluacion que se le ha realizo.
fields = ['estudiante', 'es_favorito', 'evaluacion_tipo', 'fluidez_lectora', 'tipo_lectura', 'comentario',
'texto_a_leer', 'fecha']
# def get_context_data(self, **kwargs):
# context = super(CreateView, self).get_context_data(**kwargs)
# context.update({
# 'all_estudiantes': Estudiante.objects.all(),
# })
# return context
#
# def get_queryset(self):
# return Estudiante.objects.all()
# Eliminar las Evaluaciones:
def DeleteEvaluacion(request, eva_id):
# El id de la Evaluacion a eliminar es id== eva_id
eva_obj = get_object_or_404(Evaluacion, id=eva_id)
eva_obj.delete()
return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/')) # Esto te permite redirecionar a la misma pagina
# en que estabas, luego de eliminar y actualizar.
class IndexView(generic.ListView):
template_name = 'resources/index.html'
context_object_name = 'all_estudiantes'
def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)
context.update({
'all_evaluaciones': Evaluacion.objects.all(),
})
return context
def get_queryset(self):
return Estudiante.objects.all()
class ReportesView(generic.ListView):
template_name = 'resources/reportes.html'
context_object_name = 'all_evaluaciones'
slug_field = 'evaluacion'
slug_url_kwarg = 'evaluacion'
def get_queryset(self):
return Evaluacion.objects.all()
# context_object_name = 'all_estudiantes'
#
# def get_context_data(self, **kwargs):
# context = super(IndexView, self).get_context_data(**kwargs)
# context.update({
# 'all_evaluaciones': Evaluacion.objects.all(),
# })
# return context
#
# def get_queryset(self):
# return Estudiante.objects.all()
class DetailViewEvaluacion(generic.DetailView):
model = Evaluacion
template_name = 'resources/evaluacion-detalles.html'
# success_url = reverse_lazy('estudiante-update')
class ListEstudiantes(generic.ListView):
template_name = 'resources/estudiantes.html'
context_object_name = 'all_estudiantes'
slug_field = 'estudiante'
slug_url_kwarg = 'estudiante'
def get_queryset(self):
return Estudiante.objects.all()
class DetailView(generic.DetailView):
model = Estudiante
template_name = 'resources/detalles.html'
class CrearEstudiante(CreateView):
model = Estudiante
fields = ['id', 'nombres', 'apellidos', 'genero', 'edad', 'foto']
# success_url = "/estudiante/{estudiante_id}"
# success_url = reverse_lazy('listado-estudiantes')
def form_valid(self, form):
# Add logged-in user as autor of comment THIS IS THE KEY TO THE SOLUTION
form.instance.profesor = self.request.user
# Call super-class form validation behaviour
return super(CrearEstudiante, self).form_valid(form)
class CrearLectura(CreateView):
model = Lectura
success_url = "listado/lecturas/"
template_name = "resources/lectura_form.html"
fields = ['id', 'titulo', 'texto']
# /lecturas lista
class ListLecturas(generic.ListView):
template_name = 'resources/lecturas.html'
context_object_name = 'all_lecturas'
slug_field = 'lectura'
slug_url_kwarg = 'lectura'
def get_queryset(self):
return Lectura.objects.all()
class UpdateEstudiante(UpdateView):
model = Estudiante
fields = ['id', 'nombres', 'apellidos', 'genero', 'edad', 'foto']
class DeleteEstudiante(DeleteView):
model = Estudiante
success_url = reverse_lazy('resources:index')
class UpdateLectura(UpdateView):
model = Lectura
fields = ['id', 'titulo', 'texto']
class DeleteLectura(DeleteView):
model = Lectura
success_url = reverse_lazy('resources:listado-lecturas')
'''
Vistas para las Graficas (Libreria: FusionCharts)
'''
def chart(request):
dataSource= {}
dataSource['chart'] = {
"caption": "Velocidad de la lectura,",
"subCaption": "evaluada segun su tipo",
"xAxisName": "Tipo Lectura",
"yAxisName": "Velocidad Lectora (En PPM)",
"numberPrefix": "ppm",
"theme": "zune"
}
# The data for the chart should be in an array where each element of the array is a JSON object
# having the `label` and `value` as key value pair.
dataSource['data'] = []
# Iterate through the data in `Revenue` model and insert in to the `dataSource['data']` list.
for key in Evaluacion.objects.all():
data = {}
data['label'] = key.tipo_lectura
data['value'] = key.fluidez_lectora
dataSource['data'].append(data)
# Create an object for the Column 2D chart using the FusionCharts class constructor
column2D = FusionCharts("column2D", "ex1", "600", "350", "chart-1", "json", dataSource)
return render(request, 'resources/bar-chart.html', {'output': column2D.render()})
# Manejo de RestFull(Listar o crear uno nuevo del model para el Serv.Rest):
# /estudiantes
class EstudianteList(APIView):
def get(self, request):
estudiantes = Estudiante.objects.all()
serializer = EstudianteSerializer(estudiantes, many=True)
return Response(serializer.data)
def post(self):
pass
# /evaluaciones
class EvaluacionList(APIView): # Esto funciona como una especie de JSON.
def get(self, request):
evaluaciones = Evaluacion.objects.all()
serializer = EvaluacionSerializer(evaluaciones, many=True)
return Response(serializer.data)
def post(self):
pass
| [
"joelant97@gmail.com"
] | joelant97@gmail.com |
875f0277e8f0a1d890f62156d1ff2f9287f22dc2 | 508fd86b80959df7289f49c90c67b5da5b42d440 | /bin_to_dec_oct_hex.py | 9f57df283a83f6237be5262c92c546e0e8ab4815 | [] | no_license | habeebahmed/challenges | ea02e56fdf6cfbf702c6e4dfc2606e71250da5ac | b163ed0707364e472db9ef5c1b54975572fd2e19 | refs/heads/master | 2022-09-17T21:38:46.413225 | 2022-07-31T23:01:25 | 2022-07-31T23:01:25 | 225,154,386 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,906 | py | '''
Online Python Compiler.
Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.
'''
# print("Hello World")
# b_num = list(input("Input a binary number: "))
# value = 0
# for i in range(len(b_num)):
# digit = b_num.pop()
# if digit == '1':
# value = value + pow(2, i)
# print("The decimal value of the number is", value)
import math
import os
import random
import re
import sys
#
# Complete the 'binary_converter' function below.
#
# The function is expected to return a STRING.
# The function accepts following parameters:
# 1. INTEGER_ARRAY binary
# 2. CHARACTER base
#
def getOctal(binArray):
i = 0
ocatalArray = [0] * 32
pos = 0
count = 1
ocatalDigit = 0
lengthOfBinList = len(str(binArray))
while int(binArray)!=0:
digit = binArray % 10
ocatalDigit += digit * pow(2,i)
binArray = int (binArray / 10)
i += 1
ocatalArray[pos] = ocatalDigit
if count % 3 == 0 or lengthOfBinList == count:
ocatalDigit = 0
i = 0
pos += 1
count += 1
newArray = ocatalArray[:pos]
newArray.reverse()
return newArray
# 16 - 8 4 2 1
# 0-9 A B C D E F
def getHexa(binArray):
i = 0
hexArray = [0] * 32
pos = 0
count = 1
hexDigit = 0
lengthOfBinList = len(str(binArray))
hexaObj = { 10: 'A', 11: 'B', 12: 'C', 13: 'D', 14: 'E', 15: 'F' }
while int(binArray) != 0:
digit = binArray % 10
hexDigit += digit * pow(2,i)
binArray = int (binArray / 10)
i += 1
hexArray[pos] = hexDigit
if count%4 == 0 or lengthOfBinList == count:
if hexDigit > 9:
hexArray[pos] = hexaObj[hexDigit]
i = 0
hexDigit = 0
pos +=1
count +=1
newArray = hexArray[:pos]
newArray.reverse()
return newArray
def binary_converter(binary,base = 'd'):
print(binary, base)
value = 0
if base == 'b':
return "".join(map(str, binary)).lstrip('0')
elif base == 'o':
octalArray = getOctal(int("".join(map(str, binary)).lstrip('0')))
return "".join(map(str, octalArray))
elif base == 'h':
hexArray = getHexa(int("".join(map(str, binary)).lstrip('0')))
return "".join(map(str, hexArray))
else:
for i in range(len(binary)):
digit = binary.pop()
if digit == 1:
value = value + pow(2, i)
print(value)
return value
# fptr = open(os.environ['OUTPUT_PATH'], 'w')
binary = [1,1,1,1,1,1,0,1]
try:
base = 'h'
result = binary_converter(binary, base)
except:
result = binary_converter(binary)
print("value", result)
# fptr.write(result + '\n')
# fptr.close() | [
"habeebahmed@Habeebs-MacBook-Pro.local"
] | habeebahmed@Habeebs-MacBook-Pro.local |
31796965335c361024f29cf5de2c18699d806d6e | 0f2d3fca1ef0d59f5276b2e1e1af7b02c225917b | /tests/test_visualiser.py | 827a2853bb3584bb13a1ba442160337714b47305 | [] | no_license | breakingflower/door2door_mi_challenge | 4f3f47b8cfae91d2684a85df7956f1b201cec36f | 450f1ba9a0d281ca418da8d256da329db31a102f | refs/heads/master | 2023-04-13T23:34:06.637892 | 2020-09-28T20:15:38 | 2020-09-28T20:15:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,225 | py | ###################################################################
# Script Name : "TEST_VISUALISER.PY"
# Description : Tests for the visualiser/visualiser.py file
# Args :
# Author : Floris Remmen
# Email : floris.remmen@gmail.com
# Date : "28 September 2020"
###################################################################
import unittest
from visualiser.visualiser import Visualiser
from utilities.bounding_box import BoundingBox
from utilities.staticdatareader import StaticDataReader
from simulator.simulator import Simulator
import warnings
from os.path import isfile
class TestVisualiser(unittest.TestCase):
"""
Testcase for the Visualiser Class
"""
@classmethod
def setUpClass(self):
"""
Sets up the class. The data only has to be read in once, so this is done in the class setup method.
"""
# TODO: Remove warn ngs filter when migrating to geopandas > 0.7.0 !
warnings.simplefilter('ignore', category=FutureWarning)
warnings.simplefilter('ignore', category=DeprecationWarning)
static_data = StaticDataReader(
'data/berlin_bounds.poly',
'data/berlin_stops.geojson'
)
bounding_box_tuple = (
13.34014892578125,
52.52791908000258,
13.506317138671875,
52.562995039558004
)
simulator = Simulator(
bounding_box = bounding_box_tuple
)
simulation_results = simulator.simulate(number_of_requests=6)
self.visualiser = Visualiser(
bounding_box = BoundingBox(bounding_box_tuple),
simulation_results = simulation_results,
static_data= static_data,
static_path = 'webapp/static'
)
def setUp(self):
pass
def test_generate_overview_figure(self):
"""
Asserts a overview figure is generated after calling the function.
"""
self.visualiser.generate_overview_figure()
self.assertTrue(
isfile(f"{self.visualiser.static_path}/{self.visualiser.id}_overview_plot.png")
)
def test_generate_closeup_figure(self):
"""
Asserts a closeup figure is generated after calling the function.
"""
self.visualiser.generate_closeup_figure()
self.assertTrue(
isfile(f"{self.visualiser.static_path}/{self.visualiser.id}_closeup_plot.png")
)
def test_generate_gmap(self):
"""
Asserts a html map is generated after calling the function.
"""
self.visualiser.generate_gmap()
self.assertTrue(
isfile(f"{self.visualiser.static_path}/{self.visualiser.id}_map.html")
)
def tearDown(self):
pass
if __name__ == "__main__":
unittest.main() | [
"floris.remmen@gmail.com"
] | floris.remmen@gmail.com |
19e8f21141951d921204abcb75ae7fa31b3ef394 | 4d547798e619238c13dc5cf7c82e7f7ff2451c1c | /DjangoSunucu/Proje/Sunucu/models.py | 986ee05fdf47264d351d88dc101826a60916dc2a | [] | no_license | emogooo/Buyukbas-Android-IOS-Uygulamasinin-Sunucusu | c845224275dcdba712411a009725a90331360e3a | 5daf911c597c5fe437cc7fb02720e4d3253f54f3 | refs/heads/master | 2022-12-08T03:08:43.938063 | 2020-09-04T12:24:24 | 2020-09-04T12:24:24 | 292,840,524 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,593 | py | from django.db import models
"""
from django.db.models import signals
from django.dispatch import receiver
from django.db.models.signals import pre_save
"""
class Asi(models.Model):
ad = models.CharField(max_length=30)
aciklama = models.CharField(max_length=200)
def __str__(self):
return self.ad
class CikisSebebi(models.Model):
ad = models.CharField(max_length=30)
def __str__(self):
return self.ad
class Isletme(models.Model):
ad = models.CharField(max_length=30)
def __str__(self):
return self.ad
class Cinsiyet(models.Model):
ad = models.CharField(max_length=30)
def __str__(self):
return self.ad
class Irk(models.Model):
ad = models.CharField(max_length=30)
def __str__(self):
return self.ad
class Pazarlikci(models.Model):
ad = models.CharField(max_length=30)
soyad = models.CharField(max_length=30)
telefon = models.CharField(max_length=11)
adres = models.CharField(max_length=70)
def __str__(self):
return self.ad + " " + self.soyad
class AlisBilgisi(models.Model):
fiyatTL = models.PositiveSmallIntegerField()
tarih = models.DateField(auto_now=False, auto_now_add=False)
kilo = models.PositiveSmallIntegerField()
pazarlikci = models.ForeignKey(Pazarlikci, on_delete=models.CASCADE)
def __str__(self):
return str(self.fiyatTL) + " " + str(self.kilo) + " " + str(self.tarih) + " " + str(self.pazarlikci)
class Hayvan(models.Model):
kupeNo = models.CharField(max_length=10)
padokNo = models.CharField(max_length=10)
aciklama = models.CharField(max_length=200)
aktif = models.BooleanField(default=True)
alisBilgisi = models.ForeignKey(AlisBilgisi, on_delete=models.CASCADE)
irk = models.ForeignKey(Irk, on_delete=models.CASCADE)
cinsiyet = models.ForeignKey(Cinsiyet, on_delete=models.CASCADE)
isletme = models.ForeignKey(Isletme, on_delete=models.CASCADE)
def __str__(self):
return str(self.kupeNo)
class AsiBilgi(models.Model):
hayvan = models.ForeignKey(Hayvan, on_delete=models.CASCADE)
asi = models.ForeignKey(Asi, on_delete=models.CASCADE)
tarih = models.DateField(auto_now=False, auto_now_add=False)
def __str__(self):
return str(self.hayvan) + " " +str(self.asi)
class Cikis(models.Model):
sebep = models.ForeignKey(CikisSebebi, on_delete=models.CASCADE)
hayvan = models.ForeignKey(Hayvan, on_delete=models.CASCADE)
tarih = models.DateField(auto_now=False, auto_now_add=False)
def __str__(self):
return str(self.hayvan) + " " + str(self.sebep)
class Ticaret(models.Model):
cikis = models.ForeignKey(Cikis, on_delete=models.CASCADE)
musteri = models.ForeignKey(Pazarlikci, on_delete=models.CASCADE)
fiyatTL = models.PositiveSmallIntegerField()
tarih = models.DateField(auto_now=False, auto_now_add=False)
def __str__(self):
return str(self.musteri) + " " + str(self.cikis) + " " + str(self.fiyatTL)
class EskiKupeNo(models.Model):
hayvan = models.ForeignKey(Hayvan, on_delete=models.CASCADE)
eskiKupe = models.CharField(max_length=10)
yeniKupe = models.CharField(max_length=10)
tarih = models.DateField(auto_now=False, auto_now_add=False)
def __str__(self):
return str(self.hayvan) + " " + str(self.eskiKupe) + " " + str(self.yeniKupe)
"""
@receiver(signals.pre_save, sender=Hayvan)
def createOrUpdate(sender, instance, **kwargs):
if kwargs['created']:
print('created')
else:
print('updated')
pre_save.connect(createOrUpdate, sender=Hayvan)
""" | [
"58745898+emogooo@users.noreply.github.com"
] | 58745898+emogooo@users.noreply.github.com |
c9a604456c34d29080c08177efe61aef1e31a260 | 55cdb125dcff042f59798253ec63ee021755a01b | /cookie-Token/models.py | ac280672d77adad609d5c9fc3d8182ec488781df | [] | no_license | chaojixiaoyao/python-rear_end | 5b547548a57109ce4f067a9a140288af96388ba3 | 3c05d2d92948780ac8bd91d3bead05fb08900c38 | refs/heads/master | 2020-05-15T13:14:14.848573 | 2019-05-16T10:02:47 | 2019-05-16T10:02:47 | 182,291,566 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,641 | py | import json
def save(data, path):
"""
data 是 dict 或者 list
path 是保存文件的路径
"""
s = json.dumps(data, indent=2, ensure_ascii=False)
with open(path, 'w+', encoding='utf-8') as f:
f.write(s)
def load(path):
with open(path, 'r', encoding='utf-8') as f:
s = f.read()
return json.loads(s)
class Model(object):
"""
Model 是所有 model 的基类
@classmethod 是一个套路用法
例如
user = User()
user.db_path() 返回 User.txt
"""
@classmethod
def db_path(cls):
"""
cls 是类名, 谁调用的类名就是谁的
classmethod 有一个参数是 class(这里我们用 cls 这个名字)
所以我们可以得到 class 的名字
"""
classname = cls.__name__
path = '{}.txt'.format(classname)
return path
@classmethod
def all(cls):
"""
all 方法(类里面的函数叫方法)使用 load 函数得到所有的 models
"""
path = cls.db_path()
models = load(path)
# 这里用了列表推导生成一个包含所有 实例 的 list
# m 是 dict, 用 cls.new(m) 可以初始化一个 cls 的实例
# 不明白就 log 大法看看这些都是啥
ms = [cls.new(m) for m in models]
return ms
@classmethod
def new(cls, form):
m = cls(form)
return m
@classmethod
def find_by(cls, **kwargs):
"""
用法如下,kwargs 是只有一个元素的 dict
u = User.find_by(username='gua')
"""
k, v = '', ''
for key, value in kwargs.items():
k, v = key, value
all = cls.all()
for m in all:
# getattr(m, k) 等价于 m.__dict__[k]
if v == m.__dict__[k]:
return m
return None
@classmethod
def find_all(cls, **kwargs):
"""
用法如下,kwargs 是只有一个元素的 dict
u = User.find_by(username='gua')
"""
k, v = '', ''
for key, value in kwargs.items():
k, v = key, value
all = cls.all()
data = []
for m in all:
# getattr(m, k) 等价于 m.__dict__[k]
if v == m.__dict__[k]:
data.append(m)
return data
def __repr__(self):
"""
__repr__ 是一个魔法方法
简单来说, 它的作用是得到类的 字符串表达 形式
比如 print(u) 实际上是 print(u.__repr__())
"""
classname = self.__class__.__name__
properties = ['{}: ({})'.format(k, v) for k, v in self.__dict__.items()]
s = '\n'.join(properties)
return '< {}\n{} >\n'.format(classname, s)
def save(self):
"""
用 all 方法读取文件中的所有 model 并生成一个 list
把 self 添加进去并且保存进文件
"""
models = self.all()
first_index = 0
if self.__dict__.get('id') is None:
# 加上 id
if len(models) > 3:
# 不是第一个数据
self.id = models[-1].id + 1
else:
# 是第一个数据
self.id = first_index
models.append(self)
else:
# 有 id 说明已经是存在于数据文件中的数据
# 那么就找到这条数据并替换之
index = -1
for i, m in enumerate(models):
if m.id == self.id:
index = i
break
# 看看是否找到下标
# 如果找到,就替换掉这条数据
if index > -1:
models[index] = self
# 保存
l = [m.__dict__ for m in models]
path = self.db_path()
save(l, path)
class User(Model):
"""
User 是一个保存用户数据的 model
现在只有两个属性 username 和 password
"""
def __init__(self, form):
self.id = form.get('id', None)
if self.id is not None:
self.id = int(self.id)
self.username = form.get('username', '')
self.password = form.get('password', '')
def validate_login(self):
# return self.username == 'gua' and self.password == '123'
u = User.find_by(username=self.username)
# us = User.all()
# for u in us:
# if u.username == self.username and u.password == self.password:
# return True
# return False
return u is not None and u.password == self.password
# 这样的代码是不好的,不应该用隐式转换
# return u and u.password == self.password
"""
0 None ''
"""
def validate_register(self):
return len(self.username) > 2 and len(self.password) > 2
class Message(Model):
"""
Message 是用来保存留言的 model
"""
def __init__(self, form):
self.author = form.get('author', '')
self.message = form.get('message', '')
def test():
# users = User.all()
# u = User.find_by(username='gua')
form = dict(
username='gua',
password='gua',
)
u = User(form)
u.save()
# u.save()
# u.save()
# u.save()
# u.save()
# u.save()
# u = User.find_by(id=1)
# u.username = '瓜'
# u.save()
if __name__ == '__main__':
test()
| [
"noreply@github.com"
] | chaojixiaoyao.noreply@github.com |
4c4e27e45b34e9331a3ec84ac79cfdf43b698848 | f2543f7266cc6f6bebee3d14081daaa676a6f80a | /tensorflow_federated/python/research/optimization/emnist_ae/dataset_test.py | aa4b7a71a5ea7055bce4f6d2649dd8c65cb6a93a | [
"Apache-2.0"
] | permissive | matech96/federated | d497d24e64399f6b1da673a8457e88a18bc29473 | b30a26d66162bd02a89a12f119e17925d161a26b | refs/heads/master | 2022-11-12T10:20:34.483506 | 2020-06-11T21:13:02 | 2020-06-11T21:13:30 | 271,650,529 | 0 | 0 | Apache-2.0 | 2020-06-11T21:31:51 | 2020-06-11T21:31:50 | null | UTF-8 | Python | false | false | 1,962 | py | # Copyright 2019, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import tensorflow as tf
from tensorflow_federated.python.research.optimization.emnist_ae import dataset
TEST_BATCH_SIZE = dataset.TEST_BATCH_SIZE
class DatasetTest(tf.test.TestCase):
def test_emnist_dataset_structure(self):
emnist_train, emnist_test = dataset.get_emnist_datasets(
client_batch_size=10, client_epochs_per_round=1, only_digits=True)
self.assertEqual(len(emnist_train.client_ids), 3383)
sample_train_ds = emnist_train.create_tf_dataset_for_client(
emnist_train.client_ids[0])
train_batch = next(iter(sample_train_ds))
train_batch_shape = train_batch[0].shape
test_batch = next(iter(emnist_test))
test_batch_shape = test_batch[0].shape
self.assertEqual(train_batch_shape.as_list(), [10, 28*28])
self.assertEqual(test_batch_shape.as_list(), [TEST_BATCH_SIZE, 28*28])
def test_global_emnist_dataset_structure(self):
global_train, global_test = dataset.get_centralized_emnist_datasets(
batch_size=32, only_digits=False)
train_batch = next(iter(global_train))
train_batch_shape = train_batch[0].shape
test_batch = next(iter(global_test))
test_batch_shape = test_batch[0].shape
self.assertEqual(train_batch_shape.as_list(), [32, 28*28])
self.assertEqual(test_batch_shape.as_list(), [TEST_BATCH_SIZE, 28*28])
if __name__ == '__main__':
tf.test.main()
| [
"tensorflow.copybara@gmail.com"
] | tensorflow.copybara@gmail.com |
ff3b79306b579ddcb48b552d769e092672abe3e5 | ec2937329e810741c768f421b1f143dcc23e0431 | /testapp/models.py | 12fef266b580d5f71d6528cf84549bf78a0ff17a | [] | no_license | kaushikdobariya777/dk_lms | fdc0ebf09980f029f4072756ee5a82e07e3506fc | d26eb169d990a3eeea5d8e56be8dd44dcd13e76c | refs/heads/master | 2023-07-19T17:08:55.287103 | 2021-08-26T03:31:43 | 2021-08-26T03:31:43 | 400,028,560 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 252 | py | from django.db import models
class Employee(models.Model):
eno=models.IntegerField()
ename=models.CharField(max_length=30)
esal=models.FloatField()
eaddr=models.CharField(max_length=60)
def __str__(self):
return self.ename
| [
"kaus.patel777@gmail.com"
] | kaus.patel777@gmail.com |
d0b5c3f8d6c7520c4bec6204a5f3d9ed7fbba332 | f1a6e9228ee3a66a2b878b85ee6e6b5d6ac9ddfa | /gallery/wsgi.py | 0276e4ba6c10865c3587a5b1d6d76a8c445f3cd2 | [
"MIT"
] | permissive | Doktatech/Gallery | 499f0b645d6f9e74d7f16a688ea8a62d331f03d8 | 7916ce6e38c80817554b1d02f7886f7b1ee759f7 | refs/heads/master | 2021-09-09T11:54:25.624827 | 2019-06-17T13:03:13 | 2019-06-17T13:03:13 | 191,943,755 | 0 | 0 | null | 2021-09-08T01:04:47 | 2019-06-14T13:00:27 | Python | UTF-8 | Python | false | false | 394 | py | """
WSGI config for gallery project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gallery.settings")
application = get_wsgi_application()
| [
"Doktatech2@gmail.com"
] | Doktatech2@gmail.com |
5ce0a9c5a2771d2c02defab056fef6f9f18b954d | 425348ff17e6dc9bf5e822378aa4c06260ec2e33 | /groceries_fwdtest.py | f4a2664871278fde506122239eebfdbc8f61fc05 | [] | no_license | themathgeek13/robotautonomyproject2020 | 002ff2d8b9a058f99611dd3c90086f16f7720660 | 2e09821ada48872b65d33710d5364e1bca8eedea | refs/heads/master | 2022-04-23T19:11:27.451491 | 2020-04-19T19:00:29 | 2020-04-19T19:00:29 | 254,685,153 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 6,171 | py | import numpy as np
import scipy as sp
from quaternion import from_rotation_matrix, quaternion
from rlbench.environment import Environment
from rlbench.action_modes import ArmActionMode, ActionMode
from rlbench.observation_config import ObservationConfig
from rlbench.tasks import *
from perception import CameraIntrinsics, DepthImage
def skew(x):
return np.array([[0, -x[2], x[1]],
[x[2], 0, -x[0]],
[-x[1], x[0], 0]])
def sample_normal_pose(pos_scale, rot_scale):
'''
Samples a 6D pose from a zero-mean isotropic normal distribution
'''
pos = np.random.normal(scale=pos_scale)
eps = skew(np.random.normal(scale=rot_scale))
R = sp.linalg.expm(eps)
quat_wxyz = from_rotation_matrix(R)
return pos, quat_wxyz
class RandomAgent:
def act(self, obs):
delta_pos = [(np.random.rand() * 2 - 1) * 0.005, 0, 0]
delta_quat = [0, 0, 0, 1] # xyzw
gripper_pos = [np.random.rand() > 0.5]
return delta_pos + delta_quat + gripper_pos
class NoisyObjectPoseSensor:
def __init__(self, env):
self._env = env
self._pos_scale = [0.005] * 3
self._rot_scale = [0.01] * 3
def get_poses(self):
objs = self._env._scene._active_task.get_base().get_objects_in_tree(exclude_base=True, first_generation_only=False)
obj_poses = {}
for obj in objs:
name = obj.get_name()
pose = obj.get_pose()
pos, quat_wxyz = sample_normal_pose(self._pos_scale, self._rot_scale)
gt_quat_wxyz = quaternion(pose[6], pose[3], pose[4], pose[5])
perturbed_quat_wxyz = quat_wxyz * gt_quat_wxyz
pose[:3] += pos
pose[3:] = [perturbed_quat_wxyz.x, perturbed_quat_wxyz.y, perturbed_quat_wxyz.z, perturbed_quat_wxyz.w]
obj_poses[name] = pose
return obj_poses
if __name__ == "__main__":
action_mode = ActionMode(ArmActionMode.ABS_EE_POSE_PLAN) # See rlbench/action_modes.py for other action modes
env = Environment(action_mode, '', ObservationConfig(), False)
task = env.get_task(PutGroceriesInCupboard) # available tasks: EmptyContainer, PlayJenga, PutGroceriesInCupboard, SetTheTable
agent = RandomAgent()
obj_pose_sensor = NoisyObjectPoseSensor(env)
descriptions, obs = task.reset()
print(descriptions)
# Set all the object poses (create function because it might change if you drop something)
def coffee():
return obj_pose_sensor.get_poses()["coffee_grasp_point"]
def chocolate_jello():
return obj_pose_sensor.get_poses()["chocolate_jello_grasp_point"]
def crackers():
return obj_pose_sensor.get_poses()["crackers_grasp_point"]
def mustard():
return obj_pose_sensor.get_poses()["mustard_grasp_point"]
def soup():
return obj_pose_sensor.get_poses()["soup_grasp_point"]
def spam():
return obj_pose_sensor.get_poses()["spam_grasp_point"]
def strawberry_jello():
return obj_pose_sensor.get_poses()["strawberry_jello_grasp_point"]
# Set all the waypoints
waypoint1 = obj_pose_sensor.get_poses()["waypoint1"]
waypoint2 = obj_pose_sensor.get_poses()["waypoint2"]
waypoint3 = obj_pose_sensor.get_poses()["waypoint3"] # just outside cupboard
waypoint4 = obj_pose_sensor.get_poses()["waypoint4"] # lower shelf of cupboard
startpose = obs.gripper_pose
# Go to location above the center of workspace (waypoint 2)
#task.step(waypoint2.tolist()+[1])
# Now go to crackers
task.step(crackers().tolist()+[1])
# Now close the gripper to try picking it up (close gripper)
task.step((obs.gripper_pose).tolist()+[0])
# Now move to waypoint 2 then waypoint 3 once again (but keep the gripper closed)
#task.step(waypoint2.tolist()+[0])
task.step(waypoint3.tolist()+[0])
task.step(waypoint4.tolist()+[0])
# Now drop it.
task.step((obs.gripper_pose).tolist()+[1])
#######################################################################
# Now move back to startpose
task.step(waypoint3.tolist()+[1])
#task.step(startpose.tolist()+[1])
# Now pick up coffee
task.step(coffee().tolist()+[1])
# Now close the gripper to try picking it up (close gripper)
task.step((obs.gripper_pose).tolist()+[0])
# Now move to waypoint 2 once again (but keep the gripper closed)
#task.step(waypoint2.tolist()+[0])
task.step(waypoint3.tolist()+[0])
task.step(waypoint4.tolist()+[0])
# Now drop it.
task.step((obs.gripper_pose).tolist()+[1])
######################################################################
# Now move back to waypoint3
task.step(waypoint3.tolist()+[1])
#task.step(startpose.tolist()+[1])
# Now pick up the mustard
task.step(mustard().tolist()+[1])
# Now close the gripper to try picking it up (close gripper)
task.step((obs.gripper_pose).tolist()+[0])
# Now move to waypoint 2 once again (but keep the gripper closed)
#task.step(waypoint2.tolist()+[0])
task.step(waypoint3.tolist()+[0])
task.step(waypoint4.tolist()+[0])
# Now drop it.
task.step((obs.gripper_pose).tolist()+[1])
######################################################################
# Now move back to waypoint3
task.step(waypoint3.tolist()+[1])
#task.step(startpose.tolist()+[1])
# Now pick up the spam
task.step(spam().tolist()+[1])
# Now close the gripper to try picking it up (close gripper)
task.step((obs.gripper_pose).tolist()+[0])
# Now move to waypoint 2 once again (but keep the gripper closed)
#task.step(waypoint2.tolist()+[0])
task.step(waypoint3.tolist()+[0])
task.step(waypoint4.tolist()+[0])
# Now drop it.
task.step((obs.gripper_pose).tolist()+[1])
######################################################################
# Now move back to waypoint3
task.step(waypoint3.tolist()+[1])
#task.step(startpose.tolist()+[1])
# Now pick up the strawberry jello
task.step(strawberry_jello().tolist()+[1])
# Now close the gripper to try picking it up (close gripper)
task.step((obs.gripper_pose).tolist()+[0])
# Now move to waypoint 2 once again (but keep the gripper closed)
#task.step(waypoint2.tolist()+[0])
task.step(waypoint3.tolist()+[0])
task.step(waypoint4.tolist()+[0])
# Now drop it.
task.step((obs.gripper_pose).tolist()+[1])
env.shutdown()
| [
"themathgeek13@gmail.com"
] | themathgeek13@gmail.com |
61448bc81242a735d68558bf06e984de2a08c430 | 5e5b1a6cb0d3afe2c0b8e8ff36b53279c453b81b | /POC/POC/urls.py | ea1bc30c604473692e0068cacf39a74b4058abc1 | [] | no_license | akshayratimani/GITProjects | a422addd407680097d14fbc1e5e4c78c8a81b96a | 1ba9e272c11693337b7b295ab9dedcba75904525 | refs/heads/master | 2022-12-21T09:06:37.344947 | 2019-08-22T04:56:57 | 2019-08-22T04:56:57 | 195,341,518 | 0 | 0 | null | 2022-12-10T05:34:59 | 2019-07-05T05:00:40 | Python | UTF-8 | Python | false | false | 792 | py | """POC URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('', include('LogReg.urls')),
path('admin/', admin.site.urls),
]
| [
"akshay.ratimani@gmail.com"
] | akshay.ratimani@gmail.com |
ea6229eb0f4297817a25182b65275423940a989f | 425ef46a6f6a3fd799e059eeacda10068976a282 | /menu/migrations/0002_auto_20210605_2027.py | e8a60db0f6704a40945aa6dad772dcaf8c71bd1e | [] | no_license | dervin48/Final2021 | 6ac6365c9e2dbc31945afd7e5bf5a3ca5a97f439 | 30360210a3cdf9b5119b02af614a6421fb78c82a | refs/heads/master | 2023-06-28T22:24:35.515353 | 2021-07-28T03:39:59 | 2021-07-28T03:39:59 | 390,199,922 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 574 | py | # Generated by Django 3.2.3 on 2021-06-06 02:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('menu', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='menu',
name='platillo',
),
migrations.AddField(
model_name='menu',
name='descripcion',
field=models.CharField(default=1, max_length=50, verbose_name='descripcion'),
preserve_default=False,
),
]
| [
"dervin48@gmail.com"
] | dervin48@gmail.com |
2e9d12a6e7190233efa49503cb1d489948f47589 | 451aa47b80ce89318d74113a1dfea781f79af441 | /onsset/funcs.py | dc4b17a6dbbf24dd39c27c4307cd744e183e53e2 | [
"MIT"
] | permissive | Somalia-Electrification-Platform/onsset | 79f08d837aea9abde6e5956c56c78d6db27f31b2 | 64f05ce862e2918b17869da3534d35ef3a5b401a | refs/heads/Somalia | 2023-03-30T23:54:43.831492 | 2021-03-23T10:42:17 | 2021-03-23T10:42:17 | 299,992,794 | 0 | 1 | NOASSERTION | 2021-03-22T10:19:37 | 2020-09-30T17:06:48 | Python | UTF-8 | Python | false | false | 10,014 | py | from onsset import *
import matplotlib.pylab as plt
import seaborn as sns
def tech_specifications(discount_rate, grid_generation_cost, grid_power_plants_capital_cost, grid_losses,
mg_hydro_capital_cost, sa_pv_capital_cost_1, sa_pv_capital_cost_2, sa_pv_capital_cost_3,
sa_pv_capital_cost_4, sa_pv_capital_cost_5, sa_pv_life, hv_line_capacity, hv_line_cost,
mv_line_cost, mv_line_capacity, lv_line_capacity, lv_line_cost,
lv_line_max_length, distribution_losses, distribution_om, hv_mv_transformer_cost,
mv_lv_transformer_cost, service_transformer_type, service_transformer_cost,
max_nodes_per_serv_transformer, connection_cost_per_household, hydro_life,
start_year, end_year):
# Mini-grid hydro costs
mg_hydro_calc = Technology(om_of_td_lines=distribution_om,
distribution_losses=distribution_losses,
connection_cost_per_hh=connection_cost_per_household,
base_to_peak_load_ratio=0.85,
capacity_factor=0.5,
tech_life=hydro_life,
capital_cost={float("inf"): mg_hydro_capital_cost},
om_costs=0.02,
)
# Stand-alone PV costs
sa_pv_calc = Technology(base_to_peak_load_ratio=0.9,
tech_life=sa_pv_life,
om_costs=0.075,
capital_cost={float("inf"): sa_pv_capital_cost_5,
0.2: sa_pv_capital_cost_4,
0.08: sa_pv_capital_cost_3,
0.03: sa_pv_capital_cost_2,
0.006: sa_pv_capital_cost_1},
standalone=True
)
mg_pv_hybrid_calc = Technology(om_of_td_lines=distribution_om,
distribution_losses=distribution_losses,
connection_cost_per_hh=connection_cost_per_household,
capacity_factor=0.5,
tech_life=30,
mini_grid=True,
hybrid=True)
mg_wind_hybrid_calc = Technology(om_of_td_lines=distribution_om,
distribution_losses=distribution_losses,
connection_cost_per_hh=connection_cost_per_household,
capacity_factor=0.5,
tech_life=30,
mini_grid=True,
hybrid=True)
Technology.set_default_values(base_year=start_year,
start_year=start_year,
end_year=end_year,
discount_rate=discount_rate,
hv_line_type=hv_line_capacity,
hv_line_cost=hv_line_cost,
mv_line_type=mv_line_capacity,
mv_line_amperage_limit=8.0,
mv_line_cost=mv_line_cost,
lv_line_type=lv_line_capacity,
lv_line_cost=lv_line_cost,
lv_line_max_length=lv_line_max_length,
service_transf_type=service_transformer_type,
service_transf_cost=service_transformer_cost,
max_nodes_per_serv_trans=max_nodes_per_serv_transformer,
mv_lv_sub_station_cost=mv_lv_transformer_cost,
mv_mv_sub_station_cost=mv_lv_transformer_cost,
hv_lv_sub_station_cost=hv_mv_transformer_cost,
hv_mv_sub_station_cost=hv_mv_transformer_cost)
return mg_hydro_calc, sa_pv_calc, mg_pv_hybrid_calc, mg_wind_hybrid_calc
def summary_table_calc(self, yearsofanalysis, option, intensification_dist):
elements = []
for year in yearsofanalysis:
elements.append("Population{}".format(year))
elements.append("NewConnections{}".format(year))
elements.append("Capacity{}".format(year))
elements.append("Investment{}".format(year))
if (option == 1) & (intensification_dist > 0):
techs = ["Expanded_MG", "SA_PV", "MG_PV_Hybrid", "MG_Wind_Hybrid", "MG_Hydro"]
codes = [2, 3, 8, 9, 7]
else:
techs = ["Grid", "SA_PV", "MG_PV_Hybrid", "MG_Wind_Hybrid", "MG_Hydro"]
codes = [1, 3, 8, 9, 7]
sumtechs = []
for year in yearsofanalysis:
sumtechs.extend(["Population{}".format(year) + t for t in techs])
sumtechs.extend(["NewConnections{}".format(year) + t for t in techs])
sumtechs.extend(["Capacity{}".format(year) + t for t in techs])
sumtechs.extend(["Investment{}".format(year) + t for t in techs])
summary = pd.Series(index=sumtechs, name='country')
for year in yearsofanalysis:
code_index = 0
for t in techs:
code = codes[code_index]
code_index += 1
summary.loc["Population{}".format(year) + t] = self.loc[(self[SET_ELEC_FINAL_CODE + '{}'.format(year)] == code) & (self[SET_ELEC_FINAL_CODE + '{}'.format(year)] < 99), SET_POP + '{}'.format(year)].sum() / 1000000
summary.loc["NewConnections{}".format(year) + t] = self.loc[(self[SET_ELEC_FINAL_CODE + '{}'.format(year)] == code) & (self[SET_ELEC_FINAL_CODE + '{}'.format(year)] < 99), SET_NEW_CONNECTIONS + '{}'.format(year)].sum() /1000000
summary.loc["Capacity{}".format(year) + t] = self.loc[(self[SET_ELEC_FINAL_CODE + '{}'.format(year)] == code) & (self[SET_ELEC_FINAL_CODE + '{}'.format(year)] < 99), SET_NEW_CAPACITY + '{}'.format(year)].sum() / 1000
summary.loc["Investment{}".format(year) + t] = self.loc[(self[SET_ELEC_FINAL_CODE + '{}'.format(year)] == code) & (self[SET_ELEC_FINAL_CODE + '{}'.format(year)] < 99), SET_INVESTMENT_COST + '{}'.format(year)].sum()
code += 1
index = techs + ['Total']
columns = []
for year in yearsofanalysis:
columns.append("Population{} (Million)".format(year))
columns.append("NewConnections{} (Million)".format(year))
columns.append("Capacity{} (MW)".format(year))
columns.append("Investment{} (million USD)".format(year))
columns.append("NewConnectionsTotal (Million)")
columns.append("CapacityTotal (MW)")
columns.append("InvestmentTotal (million USD)")
summary_table = pd.DataFrame(index=index, columns=columns)
summary_table[columns[0]] = summary.iloc[0:5].tolist() + [summary.iloc[0:5].sum()]
summary_table[columns[1]] = summary.iloc[5:10].tolist() + [summary.iloc[5:10].sum()]
summary_table[columns[2]] = summary.iloc[10:15].tolist() + [summary.iloc[10:15].sum()]
summary_table[columns[3]] = [round(x / 1e4) / 1e2 for x in summary.iloc[15:20].astype(float).tolist()] + [round(summary.iloc[15:20].sum() / 1e4) / 1e2]
summary_table[columns[4]] = summary.iloc[20:25].tolist() + [summary.iloc[20:25].sum()]
summary_table[columns[5]] = summary.iloc[25:30].tolist() + [summary.iloc[25:30].sum()]
summary_table[columns[6]] = summary.iloc[30:35].tolist() + [summary.iloc[30:35].sum()]
summary_table[columns[7]] = [round(x / 1e4) / 1e2 for x in summary.iloc[35:40].astype(float).tolist()] + [round(summary.iloc[35:40].sum() / 1e4) / 1e2]
summary_table[columns[8]] = summary_table[columns[1]] + summary_table[columns[5]]
summary_table[columns[9]] = summary_table[columns[2]] + summary_table[columns[6]]
summary_table[columns[10]] = summary_table[columns[3]] + summary_table[columns[7]]
return summary_table
def summary_plots(summary_table, yearsofanalysis):
colors = ['#73B2FF', '#FFD38C', '#FE5931', '#A56A56', '#00518E']
techs = ["Grid", "SA_PV", "MG_PV_Hybrid", "MG_Wind_Hybrid", "MG_Hydro"]
techs_colors = dict(zip(techs, colors))
columns = []
for year in yearsofanalysis:
columns.append("Population{} (Million)".format(year))
columns.append("NewConnections{} (Million)".format(year))
columns.append("Capacity{} (MW)".format(year))
columns.append("Investment{} (million USD)".format(year))
columns.append("NewConnectionsTotal (Million)")
columns.append("CapacityTotal (MW)")
columns.append("InvestmentTotal (million USD)")
summary_plot = summary_table.drop(labels='Total', axis=0)
fig_size = [15, 15]
font_size = 8
plt.rcParams["figure.figsize"] = fig_size
f, axarr = plt.subplots(2, 2)
fig_size = [15, 15]
font_size = 8
plt.rcParams["figure.figsize"] = fig_size
sns.barplot(x=summary_plot.index.tolist(), y=columns[4], data=summary_plot, ax=axarr[0, 0], palette=colors)
axarr[0, 0].set_ylabel(columns[4], fontsize=2 * font_size)
axarr[0, 0].tick_params(labelsize=font_size)
sns.barplot(x=summary_plot.index.tolist(), y=columns[8], data=summary_plot, ax=axarr[0, 1], palette=colors)
axarr[0, 1].set_ylabel(columns[5], fontsize=2 * font_size)
axarr[0, 1].tick_params(labelsize=font_size)
sns.barplot(x=summary_plot.index.tolist(), y=columns[9], data=summary_plot, ax=axarr[1, 0], palette=colors)
axarr[1, 0].set_ylabel(columns[6], fontsize=2 * font_size)
axarr[1, 0].tick_params(labelsize=font_size)
sns.barplot(x=summary_plot.index.tolist(), y=columns[10], data=summary_plot, ax=axarr[1, 1], palette=colors)
axarr[1, 1].set_ylabel(columns[7], fontsize=2 * font_size)
axarr[1, 1].tick_params(labelsize=font_size)
return summary_plot
| [
"asahl@UG.KTH.SE"
] | asahl@UG.KTH.SE |
64ee037a348f62ede96c0c96f074d48d1350d374 | 6b5c6d0258833d706cbcedc4499879bef659aeb4 | /tools/__init__.py | f5161f39b10fef2058eefc05f340a0aebcc33120 | [] | no_license | udjenweb/online_courses | ce80474a11d2dbb7c45e34597dd2ce79e6462074 | 515307de0ce3997610b150f361f88600fc8799bd | refs/heads/master | 2021-01-21T20:38:50.688646 | 2017-05-24T08:18:00 | 2017-05-24T08:18:00 | 92,264,065 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 423 | py | # coding: utf-8
from .eve.eve_sqlalchemy_fix import EveSQLAlchemy
from .eve.domains import Domains
from .aditional.current_object import CurrentObject
from .http.response_standard_json import (
response_data_error,
response_data_success,
)
from .aditional.console import draw
from .aditional.loggingconf import (
LOGGING_CONF_DEFAULT,
FORMAT_DEFAULT,
create_file_handler,
create_console_handler,
) | [
"udjen.web@gmail.com"
] | udjen.web@gmail.com |
caf01fee84b8f19a586c8dadd8b3aa0ec0be2030 | be3f8a09a5b8859fffa07673cdfd17723e843b86 | /src/Socket_Control/coordinate_collation_interface.py | 61179a2af41d390603fb1d43dad2348078877ed4 | [
"MIT"
] | permissive | SamKaiYang/2019_Hiwin_Shaking | 88646a0a9ff87dfe96a3fb90ede44602bd413d53 | d599f8c87dc4da89eae266990d12eb3a8b0f3e16 | refs/heads/master | 2020-07-22T13:25:21.063822 | 2019-09-09T03:29:11 | 2019-09-09T03:29:11 | 207,216,404 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 7,413 | py | #!/usr/bin/env python3
# license removed for brevity
#encoding:utf-8
import tkinter as tk
import shake_strategy_trigger as shake_trig
import shake_strategy_content as shake_cont
# interface for collation
# =======================================================================
# =23/07/2019:add above pos_collation =
# =======================================================================
collate_speed=15
def LeftCollate():
shake_cont.InitData(shake_cont.delt_z)
# shake_cont.Left(shake_cont.Animation_Action)
shake_cont.Left(shake_trig.Hiwin_Solo_Action)
shake_cont.InitData(-shake_cont.delt_z)
def RightCollate():
shake_cont.InitData(shake_cont.delt_z)
# shake_cont.Right(shake_cont.Animation_Action)
shake_cont.Right(shake_trig.Hiwin_Solo_Action)
shake_cont.InitData(-shake_cont.delt_z)
def ArmTestAct():
shake_cont.InitData(shake_cont.delt_z)
# shake_cont.ArmTest(shake_cont.Animation_Action)
shake_cont.ArmTest(shake_trig.Hiwin_Action)
shake_cont.InitData(-shake_cont.delt_z)
def CupCollate():
global collate_speed
shake_cont.InitData(shake_cont.delt_z)
# Action=shake_cont.Animation_Action
Action=shake_trig.Hiwin_Solo_Action
shake_cont.SpeedModeToggle(1)
Action.ArmMove(shake_cont.Above_Shake_Pos,collate_speed,shake_cont.gp_stop,'移動至雪克杯上方')
Action.ArmMove(shake_cont.Pre_Grip_Pos,collate_speed,shake_cont.gp_stop,'轉動')
Action.ArmMove(shake_cont.Grip_Shake_For_Pour_Pos,collate_speed,shake_cont.gp_stop,'移動至雪克杯')
tk.messagebox.showinfo(message='Shake OK?')
Action.GripCtrl(shake_cont.Grip_Shake_For_Pour_Pos,collate_speed,shake_cont.gp_tight_catch,'移動至雪克杯','夾住雪克杯')
tk.messagebox.showinfo(message='Shake OK?')
Action.ArmMove(shake_cont.Lift_Up_Full_Shake_Pos,collate_speed,shake_cont.gp_stop,'移動至雪克杯空位上方')
Action.ArmMove(shake_cont.Pour_Product_Ready_Pos,collate_speed,shake_cont.gp_stop,'準備倒飲料至手搖杯')
Action.ArmMove(shake_cont.Pour_Product_Pour_Pos,collate_speed,shake_cont.gp_stop,'倒飲料至手搖杯')
Action.ArmMove(shake_cont.Pour_Product_Down_Pos,collate_speed,shake_cont.gp_stop,'向下移動')
tk.messagebox.showinfo(message='Cup OK?')
Action.ArmMove(shake_cont.Pour_Product_Pour_Pos,collate_speed,shake_cont.gp_stop,'向上移動')
Action.ArmMove(shake_cont.Pour_Product_Ready_Pos,collate_speed,shake_cont.gp_stop,'倒飲料至手搖杯結束')
Action.ArmMove(shake_cont.Lift_Up_Full_Shake_Pos,collate_speed,shake_cont.gp_stop,'移動至雪克杯空位上方')
Action.GripCtrl(shake_cont.Grip_Shake_For_Pour_Pos,collate_speed,shake_cont.gp_open,'放下雪克杯','鬆開雪克杯')
tk.messagebox.showinfo(message='Cup OK?')
Action.ArmMove(shake_cont.Pre_Grip_Pos,collate_speed,shake_cont.gp_stop,'移動至雪克杯上方')
Action.ArmMove(shake_cont.Above_Shake_Pos,collate_speed,shake_cont.gp_stop,'轉動')
tk.messagebox.showinfo(message='Collation Finished!')
Action.ArmMove(shake_cont.Home_Pos,collate_speed,shake_cont.gp_stop,'移動至原位')
shake_cont.InitData(-shake_cont.delt_z)
def LidCollate():
shake_cont.InitData(shake_cont.delt_z)
# Action=shake_cont.Animation_Action
Action=shake_trig.Hiwin_Solo_Action
shake_cont.SpeedModeToggle(1)
Action.LimitArmMove(shake_cont.Above_Lid_Pos,collate_speed,5,shake_cont.gp_stop,'移動至雪克杯蓋上方')
Action.GripCtrl(shake_cont.Lid_Pos,collate_speed,shake_cont.gp_tight_catch,'移動至雪克杯蓋','夾住雪克杯蓋')
tk.messagebox.showinfo(message='Lid OK?')
Action.ArmMove(shake_cont.Above_Lid_Pos,collate_speed,shake_cont.gp_stop,'拿起雪克杯蓋')
Action.ArmMove(shake_cont.Above_Shake_Pos,collate_speed,shake_cont.gp_stop,'移動至雪克杯上方')
Action.LimitArmMove(shake_cont.Collate_Lid_Pos,collate_speed,5,shake_cont.gp_stop,'蓋杯蓋')
tk.messagebox.showinfo(message='Lid OK?')
Action.ArmMove(shake_cont.Above_Shake_Pos,collate_speed,shake_cont.gp_stop,'移動至雪克杯上方')
Action.ArmMove(shake_cont.Above_Lid_Pos,collate_speed,shake_cont.gp_stop,'移動至雪克杯蓋上方')
Action.GripCtrl(shake_cont.Lid_Pos,collate_speed//2,shake_cont.gp_open,'放下雪克杯蓋','鬆開雪克杯蓋')
tk.messagebox.showinfo(message='Collation Finished!')
Action.ArmMove(shake_cont.Home_Pos,collate_speed,shake_cont.gp_stop,'移動至原位')
shake_cont.InitData(-shake_cont.delt_z)
def PosCollate():
shake_cont.InitData(shake_cont.delt_z)
pos_list = [shake_cont.Home_Pos,shake_cont.Full_Ice_Pos,shake_cont.Above_Ice_Pos,
shake_cont.Above_Duo_Duo_Pos,shake_cont.Duo_Duo_Pos,shake_cont.Above_Duo_Duo_Pos,
shake_cont.Above_Dong_Gua_T_Pos,shake_cont.Dong_Gua_T_Pos,shake_cont.Above_Dong_Gua_T_Pos,
shake_cont.Above_Blace_T_Pos,shake_cont.Blace_T_Pos,shake_cont.Above_Blace_T_Pos,
shake_cont.Above_Green_T_Pos,shake_cont.Green_T_Pos,shake_cont.Above_Green_T_Pos,
shake_cont.Above_Lid_Pos,shake_cont.Back_Sugar_Pos,shake_cont.Above_Sugar_Unspined_Pos,
shake_cont.Above_Sugar_Unspined_Pos,shake_cont.Back_Sugar_Pos]
pause_list=[1,4,7,10,13,18]
shake_cont.SpeedModeToggle(1)
for i in range(len(pos_list)):
shake_trig.Hiwin_Action.ArmMove(pos_list[i],collate_speed,0,'test point({}/{})'.format(i+1,len(pos_list)))
# shake_cont.Animation_Action.ArmMove(pos_list[i],20,0,'test point({}/{})'.format(i+1,len(pos_list)))
if i in pause_list:
tk.messagebox.showinfo(message='Next Point?')
tk.messagebox.showinfo(message='Collation Finished!')
# shake_cont.Home(shake_cont.Animation_Action)
shake_cont.Home(shake_trig.Hiwin_Action)
shake_cont.InitData(-shake_cont.delt_z)
def Collation():
collate = tk.Toplevel()
collate.title('Coordinate Collation')
collate.geometry('620x355')
collate.wm_attributes("-topmost",1)
def CollateOK():
collate.destroy()
# shake_cont.Home(shake_cont.Animation_Action)
shake_cont.Home(shake_trig.Hiwin_Solo_Action)
arm_test = tk.Button(collate,text='Arm Test',font=('Arial', 15),width=45,height=2,command=ArmTestAct)
arm_test.place(x=50,y=35)
left_collate = tk.Button(collate,text='Left',font=('Arial', 15),width=19,height=2,command=LeftCollate)
left_collate.place(x=50,y=110)
right_collate = tk.Button(collate,text='Right',font=('Arial', 15),width=19,height=2,command=RightCollate)
right_collate.place(x=335,y=110)
pos_collate = tk.Button(collate,text='Pos',font=('Arial', 15),width=12,height=2,command=PosCollate)
pos_collate.place(x=50,y=185)
cup_collate = tk.Button(collate,text='Cup',font=('Arial', 15),width=12,height=2,command=CupCollate)
cup_collate.place(x=230,y=185)
lid_collate = tk.Button(collate,text='Lid',font=('Arial', 15),width=12,height=2,command=LidCollate)
lid_collate.place(x=410,y=185)
collate_ok = tk.Button(collate,text='OK',font=('Arial', 15),width=45,height=2,command=CollateOK)
collate_ok.place(x=50,y=260)
def BackHome():
collate.destroy()
# shake_cont.Home(shake_cont.Animation_Action)
shake_cont.Home(shake_trig.Hiwin_Solo_Action)
collate.protocol('WM_DELETE_WINDOW', BackHome)
collate.mainloop() | [
"tt00621212@gmail.com"
] | tt00621212@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.