blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
281
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
6
116
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
313 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
18.2k
668M
star_events_count
int64
0
102k
fork_events_count
int64
0
38.2k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
107 values
src_encoding
stringclasses
20 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
4
6.02M
extension
stringclasses
78 values
content
stringlengths
2
6.02M
authors
listlengths
1
1
author
stringlengths
0
175
6f1626422bd5fe30a5d69e1a6033406a0eb15da8
74d962367e299eb2ffb827d78e88aea76c3ebabc
/manage.py
6c8e8d2a9587f74e95b0d56e701e5076f0a97dec
[]
no_license
PauloViOS/flordodia
8b40105f78ce5d4ff73b4a5e9fe4ef2402fc6c73
b10ca10b882aba785a4ffd2e6a51d2cc16f59209
refs/heads/master
2023-03-06T16:14:59.815158
2021-02-23T13:55:28
2021-02-23T13:55:28
337,239,739
0
0
null
null
null
null
UTF-8
Python
false
false
541
py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flordodia.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv)
[ "paulo.santos@buser.com.br" ]
paulo.santos@buser.com.br
380e413c789d06c1d8c1e6b1304c9a37e8b030e3
ec852d0c26ca2ebba40054cd2668db0ee990af69
/2.py
1a0edb5dff657f4e37b3a0835b97627531f12924
[]
no_license
sadilet/xgboost-predictor
61ecdd951d275f3e69a3741f1623c52c11cf4ed2
e31c4bcdce995a7c1ffa3c4eaf8a2b7fb65b5861
refs/heads/master
2023-02-06T13:38:37.149240
2020-12-21T00:54:50
2020-12-21T00:54:50
321,763,828
0
0
null
null
null
null
UTF-8
Python
false
false
1,292
py
import datetime import xgboost import numpy as np import xgboost_predictor if __name__ == "__main__": data = [] with open("tests/resources/data/agaricus.txt.0.test", "r") as f: for line in f.readlines(): row = [0] * 126 for i in line.split(" ")[1:]: f, v = i.split(":") row[int(f)] = int(v) data.append(tuple(row)) data = tuple(data) booster1 = xgboost.Booster({"nthread": 1}) booster1.load_model('tests/resources/model/gblinear/v40/binary-logistic.model') data1 = xgboost.DMatrix(np.array(data, dtype=np.float32)) start = datetime.datetime.now() a = booster1.predict(data1) print(datetime.datetime.now() - start) booster2 = xgboost_predictor.load_model('tests/resources/model/gblinear/v40/binary-logistic.model') data2 = np.array(data, dtype=np.float32) start = datetime.datetime.now() b = booster2.predict_many(data2) print((datetime.datetime.now() - start)) print(a) print(b[:10]) print(len(b)) """ [1,2,3,4, 1,2,3,4, 1,2,3,4] (0 * 3) + 0 = 0 (0 * 3) + 1 = 1 (0 * 3) + 2 = 2 (0 * 3) + 3 = 3 (1 * 3) + 0 = 3 + (1 * 3) + 1 = 4 (1 * 3) + 2 = 5 (1 * 3) + 3 = 6 (2 * 3) + 0 = 6 + 2 (2 * 3) + 1 = 7 (2 * 3) + 2 = 8 (2 * 3) + 3 = 9 """
[ "wallstbrok@gmail.com" ]
wallstbrok@gmail.com
6bfd1c5183aa706f998839766d337607080cb8bd
50a4423ce551b125fc062d84077a8457fbe21be3
/work_spider/util/langconv/zh_wiki.py
c831fae4f9a61b5eb11109d04dfbbb88d167c180
[]
no_license
zhenglanfang/spider_project
15c247b0e14803d40fca17a65219a0fc4245279d
7108662aafff9f971928e4acda7781ac7b76d250
refs/heads/master
2021-01-25T11:28:07.782535
2018-07-04T02:21:40
2018-07-04T02:21:40
123,399,309
0
1
null
null
null
null
UTF-8
Python
false
false
143,277
py
# -*- coding: utf-8 -*- # copy fom wikipedia zh2Hant = { '铺':'舖', '呆': '獃', "打印机": "印表機", '帮助文件': '說明檔案', "画": "畫", "板": "板", "表": "表", "才": "才", "丑": "醜", "出": "出", "淀": "澱", "冬": "冬", "范": "範", "丰": "豐", "刮": "刮", "后": "後", "胡": "胡", "回": "回", "伙": "夥", "姜": "薑", "借": "借", "克": "克", "困": "困", "漓": "漓", "里": "里", "帘": "簾", "霉": "霉", "面": "面", "蔑": "蔑", "千": "千", "秋": "秋", "松": "松", "咸": "咸", "向": "向", "余": "餘", "郁": "鬱", "御": "御", "愿": "願", "云": "雲", "芸": "芸", "沄": "沄", "致": "致", "制": "制", "朱": "朱", "筑": "築", "准": "準", "厂": "廠", "广": "廣", "辟": "闢", "别": "別", "卜": "卜", "沈": "沈", "冲": "沖", "种": "種", "虫": "蟲", "担": "擔", "党": "黨", "斗": "鬥", "儿": "兒", "干": "乾", "谷": "谷", "柜": "櫃", "合": "合", "划": "劃", "坏": "壞", "几": "幾", "系": "系", "家": "家", "价": "價", "据": "據", "卷": "捲", "适": "適", "蜡": "蠟", "腊": "臘", "了": "了", "累": "累", "么": "麽", "蒙": "蒙", "万": "萬", "宁": "寧", "朴": "樸", "苹": "蘋", "仆": "僕", "曲": "曲", "确": "確", "舍": "舍", "胜": "勝", "术": "術", "台": "台", "体": "體", "涂": "塗", "叶": "葉", "吁": "吁", "旋": "旋", "佣": "傭", "与": "與", "折": "折", "征": "徵", "症": "症", "恶": "惡", "发": "發", "复": "復", "汇": "匯", "获": "獲", "饥": "飢", "尽": "盡", "历": "歷", "卤": "滷", "弥": "彌", "签": "簽", "纤": "纖", "苏": "蘇", "坛": "壇", "团": "團", "须": "須", "脏": "臟", "只": "只", "钟": "鐘", "药": "藥", "同": "同", "志": "志", "杯": "杯", "岳": "岳", "布": "布", "当": "當", "吊": "弔", "仇": "仇", "蕴": "蘊", "线": "線", "为": "為", "产": "產", "众": "眾", "伪": "偽", "凫": "鳧", "厕": "廁", "启": "啟", "墙": "牆", "壳": "殼", "奖": "獎", "妫": "媯", "并": "並", "录": "錄", "悫": "愨", "极": "極", "沩": "溈", "瘘": "瘺", "硷": "鹼", "竖": "豎", "绝": "絕", "绣": "繡", "绦": "絛", "绱": "緔", "绷": "綳", "绿": "綠", "缰": "韁", "苧": "苎", "莼": "蒓", "说": "說", "谣": "謠", "谫": "譾", "赃": "贓", "赍": "齎", "赝": "贗", "酝": "醞", "采": "採", "钩": "鉤", "钵": "缽", "锈": "銹", "锐": "銳", "锨": "杴", "镌": "鐫", "镢": "钁", "阅": "閱", "颓": "頹", "颜": "顏", "骂": "罵", "鲇": "鯰", "鲞": "鯗", "鳄": "鱷", "鸡": "雞", "鹚": "鶿", "荡": "盪", "锤": "錘", "㟆": "㠏", "㛟": "𡞵", "专": "專", "业": "業", "丛": "叢", "东": "東", "丝": "絲", "丢": "丟", "两": "兩", "严": "嚴", "丧": "喪", "个": "個", "临": "臨", "丽": "麗", "举": "舉", "义": "義", "乌": "烏", "乐": "樂", "乔": "喬", "习": "習", "乡": "鄉", "书": "書", "买": "買", "乱": "亂", "争": "爭", "于": "於", "亏": "虧", "亚": "亞", "亩": "畝", "亲": "親", "亵": "褻", "亸": "嚲", "亿": "億", "仅": "僅", "从": "從", "仑": "侖", "仓": "倉", "仪": "儀", "们": "們", "优": "優", "会": "會", "伛": "傴", "伞": "傘", "伟": "偉", "传": "傳", "伣": "俔", "伤": "傷", "伥": "倀", "伦": "倫", "伧": "傖", "伫": "佇", "佥": "僉", "侠": "俠", "侣": "侶", "侥": "僥", "侦": "偵", "侧": "側", "侨": "僑", "侩": "儈", "侪": "儕", "侬": "儂", "俣": "俁", "俦": "儔", "俨": "儼", "俩": "倆", "俪": "儷", "俫": "倈", "俭": "儉", "债": "債", "倾": "傾", "偬": "傯", "偻": "僂", "偾": "僨", "偿": "償", "傥": "儻", "傧": "儐", "储": "儲", "傩": "儺", "㑩": "儸", "兑": "兌", "兖": "兗", "兰": "蘭", "关": "關", "兴": "興", "兹": "茲", "养": "養", "兽": "獸", "冁": "囅", "内": "內", "冈": "岡", "册": "冊", "写": "寫", "军": "軍", "农": "農", "冯": "馮", "决": "決", "况": "況", "冻": "凍", "净": "凈", "凉": "涼", "减": "減", "凑": "湊", "凛": "凜", "凤": "鳳", "凭": "憑", "凯": "凱", "击": "擊", "凿": "鑿", "刍": "芻", "刘": "劉", "则": "則", "刚": "剛", "创": "創", "删": "刪", "刬": "剗", "刭": "剄", "刹": "剎", "刽": "劊", "刿": "劌", "剀": "剴", "剂": "劑", "剐": "剮", "剑": "劍", "剥": "剝", "剧": "劇", "㓥": "劏", "㔉": "劚", "劝": "勸", "办": "辦", "务": "務", "劢": "勱", "动": "動", "励": "勵", "劲": "勁", "劳": "勞", "势": "勢", "勋": "勛", "勚": "勩", "匀": "勻", "匦": "匭", "匮": "匱", "区": "區", "医": "醫", "华": "華", "协": "協", "单": "單", "卖": "賣", "卢": "盧", "卫": "衛", "却": "卻", "厅": "廳", "厉": "厲", "压": "壓", "厌": "厭", "厍": "厙", "厐": "龎", "厘": "釐", "厢": "廂", "厣": "厴", "厦": "廈", "厨": "廚", "厩": "廄", "厮": "廝", "县": "縣", "叁": "叄", "参": "參", "双": "雙", "变": "變", "叙": "敘", "叠": "疊", "号": "號", "叹": "嘆", "叽": "嘰", "吓": "嚇", "吕": "呂", "吗": "嗎", "吣": "唚", "吨": "噸", "听": "聽", "吴": "吳", "呐": "吶", "呒": "嘸", "呓": "囈", "呕": "嘔", "呖": "嚦", "呗": "唄", "员": "員", "呙": "咼", "呛": "嗆", "呜": "嗚", "咏": "詠", "咙": "嚨", "咛": "嚀", "咝": "噝", "咤": "吒", "响": "響", "哑": "啞", "哒": "噠", "哓": "嘵", "哔": "嗶", "哕": "噦", "哗": "嘩", "哙": "噲", "哜": "嚌", "哝": "噥", "哟": "喲", "唛": "嘜", "唝": "嗊", "唠": "嘮", "唡": "啢", "唢": "嗩", "唤": "喚", "啧": "嘖", "啬": "嗇", "啭": "囀", "啮": "嚙", "啴": "嘽", "啸": "嘯", "㖞": "喎", "喷": "噴", "喽": "嘍", "喾": "嚳", "嗫": "囁", "嗳": "噯", "嘘": "噓", "嘤": "嚶", "嘱": "囑", "㖊": "噚", "噜": "嚕", "嚣": "囂", "园": "園", "囱": "囪", "围": "圍", "囵": "圇", "国": "國", "图": "圖", "圆": "圓", "圣": "聖", "圹": "壙", "场": "場", "坂": "阪", "块": "塊", "坚": "堅", "坜": "壢", "坝": "壩", "坞": "塢", "坟": "墳", "坠": "墜", "垄": "壟", "垅": "壠", "垆": "壚", "垒": "壘", "垦": "墾", "垩": "堊", "垫": "墊", "垭": "埡", "垱": "壋", "垲": "塏", "垴": "堖", "埘": "塒", "埙": "塤", "埚": "堝", "埯": "垵", "堑": "塹", "堕": "墮", "𡒄": "壈", "壮": "壯", "声": "聲", "壶": "壺", "壸": "壼", "处": "處", "备": "備", "够": "夠", "头": "頭", "夸": "誇", "夹": "夾", "夺": "奪", "奁": "奩", "奂": "奐", "奋": "奮", "奥": "奧", "奸": "姦", "妆": "妝", "妇": "婦", "妈": "媽", "妩": "嫵", "妪": "嫗", "姗": "姍", "姹": "奼", "娄": "婁", "娅": "婭", "娆": "嬈", "娇": "嬌", "娈": "孌", "娱": "娛", "娲": "媧", "娴": "嫻", "婳": "嫿", "婴": "嬰", "婵": "嬋", "婶": "嬸", "媪": "媼", "嫒": "嬡", "嫔": "嬪", "嫱": "嬙", "嬷": "嬤", "孙": "孫", "学": "學", "孪": "孿", "宝": "寶", "实": "實", "宠": "寵", "审": "審", "宪": "憲", "宫": "宮", "宽": "寬", "宾": "賓", "寝": "寢", "对": "對", "寻": "尋", "导": "導", "寿": "壽", "将": "將", "尔": "爾", "尘": "塵", "尝": "嘗", "尧": "堯", "尴": "尷", "尸": "屍", "层": "層", "屃": "屓", "屉": "屜", "届": "屆", "属": "屬", "屡": "屢", "屦": "屨", "屿": "嶼", "岁": "歲", "岂": "豈", "岖": "嶇", "岗": "崗", "岘": "峴", "岙": "嶴", "岚": "嵐", "岛": "島", "岭": "嶺", "岽": "崬", "岿": "巋", "峄": "嶧", "峡": "峽", "峣": "嶢", "峤": "嶠", "峥": "崢", "峦": "巒", "崂": "嶗", "崃": "崍", "崄": "嶮", "崭": "嶄", "嵘": "嶸", "嵚": "嶔", "嵝": "嶁", "巅": "巔", "巩": "鞏", "巯": "巰", "币": "幣", "帅": "帥", "师": "師", "帏": "幃", "帐": "帳", "帜": "幟", "带": "帶", "帧": "幀", "帮": "幫", "帱": "幬", "帻": "幘", "帼": "幗", "幂": "冪", "庄": "莊", "庆": "慶", "庐": "廬", "庑": "廡", "库": "庫", "应": "應", "庙": "廟", "庞": "龐", "废": "廢", "廪": "廩", "开": "開", "异": "異", "弃": "棄", "弑": "弒", "张": "張", "弪": "弳", "弯": "彎", "弹": "彈", "强": "強", "归": "歸", "彝": "彞", "彦": "彥", "彻": "徹", "径": "徑", "徕": "徠", "忆": "憶", "忏": "懺", "忧": "憂", "忾": "愾", "怀": "懷", "态": "態", "怂": "慫", "怃": "憮", "怄": "慪", "怅": "悵", "怆": "愴", "怜": "憐", "总": "總", "怼": "懟", "怿": "懌", "恋": "戀", "恒": "恆", "恳": "懇", "恸": "慟", "恹": "懨", "恺": "愷", "恻": "惻", "恼": "惱", "恽": "惲", "悦": "悅", "悬": "懸", "悭": "慳", "悮": "悞", "悯": "憫", "惊": "驚", "惧": "懼", "惨": "慘", "惩": "懲", "惫": "憊", "惬": "愜", "惭": "慚", "惮": "憚", "惯": "慣", "愠": "慍", "愤": "憤", "愦": "憒", "慑": "懾", "懑": "懣", "懒": "懶", "懔": "懍", "戆": "戇", "戋": "戔", "戏": "戲", "戗": "戧", "战": "戰", "戬": "戩", "戯": "戱", "户": "戶", "扑": "撲", "执": "執", "扩": "擴", "扪": "捫", "扫": "掃", "扬": "揚", "扰": "擾", "抚": "撫", "抛": "拋", "抟": "摶", "抠": "摳", "抡": "掄", "抢": "搶", "护": "護", "报": "報", "拟": "擬", "拢": "攏", "拣": "揀", "拥": "擁", "拦": "攔", "拧": "擰", "拨": "撥", "择": "擇", "挂": "掛", "挚": "摯", "挛": "攣", "挜": "掗", "挝": "撾", "挞": "撻", "挟": "挾", "挠": "撓", "挡": "擋", "挢": "撟", "挣": "掙", "挤": "擠", "挥": "揮", "挦": "撏", "挽": "輓", "捝": "挩", "捞": "撈", "损": "損", "捡": "撿", "换": "換", "捣": "搗", "掳": "擄", "掴": "摑", "掷": "擲", "掸": "撣", "掺": "摻", "掼": "摜", "揽": "攬", "揾": "搵", "揿": "撳", "搀": "攙", "搁": "擱", "搂": "摟", "搅": "攪", "携": "攜", "摄": "攝", "摅": "攄", "摆": "擺", "摇": "搖", "摈": "擯", "摊": "攤", "撄": "攖", "撑": "撐", "㧑": "撝", "撵": "攆", "撷": "擷", "撸": "擼", "撺": "攛", "㧟": "擓", "擞": "擻", "攒": "攢", "敌": "敵", "敛": "斂", "数": "數", "斋": "齋", "斓": "斕", "斩": "斬", "断": "斷", "无": "無", "旧": "舊", "时": "時", "旷": "曠", "旸": "暘", "昙": "曇", "昼": "晝", "昽": "曨", "显": "顯", "晋": "晉", "晒": "曬", "晓": "曉", "晔": "曄", "晕": "暈", "晖": "暉", "暂": "暫", "暧": "曖", "机": "機", "杀": "殺", "杂": "雜", "权": "權", "杆": "桿", "条": "條", "来": "來", "杨": "楊", "杩": "榪", "杰": "傑", "构": "構", "枞": "樅", "枢": "樞", "枣": "棗", "枥": "櫪", "枧": "梘", "枨": "棖", "枪": "槍", "枫": "楓", "枭": "梟", "柠": "檸", "柽": "檉", "栀": "梔", "栅": "柵", "标": "標", "栈": "棧", "栉": "櫛", "栊": "櫳", "栋": "棟", "栌": "櫨", "栎": "櫟", "栏": "欄", "树": "樹", "栖": "棲", "栗": "慄", "样": "樣", "栾": "欒", "桠": "椏", "桡": "橈", "桢": "楨", "档": "檔", "桤": "榿", "桥": "橋", "桦": "樺", "桧": "檜", "桨": "槳", "桩": "樁", "梦": "夢", "梼": "檮", "梾": "棶", "梿": "槤", "检": "檢", "棁": "梲", "棂": "欞", "椁": "槨", "椟": "櫝", "椠": "槧", "椤": "欏", "椭": "橢", "楼": "樓", "榄": "欖", "榅": "榲", "榇": "櫬", "榈": "櫚", "榉": "櫸", "槚": "檟", "槛": "檻", "槟": "檳", "槠": "櫧", "横": "橫", "樯": "檣", "樱": "櫻", "橥": "櫫", "橱": "櫥", "橹": "櫓", "橼": "櫞", "檩": "檁", "欢": "歡", "欤": "歟", "欧": "歐", "歼": "殲", "殁": "歿", "殇": "殤", "残": "殘", "殒": "殞", "殓": "殮", "殚": "殫", "殡": "殯", "㱮": "殨", "㱩": "殰", "殴": "毆", "毁": "毀", "毂": "轂", "毕": "畢", "毙": "斃", "毡": "氈", "毵": "毿", "氇": "氌", "气": "氣", "氢": "氫", "氩": "氬", "氲": "氳", "汉": "漢", "汤": "湯", "汹": "洶", "沟": "溝", "没": "沒", "沣": "灃", "沤": "漚", "沥": "瀝", "沦": "淪", "沧": "滄", "沪": "滬", "泞": "濘", "注": "註", "泪": "淚", "泶": "澩", "泷": "瀧", "泸": "瀘", "泺": "濼", "泻": "瀉", "泼": "潑", "泽": "澤", "泾": "涇", "洁": "潔", "洒": "灑", "洼": "窪", "浃": "浹", "浅": "淺", "浆": "漿", "浇": "澆", "浈": "湞", "浊": "濁", "测": "測", "浍": "澮", "济": "濟", "浏": "瀏", "浐": "滻", "浑": "渾", "浒": "滸", "浓": "濃", "浔": "潯", "涛": "濤", "涝": "澇", "涞": "淶", "涟": "漣", "涠": "潿", "涡": "渦", "涣": "渙", "涤": "滌", "润": "潤", "涧": "澗", "涨": "漲", "涩": "澀", "渊": "淵", "渌": "淥", "渍": "漬", "渎": "瀆", "渐": "漸", "渑": "澠", "渔": "漁", "渖": "瀋", "渗": "滲", "温": "溫", "湾": "灣", "湿": "濕", "溃": "潰", "溅": "濺", "溆": "漵", "滗": "潷", "滚": "滾", "滞": "滯", "滟": "灧", "滠": "灄", "满": "滿", "滢": "瀅", "滤": "濾", "滥": "濫", "滦": "灤", "滨": "濱", "滩": "灘", "滪": "澦", "漤": "灠", "潆": "瀠", "潇": "瀟", "潋": "瀲", "潍": "濰", "潜": "潛", "潴": "瀦", "澜": "瀾", "濑": "瀨", "濒": "瀕", "㲿": "瀇", "灏": "灝", "灭": "滅", "灯": "燈", "灵": "靈", "灶": "竈", "灾": "災", "灿": "燦", "炀": "煬", "炉": "爐", "炖": "燉", "炜": "煒", "炝": "熗", "点": "點", "炼": "煉", "炽": "熾", "烁": "爍", "烂": "爛", "烃": "烴", "烛": "燭", "烟": "煙", "烦": "煩", "烧": "燒", "烨": "燁", "烩": "燴", "烫": "燙", "烬": "燼", "热": "熱", "焕": "煥", "焖": "燜", "焘": "燾", "㶽": "煱", "煴": "熅", "㶶": "燶", "爱": "愛", "爷": "爺", "牍": "牘", "牦": "氂", "牵": "牽", "牺": "犧", "犊": "犢", "状": "狀", "犷": "獷", "犸": "獁", "犹": "猶", "狈": "狽", "狝": "獮", "狞": "獰", "独": "獨", "狭": "狹", "狮": "獅", "狯": "獪", "狰": "猙", "狱": "獄", "狲": "猻", "猃": "獫", "猎": "獵", "猕": "獼", "猡": "玀", "猪": "豬", "猫": "貓", "猬": "蝟", "献": "獻", "獭": "獺", "㺍": "獱", "玑": "璣", "玚": "瑒", "玛": "瑪", "玮": "瑋", "环": "環", "现": "現", "玱": "瑲", "玺": "璽", "珐": "琺", "珑": "瓏", "珰": "璫", "珲": "琿", "琏": "璉", "琐": "瑣", "琼": "瓊", "瑶": "瑤", "瑷": "璦", "璎": "瓔", "瓒": "瓚", "瓯": "甌", "电": "電", "画": "畫", "畅": "暢", "畴": "疇", "疖": "癤", "疗": "療", "疟": "瘧", "疠": "癘", "疡": "瘍", "疬": "癧", "疭": "瘲", "疮": "瘡", "疯": "瘋", "疱": "皰", "疴": "痾", "痈": "癰", "痉": "痙", "痒": "癢", "痖": "瘂", "痨": "癆", "痪": "瘓", "痫": "癇", "瘅": "癉", "瘆": "瘮", "瘗": "瘞", "瘪": "癟", "瘫": "癱", "瘾": "癮", "瘿": "癭", "癞": "癩", "癣": "癬", "癫": "癲", "皑": "皚", "皱": "皺", "皲": "皸", "盏": "盞", "盐": "鹽", "监": "監", "盖": "蓋", "盗": "盜", "盘": "盤", "眍": "瞘", "眦": "眥", "眬": "矓", "着": "著", "睁": "睜", "睐": "睞", "睑": "瞼", "瞆": "瞶", "瞒": "瞞", "䁖": "瞜", "瞩": "矚", "矫": "矯", "矶": "磯", "矾": "礬", "矿": "礦", "砀": "碭", "码": "碼", "砖": "磚", "砗": "硨", "砚": "硯", "砜": "碸", "砺": "礪", "砻": "礱", "砾": "礫", "础": "礎", "硁": "硜", "硕": "碩", "硖": "硤", "硗": "磽", "硙": "磑", "碍": "礙", "碛": "磧", "碜": "磣", "碱": "鹼", "礼": "禮", "祃": "禡", "祎": "禕", "祢": "禰", "祯": "禎", "祷": "禱", "祸": "禍", "禀": "稟", "禄": "祿", "禅": "禪", "离": "離", "秃": "禿", "秆": "稈", "积": "積", "称": "稱", "秽": "穢", "秾": "穠", "稆": "穭", "税": "稅", "䅉": "稏", "稣": "穌", "稳": "穩", "穑": "穡", "穷": "窮", "窃": "竊", "窍": "竅", "窎": "窵", "窑": "窯", "窜": "竄", "窝": "窩", "窥": "窺", "窦": "竇", "窭": "窶", "竞": "競", "笃": "篤", "笋": "筍", "笔": "筆", "笕": "筧", "笺": "箋", "笼": "籠", "笾": "籩", "筚": "篳", "筛": "篩", "筜": "簹", "筝": "箏", "䇲": "筴", "筹": "籌", "筼": "篔", "简": "簡", "箓": "籙", "箦": "簀", "箧": "篋", "箨": "籜", "箩": "籮", "箪": "簞", "箫": "簫", "篑": "簣", "篓": "簍", "篮": "籃", "篱": "籬", "簖": "籪", "籁": "籟", "籴": "糴", "类": "類", "籼": "秈", "粜": "糶", "粝": "糲", "粤": "粵", "粪": "糞", "粮": "糧", "糁": "糝", "糇": "餱", "紧": "緊", "䌷": "紬", "䌹": "絅", "絷": "縶", "䌼": "綐", "䌽": "綵", "䌸": "縳", "䍁": "繸", "䍀": "繿", "纟": "糹", "纠": "糾", "纡": "紆", "红": "紅", "纣": "紂", "纥": "紇", "约": "約", "级": "級", "纨": "紈", "纩": "纊", "纪": "紀", "纫": "紉", "纬": "緯", "纭": "紜", "纮": "紘", "纯": "純", "纰": "紕", "纱": "紗", "纲": "綱", "纳": "納", "纴": "紝", "纵": "縱", "纶": "綸", "纷": "紛", "纸": "紙", "纹": "紋", "纺": "紡", "纻": "紵", "纼": "紖", "纽": "紐", "纾": "紓", "绀": "紺", "绁": "紲", "绂": "紱", "练": "練", "组": "組", "绅": "紳", "细": "細", "织": "織", "终": "終", "绉": "縐", "绊": "絆", "绋": "紼", "绌": "絀", "绍": "紹", "绎": "繹", "经": "經", "绐": "紿", "绑": "綁", "绒": "絨", "结": "結", "绔": "絝", "绕": "繞", "绖": "絰", "绗": "絎", "绘": "繪", "给": "給", "绚": "絢", "绛": "絳", "络": "絡", "绞": "絞", "统": "統", "绠": "綆", "绡": "綃", "绢": "絹", "绤": "綌", "绥": "綏", "继": "繼", "绨": "綈", "绩": "績", "绪": "緒", "绫": "綾", "绬": "緓", "续": "續", "绮": "綺", "绯": "緋", "绰": "綽", "绲": "緄", "绳": "繩", "维": "維", "绵": "綿", "绶": "綬", "绸": "綢", "绹": "綯", "绺": "綹", "绻": "綣", "综": "綜", "绽": "綻", "绾": "綰", "缀": "綴", "缁": "緇", "缂": "緙", "缃": "緗", "缄": "緘", "缅": "緬", "缆": "纜", "缇": "緹", "缈": "緲", "缉": "緝", "缊": "縕", "缋": "繢", "缌": "緦", "缍": "綞", "缎": "緞", "缏": "緶", "缑": "緱", "缒": "縋", "缓": "緩", "缔": "締", "缕": "縷", "编": "編", "缗": "緡", "缘": "緣", "缙": "縉", "缚": "縛", "缛": "縟", "缜": "縝", "缝": "縫", "缞": "縗", "缟": "縞", "缠": "纏", "缡": "縭", "缢": "縊", "缣": "縑", "缤": "繽", "缥": "縹", "缦": "縵", "缧": "縲", "缨": "纓", "缩": "縮", "缪": "繆", "缫": "繅", "缬": "纈", "缭": "繚", "缮": "繕", "缯": "繒", "缱": "繾", "缲": "繰", "缳": "繯", "缴": "繳", "缵": "纘", "罂": "罌", "网": "網", "罗": "羅", "罚": "罰", "罢": "罷", "罴": "羆", "羁": "羈", "羟": "羥", "翘": "翹", "耢": "耮", "耧": "耬", "耸": "聳", "耻": "恥", "聂": "聶", "聋": "聾", "职": "職", "聍": "聹", "联": "聯", "聩": "聵", "聪": "聰", "肃": "肅", "肠": "腸", "肤": "膚", "肮": "骯", "肴": "餚", "肾": "腎", "肿": "腫", "胀": "脹", "胁": "脅", "胆": "膽", "胧": "朧", "胨": "腖", "胪": "臚", "胫": "脛", "胶": "膠", "脉": "脈", "脍": "膾", "脐": "臍", "脑": "腦", "脓": "膿", "脔": "臠", "脚": "腳", "脱": "脫", "脶": "腡", "脸": "臉", "腭": "齶", "腻": "膩", "腼": "靦", "腽": "膃", "腾": "騰", "膑": "臏", "臜": "臢", "舆": "輿", "舣": "艤", "舰": "艦", "舱": "艙", "舻": "艫", "艰": "艱", "艳": "艷", "艺": "藝", "节": "節", "芈": "羋", "芗": "薌", "芜": "蕪", "芦": "蘆", "苁": "蓯", "苇": "葦", "苈": "藶", "苋": "莧", "苌": "萇", "苍": "蒼", "苎": "苧", "茎": "莖", "茏": "蘢", "茑": "蔦", "茔": "塋", "茕": "煢", "茧": "繭", "荆": "荊", "荐": "薦", "荙": "薘", "荚": "莢", "荛": "蕘", "荜": "蓽", "荞": "蕎", "荟": "薈", "荠": "薺", "荣": "榮", "荤": "葷", "荥": "滎", "荦": "犖", "荧": "熒", "荨": "蕁", "荩": "藎", "荪": "蓀", "荫": "蔭", "荬": "蕒", "荭": "葒", "荮": "葤", "莅": "蒞", "莱": "萊", "莲": "蓮", "莳": "蒔", "莴": "萵", "莶": "薟", "莸": "蕕", "莹": "瑩", "莺": "鶯", "萝": "蘿", "萤": "螢", "营": "營", "萦": "縈", "萧": "蕭", "萨": "薩", "葱": "蔥", "蒇": "蕆", "蒉": "蕢", "蒋": "蔣", "蒌": "蔞", "蓝": "藍", "蓟": "薊", "蓠": "蘺", "蓣": "蕷", "蓥": "鎣", "蓦": "驀", "蔂": "虆", "蔷": "薔", "蔹": "蘞", "蔺": "藺", "蔼": "藹", "蕰": "薀", "蕲": "蘄", "薮": "藪", "䓕": "薳", "藓": "蘚", "蘖": "櫱", "虏": "虜", "虑": "慮", "虚": "虛", "虬": "虯", "虮": "蟣", "虽": "雖", "虾": "蝦", "虿": "蠆", "蚀": "蝕", "蚁": "蟻", "蚂": "螞", "蚕": "蠶", "蚬": "蜆", "蛊": "蠱", "蛎": "蠣", "蛏": "蟶", "蛮": "蠻", "蛰": "蟄", "蛱": "蛺", "蛲": "蟯", "蛳": "螄", "蛴": "蠐", "蜕": "蛻", "蜗": "蝸", "蝇": "蠅", "蝈": "蟈", "蝉": "蟬", "蝼": "螻", "蝾": "蠑", "螀": "螿", "螨": "蟎", "䗖": "螮", "蟏": "蠨", "衅": "釁", "衔": "銜", "补": "補", "衬": "襯", "衮": "袞", "袄": "襖", "袅": "裊", "袆": "褘", "袜": "襪", "袭": "襲", "袯": "襏", "装": "裝", "裆": "襠", "裈": "褌", "裢": "褳", "裣": "襝", "裤": "褲", "裥": "襇", "褛": "褸", "褴": "襤", "䙓": "襬", "见": "見", "观": "觀", "觃": "覎", "规": "規", "觅": "覓", "视": "視", "觇": "覘", "览": "覽", "觉": "覺", "觊": "覬", "觋": "覡", "觌": "覿", "觍": "覥", "觎": "覦", "觏": "覯", "觐": "覲", "觑": "覷", "觞": "觴", "触": "觸", "觯": "觶", "訚": "誾", "䜣": "訢", "誉": "譽", "誊": "謄", "䜧": "譅", "讠": "訁", "计": "計", "订": "訂", "讣": "訃", "认": "認", "讥": "譏", "讦": "訐", "讧": "訌", "讨": "討", "让": "讓", "讪": "訕", "讫": "訖", "讬": "託", "训": "訓", "议": "議", "讯": "訊", "记": "記", "讱": "訒", "讲": "講", "讳": "諱", "讴": "謳", "讵": "詎", "讶": "訝", "讷": "訥", "许": "許", "讹": "訛", "论": "論", "讻": "訩", "讼": "訟", "讽": "諷", "设": "設", "访": "訪", "诀": "訣", "证": "證", "诂": "詁", "诃": "訶", "评": "評", "诅": "詛", "识": "識", "诇": "詗", "诈": "詐", "诉": "訴", "诊": "診", "诋": "詆", "诌": "謅", "词": "詞", "诎": "詘", "诏": "詔", "诐": "詖", "译": "譯", "诒": "詒", "诓": "誆", "诔": "誄", "试": "試", "诖": "詿", "诗": "詩", "诘": "詰", "诙": "詼", "诚": "誠", "诛": "誅", "诜": "詵", "话": "話", "诞": "誕", "诟": "詬", "诠": "詮", "诡": "詭", "询": "詢", "诣": "詣", "诤": "諍", "该": "該", "详": "詳", "诧": "詫", "诨": "諢", "诩": "詡", "诪": "譸", "诫": "誡", "诬": "誣", "语": "語", "诮": "誚", "误": "誤", "诰": "誥", "诱": "誘", "诲": "誨", "诳": "誑", "诵": "誦", "诶": "誒", "请": "請", "诸": "諸", "诹": "諏", "诺": "諾", "读": "讀", "诼": "諑", "诽": "誹", "课": "課", "诿": "諉", "谀": "諛", "谁": "誰", "谂": "諗", "调": "調", "谄": "諂", "谅": "諒", "谆": "諄", "谇": "誶", "谈": "談", "谊": "誼", "谋": "謀", "谌": "諶", "谍": "諜", "谎": "謊", "谏": "諫", "谐": "諧", "谑": "謔", "谒": "謁", "谓": "謂", "谔": "諤", "谕": "諭", "谖": "諼", "谗": "讒", "谘": "諮", "谙": "諳", "谚": "諺", "谛": "諦", "谜": "謎", "谝": "諞", "谞": "諝", "谟": "謨", "谠": "讜", "谡": "謖", "谢": "謝", "谤": "謗", "谥": "謚", "谦": "謙", "谧": "謐", "谨": "謹", "谩": "謾", "谪": "謫", "谬": "謬", "谭": "譚", "谮": "譖", "谯": "譙", "谰": "讕", "谱": "譜", "谲": "譎", "谳": "讞", "谴": "譴", "谵": "譫", "谶": "讖", "豮": "豶", "䝙": "貙", "䞐": "賰", "贝": "貝", "贞": "貞", "负": "負", "贠": "貟", "贡": "貢", "财": "財", "责": "責", "贤": "賢", "败": "敗", "账": "賬", "货": "貨", "质": "質", "贩": "販", "贪": "貪", "贫": "貧", "贬": "貶", "购": "購", "贮": "貯", "贯": "貫", "贰": "貳", "贱": "賤", "贲": "賁", "贳": "貰", "贴": "貼", "贵": "貴", "贶": "貺", "贷": "貸", "贸": "貿", "费": "費", "贺": "賀", "贻": "貽", "贼": "賊", "贽": "贄", "贾": "賈", "贿": "賄", "赀": "貲", "赁": "賃", "赂": "賂", "资": "資", "赅": "賅", "赆": "贐", "赇": "賕", "赈": "賑", "赉": "賚", "赊": "賒", "赋": "賦", "赌": "賭", "赎": "贖", "赏": "賞", "赐": "賜", "赑": "贔", "赒": "賙", "赓": "賡", "赔": "賠", "赕": "賧", "赖": "賴", "赗": "賵", "赘": "贅", "赙": "賻", "赚": "賺", "赛": "賽", "赜": "賾", "赞": "贊", "赟": "贇", "赠": "贈", "赡": "贍", "赢": "贏", "赣": "贛", "赪": "赬", "赵": "趙", "赶": "趕", "趋": "趨", "趱": "趲", "趸": "躉", "跃": "躍", "跄": "蹌", "跞": "躒", "践": "踐", "跶": "躂", "跷": "蹺", "跸": "蹕", "跹": "躚", "跻": "躋", "踊": "踴", "踌": "躊", "踪": "蹤", "踬": "躓", "踯": "躑", "蹑": "躡", "蹒": "蹣", "蹰": "躕", "蹿": "躥", "躏": "躪", "躜": "躦", "躯": "軀", "车": "車", "轧": "軋", "轨": "軌", "轩": "軒", "轪": "軑", "轫": "軔", "转": "轉", "轭": "軛", "轮": "輪", "软": "軟", "轰": "轟", "轱": "軲", "轲": "軻", "轳": "轤", "轴": "軸", "轵": "軹", "轶": "軼", "轷": "軤", "轸": "軫", "轹": "轢", "轺": "軺", "轻": "輕", "轼": "軾", "载": "載", "轾": "輊", "轿": "轎", "辀": "輈", "辁": "輇", "辂": "輅", "较": "較", "辄": "輒", "辅": "輔", "辆": "輛", "辇": "輦", "辈": "輩", "辉": "輝", "辊": "輥", "辋": "輞", "辌": "輬", "辍": "輟", "辎": "輜", "辏": "輳", "辐": "輻", "辑": "輯", "辒": "轀", "输": "輸", "辔": "轡", "辕": "轅", "辖": "轄", "辗": "輾", "辘": "轆", "辙": "轍", "辚": "轔", "辞": "辭", "辩": "辯", "辫": "辮", "边": "邊", "辽": "遼", "达": "達", "迁": "遷", "过": "過", "迈": "邁", "运": "運", "还": "還", "这": "這", "进": "進", "远": "遠", "违": "違", "连": "連", "迟": "遲", "迩": "邇", "迳": "逕", "迹": "跡", "选": "選", "逊": "遜", "递": "遞", "逦": "邐", "逻": "邏", "遗": "遺", "遥": "遙", "邓": "鄧", "邝": "鄺", "邬": "鄔", "邮": "郵", "邹": "鄒", "邺": "鄴", "邻": "鄰", "郏": "郟", "郐": "鄶", "郑": "鄭", "郓": "鄆", "郦": "酈", "郧": "鄖", "郸": "鄲", "酂": "酇", "酦": "醱", "酱": "醬", "酽": "釅", "酾": "釃", "酿": "釀", "释": "釋", "鉴": "鑒", "銮": "鑾", "錾": "鏨", "𨱏": "鎝", "钅": "釒", "钆": "釓", "钇": "釔", "针": "針", "钉": "釘", "钊": "釗", "钋": "釙", "钌": "釕", "钍": "釷", "钎": "釺", "钏": "釧", "钐": "釤", "钑": "鈒", "钒": "釩", "钓": "釣", "钔": "鍆", "钕": "釹", "钖": "鍚", "钗": "釵", "钘": "鈃", "钙": "鈣", "钚": "鈈", "钛": "鈦", "钜": "鉅", "钝": "鈍", "钞": "鈔", "钠": "鈉", "钡": "鋇", "钢": "鋼", "钣": "鈑", "钤": "鈐", "钥": "鑰", "钦": "欽", "钧": "鈞", "钨": "鎢", "钪": "鈧", "钫": "鈁", "钬": "鈥", "钭": "鈄", "钮": "鈕", "钯": "鈀", "钰": "鈺", "钱": "錢", "钲": "鉦", "钳": "鉗", "钴": "鈷", "钶": "鈳", "钷": "鉕", "钸": "鈽", "钹": "鈸", "钺": "鉞", "钻": "鑽", "钼": "鉬", "钽": "鉭", "钾": "鉀", "钿": "鈿", "铀": "鈾", "铁": "鐵", "铂": "鉑", "铃": "鈴", "铄": "鑠", "铅": "鉛", "铆": "鉚", "铇": "鉋", "铈": "鈰", "铉": "鉉", "铊": "鉈", "铋": "鉍", "铌": "鈮", "铍": "鈹", "铎": "鐸", "铏": "鉶", "铐": "銬", "铑": "銠", "铒": "鉺", "铓": "鋩", "铔": "錏", "铕": "銪", "铖": "鋮", "铗": "鋏", "铘": "鋣", "铙": "鐃", "铚": "銍", "铛": "鐺", "铜": "銅", "铝": "鋁", "铞": "銱", "铟": "銦", "铠": "鎧", "铡": "鍘", "铢": "銖", "铣": "銑", "铤": "鋌", "铥": "銩", "铦": "銛", "铧": "鏵", "铨": "銓", "铩": "鎩", "铪": "鉿", "铫": "銚", "铬": "鉻", "铭": "銘", "铮": "錚", "铯": "銫", "铰": "鉸", "铱": "銥", "铲": "鏟", "铳": "銃", "铴": "鐋", "铵": "銨", "银": "銀", "铷": "銣", "铸": "鑄", "铹": "鐒", "铺": "鋪", "铻": "鋙", "铼": "錸", "铽": "鋱", "链": "鏈", "铿": "鏗", "销": "銷", "锁": "鎖", "锂": "鋰", "锃": "鋥", "锄": "鋤", "锅": "鍋", "锆": "鋯", "锇": "鋨", "锉": "銼", "锊": "鋝", "锋": "鋒", "锌": "鋅", "锍": "鋶", "锎": "鐦", "锏": "鐧", "锑": "銻", "锒": "鋃", "锓": "鋟", "锔": "鋦", "锕": "錒", "锖": "錆", "锗": "鍺", "锘": "鍩", "错": "錯", "锚": "錨", "锛": "錛", "锜": "錡", "锝": "鍀", "锞": "錁", "锟": "錕", "锠": "錩", "锡": "錫", "锢": "錮", "锣": "鑼", "锥": "錐", "锦": "錦", "锧": "鑕", "锩": "錈", "锪": "鍃", "锫": "錇", "锬": "錟", "锭": "錠", "键": "鍵", "锯": "鋸", "锰": "錳", "锱": "錙", "锲": "鍥", "锳": "鍈", "锴": "鍇", "锵": "鏘", "锶": "鍶", "锷": "鍔", "锸": "鍤", "锹": "鍬", "锺": "鍾", "锻": "鍛", "锼": "鎪", "锽": "鍠", "锾": "鍰", "锿": "鎄", "镀": "鍍", "镁": "鎂", "镂": "鏤", "镃": "鎡", "镄": "鐨", "镅": "鎇", "镆": "鏌", "镇": "鎮", "镈": "鎛", "镉": "鎘", "镊": "鑷", "镋": "鎲", "镍": "鎳", "镎": "鎿", "镏": "鎦", "镐": "鎬", "镑": "鎊", "镒": "鎰", "镓": "鎵", "镔": "鑌", "镕": "鎔", "镖": "鏢", "镗": "鏜", "镘": "鏝", "镙": "鏍", "镚": "鏰", "镛": "鏞", "镜": "鏡", "镝": "鏑", "镞": "鏃", "镟": "鏇", "镠": "鏐", "镡": "鐔", "镣": "鐐", "镤": "鏷", "镥": "鑥", "镦": "鐓", "镧": "鑭", "镨": "鐠", "镩": "鑹", "镪": "鏹", "镫": "鐙", "镬": "鑊", "镭": "鐳", "镮": "鐶", "镯": "鐲", "镰": "鐮", "镱": "鐿", "镲": "鑔", "镳": "鑣", "镴": "鑞", "镵": "鑱", "镶": "鑲", "长": "長", "门": "門", "闩": "閂", "闪": "閃", "闫": "閆", "闬": "閈", "闭": "閉", "问": "問", "闯": "闖", "闰": "閏", "闱": "闈", "闲": "閑", "闳": "閎", "间": "間", "闵": "閔", "闶": "閌", "闷": "悶", "闸": "閘", "闹": "鬧", "闺": "閨", "闻": "聞", "闼": "闥", "闽": "閩", "闾": "閭", "闿": "闓", "阀": "閥", "阁": "閣", "阂": "閡", "阃": "閫", "阄": "鬮", "阆": "閬", "阇": "闍", "阈": "閾", "阉": "閹", "阊": "閶", "阋": "鬩", "阌": "閿", "阍": "閽", "阎": "閻", "阏": "閼", "阐": "闡", "阑": "闌", "阒": "闃", "阓": "闠", "阔": "闊", "阕": "闋", "阖": "闔", "阗": "闐", "阘": "闒", "阙": "闕", "阚": "闞", "阛": "闤", "队": "隊", "阳": "陽", "阴": "陰", "阵": "陣", "阶": "階", "际": "際", "陆": "陸", "陇": "隴", "陈": "陳", "陉": "陘", "陕": "陝", "陧": "隉", "陨": "隕", "险": "險", "随": "隨", "隐": "隱", "隶": "隸", "隽": "雋", "难": "難", "雏": "雛", "雠": "讎", "雳": "靂", "雾": "霧", "霁": "霽", "霡": "霢", "霭": "靄", "靓": "靚", "静": "靜", "靥": "靨", "䩄": "靦", "鞑": "韃", "鞒": "鞽", "鞯": "韉", "韦": "韋", "韧": "韌", "韨": "韍", "韩": "韓", "韪": "韙", "韫": "韞", "韬": "韜", "韵": "韻", "页": "頁", "顶": "頂", "顷": "頃", "顸": "頇", "项": "項", "顺": "順", "顼": "頊", "顽": "頑", "顾": "顧", "顿": "頓", "颀": "頎", "颁": "頒", "颂": "頌", "颃": "頏", "预": "預", "颅": "顱", "领": "領", "颇": "頗", "颈": "頸", "颉": "頡", "颊": "頰", "颋": "頲", "颌": "頜", "颍": "潁", "颎": "熲", "颏": "頦", "颐": "頤", "频": "頻", "颒": "頮", "颔": "頷", "颕": "頴", "颖": "穎", "颗": "顆", "题": "題", "颙": "顒", "颚": "顎", "颛": "顓", "额": "額", "颞": "顳", "颟": "顢", "颠": "顛", "颡": "顙", "颢": "顥", "颤": "顫", "颥": "顬", "颦": "顰", "颧": "顴", "风": "風", "飏": "颺", "飐": "颭", "飑": "颮", "飒": "颯", "飓": "颶", "飔": "颸", "飕": "颼", "飖": "颻", "飗": "飀", "飘": "飄", "飙": "飆", "飚": "飈", "飞": "飛", "飨": "饗", "餍": "饜", "饣": "飠", "饤": "飣", "饦": "飥", "饧": "餳", "饨": "飩", "饩": "餼", "饪": "飪", "饫": "飫", "饬": "飭", "饭": "飯", "饮": "飲", "饯": "餞", "饰": "飾", "饱": "飽", "饲": "飼", "饳": "飿", "饴": "飴", "饵": "餌", "饶": "饒", "饷": "餉", "饸": "餄", "饹": "餎", "饺": "餃", "饻": "餏", "饼": "餅", "饽": "餑", "饾": "餖", "饿": "餓", "馀": "餘", "馁": "餒", "馂": "餕", "馃": "餜", "馄": "餛", "馅": "餡", "馆": "館", "馇": "餷", "馈": "饋", "馉": "餶", "馊": "餿", "馋": "饞", "馌": "饁", "馍": "饃", "馎": "餺", "馏": "餾", "馐": "饈", "馑": "饉", "馒": "饅", "馓": "饊", "馔": "饌", "馕": "饢", "䯄": "騧", "马": "馬", "驭": "馭", "驮": "馱", "驯": "馴", "驰": "馳", "驱": "驅", "驲": "馹", "驳": "駁", "驴": "驢", "驵": "駔", "驶": "駛", "驷": "駟", "驸": "駙", "驹": "駒", "驺": "騶", "驻": "駐", "驼": "駝", "驽": "駑", "驾": "駕", "驿": "驛", "骀": "駘", "骁": "驍", "骃": "駰", "骄": "驕", "骅": "驊", "骆": "駱", "骇": "駭", "骈": "駢", "骉": "驫", "骊": "驪", "骋": "騁", "验": "驗", "骍": "騂", "骎": "駸", "骏": "駿", "骐": "騏", "骑": "騎", "骒": "騍", "骓": "騅", "骔": "騌", "骕": "驌", "骖": "驂", "骗": "騙", "骘": "騭", "骙": "騤", "骚": "騷", "骛": "騖", "骜": "驁", "骝": "騮", "骞": "騫", "骟": "騸", "骠": "驃", "骡": "騾", "骢": "驄", "骣": "驏", "骤": "驟", "骥": "驥", "骦": "驦", "骧": "驤", "髅": "髏", "髋": "髖", "髌": "髕", "鬓": "鬢", "魇": "魘", "魉": "魎", "鱼": "魚", "鱽": "魛", "鱾": "魢", "鱿": "魷", "鲀": "魨", "鲁": "魯", "鲂": "魴", "鲃": "䰾", "鲄": "魺", "鲅": "鮁", "鲆": "鮃", "鲈": "鱸", "鲉": "鮋", "鲊": "鮓", "鲋": "鮒", "鲌": "鮊", "鲍": "鮑", "鲎": "鱟", "鲏": "鮍", "鲐": "鮐", "鲑": "鮭", "鲒": "鮚", "鲓": "鮳", "鲔": "鮪", "鲕": "鮞", "鲖": "鮦", "鲗": "鰂", "鲘": "鮜", "鲙": "鱠", "鲚": "鱭", "鲛": "鮫", "鲜": "鮮", "鲝": "鮺", "鲟": "鱘", "鲠": "鯁", "鲡": "鱺", "鲢": "鰱", "鲣": "鰹", "鲤": "鯉", "鲥": "鰣", "鲦": "鰷", "鲧": "鯀", "鲨": "鯊", "鲩": "鯇", "鲪": "鮶", "鲫": "鯽", "鲬": "鯒", "鲭": "鯖", "鲮": "鯪", "鲯": "鯕", "鲰": "鯫", "鲱": "鯡", "鲲": "鯤", "鲳": "鯧", "鲴": "鯝", "鲵": "鯢", "鲶": "鯰", "鲷": "鯛", "鲸": "鯨", "鲹": "鰺", "鲺": "鯴", "鲻": "鯔", "鲼": "鱝", "鲽": "鰈", "鲾": "鰏", "鲿": "鱨", "鳀": "鯷", "鳁": "鰮", "鳂": "鰃", "鳃": "鰓", "鳅": "鰍", "鳆": "鰒", "鳇": "鰉", "鳈": "鰁", "鳉": "鱂", "鳊": "鯿", "鳋": "鰠", "鳌": "鰲", "鳍": "鰭", "鳎": "鰨", "鳏": "鰥", "鳐": "鰩", "鳑": "鰟", "鳒": "鰜", "鳓": "鰳", "鳔": "鰾", "鳕": "鱈", "鳖": "鱉", "鳗": "鰻", "鳘": "鰵", "鳙": "鱅", "鳚": "䲁", "鳛": "鰼", "鳜": "鱖", "鳝": "鱔", "鳞": "鱗", "鳟": "鱒", "鳠": "鱯", "鳡": "鱤", "鳢": "鱧", "鳣": "鱣", "䴓": "鳾", "䴕": "鴷", "䴔": "鵁", "䴖": "鶄", "䴗": "鶪", "䴘": "鷈", "䴙": "鷿", "㶉": "鸂", "鸟": "鳥", "鸠": "鳩", "鸢": "鳶", "鸣": "鳴", "鸤": "鳲", "鸥": "鷗", "鸦": "鴉", "鸧": "鶬", "鸨": "鴇", "鸩": "鴆", "鸪": "鴣", "鸫": "鶇", "鸬": "鸕", "鸭": "鴨", "鸮": "鴞", "鸯": "鴦", "鸰": "鴒", "鸱": "鴟", "鸲": "鴝", "鸳": "鴛", "鸴": "鷽", "鸵": "鴕", "鸶": "鷥", "鸷": "鷙", "鸸": "鴯", "鸹": "鴰", "鸺": "鵂", "鸻": "鴴", "鸼": "鵃", "鸽": "鴿", "鸾": "鸞", "鸿": "鴻", "鹀": "鵐", "鹁": "鵓", "鹂": "鸝", "鹃": "鵑", "鹄": "鵠", "鹅": "鵝", "鹆": "鵒", "鹇": "鷳", "鹈": "鵜", "鹉": "鵡", "鹊": "鵲", "鹋": "鶓", "鹌": "鵪", "鹍": "鵾", "鹎": "鵯", "鹏": "鵬", "鹐": "鵮", "鹑": "鶉", "鹒": "鶊", "鹓": "鵷", "鹔": "鷫", "鹕": "鶘", "鹖": "鶡", "鹗": "鶚", "鹘": "鶻", "鹙": "鶖", "鹛": "鶥", "鹜": "鶩", "鹝": "鷊", "鹞": "鷂", "鹟": "鶲", "鹠": "鶹", "鹡": "鶺", "鹢": "鷁", "鹣": "鶼", "鹤": "鶴", "鹥": "鷖", "鹦": "鸚", "鹧": "鷓", "鹨": "鷚", "鹩": "鷯", "鹪": "鷦", "鹫": "鷲", "鹬": "鷸", "鹭": "鷺", "鹯": "鸇", "鹰": "鷹", "鹱": "鸌", "鹲": "鸏", "鹳": "鸛", "鹴": "鸘", "鹾": "鹺", "麦": "麥", "麸": "麩", "黄": "黃", "黉": "黌", "黡": "黶", "黩": "黷", "黪": "黲", "黾": "黽", "鼋": "黿", "鼍": "鼉", "鼗": "鞀", "鼹": "鼴", "齐": "齊", "齑": "齏", "齿": "齒", "龀": "齔", "龁": "齕", "龂": "齗", "龃": "齟", "龄": "齡", "龅": "齙", "龆": "齠", "龇": "齜", "龈": "齦", "龉": "齬", "龊": "齪", "龋": "齲", "龌": "齷", "龙": "龍", "龚": "龔", "龛": "龕", "龟": "龜", "一伙": "一伙", "一并": "一併", "一准": "一准", "一划": "一划", "一地里": "一地裡", "一干": "一干", "一树百获": "一樹百穫", "一台": "一臺", "一冲": "一衝", "一只": "一隻", "一发千钧": "一髮千鈞", "一出": "一齣", "七只": "七隻", "三元里": "三元裡", "三国志": "三國誌", "三复": "三複", "三只": "三隻", "上吊": "上吊", "上台": "上臺", "下不了台": "下不了臺", "下台": "下臺", "下面": "下麵", "不准": "不准", "不吊": "不吊", "不知就里": "不知就裡", "不知所云": "不知所云", "不锈钢": "不鏽鋼", "丑剧": "丑劇", "丑旦": "丑旦", "丑角": "丑角", "并存着": "並存著", "中岳": "中嶽", "中台医专": "中臺醫專", "丰南": "丰南", "丰台": "丰台", "丰姿": "丰姿", "丰采": "丰采", "丰韵": "丰韻", "主干": "主幹", "么么唱唱": "么么唱唱", "么儿": "么兒", "么喝": "么喝", "么妹": "么妹", "么弟": "么弟", "么爷": "么爺", "九世之雠": "九世之讎", "九只": "九隻", "干丝": "乾絲", "干着急": "乾著急", "乱发": "亂髮", "云云": "云云", "云尔": "云爾", "五岳": "五嶽", "五斗柜": "五斗櫃", "五斗橱": "五斗櫥", "五谷": "五穀", "五行生克": "五行生剋", "五只": "五隻", "五出": "五齣", "交卷": "交卷", "人云亦云": "人云亦云", "人物志": "人物誌", "什锦面": "什錦麵", "什么": "什麼", "仆倒": "仆倒", "介系词": "介係詞", "介系词": "介繫詞", "仿制": "仿製", "伙伕": "伙伕", "伙伴": "伙伴", "伙同": "伙同", "伙夫": "伙夫", "伙房": "伙房", "伙计": "伙計", "伙食": "伙食", "布下": "佈下", "布告": "佈告", "布哨": "佈哨", "布局": "佈局", "布岗": "佈崗", "布施": "佈施", "布景": "佈景", "布满": "佈滿", "布线": "佈線", "布置": "佈置", "布署": "佈署", "布道": "佈道", "布达": "佈達", "布防": "佈防", "布阵": "佈陣", "布雷": "佈雷", "体育锻鍊": "体育鍛鍊", "何干": "何干", "作准": "作准", "佣人": "佣人", "佣工": "佣工", "佣金": "佣金", "并入": "併入", "并列": "併列", "并到": "併到", "并合": "併合", "并吞": "併吞", "并在": "併在", "并成": "併成", "并排": "併排", "并拢": "併攏", "并案": "併案", "并为": "併為", "并发": "併發", "并科": "併科", "并购": "併購", "并进": "併進", "来复": "來複", "供制": "供製", "依依不舍": "依依不捨", "侵并": "侵併", "便辟": "便辟", "系数": "係數", "系为": "係為", "保险柜": "保險柜", "信号台": "信號臺", "修复": "修複", "修胡刀": "修鬍刀", "俯冲": "俯衝", "个里": "個裡", "借着": "借著", "假发": "假髮", "停制": "停製", "偷鸡不着": "偷雞不著", "家伙": "傢伙", "家俱": "傢俱", "家具": "傢具", "传布": "傳佈", "债台高筑": "債臺高築", "傻里傻气": "傻裡傻氣", "倾家荡产": "傾家蕩產", "倾复": "傾複", "倾复": "傾覆", "僱佣": "僱佣", "仪表": "儀錶", "亿只": "億隻", "尽尽": "儘儘", "尽先": "儘先", "尽其所有": "儘其所有", "尽力": "儘力", "尽快": "儘快", "尽早": "儘早", "尽是": "儘是", "尽管": "儘管", "尽速": "儘速", "尽量": "儘量", "允准": "允准", "兄台": "兄臺", "充饥": "充饑", "光采": "光采", "克里": "克裡", "克复": "克複", "入伙": "入伙", "内制": "內製", "两只": "兩隻", "八字胡": "八字鬍", "八只": "八隻", "公布": "公佈", "公干": "公幹", "公斗": "公斗", "公历": "公曆", "六只": "六隻", "六出": "六齣", "兼并": "兼併", "冤雠": "冤讎", "准予": "准予", "准假": "准假", "准将": "准將", "准考证": "准考證", "准许": "准許", "几几": "几几", "几案": "几案", "几丝": "几絲", "凹洞里": "凹洞裡", "出征": "出征", "出锤": "出鎚", "刀削面": "刀削麵", "刁斗": "刁斗", "分布": "分佈", "切面": "切麵", "刊布": "刊佈", "划上": "划上", "划下": "划下", "划不来": "划不來", "划了": "划了", "划具": "划具", "划出": "划出", "划到": "划到", "划动": "划動", "划去": "划去", "划子": "划子", "划得来": "划得來", "划拳": "划拳", "划桨": "划槳", "划水": "划水", "划算": "划算", "划船": "划船", "划艇": "划艇", "划着": "划著", "划着走": "划著走", "划行": "划行", "划走": "划走", "划起": "划起", "划进": "划進", "划过": "划過", "初征": "初征", "别致": "別緻", "别着": "別著", "别只": "別隻", "利比里亚": "利比裡亞", "刮着": "刮著", "刮胡刀": "刮鬍刀", "剃发": "剃髮", "剃须": "剃鬚", "削发": "削髮", "克制": "剋制", "克星": "剋星", "克服": "剋服", "克死": "剋死", "克薄": "剋薄", "前仆后继": "前仆後繼", "前台": "前臺", "前车之复": "前車之覆", "刚才": "剛纔", "剪发": "剪髮", "割舍": "割捨", "创制": "創製", "加里宁": "加裡寧", "动荡": "動蕩", "劳力士表": "勞力士錶", "包准": "包准", "包谷": "包穀", "北斗": "北斗", "北回": "北迴", "匡复": "匡複", "匪干": "匪幹", "十卷": "十卷", "十台": "十臺", "十只": "十隻", "十出": "十齣", "千丝万缕": "千絲萬縷", "千回百折": "千迴百折", "千回百转": "千迴百轉", "千钧一发": "千鈞一髮", "千只": "千隻", "升斗小民": "升斗小民", "半只": "半隻", "南岳": "南嶽", "南征": "南征", "南台": "南臺", "南回": "南迴", "卡里": "卡裡", "印制": "印製", "卷入": "卷入", "卷取": "卷取", "卷土重来": "卷土重來", "卷子": "卷子", "卷宗": "卷宗", "卷尺": "卷尺", "卷层云": "卷層雲", "卷帙": "卷帙", "卷扬机": "卷揚機", "卷曲": "卷曲", "卷染": "卷染", "卷烟": "卷煙", "卷筒": "卷筒", "卷纬": "卷緯", "卷绕": "卷繞", "卷装": "卷裝", "卷轴": "卷軸", "卷云": "卷雲", "卷领": "卷領", "卷发": "卷髮", "卷须": "卷鬚", "参与": "參与", "参与者": "參与者", "参合": "參合", "参考价值": "參考價值", "参与": "參與", "参与人员": "參與人員", "参与制": "參與制", "参与感": "參與感", "参与者": "參與者", "参观团": "參觀團", "参观团体": "參觀團體", "参阅": "參閱", "反冲": "反衝", "反复": "反複", "反复": "反覆", "取舍": "取捨", "口里": "口裡", "只准": "只准", "只冲": "只衝", "叮当": "叮噹", "可怜虫": "可憐虫", "可紧可松": "可緊可鬆", "台制": "台製", "司令台": "司令臺", "吃着不尽": "吃著不盡", "吃里扒外": "吃裡扒外", "吃里爬外": "吃裡爬外", "各吊": "各吊", "合伙": "合伙", "合并": "合併", "合着": "合著", "合着者": "合著者", "吊上": "吊上", "吊下": "吊下", "吊了": "吊了", "吊个": "吊個", "吊儿郎当": "吊兒郎當", "吊到": "吊到", "吊去": "吊去", "吊取": "吊取", "吊吊": "吊吊", "吊嗓": "吊嗓", "吊好": "吊好", "吊子": "吊子", "吊带": "吊帶", "吊带裤": "吊帶褲", "吊床": "吊床", "吊得": "吊得", "吊挂": "吊掛", "吊挂着": "吊掛著", "吊杆": "吊杆", "吊架": "吊架", "吊桶": "吊桶", "吊杆": "吊桿", "吊桥": "吊橋", "吊死": "吊死", "吊灯": "吊燈", "吊环": "吊環", "吊盘": "吊盤", "吊索": "吊索", "吊着": "吊著", "吊装": "吊裝", "吊裤": "吊褲", "吊裤带": "吊褲帶", "吊袜": "吊襪", "吊走": "吊走", "吊起": "吊起", "吊车": "吊車", "吊钩": "吊鉤", "吊销": "吊銷", "吊钟": "吊鐘", "同伙": "同伙", "名表": "名錶", "后冠": "后冠", "后土": "后土", "后妃": "后妃", "后座": "后座", "后稷": "后稷", "后羿": "后羿", "后里": "后里", "向着": "向著", "吞并": "吞併", "吹发": "吹髮", "吕后": "呂后", "獃里獃气": "呆裡呆氣", "周而复始": "周而複始", "呼吁": "呼籲", "和面": "和麵", "哪里": "哪裡", "哭脏": "哭髒", "问卷": "問卷", "喝采": "喝采", "单干": "單干", "单只": "單隻", "嘴里": "嘴裡", "恶心": "噁心", "当啷": "噹啷", "当当": "噹噹", "噜苏": "嚕囌", "向导": "嚮導", "向往": "嚮往", "向应": "嚮應", "向日": "嚮日", "向迩": "嚮邇", "严丝合缝": "嚴絲合縫", "严复": "嚴複", "四舍五入": "四捨五入", "四只": "四隻", "四出": "四齣", "回丝": "回絲", "回着": "回著", "回荡": "回蕩", "回复": "回覆", "回采": "回采", "圈子里": "圈子裡", "圈里": "圈裡", "国历": "國曆", "国雠": "國讎", "园里": "園裡", "图里": "圖裡", "土里": "土裡", "土制": "土製", "地志": "地誌", "坍台": "坍臺", "坑里": "坑裡", "坦荡": "坦蕩", "垂发": "垂髮", "垮台": "垮臺", "埋布": "埋佈", "城里": "城裡", "基干": "基幹", "报复": "報複", "塌台": "塌臺", "塔台": "塔臺", "涂着": "塗著", "墓志": "墓誌", "墨斗": "墨斗", "墨索里尼": "墨索裡尼", "垦复": "墾複", "垄断价格": "壟斷價格", "垄断资产": "壟斷資產", "垄断集团": "壟斷集團", "壶里": "壺裡", "寿面": "壽麵", "夏天里": "夏天裡", "夏历": "夏曆", "外制": "外製", "多冲": "多衝", "多采多姿": "多采多姿", "多么": "多麼", "夜光表": "夜光錶", "夜里": "夜裡", "梦里": "夢裡", "大伙": "大伙", "大卷": "大卷", "大干": "大干", "大干": "大幹", "大锤": "大鎚", "大只": "大隻", "天后": "天后", "天干": "天干", "天文台": "天文臺", "天翻地复": "天翻地覆", "太后": "太后", "奏折": "奏摺", "女丑": "女丑", "女佣": "女佣", "好家夥": "好傢夥", "好戏连台": "好戲連臺", "如法泡制": "如法泡製", "妆台": "妝臺", "姜太公": "姜太公", "姜子牙": "姜子牙", "姜丝": "姜絲", "字汇": "字彙", "字里行间": "字裡行間", "存折": "存摺", "孟姜女": "孟姜女", "宇宙志": "宇宙誌", "定准": "定准", "定制": "定製", "宣布": "宣佈", "宫里": "宮裡", "家伙": "家伙", "家里": "家裡", "密布": "密佈", "寇雠": "寇讎", "实干": "實幹", "写字台": "寫字檯", "写字台": "寫字臺", "宽松": "寬鬆", "封面里": "封面裡", "射干": "射干", "对表": "對錶", "小丑": "小丑", "小伙": "小伙", "小只": "小隻", "少吊": "少吊", "尺布斗粟": "尺布斗粟", "尼克松": "尼克鬆", "尼采": "尼采", "尿斗": "尿斗", "局里": "局裡", "居里": "居裡", "屋子里": "屋子裡", "屋里": "屋裡", "展布": "展佈", "屡仆屡起": "屢仆屢起", "屯里": "屯裡", "山岳": "山嶽", "山里": "山裡", "峰回": "峰迴", "巡回": "巡迴", "巧干": "巧幹", "巴尔干": "巴爾幹", "巴里": "巴裡", "巷里": "巷裡", "市里": "市裡", "布谷": "布穀", "希腊": "希腊", "帘子": "帘子", "帘布": "帘布", "席卷": "席卷", "带团参加": "帶團參加", "带发修行": "帶髮修行", "干休": "干休", "干系": "干係", "干卿何事": "干卿何事", "干将": "干將", "干戈": "干戈", "干挠": "干撓", "干扰": "干擾", "干支": "干支", "干政": "干政", "干时": "干時", "干涉": "干涉", "干犯": "干犯", "干与": "干與", "干着急": "干著急", "干贝": "干貝", "干预": "干預", "平台": "平臺", "年历": "年曆", "年里": "年裡", "干上": "幹上", "干下去": "幹下去", "干了": "幹了", "干事": "幹事", "干些": "幹些", "干个": "幹個", "干劲": "幹勁", "干员": "幹員", "干吗": "幹嗎", "干嘛": "幹嘛", "干坏事": "幹壞事", "干完": "幹完", "干得": "幹得", "干性油": "幹性油", "干才": "幹才", "干掉": "幹掉", "干校": "幹校", "干活": "幹活", "干流": "幹流", "干球温度": "幹球溫度", "干线": "幹線", "干练": "幹練", "干警": "幹警", "干起来": "幹起來", "干路": "幹路", "干道": "幹道", "干部": "幹部", "干么": "幹麼", "几丝": "幾絲", "几只": "幾隻", "几出": "幾齣", "底里": "底裡", "康采恩": "康采恩", "庙里": "廟裡", "建台": "建臺", "弄脏": "弄髒", "弔卷": "弔卷", "弘历": "弘曆", "别扭": "彆扭", "别拗": "彆拗", "别气": "彆氣", "别脚": "彆腳", "别着": "彆著", "弹子台": "彈子檯", "弹药": "彈葯", "汇报": "彙報", "汇整": "彙整", "汇编": "彙編", "汇总": "彙總", "汇纂": "彙纂", "汇辑": "彙輯", "汇集": "彙集", "形单影只": "形單影隻", "影后": "影后", "往里": "往裡", "往复": "往複", "征伐": "征伐", "征兵": "征兵", "征尘": "征塵", "征夫": "征夫", "征战": "征戰", "征收": "征收", "征服": "征服", "征求": "征求", "征发": "征發", "征衣": "征衣", "征讨": "征討", "征途": "征途", "后台": "後臺", "从里到外": "從裡到外", "从里向外": "從裡向外", "复雠": "復讎", "复辟": "復辟", "德干高原": "德干高原", "心愿": "心愿", "心荡神驰": "心蕩神馳", "心里": "心裡", "忙里": "忙裡", "快干": "快幹", "快冲": "快衝", "怎么": "怎麼", "怎么着": "怎麼著", "怒发冲冠": "怒髮衝冠", "急冲而下": "急衝而下", "怪里怪气": "怪裡怪氣", "恩准": "恩准", "情有所钟": "情有所鍾", "意面": "意麵", "慌里慌张": "慌裡慌張", "慰借": "慰藉", "忧郁": "憂郁", "凭吊": "憑吊", "凭借": "憑藉", "凭借着": "憑藉著", "蒙懂": "懞懂", "怀里": "懷裡", "怀表": "懷錶", "悬吊": "懸吊", "恋恋不舍": "戀戀不捨", "戏台": "戲臺", "戴表": "戴錶", "戽斗": "戽斗", "房里": "房裡", "手不释卷": "手不釋卷", "手卷": "手卷", "手折": "手摺", "手里": "手裡", "手表": "手錶", "手松": "手鬆", "才干": "才幹", "才高八斗": "才高八斗", "打谷": "打穀", "扞御": "扞禦", "批准": "批准", "批复": "批複", "批复": "批覆", "承制": "承製", "抗御": "抗禦", "折冲": "折衝", "披复": "披覆", "披发": "披髮", "抱朴": "抱朴", "抵御": "抵禦", "拆伙": "拆伙", "拆台": "拆臺", "拈须": "拈鬚", "拉纤": "拉縴", "拉面": "拉麵", "拖吊": "拖吊", "拗别": "拗彆", "拮据": "拮据", "振荡": "振蕩", "捍御": "捍禦", "舍不得": "捨不得", "舍出": "捨出", "舍去": "捨去", "舍命": "捨命", "舍己从人": "捨己從人", "舍己救人": "捨己救人", "舍己为人": "捨己為人", "舍己为公": "捨己為公", "舍己为国": "捨己為國", "舍得": "捨得", "舍我其谁": "捨我其誰", "舍本逐末": "捨本逐末", "舍弃": "捨棄", "舍死忘生": "捨死忘生", "舍生": "捨生", "舍短取长": "捨短取長", "舍身": "捨身", "舍车保帅": "捨車保帥", "舍近求远": "捨近求遠", "捲发": "捲髮", "捵面": "捵麵", "扫荡": "掃蕩", "掌柜": "掌柜", "排骨面": "排骨麵", "挂帘": "掛帘", "挂面": "掛麵", "接着说": "接著說", "提心吊胆": "提心吊膽", "插图卷": "插圖卷", "换吊": "換吊", "换只": "換隻", "换发": "換髮", "摇荡": "搖蕩", "搭伙": "搭伙", "折合": "摺合", "折奏": "摺奏", "折子": "摺子", "折尺": "摺尺", "折扇": "摺扇", "折梯": "摺梯", "折椅": "摺椅", "折叠": "摺疊", "折痕": "摺痕", "折篷": "摺篷", "折纸": "摺紙", "折裙": "摺裙", "撒布": "撒佈", "撚须": "撚鬚", "撞球台": "撞球檯", "擂台": "擂臺", "担仔面": "擔仔麵", "担担面": "擔擔麵", "担着": "擔著", "担负着": "擔負著", "据云": "據云", "擢发难数": "擢髮難數", "摆布": "擺佈", "摄制": "攝製", "支干": "支幹", "收获": "收穫", "改制": "改製", "攻克": "攻剋", "放荡": "放蕩", "放松": "放鬆", "叙说着": "敘說著", "散伙": "散伙", "散布": "散佈", "散荡": "散蕩", "散发": "散髮", "整只": "整隻", "整出": "整齣", "文采": "文采", "斗六": "斗六", "斗南": "斗南", "斗大": "斗大", "斗子": "斗子", "斗室": "斗室", "斗方": "斗方", "斗栱": "斗栱", "斗笠": "斗笠", "斗箕": "斗箕", "斗篷": "斗篷", "斗胆": "斗膽", "斗转参横": "斗轉參橫", "斗量": "斗量", "斗门": "斗門", "料斗": "料斗", "斯里兰卡": "斯裡蘭卡", "新历": "新曆", "断头台": "斷頭臺", "方才": "方纔", "施舍": "施捨", "旋绕着": "旋繞著", "旋回": "旋迴", "族里": "族裡", "日历": "日曆", "日志": "日誌", "日进斗金": "日進斗金", "明了": "明瞭", "明窗净几": "明窗淨几", "明里": "明裡", "星斗": "星斗", "星历": "星曆", "星移斗换": "星移斗換", "星移斗转": "星移斗轉", "星罗棋布": "星羅棋佈", "星辰表": "星辰錶", "春假里": "春假裡", "春天里": "春天裡", "晃荡": "晃蕩", "景致": "景緻", "暗地里": "暗地裡", "暗沟里": "暗溝裡", "暗里": "暗裡", "历数": "曆數", "历书": "曆書", "历法": "曆法", "书卷": "書卷", "会干": "會幹", "会里": "會裡", "月历": "月曆", "月台": "月臺", "有只": "有隻", "木制": "木製", "本台": "本臺", "朴子": "朴子", "朴实": "朴實", "朴硝": "朴硝", "朴素": "朴素", "朴资茅斯": "朴資茅斯", "村里": "村裡", "束发": "束髮", "东岳": "東嶽", "东征": "東征", "松赞干布": "松贊干布", "板着脸": "板著臉", "板荡": "板蕩", "枕借": "枕藉", "林宏岳": "林宏嶽", "枝干": "枝幹", "枯干": "枯幹", "某只": "某隻", "染发": "染髮", "柜上": "柜上", "柜台": "柜台", "柜子": "柜子", "查卷": "查卷", "查号台": "查號臺", "校雠学": "校讎學", "核准": "核准", "核复": "核覆", "格里": "格裡", "案卷": "案卷", "条干": "條幹", "棉卷": "棉卷", "棉制": "棉製", "植发": "植髮", "楼台": "樓臺", "标志着": "標志著", "标致": "標緻", "标志": "標誌", "模制": "模製", "树干": "樹幹", "横征暴敛": "橫征暴斂", "横冲": "橫衝", "档卷": "檔卷", "检复": "檢覆", "台子": "檯子", "台布": "檯布", "台灯": "檯燈", "台球": "檯球", "台面": "檯面", "柜台": "櫃檯", "柜台": "櫃臺", "栏干": "欄干", "欺蒙": "欺矇", "歌后": "歌后", "欧几里得": "歐幾裡得", "正当着": "正當著", "武后": "武后", "武松": "武鬆", "归并": "歸併", "死里求生": "死裡求生", "死里逃生": "死裡逃生", "残卷": "殘卷", "杀虫药": "殺虫藥", "壳里": "殼裡", "母后": "母后", "每只": "每隻", "比干": "比干", "毛卷": "毛卷", "毛发": "毛髮", "毫发": "毫髮", "气冲牛斗": "氣沖牛斗", "气象台": "氣象臺", "氯霉素": "氯黴素", "水斗": "水斗", "水里": "水裡", "水表": "水錶", "永历": "永曆", "污蔑": "汙衊", "池里": "池裡", "污蔑": "污衊", "沈着": "沈著", "没事干": "沒事幹", "没精打采": "沒精打采", "冲着": "沖著", "沙里淘金": "沙裡淘金", "河里": "河裡", "油面": "油麵", "泡面": "泡麵", "泰斗": "泰斗", "洗手不干": "洗手不幹", "洗发精": "洗髮精", "派团参加": "派團參加", "流荡": "流蕩", "浩荡": "浩蕩", "浪琴表": "浪琴錶", "浪荡": "浪蕩", "浮荡": "浮蕩", "海里": "海裡", "涂着": "涂著", "液晶表": "液晶錶", "凉面": "涼麵", "淡朱": "淡硃", "淫荡": "淫蕩", "测验卷": "測驗卷", "港制": "港製", "游荡": "游蕩", "凑合着": "湊合著", "湖里": "湖裡", "汤团": "湯糰", "汤面": "湯麵", "卤制": "滷製", "卤面": "滷麵", "满布": "滿佈", "漂荡": "漂蕩", "漏斗": "漏斗", "演奏台": "演奏臺", "潭里": "潭裡", "激荡": "激蕩", "浓郁": "濃郁", "浓发": "濃髮", "湿地松": "濕地鬆", "蒙蒙": "濛濛", "蒙雾": "濛霧", "瀛台": "瀛臺", "弥漫": "瀰漫", "弥漫着": "瀰漫著", "火并": "火併", "灰蒙": "灰濛", "炒面": "炒麵", "炮制": "炮製", "炸药": "炸葯", "炸酱面": "炸醬麵", "为着": "為著", "乌干达": "烏干達", "乌苏里江": "烏蘇裡江", "乌发": "烏髮", "乌龙面": "烏龍麵", "烘制": "烘製", "烽火台": "烽火臺", "无干": "無干", "无精打采": "無精打采", "炼制": "煉製", "烟卷儿": "煙卷兒", "烟斗": "煙斗", "烟斗丝": "煙斗絲", "烟台": "煙臺", "照准": "照准", "熨斗": "熨斗", "灯台": "燈臺", "燎发": "燎髮", "烫发": "燙髮", "烫面": "燙麵", "烛台": "燭臺", "炉台": "爐臺", "爽荡": "爽蕩", "片言只语": "片言隻語", "牛肉面": "牛肉麵", "牛只": "牛隻", "特准": "特准", "特征": "特征", "特里": "特裡", "特制": "特製", "牵系": "牽繫", "狼借": "狼藉", "猛冲": "猛衝", "奖杯": "獎盃", "获准": "獲准", "率团参加": "率團參加", "王侯后": "王侯后", "王后": "王后", "班里": "班裡", "理发": "理髮", "瑶台": "瑤臺", "甚么": "甚麼", "甜面酱": "甜麵醬", "生力面": "生力麵", "生锈": "生鏽", "生发": "生髮", "田里": "田裡", "由馀": "由余", "男佣": "男佣", "男用表": "男用錶", "留发": "留髮", "畚斗": "畚斗", "当着": "當著", "疏松": "疏鬆", "疲困": "疲睏", "病症": "病癥", "症候": "癥候", "症状": "癥狀", "症结": "癥結", "登台": "登臺", "发布": "發佈", "发着": "發著", "发面": "發麵", "发霉": "發黴", "白卷": "白卷", "白干儿": "白干兒", "白发": "白髮", "白面": "白麵", "百里": "百裡", "百只": "百隻", "皇后": "皇后", "皇历": "皇曆", "皓发": "皓髮", "皮里阳秋": "皮裏陽秋", "皮里春秋": "皮裡春秋", "皮制": "皮製", "皱折": "皺摺", "盒里": "盒裡", "监制": "監製", "盘里": "盤裡", "盘回": "盤迴", "直接参与": "直接參与", "直冲": "直衝", "相克": "相剋", "相干": "相干", "相冲": "相衝", "看台": "看臺", "眼帘": "眼帘", "眼眶里": "眼眶裡", "眼里": "眼裡", "困乏": "睏乏", "睡着了": "睡著了", "了如": "瞭如", "了望": "瞭望", "了然": "瞭然", "了若指掌": "瞭若指掌", "了解": "瞭解", "蒙住": "矇住", "蒙昧无知": "矇昧無知", "蒙混": "矇混", "蒙蒙": "矇矇", "蒙眬": "矇矓", "蒙蔽": "矇蔽", "蒙骗": "矇騙", "短发": "短髮", "石英表": "石英錶", "研制": "研製", "砰当": "砰噹", "砲台": "砲臺", "朱唇皓齿": "硃唇皓齒", "朱批": "硃批", "朱砂": "硃砂", "朱笔": "硃筆", "朱红色": "硃紅色", "朱色": "硃色", "硬干": "硬幹", "砚台": "硯臺", "碑志": "碑誌", "磁制": "磁製", "磨制": "磨製", "示复": "示覆", "社里": "社裡", "神采": "神采", "御侮": "禦侮", "御寇": "禦寇", "御寒": "禦寒", "御敌": "禦敵", "秃发": "禿髮", "秀发": "秀髮", "私下里": "私下裡", "秋天里": "秋天裡", "秋裤": "秋褲", "秒表": "秒錶", "稀松": "稀鬆", "禀复": "稟覆", "稻谷": "稻穀", "稽征": "稽征", "谷仓": "穀倉", "谷场": "穀場", "谷子": "穀子", "谷壳": "穀殼", "谷物": "穀物", "谷皮": "穀皮", "谷神": "穀神", "谷粒": "穀粒", "谷舱": "穀艙", "谷苗": "穀苗", "谷草": "穀草", "谷贱伤农": "穀賤傷農", "谷道": "穀道", "谷雨": "穀雨", "谷类": "穀類", "积极参与": "積极參与", "积极参加": "積极參加", "空荡": "空蕩", "窗帘": "窗帘", "窗明几净": "窗明几淨", "窗台": "窗檯", "窗台": "窗臺", "窝里": "窩裡", "窝阔台": "窩闊臺", "穷追不舍": "窮追不捨", "笆斗": "笆斗", "笑里藏刀": "笑裡藏刀", "第一卷": "第一卷", "筋斗": "筋斗", "答卷": "答卷", "答复": "答複", "答复": "答覆", "筵几": "筵几", "箕斗": "箕斗", "签着": "簽著", "吁求": "籲求", "吁请": "籲請", "粗制": "粗製", "粗卤": "粗鹵", "精干": "精幹", "精明强干": "精明強幹", "精致": "精緻", "精制": "精製", "精辟": "精辟", "精采": "精采", "糊里糊涂": "糊裡糊塗", "团子": "糰子", "系着": "系著", "纪历": "紀曆", "红发": "紅髮", "红霉素": "紅黴素", "纡回": "紆迴", "纳采": "納采", "素食面": "素食麵", "素面": "素麵", "紫微斗数": "紫微斗數", "细致": "細緻", "组里": "組裡", "结发": "結髮", "绝对参照": "絕對參照", "丝来线去": "絲來線去", "丝布": "絲布", "丝板": "絲板", "丝瓜布": "絲瓜布", "丝绒布": "絲絨布", "丝线": "絲線", "丝织厂": "絲織廠", "丝虫": "絲蟲", "綑吊": "綑吊", "经卷": "經卷", "绿霉素": "綠黴素", "维系": "維繫", "绾发": "綰髮", "网里": "網裡", "紧绷": "緊繃", "紧绷着": "緊繃著", "紧追不舍": "緊追不捨", "编制": "編製", "编发": "編髮", "缓冲": "緩衝", "致密": "緻密", "萦回": "縈迴", "县里": "縣裡", "县志": "縣誌", "缝里": "縫裡", "缝制": "縫製", "纤夫": "縴夫", "繁复": "繁複", "绷住": "繃住", "绷子": "繃子", "绷带": "繃帶", "绷紧": "繃緊", "绷脸": "繃臉", "绷着": "繃著", "绷着脸": "繃著臉", "绷着脸儿": "繃著臉兒", "绷开": "繃開", "绘制": "繪製", "系上": "繫上", "系到": "繫到", "系囚": "繫囚", "系心": "繫心", "系念": "繫念", "系怀": "繫懷", "系数": "繫數", "系于": "繫於", "系系": "繫系", "系紧": "繫緊", "系绳": "繫繩", "系着": "繫著", "系辞": "繫辭", "缴卷": "繳卷", "累囚": "纍囚", "累累": "纍纍", "坛子": "罈子", "坛坛罐罐": "罈罈罐罐", "骂着": "罵著", "美制": "美製", "美发": "美髮", "翻来复去": "翻來覆去", "翻天复地": "翻天覆地", "翻复": "翻覆", "翻云复雨": "翻雲覆雨", "老么": "老么", "老板": "老闆", "考卷": "考卷", "耕获": "耕穫", "聊斋志异": "聊齋誌異", "联系": "聯係", "联系": "聯繫", "肉丝面": "肉絲麵", "肉羹面": "肉羹麵", "肉松": "肉鬆", "肢体": "肢体", "背向着": "背向著", "背地里": "背地裡", "胡里胡涂": "胡裡胡塗", "能干": "能幹", "脉冲": "脈衝", "脱发": "脫髮", "腊味": "腊味", "腊笔": "腊筆", "腊肉": "腊肉", "脑子里": "腦子裡", "腰里": "腰裡", "胶卷": "膠卷", "自制": "自製", "自觉自愿": "自覺自愿", "台上": "臺上", "台下": "臺下", "台中": "臺中", "台北": "臺北", "台南": "臺南", "台地": "臺地", "台塑": "臺塑", "台大": "臺大", "台币": "臺幣", "台座": "臺座", "台东": "臺東", "台柱": "臺柱", "台榭": "臺榭", "台汽": "臺汽", "台海": "臺海", "台澎金马": "臺澎金馬", "台湾": "臺灣", "台灯": "臺燈", "台球": "臺球", "台省": "臺省", "台端": "臺端", "台糖": "臺糖", "台肥": "臺肥", "台航": "臺航", "台视": "臺視", "台词": "臺詞", "台车": "臺車", "台铁": "臺鐵", "台阶": "臺階", "台电": "臺電", "台面": "臺面", "舂谷": "舂穀", "兴致": "興緻", "兴高采烈": "興高采烈", "旧历": "舊曆", "舒卷": "舒卷", "舞台": "舞臺", "航海历": "航海曆", "船只": "船隻", "舰只": "艦隻", "芬郁": "芬郁", "花卷": "花卷", "花盆里": "花盆裡", "花采": "花采", "苑里": "苑裡", "若干": "若干", "苦干": "苦幹", "苦里": "苦裏", "苦卤": "苦鹵", "范仲淹": "范仲淹", "范蠡": "范蠡", "范阳": "范陽", "茅台": "茅臺", "茶几": "茶几", "草丛里": "草叢裡", "庄里": "莊裡", "茎干": "莖幹", "莽荡": "莽蕩", "菌丝体": "菌絲体", "菌丝体": "菌絲體", "华里": "華裡", "华发": "華髮", "万卷": "萬卷", "万历": "萬曆", "万只": "萬隻", "落发": "落髮", "着儿": "著兒", "着书立说": "著書立說", "着色软体": "著色軟體", "着重指出": "著重指出", "着录": "著錄", "着录规则": "著錄規則", "蓄发": "蓄髮", "蓄须": "蓄鬚", "蓬发": "蓬髮", "蓬松": "蓬鬆", "莲台": "蓮臺", "荡来荡去": "蕩來蕩去", "荡女": "蕩女", "荡妇": "蕩婦", "荡寇": "蕩寇", "荡平": "蕩平", "荡涤": "蕩滌", "荡漾": "蕩漾", "荡然": "蕩然", "荡舟": "蕩舟", "荡船": "蕩船", "荡荡": "蕩蕩", "薑丝": "薑絲", "薙发": "薙髮", "借以": "藉以", "借口": "藉口", "借故": "藉故", "借机": "藉機", "借此": "藉此", "借由": "藉由", "借端": "藉端", "借着": "藉著", "借借": "藉藉", "借词": "藉詞", "借资": "藉資", "借酒浇愁": "藉酒澆愁", "藤制": "藤製", "蕴含着": "蘊含著", "蕴涵着": "蘊涵著", "蕴借": "蘊藉", "萝卜": "蘿蔔", "虎须": "虎鬚", "号志": "號誌", "蜂后": "蜂后", "蛮干": "蠻幹", "行事历": "行事曆", "胡同": "衚衕", "冲上": "衝上", "冲下": "衝下", "冲来": "衝來", "冲倒": "衝倒", "冲出": "衝出", "冲到": "衝到", "冲刺": "衝刺", "冲克": "衝剋", "冲力": "衝力", "冲劲": "衝勁", "冲动": "衝動", "冲去": "衝去", "冲口": "衝口", "冲垮": "衝垮", "冲堂": "衝堂", "冲压": "衝壓", "冲天": "衝天", "冲掉": "衝掉", "冲撞": "衝撞", "冲击": "衝擊", "冲散": "衝散", "冲决": "衝決", "冲浪": "衝浪", "冲激": "衝激", "冲破": "衝破", "冲程": "衝程", "冲突": "衝突", "冲线": "衝線", "冲着": "衝著", "冲冲": "衝衝", "冲要": "衝要", "冲起": "衝起", "冲进": "衝進", "冲过": "衝過", "冲锋": "衝鋒", "表里": "表裡", "袖里": "袖裡", "被里": "被裡", "被复": "被複", "被复": "被覆", "被复着": "被覆著", "被发": "被髮", "裁并": "裁併", "裁制": "裁製", "里面": "裏面", "里人": "裡人", "里加": "裡加", "里外": "裡外", "里子": "裡子", "里屋": "裡屋", "里层": "裡層", "里布": "裡布", "里带": "裡帶", "里弦": "裡弦", "里应外合": "裡應外合", "里拉": "裡拉", "里斯": "裡斯", "里海": "裡海", "里脊": "裡脊", "里衣": "裡衣", "里里": "裡裡", "里通外国": "裡通外國", "里通外敌": "裡通外敵", "里边": "裡邊", "里间": "裡間", "里面": "裡面", "里头": "裡頭", "制件": "製件", "制作": "製作", "制做": "製做", "制备": "製備", "制冰": "製冰", "制冷": "製冷", "制剂": "製劑", "制品": "製品", "制图": "製圖", "制成": "製成", "制法": "製法", "制为": "製為", "制片": "製片", "制版": "製版", "制程": "製程", "制糖": "製糖", "制纸": "製紙", "制药": "製藥", "制表": "製表", "制裁": "製裁", "制造": "製造", "制革": "製革", "制鞋": "製鞋", "制盐": "製鹽", "复仞年如": "複仞年如", "复以百万": "複以百萬", "复位": "複位", "复信": "複信", "复分数": "複分數", "复列": "複列", "复利": "複利", "复印": "複印", "复原": "複原", "复句": "複句", "复合": "複合", "复名": "複名", "复员": "複員", "复壁": "複壁", "复壮": "複壯", "复姓": "複姓", "复字键": "複字鍵", "复审": "複審", "复写": "複寫", "复式": "複式", "复复": "複復", "复数": "複數", "复本": "複本", "复查": "複查", "复核": "複核", "复检": "複檢", "复次": "複次", "复比": "複比", "复决": "複決", "复活": "複活", "复测": "複測", "复亩珍": "複畝珍", "复发": "複發", "复目": "複目", "复眼": "複眼", "复种": "複種", "复线": "複線", "复习": "複習", "复兴社": "複興社", "复旧": "複舊", "复色": "複色", "复叶": "複葉", "复盖": "複蓋", "复苏": "複蘇", "复制": "複製", "复诊": "複診", "复词": "複詞", "复试": "複試", "复课": "複課", "复议": "複議", "复变函数": "複變函數", "复赛": "複賽", "复述": "複述", "复选": "複選", "复钱": "複錢", "复杂": "複雜", "复电": "複電", "复音": "複音", "复韵": "複韻", "衬里": "襯裡", "西岳": "西嶽", "西征": "西征", "西历": "西曆", "要冲": "要衝", "要么": "要麼", "复上": "覆上", "复亡": "覆亡", "复住": "覆住", "复信": "覆信", "复命": "覆命", "复在": "覆在", "复审": "覆審", "复巢之下": "覆巢之下", "复成": "覆成", "复败": "覆敗", "复文": "覆文", "复校": "覆校", "复核": "覆核", "复水难收": "覆水難收", "复没": "覆沒", "复灭": "覆滅", "复盆": "覆盆", "复舟": "覆舟", "复着": "覆著", "复盖": "覆蓋", "复盖着": "覆蓋著", "复试": "覆試", "复议": "覆議", "复车": "覆車", "复载": "覆載", "复辙": "覆轍", "复电": "覆電", "见复": "見覆", "亲征": "親征", "观众台": "觀眾臺", "观台": "觀臺", "观象台": "觀象臺", "角落里": "角落裡", "觔斗": "觔斗", "触须": "觸鬚", "订制": "訂製", "诉说着": "訴說著", "词汇": "詞彙", "试卷": "試卷", "诗卷": "詩卷", "话里有话": "話裡有話", "志哀": "誌哀", "志喜": "誌喜", "志庆": "誌慶", "语云": "語云", "语汇": "語彙", "诬蔑": "誣衊", "诵经台": "誦經臺", "说着": "說著", "课征": "課征", "调制": "調製", "调频台": "調頻臺", "请参阅": "請參閱", "讲台": "講臺", "谢绝参观": "謝絕參觀", "护发": "護髮", "雠隙": "讎隙", "豆腐干": "豆腐干", "竖着": "豎著", "丰富多采": "豐富多采", "丰滨": "豐濱", "丰滨乡": "豐濱鄉", "丰采": "豐采", "象征着": "象徵著", "贵干": "貴幹", "贾后": "賈后", "赈饥": "賑饑", "贤后": "賢后", "质朴": "質朴", "赌台": "賭檯", "购并": "購併", "赤松": "赤鬆", "起吊": "起吊", "起复": "起複", "赶制": "趕製", "跌荡": "跌蕩", "跟斗": "跟斗", "跳荡": "跳蕩", "跳表": "跳錶", "踬仆": "躓仆", "躯干": "軀幹", "车库里": "車庫裡", "车站里": "車站裡", "车里": "車裡", "轻松": "輕鬆", "轮回": "輪迴", "转台": "轉檯", "辛丑": "辛丑", "辟邪": "辟邪", "办伙": "辦伙", "办公台": "辦公檯", "辞汇": "辭彙", "农历": "農曆", "迂回": "迂迴", "近日里": "近日裡", "迥然回异": "迥然迴異", "回光返照": "迴光返照", "回向": "迴向", "回圈": "迴圈", "回廊": "迴廊", "回形夹": "迴形夾", "回文": "迴文", "回旋": "迴旋", "回流": "迴流", "回环": "迴環", "回荡": "迴盪", "回纹针": "迴紋針", "回绕": "迴繞", "回肠": "迴腸", "回荡": "迴蕩", "回诵": "迴誦", "回路": "迴路", "回转": "迴轉", "回递性": "迴遞性", "回避": "迴避", "回响": "迴響", "回风": "迴風", "回首": "迴首", "迷蒙": "迷濛", "退伙": "退伙", "这么着": "這么著", "这里": "這裏", "这里": "這裡", "这只": "這隻", "这么": "這麼", "这么着": "這麼著", "通心面": "通心麵", "速食面": "速食麵", "连系": "連繫", "连台好戏": "連臺好戲", "游荡": "遊蕩", "遍布": "遍佈", "递回": "遞迴", "远征": "遠征", "适才": "適纔", "遮复": "遮覆", "还冲": "還衝", "邋里邋遢": "邋裡邋遢", "那里": "那裡", "那只": "那隻", "那么": "那麼", "那么着": "那麼著", "邪辟": "邪辟", "郁烈": "郁烈", "郁穆": "郁穆", "郁郁": "郁郁", "郁闭": "郁閉", "郁馥": "郁馥", "乡愿": "鄉愿", "乡里": "鄉裡", "邻里": "鄰裡", "配合着": "配合著", "配制": "配製", "酒杯": "酒盃", "酒坛": "酒罈", "酥松": "酥鬆", "醋坛": "醋罈", "酝借": "醞藉", "酝酿着": "醞釀著", "医药": "醫葯", "醲郁": "醲郁", "酿制": "釀製", "采地": "采地", "采女": "采女", "采声": "采聲", "采色": "采色", "采邑": "采邑", "里程表": "里程錶", "重折": "重摺", "重复": "重複", "重复": "重覆", "重锤": "重鎚", "野台戏": "野臺戲", "金斗": "金斗", "金表": "金錶", "金发": "金髮", "金霉素": "金黴素", "钉锤": "釘鎚", "银朱": "銀硃", "银发": "銀髮", "铜制": "銅製", "铝制": "鋁製", "钢制": "鋼製", "录着": "錄著", "录制": "錄製", "表带": "錶帶", "表店": "錶店", "表厂": "錶廠", "表壳": "錶殼", "表链": "錶鏈", "表面": "錶面", "锅台": "鍋臺", "锻鍊出": "鍛鍊出", "锻鍊身体": "鍛鍊身体", "锲而不舍": "鍥而不捨", "锤儿": "鎚兒", "锤子": "鎚子", "锤头": "鎚頭", "链霉素": "鏈黴素", "镜台": "鏡臺", "锈病": "鏽病", "锈菌": "鏽菌", "锈蚀": "鏽蝕", "钟表": "鐘錶", "铁锤": "鐵鎚", "铁锈": "鐵鏽", "长征": "長征", "长发": "長髮", "长须鲸": "長鬚鯨", "门帘": "門帘", "门斗": "門斗", "门里": "門裡", "开伙": "開伙", "开卷": "開卷", "开诚布公": "開誠佈公", "开采": "開采", "閒情逸致": "閒情逸緻", "閒荡": "閒蕩", "间不容发": "間不容髮", "闵采尔": "閔采爾", "阅卷": "閱卷", "阑干": "闌干", "关系": "關係", "关系着": "關係著", "防御": "防禦", "防锈": "防鏽", "防台": "防颱", "阿斗": "阿斗", "阿里": "阿裡", "除旧布新": "除舊佈新", "阴干": "陰干", "阴历": "陰曆", "阴郁": "陰郁", "陆征祥": "陸征祥", "阳春面": "陽春麵", "阳历": "陽曆", "阳台": "陽臺", "只字": "隻字", "只影": "隻影", "只手遮天": "隻手遮天", "只眼": "隻眼", "只言片语": "隻言片語", "只身": "隻身", "雅致": "雅緻", "雇佣": "雇佣", "双折": "雙摺", "杂志": "雜誌", "鸡丝": "雞絲", "鸡丝面": "雞絲麵", "鸡腿面": "雞腿麵", "鸡只": "雞隻", "难舍": "難捨", "雪里": "雪裡", "云须": "雲鬚", "电子表": "電子錶", "电台": "電臺", "电冲": "電衝", "电复": "電覆", "电视台": "電視臺", "电表": "電錶", "震荡": "震蕩", "雾里": "霧裡", "露台": "露臺", "灵台": "靈臺", "青瓦台": "青瓦臺", "青霉": "青黴", "面朝着": "面朝著", "面临着": "面臨著", "鞋里": "鞋裡", "鞣制": "鞣製", "秋千": "鞦韆", "鞭辟入里": "鞭辟入裡", "韩国制": "韓國製", "韩制": "韓製", "预制": "預製", "颁布": "頒佈", "头里": "頭裡", "头发": "頭髮", "颊须": "頰鬚", "颠仆": "顛仆", "颠复": "顛複", "颠复": "顛覆", "显着标志": "顯著標志", "风土志": "風土誌", "风斗": "風斗", "风物志": "風物誌", "风里": "風裡", "风采": "風采", "台风": "颱風", "刮了": "颳了", "刮倒": "颳倒", "刮去": "颳去", "刮得": "颳得", "刮着": "颳著", "刮走": "颳走", "刮起": "颳起", "刮风": "颳風", "飘荡": "飄蕩", "饭团": "飯糰", "饼干": "餅干", "馄饨面": "餛飩麵", "饥不择食": "饑不擇食", "饥寒": "饑寒", "饥民": "饑民", "饥渴": "饑渴", "饥溺": "饑溺", "饥荒": "饑荒", "饥饱": "饑飽", "饥饿": "饑餓", "饥馑": "饑饉", "首当其冲": "首當其衝", "香郁": "香郁", "馥郁": "馥郁", "马里": "馬裡", "马表": "馬錶", "骀荡": "駘蕩", "腾冲": "騰衝", "骨子里": "骨子裡", "骨干": "骨幹", "骨灰坛": "骨灰罈", "肮脏": "骯髒", "脏乱": "髒亂", "脏兮兮": "髒兮兮", "脏字": "髒字", "脏得": "髒得", "脏东西": "髒東西", "脏水": "髒水", "脏的": "髒的", "脏话": "髒話", "脏钱": "髒錢", "高干": "高幹", "高台": "高臺", "髭须": "髭鬚", "发型": "髮型", "发夹": "髮夾", "发妻": "髮妻", "发姐": "髮姐", "发带": "髮帶", "发廊": "髮廊", "发式": "髮式", "发指": "髮指", "发捲": "髮捲", "发根": "髮根", "发毛": "髮毛", "发油": "髮油", "发状": "髮狀", "发短心长": "髮短心長", "发端": "髮端", "发结": "髮結", "发丝": "髮絲", "发网": "髮網", "发肤": "髮膚", "发胶": "髮膠", "发菜": "髮菜", "发蜡": "髮蠟", "发辫": "髮辮", "发针": "髮針", "发长": "髮長", "发际": "髮際", "发霜": "髮霜", "发髻": "髮髻", "发鬓": "髮鬢", "鬅松": "鬅鬆", "松了": "鬆了", "松些": "鬆些", "松劲": "鬆勁", "松动": "鬆動", "松口": "鬆口", "松土": "鬆土", "松弛": "鬆弛", "松快": "鬆快", "松懈": "鬆懈", "松手": "鬆手", "松散": "鬆散", "松林": "鬆林", "松柔": "鬆柔", "松毛虫": "鬆毛蟲", "松浮": "鬆浮", "松涛": "鬆濤", "松科": "鬆科", "松节油": "鬆節油", "松绑": "鬆綁", "松紧": "鬆緊", "松缓": "鬆緩", "松脆": "鬆脆", "松脱": "鬆脫", "松起": "鬆起", "松软": "鬆軟", "松通": "鬆通", "松开": "鬆開", "松饼": "鬆餅", "松松": "鬆鬆", "鬈发": "鬈髮", "胡子": "鬍子", "胡梢": "鬍梢", "胡渣": "鬍渣", "胡髭": "鬍髭", "胡须": "鬍鬚", "须根": "鬚根", "须毛": "鬚毛", "须生": "鬚生", "须眉": "鬚眉", "须发": "鬚髮", "须须": "鬚鬚", "鬓发": "鬢髮", "斗着": "鬥著", "闹着玩儿": "鬧著玩儿", "闹着玩儿": "鬧著玩兒", "郁郁": "鬱郁", "鱼松": "魚鬆", "鲸须": "鯨鬚", "鲇鱼": "鯰魚", "鹤发": "鶴髮", "卤化": "鹵化", "卤味": "鹵味", "卤族": "鹵族", "卤水": "鹵水", "卤汁": "鹵汁", "卤簿": "鹵簿", "卤素": "鹵素", "卤莽": "鹵莽", "卤钝": "鹵鈍", "咸味": "鹹味", "咸土": "鹹土", "咸度": "鹹度", "咸得": "鹹得", "咸水": "鹹水", "咸海": "鹹海", "咸淡": "鹹淡", "咸湖": "鹹湖", "咸汤": "鹹湯", "咸的": "鹹的", "咸肉": "鹹肉", "咸菜": "鹹菜", "咸蛋": "鹹蛋", "咸猪肉": "鹹豬肉", "咸类": "鹹類", "咸鱼": "鹹魚", "咸鸭蛋": "鹹鴨蛋", "咸卤": "鹹鹵", "咸咸": "鹹鹹", "盐卤": "鹽鹵", "面价": "麵價", "面包": "麵包", "面团": "麵團", "面店": "麵店", "面厂": "麵廠", "面杖": "麵杖", "面条": "麵條", "面灰": "麵灰", "面皮": "麵皮", "面筋": "麵筋", "面粉": "麵粉", "面糊": "麵糊", "面线": "麵線", "面茶": "麵茶", "面食": "麵食", "面饺": "麵餃", "面饼": "麵餅", "麻酱面": "麻醬麵", "黄历": "黃曆", "黄发垂髫": "黃髮垂髫", "黑发": "黑髮", "黑松": "黑鬆", "霉毒": "黴毒", "霉菌": "黴菌", "鼓里": "鼓裡", "冬冬": "鼕鼕", "龙卷": "龍卷", "龙须": "龍鬚", } zh2Hans = { '顯著': '显著', '土著': '土著', '印表機': '打印机', '說明檔案': '帮助文件', '舖': '铺', "瀋": "沈", "畫": "划", "鍾": "钟", "靦": "腼", "餘": "余", "鯰": "鲇", "鹼": "碱", "㠏": "㟆", "𡞵": "㛟", "万": "万", "与": "与", "丑": "丑", "丟": "丢", "並": "并", "丰": "丰", "么": "么", "乾": "干", "乾坤": "乾坤", "乾隆": "乾隆", "亂": "乱", "云": "云", "亙": "亘", "亞": "亚", "仆": "仆", "价": "价", "伙": "伙", "佇": "伫", "佈": "布", "体": "体", "余": "余", "余": "馀", "佣": "佣", "併": "并", "來": "来", "侖": "仑", "侶": "侣", "俁": "俣", "係": "系", "俔": "伣", "俠": "侠", "倀": "伥", "倆": "俩", "倈": "俫", "倉": "仓", "個": "个", "們": "们", "倫": "伦", "偉": "伟", "側": "侧", "偵": "侦", "偽": "伪", "傑": "杰", "傖": "伧", "傘": "伞", "備": "备", "傢": "家", "傭": "佣", "傯": "偬", "傳": "传", "傴": "伛", "債": "债", "傷": "伤", "傾": "倾", "僂": "偻", "僅": "仅", "僉": "佥", "僑": "侨", "僕": "仆", "僞": "伪", "僥": "侥", "僨": "偾", "價": "价", "儀": "仪", "儂": "侬", "億": "亿", "儈": "侩", "儉": "俭", "儐": "傧", "儔": "俦", "儕": "侪", "儘": "尽", "償": "偿", "優": "优", "儲": "储", "儷": "俪", "儸": "㑩", "儺": "傩", "儻": "傥", "儼": "俨", "儿": "儿", "兇": "凶", "兌": "兑", "兒": "儿", "兗": "兖", "党": "党", "內": "内", "兩": "两", "冊": "册", "冪": "幂", "准": "准", "凈": "净", "凍": "冻", "凜": "凛", "几": "几", "凱": "凯", "划": "划", "別": "别", "刪": "删", "剄": "刭", "則": "则", "剋": "克", "剎": "刹", "剗": "刬", "剛": "刚", "剝": "剥", "剮": "剐", "剴": "剀", "創": "创", "劃": "划", "劇": "剧", "劉": "刘", "劊": "刽", "劌": "刿", "劍": "剑", "劏": "㓥", "劑": "剂", "劚": "㔉", "勁": "劲", "動": "动", "務": "务", "勛": "勋", "勝": "胜", "勞": "劳", "勢": "势", "勩": "勚", "勱": "劢", "勵": "励", "勸": "劝", "勻": "匀", "匭": "匦", "匯": "汇", "匱": "匮", "區": "区", "協": "协", "卷": "卷", "卻": "却", "厂": "厂", "厙": "厍", "厠": "厕", "厭": "厌", "厲": "厉", "厴": "厣", "參": "参", "叄": "叁", "叢": "丛", "台": "台", "叶": "叶", "吊": "吊", "后": "后", "吒": "咤", "吳": "吴", "吶": "呐", "呂": "吕", "獃": "呆", "咼": "呙", "員": "员", "唄": "呗", "唚": "吣", "問": "问", "啓": "启", "啞": "哑", "啟": "启", "啢": "唡", "喎": "㖞", "喚": "唤", "喪": "丧", "喬": "乔", "單": "单", "喲": "哟", "嗆": "呛", "嗇": "啬", "嗊": "唝", "嗎": "吗", "嗚": "呜", "嗩": "唢", "嗶": "哔", "嘆": "叹", "嘍": "喽", "嘔": "呕", "嘖": "啧", "嘗": "尝", "嘜": "唛", "嘩": "哗", "嘮": "唠", "嘯": "啸", "嘰": "叽", "嘵": "哓", "嘸": "呒", "嘽": "啴", "噁": "恶", "噓": "嘘", "噚": "㖊", "噝": "咝", "噠": "哒", "噥": "哝", "噦": "哕", "噯": "嗳", "噲": "哙", "噴": "喷", "噸": "吨", "噹": "当", "嚀": "咛", "嚇": "吓", "嚌": "哜", "嚕": "噜", "嚙": "啮", "嚥": "咽", "嚦": "呖", "嚨": "咙", "嚮": "向", "嚲": "亸", "嚳": "喾", "嚴": "严", "嚶": "嘤", "囀": "啭", "囁": "嗫", "囂": "嚣", "囅": "冁", "囈": "呓", "囌": "苏", "囑": "嘱", "囪": "囱", "圇": "囵", "國": "国", "圍": "围", "園": "园", "圓": "圆", "圖": "图", "團": "团", "坏": "坏", "垵": "埯", "埡": "垭", "埰": "采", "執": "执", "堅": "坚", "堊": "垩", "堖": "垴", "堝": "埚", "堯": "尧", "報": "报", "場": "场", "塊": "块", "塋": "茔", "塏": "垲", "塒": "埘", "塗": "涂", "塚": "冢", "塢": "坞", "塤": "埙", "塵": "尘", "塹": "堑", "墊": "垫", "墜": "坠", "墮": "堕", "墳": "坟", "墻": "墙", "墾": "垦", "壇": "坛", "壈": "𡒄", "壋": "垱", "壓": "压", "壘": "垒", "壙": "圹", "壚": "垆", "壞": "坏", "壟": "垄", "壠": "垅", "壢": "坜", "壩": "坝", "壯": "壮", "壺": "壶", "壼": "壸", "壽": "寿", "夠": "够", "夢": "梦", "夾": "夹", "奐": "奂", "奧": "奥", "奩": "奁", "奪": "夺", "奬": "奖", "奮": "奋", "奼": "姹", "妝": "妆", "姍": "姗", "姜": "姜", "姦": "奸", "娛": "娱", "婁": "娄", "婦": "妇", "婭": "娅", "媧": "娲", "媯": "妫", "媼": "媪", "媽": "妈", "嫗": "妪", "嫵": "妩", "嫻": "娴", "嫿": "婳", "嬀": "妫", "嬈": "娆", "嬋": "婵", "嬌": "娇", "嬙": "嫱", "嬡": "嫒", "嬤": "嬷", "嬪": "嫔", "嬰": "婴", "嬸": "婶", "孌": "娈", "孫": "孙", "學": "学", "孿": "孪", "宁": "宁", "宮": "宫", "寢": "寝", "實": "实", "寧": "宁", "審": "审", "寫": "写", "寬": "宽", "寵": "宠", "寶": "宝", "將": "将", "專": "专", "尋": "寻", "對": "对", "導": "导", "尷": "尴", "屆": "届", "屍": "尸", "屓": "屃", "屜": "屉", "屢": "屡", "層": "层", "屨": "屦", "屬": "属", "岡": "冈", "峴": "岘", "島": "岛", "峽": "峡", "崍": "崃", "崗": "岗", "崢": "峥", "崬": "岽", "嵐": "岚", "嶁": "嵝", "嶄": "崭", "嶇": "岖", "嶔": "嵚", "嶗": "崂", "嶠": "峤", "嶢": "峣", "嶧": "峄", "嶮": "崄", "嶴": "岙", "嶸": "嵘", "嶺": "岭", "嶼": "屿", "嶽": "岳", "巋": "岿", "巒": "峦", "巔": "巅", "巰": "巯", "帘": "帘", "帥": "帅", "師": "师", "帳": "帐", "帶": "带", "幀": "帧", "幃": "帏", "幗": "帼", "幘": "帻", "幟": "帜", "幣": "币", "幫": "帮", "幬": "帱", "幹": "干", "幺": "么", "幾": "几", "广": "广", "庫": "库", "廁": "厕", "廂": "厢", "廄": "厩", "廈": "厦", "廚": "厨", "廝": "厮", "廟": "庙", "廠": "厂", "廡": "庑", "廢": "废", "廣": "广", "廩": "廪", "廬": "庐", "廳": "厅", "弒": "弑", "弳": "弪", "張": "张", "強": "强", "彆": "别", "彈": "弹", "彌": "弥", "彎": "弯", "彙": "汇", "彞": "彝", "彥": "彦", "征": "征", "後": "后", "徑": "径", "從": "从", "徠": "徕", "復": "复", "徵": "征", "徹": "彻", "志": "志", "恆": "恒", "恥": "耻", "悅": "悦", "悞": "悮", "悵": "怅", "悶": "闷", "惡": "恶", "惱": "恼", "惲": "恽", "惻": "恻", "愛": "爱", "愜": "惬", "愨": "悫", "愴": "怆", "愷": "恺", "愾": "忾", "愿": "愿", "慄": "栗", "態": "态", "慍": "愠", "慘": "惨", "慚": "惭", "慟": "恸", "慣": "惯", "慤": "悫", "慪": "怄", "慫": "怂", "慮": "虑", "慳": "悭", "慶": "庆", "憂": "忧", "憊": "惫", "憐": "怜", "憑": "凭", "憒": "愦", "憚": "惮", "憤": "愤", "憫": "悯", "憮": "怃", "憲": "宪", "憶": "忆", "懇": "恳", "應": "应", "懌": "怿", "懍": "懔", "懞": "蒙", "懟": "怼", "懣": "懑", "懨": "恹", "懲": "惩", "懶": "懒", "懷": "怀", "懸": "悬", "懺": "忏", "懼": "惧", "懾": "慑", "戀": "恋", "戇": "戆", "戔": "戋", "戧": "戗", "戩": "戬", "戰": "战", "戱": "戯", "戲": "戏", "戶": "户", "担": "担", "拋": "抛", "挩": "捝", "挾": "挟", "捨": "舍", "捫": "扪", "据": "据", "掃": "扫", "掄": "抡", "掗": "挜", "掙": "挣", "掛": "挂", "採": "采", "揀": "拣", "揚": "扬", "換": "换", "揮": "挥", "損": "损", "搖": "摇", "搗": "捣", "搵": "揾", "搶": "抢", "摑": "掴", "摜": "掼", "摟": "搂", "摯": "挚", "摳": "抠", "摶": "抟", "摺": "折", "摻": "掺", "撈": "捞", "撏": "挦", "撐": "撑", "撓": "挠", "撝": "㧑", "撟": "挢", "撣": "掸", "撥": "拨", "撫": "抚", "撲": "扑", "撳": "揿", "撻": "挞", "撾": "挝", "撿": "捡", "擁": "拥", "擄": "掳", "擇": "择", "擊": "击", "擋": "挡", "擓": "㧟", "擔": "担", "據": "据", "擠": "挤", "擬": "拟", "擯": "摈", "擰": "拧", "擱": "搁", "擲": "掷", "擴": "扩", "擷": "撷", "擺": "摆", "擻": "擞", "擼": "撸", "擾": "扰", "攄": "摅", "攆": "撵", "攏": "拢", "攔": "拦", "攖": "撄", "攙": "搀", "攛": "撺", "攜": "携", "攝": "摄", "攢": "攒", "攣": "挛", "攤": "摊", "攪": "搅", "攬": "揽", "敗": "败", "敘": "叙", "敵": "敌", "數": "数", "斂": "敛", "斃": "毙", "斕": "斓", "斗": "斗", "斬": "斩", "斷": "断", "於": "于", "時": "时", "晉": "晋", "晝": "昼", "暈": "晕", "暉": "晖", "暘": "旸", "暢": "畅", "暫": "暂", "曄": "晔", "曆": "历", "曇": "昙", "曉": "晓", "曏": "向", "曖": "暧", "曠": "旷", "曨": "昽", "曬": "晒", "書": "书", "會": "会", "朧": "胧", "朮": "术", "术": "术", "朴": "朴", "東": "东", "杴": "锨", "极": "极", "柜": "柜", "柵": "栅", "桿": "杆", "梔": "栀", "梘": "枧", "條": "条", "梟": "枭", "梲": "棁", "棄": "弃", "棖": "枨", "棗": "枣", "棟": "栋", "棧": "栈", "棲": "栖", "棶": "梾", "椏": "桠", "楊": "杨", "楓": "枫", "楨": "桢", "業": "业", "極": "极", "榪": "杩", "榮": "荣", "榲": "榅", "榿": "桤", "構": "构", "槍": "枪", "槤": "梿", "槧": "椠", "槨": "椁", "槳": "桨", "樁": "桩", "樂": "乐", "樅": "枞", "樓": "楼", "標": "标", "樞": "枢", "樣": "样", "樸": "朴", "樹": "树", "樺": "桦", "橈": "桡", "橋": "桥", "機": "机", "橢": "椭", "橫": "横", "檁": "檩", "檉": "柽", "檔": "档", "檜": "桧", "檟": "槚", "檢": "检", "檣": "樯", "檮": "梼", "檯": "台", "檳": "槟", "檸": "柠", "檻": "槛", "櫃": "柜", "櫓": "橹", "櫚": "榈", "櫛": "栉", "櫝": "椟", "櫞": "橼", "櫟": "栎", "櫥": "橱", "櫧": "槠", "櫨": "栌", "櫪": "枥", "櫫": "橥", "櫬": "榇", "櫱": "蘖", "櫳": "栊", "櫸": "榉", "櫻": "樱", "欄": "栏", "權": "权", "欏": "椤", "欒": "栾", "欖": "榄", "欞": "棂", "欽": "钦", "歐": "欧", "歟": "欤", "歡": "欢", "歲": "岁", "歷": "历", "歸": "归", "歿": "殁", "殘": "残", "殞": "殒", "殤": "殇", "殨": "㱮", "殫": "殚", "殮": "殓", "殯": "殡", "殰": "㱩", "殲": "歼", "殺": "杀", "殻": "壳", "殼": "壳", "毀": "毁", "毆": "殴", "毿": "毵", "氂": "牦", "氈": "毡", "氌": "氇", "氣": "气", "氫": "氢", "氬": "氩", "氳": "氲", "汙": "污", "決": "决", "沒": "没", "沖": "冲", "況": "况", "洶": "汹", "浹": "浃", "涂": "涂", "涇": "泾", "涼": "凉", "淀": "淀", "淒": "凄", "淚": "泪", "淥": "渌", "淨": "净", "淩": "凌", "淪": "沦", "淵": "渊", "淶": "涞", "淺": "浅", "渙": "涣", "減": "减", "渦": "涡", "測": "测", "渾": "浑", "湊": "凑", "湞": "浈", "湯": "汤", "溈": "沩", "準": "准", "溝": "沟", "溫": "温", "滄": "沧", "滅": "灭", "滌": "涤", "滎": "荥", "滬": "沪", "滯": "滞", "滲": "渗", "滷": "卤", "滸": "浒", "滻": "浐", "滾": "滚", "滿": "满", "漁": "渔", "漚": "沤", "漢": "汉", "漣": "涟", "漬": "渍", "漲": "涨", "漵": "溆", "漸": "渐", "漿": "浆", "潁": "颍", "潑": "泼", "潔": "洁", "潙": "沩", "潛": "潜", "潤": "润", "潯": "浔", "潰": "溃", "潷": "滗", "潿": "涠", "澀": "涩", "澆": "浇", "澇": "涝", "澐": "沄", "澗": "涧", "澠": "渑", "澤": "泽", "澦": "滪", "澩": "泶", "澮": "浍", "澱": "淀", "濁": "浊", "濃": "浓", "濕": "湿", "濘": "泞", "濛": "蒙", "濟": "济", "濤": "涛", "濫": "滥", "濰": "潍", "濱": "滨", "濺": "溅", "濼": "泺", "濾": "滤", "瀅": "滢", "瀆": "渎", "瀇": "㲿", "瀉": "泻", "瀋": "沈", "瀏": "浏", "瀕": "濒", "瀘": "泸", "瀝": "沥", "瀟": "潇", "瀠": "潆", "瀦": "潴", "瀧": "泷", "瀨": "濑", "瀰": "弥", "瀲": "潋", "瀾": "澜", "灃": "沣", "灄": "滠", "灑": "洒", "灕": "漓", "灘": "滩", "灝": "灏", "灠": "漤", "灣": "湾", "灤": "滦", "灧": "滟", "災": "灾", "為": "为", "烏": "乌", "烴": "烃", "無": "无", "煉": "炼", "煒": "炜", "煙": "烟", "煢": "茕", "煥": "焕", "煩": "烦", "煬": "炀", "煱": "㶽", "熅": "煴", "熒": "荧", "熗": "炝", "熱": "热", "熲": "颎", "熾": "炽", "燁": "烨", "燈": "灯", "燉": "炖", "燒": "烧", "燙": "烫", "燜": "焖", "營": "营", "燦": "灿", "燭": "烛", "燴": "烩", "燶": "㶶", "燼": "烬", "燾": "焘", "爍": "烁", "爐": "炉", "爛": "烂", "爭": "争", "爲": "为", "爺": "爷", "爾": "尔", "牆": "墙", "牘": "牍", "牽": "牵", "犖": "荦", "犢": "犊", "犧": "牺", "狀": "状", "狹": "狭", "狽": "狈", "猙": "狰", "猶": "犹", "猻": "狲", "獁": "犸", "獄": "狱", "獅": "狮", "獎": "奖", "獨": "独", "獪": "狯", "獫": "猃", "獮": "狝", "獰": "狞", "獱": "㺍", "獲": "获", "獵": "猎", "獷": "犷", "獸": "兽", "獺": "獭", "獻": "献", "獼": "猕", "玀": "猡", "現": "现", "琺": "珐", "琿": "珲", "瑋": "玮", "瑒": "玚", "瑣": "琐", "瑤": "瑶", "瑩": "莹", "瑪": "玛", "瑲": "玱", "璉": "琏", "璣": "玑", "璦": "瑷", "璫": "珰", "環": "环", "璽": "玺", "瓊": "琼", "瓏": "珑", "瓔": "璎", "瓚": "瓒", "甌": "瓯", "產": "产", "産": "产", "畝": "亩", "畢": "毕", "異": "异", "畵": "画", "當": "当", "疇": "畴", "疊": "叠", "痙": "痉", "痾": "疴", "瘂": "痖", "瘋": "疯", "瘍": "疡", "瘓": "痪", "瘞": "瘗", "瘡": "疮", "瘧": "疟", "瘮": "瘆", "瘲": "疭", "瘺": "瘘", "瘻": "瘘", "療": "疗", "癆": "痨", "癇": "痫", "癉": "瘅", "癘": "疠", "癟": "瘪", "癢": "痒", "癤": "疖", "癥": "症", "癧": "疬", "癩": "癞", "癬": "癣", "癭": "瘿", "癮": "瘾", "癰": "痈", "癱": "瘫", "癲": "癫", "發": "发", "皚": "皑", "皰": "疱", "皸": "皲", "皺": "皱", "盃": "杯", "盜": "盗", "盞": "盏", "盡": "尽", "監": "监", "盤": "盘", "盧": "卢", "盪": "荡", "眥": "眦", "眾": "众", "睏": "困", "睜": "睁", "睞": "睐", "瞘": "眍", "瞜": "䁖", "瞞": "瞒", "瞭": "了", "瞶": "瞆", "瞼": "睑", "矇": "蒙", "矓": "眬", "矚": "瞩", "矯": "矫", "硃": "朱", "硜": "硁", "硤": "硖", "硨": "砗", "确": "确", "硯": "砚", "碩": "硕", "碭": "砀", "碸": "砜", "確": "确", "碼": "码", "磑": "硙", "磚": "砖", "磣": "碜", "磧": "碛", "磯": "矶", "磽": "硗", "礆": "硷", "礎": "础", "礙": "碍", "礦": "矿", "礪": "砺", "礫": "砾", "礬": "矾", "礱": "砻", "祿": "禄", "禍": "祸", "禎": "祯", "禕": "祎", "禡": "祃", "禦": "御", "禪": "禅", "禮": "礼", "禰": "祢", "禱": "祷", "禿": "秃", "秈": "籼", "种": "种", "稅": "税", "稈": "秆", "稏": "䅉", "稟": "禀", "種": "种", "稱": "称", "穀": "谷", "穌": "稣", "積": "积", "穎": "颖", "穠": "秾", "穡": "穑", "穢": "秽", "穩": "稳", "穫": "获", "穭": "稆", "窩": "窝", "窪": "洼", "窮": "穷", "窯": "窑", "窵": "窎", "窶": "窭", "窺": "窥", "竄": "窜", "竅": "窍", "竇": "窦", "竈": "灶", "竊": "窃", "竪": "竖", "競": "竞", "筆": "笔", "筍": "笋", "筑": "筑", "筧": "笕", "筴": "䇲", "箋": "笺", "箏": "筝", "節": "节", "範": "范", "築": "筑", "篋": "箧", "篔": "筼", "篤": "笃", "篩": "筛", "篳": "筚", "簀": "箦", "簍": "篓", "簞": "箪", "簡": "简", "簣": "篑", "簫": "箫", "簹": "筜", "簽": "签", "簾": "帘", "籃": "篮", "籌": "筹", "籖": "签", "籙": "箓", "籜": "箨", "籟": "籁", "籠": "笼", "籩": "笾", "籪": "簖", "籬": "篱", "籮": "箩", "籲": "吁", "粵": "粤", "糝": "糁", "糞": "粪", "糧": "粮", "糰": "团", "糲": "粝", "糴": "籴", "糶": "粜", "糹": "纟", "糾": "纠", "紀": "纪", "紂": "纣", "約": "约", "紅": "红", "紆": "纡", "紇": "纥", "紈": "纨", "紉": "纫", "紋": "纹", "納": "纳", "紐": "纽", "紓": "纾", "純": "纯", "紕": "纰", "紖": "纼", "紗": "纱", "紘": "纮", "紙": "纸", "級": "级", "紛": "纷", "紜": "纭", "紝": "纴", "紡": "纺", "紬": "䌷", "細": "细", "紱": "绂", "紲": "绁", "紳": "绅", "紵": "纻", "紹": "绍", "紺": "绀", "紼": "绋", "紿": "绐", "絀": "绌", "終": "终", "組": "组", "絅": "䌹", "絆": "绊", "絎": "绗", "結": "结", "絕": "绝", "絛": "绦", "絝": "绔", "絞": "绞", "絡": "络", "絢": "绚", "給": "给", "絨": "绒", "絰": "绖", "統": "统", "絲": "丝", "絳": "绛", "絶": "绝", "絹": "绢", "綁": "绑", "綃": "绡", "綆": "绠", "綈": "绨", "綉": "绣", "綌": "绤", "綏": "绥", "綐": "䌼", "經": "经", "綜": "综", "綞": "缍", "綠": "绿", "綢": "绸", "綣": "绻", "綫": "线", "綬": "绶", "維": "维", "綯": "绹", "綰": "绾", "綱": "纲", "網": "网", "綳": "绷", "綴": "缀", "綵": "䌽", "綸": "纶", "綹": "绺", "綺": "绮", "綻": "绽", "綽": "绰", "綾": "绫", "綿": "绵", "緄": "绲", "緇": "缁", "緊": "紧", "緋": "绯", "緑": "绿", "緒": "绪", "緓": "绬", "緔": "绱", "緗": "缃", "緘": "缄", "緙": "缂", "線": "线", "緝": "缉", "緞": "缎", "締": "缔", "緡": "缗", "緣": "缘", "緦": "缌", "編": "编", "緩": "缓", "緬": "缅", "緯": "纬", "緱": "缑", "緲": "缈", "練": "练", "緶": "缏", "緹": "缇", "緻": "致", "縈": "萦", "縉": "缙", "縊": "缢", "縋": "缒", "縐": "绉", "縑": "缣", "縕": "缊", "縗": "缞", "縛": "缚", "縝": "缜", "縞": "缟", "縟": "缛", "縣": "县", "縧": "绦", "縫": "缝", "縭": "缡", "縮": "缩", "縱": "纵", "縲": "缧", "縳": "䌸", "縴": "纤", "縵": "缦", "縶": "絷", "縷": "缕", "縹": "缥", "總": "总", "績": "绩", "繃": "绷", "繅": "缫", "繆": "缪", "繒": "缯", "織": "织", "繕": "缮", "繚": "缭", "繞": "绕", "繡": "绣", "繢": "缋", "繩": "绳", "繪": "绘", "繫": "系", "繭": "茧", "繮": "缰", "繯": "缳", "繰": "缲", "繳": "缴", "繸": "䍁", "繹": "绎", "繼": "继", "繽": "缤", "繾": "缱", "繿": "䍀", "纈": "缬", "纊": "纩", "續": "续", "纍": "累", "纏": "缠", "纓": "缨", "纔": "才", "纖": "纤", "纘": "缵", "纜": "缆", "缽": "钵", "罈": "坛", "罌": "罂", "罰": "罚", "罵": "骂", "罷": "罢", "羅": "罗", "羆": "罴", "羈": "羁", "羋": "芈", "羥": "羟", "義": "义", "習": "习", "翹": "翘", "耬": "耧", "耮": "耢", "聖": "圣", "聞": "闻", "聯": "联", "聰": "聪", "聲": "声", "聳": "耸", "聵": "聩", "聶": "聂", "職": "职", "聹": "聍", "聽": "听", "聾": "聋", "肅": "肃", "胜": "胜", "脅": "胁", "脈": "脉", "脛": "胫", "脫": "脱", "脹": "胀", "腊": "腊", "腎": "肾", "腖": "胨", "腡": "脶", "腦": "脑", "腫": "肿", "腳": "脚", "腸": "肠", "膃": "腽", "膚": "肤", "膠": "胶", "膩": "腻", "膽": "胆", "膾": "脍", "膿": "脓", "臉": "脸", "臍": "脐", "臏": "膑", "臘": "腊", "臚": "胪", "臟": "脏", "臠": "脔", "臢": "臜", "臥": "卧", "臨": "临", "臺": "台", "與": "与", "興": "兴", "舉": "举", "舊": "旧", "艙": "舱", "艤": "舣", "艦": "舰", "艫": "舻", "艱": "艰", "艷": "艳", "芻": "刍", "苧": "苎", "苹": "苹", "范": "范", "茲": "兹", "荊": "荆", "莊": "庄", "莖": "茎", "莢": "荚", "莧": "苋", "華": "华", "萇": "苌", "萊": "莱", "萬": "万", "萵": "莴", "葉": "叶", "葒": "荭", "著": "着", "著名": "著名", "葤": "荮", "葦": "苇", "葯": "药", "葷": "荤", "蒓": "莼", "蒔": "莳", "蒞": "莅", "蒼": "苍", "蓀": "荪", "蓋": "盖", "蓮": "莲", "蓯": "苁", "蓴": "莼", "蓽": "荜", "蔔": "卜", "蔞": "蒌", "蔣": "蒋", "蔥": "葱", "蔦": "茑", "蔭": "荫", "蕁": "荨", "蕆": "蒇", "蕎": "荞", "蕒": "荬", "蕓": "芸", "蕕": "莸", "蕘": "荛", "蕢": "蒉", "蕩": "荡", "蕪": "芜", "蕭": "萧", "蕷": "蓣", "薀": "蕰", "薈": "荟", "薊": "蓟", "薌": "芗", "薔": "蔷", "薘": "荙", "薟": "莶", "薦": "荐", "薩": "萨", "薳": "䓕", "薴": "苧", "薺": "荠", "藉": "借", "藍": "蓝", "藎": "荩", "藝": "艺", "藥": "药", "藪": "薮", "藴": "蕴", "藶": "苈", "藹": "蔼", "藺": "蔺", "蘄": "蕲", "蘆": "芦", "蘇": "苏", "蘊": "蕴", "蘋": "苹", "蘚": "藓", "蘞": "蔹", "蘢": "茏", "蘭": "兰", "蘺": "蓠", "蘿": "萝", "虆": "蔂", "處": "处", "虛": "虚", "虜": "虏", "號": "号", "虧": "亏", "虫": "虫", "虯": "虬", "蛺": "蛱", "蛻": "蜕", "蜆": "蚬", "蜡": "蜡", "蝕": "蚀", "蝟": "猬", "蝦": "虾", "蝸": "蜗", "螄": "蛳", "螞": "蚂", "螢": "萤", "螮": "䗖", "螻": "蝼", "螿": "螀", "蟄": "蛰", "蟈": "蝈", "蟎": "螨", "蟣": "虮", "蟬": "蝉", "蟯": "蛲", "蟲": "虫", "蟶": "蛏", "蟻": "蚁", "蠅": "蝇", "蠆": "虿", "蠐": "蛴", "蠑": "蝾", "蠟": "蜡", "蠣": "蛎", "蠨": "蟏", "蠱": "蛊", "蠶": "蚕", "蠻": "蛮", "衆": "众", "衊": "蔑", "術": "术", "衕": "同", "衚": "胡", "衛": "卫", "衝": "冲", "衹": "只", "袞": "衮", "裊": "袅", "裏": "里", "補": "补", "裝": "装", "裡": "里", "製": "制", "複": "复", "褌": "裈", "褘": "袆", "褲": "裤", "褳": "裢", "褸": "褛", "褻": "亵", "襇": "裥", "襏": "袯", "襖": "袄", "襝": "裣", "襠": "裆", "襤": "褴", "襪": "袜", "襬": "䙓", "襯": "衬", "襲": "袭", "覆": "复", "覆蓋": "覆盖", "翻來覆去": "翻来覆去", "見": "见", "覎": "觃", "規": "规", "覓": "觅", "視": "视", "覘": "觇", "覡": "觋", "覥": "觍", "覦": "觎", "親": "亲", "覬": "觊", "覯": "觏", "覲": "觐", "覷": "觑", "覺": "觉", "覽": "览", "覿": "觌", "觀": "观", "觴": "觞", "觶": "觯", "觸": "触", "訁": "讠", "訂": "订", "訃": "讣", "計": "计", "訊": "讯", "訌": "讧", "討": "讨", "訐": "讦", "訒": "讱", "訓": "训", "訕": "讪", "訖": "讫", "託": "讬", "記": "记", "訛": "讹", "訝": "讶", "訟": "讼", "訢": "䜣", "訣": "诀", "訥": "讷", "訩": "讻", "訪": "访", "設": "设", "許": "许", "訴": "诉", "訶": "诃", "診": "诊", "註": "注", "詁": "诂", "詆": "诋", "詎": "讵", "詐": "诈", "詒": "诒", "詔": "诏", "評": "评", "詖": "诐", "詗": "诇", "詘": "诎", "詛": "诅", "詞": "词", "詠": "咏", "詡": "诩", "詢": "询", "詣": "诣", "試": "试", "詩": "诗", "詫": "诧", "詬": "诟", "詭": "诡", "詮": "诠", "詰": "诘", "話": "话", "該": "该", "詳": "详", "詵": "诜", "詼": "诙", "詿": "诖", "誄": "诔", "誅": "诛", "誆": "诓", "誇": "夸", "誌": "志", "認": "认", "誑": "诳", "誒": "诶", "誕": "诞", "誘": "诱", "誚": "诮", "語": "语", "誠": "诚", "誡": "诫", "誣": "诬", "誤": "误", "誥": "诰", "誦": "诵", "誨": "诲", "說": "说", "説": "说", "誰": "谁", "課": "课", "誶": "谇", "誹": "诽", "誼": "谊", "誾": "訚", "調": "调", "諂": "谄", "諄": "谆", "談": "谈", "諉": "诿", "請": "请", "諍": "诤", "諏": "诹", "諑": "诼", "諒": "谅", "論": "论", "諗": "谂", "諛": "谀", "諜": "谍", "諝": "谞", "諞": "谝", "諢": "诨", "諤": "谔", "諦": "谛", "諧": "谐", "諫": "谏", "諭": "谕", "諮": "谘", "諱": "讳", "諳": "谙", "諶": "谌", "諷": "讽", "諸": "诸", "諺": "谚", "諼": "谖", "諾": "诺", "謀": "谋", "謁": "谒", "謂": "谓", "謄": "誊", "謅": "诌", "謊": "谎", "謎": "谜", "謐": "谧", "謔": "谑", "謖": "谡", "謗": "谤", "謙": "谦", "謚": "谥", "講": "讲", "謝": "谢", "謠": "谣", "謡": "谣", "謨": "谟", "謫": "谪", "謬": "谬", "謭": "谫", "謳": "讴", "謹": "谨", "謾": "谩", "譅": "䜧", "證": "证", "譎": "谲", "譏": "讥", "譖": "谮", "識": "识", "譙": "谯", "譚": "谭", "譜": "谱", "譫": "谵", "譯": "译", "議": "议", "譴": "谴", "護": "护", "譸": "诪", "譽": "誉", "譾": "谫", "讀": "读", "變": "变", "讎": "仇", "讎": "雠", "讒": "谗", "讓": "让", "讕": "谰", "讖": "谶", "讜": "谠", "讞": "谳", "豈": "岂", "豎": "竖", "豐": "丰", "豬": "猪", "豶": "豮", "貓": "猫", "貙": "䝙", "貝": "贝", "貞": "贞", "貟": "贠", "負": "负", "財": "财", "貢": "贡", "貧": "贫", "貨": "货", "販": "贩", "貪": "贪", "貫": "贯", "責": "责", "貯": "贮", "貰": "贳", "貲": "赀", "貳": "贰", "貴": "贵", "貶": "贬", "買": "买", "貸": "贷", "貺": "贶", "費": "费", "貼": "贴", "貽": "贻", "貿": "贸", "賀": "贺", "賁": "贲", "賂": "赂", "賃": "赁", "賄": "贿", "賅": "赅", "資": "资", "賈": "贾", "賊": "贼", "賑": "赈", "賒": "赊", "賓": "宾", "賕": "赇", "賙": "赒", "賚": "赉", "賜": "赐", "賞": "赏", "賠": "赔", "賡": "赓", "賢": "贤", "賣": "卖", "賤": "贱", "賦": "赋", "賧": "赕", "質": "质", "賫": "赍", "賬": "账", "賭": "赌", "賰": "䞐", "賴": "赖", "賵": "赗", "賺": "赚", "賻": "赙", "購": "购", "賽": "赛", "賾": "赜", "贄": "贽", "贅": "赘", "贇": "赟", "贈": "赠", "贊": "赞", "贋": "赝", "贍": "赡", "贏": "赢", "贐": "赆", "贓": "赃", "贔": "赑", "贖": "赎", "贗": "赝", "贛": "赣", "贜": "赃", "赬": "赪", "趕": "赶", "趙": "赵", "趨": "趋", "趲": "趱", "跡": "迹", "踐": "践", "踴": "踊", "蹌": "跄", "蹕": "跸", "蹣": "蹒", "蹤": "踪", "蹺": "跷", "躂": "跶", "躉": "趸", "躊": "踌", "躋": "跻", "躍": "跃", "躑": "踯", "躒": "跞", "躓": "踬", "躕": "蹰", "躚": "跹", "躡": "蹑", "躥": "蹿", "躦": "躜", "躪": "躏", "軀": "躯", "車": "车", "軋": "轧", "軌": "轨", "軍": "军", "軑": "轪", "軒": "轩", "軔": "轫", "軛": "轭", "軟": "软", "軤": "轷", "軫": "轸", "軲": "轱", "軸": "轴", "軹": "轵", "軺": "轺", "軻": "轲", "軼": "轶", "軾": "轼", "較": "较", "輅": "辂", "輇": "辁", "輈": "辀", "載": "载", "輊": "轾", "輒": "辄", "輓": "挽", "輔": "辅", "輕": "轻", "輛": "辆", "輜": "辎", "輝": "辉", "輞": "辋", "輟": "辍", "輥": "辊", "輦": "辇", "輩": "辈", "輪": "轮", "輬": "辌", "輯": "辑", "輳": "辏", "輸": "输", "輻": "辐", "輾": "辗", "輿": "舆", "轀": "辒", "轂": "毂", "轄": "辖", "轅": "辕", "轆": "辘", "轉": "转", "轍": "辙", "轎": "轿", "轔": "辚", "轟": "轰", "轡": "辔", "轢": "轹", "轤": "轳", "辟": "辟", "辦": "办", "辭": "辞", "辮": "辫", "辯": "辩", "農": "农", "迴": "回", "适": "适", "逕": "迳", "這": "这", "連": "连", "週": "周", "進": "进", "遊": "游", "運": "运", "過": "过", "達": "达", "違": "违", "遙": "遥", "遜": "逊", "遞": "递", "遠": "远", "適": "适", "遲": "迟", "遷": "迁", "選": "选", "遺": "遗", "遼": "辽", "邁": "迈", "還": "还", "邇": "迩", "邊": "边", "邏": "逻", "邐": "逦", "郁": "郁", "郟": "郏", "郵": "邮", "鄆": "郓", "鄉": "乡", "鄒": "邹", "鄔": "邬", "鄖": "郧", "鄧": "邓", "鄭": "郑", "鄰": "邻", "鄲": "郸", "鄴": "邺", "鄶": "郐", "鄺": "邝", "酇": "酂", "酈": "郦", "醖": "酝", "醜": "丑", "醞": "酝", "醫": "医", "醬": "酱", "醱": "酦", "釀": "酿", "釁": "衅", "釃": "酾", "釅": "酽", "采": "采", "釋": "释", "釐": "厘", "釒": "钅", "釓": "钆", "釔": "钇", "釕": "钌", "釗": "钊", "釘": "钉", "釙": "钋", "針": "针", "釣": "钓", "釤": "钐", "釧": "钏", "釩": "钒", "釵": "钗", "釷": "钍", "釹": "钕", "釺": "钎", "鈀": "钯", "鈁": "钫", "鈃": "钘", "鈄": "钭", "鈈": "钚", "鈉": "钠", "鈍": "钝", "鈎": "钩", "鈐": "钤", "鈑": "钣", "鈒": "钑", "鈔": "钞", "鈕": "钮", "鈞": "钧", "鈣": "钙", "鈥": "钬", "鈦": "钛", "鈧": "钪", "鈮": "铌", "鈰": "铈", "鈳": "钶", "鈴": "铃", "鈷": "钴", "鈸": "钹", "鈹": "铍", "鈺": "钰", "鈽": "钸", "鈾": "铀", "鈿": "钿", "鉀": "钾", "鉅": "钜", "鉈": "铊", "鉉": "铉", "鉋": "铇", "鉍": "铋", "鉑": "铂", "鉕": "钷", "鉗": "钳", "鉚": "铆", "鉛": "铅", "鉞": "钺", "鉢": "钵", "鉤": "钩", "鉦": "钲", "鉬": "钼", "鉭": "钽", "鉶": "铏", "鉸": "铰", "鉺": "铒", "鉻": "铬", "鉿": "铪", "銀": "银", "銃": "铳", "銅": "铜", "銍": "铚", "銑": "铣", "銓": "铨", "銖": "铢", "銘": "铭", "銚": "铫", "銛": "铦", "銜": "衔", "銠": "铑", "銣": "铷", "銥": "铱", "銦": "铟", "銨": "铵", "銩": "铥", "銪": "铕", "銫": "铯", "銬": "铐", "銱": "铞", "銳": "锐", "銷": "销", "銹": "锈", "銻": "锑", "銼": "锉", "鋁": "铝", "鋃": "锒", "鋅": "锌", "鋇": "钡", "鋌": "铤", "鋏": "铗", "鋒": "锋", "鋙": "铻", "鋝": "锊", "鋟": "锓", "鋣": "铘", "鋤": "锄", "鋥": "锃", "鋦": "锔", "鋨": "锇", "鋩": "铓", "鋪": "铺", "鋭": "锐", "鋮": "铖", "鋯": "锆", "鋰": "锂", "鋱": "铽", "鋶": "锍", "鋸": "锯", "鋼": "钢", "錁": "锞", "錄": "录", "錆": "锖", "錇": "锫", "錈": "锩", "錏": "铔", "錐": "锥", "錒": "锕", "錕": "锟", "錘": "锤", "錙": "锱", "錚": "铮", "錛": "锛", "錟": "锬", "錠": "锭", "錡": "锜", "錢": "钱", "錦": "锦", "錨": "锚", "錩": "锠", "錫": "锡", "錮": "锢", "錯": "错", "録": "录", "錳": "锰", "錶": "表", "錸": "铼", "鍀": "锝", "鍁": "锨", "鍃": "锪", "鍆": "钔", "鍇": "锴", "鍈": "锳", "鍋": "锅", "鍍": "镀", "鍔": "锷", "鍘": "铡", "鍚": "钖", "鍛": "锻", "鍠": "锽", "鍤": "锸", "鍥": "锲", "鍩": "锘", "鍬": "锹", "鍰": "锾", "鍵": "键", "鍶": "锶", "鍺": "锗", "鍾": "钟", "鎂": "镁", "鎄": "锿", "鎇": "镅", "鎊": "镑", "鎔": "镕", "鎖": "锁", "鎘": "镉", "鎚": "锤", "鎛": "镈", "鎝": "𨱏", "鎡": "镃", "鎢": "钨", "鎣": "蓥", "鎦": "镏", "鎧": "铠", "鎩": "铩", "鎪": "锼", "鎬": "镐", "鎮": "镇", "鎰": "镒", "鎲": "镋", "鎳": "镍", "鎵": "镓", "鎸": "镌", "鎿": "镎", "鏃": "镞", "鏇": "镟", "鏈": "链", "鏌": "镆", "鏍": "镙", "鏐": "镠", "鏑": "镝", "鏗": "铿", "鏘": "锵", "鏜": "镗", "鏝": "镘", "鏞": "镛", "鏟": "铲", "鏡": "镜", "鏢": "镖", "鏤": "镂", "鏨": "錾", "鏰": "镚", "鏵": "铧", "鏷": "镤", "鏹": "镪", "鏽": "锈", "鐃": "铙", "鐋": "铴", "鐐": "镣", "鐒": "铹", "鐓": "镦", "鐔": "镡", "鐘": "钟", "鐙": "镫", "鐝": "镢", "鐠": "镨", "鐦": "锎", "鐧": "锏", "鐨": "镄", "鐫": "镌", "鐮": "镰", "鐲": "镯", "鐳": "镭", "鐵": "铁", "鐶": "镮", "鐸": "铎", "鐺": "铛", "鐿": "镱", "鑄": "铸", "鑊": "镬", "鑌": "镔", "鑒": "鉴", "鑔": "镲", "鑕": "锧", "鑞": "镴", "鑠": "铄", "鑣": "镳", "鑥": "镥", "鑭": "镧", "鑰": "钥", "鑱": "镵", "鑲": "镶", "鑷": "镊", "鑹": "镩", "鑼": "锣", "鑽": "钻", "鑾": "銮", "鑿": "凿", "钁": "镢", "镟": "旋", "長": "长", "門": "门", "閂": "闩", "閃": "闪", "閆": "闫", "閈": "闬", "閉": "闭", "開": "开", "閌": "闶", "閎": "闳", "閏": "闰", "閑": "闲", "間": "间", "閔": "闵", "閘": "闸", "閡": "阂", "閣": "阁", "閤": "合", "閥": "阀", "閨": "闺", "閩": "闽", "閫": "阃", "閬": "阆", "閭": "闾", "閱": "阅", "閲": "阅", "閶": "阊", "閹": "阉", "閻": "阎", "閼": "阏", "閽": "阍", "閾": "阈", "閿": "阌", "闃": "阒", "闆": "板", "闈": "闱", "闊": "阔", "闋": "阕", "闌": "阑", "闍": "阇", "闐": "阗", "闒": "阘", "闓": "闿", "闔": "阖", "闕": "阙", "闖": "闯", "關": "关", "闞": "阚", "闠": "阓", "闡": "阐", "闤": "阛", "闥": "闼", "阪": "坂", "陘": "陉", "陝": "陕", "陣": "阵", "陰": "阴", "陳": "陈", "陸": "陆", "陽": "阳", "隉": "陧", "隊": "队", "階": "阶", "隕": "陨", "際": "际", "隨": "随", "險": "险", "隱": "隐", "隴": "陇", "隸": "隶", "隻": "只", "雋": "隽", "雖": "虽", "雙": "双", "雛": "雏", "雜": "杂", "雞": "鸡", "離": "离", "難": "难", "雲": "云", "電": "电", "霢": "霡", "霧": "雾", "霽": "霁", "靂": "雳", "靄": "霭", "靈": "灵", "靚": "靓", "靜": "静", "靨": "靥", "鞀": "鼗", "鞏": "巩", "鞝": "绱", "鞦": "秋", "鞽": "鞒", "韁": "缰", "韃": "鞑", "韆": "千", "韉": "鞯", "韋": "韦", "韌": "韧", "韍": "韨", "韓": "韩", "韙": "韪", "韜": "韬", "韞": "韫", "韻": "韵", "響": "响", "頁": "页", "頂": "顶", "頃": "顷", "項": "项", "順": "顺", "頇": "顸", "須": "须", "頊": "顼", "頌": "颂", "頎": "颀", "頏": "颃", "預": "预", "頑": "顽", "頒": "颁", "頓": "顿", "頗": "颇", "領": "领", "頜": "颌", "頡": "颉", "頤": "颐", "頦": "颏", "頭": "头", "頮": "颒", "頰": "颊", "頲": "颋", "頴": "颕", "頷": "颔", "頸": "颈", "頹": "颓", "頻": "频", "頽": "颓", "顆": "颗", "題": "题", "額": "额", "顎": "颚", "顏": "颜", "顒": "颙", "顓": "颛", "顔": "颜", "願": "愿", "顙": "颡", "顛": "颠", "類": "类", "顢": "颟", "顥": "颢", "顧": "顾", "顫": "颤", "顬": "颥", "顯": "显", "顰": "颦", "顱": "颅", "顳": "颞", "顴": "颧", "風": "风", "颭": "飐", "颮": "飑", "颯": "飒", "颱": "台", "颳": "刮", "颶": "飓", "颸": "飔", "颺": "飏", "颻": "飖", "颼": "飕", "飀": "飗", "飄": "飘", "飆": "飙", "飈": "飚", "飛": "飞", "飠": "饣", "飢": "饥", "飣": "饤", "飥": "饦", "飩": "饨", "飪": "饪", "飫": "饫", "飭": "饬", "飯": "饭", "飲": "饮", "飴": "饴", "飼": "饲", "飽": "饱", "飾": "饰", "飿": "饳", "餃": "饺", "餄": "饸", "餅": "饼", "餉": "饷", "養": "养", "餌": "饵", "餎": "饹", "餏": "饻", "餑": "饽", "餒": "馁", "餓": "饿", "餕": "馂", "餖": "饾", "餚": "肴", "餛": "馄", "餜": "馃", "餞": "饯", "餡": "馅", "館": "馆", "餱": "糇", "餳": "饧", "餶": "馉", "餷": "馇", "餺": "馎", "餼": "饩", "餾": "馏", "餿": "馊", "饁": "馌", "饃": "馍", "饅": "馒", "饈": "馐", "饉": "馑", "饊": "馓", "饋": "馈", "饌": "馔", "饑": "饥", "饒": "饶", "饗": "飨", "饜": "餍", "饞": "馋", "饢": "馕", "馬": "马", "馭": "驭", "馮": "冯", "馱": "驮", "馳": "驰", "馴": "驯", "馹": "驲", "駁": "驳", "駐": "驻", "駑": "驽", "駒": "驹", "駔": "驵", "駕": "驾", "駘": "骀", "駙": "驸", "駛": "驶", "駝": "驼", "駟": "驷", "駡": "骂", "駢": "骈", "駭": "骇", "駰": "骃", "駱": "骆", "駸": "骎", "駿": "骏", "騁": "骋", "騂": "骍", "騅": "骓", "騌": "骔", "騍": "骒", "騎": "骑", "騏": "骐", "騖": "骛", "騙": "骗", "騤": "骙", "騧": "䯄", "騫": "骞", "騭": "骘", "騮": "骝", "騰": "腾", "騶": "驺", "騷": "骚", "騸": "骟", "騾": "骡", "驀": "蓦", "驁": "骜", "驂": "骖", "驃": "骠", "驄": "骢", "驅": "驱", "驊": "骅", "驌": "骕", "驍": "骁", "驏": "骣", "驕": "骄", "驗": "验", "驚": "惊", "驛": "驿", "驟": "骤", "驢": "驴", "驤": "骧", "驥": "骥", "驦": "骦", "驪": "骊", "驫": "骉", "骯": "肮", "髏": "髅", "髒": "脏", "體": "体", "髕": "髌", "髖": "髋", "髮": "发", "鬆": "松", "鬍": "胡", "鬚": "须", "鬢": "鬓", "鬥": "斗", "鬧": "闹", "鬩": "阋", "鬮": "阄", "鬱": "郁", "魎": "魉", "魘": "魇", "魚": "鱼", "魛": "鱽", "魢": "鱾", "魨": "鲀", "魯": "鲁", "魴": "鲂", "魷": "鱿", "魺": "鲄", "鮁": "鲅", "鮃": "鲆", "鮊": "鲌", "鮋": "鲉", "鮍": "鲏", "鮎": "鲇", "鮐": "鲐", "鮑": "鲍", "鮒": "鲋", "鮓": "鲊", "鮚": "鲒", "鮜": "鲘", "鮝": "鲞", "鮞": "鲕", "鮦": "鲖", "鮪": "鲔", "鮫": "鲛", "鮭": "鲑", "鮮": "鲜", "鮳": "鲓", "鮶": "鲪", "鮺": "鲝", "鯀": "鲧", "鯁": "鲠", "鯇": "鲩", "鯉": "鲤", "鯊": "鲨", "鯒": "鲬", "鯔": "鲻", "鯕": "鲯", "鯖": "鲭", "鯗": "鲞", "鯛": "鲷", "鯝": "鲴", "鯡": "鲱", "鯢": "鲵", "鯤": "鲲", "鯧": "鲳", "鯨": "鲸", "鯪": "鲮", "鯫": "鲰", "鯴": "鲺", "鯷": "鳀", "鯽": "鲫", "鯿": "鳊", "鰁": "鳈", "鰂": "鲗", "鰃": "鳂", "鰈": "鲽", "鰉": "鳇", "鰍": "鳅", "鰏": "鲾", "鰐": "鳄", "鰒": "鳆", "鰓": "鳃", "鰜": "鳒", "鰟": "鳑", "鰠": "鳋", "鰣": "鲥", "鰥": "鳏", "鰨": "鳎", "鰩": "鳐", "鰭": "鳍", "鰮": "鳁", "鰱": "鲢", "鰲": "鳌", "鰳": "鳓", "鰵": "鳘", "鰷": "鲦", "鰹": "鲣", "鰺": "鲹", "鰻": "鳗", "鰼": "鳛", "鰾": "鳔", "鱂": "鳉", "鱅": "鳙", "鱈": "鳕", "鱉": "鳖", "鱒": "鳟", "鱔": "鳝", "鱖": "鳜", "鱗": "鳞", "鱘": "鲟", "鱝": "鲼", "鱟": "鲎", "鱠": "鲙", "鱣": "鳣", "鱤": "鳡", "鱧": "鳢", "鱨": "鲿", "鱭": "鲚", "鱯": "鳠", "鱷": "鳄", "鱸": "鲈", "鱺": "鲡", "䰾": "鲃", "䲁": "鳚", "鳥": "鸟", "鳧": "凫", "鳩": "鸠", "鳬": "凫", "鳲": "鸤", "鳳": "凤", "鳴": "鸣", "鳶": "鸢", "鳾": "䴓", "鴆": "鸩", "鴇": "鸨", "鴉": "鸦", "鴒": "鸰", "鴕": "鸵", "鴛": "鸳", "鴝": "鸲", "鴞": "鸮", "鴟": "鸱", "鴣": "鸪", "鴦": "鸯", "鴨": "鸭", "鴯": "鸸", "鴰": "鸹", "鴴": "鸻", "鴷": "䴕", "鴻": "鸿", "鴿": "鸽", "鵁": "䴔", "鵂": "鸺", "鵃": "鸼", "鵐": "鹀", "鵑": "鹃", "鵒": "鹆", "鵓": "鹁", "鵜": "鹈", "鵝": "鹅", "鵠": "鹄", "鵡": "鹉", "鵪": "鹌", "鵬": "鹏", "鵮": "鹐", "鵯": "鹎", "鵲": "鹊", "鵷": "鹓", "鵾": "鹍", "鶄": "䴖", "鶇": "鸫", "鶉": "鹑", "鶊": "鹒", "鶓": "鹋", "鶖": "鹙", "鶘": "鹕", "鶚": "鹗", "鶡": "鹖", "鶥": "鹛", "鶩": "鹜", "鶪": "䴗", "鶬": "鸧", "鶯": "莺", "鶲": "鹟", "鶴": "鹤", "鶹": "鹠", "鶺": "鹡", "鶻": "鹘", "鶼": "鹣", "鶿": "鹚", "鷀": "鹚", "鷁": "鹢", "鷂": "鹞", "鷄": "鸡", "鷈": "䴘", "鷊": "鹝", "鷓": "鹧", "鷖": "鹥", "鷗": "鸥", "鷙": "鸷", "鷚": "鹨", "鷥": "鸶", "鷦": "鹪", "鷫": "鹔", "鷯": "鹩", "鷲": "鹫", "鷳": "鹇", "鷸": "鹬", "鷹": "鹰", "鷺": "鹭", "鷽": "鸴", "鷿": "䴙", "鸂": "㶉", "鸇": "鹯", "鸌": "鹱", "鸏": "鹲", "鸕": "鸬", "鸘": "鹴", "鸚": "鹦", "鸛": "鹳", "鸝": "鹂", "鸞": "鸾", "鹵": "卤", "鹹": "咸", "鹺": "鹾", "鹽": "盐", "麗": "丽", "麥": "麦", "麩": "麸", "麯": "曲", "麵": "面", "麼": "么", "麽": "么", "黃": "黄", "黌": "黉", "點": "点", "黨": "党", "黲": "黪", "黴": "霉", "黶": "黡", "黷": "黩", "黽": "黾", "黿": "鼋", "鼉": "鼍", "鼕": "冬", "鼴": "鼹", "齊": "齐", "齋": "斋", "齎": "赍", "齏": "齑", "齒": "齿", "齔": "龀", "齕": "龁", "齗": "龂", "齙": "龅", "齜": "龇", "齟": "龃", "齠": "龆", "齡": "龄", "齣": "出", "齦": "龈", "齪": "龊", "齬": "龉", "齲": "龋", "齶": "腭", "齷": "龌", "龍": "龙", "龎": "厐", "龐": "庞", "龔": "龚", "龕": "龛", "龜": "龟", "幾畫": "几画", "賣畫": "卖画", "滷鹼": "卤碱", "原畫": "原画", "口鹼": "口碱", "古畫": "古画", "名畫": "名画", "奇畫": "奇画", "如畫": "如画", "弱鹼": "弱碱", "彩畫": "彩画", "所畫": "所画", "扉畫": "扉画", "教畫": "教画", "水鹼": "水碱", "洋鹼": "洋碱", "炭畫": "炭画", "畫一": "画一", "畫上": "画上", "畫下": "画下", "畫中": "画中", "畫供": "画供", "畫兒": "画儿", "畫具": "画具", "畫出": "画出", "畫史": "画史", "畫品": "画品", "畫商": "画商", "畫圈": "画圈", "畫境": "画境", "畫工": "画工", "畫帖": "画帖", "畫幅": "画幅", "畫意": "画意", "畫成": "画成", "畫景": "画景", "畫本": "画本", "畫架": "画架", "畫框": "画框", "畫法": "画法", "畫王": "画王", "畫界": "画界", "畫符": "画符", "畫紙": "画纸", "畫線": "画线", "畫航": "画航", "畫舫": "画舫", "畫虎": "画虎", "畫論": "画论", "畫譜": "画谱", "畫象": "画象", "畫質": "画质", "畫貼": "画贴", "畫軸": "画轴", "畫頁": "画页", "鹽鹼": "盐碱", "鹼": "碱", "鹼基": "碱基", "鹼度": "碱度", "鹼水": "碱水", "鹼熔": "碱熔", "磁畫": "磁画", "策畫": "策画", "組畫": "组画", "絹畫": "绢画", "耐鹼": "耐碱", "肉鹼": "肉碱", "膠畫": "胶画", "茶鹼": "茶碱", "西畫": "西画", "貼畫": "贴画", "返鹼": "返碱", "鍾鍛": "锺锻", "鍛鍾": "锻锺", "雕畫": "雕画", "鯰": "鲶", "三聯畫": "三联画", "中國畫": "中国画", "書畫": "书画", "書畫社": "书画社", "五筆畫": "五笔画", "作畫": "作画", "入畫": "入画", "寫生畫": "写生画", "刻畫": "刻画", "動畫": "动画", "勾畫": "勾画", "單色畫": "单色画", "卡通畫": "卡通画", "國畫": "国画", "圖畫": "图画", "壁畫": "壁画", "字畫": "字画", "宣傳畫": "宣传画", "工筆畫": "工笔画", "年畫": "年画", "幽默畫": "幽默画", "指畫": "指画", "描畫": "描画", "插畫": "插画", "擘畫": "擘画", "春畫": "春画", "木刻畫": "木刻画", "機械畫": "机械画", "比畫": "比画", "毛筆畫": "毛笔画", "水粉畫": "水粉画", "油畫": "油画", "海景畫": "海景画", "漫畫": "漫画", "點畫": "点画", "版畫": "版画", "畫": "画", "畫像": "画像", "畫冊": "画册", "畫刊": "画刊", "畫匠": "画匠", "畫捲": "画卷", "畫圖": "画图", "畫壇": "画坛", "畫室": "画室", "畫家": "画家", "畫屏": "画屏", "畫展": "画展", "畫布": "画布", "畫師": "画师", "畫廊": "画廊", "畫報": "画报", "畫押": "画押", "畫板": "画板", "畫片": "画片", "畫畫": "画画", "畫皮": "画皮", "畫眉鳥": "画眉鸟", "畫稿": "画稿", "畫筆": "画笔", "畫院": "画院", "畫集": "画集", "畫面": "画面", "筆畫": "笔画", "細密畫": "细密画", "繪畫": "绘画", "自畫像": "自画像", "蠟筆畫": "蜡笔画", "裸體畫": "裸体画", "西洋畫": "西洋画", "透視畫": "透视画", "銅版畫": "铜版画", "鍾": "锺", "靜物畫": "静物画", "餘": "馀", } zh2TW = { "缺省": "預設", "串行": "串列", "以太网": "乙太網", "位图": "點陣圖", "例程": "常式", "信道": "通道", "光标": "游標", "光盘": "光碟", "光驱": "光碟機", "全角": "全形", "加载": "載入", "半角": "半形", "变量": "變數", "噪声": "雜訊", "脱机": "離線", "声卡": "音效卡", "老字号": "老字號", "字号": "字型大小", "字库": "字型檔", "字段": "欄位", "字符": "字元", "存盘": "存檔", "寻址": "定址", "尾注": "章節附註", "异步": "非同步", "总线": "匯流排", "括号": "括弧", "接口": "介面", "控件": "控制項", "权限": "許可權", "盘片": "碟片", "硅片": "矽片", "硅谷": "矽谷", "硬盘": "硬碟", "磁盘": "磁碟", "磁道": "磁軌", "程控": "程式控制", "端口": "埠", "算子": "運算元", "算法": "演算法", "芯片": "晶片", "芯片": "晶元", "词组": "片語", "译码": "解碼", "软驱": "軟碟機", "快闪存储器": "快閃記憶體", "闪存": "快閃記憶體", "鼠标": "滑鼠", "进制": "進位", "交互式": "互動式", "仿真": "模擬", "优先级": "優先順序", "传感": "感測", "便携式": "攜帶型", "信息论": "資訊理論", "写保护": "防寫", "分布式": "分散式", "分辨率": "解析度", "服务器": "伺服器", "等于": "等於", "局域网": "區域網", "计算机": "電腦", "扫瞄仪": "掃瞄器", "宽带": "寬頻", "数据库": "資料庫", "奶酪": "乳酪", "巨商": "鉅賈", "手电": "手電筒", "万历": "萬曆", "永历": "永曆", "词汇": "辭彙", "习用": "慣用", "元音": "母音", "任意球": "自由球", "头球": "頭槌", "入球": "進球", "粒入球": "顆進球", "打门": "射門", "火锅盖帽": "蓋火鍋", "打印机": "印表機", "打印機": "印表機", "字节": "位元組", "字節": "位元組", "打印": "列印", "打印": "列印", "硬件": "硬體", "硬件": "硬體", "二极管": "二極體", "二極管": "二極體", "三极管": "三極體", "三極管": "三極體", "软件": "軟體", "軟件": "軟體", "网络": "網路", "網絡": "網路", "人工智能": "人工智慧", "航天飞机": "太空梭", "穿梭機": "太空梭", "因特网": "網際網路", "互聯網": "網際網路", "机器人": "機器人", "機械人": "機器人", "移动电话": "行動電話", "流動電話": "行動電話", "调制解调器": "數據機", "調制解調器": "數據機", "短信": "簡訊", "短訊": "簡訊", "乌兹别克斯坦": "烏茲別克", "乍得": "查德", "乍得": "查德", "也门": "葉門", "也門": "葉門", "伯利兹": "貝里斯", "伯利茲": "貝里斯", "佛得角": "維德角", "佛得角": "維德角", "克罗地亚": "克羅埃西亞", "克羅地亞": "克羅埃西亞", "冈比亚": "甘比亞", "岡比亞": "甘比亞", "几内亚比绍": "幾內亞比索", "幾內亞比紹": "幾內亞比索", "列支敦士登": "列支敦斯登", "列支敦士登": "列支敦斯登", "利比里亚": "賴比瑞亞", "利比里亞": "賴比瑞亞", "加纳": "迦納", "加納": "迦納", "加蓬": "加彭", "加蓬": "加彭", "博茨瓦纳": "波札那", "博茨瓦納": "波札那", "卡塔尔": "卡達", "卡塔爾": "卡達", "卢旺达": "盧安達", "盧旺達": "盧安達", "危地马拉": "瓜地馬拉", "危地馬拉": "瓜地馬拉", "厄瓜多尔": "厄瓜多", "厄瓜多爾": "厄瓜多", "厄立特里亚": "厄利垂亞", "厄立特里亞": "厄利垂亞", "吉布提": "吉布地", "吉布堤": "吉布地", "哈萨克斯坦": "哈薩克", "哥斯达黎加": "哥斯大黎加", "哥斯達黎加": "哥斯大黎加", "图瓦卢": "吐瓦魯", "圖瓦盧": "吐瓦魯", "土库曼斯坦": "土庫曼", "圣卢西亚": "聖露西亞", "聖盧西亞": "聖露西亞", "圣基茨和尼维斯": "聖克里斯多福及尼維斯", "聖吉斯納域斯": "聖克里斯多福及尼維斯", "圣文森特和格林纳丁斯": "聖文森及格瑞那丁", "聖文森特和格林納丁斯": "聖文森及格瑞那丁", "圣马力诺": "聖馬利諾", "聖馬力諾": "聖馬利諾", "圭亚那": "蓋亞那", "圭亞那": "蓋亞那", "坦桑尼亚": "坦尚尼亞", "坦桑尼亞": "坦尚尼亞", "埃塞俄比亚": "衣索比亞", "埃塞俄比亞": "衣索比亞", "基里巴斯": "吉里巴斯", "基里巴斯": "吉里巴斯", "塔吉克斯坦": "塔吉克", "塞拉利昂": "獅子山", "塞拉利昂": "獅子山", "塞浦路斯": "塞普勒斯", "塞浦路斯": "塞普勒斯", "塞舌尔": "塞席爾", "塞舌爾": "塞席爾", "多米尼加": "多明尼加", "多明尼加共和國": "多明尼加", "多米尼加联邦": "多米尼克", "多明尼加聯邦": "多米尼克", "安提瓜和巴布达": "安地卡及巴布達", "安提瓜和巴布達": "安地卡及巴布達", "尼日利亚": "奈及利亞", "尼日利亞": "奈及利亞", "尼日尔": "尼日", "尼日爾": "尼日", "巴巴多斯": "巴貝多", "巴巴多斯": "巴貝多", "巴布亚新几内亚": "巴布亞紐幾內亞", "巴布亞新畿內亞": "巴布亞紐幾內亞", "布基纳法索": "布吉納法索", "布基納法索": "布吉納法索", "布隆迪": "蒲隆地", "布隆迪": "蒲隆地", "希腊": "希臘", "帕劳": "帛琉", "意大利": "義大利", "意大利": "義大利", "所罗门群岛": "索羅門群島", "所羅門群島": "索羅門群島", "文莱": "汶萊", "斯威士兰": "史瓦濟蘭", "斯威士蘭": "史瓦濟蘭", "斯洛文尼亚": "斯洛維尼亞", "斯洛文尼亞": "斯洛維尼亞", "新西兰": "紐西蘭", "新西蘭": "紐西蘭", "格林纳达": "格瑞那達", "格林納達": "格瑞那達", "格鲁吉亚": "喬治亞", "格魯吉亞": "喬治亞", "佐治亚": "喬治亞", "佐治亞": "喬治亞", "毛里塔尼亚": "茅利塔尼亞", "毛里塔尼亞": "茅利塔尼亞", "毛里求斯": "模里西斯", "毛里裘斯": "模里西斯", "沙特阿拉伯": "沙烏地阿拉伯", "沙地阿拉伯": "沙烏地阿拉伯", "波斯尼亚和黑塞哥维那": "波士尼亞赫塞哥維納", "波斯尼亞黑塞哥維那": "波士尼亞赫塞哥維納", "津巴布韦": "辛巴威", "津巴布韋": "辛巴威", "洪都拉斯": "宏都拉斯", "洪都拉斯": "宏都拉斯", "特立尼达和托巴哥": "千里達托貝哥", "特立尼達和多巴哥": "千里達托貝哥", "瑙鲁": "諾魯", "瑙魯": "諾魯", "瓦努阿图": "萬那杜", "瓦努阿圖": "萬那杜", "溫納圖萬": "那杜", "科摩罗": "葛摩", "科摩羅": "葛摩", "科特迪瓦": "象牙海岸", "突尼斯": "突尼西亞", "索马里": "索馬利亞", "索馬里": "索馬利亞", "老挝": "寮國", "老撾": "寮國", "肯尼亚": "肯亞", "肯雅": "肯亞", "苏里南": "蘇利南", "莫桑比克": "莫三比克", "莱索托": "賴索托", "萊索托": "賴索托", "贝宁": "貝南", "貝寧": "貝南", "赞比亚": "尚比亞", "贊比亞": "尚比亞", "阿塞拜疆": "亞塞拜然", "阿塞拜疆": "亞塞拜然", "阿拉伯联合酋长国": "阿拉伯聯合大公國", "阿拉伯聯合酋長國": "阿拉伯聯合大公國", "马尔代夫": "馬爾地夫", "馬爾代夫": "馬爾地夫", "马耳他": "馬爾他", "马里共和国": "馬利共和國", "馬里共和國": "馬利共和國", "方便面": "速食麵", "快速面": "速食麵", "即食麵": "速食麵", "薯仔": "土豆", "蹦极跳": "笨豬跳", "绑紧跳": "笨豬跳", "冷菜": "冷盤", "凉菜": "冷盤", "出租车": "計程車", "台球": "撞球", "桌球": "撞球", "雪糕": "冰淇淋", "卫生": "衛生", "衞生": "衛生", "平治": "賓士", "奔驰": "賓士", "積架": "捷豹", "福士": "福斯", "雪铁龙": "雪鐵龍", "马自达": "馬自達", "萬事得": "馬自達", "拿破仑": "拿破崙", "拿破侖": "拿破崙", "布什": "布希", "布殊": "布希", "克林顿": "柯林頓", "克林頓": "柯林頓", "侯赛因": "海珊", "侯賽因": "海珊", "凡高": "梵谷", "狄安娜": "黛安娜", "戴安娜": "黛安娜", "赫拉": "希拉", } zh2HK = { "打印机": "打印機", "印表機": "打印機", "字节": "位元組", "字節": "位元組", "打印": "打印", "列印": "打印", "硬件": "硬件", "硬體": "硬件", "二极管": "二極管", "二極體": "二極管", "三极管": "三極管", "三極體": "三極管", "数码": "數碼", "數位": "數碼", "软件": "軟件", "軟體": "軟件", "网络": "網絡", "網路": "網絡", "人工智能": "人工智能", "人工智慧": "人工智能", "航天飞机": "穿梭機", "太空梭": "穿梭機", "因特网": "互聯網", "網際網路": "互聯網", "机器人": "機械人", "機器人": "機械人", "移动电话": "流動電話", "行動電話": "流動電話", "调制解调器": "調制解調器", "數據機": "調制解調器", "短信": "短訊", "簡訊": "短訊", "乍得": "乍得", "查德": "乍得", "也门": "也門", "葉門": "也門", "伯利兹": "伯利茲", "貝里斯": "伯利茲", "佛得角": "佛得角", "維德角": "佛得角", "克罗地亚": "克羅地亞", "克羅埃西亞": "克羅地亞", "冈比亚": "岡比亞", "甘比亞": "岡比亞", "几内亚比绍": "幾內亞比紹", "幾內亞比索": "幾內亞比紹", "列支敦士登": "列支敦士登", "列支敦斯登": "列支敦士登", "利比里亚": "利比里亞", "賴比瑞亞": "利比里亞", "加纳": "加納", "迦納": "加納", "加蓬": "加蓬", "加彭": "加蓬", "博茨瓦纳": "博茨瓦納", "波札那": "博茨瓦納", "卡塔尔": "卡塔爾", "卡達": "卡塔爾", "卢旺达": "盧旺達", "盧安達": "盧旺達", "危地马拉": "危地馬拉", "瓜地馬拉": "危地馬拉", "厄瓜多尔": "厄瓜多爾", "厄瓜多": "厄瓜多爾", "厄立特里亚": "厄立特里亞", "厄利垂亞": "厄立特里亞", "吉布提": "吉布堤", "吉布地": "吉布堤", "哥斯达黎加": "哥斯達黎加", "哥斯大黎加": "哥斯達黎加", "图瓦卢": "圖瓦盧", "吐瓦魯": "圖瓦盧", "圣卢西亚": "聖盧西亞", "聖露西亞": "聖盧西亞", "圣基茨和尼维斯": "聖吉斯納域斯", "聖克里斯多福及尼維斯": "聖吉斯納域斯", "圣文森特和格林纳丁斯": "聖文森特和格林納丁斯", "聖文森及格瑞那丁": "聖文森特和格林納丁斯", "圣马力诺": "聖馬力諾", "聖馬利諾": "聖馬力諾", "圭亚那": "圭亞那", "蓋亞那": "圭亞那", "坦桑尼亚": "坦桑尼亞", "坦尚尼亞": "坦桑尼亞", "埃塞俄比亚": "埃塞俄比亞", "衣索匹亞": "埃塞俄比亞", "衣索比亞": "埃塞俄比亞", "基里巴斯": "基里巴斯", "吉里巴斯": "基里巴斯", "狮子山": "獅子山", "塞普勒斯": "塞浦路斯", "塞舌尔": "塞舌爾", "塞席爾": "塞舌爾", "多米尼加": "多明尼加共和國", "多明尼加": "多明尼加共和國", "多米尼加联邦": "多明尼加聯邦", "多米尼克": "多明尼加聯邦", "安提瓜和巴布达": "安提瓜和巴布達", "安地卡及巴布達": "安提瓜和巴布達", "尼日利亚": "尼日利亞", "奈及利亞": "尼日利亞", "尼日尔": "尼日爾", "尼日": "尼日爾", "巴巴多斯": "巴巴多斯", "巴貝多": "巴巴多斯", "巴布亚新几内亚": "巴布亞新畿內亞", "巴布亞紐幾內亞": "巴布亞新畿內亞", "布基纳法索": "布基納法索", "布吉納法索": "布基納法索", "布隆迪": "布隆迪", "蒲隆地": "布隆迪", "義大利": "意大利", "所罗门群岛": "所羅門群島", "索羅門群島": "所羅門群島", "斯威士兰": "斯威士蘭", "史瓦濟蘭": "斯威士蘭", "斯洛文尼亚": "斯洛文尼亞", "斯洛維尼亞": "斯洛文尼亞", "新西兰": "新西蘭", "紐西蘭": "新西蘭", "格林纳达": "格林納達", "格瑞那達": "格林納達", "格鲁吉亚": "喬治亞", "格魯吉亞": "喬治亞", "梵蒂冈": "梵蒂岡", "毛里塔尼亚": "毛里塔尼亞", "茅利塔尼亞": "毛里塔尼亞", "毛里求斯": "毛里裘斯", "模里西斯": "毛里裘斯", "沙烏地阿拉伯": "沙特阿拉伯", "波斯尼亚和黑塞哥维那": "波斯尼亞黑塞哥維那", "波士尼亞赫塞哥維納": "波斯尼亞黑塞哥維那", "津巴布韦": "津巴布韋", "辛巴威": "津巴布韋", "洪都拉斯": "洪都拉斯", "宏都拉斯": "洪都拉斯", "特立尼达和托巴哥": "特立尼達和多巴哥", "千里達托貝哥": "特立尼達和多巴哥", "瑙鲁": "瑙魯", "諾魯": "瑙魯", "瓦努阿图": "瓦努阿圖", "萬那杜": "瓦努阿圖", "科摩罗": "科摩羅", "葛摩": "科摩羅", "索马里": "索馬里", "索馬利亞": "索馬里", "老挝": "老撾", "寮國": "老撾", "肯尼亚": "肯雅", "肯亞": "肯雅", "莫桑比克": "莫桑比克", "莫三比克": "莫桑比克", "莱索托": "萊索托", "賴索托": "萊索托", "贝宁": "貝寧", "貝南": "貝寧", "赞比亚": "贊比亞", "尚比亞": "贊比亞", "阿塞拜疆": "阿塞拜疆", "亞塞拜然": "阿塞拜疆", "阿拉伯联合酋长国": "阿拉伯聯合酋長國", "阿拉伯聯合大公國": "阿拉伯聯合酋長國", "马尔代夫": "馬爾代夫", "馬爾地夫": "馬爾代夫", "馬利共和國": "馬里共和國", "方便面": "即食麵", "快速面": "即食麵", "速食麵": "即食麵", "泡麵": "即食麵", "土豆": "馬鈴薯", "华乐": "中樂", "民乐": "中樂", "計程車": "的士", "出租车": "的士", "公車": "巴士", "自行车": "單車", "犬只": "狗隻", "台球": "桌球", "撞球": "桌球", "冰淇淋": "雪糕", "賓士": "平治", "捷豹": "積架", "福斯": "福士", "雪铁龙": "先進", "雪鐵龍": "先進", "沃尓沃": "富豪", "马自达": "萬事得", "馬自達": "萬事得", "寶獅": "標致", "拿破崙": "拿破侖", "布什": "布殊", "布希": "布殊", "克林顿": "克林頓", "柯林頓": "克林頓", "萨达姆": "薩達姆", "海珊": "侯賽因", "侯赛因": "侯賽因", "大卫·贝克汉姆": "大衛碧咸", "迈克尔·欧文": "米高奧雲", "珍妮弗·卡普里亚蒂": "卡佩雅蒂", "马拉特·萨芬": "沙芬", "迈克尔·舒马赫": "舒麥加", "希特勒": "希特拉", "狄安娜": "戴安娜", "黛安娜": "戴安娜", } zh2CN = { "記憶體": "内存", "預設": "默认", "串列": "串行", "乙太網": "以太网", "點陣圖": "位图", "常式": "例程", "游標": "光标", "光碟": "光盘", "光碟機": "光驱", "全形": "全角", "共用": "共享", "載入": "加载", "半形": "半角", "變數": "变量", "雜訊": "噪声", "因數": "因子", "功能變數名稱": "域名", "音效卡": "声卡", "字型大小": "字号", "字型檔": "字库", "欄位": "字段", "字元": "字符", "存檔": "存盘", "定址": "寻址", "章節附註": "尾注", "非同步": "异步", "匯流排": "总线", "括弧": "括号", "介面": "接口", "控制項": "控件", "許可權": "权限", "碟片": "盘片", "矽片": "硅片", "矽谷": "硅谷", "硬碟": "硬盘", "磁碟": "磁盘", "磁軌": "磁道", "程式控制": "程控", "運算元": "算子", "演算法": "算法", "晶片": "芯片", "晶元": "芯片", "片語": "词组", "軟碟機": "软驱", "快閃記憶體": "快闪存储器", "滑鼠": "鼠标", "進位": "进制", "互動式": "交互式", "優先順序": "优先级", "感測": "传感", "攜帶型": "便携式", "資訊理論": "信息论", "迴圈": "循环", "防寫": "写保护", "分散式": "分布式", "解析度": "分辨率", "伺服器": "服务器", "等於": "等于", "區域網": "局域网", "巨集": "宏", "掃瞄器": "扫瞄仪", "寬頻": "宽带", "資料庫": "数据库", "乳酪": "奶酪", "鉅賈": "巨商", "手電筒": "手电", "萬曆": "万历", "永曆": "永历", "辭彙": "词汇", "母音": "元音", "自由球": "任意球", "頭槌": "头球", "進球": "入球", "顆進球": "粒入球", "射門": "打门", "蓋火鍋": "火锅盖帽", "印表機": "打印机", "打印機": "打印机", "位元組": "字节", "字節": "字节", "列印": "打印", "打印": "打印", "硬體": "硬件", "二極體": "二极管", "二極管": "二极管", "三極體": "三极管", "三極管": "三极管", "數位": "数码", "數碼": "数码", "軟體": "软件", "軟件": "软件", "網路": "网络", "網絡": "网络", "人工智慧": "人工智能", "太空梭": "航天飞机", "穿梭機": "航天飞机", "網際網路": "因特网", "互聯網": "因特网", "機械人": "机器人", "機器人": "机器人", "行動電話": "移动电话", "流動電話": "移动电话", "調制解調器": "调制解调器", "數據機": "调制解调器", "短訊": "短信", "簡訊": "短信", "烏茲別克": "乌兹别克斯坦", "查德": "乍得", "乍得": "乍得", "也門": "", "葉門": "也门", "伯利茲": "伯利兹", "貝里斯": "伯利兹", "維德角": "佛得角", "佛得角": "佛得角", "克羅地亞": "克罗地亚", "克羅埃西亞": "克罗地亚", "岡比亞": "冈比亚", "甘比亞": "冈比亚", "幾內亞比紹": "几内亚比绍", "幾內亞比索": "几内亚比绍", "列支敦斯登": "列支敦士登", "列支敦士登": "列支敦士登", "利比里亞": "利比里亚", "賴比瑞亞": "利比里亚", "加納": "加纳", "迦納": "加纳", "加彭": "加蓬", "加蓬": "加蓬", "博茨瓦納": "博茨瓦纳", "波札那": "博茨瓦纳", "卡塔爾": "卡塔尔", "卡達": "卡塔尔", "盧旺達": "卢旺达", "盧安達": "卢旺达", "危地馬拉": "危地马拉", "瓜地馬拉": "危地马拉", "厄瓜多爾": "厄瓜多尔", "厄瓜多": "厄瓜多尔", "厄立特里亞": "厄立特里亚", "厄利垂亞": "厄立特里亚", "吉布堤": "吉布提", "吉布地": "吉布提", "哈薩克": "哈萨克斯坦", "哥斯達黎加": "哥斯达黎加", "哥斯大黎加": "哥斯达黎加", "圖瓦盧": "图瓦卢", "吐瓦魯": "图瓦卢", "土庫曼": "土库曼斯坦", "聖盧西亞": "圣卢西亚", "聖露西亞": "圣卢西亚", "聖吉斯納域斯": "圣基茨和尼维斯", "聖克里斯多福及尼維斯": "圣基茨和尼维斯", "聖文森特和格林納丁斯": "圣文森特和格林纳丁斯", "聖文森及格瑞那丁": "圣文森特和格林纳丁斯", "聖馬力諾": "圣马力诺", "聖馬利諾": "圣马力诺", "圭亞那": "圭亚那", "蓋亞那": "圭亚那", "坦桑尼亞": "坦桑尼亚", "坦尚尼亞": "坦桑尼亚", "埃塞俄比亞": "埃塞俄比亚", "衣索匹亞": "埃塞俄比亚", "衣索比亞": "埃塞俄比亚", "吉里巴斯": "基里巴斯", "基里巴斯": "基里巴斯", "塔吉克": "塔吉克斯坦", "塞拉利昂": "塞拉利昂", "塞普勒斯": "塞浦路斯", "塞浦路斯": "塞浦路斯", "塞舌爾": "塞舌尔", "塞席爾": "塞舌尔", "多明尼加共和國": "多米尼加", "多明尼加": "多米尼加", "多明尼加聯邦": "多米尼加联邦", "多米尼克": "多米尼加联邦", "安提瓜和巴布達": "安提瓜和巴布达", "安地卡及巴布達": "安提瓜和巴布达", "尼日利亞": "尼日利亚", "奈及利亞": "尼日利亚", "尼日爾": "尼日尔", "尼日": "尼日尔", "巴貝多": "巴巴多斯", "巴巴多斯": "巴巴多斯", "巴布亞新畿內亞": "巴布亚新几内亚", "巴布亞紐幾內亞": "巴布亚新几内亚", "布基納法索": "布基纳法索", "布吉納法索": "布基纳法索", "蒲隆地": "布隆迪", "布隆迪": "布隆迪", "希臘": "希腊", "帛琉": "帕劳", "義大利": "意大利", "意大利": "意大利", "所羅門群島": "所罗门群岛", "索羅門群島": "所罗门群岛", "汶萊": "文莱", "斯威士蘭": "斯威士兰", "史瓦濟蘭": "斯威士兰", "斯洛文尼亞": "斯洛文尼亚", "斯洛維尼亞": "斯洛文尼亚", "新西蘭": "新西兰", "紐西蘭": "新西兰", "格林納達": "格林纳达", "格瑞那達": "格林纳达", "格魯吉亞": "乔治亚", "喬治亞": "乔治亚", "梵蒂岡": "梵蒂冈", "毛里塔尼亞": "毛里塔尼亚", "茅利塔尼亞": "毛里塔尼亚", "毛里裘斯": "毛里求斯", "模里西斯": "毛里求斯", "沙地阿拉伯": "沙特阿拉伯", "沙烏地阿拉伯": "沙特阿拉伯", "波斯尼亞黑塞哥維那": "波斯尼亚和黑塞哥维那", "波士尼亞赫塞哥維納": "波斯尼亚和黑塞哥维那", "津巴布韋": "津巴布韦", "辛巴威": "津巴布韦", "宏都拉斯": "洪都拉斯", "洪都拉斯": "洪都拉斯", "特立尼達和多巴哥": "特立尼达和托巴哥", "千里達托貝哥": "特立尼达和托巴哥", "瑙魯": "瑙鲁", "諾魯": "瑙鲁", "瓦努阿圖": "瓦努阿图", "萬那杜": "瓦努阿图", "溫納圖": "瓦努阿图", "科摩羅": "科摩罗", "葛摩": "科摩罗", "象牙海岸": "科特迪瓦", "突尼西亞": "突尼斯", "索馬里": "索马里", "索馬利亞": "索马里", "老撾": "老挝", "寮國": "老挝", "肯雅": "肯尼亚", "肯亞": "肯尼亚", "蘇利南": "苏里南", "莫三比克": "莫桑比克", "莫桑比克": "莫桑比克", "萊索托": "莱索托", "賴索托": "莱索托", "貝寧": "贝宁", "貝南": "贝宁", "贊比亞": "赞比亚", "尚比亞": "赞比亚", "亞塞拜然": "阿塞拜疆", "阿塞拜疆": "阿塞拜疆", "阿拉伯聯合酋長國": "阿拉伯联合酋长国", "阿拉伯聯合大公國": "阿拉伯联合酋长国", "南韓": "韩国", "馬爾代夫": "马尔代夫", "馬爾地夫": "马尔代夫", "馬爾他": "马耳他", "馬利共和國": "马里共和国", "即食麵": "方便面", "快速面": "方便面", "速食麵": "方便面", "泡麵": "方便面", "笨豬跳": "蹦极跳", "绑紧跳": "蹦极跳", "冷盤": "凉菜", "冷菜": "凉菜", "散钱": "零钱", "谐星": "笑星", "夜学": "夜校", "华乐": "民乐", "中樂": "民乐", "屋价": "房价", "的士": "出租车", "計程車": "出租车", "公車": "公共汽车", "單車": "自行车", "節慶": "节日", "芝士": "乾酪", "狗隻": "犬只", "士多啤梨": "草莓", "忌廉": "奶油", "桌球": "台球", "撞球": "台球", "雪糕": "冰淇淋", "衞生": "卫生", "衛生": "卫生", "賓士": "奔驰", "平治": "奔驰", "積架": "捷豹", "福斯": "大众", "福士": "大众", "雪鐵龍": "雪铁龙", "萬事得": "马自达", "馬自達": "马自达", "寶獅": "标志", "拿破崙": "拿破仑", "布殊": "布什", "布希": "布什", "柯林頓": "克林顿", "克林頓": "克林顿", "薩達姆": "萨达姆", "海珊": "萨达姆", "梵谷": "凡高", "大衛碧咸": "大卫·贝克汉姆", "米高奧雲": "迈克尔·欧文", "卡佩雅蒂": "珍妮弗·卡普里亚蒂", "沙芬": "马拉特·萨芬", "舒麥加": "迈克尔·舒马赫", "希特拉": "希特勒", "黛安娜": "戴安娜", "希拉": "赫拉", } zh2SG = { "方便面": "快速面", "速食麵": "快速面", "即食麵": "快速面", "蹦极跳": "绑紧跳", "笨豬跳": "绑紧跳", "凉菜": "冷菜", "冷盤": "冷菜", "零钱": "散钱", "散紙": "散钱", "笑星": "谐星", "夜校": "夜学", "民乐": "华乐", "住房": "住屋", "房价": "屋价", "泡麵": "快速面", }
[ "lanfang.zheng@mrs.ai" ]
lanfang.zheng@mrs.ai
1fe976ca0106beea3c9fdf4f4b31055726c1d3f6
61cefb212b04fdcd3ab3e36374104f7eb9aeab75
/gym_rover/state/agent.py
cd7a3be00fb7e82f143279bf6667f2d83e2934bf
[ "MIT" ]
permissive
eklinkhammer/gym-rover
8df6297218c1a22c42273861e68aeb342d3a63a4
38ed96f6f7ea4e5fed4432cb3967d2317caf145e
refs/heads/master
2021-01-20T02:25:14.158595
2018-03-20T01:24:05
2018-03-20T01:24:05
89,403,230
0
0
null
null
null
null
UTF-8
Python
false
false
2,057
py
import sys import random import numpy as np class Agent(object): """ Agent is a rover that moves in either a discrete or continuous action space """ def __init__(self, loc, uuid=None): """ Creates an Agent at position with a unique id. Args: loc (length 2 np array): Position of Agent if not a np array, must be Indexable and at least length 2 uuid (int): Unique identifer. If None, will be a random integer Because integer is random there is a chance of a collision. """ if type(loc) is not np.ndarray: loc = np.array([loc[0], loc[1]]) if uuid is None: uuid = random.randint(0, sys.maxsize) self._loc = loc self._uuid = uuid self.moves = { 0 : np.array([ 0, 0]), # Still 1 : np.array([ 1, 0]), # East 2 : np.array([ 1, 1]), # NE 3 : np.array([ 0, 1]), # North 4 : np.array([-1, 1]), # NW 5 : np.array([-1, 0]), # West 6 : np.array([-1, -1]), # SW 7 : np.array([ 0, -1]), # South 8 : np.array([ 1, -1])} # SE def discrete_move(self, command): """ Move agent in one of the eight cardinal directions, or stay still. Args: command (int): The movement direction. """ my_vec = self.moves[command] normed = self._normalize(my_vec) self._loc = np.add(self._loc, normed) def cont_move(self, command): self._loc = np.add(self._loc, command) def get_uuid(self): """ Accessor method for unique id """ return self._uuid def get_loc(self): """ Accessor method for location. Numpy array """ return self._loc def _normalize(self, v): """ Vector Norm """ norm = np.linalg.norm(v) if norm == 0: return v return v / norm
[ "eklinkhammer@gmail.com" ]
eklinkhammer@gmail.com
79a21b3cd0fc0706188237e2a0b76e6e913732bc
15f122c5d9d91493107c008acb23a9a1288aa95b
/review/settings.py
f91fff3e8b6e438ad860bfbb8623bb3d56d6b47d
[]
no_license
AdityaGaur-whiteCrayon/reviewap
9baba1c0dcf5adbe54f573ef10f8398ba75e1791
080bd45634f793d5c8d48f512472a7845bfd389f
refs/heads/main
2023-06-27T04:30:58.378069
2021-08-03T21:43:43
2021-08-03T21:43:43
392,461,954
0
0
null
null
null
null
UTF-8
Python
false
false
3,720
py
""" Django settings for review project. Generated by 'django-admin startproject' using Django 3.2.3. For more information on this file, see https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ from pathlib import Path import os import django_heroku # 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.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure-dr8296*_-x=%=*w(*j#g-ljz47enx%8-au$l7&e@4x-(dud=h)' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False ALLOWED_HOSTS = ['https://vast-cove-31406.herokuapp.com', 'localhost', '127.0.0.1' ] # Application definition INSTALLED_APPS = [ 'safedelete', 'reviewadmin', 'userapp', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', '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 = 'review.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'static')], '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 = 'review.wsgi.application' # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/3.2/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.2/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.2/howto/static-files/ STATIC_URL = '/static/' # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') # Activate Django-Heroku django_heroku.settings(locals())
[ "noreply@github.com" ]
noreply@github.com
f9aedbea917b21ed89324565fef95311658ab4cb
a37d9f2ab27952dbc1fd3f394ce6f8f537bbee3a
/bnet/optimizers/__init__.py
01323a07f36de3f988c1c8a9a500ab761d196794
[]
no_license
dmbernaal/bnet-resnest-xresnet-mininets
d4b1739270bc0610550d4098f2db2756147f2c7c
b53248bc64e6cc1eca47a7770984066e38070045
refs/heads/main
2023-01-23T15:08:26.376580
2020-12-08T06:08:08
2020-12-08T06:08:08
319,539,625
0
0
null
null
null
null
UTF-8
Python
false
false
341
py
from .adamod import AdaMod from .deepmemory import DeepMemory from .diffgrad import DiffGrad from .diffmod import DiffMod from .lookahead import Lookahead, LookaheadAdam from .novograd import Novograd from .ralamb import Ralamb from .ranger import Ranger from .rangerlars import RangerLars from .adahessian import Adahessian, get_params_grad
[ "dmbernaal@gmail.com" ]
dmbernaal@gmail.com
28bda1e33cd425eb795d84761fee2c683f18d463
81c914bfcc5cd7fcb78a4cc3e9c86a12366c6379
/flask_emal/pyMail/pyMail.py
fd5f68d0a65245d83a88ded5c0ccdaeaafeccc6d
[]
no_license
DarionRichie/emali
2e9e487beec3962990eaf6633333f508d5808c32
f4251965aea95ffcb5a14052f4b419735740ba2d
refs/heads/master
2023-05-24T01:10:18.566193
2021-06-17T09:07:28
2021-06-17T09:07:28
377,769,029
0
0
null
null
null
null
UTF-8
Python
false
false
8,210
py
# -*- coding: utf-8 -*- import imaplib, email import sys import os import smtplib import mimetypes from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase from email.MIMEText import MIMEText from email.encoders import encode_base64 from email.header import Header reload(sys) sys.setdefaultencoding('utf8') # *********接受邮件部分(IMAP)********** # 处理接受邮件的类 class ReceiveMailDealer: # 构造函数(用户名,密码,imap服务器) def __init__(self, username, password, server): self.mail = imaplib.IMAP4_SSL(server) self.mail.login(username, password) self.select("INBOX") # 返回所有文件夹 def showFolders(self): return self.mail.list() # 选择收件箱(如“INBOX”,如果不知道可以调用showFolders) def select(self, selector): return self.mail.select(selector) # 搜索邮件(参照RFC文档http://tools.ietf.org/html/rfc3501#page-49) def search(self, charset, *criteria): try: return self.mail.search(charset, *criteria) except: self.select("INBOX") return self.mail.search(charset, *criteria) # 返回所有未读的邮件列表(返回的是包含邮件序号的列表) def getUnread(self): return self.search(None, "All") def getSend(self): return self.search(None, "All") def getUnread_real(self): return self.search(None, "Unseen") # 以RFC822协议格式返回邮件详情的email对象 def getEmailFormat(self, num): data = self.mail.fetch(num, 'RFC822') # print(data) # print(self.mail.ParseFlags) if data[0] == 'OK': return email.message_from_string(data[1][0][1]) else: return "fetch error" # 返回发送者的信息——元组(邮件称呼,邮件地址) def getSenderInfo(self, msg): name = email.Utils.parseaddr(msg["from"])[0] deName = email.Header.decode_header(name)[0] if deName[1] != None: name = unicode(deName[0], deName[1]) address = email.Utils.parseaddr(msg["from"])[1] return (name, address) # 返回接受者的信息——元组(邮件称呼,邮件地址) def getReceiverInfo(self, msg): name = email.Utils.parseaddr(msg["to"])[0] deName = email.Header.decode_header(name)[0] if deName[1] != None: name = unicode(deName[0], deName[1]) address = email.Utils.parseaddr(msg["to"])[1] return (name, address) # 返回邮件的主题(参数msg是email对象,可调用getEmailFormat获得) def getSubjectContent(self, msg): deContent = email.Header.decode_header(msg['subject'])[0] if deContent[1] != None: return unicode(deContent[0], deContent[1]) return deContent[0] '''判断是否有附件,并解析(解析email对象的part) 返回列表(内容类型,大小,文件名,数据流) ''' def parse_attachment(self, message_part): content_disposition = message_part.get("Content-Disposition", None) if content_disposition: dispositions = content_disposition.strip().split(";") if bool(content_disposition and dispositions[0].lower() == "attachment"): file_data = message_part.get_payload(decode=True) attachment = {} attachment["content_type"] = message_part.get_content_type() attachment["size"] = len(file_data) deName = email.Header.decode_header(message_part.get_filename())[0] name = deName[0] if deName[1] != None: name = unicode(deName[0], deName[1]) # print name attachment["name"] = name attachment["data"] = file_data '''保存附件 fileobject = open(name, "wb") fileobject.write(file_data) fileobject.close() ''' return attachment return None '''返回邮件的解析后信息部分 返回列表包含(主题,纯文本正文部分,html的正文部分,发件人元组,收件人元组,附件列表) ''' # 先只返回部分有用的信息 def getMailInfo(self, num): msg = self.getEmailFormat(num) return { 'subject': self.getSubjectContent(msg) } def getMailInfo_all(self, num): msg = self.getEmailFormat(num) # print(msg) attachments = [] body = None html = None for part in msg.walk(): attachment = self.parse_attachment(part) if attachment: attachments.append(attachment) elif part.get_content_type() == "text/plain": if body is None: body = "" body += part.get_payload(decode=True) elif part.get_content_type() == "text/html": if html is None: html = "" html += part.get_payload(decode=True) return { 'subject': self.getSubjectContent(msg), 'body': body, 'html': html, 'from': self.getSenderInfo(msg), 'to': self.getReceiverInfo(msg), 'attachments': attachments, } # *********发送邮件部分(smtp)********** class SendMailDealer: # 构造函数(用户名,密码,smtp服务器) def __init__(self, user, passwd, smtp, port = 25, usettls=False): self.mailUser = user self.mailPassword = passwd self.smtpServer = smtp self.smtpPort = port self.mailServer = smtplib.SMTP(self.smtpServer, self.smtpPort) self.mailServer.ehlo() if usettls: self.mailServer.starttls() self.mailServer.ehlo() self.mailServer.login(self.mailUser, self.mailPassword) self.msg = MIMEMultipart() # 对象销毁时,关闭mailserver def __del__(self): self.mailServer.close() # 重新初始化邮件信息部分 def reinitMailInfo(self): self.msg = MIMEMultipart() # 设置邮件的基本信息(收件人,主题,正文,正文类型html或者plain,可变参数附件路径列表) def setMailInfo(self, receiveUser, subject, text, text_type, *attachmentFilePaths): self.msg['From'] = self.mailUser self.msg['To'] = receiveUser self.msg['Subject'] = subject self.msg.attach(MIMEText(text, text_type)) for attachmentFilePath in attachmentFilePaths: self.msg.attach(self.getAttachmentFromFile(attachmentFilePath)) # 自定义邮件正文信息(正文内容,正文格式html或者plain) def addTextPart(self, text, text_type): self.msg.attach(MIMEText(text, text_type)) # 增加附件(以流形式添加,可以添加网络获取等流格式)参数(文件名,文件流) def addAttachment(self, filename, filedata): part = MIMEBase('application', "octet-stream") part.set_payload(filedata) encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename="%s"' % str(Header(filename, 'utf8'))) self.msg.attach(part) # 通用方法添加邮件信息(MIMETEXT,MIMEIMAGE,MIMEBASE...) def addPart(self, part): self.msg.attach(part) # 发送邮件 def sendMail(self): if not self.msg['To']: print "没有收件人,请先设置邮件基本信息" return self.mailServer.sendmail(self.mailUser, self.msg['To'], self.msg.as_string()) print('Sent email to %s' % self.msg['To']) # 通过路径添加附件 def getAttachmentFromFile(self, attachmentFilePath): part = MIMEBase('application', "octet-stream") part.set_payload(open(attachmentFilePath, "rb").read()) encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename="%s"' % str(Header(attachmentFilePath, 'utf8'))) return part
[ "2969524644@qq.com" ]
2969524644@qq.com
d71180f0bd321d3d7193738b32581743b75440f3
3257372291236aac1737b057c9ac6c61da9ccca0
/tutorials/W0D5_Statistics/solutions/W0D5_Tutorial2_Solution_281848de.py
65dc66a635bd53e9c76bb3d72f597aebb3c00512
[ "CC-BY-4.0", "BSD-3-Clause", "MIT" ]
permissive
NeuromatchAcademy/precourse
230ead0d11ae7b0dba21c8df97695a1796e9797d
b7f2432c6a68a7984ca923ceed8e07d5cfdb77c3
refs/heads/main
2023-07-26T11:18:24.493966
2023-07-09T14:42:49
2023-07-09T14:42:49
256,327,558
639
174
MIT
2023-07-09T14:42:50
2020-04-16T20:54:03
Jupyter Notebook
UTF-8
Python
false
false
621
py
""" You will learn more about "Bayesian brains" and the theory surrounding these ideas once the course begins. Here is a brief explanation: it may be ideal for human brains to implement Bayesian inference by integrating "prior" information the brain has about the world (memories, prior knowledge, etc.) with new evidence that updates its "beliefs"/prior. This process seems to parallel the brain's method of learning about its environment, making it a compelling theory for many neuroscience researchers. One of Bonus exercises below examines a possible real world model for Bayesian inference: sound localization. """;
[ "noreply@github.com" ]
noreply@github.com
50c2dde48b456f93aa0260584ded425981eeb60e
e7e029a04319afce21c43317e2cc8f3dc92091ca
/pex/commands/command.py
2104e893ca0f0b603d42816941bd46692371ae1a
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
asherf/pex
e451b28a088968736e47285396813f6a2b4c6058
c15508ad1a2d48bdef9fbac677dbfa32927e6625
refs/heads/master
2022-07-22T23:01:48.331316
2022-07-05T14:41:35
2022-07-05T14:41:35
237,337,647
0
0
Apache-2.0
2020-01-31T01:12:31
2020-01-31T01:12:30
null
UTF-8
Python
false
false
13,469
py
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, print_function import functools import json import logging import os import subprocess import sys import tempfile from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace, _ActionsContainer from contextlib import contextmanager from pex import pex_warnings from pex.argparse import HandleBoolAction from pex.common import safe_mkdtemp, safe_open from pex.result import Error, Ok, Result from pex.typing import TYPE_CHECKING, Generic, cast from pex.variables import ENV, Variables from pex.version import __version__ if TYPE_CHECKING: from typing import ( IO, Any, Dict, Iterable, Iterator, NoReturn, Optional, Sequence, Type, TypeVar, ) import attr # vendor:skip else: from pex.third_party import attr if TYPE_CHECKING: _T = TypeVar("_T") def try_run_program( program, # type: str args, # type: Iterable[str] url=None, # type: Optional[str] error=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> Result try: subprocess.check_call([program] + list(args), **kwargs) return Ok() except OSError as e: msg = [error] if error else [] msg.append("Do you have `{}` installed on the $PATH?: {}".format(program, e)) if url: msg.append( "Find more information on `{program}` at {url}.".format(program=program, url=url) ) return Error("\n".join(msg)) except subprocess.CalledProcessError as e: return Error(str(e), exit_code=e.returncode) def try_open_file( path, # type: str error=None, # type: Optional[str] ): # type: (...) -> Result opener, url = ( ("xdg-open", "https://www.freedesktop.org/wiki/Software/xdg-utils/") if "Linux" == os.uname()[0] else ("open", None) ) with open(os.devnull, "wb") as devnull: return try_run_program(opener, [path], url=url, error=error, stdout=devnull) @attr.s(frozen=True) class Command(object): @staticmethod def show_help( parser, # type: ArgumentParser *_args, # type: Any **_kwargs # type: Any ): # type: (...) -> NoReturn parser.error("a subcommand is required") @staticmethod def register_global_arguments( parser, # type: _ActionsContainer include_verbosity=True, # type: bool ): # type: (...) -> None register_global_arguments(parser, include_verbosity=include_verbosity) @classmethod def name(cls): # type: () -> str return cls.__name__.lower() @classmethod def description(cls): # type: () -> Optional[str] return cls.__doc__ @classmethod def add_arguments(cls, parser): # type: (ArgumentParser) -> None pass options = attr.ib() # type: Namespace class OutputMixin(object): @staticmethod def add_output_option( parser, # type: _ActionsContainer entity, # type: str ): # type: (...) -> None parser.add_argument( "-o", "--output", metavar="PATH", help=( "A file to output the {entity} to; STDOUT by default or when `-` is " "specified.".format(entity=entity) ), ) @staticmethod def is_stdout(options): # type: (Namespace) -> bool return options.output == "-" or not options.output @classmethod @contextmanager def output( cls, options, # type: Namespace binary=False, # type: bool ): # type: (...) -> Iterator[IO] if cls.is_stdout(options): stdout = getattr(sys.stdout, "buffer", sys.stdout) if binary else sys.stdout yield stdout else: with safe_open(options.output, mode="wb" if binary else "w") as out: yield out class JsonMixin(object): @staticmethod def add_json_options( parser, # type: _ActionsContainer entity, # type: str include_switch=True, # type: bool ): flags = ("-i", "--indent") if include_switch else ("--indent",) parser.add_argument( *flags, type=int, default=None, help="Pretty-print {entity} json with the given indent.".format(entity=entity) ) @staticmethod def dump_json( options, # type: Namespace data, # type: Dict[str, Any] out, # type: IO **json_dump_kwargs # type: Any ): json.dump(data, out, indent=options.indent, **json_dump_kwargs) def register_global_arguments( parser, # type: _ActionsContainer include_verbosity=True, # type: bool ): # type: (...) -> None """Register Pex global environment configuration options with the given parser. :param parser: The parser to register global options with. :param include_verbosity: Whether to include the verbosity option `-v`. """ group = parser.add_argument_group(title="Global options") if include_verbosity: group.add_argument( "-v", dest="verbosity", action="count", default=0, help="Turn on logging verbosity, may be specified multiple times.", ) group.add_argument( "--emit-warnings", "--no-emit-warnings", dest="emit_warnings", action=HandleBoolAction, default=True, help=( "Emit runtime UserWarnings on stderr. If false, only emit them when PEX_VERBOSE " "is set." ), ) group.add_argument( "--pex-root", dest="pex_root", default=None, help=( "Specify the pex root used in this invocation of pex " "(if unspecified, uses {}).".format(ENV.PEX_ROOT) ), ) group.add_argument( "--disable-cache", dest="disable_cache", default=False, action="store_true", help="Disable caching in the pex tool entirely.", ) group.add_argument( "--cache-dir", dest="cache_dir", default=None, help=( "DEPRECATED: Use --pex-root instead. The local cache directory to use for speeding up " "requirement lookups." ), ) group.add_argument( "--tmpdir", dest="tmpdir", default=tempfile.gettempdir(), help="Specify the temporary directory Pex and its subprocesses should use.", ) group.add_argument( "--rcfile", dest="rc_file", default=None, help=( "An additional path to a pexrc file to read during configuration parsing, in addition " "to reading `/etc/pexrc` and `~/.pexrc`. If `PEX_IGNORE_RCFILES=true`, then all rc " "files will be ignored." ), ) class GlobalConfigurationError(Exception): """Indicates an error processing global options.""" @contextmanager def _configured_env(options): # type: (Namespace) -> Iterator[None] if options.rc_file or not ENV.PEX_IGNORE_RCFILES: with ENV.patch(**Variables(rc=options.rc_file).copy()): yield else: yield @contextmanager def global_environment(options): # type: (Namespace) -> Iterator[Dict[str, str]] """Configures the Pex global environment. This includes configuration of basic Pex infrastructure like logging, warnings and the `PEX_ROOT` to use. :param options: The global options registered by `register_global_arguments`. :yields: The configured global environment. :raises: :class:`GlobalConfigurationError` if invalid global option values were specified. """ if not hasattr(options, "rc_file"): # We don't register the global args on the root command (but do on every subcommand). # So if the user runs just `pex` with no subcommand we must not attempt to use those # global args, including rc_file, which we check for here as a representative of the # global args. # Note that we can't use command_type here because the legacy command line parser in # pex/bin/pex.py uses this function as well, and it doesn't set command_type. with ENV.patch() as env: yield env with _configured_env(options): verbosity = Variables.PEX_VERBOSE.strip_default(ENV) if verbosity is None: verbosity = getattr(options, "verbosity", 0) emit_warnings = True if not options.emit_warnings: emit_warnings = False if emit_warnings and ENV.PEX_EMIT_WARNINGS is not None: emit_warnings = ENV.PEX_EMIT_WARNINGS with ENV.patch(PEX_VERBOSE=str(verbosity), PEX_EMIT_WARNINGS=str(emit_warnings)): pex_warnings.configure_warnings(env=ENV) # Ensure the TMPDIR is an absolute path (So subprocesses that change CWD can find it) # and that it exists. tmpdir = os.path.realpath(options.tmpdir) if not os.path.exists(tmpdir): raise GlobalConfigurationError( "The specified --tmpdir does not exist: {}".format(tmpdir) ) if not os.path.isdir(tmpdir): raise GlobalConfigurationError( "The specified --tmpdir is not a directory: {}".format(tmpdir) ) tempfile.tempdir = os.environ["TMPDIR"] = tmpdir if options.cache_dir: pex_warnings.warn("The --cache-dir option is deprecated, use --pex-root instead.") if options.pex_root and options.cache_dir != options.pex_root: raise GlobalConfigurationError( "Both --cache-dir and --pex-root were passed with conflicting values. " "Just set --pex-root." ) if options.disable_cache: def warn_ignore_pex_root(set_via): pex_warnings.warn( "The pex root has been set via {via} but --disable-cache is also set. " "Ignoring {via} and disabling caches.".format(via=set_via) ) if options.cache_dir: warn_ignore_pex_root("--cache-dir") elif options.pex_root: warn_ignore_pex_root("--pex-root") elif os.environ.get("PEX_ROOT"): warn_ignore_pex_root("PEX_ROOT") pex_root = safe_mkdtemp() else: pex_root = options.cache_dir or options.pex_root or ENV.PEX_ROOT with ENV.patch(PEX_ROOT=pex_root, TMPDIR=tmpdir) as env: yield env if TYPE_CHECKING: _C = TypeVar("_C", bound=Command) class Main(Generic["_C"]): def __init__( self, command_types, # type: Iterable[Type[_C]] description=None, # type: Optional[str] subparsers_description=None, # type: Optional[str] prog=None, # type: Optional[str] ): # type: (...) -> None self._prog = prog self._description = description or self.__doc__ self._subparsers_description = subparsers_description self._command_types = command_types def add_arguments(self, parser): # type: (ArgumentParser) -> None pass @contextmanager def parsed_command(self, args=None): # type: (Optional[Sequence[str]]) -> Iterator[_C] logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.INFO) # By default, let argparse derive prog from sys.argv[0]. prog = self._prog if os.path.basename(sys.argv[0]) == "__main__.py": prog = "{python} -m {module}".format( python=sys.executable, module=".".join(type(self).__module__.split(".")[:-1]) ) parser = ArgumentParser( prog=prog, formatter_class=ArgumentDefaultsHelpFormatter, description=self._description, ) parser.add_argument("-V", "--version", action="version", version=__version__) parser.set_defaults(command_type=functools.partial(Command.show_help, parser)) self.add_arguments(parser) if self._command_types: subparsers = parser.add_subparsers(description=self._subparsers_description) for command_type in self._command_types: name = command_type.name() description = command_type.description() help_text = description.splitlines()[0] if description else None command_parser = subparsers.add_parser( name, formatter_class=ArgumentDefaultsHelpFormatter, help=help_text, description=description, ) command_type.add_arguments(command_parser) command_parser.set_defaults(command_type=command_type) options = parser.parse_args(args=args) with global_environment(options): command_type = cast("Type[_C]", options.command_type) yield command_type(options)
[ "noreply@github.com" ]
noreply@github.com
06e60323dd57f2def66299b5acfc0b773762fb62
a3c4935537a42330758c7ac54553ae45daad069d
/.history/backend/src/api_20210807005753.py
d5a98b48745dbac2d9550540ef0d1b41a0699108
[]
no_license
saraalmuraytib/Coffee-Shop
219292b4e2dd9b39621f9cd42bdcb049f5bb20c8
cec4b8df3a4c38600fb2964f8fa85d3c820ddb6c
refs/heads/main
2023-07-12T19:39:26.617313
2021-08-28T19:22:23
2021-08-28T19:22:23
392,365,613
0
0
null
null
null
null
UTF-8
Python
false
false
4,532
py
import os from flask import Flask, request, jsonify, abort from sqlalchemy import exc import json from flask_cors import CORS from .database.models import db_drop_and_create_all, setup_db, Drink from .auth.auth import AuthError, requires_auth app = Flask(__name__) setup_db(app) CORS(app) ''' @TODO uncomment the following line to initialize the datbase !! NOTE THIS WILL DROP ALL RECORDS AND START YOUR DB FROM SCRATCH !! NOTE THIS MUST BE UNCOMMENTED ON FIRST RUN !! Running this funciton will add one ''' # db_drop_and_create_all() # ROUTES ''' @TODO implement endpoint GET /drinks it should be a public endpoint it should contain only the drink.short() data representation returns status code 200 and json {"success": True, "drinks": drinks} where drinks is the list of drinks or appropriate status code indicating reason for failure ''' @app.route('/drinks') def drinks(): try: drinks = Drink.query.all() return jsonify({ 'success': True, 'drinks': [drink.short() for drink in drinks] }),200 except: abort(404) ''' @TODO implement endpoint GET /drinks-detail it should require the 'get:drinks-detail' permission it should contain the drink.long() data representation returns status code 200 and json {"success": True, "drinks": drinks} where drinks is the list of drinks or appropriate status code indicating reason for failure ''' @app.route("/drinks-detail") @requires_auth('get:drinks-detail') def get_drink_detail(payload): try: drinks = Drink.query.all() return jsonify({ 'success': True, 'drinks': [drink.long() for drink in drinks] }),200 except: abort(404) ''' @TODO implement endpoint POST /drinks it should create a new row in the drinks table it should require the 'post:drinks' permission it should contain the drink.long() data representation returns status code 200 and json {"success": True, "drinks": drink} where drink an array containing only the newly created drink or appropriate status code indicating reason for failure ''' @app.route("/drinks", methods=['POST']) @requires_auth('post:drinks') def add_drink(payload): # Fetch the request body body = request.get_json() # Get title and recipe to create the drink title = body.get('title') recipe = body.get('recipe') try: # json.dumps ---> Serialize obj to a JSON formatted str. new_drink = Drink(title=title, recipe=json.dumps(recipe)) new_drink.insert() return jsonify({ 'success': True, 'drinks': [new_drink.long()], }) except: abort(422) ''' @TODO implement endpoint PATCH /drinks/<id> where <id> is the existing model id it should respond with a 404 error if <id> is not found it should update the corresponding row for <id> it should require the 'patch:drinks' permission it should contain the drink.long() data representation returns status code 200 and json {"success": True, "drinks": drink} where drink an array containing only the updated drink or appropriate status code indicating reason for failure ''' ''' @TODO implement endpoint DELETE /drinks/<id> where <id> is the existing model id it should respond with a 404 error if <id> is not found it should delete the corresponding row for <id> it should require the 'delete:drinks' permission returns status code 200 and json {"success": True, "delete": id} where id is the id of the deleted record or appropriate status code indicating reason for failure ''' # Error Handling ''' Example error handling for unprocessable entity ''' @app.errorhandler(422) def unprocessable(error): return jsonify({ "success": False, "error": 422, "message": "unprocessable" }), 422 ''' @TODO implement error handlers using the @app.errorhandler(error) decorator each error handler should return (with approprate messages): jsonify({ "success": False, "error": 404, "message": "resource not found" }), 404 ''' ''' @TODO implement error handler for 404 error handler should conform to general task above ''' ''' @TODO implement error handler for AuthError error handler should conform to general task above '''
[ "sara.almuraytib@gmail.com" ]
sara.almuraytib@gmail.com
3229ae4d99f065b255b95b5914601dccb2a74017
9f0e1e43883d99ac6e88cb120ad88158e5f7b1f9
/Evaluation/PSNR calculation_grayscale.py
9a48a865bfb56e16a8e44d585aa4a36dc699f0e7
[]
no_license
Sreeramansr/Image_Compression--Convolutional_Auto-encoder
8a9f93a36126ea49eff05fcffef196dd174ad1b6
17d5268064eacf61432cc0f2b6e1266089576e94
refs/heads/master
2022-12-17T01:37:59.822076
2020-09-19T10:13:02
2020-09-19T10:13:02
240,003,304
0
0
null
null
null
null
UTF-8
Python
false
false
1,339
py
# -*- coding: utf-8 -*- """ Created on Mon May 18 16:24:42 2020 @author: Sreeraman """ # calculation of PSNR values from math import log10, sqrt import cv2 import numpy as np def PSNR(original, compressed): # original = original.astype(np.float64) / 255. # compressed = compressed.astype(np.float64) / 255. mse = np.mean((original - compressed) ** 2) if(mse == 0): # MSE is zero means no noise is present in the signal . # Therefore PSNR have no importance. return 100 max_pixel = 255.0 psnr = 20 * log10(max_pixel / sqrt(mse)) return psnr def main(): sum = 0 for i in range(0,24): i = str(i) s_zero = i.zfill(1) print(s_zero) original = cv2.imread("D:/Sree program/Results/No_Dataloss/Decoded_img_7_7_16D_01/image" + s_zero + ".png") original = cv2.cvtColor(original, cv2.COLOR_BGR2GRAY) compressed = cv2.imread("D:/Sree program/Results/No_Dataloss/Decoded_img_7_7_16D_01/reconstruct"+ s_zero + ".png") compressed = cv2.cvtColor(compressed, cv2.COLOR_BGR2GRAY) value = PSNR(original, compressed) sum = sum + value print(f"PSNR value is {value} dB") avg = sum/24 print(avg) if __name__ == "__main__": main()
[ "noreply@github.com" ]
noreply@github.com
5bc51ef0a70eeafa727c3a43c4b2b701625f00af
07f54a15cc10ec715da0864901485d6282f13cae
/Lessons/ex10.py
397a1a8c699589e535b37706c1aedff31d50643c
[]
no_license
levelupcode/LearnPythonTheHardWay
4d7604c065f90f7ea63919a8994e04330a4aa309
88dcb4ec00a5d59769a1888b9b72c1968de8e943
refs/heads/master
2021-01-22T13:13:03.308266
2013-01-03T18:18:06
2013-01-03T18:18:06
null
0
0
null
null
null
null
UTF-8
Python
false
false
462
py
# Part 1 "I am 6'2\" tall." # Escape double-quote inside string 'I am 6\'2" Tall.' # Escape single-quote inside string # Part 2 tabby_cat = "\tI'm tabben in." persian_cat = "I'm split\non a line." backslash_cat = "I'm \\ a \\ cat." fat_cat = """ I'l do a list: \t* Cat Food \t* Fishies \t* Catnip\n\t* Grass """ print tabby_cat print persian_cat print backslash_cat print fat_cat # Part 3 while True: for i in ["/","-","\\","|"]: print "%s\r" % i * 10,
[ "levelupcode@gmail.com" ]
levelupcode@gmail.com
567c5930ce4dce2b362ee9ebf34f4f2c604b528e
88df15f1c36960f3473caf54904cbaae5f3bab52
/function.py
b9deefeceb27b05ad098eda3a0941d75fe731747
[]
no_license
pigpigman8686/listen
eef86b391b7399a96edfe1f8136dcd26d0ffd646
aa3b3f7d2e49ffb557739c19c3712b9e6d823e43
refs/heads/master
2020-06-19T17:46:29.283378
2019-07-14T07:34:39
2019-07-14T07:34:39
196,806,426
0
0
null
null
null
null
UTF-8
Python
false
false
897
py
import random import os,re def getMessage(yes=True,snr=28,count=1): if count == 1: page = int(9) elif yes==True: page = int((snr-10)/2-1) if page<0: page = 0 else: page = int((snr-10)/2+1) if page>18: page=18 filepath = "static/voice/"+str(page) #print("filepath:"+filepath) filelist = os.listdir(filepath) #print("mess len:"+str(random.randint(0,len(message)))) #print(random.randint(0,len(message))) message = "voice/"+str(page)+"/"+ str(filelist[random.randint(0,len(filelist)-1)]) return message def average(result): patten = re.compile('(\d{1,})-(\d{1,})') snr = 0 for i in range(1,20): #print("--------------------i:"+str(i)) s = '%s'%str(result[0]['right'+str(i)]) right = re.search(patten,s) snr += int(right.group(2)) return snr/19.0
[ "952361195@qq.com" ]
952361195@qq.com
7832dae5c8c8d4af7c3fe58a5174a5722ceeaa14
00ca311d3dccb4ffe4d2e1cd88c98cab699d26a0
/hk.py
e91e776e17f03d58ddd559c02a0a0df1abde908c
[]
no_license
y1212/myslite
e13bfb11a4189a75b1bd5d062b8cb48ef70de1c8
74e35bd04f9ac8c0a7fd1a3eb68ee3311f6adff9
refs/heads/master
2020-12-13T06:05:52.774554
2020-01-16T11:14:24
2020-01-16T11:14:24
234,330,553
0
0
null
null
null
null
UTF-8
Python
false
false
3,428
py
#setence="ls , aa, cnm, sb" # var=input("please input:") # if var in setence: # setence=setence.replace("cnm","*") # print(setence) # # tuple=(1,2,3) # list1=list(tuple[1]) # print(list1,type(list1)) # c,s =" ", "this is my house" # d=s.split() # d.reverse() # for e in d: # c=c+e+" " # print(c.lstrip()) # listB, listC = [], ["string", "tuple", "list", (1, 2, 3, 4, 5), [6, 7]] # for element in listC: # if type(element) not in (int, float, str, bool): # for e in element: # listB.append(e) # else: # listB.append(element) # print(listB) # files= open(file="story/tt.txt",encoding="utf8") # content=files.read() # print(content) # files.close() #1、除二余一,a/3==2,a/4==3,a/5==4,a/6==5,a/7==9 a=7 while True: if a % 2 ==1 and a % 3 == 2 and a % 4 == 3 and a % 5 == 4 and a % 6 == 5 and a % 7 == 0: print(a) break else: a += 7 # 2. 使用while循环, 反转句子"hello Tony, this my sister"; 反转后为"sister my this, Tony hello"; s = 'hello Tony,this my sister' list1 = s.split(',') list_target = [] i = len(list1) - 1 while i >= 0: list0 = list1[i].split(' ') a = ' '.join(list0[::-1]) list_target.append(a) i -= 1 str_target = ','.join(list_target) print(str_target) # A,B=[],"hello Tony, this my sister" # list1=B.split(',') # while len(list1)-1>=0: # list0=list1[len(list1)-1].split() # list1[] # 3. 列表["string", "tuple", "list", (1, 2, 3, 4, 5), [6, 7]]转换成["string", "tuple", "list", 1, 2, 3, 4, 5, 6, 7]; listB, listC = [], ["string", "tuple", "list", (1, 2, 3, 4, 5), [6, 7]] for element in listC: if type(element) not in (int, float, str, bool): for e in element: listB.append(e) else: listB.append(element) print(listB) 4.#对[23, 12, 15, 11, 29, 24, 57, 21, 80, 99, 45]进行排序; 方式一: 要求使用for循环; 方式二: sorted函数; listA = [23, 12, 15, 11, 29, 24, 57, 21, 80, 99, 45] s=sorted(listA) print(s) # for循环 for i in range(len(listA)): for j in range(len(listA)): if listA[i]<listA[j]: listA[i],listA[j]=listA[j],listA[i] print(listA) # 5. 元组("string", "world", 1, 2, 3, 4, 6, 9, 10), 把其中的数字提取到一个列表中; listA, tupleA = [], ("string", "world", 1, 2, 3, 4, 6, 9, 10) for element in tupleA: if type(element) in (int, float): listA.append(element) print(listA,type(listA)) # 6. 提取access_log日志中所有的IP地址到字典ips中, 并根据ips中每个IP出现次数进行排序; with open("story/access.log","r",encoding="utf8") as log: ips = {} while True: lines = log.readline() if not lines: break if lines.split()[0] in ips.keys(): ips[lines.split()[0]] += 1 else: ips[lines.split()[0]] = 1 print(ips) ip_sort = [] for item in ips.items(): ip_sort.append(item) for i in range(len(ip_sort)): for j in range(len(ip_sort) - 1): if ip_sort[j][1] < ip_sort[j + 1][1]: ip_sort[j], ip_sort[j + 1] = ip_sort[j + 1], ip_sort[j] print(sorted(ip_sort))#正序 print(ip_sort)#倒序 #7. 字符串"hello7723worl45d78", 把其中的数字提取到一个元组中; str1 = "hello7723worl45d78" str2 = "0123456789" c = " " for i in str1: if i in str2: c= c + i print(tuple(c))
[ "59354787+y1212@users.noreply.github.com" ]
59354787+y1212@users.noreply.github.com
c3f0599a81e8b53fa9132efeb23e2ef17af55d83
9b98b2f357a8b3311d51b74089bd7b6b2eb107ab
/Python Codes/teapot_optimized.py
d1ac296ecb4a99e81ac97febb5ecc67c757954ed
[]
no_license
shivam-grover/Eyantra-Thirsty_Crow-Team_ID-972
65010b9fca267b903ccc6bb29b3878adea205dfd
a6f0f3ec5a9cb5e3d5f8d694bba53137a23e8b4e
refs/heads/master
2021-10-27T12:01:41.261582
2019-04-17T03:49:21
2019-04-17T03:49:21
157,661,451
1
1
null
null
null
null
UTF-8
Python
false
false
11,792
py
""" ************************************************************************** * E-Yantra Robotics Competition * ================================ * This software is intended to check version compatiability of open source software * Theme: Thirsty Crow * MODULE: Task1.1 * Filename: detect.py * Version: 1.0.0 * Date: October 31, 2018 * * Author: e-Yantra Project, Department of Computer Science * and Engineering, Indian Institute of Technology Bombay. * * Software released under Creative Commons CC BY-NC-SA * * For legal information refer to: * http://creativecommons.org/licenses/by-nc-sa/4.0/legalcode * * * This software is made available on an “AS IS WHERE IS BASIS”. * Licensee/end user indemnifies and will keep e-Yantra indemnified from * any and all claim(s) that emanate from the use of the Software or * breach of the terms of this agreement. * * e-Yantra - An MHRD project under National Mission on Education using * ICT(NMEICT) * ************************************************************************** """ import numpy as np import cv2 import cv2.aruco as aruco import math from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from PIL import Image import pygame texture_object = None texture_background = None camera_matrix = None dist_coeff = None cap = cv2.VideoCapture(1) width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) INVERSE_MATRIX = np.array([[1.0, 1.0, 1.0, 1.0], [-1.0, -1.0, -1.0, -1.0], [-1.0, -1.0, -1.0, -1.0], [1.0, 1.0, 1.0, 1.0]]) ################## Define Utility Functions Here ####################### """ Function Name : getCameraMatrix() Input: None Output: camera_matrix, dist_coeff Purpose: Loads the camera calibration file provided and returns the camera and distortion matrix saved in the calibration file. """ def getCameraMatrix(): global camera_matrix, dist_coeff with np.load('Camera.npz') as X: camera_matrix, dist_coeff, _, _ = [X[i] for i in ('mtx', 'dist', 'rvecs', 'tvecs')] ######################################################################## ############# Main Function and Initialisations ######################## """ Function Name : main() Input: None Output: None Purpose: Initialises OpenGL window and callback functions. Then starts the event processing loop. """ def main(): glutInit() getCameraMatrix() glutInitWindowSize(640, 480) glutInitWindowPosition(625, 100) glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE) window_id = glutCreateWindow("OpenGL") init_gl() glutDisplayFunc(drawGLScene) glutIdleFunc(drawGLScene) glutReshapeFunc(resize) glutMainLoop() """ Function Name : init_gl() Input: None Output: None Purpose: Initialises various parameters related to OpenGL scene. """ def init_gl(): global texture_object, texture_background glClearColor(0.0, 0.0, 0.0, 0.0) glClearDepth(1.0) glDepthFunc(GL_LESS) glEnable(GL_DEPTH_TEST) glShadeModel(GL_SMOOTH) glMatrixMode(GL_MODELVIEW) glEnable(GL_DEPTH_TEST) glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) texture_background = glGenTextures(1) texture_object = glGenTextures(1) """ Function Name : resize() Input: None Output: None Purpose: Initialises the projection matrix of OpenGL scene """ def resize(w, h): ratio = 1.0 * w / h glMatrixMode(GL_PROJECTION) glViewport(0, 0, w, h) gluPerspective(45, ratio, 0.1, 100.0) """ Function Name : drawGLScene() Input: None Output: None Purpose: It is the main callback function which is called again and again by the event processing loop. In this loop, the webcam frame is received and set as background for OpenGL scene. ArUco marker is detected in the webcam frame and 3D model is overlayed on the marker by calling the overlay() function. """ def drawGLScene(): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ar_list = [] ret, frame = cap.read() if ret == True: draw_background(frame) glMatrixMode(GL_MODELVIEW) glLoadIdentity() ar_list = detect_markers(frame) if ar_list is not None: for i in ar_list: if i[0] == 0: overlay(frame, ar_list, i[0], "texture_1.png") if i[0] == 2: overlay(frame, ar_list, i[0], "texture_2.png") if i[0] == 1: overlay(frame, ar_list, i[0], "texture_3.png") if i[0] == 6: overlay(frame, ar_list, i[0], "texture_4.png") cv2.imshow('frame', frame) cv2.waitKey(1) glutSwapBuffers() ######################################################################## ######################## Aruco Detection Function ###################### """ Function Name : detect_markers() Input: img (numpy array) Output: aruco list in the form [(aruco_id_1, centre_1, rvec_1, tvec_1),(aruco_id_2, centre_2, rvec_2, tvec_2), ()....] Purpose: This function takes the image in form of a numpy array, camera_matrix and distortion matrix as input and detects ArUco markers in the image. For each ArUco marker detected in image, paramters such as ID, centre coord, rvec and tvec are calculated and stored in a list in a prescribed format. The list is returned as output for the function """ def detect_markers(img): aruco_list = [] ################################################################ #################### Same code as Task 1.1 ##################### ################################################################ markerLength = 0.127 aruco_list = [] aruco_dict = aruco.Dictionary_get(aruco.DICT_5X5_250) parameters = aruco.DetectorParameters_create() # lists of ids and the corners beloning to each id corners, ids, rejectedImgPoints = aruco.detectMarkers(img, aruco_dict, parameters=parameters) # print(corners) cx = [] cy = [] if ids is not None and corners is not None: for x in range(ids.size): rvec, tvec, _ = aruco.estimatePoseSingleMarkers(corners[x], markerLength, camera_matrix, dist_coeff) # Estimate pose of each marker and return the values rvet and tvec---different from camera coefficients ids = ids.astype('int64') aruco.drawDetectedMarkers(img, corners) cx.append(int( (corners[x][0][0][0] + corners[x][0][1][0] + corners[x][0][2][0] + corners[x][0][3][0]) / 4)) cy.append(int( (corners[x][0][0][1] + corners[x][0][1][1] + corners[x][0][2][1] + corners[x][0][3][1]) / 4)) tup = (ids[x, 0], (cx[x], cy[x]), rvec, tvec) # Draw A square around the markers aruco_list.append(tup) # return aruco_list ######################################################################## ################# This is where the magic happens !! ################### ############### Complete these functions as directed ################## """ Function Name : draw_background() Input: img (numpy array) Output: None Purpose: Takes image as input and converts it into an OpenGL texture. That OpenGL texture is then set as background of the OpenGL scene """ def draw_background(img): glEnable(GL_TEXTURE_2D) bg_image = cv2.flip(img, 0) bg_image = Image.fromarray(bg_image) bg_image = bg_image.tobytes("raw", "RGB", 0, -1) # create background texture glBindTexture(GL_TEXTURE_2D, texture_background) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_BGR, GL_UNSIGNED_BYTE, bg_image) glPushMatrix() i = 30.0 # draw background glTranslatef(0.0, 0.0, -i) glBegin(GL_QUADS) glTexCoord2f(0.0, 1.0) glVertex3f(-(8*i/14), -(6*i/14), 0.0) glTexCoord2f(1.0, 1.0) glVertex3f((8*i/14), -(6*i/14), 0.0) glTexCoord2f(1.0, 0.0) glVertex3f((8*i/14), (6*i/14), 0.0) glTexCoord2f(0.0, 0.0) glVertex3f(-(8*i/14), (6*i/14), 0.0) glEnd() glPopMatrix() return None """ Function Name : init_object_texture() Input: Image file path Output: None Purpose: Takes the filepath of a texture file as input and converts it into OpenGL texture. The texture is then applied to the next object rendered in the OpenGL scene. """ def init_object_texture(image_filepath): tex = cv2.imread(image_filepath) glEnable(GL_TEXTURE_2D) bg_image = cv2.flip(tex, 0) bg_image = Image.fromarray(bg_image) ix = bg_image.size[0] iy = bg_image.size[1] bg_image = bg_image.tobytes("raw", "BGRX", 0, -1) # create background texture glBindTexture(GL_TEXTURE_2D, texture_object) # glMatrixMode(GL_PROJECTION) glLoadIdentity() glPushMatrix() glTranslatef(0.0, 0.0, 10.0) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) # Draw textured Quads # glBegin(GL_QUADS) # glTexCoord2f(0.0, 0.0) # glVertex3f(0.0, 0.0, 0.0) # glTexCoord2f(1.0, 0.0) # glVertex3f(width, 0.0, 0.0) # glTexCoord2f(1.0, 1.0) # glVertex3f(width, height, 0.0) # glTexCoord2f(0.0, 1.0) # glVertex3f(0.0, height, 0.0) # glEnd() glTexImage2D(GL_TEXTURE_2D, 0, 3, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, bg_image) glPopMatrix() return None """ Function Name : overlay() Input: img (numpy array), aruco_list, aruco_id, texture_file (filepath of texture file) Output: None Purpose: Receives the ArUco information as input and overlays the 3D Model of a teapot on the ArUco marker. That ArUco information is used to calculate the rotation matrix and subsequently the view matrix. Then that view matrix is loaded as current matrix and the 3D model is rendered. Parts of this code are already completed, you just need to fill in the blanks. You may however add your own code in this function. """ def overlay(img, ar_list, ar_id, texture_file): for x in ar_list: if ar_id == x[0]: centre, rvec, tvecs = x[1], x[2], x[3] rmtx = cv2.Rodrigues(rvec)[0] offset = [[[-0.127*19/8, -0.127*2, 0]]] tvecs = tvecs - offset font = cv2.FONT_HERSHEY_SIMPLEX #font for displaying text (below) cv2.putText(img, "Id: " + str(ar_id), centre, font, 1, (0,255,0),2,cv2.LINE_AA) view_matrix = np.array([[rmtx[0][0], rmtx[0][1], rmtx[0][2], tvecs[0][0][0]*3.5], [rmtx[1][0], rmtx[1][1], rmtx[1][2], tvecs[0][0][1]*2.5], [rmtx[2][0], rmtx[2][1], rmtx[2][2], tvecs[0][0][2]*2.3], [0.0, 0.0, 0.0, 1.0]]) # view_matrix = np.array([[rmtx[0][0], rmtx[0][1], rmtx[0][2], tvecs[0][0][0]*72], # [rmtx[1][0], rmtx[1][1], rmtx[1][2], tvecs[0][0][1]*72], # [rmtx[2][0], rmtx[2][1], rmtx[2][2], tvecs[0][0][2]*15], # [0.0, 0.0, 0.0, 1.0]]) print(tvecs , texture_file) view_matrix = view_matrix * INVERSE_MATRIX view_matrix = np.transpose(view_matrix) init_object_texture(texture_file) glPushMatrix() glLoadMatrixd(view_matrix) glutSolidTeapot(0.5) glPopMatrix() ######################################################################## if __name__ == "__main__": main()
[ "noreply@github.com" ]
noreply@github.com
3d2ea1c68fba28be456bac1b10cce2be67a89c15
f698ce603b9eab5427c26dfc5501ae4ec8e03214
/proj/common/serializers.py
6b4763bb9339570bf0595cd423e0bb96422da214
[]
no_license
chunkai-meng/Fleet
847f31c7b8b3321ab097428453d0c8f9e1b21f77
9e65fdab6fbae1a691db993d12bbcd2684f5b1e9
refs/heads/main
2023-03-05T00:22:51.761197
2020-11-24T20:53:55
2020-11-24T20:53:55
312,441,324
0
0
null
null
null
null
UTF-8
Python
false
false
1,011
py
from rest_framework import serializers class BaseSerializerMixin(serializers.Serializer): created_name = serializers.CharField(source='created_by.cn_name', read_only=True) updated_name = serializers.CharField(source='updated_by.cn_name', read_only=True) class DynamicFieldsModelSerializer(serializers.ModelSerializer): """ A ModelSerializer that takes an additional `fields` argument that controls which fields should be displayed. """ def __init__(self, *args, **kwargs): # Don't pass the 'fields' arg up to the superclass fields = kwargs.pop('fields', None) # Instantiate the superclass normally super(DynamicFieldsModelSerializer, self).__init__(*args, **kwargs) if fields is not None: # Drop any fields that are not specified in the `fields` argument. allowed = set(fields) existing = set(self.fields) for field_name in existing - allowed: self.fields.pop(field_name)
[ "willcute@gmail.com" ]
willcute@gmail.com
bff32a13096803e1b074e49cecebb181d4d6913f
785a06d576cd4f7486a8a4306481392d0b65f621
/0x06-python-classes/0-square.py
b295cba0972b97fb25477fe35a3935cfbf691fec
[]
no_license
LauraPeraltaV85/holbertonschool-higher_level_programming
7c3d0a99c2dbd4f2f6951999634dbc2ae9acf1c4
264fe99bf5fc128d2faf59057e9062c2408e6065
refs/heads/master
2021-07-21T07:49:24.049890
2020-08-19T00:07:20
2020-08-19T00:07:20
207,329,486
0
0
null
null
null
null
UTF-8
Python
false
false
87
py
#!/usr/bin/python3 class Square: """Empty class that defines a squares""" pass
[ "=" ]
=
d9d53fa77c4f2dfbb4ae777a99cd4e7040f3318e
7842b9dfa31c533e753763a63dd6643f66ca7d43
/courses/models.py
d09519e3df02b7839605a043e067bf5ef53d212c
[]
no_license
YOKxPIE/YOKxPIE.github.io
83dfc46167a74860824b04e6b8d752b8fd4dd77c
633af49a4f65a07d574fc7c40a836a15b4a2016d
refs/heads/main
2023-08-17T00:51:30.654217
2021-10-02T10:02:20
2021-10-02T10:02:20
403,917,913
0
0
null
null
null
null
UTF-8
Python
false
false
1,395
py
from django.db import models from django.contrib.auth.models import User # Create your models here. class Course(models.Model): c_code = models.CharField(max_length=5) c_name = models.CharField(max_length=150, null = True) semester = models.IntegerField() a_year = models.IntegerField() count_stu = models.IntegerField(default=0) max_stu = models.PositiveIntegerField(default=3) status = models.BooleanField(default=True) def __str__(self): return f"{self.c_code} {self.semester}/{self.a_year}" def is_seat_available(self): return self.count_stu < self.max_stu class Student(models.Model): user = models.OneToOneField(User, null=True, on_delete=models.CASCADE) First_name = models.CharField(max_length=100, null = True) Last_name = models.CharField(max_length=100, null = True) email = models.CharField(max_length=200, null = True) student_id = models.CharField(max_length=10, null = True) def __str__(self): return f"{self.student_id}: {self.First_name} {self.Last_name}" class Enroll(models.Model): student = models.ForeignKey(Student, null=True, on_delete=models.CASCADE) course = models.ForeignKey(Course, null=True, on_delete=models.CASCADE) date_created = models.DateTimeField(auto_now_add=True, null=True) def __str__(self): return f"{self.student} enroll {self.course}"
[ "6210530017@student.tu.ac.th" ]
6210530017@student.tu.ac.th
0bb96f30a42e50bc0408cf4a6f607b6796d6546d
edf91e2614f0bf0dbfea1c77d2f41add5a14fac1
/twitterino/twitterino/urls.py
5e36063f9d99be119b11bcd0d2d3164226497241
[]
no_license
Razhelq/Twitterino
c5c4a9de47566a21240f1de316c9cb980b9fe01d
88269625aa2306f58c197477f3d682db270ca469
refs/heads/master
2020-03-26T18:23:15.149839
2018-08-27T19:59:57
2018-08-27T19:59:57
145,210,513
0
0
null
null
null
null
UTF-8
Python
false
false
1,831
py
"""twitterino URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.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.conf.urls import url from django.contrib import admin from django.urls import path from t.views import BaseView, IndexView, AddTweetView, LoginView, LogoutView, UserTweetsView, TweetDetailsView from t.views import UserMessagesView, SendMessageView, MessageDetailsView, AddCommentView urlpatterns = [ path('admin/', admin.site.urls), url(r'^$', BaseView.as_view(), name='base'), url(r'^index/$', IndexView.as_view(), name='index'), url(r'^add_tweet/$', AddTweetView.as_view(), name='add-tweet'), url(r'^login/$', LoginView.as_view(), name='login'), url(r'^logout/$', LogoutView.as_view(), name='logout'), url(r'^user_tweets/(?P<id>(\d)+)/$', UserTweetsView.as_view(), name='user-tweets'), url(r'^tweet_details/(?P<id>(\d)+)/$', TweetDetailsView.as_view(), name='tweet-details'), url(r'^user_messages/(?P<id>(\d)+)/$', UserMessagesView.as_view(), name='user-messages'), url(r'^send_message/(?P<id>(\d)+)/$', SendMessageView.as_view(), name='send-message'), url(r'^message_details/(?P<id>(\d)+)/$', MessageDetailsView.as_view(), name='message-details'), url(r'^add_comment/(?P<id>(\d)+)/$', AddCommentView.as_view(), name='add-comment') ]
[ "mateuszszpakowski@wp.pl" ]
mateuszszpakowski@wp.pl
6d7ba8affc9415e0e28f008abc1c5f881a23b965
d779765b758d43ed9ae19ff1e83a894ec37e1e86
/Practice/07/Python/07.py
9994d752dc51040462adea2ef23610cf2c89dc8f
[]
no_license
gamebars/Programming
2e0cc641056ba020f609f3f9a28228faafd5bb1d
9def7f353461062a0b33b10f8aa454bb16df4939
refs/heads/main
2023-05-09T09:57:58.775725
2021-06-05T18:50:59
2021-06-05T18:50:59
310,386,577
0
1
null
null
null
null
UTF-8
Python
false
false
885
py
import math print("""Выберите удобный для вариант 1. Длины стороны треугольника. 2. Координаты треугольника.""") a = b = c = 0.0 choise = int(input()) if choise == 1: print("Введите длины сторон треугольника, каждое с отдельной строки.") a = float(input()) b = float(input()) c = float(input()) elif choise == 2: print("Введите три пары чисел через пробел") x1, y1 = map(float, input().split()) x2, y2 = map(float, input().split()) x3, y3 = map(float, input().split()) a = math.sqrt((x1 - x2)**2 + (y1 - y2)**2) b = math.sqrt((x2 - x3)**2 + (y2 - y3)**2) c = math.sqrt((x3 - x1)**2 + (y3 - y1)**2) p = (a + b + c) / 2 S = math.sqrt(p * (p - a) * (p - b) * (p - c)) print("S =", S)
[ "freerancho@gmail.com" ]
freerancho@gmail.com
5d0294f94f35d0bd05457deb413fd46c97de577b
8c7b19751e0b674103e5dfa3cae63582e04c474e
/msorter.py
19d935dc04089be48189c9ea8773df3e92e23ef3
[]
no_license
andreyiv/music_sorter
eab9e9a18b1b3cebc6c43f44a2f91ad48ef01290
e93ff7ec5684a007ec1995802672ff67a3b360c1
refs/heads/master
2020-06-06T11:02:35.559773
2014-03-11T01:12:27
2014-03-11T01:12:27
15,989,698
0
0
null
null
null
null
UTF-8
Python
false
false
2,918
py
""" Sort your music. Call this in a directory with your music to get it sorted. """ import os import sys import io import eyed3 import json import time import logging # create logger logger = logging.getLogger('log') logger.propagate = False # Stops the logging from being picked up by eyed3 logger.setLevel(logging.DEBUG) # create console handler and set level to debug ch = logging.FileHandler('log.log') ch.setLevel(logging.DEBUG) # create formatter formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') # add formatter to ch ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) logger.info('Started sorting music.') songs = [] path = sys.argv[1] if len(sys.argv) > 1 else '.' for dirname, dirnames, filenames in os.walk(path): for filename in filenames: song_full_path = os.path.join(dirname, filename) logger.debug('Current file: ' + song_full_path + '\n') try: af = eyed3.load(song_full_path) songs.append({u'title': unicode(af.tag.title).title(), u'album': unicode(af.tag.album).title(), u'artist': unicode(af.tag.artist).title(), u'track_num': af.tag.track_num, u'full_path': song_full_path}) except AttributeError: logger.info('Could not read ID3 data from file: ' + song_full_path) pass # Sort songs into albums albums = {} for song in songs: try: albums[song['album']]['songs'].append(song) except KeyError: albums[song['album']] = {u'songs': [song], u'artists': []} # Get artists for albums for album in albums: artists = {} for song in albums[album]['songs']: artists[song['artist']] = 0 albums[album]['artists'] = artists.keys() # Request the user to select an artist when an album has more than one artist for album in albums: if len(albums[album]['artists']) > 1: print('Album: ' + unicode(album) + ', has more than 1 artist, artists: ') count = 0 for artist in albums[album]['artists']: count += 1 print(unicode(count) + '. ' + artist) artist_index = raw_input('Please enter the number corresponding to the main artist: ') print('Artist chosen: ' + unicode(albums[album]['artists'][int(artist_index) - 1])) albums[album]['artists'] = [albums[album]['artists'][int(artist_index) - 1]] # Reorganize albums:songs into artists:albums:songs artists = {} for album in albums: try: artists[albums[album]['artists'][0]].append({album: albums[album]}) except KeyError: artists[albums[album]['artists'][0]] = [{album: albums[album]}] fp = io.open('albums_db.txt', 'wb') temp = json.dumps(albums, indent=4) fp.write(temp) fp.close() fp = io.open('artists_db.txt', 'wb') fp.write(json.dumps(artists, indent=4, encoding="utf-8")) fp.close()
[ "andrey.ivannikov@gmail.com" ]
andrey.ivannikov@gmail.com
a59061f71af376b2f08082145adac1d496c50c3b
9189391a982d0297c8c79670b207e0d3fe3e9a1d
/sys/Analysis_script/lustre_server/lustre_server_band.py
5ec111d68973dd23270db18a58c8b50b50b5f24e
[]
no_license
dxhhisboy/Beacon
62f5eedcd7349d383f3324f74bd7475170ce5a57
7941ebb7ae2e55b923795a850e74ee23c14aca3e
refs/heads/master
2021-03-26T07:43:24.544769
2019-12-18T02:56:14
2019-12-18T02:56:14
247,685,346
1
0
null
2020-03-16T11:30:22
2020-03-16T11:30:21
null
UTF-8
Python
false
false
8,806
py
from OST_each_all import search from OST_each_all import search_le from OST_each_all import search_gt import datetime import matplotlib.pyplot as plt import numpy as np import csv import sys from optparse import OptionParser host_online1 = null host_online2 = null parser = OptionParser() parser.add_option( "-d", "--draw", default=False, action="store_true", help="Draw the figures", dest="draw") parser.add_option( "-t", "--trace", default=False, action="store_true", help="save trace", dest="trace") parser.add_option( "-a", "--auto", default=False, action="store_true", help="run with automatic mode", dest="auto") #parser.add_option("-o", "--old", default = False, action = "store_true", help = "deal old format data", dest = "old") parser.add_option( "-n", "--need_help", default=False, action="store_true", help="show detail information", dest="need_help") (options, args) = parser.parse_args() height = 300 def query(bandr, bandw, host_t, index, daytime, time_std, time_s, time_e, hostlist): if options.auto == True: try: final_result = search_le(time_std, hostlist, index, host_t) except Exception as e: print e return 0 t1 = datetime.datetime.strptime(daytime, '%Y-%m-%d %H:%M:%S') result = [] print "Query1 done..." for i in xrange(len(final_result[0])): message = final_result[0][i] time = final_result[1][i] result.append(message + ' ' + time) try: final_result = search_gt(time_std, hostlist, index, host_t) except Exception as e: print e return 0 for i in xrange(len(final_result[0])): message = final_result[0][i] time = final_result[1][i] result.append(message + ' ' + time) print "Query2 done..." result.sort() print "Reshape and sort done..." else: try: final_result = search(time_s, time_e, hostlist, index, host_t) except Exception as e: print e return 0 t1 = datetime.datetime.strptime(daytime, '%Y-%m-%d %H:%M:%S') result = [] print "Test Query done..." for i in xrange(len(final_result[0])): message = final_result[0][i] time = final_result[1][i] result.append(message + ' ' + time) result.sort() lg = len(result) print result[0] s1 = result[0].replace(',', '') s2 = s1.replace('[', '') s3 = s2.replace(']', '') x = s3.split(' ') ost_p = x[0] print x print x[-1] time_p = str(x[-1])[:10] + " " + str(x[-1])[11:-5] t2 = datetime.datetime.strptime(time_p, '%Y-%m-%d %H:%M:%S') time_interval = str(t2 - t1).split(':') t_p = int(time_interval[0]) * 3600 + int(time_interval[1]) * 60 + int( time_interval[2]) read_p = 0 write_p = 0 for i in range(1, len(x) - 1, 3): read_p += int(x[i]) * int(x[i + 1]) write_p += int(x[i]) * int(x[i + 2]) print ost_p, " ", read_p, " ", write_p, " ", time_p print "Deal data..." for item in range(1, lg): try: s1 = result[item].replace(',', '') s2 = s1.replace('[', '') s3 = s2.replace(']', '') y = s3.split(' ') ost = y[0] time = str(y[-1])[:10] + " " + str(y[-1])[11:-5] t3 = datetime.datetime.strptime(time, '%Y-%m-%d %H:%M:%S') time_interval = str(t3 - t1).split(':') t = int(time_interval[0]) * 3600 + int( time_interval[1]) * 60 + int(time_interval[2]) read = 0 write = 0 for i in range(1, len(x) - 1, 3): read += int(y[i]) * int(y[i + 1]) write += int(y[i]) * int(y[i + 2]) if ost == ost_p: interval = t - t_p #print interval," ",t_p," ",band_number OST_number = int('0x' + ost, 16) read_value = int(read) - int(read_p) write_value = int(write) - int(write_p) if interval > 0 and interval < 1000: for j in range(interval): bandr[OST_number][ t_p + j] += read_value / 1024.0 * 4 / interval bandw[OST_number][ t_p + j] += write_value / 1024.0 * 4 / interval ost_p = ost read_p = read write_p = write t_p = t else: ost_p = ost read_p = read write_p = write t_p = t except Exception as e: print e continue if options.trace == True: print "start write CSV..." count = 0 oscid = [] if host_t == host_online1: csvfile = file("../Trace/lustre_client/gio/" + index + '.csv', 'wb') else: csvfile = file("../Trace/lustre_client/vbfs/" + index + '.csv', 'wb') writer = csv.writer(csvfile) for j in range(440): for i in range(100000): row_value = [] row_value.append(j) row_value.append(i) row_value.append(bandr[j][i]) row_value.append(bandw[j][i]) if bandr[j][i] > 0 or bandw[j][i] > 0: writer.writerow(row_value) csvfile.close() if options.draw == True: print "start plot..." ax = plt.gca() for i in range(440): if np.array(bandr[i]).sum() > 0 or np.array(bandw[i]).sum() > 0: ax.plot(np.array(bandr[i]) + height * count, 'r', label='Read') ax.plot( np.array(bandw[i]) + height * count, 'b', label='Write') oscid.append(str(hex(i))) count += 1 if count >= 20: ax.set_yticks(np.linspace(0, count * height, count + 1)) ax.set_yticklabels(oscid) plt.ylabel('OST ID') plt.xlabel('Time(s)') plt.show() ax = plt.gca() count = 0 oscid = [] if count > 0: ax.set_yticks(np.linspace(0, count * height, count + 1)) ax.set_yticklabels(oscid) plt.ylabel('OST ID') plt.xlabel('Time(s)') plt.show() if __name__ == "__main__": time_s = '2018-02-02 10:00:00' time_e = '2018-02-02 10:10:00' if options.need_help == True: print "you can use this script like this: python lustre_server_band.py 2018-01-01 09:00:00 2018-01-01 09:10:00 vbfs (vbfs can replace with gio)" print "Also, you can use some triggers" print "-d mean draw pic" print "-t save trace" print "-a run with automatic (use to get lots of data)" print "-n need help information" sys.exit() if len(sys.argv) < 6: print "please input start_time,end_time and gio/vbfs (2018-03-02 10:00:00 2018-03-27 14:01:39 gio)" sys.exit() else: print len(sys.argv) time_s = sys.argv[1] + " " + sys.argv[2] time_e = sys.argv[3] + " " + sys.argv[4] month_s = int(sys.argv[1].split('-')[1]) month_e = int(sys.argv[3].split('-')[1]) day_s = int(sys.argv[1].split('-')[2]) day_e = int(sys.argv[3].split('-')[2]) if sys.argv[5] == 'gio': host_t = host_online1 else: host_t = host_online2 for mon in range(month_s, month_e + 1): if mon < 10: m = "0" + str(mon) else: m = str(mon) for index_item in range(day_s, day_e + 1): hostlist = [] bandr = [([0] * 100000) for i in range(440)] bandw = [([0] * 100000) for i in range(440)] if index_item < 10: index = "2018." + m + ".0" + str(index_item) daytime = "2018-" + m + "-0" + str( index_item) + " " + "00:00:00" time_std = "2018-" + m + "-0" + str( index_item) + " " + "12:00:00" else: index = "2018." + m + "." + str(index_item) daytime = "2018-" + m + "-" + str( index_item) + " " + "00:00:00" time_std = "2018-" + m + "-" + str( index_item) + " " + "12:00:00" query(bandr, bandw, host_t, index, daytime, time_std, time_s, time_e, hostlist)
[ "binyang@BindeMacBook-Pro.local" ]
binyang@BindeMacBook-Pro.local
b4e432358186054be12e449387e496621aedd273
08b693556d4f2476667eccd26afcdda705c2530f
/venv/bin/odf2mht
b54238864f529a8bc8c4c904f066c4390925860b
[]
no_license
ravikantpal1408/django-admin
f2f282150b1741f503895dfba6aba7adb109c6fd
dc6dbb0d1c7e78dba88b578528787fbda121e531
refs/heads/master
2020-05-07T08:25:31.865263
2019-04-09T08:40:07
2019-04-09T08:40:07
180,322,997
0
0
null
null
null
null
UTF-8
Python
false
false
2,327
#!/Volumes/MyMacDrive128/Python/blog/venv/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2006 Søren Roug, European Environment Agency # # This is free software. You may redistribute it under the terms # of the Apache license and the GNU General Public License Version # 2 or at your option any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # Contributor(s): # from __future__ import print_function from odf.odf2xhtml import ODF2XHTML import zipfile import sys #from time import gmtime, strftime from email.mime.multipart import MIMEMultipart from email.mime.nonmultipart import MIMENonMultipart from email.mime.text import MIMEText from email import encoders if sys.version_info[0]==3: unicode=str if len(sys.argv) != 2: sys.stderr.write("Usage: %s inputfile\n" % sys.argv[0]) sys.exit(1) suffices = { 'wmf':('image','x-wmf'), 'png':('image','png'), 'gif':('image','gif'), 'jpg':('image','jpeg'), 'jpeg':('image','jpeg') } msg = MIMEMultipart('related',type="text/html") # msg['Subject'] = 'Subject here' # msg['From'] = '<Saved by ODT2MHT>' # msg['Date'] = strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()) msg.preamble = 'This is a multi-part message in MIME format.' msg.epilogue = '' odhandler = ODF2XHTML() result = odhandler.odf2xhtml(unicode(sys.argv[1])) htmlpart = MIMEText(result,'html','us-ascii') htmlpart['Content-Location'] = 'index.html' msg.attach(htmlpart) z = zipfile.ZipFile(sys.argv[1]) for file in z.namelist(): if file[0:9] == 'Pictures/': suffix = file[file.rfind(".")+1:] main,sub = suffices.get(suffix,('application','octet-stream')) img = MIMENonMultipart(main,sub) img.set_payload(z.read(file)) img['Content-Location'] = "" + file encoders.encode_base64(img) msg.attach(img) z.close() print (msg.as_string()) # Local Variables: *** # mode: python *** # End: ***
[ "ravikantpal@Ravis-MacBook-Air.local" ]
ravikantpal@Ravis-MacBook-Air.local
51943779ab94d18f5a638f48ab59775a6b0b305f
d5193c2e726a40a48b0f45db27bb04aec280398e
/shortner/models.py
551783922f0264121e8bc9d5fc1d3dcd8acc3517
[]
no_license
sahaib9747/DUShort-Django_URL_Shortener
2ad652a56efb421cd49222d5f5bcfbdcc673462c
32567439883f5c7407913f061c166b0d9934c502
refs/heads/master
2023-09-01T11:04:23.224791
2021-10-27T20:11:15
2021-10-27T20:11:15
null
0
0
null
null
null
null
UTF-8
Python
false
false
229
py
from django.db import models # Create your models here. class URLShortner(models.Model): link = models.TextField(max_length=100000) uuid = models.CharField(max_length=10) def __str__(self): return self.uuid
[ "pro.sahaib9747@gmail.com" ]
pro.sahaib9747@gmail.com
0aa9d2bdb669e4233d1f34d05673e4ec31234d57
7808d2f1bc4d890938278eab5846da4108d165b7
/Rec/website/website/settings.py
c2f947fcc4aa33ef8dd9ebbb0305ac2a9d684eae
[]
no_license
KarlRixon/MovieLens_RecSys
4fe8d6906fb14a18990a6d897e94ff287600d7b8
7605f7620d1fb884c037f775cb71d303fe0ed56a
refs/heads/master
2021-05-24T16:35:33.373101
2020-04-25T12:06:25
2020-04-25T12:06:25
253,657,746
0
0
null
null
null
null
UTF-8
Python
false
false
3,762
py
""" Django settings for website project. Generated by 'django-admin startproject' using Django 2.2. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/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/2.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '(8=y7e4u0q@f@+2&$%a(%geqsi()zedd8y%r8bb&&wxw42nvik' # 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', 'recsys.apps.RecsysConfig' ] 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 = 'website.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 = 'website.wsgi.application' # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Password validation # https://docs.djangoproject.com/en/2.2/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/2.2/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/2.2/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_DIRS = ( ('css', os.path.join(STATIC_ROOT, 'css').replace('\\', '/')), ('js', os.path.join(STATIC_ROOT, 'js').replace('\\', '/')), ('images', os.path.join(STATIC_ROOT, 'images').replace('\\', '/')), ('fonts', os.path.join(STATIC_ROOT, 'fonts').replace('\\', '/')), ('posters', os.path.join(STATIC_ROOT, 'posters').replace('\\', '/')), ('FGSM', os.path.join(STATIC_ROOT, 'FGSM').replace('\\', '/')), ) # user-based CF UID = 3
[ "2434685393@qq.com" ]
2434685393@qq.com
3cd7e9bdfdb3f39bde5b3be9f9d914040e221895
d2b3bfce1d6ae568d019245bd7a0d8edc9af0a15
/articles/views.py
b26b3626d278d33497df36d97a08e3af128c23a5
[]
no_license
nvelichkin/DjangoBlog
58ca5e2bd9fc3c397c11e290d89e8a1a570fbf58
b8624cb8b226ce011d81ffe3da7547bcd7d7efda
refs/heads/master
2021-07-21T14:48:21.145525
2017-10-28T13:28:25
2017-10-28T13:28:25
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,692
py
from .models import * from django.shortcuts import render, redirect from django.http import Http404, HttpResponse from django.contrib.auth.models import User from django.contrib.auth import authenticate, login # Create your views here. def archive(request): return render(request, "archive.html", {"posts": Article.objects.all()}) def get_article(request, article_id): try: post = Article.objects.get(id=article_id) return render(request, "article.html", {"post": post}) except Article.DoesNotExist: raise Http404 def create_post(request): if not request.user.is_anonymous(): if request.method == "POST": form = { 'text': request.POST["text"], 'title': request.POST["title"] } if form["text"] and form["title"]: if not Article.objects.filter(title=form["title"]).exists(): article = Article.objects.create(text=form["text"], title=form["title"], author=request.user) return redirect('get_article', article_id=article.id) else: form['errors'] = u"Статья с таким именем уже существует" return render(request, "create_post.html", {'form': form}) else: form['errors'] = u"Не все поля заполнены" return render(request, "create_post.html", {'form': form}) else: return render(request, 'create_post.html', {}) else: raise Http404 def reg(request): if request.method == "POST": form = { 'username': request.POST['username'], 'email': request.POST['email'], 'password': request.POST['password'], 'sec_password': request.POST['sec_password'] } if form["username"] and form["password"] and form["sec_password"]: if not User.objects.filter(username=form["username"]).exists(): if form["password"] == form["sec_password"]: User.objects.create_user(username=form["username"], email=form["email"], password=form["password"]) return redirect('archive') form['errors'] = u"Пароли не совпадают" return render(request, "reg.html", {'form': form}) else: form['errors'] = u"Пользователь с таким именем уже существует" return render(request, "reg.html", {'form': form}) else: form['errors'] = u"Не все поля заполнены" return render(request, "reg.html", {'form': form}) else: return render(request, 'reg.html', {}) def auth(request): if request.method == "POST": form = { 'username': request.POST['username'], 'password': request.POST['password'], } if form["username"] and form["password"]: user = authenticate(username=form["username"], password=form["password"]) if user is not None: login(request, user) return redirect('archive') else: form['errors'] = u"Нет аккаунта с такими сочетанием никнейма и пароля" return render(request, "auth.html", {'form': form}) else: return render(request, "auth.html", {})
[ "bashka389@gmail.com" ]
bashka389@gmail.com
df09cfd7a1ce1fc9c2986dd66f9c32ec791e7b64
d9ed74c886ff517b721d6bcf2fef8ec6ed991783
/manage.py
d6d2e183eb5c5d69ca185c4e14632682bd1f7218
[]
no_license
hexvolt/poll_server
d31fa2951ecb23df87d7ff4c5543c586f1064225
8401dcbf90b1f5b6b8d69d5973a955143199438d
refs/heads/master
2021-01-19T03:45:35.332792
2016-04-17T10:10:34
2016-04-17T10:10:34
62,493,567
1
0
null
null
null
null
UTF-8
Python
false
false
254
py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "poll_server.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
[ "hexvolt@gmail.com" ]
hexvolt@gmail.com
6462655651cadf4cca9cff9d20e10ad691ceea84
bedd5e4c8186d848fa10a572d000e5b1a36acaa9
/metrics/gD43_index.py
7285d493189a3d5f73c33bc85137be24fa48d3d5
[]
no_license
AntipovDen/EvoClusterization
2eb7df815a088e8b0f6ccf57ef57cc0e95c55120
61f01cedc8f2a7b55a8cd109389b8b236885af26
refs/heads/master
2020-05-01T00:42:12.951206
2019-05-08T17:17:55
2019-05-08T17:17:55
177,174,643
0
0
null
null
null
null
UTF-8
Python
false
false
4,305
py
import sys import numpy as np import metrics.cluster_centroid as cluster_centroid import metrics.utils as utils import math from metrics.measure import Measure class Index(Measure): def __init__(self, centroids=None, cluster_sizes=None, centers=None, sums=None, diameter=0, centroid_dists=None): if centroid_dists is None: centroid_dists = [] if sums is None: sums = [] if centers is None: centers = [] if cluster_sizes is None: cluster_sizes = [] if centroids is None: centroids = [] self.centroids = centroids self.cluster_sizes = cluster_sizes self.centers = centers self.sums = sums self.diameter = diameter self.centroid_dists = centroid_dists def find(self, X, labels, n_clusters): self.diameter = utils.find_diameter(X) self.centroids = cluster_centroid.cluster_centroid(X, labels, n_clusters) self.cluster_sizes = cluster_centroid.count_cluster_sizes(labels, n_clusters) rows, colums = X.shape self.sums = [0 for _ in range(n_clusters)] minimum_dif_c = sys.float_info.max # min dist in different clusters centres_l = [[sys.float_info.max] * n_clusters] * n_clusters self.centers = np.array(centres_l) self.centroid_dists = [0 for _ in range(len(labels))] # self.centroid_dists = [utils.euclidian_dist(X[i], self.centroids[labels[i]]) for i in range(len(X))] for i in range(len(labels)): self.centroid_dists[i] = utils.euclidian_dist(X[i], self.centroids[labels[i]]) self.sums[labels[i]] += self.centroid_dists[i] for i in range(n_clusters): for j in range(n_clusters): if i != j: self.centers[i][j] = utils.euclidian_dist(self.centroids[i], self.centroids[j]) for i in range(rows): for j in range(rows): if labels[i] != labels[j]: dist = self.centers[labels[i]][labels[j]] minimum_dif_c = min(dist, minimum_dif_c) denominator = list(self.sums) for i in range(n_clusters): denominator[i] *= (2 / self.cluster_sizes[i]) return -(minimum_dif_c / max(denominator)) def update(self, X, n_clusters, labels, k, l, id): point = X[id] # prev_cluster_sizes = list(self.cluster_sizes) prev_centroids = np.copy(self.centroids) self.cluster_sizes = cluster_centroid.count_cluster_sizes(np.copy(labels), n_clusters) self.centroids = cluster_centroid.update_centroids(np.copy(self.centroids), np.copy(self.cluster_sizes), point, k, l) # update denominator new_centroid_dists = list(self.centroid_dists) dell = 10 ** (-math.log(len(X), 10) - 1) for i in range(len(labels)): if (labels[i] == k and utils.euclidian_dist(prev_centroids[k], self.centroids[k]) > dell * self.diameter or labels[i] == l and utils.euclidian_dist(prev_centroids[l], self.centroids[l]) > dell * self.diameter): new_centroid_dists[i] = utils.euclidian_dist(X[i], self.centroids[labels[i]]) new_sums = [0 for _ in range(n_clusters)] for i in range(n_clusters): if i != k and i != l: new_sums[i] = self.sums[i] for i in range(len(labels)): if labels[i] == k or labels[i] == l: new_sums[labels[i]] += new_centroid_dists[i] denominator = list(new_sums) for i in range(n_clusters): if self.cluster_sizes[i] != 0: denominator[i] *= (2 / self.cluster_sizes[i]) # update numerator for i in range(n_clusters): if i != k: self.centers[i][k] = utils.euclidian_dist(self.centroids[i], self.centroids[k]) self.centers[k][i] = self.centers[i][k] if i != l: self.centers[i][l] = utils.euclidian_dist(self.centroids[i], self.centroids[l]) self.centers[l][i] = self.centers[i][l] minimum_dif_c = np.amin(self.centers) return -(minimum_dif_c / max(denominator))
[ "mursmail@gmail.com" ]
mursmail@gmail.com
431eeaf082bc0c52b6b0cf4689df74a54c8b61e3
b207f020927e1acb24641670af22bc9eef978e26
/DeepQNetwork-MCTS/2048_DQN_MCTS_initial.py
dc1c96d3a9be47589ccace528b7e4010b84bebf9
[]
no_license
QuincyCherubini/2048
49ee7daf07313526edc93a33e03f31d592c2d154
27f64bf8365428af6f881b88c0eb29bd12166191
refs/heads/master
2020-12-20T01:55:56.540776
2020-02-25T03:26:52
2020-02-25T03:26:52
235,923,049
0
0
null
null
null
null
UTF-8
Python
false
false
11,847
py
from board import board import numpy as np import math import time import random import pickle import cProfile from collections import deque import keras from keras.models import load_model, Sequential from keras.optimizers import Adam from keras.layers.core import Activation, Dropout, Flatten, Dense from keras import initializers from keras.layers.advanced_activations import LeakyReLU from MCTS import Node from MCTS import take_next_step from MCTS import expand_node class DQN: # my board is the environment def __init__(self, board, max_time, max_sims): self.memory = deque(maxlen=50000) self.board = board self.state_shape = [1, 160] self.gamma = 0.995 self.epsilon = 0.02 # 0.99 self.epsilon_min = 0.02 self.epsilon_decay = 0.99995 self.learning_rate = 0.001 self.tau = 0.125 self.max_time = max_time self.max_sims = max_sims self.model = self.create_model() self.target_model = self.create_model() def create_model(self): model = Sequential() model.add(Dense(160, input_dim=self.state_shape[1])) model.add(Dense(160)) model.add(Dense(4)) # Action space for 2048 model.compile(loss="mean_squared_error", optimizer=Adam(lr=self.learning_rate)) return model def remember(self, state, action, reward, new_state, done): self.memory.append([state, action, reward, new_state, done]) def replay(self): batch_size = 20 if len(self.memory) < 50: return samples = random.sample(self.memory, batch_size) for sample in samples: state, action, reward, new_state, done = sample target = self.target_model.predict(state) if done: target[0][action] = reward else: Q_future = max(self.target_model.predict(new_state)[0]) target[0][action] = reward + Q_future * self.gamma self.model.fit(state, target, epochs=1, verbose=0) def target_train(self): weights = self.model.get_weights() target_weights = self.target_model.get_weights() for i in range(len(target_weights)): target_weights[i] = weights[i] * self.tau + target_weights[i] * (1 - self.tau) self.target_model.set_weights(target_weights) def act(self, state): self.epsilon *= self.epsilon_decay self.epsilon = max(self.epsilon_min, self.epsilon) # return a simulated or random move if np.random.random() < self.epsilon: # run a MCTS move if at min epsilon if self.epsilon == self.epsilon_min: # create a new node based on the board test_node = Node(self.board, 1, 9, None) # expand the tree while I have time time_start = time.time() expand_node(test_node, time_start, self.max_time, self.max_sims) action = test_node.get_best_move() # otherwise return a random move else: action = random.getrandbits(2) while not self.board.is_valid_move(action): action = (action + 1) % 4 else: output_array = self.model.predict(state)[0] action = np.argmax(output_array) # if the action is invalid choose the next best while not self.board.is_valid_move(action): output_array[action] = -999999999999999 action = np.argmax(output_array) return action def save_model(self, fn, target_n): self.model.save(fn) self.target_model.save(target_n) def run(episodes, max_time, max_sims): my_board = board() dqn_agent = DQN(my_board, max_time, max_sims) test_state = create_state(my_board) test_state = test_state.reshape(1, dqn_agent.state_shape[1]) max_score = 0 total_score = 0 for episode in range(episodes): my_board.reset() cur_state = create_state(my_board) cur_state = cur_state.reshape(1, dqn_agent.state_shape[1]) print("test prediction: {}".format(dqn_agent.model.predict(test_state)[0])) while not my_board.game_is_over(): # get the next action action = dqn_agent.act(cur_state) # perform the action cur_score = my_board.score my_board.move_tiles(action) my_board.add_new_tile() reward = my_board.score - cur_score new_state = create_state(my_board) new_state = new_state.reshape(1, dqn_agent.state_shape[1]) done = my_board.game_is_over() # log this action dqn_agent.remember(cur_state, action, reward, new_state, done) cur_state = new_state # update the model dqn_agent.replay() dqn_agent.target_train() total_score += my_board.score if my_board.score > max_score: max_score = my_board.score print("episode: {} score: {} max_score: {} avg_score: {} epsilon: {}".format(episode, my_board.score, max_score, int(total_score/(episode + 1)), dqn_agent.epsilon)) if episode % 100 == 2: # print("output layer bias: {}".format(dqn_agent.model.layers[3].get_weights()[1])) # show_game(dqn_agent) dqn_agent.save_model("obj/12/trial-{}--{}.model".format(episode, str(int(total_score/(episode + 1)))), "obj/12/trial-{}-target.model".format(episode)) def create_state(board): output = [] # give the log base 2 of the board for x in range(0, 4): for y in range(0, 4): # track the value of the tile if board.tiles[x][y] == 0: output.append(0) else: output.append(math.log(board.tiles[x][y], 2)) # track if the tile is empty if board.tiles[x][y] == 0: output.append(1) else: output.append(0) # Can merge left test # if the tile is on the left edge or is empty can't merge if x == 0 or board.tiles[x][y] == 0: output.append(0) else: temp_x = x - 1 while temp_x >= 0: # if the left tile matches the value then append 1 if board.tiles[x][y] == board.tiles[temp_x][y]: output.append(1) break # if we get to the edge without finding a match append 0 elif temp_x == 0: output.append(0) break temp_x -= 1 # Can merge right test # if the tile is on the left edge or is empty can't merge if x == 3 or board.tiles[x][y] == 0: output.append(0) else: temp_x = x + 1 while temp_x <= 3: # if the left tile matches the value then append 1 if board.tiles[x][y] == board.tiles[temp_x][y]: output.append(1) break # if we get to the edge without finding a match append 0 elif temp_x == 3: output.append(0) break temp_x += 1 # Can merge up test # if the tile is on the left edge or is empty can't merge if y == 0 or board.tiles[x][y] == 0: output.append(0) else: temp_y = y - 1 while temp_y >= 0: # if the left tile matches the value then append 1 if board.tiles[x][y] == board.tiles[x][temp_y]: output.append(1) break # if we get to the edge without finding a match append 0 elif temp_y == 0: output.append(0) break temp_y -= 1 # Can merge down test # if the tile is on the left edge or is empty can't merge if y == 3 or board.tiles[x][y] == 0: output.append(0) else: temp_y = y + 1 while temp_y <= 3: # if the left tile matches the value then append 1 if board.tiles[x][y] == board.tiles[x][temp_y]: output.append(1) break # if we get to the edge without finding a match append 0 elif temp_y == 3: output.append(0) break temp_y += 1 # if the tile to the left is 2x (directly left only) if x == 0 or board.tiles[x][y] == 0: output.append(0) elif board.tiles[x - 1][y] == 2 * board.tiles[x][y]: output.append(1) else: output.append(0) # if the tile to the right is 2x (directly only) if x == 3 or board.tiles[x][y] == 0: output.append(0) elif board.tiles[x + 1][y] == 2 * board.tiles[x][y]: output.append(1) else: output.append(0) # if the tile above is 2x (directly only) if y == 0 or board.tiles[x][y] == 0: output.append(0) elif board.tiles[x][y - 1] == 2 * board.tiles[x][y]: output.append(1) else: output.append(0) # if the tile below is 2x (directly only) if y == 3 or board.tiles[x][y] == 0: output.append(0) elif board.tiles[x][y + 1] == 2 * board.tiles[x][y]: output.append(1) else: output.append(0) # todo: add is next to 2x square (left/up/right/down) output = np.array(output) return output def show_game(dqn_agent): new_board = board() new_board.display() state = create_state(new_board) state = state.reshape(1, dqn_agent.state_shape[1]) turns = 0 while not new_board.game_is_over(): # get the next action output_array = dqn_agent.model.predict(state)[0] action = np.argmax(output_array) # if the action is invalid choose the next best while not new_board.is_valid_move(action): output_array[action] = -999999999999999 action = np.argmax(output_array) if action == 0: move = "left" elif action == 1: move = "down" elif action == 2: move = "right" elif action == 3: move = "up" print(" turn: {} action: {} move: {} arrary: {} state: {}".format(turns, action, move, output_array, state)) new_board.move_tiles(action) new_board.add_new_tile() new_board.display() state = create_state(new_board) state = state.reshape(1, dqn_agent.state_shape[1]) turns += 1 if __name__ == "__main__": # pr = cProfile.Profile() # pr.enable() episodes = 99999 max_time = 0.5 # in seconds max_sims = 2000 run(episodes, max_time, max_sims) # pr.disable() # pr.print_stats()
[ "Quincy@Cherubini.ca" ]
Quincy@Cherubini.ca
6e23c5de1d7411fa2a34e57a9a50d0e75aa00440
abc422f58ad053bcbb6653ba15b66e46d220a199
/serial_scripts/rsyslog/mylogging.py
d5ca62ae2331a8ee83e6c2ec8c2eda766a56adab
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
tungstenfabric/tf-test
d3efff59bca931b614d0008260b2c0881d1fc009
4b9eca7eb182e5530223131ecab09d3bdf366407
refs/heads/master
2023-02-26T19:14:34.345423
2023-01-11T08:45:18
2023-01-11T10:37:25
265,231,958
8
22
null
2023-02-08T00:53:29
2020-05-19T11:46:12
Python
UTF-8
Python
false
false
3,406
py
#!/usr/bin/python2.7 from __future__ import print_function from builtins import str from builtins import range import syslog import random import time import sys def send_10_log_messages_with_delay(): syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_MAIL) for ind in range(10): msg = str(ind + 1) + '. Test Syslog Messages being sent.' syslog.syslog(syslog.LOG_EMERG, msg) time.sleep(1) syslog.closelog() # end send_10_log_messages_with_delay def send_10_log_messages(): syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_MAIL) for ind in range(10): msg = str(ind + 1) + '. Test Syslog Messages being sent without delay.' syslog.syslog(syslog.LOG_EMERG, msg) syslog.closelog() # end send_10_log_messages def send_messages_grater_than_1024_bytes(): syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_MAIL) with open("message.txt", "r") as myfile: msg = myfile.readlines()[0] myfile.close() for ind in range(100): syslog.syslog( syslog.LOG_EMERG, (msg[:5] + str(ind) + 'mymark' + msg[6:])) time.sleep(1) syslog.closelog() # end send_messages_grater_than_1024_bytes def send_messages_of_all_facility_and_severity(): dict_of_facility = { 'LOG_KERN': 0, 'LOG_USER': 1, 'LOG_MAIL': 2, 'LOG_DAEMON': 3, 'LOG_AUTH': 4, 'LOG_NEWS': 7, 'LOG_UUCP': 8, 'LOG_LOCAL0': 16, 'LOG_CRON': 15, 'LOG_SYSLOG': 5, 'LOG_LOCAL1': 17} list_of_severity = ['LOG_EMERG', 'LOG_ALERT', 'LOG_CRIT', 'LOG_ERR', 'LOG_WARNING', 'LOG_NOTICE', 'LOG_INFO', 'LOG_DEBUG'] for each_facility in dict_of_facility: log_facility = dict_of_facility[each_facility] syslog.openlog(logoption=syslog.LOG_PID, facility=log_facility) for each_severity in list_of_severity: log_severity = list_of_severity.index(each_severity) msg = 'Test Message from ' + each_facility + \ ' with severity ' + each_severity + '.' syslog.syslog(log_severity, msg) syslog.closelog() time.sleep(1) # end send_messages_of_all_facility_and_severity def send_test_log_message(): syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_KERN) for ind in range(5): msg = str(ind + 1) + '. Test Syslog Messages from different nodes.' syslog.syslog(syslog.LOG_EMERG, msg) time.sleep(1) syslog.closelog() # end send_test_log_message help_string = '\nusage:\n\n./mylogging.py <function-name>\n\nwhere function names are:\ \n1. send_10_log_messages\n2. send_10_log_messages_with_delay\ \n3. send_messages_grater_than_1024_bytes\n4. send_messages_of_all_facility_and_severity\ \n5. send_test_log_message\n\n' FuncCallDict = { 'send_10_log_messages': send_10_log_messages, 'send_test_log_message': send_test_log_message, 'send_10_log_messages_with_delay': send_10_log_messages_with_delay, 'send_messages_grater_than_1024_bytes': send_messages_grater_than_1024_bytes, 'send_messages_of_all_facility_and_severity': send_messages_of_all_facility_and_severity} NumberOfArgs = len(sys.argv) if NumberOfArgs != 2: print(help_string) sys.exit(2) FunctionName = sys.argv[1] FuncCallDict[FunctionName]()
[ "andrey-mp@yandex.ru" ]
andrey-mp@yandex.ru
81b87030e4f49031523e25eeadd2033600229db8
ec00584ab288267a7cf46c5cd4f76bbec1c70a6b
/Django/webapp/webapp/urls.py
b992ee479948a6c3cd42bf76a7571f15eb468e76
[]
no_license
rahuldbhadange/Python
b4cc806ff23953389c9507f43d817b3815260e19
7e162117f1acc12537c7eeb36d6983d804122ff3
refs/heads/master
2021-06-23T05:04:20.053777
2020-01-28T10:34:28
2020-01-28T10:34:28
217,307,612
0
0
null
2021-06-10T22:44:11
2019-10-24T13:35:42
Python
UTF-8
Python
false
false
1,494
py
"""webapp URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/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 URL conf 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 django.conf.urls import include, url # from login.views import urlpatterns = [ # path('', include('login.urls')), # path('admin/', admin.site.urls), # url(r'^login/', include('login.urls')), # url(r'^API1/', include('API1.urls')), # path('', PersonListView.as_view(), name='person_list'), # path('add/', PersonCreateView.as_view(), name='person_add'), # path('<int:pk>/edit/', PersonUpdateView.as_view(), name='person_edit'), ] ''' from django.urls import path from login.views import PersonListView, PersonCreateView, PersonUpdateView urlpatterns = [ path('', PersonListView.as_view(), name='person_list'), path('add/', PersonCreateView.as_view(), name='person_add'), path('<int:pk>/edit/', PersonUpdateView.as_view(), name='person_edit'), ]'''
[ "46024570+rahuldbhadange@users.noreply.github.com" ]
46024570+rahuldbhadange@users.noreply.github.com
6f599a1d19033673865ff49df26e57b170a4a4c0
1b20455d8e80e70ad101644adf72123572558bc1
/app.py
38dbd465d0fe9e09d875e7b8cc7e2336cc59162d
[]
no_license
techcoderunner/s3-lambda-event-sample
bfa7bb6ef6de8c66fea4f67a232757b7b53a1d23
d832293cf6e05f18db61c1b834514e6ec89e1add
refs/heads/master
2022-05-25T12:12:36.286752
2020-04-27T16:13:04
2020-04-27T16:13:04
null
0
0
null
null
null
null
UTF-8
Python
false
false
256
py
#!/usr/bin/env python3 from aws_cdk import core from s3_lambda_event_sample.s3_lambda_event_sample_stack import S3LambdaEventSampleStack app = core.App() S3LambdaEventSampleStack(app, "s3-lambda-event-sample",env={'region': 'ap-south-1'}) app.synth()
[ "Rashmi.Jamadade@teradata.com" ]
Rashmi.Jamadade@teradata.com
02fe2f8f0c81c0e2c94b762ff4dbe94e7b537f33
625a978da66de7ee9054a360492455f2abd438c5
/backend.py
5588c7389e7d02bffa1129bf13922d1bf35f72d9
[]
no_license
DeVoe-byte/Bookstore-GUI
7d4de7c22977f6c968a75c3ae8d10ac0dc76afee
08f723585f957bba8cc534e74c939b7100c87a9c
refs/heads/main
2023-06-04T11:33:34.435794
2021-06-28T13:23:09
2021-06-28T13:23:09
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,415
py
import sqlite3 class Database: def __init__(self,db): self.conn=sqlite3.connect(db) self.cur=self.conn.cursor() self.cur.execute("CREATE TABLE IF NOT EXISTS bookstore(id INTEGER PRIMARY KEY , title text , author text, year integer , isbn integer)") self.conn.commit() def insert(self,title,author,year,isbn): self.cur.execute("INSERT INTO bookstore VALUES (NULL,?,?,?,?)",(title,author,year,isbn)) self.conn.commit() def view(self): self.cur.execute("SELECT * FROM bookstore") rows=self.cur.fetchall() return rows def search(self,title="",author="",year="",isbn=""): self.cur.execute("SELECT * FROM bookstore WHERE title=? OR author=? OR year=? OR isbn=?",(title,author,year,isbn)) rows=self.cur.fetchall() return rows def delete(self,id): self.cur.execute("DELETE FROM bookstore WHERE id=?",(id,)) self.conn.commit() def update(self,id,title,author,year,isbn): self.cur.execute("UPDATE bookstore SET title=?,author=?,year=?,isbn=? WHERE id=?",(title,author,year,isbn,id)) self.conn.commit() #connect() #insert("Bbl of John Die","John die",1943,342972309815267) #print(search(author="John doe")) #delete(1) #update(2,"The moon","John smooth",1988,347928374928734) #print(view())
[ "noreply@github.com" ]
noreply@github.com
de869b069c66146da83205a95ae39c151a1dab0d
4c89d3ea51082d8beb05f7d4b89295d31e1dd241
/wagtail/wagtailredirects/views.py
c88de70283be4924ba6e651fd0431273cb9b8a44
[ "BSD-3-Clause" ]
permissive
simaojf-dellent/wagtail-1.3.1
69fb08addf9c1369122f1a734429aebfc77430f7
f84134f19774ddea2cc4de408582d4cbf0ebcf7a
refs/heads/master
2021-01-12T06:33:05.253443
2016-12-26T16:07:45
2016-12-26T16:07:45
77,381,143
0
0
null
null
null
null
UTF-8
Python
false
false
3,982
py
from django.shortcuts import render, redirect, get_object_or_404 from django.utils.translation import ugettext as _ from django.views.decorators.vary import vary_on_headers from django.core.urlresolvers import reverse from wagtail.utils.pagination import paginate from wagtail.wagtailadmin.forms import SearchForm from wagtail.wagtailadmin.utils import permission_required, any_permission_required from wagtail.wagtailadmin import messages from wagtail.wagtailredirects import models from wagtail.wagtailredirects.forms import RedirectForm @any_permission_required( 'wagtailredirects.add_redirect', 'wagtailredirects.change_redirect', 'wagtailredirects.delete_redirect' ) @vary_on_headers('X-Requested-With') def index(request): query_string = request.GET.get('q', "") ordering = request.GET.get('ordering', 'old_path') redirects = models.Redirect.objects.prefetch_related('redirect_page', 'site') # Search if query_string: redirects = redirects.filter(old_path__icontains=query_string) # Ordering (A bit useless at the moment as only 'old_path' is allowed) if ordering not in ['old_path']: ordering = 'old_path' if ordering != 'old_path': redirects = redirects.order_by(ordering) # Pagination paginator, redirects = paginate(request, redirects) # Render template if request.is_ajax(): return render(request, "wagtailredirects/results.html", { 'ordering': ordering, 'redirects': redirects, 'query_string': query_string, }) else: return render(request, "wagtailredirects/index.html", { 'ordering': ordering, 'redirects': redirects, 'query_string': query_string, 'search_form': SearchForm( data=dict(q=query_string) if query_string else None, placeholder=_("Search redirects") ), }) @permission_required('wagtailredirects.change_redirect') def edit(request, redirect_id): theredirect = get_object_or_404(models.Redirect, id=redirect_id) if request.POST: form = RedirectForm(request.POST, request.FILES, instance=theredirect) if form.is_valid(): form.save() messages.success(request, _("Redirect '{0}' updated.").format(theredirect.title), buttons=[ messages.button(reverse('wagtailredirects:edit', args=(theredirect.id,)), _('Edit')) ]) return redirect('wagtailredirects:index') else: messages.error(request, _("The redirect could not be saved due to errors.")) else: form = RedirectForm(instance=theredirect) return render(request, "wagtailredirects/edit.html", { 'redirect': theredirect, 'form': form, }) @permission_required('wagtailredirects.delete_redirect') def delete(request, redirect_id): theredirect = get_object_or_404(models.Redirect, id=redirect_id) if request.POST: theredirect.delete() messages.success(request, _("Redirect '{0}' deleted.").format(theredirect.title)) return redirect('wagtailredirects:index') return render(request, "wagtailredirects/confirm_delete.html", { 'redirect': theredirect, }) @permission_required('wagtailredirects.add_redirect') def add(request): if request.POST: form = RedirectForm(request.POST, request.FILES) if form.is_valid(): theredirect = form.save() messages.success(request, _("Redirect '{0}' added.").format(theredirect.title), buttons=[ messages.button(reverse('wagtailredirects:edit', args=(theredirect.id,)), _('Edit')) ]) return redirect('wagtailredirects:index') else: messages.error(request, _("The redirect could not be created due to errors.")) else: form = RedirectForm() return render(request, "wagtailredirects/add.html", { 'form': form, })
[ "patricio-fernandes@dellentconsulting.pt" ]
patricio-fernandes@dellentconsulting.pt
5d17abe09dfdef19d8a4a829102bfef36a25bc8f
345d3257600d96454131398879d0b1f3cdde78f6
/ros_arduino_bridge/ros_arduino_python/src/ros_arduino_python/arduino_driver.py
3fc307009fde91a05b88d6112a1bcc795ca0dd39
[]
no_license
dtbinh/weeding-robot
ced30324f5a9ceb4fae5d69a6439ef1c6bc2ec10
8759ebed740657c47de8295ca54e6418c6ef368d
refs/heads/master
2023-02-26T17:01:42.433657
2021-02-04T21:52:00
2021-02-04T21:52:00
null
0
0
null
null
null
null
UTF-8
Python
false
false
12,327
py
#!/usr/bin/env python """ A Python driver for the Arduino microcontroller running the ROSArduinoBridge firmware. Created for the Pi Robot Project: http://www.pirobot.org Copyright (c) 2012 Patrick Goebel. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details at: http://www.gnu.org/licenses/gpl.html """ import thread from math import pi as PI, degrees, radians import os import time import sys, traceback from serial.serialutil import SerialException from serial import Serial SERVO_MAX = 180 SERVO_MIN = 0 class Arduino: ''' Configuration Parameters ''' N_ANALOG_PORTS = 6 N_DIGITAL_PORTS = 12 def __init__(self, port="/dev/ttyUSB0", baudrate=57600, timeout=0.5, motors_reversed=False): self.PID_RATE = 30 # Do not change this! It is a fixed property of the Arduino PID controller. self.PID_INTERVAL = 1000 / 30 self.port = port self.baudrate = baudrate self.timeout = timeout self.encoder_count = 0 self.writeTimeout = timeout self.interCharTimeout = timeout / 30. self.motors_reversed = motors_reversed # Keep things thread safe self.mutex = thread.allocate_lock() # An array to cache analog sensor readings self.analog_sensor_cache = [None] * self.N_ANALOG_PORTS # An array to cache digital sensor readings self.digital_sensor_cache = [None] * self.N_DIGITAL_PORTS def connect(self): try: print "Connecting to Arduino on port", self.port, "..." self.port = Serial(port=self.port, baudrate=self.baudrate, timeout=self.timeout, writeTimeout=self.writeTimeout) # The next line is necessary to give the firmware time to wake up. time.sleep(1) test = self.get_baud() if test != self.baudrate: time.sleep(1) test = self.get_baud() if test != self.baudrate: raise SerialException print "Connected at", self.baudrate print "Arduino is ready." except SerialException: print "Serial Exception:" print sys.exc_info() print "Traceback follows:" traceback.print_exc(file=sys.stdout) print "Cannot connect to Arduino!" os._exit(1) def open(self): ''' Open the serial port. ''' self.port.open() def close(self): ''' Close the serial port. ''' self.port.close() def send(self, cmd): ''' This command should not be used on its own: it is called by the execute commands below in a thread safe manner. ''' self.port.write(cmd + '\r') def recv(self, timeout=0.5): timeout = min(timeout, self.timeout) ''' This command should not be used on its own: it is called by the execute commands below in a thread safe manner. Note: we use read() instead of readline() since readline() tends to return garbage characters from the Arduino ''' c = '' value = '' attempts = 0 while c != '\r': c = self.port.read(1) value += c attempts += 1 if attempts * self.interCharTimeout > timeout: return None value = value.strip('\r') return value def recv_ack(self): ''' This command should not be used on its own: it is called by the execute commands below in a thread safe manner. ''' ack = self.recv(self.timeout) return ack == 'OK' def recv_int(self): ''' This command should not be used on its own: it is called by the execute commands below in a thread safe manner. ''' value = self.recv(self.timeout) try: return int(value) except: return None def recv_array(self): ''' This command should not be used on its own: it is called by the execute commands below in a thread safe manner. ''' try: values = self.recv(self.timeout * self.N_ANALOG_PORTS).split() return map(int, values) except: return [] def execute(self, cmd): ''' Thread safe execution of "cmd" on the Arduino returning a single integer value. ''' self.mutex.acquire() try: self.port.flushInput() except: pass ntries = 1 attempts = 0 try: self.port.write(cmd + '\r') value = self.recv(self.timeout) while attempts < ntries and (value == '' or value == 'Invalid Command' or value == None): try: self.port.flushInput() self.port.write(cmd + '\r') value = self.recv(self.timeout) except: print "Exception executing command: " + cmd attempts += 1 except: self.mutex.release() print "Exception executing command: " + cmd value = None self.mutex.release() return int(value) def execute_array(self, cmd): ''' Thread safe execution of "cmd" on the Arduino returning an array. ''' self.mutex.acquire() try: self.port.flushInput() except: pass ntries = 1 attempts = 0 try: self.port.write(cmd + '\r') values = self.recv_array() while attempts < ntries and (values == '' or values == 'Invalid Command' or values == [] or values == None): try: self.port.flushInput() self.port.write(cmd + '\r') values = self.recv_array() except: print("Exception executing command: " + cmd) attempts += 1 except: self.mutex.release() print "Exception executing command: " + cmd raise SerialException return [] try: values = map(int, values) except: values = [] self.mutex.release() return values def execute_ack(self, cmd): ''' Thread safe execution of "cmd" on the Arduino returning True if response is ACK. ''' self.mutex.acquire() try: self.port.flushInput() except: pass ntries = 1 attempts = 0 try: self.port.write(cmd + '\r') ack = self.recv(self.timeout) while attempts < ntries and (ack == '' or ack == 'Invalid Command' or ack == None): try: self.port.flushInput() self.port.write(cmd + '\r') ack = self.recv(self.timeout) except: print "Exception executing command: " + cmd attempts += 1 except: self.mutex.release() print "execute_ack exception when executing", cmd print sys.exc_info() return 0 self.mutex.release() return ack == 'OK' def update_pid(self, Kp, Kd, Ki, Ko): ''' Set the PID parameters on the Arduino ''' print "Updating PID parameters" cmd = 'u ' + str(Kp) + ':' + str(Kd) + ':' + str(Ki) + ':' + str(Ko) self.execute_ack(cmd) def get_baud(self): ''' Get the current baud rate on the serial port. ''' try: return int(self.execute('b')); except: return None def get_encoder_counts(self): values = self.execute_array('e') if len(values) != 2: print "Encoder count was not 2" raise SerialException return None else: if self.motors_reversed: values[0], values[1] = -values[0], -values[1] return values def reset_encoders(self): ''' Reset the encoder counts to 0 ''' return self.execute_ack('r') def drive(self, right, left): ''' Speeds are given in encoder ticks per PID interval ''' if self.motors_reversed: left, right = -left, -right return self.execute_ack('m %1.2f %1.2f' %(right, left)) def drive_m_per_s(self, right, left): ''' Set the motor speeds in meters per second. ''' left_revs_per_second = float(left) / (self.wheel_diameter * PI) right_revs_per_second = float(right) / (self.wheel_diameter * PI) left_ticks_per_loop = int(left_revs_per_second * self.encoder_resolution * self.PID_INTERVAL * self.gear_reduction) right_ticks_per_loop = int(right_revs_per_second * self.encoder_resolution * self.PID_INTERVAL * self.gear_reduction) self.drive(right_ticks_per_loop , left_ticks_per_loop ) def stop(self): ''' Stop both motors. ''' self.drive(0, 0) def analog_read(self, pin): return self.execute('a %d' %pin) def analog_write(self, pin, value): return self.execute_ack('x %d %d' %(pin, value)) def digital_read(self, pin): return self.execute('d %d' %pin) def digital_write(self, pin, value): return self.execute_ack('w %d %d' %(pin, value)) def pin_mode(self, pin, mode): return self.execute_ack('c %d %d' %(pin, mode)) def servo_write(self, id, pos): ''' Usage: servo_write(id, pos) Position is given in radians and converted to degrees before sending ''' return self.execute_ack('s %d %d' %(id, min(SERVO_MAX, max(SERVO_MIN, degrees(pos))))) def servo_read(self, id): ''' Usage: servo_read(id) The returned position is converted from degrees to radians ''' return radians(self.execute('t %d' %id)) def ping(self, pin): ''' The srf05/Ping command queries an SRF05/Ping sonar sensor connected to the General Purpose I/O line pinId for a distance, and returns the range in cm. Sonar distance resolution is integer based. ''' return self.execute('p %d' %pin); # def get_maxez1(self, triggerPin, outputPin): # ''' The maxez1 command queries a Maxbotix MaxSonar-EZ1 sonar # sensor connected to the General Purpose I/O lines, triggerPin, and # outputPin, for a distance, and returns it in Centimeters. NOTE: MAKE # SURE there's nothing directly in front of the MaxSonar-EZ1 upon # power up, otherwise it wont range correctly for object less than 6 # inches away! The sensor reading defaults to use English units # (inches). The sensor distance resolution is integer based. Also, the # maxsonar trigger pin is RX, and the echo pin is PW. # ''' # return self.execute('z %d %d' %(triggerPin, outputPin)) """ Basic test for connectivity """ if __name__ == "__main__": if os.name == "posix": portName = "/dev/ttyACM0" else: portName = "COM43" # Windows style COM port. baudRate = 57600 myArduino = Arduino(port=portName, baudrate=baudRate, timeout=0.5) myArduino.connect() print "Sleeping for 1 second..." time.sleep(1) print "Reading on analog port 0", myArduino.analog_read(0) print "Reading on digital port 0", myArduino.digital_read(0) print "Blinking the LED 3 times" for i in range(3): myArduino.digital_write(13, 1) time.sleep(1.0) #print "Current encoder counts", myArduino.encoders() print "Connection test successful.", myArduino.stop() myArduino.close() print "Shutting down Arduino."
[ "jhw83@uclive.ac.nz" ]
jhw83@uclive.ac.nz
f2836bb9ea59828b0765647f8692b4473ddbe64b
d1134f71f464e38bc75d34c7972b6fb55c361366
/PYTHON/allContacts.py
74ec013fa82b74404e5d72a64ca2e61306602806
[]
no_license
deolekarmayuresh/Zoho-Desk-API
3bf2f899cc5a21900f079364d0cfa4fb53d44f02
77147d206c5b22c59ac06306d5ceff78b89a0adb
refs/heads/master
2020-12-21T21:23:26.287504
2020-02-25T14:45:03
2020-02-25T14:45:03
236,566,355
1
0
null
null
null
null
UTF-8
Python
false
false
572
py
import requests auth_token="59550a0e2b1a864a31bef962363e029f" #YOUR_AUTH_TOKEN org_id="652853630" #YOUR_ORGANISATION_ID params="sortBy=firstName&limit=15" headers={ "Authorization":auth_token, "orgId":org_id, "contentType": "application/json; charset=utf-8" } request=requests.get('https://desk.zoho.com/api/v1/contacts?'+params, headers=headers) if request.status_code == 200: print "Request Successful,Response:" print request.content else: print "Request not successful,Response code ",request.status_code," \nResponse : ",request.content;
[ "mayureshdeolekar.md@gmail.com" ]
mayureshdeolekar.md@gmail.com
3d74cfe83f47c3ca2637e2f6ece134fe923e052c
126456d21ae5b8c58eec084fdb595353a4dbc35b
/openslides_backend/permissions/permission_helper.py
5b72c70528aef0172de11bc2a7eee6c4eddd86af
[ "MIT" ]
permissive
FinnStutzenstein/openslides-backend
7f50667e5001733c9c955e2775b135c32a4466c5
fffc152f79d3446591e07a6913d9fdf30b46f577
refs/heads/master
2023-07-08T01:19:20.710441
2021-04-08T10:51:10
2021-04-08T10:51:10
271,211,208
0
0
MIT
2020-06-10T07:39:20
2020-06-10T07:39:19
null
UTF-8
Python
false
false
2,921
py
from typing import List from ..services.datastore.commands import GetManyRequest from ..services.datastore.interface import DatastoreService from ..shared.exceptions import PermissionDenied from ..shared.patterns import Collection, FullQualifiedId from .permissions import OrganisationManagementLevel, Permission, permission_parents def has_perm( datastore: DatastoreService, user_id: int, permission: Permission, meeting_id: int ) -> bool: # anonymous cannot be fetched from db if user_id > 0: user = datastore.get( FullQualifiedId(Collection("user"), user_id), [ f"group_${meeting_id}_ids", "guest_meeting_ids", "organisation_management_level", ], ) else: user = {} # superadmins have all permissions if ( user.get("organisation_management_level") == OrganisationManagementLevel.SUPERADMIN ): return True # get correct group ids for this user if user.get(f"group_${meeting_id}_ids"): group_ids = user[f"group_${meeting_id}_ids"] else: # guests, temporary users and anonymous are in the default group if meeting_id in user.get("guest_meeting_ids", []) or user_id == 0: meeting = datastore.get( FullQualifiedId(Collection("meeting"), meeting_id), ["default_group_id", "enable_anonymous"], ) # check if anonymous is allowed if user_id == 0 and not meeting.get("enable_anonymous"): raise PermissionDenied( f"Anonymous is not enabled for meeting {meeting_id}" ) group_ids = [meeting["default_group_id"]] else: raise PermissionDenied(f"You do not belong to meeting {meeting_id}") gmr = GetManyRequest( Collection("group"), group_ids, ["permissions", "admin_group_for_meeting_id"], ) result = datastore.get_many([gmr]) for group in result[Collection("group")].values(): # admins implicitly have all permissions if group.get("admin_group_for_meeting_id") == meeting_id: return True # check if the current group has the needed permission (or a higher one) for group_permission in group.get("permissions", []): if is_child_permission(permission, group_permission): return True return False def is_child_permission(child: Permission, parent: Permission) -> bool: """ Iterate the permission tree (represented in the permissions object) from child to parent or until there are no parents anymore """ queue: List[Permission] = [child] while queue: current = queue.pop() if current == parent: return True parents = permission_parents[current] queue.extend(parents) return False
[ "noreply@github.com" ]
noreply@github.com
8458e2e8286ca685608a32c0a0d73a4550dbfb9d
8240b06d31eec50797c29d5a10ad0c76956891dd
/redact_logs.py
f1ae36ff949d45b160395aa535dc29b474457952
[]
no_license
kalina/log_redactor
770eaf91400d06482b8b77e793c4a3495f71b47a
b6100c0df02bc2674bcf6457f103447c7d21c0d3
refs/heads/master
2021-07-14T19:07:48.345527
2017-10-18T22:35:43
2017-10-18T22:35:43
107,451,605
0
0
null
null
null
null
UTF-8
Python
false
false
4,140
py
#!/usr/bin/env python import argparse import datetime import gzip import logging import os """ Redacts lines from files (likely log) containing the specified fields. """ def process_files(args): """processes files from the argument removing lines and log the results """ for f in args.files: # log start logging.info('Processing file: ' +f) start_time = datetime.datetime.now() #.replace(microsecond=0) new_name = 'redacted_' + f try: # open the original file and set up a gzipped output file with gzip.open(f, 'r') as f_in, gzip.open(new_name, 'wb') as f_out: out_exists = True # track if the file exists for exception handling total_lines = 0 redacted_lines = 0 # start iterating line by line for line in f_in: total_lines += 1 # look for everything after the delimiter for data fields = line.split(args.field) # if present we need to examine further if len(fields) == 2: # split the field elements and look for keys we ant to redact field_elements = dict(x.split('=') for x in fields[1].split(args.delimiter)) if any(k in field_elements for k in args.keys): redacted_lines += 1 f_out.write('Log entry Redacted\n') else: f_out.write(line) # line doesn't have a delimiter for data else: f_out.write(line) except Exception: logging.error('Error processing file ' +f +' to file ' +new_name) # try to remove the new file if there's an error try: f_out.close() os.unlink(f_out) out_exists = False finally: try: f_in.close() if out_exists: f_out.close() except Exception: logging.error("Error closing files") update_file_attr(f, new_name) # log before going to the next file end_time = datetime.datetime.now() logging.info('Finished processing: ' +f +' in ' + str(end_time - start_time) +'. Redacted ' +str(redacted_lines) +' out of ' +str(total_lines) +' lines.') def update_file_attr(source, dest): """attempts to copy ownership and timestamps from one file to another """ try: stat = os.stat(source) uid = stat.st_uid gid = stat.st_gid atime = stat.st_atime mtime = stat.st_mtime mode = stat.st_mode os.chown(dest, uid, gid) os.chmod(dest, mode) os.utime(dest, (atime, mtime)) except Exception: logging.error('Error setting metadata for file: ' +dest) def parse_args(): """parse the arguments from the command line """ parser = argparse.ArgumentParser(description='Redact lines from input gzip file containing fields passed as parameter') parser.add_argument('-f', '--files', nargs='+', required=True, help='<Required> list of files delimited with spaces') parser.add_argument('-k', '--keys', nargs='+', required=True, help='<Required> list of fields that will cause a line to be redacted') parser.add_argument('-l', '--log', default='redacted.log', help='<Optional> location of log file. default is redacted.log') parser.add_argument('--field', default='Fields:', help='<Optional>String that begins fields to examine') parser.add_argument('-d', '--delimiter', default=', ', help='<Optional> Field delimiter inside of fields to examine') return parser.parse_args() def main(): """Main entry point. Starts a logger. """ args = parse_args() logging.basicConfig(filename=args.log, level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') process_files(args) if __name__ == '__main__': main()
[ "drew.kalina@nike.com" ]
drew.kalina@nike.com
384e15fbdaa55431540d81542c3cbb215c0f67a0
70cb76fbbee81dcf8beeb531d98fbeaf9f97cbd7
/PASTA.py
83a0f2cd06163481b5ef2ed5d8c230e2703fbdf4
[]
no_license
someshsharma63/Restaurant-System
05ec858eafcaf883317c371a21ed2b9b6ac8cb09
c83416a98c0b5ab7ad140c12a8392ecc10bb3825
refs/heads/master
2020-08-07T23:59:23.158702
2019-10-08T12:10:35
2019-10-08T12:10:35
213,632,040
0
0
null
null
null
null
UTF-8
Python
false
false
2,130
py
from tkinter import * root=Tk() root.title("Pasta") root.geometry("500x500") framePasta=Frame(root) framePasta.pack(side="right",fill=BOTH,expand=True) ButtonCHEESEPASTA=Button(framePasta,text="CHEESE PASTA",width="15",font=("calibri",17,"bold"),height=5) ButtonCHEESEPASTA.grid(row=0,column=0,sticky="nsew") ButtonPEASPASTA=Button(framePasta,text="PEAS PASTA",width="15",font=("calibri",17,"bold"),height=5) ButtonPEASPASTA.grid(row=0,column=1,sticky="nsew") ButtonGRILLEDPASTA=Button(framePasta,text="GRILLED PASTA",width="15",font=("calibri",17,"bold"),height=5) ButtonGRILLEDPASTA.grid(row=0,column=2,sticky="nsew") ButtonSHEUPASTA=Button(framePasta,text="SHEU PASTA",width="15",font=("calibri",17,"bold"),height=5) ButtonSHEUPASTA.grid(row=1,column=0,sticky="nsew") ButtonBROCCOLIPASTA=Button(framePasta,text="BROCCOLI PASTA",width="15",font=("calibri",17,"bold"),height=5) ButtonBROCCOLIPASTA.grid(row=1,column=1,sticky="nsew") ButtonHERBPASTA=Button(framePasta,text="HERB PASTA",width="15",font=("calibri",17,"bold"),height=5) ButtonHERBPASTA.grid(row=1,column=2,sticky="nsew") ButtonBEANSPASTA=Button(framePasta,text="BEANS PASTA",width="15",font=("calibri",17,"bold"),height=5) ButtonBEANSPASTA.grid(row=2,column=0,sticky="nsew") ButtonSPINACHPASTA=Button(framePasta,text="SPINACH PASTA",width="15",font=("calibri",17,"bold"),height=5) ButtonSPINACHPASTA.grid(row=2,column=1,sticky="nsew") ButtonITALIANPASTA=Button(framePasta,text="ITALIAN PASTA",width="15",font=("calibri",17,"bold"),height=5) ButtonITALIANPASTA.grid(row=2,column=2,sticky="nsew") ButtonONIONPASTA=Button(framePasta,text="ONION PASTA",width="15",font=("calibri",17,"bold"),height=5) ButtonONIONPASTA.grid(row=3,column=0,sticky="nsew") ButtonTOMATOPASTA=Button(framePasta,text="TOMATO PASTA",width="15",font=("calibri",17,"bold"),height=5) ButtonTOMATOPASTA.grid(row=3,column=1,sticky="nsew") ButtonGARLICPASTA=Button(framePasta,text="GARLIC PASTA",width="15",font=("calibri",17,"bold"),height=5) ButtonGARLICPASTA.grid(row=3,column=2,sticky="nsew") root.mainloop()
[ "noreply@github.com" ]
noreply@github.com
d1d4037b3e971877ea2970f5fd6932bfc9f2ecb8
6768db30b642e8ee8f128d0854d08c4d33debbad
/blog/migrations/0001_initial.py
98a12c3ec86c20b6a18e440ba08e93fe40ea9fc3
[]
no_license
S3817852/Notification
b850bface709b2949154d5a5e4a0b22c2cfdfbfc
b358c85b88c31c0d2dca99cade452963f6258075
refs/heads/main
2023-04-23T15:31:45.785122
2021-05-06T18:41:33
2021-05-06T18:41:33
362,190,179
0
0
null
null
null
null
UTF-8
Python
false
false
601
py
# Generated by Django 3.2 on 2021-05-03 08:12 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Article', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=120)), ('content', models.TextField()), ('active', models.BooleanField(default=True)), ], ), ]
[ "s3817852@rmit.edu.vn" ]
s3817852@rmit.edu.vn
ba84e51bc7bf0a2d37b2022de76f9c7bd937fab0
89dcfb1af881cfda7b9bfc9a1babf8f36d665cf5
/app6/Not_app/exercise1.py
d2a2261c3dca85f07c629177e4be5ffc6ff8c6f7
[]
no_license
AvyanshKatiyar/megapython
5be6104f78dea06093a6d499ec23f6fecdcc3525
928defe72da59c58de82a71f85f0bad9ca080914
refs/heads/master
2023-02-26T04:35:18.553701
2021-01-29T14:33:53
2021-01-29T14:33:53
329,606,121
0
0
null
null
null
null
UTF-8
Python
false
false
313
py
#resizes all images in the directory import cv2 import glob all_file_names = glob.glob("sample_images/*.jpg") print(all_file_names) for filename in all_file_names: img= cv2.imread(filename, 1 ) resized_image = cv2.resize(img,(100, 100)) cv2.imwrite(f"{filename[:-4]}_resized.jpg", resized_image)
[ "avyanshkatiyar@gmail.com" ]
avyanshkatiyar@gmail.com
a4864319528ea6eedb76e88579add3f1820a7ce0
7ba8f2512eda33326fb9ccb3e338d4f078eff5d2
/config.py
f6c3d08348adf3ea65b5465a05679bacf83f46c8
[]
no_license
elinaldosoft/sync_cassandra_elasticsearch
1158d41585d525cabba3f8664fc5d4c0432b4962
33292357142543c8ed7951d96cf1a4b9ff18e6a1
refs/heads/master
2021-06-09T08:20:19.137827
2015-06-29T19:32:53
2015-06-29T19:32:53
31,242,298
1
0
null
2021-06-01T21:44:49
2015-02-24T02:59:33
Python
UTF-8
Python
false
false
993
py
#! /usr/bin/python # -*- coding: utf-8 -*- __author__ = 'elinaldo' from elasticsearch import Elasticsearch """ http://datastax.github.io/python-driver/api/cassandra/cluster.html """ CASSANDRA = { 'IP': ['127.0.0.1'], 'DB': u'cassandra_db', } """ https://elasticsearch-py.readthedocs.org/en/master/api.html#global-options """ es = Elasticsearch( ['localhost'], port=9200, ) """ TIME - Você dever definir o tempo em segundos para determinar de quanto em quanto tempo haverá uma sincronização de dados entre o Cassandra e o ElasticSearch. LIMIT - limita o número de registro que será sincronizado de cada vez PID_PATH - Caminho onde vai ficar o arquivo com o número do processo em daemon """ CONF_DAEMON = { 'TIME': 10, 'LIMIT': 100, 'PID_PATH': '/tmp/sync_daemon.pid' } """ SCHEMA_MIGRATION - É onde você define quais Classes serão sincronizados entre se. """ SCHEMA_MIGRATION = { 'posts_cassandra.Posts': 'posts_elasticsearch.PostsElasticSearch', }
[ "git@li798-221.members.linode.com" ]
git@li798-221.members.linode.com
e9d169335a5f914f653a37844eac60d56eb8136e
b96ed10d6247e22d4fa1d28bc3314bc319d3109c
/LessonSample/chapter12/03_进程池.py
2ba823ca2fd1e127c6f7ef24b29591aaddf7cb6d
[]
no_license
13555785106/PythonPPT-01
ac1b22b9b1851f2b3ea6e4ab0a100e5f6896ee8c
40e5883f248cb342f3a7fc7ad12ba02ebde4c619
refs/heads/master
2020-04-26T16:49:59.675964
2019-03-04T07:16:21
2019-03-04T07:16:21
157,095,747
4
0
null
null
null
null
UTF-8
Python
false
false
941
py
#!/usr/bin/python # -*- coding: UTF-8 -*- import os import random import time from multiprocessing import Pool def run(name): print("子进程%d启动--%s" % (name, os.getpid())) start = time.time() time.sleep(random.choice([5, 7, 9])) end = time.time() print("子进程%d结束--%s--耗时%.2f" % (name, os.getpid(), end - start)) print("父进程启动") # 创建多个进程 # 进程池 # 表示可以同时执行的进程数量 # Pool默认大小是CPU核心数 pp = Pool() for i in range(10): # 创建进程,放入进程池中统一管理 pp.apply_async(run, args=(i,)) # 在调用join之前必须先调用close,并且调用close之后就不能再继续添加新的进程了 pp.close() # close以后进程池pp将被关闭,不能再继续向pp中加入新的进程. # 进程池对象调用join,会等待进程池中所有的子进程结束完毕再去执行父进程 pp.join() print("父进程结束")
[ "312655424@qq.com" ]
312655424@qq.com
679b253d7f74808791e9fb785f946b825d3f2d31
ffefea09bc3bcbf02abcbc8c8eee1d5f32c3b857
/dtn/MNIST_USPS_p1/queuer.py
b2ea71dbb8960ce9301f882e6ddb469e1fe00875
[ "MIT" ]
permissive
elchico1990/domain_sampler_nets
0b51a6d5ee0ea02b72c7ae7595f3ac2a5b8dbeff
51103462f2f28125b50b81af8a759c1dac46531d
refs/heads/master
2020-03-16T18:59:25.179460
2018-03-21T09:53:32
2018-03-21T09:53:32
null
0
0
null
null
null
null
UTF-8
Python
false
false
596
py
import zmq import sys def main(): context = zmq.Context() queuerBe = context.socket(zmq.DEALER) queuerBe.bind('tcp://*:5570') queuerFe = context.socket(zmq.ROUTER) queuerFe.bind('tcp://*:5560') poll = zmq.Poller() poll.register(queuerFe, zmq.POLLIN) while True: sockets = dict(poll.poll()) if queuerFe in sockets: ident, expDir = queuerFe.recv_multipart() queuerBe.send_string(expDir) frontend.close() backend.close() context.term() if __name__ == '__main__': main()
[ "rvolpi@capri11.Stanford.EDU" ]
rvolpi@capri11.Stanford.EDU
1bdc224dca8b596ac6e94359d90f12c8b5e1815f
631901398be90a2dda7b703e8229165e719dae7f
/orm/entities/Area/__init__.py
fb86137b571e9985fd20e226197292e6b653f21d
[]
no_license
hevayo/results-tabulation-api
4b22cc7cb3c535862429fef84422e97e1ca5890a
939c1cbd360fd908dcdf563623ee91393959bcd5
refs/heads/master
2020-08-08T22:58:34.133675
2019-11-02T07:54:07
2019-11-02T07:54:07
213,940,023
0
0
null
2019-10-09T14:27:02
2019-10-09T14:27:00
null
UTF-8
Python
false
false
15,851
py
from app import db from sqlalchemy.orm import relationship, aliased from sqlalchemy import and_, func, or_ from orm.enums import AreaTypeEnum from orm.entities import Election from sqlalchemy.ext.hybrid import hybrid_property class AreaModel(db.Model): __tablename__ = 'area' areaId = db.Column(db.Integer, primary_key=True, autoincrement=True) areaName = db.Column(db.String(300), nullable=False) areaType = db.Column(db.Enum(AreaTypeEnum), nullable=False) electionId = db.Column(db.Integer, db.ForeignKey(Election.Model.__table__.c.electionId), nullable=False) # parentAreaId = db.Column(db.Integer, db.ForeignKey(areaId), nullable=True) _registeredVotersCount = db.Column(db.Integer(), nullable=True) election = relationship(Election.Model, foreign_keys=[electionId]) # parentArea = relationship("AreaModel", remote_side=[areaId]) # childAreas = relationship("AreaModel", foreign_keys=[parentAreaId]) # pollingStations = relationship("PollingStationModel") # this relationship is used for persistence children = relationship("AreaModel", secondary="area_area", primaryjoin="AreaModel.areaId==AreaAreaModel.parentAreaId", secondaryjoin="AreaModel.areaId==AreaAreaModel.childAreaId" ) parents = relationship("AreaModel", secondary="area_area", primaryjoin="AreaModel.areaId==AreaAreaModel.childAreaId", secondaryjoin="AreaModel.areaId==AreaAreaModel.parentAreaId" ) tallySheets = relationship("TallySheetModel", secondary="submission", primaryjoin="AreaModel.areaId==SubmissionModel.areaId", secondaryjoin="SubmissionModel.submissionId==TallySheetModel.tallySheetId" ) tallySheets_PRE_41 = relationship( "TallySheetModel", secondary="submission", primaryjoin="AreaModel.areaId==SubmissionModel.areaId", secondaryjoin="and_(SubmissionModel.submissionId==TallySheetModel.tallySheetId, TallySheetModel.tallySheetCode=='PRE_41')" ) def __init__(self, areaName, electionId): super(AreaModel, self).__init__( areaName=areaName, electionId=electionId ) db.session.add(self) db.session.flush() def add_parent(self, parentId): parentArea = get_by_id(areaId=parentId) parentArea.add_child(self.areaId) return self def add_child(self, childId): existing_mapping = AreaAreaModel.query.filter( AreaAreaModel.parentAreaId == self.areaId, AreaAreaModel.childAreaId == childId ).one_or_none() if existing_mapping is None: areaParent = AreaAreaModel(parentAreaId=self.areaId, childAreaId=childId) db.session.add(areaParent) db.session.flush() return self def get_associated_areas_query(self, areaType, electionId=None): return get_associated_areas_query(areas=[self], areaType=areaType, electionId=electionId) def get_associated_areas(self, areaType, electionId=None): return self.get_associated_areas_query(areaType, electionId).all() def get_submissions(self, submissionType): return [submission for submission in self.submissions if submission.submissionType is submissionType] # def get_reports(self, reportCode): # return [report for report in self.reports if report.reportCode is reportCode] @hybrid_property def pollingStations(self): return get_associated_areas(self, AreaTypeEnum.PollingStation) @hybrid_property def countingCentres(self): # return [] return get_associated_areas(self, AreaTypeEnum.CountingCentre) @hybrid_property def districtCentres(self): # return [] return get_associated_areas(self, AreaTypeEnum.DistrictCentre) @hybrid_property def pollingDistricts(self): # TODO review # Sending the list of polling districts only for polling stations. if self.areaType is AreaTypeEnum.PollingStation: return get_associated_areas(self, AreaTypeEnum.PollingDistrict) else: return [] @hybrid_property def registeredVotersCount(self): polling_stations_subquery = get_associated_areas_query(areas=[self], areaType=AreaTypeEnum.PollingStation).subquery() total_registered_voters_count = db.session.query( func.sum(polling_stations_subquery.c._registeredVotersCount) ).scalar() return total_registered_voters_count __mapper_args__ = { 'polymorphic_on': areaType } class AreaAreaModel(db.Model): __tablename__ = 'area_area' parentAreaId = db.Column(db.Integer, db.ForeignKey("area.areaId"), primary_key=True) childAreaId = db.Column(db.Integer, db.ForeignKey("area.areaId"), primary_key=True) Model = AreaModel def get_presidential_area_map_query(): election_commission_mapping = aliased(AreaAreaModel) district_centre_mapping = aliased(AreaAreaModel) counting_centre_mapping = aliased(AreaAreaModel) postal_vote_counting_centre_mapping = aliased(AreaAreaModel) polling_station_mapping = aliased(AreaAreaModel) polling_district_mapping = aliased(AreaAreaModel) polling_division_mapping = aliased(AreaAreaModel) electoral_district_mapping = aliased(AreaAreaModel) country_mapping = aliased(AreaAreaModel) election_commission = aliased(AreaModel) district_centre = aliased(AreaModel) counting_centre = aliased(AreaModel) polling_station = aliased(AreaModel) polling_district = aliased(AreaModel) polling_division = aliased(AreaModel) electoral_district = aliased(AreaModel) country = aliased(AreaModel) presidential_area_map_query = db.session.query( counting_centre.areaId.label("countingCentreId"), polling_station.areaId.label("pollingStationId"), district_centre.areaId.label("districtCentreId"), election_commission.areaId.label("electionCommissionId"), polling_district.areaId.label("pollingDistrictId"), polling_division.areaId.label("pollingDivisionId"), electoral_district.areaId.label("electoralDistrictId"), country.areaId.label("countryId") ).join( polling_station_mapping, polling_station_mapping.parentAreaId == counting_centre.areaId, isouter=True ).join( polling_station, and_( polling_station.areaId == polling_station_mapping.childAreaId, polling_station.areaType == AreaTypeEnum.PollingStation ), isouter=True ).join( district_centre_mapping, district_centre_mapping.childAreaId == counting_centre.areaId, isouter=True ).join( district_centre, and_( district_centre.areaId == district_centre_mapping.parentAreaId, district_centre.areaType == AreaTypeEnum.DistrictCentre ), isouter=True ).join( election_commission_mapping, election_commission_mapping.childAreaId == district_centre.areaId, isouter=True ).join( election_commission, and_( election_commission.areaId == election_commission_mapping.parentAreaId, election_commission.areaType == AreaTypeEnum.ElectionCommission ), isouter=True ).join( polling_district_mapping, polling_district_mapping.childAreaId == polling_station.areaId, isouter=True ).join( polling_district, and_( polling_district.areaId == polling_district_mapping.parentAreaId, polling_district.areaType == AreaTypeEnum.PollingDistrict ), isouter=True ).join( polling_division_mapping, polling_division_mapping.childAreaId == polling_district.areaId, isouter=True ).join( polling_division, and_( polling_division.areaId == polling_division_mapping.parentAreaId, polling_division.areaType == AreaTypeEnum.PollingDivision ), isouter=True ).join( electoral_district_mapping, electoral_district_mapping.childAreaId == polling_division.areaId, isouter=True ).join( postal_vote_counting_centre_mapping, postal_vote_counting_centre_mapping.childAreaId == counting_centre.areaId, isouter=True ).join( electoral_district, or_( and_( electoral_district.areaId == electoral_district_mapping.parentAreaId, electoral_district.areaType == AreaTypeEnum.ElectoralDistrict ), and_( electoral_district.areaId == postal_vote_counting_centre_mapping.parentAreaId, electoral_district.areaType == AreaTypeEnum.ElectoralDistrict ), ), isouter=True ).join( country_mapping, country_mapping.childAreaId == electoral_district.areaId, isouter=True ).join( country, and_( country.areaId == country_mapping.parentAreaId, country.areaType == AreaTypeEnum.Country ), isouter=True ) return presidential_area_map_query def get_associated_areas_query(areas, areaType, electionId=None): presidential_area_map_sub_query = get_presidential_area_map_query().subquery() election = Election.get_by_id(electionId=electionId) query = db.session.query( AreaModel ).join( Election.Model, Election.Model.electionId == AreaModel.electionId ) if areaType is AreaTypeEnum.PollingStation: query = query.join( presidential_area_map_sub_query, presidential_area_map_sub_query.c.pollingStationId == AreaModel.areaId ) elif areaType is AreaTypeEnum.CountingCentre: query = query.join( presidential_area_map_sub_query, presidential_area_map_sub_query.c.countingCentreId == AreaModel.areaId ) elif areaType is AreaTypeEnum.DistrictCentre: query = query.join( presidential_area_map_sub_query, presidential_area_map_sub_query.c.districtCentreId == AreaModel.areaId ) elif areaType is AreaTypeEnum.ElectionCommission: query = query.join( presidential_area_map_sub_query, presidential_area_map_sub_query.c.electionCommissionId == AreaModel.areaId ) elif areaType is AreaTypeEnum.PollingDistrict: query = query.join( presidential_area_map_sub_query, presidential_area_map_sub_query.c.pollingDistrictId == AreaModel.areaId ) elif areaType is AreaTypeEnum.PollingDivision: query = query.join( presidential_area_map_sub_query, presidential_area_map_sub_query.c.pollingDivisionId == AreaModel.areaId ) elif areaType is AreaTypeEnum.ElectoralDistrict: query = query.join( presidential_area_map_sub_query, presidential_area_map_sub_query.c.electoralDistrictId == AreaModel.areaId ) elif areaType is AreaTypeEnum.Country: query = query.join( presidential_area_map_sub_query, presidential_area_map_sub_query.c.countryId == AreaModel.areaId ) elif areaType is AreaTypeEnum.PostalVoteCountingCentre: query = query.join( presidential_area_map_sub_query, presidential_area_map_sub_query.c.postalVoteCountingCentreId == AreaModel.areaId ) query = query.group_by(AreaModel.areaId) filtered_polling_stations = [area.areaId for area in areas if area.areaType == AreaTypeEnum.PollingStation] filtered_counting_centres = [area.areaId for area in areas if area.areaType == AreaTypeEnum.CountingCentre] filtered_district_centres = [area.areaId for area in areas if area.areaType == AreaTypeEnum.DistrictCentre] filtered_election_commissions = [area.areaId for area in areas if area.areaType == AreaTypeEnum.ElectionCommission] filtered_polling_districts = [area.areaId for area in areas if area.areaType == AreaTypeEnum.PollingDistrict] filtered_polling_divisions = [area.areaId for area in areas if area.areaType == AreaTypeEnum.PollingDivision] filtered_electoral_districts = [area.areaId for area in areas if area.areaType == AreaTypeEnum.ElectoralDistrict] filtered_countries = [area.areaId for area in areas if area.areaType == AreaTypeEnum.Country] if len(filtered_polling_stations) > 0: query = query.filter( presidential_area_map_sub_query.c.pollingStationId.in_(filtered_polling_stations) ) elif len(filtered_counting_centres) > 0: query = query.filter( presidential_area_map_sub_query.c.countingCentreId.in_(filtered_counting_centres) ) elif len(filtered_district_centres) > 0: query = query.filter( presidential_area_map_sub_query.c.districtCentreId.in_(filtered_district_centres) ) elif len(filtered_election_commissions) > 0: query = query.filter( presidential_area_map_sub_query.c.electionCommissionId.in_(filtered_election_commissions) ) elif len(filtered_polling_districts) > 0: query = query.filter( presidential_area_map_sub_query.c.pollingDistrictId.in_(filtered_polling_districts) ) elif len(filtered_polling_divisions) > 0: query = query.filter( presidential_area_map_sub_query.c.pollingDivisionId.in_(filtered_polling_divisions) ) elif len(filtered_electoral_districts) > 0: query = query.filter( presidential_area_map_sub_query.c.electoralDistrictId.in_(filtered_electoral_districts) ) elif len(filtered_countries) > 0: query = query.filter( presidential_area_map_sub_query.c.countryId.in_(filtered_countries) ) if electionId is not None: query = query.filter( or_( Model.electionId.in_(election.mappedElectionIds), Model.electionId.in_(election.subElectionIds) ) ) query = query.filter( AreaModel.areaType == areaType ) return query def get_associated_areas(area, areaType, electionId=None): result = get_associated_areas_query(areas=[area], areaType=areaType, electionId=electionId).all() return result def create(areaName, electionId): area = Model( areaName=areaName, electionId=electionId ) return area def get_all(election_id=None, area_name=None, associated_area_id=None, area_type=None): election = Election.get_by_id(electionId=election_id) if associated_area_id is not None and area_type is not None: associated_area = get_by_id(areaId=associated_area_id) query = get_associated_areas_query(areas=[associated_area], areaType=area_type, electionId=election_id) else: query = Model.query if area_name is not None: query = query.filter(Model.areaName.like(area_name)) if election is not None: query = query.filter( or_( Model.electionId.in_(election.mappedElectionIds), Model.electionId.in_(election.subElectionIds) ) ) if area_type is not None: query = query.filter(Model.areaType == area_type) query = query.order_by(Model.areaId) return query def get_by_id(areaId): result = Model.query.filter( Model.areaId == areaId ).one_or_none() return result
[ "l.dinukadesilva@gmail.com" ]
l.dinukadesilva@gmail.com
9d59bed8d06382c07e4a5134ae0c40d289c3960c
6366f8d344d88101ebb5d6c1dfe77dc8cf81d265
/Test85.py
f9d53816010c2d441505db1888f164b75f98930e
[]
no_license
bobbypt05/ICE---HRM-Testing
54ccf28b6cd9fdc5ceb49bd115baa250d2a7323f
c8d061eb62ee7465cb614ea85012391c4bd83976
refs/heads/master
2020-09-09T07:53:02.418745
2019-11-13T01:24:33
2019-11-13T01:24:33
221,392,192
0
0
null
null
null
null
UTF-8
Python
false
false
3,203
py
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException import unittest, time, re class Test85(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.driver.implicitly_wait(30) self.base_url = "https://www.katalon.com/" self.verificationErrors = [] self.accept_next_alert = True def test_85(self): driver = self.driver driver.get("http://localhost/dashboard/icehrm/app/login.php") driver.find_element_by_id("username").click() driver.find_element_by_id("username").clear() driver.find_element_by_id("username").send_keys("admin") driver.find_element_by_id("password").click() driver.find_element_by_id("password").clear() driver.find_element_by_id("password").send_keys("admin") driver.find_element_by_xpath("(.//*[normalize-space(text()) and normalize-space(.)='Remember me'])[1]/following::button[1]").click() driver.find_element_by_id("usersLink").click() driver.find_element_by_xpath("//*[@id='User']/div[1]/div/button").click() driver.find_element_by_id("username").click() driver.find_element_by_id("username").clear() driver.find_element_by_id("username").send_keys("crp987") driver.find_element_by_id("email").click() driver.find_element_by_id("email").clear() driver.find_element_by_id("email").send_keys("crprajapati111@gmail.com") driver.find_element_by_id("user_level").click() driver.find_element_by_id("user_level").click() select1 = Select(driver.find_element_by_id("user_level")) select1.select_by_visible_text('Manager') select2 = Select(driver.find_element_by_xpath("//*[@id='user_roles']")) time.sleep(2) #driver.find_element_by_xpath("//*[@id='s2id_user_roles']").send_keys("Report Manager") time.sleep(2) driver.find_element_by_xpath("(.//*[normalize-space(text()) and normalize-space(.)='FI'])[1]/following::span[1]").click() driver.find_element_by_link_text("Sign out").click() def is_element_present(self, how, what): try: self.driver.find_element(by=how, value=what) except NoSuchElementException as e: return False return True def is_alert_present(self): try: self.driver.switch_to_alert() except NoAlertPresentException as e: return False return True def close_alert_and_get_its_text(self): try: alert = self.driver.switch_to_alert() alert_text = alert.text if self.accept_next_alert: alert.accept() else: alert.dismiss() return alert_text finally: self.accept_next_alert = True def tearDown(self): self.driver.quit() self.assertEqual([], self.verificationErrors) if __name__ == "__main__": unittest.main()
[ "bobbypt05@gmail.com" ]
bobbypt05@gmail.com
3d16576478fa4173a6b4ac13bd24082a5243908a
507e9728307439fa3b343de015237e2f179b0032
/hospital/api/AConfig.py
9fa547be309e9abd3052ecb9319676517a13cbcb
[]
no_license
haobin12358/hospital
3075f31c4ed527190292f2655350ef0bbc9ac7f3
9705e03eaf9514eb47f1d44d2bbe18ccf5cd5b30
refs/heads/master
2022-12-14T01:48:56.759520
2021-03-02T04:00:47
2021-03-02T04:00:47
245,367,609
2
1
null
2022-12-08T03:45:40
2020-03-06T08:32:44
Python
UTF-8
Python
false
false
1,128
py
# -*- coding : utf-8 -*- from hospital.extensions.base_resource import Resource from hospital.control.CConfig import CConfig class AConfig(Resource): def __init__(self): self.cconfig = CConfig() def get(self, config): apis = { "list_banner": self.cconfig.list_banner, "get_csd": self.cconfig.get_csd, "get_about_us": self.cconfig.get_about_us, "get_vip_price": self.cconfig.get_vip_price, "get_pointtask": self.cconfig.get_pointtask, "get_integral": self.cconfig.get_integral } return apis def post(self, config): apis = { "set_banner": self.cconfig.set_banner, "set_csd": self.cconfig.set_csd, "set_about_us": self.cconfig.set_about_us, "set_characteristic_team": self.cconfig.set_characteristic_team, "set_honour": self.cconfig.set_honour, "set_vip_price": self.cconfig.set_vip_price, "update_pointtask": self.cconfig.update_pointtask, "get_point": self.cconfig.get_point } return apis
[ "1276121237@qq.com" ]
1276121237@qq.com
0588499572b5db43202033b8b7e52943684e02b8
6811dc616a18898f565ee1e59f52a889da2b4d47
/clog/urls.py
7e24d23a5403e98aa3fd5f1454f3dabc71e0531f
[]
no_license
rtreharne/clog
163e28b8e387e7f2fe926d88e28972c115294508
69320d929d96fd291e6da8fc11023d14da998655
refs/heads/master
2021-01-10T18:24:16.863481
2015-08-18T13:58:07
2015-08-18T13:58:07
40,085,671
0
0
null
null
null
null
UTF-8
Python
false
false
563
py
from django.conf.urls import patterns, include, url from django.contrib import admin from django.conf import settings urlpatterns = patterns('', url(r'^$', 'clog.views.home', name='home'), url(r'^admin/', include(admin.site.urls)), url(r'^user/', include('profiles.urls')), url(r'^upload/', include('upload.urls')), url(r'^invite/', include('invite.urls')), ) if settings.DEBUG: urlpatterns += patterns( 'django.views.static', (r'^media/(?P<path>.*)', 'serve', {'document_root': settings.MEDIA_ROOT}), )
[ "R.Treharne@liverpool.ac.uk" ]
R.Treharne@liverpool.ac.uk
b0fb1dd21188b414f92475ad5ecc9e6106075637
ff97f84275ff7997f8ab9417d75a026bf2dc23c3
/_02_02.py
57f95be8ab7c2da26172cc211b70ebbec15368e7
[]
no_license
yurimkoo/numpy-lab
c9f355b2c6507efb956712bbc8aa1cf91365f71b
316577987a1a027f0d90104c37777fac4584abc4
refs/heads/master
2021-01-21T20:39:01.771787
2017-05-24T15:56:55
2017-05-24T15:56:55
92,266,064
0
0
null
null
null
null
UTF-8
Python
false
false
523
py
# 낮과 밤의 속도의 차이 plotting import numpy as np import matplotlib.pyplot as plt data = np.loadtxt('data2.txt') day, night = data.T print("day - night:", day-night) print("|day - night|:", abs(day-night)) ID = np.arange(1, len(day)+1) plt.plot(ID, day-night, 'k.') # 양과 음의 값 plt.title("Distribution of day-night") plt.xlabel('ID') plt.ylabel('day-night') plt.text(20.5, -29, "* = day-night \no = |day-night|") plt.plot(ID, abs(day-night), 'y*') # 절댓값 처리 plt.show()
[ "yurimzzang51@gmail.com" ]
yurimzzang51@gmail.com
eac10a806ad58329f8f11936dda99609b1065f55
7b5828edda7751700ca7002b40a214e39e5f48a8
/EA/simulation/interactions/object_retrieval_liability.py
2f36b95318e52aa7996e4d60ba902bea61025b51
[]
no_license
daniela-venuta/Sims-4-Python-Script-Workspace
54c33dac02f84daed66f46b7307f222fede0fa62
f408b28fb34626b2e3b2953152343d591a328d66
refs/heads/main
2023-03-29T18:08:39.202803
2021-03-30T19:00:42
2021-03-30T19:00:42
353,111,243
1
0
null
null
null
null
UTF-8
Python
false
false
7,849
py
import build_buy import enum import services import sims4 from element_utils import build_element, CleanupType from interactions import ParticipantType, ParticipantTypeSingle from interactions.aop import AffordanceObjectPair from interactions.base.interaction_constants import InteractionQueuePreparationStatus from interactions.context import InteractionContext, QueueInsertStrategy, InteractionBucketType from interactions.interaction_finisher import FinishingType from interactions.liability import PreparationLiability from interactions.priority import Priority from objects.object_enums import ResetReason from sims4.tuning.tunable import HasTunableFactory, AutoFactoryInit, OptionalTunable, TunableReference, TunableEnumEntry, TunableTuple, TunableVariant, HasTunableSingletonFactory logger = sims4.log.Logger('ObjectRetrievalLiability', default_owner='skorman') class ObjectRetrievalPhase(enum.Int, export=False): PUTTING_DOWN = 1 USE_AND_RETRIEVE = ... PUSHED_RETRIEVAL_AFFORDANCE = ... class _ObjectRetrievalFallbackBase(HasTunableSingletonFactory): def run_fallback(self, actor, obj): raise NotImplementedError class _SendToInventoryFallback(_ObjectRetrievalFallbackBase): def run_fallback(self, actor, obj): if actor.inventory_component.can_add(obj) and actor.inventory_component.player_try_add_object(obj): return if not build_buy.move_object_to_household_inventory(actor): logger.warn('Failed to move {} to inventory. The object will be destroyed', obj) obj.schedule_destroy_asap() class _DestroyObjectFallback(_ObjectRetrievalFallbackBase): def run_fallback(self, actor, obj): obj.schedule_destroy_asap() class ObjectRetrievalLiability(HasTunableFactory, AutoFactoryInit, PreparationLiability): LIABILITY_TOKEN = 'ObjectRetrievalLiability' FACTORY_TUNABLES = {'put_down_tuning': OptionalTunable(description='\n If enabled, the liability will push this tuned affordance to place\n the object before running the owning interaction. \n ', tunable=TunableTuple(affordance=TunableReference(description='\n The affordance to place the object before the owning\n interaction runs.\n ', manager=services.affordance_manager()), participant=TunableEnumEntry(description='\n The target of the put down affordance.\n ', tunable_type=ParticipantTypeSingle, default=ParticipantTypeSingle.Object))), 'object_to_retrieve': TunableEnumEntry(description='\n The target of the retrieval affordance.\n ', tunable_type=ParticipantTypeSingle, default=ParticipantTypeSingle.Object), 'retrieval_affordance': TunableReference(description="\n The affordance to push after the liability is released to pick up\n the 'object to retrieve'.\n ", manager=services.affordance_manager()), 'fallback_behavior': TunableVariant(description='\n The fallback behavior to use on the retrieval object if the \n retrieval affordance fails.\n ', send_to_inventory=_SendToInventoryFallback.TunableFactory(), destroy_object=_DestroyObjectFallback.TunableFactory(), default='send_to_inventory')} def __init__(self, interaction, *args, **kwargs): super().__init__(*args, **kwargs) self._interaction = interaction self._actor = interaction.get_participant(ParticipantType.Actor) self._object = interaction.get_participant(self.object_to_retrieve) self._phase = ObjectRetrievalPhase.PUTTING_DOWN self._pushed_preparation_interactions = [] def _prepare_gen(self, timeline, *args, **kwargs): if self.put_down_tuning is None: self._phase = ObjectRetrievalPhase.USE_AND_RETRIEVE if self._phase == ObjectRetrievalPhase.PUTTING_DOWN: target = self._interaction.get_participant(self.put_down_tuning.participant) if target is None: cancel_reason = 'ObjectRetrievalLiability: Failed to get participant to put down.' self._interaction.cancel(FinishingType.TRANSITION_FAILURE, cancel_reason_msg=cancel_reason) return InteractionQueuePreparationStatus.FAILURE result = self._push_affordance(self.put_down_tuning.affordance, target) if not result: cancel_reason = 'ObjectRetrievalLiability: Failed to put down object.' self._interaction.cancel(FinishingType.TRANSITION_FAILURE, cancel_reason_msg=cancel_reason) return InteractionQueuePreparationStatus.FAILURE self._pushed_preparation_interactions.append(result.interaction) self._phase = ObjectRetrievalPhase.USE_AND_RETRIEVE return InteractionQueuePreparationStatus.NEEDS_DERAIL self._pushed_preparation_interactions = [] return InteractionQueuePreparationStatus.SUCCESS def release(self): if self._object is None or self._object.is_in_inventory(): if self.put_down_tuning is not None: for interaction in self._interaction.sim.get_all_running_and_queued_interactions(): if interaction.affordance is self.put_down_tuning.affordance: interaction.cancel(FinishingType.FAILED_TESTS, cancel_reason_msg='ObjectRetrievalLiability released.') return if self._phase < ObjectRetrievalPhase.PUSHED_RETRIEVAL_AFFORDANCE: result = self._push_affordance(self.retrieval_affordance, self._object) if result: retrieval_interaction = result.interaction self.transfer(retrieval_interaction) retrieval_interaction.add_liability(ObjectRetrievalLiability, self) self._phase = ObjectRetrievalPhase.PUSHED_RETRIEVAL_AFFORDANCE return self._clean_up_object() def should_transfer(self, continuation): return continuation.affordance is self.retrieval_affordance and self._phase < ObjectRetrievalPhase.PUSHED_RETRIEVAL_AFFORDANCE def transfer(self, interaction): self._interaction = interaction def on_reset(self): self._clean_up_object() def _push_affordance(self, affordance, target): picked_item_ids = self._interaction.interaction_parameters.get('picked_item_ids') aop = AffordanceObjectPair(affordance, target, affordance, None, route_fail_on_transition_fail=False, allow_posture_changes=True, picked_item_ids=picked_item_ids) context = InteractionContext(self._actor, InteractionContext.SOURCE_SCRIPT, Priority.High, insert_strategy=QueueInsertStrategy.FIRST, bucket=InteractionBucketType.DEFAULT) return aop.test_and_execute(context) def _clean_up_object(self): if self._object is None or self._object in self._actor.inventory_component: return for child_obj in tuple(self._object.children): if child_obj.is_sim: logger.warn('Trying to clean up object {} that sim {} is using. The sim will be reset.', self._object, child_obj) reset_fn = lambda _: child_obj.reset(ResetReason.RESET_EXPECTED, source=self, cause='ObjectRetrievalLiability is cleaning up parent object {}.'.format(self._object)) element = build_element([reset_fn, lambda _: self._clean_up_object()], critical=CleanupType.OnCancelOrException) services.time_service().sim_timeline.schedule(element) return self.fallback_behavior.run_fallback(self._actor, self._object) def path_generation_deferred(self): return self._pushed_preparation_interactions
[ "44103490+daniela-venuta@users.noreply.github.com" ]
44103490+daniela-venuta@users.noreply.github.com
80e133ecd3f92edf940d262ef396d4bb0b0d6f90
9dee53bfc35c5c21cd4b20b197fa2d5b6bed16a6
/CTFd/utils/email/__init__.py
d2b39beb92a261d1e43e0c56ae4760ec0d6108cf
[ "Apache-2.0" ]
permissive
Shad0w-Synd1cate/CTFd
c8656e23533c9b32b492911df5d4411c6c4951be
0d64a37b3b06929f836a4e6cb2d462fe14e1e40e
refs/heads/master
2020-12-04T13:33:35.777021
2020-01-20T01:30:37
2020-01-20T01:30:37
231,782,690
0
0
Apache-2.0
2020-01-05T21:38:27
2020-01-04T15:09:19
Python
UTF-8
Python
false
false
1,959
py
from flask import url_for from CTFd.utils import get_config from CTFd.utils.formatters import safe_format from CTFd.utils.config import get_mail_provider from CTFd.utils.email import mailgun, smtp from CTFd.utils.security.signing import serialize def sendmail(addr, text, subject="Message from {ctf_name}"): subject = safe_format(subject, ctf_name=get_config("ctf_name")) provider = get_mail_provider() if provider == "smtp": return smtp.sendmail(addr, text, subject) if provider == "mailgun": return mailgun.sendmail(addr, text, subject) return False, "No mail settings configured" def forgot_password(email, team_name): token = serialize(team_name) text = """Did you initiate a password reset? Click the following link to reset your password: {0}/{1} """.format( url_for("auth.reset_password", _external=True), token ) return sendmail(email, text) def verify_email_address(addr): token = serialize(addr) text = """Please click the following link to confirm your email address for {ctf_name}: {url}/{token}""".format( ctf_name=get_config("ctf_name"), url=url_for("auth.confirm", _external=True), token=token, ) return sendmail(addr, text) def user_created_notification(addr, name, password): text = """An account has been created for you for {ctf_name} at {url}. \n\nUsername: {name}\nPassword: {password}""".format( ctf_name=get_config("ctf_name"), url=url_for("views.static_html", _external=True), name=name, password=password, ) return sendmail(addr, text) def check_email_is_whitelisted(email_address): local_id, _, domain = email_address.partition("@") domain_whitelist = get_config("domain_whitelist") if domain_whitelist: domain_whitelist = [d.strip() for d in domain_whitelist.split(",")] if domain not in domain_whitelist: return False return True
[ "noreply@github.com" ]
noreply@github.com
327256d7a433ba37df241987b159a68ca5fe7e81
edc576c94b2724a98cc5e49a9ac3209133ae544c
/deepfacet/mlb_DodecahedronGeometry.py
6a7b127c1102e1e5866aaf4e68f821181954b874
[]
no_license
alexahs/DeepFacet
980c105269a754a009fd8a2167cfddb2f81a9631
ce6f43155387fc6f6b309aa23e911189b0182a7e
refs/heads/main
2023-08-20T07:51:16.692144
2021-10-18T16:42:18
2021-10-18T16:42:18
401,029,896
3
0
null
null
null
null
UTF-8
Python
false
false
1,000
py
from molecular_builder.geometry import PlaneGeometry import numpy as np class DodecahedronGeometry(PlaneGeometry): """ Taken from molecular builder source code: https://github.com/henriasv/molecular-builder/ A convex rectangular dodecahedron geometry to be used for silicon carbide (SiC). :param d: (shortest) length from dodecahedron center to sides :type d: float :param center: center of dodecahedron :type center: array_like """ def __init__(self, d, center=[0, 0, 0]): # make list of normal vectors lst = [[+1, +1, 0], [+1, 0, +1], [0, +1, +1], [+1, -1, 0], [+1, 0, -1], [+0, 1, -1], [-1, +1, 0], [-1, 0, +1], [0, -1, +1], [-1, -1, 0], [-1, 0, -1], [0, -1, -1]] normals = np.asarray(lst, dtype=int) normals = normals / np.linalg.norm(normals, axis=1)[:, np.newaxis] # find points in planes points = d * normals + np.asarray(center) super().__init__(points, normals)
[ "alexander.sexton@infomedia.dk" ]
alexander.sexton@infomedia.dk
7db06e472032ce8391e3363466790dae510de469
66d0559da61eb9d09ef3bda297b7e3aaf7549e4d
/ClientCode_19.9.9/ChangeThemeWin.py
00b12c9872d5c4ee12472a1c39ac227b799ec391
[]
no_license
HappyPointer/Spam-Recognition-System-19
d7eb1984678b5f892d7c336034839f06f38afa22
fd6f6dbf1c80141ad225446304f3c4c65a515dc8
refs/heads/master
2020-07-07T07:02:55.191812
2019-09-10T14:41:44
2019-09-10T14:41:44
203,285,870
3
2
null
2019-09-09T01:45:02
2019-08-20T02:37:34
Python
UTF-8
Python
false
false
16,344
py
""" 说明:换肤窗口,为用户提供多种个性装扮。当用户点击主界面MainUI中右上角的换肤图标时跳出本窗口, 用户点击本窗口中的任意主题并确认即可换肤 作者:71117205丁婧伊 创建时间:2019/9/8 8:23pm 最后一次修改时间:2019/9/10 9:35am """ import traceback from functools import partial from PyQt5.QtCore import Qt, pyqtSignal from PyQt5.QtGui import QCursor, QPixmap, QIcon from PyQt5.QtWidgets import QWidget, QDesktopWidget, QLabel, QPushButton, QApplication, QScrollArea, QVBoxLayout, \ QMessageBox # 更换皮肤的窗口,提供多种可更换装扮 class ChangeThemeWin(QWidget): # 点击皮肤,然后确认更换后发射的信号量,发射的int变量是第几个主题 _signal = pyqtSignal(int) # 构造函数 def __init__(self): super().__init__() self.initMainUI() # 初始化函数,修改窗体属性,添加窗体控件 def initMainUI(self): # 添加bool变量确定鼠标是否按在QWidget界面,解决点击控件与拖拽页面事件冲突 self.isPressedWidget = False # 设置widget组件的大小 self.resize(800, 560) self.setMinimumSize(800, 560) self.setMaximumSize(800, 560) # 设置窗体名称和图标 self.setWindowTitle('个性装扮') self.logoPixmap = QPixmap("./pic/shirt.png") self.logopic = QIcon() self.logopic.addPixmap(self.logoPixmap) self.setWindowIcon(self.logopic) # 设置窗体的ObjectName self.setObjectName("ChangeThemeWin") # 设置widget组件的位置居中 qr = self.frameGeometry() cp = QDesktopWidget().availableGeometry().center() qr.moveCenter(cp) self.move(qr.topLeft()) # 隐藏边框 self.setWindowFlag(Qt.FramelessWindowHint) # 设置样式表 self.setStyleSheet( "QWidget#themeWidget {\n" " background-color: white;\n" "}\n" "QWidget#scroll_contents {\n" " background-color: white;\n" "}\n" "QWidget#widgetTitle {\n" " background-color: rgb(166, 166, 250);\n" "}\n" "QLabel#themeTitleLabel{ \n" " color: white;\n" "}\n" "QPushButton#closeButton{\n" " border: none;\n" " color: white;\n" " background: transparent;\n" "}\n" "QPushButton#closeButton:hover {\n" " background-color: rgba(255, 0, 0, 100%);\n" " color: white\n" "}\n" "QPushButton#clothBtn1{\n" " border-image: url(pic/mountain_small.jpg);" "}\n" "QPushButton#clothBtn1:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn2{\n" " border-image: url(pic/mountainAndStars_small.jpg);" "}\n" "QPushButton#clothBtn2:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn3{\n" " border-image: url(pic/cat_small.jpg);" "}\n" "QPushButton#clothBtn3:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn4{\n" " border-image: url(pic/sandstone_small.jpg);" "}\n" "QPushButton#clothBtn4:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn5{\n" " border-image: url(pic/pink_small.jpg);" "}\n" "QPushButton#clothBtn5:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn6{\n" " border-image: url(pic/dandelion_small.jpg);" "}\n" "QPushButton#clothBtn6:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn7{\n" " border-image: url(pic/cloud_small.jpg);" "}\n" "QPushButton#clothBtn7:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn8{\n" " border-image: url(pic/sci_fi_small.jpg);" "}\n" "QPushButton#clothBtn8:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn9{\n" " border-image: url(pic/mass_energy_small.jpg);" "}\n" "QPushButton#clothBtn9:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn10{\n" " border-image: url(pic/earth_small.jpg);" "}\n" "QPushButton#clothBtn10:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn11{\n" " border-image: url(pic/mountainAndCloud_small.jpg);" "}\n" "QPushButton#clothBtn11:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn12{\n" " border-image: url(pic/blue.png);" "}\n" "QPushButton#clothBtn12:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn13{\n" " border-image: url(pic/AvocadoGreen.png);" "}\n" "QPushButton#clothBtn13:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn14{\n" " border-image: url(pic/grey.png);" "}\n" "QPushButton#clothBtn14:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn15{\n" " border-image: url(pic/black.png);" "}\n" "QPushButton#clothBtn15:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn16{\n" " border-image: url(pic/orange.png);" "}\n" "QPushButton#clothBtn16:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" "QPushButton#clothBtn17{\n" " border-image: url(pic/red.png);" "}\n" "QPushButton#clothBtn17:hover {\n" " background-color: rgba(255, 255, 255, 50%);\n" " color: white\n" "}\n" ) # 标题栏窗体 self.widgetTitle = QWidget(self) self.widgetTitle.setGeometry(0, 0, 800, 35) self.widgetTitle.setObjectName("widgetTitle") # 标题栏标签 self.themeTitleLabel = QLabel(self) self.themeTitleLabel.setGeometry(10, 0, 80, 35) self.themeTitleLabel.setText("个性装扮") self.themeTitleLabel.setObjectName("themeTitleLabel") # 关闭按钮 self.closeButton = QPushButton("×", self) self.closeButton.setGeometry(765, 0, 35, 35) self.closeButton.setObjectName("closeButton") self.closeButton.clicked.connect(self.close) # 将皮肤窗体放在可滚动区域中 self.themeWidget = QWidget(self) self.scroll_area = QScrollArea(self) self.scroll_area.setGeometry(0, 35, 800, 525) self.scroll_area.setWidgetResizable(True) self.scroll_bar = self.scroll_area.verticalScrollBar() # 设置窗体,控制滚动区域的大小 self.scroll_contents = QWidget() self.scroll_contents.setGeometry(0, 35, 800, 1000) self.scroll_contents.setObjectName("scroll_contents") self.scroll_contents.setMinimumSize(770, 1000) # 主题1 按钮 self.clothBtn1 = QPushButton(self.scroll_contents) self.clothBtn1.resize(150, 120) self.clothBtn1.move(30, 50) self.clothBtn1.setText("主题1") self.clothBtn1.setObjectName("clothBtn1") self.clothBtn1.clicked.connect(partial(self.changeCloth, 1)) # 主题2 按钮 self.clothBtn2 = QPushButton(self.scroll_contents) self.clothBtn2.resize(150, 120) self.clothBtn2.move(230, 50) self.clothBtn2.setText("主题2") self.clothBtn2.setObjectName("clothBtn2") self.clothBtn2.clicked.connect(partial(self.changeCloth, 2)) # 主题3 按钮 self.clothBtn3 = QPushButton(self.scroll_contents) self.clothBtn3.resize(150, 120) self.clothBtn3.move(420, 50) self.clothBtn3.setText("主题3") self.clothBtn3.setObjectName("clothBtn3") self.clothBtn3.clicked.connect(partial(self.changeCloth, 3)) # 主题4 按钮 self.clothBtn4 = QPushButton(self.scroll_contents) self.clothBtn4.resize(150, 120) self.clothBtn4.move(610, 50) self.clothBtn4.setText("主题4") self.clothBtn4.setObjectName("clothBtn4") self.clothBtn4.clicked.connect(partial(self.changeCloth, 4)) # 主题5 按钮 self.clothBtn5 = QPushButton(self.scroll_contents) self.clothBtn5.resize(150, 120) self.clothBtn5.move(30, 210) self.clothBtn5.setText("主题5") self.clothBtn5.setObjectName("clothBtn5") self.clothBtn5.clicked.connect(partial(self.changeCloth, 5)) # 主题6 按钮 self.clothBtn6 = QPushButton(self.scroll_contents) self.clothBtn6.resize(150, 120) self.clothBtn6.move(230, 210) self.clothBtn6.setText("主题6") self.clothBtn6.setObjectName("clothBtn6") self.clothBtn6.clicked.connect(partial(self.changeCloth, 6)) # 主题7 按钮 self.clothBtn7 = QPushButton(self.scroll_contents) self.clothBtn7.resize(150, 120) self.clothBtn7.move(420, 210) self.clothBtn7.setText("主题7") self.clothBtn7.setObjectName("clothBtn7") self.clothBtn7.clicked.connect(partial(self.changeCloth, 7)) # 主题8 按钮 self.clothBtn8 = QPushButton(self.scroll_contents) self.clothBtn8.resize(150, 120) self.clothBtn8.move(610, 210) self.clothBtn8.setText("主题8") self.clothBtn8.setObjectName("clothBtn8") self.clothBtn8.clicked.connect(partial(self.changeCloth, 8)) # 主题9 按钮 self.clothBtn9 = QPushButton(self.scroll_contents) self.clothBtn9.resize(150, 120) self.clothBtn9.move(30, 370) self.clothBtn9.setText("主题9") self.clothBtn9.setObjectName("clothBtn9") self.clothBtn9.clicked.connect(partial(self.changeCloth, 9)) # 主题10 按钮 self.clothBtn10 = QPushButton(self.scroll_contents) self.clothBtn10.resize(150, 120) self.clothBtn10.move(230, 370) self.clothBtn10.setText("主10") self.clothBtn10.setObjectName("clothBtn10") self.clothBtn10.clicked.connect(partial(self.changeCloth, 10)) # 主题11 按钮 self.clothBtn11 = QPushButton(self.scroll_contents) self.clothBtn11.resize(150, 120) self.clothBtn11.move(420, 370) self.clothBtn11.setText("主题11") self.clothBtn11.setObjectName("clothBtn11") self.clothBtn11.clicked.connect(partial(self.changeCloth, 11)) # 主题12 按钮 self.clothBtn12 = QPushButton(self.scroll_contents) self.clothBtn12.resize(150, 120) self.clothBtn12.move(610, 370) self.clothBtn12.setText("主题12") self.clothBtn12.setObjectName("clothBtn12") self.clothBtn12.clicked.connect(partial(self.changeCloth, 12)) # 主题13 按钮 self.clothBtn13 = QPushButton(self.scroll_contents) self.clothBtn13.resize(150, 120) self.clothBtn13.move(30, 530) self.clothBtn13.setText("主题13") self.clothBtn13.setObjectName("clothBtn13") self.clothBtn13.clicked.connect(partial(self.changeCloth, 13)) # 主题14 按钮 self.clothBtn14 = QPushButton(self.scroll_contents) self.clothBtn14.resize(150, 120) self.clothBtn14.move(230, 530) self.clothBtn14.setText("主题14") self.clothBtn14.setObjectName("clothBtn14") self.clothBtn14.clicked.connect(partial(self.changeCloth, 14)) # 主题15 按钮 self.clothBtn15 = QPushButton(self.scroll_contents) self.clothBtn15.resize(150, 120) self.clothBtn15.move(420, 530) self.clothBtn15.setText("主题15") self.clothBtn15.setObjectName("clothBtn15") self.clothBtn15.clicked.connect(partial(self.changeCloth, 15)) # 主题16 按钮 self.clothBtn16 = QPushButton(self.scroll_contents) self.clothBtn16.resize(150, 120) self.clothBtn16.move(610, 530) self.clothBtn16.setText("主题16") self.clothBtn16.setObjectName("clothBtn16") self.clothBtn16.clicked.connect(partial(self.changeCloth, 16)) # 主题17 按钮 self.clothBtn17 = QPushButton(self.scroll_contents) self.clothBtn17.resize(150, 120) self.clothBtn17.move(30, 690) self.clothBtn17.setText("主题17") self.clothBtn17.setObjectName("clothBtn17") self.clothBtn17.clicked.connect(partial(self.changeCloth, 17)) # 将可滚动区域放入设置好的窗体中 self.scroll_area.setWidget(self.scroll_contents) self.scroll_area.installEventFilter(self) # 槽函数,当用户点击任意一个皮肤时跳出确认是否更换皮肤的提示框,如果用户点击确认,则发射皮肤编号给MainUI更换皮肤 def changeCloth(self, num): try: re = QMessageBox.question(self, "提示", "更换皮肤", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if re == QMessageBox.Yes: # 如果确认更换,发射用户选择的皮肤编号 self._signal.emit(num) except Exception as e: traceback.print_exc() # 用户按住鼠标事件, 获取拖拽前鼠标相对窗口的位置 def mousePressEvent(self, event): if event.button() == Qt.LeftButton: self.m_flag = True # 获取鼠标相对窗口的位置 self.m_Position = event.globalPos() - self.pos() event.accept() self.setCursor(QCursor(Qt.OpenHandCursor)) # 当前鼠标点击的是窗体而不是控件 self.isPressedWidget = True # 鼠标移动事件,窗体随鼠标拖拽而移动 def mouseMoveEvent(self, QMouseEvent): if self.isPressedWidget: # 当前鼠标点击的是窗体而不是控件 if Qt.LeftButton and self.m_flag: # 更改窗口位置 self.move(QMouseEvent.globalPos() - self.m_Position) QMouseEvent.accept() # 用户松开鼠标事件 def mouseReleaseEvent(self, QMouseEvent): self.m_flag = False self.setCursor(QCursor(Qt.ArrowCursor)) self.isPressedWidget = False
[ "noreply@github.com" ]
noreply@github.com
bc2a86c16fdc46755d1f68ef3d15c959ac845b19
b2ed893d04f04eeaf7209187133de7431c476a96
/user_net/activity_info.py
94dc0c294de672dfcb333926cf41fa221e1c7235
[]
no_license
liruikaiyao/workshop
4b5221259f59ad504d87d73c31f5fa0e58d4a1f0
6dbde74e35ef02f5e92c76dcdd1909f1d0afb89e
refs/heads/master
2021-01-17T16:09:13.248109
2015-08-05T09:43:21
2015-08-05T09:43:21
23,420,887
0
0
null
null
null
null
UTF-8
Python
false
false
1,674
py
# coding=utf-8 __author__ = 'Carry lee' from collections import Counter import datetime import urllib2 import json from config.db import ICCv1, sh, utc api_url = u'http://api.map.baidu.com/geocoder/v2/?ak=' parameter = u'&output=json&coordtype=wgs84ll&location=' ak = 'SIpMcORCSogM916QMOz5tx7S' weixin = ICCv1['weixin'] detail = ICCv1['detail'] begin = datetime.datetime(year=2015, month=5, day=12, hour=0, minute=0, second=0, tzinfo=sh) end = datetime.datetime(year=2015, month=5, day=19, hour=0, minute=0, second=0, tzinfo=sh) begin_utc = begin.astimezone(utc) end_utc = end.astimezone(utc) # 性别统计 gender = {} male = 0 female = 0 for elem in detail.find({'__REMOVED__': False, '__CREATE_TIME__': {'$gt': begin_utc, '$lt': end_utc}}): if 'sex' in elem: if elem['sex'] == 1: male += 1 elif elem['sex'] == 2: female += 1 else: pass gender['male'] = male gender['female'] = female # 根据lbs数据获取城市信息的函数 def getcity(one): location = one['Latitude'] + ',' + one['Longitude'] try: res = urllib2.urlopen(api_url + ak + parameter + location, timeout=0.5) address = json.loads(res.read())['result'] except Exception as e: print e else: city = address['addressComponent']['city'] return city city_list = [] for elem in weixin.find({'Event': 'LOCATION', '__REMOVED__': False, '__CREATE_TIME__': {'$gt': begin_utc, '$lt': end_utc}}).add_option(16): city_name = getcity(elem) city_list.append(city_name) city_info = Counter(city_list)
[ "liruikaiyao@gmail.com" ]
liruikaiyao@gmail.com
58283a877c92264ed11f230941d6d677d08e6af0
c829213e49a18c1b5b8fbfb37bcad4258b2c6fba
/CoderParadise/users/forms.py
c1af099f0d7e8e466087cea2022933382661a095
[]
no_license
NTUST/108-team5
f6b8ee29fceb0bd63278f690ba9723cb0e81c28d
e71dcca6ffeb5f73c769337b22938f15b453f064
refs/heads/master
2022-12-11T09:57:41.809315
2019-06-19T15:15:32
2019-06-19T15:15:32
172,817,739
6
0
null
2022-11-22T03:50:44
2019-02-27T01:12:56
HTML
UTF-8
Python
false
false
921
py
from django import forms from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm from .models import UserProfile from django.core.files.images import get_image_dimensions from ckeditor.fields import RichTextFormField class UserRegisterForm(UserCreationForm): email = forms.EmailField() class Meta: model = User fields = ['username', 'email', 'password1', 'password2'] class UserProfileEditForm(forms.ModelForm): avatar = forms.ImageField(required=False) aboutme = RichTextFormField(required=False, external_plugin_resources=[( 'youtube', '/static/base/vendor/ckeditor_plugins/youtube/youtube/', 'plugin.js', )]) class Meta: model = User fields = ['email']
[ "leoxz02leo@outlook.com" ]
leoxz02leo@outlook.com
a9f4fef1e4376bfc10ef1a75e7fe509d20b30fac
1e0e610166b36e5c73e7ff82c4c0b8b1288990bf
/mail/mail02.py
dbc58ae4fa61f846897bc4421ee3a39ac60cfbbc
[]
no_license
PythonOpen/PyhonProjects
4ef1e70a971b9ebd0eb6a09e63e22581ad302534
ede93314009564c31aa586d2f89ed8b1e4751c1b
refs/heads/master
2022-05-20T23:21:03.536846
2020-04-27T00:59:32
2020-04-27T00:59:32
250,142,108
0
0
null
null
null
null
UTF-8
Python
false
false
1,665
py
from email.mime.text import MIMEText import smtplib # MIMEText三个主要参数 # 1.邮件内容 # 2.MIME子类型,在此案例我们用plain表示text类型 # 3.邮件编码格式 main_content=""" <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <h1>这是一封HTML格式邮件</h1> </body> </html> """ msg=MIMEText(main_content,"html","utf-8") # 发送email地址,此处地址直接使用个人QQ,密码一般需要临时输入,此处偷懒 from_addr="1083138609@qq.com" # 此处密码是经过申请设置后的授权码,不是不是不是你的qq邮箱密码 from_pwd="ofgxddnrkxkqbaaf" # 收件人信息 # 此处使用qq邮箱,我给我自己发送 to_addr="1083138609@qq.com" # 输入SMTP服务器地址 # 此处根据不同的邮件服务商有不同的值 # 现在基本任何一家邮件服务商,如果采用第三方收发邮件,都需要开启授权选项 # 腾讯qq邮箱的smtp地址是 smtp.qq.com smtp_srv="smtp.qq.com" try: # 两个参数 # 第一个是服务器地址,但一定是bytes格式,所以需要编码 # 第二个参数是服务器的接受访问端 # SMTP协议默认端口 srv= smtplib.SMTP_SSL(smtp_srv.encode(), 25) # 登录邮箱发送 srv.login(from_addr, from_pwd) # 发送邮件 # 三个参数 # 1.发送地址 # 2. 接收地址,必须是list形式 # 3.发送内容,作为字符串发送 srv.sendmail(from_addr,[to_addr],msg.as_string()) srv.quit() except Exception as e: print(e)
[ "1083138609@qq.com" ]
1083138609@qq.com
be3079255ff0c6f0516f22a40d69ef50e6948839
9515a4c50d24b0dbbbd03d307bb7cfa7ef800c64
/manage.py
e644d48503620106cf4cc0a910b0625bea02e1f7
[]
no_license
zlzr200599/Test_dJango
6df0295a98b2c1ebca1a30b99fd93944d482b027
7cf428a81bf709cb6eb44e117d21118e9398628b
refs/heads/master
2021-01-21T11:16:16.141855
2017-03-01T10:55:56
2017-03-01T10:55:56
83,544,668
0
0
null
null
null
null
UTF-8
Python
false
false
805
py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Test_dn.settings") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason. Ensure that the # issue is really that Django is missing to avoid masking other # exceptions on Python 2. try: import django except ImportError: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) raise execute_from_command_line(sys.argv)
[ "zlzr200599@gmail.com" ]
zlzr200599@gmail.com
7670f28ba7aabb549461ab2ef055a921d977f465
19236d9e966cf5bafbe5479d613a175211e1dd37
/cohesity_management_sdk/controllers/certificates.py
419684769ccf8289a0dc95ec3fbc113bd7eed60f
[ "MIT" ]
permissive
hemanshu-cohesity/management-sdk-python
236c44fbd9604809027f8ddd0ae6c36e4e727615
07c5adee58810979780679065250d82b4b2cdaab
refs/heads/master
2020-04-29T23:22:08.909550
2019-04-10T02:42:16
2019-04-10T02:42:16
176,474,523
0
0
NOASSERTION
2019-03-19T09:27:14
2019-03-19T09:27:12
null
UTF-8
Python
false
false
6,978
py
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. import logging from cohesity_management_sdk.api_helper import APIHelper from cohesity_management_sdk.configuration import Configuration from cohesity_management_sdk.controllers.base_controller import BaseController from cohesity_management_sdk.http.auth.auth_manager import AuthManager from cohesity_management_sdk.models.ssl_certificate_configuration import SSLCertificateConfiguration from cohesity_management_sdk.exceptions.error_error_exception import ErrorErrorException class Certificates(BaseController): """A Controller to access Endpoints in the cohesity_management_sdk API.""" def __init__(self, client=None, call_back=None): super(Certificates, self).__init__(client, call_back) self.logger = logging.getLogger(__name__) def delete_web_server_certificate(self): """Does a DELETE request to /public/certificates/webServer. Returns delete status upon completion. Returns: void: Response from the API. No Content Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ try: self.logger.info('delete_web_server_certificate called.') # Prepare query URL self.logger.info('Preparing query URL for delete_web_server_certificate.') _url_path = '/public/certificates/webServer' _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare and execute request self.logger.info('Preparing and executing request for delete_web_server_certificate.') _request = self.http_client.delete(_query_url) AuthManager.apply(_request) _context = self.execute_request(_request, name = 'delete_web_server_certificate') # Endpoint and global error handling using HTTP status codes. self.logger.info('Validating response for delete_web_server_certificate.') if _context.response.status_code == 0: raise ErrorErrorException('Error', _context) self.validate_response(_context) except Exception as e: self.logger.error(e, exc_info = True) raise def get_web_server_certificate(self): """Does a GET request to /public/certificates/webServer. Returns the Server Certificate configured on the cluster. Returns: SSLCertificateConfiguration: Response from the API. Success Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ try: self.logger.info('get_web_server_certificate called.') # Prepare query URL self.logger.info('Preparing query URL for get_web_server_certificate.') _url_path = '/public/certificates/webServer' _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare headers self.logger.info('Preparing headers for get_web_server_certificate.') _headers = { 'accept': 'application/json' } # Prepare and execute request self.logger.info('Preparing and executing request for get_web_server_certificate.') _request = self.http_client.get(_query_url, headers=_headers) AuthManager.apply(_request) _context = self.execute_request(_request, name = 'get_web_server_certificate') # Endpoint and global error handling using HTTP status codes. self.logger.info('Validating response for get_web_server_certificate.') if _context.response.status_code == 0: raise ErrorErrorException('Error', _context) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize(_context.response.raw_body, SSLCertificateConfiguration.from_dictionary) except Exception as e: self.logger.error(e, exc_info = True) raise def update_web_server_certificate(self, body=None): """Does a PUT request to /public/certificates/webServer. Returns the updated Web Server Certificate on the cluster. Args: body (SSLCertificateConfiguration, optional): TODO: type description here. Example: Returns: SSLCertificateConfiguration: Response from the API. Success Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ try: self.logger.info('update_web_server_certificate called.') # Prepare query URL self.logger.info('Preparing query URL for update_web_server_certificate.') _url_path = '/public/certificates/webServer' _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) # Prepare headers self.logger.info('Preparing headers for update_web_server_certificate.') _headers = { 'accept': 'application/json', 'content-type': 'application/json; charset=utf-8' } # Prepare and execute request self.logger.info('Preparing and executing request for update_web_server_certificate.') _request = self.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) AuthManager.apply(_request) _context = self.execute_request(_request, name = 'update_web_server_certificate') # Endpoint and global error handling using HTTP status codes. self.logger.info('Validating response for update_web_server_certificate.') if _context.response.status_code == 0: raise ErrorErrorException('Error', _context) self.validate_response(_context) # Return appropriate type return APIHelper.json_deserialize(_context.response.raw_body, SSLCertificateConfiguration.from_dictionary) except Exception as e: self.logger.error(e, exc_info = True) raise
[ "ashish@cohesity.com" ]
ashish@cohesity.com
078c96a9b10e7f7913654e533eeda707766c6979
72b4f3ae71dcc6cc39c1987bd3550e02d364b43e
/VOC2012_AUG/utils.py
e28b906c5b9e3325e91005dd1b38ae1df9087535
[]
no_license
tangzhenjie/deeplabv3
6f462a2554a7038319ed0b0e7ed5d02b25592404
fc7158f82f8712268d2acb0683e9f00a2686dfa4
refs/heads/master
2020-06-19T17:53:17.266676
2019-08-07T02:19:43
2019-08-07T02:19:43
196,810,231
2
0
null
null
null
null
UTF-8
Python
false
false
3,669
py
#!/usr/bin/env python # Martin Kersner, m.kersner@gmail.com # 2016/03/11 import scipy.io import struct import numpy as np def pascal_classes(): classes = {'aeroplane' : 1, 'bicycle' : 2, 'bird' : 3, 'boat' : 4, 'bottle' : 5, 'bus' : 6, 'car' : 7, 'cat' : 8, 'chair' : 9, 'cow' : 10, 'diningtable' : 11, 'dog' : 12, 'horse' : 13, 'motorbike' : 14, 'person' : 15, 'potted-plant' : 16, 'sheep' : 17, 'sofa' : 18, 'train' : 19, 'tv/monitor' : 20} return classes def pascal_palette(): palette = {( 0, 0, 0) : 0 , (128, 0, 0) : 1 , ( 0, 128, 0) : 2 , (128, 128, 0) : 3 , ( 0, 0, 128) : 4 , (128, 0, 128) : 5 , ( 0, 128, 128) : 6 , (128, 128, 128) : 7 , ( 64, 0, 0) : 8 , (192, 0, 0) : 9 , ( 64, 128, 0) : 10, (192, 128, 0) : 11, ( 64, 0, 128) : 12, (192, 0, 128) : 13, ( 64, 128, 128) : 14, (192, 128, 128) : 15, ( 0, 64, 0) : 16, (128, 64, 0) : 17, ( 0, 192, 0) : 18, (128, 192, 0) : 19, ( 0, 64, 128) : 20 } return palette def pascal_palette_invert(): palette_list = pascal_palette().keys() palette = () for color in palette_list: palette += color return palette def pascal_mean_values(): return np.array([103.939, 116.779, 123.68], dtype=np.float32) def strstr(str1, str2): if str1.find(str2) != -1: return True else: return False # Mat to png conversion for http://www.cs.berkeley.edu/~bharath2/codes/SBD/download.html # 'GTcls' key is for class segmentation # 'GTinst' key is for instance segmentation def mat2png_hariharan(mat_file, key='GTcls'): mat = scipy.io.loadmat(mat_file, mat_dtype=True, squeeze_me=True, struct_as_record=False) return mat[key].Segmentation def convert_segmentation_mat2numpy(mat_file): np_segm = load_mat(mat_file) return np.rot90(np.fliplr(np.argmax(np_segm, axis=2))) def load_mat(mat_file, key='data'): mat = scipy.io.loadmat(mat_file, mat_dtype=True, squeeze_me=True, struct_as_record=False) return mat[key] # Python version of script in code/densecrf/my_script/LoadBinFile.m def load_binary_segmentation(bin_file, dtype='int16'): with open(bin_file, 'rb') as bf: rows = struct.unpack('i', bf.read(4))[0] cols = struct.unpack('i', bf.read(4))[0] channels = struct.unpack('i', bf.read(4))[0] num_values = rows * cols # expect only one channel in segmentation output out = np.zeros(num_values, dtype=np.uint8) # expect only values between 0 and 255 for i in range(num_values): out[i] = np.uint8(struct.unpack('h', bf.read(2))[0]) return np.rot90(np.fliplr(out.reshape((cols, rows)))) def convert_from_color_segmentation(arr_3d): arr_2d = np.zeros((arr_3d.shape[0], arr_3d.shape[1]), dtype=np.uint8) palette = pascal_palette() for c, i in palette.items(): m = np.all(arr_3d == np.array(c).reshape(1, 1, 3), axis=2) arr_2d[m] = i return arr_2d def create_lut(class_ids, max_id=256): # Index 0 is the first index used in caffe for denoting labels. # Therefore, index 0 is considered as default. lut = np.zeros(max_id, dtype=np.uint8) new_index = 1 for i in class_ids: lut[i] = new_index new_index += 1 return lut def get_id_classes(classes): all_classes = pascal_classes() id_classes = [all_classes[c] for c in classes] return id_classes
[ "2819786276@qq.com" ]
2819786276@qq.com
a99f22fac472b6feaf6d196d7ba23b1ceea6c804
991a7fc38847c51b9c44ad2abf7f8a4dd4a75d3f
/vnpy/app/cta_crypto/__init__.py
ddb80071b8ece5d87252dcfdfb8f6c43dbc4d66b
[ "MIT" ]
permissive
alexfordc/lee_vnpy
0e15a09432d101b719540ef252a3907e22c023a1
55e2f60aee94682a08e2c10bdd927e436811382c
refs/heads/master
2021-05-17T21:44:47.897021
2020-03-29T05:28:10
2020-03-29T05:28:10
250,966,103
0
1
MIT
2020-03-29T06:08:30
2020-03-29T06:08:30
null
UTF-8
Python
false
false
632
py
from pathlib import Path from vnpy.trader.app import BaseApp from .base import APP_NAME, StopOrder from .engine import CtaEngine from .template import ( Direction, Offset, Status, Interval, TickData, BarData, TradeData, OrderData, CtaTemplate, CtaFutureTemplate) # noqa from vnpy.trader.utility import BarGenerator, ArrayManager # noqa class CtaCryptoApp(BaseApp): """""" app_name = APP_NAME app_module = __module__ app_path = Path(__file__).parent display_name = "CTA策略CRYPTO" engine_class = CtaEngine widget_name = "CtaManager" icon_name = "cta.ico"
[ "123122492@qq.com" ]
123122492@qq.com
4084290fcf60c4bc0684288c02b15d7f93ae83dd
4c9f6ec19e36e0791f7970e8863fc6e4bec3641e
/Py-backup/TVD_png2docx.py
82a2ad268a126fb352df356f1eddd66e46c5afc7
[]
no_license
vivlavie/PyPHAST
cd7e75ad8ef135609d91b9101d256a1d51a54602
809f4fce0e8b73d44d34952408a17e5e846e55e3
refs/heads/master
2022-07-10T09:12:57.742156
2020-05-08T13:49:44
2020-05-08T13:49:44
260,618,659
0
0
null
null
null
null
UTF-8
Python
false
false
1,981
py
from openpyxl import load_workbook import dill from docx import Document from docx.shared import Cm, RGBColor, Pt from docx.text.run import Font, Run # from docx.dml.color import ColorFormat import re def slugify(value): """ Normalizes string, converts to lowercase, removes non-alpha characters, and converts spaces to hyphens. """ # import unicodedata # value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore') # value = unicode(re.sub('[^\w\s-]', '', value).strip().lower()) # value = unicode(re.sub('[-\s]+', '-', value)) value = re.sub('[^\w\s-]', '', value).strip().lower() value = re.sub('[-\s]+', '-', value) return value # element_dump_filename = 'Bv06_offloading_dump' # folder = 'Offloading' # element_dump_filename = 'Bv06_utility_dump' # folder = 'Utility' # element_dump_filename = 'Bv06_hull_dump' # folder = 'Hull' element_dump_filename = 'Bv06_dump' folder = 'ProcessArea' with open(element_dump_filename,'rb') as element_dump: lEvent = dill.load(element_dump) document = Document() fontn = document.styles['Normal'].font fontn.size = Pt(9) fontn.name = 'Frutiger LT 45' fontn.color.rgb = RGBColor(31, 73, 125) document.add_heading('PHAST Discharge Analysis - ' + folder, level=0) ISs = [] for e in lEvent: pvis,hole,weather = e.Key.split("\\") if not (pvis in ISs): ISs.append(pvis) nbr=1 for IS in ISs: document.add_heading(IS, level=1) for e in lEvent: pvis,hole,weather = e.Key.split("\\") if IS == pvis: # fn = 'C\\'+folder+'\\C_'+slugify(e.Key)+'.png' pngfilename = "TVD-"+pvis+"_"+hole fn = slugify(pngfilename) document.add_picture(".\\tvd_rev.B\\"+fn+".png", width=Cm(13)) p = document.add_paragraph('Figure '+str(nbr) + " - " + pvis + " Hole: " + hole) nbr = nbr +1 document.add_page_break() document.save('tvd_'+folder+'.docx')
[ "dr.sunghoon.kim@gmail.com" ]
dr.sunghoon.kim@gmail.com
0ecd07731b356d536fe9a4dc781886663a0a62e4
2fcb8038c7f87da4ae2408f45bb8cdf40e1b90e3
/myTest/global/global.py
7f77d11b5bb4b13e5a770f4f5568bdef67631be6
[]
no_license
JokerZhu/PythonLearn
dceb8cb8fbf5b4e1edce4ca96ce847ed38056cce
27c2f53e8e1c53b9e680b6558797a2cab695561e
refs/heads/master
2020-04-16T07:42:47.384470
2018-09-12T09:51:21
2018-09-12T09:51:21
36,870,000
2
0
null
null
null
null
UTF-8
Python
false
false
146
py
#!/usr/bin/python3.4 x = 50 def func(): global x print('x的值是', x) x = 2 print('全局变量x改为', x) func() print('x的值是', x)
[ "z_jing_wei_10@163.com" ]
z_jing_wei_10@163.com
7080cff6932dd365f3332a5487091c0646eb9781
aae9baf451966e81ad48846f5df123351fefe3d1
/test_circle.py
ca1ce892406841b4bde33c55a5b4c149f3a12f36
[]
no_license
7esting/py-repo
39b50ebb71d628bdb8710573c38076ecf1325fcc
94e413a9f4bbb4b05240ce7fbc2935620372c35d
refs/heads/master
2020-04-08T11:23:44.136753
2019-01-30T08:19:07
2019-01-30T08:19:07
159,303,262
0
0
null
null
null
null
UTF-8
Python
false
false
751
py
"""Unit Tests. \"Trust but verify.\" - Shakesphere.""" # File name: test_circles.py import unittest from circles import circle_area from math import pi class TestCircleArea(unittest.TestCase): def test_area(self): # Test areas when radius >= 0 self.assertAlmostEqual(circle_area(1), pi) self.assertAlmostEqual(circle_area(0), 0) self.assertAlmostEqual(circle_area(2.1), pi * 2.1**2) def test_values(self): # Make sure value errors are raised when necessary self.assertRaises(ValueError, circle_area, -2) def test_types(self): # Make sure type errors are raised when necessary self.assertRaises(TypeError, circle_area, 3+5j) self.assertRaises(TypeError, circle_area, True) self.assertRaises(TypeError, circle_area, "radius")
[ "7esting@gmail.com" ]
7esting@gmail.com
31cdcf71be688cfac6a59016037fa0c88fbc9eec
6dfdacb37c29778768c1384e88a7bb40a60ffd9f
/CS_AppsStore/project_env_appstore/lib/python3.7/site-packages/CS_AppsStore/tycho_nextflow/deployment.py
b3ef401b74ab3f71d21760201696de8bc080f920
[]
no_license
ananyagithub2/test_allauth
03235a77e4d92ef0fb15d7ac02f6a31cb9bef85c
1266742505e27d4329222cadebab982ce85d1d67
refs/heads/master
2022-04-03T02:12:28.322767
2020-02-24T16:12:01
2020-02-24T16:12:01
242,587,241
0
0
null
null
null
null
UTF-8
Python
false
false
2,267
py
import os import yaml from tycho.client import TychoClientFactory import time from django.http import HttpResponseRedirect def deploy(): try: client_factory = TychoClientFactory() client = client_factory.get_client() tycho_url = client.url print(f"TYCHO URL: {tycho_url}") except Exception as e: tycho_url = "http://localhost:5000/system" print(f"TYCHO URL: {tycho_url}") client = TychoClient("172.25.16.132:8099") base_dir = os.path.dirname(os.path.dirname(__file__)) data_dir = os.path.join(base_dir, "tycho_nextflow", "data") spec_path = os.path.join(data_dir, "docker-compose.yaml") print(data_dir) """ Load settings. """ env_file = os.path.join(data_dir, ".env") if os.path.exists(env_file): with open(env_file, 'r') as stream: settings = stream.read() settings_dict = client.parse_env(settings) """ Load docker-compose file consisting of system spec """ with open(spec_path, "r") as stream: structure = yaml.load(stream) request = { "name": "nextflow", "env": settings_dict, "system": structure, "services": { "nextflow": { "port": settings_dict['HOST_PORT'] } } } print(request) tycho_system = client.start(request) guid = tycho_system.identifier status = tycho_system.status services = tycho_system.services if status != 'success': raise Exception("Error encountered while starting jupyter-datascience service: " + status) for service in services: name = service.name if name == 'nextflow': ip_address = service.ip_address port = service.port port = settings_dict['HOST_PORT'] print('ip_address: ' + ip_address) print('port: ' + str(port)) break if ip_address == '' or ip_address == '--': raise Exception("ip_address is invalid: " + ip_address) if port == '' or port == '--': raise Exception("port is invalid: " + port) redirect_url = 'http://' + ip_address + ':' + str(port) print('redirecting to ' + redirect_url) return redirect_url
[ "ananyam@rciadmins-MacBook-Pro.local" ]
ananyam@rciadmins-MacBook-Pro.local
58881bd351dcea4ee757f3d9e6d5131f643fa74a
0df1ccb1af31d5ce9d32af640ad948525ddc9ac3
/session.py
5689aded565c670bed65a3fb531cc0359f6cd362
[ "Apache-2.0" ]
permissive
SsureyMoon/Python-GoogleAppEngine
0d5b6bb8252aed14de9c1df26964905ece6bb80f
8afd367fcaf379a63f39e0077a75c3d06543a744
refs/heads/master
2020-04-06T21:55:44.552332
2015-06-20T08:04:12
2015-06-20T08:04:12
37,762,607
0
0
null
null
null
null
UTF-8
Python
false
false
24,096
py
import json from datetime import datetime from itertools import ifilter import endpoints from google.appengine.api import memcache from google.appengine.ext import ndb from protorpc import messages from protorpc import message_types from protorpc import remote from core import EMAIL_SCOPE, API_EXPLORER_CLIENT_ID,\ SESSION_FIELDS, OPERATORS, OPERATOR_LOOKUP from models import BooleanMessage, ConflictException from models.profile import Profile from models.session import Session, SessionForm, SessionForms,\ SessionQueryForms, TypeOfSession, FeaturedSpeakerList, FeaturedSpeaker from settings import WEB_CLIENT_ID from utils import getProfileFromUser from utils import getUserId # - - - - Request messages - - - - - - - - - - - - - - - - - - - # Attributes: # - SessionForm: Session inbound form data # - websafeConferenceKey: Conference Key (web safe encoded) # Usage: # - create a session entity with a given info. SESSION_POST_REQUEST = endpoints.ResourceContainer( SessionForm, websafeConferenceKey=messages.StringField(1), ) # Attributes: # - websafeConferenceKey: Conference Key (web safe encoded) # Usage: # - Get all sessions' info. in the given conference SESSION_GET_REQUEST = endpoints.ResourceContainer( message_types.VoidMessage, websafeConferenceKey=messages.StringField(1), ) # Attributes: # - speaker: Speaker's name to search for sessions # Usage: # - Get all sessions which the given speaker belong to SESSION_GET_BY_SPEAKER_REQUEST = endpoints.ResourceContainer( message_types.VoidMessage, speaker=messages.StringField(1), ) # Attributes: # - typeOfSession: Type of session # one of [NOT_SPECIFIED, LECTURE, KEYNOTE, WORKSHOP, DEMO, SOCIAL] # - websafeConferenceKey: Conference Key (web safe encoded) # Usage: # - Get all sessions which contain the given typeOfSession. SESSION_GET_BY_TYPE_REQUEST = endpoints.ResourceContainer( message_types.VoidMessage, typeOfSession=messages.StringField(1), websafeConferenceKey=messages.StringField(2), ) # Attributes: # - websafeSessionKey: Session Key (web safe encoded) # Usage: # - Allows a user to add the given session to their wishlist SESSION_POST_WISHLIST_REQUEST = endpoints.ResourceContainer( message_types.VoidMessage, websafeSessionKey=messages.StringField(1), ) @endpoints.api(name='sessions', version='v1', allowed_client_ids=[WEB_CLIENT_ID, API_EXPLORER_CLIENT_ID], scopes=[EMAIL_SCOPE]) class SessionApi(remote.Service): """Session API v0.1 This class is of conference api. This class is consist of endpoint methods and helper methods. Attributes: @endpoints - getConferenceSessions(websafeConferenceKey): retrieve all sessions of the given conference key and return it as a response - getConferenceSessionsByType(websafeConferenceKey, typeOfSession): retrieve all sessions which are of the given type in the given conference - getSessionsBySpeaker(): return all sessions given by the particular speaker, across all conferences - createSession(websafeConferenceKey): create a new session in the given conference with ```request.fields``` and return the result If a session with the speaker already exist, append the speaker and the list of their sessions to memcache with this key: "featured_speakers" See also: _cacheSession(speaker, confKey) - addSessionToWishlist(websafeSessionKey): a current user add the given conference in their wishlist - getSessionsInWishlist(): get all the sessions that the user has added to their wishlist - querySessions(): query sessions with a form which is consist of field operator, and value. Example: START_TIME < 02 15 PM and TYPE_OF_SESSION != WORKSHOP - getFeaturedSpeaker(): get featured speakers who have more than one session in a given conference and list of their sessions' names retrieve data from memcache with this key: "featured_speakers" See also: _cacheSession(speaker, confKey) helper: _copySessionToForm(session): convert data(session) from database into Session form message _createSessionObject(request): convert data from inbound from message, so it fits in Session model. Create a new session entity _cacheSession(speaker, confKey): _getQuery(request): retrieve data from database using formatted filters. See also: _formatFilters _formatFilters(filters): Format multiple filters into a list of python dictionary. The method _getQuery takes this return list. Use _lambaFilter to do in-memory filtering See also: _lambaFilter _lambaFilter(x, filter): x is from ```ifilter(lambda x: _lambaFilter(x, filter), sessions)``` Provide a lamba function for list filtering _convertTimeToInt(timeData): Convert Time object(hour, minute, AM/PM) to integer, so it can be compared to other time column in database _recoverIntToTime(timeInteger): Recover Time object(hour, minute, AM/PM) from integer in database, so it fits in Session outbound form message """ # - - - - API endpoints - - - - - - - - - - - - - - - - - - - - - - - - - - @endpoints.method(SESSION_GET_REQUEST, SessionForms, path='conference/{websafeConferenceKey}/session', http_method='GET', name='getConferenceSessions') def getConferenceSessions(self, request): # Given a conference, return all sessions c_key = ndb.Key(urlsafe=request.websafeConferenceKey) q = Session.query() sessions = q.filter(Session.conferenceKeyBelongTo == c_key.urlsafe()) return SessionForms( items=[self._copySessionToForm(sf) for sf in sessions] ) @endpoints.method(SESSION_GET_BY_TYPE_REQUEST, SessionForms, path='conference/{websafeConferenceKey}/' 'session/{typeOfSession}', http_method='GET', name='getConferenceSessionsByType') def getConferenceSessionsByType(self, request): # Given a conference, return all sessions # of a specified type (eg lecture, keynote, workshop) c_key = ndb.Key(urlsafe=request.websafeConferenceKey) q = Session.query() q = q.filter(Session.conferenceKeyBelongTo == c_key.urlsafe()) sessions = q.filter(Session.typeOfSession == request.typeOfSession) return SessionForms( items=[self._copySessionToForm(sf) for sf in sessions] ) @endpoints.method(SESSION_GET_BY_SPEAKER_REQUEST, SessionForms, path='session/{speaker}', http_method='GET', name='getSessionsBySpeaker') def getSessionsBySpeaker(self, request): # Given a speaker, return all sessions given # by this particular speaker, across all conferences q = Session.query() sessions = q.filter(Session.speaker == request.speaker) return SessionForms( items=[self._copySessionToForm(sf) for sf in sessions] ) @endpoints.method(SESSION_POST_REQUEST, SessionForm, path='conference/{websafeConferenceKey}/session', http_method='POST', name='createSession') def createSession(self, request): # Create a session object from form data and save it to database # Return a session object created # See also: _createSessionObject return self._createSessionObject(request) @endpoints.method(SESSION_POST_WISHLIST_REQUEST, BooleanMessage, path='wishlist/session/{websafeSessionKey}', http_method='POST', name='addSessionToWishlist') def addSessionToWishlist(self, request): # Adds the session to the user's list of sessions # which the user is interested in attending to user = endpoints.get_current_user() if not user: raise endpoints.UnauthorizedException('Authorization required') # get a profile object prof = getProfileFromUser(user) wssk = request.websafeSessionKey session = ndb.Key(urlsafe=wssk).get() if not session: raise endpoints.NotFoundException( 'No session found with key: %s' % wssk) if wssk in prof.sessionKeysInWhishlist: raise ConflictException( "You have already added this session") # append this web safe session key to the list prof.sessionKeysInWhishlist.append(wssk) prof.put() retval = True return BooleanMessage(data=retval) @endpoints.method(message_types.VoidMessage, SessionForms, path='wishlist', http_method='GET', name='getSessionsInWishlist') def getSessionsInWishlist(self, request): # Get all the sessions that the user has added to their wishlist user = endpoints.get_current_user() if not user: raise endpoints.UnauthorizedException('Authorization required') prof = getProfileFromUser(user) # Get a list of session keys session_keys = [ndb.Key(urlsafe=wssk) for wssk in prof.sessionKeysInWhishlist] sessions = ndb.get_multi(session_keys) # return set of SessionForm objects per Session return SessionForms(items=[self._copySessionToForm(session) for session in sessions] ) @endpoints.method(SessionQueryForms, SessionForms, path='querySessions', http_method='POST', name='querySessions') def querySessions(self, request): """Query for conferences.""" sessions = self._getQuery(request) # return individual SessionForm object per Session # See also: _getQuery, _formatFilters, _lambdaFilter return SessionForms( items=[self._copySessionToForm(session) for session in sessions] ) @endpoints.method(message_types.VoidMessage, FeaturedSpeakerList, path='get-featured-speaker', http_method='GET', name='getFeaturedSpeaker') def getFeaturedSpeaker(self): # Get a json object of featured speakers # and a list of their session # Featured Speaker: speakers who have more than one session # in a conference featured = memcache.get("featured_speakers") if not featured: return FeaturedSpeakerList(items=[]) # We store jsonify string to mecache featured_json = json.loads(featured) # return list of FeaturedSpeaker # FeaturedSpeaker has two attr. speaker(name), sessionNames return FeaturedSpeakerList( items=[FeaturedSpeaker( speaker=speaker, sessionNames=featured_json[speaker]) for speaker in featured_json] ) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - Helper methods - - - - - - - - - - - - - - - - - - def _copySessionToForm(self, session): """Copy relevant fields from Conference to ConferenceForm.""" sf = SessionForm() for field in sf.all_fields(): if hasattr(session, field.name): if field.name == "websafeKey": # URL safe session key setattr(sf, field.name, session.key.urlsafe()) elif field.name == "date": # date type has to be stored as DateProperty setattr(sf, field.name, str(getattr(session, field.name))) elif field.name == "startTime": # startTime has to be stored as Integer, # so it is easy to Query, # such as Filter Sessions before 07 00 PM, # since 07 00 PM is converted to 1140 # See also _recoverIntToTime setattr(sf, field.name, self._recoverIntToTime( getattr(session, field.name) ) ) elif field.name == "typeOfSession": # type of session is of list type tmp = [] for type in getattr(session, field.name): tmp.append(getattr(TypeOfSession, str(type))) setattr(sf, field.name, tmp) else: setattr(sf, field.name, getattr(session, field.name)) return sf def _createSessionObject(self, request): """Create Session object, returning SessionForm/request.""" user = endpoints.get_current_user() if not user: raise endpoints.UnauthorizedException('Authorization required') user_id = getUserId(user) # Copy SessionForm/ProtoRPC Message into dict data = {field.name: getattr(request, field.name) for field in request.all_fields()} wsck = request.websafeConferenceKey conf = ndb.Key(urlsafe=wsck).get() if not conf: raise endpoints.NotFoundException('No such conference exist') if not conf.organizerUserId == user_id: raise endpoints.UnauthorizedException('Authorization required') # Delete properties which are not in the Session data model del data['websafeConferenceKey'] del data['organizerDisplayName'] if data['date']: data['date'] = datetime.strptime(data['date'], "%Y-%m-%d").date() # Convert dates from strings to Time objects # and convert it to integer # See also: _convertTimeToInt if data['startTime']: start_time = self._convertTimeToInt( datetime.strptime(data['startTime'], "%I %M %p").time() ) data['startTime'] = start_time # Allocate new Session ID with a given conference key as parent s_id = Session.allocate_ids(size=1, parent=conf.key)[0] # Make session key from ID s_key = ndb.Key(Session, s_id, parent=conf.key) data['key'] = s_key data['organizerUserId'] = request.organizerUserId = user_id data['conferenceKeyBelongTo'] = wsck # store a list of types of session to database type_of_session = [] for type in data['typeOfSession']: type_of_session.append(str(getattr(TypeOfSession, str(type)))) if len(type_of_session) > 0: data['typeOfSession'] = type_of_session Session(**data).put() if data["speaker"]: # If the inbound session form has speaker value # call _cacheSession to determine # if the speaker is a feature speaker, # and if so, save the info. to memcache as a jsonified string # See also: _cacheSession self._cacheSession(data["speaker"], data['conferenceKeyBelongTo']) # return the result as an outbound session form message sf = SessionForm() for field in sf.all_fields(): if hasattr(request, field.name): if field.name == "websafeKey": # URL safe session key setattr(sf, field.name, s_key.urlsafe()) else: setattr(sf, field.name, getattr(request, field.name)) return sf @staticmethod def _cacheSession(speaker, confKey): # Check if the given speaker already exist, # if so, append the speaker's name and the list of session # to memcache with the key, ```featured_speakers``` sessions = Session.query(ndb.AND( Session.speaker == speaker, Session.conferenceKeyBelongTo == confKey )).fetch(projection=[Session.name]) if len(sessions) > 1: featured_speakers = memcache.get("featured_speakers") if not featured_speakers: memcache.set("featured_speakers", json.dumps( [{speaker: [session.name for session in sessions]}] )) else: # If the memcache already exist, # append a new info to the value already exists featured_speakers_dict = json.loads(featured_speakers) featured_speakers_dict[speaker] =\ [session.name for session in sessions] memcache.set("featured_speakers", json.dumps(featured_speakers_dict)) def _getQuery(self, request): """Return formatted query from the submitted filters.""" q = Session.query() inequality_filters, filters = self._formatFilters(request.filters) if len(inequality_filters) <= 1: # if there is no inequality filter if len(inequality_filters) == 1: # If an inequality_filter exists, # sort on the inequality filter first q = q.order(ndb.GenericProperty( inequality_filters[0]["field"] ) ) q = q.order(Session.name) for filtr in filters: if filtr["field"] == "startTime": # convert startTime to integer, # since it is stored as integer type filtr["value"] = int(filtr["value"]) formatted_query = ndb.query.FilterNode( filtr["field"], filtr["operator"], filtr["value"]) q = q.filter(formatted_query) return q else: # If there are more than two inequality filters, # we need to handle inequality filters separately, # and do in-memory filtering to get data we want inequality_filter_key_set = [x["field"] for x in inequality_filters] # Do equality filters first for filtr in filters: if filtr["field"] not in inequality_filter_key_set: if filtr["field"] == "startTime": filtr["value"] = int(filtr["value"]) formatted_query = ndb.query.FilterNode( filtr["field"], filtr["operator"], filtr["value"]) q = q.filter(formatted_query) first_time = True for inequality_filter in inequality_filters: if first_time: # Execute the first equality filter if inequality_filter["field"] == "startTime": inequality_filter["value"] =\ int(inequality_filter["value"]) formatted_query = ndb.query.FilterNode( inequality_filter["field"], inequality_filter["operator"], inequality_filter["value"] ) first_time = False sessions = q.filter(formatted_query) else: # From the second inequality filter # we need to preform list filtering if inequality_filter["field"] == "startTime": inequality_filter["value"] =\ int(inequality_filter["value"]) # Perform lambda function filtering for each session object # lambda function returns true # if the session object satisfy the given filter # See also: _lambaFilter sessions = ifilter( lambda x: self._lambaFilter(x, inequality_filter), sessions ) return sessions def _lambaFilter(self, x, inequality_filter): if isinstance(getattr(x, inequality_filter["field"]), list): # If the filter value is of a type of list, # such as type of session, # change != to ```not in``` return inequality_filter["value"]\ not in getattr(x, inequality_filter["field"]) else: # By using OPERATOR LOOKUP Table we can get python operators # Example: # - != : operator.ne # - > : operator.gt return OPERATOR_LOOKUP[ inequality_filter["operator"] ](getattr(x, inequality_filter["field"]), inequality_filter["value"] ) def _formatFilters(self, filters): """Parse, check validity and format user supplied filters.""" formatted_filters = [] inequality_filters = [] for f in filters: filtr = {field.name: getattr(f, field.name) for field in f.all_fields()} try: filtr["field"] = SESSION_FIELDS[filtr["field"]] filtr["operator"] = OPERATORS[filtr["operator"]] if filtr["field"] == "startTime": filtr['value'] = self._convertTimeToInt( datetime.strptime(filtr['value'], "%I %M %p") ) if filtr["field"] == "date": filtr['value'] =\ datetime.strptime(filtr['value'], "%Y-%m-%d").date() except KeyError: raise endpoints.BadRequestException( "Filter contains invalid field or operator.") # Every operation except "=" is an inequality if filtr["operator"] != "=": # check if inequality operation # has been used in previous filters # disallow the filter if inequality was performed # on a different field before # track the field # on which the inequality operation is performed # store inequality filters separately inequality_filters.append(filtr) formatted_filters.append(filtr) return (inequality_filters, formatted_filters) def _convertTimeToInt(self, timeData): """ convert a time property to an integer Usage: SessionForm -> Session database model :param timeData: strptime(hour, minute, AM/PM).time() :return: integer """ try: return timeData.hour * 60 + timeData.minute except: raise endpoints.BadRequestException("Invalid time format") def _recoverIntToTime(self, timeInteger): """ recover a time property from an integer Usage: Session database model -> SessionForm :param timeInteger :return: strptime(hour, minute, AM/PM).time() """ hour = int(timeInteger / 60) loc = "AM" if hour > 12: hour = hour - 12 loc = "PM" minute = timeInteger % 60 return " ".join([str(hour), str(minute), loc])
[ "ssureymoon@gmail.com" ]
ssureymoon@gmail.com
29ef0030765216e8ee664d7ecb0a5486c0605619
6e5590d564125dc9261d6749ea896acf2e70c019
/release/create-constraints.py
91b80821357ddcfe120340469fd1aa23488c1c31
[]
no_license
andreasma/buildout.coredev
fdf6355b3e9f9732dad6d238b18f6aef22866b34
1030e2ec271b91484eb774f9c97ca6eaada44d79
refs/heads/5.2
2021-12-29T07:18:41.440633
2021-12-06T08:20:02
2021-12-06T08:20:02
240,798,449
0
0
null
2020-02-18T16:14:02
2020-02-15T22:45:09
Python
UTF-8
Python
false
false
2,020
py
# -*- coding: utf-8 -*- """Parse versions from buildout.cfg and write them into constraints.txt. This script is called by 'tox -c release/tox.ini -e constraints2' or constraints3 It must work in both Python 2 and 3. Manual usage: bin/python create-constraints.py zc.buildout needs to be importable in that python. """ from zc.buildout import buildout import os import sys # List packages that we should not include for a Python version. # This is for when we have no control over it: the pin is in Zope versions. DENYLIST2 = [ # These are packages that cannot be installed by pip on Python 2. "sphinxcontrib-serializinghtml", ] DENYLIST3 = [ # These are packages that cannot be installed by pip on Python 3. "Products.contentmigration", ] # We could hardcode paths here, but working directories in tox confuse me. if not len(sys.argv) == 3: print("ERROR. Usage: create-constraints.py buildout.cfg constraints.txt") sys.exit(1) config_file = sys.argv[1] constraints_file = sys.argv[2] constraints_file = os.path.realpath(os.path.join(os.getcwd(), constraints_file)) config = buildout.Buildout(config_file, []) # Get the constraints from the version pins. # Nice: the versions get set directly on the config. # Note: this works like a dictionary, but is a class 'zc.buildout.buildout.Options'. versions = config.versions with open(constraints_file, "w") as cfile: cfile.write("# File created by {}\n".format(__file__)) cfile.write("# Constraints parsed from {}\n".format(config_file)) for package, version in sorted(versions.items()): if sys.version_info.major == 2 and package in DENYLIST2: print("Ignoring blacklisted package {}".format(package)) continue if sys.version_info.major == 3 and package in DENYLIST3: print("Ignoring blacklisted package {}".format(package)) continue cfile.write("{}=={}\n".format(package, version)) print("Wrote all versions as constraints to {}".format(constraints_file))
[ "maurits@vanrees.org" ]
maurits@vanrees.org
def4314c7820727d47ae584b6003a9ba2b1c1f8f
e070ae82ebca838948bda28882b99bce036d1b9f
/spider/telegram.py
9cce7b7b884a9ab7d35099a5a1d6d49537eaecbb
[]
no_license
sheng2333/new_resources
e29bd7ab3af07259957d498b4221a1b3c56a2172
96987e79abcc5fbb1bcd74e9c96b7cfa20eb3e6d
refs/heads/master
2020-04-19T08:18:18.729854
2018-12-27T11:23:18
2018-12-27T11:23:18
168,072,230
1
3
null
2019-02-16T05:25:05
2019-01-29T02:08:46
Python
UTF-8
Python
false
false
4,599
py
import sys import os sys.path.append("./../") from db.mongodb import connectMongo import requests from lxml import etree from tools.translate.translate_google import mainTranslate import time import logging # 全局变量 类对象 telegramObj = None telegramResourcecollection = None telegramUrlColletion = None class MongoDB(): def __init__(self): pass def connectMongo(self): mongodb = connectMongo(True) return mongodb class Telegram(): def __init__(self): pass def dealResult(self, result): url = result["url"] responseHtml = sendRequest(url) if not responseHtml: logging.error("访问url:{}没有响应文本".format(url)) return self.dealResponse(responseHtml, result) def dealResponse(self, responseHtml, result): url = result["url"] selector = etree.HTML(responseHtml) # 标题 title = selector.xpath("//title/text()") if title: title = title[0] else: logging.error("没有获取到标题:{}".format(url)) title = "" # page title pageTitle = selector.xpath('//div[@class="tgme_page_title"]/text()') if not pageTitle: logging.error("没有获取到网页标题:{}".format(url)) pageTitle = "" else: pageTitle = pageTitle[0].strip() # 成员信息 memberInfo = selector.xpath('//div[@class="tgme_page_extra"]/text()') if not memberInfo: logging.error("没有获取到成员信息:{}".format(url)) memberInfo = "" else: memberInfo = memberInfo[0].strip() # 描述信息 descInfo = selector.xpath('//div[@class="tgme_page_description"]//text()') if descInfo: descInfo = "\n".join(descInfo).strip() else: logging.error("没有获取到描述信息{}".format(url)) descInfo = "" self.dealItem(title, pageTitle, memberInfo, descInfo, result) def dealItem(self, title, pageTitle, memberInfo, descInfo, result): # 翻译描述信息 if descInfo: descInfoCN = mainTranslate(descInfo) else: descInfoCN = "" item = { "_id": result["part"] + "_" + result["url"], "url": result["url"], "keyWord": result["keyWord"], "language": result["language"], "name": result["name"], "part": result["part"], "station": result["station"], "title": title, "pageTitle": pageTitle, "memberInfo": memberInfo, "descInfo": descInfo, "descInfoCN": descInfoCN, "country": "" } self.insertItem(item) def insertItem(self, item): global telegramResourcecollection global telegramUrlColletion try: telegramResourcecollection.insert(dict(item)) logging.info("新增telegram信息成功,url:{}".format(item["url"])) # 更新 url状态 except Exception as e: logging.exception(e) telegramUrlColletion.update_one({"url": item["url"], "part": item["part"]}, {"$set": {"isData": True}}) def sendRequest(url): for i in range(3): try: response = requests.get(url=url, timeout=10) response.encoding == "utf-8" if response.status_code == 200: return response.content else: logging.warn("访问url:{}状态码:{}".format(url, response.status_code)) except Exception as e: logging.exception(e) def readMongo(mongodb): global telegramObj global telegramResourcecollection global telegramUrlColletion telegramUrlColletion = mongodb["telegramUrl"] telegramResourcecollection = mongodb["telegramResource"] while True: resultList = list(telegramUrlColletion.find({"isData": False}).limit(100)) if not resultList: logging.error("没有需要搜索的tele数据:{}".format(int(time.time()))) time.sleep(60) continue for result in resultList: telegramObj.dealResult(result) def mainRun(): global telegramObj # 创建telegram对象 telegramObj = Telegram() # 创建mongo对象 并生成数据库 mongoObj = MongoDB() mongodb = mongoObj.connectMongo() # 读取数据库,查询未被搜索的数据 readMongo(mongodb) if __name__ == '__main__': mainRun()
[ "huguangjing@globalegrow.com" ]
huguangjing@globalegrow.com
76f8ac209548c5d2c1fd9f573f7d8158456d853f
42eace12c1d6b54b775e1ff9dce9a1726b5048d0
/job/migrations/0002_auto_20181206_1218.py
0b0685dae1af7fa9f9eba1916eb6462666c93f3c
[]
no_license
macmohan26/PortfolioBlogwebapp
c9b9936cb638c2eb672667114fdaa4680b47b932
ff5675d304edb13c29ff725fbb8aa9155402054a
refs/heads/master
2020-04-11T14:29:07.023266
2018-12-15T02:07:10
2018-12-15T02:07:10
161,856,763
0
0
null
null
null
null
UTF-8
Python
false
false
1,570
py
# Generated by Django 2.0.5 on 2018-12-06 17:18 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('job', '0001_initial'), ] operations = [ migrations.CreateModel( name='Work', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(default='', max_length=250)), ('slug', models.SlugField(default='', max_length=250, unique_for_date='publish')), ('image', models.ImageField(default='', upload_to='images/')), ('body', models.TextField(default='')), ('publish', models.DateTimeField(default=django.utils.timezone.now)), ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), ('status', models.CharField(choices=[('draft', 'Draft'), ('published', 'Published')], default='draft', max_length=10)), ('author', models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, related_name='job_works', to=settings.AUTH_USER_MODEL)), ], options={ 'ordering': ('-publish',), }, ), migrations.DeleteModel( name='Job', ), ]
[ "mrathore@unomaha.edu" ]
mrathore@unomaha.edu
a907b10a10fa739cebb6a2d9d28ef3ddc01bc2f9
e770533cc7d8517134d6f9159f5f9e52747c7153
/python/04selenium/selenium014.py
88e3348deb7fa6521253c9474ea652722cafae13
[]
no_license
code1990/bootPython
5d878f7fac8aaa09a2b9e4a6d50a3c0f86c6dea5
e5debd59b07a2c713f3e692aa4f44a9d2e5baeae
refs/heads/master
2022-07-27T04:31:00.292692
2020-08-07T07:07:15
2020-08-07T07:07:23
206,805,170
0
0
null
2020-10-13T15:51:34
2019-09-06T13:56:39
Python
UTF-8
Python
false
false
634
py
# (十四)下拉框选择 from selenium import webdriver from selenium.webdriver.support.select import Select from time import sleep driver = webdriver.Chrome(executable_path='C:\driver\chromedriver.exe') driver.implicitly_wait(10) driver.get('http://www.baidu.com') # 鼠标悬停至“设置”链接 driver.find_element_by_link_text('设置').click() sleep(1) # 打开搜索设置 driver.find_element_by_link_text("搜索设置").click() sleep(2) # 搜索结果显示条数 sel = driver.find_element_by_xpath("//select[@id='nr']") Select(sel).select_by_value('50') # 显示50条 # …… driver.quit()
[ "s1332177151@sina.com" ]
s1332177151@sina.com
50f2430a2f70ad89b97ecf0b80ada7989f14448c
9732fe676f4618c78b3ffd482d2c50347077a84c
/Search item 1st occurrence.py
dbab754a2f4d41c7a0ea5e1c289ec95df6209010
[]
no_license
Abhijeet198/Python-Program
16a733391d2420183613ae6797aad3a5360a0808
ead71392d7bb26de0b3cd9eb896a10f186f93395
refs/heads/master
2020-12-23T17:32:26.734934
2020-04-03T05:20:23
2020-04-03T05:20:23
237,219,738
0
0
null
null
null
null
UTF-8
Python
false
false
527
py
# Search item's 1st occurrence - index() mytuple=(1,3,5,7,2,3,1,4,6,7,8,1,2,3,1,) num = int(input("Enter item to be searched")) x = mytuple.index(num) print("First occurrence of the",num,"is at index:",x) # Count Occurrence of items-count() #count()>> number of times the item appears in the Tuple print("Tuple:",mytuple) n = mytuple.count(3) print("Total count of 3 in the tuple is:",n) # Delete tuple (del keyword) print("Tuple Content:",mytuple) del mytuple print("Tuple is deleted")
[ "noreply@github.com" ]
noreply@github.com
e6de3511f6f2fdee9e45700e02bc864b73345fc4
c66074d8815887a1faf6e67d35ff041af3fffb0e
/LivingMachines2013_9/gamePopulationClass.py
5b0aa363288406bac806f80d9dbdbf7749908b26
[]
no_license
rheiland/DarwinianNeurodynamics
b1eda114df838ccfbc2cd80f7832b594f70e1da4
602cdffaeef808b1e8029afcf7e7c9b0f71e8b0c
refs/heads/master
2021-01-18T10:53:27.372958
2013-04-22T15:01:08
2013-04-22T15:01:08
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,488
py
from naoqi import * import math import almath import random from gameClass import gameClass global actors import copy class gamePopulationClass(ALModule): """Game population class""" def __init__(self,name, type): ALModule.__init__(self,name) self.isRunning=True self.mm = ALProxy("memoryManager") game0 = gameClass(nameA = "game", count = 0, messages = [0,3,6,9,12,15,18,21,24,27], function = "maximize") self.games = [game0] def clearMessageHistories(self): for index, i in enumerate(self.games): self.games[index].clearMessageHistory() def storeObservedMessages(self): for index, i in enumerate(self.games): self.games[index].storeObservedMessages() def getMoleculeFitness(self): fitnessAllGames = [] for index, i in enumerate(self.games): fitnessAllGames.append(self.games[index].getMoleculeFitness()) return fitnessAllGames def removeGameMessages(self, message): for index, i in enumerate(self.games): self.games[index].removeGameMessages(message) def updateGameMessages(self, fromM, toM): for index, i in enumerate(self.games): self.games[index].updateGameMessages(fromM, toM) def exit(self): print "Exiting game populaton" try: pass except: pass self.isRunning=False ALModule.exit(self)
[ "ctf20@sussex.ac.uk" ]
ctf20@sussex.ac.uk
d54cc75966e856301a0dcf4985642e9a0b5898a5
baf72cca99b66cca6f6300fcb9f89a39845ee3fd
/dashboard/migrations/0003_post_views.py
380588cf59b5dd62b8983c6a8d4f9f98fa944122
[]
no_license
anisiomarrime/tol-uat
54af169c1f7f7a9300b01a3c513b7c05f5d6d8ff
91d598987e958ca612e6c4854e7d037e22d75a6a
refs/heads/master
2022-12-27T03:29:38.510438
2020-09-29T16:50:17
2020-09-29T16:50:17
299,680,972
0
0
null
null
null
null
UTF-8
Python
false
false
382
py
# Generated by Django 2.2.7 on 2020-03-05 13:07 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('dashboard', '0002_auto_20200305_1231'), ] operations = [ migrations.AddField( model_name='post', name='views', field=models.IntegerField(default=0), ), ]
[ "anisio.marrime@gmail.com" ]
anisio.marrime@gmail.com
91d54ca42f1b60b27b644774e15e6df0c31cf44e
f5d26e1403de16e8bcb022b954ab8f68e8b6733e
/comments/python_comments.py
66d6eed9005fd1fe785bf4c0e8f60d119bbddc65
[ "Apache-2.0" ]
permissive
aryanz-co-in/python-comments-variables-type-casting-operators
823fe24e840ddc68b7c7a82c6a4cf10a37d6739b
cdc1ccdb6ccc32c539b988e9169c6ff7d585bea2
refs/heads/main
2023-02-25T11:11:05.448802
2021-01-31T13:19:18
2021-01-31T13:19:18
330,080,631
0
0
null
null
null
null
UTF-8
Python
false
false
876
py
# Python Comments # Single line comment print("End of line comment, which will ignore anything after # and treat is as comment \n\n") # End of line comments # This # is # Multi line comments print("Multi line comment is nothing but using the # to be prefixed at start of the line.\n\n") """ Well this is also another way to write multi line comments. This is actually a string value in multi line since this is not assigned to any variable, it is treated as multi line comments. Let's see it by assigning a variable and print the variable to see what will happen. """ # print(f"Lets print the multiline string \n {s1}") x = 4 y = 2 z = 0 # z = x + y # z = x - y print(z) print("This is used while debugging, its single line " "comment but we have commented the code logic itself" " which will be ignored by the Python interpreter while executing")
[ "balamurugan.th@gmail.com" ]
balamurugan.th@gmail.com
5704a6e8200a1842c1da7c558ef26fbc91662ce3
c071eb46184635818e8349ce9c2a78d6c6e460fc
/system/python_stubs/-745935208/_ast/Eq.py
65f93d36a7d2abe45c41f6fe9cdfc0b757574bc7
[]
no_license
sidbmw/PyCharm-Settings
a71bc594c83829a1522e215155686381b8ac5c6e
083f9fe945ee5358346e5d86b17130d521d1b954
refs/heads/master
2020-04-05T14:24:03.216082
2018-12-28T02:29:29
2018-12-28T02:29:29
156,927,399
0
0
null
null
null
null
UTF-8
Python
false
false
347
py
# encoding: utf-8 # module _ast # from C:\Users\siddh\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\core\_dummy.cp37-win_amd64.pyd # by generator 1.146 # no doc # no imports from .cmpop import cmpop class Eq(cmpop): # no doc def __init__(self, *args, **kwargs): # real signature unknown pass _fields = ()
[ "siddharthnatamai@gmail.com" ]
siddharthnatamai@gmail.com
c5a0b602802047331764d01e3710f4ec2987177d
2b28ef0b41b7d9eccbd54d30951591b84c9abfdb
/codes/DQN.py
38cfe2b25b80ba8ade8b159597ca75e01fd58a8e
[]
no_license
wangzz15/Playing-ViZDoom-based-on-DQN
b83665b6bee9fc757aeea034c04a29fd61f564a4
fba5a17f3e99a5febd0f4cd87fa13d73e1502447
refs/heads/master
2022-11-20T06:22:55.768904
2020-07-20T14:36:50
2020-07-20T14:36:50
281,140,853
0
0
null
null
null
null
UTF-8
Python
false
false
6,431
py
import os import random import numpy as np import torch import torch.nn.functional as F import torch.optim as optim from memory_buffers import ReplayBuffer from nn_models import DQNetwork class StateMotion(): def __init__(self, frame_shape, num_frames, device='cuda:0'): self.num_frames = num_frames self.frame_h = frame_shape[0] self.frame_w = frame_shape[1] self.frame_c = frame_shape[2] self.frame_array = None def update_motion(self, obs): # game.new_episode() if self.frame_array is None: self.frame_array = np.zeros((self.num_frames * self.frame_c, self.frame_h, self.frame_w), dtype=np.uint8) cs = 0 for i in range(self.num_frames): ce = cs + self.frame_c self.frame_array[cs:ce, :, :] = obs.copy() cs = ce else: dest_cs = 0 for i in range(1, self.num_frames): dest_ce = dest_cs + self.frame_c src_cs = dest_ce src_ce = src_cs + self.frame_c self.frame_array[dest_cs:dest_ce, :, :] = self.frame_array[src_cs:src_ce, :, :].copy() dest_cs = dest_ce self.frame_array[-self.frame_c:, :, :] = obs.copy() class DQN(): def __init__(self, frame_shape, num_frames, num_actions, gamma, buffer_size, batch_size, learning_rate, target_q_update_freq, double_q=False, dueling=False, device='cuda:0'): """ The DQN agent. args: frame_shape: The shape of the screen of a frame. type: tuple (height, width, channel) num_frames: The number of frames to construct a motion for a state. type: int num_actions: The number of the actions type: int gamma: The discount factor gamma. type: float buffer_size: The size of the Replay Buffer type: int batch_size: The size of the mini batch for every updating process. type: int learning_rate: The learning rate for the q network. type: float target_q_update_freq: The frequency for updating the target q network. type: int double_q: If using double Q learning. type: boolean device: The device to train the networks. ('cpu' or 'cuda') type: str """ self.frame_shape = frame_shape self.num_frames = num_frames self.num_actions = num_actions self.gamma = gamma self.buffer_size = buffer_size self.batch_size = batch_size self.learning_rate = learning_rate self.target_q_update_freq = target_q_update_freq self.double_q = double_q self.device = device self.dueling = dueling self.num_params_update = 0 self.create_nets() self.memory = ReplayBuffer(self.buffer_size) self.optimizer = optim.Adam(self.q.parameters(), lr=self.learning_rate) def create_nets(self): """ Initialize the q network and target q network. Copy the parameters from q network to target q network. """ self.q = DQNetwork(w=self.frame_shape[1], h=self.frame_shape[0], c=self.frame_shape[2] * self.num_frames, dueling=self.dueling).to(self.device) self.q_target = DQNetwork(w=self.frame_shape[1], h=self.frame_shape[0], c=self.frame_shape[2] * self.num_frames, dueling=self.dueling).to(self.device) self.q_target.load_state_dict(self.q.state_dict()) def sample_action(self, state_motion, epsilon=0.0): """ Sample the action according to epsilon-greedy policy. args: obs: observation from the environment. type: np.ndarray(dtype=np.float) shape: [num_inputs] epsilon: The probability to take a random action. Default is 0.0 type: float """ state_motion = torch.from_numpy(state_motion).unsqueeze(0).float() q_out = self.q(state_motion.to(self.device)) # ramdom sample the acition via epsilon-greedy. random_digit = random.random() action = q_out.argmax().item() if random_digit >= epsilon else random.randint( 0, self.num_actions - 1) return action def calc_loss(self): """ Sample a mini-batch from the replay buffer and then calculate the loss function. """ state_batch, action_batch, reward_batch, next_state_batch, done_mask_batch = self.memory.sample( self.batch_size) # transfer the data to the target device state_batch = state_batch.to(self.device) action_batch = action_batch.to(self.device) reward_batch = reward_batch.to(self.device) next_state_batch = next_state_batch.to(self.device) done_mask_batch = done_mask_batch.to(self.device) q_out = self.q(state_batch) q_values = q_out.gather(1, action_batch) if self.double_q: next_s_max_indice = self.q(next_state_batch).detach().max(dim=1)[ 1].unsqueeze(dim=1) next_s_target_q = self.q_target(next_state_batch) next_s_max_q = next_s_target_q.gather(1, next_s_max_indice) else: next_s_max_q = self.q_target(next_state_batch).detach().max(dim=1)[ 0].unsqueeze(dim=1) expected_q_values = reward_batch + self.gamma * next_s_max_q * done_mask_batch loss = F.smooth_l1_loss(q_values, expected_q_values) return loss def learn(self): loss = self.calc_loss() # updata the q network using optimizer self.optimizer.zero_grad() loss.backward() self.optimizer.step() self.num_params_update += 1 # update the target q network if self.num_params_update % self.target_q_update_freq == 0: self.q_target.load_state_dict(self.q.state_dict()) return loss
[ "wangzz15@tsinghua.org.cn" ]
wangzz15@tsinghua.org.cn
fbfe7a8c892ccaf8a85a6c82938fd2cba4859293
f441537763dd490b6c365bfd7b4f33bbdd62f11f
/robin.py
ebbd036fda491633de65cfec1c48391f66b434f4
[]
no_license
kristopolous/robinhood-analytics
2482934823506088f691f7adf12a2272095ca9b6
59512e955c975a18ee37ba99f1c548b3dd184d6f
refs/heads/master
2022-12-24T12:11:15.957349
2020-10-04T21:57:26
2020-10-05T21:57:26
286,158,739
0
1
null
null
null
null
UTF-8
Python
false
false
12,424
py
#!/usr/bin/env python3 from pyrh import Robinhood import urllib import sys import json import os import dateparser, datetime, time from colr import color import db import lib YEAR = 365.2524 def get_archive(stockList = None): global last if stockList is None: stockList = lib.getsymols() if type(stockList) is str: stockList = [stockList] ix = 0 ttl = 3 * len(stockList) print("Gathering {} stocks".format(len(stockList))) alpha = lib.config.get('alpha') if not alpha: raise("Hey you need to get an alpha advantage key") for name,duration in [('MONTHLY', 365.25/12), ('DAILY', 1), ('WEEKLY',7)]: duration *= (60 * 24) for stock in stockList: stock = stock.upper() print("{:6.3f} {} {} ".format(100 * ix / ttl, name, stock)) force = False while True: ix += 1 url = "https://www.alphavantage.co/query?function=TIME_SERIES_{}_ADJUSTED&symbol={}".format(name, stock) cache_time = max(60 * 60 * 24, duration / 2) resraw = lib.cache_get(url, force = force, append = '&apikey={}'.format(alpha[ix % len(alpha)]), cache_time = cache_time ) last = time.time() resjson = json.loads(resraw) if "Note" in resjson or 'Error Message' in resjson: force = True else: break for k,v in resjson.items(): if k == 'Meta Data': continue for date,row in v.items(): db.insert('historical', { 'ticker': stock, 'open': row['1. open'], 'high': row['2. high'], 'low': row['3. low'], 'close': row['4. close'], 'begin': date, 'duration': duration }) def getInstrument(url): key = url.split('/')[-2] res = lib.r.hget('inst', key) try: res = res.decode("utf-8") except BaseException: pass if not res: req = urllib.request.Request(url) with urllib.request.urlopen(req) as response: res = response.read() lib.r.hset('inst', key, res) resJson = json.loads(res) name = resJson['simple_name'] if not name: name = resJson['name'] db.insert('instruments', { 'ticker': resJson['symbol'], 'name': name }) return res def historical(stockList=['MSFT']): lib.login() if type(stockList) is str: stockList = [stockList] for instrument in stockList: data = lib.my_trader.get_historical_quotes(instrument, 'day', 'week') duration = 60 * 24 if data: for payload in data.get('results'): for row in payload.get('historicals'): db.insert('historical', { 'ticker': instrument, 'open': row['open_price'], 'close': row['close_price'], 'low': row['low_price'], 'high': row['high_price'], 'begin': row['begins_at'], 'duration': duration }) def get_history(): """ Get your trading history and populates it into the database """ def dividends(data=False): print("Dividends") if not data: tradeList = lib.my_trader.dividends() else: tradeList = data for trade in tradeList['results']: db.insert('trades', { 'side': 'dividend', 'instrument': trade['instrument'].split('/')[-2], 'quantity': trade['position'], 'price': trade['rate'], 'created': trade['paid_at'], 'rbn_id': trade['id'] }) if tradeList['next']: data = lib.my_trader.session.get(tradeList['next']) dividends(data.json()) def trades(data=False): print("trades") if not data: tradeList = lib.my_trader.order_history() else: tradeList = data for trade in tradeList['results']: for execution in trade['executions']: try: attempt = db.insert('trades', { 'side': trade['side'], 'instrument': trade['instrument'].split('/')[-2], 'quantity': execution['quantity'], 'price': execution['price'], 'created': execution['timestamp'], 'rbn_id': execution['id'] }) except BaseException as ex: return trade['instrument'] = json.loads(getInstrument(trade['instrument'])) print( "{} {:5s} {:6s}".format( trade['created_at'], trade['side'], trade['instrument']['symbol'])) if tradeList['next'] and attempt is not None: data = lib.my_trader.session.get(tradeList['next']) trades(data.json()) lib.login() trades() dividends() def l(): """ Lists the instruments in the portfolio """ symbolList = [] for k,v in lib.r.hgetall('inst').items(): v = json.loads(v) trades = db.run( 'select count(*) from trades where instrument = ?', (k, )).fetchone() if trades[0] > 0: name = v.get('simple_name') if name is None: name = v.get('name') symbolList.append("[{:4}] {:<5} ({})".format(trades[0], v.get('symbol'), name)) print("\n".join(sorted(symbolList))) def hist(ticker = None, is_single = True): """ Find the performance history for a particular investment """ if not ticker: print("{:6} | {:5} ({:6}) {:17} | {:5} {:10} ".format( "max", "max", "count", "date", "start", "date")) for i in lib.getsymbols(): hist(i, False) return holdings = positions(False) ticker = ticker.lower() uid = False symbolList = [] for k,v in lib.r.hgetall('inst').items(): v = json.loads(v) if v.get('symbol').lower() == ticker: uid = k symbolList.append(v.get('symbol')) if not uid: print("woooah, wtf is {}".format(ticker)) return ttl_buy = 0 avg_buy = 0 ttl_sell = 0 shares_sell = 0 rec = { 'buy': { 'first': 0, 'low': float("inf"), 'high': 0}, 'sell': {'low': float("inf"), 'high': 0} } atmax = None atmax_avg = 0 atmax_time = 0 net_buy = 0 net_sell = 0 avg_sell = 0 money = 0 shares = 0 week = 24 * 7 * 3600 last_week = 0 max_shares = -float('inf') min_shares = 0 first = None trades = list(db.run( 'select side,price,created,quantity,strftime("%s",created),id as unix from trades where instrument = ? order by created asc', (uid, ) ).fetchall()) max_holding = 0 for row in trades: sign = 1 quant = row[3] if row[0] == 'dividend': continue if row[0] == 'sell': sign = -1 if not first: first = row shares += sign * quant if shares > max_shares: atmax = row[5] max_shares = max(max_shares, shares) min_shares = min(min_shares, shares) shares = 0 if min_shares < 0: min_shares *= -1 max_shares += min_shares shares += min_shares if max_shares == 0: unit = 25.0 / 50 else: unit = 25.0 / max_shares try: rec['buy']['first'] = first[1] except: return for row in trades: sign = 1 if row[0] == 'dividend': continue side = row[0] price = row[1] quant = row[3] ttl = quant * price epoch = int(row[4]) wk = '' if epoch - last_week > week: last_week = epoch wk = '-----' if row[0] == 'sell': sign = -1 if shares > 0: avg_buy = ttl_buy / shares ttl_buy -= (avg_buy * quant) ttl_sell += ttl shares_sell += quant net_sell += ttl rec['sell']['high'] = max(rec['sell']['high'], price) rec['sell']['low'] = min(rec['sell']['low'], price) else: rec['buy']['high'] = max(rec['buy']['high'], price) rec['buy']['low'] = min(rec['buy']['low'], price) net_buy += ttl ttl_buy += ttl if shares_sell > 0: avg_sell = ttl_sell / shares_sell #ttl_sell -= (price * quant) else: avg_sell = 0 shares_sell = 0 ttl_sell = 0 shares += sign * quant money += sign * ttl if shares > 0: avg_buy = ttl_buy / shares else: avg_sell = 0 shares_sell = 0 ttl_sell = 0 if shares_sell > 0: avg_sell = ttl_sell / shares_sell if sign == 1: sign = ' ' else: sign = '-' if row[5] == atmax: atmax_avg = avg_buy atmax_time = epoch atmax_date = row[2][:10] rep=''.join(int(shares * unit) * ['*']) margin = 0 if avg_buy > 0: margin = round(100 * avg_sell/avg_buy) if margin == 0: margin = '' else: margin -= 100 if is_single: print("{} {:<7g} {:<25} {:<5g} {:<10g} {:4} {:4} {:>3} {:5} {} {} ".format(sign, round(shares,3), rep, round(price), round(shares * row[1]), round(row[1]), round(avg_buy), round(avg_sell), margin, row[2][:10], wk)) if shares < 0.0001 and not is_single: return shares = holdings.get(ticker.upper()).get('count') nowprice = float(lib.getquote(ticker).get('last_trade_price')) reality = net_sell - net_buy + nowprice * shares buy_low_and_sell_high = round(max_shares * max(rec['buy']['high'],rec['sell']['high']) - max_shares * min(rec['sell']['low'], rec['buy']['low'])) buy_and_hold = round(max_shares * nowprice - max_shares * first[1]) hold_at_max = round(max_shares * nowprice - max_shares * atmax_avg) duration = (time.time() - int(first[4])) / (365.2475 * 24 * 60 * 60) atmax_delta = (time.time() - atmax_time) / (365.2475 * 24 * 60 * 60) roi = { 'blash': 100 * abs(buy_low_and_sell_high / reality - 1), 'ham': 100 * abs(hold_at_max / reality - 1), 'bah': 100 * abs(buy_and_hold / reality - 1) } if is_single: print("\n".join([ "({}) buy: {} | sell {} | diff: {}".format(ticker, round(net_buy), round(net_sell), net_sell - net_buy), "records:", " buy: {:8.2f} - {:8.2f}".format(rec['buy']['low'], rec['buy']['high']), " sell: {:8.2f} - {:8.2f}".format(rec['sell']['low'], rec['sell']['high']), "", "if you bought max low and sold high:", "{} ({}% / {}%)".format(buy_low_and_sell_high, round(roi['blash']), round(roi['blash']/duration)), "", "if you held when you had max ({} - {}):".format(atmax_date, max_shares), "{} ({}% / {}%)".format(hold_at_max, round(roi['ham']), round(roi['ham']/atmax_delta)), "", "if you bought max at the beginning ({}):".format(first[2][:10]), "{} ({}% / {}%)".format(buy_and_hold, round(roi['bah']), round(roi['bah'] / duration)), "", "your strategy:", "{}".format(round(reality)) ])) else: strat_col = 'red' if reality > buy_and_hold: strat_col = 'green' delta_start = datetime.datetime.now() - dateparser.parse(first[2][:10]) delta_max = datetime.datetime.now() - dateparser.parse(atmax_date) delta = { "start": delta_start.days / YEAR, "max": delta_max.days / YEAR } fmt = "{:5.2f}y" for k,v in delta.items(): sat = 1 - min(1, v) delta[k] = color(fmt.format(v), fore=lib.torgb(0.5, sat, 1), style='bright') print("{:6} | {:5} ({:-6.2f}) {} {} | {:5} {} {} | {:5} {} ({:6.2f} - ${:<8.2f})".format( buy_low_and_sell_high, hold_at_max, max_shares, atmax_date, delta.get('max'), buy_and_hold, first[2][:10], delta.get('start'), ticker.upper(), color("{:8}".format(round(reality)), fore=strat_col, style='bright'), shares, shares * nowprice), ) def positions(do_print = True): holdings = lib.kv('holdings') if not do_print and holdings: return holdings lib.login() positionList = lib.my_trader.positions() tickerList = [] computed = 0 holdings = {} for position in positionList['results']: position['instrument'] = json.loads(getInstrument(position['instrument'])) if float(position['quantity']) > 0: symbol = position['instrument']['symbol'] res = lib.getquote(symbol) last_price = res['last_extended_hours_trade_price'] if last_price is None: last_price = res['last_trade_price'] computed += float(position['quantity']) * float(last_price) holdings[symbol] = {'price': float(last_price), 'count': float(position['quantity'])} if do_print: print("{:30s} {:5s} {:5.2f} {:10}".format( position['instrument']['name'][:29], symbol, float(position['quantity']), last_price)) #holdings['_computed'] = computed #holdings['_raw'] = positionList lib.kv('holdings', holdings) return holdings
[ "kristopolous@yahoo.com" ]
kristopolous@yahoo.com
95513d0222466b05775626ce21dbbcff1a0f2158
09e57dd1374713f06b70d7b37a580130d9bbab0d
/data/p4VQE/R1/benchmark/startQiskit_noisy68.py
2abe4bba4276c4ad5fc8fe827f963e48f6c2e57f
[ "BSD-3-Clause" ]
permissive
UCLA-SEAL/QDiff
ad53650034897abb5941e74539e3aee8edb600ab
d968cbc47fe926b7f88b4adf10490f1edd6f8819
refs/heads/main
2023-08-05T04:52:24.961998
2021-09-19T02:56:16
2021-09-19T02:56:16
405,159,939
2
0
null
null
null
null
UTF-8
Python
false
false
2,423
py
# qubit number=3 # total number=9 import numpy as np from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ import networkx as nx from qiskit.visualization import plot_histogram from typing import * from pprint import pprint from math import log2 from collections import Counter from qiskit.test.mock import FakeVigo, FakeYorktown kernel = 'circuit/bernstein' def make_circuit(n:int) -> QuantumCircuit: # circuit begin input_qubit = QuantumRegister(n,"qc") prog = QuantumCircuit(input_qubit) prog.h(input_qubit[0]) # number=1 prog.h(input_qubit[1]) # number=2 prog.h(input_qubit[2]) # number=3 prog.h(input_qubit[3]) # number=4 for edge in E: k = edge[0] l = edge[1] prog.cp(-2 * gamma, input_qubit[k-1], input_qubit[l-1]) prog.p(gamma, k) prog.p(gamma, l) prog.rx(2 * beta, range(len(V))) prog.cx(input_qubit[1],input_qubit[0]) # number=5 prog.cx(input_qubit[1],input_qubit[0]) # number=6 prog.swap(input_qubit[3],input_qubit[0]) # number=7 prog.swap(input_qubit[3],input_qubit[0]) # number=8 # circuit end return prog if __name__ == '__main__': n = 4 V = np.arange(0, n, 1) E = [(0, 1, 1.0), (0, 2, 1.0), (1, 2, 1.0), (3, 2, 1.0), (3, 1, 1.0)] G = nx.Graph() G.add_nodes_from(V) G.add_weighted_edges_from(E) step_size = 0.1 a_gamma = np.arange(0, np.pi, step_size) a_beta = np.arange(0, np.pi, step_size) a_gamma, a_beta = np.meshgrid(a_gamma, a_beta) F1 = 3 - (np.sin(2 * a_beta) ** 2 * np.sin(2 * a_gamma) ** 2 - 0.5 * np.sin(4 * a_beta) * np.sin(4 * a_gamma)) * ( 1 + np.cos(4 * a_gamma) ** 2) result = np.where(F1 == np.amax(F1)) a = list(zip(result[0], result[1]))[0] gamma = a[0] * step_size beta = a[1] * step_size prog = make_circuit(4) sample_shot =5200 writefile = open("../data/startQiskit_noisy68.csv", "w") # prog.draw('mpl', filename=(kernel + '.png')) backend = FakeYorktown() circuit1 = transpile(prog, FakeYorktown()) circuit1.measure_all() prog = circuit1 info = execute(prog,backend=backend, shots=sample_shot).result().get_counts() print(info, file=writefile) print("results end", file=writefile) print(circuit1.depth(), file=writefile) print(circuit1, file=writefile) writefile.close()
[ "wangjiyuan123@yeah.net" ]
wangjiyuan123@yeah.net
73676db8fb5ad6d93116521e45d1b67101bb0caf
5ba91f39171497a9ee26567eee0627a5b9134ccf
/vis.py
c1cb615b535e179b21210f466a5f510cec66a491
[]
no_license
agrafix/grabcite-net
bade98be3bce947701e14bd6ad48ad350234d608
4fa9c81d5c46114a981edab19a3c1b6e07f85a41
refs/heads/master
2021-03-27T08:45:30.067163
2017-10-08T21:22:55
2017-10-08T21:22:55
93,861,790
3
1
null
null
null
null
UTF-8
Python
false
false
5,396
py
# visualise a data set # local imports import prepare_data as pd from config import data_glob # package imports import glob import numpy as np from tqdm import tqdm import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt plt.style.use('ggplot') # std lib from collections import Counter from urllib.request import urlopen import os import time import sys import csv from functools import lru_cache import urllib.parse import json citMap = [] citTyMap = [] authorMap = [] journalMap = [] yearMap = [] hasCitMap = [] citDifMap = [] def countUp(d, key): if key != None and key != "": d.append(key) def countEntries(d, entries): for e in entries: countUp(d, e) def writeCsv(counter, csvName): print("Writing " + csvName) with open(csvName, 'w') as csvfile: cwriter = csv.writer(csvfile, delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL) for (k, v) in counter.most_common(): cwriter.writerow([k, v]) def plotHist(d, name, fname, sortStyle='key'): counter = Counter(d) cats = [] counts = [] mostCommon = counter.most_common() mostCommon.sort(key=lambda x: x[0] if sortStyle == 'key' else x[1]) for (k, v) in tqdm(mostCommon, desc='Building histogram data', unit='dp'): cats.append(k) counts.append(v) if len(cats) < 5000: indexes = np.arange(len(cats)) width = 0.7 plt.figure(figsize=(40, 10)) plt.gcf().subplots_adjust(bottom=0.25) plt.suptitle(name, fontsize=14, fontweight='bold') plt.bar(indexes, counts, width) plt.xticks(indexes + width * 0.5, cats, rotation='vertical', fontsize=6) # plt.tight_layout() <-- this breaks atm print("Writing " + fname) plt.savefig(fname, dpi = (200)) plt.close() else: print("Too many entries, skipping generation of " + fname) csvName = os.path.splitext(fname)[0] + ".csv" writeCsv(counter, csvName) @lru_cache(maxsize=10000) def getEntry(ref): recId = ref.replace("http://dblp.org/rec/", "") q = urllib.parse.urlencode({ "id": recId }) url = "http://papergrep.com/api/get?" + q print("Fetching " + url) try: output = urlopen(url).read().decode('utf-8') entry = json.loads(output) return entry except: print(sys.exc_info()) return None dirName = "vis-" + str(time.time()) print("Output is going to go to " + dirName) if not os.path.exists(dirName): os.makedirs(dirName) countedPapers = set() dataSetPapers = set() referencePapers = {} print("Working on " + data_glob) for file in glob.glob(data_glob): metaName = os.path.splitext(file)[0] + ".meta" refName = os.path.splitext(file)[0] + ".refs" myUrl = None myMeta = None if os.path.exists(metaName): with open(metaName, 'r') as metaHandle: data = json.loads(metaHandle.read()) myUrl = data["url"] if myUrl is not None: dataSetPapers.add(myUrl) myMeta = getEntry(myUrl) print("DBLP of " + file + " is " + str(myUrl)) with open(file, 'r') as myfile: data = myfile.read().split("\n============\n") for sentence in data: refs, _ = pd.prepare_sentence(sentence) if len(refs) > 0: countUp(hasCitMap, "yes") else: countUp(hasCitMap, "no") for (ty, ref) in refs: countUp(citMap, ref) countUp(citTyMap, ty) if ty == 'DBLP': if ref not in referencePapers: referencePapers[ref] = 0 referencePapers[ref] += 1 entry = getEntry(ref) if entry != None: countEntries(authorMap, entry["authors"]) countEntries(journalMap, [entry["journal"]]) countEntries(yearMap, [str(entry["year"])]) if myMeta is not None and myMeta["year"] is not None and entry["year"] is not None: yearDif = myMeta["year"] - entry["year"] if yearDif >= 0: countEntries(citDifMap, [yearDif]) # Plot all the things plotHist(hasCitMap, "Sentences with Citation", dirName + "/cit_yn.png", sortStyle='key') plotHist(citMap, "Citations", dirName + "/cits.png", sortStyle='value') plotHist(citTyMap, "Citation Types", dirName + "/cit_ty.png", sortStyle='value') plotHist(authorMap, "Authors", dirName + "/authors.png", sortStyle='value') plotHist(journalMap, "Journals", dirName + "/journals.png", sortStyle='value') plotHist(yearMap, "Years", dirName + "/years.png", sortStyle='key') plotHist(citDifMap, "Year Difference", dirName + "/year-diff.png", sortStyle='key') # Graph info refKeys = set(referencePapers.keys()) inGraphRefs = { k: referencePapers[k] for k in dataSetPapers if k in referencePapers } totalInner = 0 for r, ct in inGraphRefs.items(): totalInner += ct print("Total Inner-graph citations: " + str(totalInner)) print("Unique Inner-graph citations: " + str(len(refKeys.intersection(dataSetPapers)))) print("Unique Dangeling citations: " + str(len(refKeys.difference(dataSetPapers)))) print("Unique Uncited graph papers: " + str(len(dataSetPapers.difference(refKeys))))
[ "mail@athiemann.net" ]
mail@athiemann.net
56b7265616c08c752940d5c5672d4fe0e629698d
35994e4609cb8a59189ea1b8329708cdc7f3ac0c
/PS5/ps5.py
b77203dd17bf26c5243140791d5f0970b06ad7b1
[]
no_license
eravet/MIT-OCW-6.0002
bcd0ab89ab714b1fdf62bde5ff81cc4426f1085a
65cf4aab0f5bc9e8503481cd08759c493b60514f
refs/heads/main
2022-12-29T01:50:03.086521
2020-10-15T04:59:33
2020-10-15T04:59:33
304,210,899
0
0
null
null
null
null
UTF-8
Python
false
false
14,048
py
# -*- coding: utf-8 -*- # Problem Set 5: Experimental Analysis # Name: # Collaborators (discussion): # Time: import pylab import re # cities in our weather data CITIES = [ 'BOSTON', 'SEATTLE', 'SAN DIEGO', 'PHILADELPHIA', 'PHOENIX', 'LAS VEGAS', 'CHARLOTTE', 'DALLAS', 'BALTIMORE', 'SAN JUAN', 'LOS ANGELES', 'MIAMI', 'NEW ORLEANS', 'ALBUQUERQUE', 'PORTLAND', 'SAN FRANCISCO', 'TAMPA', 'NEW YORK', 'DETROIT', 'ST LOUIS', 'CHICAGO' ] TRAINING_INTERVAL = range(1961, 2010) TESTING_INTERVAL = range(2010, 2016) """ Begin helper code """ class Climate(object): """ The collection of temperature records loaded from given csv file """ def __init__(self, filename): """ Initialize a Climate instance, which stores the temperature records loaded from a given csv file specified by filename. Args: filename: name of the csv file (str) """ self.rawdata = {} f = open(filename, 'r') header = f.readline().strip().split(',') for line in f: items = line.strip().split(',') date = re.match('(\d\d\d\d)(\d\d)(\d\d)', items[header.index('DATE')]) year = int(date.group(1)) month = int(date.group(2)) day = int(date.group(3)) city = items[header.index('CITY')] temperature = float(items[header.index('TEMP')]) if city not in self.rawdata: self.rawdata[city] = {} if year not in self.rawdata[city]: self.rawdata[city][year] = {} if month not in self.rawdata[city][year]: self.rawdata[city][year][month] = {} self.rawdata[city][year][month][day] = temperature f.close() def get_yearly_temp(self, city, year): """ Get the daily temperatures for the given year and city. Args: city: city name (str) year: the year to get the data for (int) Returns: a 1-d pylab array of daily temperatures for the specified year and city """ temperatures = [] assert city in self.rawdata, "provided city is not available" assert year in self.rawdata[city], "provided year is not available" for month in range(1, 13): for day in range(1, 32): if day in self.rawdata[city][year][month]: temperatures.append(self.rawdata[city][year][month][day]) return pylab.array(temperatures) def get_daily_temp(self, city, month, day, year): """ Get the daily temperature for the given city and time (year + date). Args: city: city name (str) month: the month to get the data for (int, where January = 1, December = 12) day: the day to get the data for (int, where 1st day of month = 1) year: the year to get the data for (int) Returns: a float of the daily temperature for the specified time (year + date) and city """ assert city in self.rawdata, "provided city is not available" assert year in self.rawdata[city], "provided year is not available" assert month in self.rawdata[city][year], "provided month is not available" assert day in self.rawdata[city][year][month], "provided day is not available" return self.rawdata[city][year][month][day] def se_over_slope(x, y, estimated, model): """ For a linear regression model, calculate the ratio of the standard error of this fitted curve's slope to the slope. The larger the absolute value of this ratio is, the more likely we have the upward/downward trend in this fitted curve by chance. Args: x: an 1-d pylab array with length N, representing the x-coordinates of the N sample points y: an 1-d pylab array with length N, representing the y-coordinates of the N sample points estimated: an 1-d pylab array of values estimated by a linear regression model model: a pylab array storing the coefficients of a linear regression model Returns: a float for the ratio of standard error of slope to slope """ assert len(y) == len(estimated) assert len(x) == len(estimated) EE = ((estimated - y)**2).sum() var_x = ((x - x.mean())**2).sum() SE = pylab.sqrt(EE/(len(x)-2)/var_x) return SE/model[0] """ End helper code """ def generate_models(x, y, degs): """ Generate regression models by fitting a polynomial for each degree in degs to points (x, y). Args: x: an 1-d pylab array with length N, representing the x-coordinates of the N sample points y: an 1-d pylab array with length N, representing the y-coordinates of the N sample points degs: a list of degrees of the fitting polynomial Returns: a list of pylab arrays, where each array is a 1-d array of coefficients that minimizes the squared error of the fitting polynomial """ results = [] for deg in degs: results.append(pylab.polyfit(x, y, deg)) return results def r_squared(y, estimated): """ Calculate the R-squared error term. Args: y: 1-d pylab array with length N, representing the y-coordinates of the N sample points estimated: an 1-d pylab array of values estimated by the regression model Returns: a float for the R-squared error term """ mean = sum(y)/len(y) num = sum((y-estimated)**2) denom = sum((y-mean)**2) return 1 - (num/denom) def evaluate_models_on_training(x, y, models): """ For each regression model, compute the R-squared value for this model with the standard error over slope of a linear regression line (only if the model is linear), and plot the data along with the best fit curve. For the plots, you should plot data points (x,y) as blue dots and your best fit curve (aka model) as a red solid line. You should also label the axes of this figure appropriately and have a title reporting the following information: degree of your regression model, R-square of your model evaluated on the given data points, and SE/slope (if degree of this model is 1 -- see se_over_slope). Args: x: an 1-d pylab array with length N, representing the x-coordinates of the N sample points y: an 1-d pylab array with length N, representing the y-coordinates of the N sample points models: a list containing the regression models you want to apply to your data. Each model is a pylab array storing the coefficients of a polynomial. Returns: None """ for model in models: deg = len(model) - 1 curve = pylab.polyval(model, x) if deg == 1: se = se_over_slope(x, y, curve, model) r2 = r_squared(y, curve) pylab.figure() pylab.plot(x, y, 'bo') pylab.plot(x, curve, 'r-') pylab.xlabel('year') pylab.ylabel('temp (C)') if deg == 1: pylab.title('climate change model\ndegs = ' + str(deg) + ', r**2 = ' + str(r2) + '\nse = ' + str(se)) else: pylab.title('climate change model\ndegs = ' + str(deg) + ', r**2 = ' + str(r2)) pylab.show() def gen_cities_avg(climate, multi_cities, years): """ Compute the average annual temperature over multiple cities. Args: climate: instance of Climate multi_cities: the names of cities we want to average over (list of str) years: the range of years of the yearly averaged temperature (list of int) Returns: a pylab 1-d array of floats with length = len(years). Each element in this array corresponds to the average annual temperature over the given cities for a given year. """ yearly_temps = [] for year in years: city_temps = [] for city in multi_cities: city_temps.append(climate.get_yearly_temp(city, year)) city_temps = pylab.array(city_temps) yearly_temps.append(city_temps.mean()) return pylab.array(yearly_temps) def moving_average(y, window_length): """ Compute the moving average of y with specified window length. Args: y: an 1-d pylab array with length N, representing the y-coordinates of the N sample points window_length: an integer indicating the window length for computing moving average Returns: an 1-d pylab array with the same length as y storing moving average of y-coordinates of the N sample points """ moving_y = [None]*len(y) y = pylab.array(y) for i in range(1, len(y)+1): if i < window_length: moving_y[i-1] = y[0:i].mean() else: moving_y[i-1] = y[i-window_length:i].mean() return pylab.array(moving_y) def rmse(y, estimated): """ Calculate the root mean square error term. Args: y: an 1-d pylab array with length N, representing the y-coordinates of the N sample points estimated: an 1-d pylab array of values estimated by the regression model Returns: a float for the root mean square error term """ RMSE = (y - estimated)**2 RMSE = RMSE.sum()/len(y) return RMSE**0.5 def gen_std_devs(climate, multi_cities, years): """ For each year in years, compute the standard deviation over the averaged yearly temperatures for each city in multi_cities. Args: climate: instance of Climate multi_cities: the names of cities we want to use in our std dev calculation (list of str) years: the range of years to calculate standard deviation for (list of int) Returns: a pylab 1-d array of floats with length = len(years). Each element in this array corresponds to the standard deviation of the average annual city temperatures for the given cities in a given year. """ year_temp = [] for year in years: daily_temp = [] for month in range(1, 13): for day in range(1, 32): try: daily_temp.append(get_daily_avg(climate, multi_cities, year, month, day)) except: continue year_temp.append(pylab.array(daily_temp).std()) return year_temp def get_daily_avg(climate, cities, year, month, day): """ Compute the average temperaute over multiple cities for a given day. Args: climate: instance of Climate cities: list of cities to be evaluated (list of str) year/month/day: date to be evaluated. (int) Returns: float equal to the average daily temperature across range of cities. """ temps = [] for city in cities: temps.append(climate.get_daily_temp(city, month, day, year)) return pylab.array(temps).mean() def evaluate_models_on_testing(x, y, models): """ For each regression model, compute the RMSE for this model and plot the test data along with the model’s estimation. For the plots, you should plot data points (x,y) as blue dots and your best fit curve (aka model) as a red solid line. You should also label the axes of this figure appropriately and have a title reporting the following information: degree of your regression model, RMSE of your model evaluated on the given data points. Args: x: an 1-d pylab array with length N, representing the x-coordinates of the N sample points y: an 1-d pylab array with length N, representing the y-coordinates of the N sample points models: a list containing the regression models you want to apply to your data. Each model is a pylab array storing the coefficients of a polynomial. Returns: None """ for model in models: deg = len(model) - 1 estimated = pylab.polyval(model, x) RMSE = rmse(y, estimated) pylab.figure() pylab.plot(x, y, 'bo') pylab.plot(x, estimated, 'r-') pylab.xlabel('year') pylab.ylabel('temp (C)') pylab.title('climate change model\ndegs = ' + str(deg) + ', RMSE = ' + str(RMSE)) pylab.show() if __name__ == '__main__': pass # Part A.4 data = Climate('data.csv') x_train = pylab.array(TRAINING_INTERVAL) # y = [] # for year in x: # y.append(data.get_daily_temp('NEW YORK', 1, 10, year)) # y = pylab.array(y) # model = list(generate_models(x, y, [1])) # evaluate_models_on_training(x, y, model) # y = [] # for year in x: # yearly_temp = data.get_yearly_temp('NEW YORK', year) # y.append(yearly_temp.mean()) # y = pylab.array(y) # model = generate_models(x, y, [1]) # evaluate_models_on_training(x, y, model) # # Part B # y_train = gen_cities_avg(data, CITIES, x_train) # # model = generate_models(x, y, [1]) # # evaluate_models_on_training(x, y, model) # # # Part C # y_train = moving_average(y_train, 5) # models = generate_models(x_train, y_train, [1, 2, 20]) # # evaluate_models_on_training(x, y, models) # # Part D.2 # x_test = pylab.array(TESTING_INTERVAL) # y_test = gen_cities_avg(data, CITIES, x_test) # y_test = moving_average(y_test, 5) # evaluate_models_on_testing(x_test, y_test, models) # Part E x_train = pylab.array(TRAINING_INTERVAL) y = gen_std_devs(data, CITIES, TRAINING_INTERVAL) y_moving = moving_average(y, 15) model = generate_models(x_train, y_moving, [1, 2, 3, 5, 10]) evaluate_models_on_training(x_train, y_moving, model)
[ "noreply@github.com" ]
noreply@github.com
fb2ad1469a3b5b969fe792f8502ac2afe0658c59
42dd928353c1d534ce149322c3ae65ec97545ac5
/boards/urls.py
be9271e3a125345f3a34e95f4a524d2995e7a0c8
[]
no_license
yeojinhwang/django_recrud
1ef480b3c5802ce5c3c5487eef8344588e52b0c0
d2fdf3f68fbdf6dcf85e0736ec4ccec25af70979
refs/heads/master
2020-04-28T08:10:51.572333
2019-03-18T02:26:46
2019-03-18T02:26:46
175,116,967
0
0
null
null
null
null
UTF-8
Python
false
false
673
py
from django.urls import path from . import views app_name = 'boards' urlpatterns = [ path('', views.index, name='index'), # boards:index path('new/', views.new, name='new'), path('<int:board_pk>/', views.detail, name='detail'), # path('create/', views.create, name='create'), path('edit/<int:board_pk>/', views.edit, name='edit'), # path('update/<int:pk>/', views.update, name='update'), path('delete/<int:board_pk>', views.delete, name='delete'), path('<int:board_pk>/comments/', views.comments_create, name='comments_create'), path('<int:board_pk>/comments/<int:comment_pk>/delete/', views.comments_delete, name='comments_delete'), ]
[ "hwangyj0202@gmail.com" ]
hwangyj0202@gmail.com
8142a079cb5679353a2068fb899c1793ccb9dbb0
56a00818882990c758aab49b2f71b3c340f966ab
/Implementations/content/contest/genLong.py
0eeaaa0544b1f1eeb8f3744c182fc745c801a019
[ "MIT" ]
permissive
ManishGotame/USACO
2c4d651da2af9500637ea063e8775cbde7a78009
24ef4c9a298695c7a8770726e6ac3eb6180fe56f
refs/heads/master
2020-09-13T09:07:20.669660
2019-11-18T00:37:44
2019-11-18T00:37:44
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,266
py
filenames = ['template.cpp', 'CppIO.h', '../number-theory (11.1)/Modular Arithmetic/Modular.h'] with open('templateLong.cpp', 'w') as outfile: res = [] active = False def ad(line): global active if line.startswith('#include "'): return if line.startswith('/**'): active = True if active and '*/' in line: active = False return if active: return if line.endswith("//\n"): line = line[:-3]+"\n" res.append(line) if not res[-1].endswith('\n'): res[-1] += '\n' while len(res) > 1 and len(res[-1]) <= 1 and len(res[-2]) <= 1: res.pop() extra = [] for fname in filenames: with open(fname) as infile: v = [] for line in infile: v.append(line) if fname == 'template.cpp': for i in range(len(v)): line = v[i] if i < len(v)-5: ad(line) elif i > len(v)-4: extra.append(line) else: for line in v: ad(line) ad('\n') for line in extra: ad(line) res.pop() res.append(' // you should actually read the stuff at the bottom\n') res.append('}\n\n') res.append("""/* stuff you should look for * int overflow, array bounds * special cases (n=1?), slow multiset operations * do smth instead of nothing and stay organized */""") for line in res: outfile.write(line)
[ "bqi343@gmail.com" ]
bqi343@gmail.com
dc55ed13f4103e66e4e5edcf55079267753cb476
ee4db47ccecd23559b3b6f3fce1822c9e5982a56
/Build Chatbots/Tokenization.py
db3b63f6326833b215d84cf8c42b27248d31c56d
[]
no_license
meoclark/Data-Science-DropBox
d51e5da75569626affc89fdcca1975bed15422fd
5f365cedc8d0a780abeb4e595cd0d90113a75d9d
refs/heads/master
2022-10-30T08:43:22.502408
2020-06-16T19:45:05
2020-06-16T19:45:05
265,558,242
0
1
null
null
null
null
UTF-8
Python
false
false
586
py
from nltk.tokenize import word_tokenize,sent_tokenize ecg_text = 'An electrocardiogram is used to record the electrical conduction through a person\'s heart. The readings can be used to diagnose cardiac arrhythmias.' tokenized_by_word = word_tokenize(ecg_text) tokenized_by_sentence = sent_tokenize(ecg_text) try: print('Word Tokenization:') print(tokenized_by_word) except: print('Expected a variable called `tokenized_by_word`') try: print('Sentence Tokenization:') print(tokenized_by_sentence) except: print('Expected a variable called `tokenized_by_sentence`')
[ "oluchukwuegbo@gmail.com" ]
oluchukwuegbo@gmail.com
9d32305746ee8dc48cfda6a108885921793c9eb2
8b16579c1b89a1ac33ec0c5584236922d508eb9b
/proyectodetiempo/settings.py
2fd4372c1f040b78fecc9a0dc3b3f1291ef98e44
[]
no_license
SergioAnanias/time_display
c9c6f26466ffcbea3833d6a9177397b8a776037b
498a948ff53c2cd6233ed2bea8f88825838dba8b
refs/heads/main
2023-05-09T19:36:48.397757
2021-06-05T18:10:09
2021-06-05T18:10:09
373,287,364
0
0
null
null
null
null
UTF-8
Python
false
false
3,289
py
""" Django settings for proyectodetiempo project. Generated by 'django-admin startproject' using Django 3.2.3. For more information on this file, see https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/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.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure-7jm%w(uq!zzxu@auu2e0_1i+e%xc&zmv!+-e0mquridia!83nb' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'time_display', '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 = 'proyectodetiempo.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 = 'proyectodetiempo.wsgi.application' # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/3.2/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.2/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'GMT' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.2/howto/static-files/ STATIC_URL = '/static/' # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
[ "sergio.ananias.o@gmail.com" ]
sergio.ananias.o@gmail.com
1374a52f9cb3e9c340ae14537ee505ffd8ec8389
c5460c90510054bf7e827be21665e03eb8faac5d
/blog/migrations/0001_initial.py
2ff0933ef1187b31de8c556b7e5101cc40500389
[]
no_license
sergiofv/portfolio-template
f0d3d39cf256ec1833fcccb7bd3dcc41b4db9598
eb28c73c8d22918a1e960c8faa0ba5b1e991b6be
refs/heads/main
2023-01-24T13:38:46.333652
2020-12-11T22:03:08
2020-12-11T22:03:08
320,618,979
0
0
null
null
null
null
UTF-8
Python
false
false
652
py
# Generated by Django 3.1.4 on 2020-12-10 14:18 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Blog', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=255)), ('pub_date', models.DateTimeField()), ('body', models.TextField()), ('image', models.ImageField(upload_to='images/')), ], ), ]
[ "sfvsound@gmail.com" ]
sfvsound@gmail.com
6828773afe2c70b90d77d77c6f63e2884339c267
ce20d0de4822644e2a553d33cfa5d1ba21d2ee5e
/codingame/fall-challenge-2022/ai.py
8bf6250a90265d8ed4c706b37739908d4a1fa3f8
[]
no_license
yana87gt/procon
08bfc87756d43a7cac9d61fad271880c421e4aca
3f420f0b242f3e9108c780ca37288696e09522eb
refs/heads/master
2023-08-31T01:50:13.592343
2023-08-26T17:11:02
2023-08-26T17:11:02
92,819,190
0
1
null
null
null
null
UTF-8
Python
false
false
28,085
py
''' # IDE https://www.codingame.com/ide/challenge/fall-challenge-2022 # ルール https://tsukammo.hatenablog.com/ # Leader Board https://www.codingame.com/contests/fall-challenge-2022/leaderboard # Replay https://www.codingame.com/replay/684709569 https://www.codingame.com/replay/684770223 https://www.codingame.com/replay/684771377 https://www.codingame.com/replay/685575216 * 侵略している https://www.codingame.com/replay/689089685 https://www.codingame.com/replay/689089320 # マスの表記 [M]: 自分のUnitありマス [m]: 自分のUnitなしマス [F]: 相手のUnitありマス [f]: 相手のUnitなしマス [R]: 自分のリサイクルマス [r]: 相手のリサイクルマス [.]: 空マス [#]: 草マス ''' from collections import defaultdict import sys import heapq ME = 1 FOE = 0 NEUTRAL = -1 INF = 1000 dx = [0, -1, 0, +1] dy = [-1, 0, +1, 0] phase = 1 # Const values in Game width, height = [int(i) for i in input().split()] is_left_side = None cut_done = False def debug(text): print(text, file=sys.stderr, flush=True) class Cell(): def input_data(self, x: int, y: int): self.x, self.y = x, y scrap_amount, owner, units, recycler, can_build, can_spawn, in_range_of_recycler = [int(k) for k in input().split()] self.scrap_amount, self.owner, self.units, self.recycler, self.can_build, self.can_spawn, self.in_range_of_recycler = scrap_amount, owner, units, recycler, can_build, can_spawn, in_range_of_recycler self.reachable = [INF, INF] # [FOR, ME] self.targeted = False self.not_pass = False self.deleted_next_turn = False self.build_next_turn = False c = [[Cell() for y in range(height)] for x in range(width)] # (x, y) の周り4マスの座標を返す # 空きマス, 範囲外のマス は省く # デフォルトでは recycler を省く def next_xy(x: int, y: int, allow_recycler: bool = False) -> list: nexts = [] for i in range(4): nx, ny = x + dx[i], y + dy[i] if nx < 0 or nx >= width or ny < 0 or ny >= height: continue if c[nx][ny].scrap_amount == 0: continue if not allow_recycler and c[nx][ny].recycler: continue nexts.append((nx, ny)) return nexts # cost ターンで (x, y) に辿りつける (src_x, src_y) を全て返す def get_src_units(cost: int, x: int, y: int) -> list: # [(x, y, is_unit), ...] if c[x][y].reachable[ME] != cost: return [] src_units = [] if cost == 0 and c[x][y].reachable[ME] == 0: src_units.append((x, y, True)) if cost == 1 and c[x][y].units == 0 and c[x][y].owner == ME: src_units.append((x, y, False)) for nx, ny in next_xy(x, y): src_units += get_src_units(cost - 1, nx, ny) return src_units # (src_x, src_y) から (dst_x, dst_y) に行くときの最適な MOVE command を返す def get_proper_step(src_x: int, src_y: int, dst_x: int, dst_y: int) -> str: qu = [] cost_map = dict() heapq.heappush(qu, (0, dst_x, dst_y)) while len(qu) != 0: cost, x, y = heapq.heappop(qu) if (x, y) in cost_map and cost_map[(x, y)] <= cost: continue if c[x][y].owner == FOE: continue if c[x][y].not_pass: continue if c[x][y].scrap_amount == 0: continue if c[x][y].recycler: continue cost_map[(x, y)] = cost for nx, ny in next_xy(x, y): heapq.heappush(qu, (cost + 1, nx, ny)) nexts = list(filter(lambda xy: (xy[0], xy[1]) in cost_map, next_xy(src_x, src_y))) if len(nexts) == 0: return "" nexts.sort(key=lambda xy: (cost_map[(xy[0], xy[1])], c[xy[0]][xy[1]].scrap_amount)) # min_cost = cost_map[(nexts[0][0], nexts[0][1])] # nexts = list(filter(lambda xy: cost_map[(xy[0], xy[1])] == min_cost, nexts)) nexts.sort(key=lambda xy: ( cost_map[(xy[0], xy[1])], c[xy[0]][xy[1]].reachable[FOE] - c[xy[0]][xy[1]].reachable[ME] <= 1, abs(xy[1] - src_y) )) return f"MOVE 1 {src_x} {src_y} {nexts[0][0]} {nexts[0][1]}" # Game loop for turn in range(500): # Const values in Turn my_matter, opp_matter = [int(i) for i in input().split()] my_units = [] # (x, y) my_top_x = my_top_y = my_bottom_x = my_bottom_y = my_front_x = my_front_y = None opp_front_xs = [] if is_left_side is None else[INF if is_left_side else -INF for _ in range(height)] for y in range(height): for x in range(width): # Input c[x][y].input_data(x, y) # Set is_left_side if turn == 0 and c[x][y].units > 0 and is_left_side is None: if c[x][y].owner == ME: is_left_side = x < width - x - 1 else: is_left_side = x >= width - x - 1 # Init opp_front_xs opp_front_xs = [INF if is_left_side else -INF for _ in range(height)] if c[x][y].owner == ME and c[x][y].units > 0: # List up my_units for i in range(c[x][y].units): my_units.append((x, y)) # Waller if my_top_y is None: my_top_x = my_bottom_x = my_front_x = x my_top_y = my_bottom_y = my_front_y = y assert my_front_x is not None and my_bottom_y is not None if (is_left_side and x >= my_front_x) or (not is_left_side and x <= my_front_x): my_front_x, my_front_y = x, y if y == my_top_y and is_left_side: my_top_x = x if y > my_bottom_y: my_bottom_x, my_bottom_y = x, y if y == my_bottom_y and is_left_side: my_bottom_x = x # Set opp_front_xs if c[x][y].owner == FOE and c[x][y].units > 0: if is_left_side: opp_front_xs[y] = min(x, opp_front_xs[y]) else: opp_front_xs[y] = max(x, opp_front_xs[y]) if c[x][y].owner == FOE and c[x][y].units == 0 and not c[x][y].recycler: if is_left_side: opp_front_xs[y] = min(x+1, opp_front_xs[y]) else: opp_front_xs[y] = max(x-1, opp_front_xs[y]) assert not(my_top_x is None or my_top_y is None or my_bottom_x is None or my_bottom_y is None) debug(f'opp_front_xs = {opp_front_xs}') # recycler によって次のターン not_pass になる場所を調べる next_turn_scrap_amounts = defaultdict(int) for y in range(height): for x in range(width): next_turn_scrap_amounts[(x, y)] += c[x][y].scrap_amount if c[x][y].recycler: for nx, ny in next_xy(x, y, allow_recycler=True): next_turn_scrap_amounts[(nx, ny)] -= 1 for y in range(height): for x in range(width): if next_turn_scrap_amounts[(x, y)] <= 0: c[x][y].not_pass = True c[x][y].deleted_next_turn = True commands = [] ''' [m][F] -> [R][F] ''' for y in range(height): for x in range(width): if not (c[x][y].units == 0 and c[x][y].owner == ME and not c[x][y].recycler): continue if not c[x][y].can_build: continue if c[x][y].deleted_next_turn: continue # [m] = (x, y) for nx, ny in next_xy(x, y): if c[nx][ny].units > 0 and c[nx][ny].owner == FOE: commands.append(f'BUILD {x} {y}') c[x][y].not_pass = True c[x][y].build_next_turn = True break ''' ✅ 準分断(phase = 2) / 分断(phase = 3) 判定 y = 0 の x = 相手サイドから (y = height - 1 もしくは 相手サイドのx) に辿り着けるパスはあるか判定する 最も相手サイドを通るように経路をdfsする * .owner == ME かつ unit = 0 のマス * .recycler (ownerは問わない) * .build_next_turn == True * .scrap_amount == 0 * .deleted_next_turn == True 無事経路が見つかったのであれば、経路中の[m]をカウント (= my_area_count) して、 my_matter -= max((my_area_count - 1) * 10, 0) をする (このターンのBUILD は先にやっておく) これで次のターンに BUILD できるように最低限節約できる。 経路中の[m]は持っておいて、 not_pass にする(いるとBUILD できないので) -> TODO: 相手の opp_matter で対応できないくらいにを強気にunitを増やして荒らす ''' if phase <= 2: x_range = list(range(width - 1, -1, -1) if is_left_side else range(width)) # TODO: 最初からx_range全部quに入れる for top_x in x_range: assert is_left_side is not None qu = [] cost_map = dict() def cell_cost(xx: int, yy: int) -> int: if xx < 0 or xx >= width or yy < 0 or yy >= height: return INF return int( c[xx][yy].owner == ME and c[xx][yy].units == 0 and not c[xx][yy].recycler and not c[xx][yy].build_next_turn and not c[xx][yy].deleted_next_turn ) heapq.heappush(qu, (cell_cost(top_x, 0), top_x, 0)) while len(qu) != 0: cost, x, y = heapq.heappop(qu) if (x, y) in cost_map and cost_map[(x, y)] <= cost: continue if x < 0 or x >= width or y < 0 or y >= height: continue ok = False ok |= (c[x][y].owner == ME and c[x][y].units == 0) ok |= c[x][y].recycler ok |= c[x][y].build_next_turn ok |= c[x][y].scrap_amount == 0 ok |= c[x][y].deleted_next_turn if not ok: continue cost_map[(x, y)] = cost if is_left_side: nexts = [(x+1, y+1), (x+1, y), (x, y+1), (x-1, y+1), (x-1, y)] else: nexts = [(x-1, y+1), (x-1, y), (x, y+1), (x+1, y+1), (x+1, y)] for nx, ny in nexts: heapq.heappush(qu, (cost + cell_cost(nx, ny), nx, ny)) found = False for dst_x in x_range: if (dst_x, height - 1) in cost_map: cost = cost_map[(dst_x, height - 1)] if cost >= 1: my_matter -= (cost - 1) * 10 phase = 2 else: phase = 3 debug(f'Cutting cost: {cost}') found = True break if found: break debug(f'phase = {phase}') ''' [M]+[.][F]+ M <= F or phase = 1 -> ✅ [m][.][F] にして次のターンでのリサイクルに備える M > F or phase >= 2 -> ✅ [m][M][F] (Without matter) * TODO(Low): M < F で突っ込んでいるが? -> RISCしたのに再現しなくて泣いちゃった ''' for y in range(height): for x in range(width): if c[x][y].not_pass: continue if not (c[x][y].owner == NEUTRAL and c[x][y].scrap_amount > 0): continue # [.] = (x, y) opp_unit_count = 0 my_unit_count = 0 for nx, ny in next_xy(x, y): if c[nx][ny].units > 0: if c[nx][ny].owner == FOE: # [F] = (nx, ny) opp_unit_count += c[nx][ny].units else: my_unit_count += my_units.count((nx, ny)) if opp_unit_count == 0 or my_unit_count == 0: continue if my_unit_count <= opp_unit_count or phase == 1: # [m][.][F]+ にして次のターンでのリサイクルに備える debug(f'[M]+[.][F]+ -> [m][.][F]: [.] = {(x, y)}') c[x][y].not_pass = True for nx, ny in next_xy(x, y): # [M] = (nx, ny) # TODO(Low): 2方向以上の [M] についても notpass にしちゃってるけどいい? if my_units.count((nx, ny)) > 0 and c[nx][ny].owner == ME: c[nx][ny].not_pass = True else: # [m][M][F] # TODO(Light): .targeted って機能してる? c[x][y].targeted = True for nx, ny in next_xy(x, y): count = my_units.count((nx, ny)) if count > 0 and c[nx][ny].owner == ME: # [M] = (nx, ny) commands.append(f'MOVE {count} {nx} {ny} {x} {y}') for i in range(count): my_units.remove((nx, ny)) ''' [M][f]+ かつ [M]の周りに[.]がない かつ phase >= 2 -> TODO(High): [m][M=1]* して足りなければSPAWN # ([f]の周り,[M]の周りの[F]の総数にあわせて[m][M]にする) -> TODO(Low): [M][r] の可能性もあるので保険で他のマスへのMOVEも入れておく ''' if phase >= 2: for y in range(height): for x in range(width): if not(c[x][y].units > 0 and c[x][y].owner == ME): continue if c[x][y].deleted_next_turn: continue if c[x][y].not_pass: continue # [M] = (x, y) rem_units = my_units.count((x, y)) for nx, ny in next_xy(x, y): if c[nx][ny].units == 0 and c[nx][ny].owner == FOE and not c[nx][ny].not_pass: # [f] = (nx, ny) if rem_units > 0: commands.append(f'MOVE 1 {x} {y} {nx} {ny}') my_units.remove((x, y)) rem_units -= 1 elif my_matter >= 10: commands.append(f'SPAWN 1 {x} {y}') my_matter -= 10 else: debug(f"Can't SPAWN 1 {x} {y} for [M][f]+") ''' [m][f] かつ phase >= 2 -> [M=1][f] * ✅ 実装 * TODO: どれくらい有効か見てみる ''' if phase >= 2: for y in range(height): for x in range(width): if not(c[x][y].units == 0 and c[x][y].owner == ME): continue if c[x][y].recycler: continue if c[x][y].deleted_next_turn: continue if c[x][y].not_pass: continue # [m] = (x, y) ng = False foe_area_count = 0 for nx, ny in next_xy(x, y): if c[nx][ny].owner == NEUTRAL and c[nx][ny].scrap_amount > 0 and not c[nx][ny].deleted_next_turn: # [.] = (nx, ny) ng = True if c[nx][ny].owner == FOE and c[nx][ny].units == 0: # [f] = (nx, ny) foe_area_count += 1 if c[nx][ny].owner == FOE and c[nx][ny].units > 0: # [F] = (nx, ny) ng = True if ng: continue if not ng and my_matter >= 10 and foe_area_count > 0: commands.append(f'SPAWN 1 {x} {y}') my_matter -= 10 ''' [M][F]+ [.]+[M][F]+ -> ✅ 空きマス(*1 recyclerで3ターン以内に消えない)にできる限りMOVE ✅ 残った M に対して F+ の量になるまで追加 SPAWN ✅ 空きマスにMOVEし足りなかった分 SPAWN Mの周りに空きマス(*1)がない -> phase >= 2 -> TODO(High): 攻め phase = 1 -> ✅ なるべく少ないFに突っ込む ''' for y in range(height): for x in range(width): if not(c[x][y].units > 0 and c[x][y].owner == ME): continue # [M] = (x, y) next_opp_unit_count = 0 next_space_xy = [] rem_units = my_units.count((x, y)) for nx, ny in next_xy(x, y): if c[nx][ny].units > 0 and c[nx][ny].owner == FOE: # [F] = (nx, ny) next_opp_unit_count += c[nx][ny].units # TODO(Middle): recycler で3ターン以内に消える空きマスであれば無視して良い if c[nx][ny].owner == NEUTRAL and c[nx][ny].scrap_amount > 0 and not c[nx][ny].deleted_next_turn: # [.] = (nx, ny) next_space_xy.append((nx, ny)) # そもそも周りにFがいなければなにもしない if next_opp_unit_count == 0: continue if len(next_space_xy) > 0: # 空きマス(*1)にできる限りMOVE for nx, ny in next_space_xy: if rem_units > 0: commands.append(f'MOVE 1 {x} {y} {nx} {ny}') my_units.remove((x, y)) rem_units -= 1 elif my_matter >= 10: commands.append(f'SPAWN 1 {x} {y}') my_matter -= 10 else: debug(f"Can't SPAWN 1 {x} {y} for [.]+[M][F]+") spawn_num = max(next_opp_unit_count - rem_units, 0) # rem_units は MOVE しないようにする for _ in range(rem_units): my_units.remove((x, y)) if my_matter >= spawn_num * 10 and spawn_num > 0: commands.append(f'SPAWN {spawn_num} {x} {y}') my_matter -= spawn_num * 10 else: debug(f"Can't SPAWN {spawn_num} {x} {y}") if phase >= 2: spawn_num = my_matter // 20 for _ in range(spawn_num): if my_matter >= 10: commands.append(f'SPAWN 1 {x} {y}') my_matter -= 10 else: debug(f"Can't SPAWN 1 {x} {y}") break else: # Mの周りに空きマス(*)がなければ、なるべく少ないFに突っ込む next_opp_units = [] next_opp_count = 0 for nx, ny in next_xy(x, y): if c[nx][ny].units > 0 and c[nx][ny].owner == FOE: next_opp_units.append((c[nx][ny].units, nx, ny)) next_opp_count += c[nx][ny].units next_opp_units.sort() commands.append(f'MOVE {rem_units} {x} {y} {next_opp_units[0][1]} {next_opp_units[0][2]}') for _ in range(rem_units): my_units.remove((x, y)) if phase >= 2: spawn_num = next_opp_unit_count + 1 for _ in range(spawn_num): if my_matter >= 10: commands.append(f'SPAWN 1 {x} {y}') my_matter -= 10 else: debug(f"Can't SPAWN 1 {x} {y}") break ''' TODO: [F][.][.][M] は全体のアルゴリズムでいざという時に詰められているか? ''' # Calc reachable cost qu = [] for y in range(height): for x in range(width): if c[x][y].owner != NEUTRAL: heapq.heappush(qu, (int(c[x][y].units == 0), x, y, c[x][y].owner)) while len(qu) != 0: cost, x, y, player = heapq.heappop(qu) if c[x][y].reachable[player] <= cost: continue if c[x][y].owner != NEUTRAL and c[x][y].owner != player: continue if c[x][y].not_pass: continue if c[x][y].scrap_amount == 0: continue if c[x][y].recycler: continue c[x][y].reachable[player] = cost for nx, ny in next_xy(x, y): # TODO(Low): recycler によるNターン後の道の封鎖を考慮(そのマスの寿命をdfsで計算する) heapq.heappush(qu, (cost + 1, nx, ny, player)) # List up destinations destinations = [] # (cost, x, y) for y in range(height): for x in range(width): # TODO: 目的地リストの中で、上のタスクで使用してるマスは除外 if c[x][y].reachable[ME] == INF: continue diff = c[x][y].reachable[FOE] - c[x][y].reachable[ME] if diff == 0: destinations.append((c[x][y].reachable[ME], x, y)) elif diff == 1: destinations.append((c[x][y].reachable[ME], x, y)) if len(destinations) == 0: ''' 分断完了後のマス埋め 空きマスの隣にSPAWN & destinations追加 * TODO: cut_done の判定は分断のときにやる ''' cut_done = True for y in range(height): for x in range(width): if not(c[x][y].owner == NEUTRAL and c[x][y].scrap_amount > 0): continue # [.] = (x, y) destinations.append((c[x][y].reachable[ME], x, y)) cancel = False spawn_command = "" for nx, ny in next_xy(x, y): if c[nx][ny].owner == ME and c[nx][ny].units > 0: cancel = True if c[nx][ny].owner == ME and c[nx][ny].units == 0: spawn_command = f'SPAWN 1 {nx} {ny}' if not cancel and spawn_command != "" and my_matter >= 150: commands.append(spawn_command) my_matter -= 10 ''' TODO: Move my_units to destinations diff が +2 or +3 のところに手分けして行く ''' # Top Waller if (my_top_x, my_top_y) in my_units: if is_left_side: x_range = range(width - 1, -1, -1) dst_x, dst_y = width - 1, 0 else: x_range = range(width) dst_x, dst_y = 0, 0 for y in range(height): if abs(opp_front_xs[y]) != INF: dst_x, dst_y = opp_front_xs[y], y break found = False for x in x_range: for y in range(0, min(my_top_y + 1, height//2)): # TODO: my_top_x, my_top_y からの reachable を計算すべし diff = c[x][y].reachable[FOE] - c[x][y].reachable[ME] if y > 0 and diff >= 2 and diff <= 3: dst_x, dst_y = x, y found = True break elif y == 0 and diff >= 1 and diff <= 3: dst_x, dst_y = x, y found = True break if found: break command = get_proper_step(my_top_x, my_top_y, dst_x, dst_y) debug(f'Top Waller: {(my_top_x, my_top_y)} -> {(dst_x, dst_y)}') if command != "": commands.append(command) my_units.remove((my_top_x, my_top_y)) # Bottom Waller if (my_bottom_x, my_bottom_y) in my_units: if is_left_side: x_range = range(width - 1, -1, -1) dst_x, dst_y = width - 1, height - 1 else: x_range = range(width) dst_x, dst_y = 0, height - 1 for y in range(height - 1, -1, -1): if abs(opp_front_xs[y]) != INF: dst_x, dst_y = opp_front_xs[y], y break found = False for x in x_range: for y in range(height - 1, max(my_bottom_y - 1, height//2), -1): # TODO: my_bottom_x, my_bottom_y からの reachable を計算すべし diff = c[x][y].reachable[FOE] - c[x][y].reachable[ME] if y < height - 1 and diff >= 2 and diff <= 3: dst_x, dst_y = x, y found = True break elif y == height - 1 and diff >= 1 and diff <= 3: dst_x, dst_y = x, y found = True break if found: break command = get_proper_step(my_bottom_x, my_bottom_y, dst_x, dst_y) debug(f'Bottom Waller: {(my_bottom_x, my_bottom_y)} -> {(dst_x, dst_y)}') if command != "": commands.append(command) my_units.remove((my_bottom_x, my_bottom_y)) # TODO: (my_front_x, my_front_y) # TODO もっとまともなのを考える # 1. dst からみて最短で来れる my_unit がいれば来させる destinations.sort(key=lambda item: item[0]) # cost小さい順 for dst_cost, dst_x, dst_y in destinations[:max(len(my_units), 4)]: src_units = get_src_units(dst_cost, dst_x, dst_y) for unit_x, unit_y, _ in src_units: if not cut_done and (unit_x, unit_y) == (my_top_x, my_top_y): continue if not cut_done and (unit_x, unit_y) == (my_bottom_x, my_bottom_y): continue if (unit_x, unit_y) in my_units: step_command = get_proper_step(unit_x, unit_y, dst_x, dst_y) if step_command != "": commands.append(step_command) my_units.remove((unit_x, unit_y)) c[dst_x][dst_y].targeted = True break # 2. unit からみて余ってる destinations がいれば来させる destinations = list(filter(lambda dst: not c[dst[1]][dst[2]].targeted, destinations)) if len(destinations) > 0 and len(my_units) > 0: # 2-B. destinations の中で遠いものに全て向かわせる? _, dst_x, dst_y = destinations[-1] for unit_x, unit_y in my_units: if not cut_done and (unit_x, unit_y) == (my_top_x, my_top_y): continue if not cut_done and (unit_x, unit_y) == (my_bottom_x, my_bottom_y): continue step_command = get_proper_step(unit_x, unit_y, dst_x, dst_y) if step_command != "": commands.append(step_command) my_units = [] # TODO: [M(deleted_next_turn)] があるのであれば動かす # TODO: リサイクルは自分の周りの1以上のマスの中で最小scrapamountであればやってもいい # TODO(Low): unitがいるマスはそのunitだけじゃなくそこからSPAWNもできるということをあまり考慮していない # TODO(High): 真ん中や余っているunitを良い感じに塗らせたり、SPAWNさせたりする # → 2 <= diff <= 3 を sortしてunits をそれぞれいい感じに向かわせる # TODO: それぞれの意思決定を debug print で分かりやすくする # Field print for y in range(height): row = [] for x in range(width): if c[x][y].recycler: row.append("RR" if c[x][y].owner == "ME" else "rr") elif c[x][y].owner == FOE: row.append("FF" if c[x][y].units > 0 else "ff") elif c[x][y].reachable[ME] == INF: row.append(" ") elif c[x][y].not_pass: row.append("xx") elif c[x][y].owner == ME: row.append("MM" if c[x][y].units > 0 else "mm") else: diff = c[x][y].reachable[FOE] - c[x][y].reachable[ME] if diff == 0: row.append("00") elif abs(diff) < 10: row.append(f'{"+" if diff > 0 else ""}{diff}') else: row.append("++" if diff > 0 else "--") print(' '.join(row), file=sys.stderr, flush=True) # Output commands = list(filter(lambda command: command, commands)) if len(commands) == 0: print("WAIT") else: print('; '.join(commands))
[ "syts175yana@gmail.com" ]
syts175yana@gmail.com
077511796d2fb021509e9b9b7a655e16d156254f
d3375f789ee64d3ca8495cb88f8f7cfc133c48ab
/visualization.py
ddaa10ee80a054b92a857aa0f0e9f4cc84a7050a
[]
no_license
danglingP0inter/Recognition-of-Handwritten-digits
9c8964dd7fd48c8df1d69870a6a0a6884a11b042
6579b9c2e76248c028474ad7dbaa0aeebb0070b0
refs/heads/master
2020-04-18T06:33:59.318688
2019-01-24T08:25:57
2019-01-24T08:25:57
167,326,417
1
0
null
null
null
null
UTF-8
Python
false
false
362
py
from mnist import MNIST from PIL import Image, ImageDraw # Load dataset mndata = MNIST('./data/') images, labels = mndata.load_training() # Pick the fifth image from the dataset (it's a 9) i = 4 image, label = images[i], labels[i] # Print the image output = Image.new("L", (28, 28)) output.putdata(image) output.save("output.png") # Print label print(label)
[ "noreply@github.com" ]
noreply@github.com
25e6e896033a557680d6a173703473897e0b1fdd
000b86164340d118fc87f14d5d73265e308d50f4
/ACGPN_inference/get_score.py
6b6e1ddfb188c2c3063a109cf3d0c23a2de75c93
[]
no_license
Gogo693/frank
3ff21db9d41fff6a7c202fb130e9b5f73b2db135
ef2ad6bb39df022defd7992d4510a23fe3eb5d39
refs/heads/master
2023-04-28T10:52:40.362367
2021-05-11T15:44:11
2021-05-11T15:44:11
332,807,586
0
0
null
null
null
null
UTF-8
Python
false
false
2,701
py
# calculate inception score for cifar-10 in Keras from math import floor from numpy import ones from numpy import expand_dims from numpy import log from numpy import mean from numpy import std from numpy import exp from numpy.random import shuffle from keras.applications.inception_v3 import InceptionV3 from keras.applications.inception_v3 import preprocess_input from keras.datasets import cifar10 from skimage.transform import resize from numpy import asarray from PIL import Image import os import numpy as np import sys # scale an array of images to a new size def scale_images(images, new_shape): images_list = list() for image in images: # resize with nearest neighbor interpolation new_image = resize(image, new_shape, 0) # store images_list.append(new_image) return asarray(images_list) # assumes images have any shape and pixels in [0,255] def calculate_inception_score(images, n_split=10, eps=1E-16): # load inception v3 model model = InceptionV3() # enumerate splits of images/predictions scores = list() n_part = floor(images.shape[0] / n_split) for i in range(n_split): # retrieve images ix_start, ix_end = i * n_part, (i + 1) * n_part # print(images.shape) subset = images[ix_start:ix_end] # convert from uint8 to float32 subset = subset.astype('float32') # scale images to the required size # print(subset.shape) subset = scale_images(subset, (299, 299, 3)) # pre-process images, scale to [-1,1] subset = preprocess_input(subset) # predict p(y|x) p_yx = model.predict(subset) # calculate p(y) p_y = expand_dims(p_yx.mean(axis=0), 0) # calculate KL divergence using log probabilities kl_d = p_yx * (log(p_yx + eps) - log(p_y + eps)) # sum over classes sum_kl_d = kl_d.sum(axis=1) # average over images avg_kl_d = mean(sum_kl_d) # undo the log is_score = exp(avg_kl_d) # store scores.append(is_score) # average across images is_avg, is_std = mean(scores), std(scores) return is_avg, is_std def main(root='results/'): images = [] for filename in os.listdir(root): im = np.array(Image.open(root + filename)) # im = np.expand_dims(im, axis = 0) images.append(im) # print(im.shape) images = np.asarray(images) # print(images.shape) # print(asd) # shuffle images shuffle(images) print('loaded', images.shape) # calculate inception score is_avg, is_std = calculate_inception_score(images) print('score', is_avg, is_std) main()
[ "giorgio.crepaldi93@gmail.com" ]
giorgio.crepaldi93@gmail.com
8d76957311696f5d8031a0f6af07845ca6839a63
6223dc2e5de7921696cb34fb62142fd4a4efe361
/.metadata/.plugins/org.eclipse.core.resources/.history/0/10c54487a564001418adf2b9b78fa3c6
9c5974137244fcb2386c19b2e81426b669f02921
[]
no_license
Mushirahmed/python_workspace
5ef477b2688e8c25b1372f546752501ee53d93e5
46e2ed783b17450aba29e4e2df7b656522b2b03b
refs/heads/master
2021-03-12T19:24:50.598982
2015-05-25T10:23:54
2015-05-25T10:23:54
24,671,376
0
1
null
2015-02-06T09:27:40
2014-10-01T08:40:33
Python
UTF-8
Python
false
false
2,411
#!/usr/bin/env python # # Copyright 2014 <+YOU OR YOUR COMPANY+>. # # This is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this software; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # import numpy as np from gnuradio import gr import gras class ztransform(gras.Block): """ docstring for block ztransform """ def __init__(self): gras.Block.__init__(self, name="ztransform", in_sig=[np.float32], out_sig=[np.float32]) def set_parameters(self,num,den,window): self.num = list(map(float,num.split(" "))) self.den = list(map(float,den.split(" "))) print("self.num") print("self.den") self.n = window self.num = np.poly1d(self.num) self.den = np.poly1d(self.den) self.den_coeff = self.den.c nm_coeff = self.num.c #print self.den_coeff self.den_ord = self.den.order self.num_ord = self.num.order for i in range(0,self.den_ord-self.num_ord): nm_coeff = np.insert(nm_coeff,0,0) self.num_coeff = nm_coeff #print self.num_coeff self.in_q = [0]*(self.den_ord + 1) self.out_q = [0]*(self.den_ord + 1) self.final_q = [] def work(self, input_items, output_items): in0 = input_items[0] out = output_items[0] #print "i am in work function" # <+signal processing here+> ans1 = 0 ans2 = 0 for i in range(1,self.den_ord + 1): ans1 += self.den_coeff[i]*self.out_q[len(self.out_q)-i] self.in_q.append(float(in0[0])) #print self.in_q for i in range(0,self.den_ord + 1): ans2 += self.num_coeff[i]*self.in_q[len(self.in_q)-i-1] #print ans2 ans = ans2 - ans1 ans = ans/self.den_coeff[0] self.out_q.append(ans) self.out_q.pop(0) self.in_q.pop(0) out[0] = ans print "OUTPUT:",out[0] #self.final_q.append(ans) self.consume(0,1) self.produce(0,1)
[ "imushir@gmail.com" ]
imushir@gmail.com
29082448882838e7a4277231b7d1440fd2de26ce
ba0be392e94049fa796fa94f3c33a52d9f17afc7
/3-Factorial/factorial.py
6062affaa0634cf40e108410f10e61ee168c6870
[]
no_license
olteffe/GrokkingAlgorithms
f985b7f6b92b48641f32ba2eff3c6d126c555fcb
c3584cd31ce6568080df72bb39a5855776f85617
refs/heads/master
2023-08-26T22:12:51.165361
2021-11-11T12:45:31
2021-11-11T12:45:31
424,656,976
0
0
null
null
null
null
UTF-8
Python
false
false
169
py
def fact(x: int) -> int: if x == 1: return 1 else: return x * fact(x-1) def main(): print(fact(5)) if __name__ == '__main__': main()
[ "olteffe@gmail.com" ]
olteffe@gmail.com
0eb2806e88e7b7ed43ae5003fc4771667bace830
09ae3fa519a48e81d4c0dd1ed54b1fb0ba06c804
/LAB_1/task2.py
c64bf5efd313cf5ad20f21d27b8665b22ad1964a
[]
no_license
GavrichenkoKate/infa_2021_gavrichenko
1e008141e78eecfa64deaa5ded8960164441c3f3
aab80bd038a22f01a0e821f53ec597ecf763a286
refs/heads/main
2023-09-06T07:27:54.218910
2021-11-15T11:39:17
2021-11-15T11:39:17
408,338,761
0
0
null
null
null
null
UTF-8
Python
false
false
207
py
import numpy as np import matplotlib.pyplot as plt x = np.arange(-10, 10.01, 0.01) plt.plot(x, x*x - x - 6) plt.xlabel(r'$x$') plt.ylabel(r'$f(x)$') plt.title(r'$f(x)=x^2 - x - 6$') plt.grid(True) plt.show()
[ "noreply@github.com" ]
noreply@github.com
c79f5defc4669af504b01120e06bf5dba6eb51f4
2bdedcda705f6dcf45a1e9a090377f892bcb58bb
/src/main/output/community/way/lot_world/month/car_level/president_program.py
09d22c760a6b771bc4aee758f82f7a48327f5762
[]
no_license
matkosoric/GenericNameTesting
860a22af1098dda9ea9e24a1fc681bb728aa2d69
03f4a38229c28bc6d83258e5a84fce4b189d5f00
refs/heads/master
2021-01-08T22:35:20.022350
2020-02-21T11:28:21
2020-02-21T11:28:21
242,123,053
1
0
null
null
null
null
UTF-8
Python
false
false
3,135
py
## Get supported languages for translation The following code gets a list of language codes representing languages supported for translation, using the GetLanguagesForTranslate method. 1. Create a new Node.JS project in your favorite IDE. 2. Add the code provided below. 3. Replace the `key` value with an access key valid for your subscription. 4. Run the program. ```nodejs 'use strict'; let https = require ('https'); // ********************************************** // *** Update or verify the following values. *** // ********************************************** // Replace the subscriptionKey string value with your valid subscription key. let subscriptionKey = '970028e5525647c21ea1b2b2ab045fbf'; let host = 'api.microsofttranslator.com'; let path = '/V2/Http.svc/GetLanguagesForTranslate'; let params = ''; let response_handler = function (response) { let body = ''; response.on ('data', function (d) { body += d; }); response.on ('end', function () { console.log (body); }); response.on ('error', function (e) { console.log ('Error: ' + e.message); }); }; let GetLanguagesForTranslate = function () { let request_params = { method : 'GET', hostname : host, path : path + params, headers : { 'ed56e4d6e94b67527cced64771b62d28' : subscriptionKey, } }; let req = https.request (request_params, response_handler); req.end (); } GetLanguagesForTranslate (); ``` **Get supported languages for translation response** A successful response is returned in XML, as shown in the following example: ```xml <ArrayOfstring xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <string>af</string> <string>ar</string> <string>bn</string> <string>bs-Latn</string> <string>bg</string> <string>ca</string> <string>zh-CHS</string> <string>zh-CHT</string> <string>yue</string> <string>hr</string> <string>cs</string> <string>da</string> <string>nl</string> <string>en</string> <string>et</string> <string>fj</string> <string>fil</string> <string>fi</string> <string>fr</string> <string>de</string> <string>el</string> <string>ht</string> <string>he</string> <string>hi</string> <string>mww</string> <string>hu</string> <string>id</string> <string>it</string> <string>ja</string> <string>sw</string> <string>tlh</string> <string>tlh-Qaak</string> <string>ko</string> <string>lv</string> <string>lt</string> <string>mg</string> <string>ms</string> <string>mt</string> <string>yua</string> <string>no</string> <string>otq</string> <string>fa</string> <string>pl</string> <string>pt</string> <string>ro</string> <string>ru</string> <string>sm</string> <string>sr-Cyrl</string> <string>sr-Latn</string> <string>sk</string> <string>sl</string> <string>es</string> <string>sv</string> <string>ty</string> <string>ta</string> <string>th</string> <string>to</string> <string>tr</string> <string>uk</string> <string>ur</string> <string>vi</string> <string>cy</string> </ArrayOfstring> ```
[ "soric.matko@gmail.com" ]
soric.matko@gmail.com
c05cfa6cdcbb0ebcaf7c05cf9eea5afacaf608c7
eafa31d951cfed5a10b77ae1258f19fab29f6442
/utils/pagerduty_api.py
e82b463865d87616469a4f59d7909285eff5abea
[ "Apache-2.0" ]
permissive
apahim/qontract-reconcile
4cbd459e18a6fe1be6d54c195702df2212985955
b540660da1ee5b2f843d42cf8754381c0487b6a9
refs/heads/master
2022-05-03T16:45:50.415734
2020-10-19T13:27:11
2020-10-19T13:27:11
227,624,515
0
0
Apache-2.0
2019-12-12T14:23:09
2019-12-12T14:23:08
null
UTF-8
Python
false
false
2,506
py
import pypd import datetime import requests import utils.secret_reader as secret_reader class PagerDutyUserNotFoundException(Exception): pass class PagerDutyApi(object): """Wrapper around PagerDuty API calls""" def __init__(self, token, settings=None): pd_api_key = secret_reader.read(token, settings=settings) pypd.api_key = pd_api_key self.init_users() def init_users(self): self.users = pypd.User.find() def get_pagerduty_users(self, resource_type, resource_id): now = datetime.datetime.utcnow() try: if resource_type == 'schedule': users = self.get_schedule_users(resource_id, now) elif resource_type == 'escalationPolicy': users = self.get_escalation_policy_users(resource_id, now) except requests.exceptions.HTTPError: return None return users def get_user(self, user_id): for user in self.users: if user.id == user_id: return user.email.split('@')[0] # should never be reached as user_id comes from PagerDuty API itself raise PagerDutyUserNotFoundException(user_id) def get_schedule_users(self, schedule_id, now): s = pypd.Schedule.fetch( id=schedule_id, since=now, until=now, time_zone='UTC') entries = s['final_schedule']['rendered_schedule_entries'] return [self.get_user(entry['user']['id']) for entry in entries] def get_escalation_policy_users(self, escalation_policy_id, now): ep = pypd.EscalationPolicy.fetch( id=escalation_policy_id, since=now, until=now, time_zone='UTC') users = [] rules = ep['escalation_rules'] for rule in rules: targets = rule['targets'] for target in targets: target_type = target['type'] if target_type == 'schedule_reference': schedule_users = \ self.get_schedule_users(target['id'], now) users.extend(schedule_users) elif target_type == 'user_reference': users.append(self.get_user(target['id'])) if users and rule['escalation_delay_in_minutes'] != 0: # process rules until users are found # and next escalation is not 0 minutes from now break return users
[ "noreply@github.com" ]
noreply@github.com
8e81c83eca27fafe4374430fd062b2cda78d9877
ca045f22bc2660a24d44ecacdb41f7a646df3d19
/src/exemplos/2_Operadores/9_exponenciacao.py
4888c9e422a96a463e3625ae6a742f61a4d519ba
[]
no_license
gabriel1997castro/CIC-APC
db7e4114bfa0925e976b64638cac9e94845d8376
217f66ab04b0529886d2ef22ce1de15103440ba3
refs/heads/master
2020-12-25T11:32:06.276710
2016-01-27T02:57:24
2016-01-27T02:57:24
50,466,976
0
0
null
2016-01-26T23:32:49
2016-01-26T23:32:49
null
UTF-8
Python
false
false
2,414
py
# -*- coding: utf-8 -*- # @file: 9_exponenciacao.py # @author: Guilherme N. Ramos (gnramos@unb.br) # @disciplina: Algoritmos e Programação de Computadores # # Exemplos de utilização do operador de exponenciação. print 'Exponenciação:' base = 0 expoente = 0 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) expoente = 1 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) expoente = 2 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) expoente = 3 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) base = 1 expoente = 0 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) expoente = 1 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) expoente = 2 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) expoente = 3 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) base = 2 expoente = 0 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) expoente = 1 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) expoente = 2 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) expoente = 3 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) base = 3 expoente = 0 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) expoente = 1 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) expoente = 2 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) expoente = 3 resultado = base ** expoente print ' (%d)**(%d) = %d' % (base, expoente, resultado) base = 2 expoente = -2 resultado = base ** expoente print ' (%d)**(%d) = %f' % (base, expoente, resultado) expoente = -1 resultado = base ** expoente print ' (%d)**(%d) = %f' % (base, expoente, resultado) expoente = 0.5 resultado = base ** expoente print ' (%d)**(%f) = %f' % (base, expoente, resultado) base = 4 expoente = 0.5 resultado = base ** expoente print ' (%d)**(%f) = %f' % (base, expoente, resultado) base = 8 expoente = 1.0/3.0 resultado = base ** expoente print ' (%d)**(%f) = %f' % (base, expoente, resultado)
[ "ramos@gnramos.com" ]
ramos@gnramos.com
a0ff9afe2f9a4d79aea2f7d6c0bba518ccf73cf9
be22c3bf693c7626f2fe27232933beb35981e200
/mtzs2structures.py
d955b92cf9e380a98e14d7490a338443417508e1
[]
no_license
miket928/mct_useful_scripts
cc9130b16e226b8d7673856f383ae72e8fdc53f0
b9b05f329052a639f64acd06f1ca7c473bb1c4f2
refs/heads/master
2021-05-14T02:32:45.684463
2018-10-04T03:40:04
2018-10-04T03:40:04
116,596,419
1
0
null
null
null
null
UTF-8
Python
false
false
6,850
py
#Script for copying a set of Rfree flags across multiple isomorphous data sets and #perform rigid-body refinement to initiate rebuild. #Usage: libtbx.python mtzs2structures.py [isomorphous.pdb] [r_free.mtz] #You will need to source a phenix installation to run with libtbx.python #Run from a directory containing all of the derivative MTZ files and the other inputs (native pdb file and mtz with R-free set) import os import sys import math import string from iotbx.reflection_file_reader import any_reflection_file import subprocess #Take command line input (isomorphous-ish PDB file and an MTZ file with desired FreeR_flags) #assess MTZ files #make a directory for each MTZ cwd = os.getcwd() isomorphous_input_pdb = sys.argv[1] isomorphous_input_pdb_fullpath = os.path.join(cwd, isomorphous_input_pdb) r_free_mtz = sys.argv[2] r_free_mtz_fullpath = os.path.join(cwd, r_free_mtz) root_dir = os.getcwd() original_mtz_files = [] original_mtz_filenames = [] dir_paths = [] for root, dirs, filenames in os.walk('./'): for filename in filenames: if filename.split('.')[-1] == 'mtz': fullpath = os.path.join(cwd, filename) original_mtz_files.append(fullpath) original_mtz_filenames.append(filename.split('.')[-2]) for i, mtz_filename in enumerate(original_mtz_filenames): dir_path = os.path.join(root_dir, mtz_filename) dir_paths.append(dir_path) os.mkdir(dir_path, 0755) #Run phenix.xtriage #retrieve unit cell parameters and space group #create input for reflection_file_editor and run #create new pdb with modified CRYST1 #set up phenix.refine for rigid body refinement and run for n, path in enumerate(dir_paths): print path os.chdir(path) cwd = os.getcwd() # xtriage_cmd = 'phenix.xtriage ../'+str(original_mtz_filenames[n])+'.mtz' # os.system(xtriage_cmd) hkl_file = any_reflection_file("../"+str(original_mtz_filenames[n])+'.mtz') info = hkl_file.file_content() xtals =info.crystals() if len(xtals) > 1: xtal = xtals[0] else: xtal =xtals space_group = info.space_group_number() unit_cell = xtal.unit_cell_parameters() uc_a, uc_b, uc_c, uc_al, uc_be, uc_ga = unit_cell uc_str = str(unit_cell)[1:-1] # xtriage_outfile = open('./logfile.log', 'r') # # unit_cell_line = xtriage_outfile.readlines()[20] # for line in xtriage_outfile.readlines(): # print line # unit_cell = unit_cell_line.split('=')[-1] # uc_a = unit_cell_line.split(' ')[-6] # uc_b = unit_cell_line.split(' ')[-5] # uc_c = unit_cell_line.split(' ')[-4] # uc_al = unit_cell_line.split(' ')[-3] # uc_be = unit_cell_line.split(' ')[-2] # uc_ga = unit_cell_line.split(' ')[-1] # space_group_line = xtriage_outfile.readlines()[21] # space_group = space_group_line.split('"')[-2] input_refl_mtz_file = original_mtz_files[n] output_mtz_filename = original_mtz_filenames[n]+"_flags.mtz" # output_mtz_file = os.path.join(cwd, flags_mtz_filename) output_mtz_file = os.path.join(cwd, output_mtz_filename) RFE_def_file_fullpath = os.path.join(cwd, "reflection_file_editor.def") RFE_def_file = open(RFE_def_file_fullpath, 'w') RFE_def_text = """show_arrays = False dry_run = False verbose = True mtz_file { crystal_symmetry { unit_cell = %s space_group = %s output_unit_cell = None output_space_group = None change_of_basis = None eliminate_invalid_indices = False expand_to_p1 = False disable_unit_cell_check = True disable_space_group_check = False eliminate_sys_absent = True } d_max = None d_min = None wavelength = None output_file = %s job_title = None resolve_label_conflicts = True exclude_reflection = None miller_array { file_name = %s labels = IOBS,SIGIOBS output_labels = IOBS SIGIOBS column_root_label = None d_min = None d_max = None output_as = *auto intensities amplitudes_fw amplitudes anomalous_data = *Auto merged anomalous force_type = *auto amplitudes intensities scale_max = None scale_factor = None remove_negatives = False massage_intensities = False filter_by_signal_to_noise = None add_b_iso = None add_b_aniso = 0 0 0 0 0 0 shuffle_values = False reset_values_to = None } miller_array { file_name = %s labels = R-free-flags output_labels = FreeR_flag column_root_label = None d_min = None d_max = None output_as = *auto intensities amplitudes_fw amplitudes anomalous_data = *Auto merged anomalous force_type = *auto amplitudes intensities scale_max = None scale_factor = None remove_negatives = False massage_intensities = False filter_by_signal_to_noise = None add_b_iso = None add_b_aniso = 0 0 0 0 0 0 shuffle_values = False reset_values_to = None } r_free_flags { generate = True force_generate = False new_label = "FreeR_flag" fraction = 0.1 max_free = 2000 lattice_symmetry_max_delta = 5 use_lattice_symmetry = True use_dataman_shells = False n_shells = 20 random_seed = None extend = True old_test_flag_value = None export_for_ccp4 = False preserve_input_values = True warn_if_all_same_value = True adjust_fraction = False d_eps = 0.0001 relative_to_complete_set = False remediate_mismatches = False } } """ % (uc_str, space_group, output_mtz_file, input_refl_mtz_file, r_free_mtz_fullpath) RFE_def_file.write(RFE_def_text) RFE_def_file.close() print "wrote RFE def file successfully!" subprocess.call(['iotbx.reflection_file_editor', 'reflection_file_editor.def']) # prepare input pdb file # pdbtools # cryst1 cryst1_sg = str(space_group).rjust(10) cryst1_line = "CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f%s \n" % (uc_a, uc_b, uc_c, uc_al, uc_be, uc_ga, space_group) # cryst1_line = "CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f%s \n" % (unit_cell, space_group) # cryst1_line = "CRYST1%s%s \n" % (unit_cell,space_group) orig_pdb_file = open(isomorphous_input_pdb_fullpath, 'r') output_pdb_file_fullpath = os.path.join(cwd, "coords_in_current_cell.pdb") output_pdb_file = open(output_pdb_file_fullpath, 'w') output_pdb_lines = [] for line in orig_pdb_file.readlines(): if line.startswith('ATOM'): output_pdb_lines.append(line) output_pdb_file.write(cryst1_line) for atom in output_pdb_lines: output_pdb_file.write(atom) output_pdb_file.close() pdbtools_cmd = "phenix.pdbtools %s convert_to_isotropic=True set_b_iso=20.00 remove='not protein' output.file_name='coords_in_current_cell.pdb'" % (output_pdb_file_fullpath) os.system(pdbtools_cmd) phenix_refine_cmd = "phenix.refine %s coords_in_current_cell.pdb strategy=rigid_body --space_group %s --unit_cell %s" % (output_mtz_file, space_group, uc_str.replace(" ","")) os.system(phenix_refine_cmd) os.chdir('..')
[ "miket928@users.noreply.github.com" ]
miket928@users.noreply.github.com
413aa420b985881d6b0be993051cd8740ed2b88e
7c9789aa0ac1cb7d3e1839c3aeffe8b7f9362ad4
/Tensorflow2/SaveModel.py
c8d7ce64c0245c86414302430690fd979b99dccc
[]
no_license
xjsaber/MyML
5ca511e84da3248bfec76ce2b70f0c1f102c3926
4a1930d92d6edd2e2edf0b340b0b1a6b18844418
refs/heads/main
2023-07-23T07:20:05.257267
2021-09-02T15:23:50
2021-09-02T15:24:10
369,053,904
0
0
null
null
null
null
UTF-8
Python
false
false
956
py
# 使用 SavedModel 格式 import os import tempfile from matplotlib import pyplot as plt import numpy as np import tensorflow as tf tmpdir = tempfile.mkdtemp() physical_devices = tf.config.list_physical_devices('GPU') for device in physical_devices: tf.config.experimental.set_memory_growth(device, True) # file = tf.keras.utils.get_file( # "grace_hopper.jpg", # "https://storage.googleapis.com/download.tensorflow.org/example_images/grace_hopper.jpg") file = './Datasets/grace_hopper.jpg' img = tf.keras.preprocessing.image.load_img(file, target_size=[224, 224]) plt.imshow(img) plt.axis('off') x = tf.keras.preprocessing.image.img_to_array(img) x = tf.keras.applications.mobilenet.preprocess_input( x[tf.newaxis,...]) labels_path = tf.keras.utils.get_file( 'ImageNetLabels.txt', 'https://storage.googleapis.com/download.tensorflow.org/data/ImageNetLabels.txt') imagenet_labels = np.array(open(labels_path).read().splitlines())
[ "xjsaber@yeah.net" ]
xjsaber@yeah.net
15733217b80855ba05d5934e7d07194f747db416
fa62a10dc55e5af03f24d0e0c1fe46502b814e8c
/python基础/发布模块/message_package/receive_message.py
c254e1c1f8703a6f9d885bb93783119a5f3acbd9
[]
no_license
jiangchuan617/PythonLearning
c5ede77f596c2282e819cc0270cef842e4147783
a8b999e348a0f90b8febc6ded8f4ae14a5f0ebe5
refs/heads/master
2022-05-02T04:37:59.515143
2022-05-01T16:20:15
2022-05-01T16:20:15
129,497,116
0
0
null
null
null
null
UTF-8
Python
false
false
55
py
def receive(): return '这是来自177***的消息'
[ "jiangfeng@jiangfengdeMacBook-Pro.local" ]
jiangfeng@jiangfengdeMacBook-Pro.local
ace2295d50585c48c7aa70f2db8b8c85f23a747c
0991830fd90a37462ca5ef6db5cb7c2a8f59c44f
/stopWWTslideshow.py
58a45a87bbeb0d7e82fb84ab87d76e92b9a240f0
[ "MIT" ]
permissive
ageller/SVL_db_nav
4e0d537c1a61e40a59f7d4ed7c5897c1c4a2c1e1
3b2a094dc01dcb731bec7c6f99f0c63ff750d9d6
refs/heads/main
2023-07-30T09:09:03.023072
2021-10-08T14:48:13
2021-10-08T14:48:13
223,447,110
0
0
null
null
null
null
UTF-8
Python
false
false
2,793
py
''' This code will automatically turn off the slideshow in WorldWide Telescope that is initiated in the current "WWTBasic" starter. This code will manipulate the mouse in order to access the menu and click on the checkbox. (This appears to be the easiest method.) The .bat file can be used to run the code from startup (or from a double click on the .bat file). Currently this is implemented to run at startup on the "tilewall". ''' import time #########toggle WWT fullscreen. #https://stackoverflow.com/questions/12996985/send-some-keys-to-inactive-window-with-python #https://stackoverflow.com/questions/55547940/how-to-get-a-list-of-the-name-of-every-open-window #https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes import win32gui import win32con import win32api hwndMain = None searchString = "WorldWide Telescope" def findProc(hwnd, foo): global hwndMain if win32gui.IsWindowVisible(hwnd): name = win32gui.GetWindowText(hwnd) if (searchString in name): hwndMain = hwnd print(hwnd, name) def toggleWWTfullscreen(): #find the unique ID of the WWT app win32gui.EnumWindows(findProc, None) if (hwndMain is None): return False #find the unique ID of the sub/child hwndChild = win32gui.GetWindow(hwndMain, win32con.GW_CHILD) #send F11 for fullscreen _ = win32api.PostMessage(hwndChild, win32con.WM_KEYDOWN, win32con.VK_F11, 0) return True #########For turning off the slide show (easiest to do this when it is not in fullscreen mode) from pynput.mouse import Button, Controller def toggleWWTslideshow(inFullscreen = True): #easiest to do this when the app isn't in full screen! So I will toggle on and off. if (inFullscreen): _ = toggleWWTfullscreen() mouse = Controller() #print(mouse.position) #these are probably dependent on the monitor. (Will need to update for 4K TV.) pExplore = [190, 50] pMenu = [190, 145] pMid = [1000, 400] #somewhere in middle pEnd = [1920, 0] #upper right corner mouse.position = pExplore time.sleep(3) #wait for the menu to open mouse.click(Button.left) time.sleep(1) mouse.position = pMenu time.sleep(1) mouse.click(Button.left) if (inFullscreen): time.sleep(1) _ = toggleWWTfullscreen() mouse.position = pMid time.sleep(3) #allow menu to fade, then hide mouse mouse.position = pEnd ############################################################# if __name__ == '__main__': #check if WWT is running print('Checking that WWT is running...') running = False while (not running): win32gui.EnumWindows(findProc, None) if (hwndMain is not None): running = True break print('... WWT is not running.') time.sleep(5) #wait a bit to make sure that WWT is fully loaded time.sleep(15) print('Turning off WWT slideshow...') toggleWWTslideshow()
[ "a-geller@northwestern.edu" ]
a-geller@northwestern.edu
0d0a0b3617df919849491feea5ce2e7a9fac4f4b
9508d6a89a7bd459ce62a9701795fcc3763dfdd6
/raft_wrapper.py
6019cb5fad48ac664f6c4310a7ad1a66417d89cc
[ "MIT" ]
permissive
zebrajack/layered-neural-atlases
3be4afc644aebf5a124b56321c4d605c176b4e06
1cc6428e4a603457f6b663d77df5f15f75d0220f
refs/heads/main
2023-08-24T13:56:22.687541
2021-10-23T18:43:57
2021-10-23T18:43:57
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,389
py
import torch import numpy as np import argparse import cv2 import sys import os from PIL import Image device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") sys.path.insert(0, './thirdparty/RAFT/core') from utils.utils import InputPadder from raft import RAFT from utils import flow_viz sys.path.remove('./thirdparty/RAFT/core') class RAFTWrapper(): def __init__(self, model_path, max_long_edge=900): args = argparse.Namespace() args.small = False args.mixed_precision = True args.model = model_path args.max_long_edge = max_long_edge self.model = torch.nn.DataParallel(RAFT(args)) self.model.load_state_dict(torch.load(args.model)) self.model = self.model.module self.model.to(device) self.model.eval() self.args = args def load_image(self, fn): img = np.array(Image.open(fn)).astype(np.uint8) if img is None: print(f'Error reading file: {fn}') sys.exit(1) im_h = img.shape[0] im_w = img.shape[1] long_edge = max(im_w, im_h) factor = long_edge / self.args.max_long_edge if factor > 1: new_w = int(im_w // factor) new_h = int(im_h // factor) img = cv2.resize(img, (new_w, new_h), interpolation=cv2.INTER_AREA) img = torch.from_numpy(img).permute(2, 0, 1).float() return img def load_image_list(self, image_files): images = [] for imfile in sorted(image_files): images.append(self.load_image(imfile)) images = torch.stack(images, dim=0) images = images.to(device) padder = InputPadder(images.shape) return padder.pad(images)[0] def load_images(self, fn1, fn2): """ load and resize to multiple of 64 """ images = [fn1, fn2] images = self.load_image_list(images) im1 = images[0, None] im2 = images[1, None] return im1, im2 def compute_flow(self, im1, im2): padder = InputPadder(im1.shape) im1, im2 = padder.pad(im1, im2) _, flow12 = self.model(im1, im2, iters=20, test_mode=True) flow12 = flow12[0].permute(1, 2, 0).detach().cpu().numpy() return flow12 def viz(self, flo): # map flow to rgb image img = flow_viz.flow_to_image(flo) return img
[ "yonikasten@gmail.com" ]
yonikasten@gmail.com
2e51ecf568f7cc81565abd284680556690f6bd10
08f298aa9e6703554f5c2ef141a82cfbbfe9c664
/feed/spiders/ksl.py
8864f9c3a5864b1e7bc788fb6b80faff029c483c
[]
no_license
bysorry/scrape-ksl
70c442c0b5907ea426fea44ff6551994306ebf2f
9ecd473917c614524d41d6da01357a92b2897762
refs/heads/master
2021-10-11T01:06:14.975528
2019-01-20T16:27:32
2019-01-20T16:27:32
213,028,545
2
0
null
null
null
null
UTF-8
Python
false
false
4,371
py
# -*- coding: utf-8 -*- import scrapy from ..contact import Contact import csv import json class KSLSpider(scrapy.Spider): name = "ksl" category = [ # "Baby",# # "Books and Media" # # "Clothing and Apparel", # # "Computers",# # "Cycling",# # "Electronics",# # "Furniture", # "General",# # "Industrial",# # "Musical Instruments",# # "Outdoors and Sporting",# "Recreational Vehicles",# # "Tickets", # # "Toys",# # "Weddings",# # "Winter Sports"# ] resultfile = open('small.csv', mode='w', newline='') writer = csv.writer(resultfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) def start_requests(self): header_row = ['name', 'home_phone', 'cell_phone', 'category', 'sub_category', 'city', 'state', 'zip'] self.writer.writerow(header_row) urls = [] for cat in self.category: urls.append('https://classifieds.ksl.com/s/{}'.format(cat)) # urls = [ # 'https://classifieds.ksl.com/s/Baby' # ] for url in urls: yield scrapy.Request(url=url, callback=self.parse) def parse(self, response): ttt = response.xpath('//span[@class="total-listings"]').xpath("text()").extract_first() ttt = ttt.replace(',', '').strip() count = int(ttt) if count == 0: yield scrapy.Request(url=response.url, dont_filter=True) # url = 'https://classifieds.ksl.com/search/index?perPage=96' # yield scrapy.Request(url=url, callback=self.parse_page) for page in range(0, int(count/24)): url = 'https://classifieds.ksl.com/search/index?page={}'.format(page) yield scrapy.Request(url=url, callback=self.parse_page) def parse_page(self, response): print(response.url) txt = response.text pos1 = txt.find('listings:') pos2 = txt.find('}],', pos1 + 1) if pos1 == -1 or pos2 == -1: yield scrapy.Request(url=response.url, dont_filter=True) jsontxt = txt[pos1 + len('listings:'):pos2 + 2] dddd = json.loads(jsontxt) for item in dddd: t_row = [] contact = {} contact['cell_phone'] = '' if 'cellPhone' in item: contact['cell_phone'] = item['cellPhone'] contact['home_phone'] = '' if 'homePhone' in item: contact['home_phone'] = item['homePhone'] # if contact['cellPhone'] == '999-999-9999' or contact['homePhone'] == '999-999-9999': # continue # if contact['cellPhone'] == '' and contact['homePhone'] == '': # continue contact['category'] = '' if 'category' in item: contact['category'] = item['category'] contact['sub_category'] = '' if 'subCategory' in item: contact['sub_category'] = item['subCategory'] contact['city'] = '' if 'city' in item: contact['city'] = item['city'] contact['state'] = '' if 'state' in item: contact['state'] = item['state'] contact['member_id'] = '' if 'name' in item: contact['member_id'] = item['name'] contact['zip'] = '' if 'zip' in item: contact['zip'] = item['zip'] print(contact) t_row.append(contact['member_id']) t_row.append(contact['home_phone']) t_row.append(contact['cell_phone']) t_row.append(contact['category']) t_row.append(contact['sub_category']) t_row.append(contact['city']) t_row.append(contact['state']) t_row.append(contact['zip']) self.writer.writerow(t_row) """ Baby Books and Media Clothing Computers Cycling Electronics Furniture General Industrial Musical Instruments Outdoors and Sporting Recreational Vehicles Services Toys Weddings Winter Sports """
[ "ceo@skylinesdigital.com" ]
ceo@skylinesdigital.com
142c92391f03f9036f5df23bd5d855af23e4e0ac
f0d713996eb095bcdc701f3fab0a8110b8541cbb
/YXjx9G5uQ4CdYPuB4_20.py
f0a10dccbee452d6af543673b232e8f6d5b7d4b0
[]
no_license
daniel-reich/turbo-robot
feda6c0523bb83ab8954b6d06302bfec5b16ebdf
a7a25c63097674c0a81675eed7e6b763785f1c41
refs/heads/main
2023-03-26T01:55:14.210264
2021-03-23T16:08:01
2021-03-23T16:08:01
350,773,815
0
0
null
null
null
null
UTF-8
Python
false
false
1,110
py
""" **Mubashir** needs your help to compare two lists. First list `lst1` contains some numbers and second list `lst2` contains **squared values of numbers given in the first list**. Create a function which takes these two lists and returns `True` if all square values are available, `False` otherwise. lst1 = [121, 144, 19, 161, 19, 144, 19, 11] lst2 = [121, 14641, 20736, 361, 25921, 361, 20736, 361] Returns `True` because **121 is square of 11, 14641 is square of 121, 20736 is square of 144, 361 is square of 19, 25921 the square of 161, and so on...** lst1 = [121, 144, 19, 161, 19, 144, 19, 11] lst2 = [11*11, 121*121, 144*144, 19*19, 161*161, 19*19, 144*144, 19*19] ### Examples simple_comp([121, 144, 19, 161, 19, 144, 19, 11], [121, 14641, 20736, 361, 25921, 361, 20736, 361]) ➞ True simple_comp([4, 4], [1, 31]) ➞ False simple_comp([2, 2, 3], [4, 4, 9]) ➞ True ### Notes Numbers can be in any order. """ def simple_comp(lst1, lst2): if lst1==None or lst2==None: return lst1==lst2 return sorted(x**2 for x in lst1)==sorted(lst2)
[ "daniel.reich@danielreichs-MacBook-Pro.local" ]
daniel.reich@danielreichs-MacBook-Pro.local