hexsha
string
size
int64
ext
string
lang
string
max_stars_repo_path
string
max_stars_repo_name
string
max_stars_repo_head_hexsha
string
max_stars_repo_licenses
list
max_stars_count
int64
max_stars_repo_stars_event_min_datetime
string
max_stars_repo_stars_event_max_datetime
string
max_issues_repo_path
string
max_issues_repo_name
string
max_issues_repo_head_hexsha
string
max_issues_repo_licenses
list
max_issues_count
int64
max_issues_repo_issues_event_min_datetime
string
max_issues_repo_issues_event_max_datetime
string
max_forks_repo_path
string
max_forks_repo_name
string
max_forks_repo_head_hexsha
string
max_forks_repo_licenses
list
max_forks_count
int64
max_forks_repo_forks_event_min_datetime
string
max_forks_repo_forks_event_max_datetime
string
content
string
avg_line_length
float64
max_line_length
int64
alphanum_fraction
float64
qsc_code_num_words_quality_signal
int64
qsc_code_num_chars_quality_signal
float64
qsc_code_mean_word_length_quality_signal
float64
qsc_code_frac_words_unique_quality_signal
float64
qsc_code_frac_chars_top_2grams_quality_signal
float64
qsc_code_frac_chars_top_3grams_quality_signal
float64
qsc_code_frac_chars_top_4grams_quality_signal
float64
qsc_code_frac_chars_dupe_5grams_quality_signal
float64
qsc_code_frac_chars_dupe_6grams_quality_signal
float64
qsc_code_frac_chars_dupe_7grams_quality_signal
float64
qsc_code_frac_chars_dupe_8grams_quality_signal
float64
qsc_code_frac_chars_dupe_9grams_quality_signal
float64
qsc_code_frac_chars_dupe_10grams_quality_signal
float64
qsc_code_frac_chars_replacement_symbols_quality_signal
float64
qsc_code_frac_chars_digital_quality_signal
float64
qsc_code_frac_chars_whitespace_quality_signal
float64
qsc_code_size_file_byte_quality_signal
float64
qsc_code_num_lines_quality_signal
float64
qsc_code_num_chars_line_max_quality_signal
float64
qsc_code_num_chars_line_mean_quality_signal
float64
qsc_code_frac_chars_alphabet_quality_signal
float64
qsc_code_frac_chars_comments_quality_signal
float64
qsc_code_cate_xml_start_quality_signal
float64
qsc_code_frac_lines_dupe_lines_quality_signal
float64
qsc_code_cate_autogen_quality_signal
float64
qsc_code_frac_lines_long_string_quality_signal
float64
qsc_code_frac_chars_string_length_quality_signal
float64
qsc_code_frac_chars_long_word_length_quality_signal
float64
qsc_code_frac_lines_string_concat_quality_signal
float64
qsc_code_cate_encoded_data_quality_signal
float64
qsc_code_frac_chars_hex_words_quality_signal
float64
qsc_code_frac_lines_prompt_comments_quality_signal
float64
qsc_code_frac_lines_assert_quality_signal
float64
qsc_codepython_cate_ast_quality_signal
float64
qsc_codepython_frac_lines_func_ratio_quality_signal
float64
qsc_codepython_cate_var_zero_quality_signal
bool
qsc_codepython_frac_lines_pass_quality_signal
float64
qsc_codepython_frac_lines_import_quality_signal
float64
qsc_codepython_frac_lines_simplefunc_quality_signal
float64
qsc_codepython_score_lines_no_logic_quality_signal
float64
qsc_codepython_frac_lines_print_quality_signal
float64
qsc_code_num_words
int64
qsc_code_num_chars
int64
qsc_code_mean_word_length
int64
qsc_code_frac_words_unique
null
qsc_code_frac_chars_top_2grams
int64
qsc_code_frac_chars_top_3grams
int64
qsc_code_frac_chars_top_4grams
int64
qsc_code_frac_chars_dupe_5grams
int64
qsc_code_frac_chars_dupe_6grams
int64
qsc_code_frac_chars_dupe_7grams
int64
qsc_code_frac_chars_dupe_8grams
int64
qsc_code_frac_chars_dupe_9grams
int64
qsc_code_frac_chars_dupe_10grams
int64
qsc_code_frac_chars_replacement_symbols
int64
qsc_code_frac_chars_digital
int64
qsc_code_frac_chars_whitespace
int64
qsc_code_size_file_byte
int64
qsc_code_num_lines
int64
qsc_code_num_chars_line_max
int64
qsc_code_num_chars_line_mean
int64
qsc_code_frac_chars_alphabet
int64
qsc_code_frac_chars_comments
int64
qsc_code_cate_xml_start
int64
qsc_code_frac_lines_dupe_lines
int64
qsc_code_cate_autogen
int64
qsc_code_frac_lines_long_string
int64
qsc_code_frac_chars_string_length
int64
qsc_code_frac_chars_long_word_length
int64
qsc_code_frac_lines_string_concat
null
qsc_code_cate_encoded_data
int64
qsc_code_frac_chars_hex_words
int64
qsc_code_frac_lines_prompt_comments
int64
qsc_code_frac_lines_assert
int64
qsc_codepython_cate_ast
int64
qsc_codepython_frac_lines_func_ratio
int64
qsc_codepython_cate_var_zero
int64
qsc_codepython_frac_lines_pass
int64
qsc_codepython_frac_lines_import
int64
qsc_codepython_frac_lines_simplefunc
int64
qsc_codepython_score_lines_no_logic
int64
qsc_codepython_frac_lines_print
int64
effective
string
hits
int64
73b8db5714154072049f41562b46bb8f89e7deee
1,233
py
Python
shortest-paths.py
SAUSy-Lab/map-speed-test
0c9e78056017a247976ff63782c6366c5a724bf4
[ "MIT" ]
2
2017-03-31T02:16:57.000Z
2019-07-13T14:31:04.000Z
shortest-paths.py
SAUSy-Lab/map-speed-test
0c9e78056017a247976ff63782c6366c5a724bf4
[ "MIT" ]
10
2017-01-07T04:26:41.000Z
2017-03-07T21:00:27.000Z
shortest-paths.py
SAUSy-Lab/map-speed-test
0c9e78056017a247976ff63782c6366c5a724bf4
[ "MIT" ]
null
null
null
# calculate shortest paths between OD pairs # in the map_speed_od postgis table # update the shortest path geometry into the table import requests, json, psycopg2 # get OD pairs from DB conn_string = ( "host='localhost' dbname='' user='' password=''" ) connection = psycopg2.connect(conn_string) connection.autocommit = True c = connection.cursor() c.execute(""" SELECT id, ST_X(ST_StartPoint(vector)) AS lon1, ST_Y(ST_StartPoint(vector)) AS lat1, ST_X(ST_EndPoint(vector)) AS lon2, ST_Y(ST_EndPoint(vector)) AS lat2 FROM map_speed_od """) # iterate over DB pairs for (rid,lon1,lat1,lon2,lat2) in c.fetchall(): # request route for these points options = { 'geometries':'geojson', 'overview':'full', 'steps':'false', 'annotations':'false' } response = requests.get( ('http://206.167.182.17:5000/route/v1/transit/'+str(lon1)+','+str(lat1)+';'+str(lon2)+','+str(lat2)), params=options, timeout=5 ) # parse the result j = json.loads(response.text) print json.dumps(j['routes'][0]['geometry']) # insert the route result c.execute(""" UPDATE map_speed_od SET shortest_path = ST_SetSRID(ST_GeomFromGeoJSON(%s),4326) WHERE id = %s; """, (json.dumps(j['routes'][0]['geometry']),rid,) )
25.163265
103
0.687753
179
1,233
4.631285
0.536313
0.038601
0.036188
0.048251
0.060314
0.060314
0
0
0
0
0
0.035171
0.146796
1,233
48
104
25.6875
0.752852
0.193836
0
0.054054
0
0
0.477642
0.145325
0
0
0
0
0
0
null
null
0.027027
0.027027
null
null
0.027027
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
73b9218ed262aae642dc0406539a72aa91d888bc
320
py
Python
my_tools/tools_for_os/for_file.py
Alex2Yang97/waiting_time_project
649dbaa4bd45b9b9974a5b71a8ee17fada07bcc9
[ "MIT" ]
null
null
null
my_tools/tools_for_os/for_file.py
Alex2Yang97/waiting_time_project
649dbaa4bd45b9b9974a5b71a8ee17fada07bcc9
[ "MIT" ]
12
2020-11-13T17:16:58.000Z
2021-04-23T01:25:17.000Z
my_tools/tools_for_os/for_file.py
Alex2Yang97/waiting_time_project
649dbaa4bd45b9b9974a5b71a8ee17fada07bcc9
[ "MIT" ]
null
null
null
#-*- coding:utf-8 -*- # @Time : 2020-02-15 15:49 # @Author : Zhirui(Alex) Yang # @Function : import os def create_folder(folder_name): if not os.path.exists(folder_name): os.makedirs(folder_name) print(folder_name, 'has created!') else: print(folder_name, 'already existed!')
17.777778
46
0.61875
43
320
4.465116
0.697674
0.260417
0.15625
0
0
0
0
0
0
0
0
0.053061
0.234375
320
17
47
18.823529
0.730612
0.284375
0
0
0
0
0.125561
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0
0.285714
0.285714
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
73c50231a058cf0ef478478e7a36afc7a3fd3081
3,481
py
Python
src/cam_loop.py
stay-whimsical/screamchess
4950d480f8f33db2bc3f2d94eea5dc6706ae8087
[ "MIT" ]
2
2019-06-19T20:25:12.000Z
2021-06-04T04:43:36.000Z
src/cam_loop.py
pablo-meier/screamchess
4950d480f8f33db2bc3f2d94eea5dc6706ae8087
[ "MIT" ]
8
2017-08-19T07:09:55.000Z
2017-08-20T21:11:11.000Z
src/cam_loop.py
pablo-meier/screamchess
4950d480f8f33db2bc3f2d94eea5dc6706ae8087
[ "MIT" ]
1
2020-04-17T00:19:43.000Z
2020-04-17T00:19:43.000Z
from camera import board_image_processor as bip from chess.models import * import cv2 import numpy as np from media.sound import * def show_webcam(mirror=False): cam = cv2.VideoCapture(0) while True: ret_val, img = cam.read() #chess_state = process_image(img) cv2.imshow('webcam', img) if cv2.waitKey(1) == 27: break def one_frame(id=0): cam = cv2.VideoCapture(id) ret_val, img = cam.read() #print("width: " + str(cam.get(3))) #print("height: " + str(cam.get(4))) # cv2.imwrite("testimage3.png", img) return img def show_all_hsv_color_ranges(steps, board_processor): step_size = 180/steps hsv = one_frame() for i in range(steps): lower = np.array([i*step_size, 50, 50]) upper = np.array([(i+1)*step_size, 255, 255]) conv = board_processor._get_convolved_image(hsv, (lower, upper)) board_processor._show_image(conv) def test_color_ranges(): board_processor = bip.BoardProcessor() red = (np.array([0, 50, 50]), np.array([18, 255, 255])) green = (np.array([19, 50, 50]), np.array([36, 255, 255])) blue = (np.array([90, 50, 50]), np.array([108, 255, 255])) color_map = {'W': green, 'B': blue} board_processor.set_color_map(color_map) return board_processor def blend_images(num): alpha = 0.5 beta = 1.0 - alpha gamma = 0.0 img = one_frame() for i in range(num): img2 = one_frame() img = cv2.addWeighted(img, alpha, img2, beta, gamma) return img def main_get_color_ranges(): board_processor = bip.BoardProcessor(debug_image_mode=False) show_all_hsv_color_ranges(10, board_processor) def main(): print 'Now initializing board processor' board_processor = bip.BoardProcessor(debug_image_mode=False) #board_processor = test_color_ranges() #board_processor = bip.BoardProcessor() state = board_processor.get_cur_state() board = Board() while True: #img = one_frame() print 'reading 5 frames' try: img = blend_images(5) tmp_im_path = '/tmp/img.jpg' cv2.imwrite(tmp_im_path, img) board_processor._cache_pil_im(tmp_im_path) board_processor._show_image(img, show_this_image=False) print 'updating state' board_processor.update_state(img) ret_state = board_processor.get_cur_state() if ret_state != state: pieces = [] for i in range(0,8): for j in range(0,8): if board.state[i][j].piece: pieces.append(board.state[i][j].piece) piece_index = random.randint(0, len(pieces) - 1) if pieces: play_sound(pieces[piece_index], random_action()) print '\033[34;1m Got state change, new state = \033[0m' for row in ret_state: m = [] for x in row: if x is None: m.append('-') else: m.append('P') print m state = ret_state else: print 'No new state', except Exception as e: print '\033[31;1m GOT EXCEPTION', e, '\033[0m' # show_webcam() if __name__ == '__main__': main() #main_get_color_ranges()
33.152381
72
0.564493
452
3,481
4.128319
0.316372
0.127546
0.036442
0.066452
0.219185
0.161308
0.102894
0.053591
0
0
0
0.046472
0.320023
3,481
104
73
33.471154
0.741867
0.076128
0
0.117647
0
0
0.057063
0
0
0
0
0
0
0
null
null
0
0.058824
null
null
0.082353
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
73c5ed5d0d7202bd31940ec8f1e4251cfbaeba8a
10,054
py
Python
app/views.py
allthingsclowd/K5_User_Onboarding_Example
313b0033ceb015cca86574762915e02000d4bbbb
[ "MIT" ]
null
null
null
app/views.py
allthingsclowd/K5_User_Onboarding_Example
313b0033ceb015cca86574762915e02000d4bbbb
[ "MIT" ]
null
null
null
app/views.py
allthingsclowd/K5_User_Onboarding_Example
313b0033ceb015cca86574762915e02000d4bbbb
[ "MIT" ]
null
null
null
#!/usr/bin/python """Summary - Flask Views Used to Control/Wrap a web UI around the Add User Python Script Author: Graham Land Date: 08/12/16 Twitter: @allthingsclowd Github: https://github.com/allthingscloud Blog: https://allthingscloud.eu """ from flask import flash, render_template, session, request, redirect, url_for, json, make_response from app import app import os,binascii import AddUserToProjectv3 as K5User import k5APIwrappersV19 as K5API from functools import wraps app.secret_key = os.urandom(24) JSESSION_ID = binascii.b2a_hex(os.urandom(16)) def login_required(f): """Summary - Decorator used to ensure that routes channeled through this function are authenticated already Otherwise they're returned to the login screen """ @wraps(f) def decorated_function(*args, **kwargs): if session['regionaltoken'] is None: return redirect(url_for('index', next=request.url)) return f(*args, **kwargs) return decorated_function @app.route('/', methods=['GET', 'POST']) @app.route('/login', methods=['GET', 'POST']) def index(): """Summary - Default login screen used to capture user login details and authenticate user session """ session['regionaltoken'] = None if request.headers.get('x-forwarded-proto') != 'https': secure_url=request.url.replace("http://","https://") return redirect(secure_url) if request.method == 'POST': adminUser = request.form.get('k5username', None) adminPassword = request.form.get('k5password', None) contract = request.form.get('k5contract', None) region = request.form.get('k5region', None) #print adminUser, adminPassword, contract, region try: regional_token = K5API.get_unscoped_token( adminUser, adminPassword, contract, region) #print regional_token #print regional_token.json() defaultid = regional_token.json()['token']['project'].get('id') global_token = K5API.get_globally_scoped_token( adminUser, adminPassword, contract, defaultid, region) if not isinstance(regional_token, str): #print "Got this far!!" for role in regional_token.json()['token']['roles']: if role['name'] == 'cpf_admin': session['adminUser'] = adminUser session['adminPassword'] = adminPassword session['regionaltoken'] = regional_token.headers[ 'X-Subject-Token'] session['globaltoken'] = global_token.headers[ 'X-Subject-Token'] session['contract'] = contract session['contractid'] = regional_token.json()['token']['project'][ 'domain'].get('id') session['defaultprjid'] = regional_token.json()['token'][ 'project'].get('id') session['region'] = region #print "Downloads" #print session['bubbles'].json() return redirect(url_for('adduser')) else: return render_template('hello-flask-login.html', title='K5 User Onboarding Portal (Demo)') except: return render_template('hello-flask-login.html', title='K5 User Onboarding Portal (Demo)') else: resp = make_response(render_template('hello-flask-login.html', title='K5 User Onboarding Portal (Demo)')) resp.set_cookie('JSESSIONID',JSESSION_ID) return resp @app.route('/adduser', methods=['GET', 'POST']) @login_required def adduser(): """Summary - Call the add user function """ if request.method == 'POST': if request.form.get('AddUser', None) == "Add User": adminUser = session['adminUser'] adminPassword = session['adminPassword'] contract = session['contract'] contractid = session['contractid'] region = session['region'] defaultprjid = session['defaultprjid'] try: regional_token = K5API.get_unscoped_token( adminUser, adminPassword, contract, region) global_token = K5API.get_globally_scoped_token( adminUser, adminPassword, contract, defaultprjid, region) id_token = K5API.get_unscoped_idtoken( adminUser, adminPassword, contract) except: return render_template('hello-flask-login.html', title='K5 User Onboarding Portal (Demo)') newregionaltoken = regional_token.headers['X-Subject-Token'] newglobaltoken = global_token.headers['X-Subject-Token'] email = request.form.get('k5useremail', None) userProject = request.form.get('k5project', None) userProjectA = unicode(userProject) + unicode('a') userProjectB = unicode(userProject) + unicode('b') try: resultprojecta = K5User.adduser_to_K5(id_token, newglobaltoken, newregionaltoken, contractid, contract, region, email, userProjectA) resultprojectb = K5User.adduser_to_K5(id_token, newglobaltoken, newregionaltoken, contractid, contract, region, email, userProjectB) #print result except: return render_template('hello-flask-login.html', title='K5 User Onboarding Portal (Demo)') if resultprojecta is not None: #print result session['newuserlogin'] = resultprojecta[2] session['newuserpassword'] = resultprojecta[4] session['newuserstatusa'] = resultprojecta[5] session['newuserprojecta'] = userProjectA session['newuserstatusb'] = resultprojectb[5] session['newuserprojectb'] = userProjectB session['newusercontract'] = contract session['newuserregion'] = region return redirect(url_for('userstatus')) else: if request.form.get('Logout', None) == "Logout": return redirect(url_for('logout')) if request.method == 'GET': region = session['region'] defaultprjid = session['defaultprjid'] regionaltoken = session['regionaltoken'] # report_bubbles = json.dumps(download_item_in_storage_container( # regionaltoken, # defaultprjid, # "Bubbles", # "Bubbles.json", region).json()) report_bubbles = [{ "name": "Test"}] #print "\n\n\nLoading JSON Details..................\n\n\n" #print "The actual JSON File.................." #print report_bubbles return render_template('hello-flask-adduser.html', title='K5 Add User', bubbles=report_bubbles) @app.route('/userstatus', methods=['GET', 'POST']) @login_required def userstatus(): """Summary - Display the results of the user add request """ if request.method == 'POST': if request.form.get('AddUser', None) == "Add Another User": return redirect(url_for('adduser')) else: if request.form.get('Logout', None) == "Logout": return redirect(url_for('logout')) if request.method == 'GET': username = session['newuserlogin'] userpassword = session['newuserpassword'] userstatusa = session['newuserstatusa'] userprojecta = session['newuserprojecta'] userstatusb = session['newuserstatusb'] userprojectb = session['newuserprojectb'] usercontract = session['newusercontract'] usercontractid = session['contractid'] userregion = session['newuserregion'] return render_template('hello-flask-result.html', title='K5 New User Details', userstatus=( 'Username : ' + username + ' | Password : ' + userpassword + ' | Project 1 : ' + userprojecta + ' | Status : ' + userstatusa + ' | Project 2 : ' + userprojectb + ' | Status : ' + userstatusb + ' | Contract : ' + usercontract + ' | Contract ID : ' + usercontractid + ' | Region : ' + userregion)) @app.route('/logout') @login_required def logout(): """Summary - Dump the user session cookies on logout """ # remove session vars session.pop('regionaltoken', None) session.pop('globaltoken', None) session.pop('adminUser', None) session.pop('adminPassword', None) return redirect(url_for('index'))
41.717842
98
0.514919
834
10,054
6.118705
0.266187
0.028023
0.027435
0.027435
0.321967
0.304527
0.222614
0.209289
0.209289
0.209289
0
0.007213
0.379451
10,054
240
99
41.891667
0.810707
0.118958
0
0.337349
0
0
0.157774
0.017937
0
0
0
0
0
1
0.036145
false
0.072289
0.036145
0
0.174699
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
1
73c9920f5c36cc9f240880ba80cb675e0c7cb5ca
5,135
py
Python
readux/books/abbyyocr.py
jpkarlsberg/readux
50a895dcf7d64b753a07808e9be218cab3682850
[ "Apache-2.0" ]
null
null
null
readux/books/abbyyocr.py
jpkarlsberg/readux
50a895dcf7d64b753a07808e9be218cab3682850
[ "Apache-2.0" ]
null
null
null
readux/books/abbyyocr.py
jpkarlsberg/readux
50a895dcf7d64b753a07808e9be218cab3682850
[ "Apache-2.0" ]
null
null
null
''' :class:`eulxml.xmlmap.XmlObject` classes for working with ABBYY FineReadux OCR XML. Currently supports **FineReader6-schema-v1** and **FineReader8-schema-v2**. ---- ''' from eulxml import xmlmap class Base(xmlmap.XmlObject): '''Base :class:`eulxml.xmlmap.XmlObject` for ABBYY OCR XML with common namespace declarations. ''' ROOT_NAMESPACES = { 'fr6v1': 'http://www.abbyy.com/FineReader_xml/FineReader6-schema-v1.xml', 'fr8v2': 'http://www.abbyy.com/FineReader_xml/FineReader8-schema-v2.xml' } 'namespaces for supported versions of FineReader xml' id = xmlmap.StringField('@xml:id') def frns(xpath): '''Utility function to convert a simple xpath to match any of the configured versions of ABBYY FineReader XML namespaces. Example conversions: * ``page`` becomes ``f1:page|f2:page`` * ``text/par`` becomes ``f1:page/f1:text|f2:page/f2:text`` Uses all declared namespace prefixes from :attr:`Base.ROOT_NAMESPACES` ''' namespaces = Base.ROOT_NAMESPACES.keys() return '|'.join('/'.join('%s:%s' % (ns, el) for el in xpath.split('/')) for ns in namespaces) class Formatting(Base): '''A group of characters in a single :class:`Line` with uniform formatting.''' ROOT_NAME = 'formatting' language = xmlmap.StringField('@lang') 'language of this formatted section' text = xmlmap.StringField('text()') 'text value' # char params ? # boolean attributes for: ff, fs, bold, italic, subscript, superscript, # smallcaps, underline, strikeout, color, scaling, spacing class Line(Base): '''A single line of text in a :class:`Paragraph`.''' ROOT_NAME = 'line' baseline = xmlmap.IntegerField('@baseline') 'integer baseline' left = xmlmap.IntegerField('@l') 'integer left' top = xmlmap.IntegerField('@t') 'integer top' right = xmlmap.IntegerField('@r') 'integer right' bottom = xmlmap.IntegerField('@b') 'integer bottom' formatted_text = xmlmap.NodeListField(frns('formatting'), Formatting) 'list of :class:`Formatting` elements' class Paragraph(Base): '''A single paragraph of text somewhere in a :class:`Document`.''' ROOT_NAME = 'par' align = xmlmap.StringField('@align') # default is Left; Center, Right, Justified 'text alignment (Left, Center, Right, Justified)' left_indent = xmlmap.IntegerField('@leftIndent') 'integer left indent' right_indent = xmlmap.IntegerField('@rightIndent') 'integer right indent' start_indent = xmlmap.IntegerField('@startIndent') 'integer start indent' line_spacing = xmlmap.IntegerField('@lineSpacing') 'integer line spacing' # dropChars stuff ? lines = xmlmap.NodeListField(frns('line'), Line) 'list of :class:`Line` elements' class Block(Base): ROOT_NAME = 'page' '''A single block of content on a :class:`Page`.''' type = xmlmap.StringField('@blockType') # Text, Table, Picture, Barcode 'type of block (Text, Table, Picture, Barcode)' left = xmlmap.IntegerField('@l') 'integer left' top = xmlmap.IntegerField('@t') 'integer top' right = xmlmap.IntegerField('@r') 'integer right' bottom = xmlmap.IntegerField('@b') 'integer bottom' # must have one & only one region; # region/rect dimensions appears to be redundant... paragraphs = xmlmap.NodeListField(frns('text/par'), Paragraph) 'list of :class:`Paragraph` elements' class Page(Base): '''A single page of a :class:`Document`.''' ROOT_NAME = 'page' width = xmlmap.IntegerField('@width') 'integer width' height = xmlmap.IntegerField('@height') 'integer height' resolution = xmlmap.IntegerField('@resolution') 'integer resolution' blocks = xmlmap.NodeListField(frns('block'), Block) 'list of :class:`Block` elements in this page' text_blocks = xmlmap.NodeListField(frns('block[@blockType="Text"]'), Block) 'text :class:`Block` elements (where type is "Text")' picture_blocks = xmlmap.NodeListField(frns('block[@blockType="Picture"]'), Block) 'picture :class:`Block` elements (where type is "Picture")' # block position info possibly redundant? map paragraphs directly paragraphs = xmlmap.NodeListField(frns('block/text/par'), Paragraph) 'list of :class:`Paragraph` elements in any of the blocks on this page' class Document(Base): ''':class:`~eulxml.xmlmap.XmlObject` class for an ABBYY OCR XML Document. .. Note:: Currently there is no support for tabular formatting elements. ''' ROOT_NAME ='document' pages = xmlmap.NodeListField(frns('page'), Page) 'pages as :class:`Page`' page_count = xmlmap.IntegerField('@pagesCount') 'integer page_count (document ``@pagesCount``)' language = xmlmap.StringField('@mainLanguage') 'main language of the document' languages = xmlmap.StringField('@languages') 'all languages included in the document'
36.161972
84
0.651996
587
5,135
5.669506
0.301533
0.091947
0.055288
0.033654
0.212139
0.170673
0.110577
0.110577
0.084135
0.084135
0
0.004467
0.21519
5,135
141
85
36.41844
0.82134
0.255696
0
0.222222
0
0
0.359759
0.013942
0
0
0
0
0
1
0.011111
false
0
0.011111
0
0.544444
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
73cb0638be23bf0c8d4dd43c1030dd71337f3c61
2,330
py
Python
tests/test_markdown_in_code_cells.py
st--/jupytext
f8e8352859cc22e17b11154d0770fd946c4a430a
[ "MIT" ]
5,378
2018-09-01T22:03:43.000Z
2022-03-31T06:51:42.000Z
tests/test_markdown_in_code_cells.py
st--/jupytext
f8e8352859cc22e17b11154d0770fd946c4a430a
[ "MIT" ]
812
2018-08-31T08:26:13.000Z
2022-03-30T18:12:11.000Z
tests/test_markdown_in_code_cells.py
st--/jupytext
f8e8352859cc22e17b11154d0770fd946c4a430a
[ "MIT" ]
380
2018-09-02T01:40:07.000Z
2022-03-25T13:57:23.000Z
"""Issue #712""" from nbformat.v4.nbbase import new_code_cell, new_notebook from jupytext import reads, writes from jupytext.cell_to_text import three_backticks_or_more from jupytext.compare import compare, compare_notebooks from .utils import requires_myst def test_three_backticks_or_more(): assert three_backticks_or_more([""]) == "```" assert three_backticks_or_more(["``"]) == "```" assert three_backticks_or_more(["```python"]) == "````" assert three_backticks_or_more(["```"]) == "````" assert three_backticks_or_more(["`````python"]) == "``````" assert three_backticks_or_more(["`````"]) == "``````" def test_triple_backticks_in_code_cell( no_jupytext_version_number, nb=new_notebook( metadata={"main_language": "python"}, cells=[ new_code_cell( '''a = """ ``` foo ``` """''' ) ], ), text='''--- jupyter: jupytext: main_language: python --- ````python a = """ ``` foo ``` """ ```` ''', ): actual_text = writes(nb, fmt="md") compare(actual_text, text) actual_nb = reads(text, fmt="md") compare_notebooks(actual_nb, nb) @requires_myst def test_triple_backticks_in_code_cell_myst( no_jupytext_version_number, nb=new_notebook( metadata={"main_language": "python"}, cells=[ new_code_cell( '''a = """ ``` foo ``` """''' ) ], ), text='''--- jupytext: main_language: python --- ````{code-cell} a = """ ``` foo ``` """ ```` ''', ): actual_text = writes(nb, fmt="md:myst") compare(actual_text, text) actual_nb = reads(text, fmt="md:myst") compare_notebooks(actual_nb, nb) def test_alternate_tree_four_five_backticks( no_jupytext_version_number, nb=new_notebook( metadata={"main_language": "python"}, cells=[ new_code_cell('a = """\n```\n"""'), new_code_cell("b = 2"), new_code_cell('c = """\n````\n"""'), ], ), text='''--- jupyter: jupytext: main_language: python --- ````python a = """ ``` """ ```` ```python b = 2 ``` `````python c = """ ```` """ ````` ''', ): actual_text = writes(nb, fmt="md") compare(actual_text, text) actual_nb = reads(text, fmt="md") compare_notebooks(actual_nb, nb)
17.923077
63
0.564807
260
2,330
4.707692
0.203846
0.058824
0.104575
0.130719
0.710784
0.689542
0.689542
0.637255
0.544118
0.544118
0
0.003356
0.232618
2,330
129
64
18.062016
0.681208
0.004292
0
0.71
0
0
0.223404
0
0
0
0
0
0.06
1
0.04
false
0
0.05
0
0.09
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
73cd6b9d543cd1b702c785eacf0e7b85b40a9737
629
py
Python
amy/workshops/migrations/0152_event_open_ttt_applications.py
code-review-doctor/amy
268c1a199510457891459f3ddd73fcce7fe2b974
[ "MIT" ]
53
2015-01-10T17:39:19.000Z
2019-06-12T17:36:34.000Z
amy/workshops/migrations/0152_event_open_ttt_applications.py
code-review-doctor/amy
268c1a199510457891459f3ddd73fcce7fe2b974
[ "MIT" ]
1,176
2015-01-02T06:32:47.000Z
2019-06-18T11:57:47.000Z
amy/workshops/migrations/0152_event_open_ttt_applications.py
code-review-doctor/amy
268c1a199510457891459f3ddd73fcce7fe2b974
[ "MIT" ]
44
2015-01-03T15:08:56.000Z
2019-06-09T05:33:08.000Z
# Generated by Django 2.1 on 2018-09-02 14:27 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('workshops', '0151_auto_20180902_0409'), ] operations = [ migrations.AddField( model_name='event', name='open_TTT_applications', field=models.BooleanField(blank=True, default=False, help_text="If this event is TTT, you can mark it as 'open applications' which means that people not associated with this event's member sites can also take part in this event.", verbose_name='TTT Open applications'), ), ]
33.105263
281
0.677266
82
629
5.097561
0.768293
0.064593
0
0
0
0
0
0
0
0
0
0.061983
0.230525
629
18
282
34.944444
0.801653
0.068362
0
0
1
0.083333
0.416096
0.075342
0
0
0
0
0
1
0
false
0
0.083333
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
73cf528b5a42e68ea53f81fc68bbf5a7a0f2cf10
688
py
Python
noheavenbot/cogs/commands/testing.py
Molanito13/noheaven-bot
ad126d4601321ecabff9d1d214ce7d3f4e258c3e
[ "MIT" ]
3
2018-10-13T14:05:24.000Z
2018-12-25T21:40:21.000Z
noheavenbot/cogs/commands/testing.py
Molanito13/noheaven-bot
ad126d4601321ecabff9d1d214ce7d3f4e258c3e
[ "MIT" ]
2
2018-10-08T14:33:39.000Z
2020-03-02T18:00:47.000Z
noheavenbot/cogs/commands/testing.py
Molanito13/noheaven-bot
ad126d4601321ecabff9d1d214ce7d3f4e258c3e
[ "MIT" ]
5
2018-10-08T14:18:58.000Z
2020-11-01T17:55:51.000Z
from discord.ext.commands import command, Cog from noheavenbot.utils.constants import TEXTCHANNELS from discord import Member from noheavenbot.utils.database_tables.table_users import Users from noheavenbot.utils.validator import has_role as check_role class Test(Cog): def __init__(self, bot): self.bot = bot @command() async def test(self, ctx): if check_role(ctx.message.author.roles, 445947005169303552, True): admin = True return await ctx.send('all ok') else: return await ctx.send('Solo los administradores pueden añadir bots con permisos de administración.') def setup(bot): bot.add_cog(Test(bot))
28.666667
112
0.709302
92
688
5.195652
0.586957
0.094142
0.125523
0.075314
0
0
0
0
0
0
0
0.033149
0.210756
688
23
113
29.913043
0.847145
0
0
0
0
0
0.117733
0
0
0
0
0
0
1
0.117647
false
0
0.294118
0
0.588235
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
73ddae6e14c41c647c3dc794212f25f68df13789
1,094
py
Python
Python/6-hc_sr04-sensor.py
matr1xprogrammer/raspberry_pi-iot
7ff8247fde839a23dd75720c58f3b04d86485ec4
[ "MIT" ]
2
2017-02-18T12:05:25.000Z
2017-02-18T12:15:53.000Z
Python/6-hc_sr04-sensor.py
matr1xprogrammer/raspberry_pi-iot
7ff8247fde839a23dd75720c58f3b04d86485ec4
[ "MIT" ]
null
null
null
Python/6-hc_sr04-sensor.py
matr1xprogrammer/raspberry_pi-iot
7ff8247fde839a23dd75720c58f3b04d86485ec4
[ "MIT" ]
null
null
null
#!/usr/bin/python # # HC-SR04 Ultrasonic ranging sensor # import RPi.GPIO as GPIO import sys, time try: GPIO.setmode(GPIO.BCM) TRIG = 23 ECHO = 24 print "Distance measurement in progress..." GPIO.setup(TRIG, GPIO.OUT) GPIO.setup(ECHO, GPIO.IN) GPIO.output(TRIG, False) while True: print "Waiting for sensor to settle" time.sleep(2) GPIO.output(TRIG, True) time.sleep(0.00001) GPIO.output(TRIG, False) while GPIO.input(ECHO) == 0: pulse_start = time.time() while GPIO.input(ECHO) == 1: pulse_end = time.time() pulse_duration = pulse_end - pulse_start distance = pulse_duration * 17150 distance = round(distance, 2) print "Distance: ", distance, "cm" except KeyboardInterrupt: GPIO.cleanup() print("<Ctrl+C> pressed... exiting.") except: GPIO.cleanup() print("Error: {0} {1}".format(sys.exc_info()[0], sys.exc_info()[1]))
22.791667
74
0.543876
128
1,094
4.585938
0.46875
0.051107
0.07155
0.064736
0.081772
0
0
0
0
0
0
0.034388
0.335466
1,094
47
75
23.276596
0.77304
0.045704
0
0.133333
0
0
0.1125
0
0
0
0
0
0
0
null
null
0
0.066667
null
null
0.166667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
73de6cd753fb9320e7590a96928403d694712cd8
1,632
py
Python
hc/front/tests/test_add_pdc.py
IfBkg/healthchecks
dcd8a74c6b0bcdb0065e7c27d5b6639823400562
[ "BSD-3-Clause" ]
1
2020-07-13T15:33:31.000Z
2020-07-13T15:33:31.000Z
hc/front/tests/test_add_pdc.py
IfBkg/healthchecks
dcd8a74c6b0bcdb0065e7c27d5b6639823400562
[ "BSD-3-Clause" ]
53
2020-11-27T14:55:01.000Z
2021-04-22T10:01:13.000Z
hc/front/tests/test_add_pdc.py
IfBkg/healthchecks
dcd8a74c6b0bcdb0065e7c27d5b6639823400562
[ "BSD-3-Clause" ]
null
null
null
from django.test.utils import override_settings from hc.api.models import Channel from hc.test import BaseTestCase @override_settings(PD_VENDOR_KEY="foo") class AddPdConnectTestCase(BaseTestCase): def setUp(self): super().setUp() self.url = "/projects/%s/add_pdc/" % self.project.code def test_it_works(self): session = self.client.session session["pd"] = "1234567890AB" # 12 characters session.save() self.client.login(username="alice@example.org", password="password") url = self.url + "1234567890AB/?service_key=123" r = self.client.get(url, follow=True) self.assertRedirects(r, self.channels_url) c = Channel.objects.get() self.assertEqual(c.kind, "pd") self.assertEqual(c.pd_service_key, "123") self.assertEqual(c.project, self.project) @override_settings(PD_VENDOR_KEY=None) def test_it_requires_vendor_key(self): self.client.login(username="alice@example.org", password="password") r = self.client.get(self.url) self.assertEqual(r.status_code, 404) @override_settings(PD_ENABLED=False) def test_it_requires_pd_enabled(self): self.client.login(username="alice@example.org", password="password") r = self.client.get(self.url) self.assertEqual(r.status_code, 404) def test_it_requires_rw_access(self): self.bobs_membership.rw = False self.bobs_membership.save() self.client.login(username="bob@example.org", password="password") r = self.client.get(self.url) self.assertEqual(r.status_code, 403)
34
76
0.677083
212
1,632
5.056604
0.316038
0.083955
0.033582
0.085821
0.399254
0.319963
0.319963
0.319963
0.319963
0.26959
0
0.028244
0.197304
1,632
47
77
34.723404
0.790076
0.007966
0
0.222222
0
0
0.105133
0.030921
0
0
0
0
0.194444
1
0.138889
false
0.111111
0.083333
0
0.25
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
1
73e0868276739ce21107e9b9452274d8030151db
2,568
py
Python
devel_notes/test_class_speed.py
mekhub/alphafold
8d89abf73ea07841b550b968aceae794acb244df
[ "MIT" ]
3
2019-05-15T16:46:20.000Z
2019-07-19T13:27:45.000Z
devel_notes/test_class_speed.py
mekhub/alphafold
8d89abf73ea07841b550b968aceae794acb244df
[ "MIT" ]
null
null
null
devel_notes/test_class_speed.py
mekhub/alphafold
8d89abf73ea07841b550b968aceae794acb244df
[ "MIT" ]
4
2020-02-08T02:43:01.000Z
2021-08-22T09:23:17.000Z
#!/usr/bin/python import time import sys import os from copy import deepcopy sys.path.append(os.path.join(os.getcwd(), '..')) from alphafold.partition import DynamicProgrammingData as DP def getval( DP, idx ): return DP.X[ idx ][ idx ] x = [[]]*500 for i in range( 500 ): x[i] = [0.0]*500 dx = deepcopy( x ) xcontrib = [[]]*500 for i in range( 500 ): xcontrib[i] = [[]]*500 xDP = DP( 500 ) # 500x500 object with other stuff in it. N = 500000 print 'Try for ', N, 'cycles each:' # Time getting print 'GETTING' t0 = time.time() for i in range( N ): y = x[56][56] t1 = time.time() print t1 - t0, 'y = x[56][56]' t0 = time.time() for i in range( N ): y = xDP.X[56][56] t1 = time.time() print t1 - t0,'y = xDP.X[56][56]' t0 = time.time() for i in range( N ): y = getval(xDP,56) t1 = time.time() print t1 - t0, 'y = getval(xDP,56)' t0 = time.time() for i in range( N ): y = xDP[56][56] t1 = time.time() print t1 - t0, 'y = xDP[56][56]' # Time setting print 'SETTING' t0 = time.time() for i in range( N ): x[56][56] = 20 t1 = time.time() print t1 - t0, 'x[56][56] = 20' t0 = time.time() for i in range( N ): xDP.X[56][56] = 20 t1 = time.time() print t1 - t0,'xDP.X[56][56] = 20' t0 = time.time() for i in range( N ): val = 20 xDP.X[56][56] = val t1 = time.time() print t1 - t0,'val = 20; xDP.X[56][56] = val' t0 = time.time() for i in range( N ): xDP[56][56] = 20 t1 = time.time() print t1 - t0,'xDP[56][56] = 20' # Time setting, including derivs print 'SETTING INCLUDE DERIVS' t0 = time.time() for i in range( N ): x[56][56] = 20 dx[56][56] = 0 t1 = time.time() print t1 - t0, 'x[56][56] = 20, dx[56][56] = 20' t0 = time.time() for i in range( N ): x[56][56] = (20,0) t1 = time.time() print t1 - t0, 'x[56][56] = (20,0)' t0 = time.time() for i in range( N ): xDP.X[56][56] = 20 xDP.dX[56][56] = 0 t1 = time.time() print t1 - t0,'xDP.X[56][56] = 20, xDP.dX[56][56]' t0 = time.time() for i in range( N ): xDP.add(56,56,20) t1 = time.time() print t1 - t0,'xDP += 20' # Time setting, including derivs and contribs print 'SETTING INCLUDE DERIVS AND CONTRIBS' t0 = time.time() for i in range( N ): x[56][56] = 20 dx[56][56] = 0 xcontrib[56][56].append( [x,56,56,20] ) t1 = time.time() print t1 - t0, 'x[56][56] = 20' t0 = time.time() for i in range( N ): xDP.X[56][56] = 20 xDP.dX[56][56] = 0 xDP.X_contrib[56][56].append( [x,56,56,20] ) t1 = time.time() print t1 - t0,'xDP.X[56][56] = 20' t0 = time.time() for i in range( N ): xDP.add(56,56,20) t1 = time.time() print t1 - t0,'xDP += 20'
20.709677
60
0.575545
496
2,568
2.977823
0.120968
0.097495
0.074475
0.126608
0.698714
0.661476
0.625592
0.602573
0.587678
0.551794
0
0.14824
0.214564
2,568
123
61
20.878049
0.584036
0.060748
0
0.568421
0
0
0.152535
0
0
0
0
0
0
0
null
null
0
0.052632
null
null
0.210526
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
73e9a8245d7f2b954b01c47bce5f6ddf87248068
781
py
Python
tym.py
tsyogesh40/Finger_recognition-Python-
4c1597cd246be1248bbfbb6cfc1ce1cbf5c4ecac
[ "MIT" ]
null
null
null
tym.py
tsyogesh40/Finger_recognition-Python-
4c1597cd246be1248bbfbb6cfc1ce1cbf5c4ecac
[ "MIT" ]
null
null
null
tym.py
tsyogesh40/Finger_recognition-Python-
4c1597cd246be1248bbfbb6cfc1ce1cbf5c4ecac
[ "MIT" ]
null
null
null
import datetime t=datetime.datetime.now() #date format weekday=t.strftime("%a") # %A for abbr day=t.strftime("%d") month=t.strftime("%b") #%B for abbr month_num=t.strftime("%m") year=t.strftime("%Y") date=t.strftime("%Y-%m-%d") print(date) #time format hour_12=t.strftime("%I") hour_24=t.strftime("%H") minutes=t.strftime("%H") seconds=t.strftime("%S") am_pm=t.strftime("%p") time_12=t.strftime("%I:%M:%S %p") #12hrs time AM/PM time_24=t.strftime("%H:%M:%S") #24 Hrs time print(time_12) print(time_24) def sem_calc(month): if(month>=1 & month<6): return "odd" else: return "even" def date(): t=datetime.datetime.now() time_12=t.strftime("%I:%M:%S %p") #12hrs time AM/PM return time_12 print(sem_calc(int(month_num))) print(date())
17.75
55
0.641485
139
781
3.510791
0.323741
0.258197
0.067623
0.07377
0.131148
0.131148
0.131148
0.131148
0.131148
0.131148
0
0.035714
0.139565
781
43
56
18.162791
0.690476
0.112676
0
0.137931
0
0
0.094752
0
0
0
0
0
0
1
0.068966
false
0
0.034483
0
0.206897
0.172414
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
73f2bc3599ec98d3aba14c518c543be223219c33
4,759
py
Python
cytochrome-b6f-nn-np-model-kinetics.py
vstadnyt/cytochrome
546aa450fa6dc2758b079aba258e3572dd24d60c
[ "MIT" ]
null
null
null
cytochrome-b6f-nn-np-model-kinetics.py
vstadnyt/cytochrome
546aa450fa6dc2758b079aba258e3572dd24d60c
[ "MIT" ]
null
null
null
cytochrome-b6f-nn-np-model-kinetics.py
vstadnyt/cytochrome
546aa450fa6dc2758b079aba258e3572dd24d60c
[ "MIT" ]
1
2021-09-28T17:17:48.000Z
2021-09-28T17:17:48.000Z
import cytochrome_lib #This is a cytochrome library import matplotlib.pyplot as plt import numpy as np version = "Last update: Aug 8, 2017" desription = "This code calculates population distribution in the cytochrome b6f protein and plots kinetic profiles for two different models: \n'nn' and 'np' models \n The outputs are: \n Figure 1: \n Figure 2: The ppulation distributions for different oxydations states of the cytochrome proteins. \n Figure 3: the resulting absorbance and circular dichroism kinetics for two different models" print desription print version #the eclusions_lst is a list of hemes that are taken into account during calculations (1 - include; 0 - exclude); #There are 8 values for 4 hemes and 2 dipoles per heme: [Qx_p1, Qy_p1, Qx_n1, Qy_n1, Qx_p2, Qy_p2, Qx_n2, Qy_n2] ##This is a main part of a code #This part creates two lists of several instances of a cyt class (see cytochrome library) with different input files exclusions_lst = [] exclusions_lst.append([0,0,0,0,0,0,0,0]) exclusions_lst.append([0,0,1,1,0,0,0,0]) exclusions_lst.append([1,1,1,1,0,0,0,0]) exclusions_lst.append([1,1,1,1,0,0,1,1]) exclusions_lst.append([1,1,1,1,1,1,1,1]) cyt_b6f_np = [] for excl in exclusions_lst: cyt_b6f_np.append(cytochrome_lib.cyt('cytochrome_b6f.txt',excl)) for i in range(len(exclusions_lst)): cyt_b6f_np[i].read_structure_file() cyt_b6f_np[i].Hamiltonian() cyt_b6f_np[i].D_and_R_strength() cyt_b6f_np[i].spectra_plot() exclusions_lst = [] exclusions_lst.append([0,0,0,0,0,0,0,0]) exclusions_lst.append([0,0,1,1,0,0,0,0]) exclusions_lst.append([0,0,1,1,0,0,1,1]) exclusions_lst.append([1,1,1,1,0,0,1,1]) exclusions_lst.append([1,1,1,1,1,1,1,1]) cyt_b6f_nn = [] for excl in exclusions_lst: cyt_b6f_nn.append(cytochrome_lib.cyt('cytochrome_b6f.txt',excl)) for i in range(len(exclusions_lst)): cyt_b6f_nn[i].read_structure_file() cyt_b6f_nn[i].Hamiltonian() cyt_b6f_nn[i].D_and_R_strength() cyt_b6f_nn[i].spectra_plot() x_range_nm = cyt_b6f_nn[0].x_range_nm plt.figure(1) plt.ion() plt.subplot(2,2,1) for i in range(len(exclusions_lst)): plt.plot(x_range_nm,np.sum(cyt_b6f_nn[i].specR,axis = 0),linewidth=2) #plt.plot(x_range_nm,np.sum(specR_full,axis = 0),linewidth=5) #plt.legend(['n1p1','n1n2','n1p2','p1n2','p1p2','n2p2']); plt.title('cytochrome b6f np model') plt.subplot(2,2,2) for i in range(len(exclusions_lst)): plt.plot(x_range_nm,np.sum(cyt_b6f_np[i].specR,axis = 0),linewidth=2) #plt.plot(x_range_nm,np.sum(specR_full,axis = 0),linewidth=5) plt.title('cytochrome b6f nn model') plt.subplot(2,2,3) for i in range(len(exclusions_lst)): plt.plot(x_range_nm,np.sum(cyt_b6f_nn[i].specD,axis = 0),linewidth=2) #plt.plot(x_range_nm,np.sum(specR_full,axis = 0),linewidth=5) plt.subplot(2,2,4) for i in range(len(exclusions_lst)): plt.plot(x_range_nm,np.sum(cyt_b6f_np[i].specD,axis = 0),linewidth=2) plt.show() length = 10000 population = cytochrome_lib.kinetics_solve(np.array([1,1,1,1,0,0,0]),length) plt.figure(2) plt.ion() for i in range(5): plt.plot(range(length),population[i,:]) plt.title("Population distribution of proteins in different oxydation states") plt.legend(['0e- state (fully oxydized)','1e- state','2e- state','3e- state','4e- state(fully reduced)']) plt.show() Absorbance_lst_b6f_nn = [] Circular_Dichroism_lst_b6f_nn = [] for i in range(5): Absorbance_lst_b6f_nn.append(population[i,:]*np.sum(np.sum(cyt_b6f_nn[i].specD,axis = 0))) Circular_Dichroism_lst_b6f_nn.append(population[i,:]*np.sum(np.abs(np.sum(cyt_b6f_nn[i].specR,axis = 0)))) Absorbance_b6f_nn = np.asarray(Absorbance_lst_b6f_nn) Circular_Dichroism_b6f_nn = np.asarray(Circular_Dichroism_lst_b6f_nn) Absorbance_lst_b6f_np = [] Circular_Dichroism_lst_b6f_np = [] for i in range(5): Absorbance_lst_b6f_np.append(population[i,:]*np.sum(np.sum(cyt_b6f_np[i].specD,axis = 0))) Circular_Dichroism_lst_b6f_np.append(population[i,:]*np.sum(np.abs(np.sum(cyt_b6f_np[i].specR,axis = 0)))) Absorbance_b6f_np = np.asarray(Absorbance_lst_b6f_np) Circular_Dichroism_b6f_np = np.asarray(Circular_Dichroism_lst_b6f_np) plt.figure(3) plt.ion() plt.title('cytochrome b6f nn and np models') plt.plot(range(length),np.sum(Absorbance_b6f_nn, axis = 0)/np.max(np.sum(Absorbance_b6f_nn, axis = 0))) plt.plot(range(length),np.sum(Absorbance_b6f_np, axis = 0)/np.max(np.sum(Absorbance_b6f_np, axis = 0))) plt.plot(range(length),np.sum(Circular_Dichroism_b6f_nn, axis = 0)/np.max(np.sum(Circular_Dichroism_b6f_nn, axis = 0))) plt.plot(range(length),np.sum(Circular_Dichroism_b6f_np, axis = 0)/np.max(np.sum(Circular_Dichroism_b6f_np, axis = 0))) plt.legend(['OD_nn','OD_np','CD_nn','CD_np']) plt.show() print "\nCalculations are finished. Please, see figures 1-3"
36.328244
394
0.741963
891
4,759
3.753086
0.171717
0.019139
0.017943
0.016746
0.612739
0.571471
0.488337
0.45305
0.394737
0.325359
0
0.053446
0.103593
4,759
130
395
36.607692
0.730427
0.132801
0
0.313953
0
0.011628
0.177357
0
0
0
0
0
0
0
null
null
0
0.034884
null
null
0.034884
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
73fb16f86099e7cc34882ec8e6eb8ce6cb617a74
487
py
Python
processing/1_comset.py
acleclair/ICPC2020_GNN
a8b03de597e8f25c17503c3834c7956ecc8f2247
[ "MIT" ]
58
2020-04-09T20:29:34.000Z
2022-03-28T11:38:40.000Z
processing/1_comset.py
acleclair/ICPC2020_GNN
a8b03de597e8f25c17503c3834c7956ecc8f2247
[ "MIT" ]
11
2020-04-11T14:19:01.000Z
2021-11-27T07:38:41.000Z
processing/1_comset.py
acleclair/ICPC2020_GNN
a8b03de597e8f25c17503c3834c7956ecc8f2247
[ "MIT" ]
14
2020-06-15T14:32:03.000Z
2022-01-23T10:33:15.000Z
import pickle bad_fid = pickle.load(open('autogenfid.pkl', 'rb')) comdata = 'com_pp.txt' good_fid = [] outfile = './output/dataset.coms' fo = open(outfile, 'w') for line in open(comdata): tmp = line.split(',') fid = int(tmp[0].strip()) if bad_fid[fid]: continue com = tmp[1].strip() com = com.split() if len(com) > 13 or len(com) < 3: continue com = ' '.join(com) fo.write('{}, <s> {} </s>\n'.format(fid, com)) fo.close()
20.291667
51
0.546201
71
487
3.690141
0.577465
0.045802
0
0
0
0
0
0
0
0
0
0.013699
0.250513
487
23
52
21.173913
0.70411
0
0
0.111111
1
0
0.137577
0.043121
0
0
0
0
0
1
0
false
0
0.055556
0
0.055556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
73fbbcb7d6e336ad39011f035279ed591c9a4ab4
937
py
Python
src/create_scatterplot.py
djparente/coevol-utils
966a1f16872d72886b92cc3fa51f803412acc481
[ "BSD-3-Clause" ]
1
2016-03-13T05:26:40.000Z
2016-03-13T05:26:40.000Z
src/create_scatterplot.py
djparente/coevol-utils
966a1f16872d72886b92cc3fa51f803412acc481
[ "BSD-3-Clause" ]
null
null
null
src/create_scatterplot.py
djparente/coevol-utils
966a1f16872d72886b92cc3fa51f803412acc481
[ "BSD-3-Clause" ]
null
null
null
#!/cygdrive/c/Python27/python.exe # Daniel J. Parente, Ph.D. # Swint-Kruse Laboratory # Physician Scientist Training Program # University of Kansas Medical Center # This code is adapted from the example available at # http://pandasplotting.blogspot.com/2012/04/added-kde-to-scatter-matrix-diagonals.html # Creates a scatterplot matrix (off-diagonals) with a kernal density estimate (KDE) # of the distribution of (univariate) data on the diagonal import numpy as np import matplotlib.pyplot as plt import pandas import sys infile=sys.argv[1] outfile=sys.argv[2] maindata = pandas.read_csv(infile, sep="\t") plt.rcParams['patch.facecolor'] = 'k' # Make the markers black # Plot ax = pandas.tools.plotting.scatter_matrix(maindata, alpha=0.1, marker='k.', figsize=(8,8), diagonal='kde', range_padding=0.1) # Give a small inter-plot spacing plt.subplots_adjust(wspace=.05, hspace=.05) #Save the figure plt.savefig(outfile, dpi=600)
28.393939
125
0.760939
145
937
4.889655
0.744828
0.036671
0
0
0
0
0
0
0
0
0
0.027879
0.11953
937
33
126
28.393939
0.831515
0.537887
0
0
0
0
0.054632
0
0
0
0
0
0
1
0
false
0
0.363636
0
0.363636
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
1
73fea2fbc1c54c3ba581a8b82427643b53be014d
1,444
py
Python
manu_sawyer/src/tensorflow_model_is_gripping/grasp_example.py
robertocalandra/the-feeling-of-success
7bb895897e369ae9f5fcaeed61d401e019a9cdf1
[ "MIT" ]
10
2018-05-31T04:57:25.000Z
2021-05-28T11:22:29.000Z
manu_sawyer/src/tensorflow_model_is_gripping/grasp_example.py
robertocalandra/the-feeling-of-success
7bb895897e369ae9f5fcaeed61d401e019a9cdf1
[ "MIT" ]
null
null
null
manu_sawyer/src/tensorflow_model_is_gripping/grasp_example.py
robertocalandra/the-feeling-of-success
7bb895897e369ae9f5fcaeed61d401e019a9cdf1
[ "MIT" ]
3
2018-05-31T05:00:08.000Z
2019-02-25T06:32:45.000Z
import grasp_net, grasp_params, h5py, aolib.img as ig, os, numpy as np, aolib.util as ut net_pr = grasp_params.im_fulldata_v5() net_pr = grasp_params.gel_im_fulldata_v5() checkpoint_file = '/home/manu/ros_ws/src/manu_research/manu_sawyer/src/tensorflow_model_is_gripping/training/net.tf-6499' gpu = '/gpu:0' db_file = '/media/backup_disk/dataset_manu/ver2/2017-06-22/2017-06-22_212702.hdf5' with h5py.File(db_file, 'r') as db: pre, mid, _ = grasp_net.milestone_frames(db) # sc = lambda x : ig.scale(x, (224, 224)) def sc(x): """ do a center crop (helps with gelsight) """ x = ig.scale(x, (256, 256)) return ut.crop_center(x, 224) u = ig.uncompress crop = grasp_net.crop_kinect inputs = dict( gel0_pre=sc(u(db['GelSightA_image'].value[pre])), gel1_pre=sc(u(db['GelSightB_image'].value[pre])), gel0_post=sc(u(db['GelSightA_image'].value[mid])), gel1_post=sc(u(db['GelSightB_image'].value[mid])), im0_pre=sc(crop(u(db['color_image_KinectA'].value[pre]))), im0_post=sc(crop(u(db['color_image_KinectA'].value[mid]))), # these are probably unnecessary depth0_pre=sc(crop(db['depth_image_KinectA'].value[pre].astype('float32'))), depth0_post=sc(crop(db['depth_image_KinectA'].value[mid].astype('float32')))) net = grasp_net.NetClf(net_pr, checkpoint_file, gpu) prob = net.predict(**inputs) print 'prob = ', prob
40.111111
121
0.668975
229
1,444
3.991266
0.414847
0.019694
0.021882
0.035011
0.238512
0.238512
0.133479
0.067834
0
0
0
0.049875
0.166898
1,444
35
122
41.257143
0.709892
0.048476
0
0
0
0.08
0.25283
0.129057
0
0
0
0
0
0
null
null
0
0.04
null
null
0.04
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
73fecce467712a52b8aaf68f72a88091d6f9da83
418
py
Python
src/TestDice.py
Yamanama/CodeMonkeyApplication
4dc24016b96dbed5b8e833d5248dd76d1f3dfc08
[ "MIT" ]
null
null
null
src/TestDice.py
Yamanama/CodeMonkeyApplication
4dc24016b96dbed5b8e833d5248dd76d1f3dfc08
[ "MIT" ]
null
null
null
src/TestDice.py
Yamanama/CodeMonkeyApplication
4dc24016b96dbed5b8e833d5248dd76d1f3dfc08
[ "MIT" ]
null
null
null
import unittest from Dice import Dice class TestDice(unittest.TestCase): def setUp(self): self.sides = 8 self.dice = Dice(self.sides) def test_roll(self): for i in range(1000): self.assertLessEqual(self.dice.roll(), self.sides) def test_error(self): self.assertRaises(ValueError, Dice, 0) if __name__ == '__main__': # pragma no cover unittest.main()
19.904762
62
0.636364
54
418
4.740741
0.555556
0.105469
0.09375
0.125
0
0
0
0
0
0
0
0.019231
0.253589
418
20
63
20.9
0.801282
0.035885
0
0
0
0
0.01995
0
0
0
0
0
0.153846
1
0.230769
false
0
0.153846
0
0.461538
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
1
fb40d608ac0b102b80003c2f549912877d9e3d53
963
py
Python
wagtail/snippets/urls.py
brownaa/wagtail
c97bc56c6822eb1b6589d5c33e07f71acfc48845
[ "BSD-3-Clause" ]
2
2021-03-18T21:41:05.000Z
2021-03-18T21:41:08.000Z
wagtail/snippets/urls.py
brownaa/wagtail
c97bc56c6822eb1b6589d5c33e07f71acfc48845
[ "BSD-3-Clause" ]
13
2015-05-08T12:27:10.000Z
2020-01-23T14:45:57.000Z
wagtail/snippets/urls.py
brownaa/wagtail
c97bc56c6822eb1b6589d5c33e07f71acfc48845
[ "BSD-3-Clause" ]
2
2020-09-03T20:12:32.000Z
2021-03-29T08:29:23.000Z
from django.urls import path from wagtail.snippets.views import chooser, snippets app_name = 'wagtailsnippets' urlpatterns = [ path('', snippets.index, name='index'), path('choose/', chooser.choose, name='choose_generic'), path('choose/<slug:app_label>/<slug:model_name>/', chooser.choose, name='choose'), path('choose/<slug:app_label>/<slug:model_name>/<str:pk>/', chooser.chosen, name='chosen'), path('<slug:app_label>/<slug:model_name>/', snippets.list, name='list'), path('<slug:app_label>/<slug:model_name>/add/', snippets.create, name='add'), path('<slug:app_label>/<slug:model_name>/<str:pk>/', snippets.edit, name='edit'), path('<slug:app_label>/<slug:model_name>/multiple/delete/', snippets.delete, name='delete-multiple'), path('<slug:app_label>/<slug:model_name>/<str:pk>/delete/', snippets.delete, name='delete'), path('<slug:app_label>/<slug:model_name>/<str:pk>/usage/', snippets.usage, name='usage'), ]
45.857143
105
0.688474
132
963
4.886364
0.219697
0.086822
0.148837
0.19845
0.502326
0.409302
0.409302
0.274419
0.15814
0
0
0
0.094496
963
20
106
48.15
0.739679
0
0
0
0
0
0.470405
0.376947
0
0
0
0
0
1
0
false
0
0.133333
0
0.133333
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
fb427d81000b8506419aa7780e97ffc579670c50
813
py
Python
tools_d2/convert-pretrain-model-to-d2.py
nguyentritai2906/panoptic-deeplab
6bbe17801488a417ed9586acab285ee6a05d68cb
[ "Apache-2.0" ]
506
2020-06-12T01:07:56.000Z
2022-03-26T00:56:52.000Z
tools_d2/convert-pretrain-model-to-d2.py
MrMa-T/panoptic-deeplab
cf8e20bbbf1cf540c7593434b965a93c4a889890
[ "Apache-2.0" ]
85
2020-06-12T04:51:31.000Z
2022-03-23T16:19:44.000Z
tools_d2/convert-pretrain-model-to-d2.py
MrMa-T/panoptic-deeplab
cf8e20bbbf1cf540c7593434b965a93c4a889890
[ "Apache-2.0" ]
102
2020-06-12T06:45:44.000Z
2022-03-22T14:03:04.000Z
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import pickle as pkl import sys import torch """ Usage: # download your pretrained model: wget https://github.com/LikeLy-Journey/SegmenTron/releases/download/v0.1.0/tf-xception65-270e81cf.pth -O x65.pth # run the conversion ./convert-pretrained-model-to-d2.py x65.pth x65.pkl # Then, use x65.pkl with the following changes in config: MODEL: WEIGHTS: "/path/to/x65.pkl" PIXEL_MEAN: [128, 128, 128] PIXEL_STD: [128, 128, 128] INPUT: FORMAT: "RGB" """ if __name__ == "__main__": input = sys.argv[1] obj = torch.load(input, map_location="cpu") res = {"model": obj, "__author__": "third_party", "matching_heuristics": True} with open(sys.argv[2], "wb") as f: pkl.dump(res, f)
24.636364
114
0.681427
123
813
4.365854
0.699187
0.044693
0.03352
0
0
0
0
0
0
0
0
0.060831
0.170972
813
32
115
25.40625
0.735905
0.109471
0
0
0
0
0.193333
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
1
fb4386dbb22354c808375368f8d1474f3605a181
2,953
py
Python
test_geo.py
OrrEos/IA-Flood-Warning-Project
af485560050c6e387aabf0bd7500b13de62f810f
[ "MIT" ]
null
null
null
test_geo.py
OrrEos/IA-Flood-Warning-Project
af485560050c6e387aabf0bd7500b13de62f810f
[ "MIT" ]
null
null
null
test_geo.py
OrrEos/IA-Flood-Warning-Project
af485560050c6e387aabf0bd7500b13de62f810f
[ "MIT" ]
1
2022-01-24T09:57:24.000Z
2022-01-24T09:57:24.000Z
import random from floodsystem.utils import sorted_by_key # noqa from floodsystem.geo import stations_by_distance, stations_within_radius, rivers_with_station, stations_by_river,rivers_by_station_number from floodsystem.stationdata import build_station_list '''def test_geo(): #Task 1A #does the function give an output & if it's a list: out = build_station_list() assert type(out) == list #checking that list is a reasonable length assert len(out) >1700 assert len(out) <2500''' #Task 1B def test_stations_by_distance(): stations = build_station_list() p = (52.2053, 0.1218)#putting in Cambridge value from task out = stations_by_distance(stations, p) #check that list is returned assert type(out) == list #check that items are tuples assert type(out[0]) == tuple #check that first station is Jesus Lock assert out[0] == ('Cambridge Jesus Lock', 'Cambridge', 0.840237595667494) #check that furthest station is Penberth assert out[-1] == ('Penberth', 'Penberth', 467.53431870130544) #Task 1C def test_stations_within_radius(): stations = build_station_list() out = stations_within_radius(stations, (52.2053, 0.1218), 10) #check that list is returned assert type(out) == list #checking first value, which is checking the sorting, too assert out[0] == 'Bin Brook' #checking length of list assert len(out) == 11 #Task 1D def test_rivers_with_station(): stations = build_station_list() out = rivers_with_station(stations) #check that out is a set assert type(out) == set #check that each item in list is a string out = list(out) assert type(out[0]) == str #check that out is of a reasonable length - no. of stations might change in the future? assert len(out) > 900 assert len(out) < 1000 #checking for duplicates #if set(out) is shorter than list (out), then there are duplicates assert len(out) == len(set(out)) def test_stations_by_rivers(): stations = build_station_list out = stations_by_river(stations) #check that output is a dictionary assert type(out) == dict #check number of stations listed for Aire: aire = out['River Aire'] assert len(aire) ==24 #check that it's a list assert type(out['River Thames']) == list #Task1E def test_rivers_by_station_number(): stations = build_station_list() N = random.randint(0,9) out = rivers_by_station_number(stations, N) #check that output is a list assert type(out)==list #check that items are tuples #assert(type(out[0])) == tuple #check that list is of length N assert len(out) == N #checking that list is sorted by number of stations ret = sorted_by_key(out, 1, reverse=True)#sorting the list by decreasing distance from p (the 3rd thing in tuple - distance_p) assert ret == out
29.828283
137
0.679986
432
2,953
4.513889
0.266204
0.06
0.066667
0.061538
0.230256
0.137949
0.102051
0.102051
0.102051
0.069744
0
0.04007
0.230952
2,953
99
138
29.828283
0.818582
0.299357
0
0.166667
0
0
0.042506
0
0
0
0
0
0.428571
1
0.119048
false
0
0.095238
0
0.214286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
1
fb4520cbe2999728bc66894639cfa8a36d53fb16
1,809
py
Python
pyActionRec/action_flow.py
Xiatian-Zhu/anet2016_cuhk
a0df08cbbe65013e9a259d5412c33a99c2c84127
[ "BSD-2-Clause" ]
253
2016-07-01T22:57:55.000Z
2022-03-01T10:59:31.000Z
pyActionRec/action_flow.py
Xiatian-Zhu/anet2016_cuhk
a0df08cbbe65013e9a259d5412c33a99c2c84127
[ "BSD-2-Clause" ]
39
2016-08-31T08:42:24.000Z
2021-12-11T06:56:47.000Z
pyActionRec/action_flow.py
Xiatian-Zhu/anet2016_cuhk
a0df08cbbe65013e9a259d5412c33a99c2c84127
[ "BSD-2-Clause" ]
101
2016-07-01T22:57:57.000Z
2022-03-08T07:26:53.000Z
from config import ANET_CFG import sys sys.path.append(ANET_CFG.DENSE_FLOW_ROOT+'/build') from libpydenseflow import TVL1FlowExtractor import action_caffe import numpy as np class FlowExtractor(object): def __init__(self, dev_id, bound=20): TVL1FlowExtractor.set_device(dev_id) self._et = TVL1FlowExtractor(bound) def extract_flow(self, frame_list, new_size=None): """ This function extracts the optical flow and interleave x and y channels :param frame_list: :return: """ frame_size = frame_list[0].shape[:2] rst = self._et.extract_flow([x.tostring() for x in frame_list], frame_size[1], frame_size[0]) n_out = len(rst) if new_size is None: ret = np.zeros((n_out*2, frame_size[0], frame_size[1])) for i in xrange(n_out): ret[2*i, :] = np.fromstring(rst[i][0], dtype='uint8').reshape(frame_size) ret[2*i+1, :] = np.fromstring(rst[i][1], dtype='uint8').reshape(frame_size) else: import cv2 ret = np.zeros((n_out*2, new_size[1], new_size[0])) for i in xrange(n_out): ret[2*i, :] = cv2.resize(np.fromstring(rst[i][0], dtype='uint8').reshape(frame_size), new_size) ret[2*i+1, :] = cv2.resize(np.fromstring(rst[i][1], dtype='uint8').reshape(frame_size), new_size) return ret if __name__ == "__main__": import cv2 im1 = cv2.imread('../data/img_1.jpg') im2 = cv2.imread('../data/img_2.jpg') f = FlowExtractor(0) flow_frames = f.extract_flow([im1, im2]) from pylab import * plt.figure() plt.imshow(flow_frames[0]) plt.figure() plt.imshow(flow_frames[1]) plt.figure() plt.imshow(im1) plt.show() print flow_frames
30.15
113
0.611388
264
1,809
3.981061
0.340909
0.077069
0.01903
0.060894
0.327307
0.31589
0.216936
0.203616
0.203616
0.163654
0
0.033088
0.248203
1,809
59
114
30.661017
0.739706
0
0
0.170732
0
0
0.040719
0
0
0
0
0
0
0
null
null
0
0.195122
null
null
0.02439
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fb49836ffdfff81dfa3d877748d3c2b47f98f7fb
3,446
py
Python
googlecode-issues-exporter/generate_user_map.py
ballschin52/support-tools
85be996e89d292c7f20031dde88198acc63d5e6c
[ "Apache-2.0" ]
41
2016-05-03T02:27:07.000Z
2021-10-14T13:54:16.000Z
googlecode-issues-exporter/generate_user_map.py
ballschin52/support-tools
85be996e89d292c7f20031dde88198acc63d5e6c
[ "Apache-2.0" ]
7
2016-05-05T13:53:37.000Z
2021-06-27T20:25:13.000Z
googlecode-issues-exporter/generate_user_map.py
ballschin52/support-tools
85be996e89d292c7f20031dde88198acc63d5e6c
[ "Apache-2.0" ]
30
2016-05-05T13:26:21.000Z
2021-10-13T09:39:21.000Z
# Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Tool for generating a user mapping from Google Code user to BitBucket user. """ import argparse import json import sys import issues class OptionalMap(dict): """Dictionary that returns the key for missing items. """ def __missing__(self, key): """Implements the dict interface. """ return key def addIfNotPresent(users, user): """Adds a user if it is not already set.""" if user not in users: users[user] = user def _CreateUsersDict(issue_data, project_name): """Extract users from list of issues into a dict. Args: issue_data: Issue data project_name: The name of the project being exported. Returns: Dict of users associated with a list of issues """ users = {} for issue in issue_data: googlecode_issue = issues.GoogleCodeIssue( issue, project_name, OptionalMap()) reporting_user = googlecode_issue.GetAuthor() addIfNotPresent(users, reporting_user) assignee_user = googlecode_issue.GetOwner() addIfNotPresent(users, assignee_user) googlecode_comments = googlecode_issue.GetComments() for comment in googlecode_comments: googlecode_comment = issues.GoogleCodeComment(googlecode_issue, comment) commenting_user = googlecode_comment.GetAuthor() addIfNotPresent(users, commenting_user) return { "users": users } def Generate(issue_file_path, project_name): """Generates a user map for the specified issues. """ issue_data = None user_file = open(issue_file_path) user_data = json.load(user_file) user_projects = user_data["projects"] for project in user_projects: if project_name in project["name"]: issue_data = project["issues"]["items"] break if issue_data is None: raise issues.ProjectNotFoundError( "Project %s not found" % project_name) users = _CreateUsersDict(issue_data, project_name) with open("users.json", "w") as users_file: user_json = json.dumps(users, sort_keys=True, indent=4, separators=(",", ": "), ensure_ascii=False) users_file.write(unicode(user_json)) print "\nCreated file users.json.\n" def main(args): """The main function. Args: args: The command line arguments. Raises: issues.ProjectNotFoundError: The user passed in an invalid project name. """ parser = argparse.ArgumentParser() parser.add_argument("--issue_file_path", required=True, help="The path to the file containing the issues from" "Google Code.") parser.add_argument("--project_name", required=True, help="The name of the Google Code project you wish to" "export") parsed_args, _ = parser.parse_known_args(args) Generate(parsed_args.issue_file_path, parsed_args.project_name) if __name__ == "__main__": main(sys.argv)
28.716667
78
0.702844
450
3,446
5.22
0.382222
0.051511
0.027246
0.025543
0.0298
0
0
0
0
0
0
0.003297
0.207777
3,446
119
79
28.957983
0.857143
0.165119
0
0
0
0
0.108705
0
0
0
0
0
0
0
null
null
0
0.070175
null
null
0.017544
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fb4998788840ae0b088496c0b1aec6536f521b03
952
py
Python
apps/auth/views/wxlogin.py
rainydaygit/testtcloudserver
8037603efe4502726a4d794fb1fc0a3f3cc80137
[ "MIT" ]
349
2020-08-04T10:21:01.000Z
2022-03-23T08:31:29.000Z
apps/auth/views/wxlogin.py
rainydaygit/testtcloudserver
8037603efe4502726a4d794fb1fc0a3f3cc80137
[ "MIT" ]
2
2021-01-07T06:17:05.000Z
2021-04-01T06:01:30.000Z
apps/auth/views/wxlogin.py
rainydaygit/testtcloudserver
8037603efe4502726a4d794fb1fc0a3f3cc80137
[ "MIT" ]
70
2020-08-24T06:46:14.000Z
2022-03-25T13:23:27.000Z
from flask import Blueprint from apps.auth.business.wxlogin import WxLoginBusiness from apps.auth.extentions import validation, parse_json_form from library.api.render import json_detail_render wxlogin = Blueprint("wxlogin", __name__) @wxlogin.route('/', methods=['POST']) @validation('POST:wx_user_code') def wxuser_index_handler(): """ @api {post} /v1/wxlogin/ 登录 微信 @apiName WxLogin @apiGroup 用户 @apiDescription 登录微信 @apiParam {string} user_code 用户编码 @apiParamExample {json} Request-Example: { "user_code":"j2qL3QjNXXwa_4A0WJFDNJyPEx88HTHytARgRbr176g" } @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": { "token": "asdasdasd" }, "message": "" } """ user_code = parse_json_form('wx_user_code') ret, data, msg = WxLoginBusiness.get_user(user_code[0]) return json_detail_render(ret, data, msg)
25.052632
65
0.668067
109
952
5.614679
0.559633
0.078431
0.039216
0
0
0
0
0
0
0
0
0.022727
0.214286
952
37
66
25.72973
0.795455
0.387605
0
0
0
0
0.082164
0
0
0
0
0
0
1
0.090909
false
0
0.363636
0
0.545455
0.181818
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
1
fb4fa127bfbce18cd4fdeeaf2d1ebf19b58badc3
13,826
py
Python
run.py
openmg/mg-phm
e3bb05d6352f90ee40fdc4415ad8e1ed5857196f
[ "Apache-2.0" ]
null
null
null
run.py
openmg/mg-phm
e3bb05d6352f90ee40fdc4415ad8e1ed5857196f
[ "Apache-2.0" ]
null
null
null
run.py
openmg/mg-phm
e3bb05d6352f90ee40fdc4415ad8e1ed5857196f
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- import numpy as np import cv2 from scipy.misc import imsave import matplotlib.pyplot as plt import analysis import imageprocess import datainterface import imagemosaicking town_names = ['昂素镇', '敖勒召其镇', '布拉格苏木', '城川镇', '二道川乡', \ '毛盖图苏木', '三段地镇', '上海庙镇', '珠和苏木'] for index in range(len(town_names)): town_names[index] = unicode(town_names[index], 'utf8') geojson_path = 'testdata/' #12月 winter12933 = 'LC81290332016343LGN00_MTL' winter12833 = 'LC81280332016336LGN00_MTL' winter12834 = 'LC81280342016336LGN00_MTL' winter12 = (winter12933, winter12833, winter12834) #01月 winter12933 = 'LC81290332017025LGN00_MTL' winter12833 = 'LC81280332017002LGN00_MTL' winter12834 = 'LC81280342017002LGN00_MTL' winter01 = (winter12933, winter12833, winter12834) #02月 winter12933 = 'LC81290332017089LGN00_MTL'#3月,2月数据不可用 winter12833 = 'LC81280332017034LGN00_MTL' winter12834 = 'LC81280342017034LGN00_MTL' winter02 = (winter12933, winter12833, winter12834) #06 summer12933 = 'LC81290332016151LGN00_MTL' summer12833 = 'LC81280332016176LGN00_MTL' summer12834 = 'LC81280342016176LGN00_MTL' summer06 = (summer12933, summer12833, summer12834) #07 summer12933 = 'LC81290332016183LGN00_MTL' summer12833 = 'LC81280332016208LGN00_MTL' summer12834 = 'LC81280342016208LGN00_MTL' summer07 = (summer12933, summer12833, summer12834) #08 summer12933 = 'LC81290332016247LGN00_MTL' summer12833 = 'LC81280332016240LGN00_MTL' summer12834 = 'LC81280342016240LGN00_MTL' summer08 = (summer12933, summer12833, summer12834) cases = (summer08,) case_name = ('Aug',) #cases = (winter12, winter01, winter02, summer06, summer07, summer08) #case_name = ('Nov','Jan','Feb','Jun','Jul','Aug',) #cases = (wintercode,) #case_name = ('winter') for ii in range(len(cases)): case = cases[ii] # image load imgcode1 = case[0] imgcode2 = case[1] imgcode3 = case[2] path1 = 'testdata/1-12933/' path2 = 'testdata/2-12833/' path3 = 'testdata/3-12834/' corner1 = datainterface.get_corner(imgcode1, path1) corner2 = datainterface.get_corner(imgcode2, path2) corner3 = datainterface.get_corner(imgcode3, path3) img1 = datainterface.get_band(imgcode1, 4, path1) img2 = datainterface.get_band(imgcode2, 4, path2) img3 = datainterface.get_band(imgcode3, 4, path3) bqa1 = datainterface.get_bqa(imgcode1, path1) bqa2 = datainterface.get_bqa(imgcode2, path2) bqa3 = datainterface.get_bqa(imgcode3, path3) file_date1 = datainterface.get_date(imgcode1, path1) file_date2 = datainterface.get_date(imgcode2, path2) file_date3 = datainterface.get_date(imgcode3, path3) # image analysis ndvi1, vfc1 = analysis.get_plant(imgcode1, path1) ndvi2, vfc2 = analysis.get_plant(imgcode2, path2) ndvi3, vfc3 = analysis.get_plant(imgcode3, path3) print 'complete ndvi calculation...' Ts1 = analysis.get_temperature(imgcode1, path1) Ts2 = analysis.get_temperature(imgcode2, path2) Ts3 = analysis.get_temperature(imgcode3, path3) print 'complete Ts calculation...' tvdi1, cover1 = analysis.get_drought(ndvi1, Ts1, bqa1) tvdi2, cover2 = analysis.get_drought(ndvi2, Ts2, bqa2) tvdi3, cover3 = analysis.get_drought(ndvi3, Ts3, bqa3) print 'complete tvdi calculation...' ndvi1_d = cv2.resize(ndvi1,None,fx=0.1,fy=0.1) ndvi2_d = cv2.resize(ndvi2,None,fx=0.1,fy=0.1) ndvi3_d = cv2.resize(ndvi3,None,fx=0.1,fy=0.1) vfc1_d = cv2.resize(vfc1,None,fx=0.1,fy=0.1) vfc2_d = cv2.resize(vfc2,None,fx=0.1,fy=0.1) vfc3_d = cv2.resize(vfc3,None,fx=0.1,fy=0.1) Ts1_d = cv2.resize(Ts1,None,fx=0.1,fy=0.1) Ts2_d = cv2.resize(Ts2,None,fx=0.1,fy=0.1) Ts3_d = cv2.resize(Ts3,None,fx=0.1,fy=0.1) tvdi1_d = cv2.resize(tvdi1,None,fx=0.1,fy=0.1) tvdi2_d = cv2.resize(tvdi2,None,fx=0.1,fy=0.1) tvdi3_d = cv2.resize(tvdi3,None,fx=0.1,fy=0.1) print 'complete image analyzing...' save_filename = 'output/' + case_name[ii] + '_' + 'ndvi1' + '.png' imsave(save_filename, ndvi1) save_filename = 'output/' + case_name[ii] + '_' + 'vfc1' + '.png' imsave(save_filename, vfc1) save_filename = 'output/' + case_name[ii] + '_' + 'ndvi2' + '.png' imsave(save_filename, ndvi2) save_filename = 'output/' + case_name[ii] + '_' + 'vfc2' + '.png' imsave(save_filename, vfc2) save_filename = 'output/' + case_name[ii] + '_' + 'ndvi3' + '.png' imsave(save_filename, ndvi3) save_filename = 'output/' + case_name[ii] + '_' + 'vfc3' + '.png' imsave(save_filename, vfc3) save_filename = 'output/' + case_name[ii] + '_' + 'Ts1' + '.png' imsave(save_filename, Ts1) save_filename = 'output/' + case_name[ii] + '_' + 'Ts2' + '.png' imsave(save_filename, Ts2) save_filename = 'output/' + case_name[ii] + '_' + 'Ts3' + '.png' imsave(save_filename, Ts3) save_filename = 'output/' + case_name[ii] + '_' + 'tvdi1' + '.png' imsave(save_filename, tvdi1) save_filename = 'output/' + case_name[ii] + '_' + 'tvdi2' + '.png' imsave(save_filename, tvdi2) save_filename = 'output/' + case_name[ii] + '_' + 'tvdi3' + '.png' imsave(save_filename, tvdi3) save_filename = 'output/d' + case_name[ii] + '_' + 'ndvi1_d' + '.png' imsave(save_filename, ndvi1_d) save_filename = 'output/d' + case_name[ii] + '_' + 'vfc1_d' + '.png' imsave(save_filename, vfc1_d) save_filename = 'output/d' + case_name[ii] + '_' + 'ndvi2_d' + '.png' imsave(save_filename, ndvi2_d) save_filename = 'output/d' + case_name[ii] + '_' + 'vfc2_d' + '.png' imsave(save_filename, vfc2_d) save_filename = 'output/d' + case_name[ii] + '_' + 'ndvi3_d' + '.png' imsave(save_filename, ndvi3_d) save_filename = 'output/d' + case_name[ii] + '_' + 'vfc3_d' + '.png' imsave(save_filename, vfc3_d) save_filename = 'output/d' + case_name[ii] + '_' + 'Ts1_d' + '.png' imsave(save_filename, Ts1_d) save_filename = 'output/d' + case_name[ii] + '_' + 'Ts2_d' + '.png' imsave(save_filename, Ts2_d) save_filename = 'output/d' + case_name[ii] + '_' + 'Ts3_d' + '.png' imsave(save_filename, Ts3_d) save_filename = 'output/d' + case_name[ii] + '_' + 'tvdi1_d' + '.png' imsave(save_filename, tvdi1_d) save_filename = 'output/d' + case_name[ii] + '_' + 'tvdi2_d' + '.png' imsave(save_filename, tvdi2_d) save_filename = 'output/d' + case_name[ii] + '_' + 'tvdi3_d' + '.png' imsave(save_filename, tvdi3_d) # image mosaicking imgall_origin, corner_origin = imagemosaicking.cut_img_easy(img1, img2, img3, corner1, corner2, corner3) imgall_ndvi, corner_ndvi = imagemosaicking.cut_img_easy(ndvi1, ndvi2, ndvi3, corner1, corner2, corner3) imgall_vfc, corner_vfc = imagemosaicking.cut_img_easy(vfc1, vfc2, vfc3, corner1, corner2, corner3) imgall_Ts, corner_Ts = imagemosaicking.cut_img_easy(Ts1, Ts2, Ts3, corner1, corner2, corner3) imgall_tvdi, corner_tvdi = imagemosaicking.cut_img_easy(tvdi1, tvdi2, tvdi3, corner1, corner2, corner3) imgall_tvdi_cover, corner_cover = imagemosaicking.cut_img_easy(cover1, cover2, cover3, corner1, corner2, corner3) save_filename = 'output/' + case_name[ii] + '_' + 'imgall_origin' + '.png' imsave(save_filename, imgall_origin) save_filename = 'output/' + case_name[ii] + '_' + 'imgall_ndvi' + '.png' imsave(save_filename, imgall_ndvi) save_filename = 'output/' + case_name[ii] + '_' + 'imgall_vfc' + '.png' imsave(save_filename, imgall_vfc) save_filename = 'output/' + case_name[ii] + '_' + 'imgall_Ts' + '.png' imsave(save_filename, imgall_Ts) save_filename = 'output/' + case_name[ii] + '_' + 'imgall_tvdi' + '.png' imsave(save_filename, imgall_tvdi) imgall_origin_d = cv2.resize(imgall_origin, None, fx=0.2, fy=0.2) imgall_ndvi_d = cv2.resize(imgall_ndvi, None, fx=0.2, fy=0.2) imgall_vfc_d = cv2.resize(imgall_vfc, None, fx=0.2, fy=0.2) imgall_Ts_d = cv2.resize(imgall_Ts, None, fx=0.2, fy=0.2) imgall_tvdi_d = cv2.resize(imgall_tvdi, None, fx=0.2, fy=0.2) imgall_tvdi_cover_d = cv2.resize(imgall_tvdi_cover, None, fx=0.2, fy=0.2) save_filename = 'output/d' + case_name[ii] + '_' + 'imgall_origin_d' + '.png' imsave(save_filename, imgall_origin_d) save_filename = 'output/d' + case_name[ii] + '_' + 'imgall_ndvi_d' + '.png' imsave(save_filename, imgall_ndvi_d) save_filename = 'output/d' + case_name[ii] + '_' + 'imgall_vfc_d' + '.png' imsave(save_filename, imgall_vfc_d) save_filename = 'output/d' + case_name[ii] + '_' + 'imgall_Ts_d' + '.png' imsave(save_filename, imgall_Ts_d) save_filename = 'output/d' + case_name[ii] + '_' + 'imgall_tvdi_d' + '.png' imsave(save_filename, imgall_tvdi_d) print 'complete image mosaicking...' # image filtering filter_box = 20 imgall_origin_filtered = imageprocess.mean_filter(imgall_origin_d, filter_box) imgall_ndvi_filtered = imageprocess.mean_filter(imgall_ndvi_d, filter_box) imgall_vfc_filtered = imageprocess.mean_filter(imgall_vfc_d, filter_box) imgall_Ts_filtered = imageprocess.mean_filter(imgall_Ts_d, filter_box) imgall_tvdi_filtered = imageprocess.mean_filter(imgall_tvdi_d, filter_box) print 'complete image filtering...' """ save_filename = 'output/' + case_name[ii] + '_' + 'imgall_origin_filtered' + '.png' imsave(save_filename, imgall_origin_filtered) save_filename = 'output/' + case_name[ii] + '_' + 'imgall_ndvi_filtered' + '.png' imsave(save_filename, imgall_ndvi_filtered) save_filename = 'output/' + case_name[ii] + '_' + 'imgall_vfc_filtered' + '.png' imsave(save_filename, imgall_vfc_filtered) save_filename = 'output/' + case_name[ii] + '_' + 'imgall_Ts_filtered' + '.png' imsave(save_filename, imgall_Ts_filtered) save_filename = 'output/' + case_name[ii] + '_' + 'imgall_tvdi_filtered' + '.png' imsave(save_filename, imgall_tvdi_filtered) """ filter_box = 5 imgall_origin = imageprocess.mean_filter(imgall_origin_d, filter_box) imgall_ndvi = imageprocess.mean_filter(imgall_ndvi_d, filter_box) imgall_vfc = imageprocess.mean_filter(imgall_vfc_d, filter_box) imgall_Ts = imageprocess.mean_filter(imgall_Ts_d, filter_box) imgall_tvdi = imageprocess.mean_filter(imgall_tvdi_d, filter_box) print 'complete image filtering...' # density divide vfc_3d = analysis.vfc_divide(imgall_vfc, imgall_ndvi) tvdi_3d = analysis.tvdi_divide(imgall_tvdi, imgall_ndvi, imgall_tvdi_cover_d) print 'complete density divide...' save_filename = 'output/' + case_name[ii] + '_' + 'vfc_3d' + '.png' imsave(save_filename, vfc_3d) save_filename = 'output/' + case_name[ii] + '_' + 'tvdi_3d' + '.png' imsave(save_filename, tvdi_3d) """ #pn_poly county_cover = np.zeros_like(imgall_origin) for town_num in range(len(town_names)): print town_num + 1 geo_filename = geojson_path + town_names[town_num] + '.geojson' geodata = datainterface.geojson_read(geo_filename) town_cover = imageprocess.pn_poly(imgall_origin, corner_origin, geodata) county_cover += town_cover town_origin = town_cover * imgall_origin town_vfc = town_cover * imgall_vfc town_Ts = town_cover * imgall_Ts town_tvdi = town_cover * imgall_tvdi town_vfc_4d = np.zeros((vfc_3d.shape[0], vfc_3d.shape[1], 4)) town_tvdi_4d = np.zeros((tvdi_3d.shape[0], tvdi_3d.shape[1], 4)) for i in range(3): town_vfc_4d[:, :, i] = vfc_3d[:, :, i] / 255.0 town_tvdi_4d[:, :, i] = tvdi_3d[:, :, i] / 255.0 town_vfc_4d[:,:,3] = town_cover town_tvdi_4d[:,:,3] = town_cover var_names = ('town_origin', 'town_vfc', 'town_Ts', 'town_tvdi',\ 'town_vfc_4d', 'town_tvdi_4d') for var_name in var_names: save_filename = 'output/' + case_name[ii] + town_names[town_num] + var_name + '_' + '.png' print 'saving images of '+ town_names[town_num] + var_name + '...' if (var_name != 'town_vfc_4d') and (var_name != 'town_tvdi_4d'): imsave(save_filename, eval(var_name) * town_cover) else: # img_temp = np.zeros((town_cover.shape[0], town_cover.shape[1],4)) # img_temp[:,:,0:3] = eval(var_name) # img_temp[:,:,3] = town_cover # imsave(save_filename, img_temp) imsave(save_filename, eval(var_name)) print 'saving images of county...' county_origin = county_cover * imgall_origin county_vfc = county_cover * imgall_vfc county_Ts = county_cover * imgall_Ts county_tvdi = county_cover * imgall_tvdi county_vfc_4d = np.zeros((vfc_3d.shape[0], vfc_3d.shape[1], 4)) county_tvdi_4d = np.zeros((tvdi_3d.shape[0], tvdi_3d.shape[1], 4)) for i in range(3): county_vfc_4d[:, :, i] = vfc_3d[:, :, i] / 255.0 county_tvdi_4d[:, :, i] = tvdi_3d[:, :, i] / 255.0 county_vfc_4d[:,:,3] = county_cover county_tvdi_4d[:,:,3] = county_cover # save county var_names = ('county_origin', 'county_vfc', 'county_Ts', 'county_tvdi',\ 'county_vfc_4d', 'county_tvdi_4d') for var_name in var_names: print var_name save_filename = 'output/' + case_name[ii] + var_name + '_' + '.png' print 'saving images of ' + var_name +'...' if (var_name != 'county_vfc_4d') and (var_name != 'county_tvdi_4d'): imsave(save_filename, eval(var_name) * county_cover) else: imsave(save_filename, eval(var_name)) # img_temp = np.zeros((county_cover.shape[0], county_cover.shape[1],4)) # img_temp[:,:,0:3] = eval(var_name) # img_temp[:,:,3] = county_cover # imsave(save_filename, img_temp) """
41.39521
117
0.667872
1,845
13,826
4.692141
0.107859
0.124755
0.097724
0.099457
0.497054
0.387894
0.259443
0.231373
0.113665
0.091949
0
0.080161
0.188847
13,826
333
118
41.51952
0.691752
0.020324
0
0.010753
0
0
0.151208
0.046069
0.193548
0
0
0
0
0
null
null
0
0.043011
null
null
0.043011
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fb515bfaa92002625ae59283942eea3a360391f0
467
py
Python
lib/mysocket.py
vanphuong12a2/pposter
fac6e289985909de059150ca860677dba9ade6c9
[ "MIT" ]
null
null
null
lib/mysocket.py
vanphuong12a2/pposter
fac6e289985909de059150ca860677dba9ade6c9
[ "MIT" ]
null
null
null
lib/mysocket.py
vanphuong12a2/pposter
fac6e289985909de059150ca860677dba9ade6c9
[ "MIT" ]
null
null
null
from flask_socketio import SocketIO NOTI = 'notification' class MySocket(): def __init__(self, app, async_mode): self.socketio = SocketIO(app, async_mode=async_mode) def get_socketio(self): return self.socketio def noti_emit(self, msg, room=None): if room: self.socketio.emit(NOTI, {'data': msg}, namespace='/noti', room=room) else: self.socketio.emit(NOTI, {'data': msg}, namespace='/noti')
23.35
81
0.62955
58
467
4.896552
0.413793
0.169014
0.084507
0.140845
0.28169
0.28169
0.28169
0.28169
0
0
0
0
0.239829
467
19
82
24.578947
0.8
0
0
0
0
0
0.06424
0
0
0
0
0
0
1
0.25
false
0
0.083333
0.083333
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
1
fb593493c97b14b708bc0b8b5a7f5e7166948d28
10,489
py
Python
Kelp/kelp.py
trondkr/particleDistributions
1f5be088150db92c985c00210951ab62521bf694
[ "MIT" ]
null
null
null
Kelp/kelp.py
trondkr/particleDistributions
1f5be088150db92c985c00210951ab62521bf694
[ "MIT" ]
1
2019-07-11T15:02:32.000Z
2019-07-11T16:57:03.000Z
Kelp/kelp.py
trondkr/particleDistributions
1f5be088150db92c985c00210951ab62521bf694
[ "MIT" ]
1
2019-12-23T06:49:29.000Z
2019-12-23T06:49:29.000Z
#!/usr/bin/env python from datetime import datetime, timedelta import numpy as np from opendrift.readers import reader_basemap_landmask from opendrift.readers import reader_ROMS_native from kelp.kelpClass import PelagicPlanktonDrift from opendrift.readers import reader_netCDF_CF_generic import logging import gdal import os from netCDF4 import Dataset, datetime, date2num,num2date from numpy.random import RandomState import random import glob import matplotlib.pyplot as plt try: import ogr import osr except Exception as e: print(e) raise ValueError('OGR library is needed to read shapefiles.') def setupSeed(hoursBetweenTimestepInROMSFiles,startTime,endTime,startReleaseTime,endReleaseTime,releaseParticles): ################################################## # Create seed variation as function of day ################################################## # Make datetime array from start to end at 3 hour interval #interval = timedelta(hours=hoursBetweenTimestepInROMSFiles) difference=endTime-startTime hoursOfSimulation=divmod(difference.total_seconds(), 3600) difference=endReleaseTime-startReleaseTime hoursOfRelease=divmod(difference.total_seconds(), 3600) #startSimulationJD=startTime.timetuple().tm_yday #endSimulationJD=endTime.timetuple().tm_yday timeStepsSimulation=int(int(hoursOfSimulation[0])/hoursBetweenTimestepInROMSFiles) #startReleaseJD=startReleaseTime.timetuple().tm_yday #endReleaseJD=endReleaseTime.timetuple().tm_yday #timeStepsRelease=int(int(hoursOfRelease[0])/hoursBetweenTimestepInROMSFiles) print("=>SIMULATION: Drift simulation will run for %s simulation hours" %(timeStepsSimulation)) print("=>Release: Simulated Release will run for %s simulation hours\n initiated on %s and ending on %s"%(timeStepsSimulation,startReleaseTime,endReleaseTime)) interval = timedelta(hours=6) hoursPerRelease=divmod(interval.total_seconds(), 3600) #hours per Release event timeStepsRelease=int(int(hoursOfRelease[0])/int(hoursPerRelease[0])) #number of Release timesteps ReleaseTimes = [startReleaseTime + interval*n for n in range(timeStepsRelease)] #times of Release num=np.random.normal(releaseParticles,int(releaseParticles/2)-1, size=len(ReleaseTimes)).astype(int) num=np.sort(num) #sort particles in increasing order #num=np.concatenate((num[len(num)%2::2],num[::-2]),axis=0) #release the highest number of particles at the midpoint of the Release period print("Release: Simulated Release will release %s kelp particles"%(np.sum(num))) return num, ReleaseTimes def kelpProperties(num): kelpProps=np.zeros((len(num), 4)) mylist=[0,1,2] weights=[0.5069324, 0.4485244,0.10138648] volumes=[0.000140226, 0.000753867, 2.80452E-05] areas=[0.1149934, 0.05, 0.02299868] densities=[2000,1100,300] for i in range(len(num)): ind=random.choice(mylist) kelpProps[i,0]=weights[ind] kelpProps[i,1]=volumes[ind] kelpProps[i,2]=areas[ind] # Calculate the density of the kelp density=weights[ind]/volumes[ind] kelpProps[i,3]=densities[ind] return kelpProps def createOutputFilenames(startTime,endTime,polygonIndex,shapefile,verticalBehavior): startDate='' if startTime.day<10: startDate+='0%s'%(startTime.day) else: startDate+='%s'%(startTime.day) if startTime.month<10: startDate+='0%s'%(startTime.month) else: startDate+='%s'%(startTime.month) startDate+='%s'%(startTime.year) endDate='' if endTime.day<10: endDate+='0%s'%(endTime.day) else: endDate+='%s'%(endTime.day) if endTime.month<10: endDate+='0%s'%(endTime.month) else: endDate+='%s'%(endTime.month) endDate+='%s'%(endTime.year) # Special file naming for KINO. Each layer has name 'species.shp' and we want teh species name only. head,tail=os.path.split(shapefile) specie="Kelp" if verticalBehavior: outputFilename='results/%s_polygon_%s_kelp_opendrift_%s_to_%s_vertical.nc'%(specie,polygonIndex,startDate,endDate) animationFilename='figures/%s_polygon_%s_kelp_animation_%s_to_%s_vertical.mp4'%(specie,polygonIndex,startDate,endDate) plotFilename='figures/%s_polygon_%s_kelp_plot_%s_to_%s_vertical.png'%(specie,polygonIndex,startDate,endDate) else: outputFilename='results/%s_polygon_%s_kelp_opendrift_%s_to_%s_novertical.nc'%(specie,polygonIndex,startDate,endDate) animationFilename='figures/%s_polygon_%s_kelp_animation_%s_to_%s_novertical.mp4'%(specie,polygonIndex,startDate,endDate) plotFilename='figures/%s_polygon_%s_kelp_plot_%s_to_%s_novertical.png'%(specie,polygonIndex,startDate,endDate) if not os.path.exists('figures'): os.makedirs('figures') if not os.path.exists('results'): os.makedirs('results') return outputFilename, animationFilename, plotFilename def createAndRunSimulation(lowDepth,highDepth,endTime,layer,polygonIndex,shapefile,outputFilename,animationFilename,plotFilename,releaseParticles,kinoDirectory,pattern_kino,svimDirectory,pattern_svim,verticalBehavior): # Setup a new simulation o = PelagicPlanktonDrift(loglevel=0) # Set loglevel to 0 for debug information ####################### # Preparing readers ####################### reader_basemap = reader_basemap_landmask.Reader( llcrnrlon=16, llcrnrlat=68, urcrnrlon=20, urcrnrlat=72, resolution='f', projection='merc') o.add_reader([reader_basemap]) #Do not include basemap when stranding is deactivated print([s for s in pattern_kino]) reader_kino = reader_ROMS_native.Reader([s for s in pattern_kino]) reader_kino.interpolation = 'linearNDFast' #linearND reader_svim = reader_ROMS_native.Reader(svimDirectory+pattern_svim) reader_svim.interpolation = 'linearNDFast' #linearND #reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc') o.add_reader([reader_kino,reader_svim]) num, ReleaseTimes = setupSeed(hoursBetweenTimestepInROMSFiles,startTime,endTime,startReleaseTime,endReleaseTime,releaseParticles) ####################### #Adjusting configuration ####################### o.set_config('processes:turbulentmixing', True) o.set_config('turbulentmixing:diffusivitymodel','environment') o.set_config('turbulentmixing:timestep', 30) # seconds o.set_config('turbulentmixing:verticalresolution', 1) # default is 1 meter, but since we have longer timestep we justify it o.set_config('processes:verticaladvection', True) o.set_config('turbulentmixing:TSprofiles', True) # o.set_config('drift:scheme', 'euler') o.set_config('drift:scheme', 'runge-kutta') #del o.fallback_values['x_sea_water_velocity'] #del o.fallback_values['y_sea_water_velocity'] o.set_config('general:coastline_action', 'stranding') #Prevent stranding, jump back to previous position ####################### # Seed kelp particles ####################### kelpProps=kelpProperties(num) for i, nums in enumerate(num): if nums <= 0: continue print("Running i=%s num=%s and polygon=%s"%(i,nums,polygonIndex)) o.seed_from_shapefile(shapefile, nums,featurenum=[polygonIndex], z=np.random.randint(low=lowDepth, high=highDepth, size=np.shape(nums)), weight=kelpProps[i,0], volume=kelpProps[i,1], diameter=kelpProps[i,2], density=kelpProps[i,3], time=ReleaseTimes[i]) #reader_basemap.plot() ######################### # Run the model ######################### o.run(end_time=endTime, time_step=timedelta(hours=2), outfile=outputFilename) #export_variables=['lon', 'lat', 'z','temp','length','weight','survival']) print(o) ######################### # SETUP FOR KELP PROJECT ######################### startTime=datetime(2016,4,10,12,0,0) endTime=datetime(2016,5,26,23,0,0) startReleaseTime=startTime endReleaseTime=datetime(2016,4,12,12,0,0) releaseParticles=4 # Per timestep multiplied by gaussian bell (so maximum is releaseParticles and minimum is close to zero) lowDepth, highDepth = -7, -2 # in negative meters verticalBehavior=False hoursBetweenTimestepInROMSFiles=1 #kinoDirectory='/work/users/trondk/KINO/FORWARD/Run/RESULTS/'+str(startTime.year)+'/' kinoDirectory='/work/shared/nn9297k/Nordfjord/' kinoDirectory='/imr/vol1/NorFjords5/Malangen-160m_AUG2015-AUG2016/' svimDirectory='/work/shared/imr/SVIM/'+str(startTime.year)+'/' firstkino = int(date2num(startTime,units="days since 1948-01-01 00:00:00",calendar="standard")) lastkino = int(date2num(endTime,units="days since 1948-01-01 00:00:00",calendar="standard")) apattern = 'norfjords_160m_his.nc4_%s*'%(startTime.year) argument="%s%s"%(kinoDirectory,apattern) pattern_kino = glob.glob(argument) pattern_kino.sort() print(pattern_kino) pattern_svim='ocean_avg_*.nc' shapefile='/work/shared/nn9297k/Kelp/Shapefile/KelpExPol_utenNASAland.shp' print("=> Using shapefile %s"%(shapefile)) s = ogr.Open(shapefile) for layer in s: polygons=[x+1 for x in range(layer.GetFeatureCount()-1)] #polygons=[1,2,3,4,7] #N.Trench,Dogger bank C, Dogger bank, German bight, Viking bank #polygons=[2] #N.Trench,Dogger bank C, Dogger bank, German bight, Viking bank for polygonIndex in polygons: feature = layer.GetFeature(polygonIndex-1) print("Area",feature.GetGeometryRef().GetArea()) geom = feature.GetGeometryRef() points = geom.GetGeometryCount() ring = geom.GetGeometryRef(0) print("jj",polygonIndex, points) if ring.GetPointCount() > 3: outputFilename, animationFilename, plotFilename = createOutputFilenames(startTime,endTime,polygonIndex,shapefile,verticalBehavior) print("Result files will be stored as:\nnetCDF=> %s\nmp4=> %s"%(outputFilename,animationFilename)) createAndRunSimulation(lowDepth,highDepth,endTime, layer,polygonIndex,shapefile, outputFilename,animationFilename,plotFilename,releaseParticles, kinoDirectory,pattern_kino,svimDirectory,pattern_svim,verticalBehavior)
38.992565
218
0.695586
1,218
10,489
5.885057
0.328407
0.005022
0.012556
0.010882
0.284319
0.203125
0.175223
0.146763
0.138951
0.138951
0
0.029656
0.160931
10,489
268
219
39.13806
0.784797
0.179331
0
0.030864
0
0.006173
0.160569
0.088246
0
0
0
0
0
0
null
null
0
0.098765
null
null
0.074074
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fb5eea86a746925440911830c3d41121077c7f7a
472
py
Python
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/s/star/star_needs_assignment_target_py35.py
ciskoinch8/vimrc
5bf77a7e7bc70fac5173ab2e9ea05d7dda3e52b8
[ "MIT" ]
463
2015-01-15T08:17:42.000Z
2022-03-28T15:10:20.000Z
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/s/star/star_needs_assignment_target_py35.py
ciskoinch8/vimrc
5bf77a7e7bc70fac5173ab2e9ea05d7dda3e52b8
[ "MIT" ]
52
2015-01-06T02:43:59.000Z
2022-03-14T11:15:21.000Z
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/s/star/star_needs_assignment_target_py35.py
ciskoinch8/vimrc
5bf77a7e7bc70fac5173ab2e9ea05d7dda3e52b8
[ "MIT" ]
249
2015-01-07T22:49:49.000Z
2022-03-18T02:32:06.000Z
""" Test PEP 0448 -- Additional Unpacking Generalizations https://www.python.org/dev/peps/pep-0448/ """ # pylint: disable=superfluous-parens, unnecessary-comprehension UNPACK_TUPLE = (*range(4), 4) UNPACK_LIST = [*range(4), 4] UNPACK_SET = {*range(4), 4} UNPACK_DICT = {'a': 1, **{'b': '2'}} UNPACK_DICT2 = {**UNPACK_DICT, "x": 1, "y": 2} UNPACK_DICT3 = {**{'a': 1}, 'a': 2, **{'a': 3}} UNPACK_IN_COMP = {elem for elem in (*range(10))} # [star-needs-assignment-target]
29.5
81
0.641949
70
472
4.2
0.614286
0.061224
0.071429
0.132653
0
0
0
0
0
0
0
0.060533
0.125
472
15
82
31.466667
0.651332
0.194915
0
0
0
0
0.029197
0
0
0
0
0
0
0
null
null
0
0
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fb623387f3a45681b01c77927c90b4d6cbbd3ef4
3,503
py
Python
ImageStabilizer.py
arthurscholz/UMN-AFM-Scripts
86b4d11f9f70f378200899c930d1fa38ad393c66
[ "MIT" ]
null
null
null
ImageStabilizer.py
arthurscholz/UMN-AFM-Scripts
86b4d11f9f70f378200899c930d1fa38ad393c66
[ "MIT" ]
null
null
null
ImageStabilizer.py
arthurscholz/UMN-AFM-Scripts
86b4d11f9f70f378200899c930d1fa38ad393c66
[ "MIT" ]
null
null
null
import numpy as np import picoscript import cv2 import HeightTracker import atexit print "Setting Parameters..." zDacRange = 0.215 # Sensor specific number windowSize = 3e-6 # window size in meters windowBLHCX = 3.5e-6 # window bottom left hand corner X-axis in meters windowBLHCY = 3.5e-6 # window bottom left hand corner Y-axis in meters imageBuffer = 0 # buffer for tracking image (0-7) binary = True servoRange = picoscript.GetServoTopographyRange() imageRange = servoRange * zDacRange MAX_SHORT = 2**15 def PlaneLevel(im): x, y = np.indices(im.shape) A = np.vstack([x.flatten(), y.flatten(), np.ones(im.size)]).T z = im.flatten() a,b,c = np.linalg.lstsq(A, z)[0] plane = a*x + b*y + c return im - plane def LineLevel(im): output = np.empty_like(im) for i in range(im.shape[0]): output[i] = im[i] - np.median(im[i]) return output def LoadBuffer(i): xSize = picoscript.GetScanXPixels() ySize = picoscript.GetScanYPixels() # Read in image data buffer im = np.asarray(picoscript.ReadImageDataBuffer(imageBuffer)) im = im.reshape(ySize,xSize) im = im * imageRange / MAX_SHORT return im # Calculates scan offset for new image. Takes an image, roi template and bottom # left hand corner def CalculateOffset(im,template,blhc): res = cv2.matchTemplate(im.astype('float32'),template.astype('float32'),cv2.TM_CCORR_NORMED) min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res) # returns vector to feature return np.asarray(max_loc)-blhc def Stabilize(): position = picoscript.GetStatusApproachPosition() im = LoadBuffer(0) im = PlaneLevel(im) im = LineLevel(im) ref_image = im im_size = picoscript.GetScanSize() x0 = int(windowBLHCX / im_size * im.shape[1]) y0 = int(windowBLHCY / im_size * im.shape[0]) x1 = int((windowBLHCX + windowSize)/im_size * im.shape[1]) y1 = int((windowBLHCY + windowSize)/im_size * im.shape[0]) template = ref_image[y0:y1,x0:x1] while(position == picoscript.GetStatusApproachPosition()): picoscript.ScanStartDown() picoscript.WaitForStatusScanning(True) picoscript.WaitForStatusScanning(False) im = LoadBuffer(0) im = PlaneLevel(im) im = LineLevel(im) offset = CalculateOffset(im,template,np.array([x0,y0])) x_offset = picoscript.GetScanXOffset() + offset[0]*im_size/im.shape[1] y_offset = picoscript.GetScanYOffset() + offset[1]*im_size/im.shape[0] picoscript.SetScanXOffset(x_offset) picoscript.SetScanYOffset(y_offset) x0_new = offset[0] + x0 x1_new = offset[0] + x1 y0_new = offset[1] + y0 y1_new = offset[1] + y1 print '{0}, {1}'.format(x_offset, y_offset) template = im[y0_new:y1_new,x0_new:x1_new] if __name__ == "__main__": atexit.register(picoscript.Disconnect) heighttrack = HeightTracker.Track() heighttrack.start() RunStabilize = True print "Waiting for current scan to end..." picoscript.WaitForStatusScanning(False) print "Starting stabilization..." while True: if RunStabilize: Stabilize() position = picoscript.GetStatusApproachPosition() picoscript.ScanStartDown() picoscript.WaitForStatusScanning(True) picoscript.WaitForStatusScanning(False) RunStabilize = position == picoscript.GetStatusApproachPosition()
30.198276
96
0.663717
434
3,503
5.262673
0.334101
0.024518
0.021016
0.034151
0.226795
0.181261
0.181261
0.181261
0.154991
0.119965
0
0.0243
0.224665
3,503
116
97
30.198276
0.816642
0.091065
0
0.178571
0
0
0.034646
0
0
0
0
0
0
0
null
null
0
0.059524
null
null
0.047619
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fb67712141abf405660b20968e896ccaf386184f
3,696
py
Python
src/commercetools/services/inventory.py
labd/commercetools-python-sdk
d8ec285f08d56ede2e4cad45c74833f5b609ab5c
[ "MIT" ]
15
2018-11-02T14:35:52.000Z
2022-03-16T07:51:44.000Z
src/commercetools/services/inventory.py
lime-green/commercetools-python-sdk
63b77f6e5abe43e2b3ebbf3cdbbe00c7cf80dca6
[ "MIT" ]
84
2018-11-02T12:50:32.000Z
2022-03-22T01:25:54.000Z
src/commercetools/services/inventory.py
lime-green/commercetools-python-sdk
63b77f6e5abe43e2b3ebbf3cdbbe00c7cf80dca6
[ "MIT" ]
13
2019-01-03T09:16:50.000Z
2022-02-15T18:37:19.000Z
# DO NOT EDIT! This file is automatically generated import typing from commercetools.helpers import RemoveEmptyValuesMixin from commercetools.platform.models.inventory import ( InventoryEntry, InventoryEntryDraft, InventoryEntryUpdate, InventoryEntryUpdateAction, InventoryPagedQueryResponse, ) from commercetools.typing import OptionalListStr from . import abstract, traits class _InventoryEntryQuerySchema( traits.ExpandableSchema, traits.SortableSchema, traits.PagingSchema, traits.QuerySchema, ): pass class _InventoryEntryUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): pass class _InventoryEntryDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): pass class InventoryEntryService(abstract.AbstractService): """Inventory allows you to track stock quantities.""" def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> InventoryEntry: params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) return self._client._get( endpoint=f"inventory/{id}", params=params, response_class=InventoryEntry ) def query( self, *, expand: OptionalListStr = None, sort: OptionalListStr = None, limit: int = None, offset: int = None, with_total: bool = None, where: OptionalListStr = None, predicate_var: typing.Dict[str, str] = None, ) -> InventoryPagedQueryResponse: """Inventory allows you to track stock quantities.""" params = self._serialize_params( { "expand": expand, "sort": sort, "limit": limit, "offset": offset, "with_total": with_total, "where": where, "predicate_var": predicate_var, }, _InventoryEntryQuerySchema, ) return self._client._get( endpoint="inventory", params=params, response_class=InventoryPagedQueryResponse, ) def create( self, draft: InventoryEntryDraft, *, expand: OptionalListStr = None ) -> InventoryEntry: """Inventory allows you to track stock quantities.""" params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) return self._client._post( endpoint="inventory", params=params, data_object=draft, response_class=InventoryEntry, ) def update_by_id( self, id: str, version: int, actions: typing.List[InventoryEntryUpdateAction], *, expand: OptionalListStr = None, force_update: bool = False, ) -> InventoryEntry: params = self._serialize_params({"expand": expand}, _InventoryEntryUpdateSchema) update_action = InventoryEntryUpdate(version=version, actions=actions) return self._client._post( endpoint=f"inventory/{id}", params=params, data_object=update_action, response_class=InventoryEntry, force_update=force_update, ) def delete_by_id( self, id: str, version: int, *, expand: OptionalListStr = None, force_delete: bool = False, ) -> InventoryEntry: params = self._serialize_params( {"version": version, "expand": expand}, _InventoryEntryDeleteSchema ) return self._client._delete( endpoint=f"inventory/{id}", params=params, response_class=InventoryEntry, force_delete=force_delete, )
30.545455
88
0.623106
311
3,696
7.234727
0.266881
0.059111
0.055556
0.055556
0.311111
0.277778
0.263556
0.171111
0.171111
0.118667
0
0
0.28869
3,696
120
89
30.8
0.855839
0.052489
0
0.376238
1
0
0.040161
0
0
0
0
0
0
1
0.049505
false
0.029703
0.049505
0
0.188119
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
fb6a3d12a6011f130cb0dca995f5e63b890b615a
184
py
Python
Desafios/desafio48.py
ArthurBrito1/MY-SCRIPTS-PYTHON
86967fe293715a705ac50e908d3369fa3257b5a2
[ "MIT" ]
1
2019-11-21T02:08:58.000Z
2019-11-21T02:08:58.000Z
Desafios/desafio48.py
ArthurBrito1/MY-SCRIPTS-PYTHON
86967fe293715a705ac50e908d3369fa3257b5a2
[ "MIT" ]
null
null
null
Desafios/desafio48.py
ArthurBrito1/MY-SCRIPTS-PYTHON
86967fe293715a705ac50e908d3369fa3257b5a2
[ "MIT" ]
null
null
null
s = 0 cont = 0 for c in range(1, 501, 2): if c % 3 == 0: s = s + c cont = cont + 1 print('A soma de todos os {} valores solicitados é {}'.format(cont, s))
20.444444
72
0.483696
33
184
2.69697
0.666667
0
0
0
0
0
0
0
0
0
0
0.086207
0.369565
184
8
73
23
0.681034
0
0
0
0
0
0.262857
0
0
0
0
0
0
1
0
false
0
0
0
0
0.142857
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
fb747216a8e33dd3a7c21862ae471a10d4ad3882
246
py
Python
setup.py
whistlebee/awis-py
01793c72b369e5e41c4d11b7ba67f71e47cee3ef
[ "Apache-2.0" ]
1
2020-09-04T18:50:32.000Z
2020-09-04T18:50:32.000Z
setup.py
whistlebee/awis-py
01793c72b369e5e41c4d11b7ba67f71e47cee3ef
[ "Apache-2.0" ]
1
2020-09-06T05:51:43.000Z
2020-09-19T09:27:56.000Z
setup.py
whistlebee/awis-py
01793c72b369e5e41c4d11b7ba67f71e47cee3ef
[ "Apache-2.0" ]
null
null
null
from setuptools import setup, find_packages setup( name='awis-py', version='0.0.2', url='https://github.com/whistlebee/awis-py', packages=find_packages(), install_requires=['requests', 'lxml'], python_requires='>=3.6' )
20.5
48
0.658537
32
246
4.9375
0.75
0.151899
0
0
0
0
0
0
0
0
0
0.024272
0.162602
246
11
49
22.363636
0.742718
0
0
0
0
0
0.268293
0
0
0
0
0
0
1
0
true
0
0.111111
0
0.111111
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
1
fb7811b122904a7fba10519297aa03213ea6aa2e
755
py
Python
deep-rl/lib/python2.7/site-packages/OpenGL/GLES2/vboimplementation.py
ShujaKhalid/deep-rl
99c6ba6c3095d1bfdab81bd01395ced96bddd611
[ "MIT" ]
210
2016-04-09T14:26:00.000Z
2022-03-25T18:36:19.000Z
deep-rl/lib/python2.7/site-packages/OpenGL/GLES2/vboimplementation.py
ShujaKhalid/deep-rl
99c6ba6c3095d1bfdab81bd01395ced96bddd611
[ "MIT" ]
72
2016-09-04T09:30:19.000Z
2022-03-27T17:06:53.000Z
deep-rl/lib/python2.7/site-packages/OpenGL/GLES2/vboimplementation.py
ShujaKhalid/deep-rl
99c6ba6c3095d1bfdab81bd01395ced96bddd611
[ "MIT" ]
64
2016-04-09T14:26:49.000Z
2022-03-21T11:19:47.000Z
from OpenGL.arrays import vbo from OpenGL.GLES2.VERSION import GLES2_2_0 from OpenGL.GLES2.OES import mapbuffer class Implementation( vbo.Implementation ): """OpenGL-based implementation of VBO interfaces""" def __init__( self ): for name in self.EXPORTED_NAMES: for source in [ GLES2_2_0, mapbuffer ]: for possible in (name,name+'OES'): try: setattr( self, name, getattr( source, possible )) except AttributeError as err: pass else: found = True assert found, name if GLES2_2_0.glBufferData: self.available = True Implementation.register()
35.952381
73
0.561589
79
755
5.227848
0.531646
0.072639
0.050847
0
0
0
0
0
0
0
0
0.023158
0.370861
755
20
74
37.75
0.846316
0.059603
0
0
0
0
0.004261
0
0
0
0
0
0.055556
1
0.055556
false
0.055556
0.166667
0
0.277778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
1
fb7bbc55fb1c9399f6c93d62c5a66100a843787f
175
py
Python
examples/domainby.py
ipfinder/ip-finder-python
48ba093801d244c12a4583c138d62c94355baf28
[ "Apache-2.0" ]
8
2019-07-12T22:20:49.000Z
2022-03-01T09:03:58.000Z
examples/domainby.py
ipfinder/ip-finder-python
48ba093801d244c12a4583c138d62c94355baf28
[ "Apache-2.0" ]
2
2019-08-29T23:24:57.000Z
2021-02-01T15:15:16.000Z
examples/domainby.py
ipfinder/ip-finder-python
48ba093801d244c12a4583c138d62c94355baf28
[ "Apache-2.0" ]
5
2019-07-12T23:01:03.000Z
2021-07-07T11:11:44.000Z
import ipfinder con = ipfinder.config('f67f788f8a02a188ec84502e0dff066ed4413a85') # YOUR_TOKEN_GOES_HERE # domain name by = 'DZ'; dby = con.getDomainBy(by) print(dby.all)
15.909091
88
0.771429
21
175
6.285714
0.809524
0
0
0
0
0
0
0
0
0
0
0.168831
0.12
175
10
89
17.5
0.688312
0.182857
0
0
0
0
0.3
0.285714
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
fb8171ca82d4da70cd7cdba0a82012d267002dc5
4,227
py
Python
compuG/transformacionesPCarte copia.py
alejoso76/Computaci-n-gr-fica
474a498a328b8951aa0bfa1db2d0d1f3d8cc914b
[ "MIT" ]
null
null
null
compuG/transformacionesPCarte copia.py
alejoso76/Computaci-n-gr-fica
474a498a328b8951aa0bfa1db2d0d1f3d8cc914b
[ "MIT" ]
null
null
null
compuG/transformacionesPCarte copia.py
alejoso76/Computaci-n-gr-fica
474a498a328b8951aa0bfa1db2d0d1f3d8cc914b
[ "MIT" ]
null
null
null
import pygame import math #Dibuja triangulo y lo escala con el teclado ANCHO=600 ALTO=480 def dibujarPlano(o, pantalla): pygame.draw.line(pantalla, [0, 255, 0], [o[0], 0], [o[0], 480] ) pygame.draw.line(pantalla, [0, 255, 0], [0, o[1]], [640, o[1]] ) def dibujarTriangulo(a, b, c, plano): ''' pygame.draw.line(plano, [0, 255, 0], [a[0], a[1]], [b[0], b[1]] ) pygame.draw.line(plano, [0, 255, 0], [b[0], b[1]], [c[0], c[1]] ) pygame.draw.line(plano, [0, 255, 0], [c[0], c[1]], [a[0], a[1]] ) ''' pygame.draw.polygon(plano, [0, 255, 0], [a,b,c]) pygame.display.flip() return a, b, c def mostrarPos(): pos=pygame.mouse.get_pos() return pos def escalarPunto (a, factor): x=a[0]*factor y=a[1]*factor return x, y def rotacionHoraria(a): #xcos+ysen, -xsen+ycos x=int(a[0]*math.cos(math.pi/2) + a[1]*math.sin(math.pi/2)) y=int(-(a[0]*math.sin(math.pi/2)) + a[1]*math.cos(math.pi/2)) return x, y def rotacionAntiHoraria(a): #xcos-ysen, xsen+ycos x=int(a[0]*math.cos(math.pi/2) - a[1]*math.sin(math.pi/2)) y=int(a[0]*math.sin(math.pi/2) + a[1]*math.cos(math.pi/2)) return x, y def calcularPosPlano(o, pos): x=pos[0]-o[0] y=-1*(pos[1]-o[1]) return x, y def calcularPosPantalla(o, p): x=o[0]+p[0] y=o[1]-p[1] return x, y if __name__ == '__main__': pygame.init() pantalla=pygame.display.set_mode([ANCHO, ALTO]) #Crea la ventana o=[ANCHO/2, ALTO/2] dibujarPlano(o, pantalla) pygame.display.flip() print 'Funciona' cont=0 lista=[] fin=False while not fin: for event in pygame.event.get(): if event.type == pygame.QUIT: fin=True if event.type == pygame.MOUSEBUTTONDOWN: cont+=1 lista.append(mostrarPos()) if event.type == pygame.KEYDOWN: if event.key==pygame.K_RIGHT: pantalla.fill([0, 0, 0]) dibujarPlano(o, pantalla) pygame.display.flip() puntos=lista puntos[0]=calcularPosPlano(o, puntos[0]) puntos[1]=calcularPosPlano(o, puntos[1]) puntos[2]=calcularPosPlano(o, puntos[2]) ''' print 'Puntos iniciales:' print puntos ''' puntos[0]=rotacionHoraria(puntos[0]) puntos[1]=rotacionHoraria(puntos[1]) puntos[2]=rotacionHoraria(puntos[2]) puntos[0]=calcularPosPantalla(o, puntos[0]) puntos[1]=calcularPosPantalla(o, puntos[1]) puntos[2]=calcularPosPantalla(o, puntos[2]) '''' print 'Puntos finales:' print puntos ''' dibujarTriangulo(puntos[0], puntos[1], puntos[2], pantalla) if event.key==pygame.K_LEFT: pantalla.fill([0, 0, 0]) dibujarPlano(o, pantalla) pygame.display.flip() puntos=lista puntos[0]=calcularPosPlano(o, puntos[0]) puntos[1]=calcularPosPlano(o, puntos[1]) puntos[2]=calcularPosPlano(o, puntos[2]) ''' print 'Puntos iniciales:' print puntos ''' puntos[0]=rotacionAntiHoraria(puntos[0]) puntos[1]=rotacionAntiHoraria(puntos[1]) puntos[2]=rotacionAntiHoraria(puntos[2]) puntos[0]=calcularPosPantalla(o, puntos[0]) puntos[1]=calcularPosPantalla(o, puntos[1]) puntos[2]=calcularPosPantalla(o, puntos[2]) ''' print 'Puntos finales:' print puntos ''' dibujarTriangulo(puntos[0], puntos[1], puntos[2], pantalla) if cont==3: dibujarTriangulo(lista[0], lista[1], lista[2], pantalla) cont=0 #lista=[]
32.767442
79
0.492548
511
4,227
4.050881
0.176125
0.047343
0.027053
0.054106
0.565217
0.543961
0.525604
0.487923
0.463768
0.463768
0
0.052961
0.356754
4,227
128
80
33.023438
0.708349
0.025313
0
0.376471
0
0
0.004607
0
0
0
0
0
0
0
null
null
0
0.023529
null
null
0.011765
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fb8406595f2e94d2539b01b5e80bd41db3092f8b
1,667
py
Python
soccer_stats_calc/soccer_var_ana.py
steffens21/diesunddas
35222ff2ddac0b115dfd2e5b6764c6878af8d228
[ "MIT" ]
null
null
null
soccer_stats_calc/soccer_var_ana.py
steffens21/diesunddas
35222ff2ddac0b115dfd2e5b6764c6878af8d228
[ "MIT" ]
null
null
null
soccer_stats_calc/soccer_var_ana.py
steffens21/diesunddas
35222ff2ddac0b115dfd2e5b6764c6878af8d228
[ "MIT" ]
null
null
null
import sys from collections import deque import soccer_toolbox import csv_tools def fileToStats(csvfile, stat, nbrAgg): header, listRawData = csv_tools.loadData(csvfile) dictCol = csv_tools.getColumns(header) setTeams = csv_tools.getTeams(listRawData, dictCol['nColHomeTeam'], dictCol['nColAwayTeam']) resultDict = {team: list() for team in setTeams} teamDataDict = {team: list() for team in setTeams} for data in listRawData: teamDataDict[data[dictCol['nColHomeTeam']]].append(data) teamDataDict[data[dictCol['nColAwayTeam']]].append(data) for team in teamDataDict: currentData = deque() for data in teamDataDict[team]: currentData.append(data) if len(currentData) <= nbrAgg: continue else: currentData.popleft() # calc statsDict = soccer_toolbox.getStatsForTeam(team, dictCol, list(currentData)) resultDict[team].append(statsDict[stat]) if currentData: statsDict = soccer_toolbox.getStatsForTeam(team, dictCol, currentData) resultDict[team].append(statsDict[stat]) return resultDict def main(): if len(sys.argv) > 1: csvfile = sys.argv[1] else: csvfile = 'D1.csv' stat = 'Rating' if len(sys.argv) > 2: stat = sys.argv[2] nbrAgg = 1 if len(sys.argv) > 3: nbrAgg = int(sys.argv[3]) dictTeamStats = fileToStats(csvfile, stat, nbrAgg) for name, val in sorted(dictTeamStats.items()): print ','.join([name] + map(str, val)) if __name__ == "__main__": main()
29.245614
96
0.619076
179
1,667
5.681564
0.324022
0.041298
0.026549
0.035398
0.230089
0.230089
0
0
0
0
0
0.006579
0.270546
1,667
56
97
29.767857
0.82977
0.0024
0
0.093023
0
0
0.041541
0
0
0
0
0
0
0
null
null
0
0.093023
null
null
0.023256
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fb8546895b2c19d3192fb1d824c0ca8782071aeb
895
py
Python
HelloWorldWebsite/searchTest/views.py
404NotFound-401/DjangoTutorial
8218b5308245b309c7cb36386306152378602b6d
[ "MIT" ]
null
null
null
HelloWorldWebsite/searchTest/views.py
404NotFound-401/DjangoTutorial
8218b5308245b309c7cb36386306152378602b6d
[ "MIT" ]
10
2019-09-07T20:30:34.000Z
2019-09-08T19:22:11.000Z
HelloWorldWebsite/searchTest/views.py
404NotFound-401/DjangoTutorial
8218b5308245b309c7cb36386306152378602b6d
[ "MIT" ]
1
2019-09-08T19:38:54.000Z
2019-09-08T19:38:54.000Z
from __future__ import unicode_literals from django.shortcuts import render, redirect from django.template import loader from django.http import HttpResponse from django.views import generic from .models import Movie from . import searchapi from django.urls import reverse # Create your views here. class Search(generic.DetailView): model = Movie template_name = 'searchTest.html' def get(self, request, *args, **kwargs): context = {'movieId':'Please enter the film name'} return render(request, self.template_name, context) def post(self, request, *args, **kwargs): if 'movieName' in request.POST: print("Get movie name") context = searchapi.getName(request.POST['movieName']) else: print("Wrong act") return redirect('mainpage') return render(request, "home/result.html", context)
28.870968
66
0.684916
107
895
5.663551
0.514019
0.082508
0.049505
0.069307
0
0
0
0
0
0
0
0
0.221229
895
30
67
29.833333
0.86944
0.025698
0
0
0
0
0.130184
0
0
0
0
0
0
1
0.090909
false
0
0.363636
0
0.727273
0.090909
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
1
fb8662bca964b254e5cebea057da8c25555e063b
27,693
py
Python
mapreduce/handlers.py
igeeker/v2ex
9fa81f7c82aa7d162a924d357494b241eb8a6207
[ "BSD-3-Clause" ]
161
2019-07-23T06:53:45.000Z
2022-03-24T01:07:19.000Z
mapreduce/handlers.py
igeeker/v2ex
9fa81f7c82aa7d162a924d357494b241eb8a6207
[ "BSD-3-Clause" ]
null
null
null
mapreduce/handlers.py
igeeker/v2ex
9fa81f7c82aa7d162a924d357494b241eb8a6207
[ "BSD-3-Clause" ]
26
2019-08-05T06:09:38.000Z
2021-07-08T02:05:13.000Z
#!/usr/bin/env python # # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # """Defines executor tasks handlers for MapReduce implementation.""" # Disable "Invalid method name" # pylint: disable-msg=C6409 import datetime import logging import math import os from mapreduce.lib import simplejson import time from google.appengine.api import memcache from google.appengine.api.labs import taskqueue from google.appengine.ext import db from mapreduce import base_handler from mapreduce import context from mapreduce import quota from mapreduce import model from mapreduce import quota from mapreduce import util # TODO(user): Make this a product of the reader or in quotas.py _QUOTA_BATCH_SIZE = 20 # The amount of time to perform scanning in one slice. New slice will be # scheduled as soon as current one takes this long. _SLICE_DURATION_SEC = 15 # Delay between consecutive controller callback invocations. _CONTROLLER_PERIOD_SEC = 2 class Error(Exception): """Base class for exceptions in this module.""" class NotEnoughArgumentsError(Error): """Required argument is missing.""" class NoDataError(Error): """There is no data present for a desired input.""" class MapperWorkerCallbackHandler(base_handler.BaseHandler): """Callback handler for mapreduce worker task. Request Parameters: mapreduce_spec: MapreduceSpec of the mapreduce serialized to json. shard_id: id of the shard. slice_id: id of the slice. """ def __init__(self, time_function=time.time): """Constructor. Args: time_function: time function to use to obtain current time. """ base_handler.BaseHandler.__init__(self) self._time = time_function def post(self): """Handle post request.""" spec = model.MapreduceSpec.from_json_str( self.request.get("mapreduce_spec")) self._start_time = self._time() shard_id = self.shard_id() # TODO(user): Make this prettier logging.debug("post: shard=%s slice=%s headers=%s", shard_id, self.slice_id(), self.request.headers) shard_state, control = db.get([ model.ShardState.get_key_by_shard_id(shard_id), model.MapreduceControl.get_key_by_job_id(spec.mapreduce_id), ]) if not shard_state: # We're letting this task to die. It's up to controller code to # reinitialize and restart the task. logging.error("State not found for shard ID %r; shutting down", shard_id) return if control and control.command == model.MapreduceControl.ABORT: logging.info("Abort command received by shard %d of job '%s'", shard_state.shard_number, shard_state.mapreduce_id) shard_state.active = False shard_state.result_status = model.ShardState.RESULT_ABORTED shard_state.put() model.MapreduceControl.abort(spec.mapreduce_id) return input_reader = self.input_reader(spec.mapper) if spec.mapper.params.get("enable_quota", True): quota_consumer = quota.QuotaConsumer( quota.QuotaManager(memcache.Client()), shard_id, _QUOTA_BATCH_SIZE) else: quota_consumer = None ctx = context.Context(spec, shard_state) context.Context._set(ctx) try: # consume quota ahead, because we do not want to run a datastore # query if there's not enough quota for the shard. if not quota_consumer or quota_consumer.check(): scan_aborted = False entity = None # We shouldn't fetch an entity from the reader if there's not enough # quota to process it. Perform all quota checks proactively. if not quota_consumer or quota_consumer.consume(): for entity in input_reader: if isinstance(entity, db.Model): shard_state.last_work_item = repr(entity.key()) else: shard_state.last_work_item = repr(entity)[:100] scan_aborted = not self.process_entity(entity, ctx) # Check if we've got enough quota for the next entity. if (quota_consumer and not scan_aborted and not quota_consumer.consume()): scan_aborted = True if scan_aborted: break else: scan_aborted = True if not scan_aborted: logging.info("Processing done for shard %d of job '%s'", shard_state.shard_number, shard_state.mapreduce_id) # We consumed extra quota item at the end of for loop. # Just be nice here and give it back :) if quota_consumer: quota_consumer.put(1) shard_state.active = False shard_state.result_status = model.ShardState.RESULT_SUCCESS # TODO(user): Mike said we don't want this happen in case of # exception while scanning. Figure out when it's appropriate to skip. ctx.flush() finally: context.Context._set(None) if quota_consumer: quota_consumer.dispose() # Rescheduling work should always be the last statement. It shouldn't happen # if there were any exceptions in code before it. if shard_state.active: self.reschedule(spec, input_reader) def process_entity(self, entity, ctx): """Process a single entity. Call mapper handler on the entity. Args: entity: an entity to process. ctx: current execution context. Returns: True if scan should be continued, False if scan should be aborted. """ ctx.counters.increment(context.COUNTER_MAPPER_CALLS) handler = ctx.mapreduce_spec.mapper.handler if util.is_generator_function(handler): for result in handler(entity): if callable(result): result(ctx) else: try: if len(result) == 2: logging.error("Collectors not implemented yet") else: logging.error("Got bad output tuple of length %d", len(result)) except TypeError: logging.error( "Handler yielded type %s, expected a callable or a tuple", result.__class__.__name__) else: handler(entity) if self._time() - self._start_time > _SLICE_DURATION_SEC: logging.debug("Spent %s seconds. Rescheduling", self._time() - self._start_time) return False return True def shard_id(self): """Get shard unique identifier of this task from request. Returns: shard identifier as string. """ return str(self.request.get("shard_id")) def slice_id(self): """Get slice unique identifier of this task from request. Returns: slice identifier as int. """ return int(self.request.get("slice_id")) def input_reader(self, mapper_spec): """Get the reader from mapper_spec initialized with the request's state. Args: mapper_spec: a mapper spec containing the immutable mapper state. Returns: An initialized InputReader. """ input_reader_spec_dict = simplejson.loads( self.request.get("input_reader_state")) return mapper_spec.input_reader_class().from_json( input_reader_spec_dict) @staticmethod def worker_parameters(mapreduce_spec, shard_id, slice_id, input_reader): """Fill in mapper worker task parameters. Returned parameters map is to be used as task payload, and it contains all the data, required by mapper worker to perform its function. Args: mapreduce_spec: specification of the mapreduce. shard_id: id of the shard (part of the whole dataset). slice_id: id of the slice (part of the shard). input_reader: InputReader containing the remaining inputs for this shard. Returns: string->string map of parameters to be used as task payload. """ return {"mapreduce_spec": mapreduce_spec.to_json_str(), "shard_id": shard_id, "slice_id": str(slice_id), "input_reader_state": input_reader.to_json_str()} @staticmethod def get_task_name(shard_id, slice_id): """Compute single worker task name. Args: shard_id: id of the shard (part of the whole dataset) as string. slice_id: id of the slice (part of the shard) as int. Returns: task name which should be used to process specified shard/slice. """ # Prefix the task name with something unique to this framework's # namespace so we don't conflict with user tasks on the queue. return "appengine-mrshard-%s-%s" % (shard_id, slice_id) def reschedule(self, mapreduce_spec, input_reader): """Reschedule worker task to continue scanning work. Args: mapreduce_spec: mapreduce specification. input_reader: remaining input reader to process. """ MapperWorkerCallbackHandler.schedule_slice( self.base_path(), mapreduce_spec, self.shard_id(), self.slice_id() + 1, input_reader) @classmethod def schedule_slice(cls, base_path, mapreduce_spec, shard_id, slice_id, input_reader, queue_name=None, eta=None, countdown=None): """Schedule slice scanning by adding it to the task queue. Args: base_path: base_path of mapreduce request handlers as string. mapreduce_spec: mapreduce specification as MapreduceSpec. shard_id: current shard id as string. slice_id: slice id as int. input_reader: remaining InputReader for given shard. queue_name: Optional queue to run on; uses the current queue of execution or the default queue if unspecified. eta: Absolute time when the MR should execute. May not be specified if 'countdown' is also supplied. This may be timezone-aware or timezone-naive. countdown: Time in seconds into the future that this MR should execute. Defaults to zero. """ task_params = MapperWorkerCallbackHandler.worker_parameters( mapreduce_spec, shard_id, slice_id, input_reader) task_name = MapperWorkerCallbackHandler.get_task_name(shard_id, slice_id) queue_name = os.environ.get("HTTP_X_APPENGINE_QUEUENAME", queue_name or "default") try: taskqueue.Task(url=base_path + "/worker_callback", params=task_params, name=task_name, eta=eta, countdown=countdown).add(queue_name) except (taskqueue.TombstonedTaskError, taskqueue.TaskAlreadyExistsError), e: logging.warning("Task %r with params %r already exists. %s: %s", task_name, task_params, e.__class__, e) class ControllerCallbackHandler(base_handler.BaseHandler): """Supervises mapreduce execution. Is also responsible for gathering execution status from shards together. This task is "continuously" running by adding itself again to taskqueue if mapreduce is still active. """ def __init__(self, time_function=time.time): """Constructor. Args: time_function: time function to use to obtain current time. """ base_handler.BaseHandler.__init__(self) self._time = time_function def post(self): """Handle post request.""" spec = model.MapreduceSpec.from_json_str( self.request.get("mapreduce_spec")) # TODO(user): Make this logging prettier. logging.debug("post: id=%s headers=%s", spec.mapreduce_id, self.request.headers) state, control = db.get([ model.MapreduceState.get_key_by_job_id(spec.mapreduce_id), model.MapreduceControl.get_key_by_job_id(spec.mapreduce_id), ]) if not state: logging.error("State not found for mapreduce_id '%s'; skipping", spec.mapreduce_id) return shard_states = model.ShardState.find_by_mapreduce_id(spec.mapreduce_id) if state.active and len(shard_states) != spec.mapper.shard_count: # Some shards were lost logging.error("Incorrect number of shard states: %d vs %d; " "aborting job '%s'", len(shard_states), spec.mapper.shard_count, spec.mapreduce_id) state.active = False state.result_status = model.MapreduceState.RESULT_FAILED model.MapreduceControl.abort(spec.mapreduce_id) active_shards = [s for s in shard_states if s.active] failed_shards = [s for s in shard_states if s.result_status == model.ShardState.RESULT_FAILED] aborted_shards = [s for s in shard_states if s.result_status == model.ShardState.RESULT_ABORTED] if state.active: state.active = bool(active_shards) state.active_shards = len(active_shards) state.failed_shards = len(failed_shards) state.aborted_shards = len(aborted_shards) if (not state.active and control and control.command == model.MapreduceControl.ABORT): # User-initiated abort *after* all shards have completed. logging.info("Abort signal received for job '%s'", spec.mapreduce_id) state.result_status = model.MapreduceState.RESULT_ABORTED if not state.active: state.active_shards = 0 if not state.result_status: # Set final result status derived from shard states. if [s for s in shard_states if s.result_status != model.ShardState.RESULT_SUCCESS]: state.result_status = model.MapreduceState.RESULT_FAILED else: state.result_status = model.MapreduceState.RESULT_SUCCESS logging.info("Final result for job '%s' is '%s'", spec.mapreduce_id, state.result_status) # We don't need a transaction here, since we change only statistics data, # and we don't care if it gets overwritten/slightly inconsistent. self.aggregate_state(state, shard_states) poll_time = state.last_poll_time state.last_poll_time = datetime.datetime.utcfromtimestamp(self._time()) if not state.active: # This is the last execution. # Enqueue done_callback if needed. def put_state(state): state.put() done_callback = spec.params.get( model.MapreduceSpec.PARAM_DONE_CALLBACK) if done_callback: taskqueue.Task( url=done_callback, headers={"Mapreduce-Id": spec.mapreduce_id}).add( spec.params.get( model.MapreduceSpec.PARAM_DONE_CALLBACK_QUEUE, "default"), transactional=True) db.run_in_transaction(put_state, state) return else: state.put() processing_rate = int(spec.mapper.params.get( "processing_rate") or model._DEFAULT_PROCESSING_RATE_PER_SEC) self.refill_quotas(poll_time, processing_rate, active_shards) ControllerCallbackHandler.reschedule( self.base_path(), spec, self.serial_id() + 1) def aggregate_state(self, mapreduce_state, shard_states): """Update current mapreduce state by aggregating shard states. Args: mapreduce_state: current mapreduce state as MapreduceState. shard_states: all shard states (active and inactive). list of ShardState. """ processed_counts = [] mapreduce_state.counters_map.clear() for shard_state in shard_states: mapreduce_state.counters_map.add_map(shard_state.counters_map) processed_counts.append(shard_state.counters_map.get( context.COUNTER_MAPPER_CALLS)) mapreduce_state.set_processed_counts(processed_counts) def refill_quotas(self, last_poll_time, processing_rate, active_shard_states): """Refill quotas for all active shards. Args: last_poll_time: Datetime with the last time the job state was updated. processing_rate: How many items to process per second overall. active_shard_states: All active shard states, list of ShardState. """ if not active_shard_states: return quota_manager = quota.QuotaManager(memcache.Client()) current_time = int(self._time()) last_poll_time = time.mktime(last_poll_time.timetuple()) total_quota_refill = processing_rate * max(0, current_time - last_poll_time) quota_refill = int(math.ceil( 1.0 * total_quota_refill / len(active_shard_states))) if not quota_refill: return # TODO(user): use batch memcache API to refill quota in one API call. for shard_state in active_shard_states: quota_manager.put(shard_state.shard_id, quota_refill) def serial_id(self): """Get serial unique identifier of this task from request. Returns: serial identifier as int. """ return int(self.request.get("serial_id")) @staticmethod def get_task_name(mapreduce_spec, serial_id): """Compute single controller task name. Args: mapreduce_spec: specification of the mapreduce. serial_id: id of the invocation as int. Returns: task name which should be used to process specified shard/slice. """ # Prefix the task name with something unique to this framework's # namespace so we don't conflict with user tasks on the queue. return "appengine-mrcontrol-%s-%s" % ( mapreduce_spec.mapreduce_id, serial_id) @staticmethod def controller_parameters(mapreduce_spec, serial_id): """Fill in controller task parameters. Returned parameters map is to be used as task payload, and it contains all the data, required by controller to perform its function. Args: mapreduce_spec: specification of the mapreduce. serial_id: id of the invocation as int. Returns: string->string map of parameters to be used as task payload. """ return {"mapreduce_spec": mapreduce_spec.to_json_str(), "serial_id": str(serial_id)} @classmethod def reschedule(cls, base_path, mapreduce_spec, serial_id, queue_name=None): """Schedule new update status callback task. Args: base_path: mapreduce handlers url base path as string. mapreduce_spec: mapreduce specification as MapreduceSpec. serial_id: id of the invocation as int. queue_name: The queue to schedule this task on. Will use the current queue of execution if not supplied. """ task_name = ControllerCallbackHandler.get_task_name( mapreduce_spec, serial_id) task_params = ControllerCallbackHandler.controller_parameters( mapreduce_spec, serial_id) if not queue_name: queue_name = os.environ.get("HTTP_X_APPENGINE_QUEUENAME", "default") try: taskqueue.Task(url=base_path + "/controller_callback", name=task_name, params=task_params, countdown=_CONTROLLER_PERIOD_SEC).add(queue_name) except (taskqueue.TombstonedTaskError, taskqueue.TaskAlreadyExistsError), e: logging.warning("Task %r with params %r already exists. %s: %s", task_name, task_params, e.__class__, e) class KickOffJobHandler(base_handler.BaseHandler): """Taskqueue handler which kicks off a mapreduce processing. Request Parameters: mapreduce_spec: MapreduceSpec of the mapreduce serialized to json. input_readers: List of InputReaders objects separated by semi-colons. """ def post(self): """Handles kick off request.""" spec = model.MapreduceSpec.from_json_str( self._get_required_param("mapreduce_spec")) input_readers_json = simplejson.loads( self._get_required_param("input_readers")) queue_name = os.environ.get("HTTP_X_APPENGINE_QUEUENAME", "default") mapper_input_reader_class = spec.mapper.input_reader_class() input_readers = [mapper_input_reader_class.from_json_str(reader_json) for reader_json in input_readers_json] KickOffJobHandler._schedule_shards( spec, input_readers, queue_name, self.base_path()) ControllerCallbackHandler.reschedule( self.base_path(), spec, queue_name=queue_name, serial_id=0) def _get_required_param(self, param_name): """Get a required request parameter. Args: param_name: name of request parameter to fetch. Returns: parameter value Raises: NotEnoughArgumentsError: if parameter is not specified. """ value = self.request.get(param_name) if not value: raise NotEnoughArgumentsError(param_name + " not specified") return value @classmethod def _schedule_shards(cls, spec, input_readers, queue_name, base_path): """Prepares shard states and schedules their execution. Args: spec: mapreduce specification as MapreduceSpec. input_readers: list of InputReaders describing shard splits. queue_name: The queue to run this job on. base_path: The base url path of mapreduce callbacks. """ # Note: it's safe to re-attempt this handler because: # - shard state has deterministic and unique key. # - schedule_slice will fall back gracefully if a task already exists. shard_states = [] for shard_number, input_reader in enumerate(input_readers): shard = model.ShardState.create_new(spec.mapreduce_id, shard_number) shard.shard_description = str(input_reader) shard_states.append(shard) # Retrievs already existing shards. existing_shard_states = db.get(shard.key() for shard in shard_states) existing_shard_keys = set(shard.key() for shard in existing_shard_states if shard is not None) # Puts only non-existing shards. db.put(shard for shard in shard_states if shard.key() not in existing_shard_keys) for shard_number, input_reader in enumerate(input_readers): shard_id = model.ShardState.shard_id_from_number( spec.mapreduce_id, shard_number) MapperWorkerCallbackHandler.schedule_slice( base_path, spec, shard_id, 0, input_reader, queue_name=queue_name) class StartJobHandler(base_handler.JsonHandler): """Command handler starts a mapreduce job.""" def handle(self): """Handles start request.""" # Mapper spec as form arguments. mapreduce_name = self._get_required_param("name") mapper_input_reader_spec = self._get_required_param("mapper_input_reader") mapper_handler_spec = self._get_required_param("mapper_handler") mapper_params = self._get_params( "mapper_params_validator", "mapper_params.") params = self._get_params( "params_validator", "params.") # Set some mapper param defaults if not present. mapper_params["processing_rate"] = int(mapper_params.get( "processing_rate") or model._DEFAULT_PROCESSING_RATE_PER_SEC) queue_name = mapper_params["queue_name"] = mapper_params.get( "queue_name", "default") # Validate the Mapper spec, handler, and input reader. mapper_spec = model.MapperSpec( mapper_handler_spec, mapper_input_reader_spec, mapper_params, int(mapper_params.get("shard_count", model._DEFAULT_SHARD_COUNT))) mapreduce_id = type(self)._start_map( mapreduce_name, mapper_spec, params, base_path=self.base_path(), queue_name=queue_name, _app=mapper_params.get("_app")) self.json_response["mapreduce_id"] = mapreduce_id def _get_params(self, validator_parameter, name_prefix): """Retrieves additional user-supplied params for the job and validates them. Args: validator_parameter: name of the request parameter which supplies validator for this parameter set. name_prefix: common prefix for all parameter names in the request. Raises: Any exception raised by the 'params_validator' request parameter if the params fail to validate. """ params_validator = self.request.get(validator_parameter) user_params = {} for key in self.request.arguments(): if key.startswith(name_prefix): values = self.request.get_all(key) adjusted_key = key[len(name_prefix):] if len(values) == 1: user_params[adjusted_key] = values[0] else: user_params[adjusted_key] = values if params_validator: resolved_validator = util.for_name(params_validator) resolved_validator(user_params) return user_params def _get_required_param(self, param_name): """Get a required request parameter. Args: param_name: name of request parameter to fetch. Returns: parameter value Raises: NotEnoughArgumentsError: if parameter is not specified. """ value = self.request.get(param_name) if not value: raise NotEnoughArgumentsError(param_name + " not specified") return value @classmethod def _start_map(cls, name, mapper_spec, mapreduce_params, base_path="/mapreduce", queue_name="default", eta=None, countdown=None, _app=None): # Check that handler can be instantiated. mapper_spec.get_handler() mapper_input_reader_class = mapper_spec.input_reader_class() mapper_input_readers = mapper_input_reader_class.split_input(mapper_spec) if not mapper_input_readers: raise NoDataError("Found no mapper input readers to process.") mapper_spec.shard_count = len(mapper_input_readers) state = model.MapreduceState.create_new() mapreduce_spec = model.MapreduceSpec( name, state.key().id_or_name(), mapper_spec.to_json(), mapreduce_params) state.mapreduce_spec = mapreduce_spec state.active = True state.active_shards = mapper_spec.shard_count if _app: state.app_id = _app # TODO(user): Initialize UI fields correctly. state.char_url = "" state.sparkline_url = "" def schedule_mapreduce(state, mapper_input_readers, eta, countdown): state.put() readers_json = [reader.to_json_str() for reader in mapper_input_readers] taskqueue.Task( url=base_path + "/kickoffjob_callback", params={"mapreduce_spec": state.mapreduce_spec.to_json_str(), "input_readers": simplejson.dumps(readers_json)}, eta=eta, countdown=countdown).add(queue_name, transactional=True) # Point of no return: We're actually going to run this job! db.run_in_transaction( schedule_mapreduce, state, mapper_input_readers, eta, countdown) return state.key().id_or_name() class CleanUpJobHandler(base_handler.JsonHandler): """Command to kick off tasks to clean up a job's data.""" def handle(self): # TODO(user): Have this kick off a task to clean up all MapreduceState, # ShardState, and MapreduceControl entities for a job ID. self.json_response["status"] = "This does nothing yet." class AbortJobHandler(base_handler.JsonHandler): """Command to abort a running job.""" def handle(self): model.MapreduceControl.abort(self.request.get("mapreduce_id")) self.json_response["status"] = "Abort signal sent."
35.188056
80
0.680605
3,533
27,693
5.12822
0.152279
0.020642
0.012419
0.004471
0.373772
0.317254
0.280329
0.237223
0.200684
0.196766
0
0.001521
0.240386
27,693
786
81
35.232824
0.859764
0.106236
0
0.26087
0
0
0.075547
0.008175
0
0
0
0.006361
0
0
null
null
0
0.036232
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fb8db21fcb68449e4d69cc6ce7881b29676db85c
864
py
Python
Numbers/floor_tiles_cost.py
lucasc896/Projects
01ec687b07e4b56554c89ecc244fe5979c489826
[ "MIT" ]
null
null
null
Numbers/floor_tiles_cost.py
lucasc896/Projects
01ec687b07e4b56554c89ecc244fe5979c489826
[ "MIT" ]
null
null
null
Numbers/floor_tiles_cost.py
lucasc896/Projects
01ec687b07e4b56554c89ecc244fe5979c489826
[ "MIT" ]
null
null
null
import math as ma # note all sizes in m^2 # all costs in pounds def get_details(): return {'w': get_value("Width:", float), 'h': get_value("Height:", float), 'cost': get_value("Cost per tile:", float),} def get_value(text = "enter_val", expected_type = None): while True: r_in = raw_input(text) try: r_in = expected_type(r_in) return r_in except ValueError: print "Incorrect variable type entered. Expected: %s" % expected_type def get_cost(d = {}): for key in ['w', 'h', 'cost', 'tile_area']: assert key in d total_cost = d['w']*d['h']*d['cost']/d['tile_area'] return total_cost if __name__ == "__main__": vals = get_details() vals['tile_area'] = 0.04 #0.2m squared tiles print "\n > Total cost: %.2f\n" % get_cost(vals)
23.351351
81
0.572917
126
864
3.690476
0.484127
0.068817
0
0
0
0
0
0
0
0
0
0.011236
0.278935
864
37
82
23.351351
0.735152
0.068287
0
0
0
0
0.198254
0
0
0
0
0
0.045455
0
null
null
0
0.045455
null
null
0.090909
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fb9534493c6c33c290455dafb3878a1f3ed9246b
454
py
Python
opendbc/generator/test_generator.py
darknight111/openpilot3
a0c755fbe1889f26404a8225816f57e89fde7bc2
[ "MIT" ]
116
2018-03-07T09:00:10.000Z
2020-04-06T18:37:45.000Z
opendbc/generator/test_generator.py
darknight111/openpilot3
a0c755fbe1889f26404a8225816f57e89fde7bc2
[ "MIT" ]
66
2020-04-09T20:27:57.000Z
2022-01-27T14:39:24.000Z
opendbc/generator/test_generator.py
darknight111/openpilot3
a0c755fbe1889f26404a8225816f57e89fde7bc2
[ "MIT" ]
154
2020-04-08T21:41:22.000Z
2022-03-17T21:05:33.000Z
#!/usr/bin/env python3 import os import filecmp import tempfile from opendbc.generator.generator import create_all, opendbc_root def test_generator(): with tempfile.TemporaryDirectory() as d: create_all(d) ignore = [f for f in os.listdir(opendbc_root) if not f.endswith('_generated.dbc')] comp = filecmp.dircmp(opendbc_root, d, ignore=ignore) assert len(comp.diff_files) == 0, f"Different files: {comp.diff_files}" test_generator()
26.705882
86
0.746696
67
454
4.910448
0.567164
0.100304
0.079027
0
0
0
0
0
0
0
0
0.005141
0.143172
454
16
87
28.375
0.840617
0.046256
0
0
0
0
0.111111
0
0
0
0
0
0.090909
1
0.090909
false
0
0.363636
0
0.454545
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
1
fb97354673fa2e5ae7cab8bfd23169b53bcbcce7
254
py
Python
python/griddly/util/rllib/torch/agents/common.py
maichmueller/Griddly
25b978a08f13226de2831d0941af0f37fea12718
[ "MIT" ]
93
2020-05-29T14:36:46.000Z
2022-03-28T02:58:04.000Z
python/griddly/util/rllib/torch/agents/common.py
maichmueller/Griddly
25b978a08f13226de2831d0941af0f37fea12718
[ "MIT" ]
35
2020-07-22T16:43:03.000Z
2022-03-30T19:50:20.000Z
python/griddly/util/rllib/torch/agents/common.py
maichmueller/Griddly
25b978a08f13226de2831d0941af0f37fea12718
[ "MIT" ]
13
2020-07-22T08:24:28.000Z
2022-01-28T06:58:38.000Z
import numpy as np from torch import nn def layer_init(layer, std=np.sqrt(2), bias_const=0.0): """ Simple function to init layers """ nn.init.orthogonal_(layer.weight, std) nn.init.constant_(layer.bias, bias_const) return layer
21.166667
54
0.685039
40
254
4.225
0.6
0.106509
0
0
0
0
0
0
0
0
0
0.014778
0.200787
254
11
55
23.090909
0.817734
0.11811
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
1
fb9c65b9797d0529bc740e716a16f8507c95db85
1,567
py
Python
testframework/checkers/spanner_checker.py
emartech/ems-dataflow-testframework
c70b0768573e9c4af98173bb0b444dee442de53a
[ "MIT" ]
null
null
null
testframework/checkers/spanner_checker.py
emartech/ems-dataflow-testframework
c70b0768573e9c4af98173bb0b444dee442de53a
[ "MIT" ]
null
null
null
testframework/checkers/spanner_checker.py
emartech/ems-dataflow-testframework
c70b0768573e9c4af98173bb0b444dee442de53a
[ "MIT" ]
1
2022-02-17T19:56:44.000Z
2022-02-17T19:56:44.000Z
import logging from collections import Generator from typing import Dict from spanner import ems_spanner_client from tenacity import retry, stop_after_attempt, wait_fixed class SpannerChecker: STOP_AFTER_ATTEMPT_SECS = 15 WAIT_FIXED = 3 def __init__(self, project_id: str, instance_id: str, db_name: str) -> None: self._client = ems_spanner_client.EmsSpannerClient(project_id, instance_id, db_name) def execute_sql(self, query: str) -> Generator: logging.info(f"Executing query: {query}") return self._client.execute_sql(query) def execute_update(self, query: str): logging.info(f"Executing update: {query}") self._client.execute_update(query) def has_row_for(self, table_name: str, conditions: Dict): @retry(stop=stop_after_attempt(self.STOP_AFTER_ATTEMPT_SECS), wait=wait_fixed(self.WAIT_FIXED)) def is_found(query: str): if list(self.execute_sql(query))[0][0] == 0: raise ValueError("Spanner table row not found.") return True query = self._compose_query(table_name, conditions) return is_found(query) @staticmethod def _compose_query(table_name, conditions) -> str: normalized_conditions = [] for key, value in conditions.items(): quoted_value = f"'{value}'" if isinstance(value, str) else value normalized_conditions.append(f'{key} = {quoted_value}') where = ' AND '.join(normalized_conditions) return f'SELECT COUNT(*) FROM {table_name} WHERE {where}'
37.309524
103
0.685386
203
1,567
5.029557
0.349754
0.03526
0.062684
0.039177
0.060725
0
0
0
0
0
0
0.004878
0.215061
1,567
41
104
38.219512
0.825203
0
0
0
0
0
0.102106
0
0
0
0
0
0
1
0.1875
false
0
0.15625
0
0.5625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
fba184b6f53f7d77cbaf5e8e08d7ed47d47fd543
5,950
py
Python
vgg16_imagenet.py
jamccomb92/TransferLearningPneuomia
d476cb89dc75e51ea7bbbea3542590fe0e74dfaa
[ "MIT" ]
null
null
null
vgg16_imagenet.py
jamccomb92/TransferLearningPneuomia
d476cb89dc75e51ea7bbbea3542590fe0e74dfaa
[ "MIT" ]
null
null
null
vgg16_imagenet.py
jamccomb92/TransferLearningPneuomia
d476cb89dc75e51ea7bbbea3542590fe0e74dfaa
[ "MIT" ]
null
null
null
\ import os from keras import applications import keras import tensorflow as tf import time config = tf.ConfigProto() config.gpu_options.allow_growth = True keras.backend.tensorflow_backend.set_session(tf.Session(config=config)) from keras.models import Model from keras.layers import Input, Conv2D, MaxPooling2D, Flatten, Dense, Dropout from keras.preprocessing.image import ImageDataGenerator from keras.optimizers import Adam,SGD from keras.callbacks import ModelCheckpoint,CSVLogger from keras import backend as k DATASET_PATH = '/deepLearning/jamccomb/chest_xray/' IMAGE_SIZE = (150,150) NUM_CLASSES = 2 BATCH_SIZE = 32 # try reducing batch size or freeze more layers if your GPU runs out of memory NUM_EPOCHS = 35 WEIGHTS_FINAL = 'model-transfer-Chest-MobileNet-000001--final.h5' train_datagen = ImageDataGenerator( rescale=1.0 / 255.0, rotation_range=40, width_shift_range=0.2, height_shift_range=0.2, shear_range=0.2, zoom_range=0.2, channel_shift_range=10, horizontal_flip=True, fill_mode='nearest') train_batches = train_datagen.flow_from_directory(DATASET_PATH + '/train', target_size=IMAGE_SIZE, interpolation='bicubic', class_mode='categorical', shuffle=True, batch_size=BATCH_SIZE) valid_datagen = ImageDataGenerator(rescale=1.0/255.0) valid_batches = valid_datagen.flow_from_directory(DATASET_PATH + '/test', target_size=IMAGE_SIZE, interpolation='bicubic', class_mode='categorical', shuffle=False, batch_size=BATCH_SIZE) lrelu = lambda x: tensorflow.keras.activations.relu(x, alpha=0.1) # Load VGG16 model architecture with the ImageNet weights model = applications.VGG16(weights = "imagenet", include_top=False, input_shape=[150,150,3]) # Freeze the layers which you don't want to train. Here I am freezing the first 5 layers. for layer in model.layers[:14]: layer.trainable = False # Build classifier x = model.output x = Flatten()(x) x = Dense(32, activation="sigmoid")(x) predictions = Dense(2, activation="softmax")(x) #Use Adam optimizer (instead of plain SGD), set learning rate to explore. adam = Adam(lr=.00001) #instantiate model model = Model(input=model.input, output=predictions) #Compile model model.compile(optimizer = adam, loss='categorical_crossentropy', metrics=['accuracy']) #Print layers for resulting model model.summary() #Log training data into csv file csv_logger = CSVLogger(filename="vgg16-imagenet-log.csv") checkpointer = ModelCheckpoint(filepath='MobileNet/000001//weights.{epoch:02d}-{val_acc:.2f}.hdf5',monitor='val_loss', verbose=1, save_best_only=True, mode='min') cblist = [csv_logger, checkpointer] # train the model model.fit_generator(train_batches, steps_per_epoch = train_batches.samples // BATCH_SIZE, validation_data = valid_batches, validation_steps = valid_batches.samples // BATCH_SIZE, epochs = NUM_EPOCHS, callbacks=cblist) # save trained model and weights model.save(WEIGHTS_FINAL)
58.910891
271
0.381849
416
5,950
5.302885
0.461538
0.032638
0.012693
0.029918
0.12602
0.12602
0.094288
0.059837
0.059837
0.059837
0
0.031444
0.567059
5,950
100
272
59.5
0.824922
0.377143
0
0.123077
0
0
0.080486
0.052982
0
0
0
0
0
1
0
false
0
0.169231
0
0.169231
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
fba6946e547a329b3ac4d404e2ef31baf20b094f
5,290
py
Python
pxr/base/tf/testenv/testTfStringUtils.py
DougRogers-DigitalFish/USD
d8a405a1344480f859f025c4f97085143efacb53
[ "BSD-2-Clause" ]
3,680
2016-07-26T18:28:11.000Z
2022-03-31T09:55:05.000Z
pxr/base/tf/testenv/testTfStringUtils.py
DougRogers-DigitalFish/USD
d8a405a1344480f859f025c4f97085143efacb53
[ "BSD-2-Clause" ]
1,759
2016-07-26T19:19:59.000Z
2022-03-31T21:24:00.000Z
pxr/base/tf/testenv/testTfStringUtils.py
DougRogers-DigitalFish/USD
d8a405a1344480f859f025c4f97085143efacb53
[ "BSD-2-Clause" ]
904
2016-07-26T18:33:40.000Z
2022-03-31T09:55:16.000Z
#!/pxrpythonsubst # # Copyright 2016 Pixar # # Licensed under the Apache License, Version 2.0 (the "Apache License") # with the following modification; you may not use this file except in # compliance with the Apache License and the following modification to it: # Section 6. Trademarks. is deleted and replaced with: # # 6. Trademarks. This License does not grant permission to use the trade # names, trademarks, service marks, or product names of the Licensor # and its affiliates, except as required to comply with Section 4(c) of # the License and to reproduce the content of the NOTICE file. # # You may obtain a copy of the Apache License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the Apache License with the above modification is # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the Apache License for the specific # language governing permissions and limitations under the Apache License. # from pxr import Tf import logging import unittest class TestStringUtils(unittest.TestCase): """ Test Tf String Utils (The python wrapped porting of the utility functions). """ def setUp(self): self.log = logging.getLogger() def test_StringSplit(self): """Testing StringSplit() function. This function is supposed to behave like the split method on python string objects.""" self.log.info("Testing string split cases") self.assertEqual([], Tf.StringSplit("","")) self.assertEqual([], Tf.StringSplit("abcd","")) self.assertEqual([], Tf.StringSplit("","ccc")) s = "abcd" self.assertEqual(s.split("a"), Tf.StringSplit(s, "a")) self.assertEqual(s.split("b"), Tf.StringSplit(s, "b")) self.assertEqual(s.split("c"), Tf.StringSplit(s, "c")) self.assertEqual(s.split("d"), Tf.StringSplit(s, "d")) self.assertEqual(s.split("abcd"), Tf.StringSplit(s, "abcd")) self.assertEqual(s.split("ab"), Tf.StringSplit(s, "ab")) s = "a:+b:+c:+d" self.assertEqual(s.split(":+"), Tf.StringSplit(s, ":+")) s = "a:+b:+c:d" self.assertEqual(s.split(":+"), Tf.StringSplit(s, ":+")) def test_Unicode(self): """Testing that we can pass python unicode objects to wrapped functions expecting std::string""" self.log.info("Testing unicode calls") self.assertEqual(Tf.StringSplit('123', '2'), ['1', '3']) self.assertEqual(Tf.StringSplit('123', u'2'), ['1', '3']) self.assertEqual(Tf.StringSplit(u'123', '2'), ['1', '3']) self.assertEqual(Tf.StringSplit(u'123', u'2'), ['1', '3']) self.assertEqual(Tf.DictionaryStrcmp('apple', 'banana'), -1) self.assertEqual(Tf.DictionaryStrcmp('apple', u'banana'), -1) self.assertEqual(Tf.DictionaryStrcmp(u'apple', 'banana'), -1) self.assertEqual(Tf.DictionaryStrcmp(u'apple', u'banana'), -1) def test_StringToLong(self): def checks(val): self.assertEqual(Tf.StringToLong(repr(val)), val) def checku(val): self.assertEqual(Tf.StringToULong(repr(val)), val) # A range of valid values. for i in range(1000000): checku(i) for i in range(-500000, 500000): checks(i) # A wider range of valid values. for i in range(0, 1000000000, 9337): checks(i) for i in range(-500000000, 500000000, 9337): checks(i) # Get the max/min values. ulmax, lmax, lmin = ( Tf._GetULongMax(), Tf._GetLongMax(), Tf._GetLongMin()) # Check the extrema and one before to ensure they work. for n in [ulmax-1, ulmax]: checku(n) for n in [lmin, lmin+1, lmax-1, lmax]: checks(n) # Check that some beyond the extrema over/underflow. # # Unsigned overflow. for i in range(1, 1000): with self.assertRaises(ValueError): checku(ulmax + i) with self.assertRaises(ValueError): checks(lmax + i) with self.assertRaises(ValueError): checks(lmin - i) def test_Identifiers(self): self.assertFalse(Tf.IsValidIdentifier('')) self.assertTrue(Tf.IsValidIdentifier('hello9')) self.assertFalse(Tf.IsValidIdentifier('9hello')) self.assertTrue(Tf.IsValidIdentifier('hello_world')) self.assertTrue(Tf.IsValidIdentifier('HELLO_WORLD')) self.assertTrue(Tf.IsValidIdentifier('hello_world_1234')) self.assertFalse(Tf.IsValidIdentifier('hello_#world#_1234')) self.assertFalse(Tf.IsValidIdentifier('h e l l o')) self.assertEqual(Tf.MakeValidIdentifier(''), '_') self.assertEqual(Tf.MakeValidIdentifier('hello9'), 'hello9') self.assertEqual(Tf.MakeValidIdentifier('9hello'), '_hello') self.assertEqual( Tf.MakeValidIdentifier('hello_#world#_1234'), 'hello__world__1234') self.assertFalse(Tf.IsValidIdentifier('h e l l o'), 'h_e_l_l_o') self.assertFalse(Tf.IsValidIdentifier('!@#$%'), '_____') if __name__ == '__main__': unittest.main()
38.613139
79
0.633648
659
5,290
5.028832
0.308042
0.113156
0.087206
0.050694
0.288775
0.246228
0.204285
0.190706
0.12764
0.095051
0
0.030497
0.23138
5,290
136
80
38.897059
0.784555
0.286578
0
0.105263
0
0
0.093733
0
0
0
0
0
0.5
1
0.092105
false
0
0.039474
0
0.144737
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
1
fba6b995d133300dd22ec22078918d89b609c5b5
4,300
py
Python
oui/return_arp.py
sukhjinderpalsingh/ansible
07669bfc1e072af670f32a6ba037513c470caf8d
[ "Unlicense" ]
4
2019-04-17T13:16:58.000Z
2020-05-05T23:07:35.000Z
oui/return_arp.py
sukhjinderpalsingh/ansible
07669bfc1e072af670f32a6ba037513c470caf8d
[ "Unlicense" ]
null
null
null
oui/return_arp.py
sukhjinderpalsingh/ansible
07669bfc1e072af670f32a6ba037513c470caf8d
[ "Unlicense" ]
1
2019-05-23T17:24:16.000Z
2019-05-23T17:24:16.000Z
#!/usr/bin/python import subprocess import sys import cgi import datetime import re import requests validMac = False ERROR = False form = cgi.FieldStorage() user = "READONLY_USER_HERE" pwd = "PASSWORD" OUI = form.getvalue('OUI') host = form.getvalue('HOST') def formatOUI(OUI): ot=OUI[0:2] tf=OUI[2:4] fs=OUI[5:7] fmac = ot+":"+tf+":"+fs+":00:00:00" return fmac fOUI = formatOUI(OUI) webCmd = "show ip arp | i {}".format(OUI[0:7]) def printHeader(): print "Content-type: text/html" print "" print "<html><head>" print "<title>OUI Finder</title></head><body>" print "<br />Time run: " + str(datetime.datetime.now()) + "<br>" def checkInput(): pattern = re.compile('[a-fA-F0-9]{4}.[a-fA-F0-9]{2}') if re.match(pattern,OUI[0:7]): return True else: return False def sanitize(outp): item=[] outp = outp.split('# STATS ')[0] outp = outp.split(' * ') del outp[0] print "<BR>" item = [] for i in outp: entry = [] i = i.replace('changed=False','') if "Internet" not in i: entry.append(i.split(' ')[0]) else: entry.append(i.split(' ')[0]) i = i.split(' Internet ') del i[0] for j in i: j = j.split(' ') j = [k for k in j if k] del j[1] del j[2] entry.append(j) item.append(entry) return item def displaySanitized(hosts): totHosts = 0 for i in hosts: if len(i)>1: totHosts+=(len(i)-1) print "<CENTER>" print "Number of hosts found: " + str(totHosts) print "<TABLE border='1' cellpadding='10'> " for item in hosts: if len(item) == 1: print "<TR><TH colspan='3'>" print item[0] print "</TH></TR>" print "<TR><TH>IP</TH><TH>MAC</TH><TH>VLAN</TH>" print "<TR><TD colspan='3'>No hosts found</TD></TR>" else: print "<TR><TH colspan='3'>" print item[0] print "</TH></TR>" print "<TR><TH>IP</TH><TH>MAC</TH><TH>VLAN</TH>" for i in range(1,len(item)): print "<TR><TD>" print item[i][0] print "</TD><TD>" print item[i][1] print "</TD><TD>" print item[i][2] print "</TD></TR>" print "</TABLE>" def executeCmd(host): cmd = """ansible-playbook /ansible/plays/show_cmd.yml --limit '"""+host+"""' -e 'user="{0}" pass="{1}" cmd="{2}"' | sed 's/\\\\n/\\n/g'""".format(user,pwd,webCmd) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) outp = str(p.communicate()[0]) if 'Authentication failed.' in outp: print "<CENTER><H1>***ERROR!***<br>Authentication failed.</H1><h3>Check credentials</h3></CENTER>" displaySanitized(sanitize(outp)) def lookup(OUI): MAC_URL = 'http://macvendors.co/api/%s' r = requests.get(MAC_URL % OUI) print "<CENTER><h3>Vendor Name: "+(r.json()['result']['company'])+"</h3></CENTER>" printHeader() validMac = checkInput() if validMac == False: print "<CENTER><h3>{} OUI not formatted correctly, please use xxxx.xx (Cisco format).</h3></CENTER>".format(OUI) else: try: lookup(fOUI) except: ERROR = True print "<CENTER>OUI not found in database!<br>Check and try again</CENTER>" if ERROR == False: executeCmd(host)
33.858268
172
0.428837
473
4,300
3.887949
0.331924
0.022839
0.019576
0.019576
0.109842
0.090266
0.069603
0.069603
0.069603
0.069603
0
0.022855
0.42
4,300
126
173
34.126984
0.714515
0.003721
0
0.165138
0
0.055046
0.238874
0.065672
0
0
0
0
0
0
null
null
0.018349
0.055046
null
null
0.293578
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fbaa2cc659c7ec0bddf4650c7e382079513809ba
3,192
py
Python
darling_ansible/python_venv/lib/python3.7/site-packages/oci/monitoring/models/failed_metric_record.py
revnav/sandbox
f9c8422233d093b76821686b6c249417502cf61d
[ "Apache-2.0" ]
null
null
null
darling_ansible/python_venv/lib/python3.7/site-packages/oci/monitoring/models/failed_metric_record.py
revnav/sandbox
f9c8422233d093b76821686b6c249417502cf61d
[ "Apache-2.0" ]
null
null
null
darling_ansible/python_venv/lib/python3.7/site-packages/oci/monitoring/models/failed_metric_record.py
revnav/sandbox
f9c8422233d093b76821686b6c249417502cf61d
[ "Apache-2.0" ]
1
2020-06-25T03:12:58.000Z
2020-06-25T03:12:58.000Z
# coding: utf-8 # Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 from oci.decorators import init_model_state_from_kwargs @init_model_state_from_kwargs class FailedMetricRecord(object): """ The record of a single metric object that failed input validation and the reason for the failure. """ def __init__(self, **kwargs): """ Initializes a new FailedMetricRecord object with values from keyword arguments. The following keyword arguments are supported (corresponding to the getters/setters of this class): :param message: The value to assign to the message property of this FailedMetricRecord. :type message: str :param metric_data: The value to assign to the metric_data property of this FailedMetricRecord. :type metric_data: MetricDataDetails """ self.swagger_types = { 'message': 'str', 'metric_data': 'MetricDataDetails' } self.attribute_map = { 'message': 'message', 'metric_data': 'metricData' } self._message = None self._metric_data = None @property def message(self): """ **[Required]** Gets the message of this FailedMetricRecord. An error message indicating the reason that the indicated metric object failed input validation. :return: The message of this FailedMetricRecord. :rtype: str """ return self._message @message.setter def message(self, message): """ Sets the message of this FailedMetricRecord. An error message indicating the reason that the indicated metric object failed input validation. :param message: The message of this FailedMetricRecord. :type: str """ self._message = message @property def metric_data(self): """ **[Required]** Gets the metric_data of this FailedMetricRecord. Identifier of a metric object that failed input validation. :return: The metric_data of this FailedMetricRecord. :rtype: MetricDataDetails """ return self._metric_data @metric_data.setter def metric_data(self, metric_data): """ Sets the metric_data of this FailedMetricRecord. Identifier of a metric object that failed input validation. :param metric_data: The metric_data of this FailedMetricRecord. :type: MetricDataDetails """ self._metric_data = metric_data def __repr__(self): return formatted_flat_dict(self) def __eq__(self, other): if other is None: return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not self == other
31.294118
245
0.658835
378
3,192
5.383598
0.325397
0.088452
0.117936
0.055037
0.39656
0.274693
0.199509
0.199509
0.199509
0.199509
0
0.007739
0.271303
3,192
101
246
31.60396
0.867154
0.536028
0
0.057143
0
0
0.061139
0
0
0
0
0
0
1
0.228571
false
0
0.057143
0.057143
0.485714
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
1
fbaf22f54791d4657c17a86b0e49e13fd65f1463
7,614
py
Python
options/train_options.py
fatalfeel/DeblurGAN
cc4ccf09d23b91389dbea70a34797cb80331819c
[ "BSD-3-Clause" ]
3
2021-07-12T07:38:32.000Z
2021-11-16T04:56:00.000Z
options/train_options.py
fatalfeel/DeblurGAN
cc4ccf09d23b91389dbea70a34797cb80331819c
[ "BSD-3-Clause" ]
1
2021-11-03T09:57:31.000Z
2021-11-04T03:00:49.000Z
options/train_options.py
fatalfeel/DeblurGAN
cc4ccf09d23b91389dbea70a34797cb80331819c
[ "BSD-3-Clause" ]
null
null
null
import os import torch import argparse from util import util def str2bool(b_str): if b_str.lower() in ('yes', 'true', 't', 'y', '1'): return True elif b_str.lower() in ('no', 'false', 'f', 'n', '0'): return False class TrainOptions(): def __init__(self): self.parser = argparse.ArgumentParser() self.parser.add_argument('--dataroot', type=str, default='./data/combined', help='path to images (should have subfolders train, val, test)') self.parser.add_argument('--batchSize', type=int, default=1, help='input batch size') self.parser.add_argument('--loadSizeX', type=int, default=640, help='scale images to this size') self.parser.add_argument('--loadSizeY', type=int, default=360, help='scale images to this size') self.parser.add_argument('--fineSize', type=int, default=256, help='then crop to this size') self.parser.add_argument('--input_nc', type=int, default=3, help='# of input image channels') self.parser.add_argument('--output_nc', type=int, default=3, help='# of output image channels') self.parser.add_argument('--ngf', type=int, default=64, help='# of gen filters in first conv layer') self.parser.add_argument('--ndf', type=int, default=64, help='# of discrim filters in first conv layer') self.parser.add_argument('--which_model_netG', type=str, default='RESNET', help='RESNET, FPN50, FPN101, FPN152') self.parser.add_argument('--learn_residual', type=str2bool, default=True, help='if specified, model would learn only the residual to the input') self.parser.add_argument('--resume', type=str2bool, default=False, help='continue training') self.parser.add_argument('--gan_type', type=str, default='gan', help='gan is faster, wgan-gp is stable') self.parser.add_argument('--n_layers_D', type=int, default=3, help='only used if which_model_netD==n_layers') self.parser.add_argument('--n_layers_G', type=int, default=3, help='2 layers features 2^6~2^8, 3 layers features 2^6~2^9') self.parser.add_argument('--n_blocks_G', type=int, default=12, help='ResnetBlocks at 6, 9, 12...') #self.parser.add_argument('--gpu_ids', type=str, default='0', help='gpu ids: e.g. 0 0,1,2, 0,2. use -1 for CPU') self.parser.add_argument('--cuda', type=str2bool, default=False, help='using gpu training') self.parser.add_argument('--dataset_mode', type=str, default='aligned', help='chooses how datasets are loaded. [unaligned | aligned | single]') self.parser.add_argument('--model', type=str, default='content_gan', help='chooses which model to use. content_gan, pix2pix, test') self.parser.add_argument('--which_direction', type=str, default='AtoB', help='AtoB or BtoA') self.parser.add_argument('--nThreads', type=int, default=1, help='# threads for loading data') self.parser.add_argument('--checkpoints_dir', type=str, default='./checkpoint', help='models are saved here') self.parser.add_argument('--norm', type=str, default='instance', help='instance normalization or batch normalization') self.parser.add_argument('--serial_batches', action='store_true', help='if true, takes images in order to make batches, otherwise takes them randomly') self.parser.add_argument('--display_winsize', type=int, default=256, help='display window size') self.parser.add_argument('--display_id', type=int, default=-1, help='window id of the web display') self.parser.add_argument('--display_port', type=int, default=8097, help='visdom port of the web display') self.parser.add_argument('--display_single_pane_ncols', type=int, default=0, help='if positive, display all images in a single visdom web panel with certain number of images per row.') self.parser.add_argument('--no_dropout', action='store_true', help='no dropout for the generator') self.parser.add_argument('--max_dataset_size', type=int, default=float("inf"), help='Maximum number of samples allowed per dataset. If the dataset directory contains more than max_dataset_size, only a subset is loaded.') self.parser.add_argument('--resize_or_crop', type=str, default='crop', help='scaling and cropping of images at load time [resize_and_crop|crop|scale_width|scale_width_and_crop]') self.parser.add_argument('--no_flip', action='store_true', help='if specified, do not flip the images for data augmentation') self.parser.add_argument('--display_freq', type=int, default=100, help='frequency of showing training results on screen') self.parser.add_argument('--print_freq', type=int, default=20, help='frequency of showing training results on console') self.parser.add_argument('--save_epoch_freq', type=int, default=10, help='frequency of saving checkpoints at the end of epochs') self.parser.add_argument('--phase', type=str, default='train', help='train, val, test, etc') self.parser.add_argument('--e_epoch', type=int, default=2000, help='number repeat to train') self.parser.add_argument('--beta1', type=float, default=0.5, help='momentum term of adam') self.parser.add_argument('--lr', type=float, default=0.00001, help='initial learning rate for adam') self.parser.add_argument('--content_weight', type=float, default=100.0, help='fast-neural-style content weight') self.parser.add_argument('--pool_size', type=int, default=50, help='the size of image buffer that stores previously generated images') self.parser.add_argument('--no_html', action='store_true', help='do not save intermediate training results to [opt.checkpoints_dir]/[opt.name]/web/') self.isTrain = True def GetOption(self): self.opt = self.parser.parse_args() self.opt.isTrain = self.isTrain #train or test args = vars(self.opt) print('------------ Options -------------') for k, v in sorted(args.items()): print('%s: %s' % (str(k), str(v))) #print('-------------- End ----------------') # save to the disk #expr_dir = os.path.join(self.opt.checkpoints_dir, self.opt.name) expr_dir = self.opt.checkpoints_dir util.mkdirs(expr_dir) file_name = os.path.join(expr_dir, 'opt.txt') with open(file_name, 'wt') as opt_file: opt_file.write('------------ Options -------------\n') for k, v in sorted(args.items()): opt_file.write('%s: %s\n' % (str(k), str(v))) opt_file.write('-------------- End ----------------\n') return self.opt
89.576471
237
0.582217
950
7,614
4.542105
0.283158
0.104287
0.129548
0.20927
0.295249
0.146698
0.107764
0.061645
0.061645
0.021321
0
0.016863
0.275676
7,614
84
238
90.642857
0.765549
0.03638
0
0.028169
0
0.028169
0.343972
0.019776
0
0
0
0
0
1
0.042254
false
0
0.056338
0
0.15493
0.042254
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
fbb17de1e27a39093c5016a288d1b4d494da72ba
2,227
py
Python
backend/app/literature/schemas/cross_reference_schemas.py
alliance-genome/agr_literature_service
2278316422d5c3ab65e21bb97d91e861e48853c5
[ "MIT" ]
null
null
null
backend/app/literature/schemas/cross_reference_schemas.py
alliance-genome/agr_literature_service
2278316422d5c3ab65e21bb97d91e861e48853c5
[ "MIT" ]
39
2021-10-18T17:02:49.000Z
2022-03-28T20:56:24.000Z
backend/app/literature/schemas/cross_reference_schemas.py
alliance-genome/agr_literature_service
2278316422d5c3ab65e21bb97d91e861e48853c5
[ "MIT" ]
1
2021-10-21T00:11:18.000Z
2021-10-21T00:11:18.000Z
from typing import List, Optional from pydantic import BaseModel from pydantic import validator class CrossReferenceSchemaRelated(BaseModel): curie: str pages: Optional[List[str]] = None is_obsolete: Optional[bool] = None @validator('curie') def name_must_contain_space(cls, v): if v.count(":") != 1 and not v.startswith("DOI:"): raise ValueError('must contain a single colon') return v class Config(): orm_mode = True extra = "forbid" schema_extra = { "example": { "curie": "MOD:curie", "pages": [ "reference" ] } } class CrossReferenceSchemaPost(CrossReferenceSchemaRelated): resource_curie: Optional[str] = None reference_curie: Optional[str] = None class Config(): orm_mod = True extra = "forbid" schema_extra = { "example": { "curie": "MOD:curie", "pages": [ "reference" ], "reference_curie": "AGR:AGRReference<number>" } } class CrossReferencePageSchemaShow(BaseModel): name: Optional[str] = None url: Optional[str] = None class Config(): orm_mode = True extra = "forbid" class CrossReferenceSchemaShow(BaseModel): curie: str url: Optional[str] = None pages: Optional[List[CrossReferencePageSchemaShow]] = None is_obsolete: bool class CrossReferenceSchema(BaseModel): curie: str pages: Optional[List[CrossReferencePageSchemaShow]] = None url: Optional[str] = None is_obsolete: Optional[bool] = False resource_curie: Optional[str] = None reference_curie: Optional[str] = None author_ids: Optional[List[int]] = None editor_ids: Optional[List[int]] = None class Config(): orm_mode = True extra = "forbid" class CrossReferenceSchemaUpdate(BaseModel): pages: Optional[List[str]] = None resource_curie: Optional[str] = None reference_curie: Optional[str] = None is_obsolete: Optional[bool] = None class Config(): orm_mode = True extra = "forbid"
24.472527
62
0.594073
216
2,227
6.018519
0.287037
0.064615
0.115385
0.092308
0.592308
0.473077
0.401538
0.316923
0.288462
0.223846
0
0.000645
0.303996
2,227
90
63
24.744444
0.838065
0
0
0.608696
0
0
0.07903
0.010777
0
0
0
0
0
1
0.014493
false
0
0.043478
0
0.565217
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
fbb43010f529aa881832d163b127b8c90dbb0317
4,445
py
Python
syft_proto/frameworks/crypten/onnx_model_pb2.py
vkkhare/syft-proto
513b4af50d7476bd5b1ff9dfb6da8528100f961d
[ "Apache-2.0" ]
null
null
null
syft_proto/frameworks/crypten/onnx_model_pb2.py
vkkhare/syft-proto
513b4af50d7476bd5b1ff9dfb6da8528100f961d
[ "Apache-2.0" ]
null
null
null
syft_proto/frameworks/crypten/onnx_model_pb2.py
vkkhare/syft-proto
513b4af50d7476bd5b1ff9dfb6da8528100f961d
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: syft_proto/frameworks/crypten/onnx_model.proto from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() from syft_proto.types.syft.v1 import id_pb2 as syft__proto_dot_types_dot_syft_dot_v1_dot_id__pb2 DESCRIPTOR = _descriptor.FileDescriptor( name='syft_proto/frameworks/crypten/onnx_model.proto', package='syft_proto.frameworks.torch.tensors.interpreters.v1', syntax='proto3', serialized_options=b'\n@org.openmined.syftproto.frameworks.torch.tensors.interpreters.v1', create_key=_descriptor._internal_create_key, serialized_pb=b'\n.syft_proto/frameworks/crypten/onnx_model.proto\x12\x33syft_proto.frameworks.torch.tensors.interpreters.v1\x1a!syft_proto/types/syft/v1/id.proto\"\x9a\x01\n\tOnnxModel\x12,\n\x02id\x18\x01 \x01(\x0b\x32\x1c.syft_proto.types.syft.v1.IdR\x02id\x12)\n\x10serialized_model\x18\x02 \x01(\x0cR\x0fserializedModel\x12\x12\n\x04tags\x18\x03 \x03(\tR\x04tags\x12 \n\x0b\x64\x65scription\x18\x04 \x01(\tR\x0b\x64\x65scriptionBB\n@org.openmined.syftproto.frameworks.torch.tensors.interpreters.v1b\x06proto3' , dependencies=[syft__proto_dot_types_dot_syft_dot_v1_dot_id__pb2.DESCRIPTOR,]) _ONNXMODEL = _descriptor.Descriptor( name='OnnxModel', full_name='syft_proto.frameworks.torch.tensors.interpreters.v1.OnnxModel', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='id', full_name='syft_proto.frameworks.torch.tensors.interpreters.v1.OnnxModel.id', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, json_name='id', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( name='serialized_model', full_name='syft_proto.frameworks.torch.tensors.interpreters.v1.OnnxModel.serialized_model', index=1, number=2, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, json_name='serializedModel', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( name='tags', full_name='syft_proto.frameworks.torch.tensors.interpreters.v1.OnnxModel.tags', index=2, number=3, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, json_name='tags', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( name='description', full_name='syft_proto.frameworks.torch.tensors.interpreters.v1.OnnxModel.description', index=3, number=4, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, json_name='description', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=139, serialized_end=293, ) _ONNXMODEL.fields_by_name['id'].message_type = syft__proto_dot_types_dot_syft_dot_v1_dot_id__pb2._ID DESCRIPTOR.message_types_by_name['OnnxModel'] = _ONNXMODEL _sym_db.RegisterFileDescriptor(DESCRIPTOR) OnnxModel = _reflection.GeneratedProtocolMessageType('OnnxModel', (_message.Message,), { 'DESCRIPTOR' : _ONNXMODEL, '__module__' : 'syft_proto.frameworks.crypten.onnx_model_pb2' # @@protoc_insertion_point(class_scope:syft_proto.frameworks.torch.tensors.interpreters.v1.OnnxModel) }) _sym_db.RegisterMessage(OnnxModel) DESCRIPTOR._options = None # @@protoc_insertion_point(module_scope)
46.302083
516
0.783127
593
4,445
5.541315
0.22597
0.046561
0.063603
0.103469
0.574559
0.555691
0.493914
0.443701
0.366403
0.366403
0
0.031227
0.099438
4,445
95
517
46.789474
0.789658
0.068841
0
0.266667
1
0.013333
0.285092
0.247338
0
0
0
0
0
1
0
false
0
0.066667
0
0.066667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
fbbc5a0d2746e83d3a087caa18124913a0952155
519
py
Python
src/main/resources/pytz/zoneinfo/Asia/Brunei.py
TheEin/swagger-maven-plugin
cf93dce2d5c8d3534f4cf8c612b11e2d2313871b
[ "Apache-2.0" ]
65
2015-11-14T13:46:01.000Z
2021-08-14T05:54:04.000Z
lib/pytz/zoneinfo/Asia/Brunei.py
tjsavage/polymer-dashboard
19bc467f1206613f8eec646b6f2bc43cc319ef75
[ "CNRI-Python", "Linux-OpenIB" ]
13
2016-03-31T20:00:17.000Z
2021-08-20T14:52:31.000Z
lib/pytz/zoneinfo/Asia/Brunei.py
tjsavage/polymer-dashboard
19bc467f1206613f8eec646b6f2bc43cc319ef75
[ "CNRI-Python", "Linux-OpenIB" ]
20
2015-03-18T08:41:37.000Z
2020-12-18T02:58:30.000Z
'''tzinfo timezone information for Asia/Brunei.''' from pytz.tzinfo import DstTzInfo from pytz.tzinfo import memorized_datetime as d from pytz.tzinfo import memorized_ttinfo as i class Brunei(DstTzInfo): '''Asia/Brunei timezone definition. See datetime.tzinfo for details''' zone = 'Asia/Brunei' _utc_transition_times = [ d(1,1,1,0,0,0), d(1926,2,28,16,20,20), d(1932,12,31,16,30,0), ] _transition_info = [ i(27600,0,'LMT'), i(27000,0,'BNT'), i(28800,0,'BNT'), ] Brunei = Brunei()
20.76
74
0.674374
82
519
4.182927
0.5
0.087464
0.122449
0.174927
0.169096
0
0
0
0
0
0
0.116009
0.169557
519
24
75
21.625
0.679814
0.210019
0
0
0
0
0.050251
0
0
0
0
0
0
1
0
false
0
0.1875
0
0.4375
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
fbbc6e1e7a5fe37234c1f6cec6987abfae3a501e
4,184
py
Python
raiden/tests/unit/test_messages.py
ConsenSysMesh/raiden
76510e5535fa0a1ceb26107b560f805f3d7d26d9
[ "MIT" ]
3
2017-04-24T01:09:28.000Z
2017-05-26T18:32:34.000Z
raiden/tests/unit/test_messages.py
ConsenSysMesh/raiden
76510e5535fa0a1ceb26107b560f805f3d7d26d9
[ "MIT" ]
1
2021-10-31T12:41:15.000Z
2021-10-31T12:41:15.000Z
raiden/tests/unit/test_messages.py
isabella232/raiden
76510e5535fa0a1ceb26107b560f805f3d7d26d9
[ "MIT" ]
1
2021-10-31T12:05:52.000Z
2021-10-31T12:05:52.000Z
# -*- coding: utf-8 -*- import pytest from raiden.messages import Ping, Ack, decode, Lock, MediatedTransfer from raiden.utils import make_privkey_address, sha3 PRIVKEY, ADDRESS = make_privkey_address() def test_signature(): ping = Ping(nonce=0) ping.sign(PRIVKEY, ADDRESS) assert ping.sender == ADDRESS def test_encoding(): ping = Ping(nonce=0) ping.sign(PRIVKEY, ADDRESS) decoded_ping = decode(ping.encode()) assert isinstance(decoded_ping, Ping) assert decoded_ping.sender == ADDRESS == ping.sender assert ping.nonce == decoded_ping.nonce assert ping.signature == decoded_ping.signature assert ping.cmdid == decoded_ping.cmdid assert ping.hash == decoded_ping.hash def test_hash(): ping = Ping(nonce=0) ping.sign(PRIVKEY, ADDRESS) data = ping.encode() msghash = sha3(data) decoded_ping = decode(data) assert sha3(decoded_ping.encode()) == msghash def test_ack(): echo = sha3(PRIVKEY) ack = Ack(ADDRESS, echo) assert ack.echo == echo data = ack.encode() msghash = sha3(data) decoded_ack = decode(data) assert decoded_ack.echo == ack.echo assert decoded_ack.sender == ack.sender assert sha3(decoded_ack.encode()) == msghash def test_mediated_transfer(): nonce = balance = 1 token = recipient = target = initiator = ADDRESS hashlock = locksroot = sha3(ADDRESS) amount = expiration = 1 fee = 0 lock = Lock(amount, expiration, hashlock) mediated_transfer = MediatedTransfer( 1, # TODO: fill in identifier nonce, token, balance, recipient, locksroot, lock, target, initiator, fee, ) assert roundtrip_serialize_mediated_transfer(mediated_transfer) def make_lock_with_amount(amount): return Lock(amount, 1, "a" * 32) def make_mediated_transfer_with_amount(amount): return MediatedTransfer( 0, 1, ADDRESS, amount, ADDRESS, "", make_lock_with_amount(amount), ADDRESS, ADDRESS, 0 ) def make_mediated_transfer_with_nonce(nonce): return MediatedTransfer( 0, nonce, ADDRESS, 1, ADDRESS, "", make_lock_with_amount(1), ADDRESS, ADDRESS, 0 ) def make_mediated_transfer_with_fee(fee): return MediatedTransfer( 0, 1, ADDRESS, 1, ADDRESS, "", make_lock_with_amount(1), ADDRESS, ADDRESS, fee ) def roundtrip_serialize_mediated_transfer(mediated_transfer): mediated_transfer.sign(PRIVKEY, ADDRESS) decoded_mediated_transfer = decode(mediated_transfer.encode()) assert decoded_mediated_transfer == mediated_transfer return True @pytest.mark.parametrize("amount", [-1, 2 ** 256]) @pytest.mark.parametrize("make", [make_lock_with_amount, make_mediated_transfer_with_amount]) def test_amount_out_of_bounds(amount, make): with pytest.raises(ValueError): make(amount) @pytest.mark.parametrize("amount", [0, 2 ** 256 - 1]) def test_mediated_transfer_amount_min_max(amount): mediated_transfer = make_mediated_transfer_with_amount(amount) assert roundtrip_serialize_mediated_transfer(mediated_transfer) @pytest.mark.parametrize("nonce", [2 ** 64]) def test_mediated_transfer_nonce_out_of_bounds(nonce): with pytest.raises(ValueError): make_mediated_transfer_with_nonce(nonce) @pytest.mark.parametrize("nonce", [2 ** 64 - 1]) def test_mediated_transfer_nonce_max(nonce): mediated_transfer = make_mediated_transfer_with_nonce(nonce) assert roundtrip_serialize_mediated_transfer(mediated_transfer) @pytest.mark.parametrize("fee", [2 ** 256]) def test_mediated_transfer_fee_out_of_bounds(fee): with pytest.raises(ValueError): make_mediated_transfer_with_fee(fee) @pytest.mark.parametrize("fee", [0, 2 ** 256 - 1]) def test_mediated_transfer_fee_min_max(fee): mediated_transfer = make_mediated_transfer_with_fee(fee) assert roundtrip_serialize_mediated_transfer(mediated_transfer)
25.668712
70
0.675908
493
4,184
5.462475
0.144016
0.202005
0.06684
0.080208
0.500186
0.372818
0.261418
0.261418
0.092833
0.092833
0
0.017653
0.22825
4,184
162
71
25.82716
0.816352
0.010994
0
0.354331
0
0
0.007981
0
0
0
0
0.006173
0.133858
1
0.125984
false
0
0.023622
0.031496
0.188976
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
fbbdd496f48c965142da201326e11323ba150849
6,428
py
Python
python/helpful_scripts/circle_packing.py
Oilgrim/ivs_sim
95dc017ef2aec32173e73dc397ba00177d4f92ce
[ "MIT" ]
null
null
null
python/helpful_scripts/circle_packing.py
Oilgrim/ivs_sim
95dc017ef2aec32173e73dc397ba00177d4f92ce
[ "MIT" ]
null
null
null
python/helpful_scripts/circle_packing.py
Oilgrim/ivs_sim
95dc017ef2aec32173e73dc397ba00177d4f92ce
[ "MIT" ]
1
2019-08-07T03:16:47.000Z
2019-08-07T03:16:47.000Z
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Jul 5 12:41:09 2017 @author: lracuna """ #!/usr/bin/env python """ This program uses a simple implementation of the ADMM algorithm to solve the circle packing problem. We solve minimize 1 subject to |x_i - x_j| > 2R, R < x_i, y_i < L - R We put a bunch of equal radius balls inside a square. Type --help to see the options of the program. Must create a directory .figs. Guilherme Franca guifranca@gmail.com November 2015 """ import sys, os, optparse import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Rectangle, Circle def nonoverlap(a, i, omega, R): """No overlap constraint. This function receives a 1D array which is the row of a matrix. Each element is a vector. i is which row we are passing. """ nonzeroi = np.nonzero(omega[i])[0] x = a n1, n2 = a[nonzeroi] vec = n1 - n2 norm = np.linalg.norm(vec) if norm < 2*R: # push the balls appart disp = R - norm/2 x[nonzeroi] = n1 + (disp/norm)*vec, n2 - (disp/norm)*vec return x def insidebox(a, i, omega, R, L): """Keep the balls inside the box.""" j = np.nonzero(omega[i])[0][0] x = a n = a[j] if n[0] < R: x[j,0] = R elif n[0] > L-R: x[j,0] = L-R if n[1] < R: x[j,1] = R elif n[1] > L-R: x[j,1] = L-R return x def make_graph(t, z, imgpath, R, L): """Create a plot of a given time. z contains a list of vectors with the position of the center of each ball. t is the iteration time. """ fig = plt.figure() ax = fig.add_subplot(1, 1, 1) fig.suptitle('t=%i' % t) ax.add_patch(Rectangle((0,0), L, L, fill=False, linestyle='solid', linewidth=2, color='blue')) plt.xlim(-0.5, L+0.5) plt.ylim(-0.5, L+0.5) plt.axes().set_aspect('equal') colors = iter(plt.cm.prism_r(np.linspace(0,1,N))) for x in z: c = next(colors) ax.add_patch(Circle(x, radius=R, color=c, alpha=.6)) plt.axis('off') fig.tight_layout() fig.savefig(imgpath % t, format='png') print imgpath plt.close(fig) def make_omega(N): """Topology matrix Columns label variables, and rows the functions. You must order all the "nonoverlap" functions first and the "inside box" function last. We also create a vectorized version of omega. """ o1 = [] o2 = [] one = np.array([1,1]) zero = np.array([0,0]) # TODO: this is the most expensive way of creating these matrices. # Maybe improve this. for i in range(N): for j in range(i+1, N): row1 = [0]*N row1[i], row1[j] = 1, 1 o1.append(row1) row2 = [zero]*N row2[i], row2[j] = one, one o2.append(row2) for i in range(N): row = [0]*N row[i] = 1 o1.append(row) row2 = [zero]*N row2[i] = one o2.append(row2) o1 = np.array(o1) o2 = np.array(o2) return o1, o2 ############################################################################### if __name__ == '__main__': usg = "%prog -L box -R radius -N balls -M iter [-r rate -o output]" dsc = "Use ADMM optimization algorithm to fit balls into a box." parser = optparse.OptionParser(usage=usg, description=dsc) parser.add_option('-L', '--box_size', action='store', dest='L', type='float', help='size of the box') parser.add_option('-R', '--radius', action='store', dest='R', type='float', help='radius of the balls') parser.add_option('-N', '--num_balls', action='store', dest='N', type='int', help='number of balls') parser.add_option('-M', '--iter', action='store', dest='M', type='int', help='number of iterations') parser.add_option('-r', '--rate', action='store', dest='rate', default=10, type='float', help='frame rate for the movie') parser.add_option('-o', '--output', action='store', dest='out', default='out.mp4', type='str', help='movie output file') parser.add_option('-a', '--alpha', action='store', dest='alpha', default=0.05, type='float', help='alpha parameter') parser.add_option('-p', '--rho', action='store', dest='rho', default=0.5, type='float', help='rho parameter') options, args = parser.parse_args() if not options.L: parser.error("-L option is mandatory") if not options.R: parser.error("-R option is mandatory") if not options.N: parser.error("-N option is mandatory") if not options.M: parser.error("-M option is mandatory") # initialization L = options.L R = options.R N = options.N max_iter = options.M rate = options.rate output = options.out omega, omega_vec = make_omega(N) num_funcs = len(omega) num_vars = len(omega[0]) s = (num_funcs, num_vars, 2) alpha = float(options.alpha) x = np.ones(s)*omega_vec z = np.random.random_sample(size=(num_vars, 2))+\ (L/2.)*np.ones((num_vars, 2)) zz = np.array([z]*num_funcs)*omega_vec u = np.ones(s)*omega_vec n = np.ones(s)*omega_vec rho = float(options.rho)*omega_vec # performing optimization if not os.path.exists('.figs'): os.makedirs('.figs') os.system("rm -rf .figs/*") imgpath = '.figs/fig%04d.png' for k in range(max_iter): n = zz - u # proximal operator for i in range(num_funcs): if i < num_funcs - num_vars: x[i] = nonoverlap(n[i], i, omega, R) else: x[i] = insidebox(n[i], i, omega, R, L) m = x + u z = np.sum(rho*m, axis=0)/np.sum(rho, axis=0) zz = np.array([z]*num_funcs)*omega_vec u = u + alpha*(x-zz) if k == (max_iter-1): make_graph(k, z, imgpath, R, L) print "doing %i/%i" % (k, max_iter) print "Generating animation '%s' ..." % (output) os.system("ffmpeg -y -r %f -sameq -i %s %s > /dev/null 2>&1" % \ (rate, imgpath, output)) #os.system("rm -rf .figs/*") #os.rmdir('.figs') print "Done!" print "Playing ..." os.system("mplayer %s > /dev/null 2>&1" % output)
31.665025
79
0.549471
970
6,428
3.583505
0.293814
0.020713
0.034522
0.009494
0.113349
0.045167
0.015535
0.015535
0.015535
0
0
0.024178
0.285781
6,428
203
80
31.665025
0.732956
0.042159
0
0.086331
0
0.014388
0.14297
0
0
0
0
0.004926
0
0
null
null
0
0.028777
null
null
0.035971
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fbceb552efb8ef0ad3ab8ba19aa7104619c9f206
495
py
Python
Python/CeV/Exercicios/ex71.py
WerickL/Learning
5a9a488f0422454e612439b89093d5bc11242e65
[ "MIT" ]
null
null
null
Python/CeV/Exercicios/ex71.py
WerickL/Learning
5a9a488f0422454e612439b89093d5bc11242e65
[ "MIT" ]
null
null
null
Python/CeV/Exercicios/ex71.py
WerickL/Learning
5a9a488f0422454e612439b89093d5bc11242e65
[ "MIT" ]
null
null
null
Val = int(input('Digite o valor que você quer sacar:')) c50 = c20 = c10 = c1 = 0 if Val // 50 != 0: c50 = Val // 50 Val = Val % 50 if Val // 20 != 0: c20 = Val // 20 Val = Val % 20 if Val // 10 != 0: c10 = Val // 10 Val = Val % 10 if Val // 1 != 0: c1 = Val // 1 if c50 != 0: print(f'{c50} Cédulas de R$50.00') if c20 != 0: print(f'{c20} Cédulas de R$20.00') if c10 != 0: print(f'{c10} Cédulas de R$10.00') if c1 != 0: print(f'{c1} Cédulas de R$1.00')
23.571429
55
0.50303
96
495
2.59375
0.270833
0.080321
0.11245
0
0
0
0
0
0
0
0
0.209913
0.307071
495
21
56
23.571429
0.516035
0
0
0
0
0
0.260081
0
0
0
0
0
0
1
0
false
0
0
0
0
0.190476
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
fbd0e3db5f9cf99e22751e706aab58c1843471e9
801
bzl
Python
model/oppia_proto_library.bzl
bhaktideshmukh/oppia-android
94626909570ddbbd06d2cd691b49f357b986db0f
[ "Apache-2.0" ]
null
null
null
model/oppia_proto_library.bzl
bhaktideshmukh/oppia-android
94626909570ddbbd06d2cd691b49f357b986db0f
[ "Apache-2.0" ]
null
null
null
model/oppia_proto_library.bzl
bhaktideshmukh/oppia-android
94626909570ddbbd06d2cd691b49f357b986db0f
[ "Apache-2.0" ]
null
null
null
""" Bazel macros for defining proto libraries. """ load("@rules_proto//proto:defs.bzl", "proto_library") # TODO(#4096): Remove this once it's no longer needed. def oppia_proto_library(name, **kwargs): """ Defines a new proto library. Note that the library is defined with a stripped import prefix which ensures that protos have a common import directory (which is needed since Gradle builds protos in the same directory whereas Bazel doesn't by default). This common import directory is needed for cross-proto textprotos to work correctly. Args: name: str. The name of the proto library. **kwargs: additional parameters to pass into proto_library. """ proto_library( name = name, strip_import_prefix = "", **kwargs )
30.807692
99
0.689139
110
801
4.945455
0.6
0.132353
0.058824
0
0
0
0
0
0
0
0
0.006504
0.23221
801
25
100
32.04
0.878049
0.684145
0
0
0
0
0.20398
0.139303
0
0
0
0.04
0
1
0.142857
false
0
0.142857
0
0.285714
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
fbd4f1c85388584979a3225e172df289b9b181ba
1,761
py
Python
mods/goofile.py
Natto97/discover
101d5457bad9345598720a49e4323b047030e496
[ "MIT" ]
1
2018-08-11T10:28:00.000Z
2018-08-11T10:28:00.000Z
mods/goofile.py
Natto97/discover
101d5457bad9345598720a49e4323b047030e496
[ "MIT" ]
null
null
null
mods/goofile.py
Natto97/discover
101d5457bad9345598720a49e4323b047030e496
[ "MIT" ]
1
2018-11-02T18:33:00.000Z
2018-11-02T18:33:00.000Z
#!/usr/bin/env python # Goofile v1.5a # by Thomas (G13) Richards # www.g13net.com # Project Page: code.google.com/p/goofile # TheHarvester used for inspiration # A many thanks to the Edge-Security team! # Modified by Lee Baird import getopt import httplib import re import string import sys global result result =[] def usage(): print "\nusage: goofile <options>" print " -d: domain" print " -f: filetype\n" print "example: goofile.py -d target.com -f txt\n\n" sys.exit() def run(domain,file): h = httplib.HTTP('www.google.com') h.putrequest('GET',"/search?num=500&q=site:"+domain+"+filetype:"+file) h.putheader('Host', 'www.google.com') h.putheader('User-agent', 'Internet Explorer 6.0 ') h.putheader('Referrer', 'www.g13net.com') h.endheaders() returncode, returnmsg, headers = h.getreply() data=h.getfile().read() data=re.sub('<b>','',data) for e in ('>','=','<','\\','(',')','"','http',':','//'): data = string.replace(data,e,' ') r1 = re.compile('[-_.a-zA-Z0-9.-_]*'+'\.'+file) res = r1.findall(data) return res def search(argv): global limit limit = 100 if len(sys.argv) < 2: usage() try : opts, args = getopt.getopt(argv,"d:f:") except getopt.GetoptError: usage() sys.exit() for opt,arg in opts : if opt == '-f' : file=arg elif opt == '-d': domain=arg cant = 0 while cant < limit: res = run(domain,file) for x in res: if result.count(x) == 0: result.append(x) cant+=100 if result==[]: print "No results were found." else: for x in result: print x if __name__ == "__main__": try: search(sys.argv[1:]) except KeyboardInterrupt: print "Search interrupted by user." except: sys.exit()
20.717647
71
0.609313
253
1,761
4.201581
0.501976
0.0254
0.022578
0.024459
0
0
0
0
0
0
0
0.019397
0.20954
1,761
84
72
20.964286
0.744253
0.126065
0
0.081967
0
0
0.213072
0.015033
0
0
0
0
0
0
null
null
0
0.081967
null
null
0.114754
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fbdc68b03f388458c541749b935a1b91cef73dc0
155,379
py
Python
automate_online-materials/census2010.py
kruschk/automate-the-boring-stuff
2172fa9d1846b2ba9ead4e86971d72edd54f97b3
[ "MIT" ]
2
2020-01-18T16:01:24.000Z
2020-02-29T19:27:17.000Z
automate_online-materials/census2010.py
kruschk/automate-the-boring-stuff
2172fa9d1846b2ba9ead4e86971d72edd54f97b3
[ "MIT" ]
88
2019-10-31T12:30:02.000Z
2020-08-14T12:17:12.000Z
automate_online-materials/census2010.py
kruschk/automate-the-boring-stuff
2172fa9d1846b2ba9ead4e86971d72edd54f97b3
[ "MIT" ]
4
2020-08-17T16:49:06.000Z
2022-02-14T06:45:29.000Z
allData = {'AK': {'Aleutians East': {'pop': 3141, 'tracts': 1}, 'Aleutians West': {'pop': 5561, 'tracts': 2}, 'Anchorage': {'pop': 291826, 'tracts': 55}, 'Bethel': {'pop': 17013, 'tracts': 3}, 'Bristol Bay': {'pop': 997, 'tracts': 1}, 'Denali': {'pop': 1826, 'tracts': 1}, 'Dillingham': {'pop': 4847, 'tracts': 2}, 'Fairbanks North Star': {'pop': 97581, 'tracts': 19}, 'Haines': {'pop': 2508, 'tracts': 1}, 'Hoonah-Angoon': {'pop': 2150, 'tracts': 2}, 'Juneau': {'pop': 31275, 'tracts': 6}, 'Kenai Peninsula': {'pop': 55400, 'tracts': 13}, 'Ketchikan Gateway': {'pop': 13477, 'tracts': 4}, 'Kodiak Island': {'pop': 13592, 'tracts': 5}, 'Lake and Peninsula': {'pop': 1631, 'tracts': 1}, 'Matanuska-Susitna': {'pop': 88995, 'tracts': 24}, 'Nome': {'pop': 9492, 'tracts': 2}, 'North Slope': {'pop': 9430, 'tracts': 3}, 'Northwest Arctic': {'pop': 7523, 'tracts': 2}, 'Petersburg': {'pop': 3815, 'tracts': 1}, 'Prince of Wales-Hyder': {'pop': 5559, 'tracts': 4}, 'Sitka': {'pop': 8881, 'tracts': 2}, 'Skagway': {'pop': 968, 'tracts': 1}, 'Southeast Fairbanks': {'pop': 7029, 'tracts': 2}, 'Valdez-Cordova': {'pop': 9636, 'tracts': 3}, 'Wade Hampton': {'pop': 7459, 'tracts': 1}, 'Wrangell': {'pop': 2369, 'tracts': 1}, 'Yakutat': {'pop': 662, 'tracts': 1}, 'Yukon-Koyukuk': {'pop': 5588, 'tracts': 4}}, 'AL': {'Autauga': {'pop': 54571, 'tracts': 12}, 'Baldwin': {'pop': 182265, 'tracts': 31}, 'Barbour': {'pop': 27457, 'tracts': 9}, 'Bibb': {'pop': 22915, 'tracts': 4}, 'Blount': {'pop': 57322, 'tracts': 9}, 'Bullock': {'pop': 10914, 'tracts': 3}, 'Butler': {'pop': 20947, 'tracts': 9}, 'Calhoun': {'pop': 118572, 'tracts': 31}, 'Chambers': {'pop': 34215, 'tracts': 9}, 'Cherokee': {'pop': 25989, 'tracts': 6}, 'Chilton': {'pop': 43643, 'tracts': 9}, 'Choctaw': {'pop': 13859, 'tracts': 4}, 'Clarke': {'pop': 25833, 'tracts': 9}, 'Clay': {'pop': 13932, 'tracts': 4}, 'Cleburne': {'pop': 14972, 'tracts': 4}, 'Coffee': {'pop': 49948, 'tracts': 14}, 'Colbert': {'pop': 54428, 'tracts': 14}, 'Conecuh': {'pop': 13228, 'tracts': 5}, 'Coosa': {'pop': 11539, 'tracts': 3}, 'Covington': {'pop': 37765, 'tracts': 14}, 'Crenshaw': {'pop': 13906, 'tracts': 6}, 'Cullman': {'pop': 80406, 'tracts': 18}, 'Dale': {'pop': 50251, 'tracts': 14}, 'Dallas': {'pop': 43820, 'tracts': 15}, 'DeKalb': {'pop': 71109, 'tracts': 14}, 'Elmore': {'pop': 79303, 'tracts': 15}, 'Escambia': {'pop': 38319, 'tracts': 9}, 'Etowah': {'pop': 104430, 'tracts': 30}, 'Fayette': {'pop': 17241, 'tracts': 5}, 'Franklin': {'pop': 31704, 'tracts': 9}, 'Geneva': {'pop': 26790, 'tracts': 6}, 'Greene': {'pop': 9045, 'tracts': 3}, 'Hale': {'pop': 15760, 'tracts': 6}, 'Henry': {'pop': 17302, 'tracts': 6}, 'Houston': {'pop': 101547, 'tracts': 22}, 'Jackson': {'pop': 53227, 'tracts': 11}, 'Jefferson': {'pop': 658466, 'tracts': 163}, 'Lamar': {'pop': 14564, 'tracts': 3}, 'Lauderdale': {'pop': 92709, 'tracts': 22}, 'Lawrence': {'pop': 34339, 'tracts': 9}, 'Lee': {'pop': 140247, 'tracts': 27}, 'Limestone': {'pop': 82782, 'tracts': 16}, 'Lowndes': {'pop': 11299, 'tracts': 4}, 'Macon': {'pop': 21452, 'tracts': 12}, 'Madison': {'pop': 334811, 'tracts': 73}, 'Marengo': {'pop': 21027, 'tracts': 6}, 'Marion': {'pop': 30776, 'tracts': 8}, 'Marshall': {'pop': 93019, 'tracts': 18}, 'Mobile': {'pop': 412992, 'tracts': 114}, 'Monroe': {'pop': 23068, 'tracts': 7}, 'Montgomery': {'pop': 229363, 'tracts': 65}, 'Morgan': {'pop': 119490, 'tracts': 27}, 'Perry': {'pop': 10591, 'tracts': 3}, 'Pickens': {'pop': 19746, 'tracts': 5}, 'Pike': {'pop': 32899, 'tracts': 8}, 'Randolph': {'pop': 22913, 'tracts': 6}, 'Russell': {'pop': 52947, 'tracts': 13}, 'Shelby': {'pop': 195085, 'tracts': 48}, 'St. Clair': {'pop': 83593, 'tracts': 13}, 'Sumter': {'pop': 13763, 'tracts': 4}, 'Talladega': {'pop': 82291, 'tracts': 22}, 'Tallapoosa': {'pop': 41616, 'tracts': 10}, 'Tuscaloosa': {'pop': 194656, 'tracts': 47}, 'Walker': {'pop': 67023, 'tracts': 18}, 'Washington': {'pop': 17581, 'tracts': 5}, 'Wilcox': {'pop': 11670, 'tracts': 4}, 'Winston': {'pop': 24484, 'tracts': 7}}, 'AR': {'Arkansas': {'pop': 19019, 'tracts': 8}, 'Ashley': {'pop': 21853, 'tracts': 7}, 'Baxter': {'pop': 41513, 'tracts': 9}, 'Benton': {'pop': 221339, 'tracts': 49}, 'Boone': {'pop': 36903, 'tracts': 7}, 'Bradley': {'pop': 11508, 'tracts': 5}, 'Calhoun': {'pop': 5368, 'tracts': 2}, 'Carroll': {'pop': 27446, 'tracts': 5}, 'Chicot': {'pop': 11800, 'tracts': 4}, 'Clark': {'pop': 22995, 'tracts': 5}, 'Clay': {'pop': 16083, 'tracts': 6}, 'Cleburne': {'pop': 25970, 'tracts': 7}, 'Cleveland': {'pop': 8689, 'tracts': 2}, 'Columbia': {'pop': 24552, 'tracts': 5}, 'Conway': {'pop': 21273, 'tracts': 6}, 'Craighead': {'pop': 96443, 'tracts': 17}, 'Crawford': {'pop': 61948, 'tracts': 11}, 'Crittenden': {'pop': 50902, 'tracts': 20}, 'Cross': {'pop': 17870, 'tracts': 6}, 'Dallas': {'pop': 8116, 'tracts': 3}, 'Desha': {'pop': 13008, 'tracts': 5}, 'Drew': {'pop': 18509, 'tracts': 5}, 'Faulkner': {'pop': 113237, 'tracts': 25}, 'Franklin': {'pop': 18125, 'tracts': 3}, 'Fulton': {'pop': 12245, 'tracts': 2}, 'Garland': {'pop': 96024, 'tracts': 20}, 'Grant': {'pop': 17853, 'tracts': 4}, 'Greene': {'pop': 42090, 'tracts': 9}, 'Hempstead': {'pop': 22609, 'tracts': 5}, 'Hot Spring': {'pop': 32923, 'tracts': 7}, 'Howard': {'pop': 13789, 'tracts': 3}, 'Independence': {'pop': 36647, 'tracts': 8}, 'Izard': {'pop': 13696, 'tracts': 4}, 'Jackson': {'pop': 17997, 'tracts': 5}, 'Jefferson': {'pop': 77435, 'tracts': 24}, 'Johnson': {'pop': 25540, 'tracts': 6}, 'Lafayette': {'pop': 7645, 'tracts': 2}, 'Lawrence': {'pop': 17415, 'tracts': 6}, 'Lee': {'pop': 10424, 'tracts': 4}, 'Lincoln': {'pop': 14134, 'tracts': 4}, 'Little River': {'pop': 13171, 'tracts': 4}, 'Logan': {'pop': 22353, 'tracts': 6}, 'Lonoke': {'pop': 68356, 'tracts': 16}, 'Madison': {'pop': 15717, 'tracts': 4}, 'Marion': {'pop': 16653, 'tracts': 4}, 'Miller': {'pop': 43462, 'tracts': 12}, 'Mississippi': {'pop': 46480, 'tracts': 12}, 'Monroe': {'pop': 8149, 'tracts': 3}, 'Montgomery': {'pop': 9487, 'tracts': 3}, 'Nevada': {'pop': 8997, 'tracts': 3}, 'Newton': {'pop': 8330, 'tracts': 2}, 'Ouachita': {'pop': 26120, 'tracts': 6}, 'Perry': {'pop': 10445, 'tracts': 3}, 'Phillips': {'pop': 21757, 'tracts': 6}, 'Pike': {'pop': 11291, 'tracts': 3}, 'Poinsett': {'pop': 24583, 'tracts': 7}, 'Polk': {'pop': 20662, 'tracts': 6}, 'Pope': {'pop': 61754, 'tracts': 11}, 'Prairie': {'pop': 8715, 'tracts': 3}, 'Pulaski': {'pop': 382748, 'tracts': 95}, 'Randolph': {'pop': 17969, 'tracts': 4}, 'Saline': {'pop': 107118, 'tracts': 21}, 'Scott': {'pop': 11233, 'tracts': 3}, 'Searcy': {'pop': 8195, 'tracts': 3}, 'Sebastian': {'pop': 125744, 'tracts': 26}, 'Sevier': {'pop': 17058, 'tracts': 4}, 'Sharp': {'pop': 17264, 'tracts': 4}, 'St. Francis': {'pop': 28258, 'tracts': 6}, 'Stone': {'pop': 12394, 'tracts': 3}, 'Union': {'pop': 41639, 'tracts': 10}, 'Van Buren': {'pop': 17295, 'tracts': 5}, 'Washington': {'pop': 203065, 'tracts': 32}, 'White': {'pop': 77076, 'tracts': 13}, 'Woodruff': {'pop': 7260, 'tracts': 2}, 'Yell': {'pop': 22185, 'tracts': 6}}, 'AZ': {'Apache': {'pop': 71518, 'tracts': 16}, 'Cochise': {'pop': 131346, 'tracts': 32}, 'Coconino': {'pop': 134421, 'tracts': 28}, 'Gila': {'pop': 53597, 'tracts': 16}, 'Graham': {'pop': 37220, 'tracts': 9}, 'Greenlee': {'pop': 8437, 'tracts': 3}, 'La Paz': {'pop': 20489, 'tracts': 9}, 'Maricopa': {'pop': 3817117, 'tracts': 916}, 'Mohave': {'pop': 200186, 'tracts': 43}, 'Navajo': {'pop': 107449, 'tracts': 31}, 'Pima': {'pop': 980263, 'tracts': 241}, 'Pinal': {'pop': 375770, 'tracts': 75}, 'Santa Cruz': {'pop': 47420, 'tracts': 10}, 'Yavapai': {'pop': 211033, 'tracts': 42}, 'Yuma': {'pop': 195751, 'tracts': 55}}, 'CA': {'Alameda': {'pop': 1510271, 'tracts': 360}, 'Alpine': {'pop': 1175, 'tracts': 1}, 'Amador': {'pop': 38091, 'tracts': 9}, 'Butte': {'pop': 220000, 'tracts': 51}, 'Calaveras': {'pop': 45578, 'tracts': 10}, 'Colusa': {'pop': 21419, 'tracts': 5}, 'Contra Costa': {'pop': 1049025, 'tracts': 208}, 'Del Norte': {'pop': 28610, 'tracts': 7}, 'El Dorado': {'pop': 181058, 'tracts': 43}, 'Fresno': {'pop': 930450, 'tracts': 199}, 'Glenn': {'pop': 28122, 'tracts': 6}, 'Humboldt': {'pop': 134623, 'tracts': 30}, 'Imperial': {'pop': 174528, 'tracts': 31}, 'Inyo': {'pop': 18546, 'tracts': 6}, 'Kern': {'pop': 839631, 'tracts': 151}, 'Kings': {'pop': 152982, 'tracts': 27}, 'Lake': {'pop': 64665, 'tracts': 15}, 'Lassen': {'pop': 34895, 'tracts': 9}, 'Los Angeles': {'pop': 9818605, 'tracts': 2343}, 'Madera': {'pop': 150865, 'tracts': 23}, 'Marin': {'pop': 252409, 'tracts': 55}, 'Mariposa': {'pop': 18251, 'tracts': 6}, 'Mendocino': {'pop': 87841, 'tracts': 20}, 'Merced': {'pop': 255793, 'tracts': 49}, 'Modoc': {'pop': 9686, 'tracts': 4}, 'Mono': {'pop': 14202, 'tracts': 3}, 'Monterey': {'pop': 415057, 'tracts': 93}, 'Napa': {'pop': 136484, 'tracts': 40}, 'Nevada': {'pop': 98764, 'tracts': 20}, 'Orange': {'pop': 3010232, 'tracts': 583}, 'Placer': {'pop': 348432, 'tracts': 85}, 'Plumas': {'pop': 20007, 'tracts': 7}, 'Riverside': {'pop': 2189641, 'tracts': 453}, 'Sacramento': {'pop': 1418788, 'tracts': 317}, 'San Benito': {'pop': 55269, 'tracts': 11}, 'San Bernardino': {'pop': 2035210, 'tracts': 369}, 'San Diego': {'pop': 3095313, 'tracts': 628}, 'San Francisco': {'pop': 805235, 'tracts': 196}, 'San Joaquin': {'pop': 685306, 'tracts': 139}, 'San Luis Obispo': {'pop': 269637, 'tracts': 53}, 'San Mateo': {'pop': 718451, 'tracts': 158}, 'Santa Barbara': {'pop': 423895, 'tracts': 90}, 'Santa Clara': {'pop': 1781642, 'tracts': 372}, 'Santa Cruz': {'pop': 262382, 'tracts': 52}, 'Shasta': {'pop': 177223, 'tracts': 48}, 'Sierra': {'pop': 3240, 'tracts': 1}, 'Siskiyou': {'pop': 44900, 'tracts': 14}, 'Solano': {'pop': 413344, 'tracts': 96}, 'Sonoma': {'pop': 483878, 'tracts': 99}, 'Stanislaus': {'pop': 514453, 'tracts': 94}, 'Sutter': {'pop': 94737, 'tracts': 21}, 'Tehama': {'pop': 63463, 'tracts': 11}, 'Trinity': {'pop': 13786, 'tracts': 5}, 'Tulare': {'pop': 442179, 'tracts': 78}, 'Tuolumne': {'pop': 55365, 'tracts': 11}, 'Ventura': {'pop': 823318, 'tracts': 174}, 'Yolo': {'pop': 200849, 'tracts': 41}, 'Yuba': {'pop': 72155, 'tracts': 14}}, 'CO': {'Adams': {'pop': 441603, 'tracts': 97}, 'Alamosa': {'pop': 15445, 'tracts': 4}, 'Arapahoe': {'pop': 572003, 'tracts': 147}, 'Archuleta': {'pop': 12084, 'tracts': 4}, 'Baca': {'pop': 3788, 'tracts': 2}, 'Bent': {'pop': 6499, 'tracts': 1}, 'Boulder': {'pop': 294567, 'tracts': 68}, 'Broomfield': {'pop': 55889, 'tracts': 18}, 'Chaffee': {'pop': 17809, 'tracts': 5}, 'Cheyenne': {'pop': 1836, 'tracts': 1}, 'Clear Creek': {'pop': 9088, 'tracts': 3}, 'Conejos': {'pop': 8256, 'tracts': 2}, 'Costilla': {'pop': 3524, 'tracts': 2}, 'Crowley': {'pop': 5823, 'tracts': 1}, 'Custer': {'pop': 4255, 'tracts': 1}, 'Delta': {'pop': 30952, 'tracts': 7}, 'Denver': {'pop': 600158, 'tracts': 144}, 'Dolores': {'pop': 2064, 'tracts': 1}, 'Douglas': {'pop': 285465, 'tracts': 61}, 'Eagle': {'pop': 52197, 'tracts': 14}, 'El Paso': {'pop': 622263, 'tracts': 130}, 'Elbert': {'pop': 23086, 'tracts': 7}, 'Fremont': {'pop': 46824, 'tracts': 14}, 'Garfield': {'pop': 56389, 'tracts': 11}, 'Gilpin': {'pop': 5441, 'tracts': 1}, 'Grand': {'pop': 14843, 'tracts': 3}, 'Gunnison': {'pop': 15324, 'tracts': 4}, 'Hinsdale': {'pop': 843, 'tracts': 1}, 'Huerfano': {'pop': 6711, 'tracts': 2}, 'Jackson': {'pop': 1394, 'tracts': 1}, 'Jefferson': {'pop': 534543, 'tracts': 138}, 'Kiowa': {'pop': 1398, 'tracts': 1}, 'Kit Carson': {'pop': 8270, 'tracts': 3}, 'La Plata': {'pop': 51334, 'tracts': 10}, 'Lake': {'pop': 7310, 'tracts': 2}, 'Larimer': {'pop': 299630, 'tracts': 73}, 'Las Animas': {'pop': 15507, 'tracts': 6}, 'Lincoln': {'pop': 5467, 'tracts': 2}, 'Logan': {'pop': 22709, 'tracts': 6}, 'Mesa': {'pop': 146723, 'tracts': 29}, 'Mineral': {'pop': 712, 'tracts': 1}, 'Moffat': {'pop': 13795, 'tracts': 4}, 'Montezuma': {'pop': 25535, 'tracts': 7}, 'Montrose': {'pop': 41276, 'tracts': 10}, 'Morgan': {'pop': 28159, 'tracts': 8}, 'Otero': {'pop': 18831, 'tracts': 7}, 'Ouray': {'pop': 4436, 'tracts': 1}, 'Park': {'pop': 16206, 'tracts': 5}, 'Phillips': {'pop': 4442, 'tracts': 2}, 'Pitkin': {'pop': 17148, 'tracts': 4}, 'Prowers': {'pop': 12551, 'tracts': 5}, 'Pueblo': {'pop': 159063, 'tracts': 55}, 'Rio Blanco': {'pop': 6666, 'tracts': 2}, 'Rio Grande': {'pop': 11982, 'tracts': 3}, 'Routt': {'pop': 23509, 'tracts': 8}, 'Saguache': {'pop': 6108, 'tracts': 2}, 'San Juan': {'pop': 699, 'tracts': 1}, 'San Miguel': {'pop': 7359, 'tracts': 4}, 'Sedgwick': {'pop': 2379, 'tracts': 1}, 'Summit': {'pop': 27994, 'tracts': 5}, 'Teller': {'pop': 23350, 'tracts': 6}, 'Washington': {'pop': 4814, 'tracts': 2}, 'Weld': {'pop': 252825, 'tracts': 77}, 'Yuma': {'pop': 10043, 'tracts': 2}}, 'CT': {'Fairfield': {'pop': 916829, 'tracts': 211}, 'Hartford': {'pop': 894014, 'tracts': 224}, 'Litchfield': {'pop': 189927, 'tracts': 51}, 'Middlesex': {'pop': 165676, 'tracts': 36}, 'New Haven': {'pop': 862477, 'tracts': 190}, 'New London': {'pop': 274055, 'tracts': 66}, 'Tolland': {'pop': 152691, 'tracts': 29}, 'Windham': {'pop': 118428, 'tracts': 25}}, 'DC': {'District of Columbia': {'pop': 601723, 'tracts': 179}}, 'DE': {'Kent': {'pop': 162310, 'tracts': 33}, 'New Castle': {'pop': 538479, 'tracts': 131}, 'Sussex': {'pop': 197145, 'tracts': 54}}, 'FL': {'Alachua': {'pop': 247336, 'tracts': 56}, 'Baker': {'pop': 27115, 'tracts': 4}, 'Bay': {'pop': 168852, 'tracts': 44}, 'Bradford': {'pop': 28520, 'tracts': 4}, 'Brevard': {'pop': 543376, 'tracts': 113}, 'Broward': {'pop': 1748066, 'tracts': 361}, 'Calhoun': {'pop': 14625, 'tracts': 3}, 'Charlotte': {'pop': 159978, 'tracts': 39}, 'Citrus': {'pop': 141236, 'tracts': 27}, 'Clay': {'pop': 190865, 'tracts': 30}, 'Collier': {'pop': 321520, 'tracts': 73}, 'Columbia': {'pop': 67531, 'tracts': 12}, 'DeSoto': {'pop': 34862, 'tracts': 9}, 'Dixie': {'pop': 16422, 'tracts': 3}, 'Duval': {'pop': 864263, 'tracts': 173}, 'Escambia': {'pop': 297619, 'tracts': 71}, 'Flagler': {'pop': 95696, 'tracts': 20}, 'Franklin': {'pop': 11549, 'tracts': 4}, 'Gadsden': {'pop': 46389, 'tracts': 9}, 'Gilchrist': {'pop': 16939, 'tracts': 5}, 'Glades': {'pop': 12884, 'tracts': 4}, 'Gulf': {'pop': 15863, 'tracts': 3}, 'Hamilton': {'pop': 14799, 'tracts': 3}, 'Hardee': {'pop': 27731, 'tracts': 6}, 'Hendry': {'pop': 39140, 'tracts': 7}, 'Hernando': {'pop': 172778, 'tracts': 45}, 'Highlands': {'pop': 98786, 'tracts': 27}, 'Hillsborough': {'pop': 1229226, 'tracts': 321}, 'Holmes': {'pop': 19927, 'tracts': 4}, 'Indian River': {'pop': 138028, 'tracts': 30}, 'Jackson': {'pop': 49746, 'tracts': 11}, 'Jefferson': {'pop': 14761, 'tracts': 3}, 'Lafayette': {'pop': 8870, 'tracts': 2}, 'Lake': {'pop': 297052, 'tracts': 56}, 'Lee': {'pop': 618754, 'tracts': 166}, 'Leon': {'pop': 275487, 'tracts': 68}, 'Levy': {'pop': 40801, 'tracts': 9}, 'Liberty': {'pop': 8365, 'tracts': 2}, 'Madison': {'pop': 19224, 'tracts': 5}, 'Manatee': {'pop': 322833, 'tracts': 78}, 'Marion': {'pop': 331298, 'tracts': 63}, 'Martin': {'pop': 146318, 'tracts': 35}, 'Miami-Dade': {'pop': 2496435, 'tracts': 519}, 'Monroe': {'pop': 73090, 'tracts': 30}, 'Nassau': {'pop': 73314, 'tracts': 12}, 'Okaloosa': {'pop': 180822, 'tracts': 41}, 'Okeechobee': {'pop': 39996, 'tracts': 12}, 'Orange': {'pop': 1145956, 'tracts': 207}, 'Osceola': {'pop': 268685, 'tracts': 41}, 'Palm Beach': {'pop': 1320134, 'tracts': 337}, 'Pasco': {'pop': 464697, 'tracts': 134}, 'Pinellas': {'pop': 916542, 'tracts': 245}, 'Polk': {'pop': 602095, 'tracts': 154}, 'Putnam': {'pop': 74364, 'tracts': 17}, 'Santa Rosa': {'pop': 151372, 'tracts': 25}, 'Sarasota': {'pop': 379448, 'tracts': 94}, 'Seminole': {'pop': 422718, 'tracts': 86}, 'St. Johns': {'pop': 190039, 'tracts': 40}, 'St. Lucie': {'pop': 277789, 'tracts': 44}, 'Sumter': {'pop': 93420, 'tracts': 19}, 'Suwannee': {'pop': 41551, 'tracts': 7}, 'Taylor': {'pop': 22570, 'tracts': 4}, 'Union': {'pop': 15535, 'tracts': 3}, 'Volusia': {'pop': 494593, 'tracts': 113}, 'Wakulla': {'pop': 30776, 'tracts': 4}, 'Walton': {'pop': 55043, 'tracts': 11}, 'Washington': {'pop': 24896, 'tracts': 7}}, 'GA': {'Appling': {'pop': 18236, 'tracts': 5}, 'Atkinson': {'pop': 8375, 'tracts': 3}, 'Bacon': {'pop': 11096, 'tracts': 3}, 'Baker': {'pop': 3451, 'tracts': 2}, 'Baldwin': {'pop': 45720, 'tracts': 9}, 'Banks': {'pop': 18395, 'tracts': 4}, 'Barrow': {'pop': 69367, 'tracts': 18}, 'Bartow': {'pop': 100157, 'tracts': 15}, 'Ben Hill': {'pop': 17634, 'tracts': 5}, 'Berrien': {'pop': 19286, 'tracts': 6}, 'Bibb': {'pop': 155547, 'tracts': 44}, 'Bleckley': {'pop': 13063, 'tracts': 3}, 'Brantley': {'pop': 18411, 'tracts': 3}, 'Brooks': {'pop': 16243, 'tracts': 5}, 'Bryan': {'pop': 30233, 'tracts': 7}, 'Bulloch': {'pop': 70217, 'tracts': 12}, 'Burke': {'pop': 23316, 'tracts': 6}, 'Butts': {'pop': 23655, 'tracts': 3}, 'Calhoun': {'pop': 6694, 'tracts': 2}, 'Camden': {'pop': 50513, 'tracts': 10}, 'Candler': {'pop': 10998, 'tracts': 3}, 'Carroll': {'pop': 110527, 'tracts': 17}, 'Catoosa': {'pop': 63942, 'tracts': 11}, 'Charlton': {'pop': 12171, 'tracts': 2}, 'Chatham': {'pop': 265128, 'tracts': 72}, 'Chattahoochee': {'pop': 11267, 'tracts': 5}, 'Chattooga': {'pop': 26015, 'tracts': 6}, 'Cherokee': {'pop': 214346, 'tracts': 26}, 'Clarke': {'pop': 116714, 'tracts': 30}, 'Clay': {'pop': 3183, 'tracts': 1}, 'Clayton': {'pop': 259424, 'tracts': 50}, 'Clinch': {'pop': 6798, 'tracts': 2}, 'Cobb': {'pop': 688078, 'tracts': 120}, 'Coffee': {'pop': 42356, 'tracts': 9}, 'Colquitt': {'pop': 45498, 'tracts': 10}, 'Columbia': {'pop': 124053, 'tracts': 20}, 'Cook': {'pop': 17212, 'tracts': 4}, 'Coweta': {'pop': 127317, 'tracts': 20}, 'Crawford': {'pop': 12630, 'tracts': 3}, 'Crisp': {'pop': 23439, 'tracts': 6}, 'Dade': {'pop': 16633, 'tracts': 4}, 'Dawson': {'pop': 22330, 'tracts': 3}, 'DeKalb': {'pop': 691893, 'tracts': 145}, 'Decatur': {'pop': 27842, 'tracts': 7}, 'Dodge': {'pop': 21796, 'tracts': 6}, 'Dooly': {'pop': 14918, 'tracts': 3}, 'Dougherty': {'pop': 94565, 'tracts': 27}, 'Douglas': {'pop': 132403, 'tracts': 20}, 'Early': {'pop': 11008, 'tracts': 5}, 'Echols': {'pop': 4034, 'tracts': 2}, 'Effingham': {'pop': 52250, 'tracts': 10}, 'Elbert': {'pop': 20166, 'tracts': 5}, 'Emanuel': {'pop': 22598, 'tracts': 6}, 'Evans': {'pop': 11000, 'tracts': 3}, 'Fannin': {'pop': 23682, 'tracts': 5}, 'Fayette': {'pop': 106567, 'tracts': 20}, 'Floyd': {'pop': 96317, 'tracts': 20}, 'Forsyth': {'pop': 175511, 'tracts': 45}, 'Franklin': {'pop': 22084, 'tracts': 5}, 'Fulton': {'pop': 920581, 'tracts': 204}, 'Gilmer': {'pop': 28292, 'tracts': 5}, 'Glascock': {'pop': 3082, 'tracts': 1}, 'Glynn': {'pop': 79626, 'tracts': 15}, 'Gordon': {'pop': 55186, 'tracts': 9}, 'Grady': {'pop': 25011, 'tracts': 6}, 'Greene': {'pop': 15994, 'tracts': 7}, 'Gwinnett': {'pop': 805321, 'tracts': 113}, 'Habersham': {'pop': 43041, 'tracts': 8}, 'Hall': {'pop': 179684, 'tracts': 36}, 'Hancock': {'pop': 9429, 'tracts': 2}, 'Haralson': {'pop': 28780, 'tracts': 5}, 'Harris': {'pop': 32024, 'tracts': 5}, 'Hart': {'pop': 25213, 'tracts': 5}, 'Heard': {'pop': 11834, 'tracts': 3}, 'Henry': {'pop': 203922, 'tracts': 25}, 'Houston': {'pop': 139900, 'tracts': 23}, 'Irwin': {'pop': 9538, 'tracts': 2}, 'Jackson': {'pop': 60485, 'tracts': 11}, 'Jasper': {'pop': 13900, 'tracts': 3}, 'Jeff Davis': {'pop': 15068, 'tracts': 3}, 'Jefferson': {'pop': 16930, 'tracts': 4}, 'Jenkins': {'pop': 8340, 'tracts': 2}, 'Johnson': {'pop': 9980, 'tracts': 3}, 'Jones': {'pop': 28669, 'tracts': 6}, 'Lamar': {'pop': 18317, 'tracts': 3}, 'Lanier': {'pop': 10078, 'tracts': 2}, 'Laurens': {'pop': 48434, 'tracts': 13}, 'Lee': {'pop': 28298, 'tracts': 5}, 'Liberty': {'pop': 63453, 'tracts': 14}, 'Lincoln': {'pop': 7996, 'tracts': 2}, 'Long': {'pop': 14464, 'tracts': 3}, 'Lowndes': {'pop': 109233, 'tracts': 25}, 'Lumpkin': {'pop': 29966, 'tracts': 4}, 'Macon': {'pop': 14740, 'tracts': 4}, 'Madison': {'pop': 28120, 'tracts': 6}, 'Marion': {'pop': 8742, 'tracts': 2}, 'McDuffie': {'pop': 21875, 'tracts': 5}, 'McIntosh': {'pop': 14333, 'tracts': 4}, 'Meriwether': {'pop': 21992, 'tracts': 4}, 'Miller': {'pop': 6125, 'tracts': 3}, 'Mitchell': {'pop': 23498, 'tracts': 5}, 'Monroe': {'pop': 26424, 'tracts': 5}, 'Montgomery': {'pop': 9123, 'tracts': 3}, 'Morgan': {'pop': 17868, 'tracts': 5}, 'Murray': {'pop': 39628, 'tracts': 8}, 'Muscogee': {'pop': 189885, 'tracts': 53}, 'Newton': {'pop': 99958, 'tracts': 13}, 'Oconee': {'pop': 32808, 'tracts': 6}, 'Oglethorpe': {'pop': 14899, 'tracts': 4}, 'Paulding': {'pop': 142324, 'tracts': 19}, 'Peach': {'pop': 27695, 'tracts': 6}, 'Pickens': {'pop': 29431, 'tracts': 6}, 'Pierce': {'pop': 18758, 'tracts': 4}, 'Pike': {'pop': 17869, 'tracts': 4}, 'Polk': {'pop': 41475, 'tracts': 7}, 'Pulaski': {'pop': 12010, 'tracts': 3}, 'Putnam': {'pop': 21218, 'tracts': 5}, 'Quitman': {'pop': 2513, 'tracts': 1}, 'Rabun': {'pop': 16276, 'tracts': 5}, 'Randolph': {'pop': 7719, 'tracts': 2}, 'Richmond': {'pop': 200549, 'tracts': 47}, 'Rockdale': {'pop': 85215, 'tracts': 15}, 'Schley': {'pop': 5010, 'tracts': 2}, 'Screven': {'pop': 14593, 'tracts': 5}, 'Seminole': {'pop': 8729, 'tracts': 3}, 'Spalding': {'pop': 64073, 'tracts': 12}, 'Stephens': {'pop': 26175, 'tracts': 5}, 'Stewart': {'pop': 6058, 'tracts': 2}, 'Sumter': {'pop': 32819, 'tracts': 8}, 'Talbot': {'pop': 6865, 'tracts': 3}, 'Taliaferro': {'pop': 1717, 'tracts': 1}, 'Tattnall': {'pop': 25520, 'tracts': 5}, 'Taylor': {'pop': 8906, 'tracts': 3}, 'Telfair': {'pop': 16500, 'tracts': 3}, 'Terrell': {'pop': 9315, 'tracts': 4}, 'Thomas': {'pop': 44720, 'tracts': 11}, 'Tift': {'pop': 40118, 'tracts': 9}, 'Toombs': {'pop': 27223, 'tracts': 6}, 'Towns': {'pop': 10471, 'tracts': 3}, 'Treutlen': {'pop': 6885, 'tracts': 2}, 'Troup': {'pop': 67044, 'tracts': 14}, 'Turner': {'pop': 8930, 'tracts': 2}, 'Twiggs': {'pop': 9023, 'tracts': 2}, 'Union': {'pop': 21356, 'tracts': 6}, 'Upson': {'pop': 27153, 'tracts': 7}, 'Walker': {'pop': 68756, 'tracts': 13}, 'Walton': {'pop': 83768, 'tracts': 15}, 'Ware': {'pop': 36312, 'tracts': 9}, 'Warren': {'pop': 5834, 'tracts': 2}, 'Washington': {'pop': 21187, 'tracts': 5}, 'Wayne': {'pop': 30099, 'tracts': 6}, 'Webster': {'pop': 2799, 'tracts': 2}, 'Wheeler': {'pop': 7421, 'tracts': 2}, 'White': {'pop': 27144, 'tracts': 5}, 'Whitfield': {'pop': 102599, 'tracts': 18}, 'Wilcox': {'pop': 9255, 'tracts': 4}, 'Wilkes': {'pop': 10593, 'tracts': 4}, 'Wilkinson': {'pop': 9563, 'tracts': 3}, 'Worth': {'pop': 21679, 'tracts': 5}}, 'HI': {'Hawaii': {'pop': 185079, 'tracts': 34}, 'Honolulu': {'pop': 953207, 'tracts': 244}, 'Kalawao': {'pop': 90, 'tracts': 1}, 'Kauai': {'pop': 67091, 'tracts': 16}, 'Maui': {'pop': 154834, 'tracts': 37}}, 'IA': {'Adair': {'pop': 7682, 'tracts': 3}, 'Adams': {'pop': 4029, 'tracts': 2}, 'Allamakee': {'pop': 14330, 'tracts': 5}, 'Appanoose': {'pop': 12887, 'tracts': 5}, 'Audubon': {'pop': 6119, 'tracts': 3}, 'Benton': {'pop': 26076, 'tracts': 7}, 'Black Hawk': {'pop': 131090, 'tracts': 38}, 'Boone': {'pop': 26306, 'tracts': 7}, 'Bremer': {'pop': 24276, 'tracts': 8}, 'Buchanan': {'pop': 20958, 'tracts': 6}, 'Buena Vista': {'pop': 20260, 'tracts': 6}, 'Butler': {'pop': 14867, 'tracts': 5}, 'Calhoun': {'pop': 9670, 'tracts': 4}, 'Carroll': {'pop': 20816, 'tracts': 6}, 'Cass': {'pop': 13956, 'tracts': 5}, 'Cedar': {'pop': 18499, 'tracts': 5}, 'Cerro Gordo': {'pop': 44151, 'tracts': 11}, 'Cherokee': {'pop': 12072, 'tracts': 4}, 'Chickasaw': {'pop': 12439, 'tracts': 4}, 'Clarke': {'pop': 9286, 'tracts': 3}, 'Clay': {'pop': 16667, 'tracts': 4}, 'Clayton': {'pop': 18129, 'tracts': 6}, 'Clinton': {'pop': 49116, 'tracts': 12}, 'Crawford': {'pop': 17096, 'tracts': 5}, 'Dallas': {'pop': 66135, 'tracts': 15}, 'Davis': {'pop': 8753, 'tracts': 2}, 'Decatur': {'pop': 8457, 'tracts': 3}, 'Delaware': {'pop': 17764, 'tracts': 4}, 'Des Moines': {'pop': 40325, 'tracts': 11}, 'Dickinson': {'pop': 16667, 'tracts': 5}, 'Dubuque': {'pop': 93653, 'tracts': 26}, 'Emmet': {'pop': 10302, 'tracts': 4}, 'Fayette': {'pop': 20880, 'tracts': 7}, 'Floyd': {'pop': 16303, 'tracts': 5}, 'Franklin': {'pop': 10680, 'tracts': 3}, 'Fremont': {'pop': 7441, 'tracts': 3}, 'Greene': {'pop': 9336, 'tracts': 4}, 'Grundy': {'pop': 12453, 'tracts': 4}, 'Guthrie': {'pop': 10954, 'tracts': 3}, 'Hamilton': {'pop': 15673, 'tracts': 5}, 'Hancock': {'pop': 11341, 'tracts': 4}, 'Hardin': {'pop': 17534, 'tracts': 6}, 'Harrison': {'pop': 14928, 'tracts': 5}, 'Henry': {'pop': 20145, 'tracts': 5}, 'Howard': {'pop': 9566, 'tracts': 3}, 'Humboldt': {'pop': 9815, 'tracts': 4}, 'Ida': {'pop': 7089, 'tracts': 3}, 'Iowa': {'pop': 16355, 'tracts': 4}, 'Jackson': {'pop': 19848, 'tracts': 6}, 'Jasper': {'pop': 36842, 'tracts': 9}, 'Jefferson': {'pop': 16843, 'tracts': 4}, 'Johnson': {'pop': 130882, 'tracts': 24}, 'Jones': {'pop': 20638, 'tracts': 5}, 'Keokuk': {'pop': 10511, 'tracts': 4}, 'Kossuth': {'pop': 15543, 'tracts': 6}, 'Lee': {'pop': 35862, 'tracts': 11}, 'Linn': {'pop': 211226, 'tracts': 45}, 'Louisa': {'pop': 11387, 'tracts': 3}, 'Lucas': {'pop': 8898, 'tracts': 4}, 'Lyon': {'pop': 11581, 'tracts': 3}, 'Madison': {'pop': 15679, 'tracts': 3}, 'Mahaska': {'pop': 22381, 'tracts': 7}, 'Marion': {'pop': 33309, 'tracts': 8}, 'Marshall': {'pop': 40648, 'tracts': 10}, 'Mills': {'pop': 15059, 'tracts': 5}, 'Mitchell': {'pop': 10776, 'tracts': 3}, 'Monona': {'pop': 9243, 'tracts': 4}, 'Monroe': {'pop': 7970, 'tracts': 3}, 'Montgomery': {'pop': 10740, 'tracts': 4}, 'Muscatine': {'pop': 42745, 'tracts': 10}, "O'Brien": {'pop': 14398, 'tracts': 4}, 'Osceola': {'pop': 6462, 'tracts': 2}, 'Page': {'pop': 15932, 'tracts': 6}, 'Palo Alto': {'pop': 9421, 'tracts': 4}, 'Plymouth': {'pop': 24986, 'tracts': 6}, 'Pocahontas': {'pop': 7310, 'tracts': 3}, 'Polk': {'pop': 430640, 'tracts': 98}, 'Pottawattamie': {'pop': 93158, 'tracts': 30}, 'Poweshiek': {'pop': 18914, 'tracts': 5}, 'Ringgold': {'pop': 5131, 'tracts': 2}, 'Sac': {'pop': 10350, 'tracts': 4}, 'Scott': {'pop': 165224, 'tracts': 47}, 'Shelby': {'pop': 12167, 'tracts': 4}, 'Sioux': {'pop': 33704, 'tracts': 7}, 'Story': {'pop': 89542, 'tracts': 20}, 'Tama': {'pop': 17767, 'tracts': 6}, 'Taylor': {'pop': 6317, 'tracts': 3}, 'Union': {'pop': 12534, 'tracts': 4}, 'Van Buren': {'pop': 7570, 'tracts': 2}, 'Wapello': {'pop': 35625, 'tracts': 11}, 'Warren': {'pop': 46225, 'tracts': 12}, 'Washington': {'pop': 21704, 'tracts': 5}, 'Wayne': {'pop': 6403, 'tracts': 3}, 'Webster': {'pop': 38013, 'tracts': 12}, 'Winnebago': {'pop': 10866, 'tracts': 3}, 'Winneshiek': {'pop': 21056, 'tracts': 5}, 'Woodbury': {'pop': 102172, 'tracts': 26}, 'Worth': {'pop': 7598, 'tracts': 3}, 'Wright': {'pop': 13229, 'tracts': 5}}, 'ID': {'Ada': {'pop': 392365, 'tracts': 59}, 'Adams': {'pop': 3976, 'tracts': 2}, 'Bannock': {'pop': 82839, 'tracts': 22}, 'Bear Lake': {'pop': 5986, 'tracts': 2}, 'Benewah': {'pop': 9285, 'tracts': 2}, 'Bingham': {'pop': 45607, 'tracts': 8}, 'Blaine': {'pop': 21376, 'tracts': 4}, 'Boise': {'pop': 7028, 'tracts': 1}, 'Bonner': {'pop': 40877, 'tracts': 9}, 'Bonneville': {'pop': 104234, 'tracts': 21}, 'Boundary': {'pop': 10972, 'tracts': 2}, 'Butte': {'pop': 2891, 'tracts': 1}, 'Camas': {'pop': 1117, 'tracts': 1}, 'Canyon': {'pop': 188923, 'tracts': 29}, 'Caribou': {'pop': 6963, 'tracts': 2}, 'Cassia': {'pop': 22952, 'tracts': 6}, 'Clark': {'pop': 982, 'tracts': 1}, 'Clearwater': {'pop': 8761, 'tracts': 2}, 'Custer': {'pop': 4368, 'tracts': 1}, 'Elmore': {'pop': 27038, 'tracts': 5}, 'Franklin': {'pop': 12786, 'tracts': 2}, 'Fremont': {'pop': 13242, 'tracts': 3}, 'Gem': {'pop': 16719, 'tracts': 3}, 'Gooding': {'pop': 15464, 'tracts': 2}, 'Idaho': {'pop': 16267, 'tracts': 5}, 'Jefferson': {'pop': 26140, 'tracts': 4}, 'Jerome': {'pop': 22374, 'tracts': 5}, 'Kootenai': {'pop': 138494, 'tracts': 25}, 'Latah': {'pop': 37244, 'tracts': 7}, 'Lemhi': {'pop': 7936, 'tracts': 3}, 'Lewis': {'pop': 3821, 'tracts': 3}, 'Lincoln': {'pop': 5208, 'tracts': 1}, 'Madison': {'pop': 37536, 'tracts': 6}, 'Minidoka': {'pop': 20069, 'tracts': 5}, 'Nez Perce': {'pop': 39265, 'tracts': 10}, 'Oneida': {'pop': 4286, 'tracts': 1}, 'Owyhee': {'pop': 11526, 'tracts': 3}, 'Payette': {'pop': 22623, 'tracts': 4}, 'Power': {'pop': 7817, 'tracts': 2}, 'Shoshone': {'pop': 12765, 'tracts': 3}, 'Teton': {'pop': 10170, 'tracts': 1}, 'Twin Falls': {'pop': 77230, 'tracts': 14}, 'Valley': {'pop': 9862, 'tracts': 3}, 'Washington': {'pop': 10198, 'tracts': 3}}, 'IL': {'Adams': {'pop': 67103, 'tracts': 18}, 'Alexander': {'pop': 8238, 'tracts': 4}, 'Bond': {'pop': 17768, 'tracts': 4}, 'Boone': {'pop': 54165, 'tracts': 7}, 'Brown': {'pop': 6937, 'tracts': 2}, 'Bureau': {'pop': 34978, 'tracts': 10}, 'Calhoun': {'pop': 5089, 'tracts': 2}, 'Carroll': {'pop': 15387, 'tracts': 6}, 'Cass': {'pop': 13642, 'tracts': 5}, 'Champaign': {'pop': 201081, 'tracts': 43}, 'Christian': {'pop': 34800, 'tracts': 10}, 'Clark': {'pop': 16335, 'tracts': 4}, 'Clay': {'pop': 13815, 'tracts': 4}, 'Clinton': {'pop': 37762, 'tracts': 8}, 'Coles': {'pop': 53873, 'tracts': 12}, 'Cook': {'pop': 5194675, 'tracts': 1318}, 'Crawford': {'pop': 19817, 'tracts': 6}, 'Cumberland': {'pop': 11048, 'tracts': 3}, 'De Witt': {'pop': 16561, 'tracts': 5}, 'DeKalb': {'pop': 105160, 'tracts': 21}, 'Douglas': {'pop': 19980, 'tracts': 5}, 'DuPage': {'pop': 916924, 'tracts': 216}, 'Edgar': {'pop': 18576, 'tracts': 5}, 'Edwards': {'pop': 6721, 'tracts': 3}, 'Effingham': {'pop': 34242, 'tracts': 8}, 'Fayette': {'pop': 22140, 'tracts': 7}, 'Ford': {'pop': 14081, 'tracts': 5}, 'Franklin': {'pop': 39561, 'tracts': 12}, 'Fulton': {'pop': 37069, 'tracts': 12}, 'Gallatin': {'pop': 5589, 'tracts': 2}, 'Greene': {'pop': 13886, 'tracts': 5}, 'Grundy': {'pop': 50063, 'tracts': 10}, 'Hamilton': {'pop': 8457, 'tracts': 3}, 'Hancock': {'pop': 19104, 'tracts': 7}, 'Hardin': {'pop': 4320, 'tracts': 2}, 'Henderson': {'pop': 7331, 'tracts': 3}, 'Henry': {'pop': 50486, 'tracts': 13}, 'Iroquois': {'pop': 29718, 'tracts': 9}, 'Jackson': {'pop': 60218, 'tracts': 14}, 'Jasper': {'pop': 9698, 'tracts': 3}, 'Jefferson': {'pop': 38827, 'tracts': 11}, 'Jersey': {'pop': 22985, 'tracts': 6}, 'Jo Daviess': {'pop': 22678, 'tracts': 6}, 'Johnson': {'pop': 12582, 'tracts': 4}, 'Kane': {'pop': 515269, 'tracts': 82}, 'Kankakee': {'pop': 113449, 'tracts': 29}, 'Kendall': {'pop': 114736, 'tracts': 10}, 'Knox': {'pop': 52919, 'tracts': 16}, 'La Salle': {'pop': 113924, 'tracts': 28}, 'Lake': {'pop': 703462, 'tracts': 153}, 'Lawrence': {'pop': 16833, 'tracts': 5}, 'Lee': {'pop': 36031, 'tracts': 9}, 'Livingston': {'pop': 38950, 'tracts': 10}, 'Logan': {'pop': 30305, 'tracts': 8}, 'Macon': {'pop': 110768, 'tracts': 34}, 'Macoupin': {'pop': 47765, 'tracts': 13}, 'Madison': {'pop': 269282, 'tracts': 61}, 'Marion': {'pop': 39437, 'tracts': 12}, 'Marshall': {'pop': 12640, 'tracts': 5}, 'Mason': {'pop': 14666, 'tracts': 6}, 'Massac': {'pop': 15429, 'tracts': 4}, 'McDonough': {'pop': 32612, 'tracts': 10}, 'McHenry': {'pop': 308760, 'tracts': 52}, 'McLean': {'pop': 169572, 'tracts': 41}, 'Menard': {'pop': 12705, 'tracts': 3}, 'Mercer': {'pop': 16434, 'tracts': 4}, 'Monroe': {'pop': 32957, 'tracts': 6}, 'Montgomery': {'pop': 30104, 'tracts': 8}, 'Morgan': {'pop': 35547, 'tracts': 10}, 'Moultrie': {'pop': 14846, 'tracts': 4}, 'Ogle': {'pop': 53497, 'tracts': 11}, 'Peoria': {'pop': 186494, 'tracts': 48}, 'Perry': {'pop': 22350, 'tracts': 6}, 'Piatt': {'pop': 16729, 'tracts': 4}, 'Pike': {'pop': 16430, 'tracts': 5}, 'Pope': {'pop': 4470, 'tracts': 2}, 'Pulaski': {'pop': 6161, 'tracts': 2}, 'Putnam': {'pop': 6006, 'tracts': 2}, 'Randolph': {'pop': 33476, 'tracts': 9}, 'Richland': {'pop': 16233, 'tracts': 5}, 'Rock Island': {'pop': 147546, 'tracts': 40}, 'Saline': {'pop': 24913, 'tracts': 9}, 'Sangamon': {'pop': 197465, 'tracts': 53}, 'Schuyler': {'pop': 7544, 'tracts': 3}, 'Scott': {'pop': 5355, 'tracts': 2}, 'Shelby': {'pop': 22363, 'tracts': 6}, 'St. Clair': {'pop': 270056, 'tracts': 60}, 'Stark': {'pop': 5994, 'tracts': 2}, 'Stephenson': {'pop': 47711, 'tracts': 13}, 'Tazewell': {'pop': 135394, 'tracts': 30}, 'Union': {'pop': 17808, 'tracts': 5}, 'Vermilion': {'pop': 81625, 'tracts': 24}, 'Wabash': {'pop': 11947, 'tracts': 4}, 'Warren': {'pop': 17707, 'tracts': 5}, 'Washington': {'pop': 14716, 'tracts': 4}, 'Wayne': {'pop': 16760, 'tracts': 5}, 'White': {'pop': 14665, 'tracts': 5}, 'Whiteside': {'pop': 58498, 'tracts': 18}, 'Will': {'pop': 677560, 'tracts': 152}, 'Williamson': {'pop': 66357, 'tracts': 15}, 'Winnebago': {'pop': 295266, 'tracts': 77}, 'Woodford': {'pop': 38664, 'tracts': 9}}, 'IN': {'Adams': {'pop': 34387, 'tracts': 7}, 'Allen': {'pop': 355329, 'tracts': 96}, 'Bartholomew': {'pop': 76794, 'tracts': 15}, 'Benton': {'pop': 8854, 'tracts': 3}, 'Blackford': {'pop': 12766, 'tracts': 4}, 'Boone': {'pop': 56640, 'tracts': 10}, 'Brown': {'pop': 15242, 'tracts': 4}, 'Carroll': {'pop': 20155, 'tracts': 7}, 'Cass': {'pop': 38966, 'tracts': 11}, 'Clark': {'pop': 110232, 'tracts': 26}, 'Clay': {'pop': 26890, 'tracts': 6}, 'Clinton': {'pop': 33224, 'tracts': 8}, 'Crawford': {'pop': 10713, 'tracts': 3}, 'Daviess': {'pop': 31648, 'tracts': 7}, 'DeKalb': {'pop': 42223, 'tracts': 9}, 'Dearborn': {'pop': 50047, 'tracts': 10}, 'Decatur': {'pop': 25740, 'tracts': 6}, 'Delaware': {'pop': 117671, 'tracts': 30}, 'Dubois': {'pop': 41889, 'tracts': 7}, 'Elkhart': {'pop': 197559, 'tracts': 36}, 'Fayette': {'pop': 24277, 'tracts': 7}, 'Floyd': {'pop': 74578, 'tracts': 20}, 'Fountain': {'pop': 17240, 'tracts': 5}, 'Franklin': {'pop': 23087, 'tracts': 5}, 'Fulton': {'pop': 20836, 'tracts': 6}, 'Gibson': {'pop': 33503, 'tracts': 7}, 'Grant': {'pop': 70061, 'tracts': 16}, 'Greene': {'pop': 33165, 'tracts': 9}, 'Hamilton': {'pop': 274569, 'tracts': 39}, 'Hancock': {'pop': 70002, 'tracts': 10}, 'Harrison': {'pop': 39364, 'tracts': 6}, 'Hendricks': {'pop': 145448, 'tracts': 21}, 'Henry': {'pop': 49462, 'tracts': 13}, 'Howard': {'pop': 82752, 'tracts': 20}, 'Huntington': {'pop': 37124, 'tracts': 9}, 'Jackson': {'pop': 42376, 'tracts': 10}, 'Jasper': {'pop': 33478, 'tracts': 8}, 'Jay': {'pop': 21253, 'tracts': 7}, 'Jefferson': {'pop': 32428, 'tracts': 7}, 'Jennings': {'pop': 28525, 'tracts': 6}, 'Johnson': {'pop': 139654, 'tracts': 22}, 'Knox': {'pop': 38440, 'tracts': 10}, 'Kosciusko': {'pop': 77358, 'tracts': 19}, 'LaGrange': {'pop': 37128, 'tracts': 8}, 'LaPorte': {'pop': 111467, 'tracts': 28}, 'Lake': {'pop': 496005, 'tracts': 117}, 'Lawrence': {'pop': 46134, 'tracts': 10}, 'Madison': {'pop': 131636, 'tracts': 37}, 'Marion': {'pop': 903393, 'tracts': 224}, 'Marshall': {'pop': 47051, 'tracts': 12}, 'Martin': {'pop': 10334, 'tracts': 3}, 'Miami': {'pop': 36903, 'tracts': 10}, 'Monroe': {'pop': 137974, 'tracts': 31}, 'Montgomery': {'pop': 38124, 'tracts': 9}, 'Morgan': {'pop': 68894, 'tracts': 13}, 'Newton': {'pop': 14244, 'tracts': 4}, 'Noble': {'pop': 47536, 'tracts': 10}, 'Ohio': {'pop': 6128, 'tracts': 2}, 'Orange': {'pop': 19840, 'tracts': 6}, 'Owen': {'pop': 21575, 'tracts': 5}, 'Parke': {'pop': 17339, 'tracts': 4}, 'Perry': {'pop': 19338, 'tracts': 5}, 'Pike': {'pop': 12845, 'tracts': 4}, 'Porter': {'pop': 164343, 'tracts': 32}, 'Posey': {'pop': 25910, 'tracts': 7}, 'Pulaski': {'pop': 13402, 'tracts': 4}, 'Putnam': {'pop': 37963, 'tracts': 7}, 'Randolph': {'pop': 26171, 'tracts': 8}, 'Ripley': {'pop': 28818, 'tracts': 6}, 'Rush': {'pop': 17392, 'tracts': 5}, 'Scott': {'pop': 24181, 'tracts': 5}, 'Shelby': {'pop': 44436, 'tracts': 10}, 'Spencer': {'pop': 20952, 'tracts': 5}, 'St. Joseph': {'pop': 266931, 'tracts': 75}, 'Starke': {'pop': 23363, 'tracts': 7}, 'Steuben': {'pop': 34185, 'tracts': 9}, 'Sullivan': {'pop': 21475, 'tracts': 5}, 'Switzerland': {'pop': 10613, 'tracts': 3}, 'Tippecanoe': {'pop': 172780, 'tracts': 37}, 'Tipton': {'pop': 15936, 'tracts': 4}, 'Union': {'pop': 7516, 'tracts': 2}, 'Vanderburgh': {'pop': 179703, 'tracts': 49}, 'Vermillion': {'pop': 16212, 'tracts': 5}, 'Vigo': {'pop': 107848, 'tracts': 28}, 'Wabash': {'pop': 32888, 'tracts': 8}, 'Warren': {'pop': 8508, 'tracts': 2}, 'Warrick': {'pop': 59689, 'tracts': 11}, 'Washington': {'pop': 28262, 'tracts': 6}, 'Wayne': {'pop': 68917, 'tracts': 17}, 'Wells': {'pop': 27636, 'tracts': 7}, 'White': {'pop': 24643, 'tracts': 8}, 'Whitley': {'pop': 33292, 'tracts': 7}}, 'KS': {'Allen': {'pop': 13371, 'tracts': 5}, 'Anderson': {'pop': 8102, 'tracts': 2}, 'Atchison': {'pop': 16924, 'tracts': 4}, 'Barber': {'pop': 4861, 'tracts': 2}, 'Barton': {'pop': 27674, 'tracts': 8}, 'Bourbon': {'pop': 15173, 'tracts': 5}, 'Brown': {'pop': 9984, 'tracts': 3}, 'Butler': {'pop': 65880, 'tracts': 13}, 'Chase': {'pop': 2790, 'tracts': 1}, 'Chautauqua': {'pop': 3669, 'tracts': 1}, 'Cherokee': {'pop': 21603, 'tracts': 6}, 'Cheyenne': {'pop': 2726, 'tracts': 1}, 'Clark': {'pop': 2215, 'tracts': 1}, 'Clay': {'pop': 8535, 'tracts': 2}, 'Cloud': {'pop': 9533, 'tracts': 4}, 'Coffey': {'pop': 8601, 'tracts': 3}, 'Comanche': {'pop': 1891, 'tracts': 1}, 'Cowley': {'pop': 36311, 'tracts': 11}, 'Crawford': {'pop': 39134, 'tracts': 11}, 'Decatur': {'pop': 2961, 'tracts': 2}, 'Dickinson': {'pop': 19754, 'tracts': 6}, 'Doniphan': {'pop': 7945, 'tracts': 3}, 'Douglas': {'pop': 110826, 'tracts': 22}, 'Edwards': {'pop': 3037, 'tracts': 2}, 'Elk': {'pop': 2882, 'tracts': 1}, 'Ellis': {'pop': 28452, 'tracts': 6}, 'Ellsworth': {'pop': 6497, 'tracts': 2}, 'Finney': {'pop': 36776, 'tracts': 12}, 'Ford': {'pop': 33848, 'tracts': 7}, 'Franklin': {'pop': 25992, 'tracts': 5}, 'Geary': {'pop': 34362, 'tracts': 8}, 'Gove': {'pop': 2695, 'tracts': 2}, 'Graham': {'pop': 2597, 'tracts': 2}, 'Grant': {'pop': 7829, 'tracts': 2}, 'Gray': {'pop': 6006, 'tracts': 2}, 'Greeley': {'pop': 1247, 'tracts': 1}, 'Greenwood': {'pop': 6689, 'tracts': 3}, 'Hamilton': {'pop': 2690, 'tracts': 1}, 'Harper': {'pop': 6034, 'tracts': 3}, 'Harvey': {'pop': 34684, 'tracts': 6}, 'Haskell': {'pop': 4256, 'tracts': 1}, 'Hodgeman': {'pop': 1916, 'tracts': 1}, 'Jackson': {'pop': 13462, 'tracts': 3}, 'Jefferson': {'pop': 19126, 'tracts': 4}, 'Jewell': {'pop': 3077, 'tracts': 2}, 'Johnson': {'pop': 544179, 'tracts': 130}, 'Kearny': {'pop': 3977, 'tracts': 1}, 'Kingman': {'pop': 7858, 'tracts': 3}, 'Kiowa': {'pop': 2553, 'tracts': 1}, 'Labette': {'pop': 21607, 'tracts': 8}, 'Lane': {'pop': 1750, 'tracts': 1}, 'Leavenworth': {'pop': 76227, 'tracts': 16}, 'Lincoln': {'pop': 3241, 'tracts': 1}, 'Linn': {'pop': 9656, 'tracts': 2}, 'Logan': {'pop': 2756, 'tracts': 1}, 'Lyon': {'pop': 33690, 'tracts': 8}, 'Marion': {'pop': 12660, 'tracts': 4}, 'Marshall': {'pop': 10117, 'tracts': 4}, 'McPherson': {'pop': 29180, 'tracts': 7}, 'Meade': {'pop': 4575, 'tracts': 2}, 'Miami': {'pop': 32787, 'tracts': 8}, 'Mitchell': {'pop': 6373, 'tracts': 2}, 'Montgomery': {'pop': 35471, 'tracts': 13}, 'Morris': {'pop': 5923, 'tracts': 2}, 'Morton': {'pop': 3233, 'tracts': 1}, 'Nemaha': {'pop': 10178, 'tracts': 3}, 'Neosho': {'pop': 16512, 'tracts': 5}, 'Ness': {'pop': 3107, 'tracts': 2}, 'Norton': {'pop': 5671, 'tracts': 1}, 'Osage': {'pop': 16295, 'tracts': 5}, 'Osborne': {'pop': 3858, 'tracts': 1}, 'Ottawa': {'pop': 6091, 'tracts': 2}, 'Pawnee': {'pop': 6973, 'tracts': 2}, 'Phillips': {'pop': 5642, 'tracts': 3}, 'Pottawatomie': {'pop': 21604, 'tracts': 4}, 'Pratt': {'pop': 9656, 'tracts': 3}, 'Rawlins': {'pop': 2519, 'tracts': 1}, 'Reno': {'pop': 64511, 'tracts': 17}, 'Republic': {'pop': 4980, 'tracts': 3}, 'Rice': {'pop': 10083, 'tracts': 3}, 'Riley': {'pop': 71115, 'tracts': 14}, 'Rooks': {'pop': 5181, 'tracts': 2}, 'Rush': {'pop': 3307, 'tracts': 2}, 'Russell': {'pop': 6970, 'tracts': 2}, 'Saline': {'pop': 55606, 'tracts': 12}, 'Scott': {'pop': 4936, 'tracts': 1}, 'Sedgwick': {'pop': 498365, 'tracts': 124}, 'Seward': {'pop': 22952, 'tracts': 5}, 'Shawnee': {'pop': 177934, 'tracts': 43}, 'Sheridan': {'pop': 2556, 'tracts': 2}, 'Sherman': {'pop': 6010, 'tracts': 2}, 'Smith': {'pop': 3853, 'tracts': 2}, 'Stafford': {'pop': 4437, 'tracts': 2}, 'Stanton': {'pop': 2235, 'tracts': 1}, 'Stevens': {'pop': 5724, 'tracts': 2}, 'Sumner': {'pop': 24132, 'tracts': 6}, 'Thomas': {'pop': 7900, 'tracts': 2}, 'Trego': {'pop': 3001, 'tracts': 1}, 'Wabaunsee': {'pop': 7053, 'tracts': 2}, 'Wallace': {'pop': 1485, 'tracts': 1}, 'Washington': {'pop': 5799, 'tracts': 2}, 'Wichita': {'pop': 2234, 'tracts': 1}, 'Wilson': {'pop': 9409, 'tracts': 4}, 'Woodson': {'pop': 3309, 'tracts': 2}, 'Wyandotte': {'pop': 157505, 'tracts': 70}}, 'KY': {'Adair': {'pop': 18656, 'tracts': 7}, 'Allen': {'pop': 19956, 'tracts': 6}, 'Anderson': {'pop': 21421, 'tracts': 5}, 'Ballard': {'pop': 8249, 'tracts': 3}, 'Barren': {'pop': 42173, 'tracts': 10}, 'Bath': {'pop': 11591, 'tracts': 3}, 'Bell': {'pop': 28691, 'tracts': 9}, 'Boone': {'pop': 118811, 'tracts': 22}, 'Bourbon': {'pop': 19985, 'tracts': 6}, 'Boyd': {'pop': 49542, 'tracts': 13}, 'Boyle': {'pop': 28432, 'tracts': 7}, 'Bracken': {'pop': 8488, 'tracts': 3}, 'Breathitt': {'pop': 13878, 'tracts': 7}, 'Breckinridge': {'pop': 20059, 'tracts': 6}, 'Bullitt': {'pop': 74319, 'tracts': 18}, 'Butler': {'pop': 12690, 'tracts': 5}, 'Caldwell': {'pop': 12984, 'tracts': 3}, 'Calloway': {'pop': 37191, 'tracts': 9}, 'Campbell': {'pop': 90336, 'tracts': 25}, 'Carlisle': {'pop': 5104, 'tracts': 3}, 'Carroll': {'pop': 10811, 'tracts': 3}, 'Carter': {'pop': 27720, 'tracts': 7}, 'Casey': {'pop': 15955, 'tracts': 5}, 'Christian': {'pop': 73955, 'tracts': 19}, 'Clark': {'pop': 35613, 'tracts': 10}, 'Clay': {'pop': 21730, 'tracts': 6}, 'Clinton': {'pop': 10272, 'tracts': 3}, 'Crittenden': {'pop': 9315, 'tracts': 4}, 'Cumberland': {'pop': 6856, 'tracts': 2}, 'Daviess': {'pop': 96656, 'tracts': 23}, 'Edmonson': {'pop': 12161, 'tracts': 4}, 'Elliott': {'pop': 7852, 'tracts': 2}, 'Estill': {'pop': 14672, 'tracts': 4}, 'Fayette': {'pop': 295803, 'tracts': 82}, 'Fleming': {'pop': 14348, 'tracts': 4}, 'Floyd': {'pop': 39451, 'tracts': 10}, 'Franklin': {'pop': 49285, 'tracts': 11}, 'Fulton': {'pop': 6813, 'tracts': 2}, 'Gallatin': {'pop': 8589, 'tracts': 2}, 'Garrard': {'pop': 16912, 'tracts': 4}, 'Grant': {'pop': 24662, 'tracts': 4}, 'Graves': {'pop': 37121, 'tracts': 9}, 'Grayson': {'pop': 25746, 'tracts': 7}, 'Green': {'pop': 11258, 'tracts': 4}, 'Greenup': {'pop': 36910, 'tracts': 9}, 'Hancock': {'pop': 8565, 'tracts': 3}, 'Hardin': {'pop': 105543, 'tracts': 22}, 'Harlan': {'pop': 29278, 'tracts': 11}, 'Harrison': {'pop': 18846, 'tracts': 5}, 'Hart': {'pop': 18199, 'tracts': 5}, 'Henderson': {'pop': 46250, 'tracts': 11}, 'Henry': {'pop': 15416, 'tracts': 5}, 'Hickman': {'pop': 4902, 'tracts': 1}, 'Hopkins': {'pop': 46920, 'tracts': 12}, 'Jackson': {'pop': 13494, 'tracts': 3}, 'Jefferson': {'pop': 741096, 'tracts': 191}, 'Jessamine': {'pop': 48586, 'tracts': 9}, 'Johnson': {'pop': 23356, 'tracts': 6}, 'Kenton': {'pop': 159720, 'tracts': 41}, 'Knott': {'pop': 16346, 'tracts': 5}, 'Knox': {'pop': 31883, 'tracts': 8}, 'Larue': {'pop': 14193, 'tracts': 4}, 'Laurel': {'pop': 58849, 'tracts': 13}, 'Lawrence': {'pop': 15860, 'tracts': 5}, 'Lee': {'pop': 7887, 'tracts': 3}, 'Leslie': {'pop': 11310, 'tracts': 3}, 'Letcher': {'pop': 24519, 'tracts': 7}, 'Lewis': {'pop': 13870, 'tracts': 4}, 'Lincoln': {'pop': 24742, 'tracts': 6}, 'Livingston': {'pop': 9519, 'tracts': 2}, 'Logan': {'pop': 26835, 'tracts': 6}, 'Lyon': {'pop': 8314, 'tracts': 3}, 'Madison': {'pop': 82916, 'tracts': 19}, 'Magoffin': {'pop': 13333, 'tracts': 4}, 'Marion': {'pop': 19820, 'tracts': 6}, 'Marshall': {'pop': 31448, 'tracts': 6}, 'Martin': {'pop': 12929, 'tracts': 3}, 'Mason': {'pop': 17490, 'tracts': 5}, 'McCracken': {'pop': 65565, 'tracts': 17}, 'McCreary': {'pop': 18306, 'tracts': 4}, 'McLean': {'pop': 9531, 'tracts': 3}, 'Meade': {'pop': 28602, 'tracts': 8}, 'Menifee': {'pop': 6306, 'tracts': 2}, 'Mercer': {'pop': 21331, 'tracts': 5}, 'Metcalfe': {'pop': 10099, 'tracts': 3}, 'Monroe': {'pop': 10963, 'tracts': 4}, 'Montgomery': {'pop': 26499, 'tracts': 6}, 'Morgan': {'pop': 13923, 'tracts': 5}, 'Muhlenberg': {'pop': 31499, 'tracts': 9}, 'Nelson': {'pop': 43437, 'tracts': 9}, 'Nicholas': {'pop': 7135, 'tracts': 2}, 'Ohio': {'pop': 23842, 'tracts': 7}, 'Oldham': {'pop': 60316, 'tracts': 14}, 'Owen': {'pop': 10841, 'tracts': 3}, 'Owsley': {'pop': 4755, 'tracts': 2}, 'Pendleton': {'pop': 14877, 'tracts': 3}, 'Perry': {'pop': 28712, 'tracts': 8}, 'Pike': {'pop': 65024, 'tracts': 19}, 'Powell': {'pop': 12613, 'tracts': 2}, 'Pulaski': {'pop': 63063, 'tracts': 14}, 'Robertson': {'pop': 2282, 'tracts': 1}, 'Rockcastle': {'pop': 17056, 'tracts': 4}, 'Rowan': {'pop': 23333, 'tracts': 4}, 'Russell': {'pop': 17565, 'tracts': 5}, 'Scott': {'pop': 47173, 'tracts': 14}, 'Shelby': {'pop': 42074, 'tracts': 9}, 'Simpson': {'pop': 17327, 'tracts': 4}, 'Spencer': {'pop': 17061, 'tracts': 4}, 'Taylor': {'pop': 24512, 'tracts': 5}, 'Todd': {'pop': 12460, 'tracts': 4}, 'Trigg': {'pop': 14339, 'tracts': 5}, 'Trimble': {'pop': 8809, 'tracts': 2}, 'Union': {'pop': 15007, 'tracts': 4}, 'Warren': {'pop': 113792, 'tracts': 24}, 'Washington': {'pop': 11717, 'tracts': 3}, 'Wayne': {'pop': 20813, 'tracts': 5}, 'Webster': {'pop': 13621, 'tracts': 4}, 'Whitley': {'pop': 35637, 'tracts': 8}, 'Wolfe': {'pop': 7355, 'tracts': 2}, 'Woodford': {'pop': 24939, 'tracts': 8}}, 'LA': {'Acadia': {'pop': 61773, 'tracts': 12}, 'Allen': {'pop': 25764, 'tracts': 5}, 'Ascension': {'pop': 107215, 'tracts': 14}, 'Assumption': {'pop': 23421, 'tracts': 6}, 'Avoyelles': {'pop': 42073, 'tracts': 9}, 'Beauregard': {'pop': 35654, 'tracts': 7}, 'Bienville': {'pop': 14353, 'tracts': 5}, 'Bossier': {'pop': 116979, 'tracts': 22}, 'Caddo': {'pop': 254969, 'tracts': 64}, 'Calcasieu': {'pop': 192768, 'tracts': 44}, 'Caldwell': {'pop': 10132, 'tracts': 3}, 'Cameron': {'pop': 6839, 'tracts': 3}, 'Catahoula': {'pop': 10407, 'tracts': 3}, 'Claiborne': {'pop': 17195, 'tracts': 5}, 'Concordia': {'pop': 20822, 'tracts': 5}, 'De Soto': {'pop': 26656, 'tracts': 7}, 'East Baton Rouge': {'pop': 440171, 'tracts': 92}, 'East Carroll': {'pop': 7759, 'tracts': 3}, 'East Feliciana': {'pop': 20267, 'tracts': 5}, 'Evangeline': {'pop': 33984, 'tracts': 8}, 'Franklin': {'pop': 20767, 'tracts': 6}, 'Grant': {'pop': 22309, 'tracts': 5}, 'Iberia': {'pop': 73240, 'tracts': 15}, 'Iberville': {'pop': 33387, 'tracts': 7}, 'Jackson': {'pop': 16274, 'tracts': 5}, 'Jefferson': {'pop': 432552, 'tracts': 127}, 'Jefferson Davis': {'pop': 31594, 'tracts': 7}, 'La Salle': {'pop': 14890, 'tracts': 3}, 'Lafayette': {'pop': 221578, 'tracts': 43}, 'Lafourche': {'pop': 96318, 'tracts': 23}, 'Lincoln': {'pop': 46735, 'tracts': 10}, 'Livingston': {'pop': 128026, 'tracts': 17}, 'Madison': {'pop': 12093, 'tracts': 5}, 'Morehouse': {'pop': 27979, 'tracts': 8}, 'Natchitoches': {'pop': 39566, 'tracts': 9}, 'Orleans': {'pop': 343829, 'tracts': 177}, 'Ouachita': {'pop': 153720, 'tracts': 40}, 'Plaquemines': {'pop': 23042, 'tracts': 9}, 'Pointe Coupee': {'pop': 22802, 'tracts': 6}, 'Rapides': {'pop': 131613, 'tracts': 33}, 'Red River': {'pop': 9091, 'tracts': 2}, 'Richland': {'pop': 20725, 'tracts': 6}, 'Sabine': {'pop': 24233, 'tracts': 7}, 'St. Bernard': {'pop': 35897, 'tracts': 18}, 'St. Charles': {'pop': 52780, 'tracts': 13}, 'St. Helena': {'pop': 11203, 'tracts': 2}, 'St. James': {'pop': 22102, 'tracts': 7}, 'St. John the Baptist': {'pop': 45924, 'tracts': 11}, 'St. Landry': {'pop': 83384, 'tracts': 19}, 'St. Martin': {'pop': 52160, 'tracts': 11}, 'St. Mary': {'pop': 54650, 'tracts': 16}, 'St. Tammany': {'pop': 233740, 'tracts': 43}, 'Tangipahoa': {'pop': 121097, 'tracts': 20}, 'Tensas': {'pop': 5252, 'tracts': 3}, 'Terrebonne': {'pop': 111860, 'tracts': 21}, 'Union': {'pop': 22721, 'tracts': 6}, 'Vermilion': {'pop': 57999, 'tracts': 12}, 'Vernon': {'pop': 52334, 'tracts': 12}, 'Washington': {'pop': 47168, 'tracts': 11}, 'Webster': {'pop': 41207, 'tracts': 11}, 'West Baton Rouge': {'pop': 23788, 'tracts': 5}, 'West Carroll': {'pop': 11604, 'tracts': 3}, 'West Feliciana': {'pop': 15625, 'tracts': 3}, 'Winn': {'pop': 15313, 'tracts': 4}}, 'MA': {'Barnstable': {'pop': 215888, 'tracts': 57}, 'Berkshire': {'pop': 131219, 'tracts': 39}, 'Bristol': {'pop': 548285, 'tracts': 126}, 'Dukes': {'pop': 16535, 'tracts': 4}, 'Essex': {'pop': 743159, 'tracts': 163}, 'Franklin': {'pop': 71372, 'tracts': 18}, 'Hampden': {'pop': 463490, 'tracts': 103}, 'Hampshire': {'pop': 158080, 'tracts': 36}, 'Middlesex': {'pop': 1503085, 'tracts': 318}, 'Nantucket': {'pop': 10172, 'tracts': 6}, 'Norfolk': {'pop': 670850, 'tracts': 130}, 'Plymouth': {'pop': 494919, 'tracts': 100}, 'Suffolk': {'pop': 722023, 'tracts': 204}, 'Worcester': {'pop': 798552, 'tracts': 172}}, 'MD': {'Allegany': {'pop': 75087, 'tracts': 23}, 'Anne Arundel': {'pop': 537656, 'tracts': 104}, 'Baltimore': {'pop': 805029, 'tracts': 214}, 'Baltimore City': {'pop': 620961, 'tracts': 200}, 'Calvert': {'pop': 88737, 'tracts': 18}, 'Caroline': {'pop': 33066, 'tracts': 9}, 'Carroll': {'pop': 167134, 'tracts': 38}, 'Cecil': {'pop': 101108, 'tracts': 19}, 'Charles': {'pop': 146551, 'tracts': 30}, 'Dorchester': {'pop': 32618, 'tracts': 10}, 'Frederick': {'pop': 233385, 'tracts': 61}, 'Garrett': {'pop': 30097, 'tracts': 7}, 'Harford': {'pop': 244826, 'tracts': 57}, 'Howard': {'pop': 287085, 'tracts': 55}, 'Kent': {'pop': 20197, 'tracts': 5}, 'Montgomery': {'pop': 971777, 'tracts': 215}, "Prince George's": {'pop': 863420, 'tracts': 218}, "Queen Anne's": {'pop': 47798, 'tracts': 12}, 'Somerset': {'pop': 26470, 'tracts': 8}, "St. Mary's": {'pop': 105151, 'tracts': 18}, 'Talbot': {'pop': 37782, 'tracts': 10}, 'Washington': {'pop': 147430, 'tracts': 32}, 'Wicomico': {'pop': 98733, 'tracts': 19}, 'Worcester': {'pop': 51454, 'tracts': 17}}, 'ME': {'Androscoggin': {'pop': 107702, 'tracts': 28}, 'Aroostook': {'pop': 71870, 'tracts': 24}, 'Cumberland': {'pop': 281674, 'tracts': 67}, 'Franklin': {'pop': 30768, 'tracts': 9}, 'Hancock': {'pop': 54418, 'tracts': 17}, 'Kennebec': {'pop': 122151, 'tracts': 31}, 'Knox': {'pop': 39736, 'tracts': 11}, 'Lincoln': {'pop': 34457, 'tracts': 9}, 'Oxford': {'pop': 57833, 'tracts': 17}, 'Penobscot': {'pop': 153923, 'tracts': 46}, 'Piscataquis': {'pop': 17535, 'tracts': 8}, 'Sagadahoc': {'pop': 35293, 'tracts': 8}, 'Somerset': {'pop': 52228, 'tracts': 17}, 'Waldo': {'pop': 38786, 'tracts': 8}, 'Washington': {'pop': 32856, 'tracts': 14}, 'York': {'pop': 197131, 'tracts': 41}}, 'MI': {'Alcona': {'pop': 10942, 'tracts': 5}, 'Alger': {'pop': 9601, 'tracts': 3}, 'Allegan': {'pop': 111408, 'tracts': 25}, 'Alpena': {'pop': 29598, 'tracts': 10}, 'Antrim': {'pop': 23580, 'tracts': 7}, 'Arenac': {'pop': 15899, 'tracts': 5}, 'Baraga': {'pop': 8860, 'tracts': 2}, 'Barry': {'pop': 59173, 'tracts': 11}, 'Bay': {'pop': 107771, 'tracts': 26}, 'Benzie': {'pop': 17525, 'tracts': 5}, 'Berrien': {'pop': 156813, 'tracts': 48}, 'Branch': {'pop': 45248, 'tracts': 12}, 'Calhoun': {'pop': 136146, 'tracts': 39}, 'Cass': {'pop': 52293, 'tracts': 11}, 'Charlevoix': {'pop': 25949, 'tracts': 13}, 'Cheboygan': {'pop': 26152, 'tracts': 8}, 'Chippewa': {'pop': 38520, 'tracts': 14}, 'Clare': {'pop': 30926, 'tracts': 11}, 'Clinton': {'pop': 75382, 'tracts': 22}, 'Crawford': {'pop': 14074, 'tracts': 5}, 'Delta': {'pop': 37069, 'tracts': 11}, 'Dickinson': {'pop': 26168, 'tracts': 7}, 'Eaton': {'pop': 107759, 'tracts': 28}, 'Emmet': {'pop': 32694, 'tracts': 8}, 'Genesee': {'pop': 425790, 'tracts': 131}, 'Gladwin': {'pop': 25692, 'tracts': 9}, 'Gogebic': {'pop': 16427, 'tracts': 7}, 'Grand Traverse': {'pop': 86986, 'tracts': 16}, 'Gratiot': {'pop': 42476, 'tracts': 10}, 'Hillsdale': {'pop': 46688, 'tracts': 12}, 'Houghton': {'pop': 36628, 'tracts': 11}, 'Huron': {'pop': 33118, 'tracts': 12}, 'Ingham': {'pop': 280895, 'tracts': 81}, 'Ionia': {'pop': 63905, 'tracts': 13}, 'Iosco': {'pop': 25887, 'tracts': 9}, 'Iron': {'pop': 11817, 'tracts': 5}, 'Isabella': {'pop': 70311, 'tracts': 15}, 'Jackson': {'pop': 160248, 'tracts': 38}, 'Kalamazoo': {'pop': 250331, 'tracts': 57}, 'Kalkaska': {'pop': 17153, 'tracts': 5}, 'Kent': {'pop': 602622, 'tracts': 128}, 'Keweenaw': {'pop': 2156, 'tracts': 2}, 'Lake': {'pop': 11539, 'tracts': 4}, 'Lapeer': {'pop': 88319, 'tracts': 24}, 'Leelanau': {'pop': 21708, 'tracts': 6}, 'Lenawee': {'pop': 99892, 'tracts': 23}, 'Livingston': {'pop': 180967, 'tracts': 61}, 'Luce': {'pop': 6631, 'tracts': 3}, 'Mackinac': {'pop': 11113, 'tracts': 6}, 'Macomb': {'pop': 840978, 'tracts': 216}, 'Manistee': {'pop': 24733, 'tracts': 9}, 'Marquette': {'pop': 67077, 'tracts': 24}, 'Mason': {'pop': 28705, 'tracts': 8}, 'Mecosta': {'pop': 42798, 'tracts': 11}, 'Menominee': {'pop': 24029, 'tracts': 7}, 'Midland': {'pop': 83629, 'tracts': 19}, 'Missaukee': {'pop': 14849, 'tracts': 4}, 'Monroe': {'pop': 152021, 'tracts': 39}, 'Montcalm': {'pop': 63342, 'tracts': 13}, 'Montmorency': {'pop': 9765, 'tracts': 5}, 'Muskegon': {'pop': 172188, 'tracts': 42}, 'Newaygo': {'pop': 48460, 'tracts': 11}, 'Oakland': {'pop': 1202362, 'tracts': 338}, 'Oceana': {'pop': 26570, 'tracts': 7}, 'Ogemaw': {'pop': 21699, 'tracts': 7}, 'Ontonagon': {'pop': 6780, 'tracts': 4}, 'Osceola': {'pop': 23528, 'tracts': 6}, 'Oscoda': {'pop': 8640, 'tracts': 5}, 'Otsego': {'pop': 24164, 'tracts': 6}, 'Ottawa': {'pop': 263801, 'tracts': 53}, 'Presque Isle': {'pop': 13376, 'tracts': 6}, 'Roscommon': {'pop': 24449, 'tracts': 10}, 'Saginaw': {'pop': 200169, 'tracts': 56}, 'Sanilac': {'pop': 43114, 'tracts': 12}, 'Schoolcraft': {'pop': 8485, 'tracts': 3}, 'Shiawassee': {'pop': 70648, 'tracts': 17}, 'St. Clair': {'pop': 163040, 'tracts': 49}, 'St. Joseph': {'pop': 61295, 'tracts': 17}, 'Tuscola': {'pop': 55729, 'tracts': 13}, 'Van Buren': {'pop': 76258, 'tracts': 15}, 'Washtenaw': {'pop': 344791, 'tracts': 100}, 'Wayne': {'pop': 1820584, 'tracts': 610}, 'Wexford': {'pop': 32735, 'tracts': 8}}, 'MN': {'Aitkin': {'pop': 16202, 'tracts': 6}, 'Anoka': {'pop': 330844, 'tracts': 83}, 'Becker': {'pop': 32504, 'tracts': 10}, 'Beltrami': {'pop': 44442, 'tracts': 10}, 'Benton': {'pop': 38451, 'tracts': 9}, 'Big Stone': {'pop': 5269, 'tracts': 3}, 'Blue Earth': {'pop': 64013, 'tracts': 16}, 'Brown': {'pop': 25893, 'tracts': 8}, 'Carlton': {'pop': 35386, 'tracts': 7}, 'Carver': {'pop': 91042, 'tracts': 19}, 'Cass': {'pop': 28567, 'tracts': 10}, 'Chippewa': {'pop': 12441, 'tracts': 4}, 'Chisago': {'pop': 53887, 'tracts': 10}, 'Clay': {'pop': 58999, 'tracts': 13}, 'Clearwater': {'pop': 8695, 'tracts': 3}, 'Cook': {'pop': 5176, 'tracts': 3}, 'Cottonwood': {'pop': 11687, 'tracts': 4}, 'Crow Wing': {'pop': 62500, 'tracts': 16}, 'Dakota': {'pop': 398552, 'tracts': 95}, 'Dodge': {'pop': 20087, 'tracts': 5}, 'Douglas': {'pop': 36009, 'tracts': 9}, 'Faribault': {'pop': 14553, 'tracts': 6}, 'Fillmore': {'pop': 20866, 'tracts': 6}, 'Freeborn': {'pop': 31255, 'tracts': 10}, 'Goodhue': {'pop': 46183, 'tracts': 10}, 'Grant': {'pop': 6018, 'tracts': 2}, 'Hennepin': {'pop': 1152425, 'tracts': 299}, 'Houston': {'pop': 19027, 'tracts': 5}, 'Hubbard': {'pop': 20428, 'tracts': 7}, 'Isanti': {'pop': 37816, 'tracts': 8}, 'Itasca': {'pop': 45058, 'tracts': 11}, 'Jackson': {'pop': 10266, 'tracts': 4}, 'Kanabec': {'pop': 16239, 'tracts': 4}, 'Kandiyohi': {'pop': 42239, 'tracts': 12}, 'Kittson': {'pop': 4552, 'tracts': 2}, 'Koochiching': {'pop': 13311, 'tracts': 4}, 'Lac qui Parle': {'pop': 7259, 'tracts': 3}, 'Lake': {'pop': 10866, 'tracts': 3}, 'Lake of the Woods': {'pop': 4045, 'tracts': 2}, 'Le Sueur': {'pop': 27703, 'tracts': 6}, 'Lincoln': {'pop': 5896, 'tracts': 2}, 'Lyon': {'pop': 25857, 'tracts': 7}, 'Mahnomen': {'pop': 5413, 'tracts': 2}, 'Marshall': {'pop': 9439, 'tracts': 4}, 'Martin': {'pop': 20840, 'tracts': 6}, 'McLeod': {'pop': 36651, 'tracts': 7}, 'Meeker': {'pop': 23300, 'tracts': 6}, 'Mille Lacs': {'pop': 26097, 'tracts': 7}, 'Morrison': {'pop': 33198, 'tracts': 8}, 'Mower': {'pop': 39163, 'tracts': 11}, 'Murray': {'pop': 8725, 'tracts': 3}, 'Nicollet': {'pop': 32727, 'tracts': 7}, 'Nobles': {'pop': 21378, 'tracts': 6}, 'Norman': {'pop': 6852, 'tracts': 3}, 'Olmsted': {'pop': 144248, 'tracts': 33}, 'Otter Tail': {'pop': 57303, 'tracts': 17}, 'Pennington': {'pop': 13930, 'tracts': 5}, 'Pine': {'pop': 29750, 'tracts': 8}, 'Pipestone': {'pop': 9596, 'tracts': 5}, 'Polk': {'pop': 31600, 'tracts': 10}, 'Pope': {'pop': 10995, 'tracts': 4}, 'Ramsey': {'pop': 508640, 'tracts': 137}, 'Red Lake': {'pop': 4089, 'tracts': 2}, 'Redwood': {'pop': 16059, 'tracts': 6}, 'Renville': {'pop': 15730, 'tracts': 6}, 'Rice': {'pop': 64142, 'tracts': 13}, 'Rock': {'pop': 9687, 'tracts': 3}, 'Roseau': {'pop': 15629, 'tracts': 5}, 'Scott': {'pop': 129928, 'tracts': 21}, 'Sherburne': {'pop': 88499, 'tracts': 11}, 'Sibley': {'pop': 15226, 'tracts': 4}, 'St. Louis': {'pop': 200226, 'tracts': 66}, 'Stearns': {'pop': 150642, 'tracts': 29}, 'Steele': {'pop': 36576, 'tracts': 8}, 'Stevens': {'pop': 9726, 'tracts': 3}, 'Swift': {'pop': 9783, 'tracts': 4}, 'Todd': {'pop': 24895, 'tracts': 8}, 'Traverse': {'pop': 3558, 'tracts': 2}, 'Wabasha': {'pop': 21676, 'tracts': 6}, 'Wadena': {'pop': 13843, 'tracts': 3}, 'Waseca': {'pop': 19136, 'tracts': 5}, 'Washington': {'pop': 238136, 'tracts': 50}, 'Watonwan': {'pop': 11211, 'tracts': 3}, 'Wilkin': {'pop': 6576, 'tracts': 2}, 'Winona': {'pop': 51461, 'tracts': 10}, 'Wright': {'pop': 124700, 'tracts': 17}, 'Yellow Medicine': {'pop': 10438, 'tracts': 4}}, 'MO': {'Adair': {'pop': 25607, 'tracts': 7}, 'Andrew': {'pop': 17291, 'tracts': 4}, 'Atchison': {'pop': 5685, 'tracts': 2}, 'Audrain': {'pop': 25529, 'tracts': 7}, 'Barry': {'pop': 35597, 'tracts': 7}, 'Barton': {'pop': 12402, 'tracts': 3}, 'Bates': {'pop': 17049, 'tracts': 4}, 'Benton': {'pop': 19056, 'tracts': 6}, 'Bollinger': {'pop': 12363, 'tracts': 3}, 'Boone': {'pop': 162642, 'tracts': 29}, 'Buchanan': {'pop': 89201, 'tracts': 25}, 'Butler': {'pop': 42794, 'tracts': 10}, 'Caldwell': {'pop': 9424, 'tracts': 2}, 'Callaway': {'pop': 44332, 'tracts': 8}, 'Camden': {'pop': 44002, 'tracts': 11}, 'Cape Girardeau': {'pop': 75674, 'tracts': 16}, 'Carroll': {'pop': 9295, 'tracts': 3}, 'Carter': {'pop': 6265, 'tracts': 2}, 'Cass': {'pop': 99478, 'tracts': 20}, 'Cedar': {'pop': 13982, 'tracts': 3}, 'Chariton': {'pop': 7831, 'tracts': 3}, 'Christian': {'pop': 77422, 'tracts': 14}, 'Clark': {'pop': 7139, 'tracts': 3}, 'Clay': {'pop': 221939, 'tracts': 44}, 'Clinton': {'pop': 20743, 'tracts': 4}, 'Cole': {'pop': 75990, 'tracts': 15}, 'Cooper': {'pop': 17601, 'tracts': 5}, 'Crawford': {'pop': 24696, 'tracts': 6}, 'Dade': {'pop': 7883, 'tracts': 2}, 'Dallas': {'pop': 16777, 'tracts': 3}, 'Daviess': {'pop': 8433, 'tracts': 2}, 'DeKalb': {'pop': 12892, 'tracts': 2}, 'Dent': {'pop': 15657, 'tracts': 4}, 'Douglas': {'pop': 13684, 'tracts': 3}, 'Dunklin': {'pop': 31953, 'tracts': 10}, 'Franklin': {'pop': 101492, 'tracts': 17}, 'Gasconade': {'pop': 15222, 'tracts': 5}, 'Gentry': {'pop': 6738, 'tracts': 2}, 'Greene': {'pop': 275174, 'tracts': 62}, 'Grundy': {'pop': 10261, 'tracts': 4}, 'Harrison': {'pop': 8957, 'tracts': 3}, 'Henry': {'pop': 22272, 'tracts': 6}, 'Hickory': {'pop': 9627, 'tracts': 3}, 'Holt': {'pop': 4912, 'tracts': 3}, 'Howard': {'pop': 10144, 'tracts': 3}, 'Howell': {'pop': 40400, 'tracts': 8}, 'Iron': {'pop': 10630, 'tracts': 4}, 'Jackson': {'pop': 674158, 'tracts': 199}, 'Jasper': {'pop': 117404, 'tracts': 22}, 'Jefferson': {'pop': 218733, 'tracts': 42}, 'Johnson': {'pop': 52595, 'tracts': 9}, 'Knox': {'pop': 4131, 'tracts': 2}, 'Laclede': {'pop': 35571, 'tracts': 6}, 'Lafayette': {'pop': 33381, 'tracts': 7}, 'Lawrence': {'pop': 38634, 'tracts': 7}, 'Lewis': {'pop': 10211, 'tracts': 4}, 'Lincoln': {'pop': 52566, 'tracts': 7}, 'Linn': {'pop': 12761, 'tracts': 5}, 'Livingston': {'pop': 15195, 'tracts': 5}, 'Macon': {'pop': 15566, 'tracts': 5}, 'Madison': {'pop': 12226, 'tracts': 3}, 'Maries': {'pop': 9176, 'tracts': 3}, 'Marion': {'pop': 28781, 'tracts': 8}, 'McDonald': {'pop': 23083, 'tracts': 4}, 'Mercer': {'pop': 3785, 'tracts': 2}, 'Miller': {'pop': 24748, 'tracts': 5}, 'Mississippi': {'pop': 14358, 'tracts': 4}, 'Moniteau': {'pop': 15607, 'tracts': 4}, 'Monroe': {'pop': 8840, 'tracts': 3}, 'Montgomery': {'pop': 12236, 'tracts': 4}, 'Morgan': {'pop': 20565, 'tracts': 5}, 'New Madrid': {'pop': 18956, 'tracts': 6}, 'Newton': {'pop': 58114, 'tracts': 12}, 'Nodaway': {'pop': 23370, 'tracts': 5}, 'Oregon': {'pop': 10881, 'tracts': 3}, 'Osage': {'pop': 13878, 'tracts': 4}, 'Ozark': {'pop': 9723, 'tracts': 2}, 'Pemiscot': {'pop': 18296, 'tracts': 6}, 'Perry': {'pop': 18971, 'tracts': 5}, 'Pettis': {'pop': 42201, 'tracts': 11}, 'Phelps': {'pop': 45156, 'tracts': 10}, 'Pike': {'pop': 18516, 'tracts': 5}, 'Platte': {'pop': 89322, 'tracts': 20}, 'Polk': {'pop': 31137, 'tracts': 4}, 'Pulaski': {'pop': 52274, 'tracts': 9}, 'Putnam': {'pop': 4979, 'tracts': 2}, 'Ralls': {'pop': 10167, 'tracts': 3}, 'Randolph': {'pop': 25414, 'tracts': 6}, 'Ray': {'pop': 23494, 'tracts': 4}, 'Reynolds': {'pop': 6696, 'tracts': 2}, 'Ripley': {'pop': 14100, 'tracts': 4}, 'Saline': {'pop': 23370, 'tracts': 8}, 'Schuyler': {'pop': 4431, 'tracts': 2}, 'Scotland': {'pop': 4843, 'tracts': 2}, 'Scott': {'pop': 39191, 'tracts': 10}, 'Shannon': {'pop': 8441, 'tracts': 2}, 'Shelby': {'pop': 6373, 'tracts': 3}, 'St. Charles': {'pop': 360485, 'tracts': 79}, 'St. Clair': {'pop': 9805, 'tracts': 3}, 'St. Francois': {'pop': 65359, 'tracts': 11}, 'St. Louis': {'pop': 998954, 'tracts': 199}, 'St. Louis City': {'pop': 319294, 'tracts': 106}, 'Ste. Genevieve': {'pop': 18145, 'tracts': 4}, 'Stoddard': {'pop': 29968, 'tracts': 8}, 'Stone': {'pop': 32202, 'tracts': 6}, 'Sullivan': {'pop': 6714, 'tracts': 3}, 'Taney': {'pop': 51675, 'tracts': 10}, 'Texas': {'pop': 26008, 'tracts': 4}, 'Vernon': {'pop': 21159, 'tracts': 6}, 'Warren': {'pop': 32513, 'tracts': 5}, 'Washington': {'pop': 25195, 'tracts': 5}, 'Wayne': {'pop': 13521, 'tracts': 4}, 'Webster': {'pop': 36202, 'tracts': 8}, 'Worth': {'pop': 2171, 'tracts': 1}, 'Wright': {'pop': 18815, 'tracts': 4}}, 'MS': {'Adams': {'pop': 32297, 'tracts': 9}, 'Alcorn': {'pop': 37057, 'tracts': 7}, 'Amite': {'pop': 13131, 'tracts': 3}, 'Attala': {'pop': 19564, 'tracts': 6}, 'Benton': {'pop': 8729, 'tracts': 2}, 'Bolivar': {'pop': 34145, 'tracts': 8}, 'Calhoun': {'pop': 14962, 'tracts': 5}, 'Carroll': {'pop': 10597, 'tracts': 2}, 'Chickasaw': {'pop': 17392, 'tracts': 4}, 'Choctaw': {'pop': 8547, 'tracts': 3}, 'Claiborne': {'pop': 9604, 'tracts': 3}, 'Clarke': {'pop': 16732, 'tracts': 4}, 'Clay': {'pop': 20634, 'tracts': 5}, 'Coahoma': {'pop': 26151, 'tracts': 7}, 'Copiah': {'pop': 29449, 'tracts': 6}, 'Covington': {'pop': 19568, 'tracts': 4}, 'DeSoto': {'pop': 161252, 'tracts': 33}, 'Forrest': {'pop': 74934, 'tracts': 17}, 'Franklin': {'pop': 8118, 'tracts': 2}, 'George': {'pop': 22578, 'tracts': 5}, 'Greene': {'pop': 14400, 'tracts': 2}, 'Grenada': {'pop': 21906, 'tracts': 5}, 'Hancock': {'pop': 43929, 'tracts': 7}, 'Harrison': {'pop': 187105, 'tracts': 46}, 'Hinds': {'pop': 245285, 'tracts': 64}, 'Holmes': {'pop': 19198, 'tracts': 5}, 'Humphreys': {'pop': 9375, 'tracts': 3}, 'Issaquena': {'pop': 1406, 'tracts': 1}, 'Itawamba': {'pop': 23401, 'tracts': 5}, 'Jackson': {'pop': 139668, 'tracts': 28}, 'Jasper': {'pop': 17062, 'tracts': 4}, 'Jefferson': {'pop': 7726, 'tracts': 2}, 'Jefferson Davis': {'pop': 12487, 'tracts': 3}, 'Jones': {'pop': 67761, 'tracts': 14}, 'Kemper': {'pop': 10456, 'tracts': 2}, 'Lafayette': {'pop': 47351, 'tracts': 10}, 'Lamar': {'pop': 55658, 'tracts': 8}, 'Lauderdale': {'pop': 80261, 'tracts': 19}, 'Lawrence': {'pop': 12929, 'tracts': 3}, 'Leake': {'pop': 23805, 'tracts': 5}, 'Lee': {'pop': 82910, 'tracts': 19}, 'Leflore': {'pop': 32317, 'tracts': 8}, 'Lincoln': {'pop': 34869, 'tracts': 6}, 'Lowndes': {'pop': 59779, 'tracts': 14}, 'Madison': {'pop': 95203, 'tracts': 21}, 'Marion': {'pop': 27088, 'tracts': 6}, 'Marshall': {'pop': 37144, 'tracts': 6}, 'Monroe': {'pop': 36989, 'tracts': 9}, 'Montgomery': {'pop': 10925, 'tracts': 3}, 'Neshoba': {'pop': 29676, 'tracts': 7}, 'Newton': {'pop': 21720, 'tracts': 5}, 'Noxubee': {'pop': 11545, 'tracts': 3}, 'Oktibbeha': {'pop': 47671, 'tracts': 8}, 'Panola': {'pop': 34707, 'tracts': 6}, 'Pearl River': {'pop': 55834, 'tracts': 9}, 'Perry': {'pop': 12250, 'tracts': 3}, 'Pike': {'pop': 40404, 'tracts': 8}, 'Pontotoc': {'pop': 29957, 'tracts': 6}, 'Prentiss': {'pop': 25276, 'tracts': 5}, 'Quitman': {'pop': 8223, 'tracts': 3}, 'Rankin': {'pop': 141617, 'tracts': 27}, 'Scott': {'pop': 28264, 'tracts': 6}, 'Sharkey': {'pop': 4916, 'tracts': 2}, 'Simpson': {'pop': 27503, 'tracts': 5}, 'Smith': {'pop': 16491, 'tracts': 3}, 'Stone': {'pop': 17786, 'tracts': 3}, 'Sunflower': {'pop': 29450, 'tracts': 7}, 'Tallahatchie': {'pop': 15378, 'tracts': 4}, 'Tate': {'pop': 28886, 'tracts': 5}, 'Tippah': {'pop': 22232, 'tracts': 4}, 'Tishomingo': {'pop': 19593, 'tracts': 4}, 'Tunica': {'pop': 10778, 'tracts': 3}, 'Union': {'pop': 27134, 'tracts': 6}, 'Walthall': {'pop': 15443, 'tracts': 3}, 'Warren': {'pop': 48773, 'tracts': 12}, 'Washington': {'pop': 51137, 'tracts': 19}, 'Wayne': {'pop': 20747, 'tracts': 4}, 'Webster': {'pop': 10253, 'tracts': 3}, 'Wilkinson': {'pop': 9878, 'tracts': 2}, 'Winston': {'pop': 19198, 'tracts': 5}, 'Yalobusha': {'pop': 12678, 'tracts': 3}, 'Yazoo': {'pop': 28065, 'tracts': 6}}, 'MT': {'Beaverhead': {'pop': 9246, 'tracts': 3}, 'Big Horn': {'pop': 12865, 'tracts': 5}, 'Blaine': {'pop': 6491, 'tracts': 4}, 'Broadwater': {'pop': 5612, 'tracts': 2}, 'Carbon': {'pop': 10078, 'tracts': 5}, 'Carter': {'pop': 1160, 'tracts': 1}, 'Cascade': {'pop': 81327, 'tracts': 22}, 'Chouteau': {'pop': 5813, 'tracts': 2}, 'Custer': {'pop': 11699, 'tracts': 6}, 'Daniels': {'pop': 1751, 'tracts': 1}, 'Dawson': {'pop': 8966, 'tracts': 3}, 'Deer Lodge': {'pop': 9298, 'tracts': 3}, 'Fallon': {'pop': 2890, 'tracts': 1}, 'Fergus': {'pop': 11586, 'tracts': 2}, 'Flathead': {'pop': 90928, 'tracts': 19}, 'Gallatin': {'pop': 89513, 'tracts': 22}, 'Garfield': {'pop': 1206, 'tracts': 1}, 'Glacier': {'pop': 13399, 'tracts': 4}, 'Golden Valley': {'pop': 884, 'tracts': 1}, 'Granite': {'pop': 3079, 'tracts': 1}, 'Hill': {'pop': 16096, 'tracts': 6}, 'Jefferson': {'pop': 11406, 'tracts': 3}, 'Judith Basin': {'pop': 2072, 'tracts': 1}, 'Lake': {'pop': 28746, 'tracts': 8}, 'Lewis and Clark': {'pop': 63395, 'tracts': 14}, 'Liberty': {'pop': 2339, 'tracts': 1}, 'Lincoln': {'pop': 19687, 'tracts': 5}, 'Madison': {'pop': 7691, 'tracts': 3}, 'McCone': {'pop': 1734, 'tracts': 1}, 'Meagher': {'pop': 1891, 'tracts': 1}, 'Mineral': {'pop': 4223, 'tracts': 2}, 'Missoula': {'pop': 109299, 'tracts': 20}, 'Musselshell': {'pop': 4538, 'tracts': 2}, 'Park': {'pop': 15636, 'tracts': 6}, 'Petroleum': {'pop': 494, 'tracts': 1}, 'Phillips': {'pop': 4253, 'tracts': 1}, 'Pondera': {'pop': 6153, 'tracts': 2}, 'Powder River': {'pop': 1743, 'tracts': 1}, 'Powell': {'pop': 7027, 'tracts': 2}, 'Prairie': {'pop': 1179, 'tracts': 1}, 'Ravalli': {'pop': 40212, 'tracts': 10}, 'Richland': {'pop': 9746, 'tracts': 4}, 'Roosevelt': {'pop': 10425, 'tracts': 3}, 'Rosebud': {'pop': 9233, 'tracts': 4}, 'Sanders': {'pop': 11413, 'tracts': 3}, 'Sheridan': {'pop': 3384, 'tracts': 2}, 'Silver Bow': {'pop': 34200, 'tracts': 8}, 'Stillwater': {'pop': 9117, 'tracts': 3}, 'Sweet Grass': {'pop': 3651, 'tracts': 1}, 'Teton': {'pop': 6073, 'tracts': 3}, 'Toole': {'pop': 5324, 'tracts': 3}, 'Treasure': {'pop': 718, 'tracts': 1}, 'Valley': {'pop': 7369, 'tracts': 3}, 'Wheatland': {'pop': 2168, 'tracts': 1}, 'Wibaux': {'pop': 1017, 'tracts': 1}, 'Yellowstone': {'pop': 147972, 'tracts': 32}}, 'NC': {'Alamance': {'pop': 151131, 'tracts': 36}, 'Alexander': {'pop': 37198, 'tracts': 7}, 'Alleghany': {'pop': 11155, 'tracts': 3}, 'Anson': {'pop': 26948, 'tracts': 6}, 'Ashe': {'pop': 27281, 'tracts': 6}, 'Avery': {'pop': 17797, 'tracts': 5}, 'Beaufort': {'pop': 47759, 'tracts': 11}, 'Bertie': {'pop': 21282, 'tracts': 4}, 'Bladen': {'pop': 35190, 'tracts': 6}, 'Brunswick': {'pop': 107431, 'tracts': 33}, 'Buncombe': {'pop': 238318, 'tracts': 56}, 'Burke': {'pop': 90912, 'tracts': 18}, 'Cabarrus': {'pop': 178011, 'tracts': 37}, 'Caldwell': {'pop': 83029, 'tracts': 17}, 'Camden': {'pop': 9980, 'tracts': 2}, 'Carteret': {'pop': 66469, 'tracts': 38}, 'Caswell': {'pop': 23719, 'tracts': 6}, 'Catawba': {'pop': 154358, 'tracts': 31}, 'Chatham': {'pop': 63505, 'tracts': 13}, 'Cherokee': {'pop': 27444, 'tracts': 7}, 'Chowan': {'pop': 14793, 'tracts': 3}, 'Clay': {'pop': 10587, 'tracts': 2}, 'Cleveland': {'pop': 98078, 'tracts': 22}, 'Columbus': {'pop': 58098, 'tracts': 13}, 'Craven': {'pop': 103505, 'tracts': 21}, 'Cumberland': {'pop': 319431, 'tracts': 68}, 'Currituck': {'pop': 23547, 'tracts': 8}, 'Dare': {'pop': 33920, 'tracts': 11}, 'Davidson': {'pop': 162878, 'tracts': 34}, 'Davie': {'pop': 41240, 'tracts': 7}, 'Duplin': {'pop': 58505, 'tracts': 11}, 'Durham': {'pop': 267587, 'tracts': 60}, 'Edgecombe': {'pop': 56552, 'tracts': 14}, 'Forsyth': {'pop': 350670, 'tracts': 93}, 'Franklin': {'pop': 60619, 'tracts': 12}, 'Gaston': {'pop': 206086, 'tracts': 65}, 'Gates': {'pop': 12197, 'tracts': 3}, 'Graham': {'pop': 8861, 'tracts': 3}, 'Granville': {'pop': 59916, 'tracts': 13}, 'Greene': {'pop': 21362, 'tracts': 4}, 'Guilford': {'pop': 488406, 'tracts': 119}, 'Halifax': {'pop': 54691, 'tracts': 12}, 'Harnett': {'pop': 114678, 'tracts': 27}, 'Haywood': {'pop': 59036, 'tracts': 16}, 'Henderson': {'pop': 106740, 'tracts': 27}, 'Hertford': {'pop': 24669, 'tracts': 5}, 'Hoke': {'pop': 46952, 'tracts': 9}, 'Hyde': {'pop': 5810, 'tracts': 2}, 'Iredell': {'pop': 159437, 'tracts': 44}, 'Jackson': {'pop': 40271, 'tracts': 9}, 'Johnston': {'pop': 168878, 'tracts': 25}, 'Jones': {'pop': 10153, 'tracts': 3}, 'Lee': {'pop': 57866, 'tracts': 13}, 'Lenoir': {'pop': 59495, 'tracts': 15}, 'Lincoln': {'pop': 78265, 'tracts': 18}, 'Macon': {'pop': 33922, 'tracts': 9}, 'Madison': {'pop': 20764, 'tracts': 6}, 'Martin': {'pop': 24505, 'tracts': 6}, 'McDowell': {'pop': 44996, 'tracts': 10}, 'Mecklenburg': {'pop': 919628, 'tracts': 233}, 'Mitchell': {'pop': 15579, 'tracts': 4}, 'Montgomery': {'pop': 27798, 'tracts': 6}, 'Moore': {'pop': 88247, 'tracts': 18}, 'Nash': {'pop': 95840, 'tracts': 18}, 'New Hanover': {'pop': 202667, 'tracts': 45}, 'Northampton': {'pop': 22099, 'tracts': 5}, 'Onslow': {'pop': 177772, 'tracts': 32}, 'Orange': {'pop': 133801, 'tracts': 28}, 'Pamlico': {'pop': 13144, 'tracts': 4}, 'Pasquotank': {'pop': 40661, 'tracts': 10}, 'Pender': {'pop': 52217, 'tracts': 16}, 'Perquimans': {'pop': 13453, 'tracts': 3}, 'Person': {'pop': 39464, 'tracts': 7}, 'Pitt': {'pop': 168148, 'tracts': 32}, 'Polk': {'pop': 20510, 'tracts': 7}, 'Randolph': {'pop': 141752, 'tracts': 28}, 'Richmond': {'pop': 46639, 'tracts': 11}, 'Robeson': {'pop': 134168, 'tracts': 31}, 'Rockingham': {'pop': 93643, 'tracts': 21}, 'Rowan': {'pop': 138428, 'tracts': 30}, 'Rutherford': {'pop': 67810, 'tracts': 13}, 'Sampson': {'pop': 63431, 'tracts': 11}, 'Scotland': {'pop': 36157, 'tracts': 7}, 'Stanly': {'pop': 60585, 'tracts': 13}, 'Stokes': {'pop': 47401, 'tracts': 9}, 'Surry': {'pop': 73673, 'tracts': 22}, 'Swain': {'pop': 13981, 'tracts': 5}, 'Transylvania': {'pop': 33090, 'tracts': 7}, 'Tyrrell': {'pop': 4407, 'tracts': 1}, 'Union': {'pop': 201292, 'tracts': 41}, 'Vance': {'pop': 45422, 'tracts': 10}, 'Wake': {'pop': 900993, 'tracts': 187}, 'Warren': {'pop': 20972, 'tracts': 6}, 'Washington': {'pop': 13228, 'tracts': 3}, 'Watauga': {'pop': 51079, 'tracts': 13}, 'Wayne': {'pop': 122623, 'tracts': 26}, 'Wilkes': {'pop': 69340, 'tracts': 14}, 'Wilson': {'pop': 81234, 'tracts': 19}, 'Yadkin': {'pop': 38406, 'tracts': 7}, 'Yancey': {'pop': 17818, 'tracts': 5}}, 'ND': {'Adams': {'pop': 2343, 'tracts': 1}, 'Barnes': {'pop': 11066, 'tracts': 4}, 'Benson': {'pop': 6660, 'tracts': 4}, 'Billings': {'pop': 783, 'tracts': 1}, 'Bottineau': {'pop': 6429, 'tracts': 3}, 'Bowman': {'pop': 3151, 'tracts': 2}, 'Burke': {'pop': 1968, 'tracts': 1}, 'Burleigh': {'pop': 81308, 'tracts': 19}, 'Cass': {'pop': 149778, 'tracts': 33}, 'Cavalier': {'pop': 3993, 'tracts': 2}, 'Dickey': {'pop': 5289, 'tracts': 3}, 'Divide': {'pop': 2071, 'tracts': 1}, 'Dunn': {'pop': 3536, 'tracts': 1}, 'Eddy': {'pop': 2385, 'tracts': 1}, 'Emmons': {'pop': 3550, 'tracts': 1}, 'Foster': {'pop': 3343, 'tracts': 1}, 'Golden Valley': {'pop': 1680, 'tracts': 1}, 'Grand Forks': {'pop': 66861, 'tracts': 18}, 'Grant': {'pop': 2394, 'tracts': 1}, 'Griggs': {'pop': 2420, 'tracts': 1}, 'Hettinger': {'pop': 2477, 'tracts': 2}, 'Kidder': {'pop': 2435, 'tracts': 1}, 'LaMoure': {'pop': 4139, 'tracts': 2}, 'Logan': {'pop': 1990, 'tracts': 1}, 'McHenry': {'pop': 5395, 'tracts': 2}, 'McIntosh': {'pop': 2809, 'tracts': 1}, 'McKenzie': {'pop': 6360, 'tracts': 4}, 'McLean': {'pop': 8962, 'tracts': 2}, 'Mercer': {'pop': 8424, 'tracts': 3}, 'Morton': {'pop': 27471, 'tracts': 5}, 'Mountrail': {'pop': 7673, 'tracts': 3}, 'Nelson': {'pop': 3126, 'tracts': 1}, 'Oliver': {'pop': 1846, 'tracts': 1}, 'Pembina': {'pop': 7413, 'tracts': 5}, 'Pierce': {'pop': 4357, 'tracts': 2}, 'Ramsey': {'pop': 11451, 'tracts': 3}, 'Ransom': {'pop': 5457, 'tracts': 3}, 'Renville': {'pop': 2470, 'tracts': 1}, 'Richland': {'pop': 16321, 'tracts': 6}, 'Rolette': {'pop': 13937, 'tracts': 4}, 'Sargent': {'pop': 3829, 'tracts': 2}, 'Sheridan': {'pop': 1321, 'tracts': 1}, 'Sioux': {'pop': 4153, 'tracts': 2}, 'Slope': {'pop': 727, 'tracts': 1}, 'Stark': {'pop': 24199, 'tracts': 8}, 'Steele': {'pop': 1975, 'tracts': 1}, 'Stutsman': {'pop': 21100, 'tracts': 6}, 'Towner': {'pop': 2246, 'tracts': 1}, 'Traill': {'pop': 8121, 'tracts': 4}, 'Walsh': {'pop': 11119, 'tracts': 6}, 'Ward': {'pop': 61675, 'tracts': 13}, 'Wells': {'pop': 4207, 'tracts': 2}, 'Williams': {'pop': 22398, 'tracts': 7}}, 'NE': {'Adams': {'pop': 31364, 'tracts': 9}, 'Antelope': {'pop': 6685, 'tracts': 3}, 'Arthur': {'pop': 460, 'tracts': 1}, 'Banner': {'pop': 690, 'tracts': 1}, 'Blaine': {'pop': 478, 'tracts': 1}, 'Boone': {'pop': 5505, 'tracts': 2}, 'Box Butte': {'pop': 11308, 'tracts': 3}, 'Boyd': {'pop': 2099, 'tracts': 1}, 'Brown': {'pop': 3145, 'tracts': 1}, 'Buffalo': {'pop': 46102, 'tracts': 11}, 'Burt': {'pop': 6858, 'tracts': 3}, 'Butler': {'pop': 8395, 'tracts': 3}, 'Cass': {'pop': 25241, 'tracts': 6}, 'Cedar': {'pop': 8852, 'tracts': 2}, 'Chase': {'pop': 3966, 'tracts': 1}, 'Cherry': {'pop': 5713, 'tracts': 2}, 'Cheyenne': {'pop': 9998, 'tracts': 3}, 'Clay': {'pop': 6542, 'tracts': 2}, 'Colfax': {'pop': 10515, 'tracts': 3}, 'Cuming': {'pop': 9139, 'tracts': 3}, 'Custer': {'pop': 10939, 'tracts': 4}, 'Dakota': {'pop': 21006, 'tracts': 4}, 'Dawes': {'pop': 9182, 'tracts': 2}, 'Dawson': {'pop': 24326, 'tracts': 7}, 'Deuel': {'pop': 1941, 'tracts': 1}, 'Dixon': {'pop': 6000, 'tracts': 2}, 'Dodge': {'pop': 36691, 'tracts': 9}, 'Douglas': {'pop': 517110, 'tracts': 156}, 'Dundy': {'pop': 2008, 'tracts': 1}, 'Fillmore': {'pop': 5890, 'tracts': 2}, 'Franklin': {'pop': 3225, 'tracts': 2}, 'Frontier': {'pop': 2756, 'tracts': 1}, 'Furnas': {'pop': 4959, 'tracts': 1}, 'Gage': {'pop': 22311, 'tracts': 7}, 'Garden': {'pop': 2057, 'tracts': 1}, 'Garfield': {'pop': 2049, 'tracts': 1}, 'Gosper': {'pop': 2044, 'tracts': 1}, 'Grant': {'pop': 614, 'tracts': 1}, 'Greeley': {'pop': 2538, 'tracts': 1}, 'Hall': {'pop': 58607, 'tracts': 14}, 'Hamilton': {'pop': 9124, 'tracts': 3}, 'Harlan': {'pop': 3423, 'tracts': 1}, 'Hayes': {'pop': 967, 'tracts': 1}, 'Hitchcock': {'pop': 2908, 'tracts': 1}, 'Holt': {'pop': 10435, 'tracts': 4}, 'Hooker': {'pop': 736, 'tracts': 1}, 'Howard': {'pop': 6274, 'tracts': 2}, 'Jefferson': {'pop': 7547, 'tracts': 3}, 'Johnson': {'pop': 5217, 'tracts': 2}, 'Kearney': {'pop': 6489, 'tracts': 2}, 'Keith': {'pop': 8368, 'tracts': 3}, 'Keya Paha': {'pop': 824, 'tracts': 1}, 'Kimball': {'pop': 3821, 'tracts': 1}, 'Knox': {'pop': 8701, 'tracts': 3}, 'Lancaster': {'pop': 285407, 'tracts': 74}, 'Lincoln': {'pop': 36288, 'tracts': 8}, 'Logan': {'pop': 763, 'tracts': 1}, 'Loup': {'pop': 632, 'tracts': 1}, 'Madison': {'pop': 34876, 'tracts': 9}, 'McPherson': {'pop': 539, 'tracts': 1}, 'Merrick': {'pop': 7845, 'tracts': 3}, 'Morrill': {'pop': 5042, 'tracts': 1}, 'Nance': {'pop': 3735, 'tracts': 1}, 'Nemaha': {'pop': 7248, 'tracts': 2}, 'Nuckolls': {'pop': 4500, 'tracts': 2}, 'Otoe': {'pop': 15740, 'tracts': 5}, 'Pawnee': {'pop': 2773, 'tracts': 1}, 'Perkins': {'pop': 2970, 'tracts': 1}, 'Phelps': {'pop': 9188, 'tracts': 3}, 'Pierce': {'pop': 7266, 'tracts': 2}, 'Platte': {'pop': 32237, 'tracts': 7}, 'Polk': {'pop': 5406, 'tracts': 2}, 'Red Willow': {'pop': 11055, 'tracts': 3}, 'Richardson': {'pop': 8363, 'tracts': 3}, 'Rock': {'pop': 1526, 'tracts': 1}, 'Saline': {'pop': 14200, 'tracts': 4}, 'Sarpy': {'pop': 158840, 'tracts': 43}, 'Saunders': {'pop': 20780, 'tracts': 5}, 'Scotts Bluff': {'pop': 36970, 'tracts': 11}, 'Seward': {'pop': 16750, 'tracts': 4}, 'Sheridan': {'pop': 5469, 'tracts': 2}, 'Sherman': {'pop': 3152, 'tracts': 1}, 'Sioux': {'pop': 1311, 'tracts': 1}, 'Stanton': {'pop': 6129, 'tracts': 2}, 'Thayer': {'pop': 5228, 'tracts': 2}, 'Thomas': {'pop': 647, 'tracts': 1}, 'Thurston': {'pop': 6940, 'tracts': 2}, 'Valley': {'pop': 4260, 'tracts': 2}, 'Washington': {'pop': 20234, 'tracts': 5}, 'Wayne': {'pop': 9595, 'tracts': 2}, 'Webster': {'pop': 3812, 'tracts': 2}, 'Wheeler': {'pop': 818, 'tracts': 1}, 'York': {'pop': 13665, 'tracts': 4}}, 'NH': {'Belknap': {'pop': 60088, 'tracts': 15}, 'Carroll': {'pop': 47818, 'tracts': 11}, 'Cheshire': {'pop': 77117, 'tracts': 16}, 'Coos': {'pop': 33055, 'tracts': 11}, 'Grafton': {'pop': 89118, 'tracts': 19}, 'Hillsborough': {'pop': 400721, 'tracts': 86}, 'Merrimack': {'pop': 146445, 'tracts': 36}, 'Rockingham': {'pop': 295223, 'tracts': 66}, 'Strafford': {'pop': 123143, 'tracts': 25}, 'Sullivan': {'pop': 43742, 'tracts': 10}}, 'NJ': {'Atlantic': {'pop': 274549, 'tracts': 69}, 'Bergen': {'pop': 905116, 'tracts': 179}, 'Burlington': {'pop': 448734, 'tracts': 114}, 'Camden': {'pop': 513657, 'tracts': 127}, 'Cape May': {'pop': 97265, 'tracts': 32}, 'Cumberland': {'pop': 156898, 'tracts': 35}, 'Essex': {'pop': 783969, 'tracts': 210}, 'Gloucester': {'pop': 288288, 'tracts': 63}, 'Hudson': {'pop': 634266, 'tracts': 166}, 'Hunterdon': {'pop': 128349, 'tracts': 26}, 'Mercer': {'pop': 366513, 'tracts': 77}, 'Middlesex': {'pop': 809858, 'tracts': 175}, 'Monmouth': {'pop': 630380, 'tracts': 144}, 'Morris': {'pop': 492276, 'tracts': 100}, 'Ocean': {'pop': 576567, 'tracts': 126}, 'Passaic': {'pop': 501226, 'tracts': 100}, 'Salem': {'pop': 66083, 'tracts': 24}, 'Somerset': {'pop': 323444, 'tracts': 68}, 'Sussex': {'pop': 149265, 'tracts': 41}, 'Union': {'pop': 536499, 'tracts': 108}, 'Warren': {'pop': 108692, 'tracts': 23}}, 'NM': {'Bernalillo': {'pop': 662564, 'tracts': 153}, 'Catron': {'pop': 3725, 'tracts': 1}, 'Chaves': {'pop': 65645, 'tracts': 16}, 'Cibola': {'pop': 27213, 'tracts': 7}, 'Colfax': {'pop': 13750, 'tracts': 3}, 'Curry': {'pop': 48376, 'tracts': 12}, 'De Baca': {'pop': 2022, 'tracts': 1}, 'Dona Ana': {'pop': 209233, 'tracts': 41}, 'Eddy': {'pop': 53829, 'tracts': 12}, 'Grant': {'pop': 29514, 'tracts': 8}, 'Guadalupe': {'pop': 4687, 'tracts': 1}, 'Harding': {'pop': 695, 'tracts': 1}, 'Hidalgo': {'pop': 4894, 'tracts': 2}, 'Lea': {'pop': 64727, 'tracts': 18}, 'Lincoln': {'pop': 20497, 'tracts': 5}, 'Los Alamos': {'pop': 17950, 'tracts': 4}, 'Luna': {'pop': 25095, 'tracts': 6}, 'McKinley': {'pop': 71492, 'tracts': 17}, 'Mora': {'pop': 4881, 'tracts': 1}, 'Otero': {'pop': 63797, 'tracts': 16}, 'Quay': {'pop': 9041, 'tracts': 3}, 'Rio Arriba': {'pop': 40246, 'tracts': 9}, 'Roosevelt': {'pop': 19846, 'tracts': 5}, 'San Juan': {'pop': 130044, 'tracts': 33}, 'San Miguel': {'pop': 29393, 'tracts': 7}, 'Sandoval': {'pop': 131561, 'tracts': 28}, 'Santa Fe': {'pop': 144170, 'tracts': 50}, 'Sierra': {'pop': 11988, 'tracts': 4}, 'Socorro': {'pop': 17866, 'tracts': 6}, 'Taos': {'pop': 32937, 'tracts': 6}, 'Torrance': {'pop': 16383, 'tracts': 4}, 'Union': {'pop': 4549, 'tracts': 1}, 'Valencia': {'pop': 76569, 'tracts': 18}}, 'NV': {'Carson City': {'pop': 55274, 'tracts': 14}, 'Churchill': {'pop': 24877, 'tracts': 7}, 'Clark': {'pop': 1951269, 'tracts': 487}, 'Douglas': {'pop': 46997, 'tracts': 17}, 'Elko': {'pop': 48818, 'tracts': 14}, 'Esmeralda': {'pop': 783, 'tracts': 1}, 'Eureka': {'pop': 1987, 'tracts': 1}, 'Humboldt': {'pop': 16528, 'tracts': 4}, 'Lander': {'pop': 5775, 'tracts': 1}, 'Lincoln': {'pop': 5345, 'tracts': 2}, 'Lyon': {'pop': 51980, 'tracts': 10}, 'Mineral': {'pop': 4772, 'tracts': 2}, 'Nye': {'pop': 43946, 'tracts': 10}, 'Pershing': {'pop': 6753, 'tracts': 1}, 'Storey': {'pop': 4010, 'tracts': 1}, 'Washoe': {'pop': 421407, 'tracts': 112}, 'White Pine': {'pop': 10030, 'tracts': 3}}, 'NY': {'Albany': {'pop': 304204, 'tracts': 75}, 'Allegany': {'pop': 48946, 'tracts': 13}, 'Bronx': {'pop': 1385108, 'tracts': 339}, 'Broome': {'pop': 200600, 'tracts': 55}, 'Cattaraugus': {'pop': 80317, 'tracts': 21}, 'Cayuga': {'pop': 80026, 'tracts': 20}, 'Chautauqua': {'pop': 134905, 'tracts': 35}, 'Chemung': {'pop': 88830, 'tracts': 22}, 'Chenango': {'pop': 50477, 'tracts': 12}, 'Clinton': {'pop': 82128, 'tracts': 19}, 'Columbia': {'pop': 63096, 'tracts': 21}, 'Cortland': {'pop': 49336, 'tracts': 12}, 'Delaware': {'pop': 47980, 'tracts': 14}, 'Dutchess': {'pop': 297488, 'tracts': 79}, 'Erie': {'pop': 919040, 'tracts': 237}, 'Essex': {'pop': 39370, 'tracts': 13}, 'Franklin': {'pop': 51599, 'tracts': 14}, 'Fulton': {'pop': 55531, 'tracts': 15}, 'Genesee': {'pop': 60079, 'tracts': 15}, 'Greene': {'pop': 49221, 'tracts': 15}, 'Hamilton': {'pop': 4836, 'tracts': 4}, 'Herkimer': {'pop': 64519, 'tracts': 19}, 'Jefferson': {'pop': 116229, 'tracts': 26}, 'Kings': {'pop': 2504700, 'tracts': 760}, 'Lewis': {'pop': 27087, 'tracts': 7}, 'Livingston': {'pop': 65393, 'tracts': 15}, 'Madison': {'pop': 73442, 'tracts': 16}, 'Monroe': {'pop': 744344, 'tracts': 192}, 'Montgomery': {'pop': 50219, 'tracts': 16}, 'Nassau': {'pop': 1339532, 'tracts': 280}, 'New York': {'pop': 1585873, 'tracts': 288}, 'Niagara': {'pop': 216469, 'tracts': 61}, 'Oneida': {'pop': 234878, 'tracts': 74}, 'Onondaga': {'pop': 467026, 'tracts': 140}, 'Ontario': {'pop': 107931, 'tracts': 25}, 'Orange': {'pop': 372813, 'tracts': 79}, 'Orleans': {'pop': 42883, 'tracts': 11}, 'Oswego': {'pop': 122109, 'tracts': 29}, 'Otsego': {'pop': 62259, 'tracts': 17}, 'Putnam': {'pop': 99710, 'tracts': 19}, 'Queens': {'pop': 2230722, 'tracts': 669}, 'Rensselaer': {'pop': 159429, 'tracts': 42}, 'Richmond': {'pop': 468730, 'tracts': 109}, 'Rockland': {'pop': 311687, 'tracts': 65}, 'Saratoga': {'pop': 219607, 'tracts': 50}, 'Schenectady': {'pop': 154727, 'tracts': 43}, 'Schoharie': {'pop': 32749, 'tracts': 8}, 'Schuyler': {'pop': 18343, 'tracts': 5}, 'Seneca': {'pop': 35251, 'tracts': 10}, 'St. Lawrence': {'pop': 111944, 'tracts': 28}, 'Steuben': {'pop': 98990, 'tracts': 30}, 'Suffolk': {'pop': 1493350, 'tracts': 322}, 'Sullivan': {'pop': 77547, 'tracts': 24}, 'Tioga': {'pop': 51125, 'tracts': 10}, 'Tompkins': {'pop': 101564, 'tracts': 23}, 'Ulster': {'pop': 182493, 'tracts': 47}, 'Warren': {'pop': 65707, 'tracts': 19}, 'Washington': {'pop': 63216, 'tracts': 17}, 'Wayne': {'pop': 93772, 'tracts': 23}, 'Westchester': {'pop': 949113, 'tracts': 223}, 'Wyoming': {'pop': 42155, 'tracts': 11}, 'Yates': {'pop': 25348, 'tracts': 5}}, 'OH': {'Adams': {'pop': 28550, 'tracts': 6}, 'Allen': {'pop': 106331, 'tracts': 33}, 'Ashland': {'pop': 53139, 'tracts': 11}, 'Ashtabula': {'pop': 101497, 'tracts': 25}, 'Athens': {'pop': 64757, 'tracts': 15}, 'Auglaize': {'pop': 45949, 'tracts': 11}, 'Belmont': {'pop': 70400, 'tracts': 20}, 'Brown': {'pop': 44846, 'tracts': 9}, 'Butler': {'pop': 368130, 'tracts': 80}, 'Carroll': {'pop': 28836, 'tracts': 7}, 'Champaign': {'pop': 40097, 'tracts': 10}, 'Clark': {'pop': 138333, 'tracts': 44}, 'Clermont': {'pop': 197363, 'tracts': 40}, 'Clinton': {'pop': 42040, 'tracts': 9}, 'Columbiana': {'pop': 107841, 'tracts': 24}, 'Coshocton': {'pop': 36901, 'tracts': 10}, 'Crawford': {'pop': 43784, 'tracts': 13}, 'Cuyahoga': {'pop': 1280122, 'tracts': 447}, 'Darke': {'pop': 52959, 'tracts': 12}, 'Defiance': {'pop': 39037, 'tracts': 9}, 'Delaware': {'pop': 174214, 'tracts': 35}, 'Erie': {'pop': 77079, 'tracts': 19}, 'Fairfield': {'pop': 146156, 'tracts': 28}, 'Fayette': {'pop': 29030, 'tracts': 7}, 'Franklin': {'pop': 1163414, 'tracts': 284}, 'Fulton': {'pop': 42698, 'tracts': 9}, 'Gallia': {'pop': 30934, 'tracts': 7}, 'Geauga': {'pop': 93389, 'tracts': 21}, 'Greene': {'pop': 161573, 'tracts': 35}, 'Guernsey': {'pop': 40087, 'tracts': 10}, 'Hamilton': {'pop': 802374, 'tracts': 222}, 'Hancock': {'pop': 74782, 'tracts': 13}, 'Hardin': {'pop': 32058, 'tracts': 7}, 'Harrison': {'pop': 15864, 'tracts': 5}, 'Henry': {'pop': 28215, 'tracts': 7}, 'Highland': {'pop': 43589, 'tracts': 9}, 'Hocking': {'pop': 29380, 'tracts': 7}, 'Holmes': {'pop': 42366, 'tracts': 8}, 'Huron': {'pop': 59626, 'tracts': 13}, 'Jackson': {'pop': 33225, 'tracts': 7}, 'Jefferson': {'pop': 69709, 'tracts': 23}, 'Knox': {'pop': 60921, 'tracts': 12}, 'Lake': {'pop': 230041, 'tracts': 59}, 'Lawrence': {'pop': 62450, 'tracts': 16}, 'Licking': {'pop': 166492, 'tracts': 32}, 'Logan': {'pop': 45858, 'tracts': 11}, 'Lorain': {'pop': 301356, 'tracts': 73}, 'Lucas': {'pop': 441815, 'tracts': 127}, 'Madison': {'pop': 43435, 'tracts': 12}, 'Mahoning': {'pop': 238823, 'tracts': 70}, 'Marion': {'pop': 66501, 'tracts': 18}, 'Medina': {'pop': 172332, 'tracts': 37}, 'Meigs': {'pop': 23770, 'tracts': 6}, 'Mercer': {'pop': 40814, 'tracts': 9}, 'Miami': {'pop': 102506, 'tracts': 21}, 'Monroe': {'pop': 14642, 'tracts': 4}, 'Montgomery': {'pop': 535153, 'tracts': 153}, 'Morgan': {'pop': 15054, 'tracts': 4}, 'Morrow': {'pop': 34827, 'tracts': 6}, 'Muskingum': {'pop': 86074, 'tracts': 19}, 'Noble': {'pop': 14645, 'tracts': 3}, 'Ottawa': {'pop': 41428, 'tracts': 13}, 'Paulding': {'pop': 19614, 'tracts': 5}, 'Perry': {'pop': 36058, 'tracts': 6}, 'Pickaway': {'pop': 55698, 'tracts': 13}, 'Pike': {'pop': 28709, 'tracts': 6}, 'Portage': {'pop': 161419, 'tracts': 35}, 'Preble': {'pop': 42270, 'tracts': 12}, 'Putnam': {'pop': 34499, 'tracts': 7}, 'Richland': {'pop': 124475, 'tracts': 30}, 'Ross': {'pop': 78064, 'tracts': 17}, 'Sandusky': {'pop': 60944, 'tracts': 15}, 'Scioto': {'pop': 79499, 'tracts': 20}, 'Seneca': {'pop': 56745, 'tracts': 14}, 'Shelby': {'pop': 49423, 'tracts': 10}, 'Stark': {'pop': 375586, 'tracts': 86}, 'Summit': {'pop': 541781, 'tracts': 135}, 'Trumbull': {'pop': 210312, 'tracts': 55}, 'Tuscarawas': {'pop': 92582, 'tracts': 21}, 'Union': {'pop': 52300, 'tracts': 10}, 'Van Wert': {'pop': 28744, 'tracts': 9}, 'Vinton': {'pop': 13435, 'tracts': 3}, 'Warren': {'pop': 212693, 'tracts': 33}, 'Washington': {'pop': 61778, 'tracts': 16}, 'Wayne': {'pop': 114520, 'tracts': 32}, 'Williams': {'pop': 37642, 'tracts': 9}, 'Wood': {'pop': 125488, 'tracts': 28}, 'Wyandot': {'pop': 22615, 'tracts': 6}}, 'OK': {'Adair': {'pop': 22683, 'tracts': 5}, 'Alfalfa': {'pop': 5642, 'tracts': 3}, 'Atoka': {'pop': 14182, 'tracts': 4}, 'Beaver': {'pop': 5636, 'tracts': 3}, 'Beckham': {'pop': 22119, 'tracts': 4}, 'Blaine': {'pop': 11943, 'tracts': 5}, 'Bryan': {'pop': 42416, 'tracts': 11}, 'Caddo': {'pop': 29600, 'tracts': 8}, 'Canadian': {'pop': 115541, 'tracts': 29}, 'Carter': {'pop': 47557, 'tracts': 11}, 'Cherokee': {'pop': 46987, 'tracts': 9}, 'Choctaw': {'pop': 15205, 'tracts': 5}, 'Cimarron': {'pop': 2475, 'tracts': 2}, 'Cleveland': {'pop': 255755, 'tracts': 62}, 'Coal': {'pop': 5925, 'tracts': 2}, 'Comanche': {'pop': 124098, 'tracts': 32}, 'Cotton': {'pop': 6193, 'tracts': 2}, 'Craig': {'pop': 15029, 'tracts': 5}, 'Creek': {'pop': 69967, 'tracts': 21}, 'Custer': {'pop': 27469, 'tracts': 5}, 'Delaware': {'pop': 41487, 'tracts': 9}, 'Dewey': {'pop': 4810, 'tracts': 3}, 'Ellis': {'pop': 4151, 'tracts': 2}, 'Garfield': {'pop': 60580, 'tracts': 12}, 'Garvin': {'pop': 27576, 'tracts': 9}, 'Grady': {'pop': 52431, 'tracts': 10}, 'Grant': {'pop': 4527, 'tracts': 2}, 'Greer': {'pop': 6239, 'tracts': 2}, 'Harmon': {'pop': 2922, 'tracts': 1}, 'Harper': {'pop': 3685, 'tracts': 2}, 'Haskell': {'pop': 12769, 'tracts': 4}, 'Hughes': {'pop': 14003, 'tracts': 5}, 'Jackson': {'pop': 26446, 'tracts': 8}, 'Jefferson': {'pop': 6472, 'tracts': 3}, 'Johnston': {'pop': 10957, 'tracts': 3}, 'Kay': {'pop': 46562, 'tracts': 11}, 'Kingfisher': {'pop': 15034, 'tracts': 4}, 'Kiowa': {'pop': 9446, 'tracts': 3}, 'Latimer': {'pop': 11154, 'tracts': 3}, 'Le Flore': {'pop': 50384, 'tracts': 12}, 'Lincoln': {'pop': 34273, 'tracts': 7}, 'Logan': {'pop': 41848, 'tracts': 8}, 'Love': {'pop': 9423, 'tracts': 3}, 'Major': {'pop': 7527, 'tracts': 3}, 'Marshall': {'pop': 15840, 'tracts': 4}, 'Mayes': {'pop': 41259, 'tracts': 9}, 'McClain': {'pop': 34506, 'tracts': 6}, 'McCurtain': {'pop': 33151, 'tracts': 8}, 'McIntosh': {'pop': 20252, 'tracts': 6}, 'Murray': {'pop': 13488, 'tracts': 3}, 'Muskogee': {'pop': 70990, 'tracts': 16}, 'Noble': {'pop': 11561, 'tracts': 4}, 'Nowata': {'pop': 10536, 'tracts': 4}, 'Okfuskee': {'pop': 12191, 'tracts': 4}, 'Oklahoma': {'pop': 718633, 'tracts': 241}, 'Okmulgee': {'pop': 40069, 'tracts': 10}, 'Osage': {'pop': 47472, 'tracts': 11}, 'Ottawa': {'pop': 31848, 'tracts': 9}, 'Pawnee': {'pop': 16577, 'tracts': 5}, 'Payne': {'pop': 77350, 'tracts': 17}, 'Pittsburg': {'pop': 45837, 'tracts': 13}, 'Pontotoc': {'pop': 37492, 'tracts': 10}, 'Pottawatomie': {'pop': 69442, 'tracts': 16}, 'Pushmataha': {'pop': 11572, 'tracts': 3}, 'Roger Mills': {'pop': 3647, 'tracts': 1}, 'Rogers': {'pop': 86905, 'tracts': 28}, 'Seminole': {'pop': 25482, 'tracts': 9}, 'Sequoyah': {'pop': 42391, 'tracts': 9}, 'Stephens': {'pop': 45048, 'tracts': 11}, 'Texas': {'pop': 20640, 'tracts': 5}, 'Tillman': {'pop': 7992, 'tracts': 5}, 'Tulsa': {'pop': 603403, 'tracts': 175}, 'Wagoner': {'pop': 73085, 'tracts': 22}, 'Washington': {'pop': 50976, 'tracts': 13}, 'Washita': {'pop': 11629, 'tracts': 4}, 'Woods': {'pop': 8878, 'tracts': 3}, 'Woodward': {'pop': 20081, 'tracts': 5}}, 'OR': {'Baker': {'pop': 16134, 'tracts': 6}, 'Benton': {'pop': 85579, 'tracts': 18}, 'Clackamas': {'pop': 375992, 'tracts': 80}, 'Clatsop': {'pop': 37039, 'tracts': 12}, 'Columbia': {'pop': 49351, 'tracts': 10}, 'Coos': {'pop': 63043, 'tracts': 13}, 'Crook': {'pop': 20978, 'tracts': 4}, 'Curry': {'pop': 22364, 'tracts': 6}, 'Deschutes': {'pop': 157733, 'tracts': 24}, 'Douglas': {'pop': 107667, 'tracts': 22}, 'Gilliam': {'pop': 1871, 'tracts': 1}, 'Grant': {'pop': 7445, 'tracts': 2}, 'Harney': {'pop': 7422, 'tracts': 2}, 'Hood River': {'pop': 22346, 'tracts': 4}, 'Jackson': {'pop': 203206, 'tracts': 41}, 'Jefferson': {'pop': 21720, 'tracts': 6}, 'Josephine': {'pop': 82713, 'tracts': 16}, 'Klamath': {'pop': 66380, 'tracts': 20}, 'Lake': {'pop': 7895, 'tracts': 2}, 'Lane': {'pop': 351715, 'tracts': 86}, 'Lincoln': {'pop': 46034, 'tracts': 18}, 'Linn': {'pop': 116672, 'tracts': 21}, 'Malheur': {'pop': 31313, 'tracts': 8}, 'Marion': {'pop': 315335, 'tracts': 58}, 'Morrow': {'pop': 11173, 'tracts': 2}, 'Multnomah': {'pop': 735334, 'tracts': 171}, 'Polk': {'pop': 75403, 'tracts': 12}, 'Sherman': {'pop': 1765, 'tracts': 1}, 'Tillamook': {'pop': 25250, 'tracts': 8}, 'Umatilla': {'pop': 75889, 'tracts': 15}, 'Union': {'pop': 25748, 'tracts': 8}, 'Wallowa': {'pop': 7008, 'tracts': 3}, 'Wasco': {'pop': 25213, 'tracts': 8}, 'Washington': {'pop': 529710, 'tracts': 104}, 'Wheeler': {'pop': 1441, 'tracts': 1}, 'Yamhill': {'pop': 99193, 'tracts': 17}}, 'PA': {'Adams': {'pop': 101407, 'tracts': 23}, 'Allegheny': {'pop': 1223348, 'tracts': 402}, 'Armstrong': {'pop': 68941, 'tracts': 19}, 'Beaver': {'pop': 170539, 'tracts': 51}, 'Bedford': {'pop': 49762, 'tracts': 11}, 'Berks': {'pop': 411442, 'tracts': 90}, 'Blair': {'pop': 127089, 'tracts': 34}, 'Bradford': {'pop': 62622, 'tracts': 14}, 'Bucks': {'pop': 625249, 'tracts': 143}, 'Butler': {'pop': 183862, 'tracts': 44}, 'Cambria': {'pop': 143679, 'tracts': 42}, 'Cameron': {'pop': 5085, 'tracts': 2}, 'Carbon': {'pop': 65249, 'tracts': 12}, 'Centre': {'pop': 153990, 'tracts': 31}, 'Chester': {'pop': 498886, 'tracts': 116}, 'Clarion': {'pop': 39988, 'tracts': 10}, 'Clearfield': {'pop': 81642, 'tracts': 20}, 'Clinton': {'pop': 39238, 'tracts': 9}, 'Columbia': {'pop': 67295, 'tracts': 15}, 'Crawford': {'pop': 88765, 'tracts': 23}, 'Cumberland': {'pop': 235406, 'tracts': 49}, 'Dauphin': {'pop': 268100, 'tracts': 65}, 'Delaware': {'pop': 558979, 'tracts': 144}, 'Elk': {'pop': 31946, 'tracts': 9}, 'Erie': {'pop': 280566, 'tracts': 72}, 'Fayette': {'pop': 136606, 'tracts': 36}, 'Forest': {'pop': 7716, 'tracts': 3}, 'Franklin': {'pop': 149618, 'tracts': 27}, 'Fulton': {'pop': 14845, 'tracts': 3}, 'Greene': {'pop': 38686, 'tracts': 9}, 'Huntingdon': {'pop': 45913, 'tracts': 12}, 'Indiana': {'pop': 88880, 'tracts': 23}, 'Jefferson': {'pop': 45200, 'tracts': 13}, 'Juniata': {'pop': 24636, 'tracts': 5}, 'Lackawanna': {'pop': 214437, 'tracts': 59}, 'Lancaster': {'pop': 519445, 'tracts': 98}, 'Lawrence': {'pop': 91108, 'tracts': 28}, 'Lebanon': {'pop': 133568, 'tracts': 31}, 'Lehigh': {'pop': 349497, 'tracts': 76}, 'Luzerne': {'pop': 320918, 'tracts': 104}, 'Lycoming': {'pop': 116111, 'tracts': 29}, 'McKean': {'pop': 43450, 'tracts': 12}, 'Mercer': {'pop': 116638, 'tracts': 30}, 'Mifflin': {'pop': 46682, 'tracts': 12}, 'Monroe': {'pop': 169842, 'tracts': 33}, 'Montgomery': {'pop': 799874, 'tracts': 211}, 'Montour': {'pop': 18267, 'tracts': 4}, 'Northampton': {'pop': 297735, 'tracts': 68}, 'Northumberland': {'pop': 94528, 'tracts': 24}, 'Perry': {'pop': 45969, 'tracts': 10}, 'Philadelphia': {'pop': 1526006, 'tracts': 384}, 'Pike': {'pop': 57369, 'tracts': 18}, 'Potter': {'pop': 17457, 'tracts': 5}, 'Schuylkill': {'pop': 148289, 'tracts': 40}, 'Snyder': {'pop': 39702, 'tracts': 8}, 'Somerset': {'pop': 77742, 'tracts': 21}, 'Sullivan': {'pop': 6428, 'tracts': 2}, 'Susquehanna': {'pop': 43356, 'tracts': 11}, 'Tioga': {'pop': 41981, 'tracts': 10}, 'Union': {'pop': 44947, 'tracts': 10}, 'Venango': {'pop': 54984, 'tracts': 16}, 'Warren': {'pop': 41815, 'tracts': 13}, 'Washington': {'pop': 207820, 'tracts': 59}, 'Wayne': {'pop': 52822, 'tracts': 14}, 'Westmoreland': {'pop': 365169, 'tracts': 100}, 'Wyoming': {'pop': 28276, 'tracts': 7}, 'York': {'pop': 434972, 'tracts': 90}}, 'RI': {'Bristol': {'pop': 49875, 'tracts': 11}, 'Kent': {'pop': 166158, 'tracts': 39}, 'Newport': {'pop': 82888, 'tracts': 22}, 'Providence': {'pop': 626667, 'tracts': 141}, 'Washington': {'pop': 126979, 'tracts': 29}}, 'SC': {'Abbeville': {'pop': 25417, 'tracts': 6}, 'Aiken': {'pop': 160099, 'tracts': 33}, 'Allendale': {'pop': 10419, 'tracts': 3}, 'Anderson': {'pop': 187126, 'tracts': 39}, 'Bamberg': {'pop': 15987, 'tracts': 4}, 'Barnwell': {'pop': 22621, 'tracts': 6}, 'Beaufort': {'pop': 162233, 'tracts': 41}, 'Berkeley': {'pop': 177843, 'tracts': 45}, 'Calhoun': {'pop': 15175, 'tracts': 3}, 'Charleston': {'pop': 350209, 'tracts': 86}, 'Cherokee': {'pop': 55342, 'tracts': 13}, 'Chester': {'pop': 33140, 'tracts': 11}, 'Chesterfield': {'pop': 46734, 'tracts': 10}, 'Clarendon': {'pop': 34971, 'tracts': 12}, 'Colleton': {'pop': 38892, 'tracts': 10}, 'Darlington': {'pop': 68681, 'tracts': 16}, 'Dillon': {'pop': 32062, 'tracts': 6}, 'Dorchester': {'pop': 136555, 'tracts': 25}, 'Edgefield': {'pop': 26985, 'tracts': 6}, 'Fairfield': {'pop': 23956, 'tracts': 5}, 'Florence': {'pop': 136885, 'tracts': 33}, 'Georgetown': {'pop': 60158, 'tracts': 15}, 'Greenville': {'pop': 451225, 'tracts': 111}, 'Greenwood': {'pop': 69661, 'tracts': 14}, 'Hampton': {'pop': 21090, 'tracts': 5}, 'Horry': {'pop': 269291, 'tracts': 72}, 'Jasper': {'pop': 24777, 'tracts': 5}, 'Kershaw': {'pop': 61697, 'tracts': 15}, 'Lancaster': {'pop': 76652, 'tracts': 14}, 'Laurens': {'pop': 66537, 'tracts': 17}, 'Lee': {'pop': 19220, 'tracts': 7}, 'Lexington': {'pop': 262391, 'tracts': 74}, 'Marion': {'pop': 33062, 'tracts': 8}, 'Marlboro': {'pop': 28933, 'tracts': 7}, 'McCormick': {'pop': 10233, 'tracts': 3}, 'Newberry': {'pop': 37508, 'tracts': 8}, 'Oconee': {'pop': 74273, 'tracts': 15}, 'Orangeburg': {'pop': 92501, 'tracts': 20}, 'Pickens': {'pop': 119224, 'tracts': 28}, 'Richland': {'pop': 384504, 'tracts': 89}, 'Saluda': {'pop': 19875, 'tracts': 5}, 'Spartanburg': {'pop': 284307, 'tracts': 69}, 'Sumter': {'pop': 107456, 'tracts': 23}, 'Union': {'pop': 28961, 'tracts': 9}, 'Williamsburg': {'pop': 34423, 'tracts': 11}, 'York': {'pop': 226073, 'tracts': 46}}, 'SD': {'Aurora': {'pop': 2710, 'tracts': 1}, 'Beadle': {'pop': 17398, 'tracts': 6}, 'Bennett': {'pop': 3431, 'tracts': 2}, 'Bon Homme': {'pop': 7070, 'tracts': 2}, 'Brookings': {'pop': 31965, 'tracts': 6}, 'Brown': {'pop': 36531, 'tracts': 8}, 'Brule': {'pop': 5255, 'tracts': 2}, 'Buffalo': {'pop': 1912, 'tracts': 1}, 'Butte': {'pop': 10110, 'tracts': 2}, 'Campbell': {'pop': 1466, 'tracts': 1}, 'Charles Mix': {'pop': 9129, 'tracts': 3}, 'Clark': {'pop': 3691, 'tracts': 1}, 'Clay': {'pop': 13864, 'tracts': 3}, 'Codington': {'pop': 27227, 'tracts': 7}, 'Corson': {'pop': 4050, 'tracts': 2}, 'Custer': {'pop': 8216, 'tracts': 2}, 'Davison': {'pop': 19504, 'tracts': 4}, 'Day': {'pop': 5710, 'tracts': 3}, 'Deuel': {'pop': 4364, 'tracts': 2}, 'Dewey': {'pop': 5301, 'tracts': 2}, 'Douglas': {'pop': 3002, 'tracts': 1}, 'Edmunds': {'pop': 4071, 'tracts': 2}, 'Fall River': {'pop': 7094, 'tracts': 2}, 'Faulk': {'pop': 2364, 'tracts': 1}, 'Grant': {'pop': 7356, 'tracts': 2}, 'Gregory': {'pop': 4271, 'tracts': 2}, 'Haakon': {'pop': 1937, 'tracts': 1}, 'Hamlin': {'pop': 5903, 'tracts': 2}, 'Hand': {'pop': 3431, 'tracts': 2}, 'Hanson': {'pop': 3331, 'tracts': 1}, 'Harding': {'pop': 1255, 'tracts': 1}, 'Hughes': {'pop': 17022, 'tracts': 4}, 'Hutchinson': {'pop': 7343, 'tracts': 3}, 'Hyde': {'pop': 1420, 'tracts': 1}, 'Jackson': {'pop': 3031, 'tracts': 2}, 'Jerauld': {'pop': 2071, 'tracts': 1}, 'Jones': {'pop': 1006, 'tracts': 1}, 'Kingsbury': {'pop': 5148, 'tracts': 2}, 'Lake': {'pop': 11200, 'tracts': 3}, 'Lawrence': {'pop': 24097, 'tracts': 5}, 'Lincoln': {'pop': 44828, 'tracts': 11}, 'Lyman': {'pop': 3755, 'tracts': 2}, 'Marshall': {'pop': 4656, 'tracts': 1}, 'McCook': {'pop': 5618, 'tracts': 2}, 'McPherson': {'pop': 2459, 'tracts': 1}, 'Meade': {'pop': 25434, 'tracts': 5}, 'Mellette': {'pop': 2048, 'tracts': 1}, 'Miner': {'pop': 2389, 'tracts': 1}, 'Minnehaha': {'pop': 169468, 'tracts': 42}, 'Moody': {'pop': 6486, 'tracts': 2}, 'Pennington': {'pop': 100948, 'tracts': 23}, 'Perkins': {'pop': 2982, 'tracts': 1}, 'Potter': {'pop': 2329, 'tracts': 1}, 'Roberts': {'pop': 10149, 'tracts': 4}, 'Sanborn': {'pop': 2355, 'tracts': 1}, 'Shannon': {'pop': 13586, 'tracts': 3}, 'Spink': {'pop': 6415, 'tracts': 3}, 'Stanley': {'pop': 2966, 'tracts': 1}, 'Sully': {'pop': 1373, 'tracts': 1}, 'Todd': {'pop': 9612, 'tracts': 2}, 'Tripp': {'pop': 5644, 'tracts': 2}, 'Turner': {'pop': 8347, 'tracts': 2}, 'Union': {'pop': 14399, 'tracts': 3}, 'Walworth': {'pop': 5438, 'tracts': 2}, 'Yankton': {'pop': 22438, 'tracts': 5}, 'Ziebach': {'pop': 2801, 'tracts': 1}}, 'TN': {'Anderson': {'pop': 75129, 'tracts': 18}, 'Bedford': {'pop': 45058, 'tracts': 9}, 'Benton': {'pop': 16489, 'tracts': 5}, 'Bledsoe': {'pop': 12876, 'tracts': 3}, 'Blount': {'pop': 123010, 'tracts': 28}, 'Bradley': {'pop': 98963, 'tracts': 19}, 'Campbell': {'pop': 40716, 'tracts': 11}, 'Cannon': {'pop': 13801, 'tracts': 3}, 'Carroll': {'pop': 28522, 'tracts': 8}, 'Carter': {'pop': 57424, 'tracts': 17}, 'Cheatham': {'pop': 39105, 'tracts': 9}, 'Chester': {'pop': 17131, 'tracts': 3}, 'Claiborne': {'pop': 32213, 'tracts': 9}, 'Clay': {'pop': 7861, 'tracts': 2}, 'Cocke': {'pop': 35662, 'tracts': 9}, 'Coffee': {'pop': 52796, 'tracts': 12}, 'Crockett': {'pop': 14586, 'tracts': 5}, 'Cumberland': {'pop': 56053, 'tracts': 14}, 'Davidson': {'pop': 626681, 'tracts': 161}, 'DeKalb': {'pop': 18723, 'tracts': 4}, 'Decatur': {'pop': 11757, 'tracts': 4}, 'Dickson': {'pop': 49666, 'tracts': 10}, 'Dyer': {'pop': 38335, 'tracts': 8}, 'Fayette': {'pop': 38413, 'tracts': 11}, 'Fentress': {'pop': 17959, 'tracts': 4}, 'Franklin': {'pop': 41052, 'tracts': 9}, 'Gibson': {'pop': 49683, 'tracts': 14}, 'Giles': {'pop': 29485, 'tracts': 8}, 'Grainger': {'pop': 22657, 'tracts': 5}, 'Greene': {'pop': 68831, 'tracts': 15}, 'Grundy': {'pop': 13703, 'tracts': 4}, 'Hamblen': {'pop': 62544, 'tracts': 12}, 'Hamilton': {'pop': 336463, 'tracts': 82}, 'Hancock': {'pop': 6819, 'tracts': 2}, 'Hardeman': {'pop': 27253, 'tracts': 6}, 'Hardin': {'pop': 26026, 'tracts': 6}, 'Hawkins': {'pop': 56833, 'tracts': 13}, 'Haywood': {'pop': 18787, 'tracts': 6}, 'Henderson': {'pop': 27769, 'tracts': 6}, 'Henry': {'pop': 32330, 'tracts': 9}, 'Hickman': {'pop': 24690, 'tracts': 6}, 'Houston': {'pop': 8426, 'tracts': 3}, 'Humphreys': {'pop': 18538, 'tracts': 5}, 'Jackson': {'pop': 11638, 'tracts': 4}, 'Jefferson': {'pop': 51407, 'tracts': 9}, 'Johnson': {'pop': 18244, 'tracts': 5}, 'Knox': {'pop': 432226, 'tracts': 112}, 'Lake': {'pop': 7832, 'tracts': 2}, 'Lauderdale': {'pop': 27815, 'tracts': 9}, 'Lawrence': {'pop': 41869, 'tracts': 11}, 'Lewis': {'pop': 12161, 'tracts': 2}, 'Lincoln': {'pop': 33361, 'tracts': 9}, 'Loudon': {'pop': 48556, 'tracts': 10}, 'Macon': {'pop': 22248, 'tracts': 4}, 'Madison': {'pop': 98294, 'tracts': 27}, 'Marion': {'pop': 28237, 'tracts': 6}, 'Marshall': {'pop': 30617, 'tracts': 6}, 'Maury': {'pop': 80956, 'tracts': 17}, 'McMinn': {'pop': 52266, 'tracts': 10}, 'McNairy': {'pop': 26075, 'tracts': 7}, 'Meigs': {'pop': 11753, 'tracts': 3}, 'Monroe': {'pop': 44519, 'tracts': 7}, 'Montgomery': {'pop': 172331, 'tracts': 39}, 'Moore': {'pop': 6362, 'tracts': 2}, 'Morgan': {'pop': 21987, 'tracts': 5}, 'Obion': {'pop': 31807, 'tracts': 10}, 'Overton': {'pop': 22083, 'tracts': 7}, 'Perry': {'pop': 7915, 'tracts': 2}, 'Pickett': {'pop': 5077, 'tracts': 1}, 'Polk': {'pop': 16825, 'tracts': 5}, 'Putnam': {'pop': 72321, 'tracts': 15}, 'Rhea': {'pop': 31809, 'tracts': 6}, 'Roane': {'pop': 54181, 'tracts': 11}, 'Robertson': {'pop': 66283, 'tracts': 14}, 'Rutherford': {'pop': 262604, 'tracts': 49}, 'Scott': {'pop': 22228, 'tracts': 5}, 'Sequatchie': {'pop': 14112, 'tracts': 3}, 'Sevier': {'pop': 89889, 'tracts': 18}, 'Shelby': {'pop': 927644, 'tracts': 221}, 'Smith': {'pop': 19166, 'tracts': 5}, 'Stewart': {'pop': 13324, 'tracts': 5}, 'Sullivan': {'pop': 156823, 'tracts': 39}, 'Sumner': {'pop': 160645, 'tracts': 42}, 'Tipton': {'pop': 61081, 'tracts': 13}, 'Trousdale': {'pop': 7870, 'tracts': 2}, 'Unicoi': {'pop': 18313, 'tracts': 4}, 'Union': {'pop': 19109, 'tracts': 4}, 'Van Buren': {'pop': 5548, 'tracts': 2}, 'Warren': {'pop': 39839, 'tracts': 9}, 'Washington': {'pop': 122979, 'tracts': 23}, 'Wayne': {'pop': 17021, 'tracts': 4}, 'Weakley': {'pop': 35021, 'tracts': 11}, 'White': {'pop': 25841, 'tracts': 6}, 'Williamson': {'pop': 183182, 'tracts': 37}, 'Wilson': {'pop': 113993, 'tracts': 21}}, 'TX': {'Anderson': {'pop': 58458, 'tracts': 11}, 'Andrews': {'pop': 14786, 'tracts': 4}, 'Angelina': {'pop': 86771, 'tracts': 17}, 'Aransas': {'pop': 23158, 'tracts': 5}, 'Archer': {'pop': 9054, 'tracts': 3}, 'Armstrong': {'pop': 1901, 'tracts': 1}, 'Atascosa': {'pop': 44911, 'tracts': 8}, 'Austin': {'pop': 28417, 'tracts': 6}, 'Bailey': {'pop': 7165, 'tracts': 1}, 'Bandera': {'pop': 20485, 'tracts': 5}, 'Bastrop': {'pop': 74171, 'tracts': 10}, 'Baylor': {'pop': 3726, 'tracts': 1}, 'Bee': {'pop': 31861, 'tracts': 7}, 'Bell': {'pop': 310235, 'tracts': 65}, 'Bexar': {'pop': 1714773, 'tracts': 366}, 'Blanco': {'pop': 10497, 'tracts': 2}, 'Borden': {'pop': 641, 'tracts': 1}, 'Bosque': {'pop': 18212, 'tracts': 7}, 'Bowie': {'pop': 92565, 'tracts': 18}, 'Brazoria': {'pop': 313166, 'tracts': 51}, 'Brazos': {'pop': 194851, 'tracts': 42}, 'Brewster': {'pop': 9232, 'tracts': 3}, 'Briscoe': {'pop': 1637, 'tracts': 1}, 'Brooks': {'pop': 7223, 'tracts': 2}, 'Brown': {'pop': 38106, 'tracts': 12}, 'Burleson': {'pop': 17187, 'tracts': 5}, 'Burnet': {'pop': 42750, 'tracts': 8}, 'Caldwell': {'pop': 38066, 'tracts': 8}, 'Calhoun': {'pop': 21381, 'tracts': 6}, 'Callahan': {'pop': 13544, 'tracts': 3}, 'Cameron': {'pop': 406220, 'tracts': 86}, 'Camp': {'pop': 12401, 'tracts': 3}, 'Carson': {'pop': 6182, 'tracts': 2}, 'Cass': {'pop': 30464, 'tracts': 7}, 'Castro': {'pop': 8062, 'tracts': 3}, 'Chambers': {'pop': 35096, 'tracts': 6}, 'Cherokee': {'pop': 50845, 'tracts': 12}, 'Childress': {'pop': 7041, 'tracts': 2}, 'Clay': {'pop': 10752, 'tracts': 3}, 'Cochran': {'pop': 3127, 'tracts': 1}, 'Coke': {'pop': 3320, 'tracts': 2}, 'Coleman': {'pop': 8895, 'tracts': 3}, 'Collin': {'pop': 782341, 'tracts': 152}, 'Collingsworth': {'pop': 3057, 'tracts': 1}, 'Colorado': {'pop': 20874, 'tracts': 5}, 'Comal': {'pop': 108472, 'tracts': 24}, 'Comanche': {'pop': 13974, 'tracts': 4}, 'Concho': {'pop': 4087, 'tracts': 1}, 'Cooke': {'pop': 38437, 'tracts': 8}, 'Coryell': {'pop': 75388, 'tracts': 19}, 'Cottle': {'pop': 1505, 'tracts': 1}, 'Crane': {'pop': 4375, 'tracts': 1}, 'Crockett': {'pop': 3719, 'tracts': 1}, 'Crosby': {'pop': 6059, 'tracts': 3}, 'Culberson': {'pop': 2398, 'tracts': 1}, 'Dallam': {'pop': 6703, 'tracts': 2}, 'Dallas': {'pop': 2368139, 'tracts': 529}, 'Dawson': {'pop': 13833, 'tracts': 4}, 'DeWitt': {'pop': 20097, 'tracts': 5}, 'Deaf Smith': {'pop': 19372, 'tracts': 4}, 'Delta': {'pop': 5231, 'tracts': 2}, 'Denton': {'pop': 662614, 'tracts': 137}, 'Dickens': {'pop': 2444, 'tracts': 1}, 'Dimmit': {'pop': 9996, 'tracts': 2}, 'Donley': {'pop': 3677, 'tracts': 2}, 'Duval': {'pop': 11782, 'tracts': 3}, 'Eastland': {'pop': 18583, 'tracts': 5}, 'Ector': {'pop': 137130, 'tracts': 28}, 'Edwards': {'pop': 2002, 'tracts': 1}, 'El Paso': {'pop': 800647, 'tracts': 161}, 'Ellis': {'pop': 149610, 'tracts': 31}, 'Erath': {'pop': 37890, 'tracts': 8}, 'Falls': {'pop': 17866, 'tracts': 6}, 'Fannin': {'pop': 33915, 'tracts': 9}, 'Fayette': {'pop': 24554, 'tracts': 7}, 'Fisher': {'pop': 3974, 'tracts': 2}, 'Floyd': {'pop': 6446, 'tracts': 2}, 'Foard': {'pop': 1336, 'tracts': 1}, 'Fort Bend': {'pop': 585375, 'tracts': 76}, 'Franklin': {'pop': 10605, 'tracts': 3}, 'Freestone': {'pop': 19816, 'tracts': 7}, 'Frio': {'pop': 17217, 'tracts': 3}, 'Gaines': {'pop': 17526, 'tracts': 3}, 'Galveston': {'pop': 291309, 'tracts': 67}, 'Garza': {'pop': 6461, 'tracts': 1}, 'Gillespie': {'pop': 24837, 'tracts': 5}, 'Glasscock': {'pop': 1226, 'tracts': 1}, 'Goliad': {'pop': 7210, 'tracts': 2}, 'Gonzales': {'pop': 19807, 'tracts': 6}, 'Gray': {'pop': 22535, 'tracts': 7}, 'Grayson': {'pop': 120877, 'tracts': 26}, 'Gregg': {'pop': 121730, 'tracts': 25}, 'Grimes': {'pop': 26604, 'tracts': 6}, 'Guadalupe': {'pop': 131533, 'tracts': 29}, 'Hale': {'pop': 36273, 'tracts': 9}, 'Hall': {'pop': 3353, 'tracts': 1}, 'Hamilton': {'pop': 8517, 'tracts': 3}, 'Hansford': {'pop': 5613, 'tracts': 2}, 'Hardeman': {'pop': 4139, 'tracts': 1}, 'Hardin': {'pop': 54635, 'tracts': 11}, 'Harris': {'pop': 4092459, 'tracts': 786}, 'Harrison': {'pop': 65631, 'tracts': 14}, 'Hartley': {'pop': 6062, 'tracts': 1}, 'Haskell': {'pop': 5899, 'tracts': 2}, 'Hays': {'pop': 157107, 'tracts': 25}, 'Hemphill': {'pop': 3807, 'tracts': 1}, 'Henderson': {'pop': 78532, 'tracts': 17}, 'Hidalgo': {'pop': 774769, 'tracts': 113}, 'Hill': {'pop': 35089, 'tracts': 11}, 'Hockley': {'pop': 22935, 'tracts': 7}, 'Hood': {'pop': 51182, 'tracts': 10}, 'Hopkins': {'pop': 35161, 'tracts': 9}, 'Houston': {'pop': 23732, 'tracts': 7}, 'Howard': {'pop': 35012, 'tracts': 10}, 'Hudspeth': {'pop': 3476, 'tracts': 1}, 'Hunt': {'pop': 86129, 'tracts': 19}, 'Hutchinson': {'pop': 22150, 'tracts': 7}, 'Irion': {'pop': 1599, 'tracts': 1}, 'Jack': {'pop': 9044, 'tracts': 3}, 'Jackson': {'pop': 14075, 'tracts': 3}, 'Jasper': {'pop': 35710, 'tracts': 8}, 'Jeff Davis': {'pop': 2342, 'tracts': 1}, 'Jefferson': {'pop': 252273, 'tracts': 72}, 'Jim Hogg': {'pop': 5300, 'tracts': 2}, 'Jim Wells': {'pop': 40838, 'tracts': 7}, 'Johnson': {'pop': 150934, 'tracts': 28}, 'Jones': {'pop': 20202, 'tracts': 6}, 'Karnes': {'pop': 14824, 'tracts': 4}, 'Kaufman': {'pop': 103350, 'tracts': 18}, 'Kendall': {'pop': 33410, 'tracts': 6}, 'Kenedy': {'pop': 416, 'tracts': 1}, 'Kent': {'pop': 808, 'tracts': 1}, 'Kerr': {'pop': 49625, 'tracts': 10}, 'Kimble': {'pop': 4607, 'tracts': 2}, 'King': {'pop': 286, 'tracts': 1}, 'Kinney': {'pop': 3598, 'tracts': 1}, 'Kleberg': {'pop': 32061, 'tracts': 6}, 'Knox': {'pop': 3719, 'tracts': 2}, 'La Salle': {'pop': 6886, 'tracts': 1}, 'Lamar': {'pop': 49793, 'tracts': 12}, 'Lamb': {'pop': 13977, 'tracts': 5}, 'Lampasas': {'pop': 19677, 'tracts': 5}, 'Lavaca': {'pop': 19263, 'tracts': 6}, 'Lee': {'pop': 16612, 'tracts': 4}, 'Leon': {'pop': 16801, 'tracts': 3}, 'Liberty': {'pop': 75643, 'tracts': 14}, 'Limestone': {'pop': 23384, 'tracts': 8}, 'Lipscomb': {'pop': 3302, 'tracts': 2}, 'Live Oak': {'pop': 11531, 'tracts': 4}, 'Llano': {'pop': 19301, 'tracts': 6}, 'Loving': {'pop': 82, 'tracts': 1}, 'Lubbock': {'pop': 278831, 'tracts': 68}, 'Lynn': {'pop': 5915, 'tracts': 3}, 'Madison': {'pop': 13664, 'tracts': 4}, 'Marion': {'pop': 10546, 'tracts': 4}, 'Martin': {'pop': 4799, 'tracts': 2}, 'Mason': {'pop': 4012, 'tracts': 2}, 'Matagorda': {'pop': 36702, 'tracts': 10}, 'Maverick': {'pop': 54258, 'tracts': 9}, 'McCulloch': {'pop': 8283, 'tracts': 3}, 'McLennan': {'pop': 234906, 'tracts': 51}, 'McMullen': {'pop': 707, 'tracts': 1}, 'Medina': {'pop': 46006, 'tracts': 8}, 'Menard': {'pop': 2242, 'tracts': 1}, 'Midland': {'pop': 136872, 'tracts': 27}, 'Milam': {'pop': 24757, 'tracts': 7}, 'Mills': {'pop': 4936, 'tracts': 2}, 'Mitchell': {'pop': 9403, 'tracts': 2}, 'Montague': {'pop': 19719, 'tracts': 6}, 'Montgomery': {'pop': 455746, 'tracts': 59}, 'Moore': {'pop': 21904, 'tracts': 4}, 'Morris': {'pop': 12934, 'tracts': 3}, 'Motley': {'pop': 1210, 'tracts': 1}, 'Nacogdoches': {'pop': 64524, 'tracts': 13}, 'Navarro': {'pop': 47735, 'tracts': 10}, 'Newton': {'pop': 14445, 'tracts': 4}, 'Nolan': {'pop': 15216, 'tracts': 5}, 'Nueces': {'pop': 340223, 'tracts': 81}, 'Ochiltree': {'pop': 10223, 'tracts': 3}, 'Oldham': {'pop': 2052, 'tracts': 1}, 'Orange': {'pop': 81837, 'tracts': 21}, 'Palo Pinto': {'pop': 28111, 'tracts': 9}, 'Panola': {'pop': 23796, 'tracts': 6}, 'Parker': {'pop': 116927, 'tracts': 19}, 'Parmer': {'pop': 10269, 'tracts': 2}, 'Pecos': {'pop': 15507, 'tracts': 4}, 'Polk': {'pop': 45413, 'tracts': 10}, 'Potter': {'pop': 121073, 'tracts': 34}, 'Presidio': {'pop': 7818, 'tracts': 2}, 'Rains': {'pop': 10914, 'tracts': 2}, 'Randall': {'pop': 120725, 'tracts': 29}, 'Reagan': {'pop': 3367, 'tracts': 1}, 'Real': {'pop': 3309, 'tracts': 1}, 'Red River': {'pop': 12860, 'tracts': 4}, 'Reeves': {'pop': 13783, 'tracts': 5}, 'Refugio': {'pop': 7383, 'tracts': 2}, 'Roberts': {'pop': 929, 'tracts': 1}, 'Robertson': {'pop': 16622, 'tracts': 5}, 'Rockwall': {'pop': 78337, 'tracts': 11}, 'Runnels': {'pop': 10501, 'tracts': 4}, 'Rusk': {'pop': 53330, 'tracts': 13}, 'Sabine': {'pop': 10834, 'tracts': 3}, 'San Augustine': {'pop': 8865, 'tracts': 3}, 'San Jacinto': {'pop': 26384, 'tracts': 4}, 'San Patricio': {'pop': 64804, 'tracts': 16}, 'San Saba': {'pop': 6131, 'tracts': 2}, 'Schleicher': {'pop': 3461, 'tracts': 1}, 'Scurry': {'pop': 16921, 'tracts': 4}, 'Shackelford': {'pop': 3378, 'tracts': 1}, 'Shelby': {'pop': 25448, 'tracts': 6}, 'Sherman': {'pop': 3034, 'tracts': 1}, 'Smith': {'pop': 209714, 'tracts': 41}, 'Somervell': {'pop': 8490, 'tracts': 2}, 'Starr': {'pop': 60968, 'tracts': 15}, 'Stephens': {'pop': 9630, 'tracts': 3}, 'Sterling': {'pop': 1143, 'tracts': 1}, 'Stonewall': {'pop': 1490, 'tracts': 1}, 'Sutton': {'pop': 4128, 'tracts': 1}, 'Swisher': {'pop': 7854, 'tracts': 3}, 'Tarrant': {'pop': 1809034, 'tracts': 357}, 'Taylor': {'pop': 131506, 'tracts': 38}, 'Terrell': {'pop': 984, 'tracts': 1}, 'Terry': {'pop': 12651, 'tracts': 3}, 'Throckmorton': {'pop': 1641, 'tracts': 1}, 'Titus': {'pop': 32334, 'tracts': 8}, 'Tom Green': {'pop': 110224, 'tracts': 25}, 'Travis': {'pop': 1024266, 'tracts': 218}, 'Trinity': {'pop': 14585, 'tracts': 5}, 'Tyler': {'pop': 21766, 'tracts': 5}, 'Upshur': {'pop': 39309, 'tracts': 7}, 'Upton': {'pop': 3355, 'tracts': 2}, 'Uvalde': {'pop': 26405, 'tracts': 5}, 'Val Verde': {'pop': 48879, 'tracts': 10}, 'Van Zandt': {'pop': 52579, 'tracts': 10}, 'Victoria': {'pop': 86793, 'tracts': 23}, 'Walker': {'pop': 67861, 'tracts': 10}, 'Waller': {'pop': 43205, 'tracts': 6}, 'Ward': {'pop': 10658, 'tracts': 3}, 'Washington': {'pop': 33718, 'tracts': 6}, 'Webb': {'pop': 250304, 'tracts': 61}, 'Wharton': {'pop': 41280, 'tracts': 11}, 'Wheeler': {'pop': 5410, 'tracts': 2}, 'Wichita': {'pop': 131500, 'tracts': 37}, 'Wilbarger': {'pop': 13535, 'tracts': 4}, 'Willacy': {'pop': 22134, 'tracts': 6}, 'Williamson': {'pop': 422679, 'tracts': 89}, 'Wilson': {'pop': 42918, 'tracts': 11}, 'Winkler': {'pop': 7110, 'tracts': 3}, 'Wise': {'pop': 59127, 'tracts': 11}, 'Wood': {'pop': 41964, 'tracts': 10}, 'Yoakum': {'pop': 7879, 'tracts': 2}, 'Young': {'pop': 18550, 'tracts': 4}, 'Zapata': {'pop': 14018, 'tracts': 3}, 'Zavala': {'pop': 11677, 'tracts': 4}}, 'UT': {'Beaver': {'pop': 6629, 'tracts': 2}, 'Box Elder': {'pop': 49975, 'tracts': 11}, 'Cache': {'pop': 112656, 'tracts': 26}, 'Carbon': {'pop': 21403, 'tracts': 5}, 'Daggett': {'pop': 1059, 'tracts': 1}, 'Davis': {'pop': 306479, 'tracts': 54}, 'Duchesne': {'pop': 18607, 'tracts': 3}, 'Emery': {'pop': 10976, 'tracts': 3}, 'Garfield': {'pop': 5172, 'tracts': 2}, 'Grand': {'pop': 9225, 'tracts': 2}, 'Iron': {'pop': 46163, 'tracts': 8}, 'Juab': {'pop': 10246, 'tracts': 2}, 'Kane': {'pop': 7125, 'tracts': 2}, 'Millard': {'pop': 12503, 'tracts': 3}, 'Morgan': {'pop': 9469, 'tracts': 2}, 'Piute': {'pop': 1556, 'tracts': 1}, 'Rich': {'pop': 2264, 'tracts': 1}, 'Salt Lake': {'pop': 1029655, 'tracts': 212}, 'San Juan': {'pop': 14746, 'tracts': 4}, 'Sanpete': {'pop': 27822, 'tracts': 5}, 'Sevier': {'pop': 20802, 'tracts': 5}, 'Summit': {'pop': 36324, 'tracts': 13}, 'Tooele': {'pop': 58218, 'tracts': 11}, 'Uintah': {'pop': 32588, 'tracts': 6}, 'Utah': {'pop': 516564, 'tracts': 128}, 'Wasatch': {'pop': 23530, 'tracts': 4}, 'Washington': {'pop': 138115, 'tracts': 21}, 'Wayne': {'pop': 2778, 'tracts': 1}, 'Weber': {'pop': 231236, 'tracts': 50}}, 'VA': {'Accomack': {'pop': 33164, 'tracts': 11}, 'Albemarle': {'pop': 98970, 'tracts': 22}, 'Alexandria': {'pop': 139966, 'tracts': 38}, 'Alleghany': {'pop': 16250, 'tracts': 6}, 'Amelia': {'pop': 12690, 'tracts': 2}, 'Amherst': {'pop': 32353, 'tracts': 9}, 'Appomattox': {'pop': 14973, 'tracts': 3}, 'Arlington': {'pop': 207627, 'tracts': 59}, 'Augusta': {'pop': 73750, 'tracts': 13}, 'Bath': {'pop': 4731, 'tracts': 1}, 'Bedford': {'pop': 68676, 'tracts': 16}, 'Bedford City': {'pop': 6222, 'tracts': 1}, 'Bland': {'pop': 6824, 'tracts': 2}, 'Botetourt': {'pop': 33148, 'tracts': 8}, 'Bristol': {'pop': 17835, 'tracts': 4}, 'Brunswick': {'pop': 17434, 'tracts': 5}, 'Buchanan': {'pop': 24098, 'tracts': 7}, 'Buckingham': {'pop': 17146, 'tracts': 4}, 'Buena Vista': {'pop': 6650, 'tracts': 1}, 'Campbell': {'pop': 54842, 'tracts': 12}, 'Caroline': {'pop': 28545, 'tracts': 7}, 'Carroll': {'pop': 30042, 'tracts': 7}, 'Charles City': {'pop': 7256, 'tracts': 3}, 'Charlotte': {'pop': 12586, 'tracts': 3}, 'Charlottesville': {'pop': 43475, 'tracts': 12}, 'Chesapeake': {'pop': 222209, 'tracts': 41}, 'Chesterfield': {'pop': 316236, 'tracts': 71}, 'Clarke': {'pop': 14034, 'tracts': 3}, 'Colonial Heights': {'pop': 17411, 'tracts': 5}, 'Covington': {'pop': 5961, 'tracts': 2}, 'Craig': {'pop': 5190, 'tracts': 1}, 'Culpeper': {'pop': 46689, 'tracts': 8}, 'Cumberland': {'pop': 10052, 'tracts': 2}, 'Danville': {'pop': 43055, 'tracts': 16}, 'Dickenson': {'pop': 15903, 'tracts': 4}, 'Dinwiddie': {'pop': 28001, 'tracts': 7}, 'Emporia': {'pop': 5927, 'tracts': 2}, 'Essex': {'pop': 11151, 'tracts': 3}, 'Fairfax': {'pop': 1081726, 'tracts': 258}, 'Fairfax City': {'pop': 22565, 'tracts': 5}, 'Falls Church': {'pop': 12332, 'tracts': 3}, 'Fauquier': {'pop': 65203, 'tracts': 17}, 'Floyd': {'pop': 15279, 'tracts': 3}, 'Fluvanna': {'pop': 25691, 'tracts': 4}, 'Franklin': {'pop': 56159, 'tracts': 10}, 'Franklin City': {'pop': 8582, 'tracts': 2}, 'Frederick': {'pop': 78305, 'tracts': 14}, 'Fredericksburg': {'pop': 24286, 'tracts': 6}, 'Galax': {'pop': 7042, 'tracts': 2}, 'Giles': {'pop': 17286, 'tracts': 4}, 'Gloucester': {'pop': 36858, 'tracts': 8}, 'Goochland': {'pop': 21717, 'tracts': 5}, 'Grayson': {'pop': 15533, 'tracts': 5}, 'Greene': {'pop': 18403, 'tracts': 3}, 'Greensville': {'pop': 12243, 'tracts': 3}, 'Halifax': {'pop': 36241, 'tracts': 9}, 'Hampton': {'pop': 137436, 'tracts': 34}, 'Hanover': {'pop': 99863, 'tracts': 23}, 'Harrisonburg': {'pop': 48914, 'tracts': 11}, 'Henrico': {'pop': 306935, 'tracts': 64}, 'Henry': {'pop': 54151, 'tracts': 14}, 'Highland': {'pop': 2321, 'tracts': 1}, 'Hopewell': {'pop': 22591, 'tracts': 7}, 'Isle of Wight': {'pop': 35270, 'tracts': 8}, 'James City': {'pop': 67009, 'tracts': 11}, 'King George': {'pop': 23584, 'tracts': 5}, 'King William': {'pop': 15935, 'tracts': 4}, 'King and Queen': {'pop': 6945, 'tracts': 2}, 'Lancaster': {'pop': 11391, 'tracts': 3}, 'Lee': {'pop': 25587, 'tracts': 6}, 'Lexington': {'pop': 7042, 'tracts': 1}, 'Loudoun': {'pop': 312311, 'tracts': 65}, 'Louisa': {'pop': 33153, 'tracts': 6}, 'Lunenburg': {'pop': 12914, 'tracts': 3}, 'Lynchburg': {'pop': 75568, 'tracts': 19}, 'Madison': {'pop': 13308, 'tracts': 2}, 'Manassas': {'pop': 37821, 'tracts': 7}, 'Manassas Park': {'pop': 14273, 'tracts': 2}, 'Martinsville': {'pop': 13821, 'tracts': 5}, 'Mathews': {'pop': 8978, 'tracts': 2}, 'Mecklenburg': {'pop': 32727, 'tracts': 9}, 'Middlesex': {'pop': 10959, 'tracts': 4}, 'Montgomery': {'pop': 94392, 'tracts': 16}, 'Nelson': {'pop': 15020, 'tracts': 3}, 'New Kent': {'pop': 18429, 'tracts': 3}, 'Newport News': {'pop': 180719, 'tracts': 44}, 'Norfolk': {'pop': 242803, 'tracts': 81}, 'Northampton': {'pop': 12389, 'tracts': 4}, 'Northumberland': {'pop': 12330, 'tracts': 3}, 'Norton': {'pop': 3958, 'tracts': 1}, 'Nottoway': {'pop': 15853, 'tracts': 4}, 'Orange': {'pop': 33481, 'tracts': 5}, 'Page': {'pop': 24042, 'tracts': 5}, 'Patrick': {'pop': 18490, 'tracts': 4}, 'Petersburg': {'pop': 32420, 'tracts': 11}, 'Pittsylvania': {'pop': 63506, 'tracts': 16}, 'Poquoson': {'pop': 12150, 'tracts': 3}, 'Portsmouth': {'pop': 95535, 'tracts': 31}, 'Powhatan': {'pop': 28046, 'tracts': 5}, 'Prince Edward': {'pop': 23368, 'tracts': 5}, 'Prince George': {'pop': 35725, 'tracts': 7}, 'Prince William': {'pop': 402002, 'tracts': 83}, 'Pulaski': {'pop': 34872, 'tracts': 10}, 'Radford': {'pop': 16408, 'tracts': 3}, 'Rappahannock': {'pop': 7373, 'tracts': 2}, 'Richmond': {'pop': 9254, 'tracts': 2}, 'Richmond City': {'pop': 204214, 'tracts': 66}, 'Roanoke': {'pop': 92376, 'tracts': 18}, 'Roanoke City': {'pop': 97032, 'tracts': 23}, 'Rockbridge': {'pop': 22307, 'tracts': 4}, 'Rockingham': {'pop': 76314, 'tracts': 19}, 'Russell': {'pop': 28897, 'tracts': 7}, 'Salem': {'pop': 24802, 'tracts': 5}, 'Scott': {'pop': 23177, 'tracts': 6}, 'Shenandoah': {'pop': 41993, 'tracts': 9}, 'Smyth': {'pop': 32208, 'tracts': 9}, 'Southampton': {'pop': 18570, 'tracts': 5}, 'Spotsylvania': {'pop': 122397, 'tracts': 30}, 'Stafford': {'pop': 128961, 'tracts': 27}, 'Staunton': {'pop': 23746, 'tracts': 6}, 'Suffolk': {'pop': 84585, 'tracts': 28}, 'Surry': {'pop': 7058, 'tracts': 2}, 'Sussex': {'pop': 12087, 'tracts': 5}, 'Tazewell': {'pop': 45078, 'tracts': 11}, 'Virginia Beach': {'pop': 437994, 'tracts': 100}, 'Warren': {'pop': 37575, 'tracts': 8}, 'Washington': {'pop': 54876, 'tracts': 13}, 'Waynesboro': {'pop': 21006, 'tracts': 5}, 'Westmoreland': {'pop': 17454, 'tracts': 4}, 'Williamsburg': {'pop': 14068, 'tracts': 3}, 'Winchester': {'pop': 26203, 'tracts': 5}, 'Wise': {'pop': 41452, 'tracts': 11}, 'Wythe': {'pop': 29235, 'tracts': 6}, 'York': {'pop': 65464, 'tracts': 14}}, 'VT': {'Addison': {'pop': 36821, 'tracts': 10}, 'Bennington': {'pop': 37125, 'tracts': 12}, 'Caledonia': {'pop': 31227, 'tracts': 10}, 'Chittenden': {'pop': 156545, 'tracts': 35}, 'Essex': {'pop': 6306, 'tracts': 3}, 'Franklin': {'pop': 47746, 'tracts': 10}, 'Grand Isle': {'pop': 6970, 'tracts': 2}, 'Lamoille': {'pop': 24475, 'tracts': 7}, 'Orange': {'pop': 28936, 'tracts': 10}, 'Orleans': {'pop': 27231, 'tracts': 10}, 'Rutland': {'pop': 61642, 'tracts': 20}, 'Washington': {'pop': 59534, 'tracts': 19}, 'Windham': {'pop': 44513, 'tracts': 18}, 'Windsor': {'pop': 56670, 'tracts': 18}}, 'WA': {'Adams': {'pop': 18728, 'tracts': 5}, 'Asotin': {'pop': 21623, 'tracts': 6}, 'Benton': {'pop': 175177, 'tracts': 37}, 'Chelan': {'pop': 72453, 'tracts': 14}, 'Clallam': {'pop': 71404, 'tracts': 22}, 'Clark': {'pop': 425363, 'tracts': 104}, 'Columbia': {'pop': 4078, 'tracts': 1}, 'Cowlitz': {'pop': 102410, 'tracts': 24}, 'Douglas': {'pop': 38431, 'tracts': 8}, 'Ferry': {'pop': 7551, 'tracts': 3}, 'Franklin': {'pop': 78163, 'tracts': 13}, 'Garfield': {'pop': 2266, 'tracts': 1}, 'Grant': {'pop': 89120, 'tracts': 16}, 'Grays Harbor': {'pop': 72797, 'tracts': 17}, 'Island': {'pop': 78506, 'tracts': 22}, 'Jefferson': {'pop': 29872, 'tracts': 7}, 'King': {'pop': 1931249, 'tracts': 397}, 'Kitsap': {'pop': 251133, 'tracts': 55}, 'Kittitas': {'pop': 40915, 'tracts': 8}, 'Klickitat': {'pop': 20318, 'tracts': 3}, 'Lewis': {'pop': 75455, 'tracts': 20}, 'Lincoln': {'pop': 10570, 'tracts': 4}, 'Mason': {'pop': 60699, 'tracts': 14}, 'Okanogan': {'pop': 41120, 'tracts': 10}, 'Pacific': {'pop': 20920, 'tracts': 8}, 'Pend Oreille': {'pop': 13001, 'tracts': 5}, 'Pierce': {'pop': 795225, 'tracts': 172}, 'San Juan': {'pop': 15769, 'tracts': 5}, 'Skagit': {'pop': 116901, 'tracts': 30}, 'Skamania': {'pop': 11066, 'tracts': 5}, 'Snohomish': {'pop': 713335, 'tracts': 151}, 'Spokane': {'pop': 471221, 'tracts': 105}, 'Stevens': {'pop': 43531, 'tracts': 12}, 'Thurston': {'pop': 252264, 'tracts': 49}, 'Wahkiakum': {'pop': 3978, 'tracts': 1}, 'Walla Walla': {'pop': 58781, 'tracts': 12}, 'Whatcom': {'pop': 201140, 'tracts': 34}, 'Whitman': {'pop': 44776, 'tracts': 10}, 'Yakima': {'pop': 243231, 'tracts': 45}}, 'WI': {'Adams': {'pop': 20875, 'tracts': 7}, 'Ashland': {'pop': 16157, 'tracts': 7}, 'Barron': {'pop': 45870, 'tracts': 10}, 'Bayfield': {'pop': 15014, 'tracts': 5}, 'Brown': {'pop': 248007, 'tracts': 54}, 'Buffalo': {'pop': 13587, 'tracts': 5}, 'Burnett': {'pop': 15457, 'tracts': 6}, 'Calumet': {'pop': 48971, 'tracts': 11}, 'Chippewa': {'pop': 62415, 'tracts': 11}, 'Clark': {'pop': 34690, 'tracts': 8}, 'Columbia': {'pop': 56833, 'tracts': 12}, 'Crawford': {'pop': 16644, 'tracts': 6}, 'Dane': {'pop': 488073, 'tracts': 107}, 'Dodge': {'pop': 88759, 'tracts': 20}, 'Door': {'pop': 27785, 'tracts': 9}, 'Douglas': {'pop': 44159, 'tracts': 12}, 'Dunn': {'pop': 43857, 'tracts': 8}, 'Eau Claire': {'pop': 98736, 'tracts': 20}, 'Florence': {'pop': 4423, 'tracts': 2}, 'Fond du Lac': {'pop': 101633, 'tracts': 20}, 'Forest': {'pop': 9304, 'tracts': 4}, 'Grant': {'pop': 51208, 'tracts': 12}, 'Green': {'pop': 36842, 'tracts': 8}, 'Green Lake': {'pop': 19051, 'tracts': 6}, 'Iowa': {'pop': 23687, 'tracts': 6}, 'Iron': {'pop': 5916, 'tracts': 3}, 'Jackson': {'pop': 20449, 'tracts': 5}, 'Jefferson': {'pop': 83686, 'tracts': 20}, 'Juneau': {'pop': 26664, 'tracts': 7}, 'Kenosha': {'pop': 166426, 'tracts': 35}, 'Kewaunee': {'pop': 20574, 'tracts': 4}, 'La Crosse': {'pop': 114638, 'tracts': 25}, 'Lafayette': {'pop': 16836, 'tracts': 5}, 'Langlade': {'pop': 19977, 'tracts': 6}, 'Lincoln': {'pop': 28743, 'tracts': 10}, 'Manitowoc': {'pop': 81442, 'tracts': 19}, 'Marathon': {'pop': 134063, 'tracts': 27}, 'Marinette': {'pop': 41749, 'tracts': 12}, 'Marquette': {'pop': 15404, 'tracts': 5}, 'Menominee': {'pop': 4232, 'tracts': 2}, 'Milwaukee': {'pop': 947735, 'tracts': 297}, 'Monroe': {'pop': 44673, 'tracts': 9}, 'Oconto': {'pop': 37660, 'tracts': 10}, 'Oneida': {'pop': 35998, 'tracts': 14}, 'Outagamie': {'pop': 176695, 'tracts': 40}, 'Ozaukee': {'pop': 86395, 'tracts': 18}, 'Pepin': {'pop': 7469, 'tracts': 2}, 'Pierce': {'pop': 41019, 'tracts': 8}, 'Polk': {'pop': 44205, 'tracts': 10}, 'Portage': {'pop': 70019, 'tracts': 14}, 'Price': {'pop': 14159, 'tracts': 6}, 'Racine': {'pop': 195408, 'tracts': 44}, 'Richland': {'pop': 18021, 'tracts': 5}, 'Rock': {'pop': 160331, 'tracts': 38}, 'Rusk': {'pop': 14755, 'tracts': 5}, 'Sauk': {'pop': 61976, 'tracts': 13}, 'Sawyer': {'pop': 16557, 'tracts': 6}, 'Shawano': {'pop': 41949, 'tracts': 11}, 'Sheboygan': {'pop': 115507, 'tracts': 26}, 'St. Croix': {'pop': 84345, 'tracts': 14}, 'Taylor': {'pop': 20689, 'tracts': 6}, 'Trempealeau': {'pop': 28816, 'tracts': 8}, 'Vernon': {'pop': 29773, 'tracts': 7}, 'Vilas': {'pop': 21430, 'tracts': 5}, 'Walworth': {'pop': 102228, 'tracts': 22}, 'Washburn': {'pop': 15911, 'tracts': 5}, 'Washington': {'pop': 131887, 'tracts': 28}, 'Waukesha': {'pop': 389891, 'tracts': 86}, 'Waupaca': {'pop': 52410, 'tracts': 12}, 'Waushara': {'pop': 24496, 'tracts': 7}, 'Winnebago': {'pop': 166994, 'tracts': 41}, 'Wood': {'pop': 74749, 'tracts': 17}}, 'WV': {'Barbour': {'pop': 16589, 'tracts': 4}, 'Berkeley': {'pop': 104169, 'tracts': 14}, 'Boone': {'pop': 24629, 'tracts': 8}, 'Braxton': {'pop': 14523, 'tracts': 3}, 'Brooke': {'pop': 24069, 'tracts': 6}, 'Cabell': {'pop': 96319, 'tracts': 29}, 'Calhoun': {'pop': 7627, 'tracts': 2}, 'Clay': {'pop': 9386, 'tracts': 3}, 'Doddridge': {'pop': 8202, 'tracts': 2}, 'Fayette': {'pop': 46039, 'tracts': 12}, 'Gilmer': {'pop': 8693, 'tracts': 2}, 'Grant': {'pop': 11937, 'tracts': 3}, 'Greenbrier': {'pop': 35480, 'tracts': 7}, 'Hampshire': {'pop': 23964, 'tracts': 5}, 'Hancock': {'pop': 30676, 'tracts': 8}, 'Hardy': {'pop': 14025, 'tracts': 3}, 'Harrison': {'pop': 69099, 'tracts': 22}, 'Jackson': {'pop': 29211, 'tracts': 6}, 'Jefferson': {'pop': 53498, 'tracts': 15}, 'Kanawha': {'pop': 193063, 'tracts': 53}, 'Lewis': {'pop': 16372, 'tracts': 5}, 'Lincoln': {'pop': 21720, 'tracts': 5}, 'Logan': {'pop': 36743, 'tracts': 9}, 'Marion': {'pop': 56418, 'tracts': 18}, 'Marshall': {'pop': 33107, 'tracts': 9}, 'Mason': {'pop': 27324, 'tracts': 6}, 'McDowell': {'pop': 22113, 'tracts': 8}, 'Mercer': {'pop': 62264, 'tracts': 16}, 'Mineral': {'pop': 28212, 'tracts': 7}, 'Mingo': {'pop': 26839, 'tracts': 7}, 'Monongalia': {'pop': 96189, 'tracts': 24}, 'Monroe': {'pop': 13502, 'tracts': 3}, 'Morgan': {'pop': 17541, 'tracts': 4}, 'Nicholas': {'pop': 26233, 'tracts': 7}, 'Ohio': {'pop': 44443, 'tracts': 18}, 'Pendleton': {'pop': 7695, 'tracts': 3}, 'Pleasants': {'pop': 7605, 'tracts': 2}, 'Pocahontas': {'pop': 8719, 'tracts': 4}, 'Preston': {'pop': 33520, 'tracts': 8}, 'Putnam': {'pop': 55486, 'tracts': 10}, 'Raleigh': {'pop': 78859, 'tracts': 17}, 'Randolph': {'pop': 29405, 'tracts': 7}, 'Ritchie': {'pop': 10449, 'tracts': 3}, 'Roane': {'pop': 14926, 'tracts': 4}, 'Summers': {'pop': 13927, 'tracts': 4}, 'Taylor': {'pop': 16895, 'tracts': 4}, 'Tucker': {'pop': 7141, 'tracts': 3}, 'Tyler': {'pop': 9208, 'tracts': 3}, 'Upshur': {'pop': 24254, 'tracts': 6}, 'Wayne': {'pop': 42481, 'tracts': 11}, 'Webster': {'pop': 9154, 'tracts': 3}, 'Wetzel': {'pop': 16583, 'tracts': 5}, 'Wirt': {'pop': 5717, 'tracts': 2}, 'Wood': {'pop': 86956, 'tracts': 26}, 'Wyoming': {'pop': 23796, 'tracts': 6}}, 'WY': {'Albany': {'pop': 36299, 'tracts': 10}, 'Big Horn': {'pop': 11668, 'tracts': 3}, 'Campbell': {'pop': 46133, 'tracts': 7}, 'Carbon': {'pop': 15885, 'tracts': 5}, 'Converse': {'pop': 13833, 'tracts': 4}, 'Crook': {'pop': 7083, 'tracts': 2}, 'Fremont': {'pop': 40123, 'tracts': 10}, 'Goshen': {'pop': 13249, 'tracts': 4}, 'Hot Springs': {'pop': 4812, 'tracts': 2}, 'Johnson': {'pop': 8569, 'tracts': 2}, 'Laramie': {'pop': 91738, 'tracts': 21}, 'Lincoln': {'pop': 18106, 'tracts': 4}, 'Natrona': {'pop': 75450, 'tracts': 18}, 'Niobrara': {'pop': 2484, 'tracts': 1}, 'Park': {'pop': 28205, 'tracts': 5}, 'Platte': {'pop': 8667, 'tracts': 2}, 'Sheridan': {'pop': 29116, 'tracts': 6}, 'Sublette': {'pop': 10247, 'tracts': 2}, 'Sweetwater': {'pop': 43806, 'tracts': 12}, 'Teton': {'pop': 21294, 'tracts': 4}, 'Uinta': {'pop': 21118, 'tracts': 3}, 'Washakie': {'pop': 8533, 'tracts': 3}, 'Weston': {'pop': 7208, 'tracts': 2}}}
49.436526
65
0.452481
16,002
155,379
4.393576
0.325772
0.032259
0.001067
0.00128
0.000512
0
0
0
0
0
0
0.180156
0.282664
155,379
3,143
66
49.436526
0.450623
0
0
0
0
0
0.331593
0
0
0
0
0
0
1
0
false
0.000318
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
fbdcdec6f6daabaf8ab83907c267233eb37da60d
4,276
py
Python
Groups/Group_ID_18/CWMVFE.py
shekhar-sharma/DataScience
1fd771f873a9bc0800458fd7c05e228bb6c4e8a0
[ "MIT" ]
5
2020-12-13T07:53:22.000Z
2020-12-20T18:49:27.000Z
Groups/Group_ID_18/CWMVFE.py
Gulnaz-Tabassum/DataScience
1fd771f873a9bc0800458fd7c05e228bb6c4e8a0
[ "MIT" ]
null
null
null
Groups/Group_ID_18/CWMVFE.py
Gulnaz-Tabassum/DataScience
1fd771f873a9bc0800458fd7c05e228bb6c4e8a0
[ "MIT" ]
24
2020-12-12T11:23:28.000Z
2021-10-04T13:09:38.000Z
#MCCA (Multiview Canonical Correlation Analysis) import numpy as np from scipy import linalg as lin from sklearn.preprocessing import StandardScaler from sklearn.neighbors import KNeighborsClassifier class CWMVFE: def __init__(self,n_components=2,reg_param=0.01 , L): self.n_components = n_components self.reg_param = reg_param self.dimen = [] self.C = [[]] #covariance matix #To normalize data so that mean=0 and std dev=1 def normalize(self,X): return StandardScaler().fit_transform(X) #for adding regularization parameter def add_reg_param(self,c): I = np.identity(c.shape[0]) R = np.dot(self.reg_param,I) c = c+R return c #for calculating covariance matrix def cov_mat(self,X_list): views = len(X_list) N = len(X_list[0]) C = [[np.array([]) for i in range(views)] for j in range(views)] for i in range(views): for j in range(views): C[i][j]=np.dot(X_list[i].T,X_list[j]) C[i][j]=np.divide(C[i][j],float(N)) if i==j: C[i][j]=self.add_reg_param(C[i][j]) self.C = C return C # it will find the k nearest element def k_nearest(a_list , b_list , n_neighbors): knn = KNeighborsClassifier(n_neighbors) knn.fit(a_list , b_list) return (a_list , b_list) # it will calculate ecludian distance for jenson shannon algorithm. def ecludian_distance(x_list): size = len(x_list) d = [[]]*size for i in range(size): for j in range(size): m=x[i] - x[j] if (m >= 0): d[i][j]=m else: d[i][j]= -m # while the i and j value is not specified is not specified in the algo so i am taking i=0 and j=size. upperis = pow((1+pow(d[i][j] , 2) , -1) for i in range(size): for j in range(i): loweris = pow((1+pow(d[i][j] , 2) , -1) q= float(upperis / loweris) return q def jenson_shannon(self ,a_list , b_list , L): mid_q = ((ecludian_distance(a_list) + ecludian_distance(b_list))/2) num_a = 0 num_b = 0 for i in range(L): num_a = num_a + (ecludian_distance(a_list)log10(ecludian_distance(a_list)/mid_q)) num_b = num_b + (ecludian_distance(b_list)log10(ecludian_distance(b_list)/mid_q)) js=(0.5(num_a)+num_b) return js def sigh(a_list , b_list): old_a_list = a_list old_b_list = b_list sigh_a[] = 0*len(a_list) sigh_b[] = 0*len(b_list) k_nearest(a_list , b_list , 5) for i in range(len(a_list)): sigh_a sigh_b[i]= (old_b_list[i] - b_list[i]) sigh_a[i] = (old_a_list[i] - a_list[i]) return (sigh_a , sigh_b) def transform(self,X_list): views = len(X_list) X_list = [self.normalize(x) for x in X_list] X_reduced = [[]]*views for i in range(views): for i in range(views): X_reduced[i]=np.dot(X_list[i],self.weights[i].T) return X_reduced def fit(self , a_list , b_list): view = len(a_list) #normalize the data a_list = [self.normalize(x) for x in a_list] b_list = [self.normalize(x) for x in b_list] for i in range(view): sigh(a_list[i] ,b_list[i]) first_term =first_term + (jenson_shannon(a_list[i] , b_list[i] ,i)(sigh_a)(sigh_b.T)(np.dot(cov_mat(a_list[i]).T , cov_mat(b_list[i])))) second_term =second_term + (jenson_shannon(a_list[i] , b_list[i] ,i)(sigh_a)(sigh_a.T )(np.dot(cov_mat(a_list[i]).T ,cov_mat(a_list[i]))) # n order to get more generalized flexibility, a parameter γ > 0 is introduced to balance the above two terms, so i assume lamda is 0.5 lamda=0.5 final_value = (first_term - (lamda)*(second_term)) return final_value def fit_transform(self , a_list , b_list): self.fit(a_list , b_list) final_value=np.transpose(final_value) return final_value
32.641221
149
0.563143
676
4,276
3.357988
0.198225
0.059471
0.043612
0.044053
0.25815
0.206608
0.185463
0.130396
0.107489
0.084582
0
0.011332
0.31899
4,276
130
150
32.892308
0.768201
0
0
0.097826
0
0
0
0
0
0
0
0
0
0
null
null
0
0.043478
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
fbdfdcb0c2a9cd822c60b6faedf5d56ff354a6c6
1,071
py
Python
bfxhfindicators/wma.py
quadramadery/bfx-hf-indicators-py
fe523607ae6c16fc26f1bb1d5e8062a3770b43e4
[ "Apache-2.0" ]
1
2022-01-12T09:31:45.000Z
2022-01-12T09:31:45.000Z
bfxhfindicators/wma.py
quadramadery/bfx-hf-indicators-py
fe523607ae6c16fc26f1bb1d5e8062a3770b43e4
[ "Apache-2.0" ]
null
null
null
bfxhfindicators/wma.py
quadramadery/bfx-hf-indicators-py
fe523607ae6c16fc26f1bb1d5e8062a3770b43e4
[ "Apache-2.0" ]
null
null
null
from bfxhfindicators.indicator import Indicator class WMA(Indicator): def __init__(self, args = []): [ period ] = args d = 0 for i in range(period): d += (i + 1) self._d = d self._p = period self._buffer = [] super().__init__({ 'args': args, 'id': 'wma', 'name': 'WMA(%f)' % period, 'seed_period': period }) def reset(self): super().reset() self._buffer = [] def update(self, v): if len(self._buffer) == 0: self._buffer.append(v) else: self._buffer[-1] = v if len(self._buffer) < self._p: return n = 0 for i in range(self._p): n += self._buffer[-i - 1] * (self._p - i) super().update(n / self._d) return self.v() def add(self, v): self._buffer.append(v) if len(self._buffer) > self._p: del self._buffer[0] elif len(self._buffer) < self._p: return n = 0 for i in range(self._p): n += self._buffer[-i - 1] * (self._p - i) super().add(n / self._d) return self.v()
18.152542
47
0.519141
150
1,071
3.493333
0.246667
0.229008
0.099237
0.040076
0.416031
0.362595
0.29771
0.251908
0.251908
0.251908
0
0.012295
0.316527
1,071
58
48
18.465517
0.703552
0
0
0.333333
0
0
0.028945
0
0
0
0
0
0
1
0.095238
false
0
0.02381
0
0.238095
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
836d607bb4f413a3224c84e9b615d0b74908dbb0
2,304
py
Python
ga4stpg/tree/generate.py
GiliardGodoi/ppgi-stpg-gpx
2097b086111e1cde423031c9a9d58f45b2b96353
[ "MIT" ]
null
null
null
ga4stpg/tree/generate.py
GiliardGodoi/ppgi-stpg-gpx
2097b086111e1cde423031c9a9d58f45b2b96353
[ "MIT" ]
5
2021-01-26T17:28:32.000Z
2021-03-14T13:46:48.000Z
ga4stpg/tree/generate.py
GiliardGodoi/ppgi-stpg-gpx
2097b086111e1cde423031c9a9d58f45b2b96353
[ "MIT" ]
1
2021-01-25T16:35:59.000Z
2021-01-25T16:35:59.000Z
from random import sample, shuffle from ga4stpg.graph import UGraph from ga4stpg.graph.disjointsets import DisjointSets class GenerateBasedPrimRST: def __init__(self, stpg): self.stpg = stpg def __call__(self): result = UGraph() terminals = self.stpg.terminals.copy() GRAPH = self.stpg.graph edges = set() # or is it better a list? vi = sample(range(1, self.stpg.nro_nodes+1), k=1)[0] terminals.discard(vi) for w in GRAPH.adjacent_to(vi): edges.add((vi, w)) while terminals and edges: edge = sample(edges, k=1)[0] # need to ensure randomness v, w = edge if w not in result: terminals.discard(w) result.add_edge(v, w) for u in GRAPH.adjacent_to(w): if u not in result: edges.add((w, u)) edges.remove(edge) # to remove from a list it can take O(n) return result class GenerateBasedKruskalRST: def __init__(self, stpg): self.stpg = stpg def __call__(self): result = UGraph() done = DisjointSets() edges = [(u, v) for u, v in self.stpg.graph.gen_undirect_edges()] shuffle(edges) for v in self.stpg.terminals: done.make_set(v) while edges and len(done.get_disjoint_sets()) > 1: edge = edges.pop() y, z = edge[0], edge[1] if y not in done: done.make_set(y) if z not in done: done.make_set(z) if done.find(y) != done.find(z): result.add(y, z) done.union(y, z) return result class GenerateBasedRandomWalk: def __init__(self, stpg): self.stpg = stpg def __call__(self): GRAPH = self.stpg.graph terminals = self.stpg.terminals.copy() result = UGraph() v = terminals.pop() while terminals: adjacents = GRAPH.adjacent_to(v, lazy=False) u = sample(adjacents, k=1)[0] if u not in result: result.add_edge(v, u) terminals.discard(u) v = u return result
27.105882
74
0.521267
286
2,304
4.06993
0.262238
0.089347
0.028351
0.03866
0.228522
0.152921
0.118557
0.118557
0.118557
0.118557
0
0.009142
0.382813
2,304
84
75
27.428571
0.809423
0.038194
0
0.344262
1
0
0
0
0
0
0
0
0
1
0.098361
false
0
0.04918
0
0.245902
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
83731763e6cbd3e1546d2f2ccc7d203e0567127e
1,411
py
Python
main/migrations/0028_auto_20170103_1634.py
jsmnbom/htxaarhuslan
5244c4e65f4912c5d2e193f1ac355b3206d1c1b8
[ "MIT" ]
1
2019-09-06T10:28:40.000Z
2019-09-06T10:28:40.000Z
main/migrations/0028_auto_20170103_1634.py
jsmnbom/htxaarhuslan
5244c4e65f4912c5d2e193f1ac355b3206d1c1b8
[ "MIT" ]
2
2018-10-22T10:33:04.000Z
2019-01-31T19:36:04.000Z
main/migrations/0028_auto_20170103_1634.py
jsmnbom/htxaarhuslan
5244c4e65f4912c5d2e193f1ac355b3206d1c1b8
[ "MIT" ]
1
2019-09-06T10:28:41.000Z
2019-09-06T10:28:41.000Z
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2017-01-03 15:34 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('main', '0027_auto_20170103_1130'), ] operations = [ migrations.CreateModel( name='Event', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255, verbose_name='navn')), ('url', models.URLField(blank=True, help_text='Valgfri. Link som kan klikkes på kalenderen.', max_length=255, null=True, verbose_name='link')), ('start', models.DateTimeField(null=True, verbose_name='Start')), ('end', models.DateTimeField(blank=True, null=True, verbose_name='Slut')), ('lan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Lan', verbose_name='lan')), ], options={ 'verbose_name_plural': 'begivenheder', 'verbose_name': 'begivenhed', }, ), migrations.AlterField( model_name='tournament', name='end', field=models.DateTimeField(blank=True, null=True, verbose_name='Slut'), ), ]
38.135135
159
0.59674
151
1,411
5.410596
0.536424
0.121175
0.073439
0.093023
0.124847
0.124847
0.124847
0.124847
0.124847
0
0
0.037464
0.262225
1,411
36
160
39.194444
0.747358
0.048193
0
0.068966
1
0
0.146269
0.017164
0
0
0
0
0
1
0
false
0
0.103448
0
0.206897
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
8373339dd9a549bf7c7f2156eb693bffea51c85a
6,207
py
Python
gw_grb_h_0_ppd_summaries.py
KamshatTazhenova/hh0
c71845056c5a108cb95654b1a1012d63034541c2
[ "MIT" ]
11
2017-07-04T06:56:17.000Z
2022-01-04T08:35:48.000Z
gw_grb_h_0_ppd_summaries.py
KamshatTazhenova/hh0
c71845056c5a108cb95654b1a1012d63034541c2
[ "MIT" ]
null
null
null
gw_grb_h_0_ppd_summaries.py
KamshatTazhenova/hh0
c71845056c5a108cb95654b1a1012d63034541c2
[ "MIT" ]
5
2017-07-07T10:00:19.000Z
2021-06-08T09:38:25.000Z
import numpy as np import matplotlib.pyplot as mp import matplotlib.cm as mpcm import matplotlib.colors as mpc import scipy.stats as ss # plotting settings lw = 1.5 mp.rc('font', family = 'serif') mp.rcParams['text.latex.preamble'] = [r'\boldmath'] mp.rcParams['axes.linewidth'] = lw mp.rcParams['lines.linewidth'] = lw cm = mpcm.get_cmap('plasma') # datafiles ppds = ['cmb', 'loc'] sums = ['ptes', 'prs'] # posterior summaries post_means = np.genfromtxt('gw_grb_h_0_posterior_means.csv', \ delimiter=',') post_vars = np.genfromtxt('gw_grb_h_0_posterior_vars.csv', \ delimiter=',') n_h_0_true = post_means.shape[0] n_bs = post_means.shape[1] print n_bs h_0_true_col = [cm(col) for col in np.linspace(0.2, 0.8, n_h_0_true)] fig, axes = mp.subplots(1, 2, figsize=(12, 5)) for i in range(n_h_0_true): print '* H_0 = {:5.2f}'.format(post_means[i, 0]) to_print = 'posterior mean = {:5.2f} +/- {:4.2f}' print to_print.format(np.mean(post_means[i, 1:]), \ np.std(post_means[i, 1:])) to_print = 'posterior sigma = {:5.2f} +/- {:4.2f}' print to_print.format(np.mean(np.sqrt(post_vars[i, 1:])), \ np.std(np.sqrt(post_vars[i, 1:]))) kde = ss.gaussian_kde(post_means[i, 1:]) grid = np.linspace(np.min(post_means[i, 1:]), \ np.max(post_means[i, 1:]), \ 1000) axes[0].plot(grid, kde.evaluate(grid), color=h_0_true_col[i]) axes[0].axvline(post_means[i, 0], color=h_0_true_col[i], ls='--') kde = ss.gaussian_kde(np.sqrt(post_vars[i, 1:])) grid = np.linspace(np.min(np.sqrt(post_vars[i, 1:])), \ np.max(np.sqrt(post_vars[i, 1:])), \ 1000) axes[1].plot(grid, kde.evaluate(grid), color=h_0_true_col[i], \ label=r'$H_0 = {:5.2f}$'.format(post_vars[i, 0])) axes[0].set_xlabel(r'$\bar{H}_0$', fontsize=18) axes[0].set_ylabel(r'${\rm Pr}(\bar{H}_0)$', fontsize=18) axes[0].tick_params(axis='both', which='major', labelsize=12) axes[1].set_xlabel(r'$\sigma_{H_0}$', fontsize=18) axes[1].set_ylabel(r'${\rm Pr}(\sigma_{H_0})$', fontsize=18) axes[1].tick_params(axis='both', which='major', labelsize=12) axes[1].legend(loc='upper right', fontsize=14) fig.suptitle('Bootstrap-Averaged Posterior Means / Sigmas', \ fontsize=18) fig.savefig('gw_grd_h_0_bs_avg_posterior_moments.pdf', \ bbox_inches = 'tight') mp.close(fig) # PPD summaries for i in range(len(ppds)): for j in range(len(sums)): # read data fname = 'gw_grb_h_0_' + ppds[i] + '_ppd_' + sums[j] data = np.genfromtxt(fname + '.csv', delimiter=',') n_bs = data.shape[1] print n_bs # plot n_h_0_true = data.shape[0] fig, axes = mp.subplots(1, n_h_0_true, \ figsize=(6 * n_h_0_true, 5)) if ppds[i] == 'cmb': fig.suptitle(r'$\hat{H}_0^{\rm CMB}\, {\rm Prediction}$', \ fontsize=18) else: fig.suptitle(r'$\hat{H}_0^{\rm CDL}\, {\rm Prediction}$', \ fontsize=18) if sums[j] == 'ptes': x_label = r'$p$' y_label = r'${\rm Pr}(p)$' else: x_label = r'$\rho$' y_label = r'${\rm Pr}(\rho)$' for k in range(n_h_0_true): kde = ss.gaussian_kde(data[k, 1:]) grid = np.linspace(np.min(data[k, 1:]), \ np.max(data[k, 1:]), \ 1000) axes[k].plot(grid, kde.evaluate(grid), color=cm(0.5)) axes[k].set_xlabel(x_label, fontsize=18) axes[k].set_ylabel(y_label, fontsize=18) axes[k].tick_params(axis='both', which='major', labelsize=12) axes[k].set_title(r'$H_0 = {:5.2f}$'.format(data[k, 0]), \ fontsize=18) # finish plot fig.savefig(fname + '.pdf', bbox_inches = 'tight') mp.close(fig) # quick check of required numbers of samples def rho(d, n, var_ratio, n_event_ref, n_event): d_n_event = n_event_ref / n_event return np.exp(-0.5 * rho_num(d, n, d_n_event) / \ rho_den(var_ratio, d_n_event)) def rho_num(d, n, d_n_event): if d > 0.0: return (d - n * np.sqrt(d_n_event)) ** 2 else: return (d + n * np.sqrt(d_n_event)) ** 2 def rho_den(var_ratio, d_n_event): return var_ratio + d_n_event def num_ratio(d, n, m, var_ratio): term = (m ** 2 * var_ratio - d ** 2) print term return [((-n * d - \ np.sqrt((n * d) ** 2 - term * (m ** 2 - n ** 2))) / \ term) ** 2, \ ((-n * d + \ np.sqrt((n * d) ** 2 - term * (m ** 2 - n ** 2))) / \ term) ** 2] n_ref = 51.0 mu_obs = np.array([67.81, 73.24]) sig_obs = np.array([0.92, 1.74]) n_sigma_sv = 1.0 n_sigma_thresh = 3.0 n_sigma_diff = [(mu_obs[1] - mu_obs[0]) / np.sqrt(post_vars[i, 1]), \ (mu_obs[0] - mu_obs[1]) / np.sqrt(post_vars[i, 1])] var_ratio = [sig_obs[1] ** 2 / post_vars[i, 1], \ sig_obs[0] ** 2 / post_vars[i, 1]] print n_sigma_diff print var_ratio n_req = np.zeros(2) n_req[0] = n_ref * num_ratio(n_sigma_diff[0], n_sigma_sv, \ n_sigma_thresh, var_ratio[0])[0] ln_rho = -2.0 * np.log(rho(n_sigma_diff[0], n_sigma_sv, \ var_ratio[0], n_ref, n_req[0])) print n_req[0], ln_rho, n_sigma_thresh ** 2 n_req[1] = n_ref * num_ratio(n_sigma_diff[1], n_sigma_sv, \ n_sigma_thresh, var_ratio[1])[1] ln_rho = -2.0 * np.log(rho(n_sigma_diff[1], n_sigma_sv, \ var_ratio[1], n_ref, n_req[1])) print n_req[1], ln_rho, n_sigma_thresh ** 2 n_grid = np.arange(n_ref, 5000.0) mp.loglog(n_grid, rho_num(n_sigma_diff[0], n_sigma_sv, n_ref / n_grid), 'r', lw=1.0) mp.plot(n_grid, 1.0 / rho_den(var_ratio[0], n_ref / n_grid), 'g', lw=1.0) mp.plot(n_grid, 1.0 / rho_den(var_ratio[1], n_ref / n_grid), 'b', lw=1.0) mp.plot(n_grid, -2.0 * np.log(rho(n_sigma_diff[0], n_sigma_sv, var_ratio[0], \ n_ref, n_grid)), 'g') mp.plot(n_grid, -2.0 * np.log(rho(n_sigma_diff[1], n_sigma_sv, var_ratio[1], \ n_ref, n_grid)), 'b') mp.axhline(n_sigma_thresh ** 2, color='k', linestyle='-.') mp.axvline(n_req[0], color='g', linestyle='-.') mp.axvline(n_req[1], color='b', linestyle='-.') mp.xlabel(r'$N$') mp.ylabel(r'$f(N)$') mp.xlim(n_ref, 5000) mp.ylim(0.3, 40.0) mp.savefig('gw_grb_h_0_ppd_samp_var_limits.pdf', bbox_inches='tight') mp.show() exit() print num_ratio(4.53, n_sigma_sv, n_sigma_thresh, 2.1) print 5.43, mu_obs[1] - mu_obs[0] print 1.2, np.sqrt(post_vars[i, 1]) print 5.43 / 1.2, n_sigma_diff[0] m = 3.0 n = 1.0 d = 3.77 # 4.53 vrat = 1.46 # 2.1 print ((d*n+np.sqrt((d*n)**2-(vrat*m**2-d**2)*(m**2-n**2)))/(vrat*m**2-d**2))**2
33.733696
84
0.624617
1,203
6,207
2.995012
0.16542
0.043297
0.018318
0.027755
0.50902
0.424091
0.340272
0.206772
0.173744
0.149598
0
0.053565
0.163847
6,207
183
85
33.918033
0.640655
0.022555
0
0.11465
0
0
0.111955
0.021797
0
0
0
0
0
0
null
null
0
0.031847
null
null
0.10828
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
837a8a805f3fa86050a9f939d897eba29f04412d
1,713
py
Python
urduhack/stop_words.py
fahdrazavi/urduhack
a2370b0d8c1ee3f260ff90ca5056f45ed9b73ee8
[ "MIT" ]
null
null
null
urduhack/stop_words.py
fahdrazavi/urduhack
a2370b0d8c1ee3f260ff90ca5056f45ed9b73ee8
[ "MIT" ]
null
null
null
urduhack/stop_words.py
fahdrazavi/urduhack
a2370b0d8c1ee3f260ff90ca5056f45ed9b73ee8
[ "MIT" ]
null
null
null
# coding: utf8 """ Complete collection of stopwords for the Urdu language. Maintainer: Ikram Ali(mrikram1989@gmail.com) version = 2019.04.07 Source = https://github.com/urduhack/urdu-stopwords """ # Urdu Language Stop words list STOP_WORDS = frozenset(""" آ آئی آئیں آئے آتا آتی آتے آس آنا آنی آنے آپ آیا ابھی از اس اسی اسے البتہ الف ان انہوں انہی انہیں اور اپ اپنا اپنی اپنے اکثر اگر اگرچہ ایسا ایسی ایسے ایک اے بار بارے باوجود باہر بعض بغیر بلکہ بن بنا بناؤ بند بڑی بھر بھریں بھی بہت بیس بے تا تاکہ تب تجھ تجھے تحت تر تم تمہارا تمہاری تمہارے تمہیں تو تک تھا تھی تھیں تھے تیری جا جاؤ جائیں جائے جاتا جاتی جاتے جانی جانے جب جبکہ جس جن جنہوں جنہیں جو جہاں جیسا جیسوں جیسی جیسے حالانکہ حالاں حصہ خالی خود درمیان دوران دوسرا دوسروں دوسری دوسرے دوں دکھائیں دی دیئے دیا دیتا دیتی دیتے دیر دینا دینی دینے دیکھو دیں دیے دے ذریعے رکھا رکھتا رکھتی رکھتے رکھنا رکھنی رکھنے رکھو رکھی رکھے رہ رہا رہتا رہتی رہتے رہنا رہنی رہنے رہو رہی رہیں رہے سا ساتھ سامنے سب سو سکا سکتا سکتے سی سے شاید صرف طرح طرف طور علاوہ عین لئے لا لائی لائے لاتا لاتی لاتے لانا لانی لانے لایا لو لوجی لوگ لوگوں لگ لگا لگتا لگتی لگی لگیں لگے لہذا لی لیا لیتا لیتی لیتے لیکن لیں لیے لے مجھ مجھے مزید مطابق مل مگر میرا میری میرے میں نا نہ نہیں نے وار واقعی والا والوں والی والے وجہ وغیرہ وہ وہاں وہی وہیں وی ویسے پایا پر پھر پیچھے چاہئے چاہتے چاہیئے چاہے چلا چلو چلیں چلے چونکہ چکی چکیں چکے ڈالنی ڈالنے ڈالے کئے کا کب کبھی کر کرتا کرتی کرتے کرنا کرنے کرو کریں کرے کس کسی کسے کم کو کوئی کون کونسا کچھ کہ کہا کہاں کہہ کہی کہیں کہے کی کیا کیسے کیونکہ کیوں کیے کے گئی گئے گا گویا گی گیا گے ہاں ہر ہم ہمارا ہماری ہمارے ہو ہوئی ہوئیں ہوئے ہوا ہوتا ہوتی ہوتیں ہوتے ہونا ہونگے ہونی ہونے ہوں ہی ہیں ہے یا یات یعنی یہ یہاں یہی یہیں """.split())
57.1
101
0.76474
350
1,713
3.74
0.98
0.018335
0
0
0
0
0
0
0
0
0
0.009644
0.213076
1,713
29
102
59.068966
0.961424
0.126678
0
0
0
0
0.971083
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
8385780ba677837b4c5c4c3d8cf272c764342143
385
py
Python
backend/todo/migrations/0008_auto_20190403_0812.py
Bhunesh2000/todoWithDjango
e5fa52a087180b66ae283e6b36fe790323d7b920
[ "MIT" ]
null
null
null
backend/todo/migrations/0008_auto_20190403_0812.py
Bhunesh2000/todoWithDjango
e5fa52a087180b66ae283e6b36fe790323d7b920
[ "MIT" ]
11
2019-04-03T09:49:17.000Z
2022-02-10T08:23:26.000Z
backend/todo/migrations/0008_auto_20190403_0812.py
Bhunesh2000/todoWithDjango
e5fa52a087180b66ae283e6b36fe790323d7b920
[ "MIT" ]
1
2019-10-21T19:26:29.000Z
2019-10-21T19:26:29.000Z
# Generated by Django 2.2 on 2019-04-03 08:12 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('todo', '0007_todo_dateevent'), ] operations = [ migrations.AlterField( model_name='todo', name='dateEvent', field=models.DateField(default='2019-04-03'), ), ]
20.263158
57
0.58961
41
385
5.463415
0.682927
0.053571
0.071429
0
0
0
0
0
0
0
0
0.094891
0.288312
385
18
58
21.388889
0.722628
0.111688
0
0
1
0
0.135294
0
0
0
0
0
0
1
0
false
0
0.083333
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
838aa6ee041eb5a569fe74b2aa529125b8e2fda2
2,595
py
Python
scipy_util/util.py
idf/sci_util_py
53b4d961a1a8faeb444d2972ca7a2baf4a966f6e
[ "BSD-3-Clause" ]
null
null
null
scipy_util/util.py
idf/sci_util_py
53b4d961a1a8faeb444d2972ca7a2baf4a966f6e
[ "BSD-3-Clause" ]
1
2016-02-10T19:17:20.000Z
2016-02-10T20:04:59.000Z
scipy_util/util.py
idf/scipy_util
53b4d961a1a8faeb444d2972ca7a2baf4a966f6e
[ "BSD-3-Clause" ]
null
null
null
""" Adapted from https://github.com/bytefish/facerec """ import os from PIL import Image import numpy as np import random def read_image(filename): imarr = np.array([]) try: im = Image.open(os.path.join(filename)) im = im.convert("L") # convert to greyscale imarr = np.array(im, dtype=np.uint8) except IOError as (errno, strerror): print "I/O error({0}): {1}".format(errno, strerror) except: print "Cannot open image." return imarr def asRowMatrix(X): """ Creates a row-matrix from multi-dimensional data items in list l. X [list] List with multi-dimensional data. """ if len(X) == 0: return np.array([]) total = 1 for i in range(0, np.ndim(X[0])): total = total * X[0].shape[i] mat = np.empty([0, total], dtype=X[0].dtype) for row in X: mat = np.append(mat, row.reshape(1, -1), axis=0) # same as vstack return np.asmatrix(mat) def asColumnMatrix(X): """ Creates a column-matrix from multi-dimensional data items in list X. X [list] List with multi-dimensional data. """ if len(X) == 0: return np.array([]) total = 1 for i in range(0, np.ndim(X[0])): total = total * X[0].shape[i] mat = np.empty([total, 0], dtype=X[0].dtype) for col in X: mat = np.append(mat, col.reshape(-1, 1), axis=1) # same as hstack return np.asmatrix(mat) def minmax_normalize(X, low, high, minX=None, maxX=None, dtype=np.float): """ min-max normalize a given matrix to given range [low,high]. Args: X [rows x columns] input data low [numeric] lower bound high [numeric] upper bound """ if minX is None: minX = np.min(X) if maxX is None: maxX = np.max(X) minX = float(minX) maxX = float(maxX) # Normalize to [0...1]. X = X - minX X = X / (maxX - minX) # Scale to [low...high]. X = X * (high - low) X = X + low return np.asarray(X, dtype=dtype) def shuffle(X, y): idx = np.argsort([random.random() for i in xrange(y.shape[0])]) return X[:, idx], y[idx] def shuffle_array(X, y): """ Shuffles two arrays! """ idx = np.argsort([random.random() for i in xrange(len(y))]) X = [X[i] for i in idx] y = [y[i] for i in idx] return X, y def to_col_vec(row_vec): """ :param row_vec: 1d np array :return: """ return row_vec[:, np.newaxis] def to_row_vec(col_vec): """ :param col_vec: 2d np array :return: """ return col_vec.reshape(1, -1)
23.807339
74
0.570713
404
2,595
3.633663
0.274752
0.010899
0.024523
0.035422
0.337875
0.273842
0.250681
0.250681
0.194823
0.145777
0
0.016077
0.280925
2,595
109
75
23.807339
0.770632
0.03815
0
0.20339
0
0
0.020799
0
0
0
0
0
0
0
null
null
0
0.067797
null
null
0.033898
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
83927dd68fcacbf5d7c2a21161a37e8eb6342054
1,021
py
Python
Task2G.py
asew4/Flood-Warning-System-8
66f436caf8307232604b830e4dc4ab385de0556e
[ "MIT" ]
null
null
null
Task2G.py
asew4/Flood-Warning-System-8
66f436caf8307232604b830e4dc4ab385de0556e
[ "MIT" ]
null
null
null
Task2G.py
asew4/Flood-Warning-System-8
66f436caf8307232604b830e4dc4ab385de0556e
[ "MIT" ]
1
2022-02-06T02:27:29.000Z
2022-02-06T02:27:29.000Z
from floodsystem import stationdata, datafetcher, station stations = stationdata.build_station_list() stationdata.update_water_levels(stations) #Empty lists for each of the risk categories severe_level_station = [] high_level_station = [] moderate_level_station = [] low_level_station = [] for station in stations: #Sorts out stations into different levels level = station.relative_water_level() if level is not None: if level > 1.2: severe_level_station.append(station) elif level > 0.9: high_level_station.append(station) elif level > 0.7: moderate_level_station.append(station) else: low_level_station.append(station) #sets for the different categories severe_town = {x.town for x in severe_level_station} high_town = {x.town for x in high_level_station} moderate_town = {x.town for x in moderate_level_station} low_town = {x.town for x in low_level_station} for town in severe_town: #xx print(town)
30.939394
66
0.712047
142
1,021
4.873239
0.338028
0.225434
0.104046
0.144509
0.187861
0.187861
0.101156
0
0
0
0
0.007509
0.217434
1,021
32
67
31.90625
0.858573
0.115573
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.041667
0
0.041667
0.041667
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
839409e02d06e81916f52fdb0dab1efe39b69585
2,190
py
Python
rotation_analysis/analysis/probe/gui/gui.py
Sepidak/spikeGUI
25ae60160308c0a34e7180f3e39a1c4dc6aad708
[ "MIT" ]
null
null
null
rotation_analysis/analysis/probe/gui/gui.py
Sepidak/spikeGUI
25ae60160308c0a34e7180f3e39a1c4dc6aad708
[ "MIT" ]
3
2021-08-09T21:51:41.000Z
2021-08-09T21:51:45.000Z
rotation_analysis/analysis/probe/gui/gui.py
Sepidak/spikeGUI
25ae60160308c0a34e7180f3e39a1c4dc6aad708
[ "MIT" ]
3
2021-10-16T14:07:59.000Z
2021-10-16T17:09:03.000Z
import os import sys if sys.platform.startswith('linux'): from OpenGL import GL from PyQt5.QtQml import QQmlApplicationEngine from PyQt5.QtWidgets import QApplication from analysis.probe.gui.backend_classes import PythonBackendClass1, Logger from analysis.probe.gui.image_providers import PyplotImageProvider DEBUG = False if __name__ == '__main__': app = QApplication(sys.argv) appEngine = QQmlApplicationEngine() context = appEngine.rootContext() analysis_image_provider1 = PyplotImageProvider(fig=None) appEngine.addImageProvider("analysisprovider1", analysis_image_provider1) analysis_image_provider2 = PyplotImageProvider(fig=None) appEngine.addImageProvider("analysisprovider2", analysis_image_provider2) # ALL THE ADDIMAGEPROVIDER LINES BELOW ARE REQUIRED TO MAKE QML BELIEVE THE PROVIDER IS VALID BEFORE ITS CREATION # appEngine.addImageProvider('viewerprovider', CvImageProvider()) # analysis_image_provider = PyplotImageProvider(fig=None) # appEngine.addImageProvider("analysisprovider", analysis_image_provider) conf = { 'shared_directory': './' # FIXME: this is obviously BS } qml_source_path = os.path.join(conf['shared_directory'], 'qml', 'gui_qtquick', 'gui_qtquick.qml') if not os.path.isfile(qml_source_path): raise ValueError("Qml code not found at {}, please verify your installation".format(qml_source_path)) appEngine.load(qml_source_path) try: win = appEngine.rootObjects()[0] except IndexError: raise ValueError("Could not start the QT GUI") if not DEBUG: logger = Logger(context, win, "log") sys.stdout = logger print('Hello world') # icon = QIcon(os.path.join(conf.shared_directory, 'resources', 'icons', 'pyper.png')) # win.setIcon(icon) backend = PythonBackendClass1(app, context, win, analysis_image_provider1, analysis_image_provider2) # create instance of backend context.setContextProperty('py_iface', backend) # register backend python object with qml code under variable name py_iface win.show() sys.exit(app.exec_())
35.322581
135
0.719635
245
2,190
6.261224
0.489796
0.067797
0.033898
0.068449
0.194915
0.095176
0
0
0
0
0
0.007332
0.190411
2,190
61
136
35.901639
0.857868
0.244292
0
0
0
0
0.135732
0
0
0
0
0.016393
0
1
0
false
0
0.194444
0
0.194444
0.027778
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
83944542d560f5e410e723d98ca83aade353b2f1
3,701
py
Python
test/integration/test_forcemerge.py
jgough/opensearch-curator
e8d7eb4d969eac551db9f99bd021d0c05e28dc35
[ "Apache-2.0" ]
null
null
null
test/integration/test_forcemerge.py
jgough/opensearch-curator
e8d7eb4d969eac551db9f99bd021d0c05e28dc35
[ "Apache-2.0" ]
null
null
null
test/integration/test_forcemerge.py
jgough/opensearch-curator
e8d7eb4d969eac551db9f99bd021d0c05e28dc35
[ "Apache-2.0" ]
null
null
null
import opensearchpy import curator import os import json import string import random import tempfile from time import sleep import click from click import testing as clicktest from mock import patch, Mock from . import CuratorTestCase from . import testvars as testvars import logging logger = logging.getLogger(__name__) host, port = os.environ.get('TEST_ES_SERVER', 'localhost:9200').split(':') port = int(port) if port else 9200 class TestActionFileforceMerge(CuratorTestCase): def test_merge(self): count = 1 idx = 'my_index' self.create_index(idx) self.add_docs(idx) ilo1 = curator.IndexList(self.client) ilo1._get_segment_counts() self.assertEqual(3, ilo1.index_info[idx]['segments']) self.write_config( self.args['configfile'], testvars.client_config.format(host, port)) self.write_config(self.args['actionfile'], testvars.forcemerge_test.format(count, 0.9)) test = clicktest.CliRunner() _ = test.invoke( curator.cli, ['--config', self.args['configfile'], self.args['actionfile']], ) ilo2 = curator.IndexList(self.client) # This stupid block is only for the benefit of Travis CI # With Python 2.7 and ES 7.0, it apparently can finish testing before # the segments have _reported_ as fully merged. This is forcing # 3 checks before giving up and reporting the result. for _ in range(0, 3): self.client.indices.refresh(index=idx) ilo2._get_segment_counts() if ilo2.index_info[idx]['segments'] == count: break else: sleep(1) self.assertEqual(count, ilo2.index_info[idx]['segments']) def test_extra_option(self): self.write_config( self.args['configfile'], testvars.client_config.format(host, port)) self.write_config(self.args['actionfile'], testvars.bad_option_proto_test.format('forcemerge')) test = clicktest.CliRunner() result = test.invoke( curator.cli, [ '--config', self.args['configfile'], self.args['actionfile'] ], ) self.assertEqual(1, result.exit_code) class TestCLIforceMerge(CuratorTestCase): def test_merge(self): count = 1 idx = 'my_index' self.create_index(idx) self.add_docs(idx) ilo1 = curator.IndexList(self.client) ilo1._get_segment_counts() self.assertEqual(3, ilo1.index_info[idx]['segments']) args = self.get_runner_args() args += [ '--config', self.args['configfile'], 'forcemerge', '--max_num_segments', str(count), '--delay', '0.9', '--filter_list', '{"filtertype":"pattern","kind":"prefix","value":"my"}', ] self.assertEqual(0, self.run_subprocess(args, logname='TestCLIforceMerge.test_merge')) ilo2 = curator.IndexList(self.client) # This stupid block is only for the benefit of Travis CI # With Python 2.7 and ES 7.0, it apparently can finish testing before # the segments have _reported_ as fully merged. This is forcing # 3 checks before giving up and reporting the result. for _ in range(0, 3): self.client.indices.refresh(index=idx) ilo2._get_segment_counts() if ilo2.index_info[idx]['segments'] == count: break else: sleep(1) self.assertEqual(count, ilo2.index_info[idx]['segments'])
37.765306
94
0.604431
431
3,701
5.053364
0.299304
0.033058
0.044995
0.055096
0.652893
0.652893
0.652893
0.652893
0.652893
0.652893
0
0.018189
0.286949
3,701
98
95
37.765306
0.807124
0.127803
0
0.541176
0
0
0.108385
0.025155
0
0
0
0
0.070588
1
0.035294
false
0
0.164706
0
0.223529
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
8398ea34b25e65cea834c631c5374561393da5cc
35,415
py
Python
tools/messages/aura4_messages.py
AuraUAS/aura-core
4711521074db72ba9089213e14455d89dc5306c0
[ "MIT", "BSD-2-Clause-FreeBSD" ]
8
2016-08-03T19:35:03.000Z
2019-12-15T06:25:05.000Z
tools/messages/aura4_messages.py
AuraUAS/aura-core
4711521074db72ba9089213e14455d89dc5306c0
[ "MIT", "BSD-2-Clause-FreeBSD" ]
4
2018-09-27T15:48:56.000Z
2018-11-05T12:38:10.000Z
tools/messages/aura4_messages.py
AuraUAS/aura-core
4711521074db72ba9089213e14455d89dc5306c0
[ "MIT", "BSD-2-Clause-FreeBSD" ]
5
2017-06-28T19:15:36.000Z
2020-02-19T19:31:24.000Z
import struct # Message id constants command_ack_id = 10 config_airdata_id = 11 config_board_id = 12 config_ekf_id = 13 config_imu_id = 14 config_mixer_id = 15 config_mixer_matrix_id = 16 config_power_id = 17 config_pwm_id = 18 config_stability_damping_id = 19 command_inceptors_id = 20 command_zero_gyros_id = 21 command_reset_ekf_id = 22 command_cycle_inceptors_id = 23 pilot_id = 24 imu_id = 25 aura_nav_pvt_id = 26 airdata_id = 27 power_id = 28 status_id = 29 ekf_id = 30 # Constants pwm_channels = 8 # number of pwm output channels sbus_channels = 16 # number of sbus channels ap_channels = 6 # number of sbus channels mix_matrix_size = 64 # 8 x 8 mix matrix # Enums enum_nav_none = 0 # None enum_nav_nav15 = 1 # None enum_nav_nav15_mag = 2 # None # Message: command_ack # Id: 10 class command_ack(): id = 10 _pack_string = "<BB" def __init__(self, msg=None): # public fields self.command_id = 0 self.subcommand_id = 0 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.command_id, self.subcommand_id) return msg def unpack(self, msg): (self.command_id, self.subcommand_id) = struct.unpack(self._pack_string, msg) # Message: config_airdata # Id: 11 class config_airdata(): id = 11 _pack_string = "<BBBB" def __init__(self, msg=None): # public fields self.barometer = 0 self.pitot = 0 self.swift_baro_addr = 0 self.swift_pitot_addr = 0 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.barometer, self.pitot, self.swift_baro_addr, self.swift_pitot_addr) return msg def unpack(self, msg): (self.barometer, self.pitot, self.swift_baro_addr, self.swift_pitot_addr) = struct.unpack(self._pack_string, msg) # Message: config_board # Id: 12 class config_board(): id = 12 _pack_string = "<BB" def __init__(self, msg=None): # public fields self.board = 0 self.led_pin = 0 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.board, self.led_pin) return msg def unpack(self, msg): (self.board, self.led_pin) = struct.unpack(self._pack_string, msg) # Message: config_ekf # Id: 13 class config_ekf(): id = 13 _pack_string = "<Bfffffffffff" def __init__(self, msg=None): # public fields self.select = 0 self.sig_w_accel = 0.0 self.sig_w_gyro = 0.0 self.sig_a_d = 0.0 self.tau_a = 0.0 self.sig_g_d = 0.0 self.tau_g = 0.0 self.sig_gps_p_ne = 0.0 self.sig_gps_p_d = 0.0 self.sig_gps_v_ne = 0.0 self.sig_gps_v_d = 0.0 self.sig_mag = 0.0 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.select, self.sig_w_accel, self.sig_w_gyro, self.sig_a_d, self.tau_a, self.sig_g_d, self.tau_g, self.sig_gps_p_ne, self.sig_gps_p_d, self.sig_gps_v_ne, self.sig_gps_v_d, self.sig_mag) return msg def unpack(self, msg): (self.select, self.sig_w_accel, self.sig_w_gyro, self.sig_a_d, self.tau_a, self.sig_g_d, self.tau_g, self.sig_gps_p_ne, self.sig_gps_p_d, self.sig_gps_v_ne, self.sig_gps_v_d, self.sig_mag) = struct.unpack(self._pack_string, msg) # Message: config_imu # Id: 14 class config_imu(): id = 14 _pack_string = "<BBfffffffffffffffffffffffffffffff" def __init__(self, msg=None): # public fields self.interface = 0 self.pin_or_address = 0 self.strapdown_calib = [0.0] * 9 self.accel_scale = [0.0] * 3 self.accel_translate = [0.0] * 3 self.mag_affine = [0.0] * 16 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.interface, self.pin_or_address, self.strapdown_calib[0], self.strapdown_calib[1], self.strapdown_calib[2], self.strapdown_calib[3], self.strapdown_calib[4], self.strapdown_calib[5], self.strapdown_calib[6], self.strapdown_calib[7], self.strapdown_calib[8], self.accel_scale[0], self.accel_scale[1], self.accel_scale[2], self.accel_translate[0], self.accel_translate[1], self.accel_translate[2], self.mag_affine[0], self.mag_affine[1], self.mag_affine[2], self.mag_affine[3], self.mag_affine[4], self.mag_affine[5], self.mag_affine[6], self.mag_affine[7], self.mag_affine[8], self.mag_affine[9], self.mag_affine[10], self.mag_affine[11], self.mag_affine[12], self.mag_affine[13], self.mag_affine[14], self.mag_affine[15]) return msg def unpack(self, msg): (self.interface, self.pin_or_address, self.strapdown_calib[0], self.strapdown_calib[1], self.strapdown_calib[2], self.strapdown_calib[3], self.strapdown_calib[4], self.strapdown_calib[5], self.strapdown_calib[6], self.strapdown_calib[7], self.strapdown_calib[8], self.accel_scale[0], self.accel_scale[1], self.accel_scale[2], self.accel_translate[0], self.accel_translate[1], self.accel_translate[2], self.mag_affine[0], self.mag_affine[1], self.mag_affine[2], self.mag_affine[3], self.mag_affine[4], self.mag_affine[5], self.mag_affine[6], self.mag_affine[7], self.mag_affine[8], self.mag_affine[9], self.mag_affine[10], self.mag_affine[11], self.mag_affine[12], self.mag_affine[13], self.mag_affine[14], self.mag_affine[15]) = struct.unpack(self._pack_string, msg) # Message: config_mixer # Id: 15 class config_mixer(): id = 15 _pack_string = "<BBBBBBBfffffffffff" def __init__(self, msg=None): # public fields self.mix_autocoord = False self.mix_throttle_trim = False self.mix_flap_trim = False self.mix_elevon = False self.mix_flaperon = False self.mix_vtail = False self.mix_diff_thrust = False self.mix_Gac = 0.0 self.mix_Get = 0.0 self.mix_Gef = 0.0 self.mix_Gea = 0.0 self.mix_Gee = 0.0 self.mix_Gfa = 0.0 self.mix_Gff = 0.0 self.mix_Gve = 0.0 self.mix_Gvr = 0.0 self.mix_Gtt = 0.0 self.mix_Gtr = 0.0 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.mix_autocoord, self.mix_throttle_trim, self.mix_flap_trim, self.mix_elevon, self.mix_flaperon, self.mix_vtail, self.mix_diff_thrust, self.mix_Gac, self.mix_Get, self.mix_Gef, self.mix_Gea, self.mix_Gee, self.mix_Gfa, self.mix_Gff, self.mix_Gve, self.mix_Gvr, self.mix_Gtt, self.mix_Gtr) return msg def unpack(self, msg): (self.mix_autocoord, self.mix_throttle_trim, self.mix_flap_trim, self.mix_elevon, self.mix_flaperon, self.mix_vtail, self.mix_diff_thrust, self.mix_Gac, self.mix_Get, self.mix_Gef, self.mix_Gea, self.mix_Gee, self.mix_Gfa, self.mix_Gff, self.mix_Gve, self.mix_Gvr, self.mix_Gtt, self.mix_Gtr) = struct.unpack(self._pack_string, msg) # Message: config_mixer_matrix # Id: 16 class config_mixer_matrix(): id = 16 _pack_string = "<hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh" def __init__(self, msg=None): # public fields self.matrix = [0.0] * mix_matrix_size # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, int(round(self.matrix[0] * 16384)), int(round(self.matrix[1] * 16384)), int(round(self.matrix[2] * 16384)), int(round(self.matrix[3] * 16384)), int(round(self.matrix[4] * 16384)), int(round(self.matrix[5] * 16384)), int(round(self.matrix[6] * 16384)), int(round(self.matrix[7] * 16384)), int(round(self.matrix[8] * 16384)), int(round(self.matrix[9] * 16384)), int(round(self.matrix[10] * 16384)), int(round(self.matrix[11] * 16384)), int(round(self.matrix[12] * 16384)), int(round(self.matrix[13] * 16384)), int(round(self.matrix[14] * 16384)), int(round(self.matrix[15] * 16384)), int(round(self.matrix[16] * 16384)), int(round(self.matrix[17] * 16384)), int(round(self.matrix[18] * 16384)), int(round(self.matrix[19] * 16384)), int(round(self.matrix[20] * 16384)), int(round(self.matrix[21] * 16384)), int(round(self.matrix[22] * 16384)), int(round(self.matrix[23] * 16384)), int(round(self.matrix[24] * 16384)), int(round(self.matrix[25] * 16384)), int(round(self.matrix[26] * 16384)), int(round(self.matrix[27] * 16384)), int(round(self.matrix[28] * 16384)), int(round(self.matrix[29] * 16384)), int(round(self.matrix[30] * 16384)), int(round(self.matrix[31] * 16384)), int(round(self.matrix[32] * 16384)), int(round(self.matrix[33] * 16384)), int(round(self.matrix[34] * 16384)), int(round(self.matrix[35] * 16384)), int(round(self.matrix[36] * 16384)), int(round(self.matrix[37] * 16384)), int(round(self.matrix[38] * 16384)), int(round(self.matrix[39] * 16384)), int(round(self.matrix[40] * 16384)), int(round(self.matrix[41] * 16384)), int(round(self.matrix[42] * 16384)), int(round(self.matrix[43] * 16384)), int(round(self.matrix[44] * 16384)), int(round(self.matrix[45] * 16384)), int(round(self.matrix[46] * 16384)), int(round(self.matrix[47] * 16384)), int(round(self.matrix[48] * 16384)), int(round(self.matrix[49] * 16384)), int(round(self.matrix[50] * 16384)), int(round(self.matrix[51] * 16384)), int(round(self.matrix[52] * 16384)), int(round(self.matrix[53] * 16384)), int(round(self.matrix[54] * 16384)), int(round(self.matrix[55] * 16384)), int(round(self.matrix[56] * 16384)), int(round(self.matrix[57] * 16384)), int(round(self.matrix[58] * 16384)), int(round(self.matrix[59] * 16384)), int(round(self.matrix[60] * 16384)), int(round(self.matrix[61] * 16384)), int(round(self.matrix[62] * 16384)), int(round(self.matrix[63] * 16384))) return msg def unpack(self, msg): (self.matrix[0], self.matrix[1], self.matrix[2], self.matrix[3], self.matrix[4], self.matrix[5], self.matrix[6], self.matrix[7], self.matrix[8], self.matrix[9], self.matrix[10], self.matrix[11], self.matrix[12], self.matrix[13], self.matrix[14], self.matrix[15], self.matrix[16], self.matrix[17], self.matrix[18], self.matrix[19], self.matrix[20], self.matrix[21], self.matrix[22], self.matrix[23], self.matrix[24], self.matrix[25], self.matrix[26], self.matrix[27], self.matrix[28], self.matrix[29], self.matrix[30], self.matrix[31], self.matrix[32], self.matrix[33], self.matrix[34], self.matrix[35], self.matrix[36], self.matrix[37], self.matrix[38], self.matrix[39], self.matrix[40], self.matrix[41], self.matrix[42], self.matrix[43], self.matrix[44], self.matrix[45], self.matrix[46], self.matrix[47], self.matrix[48], self.matrix[49], self.matrix[50], self.matrix[51], self.matrix[52], self.matrix[53], self.matrix[54], self.matrix[55], self.matrix[56], self.matrix[57], self.matrix[58], self.matrix[59], self.matrix[60], self.matrix[61], self.matrix[62], self.matrix[63],) = struct.unpack(self._pack_string, msg) self.matrix[0] /= 16384 self.matrix[1] /= 16384 self.matrix[2] /= 16384 self.matrix[3] /= 16384 self.matrix[4] /= 16384 self.matrix[5] /= 16384 self.matrix[6] /= 16384 self.matrix[7] /= 16384 self.matrix[8] /= 16384 self.matrix[9] /= 16384 self.matrix[10] /= 16384 self.matrix[11] /= 16384 self.matrix[12] /= 16384 self.matrix[13] /= 16384 self.matrix[14] /= 16384 self.matrix[15] /= 16384 self.matrix[16] /= 16384 self.matrix[17] /= 16384 self.matrix[18] /= 16384 self.matrix[19] /= 16384 self.matrix[20] /= 16384 self.matrix[21] /= 16384 self.matrix[22] /= 16384 self.matrix[23] /= 16384 self.matrix[24] /= 16384 self.matrix[25] /= 16384 self.matrix[26] /= 16384 self.matrix[27] /= 16384 self.matrix[28] /= 16384 self.matrix[29] /= 16384 self.matrix[30] /= 16384 self.matrix[31] /= 16384 self.matrix[32] /= 16384 self.matrix[33] /= 16384 self.matrix[34] /= 16384 self.matrix[35] /= 16384 self.matrix[36] /= 16384 self.matrix[37] /= 16384 self.matrix[38] /= 16384 self.matrix[39] /= 16384 self.matrix[40] /= 16384 self.matrix[41] /= 16384 self.matrix[42] /= 16384 self.matrix[43] /= 16384 self.matrix[44] /= 16384 self.matrix[45] /= 16384 self.matrix[46] /= 16384 self.matrix[47] /= 16384 self.matrix[48] /= 16384 self.matrix[49] /= 16384 self.matrix[50] /= 16384 self.matrix[51] /= 16384 self.matrix[52] /= 16384 self.matrix[53] /= 16384 self.matrix[54] /= 16384 self.matrix[55] /= 16384 self.matrix[56] /= 16384 self.matrix[57] /= 16384 self.matrix[58] /= 16384 self.matrix[59] /= 16384 self.matrix[60] /= 16384 self.matrix[61] /= 16384 self.matrix[62] /= 16384 self.matrix[63] /= 16384 # Message: config_power # Id: 17 class config_power(): id = 17 _pack_string = "<B" def __init__(self, msg=None): # public fields self.have_attopilot = False # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.have_attopilot) return msg def unpack(self, msg): (self.have_attopilot,) = struct.unpack(self._pack_string, msg) # Message: config_pwm # Id: 18 class config_pwm(): id = 18 _pack_string = "<Hffffffff" def __init__(self, msg=None): # public fields self.pwm_hz = 0 self.act_gain = [0.0] * pwm_channels # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.pwm_hz, self.act_gain[0], self.act_gain[1], self.act_gain[2], self.act_gain[3], self.act_gain[4], self.act_gain[5], self.act_gain[6], self.act_gain[7]) return msg def unpack(self, msg): (self.pwm_hz, self.act_gain[0], self.act_gain[1], self.act_gain[2], self.act_gain[3], self.act_gain[4], self.act_gain[5], self.act_gain[6], self.act_gain[7]) = struct.unpack(self._pack_string, msg) # Message: config_stability_damping # Id: 19 class config_stability_damping(): id = 19 _pack_string = "<BBBBffff" def __init__(self, msg=None): # public fields self.sas_rollaxis = False self.sas_pitchaxis = False self.sas_yawaxis = False self.sas_tune = False self.sas_rollgain = 0.0 self.sas_pitchgain = 0.0 self.sas_yawgain = 0.0 self.sas_max_gain = 0.0 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.sas_rollaxis, self.sas_pitchaxis, self.sas_yawaxis, self.sas_tune, self.sas_rollgain, self.sas_pitchgain, self.sas_yawgain, self.sas_max_gain) return msg def unpack(self, msg): (self.sas_rollaxis, self.sas_pitchaxis, self.sas_yawaxis, self.sas_tune, self.sas_rollgain, self.sas_pitchgain, self.sas_yawgain, self.sas_max_gain) = struct.unpack(self._pack_string, msg) # Message: command_inceptors # Id: 20 class command_inceptors(): id = 20 _pack_string = "<hhhhhh" def __init__(self, msg=None): # public fields self.channel = [0.0] * ap_channels # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, int(round(self.channel[0] * 16384)), int(round(self.channel[1] * 16384)), int(round(self.channel[2] * 16384)), int(round(self.channel[3] * 16384)), int(round(self.channel[4] * 16384)), int(round(self.channel[5] * 16384))) return msg def unpack(self, msg): (self.channel[0], self.channel[1], self.channel[2], self.channel[3], self.channel[4], self.channel[5],) = struct.unpack(self._pack_string, msg) self.channel[0] /= 16384 self.channel[1] /= 16384 self.channel[2] /= 16384 self.channel[3] /= 16384 self.channel[4] /= 16384 self.channel[5] /= 16384 # Message: command_zero_gyros # Id: 21 class command_zero_gyros(): id = 21 _pack_string = "<" def __init__(self, msg=None): # public fields # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, return msg def unpack(self, msg): # Message: command_reset_ekf # Id: 22 class command_reset_ekf(): id = 22 _pack_string = "<" def __init__(self, msg=None): # public fields # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, return msg def unpack(self, msg): # Message: command_cycle_inceptors # Id: 23 class command_cycle_inceptors(): id = 23 _pack_string = "<" def __init__(self, msg=None): # public fields # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, return msg def unpack(self, msg): # Message: pilot # Id: 24 class pilot(): id = 24 _pack_string = "<hhhhhhhhhhhhhhhhB" def __init__(self, msg=None): # public fields self.channel = [0.0] * sbus_channels self.flags = 0 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, int(round(self.channel[0] * 16384)), int(round(self.channel[1] * 16384)), int(round(self.channel[2] * 16384)), int(round(self.channel[3] * 16384)), int(round(self.channel[4] * 16384)), int(round(self.channel[5] * 16384)), int(round(self.channel[6] * 16384)), int(round(self.channel[7] * 16384)), int(round(self.channel[8] * 16384)), int(round(self.channel[9] * 16384)), int(round(self.channel[10] * 16384)), int(round(self.channel[11] * 16384)), int(round(self.channel[12] * 16384)), int(round(self.channel[13] * 16384)), int(round(self.channel[14] * 16384)), int(round(self.channel[15] * 16384)), self.flags) return msg def unpack(self, msg): (self.channel[0], self.channel[1], self.channel[2], self.channel[3], self.channel[4], self.channel[5], self.channel[6], self.channel[7], self.channel[8], self.channel[9], self.channel[10], self.channel[11], self.channel[12], self.channel[13], self.channel[14], self.channel[15], self.flags) = struct.unpack(self._pack_string, msg) self.channel[0] /= 16384 self.channel[1] /= 16384 self.channel[2] /= 16384 self.channel[3] /= 16384 self.channel[4] /= 16384 self.channel[5] /= 16384 self.channel[6] /= 16384 self.channel[7] /= 16384 self.channel[8] /= 16384 self.channel[9] /= 16384 self.channel[10] /= 16384 self.channel[11] /= 16384 self.channel[12] /= 16384 self.channel[13] /= 16384 self.channel[14] /= 16384 self.channel[15] /= 16384 # Message: imu # Id: 25 class imu(): id = 25 _pack_string = "<Lhhhhhhhhhhhhhhhh" def __init__(self, msg=None): # public fields self.millis = 0 self.raw = [0] * 6 self.cal = [0] * 10 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.millis, self.raw[0], self.raw[1], self.raw[2], self.raw[3], self.raw[4], self.raw[5], self.cal[0], self.cal[1], self.cal[2], self.cal[3], self.cal[4], self.cal[5], self.cal[6], self.cal[7], self.cal[8], self.cal[9]) return msg def unpack(self, msg): (self.millis, self.raw[0], self.raw[1], self.raw[2], self.raw[3], self.raw[4], self.raw[5], self.cal[0], self.cal[1], self.cal[2], self.cal[3], self.cal[4], self.cal[5], self.cal[6], self.cal[7], self.cal[8], self.cal[9]) = struct.unpack(self._pack_string, msg) # Message: aura_nav_pvt # Id: 26 class aura_nav_pvt(): id = 26 _pack_string = "<LhBBBBBBLlBBBBllllLLlllLlLLHBBBBBBlhH" def __init__(self, msg=None): # public fields self.iTOW = 0 self.year = 0 self.month = 0 self.day = 0 self.hour = 0 self.min = 0 self.sec = 0 self.valid = 0 self.tAcc = 0 self.nano = 0 self.fixType = 0 self.flags = 0 self.flags2 = 0 self.numSV = 0 self.lon = 0 self.lat = 0 self.height = 0 self.hMSL = 0 self.hAcc = 0 self.vAcc = 0 self.velN = 0 self.velE = 0 self.velD = 0 self.gSpeed = 0 self.heading = 0 self.sAcc = 0 self.headingAcc = 0 self.pDOP = 0 self.reserved = [0] * 6 self.headVeh = 0 self.magDec = 0 self.magAcc = 0 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.iTOW, self.year, self.month, self.day, self.hour, self.min, self.sec, self.valid, self.tAcc, self.nano, self.fixType, self.flags, self.flags2, self.numSV, self.lon, self.lat, self.height, self.hMSL, self.hAcc, self.vAcc, self.velN, self.velE, self.velD, self.gSpeed, self.heading, self.sAcc, self.headingAcc, self.pDOP, self.reserved[0], self.reserved[1], self.reserved[2], self.reserved[3], self.reserved[4], self.reserved[5], self.headVeh, self.magDec, self.magAcc) return msg def unpack(self, msg): (self.iTOW, self.year, self.month, self.day, self.hour, self.min, self.sec, self.valid, self.tAcc, self.nano, self.fixType, self.flags, self.flags2, self.numSV, self.lon, self.lat, self.height, self.hMSL, self.hAcc, self.vAcc, self.velN, self.velE, self.velD, self.gSpeed, self.heading, self.sAcc, self.headingAcc, self.pDOP, self.reserved[0], self.reserved[1], self.reserved[2], self.reserved[3], self.reserved[4], self.reserved[5], self.headVeh, self.magDec, self.magAcc) = struct.unpack(self._pack_string, msg) # Message: airdata # Id: 27 class airdata(): id = 27 _pack_string = "<ffffffH" def __init__(self, msg=None): # public fields self.baro_press_pa = 0.0 self.baro_temp_C = 0.0 self.baro_hum = 0.0 self.ext_diff_press_pa = 0.0 self.ext_static_press_pa = 0.0 self.ext_temp_C = 0.0 self.error_count = 0 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.baro_press_pa, self.baro_temp_C, self.baro_hum, self.ext_diff_press_pa, self.ext_static_press_pa, self.ext_temp_C, self.error_count) return msg def unpack(self, msg): (self.baro_press_pa, self.baro_temp_C, self.baro_hum, self.ext_diff_press_pa, self.ext_static_press_pa, self.ext_temp_C, self.error_count) = struct.unpack(self._pack_string, msg) # Message: power # Id: 28 class power(): id = 28 _pack_string = "<HHHH" def __init__(self, msg=None): # public fields self.int_main_v = 0.0 self.avionics_v = 0.0 self.ext_main_v = 0.0 self.ext_main_amp = 0.0 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, int(round(self.int_main_v * 100)), int(round(self.avionics_v * 100)), int(round(self.ext_main_v * 100)), int(round(self.ext_main_amp * 100))) return msg def unpack(self, msg): (self.int_main_v, self.avionics_v, self.ext_main_v, self.ext_main_amp) = struct.unpack(self._pack_string, msg) self.int_main_v /= 100 self.avionics_v /= 100 self.ext_main_v /= 100 self.ext_main_amp /= 100 # Message: status # Id: 29 class status(): id = 29 _pack_string = "<HHHLHH" def __init__(self, msg=None): # public fields self.serial_number = 0 self.firmware_rev = 0 self.master_hz = 0 self.baud = 0 self.byte_rate = 0 self.timer_misses = 0 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.serial_number, self.firmware_rev, self.master_hz, self.baud, self.byte_rate, self.timer_misses) return msg def unpack(self, msg): (self.serial_number, self.firmware_rev, self.master_hz, self.baud, self.byte_rate, self.timer_misses) = struct.unpack(self._pack_string, msg) # Message: ekf # Id: 30 class ekf(): id = 30 _pack_string = "<LddfffffffffffffHHHB" def __init__(self, msg=None): # public fields self.millis = 0 self.lat_rad = 0.0 self.lon_rad = 0.0 self.altitude_m = 0.0 self.vn_ms = 0.0 self.ve_ms = 0.0 self.vd_ms = 0.0 self.phi_rad = 0.0 self.the_rad = 0.0 self.psi_rad = 0.0 self.p_bias = 0.0 self.q_bias = 0.0 self.r_bias = 0.0 self.ax_bias = 0.0 self.ay_bias = 0.0 self.az_bias = 0.0 self.max_pos_cov = 0.0 self.max_vel_cov = 0.0 self.max_att_cov = 0.0 self.status = 0 # unpack if requested if msg: self.unpack(msg) def pack(self): msg = struct.pack(self._pack_string, self.millis, self.lat_rad, self.lon_rad, self.altitude_m, self.vn_ms, self.ve_ms, self.vd_ms, self.phi_rad, self.the_rad, self.psi_rad, self.p_bias, self.q_bias, self.r_bias, self.ax_bias, self.ay_bias, self.az_bias, int(round(self.max_pos_cov * 100)), int(round(self.max_vel_cov * 1000)), int(round(self.max_att_cov * 10000)), self.status) return msg def unpack(self, msg): (self.millis, self.lat_rad, self.lon_rad, self.altitude_m, self.vn_ms, self.ve_ms, self.vd_ms, self.phi_rad, self.the_rad, self.psi_rad, self.p_bias, self.q_bias, self.r_bias, self.ax_bias, self.ay_bias, self.az_bias, self.max_pos_cov, self.max_vel_cov, self.max_att_cov, self.status) = struct.unpack(self._pack_string, msg) self.max_pos_cov /= 100 self.max_vel_cov /= 1000 self.max_att_cov /= 10000
30.742188
86
0.472766
4,052
35,415
3.950888
0.070089
0.120557
0.069711
0.088138
0.67918
0.531014
0.519395
0.477794
0.434443
0.425448
0
0.08817
0.41906
35,415
1,151
87
30.768897
0.689948
0
0
0.474385
0
0
0.008508
0.004667
0
0
0
0
0
0
null
null
0
0.001025
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
83a488662edcd23d97eb9c55b24ca7fbca5d6193
7,727
py
Python
gw_full_latest/CloudTTN.py
rendikanyut/LowCostLoRaGw
a4bce0cf123ffeb48a01e779a62d76b1bf1c4486
[ "Linux-OpenIB" ]
654
2016-03-01T08:43:24.000Z
2022-03-22T06:55:27.000Z
gw_full_latest/CloudTTN.py
rendikanyut/LowCostLoRaGw
a4bce0cf123ffeb48a01e779a62d76b1bf1c4486
[ "Linux-OpenIB" ]
315
2016-02-25T10:36:11.000Z
2022-03-31T20:59:21.000Z
gw_full_latest/CloudTTN.py
rendikanyut/LowCostLoRaGw
a4bce0cf123ffeb48a01e779a62d76b1bf1c4486
[ "Linux-OpenIB" ]
388
2016-02-16T14:40:36.000Z
2022-03-15T04:03:20.000Z
#------------------------------------------------------------------------------- # Part of this Python script is taken from the Pycom NanoGateway # https://github.com/pycom/pycom-libraries/tree/master/examples/lorawan-nano-gateway # # Adapted by Congduc.Pham@univ-pau.fr # # This file is part of the low-cost LoRa gateway developped at University of Pau # # 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 3 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. # # You should have received a copy of the GNU General Public License # along with the program. If not, see <http://www.gnu.org/licenses/>. #------------------------------------------------------------------------------- import binascii import json import os import socket import time import datetime from dateutil import parser import calendar import sys #don't generate pyc (no compilation of imported module) so change in key_* file can be done dynamically sys.dont_write_bytecode = True import key_TTN as key_LoRaWAN netserv='TTN' try: key_LoRaWAN.source_list except AttributeError: key_LoRaWAN.source_list=[] try: key_LoRaWAN.lorawan_server except AttributeError: key_LoRaWAN.lorawan_server="router.eu.thethings.network" try: key_LoRaWAN.lorawan_port except AttributeError: key_LoRaWAN.lorawan_port=1700 PROTOCOL_VERSION = 2 PUSH_DATA = 0 PUSH_ACK = 1 PULL_DATA = 2 PULL_ACK = 4 PULL_RESP = 3 RX_PK = { 'rxpk': [{ 'time': '', 'tmst': 0, 'chan': 0, 'rfch': 0, 'freq': 0, 'stat': 1, 'modu': 'LORA', 'datr': '', 'codr': '4/5', 'rssi': 0, 'lsnr': 0, 'size': 0, 'data': '' }] } TX_ACK_PK = { 'txpk_ack': { 'error': '' } } class LoRaWAN: def __init__(self, id, frequency, bw, sf, server, port): self.id = id self.frequency = frequency self.sf = sf self.bw = bw self.server = server self.port = port self.server_ip = None self.sock = None def start(self): self._log('Cloud%s: gw id: {}' % netserv, self.id) # get the server IP and create an UDP socket try: self.server_ip = socket.getaddrinfo(self.server, self.port)[0][-1] self._log('Cloud%s: Opening UDP socket to {} ({}) port {}...' % netserv, self.server, self.server_ip[0], self.server_ip[1]) self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.sock.setblocking(False) except Exception as ex: self._log('Cloud%s: Failed to connect to server: {}' % netserv, ex) def _sf_bw_to_dr(self, sf, bw): dr = 'SF' + str(sf) if bw == 125: return dr + 'BW125' elif bw == 250: return dr + 'BW250' else: return dr + 'BW500' def rx_packet(self, ldata, datalen, tdata, tmst, rssi, snr): RX_PK["rxpk"][0]["time"] = tdata if tmst=='': #in seconds, maybe we should put it in microsecond? RX_PK["rxpk"][0]["tmst"] = calendar.timegm(time.gmtime()) else: RX_PK["rxpk"][0]["tmst"] = int(tmst) RX_PK["rxpk"][0]["freq"] = self.frequency RX_PK["rxpk"][0]["datr"] = self._sf_bw_to_dr(self.sf, self.bw) RX_PK["rxpk"][0]["rssi"] = rssi RX_PK["rxpk"][0]["lsnr"] = snr RX_PK["rxpk"][0]["data"] = ldata RX_PK["rxpk"][0]["size"] = datalen #packet = self._make_node_packet(rx_data, tdata, 0, self.sf, self.bw, rssi, snr) packet=json.dumps(RX_PK) self._push_data(packet) self._log('Cloud%s: Received packet: {}' % netserv, packet) def _push_data(self, data): token = os.urandom(2) packet = bytearray([PROTOCOL_VERSION]) + token + bytearray([PUSH_DATA]) + binascii.unhexlify(self.id) + data #print ''.join('{:02x}'.format(x) for x in packet) #self._log('Cloud%s: Try to forward packet: {}' % netserv, packet) try: self.sock.sendto(packet, self.server_ip) self.sock.close() except Exception as ex: self._log('Cloud%s: Failed to push uplink packet to server: {}' % netserv, ex) def _log(self, message, *args): print('{}'.format(str(message).format(*args))) # Testing with pau_lorawan_testing/Pau_testing_device 0x26011721 # # python CloudTTN.py "QCEXASYAAAABhCGE1L87NCDMk0jLa6hYXm0e+g==" "256,64,637605665,0,28,8,-45" "125,5,12,868100" "2019-03-25T18:46:00.528+01:00" "0000B827EBD1B236" # or # python CloudTTN.py "QCEXASYAAAABhCGE1L87NCDMk0jLa6hYXm0e+g==" "256,64,637605665,0,28,8,-45" "125,5,12,868100" "`date +%FT%T%z`" "0000B827EBD1B236" # # get the base64 encrypted data from `Arduino_LoRa_temp` sending "Hello from UPPA" # # Hello from UPPA # plain payload hex # 48 65 6C 6C 6F 20 66 72 6F 6D 20 55 50 50 41 # Encrypting # encrypted payload # 84 21 84 D4 BF 3B 34 20 CC 93 48 CB 6B A8 58 # calculate MIC with NwkSKey # transmitted LoRaWAN-like packet: # MHDR[1] | DevAddr[4] | FCtrl[1] | FCnt[2] | FPort[1] | EncryptedPayload | MIC[4] # 40 21 17 01 26 00 00 00 01 84 21 84 D4 BF 3B 34 20 CC 93 48 CB 6B A8 58 5E 6D 1E FA # [base64 LoRaWAN HEADER+CIPHER+MIC]:QCEXASYAAAABhCGE1L87NCDMk0jLa6hYXm0e+g== def main(ldata, pdata, rdata, tdata, gwid): # this is common code to process packet information provided by the main gateway script (i.e. post_processing_gw.py) # these information are provided in case you need them arr = map(int,pdata.split(',')) dst=arr[0] ptype=arr[1] src=arr[2] seq=arr[3] datalen=arr[4] SNR=arr[5] RSSI=arr[6] #if lora packet is received with an SX1301 concentrator, then the packet-formatter will pass the tmst field after the date information, separated by '*' #i.e. "2019-03-25T18:46:00.528+01:00*29641444" tmst=tdata.count('*') if (tmst != 0): tdata_tmp=tdata.split('*')[0] tmst=tdata.split('*')[1] tdata=tdata_tmp else: tmst='' #from 2019-05-14T14:53:10.241191+02:00 (similar to command date +%FT%T.%6N%z) #to 2019-05-14T14:53:10.241191Z (similar to command date +%FT%T.%6NZ) dt = parser.parse(tdata) #in case you want to remove microsecond #tdata = dt.replace(microsecond=0,tzinfo=None).isoformat()+"Z" tdata = dt.replace(tzinfo=None).isoformat()+"Z" arr = map(int,rdata.split(',')) rbw=arr[0] rcr=arr[1] rsf=arr[2] rfq=arr[3]/1000.0 #LoRaWAN packet if dst==256: src_str="0x%0.8X" % src #we force to BW125 as TTN is can not handle other bandwidth right now, for instance those of Lora 2.4GHz #TODO: change when TTN will support LoRa 2.4GHz rbw=125 else: src_str=str(src) if (src_str in key_LoRaWAN.source_list) or (len(key_LoRaWAN.source_list)==0): #build the ttn_gwid which is defined to be gwid[4:10]+"FFFF"+gwid[10:] #gwid is normally defined as eth0 MAC address filled by 0 in front: 0000B827EBD1B236 ttn_gwid=gwid[4:10]+"FFFF"+gwid[10:] ttn = LoRaWAN( id=ttn_gwid, frequency=rfq, bw=rbw, sf=rsf, server=key_LoRaWAN.lorawan_server, port=key_LoRaWAN.lorawan_port) ttn.start() ttn.rx_packet(ldata, datalen, tdata, tmst, RSSI, SNR) else: print "Source is not is source list, not sending to %s" % netserv if __name__ == "__main__": main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])
31.410569
162
0.640611
1,171
7,727
4.133219
0.347566
0.022727
0.016529
0.016736
0.171281
0.118595
0.073141
0.073141
0.06405
0.06405
0
0.070015
0.208878
7,727
245
163
31.538776
0.721741
0.42125
0
0.101351
0
0
0.103104
0.006118
0
0
0
0.004082
0
0
null
null
0
0.067568
null
null
0.013514
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
83a940e2ed8e27f8008df09f81164f38241b0cc0
303
bzl
Python
examples/index.bzl
SebastianPodgajny/rules_nodejs
7d1fbd9b6751225f502eccf2a91d1059371d461d
[ "Apache-2.0" ]
null
null
null
examples/index.bzl
SebastianPodgajny/rules_nodejs
7d1fbd9b6751225f502eccf2a91d1059371d461d
[ "Apache-2.0" ]
null
null
null
examples/index.bzl
SebastianPodgajny/rules_nodejs
7d1fbd9b6751225f502eccf2a91d1059371d461d
[ "Apache-2.0" ]
null
null
null
"Used to reference the nested workspaces for examples in /WORKSPACE" ALL_EXAMPLES = [ "angular", "app", "kotlin", "nestjs", "parcel", "protocol_buffers", "user_managed_deps", "vendored_node", "vendored_node_and_yarn", "web_testing", "webapp", "worker", ]
18.9375
68
0.617162
32
303
5.5625
0.90625
0.134831
0
0
0
0
0
0
0
0
0
0
0.244224
303
15
69
20.2
0.777293
0.217822
0
0
0
0
0.610561
0.072607
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
83a97810070d0ec137e7706e16cb2e0d4e501275
2,611
py
Python
testproject/testproject/views.py
Najiva/django-tables2-column-shifter
90695d5890c4ef6d7ba58a189a53d712aa8b9e14
[ "BSD-3-Clause" ]
19
2017-01-04T19:17:57.000Z
2021-08-05T20:06:32.000Z
testproject/testproject/views.py
Najiva/django-tables2-column-shifter
90695d5890c4ef6d7ba58a189a53d712aa8b9e14
[ "BSD-3-Clause" ]
16
2017-02-20T20:24:01.000Z
2021-07-23T12:50:35.000Z
testproject/testproject/views.py
Najiva/django-tables2-column-shifter
90695d5890c4ef6d7ba58a189a53d712aa8b9e14
[ "BSD-3-Clause" ]
8
2017-01-26T07:15:54.000Z
2022-03-22T18:03:24.000Z
from django.views.generic import TemplateView from django_tables2.config import RequestConfig from django_tables2_column_shifter.tables import ( ColumnShiftTableBootstrap2, ColumnShiftTableBootstrap3, ColumnShiftTableBootstrap4, ColumnShiftTableBootstrap5, ) from .models import Author, Book from .tables import get_author_table_class, get_book_table_class class Index(TemplateView): template_name = "testproject/index.html" class Base(object): container_css = "span10 offset1" template_name = "testproject/test_bootstrap2.html" table_class_version = ColumnShiftTableBootstrap2 def get_context_data(self, **kwargs): context = super(Base, self).get_context_data(**kwargs) # Build tabels author_queryset = Author.objects.all() author_table1 = get_author_table_class( self.table_class_version )(author_queryset) author_table2 = get_author_table_class( self.table_class_version )(author_queryset, prefix="authors2") book_queryset = Book.objects.all() book_table = get_book_table_class( self.table_class_version )(book_queryset, prefix="books") # Turn on sorting and pagination RequestConfig(self.request, paginate={'per_page': 2}).configure(author_table1) RequestConfig(self.request, paginate={'per_page': 2}).configure(author_table2) RequestConfig(self.request, paginate={'per_page': 2}).configure(book_table) context['container_css'] = self.container_css context['author_table1'] = author_table1 context['author_table2'] = author_table2 context['book_table'] = book_table context['book_queryset'] = book_queryset return context class Bootstrap2(Base, TemplateView): pass class Bootstrap3(Base, TemplateView): container_css = "col-xs-10 col-xs-offset-1" template_name = "testproject/test_bootstrap3.html" table_class_version = ColumnShiftTableBootstrap3 class Bootstrap4(Base, TemplateView): container_css = "col-xs-10 col-xs-offset-1" template_name = "testproject/test_bootstrap4.html" table_class_version = ColumnShiftTableBootstrap4 class Bootstrap4_1_3(Base, TemplateView): container_css = "col-xs-10 col-xs-offset-1" template_name = "testproject/test_bootstrap4.1.3.html" table_class_version = ColumnShiftTableBootstrap4 class Bootstrap5(Base, TemplateView): container_css = "col-xs-10 col-xs-offset-1" template_name = "testproject/test_bootstrap5.html" table_class_version = ColumnShiftTableBootstrap5
32.234568
86
0.73152
294
2,611
6.221088
0.251701
0.071077
0.074358
0.073811
0.392564
0.392564
0.318753
0.318753
0.291963
0.231821
0
0.024299
0.180391
2,611
80
87
32.6375
0.830374
0.016469
0
0.160714
0
0
0.155556
0.072515
0
0
0
0
0
1
0.017857
false
0.017857
0.089286
0
0.535714
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
83babd001889716c3b9b2382b50058698f6c9529
4,701
py
Python
resources.py
kordimsan/FreeWorker-Api
f4566d2d500328725c88d5fc5df7a4763cb4c185
[ "MIT" ]
null
null
null
resources.py
kordimsan/FreeWorker-Api
f4566d2d500328725c88d5fc5df7a4763cb4c185
[ "MIT" ]
null
null
null
resources.py
kordimsan/FreeWorker-Api
f4566d2d500328725c88d5fc5df7a4763cb4c185
[ "MIT" ]
null
null
null
#from flask_restful import Resource, reqparse from flask_restplus import Resource, reqparse,fields from models import UserModel, RevokedTokenModel from flask_jwt_extended import (create_access_token, create_refresh_token, jwt_required, jwt_refresh_token_required, get_jwt_identity, get_raw_jwt) from run import api parser = reqparse.RequestParser() parser.add_argument('username', help = 'This field cannot be blank', required = True) parser.add_argument('password', help = 'This field cannot be blank', required = True) param = api.model('User registration', {'username' : fields.String('username'), 'password' : fields.String('password')}) class UserRegistration(Resource): @api.expect(param) def post(self): data = parser.parse_args() if UserModel.find_by_username(data['username']): return {'message': 'User {} already exists'.format(data['username'])} new_user = UserModel( username = data['username'], password = UserModel.generate_hash(data['password']) ) try: new_user.save_to_db() access_token = create_access_token(identity = data['username']) refresh_token= create_refresh_token(identity = data['username']) return { 'message': 'User {} was created'.format(data['username']), 'access_token': access_token, 'refresh_token': refresh_token } except: return {'message': 'Something went wrong'}, 500 param = api.model('User login', {'username' : fields.String('username'), 'password' : fields.String('password')}) class UserLogin(Resource): @api.expect(param) def post(self): data = parser.parse_args() current_user = UserModel.find_by_username(data['username']) if not current_user: return {'message': 'User {} doesn\'t exist'.format(data['username'])} if UserModel.verify_hash(data['password'], current_user.password): access_token = create_access_token(identity = data['username']) refresh_token = create_refresh_token(identity = data['username']) return { 'message': 'Logged in as {}'.format(current_user.username), 'access_token': access_token, 'refresh_token': refresh_token } else: return {'message': 'Wrong credentials'} class UserLogoutAccess(Resource): @api.doc(security='apikey') @jwt_required def post(self): jti = get_raw_jwt()['jti'] try: revoked_token = RevokedTokenModel(jti = jti) revoked_token.add() return {'message': 'Access token has been revoked'} except: return {'message': 'Something went wrong'}, 500 class UserLogoutRefresh(Resource): @jwt_refresh_token_required def post(self): jti = get_raw_jwt()['jti'] try: revoked_token = RevokedTokenModel(jti = jti) revoked_token.add() return {'message': 'Refresh token has been revoked'} except: return {'message': 'Something went wrong'}, 500 class TokenRefresh(Resource): @jwt_refresh_token_required def post(self): current_user = get_jwt_identity() access_token = create_access_token(identity = current_user) return {'access_token': access_token} class AllUsers(Resource): @api.doc(security='apikey') @jwt_required def get(self): return UserModel.return_all() @api.doc(security='apikey') @jwt_required def delete(self): return UserModel.delete_all() class UsersByName(Resource): @api.doc(security='apikey') @jwt_required def get(self,username): x = UserModel.find_by_username(username) if not x: return {'message': 'User {} doesn\'t exist'.format(username)} return { 'user_id': x.user_id, 'username': x.username, 'password': x.password, 'email': x.email, 'admin': x.admin, 'first_name': x.first_name, 'last_name': x.last_name, 'phone_number': x.phone_number, 'latitude': x.latitude, 'longitude': x.longitude, 'area': x.area, } @api.doc(security='apikey') @jwt_required def delete(self,username): return UserModel.del_by_username(username) class SecretResource(Resource): @api.doc(security='apikey') @jwt_required def get(self): return { 'answer': 42 }
34.313869
147
0.605829
502
4,701
5.48008
0.229084
0.05598
0.030534
0.043621
0.559069
0.551436
0.512904
0.473646
0.411123
0.295529
0
0.003235
0.27675
4,701
137
148
34.313869
0.805882
0.00936
0
0.45614
0
0
0.161477
0
0
0
0
0
0
1
0.087719
false
0.052632
0.035088
0.035088
0.342105
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
1
83bdd2c382d1213ade5ce2c23b12fd693e9a4c32
700
py
Python
example.py
six-two/py_derive_cmd
ae821f16a057a809166b287ab9f203a8cf4b34b3
[ "MIT" ]
null
null
null
example.py
six-two/py_derive_cmd
ae821f16a057a809166b287ab9f203a8cf4b34b3
[ "MIT" ]
null
null
null
example.py
six-two/py_derive_cmd
ae821f16a057a809166b287ab9f203a8cf4b34b3
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # pylint: disable=unused-wildcard-import from py_derive_cmd import * import cmd class MyCmd(cmd.Cmd): pass s = Settings(MyCmd, print_warnings=False) @make_command(s, 'Test for the decorator', aliases=['d']) def test_decorator(shell: MyCmd, req_arg: str, opt_arg: str = None): print('Decorator works') print(req_arg) print(opt_arg) def test_register(shell: MyCmd, raw_arg: str): print('Register works') print(raw_arg) @make_command(s, 'Exit the shell by pressing Ctrl-D') def EOF(shell: MyCmd) -> bool: return True CommandInfo(s, test_register, ['registered', 'r'], 'Test for register', raw_arg=True).register() shell = MyCmd() shell.cmdloop()
25
96
0.708571
105
700
4.580952
0.485714
0.08316
0.049896
0
0
0
0
0
0
0
0
0.001681
0.15
700
28
97
25
0.806723
0.085714
0
0
0
0
0.176839
0
0
0
0
0
0
1
0.157895
false
0.052632
0.105263
0.052632
0.368421
0.315789
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
1
83be1a3a3ee334b7ce8506d005b0c751dcb0f57c
2,474
py
Python
tf_quant_finance/datetime/constants.py
slowy07/tf-quant-finance
0976f720fb58a2d7bfd863640c12a2425cd2f94f
[ "Apache-2.0" ]
3,138
2019-07-24T21:43:17.000Z
2022-03-30T12:11:09.000Z
tf_quant_finance/datetime/constants.py
Aarif1430/tf-quant-finance
9372eb1ddf2b48cb1a3d4283bc67a10647ddc7a6
[ "Apache-2.0" ]
63
2019-09-07T19:16:03.000Z
2022-03-29T19:29:40.000Z
tf_quant_finance/datetime/constants.py
Aarif1430/tf-quant-finance
9372eb1ddf2b48cb1a3d4283bc67a10647ddc7a6
[ "Apache-2.0" ]
423
2019-07-26T21:28:05.000Z
2022-03-26T13:07:44.000Z
# Lint as: python3 # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Date-related constants and enums.""" import enum class Month(enum.Enum): """Months. Values are one-based.""" JANUARY = 1 FEBUARY = 2 MARCH = 3 APRIL = 4 MAY = 5 JUNE = 6 JULY = 7 AUGUST = 8 SEPTEMBER = 9 OCTOBER = 10 NOVEMBER = 11 DECEMBER = 12 class WeekDay(enum.Enum): """Named days of the week. Values are zero-based with Monday = 0.""" # We follow Python datetime convention of starting from 0. MONDAY = 0 TUESDAY = 1 WEDNESDAY = 2 THURSDAY = 3 FRIDAY = 4 SATURDAY = 5 SUNDAY = 6 class PeriodType(enum.Enum): """Periods that can be added or subtracted from DateTensors.""" DAY = 0 WEEK = 1 MONTH = 2 YEAR = 3 class BusinessDayConvention(enum.Enum): """Conventions that determine how to roll dates that fall on holidays. * `NONE`: No adjustment * `FOLLOWING`: Choose the first business day after the given holiday. * `MODIFIED_FOLLOWING`: Choose the first business day after the given holiday unless that day falls in the next calendar month, in which case choose the first business day before the holiday. * `PRECEDING`: Choose the first business day before the given holiday. * `MODIFIED_PRECEDING`: Choose the first business day before the given holiday unless that day falls in the previous calendar month, in which case choose the first business day after the holiday. """ NONE = 0 FOLLOWING = 1 MODIFIED_FOLLOWING = 2 PRECEDING = 3 MODIFIED_PRECEDING = 4 # TODO(b/148011715): add NEAREST convention. class WeekendMask(object): """Provides weekend masks for some of the common weekend patterns.""" # E.g. US/UK/Europe etc. SATURDAY_SUNDAY = (0, 0, 0, 0, 0, 1, 1) # E.g. Most countries in the Middle East. FRIDAY_SATURDAY = (0, 0, 0, 0, 1, 1, 0) # E.g. India, Nepal. SUNDAY_ONLY = (0, 0, 0, 0, 0, 0, 1) # Default value. NONE = (0, 0, 0, 0, 0, 0, 0)
26.891304
80
0.696847
379
2,474
4.530343
0.485488
0.020967
0.024461
0.023296
0.236459
0.236459
0.220734
0.210833
0.210833
0.184042
0
0.040617
0.213824
2,474
91
81
27.186813
0.842159
0.660469
0
0
0
0
0
0
0
0
0
0.010989
0
1
0
false
0
0.026316
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
83c1d004633b6b337c6d2bc2c9a3fefc61d57d42
789
py
Python
setup.py
nakagami/pure-pyawabi
5ffafcaa381727af7f84013cf036a4e8f7dd51da
[ "MIT" ]
1
2021-12-13T11:29:04.000Z
2021-12-13T11:29:04.000Z
setup.py
nakagami/pure-pyawabi
5ffafcaa381727af7f84013cf036a4e8f7dd51da
[ "MIT" ]
null
null
null
setup.py
nakagami/pure-pyawabi
5ffafcaa381727af7f84013cf036a4e8f7dd51da
[ "MIT" ]
null
null
null
from setuptools import setup setup( name="pure-pyawabi", version="0.2.4", description='A morphological analyzer awabi clone', long_description=open('README.md', encoding='utf-8').read(), long_description_content_type="text/markdown", url='https://github.com/nakagami/pure-pyawabi/', classifiers=[ "License :: OSI Approved :: MIT License", "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Programming Language :: Python", "Programming Language :: Python :: 3.8", "Operating System :: POSIX", ], keywords=['MeCab'], license="MIT", author='Hajime Nakagami', author_email='nakagami@gmail.com', test_suite="tests", packages=['pyawabi'], scripts=['bin/pyawabi'], )
30.346154
64
0.628644
84
789
5.833333
0.761905
0.044898
0.102041
0
0
0
0
0
0
0
0
0.011254
0.21166
789
25
65
31.56
0.776527
0
0
0
0
0
0.476553
0
0
0
0
0
0
1
0
true
0
0.041667
0
0.041667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
1
83c369bbe9d3c23a66d5fe993029ea43352f5559
676
py
Python
exopy_qm/tasks/tasks/GetIOValuesTask.py
rassouly/exopy_qm
82eb7e4b4fc7364df3462bb7faa7a0880d699afc
[ "BSD-3-Clause" ]
null
null
null
exopy_qm/tasks/tasks/GetIOValuesTask.py
rassouly/exopy_qm
82eb7e4b4fc7364df3462bb7faa7a0880d699afc
[ "BSD-3-Clause" ]
null
null
null
exopy_qm/tasks/tasks/GetIOValuesTask.py
rassouly/exopy_qm
82eb7e4b4fc7364df3462bb7faa7a0880d699afc
[ "BSD-3-Clause" ]
null
null
null
from exopy.tasks.api import (InstrumentTask) from atom.api import Unicode, Bool, set_default import sys from exopy_qm.utils.dynamic_importer import * class GetIOValuesTask(InstrumentTask): """ Gets the IO values """ get_io_1 = Bool(True).tag(pref=True) get_io_2 = Bool(True).tag(pref=True) database_entries = set_default({'IO1': {}, 'IO2': {}}) def __init__(self, **kwargs): super().__init__(**kwargs) def perform(self): io_values = self.driver.get_io_values() if self.get_io_1: self.write_in_database('IO1', io_values[0]) if self.get_io_2: self.write_in_database('IO2', io_values[0])
26
58
0.653846
95
676
4.336842
0.452632
0.097087
0.029126
0.072816
0.092233
0
0
0
0
0
0
0.018797
0.213018
676
25
59
27.04
0.755639
0.026627
0
0
0
0
0.018576
0
0
0
0
0
0
1
0.125
false
0
0.25
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
83c3ff2e3e7205ac40f986b841cd8fa73336b765
1,158
py
Python
src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_PNET_Container_d.py
pnkfb9/gem5_priority
fbf766277df78a470758cf7d798d12fb1e7c51c4
[ "BSD-3-Clause" ]
null
null
null
src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_PNET_Container_d.py
pnkfb9/gem5_priority
fbf766277df78a470758cf7d798d12fb1e7c51c4
[ "BSD-3-Clause" ]
null
null
null
src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_PNET_Container_d.py
pnkfb9/gem5_priority
fbf766277df78a470758cf7d798d12fb1e7c51c4
[ "BSD-3-Clause" ]
null
null
null
# Authors: Davide Zoni from m5.params import * from m5.proxy import * from BasicRouter import BasicRouter class GarnetRouter_PNET_Container_d(BasicRouter): type = 'GarnetRouter_PNET_Container_d' cxx_class = 'Router_PNET_Container_d' cxx_header = "mem/ruby/network/garnet/fixed-pipeline/Router_PNET_Container_d.hh" vcs_per_vnet = Param.Int(Parent.vcs_per_vnet, "virtual channels per virtual network") virt_nets = Param.Int(Parent.number_of_virtual_networks, "number of virtual networks") virt_nets_spurious = Param.Int(Parent.number_of_virtual_networks_spurious, "number of virtual networks spurious to be used with VNET_REUSE") # param moved to garnet network to be distributed to both routers and NICs totVicharSlotPerVnet = Param.UInt8(Parent.totVicharSlotPerVnet, "VICHAR slots per vnet in the input buffer"); numFifoResynchSlots=Param.UInt8(Parent.numFifoResynchSlots,"Number of slots in the FIFO resynchronizer, when used"); router_frequency = Param.Counter(Parent.router_frequency, "initial router frequency for each router");
52.636364
120
0.740069
147
1,158
5.619048
0.455782
0.048426
0.067797
0.11138
0.136804
0.089588
0.089588
0
0
0
0
0.004278
0.192573
1,158
21
121
55.142857
0.879144
0.080311
0
0
0
0
0.353107
0.110169
0
0
0
0
0
1
0
false
0
0.1875
0
0.8125
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
83c6045e3e675c58b5fec8fdf9881ebf94e9feda
334
py
Python
condition/models.py
SamusChief/myth-caster-api
76a43f48b70c6a4b509c90757d7906689799cc25
[ "MIT" ]
null
null
null
condition/models.py
SamusChief/myth-caster-api
76a43f48b70c6a4b509c90757d7906689799cc25
[ "MIT" ]
null
null
null
condition/models.py
SamusChief/myth-caster-api
76a43f48b70c6a4b509c90757d7906689799cc25
[ "MIT" ]
1
2021-08-14T18:46:52.000Z
2021-08-14T18:46:52.000Z
""" Models for Conditions app """ from django.db import models from common.models import OwnedModel class Condition(OwnedModel): """ Condition model """ name = models.CharField(unique=True, max_length=255, db_index=True) description = models.TextField() def __str__(self): return f'Condition: {self.name}'
23.857143
71
0.700599
41
334
5.560976
0.682927
0
0
0
0
0
0
0
0
0
0
0.010989
0.182635
334
13
72
25.692308
0.824176
0.125749
0
0
0
0
0.079137
0
0
0
0
0
0
1
0.142857
false
0
0.285714
0.142857
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
1
83cfac902258a852b3126b17d68f53a3484fe5c0
1,757
py
Python
code_examples/Python/app_debugger/test_client/test_debugger.py
VPoser/docs-and-training
55d4aa4c5b964f3c810d58008db4c5b75260322b
[ "Zlib" ]
null
null
null
code_examples/Python/app_debugger/test_client/test_debugger.py
VPoser/docs-and-training
55d4aa4c5b964f3c810d58008db4c5b75260322b
[ "Zlib" ]
4
2019-05-29T06:16:56.000Z
2021-03-31T19:03:36.000Z
code_examples/Python/app_debugger/test_client/test_debugger.py
VPoser/docs-and-training
55d4aa4c5b964f3c810d58008db4c5b75260322b
[ "Zlib" ]
3
2019-04-02T08:48:31.000Z
2020-09-23T08:13:35.000Z
#!/usr/bin/env python """Simple test client to call the debugger SOAP service""" import os import sys import base64 import getpass from suds.client import Client from suds.cache import NoCache from suds import WebFault, MethodNotFound from clfpy import AuthClient auth_endpoint = 'https://api.hetcomp.org/authManager/AuthManager?wsdl' extra_pars = "auth={},WFM=dummy,".format(auth_endpoint) def soap_call(wsdl_url, methodname, method_args): """Calls a SOAP webmethod at a given URL with given arguments.""" client = Client(wsdl_url, cache=NoCache()) try: method = getattr(client.service, methodname) except MethodNotFound as error: return(error) try: response = method(*method_args) except WebFault as error: return(error) return response def main(): port = 80 try: context_root = os.environ["CONTEXT_ROOT"] except KeyError: print("Error: environment variable CONTEXT_ROOT not set.") exit(1) url = "http://localhost:{}{}/Debugger?wsdl".format(port, context_root) print("wsdl URL is {}".format(url)) print("Obtaining session token") user = input("Enter username: ") project = input("Enter project: ") password = getpass.getpass(prompt="Enter password: ") auth = AuthClient(auth_endpoint) token = auth.get_session_token(user, project, password) print("Calling parameterDebugger()") response = soap_call(url, "parameterDebugger", ["serviceID1", token, extra_pars, "Some input", "Label1", "Second input", "Label2"]) html = base64.b64decode(response).decode() with open("test.html", 'w') as fout: fout.write(html) print("Result written to test.html") if __name__ == "__main__": main()
27.030769
135
0.682413
218
1,757
5.385321
0.477064
0.037479
0.037479
0.030664
0
0
0
0
0
0
0
0.008493
0.195788
1,757
64
136
27.453125
0.822364
0.075697
0
0.113636
0
0
0.237446
0
0
0
0
0
0
1
0.045455
false
0.068182
0.181818
0
0.25
0.113636
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
1
83d10767f4acd2d7c3295abb41942f7d2223b741
6,295
py
Python
data_manager/acs/gui_ACS_sched_blocks_script_0.py
IftachSadeh/ctaOperatorGUI
f6365a86440dd2404da0bc139cd9345eb3dcb566
[ "MIT" ]
3
2018-08-28T22:44:23.000Z
2018-10-24T09:16:34.000Z
data_manager/acs/gui_ACS_sched_blocks_script_0.py
IftachSadeh/ctaOperatorGUI
f6365a86440dd2404da0bc139cd9345eb3dcb566
[ "MIT" ]
28
2020-04-02T14:48:29.000Z
2021-05-27T08:10:36.000Z
data_manager/acs/gui_ACS_sched_blocks_script_0.py
IftachSadeh/ctaOperatorGUI
f6365a86440dd2404da0bc139cd9345eb3dcb566
[ "MIT" ]
null
null
null
# import tcs # import daqctrl, inspect # ------------------------------------------------------------------ # install the script by: # cd $INTROOT/config/scripts # ln -s $guiInstalDir/ctaOperatorGUI/ctaGuiBack/ctaGuiBack/acs/guiACS_schedBlocks_script0.py # ------------------------------------------------------------------ # ------------------------------------------------------------------ from random import Random rndGen = Random(10987268332) waitTime = dict() waitTime['config_daq'] = rndGen.randint(1, 3) waitTime['config_camera'] = rndGen.randint(1, 5) waitTime['config_mount'] = rndGen.randint(2, 7) waitTime['finish_daq'] = rndGen.randint(1, 6) waitTime['finish_camera'] = rndGen.randint(1, 3) waitTime['finish_mount'] = rndGen.randint(1, 2) def get_short_wait(duration, wait_type): return waitTime[wait_type] if duration > 1 else 1 # ------------------------------------------------------------------ # # ------------------------------------------------------------------ __phases__ = [ "configuring", "config_daq", "config_camera", "config_mount", "take_data", "closing", "finish_daq", "finish_camera", "finish_mount", ] # ------------------------------------------------------------------ # # ------------------------------------------------------------------ def configuring(): coords = observationBlock.src.coords p = None try: p = (coords.equatorial.ra, coords.equatorial.dec) except: pass if not p: try: p = (coords.horizontal.alt, coords.horizontal.az) except: pass if not p: try: p = (coords.galactic.lon, coords.galactic.lat) except: pass if not p: p = (0, 0) print "Coordinates used: (" + str(p[0]) + ", " + str(p[1]) + ")" try: divergence = schedulingBlock.config.instrument.pointing_mode.divergent_.divergence print "Divergence used: " + str(divergence) except: print "Pointing mode is not divergent" pass # resources.target = tcs.SkyEquatorialTarget( # p[0], p[1], tcs.ICRS, tcs.J2000, 0.0, 0.0, 0.0, 0.0 # ) allowPhaseStart("config_daq") allowPhaseStart("config_camera") allowPhaseStart("config_mount") return # ------------------------------------------------------------------ def config_daq(): updatePhase("config_daq", "config_daq has began ...", 0) allowPhaseStart("config_camera") allowPhaseStart("config_mount") # operationStatus = daq().operationStatus # # Check daq operational status # if operationStatus != daqctrl.NOMINAL and operationStatus != daqctrl.IDLE: # raise RuntimeError('DAQ status not idle/nominal: ' + operationStatus) # # Configure daq # daqConfigured = configureDAQ() # if not daqConfigured: # raise RuntimeError('DAQ configuration failed') # add wiating time since waitToFinish is useless ............ # telescopes.waitToFinish() wait(get_short_wait(blockDuration, 'config_daq')) updatePhase("config_daq", "config_daq has ended...", 100) return # ------------------------------------------------------------------ def config_camera(): updatePhase("config_camera", "config_camera has began ...", 0) allowPhaseStart("config_mount") # cameraConfig = schedulingBlock.config.camera_configuration # telescopes.configureCameras(cameraConfig) # add wiating time since waitToFinish is useless ............ # telescopes.waitToFinish() wait(get_short_wait(blockDuration, 'config_camera')) updatePhase("config_camera", "config_camera has ended...", 100) return # ------------------------------------------------------------------ def config_mount(): updatePhase("config_mount", "config_mount has began ...", 0) # telescopes.startSlewing(resources.target) # add wiating time since waitToFinish is useless ............ # telescopes.waitToFinish() wait(get_short_wait(blockDuration, 'config_mount')) updatePhase("config_mount", "config_mount has ended...", 100) return # ------------------------------------------------------------------ def take_data(): updatePhase("take_data", "take_data has began ...", 0) # daq().moveToNextOutputBlock(daqctrl.ZFITS_ZLIB) # resources.trackingDuration = blockDuration # telescopes.startTracking(resources.trackingDuration,resources.target) # telescopes.startDataTaking() # add wiating time since waitToFinish is useless ............ # telescopes.waitToFinish() wait(blockDuration) # telescopes.stopDataTaking() updatePhase("take_data", "take_data has ended...", 100) return # ------------------------------------------------------------------ def closing(): allowPhaseStart("finish_daq") allowPhaseStart("finish_camera") allowPhaseStart("finish_mount") return # ------------------------------------------------------------------ def finish_daq(): updatePhase("finish_daq", "finish_daq has began ...", 0) allowPhaseStart("finish_camera") allowPhaseStart("finish_mount") # add wiating time since waitToFinish is useless ............ # telescopes.waitToFinish() wait(get_short_wait(blockDuration, 'finish_daq')) updatePhase("finish_daq", "finish_daq has ended...", 100) return # ------------------------------------------------------------------ def finish_camera(): updatePhase("finish_camera", "finish_camera has began ...", 0) allowPhaseStart("finish_mount") # add wiating time since waitToFinish is useless ............ # telescopes.waitToFinish() wait(get_short_wait(blockDuration, 'finish_camera')) updatePhase("finish_camera", "finish_camera has ended...", 100) return # ------------------------------------------------------------------ def finish_mount(): updatePhase("finish_mount", "finish_mount has began ...", 0) # add wiating time since waitToFinish is useless ............ # telescopes.waitToFinish() wait(get_short_wait(blockDuration, 'finish_mount')) updatePhase("finish_mount", "finish_mount has ended...", 100) return # ------------------------------------------------------------------ def cleanUp(): pass
28.2287
94
0.550278
564
6,295
5.978723
0.225177
0.039146
0.024911
0.039442
0.518387
0.481613
0.37841
0.376038
0.207592
0.207592
0
0.013777
0.169817
6,295
222
95
28.355856
0.631458
0.420969
0
0.35
0
0
0.266313
0
0
0
0
0
0
0
null
null
0.05
0.01
null
null
0.03
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
83d13060a3394fdf762b857adb260865c20a7f38
143
py
Python
AtC_Beg_Con_081-090/ABC089/B.py
yosho-18/AtCoder
50f6d5c92a01792552c31ac912ce1cd557b06fb0
[ "MIT" ]
null
null
null
AtC_Beg_Con_081-090/ABC089/B.py
yosho-18/AtCoder
50f6d5c92a01792552c31ac912ce1cd557b06fb0
[ "MIT" ]
null
null
null
AtC_Beg_Con_081-090/ABC089/B.py
yosho-18/AtCoder
50f6d5c92a01792552c31ac912ce1cd557b06fb0
[ "MIT" ]
null
null
null
n = int(input()) a = input().split() a = [str(m) for m in a] for i in a: if i == "Y": print("Four") exit() print("Three")
14.3
23
0.461538
25
143
2.64
0.64
0.090909
0
0
0
0
0
0
0
0
0
0
0.314685
143
10
24
14.3
0.673469
0
0
0
0
0
0.069444
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
83d7033bcfe2791f10a0c9ef5053fa59b2220a75
370
py
Python
phlcensus/acs/percapitaincome.py
PhiladelphiaController/phlcensus
8e15d7c993e397bec4cb06a2144e134ec96c48a1
[ "MIT" ]
null
null
null
phlcensus/acs/percapitaincome.py
PhiladelphiaController/phlcensus
8e15d7c993e397bec4cb06a2144e134ec96c48a1
[ "MIT" ]
null
null
null
phlcensus/acs/percapitaincome.py
PhiladelphiaController/phlcensus
8e15d7c993e397bec4cb06a2144e134ec96c48a1
[ "MIT" ]
null
null
null
from .core import ACSDataset import collections __all__ = ["PerCapitaIncome"] class PerCapitaIncome(ACSDataset): """ PER CAPITA INCOME IN THE PAST 12 MONTHS (IN 2018 INFLATION-ADJUSTED DOLLARS) """ AGGREGATION = None UNIVERSE = "total population" TABLE_NAME = "B19301" RAW_FIELDS = collections.OrderedDict({"001": "per_capita_income"})
23.125
81
0.705405
40
370
6.325
0.8
0.071146
0.118577
0
0
0
0
0
0
0
0
0.047138
0.197297
370
15
82
24.666667
0.804714
0.205405
0
0
0
0
0.206522
0
0
0
0
0
0
1
0
false
0
0.25
0
0.875
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
83d8ec7a846eebb200f4cc5baae5280d08288d60
1,463
py
Python
viterbi_tagging.py
cryingmiso/Natural-Language-Processing
471c3e69c65cab90fb7c432d2b632801c87f7c8e
[ "MIT" ]
null
null
null
viterbi_tagging.py
cryingmiso/Natural-Language-Processing
471c3e69c65cab90fb7c432d2b632801c87f7c8e
[ "MIT" ]
null
null
null
viterbi_tagging.py
cryingmiso/Natural-Language-Processing
471c3e69c65cab90fb7c432d2b632801c87f7c8e
[ "MIT" ]
1
2018-04-22T11:41:10.000Z
2018-04-22T11:41:10.000Z
# -*- coding:utf-8 -*- states = ("B","M","E","S") test_input = "BBMESBMEBEBESSMEBBME" observations = [obs for obs in test_input] #시작확률 start_prob = {"B":0.4,"M":0.2,"E":0.2,"S":0.2} #전이확률 transit_prob = {"B": {"B": 0.1, "M": 0.4, "E": 0.4, "S": 0.1}, "M": {"B": 0.1, "M": 0.4, "E": 0.4, "S": 0.1}, "E": {"B": 0.4, "M": 0.1, "E": 0.1, "S": 0.4}, "S": {"B": 0.4, "M": 0.1, "E": 0.1, "S": 0.4}} #출력확률 emission_prob = {'B': {"B": 0.4, "M": 0.2, "E": 0.2, "S": 0.2}, "M": {"B": 0.2, "M": 0.4, "E": 0.2, "S": 0.2}, "E": {"B": 0.2, "M": 0.2, "E": 0.4, "S": 0.2}, "S": {"B": 0.2, "M": 0.2, "E": 0.2, "S": 0.4}} def viterbi(observs,states,sp,tp,ep): T = {} # present state for st in states: T[st] = (sp[st]*ep[st][observs[0]],[st]) for ob in observs[1:]: T = next_state(ob,states,T,tp,ep) prob,labels = max([T[st] for st in T]) return prob,labels def next_state(ob,states,T,tp,ep): U = {} # next state for next_s in states: U[next_s] = (0,[]) for now_s in states: p = T[now_s][0] * tp[now_s][next_s] * ep[next_s][ob] if p>U[next_s][0]: U[next_s] = [p,T[now_s][1]+[next_s]] return U if __name__=="__main__": print observations per,last = viterbi(observations,states, start_prob,transit_prob,emission_prob) print last print per
29.857143
64
0.455913
268
1,463
2.380597
0.186567
0.047022
0.023511
0.025078
0.23511
0.221003
0.211599
0.142633
0.112853
0.112853
0
0.075816
0.287765
1,463
49
65
29.857143
0.536468
0.038961
0
0
0
0
0.054286
0
0
0
0
0
0
0
null
null
0
0
null
null
0.085714
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
83dcc185970f786453677691d5a450058ad2e7d1
511
py
Python
book/migrations/0006_alter_book_cover_img.py
KhudadadKhawari/the-library
a6acd2e8ce9ca350339d99775f1e7906d343c7d4
[ "MIT" ]
null
null
null
book/migrations/0006_alter_book_cover_img.py
KhudadadKhawari/the-library
a6acd2e8ce9ca350339d99775f1e7906d343c7d4
[ "MIT" ]
null
null
null
book/migrations/0006_alter_book_cover_img.py
KhudadadKhawari/the-library
a6acd2e8ce9ca350339d99775f1e7906d343c7d4
[ "MIT" ]
null
null
null
# Generated by Django 4.0 on 2021-12-15 09:04 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('book', '0005_alter_book_rented_count'), ] operations = [ migrations.AlterField( model_name='book', name='cover_img', field=models.ImageField(default=django.utils.timezone.now, upload_to='static/media/book/covers'), preserve_default=False, ), ]
24.333333
109
0.639922
58
511
5.5
0.741379
0.068966
0.119122
0
0
0
0
0
0
0
0
0.046875
0.248532
511
20
110
25.55
0.783854
0.084149
0
0
1
0
0.148069
0.111588
0
0
0
0
0
1
0
false
0
0.142857
0
0.357143
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
83df200991f24e112dfb55e0124bf7a8c642cf9c
7,985
py
Python
blender/.blender/scripts/uvcalc_follow_active_coords.py
visnz/sketchfab_download
976f667d5c2c2864b2bad65aceac0dab5ce51b74
[ "Apache-2.0" ]
41
2021-02-18T05:56:26.000Z
2021-12-06T07:58:15.000Z
blender/.blender/scripts/uvcalc_follow_active_coords.py
visnz/sketchfab_download
976f667d5c2c2864b2bad65aceac0dab5ce51b74
[ "Apache-2.0" ]
19
2021-02-18T05:59:03.000Z
2022-01-13T01:00:52.000Z
blender/.blender/scripts/uvcalc_follow_active_coords.py
visnz/sketchfab_download
976f667d5c2c2864b2bad65aceac0dab5ce51b74
[ "Apache-2.0" ]
18
2021-02-22T13:32:56.000Z
2022-01-22T12:38:29.000Z
#!BPY """ Name: 'Follow Active (quads)' Blender: 242 Group: 'UVCalculation' Tooltip: 'Follow from active quads.' """ __author__ = "Campbell Barton" __url__ = ("blender", "blenderartists.org") __version__ = "1.0 2006/02/07" __bpydoc__ = """\ This script sets the UV mapping and image of selected faces from adjacent unselected faces. for full docs see... http://mediawiki.blender.org/index.php/Scripts/Manual/UV_Calculate/Follow_active_quads """ # ***** BEGIN GPL LICENSE BLOCK ***** # # Script copyright (C) Campbell J Barton # # 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. # # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # ***** END GPL LICENCE BLOCK ***** # -------------------------------------------------------------------------- from Blender import * import bpy import BPyMesh def extend(EXTEND_MODE,ob): if EXTEND_MODE == -1: return me = ob.getData(mesh=1) me_verts = me.verts # Toggle Edit mode is_editmode = Window.EditMode() if is_editmode: Window.EditMode(0) Window.WaitCursor(1) t = sys.time() edge_average_lengths = {} OTHER_INDEX = 2,3,0,1 FAST_INDICIES = 0,2,1,3 # order is faster def extend_uvs(face_source, face_target, edge_key): ''' Takes 2 faces, Projects its extends its UV coords onto the face next to it. Both faces must share an edge. ''' def face_edge_vs(vi): # assunme a quad return [(vi[0], vi[1]), (vi[1], vi[2]), (vi[2], vi[3]), (vi[3], vi[0])] uvs_source = face_source.uv uvs_target = face_target.uv vidx_source = [v.index for v in face_source] vidx_target = [v.index for v in face_target] # vertex index is the key, uv is the value uvs_vhash_source = dict( [ (vindex, uvs_source[i]) for i, vindex in enumerate(vidx_source)] ) uvs_vhash_target = dict( [ (vindex, uvs_target[i]) for i, vindex in enumerate(vidx_target)] ) edge_idxs_source = face_edge_vs(vidx_source) edge_idxs_target = face_edge_vs(vidx_target) source_matching_edge = -1 target_matching_edge = -1 edge_key_swap = edge_key[1], edge_key[0] try: source_matching_edge = edge_idxs_source.index(edge_key) except: source_matching_edge = edge_idxs_source.index(edge_key_swap) try: target_matching_edge = edge_idxs_target.index(edge_key) except: target_matching_edge = edge_idxs_target.index(edge_key_swap) edgepair_inner_source = edge_idxs_source[source_matching_edge] edgepair_inner_target = edge_idxs_target[target_matching_edge] edgepair_outer_source = edge_idxs_source[OTHER_INDEX[source_matching_edge]] edgepair_outer_target = edge_idxs_target[OTHER_INDEX[target_matching_edge]] if edge_idxs_source[source_matching_edge] == edge_idxs_target[target_matching_edge]: iA= 0; iB= 1 # Flipped, most common else: # The normals of these faces must be different iA= 1; iB= 0 # Set the target UV's touching source face, no tricky calc needed, uvs_vhash_target[edgepair_inner_target[0]][:] = uvs_vhash_source[edgepair_inner_source[iA]] uvs_vhash_target[edgepair_inner_target[1]][:] = uvs_vhash_source[edgepair_inner_source[iB]] # Set the 2 UV's on the target face that are not touching # for this we need to do basic expaning on the source faces UV's if EXTEND_MODE == 2: try: # divide by zero is possible ''' measure the length of each face from the middle of each edge to the opposite allong the axis we are copying, use this ''' i1a= edgepair_outer_target[iB] i2a= edgepair_inner_target[iA] if i1a>i2a: i1a, i2a = i2a, i1a i1b= edgepair_outer_source[iB] i2b= edgepair_inner_source[iA] if i1b>i2b: i1b, i2b = i2b, i1b # print edge_average_lengths factor = edge_average_lengths[i1a, i2a][0] / edge_average_lengths[i1b, i2b][0] except: # Div By Zero? factor = 1.0 uvs_vhash_target[edgepair_outer_target[iB]][:] = uvs_vhash_source[edgepair_inner_source[0]] +factor * (uvs_vhash_source[edgepair_inner_source[0]] - uvs_vhash_source[edgepair_outer_source[1]]) uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] +factor * (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]]) else: # same as above but with no factor uvs_vhash_target[edgepair_outer_target[iB]][:] = uvs_vhash_source[edgepair_inner_source[0]] + (uvs_vhash_source[edgepair_inner_source[0]] - uvs_vhash_source[edgepair_outer_source[1]]) uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]]) if not me.faceUV: me.faceUV= True face_act = me.activeFace if face_act == -1: Draw.PupMenu('ERROR: No active face') return face_sel= [f for f in me.faces if len(f) == 4 and f.sel] face_act_local_index = -1 for i, f in enumerate(face_sel): if f.index == face_act: face_act_local_index = i break if face_act_local_index == -1: Draw.PupMenu('ERROR: Active face not selected') return # Modes # 0 unsearched # 1:mapped, use search from this face. - removed!! # 2:all siblings have been searched. dont search again. face_modes = [0] * len(face_sel) face_modes[face_act_local_index] = 1 # extend UV's from this face. # Edge connectivty edge_faces = {} for i, f in enumerate(face_sel): for edkey in f.edge_keys: try: edge_faces[edkey].append(i) except: edge_faces[edkey] = [i] SEAM = Mesh.EdgeFlags.SEAM if EXTEND_MODE == 2: edge_loops = BPyMesh.getFaceLoopEdges(face_sel, [ed.key for ed in me.edges if ed.flag & SEAM] ) me_verts = me.verts for loop in edge_loops: looplen = [0.0] for ed in loop: edge_average_lengths[ed] = looplen looplen[0] += (me_verts[ed[0]].co - me_verts[ed[1]].co).length looplen[0] = looplen[0] / len(loop) # remove seams, so we dont map accross seams. for ed in me.edges: if ed.flag & SEAM: # remove the edge pair if we can try: del edge_faces[ed.key] except: pass # Done finding seams # face connectivity - faces around each face # only store a list of indicies for each face. face_faces = [[] for i in xrange(len(face_sel))] for edge_key, faces in edge_faces.iteritems(): if len(faces) == 2: # Only do edges with 2 face users for now face_faces[faces[0]].append((faces[1], edge_key)) face_faces[faces[1]].append((faces[0], edge_key)) # Now we know what face is connected to what other face, map them by connectivity ok = True while ok: ok = False for i in xrange(len(face_sel)): if face_modes[i] == 1: # searchable for f_sibling, edge_key in face_faces[i]: if face_modes[f_sibling] == 0: face_modes[f_sibling] = 1 # mapped and search from. extend_uvs(face_sel[i], face_sel[f_sibling], edge_key) face_modes[i] = 1 # we can map from this one now. ok= True # keep searching face_modes[i] = 2 # dont search again print sys.time() - t if is_editmode: Window.EditMode(1) else: me.update() Window.RedrawAll() Window.WaitCursor(0) def main(): sce = bpy.data.scenes.active ob = sce.objects.active # print ob, ob.type if ob == None or ob.type != 'Mesh': Draw.PupMenu('ERROR: No mesh object.') return # 0:normal extend, 1:edge length EXTEND_MODE = Draw.PupMenu("Use Face Area%t|Loop Average%x2|None%x0") extend(EXTEND_MODE,ob) if __name__ == '__main__': main()
31.313725
195
0.707201
1,271
7,985
4.215578
0.247836
0.032848
0.039194
0.057484
0.270997
0.238895
0.186264
0.14483
0.14483
0.102277
0
0.019954
0.177833
7,985
254
196
31.437008
0.796192
0.240326
0
0.123188
0
0
0.067706
0
0
0
0
0
0
0
null
null
0.007246
0.021739
null
null
0.007246
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
83e3b262a987de45abbd2e106414db47c397b8e3
7,738
py
Python
CIM14/ENTSOE/Dynamics/IEC61970/Dynamics/DynamicsMetaBlock.py
MaximeBaudette/PyCIM
d68ee5ccfc1d32d44c5cd09fb173142fb5ff4f14
[ "MIT" ]
58
2015-04-22T10:41:03.000Z
2022-03-29T16:04:34.000Z
CIM14/ENTSOE/Dynamics/IEC61970/Dynamics/DynamicsMetaBlock.py
MaximeBaudette/PyCIM
d68ee5ccfc1d32d44c5cd09fb173142fb5ff4f14
[ "MIT" ]
12
2015-08-26T03:57:23.000Z
2020-12-11T20:14:42.000Z
CIM14/ENTSOE/Dynamics/IEC61970/Dynamics/DynamicsMetaBlock.py
MaximeBaudette/PyCIM
d68ee5ccfc1d32d44c5cd09fb173142fb5ff4f14
[ "MIT" ]
35
2015-01-10T12:21:03.000Z
2020-09-09T08:18:16.000Z
# Copyright (C) 2010-2011 Richard Lincoln # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. from CIM14.ENTSOE.Dynamics.IEC61970.Core.CoreIdentifiedObject import CoreIdentifiedObject class DynamicsMetaBlock(CoreIdentifiedObject): def __init__(self, blockKind="", proprietary=False, Block=None, MetaBlockSignal=None, MetaBlockReference=None, MetaBlockParameter=None, MetaBlockOutput=None, MetaBlockInput=None, MetaBlockState=None, *args, **kw_args): """Initialises a new 'DynamicsMetaBlock' instance. @param blockKind: @param proprietary: @param Block: @param MetaBlockSignal: @param MetaBlockReference: @param MetaBlockParameter: @param MetaBlockOutput: @param MetaBlockInput: @param MetaBlockState: """ self.blockKind = blockKind self.proprietary = proprietary self._Block = [] self.Block = [] if Block is None else Block self._MetaBlockSignal = [] self.MetaBlockSignal = [] if MetaBlockSignal is None else MetaBlockSignal self._MetaBlockReference = [] self.MetaBlockReference = [] if MetaBlockReference is None else MetaBlockReference self._MetaBlockParameter = [] self.MetaBlockParameter = [] if MetaBlockParameter is None else MetaBlockParameter self._MetaBlockOutput = [] self.MetaBlockOutput = [] if MetaBlockOutput is None else MetaBlockOutput self._MetaBlockInput = [] self.MetaBlockInput = [] if MetaBlockInput is None else MetaBlockInput self._MetaBlockState = [] self.MetaBlockState = [] if MetaBlockState is None else MetaBlockState super(DynamicsMetaBlock, self).__init__(*args, **kw_args) _attrs = ["blockKind", "proprietary"] _attr_types = {"blockKind": str, "proprietary": bool} _defaults = {"blockKind": "", "proprietary": False} _enums = {"blockKind": "DynamicsBlockKind"} _refs = ["Block", "MetaBlockSignal", "MetaBlockReference", "MetaBlockParameter", "MetaBlockOutput", "MetaBlockInput", "MetaBlockState"] _many_refs = ["Block", "MetaBlockSignal", "MetaBlockReference", "MetaBlockParameter", "MetaBlockOutput", "MetaBlockInput", "MetaBlockState"] def getBlock(self): """ """ return self._Block def setBlock(self, value): for x in self._Block: x.MetaBlock = None for y in value: y._MetaBlock = self self._Block = value Block = property(getBlock, setBlock) def addBlock(self, *Block): for obj in Block: obj.MetaBlock = self def removeBlock(self, *Block): for obj in Block: obj.MetaBlock = None def getMetaBlockSignal(self): """ """ return self._MetaBlockSignal def setMetaBlockSignal(self, value): for x in self._MetaBlockSignal: x.MemberOf_MetaBlock = None for y in value: y._MemberOf_MetaBlock = self self._MetaBlockSignal = value MetaBlockSignal = property(getMetaBlockSignal, setMetaBlockSignal) def addMetaBlockSignal(self, *MetaBlockSignal): for obj in MetaBlockSignal: obj.MemberOf_MetaBlock = self def removeMetaBlockSignal(self, *MetaBlockSignal): for obj in MetaBlockSignal: obj.MemberOf_MetaBlock = None def getMetaBlockReference(self): """ """ return self._MetaBlockReference def setMetaBlockReference(self, value): for x in self._MetaBlockReference: x.MemberOf_MetaBlock = None for y in value: y._MemberOf_MetaBlock = self self._MetaBlockReference = value MetaBlockReference = property(getMetaBlockReference, setMetaBlockReference) def addMetaBlockReference(self, *MetaBlockReference): for obj in MetaBlockReference: obj.MemberOf_MetaBlock = self def removeMetaBlockReference(self, *MetaBlockReference): for obj in MetaBlockReference: obj.MemberOf_MetaBlock = None def getMetaBlockParameter(self): """ """ return self._MetaBlockParameter def setMetaBlockParameter(self, value): for x in self._MetaBlockParameter: x.MemberOf_MetaBlock = None for y in value: y._MemberOf_MetaBlock = self self._MetaBlockParameter = value MetaBlockParameter = property(getMetaBlockParameter, setMetaBlockParameter) def addMetaBlockParameter(self, *MetaBlockParameter): for obj in MetaBlockParameter: obj.MemberOf_MetaBlock = self def removeMetaBlockParameter(self, *MetaBlockParameter): for obj in MetaBlockParameter: obj.MemberOf_MetaBlock = None def getMetaBlockOutput(self): """ """ return self._MetaBlockOutput def setMetaBlockOutput(self, value): for x in self._MetaBlockOutput: x.MemberOf_MetaBlock = None for y in value: y._MemberOf_MetaBlock = self self._MetaBlockOutput = value MetaBlockOutput = property(getMetaBlockOutput, setMetaBlockOutput) def addMetaBlockOutput(self, *MetaBlockOutput): for obj in MetaBlockOutput: obj.MemberOf_MetaBlock = self def removeMetaBlockOutput(self, *MetaBlockOutput): for obj in MetaBlockOutput: obj.MemberOf_MetaBlock = None def getMetaBlockInput(self): """ """ return self._MetaBlockInput def setMetaBlockInput(self, value): for x in self._MetaBlockInput: x.MemberOf_MetaBlock = None for y in value: y._MemberOf_MetaBlock = self self._MetaBlockInput = value MetaBlockInput = property(getMetaBlockInput, setMetaBlockInput) def addMetaBlockInput(self, *MetaBlockInput): for obj in MetaBlockInput: obj.MemberOf_MetaBlock = self def removeMetaBlockInput(self, *MetaBlockInput): for obj in MetaBlockInput: obj.MemberOf_MetaBlock = None def getMetaBlockState(self): """ """ return self._MetaBlockState def setMetaBlockState(self, value): for x in self._MetaBlockState: x.MemberOf_MetaBlock = None for y in value: y._MemberOf_MetaBlock = self self._MetaBlockState = value MetaBlockState = property(getMetaBlockState, setMetaBlockState) def addMetaBlockState(self, *MetaBlockState): for obj in MetaBlockState: obj.MemberOf_MetaBlock = self def removeMetaBlockState(self, *MetaBlockState): for obj in MetaBlockState: obj.MemberOf_MetaBlock = None
33.938596
222
0.674334
745
7,738
6.900671
0.233557
0.079362
0.021786
0.017701
0.315697
0.30072
0.274849
0.269986
0.216689
0.068858
0
0.00259
0.251615
7,738
227
223
34.088106
0.885167
0.178599
0
0.343511
0
0
0.045747
0
0
0
0
0
0
1
0.221374
false
0
0.007634
0
0.389313
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
1
83ee7b4543ab79bc0395dcd6db36fd4ba26a265c
378
py
Python
setup.py
mattpatey/text2qrcode
f0cbb006241ba20c76b16d67815836fd44890315
[ "Xnet", "X11" ]
1
2020-11-13T20:59:08.000Z
2020-11-13T20:59:08.000Z
setup.py
mattpatey/text2qrcode
f0cbb006241ba20c76b16d67815836fd44890315
[ "Xnet", "X11" ]
null
null
null
setup.py
mattpatey/text2qrcode
f0cbb006241ba20c76b16d67815836fd44890315
[ "Xnet", "X11" ]
null
null
null
from setuptools import ( find_packages, setup, ) setup( name="text2qrcode", version="1.0-a1", description="Render a QR code image from input text", author="Matt Patey", packages=find_packages(), install_requires=["qrcode", "pillow"], entry_points={ "console_scripts": [ "t2qr=text2qrcode.main:main" ] } )
19.894737
57
0.595238
40
378
5.5
0.825
0.109091
0
0
0
0
0
0
0
0
0
0.021818
0.272487
378
18
58
21
0.778182
0
0
0
0
0
0.312169
0.068783
0
0
0
0
0
1
0
true
0
0.058824
0
0.058824
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
1
83f188e156ec6c7d9f2733735708e0459183598e
930
py
Python
taurex/data/profiles/pressure/arraypressure.py
ucl-exoplanets/TauREx3_public
cf8da465448df44c3c4dcc2cd0002ef34edd3920
[ "BSD-3-Clause" ]
10
2019-12-18T09:19:16.000Z
2021-06-21T11:02:06.000Z
taurex/data/profiles/pressure/arraypressure.py
ucl-exoplanets/TauREx3_public
cf8da465448df44c3c4dcc2cd0002ef34edd3920
[ "BSD-3-Clause" ]
10
2020-03-24T18:02:15.000Z
2021-08-23T20:32:09.000Z
taurex/data/profiles/pressure/arraypressure.py
ucl-exoplanets/TauREx3_public
cf8da465448df44c3c4dcc2cd0002ef34edd3920
[ "BSD-3-Clause" ]
8
2020-03-26T14:16:42.000Z
2021-12-18T22:11:25.000Z
from .pressureprofile import PressureProfile import numpy as np class ArrayPressureProfile(PressureProfile): def __init__(self, array, reverse=False): super().__init__(self.__class__.__name__, array.shape[-1]) if reverse: self.pressure_profile = array[::-1] else: self.pressure_profile = array def compute_pressure_profile(self): """ Sets up the pressure profile for the atmosphere model """ logp = np.log10(self.pressure_profile) gradp = np.gradient(logp) self.pressure_profile_levels = \ 10**np.append(logp-gradp/2, logp[-1]+gradp[-1]/2) @property def profile(self): return self.pressure_profile def write(self, output): pressure = super().write(output) return pressure @classmethod def input_keywords(self): return ['array', 'fromarray',]
24.473684
66
0.62043
102
930
5.411765
0.441176
0.190217
0.172101
0.086957
0
0
0
0
0
0
0
0.014837
0.275269
930
38
67
24.473684
0.804154
0.056989
0
0
0
0
0.016413
0
0
0
0
0
0
1
0.217391
false
0
0.086957
0.086957
0.478261
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
1
83f1b322463e935e9c59457e936e5b4e88b767fd
2,857
py
Python
bin/check_samplesheet.py
ggabernet/vcreport
fe5d315364c19d7286c5f7419cc5ff4599ed373d
[ "MIT" ]
1
2021-08-23T20:15:15.000Z
2021-08-23T20:15:15.000Z
bin/check_samplesheet.py
ggabernet/vcreport
fe5d315364c19d7286c5f7419cc5ff4599ed373d
[ "MIT" ]
null
null
null
bin/check_samplesheet.py
ggabernet/vcreport
fe5d315364c19d7286c5f7419cc5ff4599ed373d
[ "MIT" ]
1
2021-09-09T09:40:11.000Z
2021-09-09T09:40:11.000Z
#!/usr/bin/env python # This script is based on the example at: https://raw.githubusercontent.com/nf-core/test-datasets/viralrecon/samplesheet/samplesheet_test_illumina_amplicon.csv import os import sys import errno import argparse def parse_args(args=None): Description = "Reformat nf-core/vcreport samplesheet file and check its contents." Epilog = "Example usage: python check_samplesheet.py <FILE_IN>" parser = argparse.ArgumentParser(description=Description, epilog=Epilog) parser.add_argument("FILE_IN", help="Input samplesheet file.") return parser.parse_args(args) def make_dir(path): if len(path) > 0: try: os.makedirs(path) except OSError as exception: if exception.errno != errno.EEXIST: raise exception def print_error(error, context="Line", context_str=""): error_str = "ERROR: Please check samplesheet -> {}".format(error) if context != "" and context_str != "": error_str = "ERROR: Please check samplesheet -> {}\n{}: '{}'".format( error, context.strip(), context_str.strip() ) print(error_str) sys.exit(1) # TODO nf-core: Update the check_samplesheet function def check_samplesheet(file_in): """ This function checks that the samplesheet follows the following structure: sample,vcf SAMPLE1,sample1.vcf SAMPLE2,sample2.vcf For an example see: https://raw.githubusercontent.com/nf-core/test-datasets/viralrecon/samplesheet/samplesheet_test_illumina_amplicon.csv """ sample_mapping_dict = {} with open(file_in, "r") as fin: ## Check header MIN_COLS = 2 # TODO nf-core: Update the column names for the input samplesheet HEADER = ["sample", "vcf"] header = [x.strip('"') for x in fin.readline().strip().split(",")] if header[: len(HEADER)] != HEADER: print("ERROR: Please check samplesheet header -> {} != {}".format(",".join(header), ",".join(HEADER))) sys.exit(1) ## Check sample entries for line in fin: lspl = [x.strip().strip('"') for x in line.strip().split(",")] # Check valid number of columns per row if len(lspl) < len(HEADER): print_error( "Invalid number of columns (minimum = {})!".format(len(HEADER)), "Line", line, ) num_cols = len([x for x in lspl if x]) if num_cols < MIN_COLS: print_error( "Invalid number of populated columns (minimum = {})!".format(MIN_COLS), "Line", line, ) def main(args=None): args = parse_args(args) check_samplesheet(args.FILE_IN) if __name__ == "__main__": sys.exit(main())
31.395604
159
0.60273
341
2,857
4.920821
0.360704
0.066746
0.023242
0.048272
0.22646
0.174017
0.174017
0.174017
0.120381
0.120381
0
0.003863
0.275114
2,857
90
160
31.744444
0.806374
0.221211
0
0.148148
0
0
0.187987
0
0
0
0
0.022222
0
1
0.092593
false
0
0.074074
0
0.185185
0.092593
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
83f2f7aa75a2c9e552bb8125bde1278a1b2c932e
1,643
bzl
Python
cmake/build_defs.bzl
benjaminp/upb
901744a97e5170bfdd5b408a26b6603b1fbab9ad
[ "BSD-3-Clause" ]
null
null
null
cmake/build_defs.bzl
benjaminp/upb
901744a97e5170bfdd5b408a26b6603b1fbab9ad
[ "BSD-3-Clause" ]
null
null
null
cmake/build_defs.bzl
benjaminp/upb
901744a97e5170bfdd5b408a26b6603b1fbab9ad
[ "BSD-3-Clause" ]
null
null
null
def generated_file_staleness_test(name, outs, generated_pattern): """Tests that checked-in file(s) match the contents of generated file(s). The resulting test will verify that all output files exist and have the correct contents. If the test fails, it can be invoked with --fix to bring the checked-in files up to date. Args: name: Name of the rule. outs: the checked-in files that are copied from generated files. generated_pattern: the pattern for transforming each "out" file into a generated file. For example, if generated_pattern="generated/%s" then a file foo.txt will look for generated file generated/foo.txt. """ script_name = name + ".py" script_src = ":staleness_test.py" # Filter out non-existing rules so Blaze doesn't error out before we even # run the test. existing_outs = native.glob(include = outs) # The file list contains a few extra bits of information at the end. # These get unpacked by the Config class in staleness_test_lib.py. file_list = outs + [generated_pattern, native.package_name() or ".", name] native.genrule( name = name + "_makescript", outs = [script_name], srcs = [script_src], testonly = 1, cmd = "cat $(location " + script_src + ") > $@; " + "sed -i.bak -e 's|INSERT_FILE_LIST_HERE|" + "\\\n ".join(file_list) + "|' $@", ) native.py_test( name = name, srcs = [script_name], data = existing_outs + [generated_pattern % file for file in outs], deps = [ ":staleness_test_lib", ], )
36.511111
93
0.634814
226
1,643
4.486726
0.482301
0.078895
0.059172
0.033531
0
0
0
0
0
0
0
0.000831
0.267194
1,643
44
94
37.340909
0.841362
0.478393
0
0
1
0
0.155087
0.031017
0
0
0
0
0
1
0.047619
false
0
0
0
0.047619
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
83f32ec218d69fd1e8829338d9a53be2a269009b
4,894
py
Python
tests/transform_finding_test.py
aws-samples/aws-security-hub-analytic-pipeline
3e4242c24297725f656ff8a560ff180604443223
[ "MIT-0" ]
7
2021-06-16T00:55:44.000Z
2022-02-13T23:00:27.000Z
tests/transform_finding_test.py
QPC-database/aws-security-hub-analytic-pipeline
aff8cd7f5954c285b93fe8f67f8bef2482a1f686
[ "MIT-0" ]
null
null
null
tests/transform_finding_test.py
QPC-database/aws-security-hub-analytic-pipeline
aff8cd7f5954c285b93fe8f67f8bef2482a1f686
[ "MIT-0" ]
2
2021-07-11T02:41:38.000Z
2022-03-29T20:34:23.000Z
from assets.lambdas.transform_findings.index import TransformFindings import boto3 from moto import mock_s3 def __make_bucket(bucket_name: str): bucket = boto3.resource('s3').Bucket(bucket_name) bucket.create() return bucket @mock_s3 def test_fix_dictionary(): bucket = __make_bucket('tester') transform_findings = TransformFindings(bucket.name) finding = { 'first/level/test': 'test', 'ProductArn': 'arn:aws:securityhub:us-east-1::product/aws/securityhub', 'Types': ['Software and Configuration Checks/Industry and Regulatory Standards/CIS AWS Foundations Benchmark'], 'Description': 'Security groups provide stateful filtering of ingress/egress network traffic to AWS resources. It is recommended that no security group allows unrestricted ingress access to port 22.', 'SchemaVersion': '2018-10-08', 'Compliance': {'Status': 'PASSED'}, 'GeneratorId': 'arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0/rule/4.1', 'FirstObservedAt': '2021-01-31T04:52:30.123Z', 'CreatedAt': '2021-01-31T04:52:30.123Z', 'RecordState': 'ACTIVE', 'Title': '4.1 Ensure no security groups allow ingress from 0.0.0.0/0 to port 22', 'Workflow': {'Status': 'RESOLVED'}, 'LastObservedAt': '2021-05-07T11:05:27.353Z', 'Severity': {'Normalized': 0, 'Label': 'INFORMATIONAL', 'Product': 0, 'Original': 'INFORMATIONAL'}, 'UpdatedAt': '2021-05-07T11:05:25.775Z', 'FindingProviderFields': { 'Types': [ 'Software and Configuration Checks/Industry and Regulatory Standards/CIS AWS Foundations Benchmark'], 'Severity': {'Normalized': 0, 'Label': 'INFORMATIONAL', 'Product': 0, 'Original': 'INFORMATIONAL'} }, 'WorkflowState': 'NEW', 'ProductFields': { 'StandardsGuideArn': 'arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0', 'StandardsGuideSubscriptionArn': 'arn:aws:securityhub:us-east-1:0123456789:subscription/cis-aws-foundations-benchmark/v/1.2.0', 'RuleId': '4.1', 'RecommendationUrl': 'https://docs.aws.amazon.com/console/securityhub/standards-cis-4.1/remediation', 'RelatedAWSResources:0/name': 'securityhub-restricted-ssh-38a80c22', 'RelatedAWSResources:0/type': 'AWS::Config::ConfigRule', 'StandardsControlArn': 'arn:aws:securityhub:us-east-1:0123456789:control/cis-aws-foundations-benchmark/v/1.2.0/4.1', 'aws/securityhub/ProductName': 'Security Hub', 'aws/securityhub/CompanyName': 'AWS', 'aws/securityhub/FindingId': 'arn:aws:securityhub:us-east-1::product/aws/securityhub/arn:aws:securityhub:us-east-1:0123456789:subscription/cis-aws-foundations-benchmark/v/1.2.0/4.1/finding/2a55570b-74e9-4aa3-9f4e-66f515c7ff03' }, 'AwsAccountId': '0123456789', 'Id': 'arn:aws:securityhub:us-east-1:0123456789:subscription/cis-aws-foundations-benchmark/v/1.2.0/4.1/finding/2a55570b-74e9-4aa3-9f4e-66f515c7ff03', 'Remediation': { 'Recommendation': { 'Text': 'For directions on how to fix this issue, please consult the AWS Security Hub CIS documentation.', 'Url': 'https://docs.aws.amazon.com/console/securityhub/standards-cis-4.1/remediation'} }, 'Resources': [{ 'Partition': 'aws', 'Type': 'AwsEc2SecurityGroup', 'Details': { 'AwsEc2SecurityGroup': { 'GroupName': 'default', 'OwnerId': '0123456789', 'VpcId': 'vpc-0123456789', 'IpPermissions': [{'IpProtocol': '-1', 'UserIdGroupPairs': [ {'UserId': '0123456789', 'GroupId': 'sg-0123456789'}]}], 'IpPermissionsEgress': [{'IpProtocol': '-1', 'IpRanges': [{'CidrIp': '0.0.0.0/0'}]}], 'GroupId': 'sg-0123456789'} }, 'Region': 'us-east-1', 'Id': 'arn:aws:ec2:us-east-1:0123456789:security-group/sg-0123456789' }] } result = transform_findings.fix_dictionary(finding) assert isinstance(result, dict) assert 'first/level/test' not in result assert 'first_level_test' in result assert 'ProductFields' in result assert 'aws/securityhub/ProductName' not in result['ProductFields'] assert 'aws_securityhub_ProductName' in result['ProductFields'] assert 'aws/securityhub/CompanyName' not in result['ProductFields'] assert 'aws_securityhub_CompanyName' in result['ProductFields'] assert 'aws/securityhub/FindingId' not in result['ProductFields'] assert 'aws_securityhub_FindingId' in result['ProductFields'] assert 'RelatedAWSResources:0/name' not in result['ProductFields'] assert 'RelatedAWSResources_0_name' in result['ProductFields']
56.252874
238
0.647323
533
4,894
5.894934
0.348968
0.084659
0.043285
0.0662
0.452896
0.448759
0.436665
0.31254
0.31254
0.241884
0
0.081769
0.205353
4,894
87
239
56.252874
0.726151
0
0
0
0
0.135802
0.602247
0.269459
0
0
0
0
0.148148
1
0.024691
false
0.012346
0.037037
0
0.074074
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
83fa1f4c15e8b0c13b7079f93983ba9e472a57f2
3,286
bzl
Python
haskell/private/packages.bzl
andyscott/rules_haskell
1c7341f885f62cecad705f6a9e8b610b73f11527
[ "Apache-2.0" ]
null
null
null
haskell/private/packages.bzl
andyscott/rules_haskell
1c7341f885f62cecad705f6a9e8b610b73f11527
[ "Apache-2.0" ]
null
null
null
haskell/private/packages.bzl
andyscott/rules_haskell
1c7341f885f62cecad705f6a9e8b610b73f11527
[ "Apache-2.0" ]
null
null
null
"""Package list handling""" load(":private/set.bzl", "set") def pkg_info_to_ghc_args(pkg_info): """ Takes the package info collected by `ghc_info()` and returns the actual list of command line arguments that should be passed to GHC. """ args = [ # In compile.bzl, we pass this just before all -package-id # arguments. Not doing so leads to bizarre compile-time failures. # It turns out that equally, not doing so leads to bizarre # link-time failures. See # https://github.com/tweag/rules_haskell/issues/395. "-hide-all-packages", ] if not pkg_info.has_version: args.extend([ # Macro version are disabled for all packages by default # and enabled for package with version # see https://github.com/tweag/rules_haskell/issues/414 "-fno-version-macros", ]) for package in pkg_info.packages: args.extend(["-package", package]) for package_id in pkg_info.package_ids: args.extend(["-package-id", package_id]) for package_db in pkg_info.package_dbs: args.extend(["-package-db", package_db]) return args def expose_packages(build_info, lib_info, use_direct, use_my_pkg_id, custom_package_caches, version): """ Returns the information that is needed by GHC in order to enable haskell packages. build_info: is common to all builds version: if the rule contains a version, we will export the CPP version macro All the other arguments are not understood well: lib_info: only used for repl and linter use_direct: only used for repl and linter use_my_pkg_id: only used for one specific task in compile.bzl custom_package_caches: override the package_caches of build_info, used only by the repl """ has_version = version != None and version != "" # Expose all prebuilt dependencies # # We have to remember to specify all (transitive) wired-in # dependencies or we can't find objects for linking # # Set use_direct if build_info does not have a direct_prebuilt_deps field. packages = [] for prebuilt_dep in set.to_list(build_info.direct_prebuilt_deps if use_direct else build_info.prebuilt_dependencies): packages.append(prebuilt_dep.package) # Expose all bazel dependencies package_ids = [] for package in set.to_list(build_info.package_ids): # XXX: repl and lint uses this lib_info flags # It is set to None in all other usage of this function # TODO: find the meaning of this flag if lib_info == None or package != lib_info.package_id: # XXX: use_my_pkg_id is not None only in compile.bzl if (use_my_pkg_id == None) or package != use_my_pkg_id: package_ids.append(package) # Only include package DBs for deps, prebuilt deps should be found # auto-magically by GHC package_dbs = [] for cache in set.to_list(build_info.package_caches if not custom_package_caches else custom_package_caches): package_dbs.append(cache.dirname) ghc_info = struct( has_version = has_version, packages = packages, package_ids = package_ids, package_dbs = package_dbs, ) return ghc_info
36.921348
121
0.680158
478
3,286
4.493724
0.307531
0.03352
0.018622
0.023277
0.119181
0.119181
0.087523
0.037244
0
0
0
0.002426
0.247413
3,286
88
122
37.340909
0.866154
0.471698
0
0
0
0
0.052311
0
0
0
0
0.011364
0
1
0.055556
false
0
0
0
0.111111
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
83fd35f6f554a1bd8fc3e12924ca6da425b05086
486
py
Python
tests/programs/lists/member_isin.py
astraldawn/pylps
e9964a24bb38657b180d441223b4cdb9e1dadc8a
[ "MIT" ]
1
2018-05-19T18:28:12.000Z
2018-05-19T18:28:12.000Z
tests/programs/lists/member_isin.py
astraldawn/pylps
e9964a24bb38657b180d441223b4cdb9e1dadc8a
[ "MIT" ]
12
2018-04-26T00:58:11.000Z
2018-05-13T22:03:39.000Z
tests/programs/lists/member_isin.py
astraldawn/pylps
e9964a24bb38657b180d441223b4cdb9e1dadc8a
[ "MIT" ]
null
null
null
from pylps.core import * initialise(max_time=5) create_actions('say(_, _)', 'say_single(_)') create_events('member(_, _)') create_facts('inp(_, _)') create_variables('X', 'Y', 'F', 'Item', 'List', 'Tail') inp([], [[]]) inp('z', ['a', 'b', 'c', 'd', 'e']) inp('a', ['b', 'c', 'a']) inp(['b', 'c'], ['d', ['a', 'c']]) inp(['b', 'c'], ['d', ['a', 'c'], ['b', 'c']]) reactive_rule(inp(Item, List)).then( Item.is_in(List), say(Item, List), ) execute(debug=False) show_kb_log()
20.25
55
0.522634
73
486
3.246575
0.547945
0.042194
0.037975
0.050633
0.067511
0.067511
0
0
0
0
0
0.00237
0.131687
486
23
56
21.130435
0.559242
0
0
0
0
0
0.164609
0
0
0
0
0
0
1
0
true
0
0.058824
0
0.058824
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
1
83ff592ddca67877e6b752e54e39cc96af464cdd
1,565
py
Python
clevr_video/params.py
jiaqi-xi/slot_attention
8420414eb261501e5b056e4d409c338d909397ef
[ "Apache-2.0" ]
null
null
null
clevr_video/params.py
jiaqi-xi/slot_attention
8420414eb261501e5b056e4d409c338d909397ef
[ "Apache-2.0" ]
null
null
null
clevr_video/params.py
jiaqi-xi/slot_attention
8420414eb261501e5b056e4d409c338d909397ef
[ "Apache-2.0" ]
1
2021-11-11T19:44:14.000Z
2021-11-11T19:44:14.000Z
from typing import Optional from typing import Tuple import attr @attr.s(auto_attribs=True) class SlotAttentionParams: lr: float = 0.0004 batch_size: int = 64 val_batch_size: int = 64 resolution: Tuple[int, int] = (128, 128) num_slots: int = 7 # 5 change to 7 according to official code num_iterations: int = 3 data_root: str = "/scratch/ssd004/scratch/ziyiwu/data/clevr_video/train/" gpus: int = 1 max_epochs: int = 8 num_sanity_val_steps: int = 1 scheduler_gamma: float = 0.5 weight_decay: float = 0.0 num_train_images: Optional[int] = None num_val_images: Optional[int] = None empty_cache: bool = True is_logger_enabled: bool = True is_verbose: bool = True num_workers: int = 4 n_samples: int = 5 warmup_steps_pct: float = 0.02 decay_steps_pct: float = 0.2 # whether use relu in SlotModel use_relu: bool = True # MLP hidden size in Slot Attention slot_mlp_size: int = 128 # use self-entropy loss to masks use_entropy_loss: bool = False entropy_loss_w: float = 1.0 # whether set the slot parameters as learnable (to be updated by BP) # TODO: should be True in official code!!! # TODO: but this codebase set it as False and I've done lots of exp using # TODO: it so far... So I set False as the default value learnable_slot = False # whether train mu and sigma or slot embedding, or directly emb itself random_slot: bool = True # whether each slot shares one set of learned parameters slot_agnostic: bool = True
34.021739
77
0.686901
247
1,565
4.198381
0.510121
0.046287
0.030858
0.027001
0
0
0
0
0
0
0
0.03457
0.242173
1,565
45
78
34.777778
0.839798
0.315655
0
0
0
0
0.050943
0.050943
0
0
0
0.022222
0
1
0
false
0
0.090909
0
0.969697
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
86024a0f256f012bd58b4d8e9b5de4b21cc1702d
1,024
py
Python
stat_ip_in_hash_woker_table.py
ligang945/pyMisc
3107c80f7f53ffc797b289ec73d1ef4db80f0b63
[ "MIT" ]
null
null
null
stat_ip_in_hash_woker_table.py
ligang945/pyMisc
3107c80f7f53ffc797b289ec73d1ef4db80f0b63
[ "MIT" ]
null
null
null
stat_ip_in_hash_woker_table.py
ligang945/pyMisc
3107c80f7f53ffc797b289ec73d1ef4db80f0b63
[ "MIT" ]
null
null
null
def sortedDict(adict): keys = adict.keys() keys.sort() return map(adict.get, keys) ipint2str = lambda x: '.'.join([str(x/(256**i)%256) for i in range(3,-1,-1)]) ipstr2int = lambda x:sum([256**j*int(i) for j,i in enumerate(x.split('.')[::-1])]) src_ip = dict() dst_ip = dict() i =0 with open('hash_key_value') as f: for line in f: i += 1 # if i==8424720: if i==328: break ip = int(line.split(',')[0], 16) dir = int(line.split(',')[1]) if dir==1: src_ip.setdefault(ip, dir) elif dir ==0: dst_ip.setdefault(ip, dir) print len(src_ip) for key in src_ip: print ipint2str(key)+' ' , print '=======' print len(dst_ip) for key in dst_ip: print ipint2str(key)+' ' , # keys = src_ip.items() # keys.sort() # for key in keys: # print ipint2str(key[0]) # keys = dst_ip.items() # keys.sort() # for key in keys: # print ipint2str(key[0])
20.078431
82
0.512695
153
1,024
3.352941
0.326797
0.048733
0.062378
0.066277
0.175439
0.175439
0.175439
0.175439
0.175439
0.175439
0
0.055241
0.310547
1,024
50
83
20.48
0.671388
0.160156
0
0.074074
0
0
0.034198
0
0
0
0
0
0
0
null
null
0
0
null
null
0.185185
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
1
86035a85164418f81cd1bcd44a084b4bd7b49d04
328
py
Python
app/LOGS/logger_.py
innovationb1ue/XMU_HealthReport
6ee0c7830a0e30fc9730401585a303873f382bac
[ "MIT" ]
2
2021-09-03T18:13:46.000Z
2022-01-13T08:48:36.000Z
app/LOGS/logger_.py
buuuuuuug/XMU_HealthReport
cb545959eceddf676b34237c38b1ba6f797764f5
[ "MIT" ]
null
null
null
app/LOGS/logger_.py
buuuuuuug/XMU_HealthReport
cb545959eceddf676b34237c38b1ba6f797764f5
[ "MIT" ]
1
2021-07-14T09:48:19.000Z
2021-07-14T09:48:19.000Z
import logging class NewLogger: def __init__(self, log_abs_path:str): self.logger = logging.getLogger() handler = logging.FileHandler(log_abs_path) handler.setLevel(logging.ERROR) self.logger.addHandler(handler) def log(self, msg:str): self.logger.log(logging.ERROR, msg)
18.222222
51
0.664634
40
328
5.25
0.475
0.142857
0.095238
0
0
0
0
0
0
0
0
0
0.231707
328
17
52
19.294118
0.833333
0
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0
0.444444
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
1
860663bf7fc7f279ff0aaf05a3df989c0b80600b
2,431
py
Python
Python/zzz_training_challenge/Python_Challenge/solutions/ch07_recursion_advanced/solutions/ex07_water_jugs.py
Kreijeck/learning
eaffee08e61f2a34e01eb8f9f04519aac633f48c
[ "MIT" ]
null
null
null
Python/zzz_training_challenge/Python_Challenge/solutions/ch07_recursion_advanced/solutions/ex07_water_jugs.py
Kreijeck/learning
eaffee08e61f2a34e01eb8f9f04519aac633f48c
[ "MIT" ]
null
null
null
Python/zzz_training_challenge/Python_Challenge/solutions/ch07_recursion_advanced/solutions/ex07_water_jugs.py
Kreijeck/learning
eaffee08e61f2a34e01eb8f9f04519aac633f48c
[ "MIT" ]
null
null
null
# Beispielprogramm für das Buch "Python Challenge" # # Copyright 2020 by Michael Inden def solve_water_jugs(size1, size2, desired_liters): return __solve_water_jugs_rec(size1, size2, desired_liters, 0, 0, {}) def __solve_water_jugs_rec(size1, size2, desired_liters, current_jug1, current_jug2, already_tried): if is_solved(current_jug1, current_jug2, desired_liters): print("Solved Jug 1:", current_jug1, " / 2:", current_jug2) return True key = (current_jug1, current_jug2) if not key in already_tried: already_tried[key] = True # Probiere alle 6 Varianten aus print("Jug 1:", current_jug1, " / 2: ", current_jug2) min_2_1 = min(current_jug2, (size1 - current_jug1)) min_1_2 = min(current_jug1, (size2 - current_jug2)) result = __solve_water_jugs_rec(size1, size2, desired_liters, 0, current_jug2, already_tried) or \ __solve_water_jugs_rec(size1, size2, desired_liters, current_jug1, 0, already_tried) or \ __solve_water_jugs_rec(size1, size2, desired_liters, size1, current_jug2, already_tried) or \ __solve_water_jugs_rec(size1, size2, desired_liters, current_jug1, size2, already_tried) or \ __solve_water_jugs_rec(size1, size2, desired_liters, current_jug1 + min_2_1, current_jug2 - min_2_1, already_tried) or \ __solve_water_jugs_rec(size1, size2, desired_liters, current_jug1 - min_1_2, current_jug2 + min_1_2, already_tried) # Memoization: already_tried[key] = result return result return False def is_solved(current_jug1, current_jug2, desired_liters): return (current_jug1 == desired_liters and current_jug2 == 0) or \ (current_jug2 == desired_liters and current_jug1 == 0) def main(): print(solve_water_jugs(4, 3, 2)) print(solve_water_jugs(4, 4, 2)) #print(solveWaterJugs(5, 2, 4)) if __name__ == "__main__": main()
37.4
80
0.559441
270
2,431
4.596296
0.203704
0.124093
0.124093
0.166801
0.559226
0.495568
0.495568
0.452055
0.382756
0.31668
0
0.055736
0.365282
2,431
64
81
37.984375
0.748542
0.062937
0
0.121951
0
0
0.016733
0
0
0
0
0
0
1
0.097561
false
0
0
0.04878
0.219512
0.097561
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
8606c99e338a87761250aeed31095b32a52bc802
10,041
py
Python
Acquire/Identity/_useraccount.py
openghg/acquire
8af8701b092f7304c02fea1ee6360e53502dfd64
[ "Apache-2.0" ]
1
2021-10-18T17:11:47.000Z
2021-10-18T17:11:47.000Z
Acquire/Identity/_useraccount.py
openghg/acquire
8af8701b092f7304c02fea1ee6360e53502dfd64
[ "Apache-2.0" ]
null
null
null
Acquire/Identity/_useraccount.py
openghg/acquire
8af8701b092f7304c02fea1ee6360e53502dfd64
[ "Apache-2.0" ]
null
null
null
__all__ = ["UserAccount"] _user_root = "identity/users" def _encode_username(username): """This function returns an encoded (sanitised) version of the username. This will ensure that the username is valid (must be between 3 and 50 characters). The sanitised username is the encoded version, meaning that a user can use a unicode (emoji) username if they so desire """ if username is None: return None if len(username) < 3 or len(username) > 150: from Acquire.Identity import UsernameError raise UsernameError("The username must be between 3 and 150 characters!") from Acquire.ObjectStore import string_to_encoded as _string_to_encoded return _string_to_encoded(username) class UserAccount: """This class holds all information about a user's account, e.g. their username, the sanitised username for the person on the system, their account keys, status etc. This data can be serialised to an from json to allow easy saving a retrieval from an object store """ def __init__(self, username=None, user_uid=None, private_key=None, status=None): """Construct from the passed username""" self._username = username self._uid = user_uid self._privkey = private_key self._status = status @staticmethod def create(username, password, _service_uid=None, _service_public_key=None): """Create a new account with username 'username', which will be secured using the passed password. Note that this will create an account with a specified user UID, meaning that different users can have the same username. We identify the right user via the combination of username, password and OTP code. Normally the UID of the service, and the skeleton key used to encrypt the backup password are obtained directly from the service. However, when initialising a new service we must pass these directly. In those cases, pass the object using _service_uid and _service_public_key This returns a tuple of the user_uid and OTP for the newly-created account """ from Acquire.ObjectStore import create_uuid as _create_uuid from Acquire.Crypto import PrivateKey as _PrivateKey from Acquire.Crypto import PublicKey as _PublicKey from Acquire.ObjectStore import ObjectStore as _ObjectStore from Acquire.Service import get_service_account_bucket as _get_service_account_bucket from Acquire.ObjectStore import bytes_to_string as _bytes_to_string from Acquire.Identity import UserCredentials as _UserCredentials from Acquire.ObjectStore import get_datetime_now_to_string as _get_datetime_now_to_string if _service_public_key is None: from Acquire.Service import get_this_service as _get_this_service service_pubkey = _get_this_service().public_skeleton_key() assert service_pubkey is not None else: service_pubkey = _service_public_key if not isinstance(service_pubkey, _PublicKey): raise TypeError("The service public key must be type PublicKey") if _service_uid is None: from Acquire.Service import get_this_service as _get_this_service service_uid = _get_this_service(need_private_access=False).uid() else: service_uid = _service_uid # create a UID for this new user user_uid = _create_uuid() # now create the primary password for this user and use # this to encrypt the special keys for this user privkey = _PrivateKey(name="user_secret_key %s %s" % (username, user_uid)) primary_password = _PrivateKey.random_passphrase() bucket = _get_service_account_bucket() # now create the credentials used to validate a login otp = _UserCredentials.create(user_uid=user_uid, password=password, primary_password=primary_password) # create the user account user = UserAccount(username=username, user_uid=user_uid, private_key=privkey, status="active") # now save a lookup from the username to this user_uid # (many users can have the same username). Use this lookup # to hold a recovery password for this account recovery_password = _bytes_to_string(service_pubkey.encrypt(primary_password)) key = "%s/names/%s/%s" % (_user_root, user.encoded_name(), user_uid) _ObjectStore.set_string_object(bucket=bucket, key=key, string_data=recovery_password) # now save a lookup from the hashed username+password # to the user_uid, so that we can # quickly find matching user_uids (expect few people will have # exactly the same username and password). This will # save the exact time this username-password combination # was set encoded_password = _UserCredentials.hash( username=username, password=password, service_uid=service_uid ) key = "%s/passwords/%s/%s" % (_user_root, encoded_password, user_uid) _ObjectStore.set_string_object(bucket=bucket, key=key, string_data=_get_datetime_now_to_string()) # finally(!) save the account itself to the object store key = "%s/uids/%s" % (_user_root, user_uid) data = user.to_data(passphrase=primary_password) _ObjectStore.set_object_from_json(bucket=bucket, key=key, data=data) # return the OTP and user_uid return (user_uid, otp) @staticmethod def login(credentials, user_uid=None, remember_device=False): """Login to the session with specified 'short_uid' with the user with passed 'username' and 'credentials', optionally specifying the user_uid """ if user_uid is None: # find all of the user_uids of accounts with this # username+password combination from Acquire.ObjectStore import ObjectStore as _ObjectStore from Acquire.Service import get_service_account_bucket as _get_service_account_bucket from Acquire.Client import Credentials as _Credentials from Acquire.Identity import UserCredentials as _UserCredentials from Acquire.Service import get_this_service as _get_this_service if not isinstance(credentials, _Credentials): raise TypeError("The credentials must be type Credentials") bucket = _get_service_account_bucket() encoded_password = _UserCredentials.hash( username=credentials.username(), password=credentials.password() ) prefix = "%s/passwords/%s/" % (_user_root, encoded_password) try: names = _ObjectStore.get_all_object_names(bucket=bucket, prefix=prefix) except: names = [] user_uids = [] for name in names: user_uids.append(name.split("/")[-1]) else: user_uids = [user_uid] if len(user_uids) == 0: from Acquire.Identity import UserValidationError raise UserValidationError("No user with name '%s'" % credentials.username()) from Acquire.Identity import UserCredentials as _UserCredentials return _UserCredentials.login( credentials=credentials, user_uids=user_uids, remember_device=remember_device ) def __str__(self): return "UserAccount(name : %s)" % self._username def name(self): """Return the name of this account""" return self._username def username(self): """Synonym for 'name'""" return self.name() def encoded_name(self): """Return the encoded (sanitised) username""" return _encode_username(self._username) def uid(self): """Return the globally unique ID for this account""" return self._uid def login_root_url(self): """Return the root URL used to log into this account""" from Acquire.Service import get_this_service as _get_this_service return _get_this_service().canonical_url() def is_valid(self): """Return whether or not this is a valid account""" return not (self._status is None) def is_active(self): """Return whether or not this is an active account""" if self._status is None: return False else: return self._status == "active" def public_key(self): """Return the lines of the public key for this account""" return self._privkey.public_key() def private_key(self): """Return the lines of the private key for this account""" return self._privkey def status(self): """Return the status for this account""" if self._status is None: return "invalid" return self._status def to_data(self, passphrase, mangleFunction=None): """Return a data representation of this object (dictionary)""" if self._username is None: return None data = {} data["username"] = self._username data["status"] = self._status data["uid"] = self._uid data["private_key"] = self._privkey.to_data(passphrase=passphrase, mangleFunction=mangleFunction) return data @staticmethod def from_data(data, passphrase, mangleFunction=None): """Return a UserAccount constructed from the passed data (dictionary) """ user = UserAccount() if data is not None and len(data) > 0: from Acquire.Crypto import PrivateKey as _PrivateKey user._username = data["username"] user._status = data["status"] user._uid = data["uid"] user._privkey = _PrivateKey.from_data( data=data["private_key"], passphrase=passphrase, mangleFunction=mangleFunction ) return user
37.74812
110
0.66587
1,245
10,041
5.154217
0.171888
0.023999
0.023999
0.02618
0.277388
0.193237
0.178276
0.11828
0.11828
0.0988
0
0.001901
0.266408
10,041
265
111
37.890566
0.869264
0.268101
0
0.20438
0
0
0.050958
0
0
0
0
0
0.007299
1
0.124088
false
0.116788
0.153285
0.007299
0.430657
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
1
860766f5b7e396034ed70275ab698c4665993ebb
584
py
Python
tests/test_translator.py
Attsun1031/schematics
90dee53fd1d5c29f2c947bec6f5ffe5f74305ab1
[ "BSD-3-Clause" ]
1,430
2015-01-01T19:22:19.000Z
2022-03-29T11:34:35.000Z
tests/test_translator.py
Attsun1031/schematics
90dee53fd1d5c29f2c947bec6f5ffe5f74305ab1
[ "BSD-3-Clause" ]
360
2015-01-02T05:27:34.000Z
2022-03-18T14:08:27.000Z
tests/test_translator.py
Attsun1031/schematics
90dee53fd1d5c29f2c947bec6f5ffe5f74305ab1
[ "BSD-3-Clause" ]
222
2015-01-07T20:07:02.000Z
2022-03-22T16:12:47.000Z
# -*- coding: utf-8 -*- import pytest def test_translator(): def translator(string): translations = {'String value is too long.': 'Tamanho de texto muito grande.'} return translations.get(string, string) from schematics.translator import register_translator register_translator(translator) from schematics.types import StringType from schematics.exceptions import ValidationError with pytest.raises(ValidationError) as exc: StringType(max_length=1).validate_length('Abc') assert exc.value == ['Tamanho de texto muito grande.']
30.736842
86
0.72089
67
584
6.208955
0.567164
0.100962
0.067308
0.091346
0.120192
0
0
0
0
0
0
0.004211
0.186644
584
18
87
32.444444
0.871579
0.035959
0
0
0
0
0.156863
0
0
0
0
0
0.083333
1
0.166667
false
0
0.333333
0
0.583333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
1
860804e29db65321937c10951cae50769822d370
641
py
Python
1014 Trie Tree/test.py
SLAPaper/hihoCoder
3f64d678c5dd46db36345736eb56880fb2d2c5fe
[ "MIT" ]
null
null
null
1014 Trie Tree/test.py
SLAPaper/hihoCoder
3f64d678c5dd46db36345736eb56880fb2d2c5fe
[ "MIT" ]
null
null
null
1014 Trie Tree/test.py
SLAPaper/hihoCoder
3f64d678c5dd46db36345736eb56880fb2d2c5fe
[ "MIT" ]
null
null
null
# generate 900k word and 900k query to test the runtime from main import TrieTree import time import random vocal = list(range(26)) trie = TrieTree() words = [[random.choice(vocal) for _ in range(random.randrange(1, 11))] for _ in range(100000)] queries = [[random.choice(vocal) for _ in range(random.randrange(1, 11))] for _ in range(100000)] begin = time.time() for word in words: trie.insert(word) insert_end = time.time() for query in queries: trie.query(query) end = time.time() print("insert time used:", insert_end - begin, 's') print("query time used:", end - insert_end, 's') print("time used:", end - begin, 's')
22.103448
97
0.692668
100
641
4.37
0.35
0.045767
0.091533
0.091533
0.279176
0.279176
0.279176
0.279176
0.279176
0.279176
0
0.048598
0.165367
641
28
98
22.892857
0.768224
0.082683
0
0
1
0
0.078498
0
0
0
0
0
0
1
0
false
0
0.176471
0
0.176471
0.176471
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
f7a809bbbe91eb7260be62d0dad3baf769a4cf97
5,013
py
Python
tests/test_host_resolver.py
mssaleh/aioatomapi
2b9f00fce993153c52595e09ecc80562574af62c
[ "MIT" ]
null
null
null
tests/test_host_resolver.py
mssaleh/aioatomapi
2b9f00fce993153c52595e09ecc80562574af62c
[ "MIT" ]
27
2021-10-13T17:17:38.000Z
2022-03-31T17:24:08.000Z
tests/test_host_resolver.py
mssaleh/aioatomapi
2b9f00fce993153c52595e09ecc80562574af62c
[ "MIT" ]
null
null
null
import asyncio import socket import pytest from mock import AsyncMock, MagicMock, patch import aioatomapi.host_resolver as hr from aioatomapi.core import APIConnectionError @pytest.fixture def async_zeroconf(): with patch("zeroconf.asyncio.AsyncZeroconf") as klass: yield klass.return_value @pytest.fixture def addr_infos(): return [ hr.AddrInfo( family=socket.AF_INET, type=socket.SOCK_STREAM, proto=socket.IPPROTO_TCP, sockaddr=hr.IPv4Sockaddr(address="10.0.0.42", port=6052), ), hr.AddrInfo( family=socket.AF_INET6, type=socket.SOCK_STREAM, proto=socket.IPPROTO_TCP, sockaddr=hr.IPv6Sockaddr( address="2001:db8:85a3::8a2e:370:7334", port=6052, flowinfo=0, scope_id=0, ), ), ] @pytest.mark.asyncio async def test_resolve_host_zeroconf(async_zeroconf, addr_infos): info = MagicMock() info.addresses_by_version.return_value = [ b"\n\x00\x00*", b" \x01\r\xb8\x85\xa3\x00\x00\x00\x00\x8a.\x03ps4", ] async_zeroconf.async_get_service_info = AsyncMock(return_value=info) async_zeroconf.async_close = AsyncMock() loop = asyncio.get_event_loop() ret = await hr._async_resolve_host_zeroconf(loop, "asdf", 6052) async_zeroconf.async_get_service_info.assert_called_once_with( "_atomlib._tcp.local.", "asdf._atomlib._tcp.local.", 3000 ) async_zeroconf.async_close.assert_called_once_with() assert ret == addr_infos @pytest.mark.asyncio async def test_resolve_host_zeroconf_empty(async_zeroconf): async_zeroconf.async_get_service_info = AsyncMock(return_value=None) async_zeroconf.async_close = AsyncMock() loop = asyncio.get_event_loop() ret = await hr._async_resolve_host_zeroconf(loop, "asdf.local", 6052) assert ret == [] @pytest.mark.asyncio async def test_resolve_host_getaddrinfo(addr_infos): eventloop = AsyncMock() eventloop.getaddrinfo.return_value = [ ( socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP, "canon1", ("10.0.0.42", 6052), ), ( socket.AF_INET6, socket.SOCK_STREAM, socket.IPPROTO_TCP, "canon2", ("2001:db8:85a3::8a2e:370:7334", 6052, 0, 0), ), (-1, socket.SOCK_STREAM, socket.IPPROTO_TCP, "canon3", ("10.0.0.42", 6052)), ] ret = await hr._async_resolve_host_getaddrinfo(eventloop, "example.com", 6052) assert ret == addr_infos @pytest.mark.asyncio async def test_resolve_host_getaddrinfo_oserror(): eventloop = AsyncMock() eventloop.getaddrinfo.side_effect = OSError() with pytest.raises(APIConnectionError): await hr._async_resolve_host_getaddrinfo(eventloop, "example.com", 6052) @pytest.mark.asyncio @patch("aioatomapi.host_resolver._async_resolve_host_zeroconf") @patch("aioatomapi.host_resolver._async_resolve_host_getaddrinfo") async def test_resolve_host_mdns(resolve_addr, resolve_zc, addr_infos): resolve_zc.return_value = addr_infos loop = asyncio.get_event_loop() ret = await hr.async_resolve_host(loop, "example.local", 6052) resolve_zc.assert_called_once_with(loop, "example", 6052, zeroconf_instance=None) resolve_addr.assert_not_called() assert ret == addr_infos[0] @pytest.mark.asyncio @patch("aioatomapi.host_resolver._async_resolve_host_zeroconf") @patch("aioatomapi.host_resolver._async_resolve_host_getaddrinfo") async def test_resolve_host_mdns_empty(resolve_addr, resolve_zc, addr_infos): resolve_zc.return_value = [] resolve_addr.return_value = addr_infos loop = asyncio.get_event_loop() ret = await hr.async_resolve_host(loop, "example.local", 6052) resolve_zc.assert_called_once_with(loop, "example", 6052, zeroconf_instance=None) resolve_addr.assert_called_once_with(loop, "example.local", 6052) assert ret == addr_infos[0] @pytest.mark.asyncio @patch("aioatomapi.host_resolver._async_resolve_host_zeroconf") @patch("aioatomapi.host_resolver._async_resolve_host_getaddrinfo") async def test_resolve_host_addrinfo(resolve_addr, resolve_zc, addr_infos): resolve_addr.return_value = addr_infos ret = await hr.async_resolve_host(None, "example.com", 6052) resolve_zc.assert_not_called() resolve_addr.assert_called_once_with(None, "example.com", 6052) assert ret == addr_infos[0] @pytest.mark.asyncio @patch("aioatomapi.host_resolver._async_resolve_host_zeroconf") @patch("aioatomapi.host_resolver._async_resolve_host_getaddrinfo") async def test_resolve_host_addrinfo_empty(resolve_addr, resolve_zc, addr_infos): resolve_addr.return_value = [] with pytest.raises(APIConnectionError): await hr.async_resolve_host(None, "example.com", 6052) resolve_zc.assert_not_called() resolve_addr.assert_called_once_with(None, "example.com", 6052)
32.764706
85
0.710353
641
5,013
5.213729
0.165367
0.078995
0.076601
0.045482
0.759725
0.739378
0.672651
0.672651
0.669659
0.582885
0
0.040362
0.18452
5,013
152
86
32.980263
0.777153
0
0
0.479339
0
0.008264
0.160184
0.118292
0
0
0
0
0.132231
1
0.016529
false
0
0.049587
0.008264
0.07438
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1