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
97fae8fbd655a4d36aaf8dc112ef517f4274a3a5
101
py
Python
codingchallenges/calculate_tip.py
joesmall37/Algorithms
ae14e48a9a05558da81da01c5061db265f09e2e4
[ "MIT" ]
null
null
null
codingchallenges/calculate_tip.py
joesmall37/Algorithms
ae14e48a9a05558da81da01c5061db265f09e2e4
[ "MIT" ]
null
null
null
codingchallenges/calculate_tip.py
joesmall37/Algorithms
ae14e48a9a05558da81da01c5061db265f09e2e4
[ "MIT" ]
null
null
null
def tip(total, percentage): tip = (total * percentage) / 100 return tip print(tip(24, 13))
14.428571
36
0.623762
14
101
4.5
0.642857
0.253968
0.571429
0
0
0
0
0
0
0
0
0.090909
0.237624
101
6
37
16.833333
0.727273
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0
0.5
0.25
1
0
0
null
1
1
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
1
0
0
0
0
0
0
0
5
3f0ac37ee9db507e35daabce30828e449e4ea118
204
py
Python
core/apps.py
Mozirra/mtghelper
57ccc201e385edc2166cfe9746b47f1b224359e9
[ "MIT" ]
null
null
null
core/apps.py
Mozirra/mtghelper
57ccc201e385edc2166cfe9746b47f1b224359e9
[ "MIT" ]
null
null
null
core/apps.py
Mozirra/mtghelper
57ccc201e385edc2166cfe9746b47f1b224359e9
[ "MIT" ]
null
null
null
"""The "Core" application configuration of the MTG Helper.""" from django.apps import AppConfig class CoreConfig(AppConfig): """The core application configuration.""" name = 'core'
18.545455
62
0.671569
22
204
6.227273
0.681818
0.10219
0.262774
0.452555
0
0
0
0
0
0
0
0
0.215686
204
10
63
20.4
0.85625
0.446078
0
0
0
0
0.043478
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
1
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
1
0
1
0
0
5
3f3e8bf6ad187b2c74315411a514724f9df866ee
57
py
Python
pstd/exceptions.py
Performance-Analytics/pstd
84d23d5478bd4072322e5cb13e8266d7b5a898ca
[ "MIT" ]
null
null
null
pstd/exceptions.py
Performance-Analytics/pstd
84d23d5478bd4072322e5cb13e8266d7b5a898ca
[ "MIT" ]
4
2019-01-04T05:34:13.000Z
2019-01-07T14:43:06.000Z
pstd/exceptions.py
Performance-Analytics/pstd
84d23d5478bd4072322e5cb13e8266d7b5a898ca
[ "MIT" ]
null
null
null
class InvalidFatigueRatingException(Exception): pass
19
47
0.824561
4
57
11.75
1
0
0
0
0
0
0
0
0
0
0
0
0.122807
57
2
48
28.5
0.94
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
0
1
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
1
1
0
0
0
0
0
5
58b0df033c0a79540af0355329232bf1bfa4894f
52
py
Python
sggm/analysis/uci/__init__.py
pierresegonne/SGGM
46663a722384b4ee2b3358261d6eb626a16ca51a
[ "Apache-2.0" ]
4
2020-10-27T13:56:54.000Z
2021-05-23T19:16:15.000Z
sggm/analysis/uci/__init__.py
pierresegonne/SGGM
46663a722384b4ee2b3358261d6eb626a16ca51a
[ "Apache-2.0" ]
16
2021-03-29T09:59:56.000Z
2022-03-12T01:00:38.000Z
sggm/analysis/uci/__init__.py
pierresegonne/SGGM
46663a722384b4ee2b3358261d6eb626a16ca51a
[ "Apache-2.0" ]
null
null
null
from sggm.analysis.uci.main import plot as uci_plot
26
51
0.826923
10
52
4.2
0.8
0
0
0
0
0
0
0
0
0
0
0
0.115385
52
1
52
52
0.913043
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
58e05ca0efc17357f0c8bdc4a06b82dbd7692bb1
8,040
py
Python
data/train/python/58e05ca0efc17357f0c8bdc4a06b82dbd7692bb1routing.py
harshp8l/deep-learning-lang-detection
2a54293181c1c2b1a2b840ddee4d4d80177efb33
[ "MIT" ]
84
2017-10-25T15:49:21.000Z
2021-11-28T21:25:54.000Z
data/train/python/58e05ca0efc17357f0c8bdc4a06b82dbd7692bb1routing.py
vassalos/deep-learning-lang-detection
cbb00b3e81bed3a64553f9c6aa6138b2511e544e
[ "MIT" ]
5
2018-03-29T11:50:46.000Z
2021-04-26T13:33:18.000Z
data/train/python/58e05ca0efc17357f0c8bdc4a06b82dbd7692bb1routing.py
vassalos/deep-learning-lang-detection
cbb00b3e81bed3a64553f9c6aa6138b2511e544e
[ "MIT" ]
24
2017-11-22T08:31:00.000Z
2022-03-27T01:22:31.000Z
"""Routes configuration The more specific and detailed routes should be defined first so they may take precedent over the more generic routes. For more information refer to the routes manual at http://routes.groovie.org/docs/ """ from routes import Mapper def make_map(config): """Create, configure and return the routes Mapper""" map = Mapper(directory=config['pylons.paths']['controllers'], always_scan=config['debug']) map.minimization = False map.explicit = False # The ErrorController route (handles 404/500 error pages); it should # likely stay at the top, ensuring it can always be resolved map.connect('/error/{action}', controller='error') map.connect('/error/{action}/{id}', controller='error') # CUSTOM ROUTES HERE map.connect(None, '/', controller='user_overview', action='index') map.connect(None, '/user', controller='user_overview', action='index') map.connect(None, '/user/', controller='user_overview', action='index') map.connect(None, '/user/overview', controller='user_overview') map.connect(None, '/user/overview/', controller='user_overview') map.connect(None, '/user/overview/{action}', controller='user_overview', action='index') map.connect(None, '/user/vos', controller='user_vos', action='index') map.connect(None, '/user/clusters', controller='user_clusters', action='index') map.connect(None, '/user/clusters/', controller='user_clusters', action='index') map.connect(None, '/user/clusters/{action}', controller='user_clusters', ) map.connect(None, '/user/clusters/{action}/{id}', controller='user_clusters') map.connect(None, '/user/clusters/{action}/{id}/{queue}', controller='user_clusters') map.connect(None, '/user/jobs', controller='user_jobs') map.connect(None, '/user/jobs/', controller='user_jobs') map.connect(None, '/user/jobs/{action}', controller='user_jobs') map.connect(None, '/user/jobs/{action}/{status}', controller='user_jobs') map.connect(None, '/user/jobdetails/{dn}/{jobid}',controller='user_job_details') map.connect(None, '/user/statistics', controller='user_statistics') map.connect(None, '/user/statistics/', controller='user_statistics') map.connect(None, '/user/statistics/{action}', controller='user_statistics') map.connect(None, '/user/tickets', controller='user_tickets') map.connect(None, '/user/tickets/', controller='user_tickets') map.connect(None, '/user/links', controller='user_links') map.connect(None, '/user/links/', controller='user_links') # site admin map.connect(None, '/siteadmin', controller='siteadmin_overview', action='index') map.connect(None, '/siteadmin/', controller='siteadmin_overview', action='index') map.connect(None, '/siteadmin/overview', controller='siteadmin_overview') map.connect(None, '/siteadmin/overview/', controller='siteadmin_overview') map.connect(None, '/siteadmin/overview/{action}', controller='siteadmin_overview') map.connect(None, '/siteadmin/clusters', controller='siteadmin_clusters', action='index') map.connect(None, '/siteadmin/clusters/', controller='siteadmin_clusters', action='index') map.connect(None, '/siteadmin/clusters/{action}', controller='siteadmin_clusters', ) map.connect(None, '/siteadmin/clusters/{action}/{id}', controller='siteadmin_clusters') map.connect(None, '/siteadmin/clusters/{action}/{id}/{queue}', controller='siteadmin_clusters') map.connect(None, '/siteadmin/jobs', controller='siteadmin_jobs') map.connect(None, '/siteadmin/jobs/', controller='siteadmin_jobs') map.connect(None, '/siteadmin/jobs/{action}', controller='siteadmin_jobs') map.connect(None, '/siteadmin/users', controller='siteadmin_users') map.connect(None, '/siteadmin/testjobs', controller='siteadmin_testjobs') map.connect(None, '/siteadmin/testjobs/', controller='siteadmin_testjobs') map.connect(None, '/siteadmin/testjobs/{action}', controller='siteadmin_testjobs') map.connect(None, '/siteadmin/testjobs/{action}/{suit}', controller='siteadmin_testjobs') map.connect(None, '/siteadmin/statistics', controller='siteadmin_statistics') map.connect(None, '/siteadmin/statistics/', controller='siteadmin_statistics') # grid admin map.connect(None, '/gridadmin',controller='gridadmin_overview') map.connect(None, '/gridadmin/',controller='gridadmin_overview') map.connect(None, '/gridadmin/overview', controller='gridadmin_overview') map.connect(None, '/gridadmin/overview/', controller='gridadmin_overview') map.connect(None, '/gridadmin/overview/{action}', controller='gridadmin_overview') map.connect(None, '/gridadmin/clusters', controller='gridadmin_clusters') map.connect(None, '/gridadmin/clusters/', controller='gridadmin_clusters') map.connect(None, '/gridadmin/clusters/{action}', controller='gridadmin_clusters') map.connect(None, '/gridadmin/clusters/{action}/{id}', controller='gridadmin_clusters') map.connect(None, '/gridadmin/clusters/{action}/{id}/{queue}', controller='gridadmin_clusters') map.connect(None, '/gridadmin/sfts', controller='gridadmin_sfts') map.connect(None, '/gridadmin/sfts/', controller='gridadmin_sfts') map.connect(None, '/gridadmin/sfts/{action}', controller='gridadmin_sfts') map.connect(None, '/gridadmin/sfts/{action}/{name}', controller='gridadmin_sfts') map.connect(None, '/gridadmin/sfts/{action}/{name}/{cluster_name}', controller='gridadmin_sfts') map.connect(None, '/gridadmin/statistics', controller='gridadmin_statistics') map.connect(None, '/gridadmin/statistics/', controller='gridadmin_statistics') map.connect(None, '/gridadmin/statistics/{action}', controller='gridadmin_statistics') map.connect(None, '/gridadmin/statistics/{action}/{ctype}', controller='gridadmin_statistics') map.connect(None, '/gridadmin/infosys', controller='gridadmin_infosys') map.connect(None, '/gridadmin/infosys/', controller='gridadmin_infosys') map.connect(None, '/gridadmin/infosys/{action}', controller='gridadmin_infosys') map.connect(None, '/gridadmin/infosys/{action}/{arg}', controller='gridadmin_infosys') #map.connect(None, '/gridadmin/plot/{action}/{type}/{name}', controller='gridadmin_plot') # administrator interface for GridMonitor map.connect(None, '/monadmin',controller='monadmin') map.connect(None, '/monadmin/',controller='monadmin') map.connect(None, '/monadmin/acl/', controller='monadmin_acl') map.connect(None, '/monadmin/acl', controller='monadmin_acl') map.connect(None, '/monadmin/acl/{action}', controller='monadmin_acl') map.connect(None, '/monadmin/acl/{action}/{id}', controller='monadmin_acl') map.connect(None, '/monadmin/sft', controller='monadmin_sft') map.connect(None, '/monadmin/sft/', controller='monadmin_sft') map.connect(None, '/monadmin/sft/{action}', controller='monadmin_sft') map.connect(None, '/monadmin/sft/{action}/{id}', controller='monadmin_sft') #json interfaces map.connect(None, '/json/cluster/{action}', controller='cluster') map.connect(None, '/json/cluster/{action}/{hostname}', controller='cluster') map.connect(None, '/json/cluster/{action}/{hostname}/{tag}', controller='cluster') map.connect(None, '/json/grid/{action}', controller='grid') map.connect(None, '/json/jobs/{action}', controller='jobs') map.connect(None, '/json/jobs/{action}/{arg1}', controller='jobs') map.connect(None, '/json/jobs/{action}/{arg1}/{arg2}', controller='jobs') map.connect(None, '/json/statistics/{action}', controller='statistics') # help map.connect(None,'/help', controller='help') # public part of monitor (non AAI protected) -> can be used as widget in other web-pages map.connect(None,'/public', controller='public_summary') map.connect(None,'/public/{action}', controller='public_summary') map.connect(None,'/public/{action}/{ce}', controller='public_summary') return map
60.909091
100
0.712438
922
8,040
6.12256
0.139913
0.162976
0.223206
0.097786
0.810452
0.807795
0.783348
0.719221
0.663419
0.548804
0
0.001256
0.108706
8,040
131
101
61.374046
0.786492
0.083955
0
0
0
0
0.437909
0.156727
0
0
0
0
0
1
0.010204
false
0
0.010204
0
0.030612
0
0
0
0
null
0
1
0
1
1
1
1
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
5
45119ca0f1d3918f25257694252216ec2bc7a485
131
py
Python
Course I/Алгоритмы Python/Part2/семинары/pract2/задание/modules/task18/equationclass.py
GeorgiyDemo/FA
641a29d088904302f5f2164c9b3e1f1c813849ec
[ "WTFPL" ]
27
2019-08-18T20:54:27.000Z
2022-02-22T02:39:45.000Z
Course I/Алгоритмы Python/Part2/семинары/pract2/задание/modules/task18/equationclass.py
GeorgiyDemo/FA
641a29d088904302f5f2164c9b3e1f1c813849ec
[ "WTFPL" ]
217
2019-09-22T14:43:25.000Z
2022-03-30T13:49:18.000Z
Course I/Алгоритмы Python/Part2/семинары/pract2/задание/modules/task18/equationclass.py
GeorgiyDemo/FA
641a29d088904302f5f2164c9b3e1f1c813849ec
[ "WTFPL" ]
42
2019-09-18T11:36:28.000Z
2022-03-19T18:43:00.000Z
class EquationClass: def __init__(self): pass def calculation(self): ... def info(self): ...
13.1
26
0.503817
12
131
5.166667
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.374046
131
9
27
14.555556
0.756098
0
0
0.285714
0
0
0
0
0
0
0
0
0
1
0.428571
false
0.142857
0
0
0.571429
0
1
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
1
0
1
0
0
1
0
0
5
45168473e27d5b66a90dbf6afff7931a82715552
218
py
Python
pconsole/file.py
l3alr0g/Pconsole
657ead3e2060d74830c04aae33ce5498cf7b672f
[ "MIT" ]
4
2020-07-02T14:09:17.000Z
2021-11-29T20:13:49.000Z
pconsole/file.py
l3alr0g/Pconsole
657ead3e2060d74830c04aae33ce5498cf7b672f
[ "MIT" ]
null
null
null
pconsole/file.py
l3alr0g/Pconsole
657ead3e2060d74830c04aae33ce5498cf7b672f
[ "MIT" ]
null
null
null
class BufferFile: def __init__(self, write): self.write = write def readline(self): pass def writelines(self, l): map(self.append, l) def flush(self): pass def isatty(self): return 1
21.8
48
0.623853
30
218
4.4
0.533333
0.136364
0.166667
0
0
0
0
0
0
0
0
0.00625
0.266055
218
9
49
24.222222
0.81875
0
0
0
0
0
0
0
0
0
0
0
0
1
0.714286
false
0.285714
0
0.142857
0.857143
0
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
1
0
1
0
1
1
0
0
5
45222f77388e2f5ab33d2942aa25ba46e136e6ef
56
py
Python
smartresponder/__init__.py
valuerr/smartresponder
ca81453fb4924477b75c0ec3c450378676a5ba4f
[ "MIT" ]
null
null
null
smartresponder/__init__.py
valuerr/smartresponder
ca81453fb4924477b75c0ec3c450378676a5ba4f
[ "MIT" ]
null
null
null
smartresponder/__init__.py
valuerr/smartresponder
ca81453fb4924477b75c0ec3c450378676a5ba4f
[ "MIT" ]
null
null
null
from smartresponder.api import API, SMRError, signature
28
55
0.839286
7
56
6.714286
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.107143
56
1
56
56
0.94
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
189e0da0a6242144f505a4843ca609a0c8343fde
44
py
Python
password_cracker.py
Ben-Meyer21/fcc-brute-force-password-cracker
9950edfc46e0f7f62d2cb12bba4c133afc4a0341
[ "Apache-2.0" ]
null
null
null
password_cracker.py
Ben-Meyer21/fcc-brute-force-password-cracker
9950edfc46e0f7f62d2cb12bba4c133afc4a0341
[ "Apache-2.0" ]
null
null
null
password_cracker.py
Ben-Meyer21/fcc-brute-force-password-cracker
9950edfc46e0f7f62d2cb12bba4c133afc4a0341
[ "Apache-2.0" ]
1
2021-01-02T14:11:53.000Z
2021-01-02T14:11:53.000Z
import hashlib def crack_sha1_hash(hash):
8.8
26
0.795455
7
44
4.714286
0.857143
0
0
0
0
0
0
0
0
0
0
0.026316
0.136364
44
4
27
11
0.842105
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.5
null
null
0
1
1
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
1
0
0
0
1
0
0
0
0
5
18fa982ee58f43f52bfb750d17d4e4347b2795a3
185
py
Python
xixiang/__init__.py
LKI/xixiang
06ba8a03936b97cfa5e4872753e2a38a97becffb
[ "MIT" ]
15
2018-03-15T10:21:10.000Z
2019-10-28T07:58:29.000Z
xixiang/__init__.py
LKI/xixiang
06ba8a03936b97cfa5e4872753e2a38a97becffb
[ "MIT" ]
1
2019-11-14T06:44:02.000Z
2020-03-18T05:20:51.000Z
xixiang/__init__.py
LKI/xixiang
06ba8a03936b97cfa5e4872753e2a38a97becffb
[ "MIT" ]
null
null
null
__author__ = "Lirian Su" __version__ = "0.3.1" from . import urls as urls # NOQA from .exceptions import * # NOQA from .models import * # NOQA from .services import XiXiang # NOQA
23.125
37
0.697297
26
185
4.653846
0.615385
0.198347
0.231405
0
0
0
0
0
0
0
0
0.020408
0.205405
185
7
38
26.428571
0.802721
0.102703
0
0
0
0
0.086957
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
1
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
1
0
1
0
0
5
e16ba15c0d1f7d13a74d165f64b73628ee238106
1,836
py
Python
experiments/torch3d/run_config.py
alexus37/MasterThesisCode
a7eada603686de75968acc8586fd307a91b0491b
[ "MIT" ]
1
2020-04-23T15:39:27.000Z
2020-04-23T15:39:27.000Z
experiments/torch3d/run_config.py
alexus37/DeepExplain
a7eada603686de75968acc8586fd307a91b0491b
[ "MIT" ]
null
null
null
experiments/torch3d/run_config.py
alexus37/DeepExplain
a7eada603686de75968acc8586fd307a91b0491b
[ "MIT" ]
null
null
null
import enum class OrderedEnum(enum.Enum): def __ge__(self, other): if self.__class__ is other.__class__: return self.value >= other.value return NotImplemented def __gt__(self, other): if self.__class__ is other.__class__: return self.value > other.value return NotImplemented def __le__(self, other): if self.__class__ is other.__class__: return self.value <= other.value return NotImplemented def __lt__(self, other): if self.__class__ is other.__class__: return self.value < other.value return NotImplemented class Run_types(OrderedEnum): all_heat_paf_l2_loss = 0 all_heat_paf_l2_reg_loss = 1 all_heat_paf_kl_loss = 2 class Run_settings(): def __init__(self, run_type=Run_types.all_heat_paf_l2_loss): self.run_type = run_type def get_settings(self): snapshot_name = '' train_dir = '' test_dir = '' if self.run_type == Run_types.all_heat_paf_l2_loss: snapshot_name = f'../snapshots/vertex_color_bg_tshirt_torch.npy' train_dir = '../data/tshirt_torch/train' test_dir = '../data/tshirt_torch/test' if self.run_type == Run_types.all_heat_paf_l2_reg_loss: snapshot_name = f'../snapshots/vertex_color_bg_lp_tshirt_torch.npy' train_dir = '../data/tshirt_torch/train' test_dir = '../data/tshirt_torch/test' if self.run_type == Run_types.all_heat_paf_kl_loss: snapshot_name = f'../snapshots/vertex_color_bg_kl_tshirt_torch.npy' train_dir = '../data/tshirt_torch/train' test_dir = '../data/tshirt_torch/test' return train_dir, test_dir, snapshot_name
36
79
0.626906
236
1,836
4.326271
0.199153
0.096964
0.06856
0.105779
0.809011
0.77571
0.754163
0.754163
0.643487
0.643487
0
0.006084
0.283769
1,836
51
80
36
0.770342
0
0
0.333333
0
0
0.160044
0.160044
0
0
0
0
0
1
0.142857
false
0
0.02381
0
0.52381
0
0
0
0
null
0
0
0
1
1
1
1
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
5
e1c2c5f05ea932e083bd57041f2e20f2035c1101
559
py
Python
tests/utils.py
denizdogan/django-whiteless
7bb784015b4ea21d54223a08db55e681256b939c
[ "MIT" ]
4
2020-03-20T11:47:27.000Z
2022-03-16T18:41:15.000Z
tests/utils.py
denizdogan/django-whiteless
7bb784015b4ea21d54223a08db55e681256b939c
[ "MIT" ]
1
2021-04-27T15:25:51.000Z
2021-04-28T15:20:37.000Z
tests/utils.py
denizdogan/django-whiteless
7bb784015b4ea21d54223a08db55e681256b939c
[ "MIT" ]
null
null
null
from hypothesis import given, strategies as st given_double_whitespaces = given(st.from_regex(r"\s\s")) given_leading_double_whitespaces = given(st.from_regex(r"^\s\s")) given_leading_trailing_whitespaces = given(st.from_regex(r"^\s\S+\s$")) given_leading_whitespaces = given(st.from_regex(r"^\s+\S+")) given_no_whitespace = given(st.from_regex(r"^\S+$", fullmatch=True)) given_only_whitespaces = given(st.from_regex(r"^\s+$", fullmatch=True)) given_some_whitespace = given(st.from_regex(r"\s")) given_trailing_whitespaces = given(st.from_regex(r"\S+\s+$"))
50.818182
71
0.762075
91
559
4.395604
0.21978
0.14
0.22
0.32
0.82
0.82
0.82
0.6975
0.6975
0.24
0
0
0.060823
559
10
72
55.9
0.761905
0
0
0
0
0
0.078712
0
0
0
0
0
0
1
0
false
0
0.111111
0
0.111111
0
0
0
0
null
0
1
1
1
1
1
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
5
831cfc1e84651470a5b678f107fb1f4100c35bfe
316
py
Python
astrosource/__init__.py
zemogle/autovar
d495a336c0559097f566c2ce3f6136645f29ed62
[ "MIT" ]
1
2019-01-28T13:35:39.000Z
2019-01-28T13:35:39.000Z
astrosource/__init__.py
zemogle/astrosource
d495a336c0559097f566c2ce3f6136645f29ed62
[ "MIT" ]
14
2019-10-28T13:09:32.000Z
2022-02-10T22:43:03.000Z
astrosource/__init__.py
zemogle/autovar
d495a336c0559097f566c2ce3f6136645f29ed62
[ "MIT" ]
3
2019-09-27T11:16:14.000Z
2021-02-07T23:10:19.000Z
import warnings warnings.simplefilter('ignore') from astrosource.analyse import * from astrosource.comparison import * from astrosource.detrend import * from astrosource.eebls import * from astrosource.identify import * from astrosource.main import * from astrosource.plots import * from astrosource.utils import *
26.333333
36
0.81962
37
316
7
0.378378
0.46332
0.567568
0
0
0
0
0
0
0
0
0
0.113924
316
11
37
28.727273
0.925
0
0
0
0
0
0.018987
0
0
0
0
0
0
1
0
true
0
0.9
0
0.9
0
0
0
0
null
1
1
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
1
0
1
0
0
5
833c1733e2044d13391e9021db65cad6aea8232f
23,660
py
Python
src/concurrency/_cssync_test.py
GStepien/CSToolkit
7a6872356f71843816a53c42b9abf5ae1ed97adf
[ "BSD-3-Clause" ]
null
null
null
src/concurrency/_cssync_test.py
GStepien/CSToolkit
7a6872356f71843816a53c42b9abf5ae1ed97adf
[ "BSD-3-Clause" ]
null
null
null
src/concurrency/_cssync_test.py
GStepien/CSToolkit
7a6872356f71843816a53c42b9abf5ae1ed97adf
[ "BSD-3-Clause" ]
null
null
null
from typing import Optional, Callable import multiprocessing.managers as mp_mngr import pytest from concurrency._fixtures import fix_cscondition_factory, fix_csl, fix_manager, fix_picklable_manager,\ fix_cslock_factory, fix_csrwlock_factory, fix_exec, fix_picklable_manager from concurrency import cs, cslocks, cssync, execs, csrwlocks import utils.functional.tools as ft from utils.testing.testasserts import de_assert_duration from concurrency import managers as mngr def test_cscondition_parameters(fix_csl: cs.En.CSL, fix_manager: Optional[mp_mngr.SyncManager], fix_picklable_manager: Optional[mngr.Im.PicklableSyncManager], fix_csrwlock_factory: Callable[[cs.En.CSL, Optional[mp_mngr.SyncManager]], csrwlocks.Pr.CSRWLock], fix_cslock_factory: Callable[[cs.En.CSL, Optional[mp_mngr.SyncManager]], cslocks.Pr.CSLock], fix_cscondition_factory: Callable[[cs.En.CSL, Optional[cslocks.Pr.CSLock], Optional[mngr.Im.PicklableSyncManager]], cssync.Pr.CSCondition], fix_exec: execs.Im.Exec) -> None: with pytest.raises(ValueError): fix_cscondition_factory(fix_csl, fix_csrwlock_factory(fix_csl, fix_manager).c_get_csrlock(), fix_picklable_manager) for lck in (None, fix_cslock_factory(fix_csl, fix_manager)): cscondition: cssync.Pr.CSCondition = fix_cscondition_factory(fix_csl, lck, fix_picklable_manager) ressource_lock: cslocks.Pr.CSLock = cscondition.c_get_resource_cslock() if lck is not None: assert lck is ressource_lock # Calling without holding resource lock with pytest.raises(ValueError): cscondition.c_wait(blocking=False) if fix_csl == cs.En.CSL.SINGLE_THREAD: with ressource_lock: with pytest.raises(RuntimeError): cscondition.c_wait(blocking=True, timeout=None) else: # Calling without holding resource lock with pytest.raises(ValueError): cscondition.c_wait() # Calling without holding resource lock with pytest.raises(ValueError): cscondition.c_notify() # Calling without holding resource lock with pytest.raises(ValueError): cscondition.c_notify_all() # Calling without holding resource lock with pytest.raises(ValueError): cscondition.c_wait() with ressource_lock: cscondition.c_notify() cscondition.c_notify_all() assert not cscondition.c_wait(blocking=True, timeout=2.0) de_assert_duration(min_sec=2.0, max_sec=3.0)( # type: ignore lambda: ft.c_poll_condition(condition_check=ft.c_eq, params=((), { 'el_1': (cscondition, cscondition.c_wait.__name__), 'params_1': (None, {'blocking': True, 'timeout': 2.0}), 'el_2': ft.c_identity, 'params_2': ((False,), None)}), max_check_count=1))() assert ressource_lock.c_is_held() assert cscondition.c_get_num_waiting() == 0 if fix_csl > cs.En.CSL.SINGLE_THREAD: # noinspection PyArgumentList fix_exec.c_exec_multiple(csl=fix_csl, join=False, exec_params=( # Waiter 1 execs.Im.ExecDelayedParams( func_or_obj_func=(cscondition, cscondition.c_wait.__name__), params=(None, {'blocking': True, 'timeout': 6.0}), join=False ), execs.Im.ExecDelayedParams( func_or_obj_func=ft.c_poll_condition, params=(None, { "condition_check": ft.c_eq, "params": (None, { "el_1": (cscondition, cscondition.c_get_num_waiting.__name__), "el_2": ft.c_identity, "params_2": (None, { "el": 1 }) }), "max_duration": 1.0 }), join=True, min_sec=0.0, max_sec=1.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=(ressource_lock, ressource_lock.c_acquire.__name__), params=None, join=True, min_sec=0.0, max_sec=1.0 ), # Waiter 2 execs.Im.ExecDelayedParams( func_or_obj_func=(cscondition, cscondition.c_wait.__name__), params=(None, {'blocking': True, 'timeout': 6.0}), join=False ), execs.Im.ExecDelayedParams( func_or_obj_func=ft.c_poll_condition, params=(None, { "condition_check": ft.c_eq, "params": (None, { "el_1": (cscondition, cscondition.c_get_num_waiting.__name__), "el_2": ft.c_identity, "params_2": (None, { "el": 2 }) }), "max_duration": 1.0 }), join=True, min_sec=0.0, max_sec=1.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=(ressource_lock, ressource_lock.c_acquire.__name__), params=None, join=True, min_sec=0.0, max_sec=1.0 ), # Waiter 3 execs.Im.ExecDelayedParams( func_or_obj_func=(cscondition, cscondition.c_wait.__name__), params=(None, {'blocking': True, 'timeout': 6.0}), join=False ), execs.Im.ExecDelayedParams( func_or_obj_func=ft.c_poll_condition, params=(None, { "condition_check": ft.c_eq, "params": (None, { "el_1": (cscondition, cscondition.c_get_num_waiting.__name__), "el_2": ft.c_identity, "params_2": (None, { "el": 3 }) }), "max_duration": 1.0 }), join=True, min_sec=0.0, max_sec=1.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=(ressource_lock, ressource_lock.c_acquire.__name__), params=None, join=True, min_sec=0.0, max_sec=1.0 ), # Waiter 4 execs.Im.ExecDelayedParams( func_or_obj_func=(cscondition, cscondition.c_wait.__name__), params=(None, {'blocking': True, 'timeout': 6.0}), join=False ), execs.Im.ExecDelayedParams( func_or_obj_func=ft.c_poll_condition, params=(None, { "condition_check": ft.c_eq, "params": (None, { "el_1": (cscondition, cscondition.c_get_num_waiting.__name__), "el_2": ft.c_identity, "params_2": (None, { "el": 4 }) }), "max_duration": 1.0 }), join=True, min_sec=0.0, max_sec=1.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=(ressource_lock, ressource_lock.c_acquire.__name__), params=None, join=True, min_sec=0.0, max_sec=1.0 ), # Notify n=2 execs.Im.ExecDelayedParams( func_or_obj_func=(cscondition, cscondition.c_notify.__name__), params=(None, {"n": 2}), join=True, in_delay=2.0, min_sec=2.0, max_sec=3.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=ft.c_poll_condition, params=(None, { "condition_check": ft.c_eq, "params": (None, { "el_1": (cscondition, cscondition.c_get_num_waiting.__name__), "el_2": ft.c_identity, "params_2": (None, { "el": 2 }) }), "max_check_count": 1 }), join=True, min_sec=0.0, max_sec=1.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=(ressource_lock, ressource_lock.c_release.__name__), params=None, join=True, min_sec=0.0, max_sec=1.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=ft.c_poll_condition, params=(None, { "condition_check": (ressource_lock, ressource_lock.c_is_held.__name__), "params": None, "max_duration": 1.0 }), join=True, min_sec=0.0, max_sec=1.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=(ressource_lock, ressource_lock.c_release.__name__), params=None, join=True, min_sec=0.0, max_sec=1.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=ft.c_poll_condition, params=(None, { "condition_check": (ressource_lock, ressource_lock.c_is_held.__name__), "params": None, "max_duration": 1.0 }), join=True, min_sec=0.0, max_sec=1.0 ), # Notify rest execs.Im.ExecDelayedParams( func_or_obj_func=(cscondition, cscondition.c_notify_all.__name__), params=None, join=True, ), execs.Im.ExecDelayedParams( func_or_obj_func=ft.c_poll_condition, params=(None, { "condition_check": ft.c_eq, "params": (None, { "el_1": (cscondition, cscondition.c_get_num_waiting.__name__), "el_2": ft.c_identity, "params_2": (None, { "el": 0 }) }), "max_check_count": 1 }), join=True, min_sec=0.0, max_sec=1.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=(ressource_lock, ressource_lock.c_release.__name__), params=None, join=True, min_sec=0.0, max_sec=1.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=ft.c_poll_condition, params=(None, { "condition_check": (ressource_lock, ressource_lock.c_is_held.__name__), "params": None, "max_duration": 1.0 }), join=True, min_sec=0.0, max_sec=1.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=(ressource_lock, ressource_lock.c_release.__name__), params=None, join=True, min_sec=0.0, max_sec=1.0 ), execs.Im.ExecDelayedParams( func_or_obj_func=ft.c_poll_condition, params=(None, { "condition_check": (ressource_lock, ressource_lock.c_is_held.__name__), "params": None, "max_duration": 1.0 }), join=True, min_sec=0.0, max_sec=1.0 ), ), manager=fix_manager, _min_sec=2.0, _max_sec=8.0), fix_exec.c_join()
63.945946
108
0.254015
1,240
23,660
4.478226
0.091129
0.061228
0.103728
0.121016
0.776517
0.743022
0.700522
0.696741
0.681433
0.664506
0
0.021117
0.695773
23,660
369
109
64.119241
0.750347
0.012215
0
0.80531
0
0
0.023291
0
0
0
0
0
0.017699
1
0.00295
false
0
0.023599
0
0.026549
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
1
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
5
833cce3dbfb811d44f9ab40437cbe60460a2fea9
146
py
Python
Introduction to Python/Introduction to Python Smallpiece 2018/Variables/Type conversion/type_cast.py
phamola/firstproject1
1e2aaafeb7abf9c82e4c823f197fc1fbefce6416
[ "Apache-2.0" ]
null
null
null
Introduction to Python/Introduction to Python Smallpiece 2018/Variables/Type conversion/type_cast.py
phamola/firstproject1
1e2aaafeb7abf9c82e4c823f197fc1fbefce6416
[ "Apache-2.0" ]
null
null
null
Introduction to Python/Introduction to Python Smallpiece 2018/Variables/Type conversion/type_cast.py
phamola/firstproject1
1e2aaafeb7abf9c82e4c823f197fc1fbefce6416
[ "Apache-2.0" ]
null
null
null
number = 9 print(type(number)) # print type of variable "number" float_number = 9.0 print(float_number) print(Convert float_number to integer)
20.857143
55
0.760274
23
146
4.695652
0.478261
0.305556
0
0
0
0
0
0
0
0
0
0.024
0.143836
146
6
56
24.333333
0.84
0.212329
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0.6
1
0
0
null
1
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
1
0
0
0
0
0
0
1
0
5
8363baee8af6a643e6a7e94081a157a7ea05d900
11,405
py
Python
tensorflow_model_analysis/addons/fairness/metrics/counterfactual_fairness/flip_count_test.py
jay90099/model-analysis
4389611ae476686d349bd6d16de39855d491cf0c
[ "Apache-2.0" ]
null
null
null
tensorflow_model_analysis/addons/fairness/metrics/counterfactual_fairness/flip_count_test.py
jay90099/model-analysis
4389611ae476686d349bd6d16de39855d491cf0c
[ "Apache-2.0" ]
null
null
null
tensorflow_model_analysis/addons/fairness/metrics/counterfactual_fairness/flip_count_test.py
jay90099/model-analysis
4389611ae476686d349bd6d16de39855d491cf0c
[ "Apache-2.0" ]
null
null
null
# Lint as: python3 # Copyright 2020 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. """Tests for flip count metric.""" import apache_beam as beam from apache_beam.testing import util import numpy as np import tensorflow as tf from tensorflow_model_analysis.addons.fairness.metrics.counterfactual_fairness import flip_count from tensorflow_model_analysis.eval_saved_model import testutil from tensorflow_model_analysis.metrics import metric_types from tensorflow_model_analysis.metrics import metric_util class FlipCountTest(testutil.TensorflowModelAnalysisTest): def testFlipCount(self): computations = flip_count.FlipCount( thresholds=[0.3], counterfactual_prediction_key='counterfactual_pred_key', example_id_key='example_id_key').computations(example_weighted=True) binary_confusion_matrix = computations[0] matrices = computations[1] metrics = computations[2] # TODO(b/171180441): Handle absence of ground truth labels in counterfactual # examples while computing flip count metrics. examples = [ { 'labels': None, 'predictions': np.array([0.5]), 'example_weights': np.array([1.0]), 'features': { 'counterfactual_pred_key': np.array([0.7]), 'example_id_key': np.array(['id_1']), }, }, { 'labels': None, 'predictions': np.array([0.1, 0.7]), # to test flattening 'example_weights': np.array([3.0]), 'features': { 'counterfactual_pred_key': np.array([1.0, 0.1]), 'example_id_key': np.array(['id_2']), }, }, { 'labels': None, 'predictions': np.array([0.5, 0.2]), 'example_weights': np.array([2.0]), 'features': { 'counterfactual_pred_key': np.array([0.2, 0.4]), 'example_id_key': np.array(['id_3']), }, }, { 'labels': None, 'predictions': np.array([0.2, 0.1]), 'example_weights': np.array([1.0]), 'features': { 'counterfactual_pred_key': np.array([0.4, 0.5]), 'example_id_key': np.array(['id_4']), }, } ] with beam.Pipeline() as pipeline: # pylint: disable=no-value-for-parameter result = ( pipeline | 'Create' >> beam.Create(examples) | 'Process' >> beam.Map(metric_util.to_standard_metric_inputs, True) | 'AddSlice' >> beam.Map(lambda x: ((), x)) | 'ComputeBinaryConfusionMatrix' >> beam.CombinePerKey( binary_confusion_matrix.combiner) | 'ComputeMatrices' >> beam.Map( lambda x: (x[0], matrices.result(x[1]))) # pyformat: ignore | 'ComputeMetrics' >> beam.Map(lambda x: (x[0], metrics.result(x[1])))) # pylint: enable=no-value-for-parameter def check_result(got): try: self.assertLen(got, 1) got_slice_key, got_metrics = got[0] self.assertEqual(got_slice_key, ()) self.assertLen(got_metrics, 6) self.assertDictElementsAlmostEqual( got_metrics, { metric_types.MetricKey( name='flip_count/positive_to_negative@0.3', example_weighted=True): 5.0, metric_types.MetricKey( name='flip_count/negative_to_positive@0.3', example_weighted=True): 7.0, metric_types.MetricKey( name='flip_count/positive_examples_count@0.3', example_weighted=True): 6.0, metric_types.MetricKey( name='flip_count/negative_examples_count@0.3', example_weighted=True): 7.0, }) self.assertAllEqual( got_metrics[metric_types.MetricKey( name='flip_count/positive_to_negative_examples_ids@0.3', example_weighted=True)], np.array([['id_2'], ['id_3']])) self.assertAllEqual( got_metrics[metric_types.MetricKey( name='flip_count/negative_to_positive_examples_ids@0.3', example_weighted=True)], np.array([['id_2'], ['id_3'], ['id_4']])) except AssertionError as err: raise util.BeamAssertException(err) util.assert_that(result, check_result, label='result') def testFlipCount_cfPredictionKeyMissing_raiseValueError(self): computations = flip_count.FlipCount( thresholds=[0.3], counterfactual_prediction_key='counterfactual_pred_key', example_id_key='example_id_key').computations() binary_confusion_matrix = computations[0] matrices = computations[1] metrics = computations[2] examples = [{ 'labels': None, 'predictions': np.array([0.5]), 'example_weights': np.array([1.0]), 'features': { 'example_id_key': np.array(['id_1']), }, }, { 'labels': None, 'predictions': np.array([0.2, 0.1]), 'example_weights': np.array([1.0]), 'features': { 'counterfactual_pred_key': np.array([0.4, 0.5]), 'example_id_key': np.array(['id_4']), }, }] with self.assertRaises(ValueError): with beam.Pipeline() as pipeline: # pylint: disable=no-value-for-parameter _ = ( pipeline | 'Create' >> beam.Create(examples) | 'Process' >> beam.Map(metric_util.to_standard_metric_inputs, True) | 'AddSlice' >> beam.Map(lambda x: ((), x)) | 'ComputeBinaryConfusionMatrix' >> beam.CombinePerKey( binary_confusion_matrix.combiner) | 'ComputeMatrices' >> beam.Map( lambda x: (x[0], matrices.result(x[1]))) # pyformat: ignore | 'FlipCount' >> beam.Map(lambda x: (x[0], metrics.result(x[1])))) def testFlipCount_cfPredictionValueNone_raiseValueError(self): computations = flip_count.FlipCount( thresholds=[0.3], counterfactual_prediction_key='counterfactual_pred_key', example_id_key='example_id_key').computations() binary_confusion_matrix = computations[0] matrices = computations[1] metrics = computations[2] examples = [{ 'labels': None, 'predictions': np.array([0.5]), 'example_weights': np.array([1.0]), 'features': { 'counterfactual_pred_key': None, 'example_id_key': np.array(['id_1']), }, }, { 'labels': None, 'predictions': np.array([0.2, 0.1]), 'example_weights': np.array([1.0]), 'features': { 'counterfactual_pred_key': np.array([0.4, 0.5]), 'example_id_key': np.array(['id_4']), }, }] with self.assertRaises(ValueError): with beam.Pipeline() as pipeline: # pylint: disable=no-value-for-parameter _ = ( pipeline | 'Create' >> beam.Create(examples) | 'Process' >> beam.Map(metric_util.to_standard_metric_inputs, True) | 'AddSlice' >> beam.Map(lambda x: ((), x)) | 'ComputeBinaryConfusionMatrix' >> beam.CombinePerKey( binary_confusion_matrix.combiner) | 'ComputeMatrices' >> beam.Map( lambda x: (x[0], matrices.result(x[1]))) # pyformat: ignore | 'FlipCount' >> beam.Map(lambda x: (x[0], metrics.result(x[1])))) def testFlipCount_predictionKeysSizeMisMatch_raiseValueError(self): computations = flip_count.FlipCount( thresholds=[0.3], counterfactual_prediction_key='counterfactual_pred_key', example_id_key='example_id_key').computations() binary_confusion_matrix = computations[0] matrices = computations[1] metrics = computations[2] examples = [{ 'labels': None, 'predictions': np.array([0.5]), 'example_weights': np.array([1.0]), 'features': { 'counterfactual_pred_key': np.array([0.4, 0.5]), 'example_id_key': np.array(['id_1']), }, }, { 'labels': None, 'predictions': np.array([0.2, 0.1]), 'example_weights': np.array([1.0]), 'features': { 'counterfactual_pred_key': np.array([0.4, 0.5]), 'example_id_key': np.array(['id_4']), }, }] with self.assertRaises(ValueError): with beam.Pipeline() as pipeline: # pylint: disable=no-value-for-parameter _ = ( pipeline | 'Create' >> beam.Create(examples) | 'Process' >> beam.Map(metric_util.to_standard_metric_inputs, True) | 'AddSlice' >> beam.Map(lambda x: ((), x)) | 'ComputeBinaryConfusionMatrix' >> beam.CombinePerKey( binary_confusion_matrix.combiner) | 'ComputeMatrices' >> beam.Map( lambda x: (x[0], matrices.result(x[1]))) # pyformat: ignore | 'FlipCount' >> beam.Map(lambda x: (x[0], metrics.result(x[1])))) def testFlipCount_predictionIsEmpty_raiseValueError(self): computations = flip_count.FlipCount( thresholds=[0.3], counterfactual_prediction_key='counterfactual_pred_key', example_id_key='example_id_key').computations() binary_confusion_matrix = computations[0] matrices = computations[1] metrics = computations[2] examples = [{ 'labels': None, 'predictions': np.array([]), 'example_weights': np.array([1.0]), 'features': { 'counterfactual_pred_key': np.array([0.4, 0.5]), 'example_id_key': np.array(['id_1']), }, }, { 'labels': None, 'predictions': np.array([0.2, 0.1]), 'example_weights': np.array([1.0]), 'features': { 'counterfactual_pred_key': np.array([0.4, 0.5]), 'example_id_key': np.array(['id_4']), }, }] with self.assertRaises(ValueError): with beam.Pipeline() as pipeline: # pylint: disable=no-value-for-parameter _ = ( pipeline | 'Create' >> beam.Create(examples) | 'Process' >> beam.Map(metric_util.to_standard_metric_inputs, True) | 'AddSlice' >> beam.Map(lambda x: ((), x)) | 'ComputeBinaryConfusionMatrix' >> beam.CombinePerKey( binary_confusion_matrix.combiner) | 'ComputeMatrices' >> beam.Map( lambda x: (x[0], matrices.result(x[1]))) # pyformat: ignore | 'FlipCount' >> beam.Map(lambda x: (x[0], metrics.result(x[1])))) if __name__ == '__main__': tf.test.main()
38.661017
96
0.574748
1,228
11,405
5.140065
0.149837
0.053232
0.041825
0.03327
0.778517
0.774873
0.768219
0.7218
0.708967
0.698035
0
0.024772
0.288558
11,405
294
97
38.792517
0.753143
0.09224
0
0.699605
0
0
0.172481
0.072674
0
0
0
0.003401
0.051383
1
0.023715
false
0
0.031621
0
0.059289
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
83673da9a8551b79cc128b35aa811ea6646f14b0
78
py
Python
electrum_gui/common/provider/chains/__init__.py
liyanhrxy/electrum
107608ef201ff1d20d2f6091c257b1ceff9b7362
[ "MIT" ]
1
2020-07-10T12:35:25.000Z
2020-07-10T12:35:25.000Z
electrum_gui/common/provider/chains/__init__.py
liyanhrxy/electrum
107608ef201ff1d20d2f6091c257b1ceff9b7362
[ "MIT" ]
null
null
null
electrum_gui/common/provider/chains/__init__.py
liyanhrxy/electrum
107608ef201ff1d20d2f6091c257b1ceff9b7362
[ "MIT" ]
null
null
null
from electrum_gui.common.provider.chains import algo, btc, cfx, eth, sol, stc
39
77
0.782051
13
78
4.615385
1
0
0
0
0
0
0
0
0
0
0
0
0.115385
78
1
78
78
0.869565
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
55d483fda5ecb6cd430f91dccc2da42caf17af30
4,949
py
Python
lib/m2ee/pgutil.py
diogomatsubara/cf-mendix-buildpack
48ab483585785e55dc7b94e2a8017fa70f0ef4a9
[ "Apache-2.0" ]
null
null
null
lib/m2ee/pgutil.py
diogomatsubara/cf-mendix-buildpack
48ab483585785e55dc7b94e2a8017fa70f0ef4a9
[ "Apache-2.0" ]
1
2021-02-08T20:38:26.000Z
2021-02-08T20:38:26.000Z
lib/m2ee/pgutil.py
diogomatsubara/cf-mendix-buildpack
48ab483585785e55dc7b94e2a8017fa70f0ef4a9
[ "Apache-2.0" ]
1
2019-03-25T07:57:57.000Z
2019-03-25T07:57:57.000Z
# # Copyright (c) 2009-2015, Mendix bv # All Rights Reserved. # # http://www.mendix.com/ # import os import subprocess import time from .log import logger def dumpdb(config, name=None): env = os.environ.copy() env.update(config.get_pg_environment()) if name is None: name = ("%s_%s.backup" % (env['PGDATABASE'], time.strftime("%Y%m%d_%H%M%S")) ) db_dump_file_name = os.path.join(config.get_database_dump_path(), name) logger.info("Writing database dump to %s" % db_dump_file_name) cmd = (config.get_pg_dump_binary(), "-O", "-x", "-F", "c") logger.trace("Executing %s" % str(cmd)) proc = subprocess.Popen(cmd, env=env, stdout=open(db_dump_file_name, 'w+')) proc.communicate() def restoredb(config, dump_name): if not config.allow_destroy_db(): logger.error("Refusing to do a destructive database operation " "because the allow_destroy_db configuration option " "is set to false.") return False env = os.environ.copy() env.update(config.get_pg_environment()) db_dump_file_name = os.path.join( config.get_database_dump_path(), dump_name ) if not os.path.isfile(db_dump_file_name): logger.error("file %s does not exist: " % db_dump_file_name) return False logger.debug("Restoring %s" % db_dump_file_name) cmd = (config.get_pg_restore_binary(), "-d", env['PGDATABASE'], "-O", "-n", "public", "-x", db_dump_file_name) logger.trace("Executing %s" % str(cmd)) proc = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() if stderr != '': logger.error("An error occured while calling pg_restore: %s " % stderr) return False return True def emptydb(config): if not config.allow_destroy_db(): logger.error("Refusing to do a destructive database operation " "because the allow_destroy_db configuration option " "is set to false.") return False env = os.environ.copy() env.update(config.get_pg_environment()) logger.info("Removing all tables...") # get list of drop table commands cmd = ( config.get_psql_binary(), "-t", "-c", "SELECT 'DROP TABLE ' || n.nspname || '.\"' || c.relname || '\" CASCADE;' " "FROM pg_catalog.pg_class AS c LEFT JOIN pg_catalog.pg_namespace AS n " "ON n.oid = c.relnamespace WHERE relkind = 'r' AND n.nspname NOT IN " "('pg_catalog', 'pg_toast') AND pg_catalog.pg_table_is_visible(c.oid)" ) logger.trace("Executing %s, creating pipe for stdout,stderr" % str(cmd)) proc1 = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc1.communicate() if stderr != '': logger.error("An error occured while calling psql: %s" % stderr) return False stdin = stdout cmd = (config.get_psql_binary(),) logger.trace("Piping stdout,stderr to %s" % str(cmd)) proc2 = subprocess.Popen(cmd, env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc2.communicate(stdin) if stderr != '': logger.error("An error occured while calling psql: %s" % stderr) return False logger.info("Removing all sequences...") # get list of drop sequence commands cmd = ( config.get_psql_binary(), "-t", "-c", "SELECT 'DROP SEQUENCE ' || n.nspname || '.\"' || c.relname || '\" " "CASCADE;' FROM pg_catalog.pg_class AS c LEFT JOIN " "pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace WHERE " "relkind = 'S' AND n.nspname NOT IN ('pg_catalog', 'pg_toast') AND " "pg_catalog.pg_table_is_visible(c.oid)" ) logger.trace("Executing %s, creating pipe for stdout,stderr" % str(cmd)) proc1 = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc1.communicate() if stderr != '': logger.error("An error occured while calling psql: %s" % stderr) return False stdin = stdout cmd = (config.get_psql_binary(),) logger.trace("Piping stdout,stderr to %s" % str(cmd)) proc2 = subprocess.Popen(cmd, env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc2.communicate(stdin) if stderr != '': logger.error("An error occured while calling psql: %s" % stderr) return False return True def psql(config): env = os.environ.copy() env.update(config.get_pg_environment()) cmd = (config.get_psql_binary(),) logger.trace("Executing %s" % str(cmd)) subprocess.call(cmd, env=env)
33.89726
83
0.61568
642
4,949
4.610592
0.208723
0.039527
0.027027
0.037838
0.798649
0.786824
0.781419
0.755405
0.755405
0.735811
0
0.004316
0.25096
4,949
145
84
34.131034
0.794173
0.029299
0
0.603774
0
0
0.279666
0.025026
0
0
0
0
0
1
0.037736
false
0
0.037736
0
0.169811
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
55db235853a06a0cd8543daff1ab61345d252d5e
106
py
Python
py/Simple Addition/simple_addition.py
6ftunder/open.kattis
e88f0f6e508cd3ae0c38cbb11202de879991e59f
[ "MIT" ]
null
null
null
py/Simple Addition/simple_addition.py
6ftunder/open.kattis
e88f0f6e508cd3ae0c38cbb11202de879991e59f
[ "MIT" ]
null
null
null
py/Simple Addition/simple_addition.py
6ftunder/open.kattis
e88f0f6e508cd3ae0c38cbb11202de879991e59f
[ "MIT" ]
null
null
null
# takes two inputs and adds them together as ints; # outputs solution print(int(input()) + int(input()))
21.2
50
0.707547
16
106
4.6875
0.875
0.213333
0
0
0
0
0
0
0
0
0
0
0.160377
106
4
51
26.5
0.842697
0.613208
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
0
0
null
1
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
1
0
0
0
0
1
0
5
55e48d28253061654b937cefb5aed7ef2022bb01
28
py
Python
__init__.py
tahabi/SimpleTrack
084f47fcac7ace72c8685dee861cef246e2c20b1
[ "BSD-3-Clause" ]
null
null
null
__init__.py
tahabi/SimpleTrack
084f47fcac7ace72c8685dee861cef246e2c20b1
[ "BSD-3-Clause" ]
null
null
null
__init__.py
tahabi/SimpleTrack
084f47fcac7ace72c8685dee861cef246e2c20b1
[ "BSD-3-Clause" ]
null
null
null
from simpletrack import app
14
27
0.857143
4
28
6
1
0
0
0
0
0
0
0
0
0
0
0
0.142857
28
1
28
28
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
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
1
0
1
0
0
0
0
5
3640a703d89ba68b966e121a3a8030fc055c8f77
7,000
py
Python
test/unit/test_gcs_util.py
potiuk/snowflake-connector-python
4df2eb03791b7ec30aa800a4ea5a4b70eec62680
[ "Apache-2.0" ]
3
2021-03-05T22:01:00.000Z
2021-04-02T17:48:33.000Z
test/unit/test_gcs_util.py
potiuk/snowflake-connector-python
4df2eb03791b7ec30aa800a4ea5a4b70eec62680
[ "Apache-2.0" ]
null
null
null
test/unit/test_gcs_util.py
potiuk/snowflake-connector-python
4df2eb03791b7ec30aa800a4ea5a4b70eec62680
[ "Apache-2.0" ]
1
2021-03-05T22:08:46.000Z
2021-03-05T22:08:46.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2012-2020 Snowflake Computing Inc. All right reserved. # import logging import mock import pytest from snowflake.connector.constants import ResultStatus from ..randomize import random_string pytestmark = pytest.mark.gcp try: from snowflake.connector.gcs_util import SnowflakeGCSUtil # NOQA except ImportError: SnowflakeGCSUtil = None try: from snowflake.connector.vendored import requests # NOQA vendored_request = True except ImportError: # pragma: no cover import requests vendored_request = False def test_create_client(caplog): """Creates a GCSUtil with an access token.""" caplog.set_level(logging.DEBUG, 'snowflake.connector') client = SnowflakeGCSUtil.create_client({'creds': {'GCS_ACCESS_TOKEN': 'fake_token'}}) assert client is not None assert client == 'fake_token' @pytest.mark.xfail(reason='Newer version support access token. This test is obsoleted') def test_native_download_access_token(caplog): """Tests that GCS access token error is correctly logged when downloading.""" caplog.set_level(logging.DEBUG, 'snowflake.connector') meta = {} SnowflakeGCSUtil._native_download_file(meta, None, 99) assert meta['result_status'] == ResultStatus.ERROR assert (('snowflake.connector.gcs_util', logging.ERROR, "GCS download operation with an access token is " "currently unsupported") in caplog.record_tuples) @pytest.mark.xfail(reason='Newer version support access token. This test is obsoleted') def test_native_upload_access_token(caplog): """Tests that GCS access token error is correctly logged when uploading.""" caplog.set_level(logging.DEBUG, 'snowflake.connector') meta = {} SnowflakeGCSUtil.upload_file(None, meta, None, 99) assert meta['result_status'] == ResultStatus.ERROR assert (('snowflake.connector.gcs_util', logging.ERROR, "GCS upload operation with an access token is " "currently unsupported") in caplog.record_tuples) @pytest.mark.parametrize('errno', [403, 408, 429, 500, 503]) def test_upload_retry_errors(errno, tmpdir): """Tests whether retryable errors are handled correctly when upploading.""" f_name = str(tmpdir.join('some_file.txt')) resp = requests.Response() resp.status_code = errno meta = {'presigned_url': ['some_url'], 'sha256_digest': 'asd'} with open(f_name, 'w') as f: f.write(random_string(15)) with mock.patch('snowflake.connector.vendored.requests.put' if vendored_request else 'requests.put', side_effect=requests.exceptions.HTTPError(response=resp)): SnowflakeGCSUtil.upload_file(f_name, meta, None, 99) assert isinstance(meta['last_error'], requests.exceptions.HTTPError) assert meta['result_status'] == ResultStatus.NEED_RETRY def test_upload_uncaught_exception(tmpdir): """Tests whether non-retryable errors are handled correctly when uploading.""" f_name = str(tmpdir.join('some_file.txt')) resp = requests.Response() resp.status_code = 501 meta = {'presigned_url': ['some_url'], 'sha256_digest': 'asd'} with open(f_name, 'w') as f: f.write(random_string(15)) with mock.patch('snowflake.connector.vendored.requests.put' if vendored_request else 'requests.put', side_effect=requests.exceptions.HTTPError(response=resp)): with pytest.raises(requests.exceptions.HTTPError): SnowflakeGCSUtil.upload_file(f_name, meta, None, 99) @pytest.mark.parametrize('errno', [403, 408, 429, 500, 503]) def test_download_retry_errors(errno, tmpdir): """Tests whether retryable errors are handled correctly when downloading.""" resp = requests.Response() resp.status_code = errno meta = {'presigned_url': ['some_url'], 'sha256_digest': 'asd'} with mock.patch('snowflake.connector.vendored.requests.get' if vendored_request else 'requests.get', side_effect=requests.exceptions.HTTPError(response=resp)): SnowflakeGCSUtil._native_download_file(meta, str(tmpdir), 99) assert isinstance(meta['last_error'], requests.exceptions.HTTPError) assert meta['result_status'] == ResultStatus.NEED_RETRY def test_download_uncaught_exception(tmpdir): """Tests whether non-retryable errors are handled correctly when downloading.""" resp = requests.Response() resp.status_code = 501 meta = {'presigned_url': ['some_url'], 'sha256_digest': 'asd'} with mock.patch('snowflake.connector.vendored.requests.get' if vendored_request else 'requests.get', side_effect=requests.exceptions.HTTPError(response=resp)): with pytest.raises(requests.exceptions.HTTPError): SnowflakeGCSUtil._native_download_file(meta, str(tmpdir), 99) def test_upload_put_timeout(tmpdir, caplog): """Tests whether timeout error is handled correctly when uploading.""" caplog.set_level(logging.DEBUG, 'snowflake.connector') f_name = str(tmpdir.join('some_file.txt')) resp = requests.Response() meta = {'presigned_url': ['some_url'], 'sha256_digest': 'asd'} with open(f_name, 'w') as f: f.write(random_string(15)) with mock.patch('snowflake.connector.vendored.requests.put' if vendored_request else 'requests.put', side_effect=requests.exceptions.Timeout(response=resp)): SnowflakeGCSUtil.upload_file(f_name, meta, None, 99) assert isinstance(meta['last_error'], requests.exceptions.Timeout) assert meta['result_status'] == ResultStatus.NEED_RETRY assert all([log in caplog.record_tuples for log in [ ('snowflake.connector.gcs_util', logging.DEBUG, 'GCS file upload Timeout Error: ') ]]) def test_upload_get_timeout(tmpdir, caplog): """Tests whether timeout error is handled correctly when downloading.""" caplog.set_level(logging.DEBUG, 'snowflake.connector') resp = requests.Response() meta = {'presigned_url': ['some_url'], 'sha256_digest': 'asd'} with mock.patch('snowflake.connector.vendored.requests.get' if vendored_request else 'requests.get', side_effect=requests.exceptions.Timeout(response=resp)): SnowflakeGCSUtil._native_download_file(meta, str(tmpdir), 99) assert isinstance(meta['last_error'], requests.exceptions.Timeout) assert meta['result_status'] == ResultStatus.NEED_RETRY assert ('snowflake.connector.gcs_util', logging.DEBUG, 'GCS file download Timeout Error: ') in caplog.record_tuples def test_get_file_header_none_with_presigned_url(): """Tests whether default file handle created by get_file_header is as expected.""" file_header = SnowflakeGCSUtil.get_file_header({"presigned_url": "www.example.com"}, 'file') assert file_header.digest is None assert file_header.content_length is None assert file_header.encryption_metadata is None
46.052632
119
0.712857
863
7,000
5.611819
0.188876
0.066901
0.0446
0.027256
0.782986
0.770184
0.770184
0.761098
0.728061
0.675201
0
0.014698
0.173857
7,000
151
120
46.357616
0.822756
0.116857
0
0.66055
0
0
0.212933
0.058459
0
0
0
0
0.174312
1
0.091743
false
0
0.091743
0
0.183486
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
364610525323df6387f1d80197e108cb34ae5ac3
122
py
Python
tasks-deploy/email-confirmations/check.py
HackerDom/qctf-starter-2018
f4eef0fd41d777661b9fbcc61dcee9709d9f6268
[ "MIT" ]
8
2018-03-15T12:07:11.000Z
2020-12-01T15:02:46.000Z
tasks-deploy/email-confirmations/check.py
HackerDom/qctf-starter-2018
f4eef0fd41d777661b9fbcc61dcee9709d9f6268
[ "MIT" ]
17
2020-01-28T22:17:42.000Z
2022-03-11T23:18:09.000Z
tasks-deploy/email-confirmations/check.py
HackerDom/qctf-starter-2018
f4eef0fd41d777661b9fbcc61dcee9709d9f6268
[ "MIT" ]
2
2018-11-26T18:54:27.000Z
2018-12-05T17:37:32.000Z
FLAG = 'QCTF{4e94227c6c003c0b6da6f81c9177c7e7}' def check(attempt, context): return Checked(attempt.answer == FLAG)
20.333333
47
0.754098
12
122
7.666667
0.833333
0
0
0
0
0
0
0
0
0
0
0.198113
0.131148
122
5
48
24.4
0.669811
0
0
0
0
0
0.311475
0.311475
0
0
0
0
0
1
0.333333
false
0
0
0.333333
0.666667
0
1
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
1
0
0
0
1
1
0
0
5
3653402969ecb055087e26fe29a47db8b2877f50
214
py
Python
mini_amazon/__init__.py
vinaydyamaklar/mini-amazon
9aab9f8e236ed0f1fa638b02e55337bf48e7f977
[ "Unlicense" ]
null
null
null
mini_amazon/__init__.py
vinaydyamaklar/mini-amazon
9aab9f8e236ed0f1fa638b02e55337bf48e7f977
[ "Unlicense" ]
null
null
null
mini_amazon/__init__.py
vinaydyamaklar/mini-amazon
9aab9f8e236ed0f1fa638b02e55337bf48e7f977
[ "Unlicense" ]
null
null
null
from flask import Flask app = Flask("mini-amazon", static_folder="./mini_amazon/static", static_url_path="", template_folder="./mini_amazon/templates") from mini_amazon import api, views
23.777778
64
0.686916
27
214
5.185185
0.518519
0.285714
0.228571
0
0
0
0
0
0
0
0
0
0.196262
214
8
65
26.75
0.813953
0
0
0
0
0
0.252336
0.107477
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
1
1
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
1
0
0
0
0
5
36599e5e3753b3cacdc811a13ddb4c30653f70f3
103
py
Python
aws_eden_cli/__main__.py
baikonur-oss/aws-eden-cli
c758b10ae1d31e9106c505565b2a234a5c942cb0
[ "MIT" ]
43
2019-08-23T01:40:42.000Z
2021-02-11T14:14:23.000Z
aws_eden_cli/__main__.py
baikonur-oss/aws-eden-cli
c758b10ae1d31e9106c505565b2a234a5c942cb0
[ "MIT" ]
146
2019-11-14T06:26:54.000Z
2020-10-09T19:41:55.000Z
aws_eden_cli/__main__.py
baikonur-oss/aws-eden-cli
c758b10ae1d31e9106c505565b2a234a5c942cb0
[ "MIT" ]
1
2020-05-23T04:03:51.000Z
2020-05-23T04:03:51.000Z
import sys from . import cmdline if __name__ == '__main__': sys.exit(cmdline.main(sys.argv[1:]))
14.714286
40
0.679612
15
103
4.133333
0.666667
0.225806
0
0
0
0
0
0
0
0
0
0.011628
0.165049
103
6
41
17.166667
0.709302
0
0
0
0
0
0.07767
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
1
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
1
0
1
0
0
0
0
5
366a1a0be9cbaa4feb453213161a209a024a7755
434
py
Python
codes/prob_distribution/random_variable.py
NCEPU-Sunrise/2021-MachineLearningGroup
d47a73fa1627f0452ed9e39aacf72e925d25ee73
[ "MIT" ]
3
2021-11-02T06:07:24.000Z
2022-03-14T07:44:24.000Z
codes/prob_distribution/random_variable.py
NCEPU-Sunrise/2021-MachineLearningGroup
d47a73fa1627f0452ed9e39aacf72e925d25ee73
[ "MIT" ]
null
null
null
codes/prob_distribution/random_variable.py
NCEPU-Sunrise/2021-MachineLearningGroup
d47a73fa1627f0452ed9e39aacf72e925d25ee73
[ "MIT" ]
1
2022-01-29T09:09:58.000Z
2022-01-29T09:09:58.000Z
class RandomVariable: """ Basic class for random variable distribution """ def __init__(self): """ self.parameter is a dict for parameters in distribution """ self.parameter = {} def fit(self): pass def ml(self): pass def map(self): pass def bayes(self): pass def pdf(self): pass def sample(self): pass
13.151515
63
0.509217
46
434
4.717391
0.5
0.221198
0.253456
0
0
0
0
0
0
0
0
0
0.400922
434
32
64
13.5625
0.834615
0.230415
0
0.4
0
0
0
0
0
0
0
0
0
1
0.466667
false
0.4
0
0
0.533333
0
0
0
0
null
1
1
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
1
0
0
1
0
0
5
369dbe3ea5fb198818a4c3cf113b65140ccf3cec
94
py
Python
src/postings/admin.py
zhuguangjun2002/REST-API-Basics-JWT
53a68ac4219d8666a3bdb6065747a6af9950d5a5
[ "MIT" ]
206
2017-12-19T22:15:04.000Z
2022-03-16T19:12:40.000Z
src/postings/admin.py
zhuguangjun2002/REST-API-Basics-JWT
53a68ac4219d8666a3bdb6065747a6af9950d5a5
[ "MIT" ]
8
2020-03-24T17:06:30.000Z
2022-01-13T01:16:34.000Z
postings/admin.py
TeddyTeddy/REST-API-Basics
c644ba054821206a5e4603dccdf35eba8a77189f
[ "MIT" ]
132
2017-12-20T18:40:29.000Z
2022-01-04T12:05:23.000Z
from django.contrib import admin from .models import BlogPost admin.site.register(BlogPost)
15.666667
32
0.819149
13
94
5.923077
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.117021
94
6
33
15.666667
0.927711
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
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
1
0
1
0
1
0
0
5
7fcaa6229adc8e71f6c5ca5b5146249ecee2003e
44
py
Python
formiko/__main__.py
benburrill/formiko
86630506c537f9517666d9b0d5b2a905e7385b01
[ "BSD-3-Clause" ]
116
2016-07-13T00:35:35.000Z
2022-02-22T15:46:44.000Z
formiko/__main__.py
benburrill/formiko
86630506c537f9517666d9b0d5b2a905e7385b01
[ "BSD-3-Clause" ]
32
2018-01-23T13:50:27.000Z
2022-03-30T05:34:56.000Z
formiko/__main__.py
benburrill/formiko
86630506c537f9517666d9b0d5b2a905e7385b01
[ "BSD-3-Clause" ]
8
2018-12-21T13:45:36.000Z
2021-11-07T22:40:05.000Z
from formiko.main import main exit(main())
11
29
0.75
7
44
4.714286
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.136364
44
3
30
14.666667
0.868421
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
1
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
1
0
1
0
0
0
0
5
7fdd61e219cc466d9a3c55099b4ce7912eee7ce0
374
py
Python
resippy/spectral/spectrum_factories/spectrum_factory.py
BeamIO-Inc/resippy
37f6b8e865f4836696a9db0a4b17eae2426cdd96
[ "BSD-3-Clause" ]
11
2019-03-30T02:32:13.000Z
2021-11-02T23:15:17.000Z
resippy/spectral/spectrum_factories/spectrum_factory.py
BeamIO-Inc/resippy
37f6b8e865f4836696a9db0a4b17eae2426cdd96
[ "BSD-3-Clause" ]
10
2019-02-28T21:24:01.000Z
2019-12-31T15:02:03.000Z
resippy/spectral/spectrum_factories/spectrum_factory.py
BeamIO-Inc/resippy
37f6b8e865f4836696a9db0a4b17eae2426cdd96
[ "BSD-3-Clause" ]
4
2019-08-16T22:20:23.000Z
2021-04-27T08:23:01.000Z
from __future__ import division from . import usgs as usgs_spectrum_factories from . import envi as envi_spectrum_factories from . import SVC as svc_spectrum_factories from . import csv as csv_spectrum_factories class SpectrumFactory: usgs = usgs_spectrum_factories envi = envi_spectrum_factories svc = svc_spectrum_factories csv = csv_spectrum_factories
26.714286
45
0.812834
50
374
5.68
0.26
0.478873
0.221831
0.285211
0
0
0
0
0
0
0
0
0.163102
374
13
46
28.769231
0.907348
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
0
0
0
null
1
1
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
1
0
1
0
0
5
7fe706ff8f6b7dfcae4c28a069f5a28407fa0e42
93
py
Python
otter/__main__.py
nalderto/otter-grader
a4714bf48df07b7eb8b3c41530ce7a778fd42c98
[ "BSD-3-Clause" ]
null
null
null
otter/__main__.py
nalderto/otter-grader
a4714bf48df07b7eb8b3c41530ce7a778fd42c98
[ "BSD-3-Clause" ]
null
null
null
otter/__main__.py
nalderto/otter-grader
a4714bf48df07b7eb8b3c41530ce7a778fd42c98
[ "BSD-3-Clause" ]
null
null
null
""" otter module """ from .run import run_otter if __name__ == "__main__": run_otter()
10.333333
26
0.645161
12
93
4.166667
0.666667
0.32
0
0
0
0
0
0
0
0
0
0
0.204301
93
8
27
11.625
0.675676
0.129032
0
0
0
0
0.109589
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
1
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
1
0
1
0
0
0
0
5
3d01a5b861be4063ebb2b4863891c173e6663939
285
py
Python
sources/model/__init__.py
lthamm/concept-embeddings-and-ilp
27592c6424147a2fbb54d7daebc92cd72b3f4a0c
[ "MIT" ]
3
2020-11-02T12:21:29.000Z
2021-08-02T14:01:37.000Z
sources/model/__init__.py
lthamm/concept-embeddings-and-ilp
27592c6424147a2fbb54d7daebc92cd72b3f4a0c
[ "MIT" ]
2
2020-11-06T07:58:13.000Z
2022-03-13T16:11:30.000Z
sources/model/__init__.py
lthamm/concept-embeddings-and-ilp
27592c6424147a2fbb54d7daebc92cd72b3f4a0c
[ "MIT" ]
1
2020-11-03T14:54:16.000Z
2020-11-03T14:54:16.000Z
"""Functions to create, save, load, and evaluate models fine-tuned for the picasso dataset. Loading functions can be found in the finetuning.model_loaders module. The fine-tuning routine and data loader can be found in finetuning.finetune_pytorch.py. """ from .utils import model_id
35.625
91
0.796491
45
285
4.977778
0.755556
0.044643
0.089286
0.107143
0
0
0
0
0
0
0
0
0.140351
285
7
92
40.714286
0.914286
0.870175
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
3d19c6369a7fff987cd7d7c19078b3e132776608
18,550
py
Python
tests/integration/test_validators.py
sthagen/p1c2u-openapi-schema-validator
60a358dbdd5f5760e354acef4687d99aef798399
[ "BSD-3-Clause" ]
1
2021-11-05T19:03:16.000Z
2021-11-05T19:03:16.000Z
tests/integration/test_validators.py
sthagen/p1c2u-openapi-schema-validator
60a358dbdd5f5760e354acef4687d99aef798399
[ "BSD-3-Clause" ]
null
null
null
tests/integration/test_validators.py
sthagen/p1c2u-openapi-schema-validator
60a358dbdd5f5760e354acef4687d99aef798399
[ "BSD-3-Clause" ]
null
null
null
from jsonschema import ValidationError import pytest from openapi_schema_validator import OAS30Validator, oas30_format_checker, \ OAS31Validator, oas31_format_checker try: from unittest import mock except ImportError: import mock class TestOAS30ValidatorValidate(object): @pytest.mark.parametrize('schema_type', [ 'boolean', 'array', 'integer', 'number', 'string', ]) def test_null(self, schema_type): schema = {"type": schema_type} validator = OAS30Validator(schema) value = None with pytest.raises(ValidationError): validator.validate(value) @pytest.mark.parametrize('schema_type', [ 'boolean', 'array', 'integer', 'number', 'string', ]) def test_nullable(self, schema_type): schema = {"type": schema_type, "nullable": True} validator = OAS30Validator(schema) value = None result = validator.validate(value) assert result is None @pytest.mark.parametrize('value', [ u'1989-01-02T00:00:00Z', u'2018-01-02T23:59:59Z', ]) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_RFC3339_VALIDATOR', False ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_STRICT_RFC3339', False ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_ISODATE', False ) def test_string_format_no_datetime_validator(self, value): schema = {"type": 'string', "format": 'date-time'} validator = OAS30Validator( schema, format_checker=oas30_format_checker) result = validator.validate(value) assert result is None @pytest.mark.parametrize('value', [ u'1989-01-02T00:00:00Z', u'2018-01-02T23:59:59Z', ]) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_RFC3339_VALIDATOR', True ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_STRICT_RFC3339', False ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_ISODATE', False ) def test_string_format_datetime_rfc3339_validator(self, value): schema = {"type": 'string', "format": 'date-time'} validator = OAS30Validator( schema, format_checker=oas30_format_checker) result = validator.validate(value) assert result is None @pytest.mark.parametrize('value', [ u'1989-01-02T00:00:00Z', u'2018-01-02T23:59:59Z', ]) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_RFC3339_VALIDATOR', False ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_STRICT_RFC3339', True ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_ISODATE', False ) def test_string_format_datetime_strict_rfc3339(self, value): schema = {"type": 'string', "format": 'date-time'} validator = OAS30Validator( schema, format_checker=oas30_format_checker) result = validator.validate(value) assert result is None @pytest.mark.parametrize('value', [ u'1989-01-02T00:00:00Z', u'2018-01-02T23:59:59Z', ]) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_RFC3339_VALIDATOR', False ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_STRICT_RFC3339', False ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_ISODATE', True ) def test_string_format_datetime_isodate(self, value): schema = {"type": 'string', "format": 'date-time'} validator = OAS30Validator( schema, format_checker=oas30_format_checker) result = validator.validate(value) assert result is None @pytest.mark.parametrize('value', [ 'f50ec0b7-f960-400d-91f0-c42a6d44e3d0', 'F50EC0B7-F960-400D-91F0-C42A6D44E3D0', ]) def test_string_uuid(self, value): schema = {"type": 'string', "format": 'uuid'} validator = OAS30Validator(schema, format_checker=oas30_format_checker) result = validator.validate(value) assert result is None def test_allof_required(self): schema = { "allOf": [ {"type": "object", "properties": { "some_prop": {"type": "string"}}}, {"type": "object", "required": ["some_prop"]}, ] } validator = OAS30Validator(schema, format_checker=oas30_format_checker) with pytest.raises(ValidationError, match="'some_prop' is a required property"): validator.validate({"another_prop": "bla"}) def test_required(self): schema = { "type": "object", "properties": { "some_prop": { "type": "string" } }, "required": ["some_prop"] } validator = OAS30Validator(schema, format_checker=oas30_format_checker) with pytest.raises(ValidationError, match="'some_prop' is a required property"): validator.validate({"another_prop": "bla"}) assert validator.validate({"some_prop": "hello"}) is None def test_required_read_only(self): schema = { "type": "object", "properties": { "some_prop": { "type": "string", "readOnly": True } }, "required": ["some_prop"] } validator = OAS30Validator(schema, format_checker=oas30_format_checker, read=True) with pytest.raises(ValidationError, match="'some_prop' is a required property"): validator.validate({"another_prop": "hello"}) validator = OAS30Validator(schema, format_checker=oas30_format_checker, write=True) assert validator.validate({"another_prop": "hello"}) is None def test_required_write_only(self): schema = { "type": "object", "properties": { "some_prop": { "type": "string", "writeOnly": True } }, "required": ["some_prop"] } validator = OAS30Validator(schema, format_checker=oas30_format_checker, write=True) with pytest.raises(ValidationError, match="'some_prop' is a required property"): validator.validate({"another_prop": "hello"}) validator = OAS30Validator(schema, format_checker=oas30_format_checker, read=True) assert validator.validate({"another_prop": "hello"}) is None def test_oneof_required(self): instance = { 'n3IwfId': 'string', } schema = { "type": "object", "properties": { "n3IwfId": {"type": "string"}, "wagfId": {"type": "string"}, }, "oneOf": [ {"required": ["n3IwfId"]}, {"required": ["wagfId"]}, ], } validator = OAS30Validator(schema, format_checker=oas30_format_checker) result = validator.validate(instance) assert result is None @pytest.mark.parametrize('schema_type', [ 'oneOf', 'anyOf', 'allOf', ]) def test_oneof_discriminator(self, schema_type): # We define a few components schemas components = { "MountainHiking": { "type": "object", "properties": { "discipline": { "type": "string", # we allow both the explicitely matched mountain_hiking discipline # and the implicitely matched MoutainHiking discipline "enum": ["mountain_hiking", "MountainHiking"] }, "length": { "type": "integer", } }, "required": ["discipline", "length"] }, "AlpineClimbing": { "type": "object", "properties": { "discipline": { "type": "string", "enum": ["alpine_climbing"] }, "height": { "type": "integer", }, }, "required": ["discipline", "height"] }, "Route": { # defined later } } components['Route'][schema_type] = [ {"$ref": "#/components/schemas/MountainHiking"}, {"$ref": "#/components/schemas/AlpineClimbing"}, ] # Add the compoments in a minimalis schema schema = { "$ref": "#/components/schemas/Route", "components": { "schemas": components } } if schema_type != 'allOf': # use jsonschema validator when no discriminator is defined validator = OAS30Validator(schema, format_checker=oas30_format_checker) with pytest.raises(ValidationError, match="is not valid under any of the given schemas"): validator.validate({ "something": "matching_none_of_the_schemas" }) assert False if schema_type == 'anyOf': # use jsonschema validator when no discriminator is defined validator = OAS30Validator(schema, format_checker=oas30_format_checker) with pytest.raises(ValidationError, match="is not valid under any of the given schemas"): validator.validate({ "something": "matching_none_of_the_schemas" }) assert False discriminator = { "propertyName": "discipline", "mapping": { "mountain_hiking": "#/components/schemas/MountainHiking", "alpine_climbing": "#/components/schemas/AlpineClimbing", } } schema['components']['schemas']['Route']['discriminator'] = discriminator # Optional: check we return useful result when the schema is wrong validator = OAS30Validator(schema, format_checker=oas30_format_checker) with pytest.raises(ValidationError, match="does not contain discriminating property"): validator.validate({ "something": "missing" }) assert False # Check we get a non-generic, somehow usable, error message when a discriminated schema is failing with pytest.raises(ValidationError, match="'bad_string' is not of type integer"): validator.validate({ "discipline": "mountain_hiking", "length": "bad_string" }) assert False # Check explicit MountainHiking resolution validator.validate({ "discipline": "mountain_hiking", "length": 10 }) # Check implicit MountainHiking resolution validator.validate({ "discipline": "MountainHiking", "length": 10 }) # Check non resolvable implicit schema with pytest.raises(ValidationError, match="reference '#/components/schemas/other' could not be resolved"): result = validator.validate({ "discipline": "other" }) assert False class TestOAS31ValidatorValidate(object): @pytest.mark.parametrize('schema_type', [ 'boolean', 'array', 'integer', 'number', 'string', ]) def test_null(self, schema_type): schema = {"type": schema_type} validator = OAS31Validator(schema) value = None with pytest.raises(ValidationError): validator.validate(value) @pytest.mark.parametrize('schema_type', [ 'boolean', 'array', 'integer', 'number', 'string', ]) def test_nullable(self, schema_type): schema = {"type": [schema_type, 'null']} validator = OAS31Validator(schema) value = None result = validator.validate(value) assert result is None @pytest.mark.parametrize('value', [ '1989-01-02T00:00:00Z', '2018-01-02T23:59:59Z', ]) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_RFC3339_VALIDATOR', False ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_STRICT_RFC3339', False ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_ISODATE', False ) def test_string_format_no_datetime_validator(self, value): schema = {"type": 'string', "format": 'date-time'} validator = OAS31Validator( schema, format_checker=oas31_format_checker, ) result = validator.validate(value) assert result is None @pytest.mark.parametrize('value', [ '1989-01-02T00:00:00Z', '2018-01-02T23:59:59Z', ]) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_RFC3339_VALIDATOR', True ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_STRICT_RFC3339', False ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_ISODATE', False ) def test_string_format_datetime_rfc3339_validator(self, value): schema = {"type": 'string', "format": 'date-time'} validator = OAS31Validator( schema, format_checker=oas31_format_checker, ) result = validator.validate(value) assert result is None @pytest.mark.parametrize('value', [ '1989-01-02T00:00:00Z', '2018-01-02T23:59:59Z', ]) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_RFC3339_VALIDATOR', False ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_STRICT_RFC3339', True ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_ISODATE', False ) def test_string_format_datetime_strict_rfc3339(self, value): schema = {"type": 'string', "format": 'date-time'} validator = OAS31Validator( schema, format_checker=oas31_format_checker, ) result = validator.validate(value) assert result is None @pytest.mark.parametrize('value', [ '1989-01-02T00:00:00Z', '2018-01-02T23:59:59Z', ]) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_RFC3339_VALIDATOR', False ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_STRICT_RFC3339', False ) @mock.patch( 'openapi_schema_validator._format.' 'DATETIME_HAS_ISODATE', True ) def test_string_format_datetime_isodate(self, value): schema = {"type": 'string', "format": 'date-time'} validator = OAS31Validator( schema, format_checker=oas31_format_checker, ) result = validator.validate(value) assert result is None @pytest.mark.parametrize('value', [ 'f50ec0b7-f960-400d-91f0-c42a6d44e3d0', 'F50EC0B7-F960-400D-91F0-C42A6D44E3D0', ]) def test_string_uuid(self, value): schema = {"type": 'string', "format": 'uuid'} validator = OAS31Validator( schema, format_checker=oas31_format_checker, ) result = validator.validate(value) assert result is None def test_schema_validation(self): schema = { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string" }, "age": { "type": "integer", "format": "int32", "minimum": 0, "nullable": True, }, "birth-date": { "type": "string", "format": "date", } }, "additionalProperties": False, } validator = OAS31Validator( schema, format_checker=oas31_format_checker, ) result = validator.validate({"name": "John", "age": 23}, schema) assert result is None with pytest.raises(ValidationError) as excinfo: validator.validate({"name": "John", "city": "London"}, schema) error = "Additional properties are not allowed ('city' was unexpected)" assert error in str(excinfo.value) with pytest.raises(ValidationError) as excinfo: validator.validate({"name": "John", "birth-date": "-12"}) error = "'-12' is not a 'date'" assert error in str(excinfo.value) def test_schema_ref(self): schema = { "$ref": "#/$defs/Pet", "$defs": { "Pet": { "required": [ "id", "name" ], "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" }, "tag": { "type": "string" } } } } } validator = OAS31Validator( schema, format_checker=oas31_format_checker, ) result = validator.validate({"id": 1, "name": "John"}, schema) assert result is None with pytest.raises(ValidationError) as excinfo: validator.validate({"name": "John"}, schema) error = "'id' is a required property" assert error in str(excinfo.value)
31.709402
114
0.539677
1,626
18,550
5.957565
0.118696
0.061732
0.056777
0.054506
0.775059
0.751213
0.724579
0.712708
0.712708
0.707753
0
0.042148
0.346415
18,550
584
115
31.763699
0.756846
0.032561
0
0.674044
0
0
0.244131
0.091563
0
0
0
0
0.052314
1
0.044266
false
0
0.012072
0
0.060362
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
3d23dae371fa527c0268bfe60fa4091945d039ab
79
py
Python
pyeccodes/defs/grib2/local/1098/2_1_table.py
ecmwf/pyeccodes
dce2c72d3adcc0cb801731366be53327ce13a00b
[ "Apache-2.0" ]
7
2020-04-14T09:41:17.000Z
2021-08-06T09:38:19.000Z
pyeccodes/defs/grib2/local/1098/2_1_table.py
ecmwf/pyeccodes
dce2c72d3adcc0cb801731366be53327ce13a00b
[ "Apache-2.0" ]
null
null
null
pyeccodes/defs/grib2/local/1098/2_1_table.py
ecmwf/pyeccodes
dce2c72d3adcc0cb801731366be53327ce13a00b
[ "Apache-2.0" ]
3
2020-04-30T12:44:48.000Z
2020-12-15T08:40:26.000Z
def load(h): return ({'abbr': 'model', 'code': 0, 'title': 'Model info'},)
26.333333
65
0.531646
11
79
3.818182
0.909091
0
0
0
0
0
0
0
0
0
0
0.015385
0.177215
79
2
66
39.5
0.630769
0
0
0
0
0
0.35443
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
1
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
1
0
0
0
1
1
0
0
5
3d2b138768285d0380b69d2f07cfaa84370b344c
157
py
Python
parflow_data_management/scheduler/models/workflow.py
tao558/parflow_data_management
903543cedfd990d52a3461b1e5d02d43721623a3
[ "BSD-3-Clause" ]
null
null
null
parflow_data_management/scheduler/models/workflow.py
tao558/parflow_data_management
903543cedfd990d52a3461b1e5d02d43721623a3
[ "BSD-3-Clause" ]
12
2020-10-26T21:05:35.000Z
2021-02-01T22:04:25.000Z
parflow_data_management/scheduler/models/workflow.py
Kitware/parflow_data_management
903543cedfd990d52a3461b1e5d02d43721623a3
[ "BSD-3-Clause" ]
1
2021-02-25T18:32:32.000Z
2021-02-25T18:32:32.000Z
from django_extensions.db.models import TimeStampedModel from .project_asset import ProjectAsset class Workflow(TimeStampedModel, ProjectAsset): pass
19.625
56
0.834395
17
157
7.588235
0.764706
0
0
0
0
0
0
0
0
0
0
0
0.121019
157
7
57
22.428571
0.934783
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.25
0.5
0
0.75
0
1
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
1
1
1
0
0
0
0
5
3d3a90b28f2b798201b8c9e0024a389c7f238764
60
py
Python
printree/__init__.py
chrizzFTD/printree
5ecd1ca04c2936799bcadcfc059c312823e1613c
[ "MIT" ]
5
2021-02-21T21:31:23.000Z
2022-01-23T09:51:07.000Z
printree/__init__.py
chrizzFTD/printree
5ecd1ca04c2936799bcadcfc059c312823e1613c
[ "MIT" ]
null
null
null
printree/__init__.py
chrizzFTD/printree
5ecd1ca04c2936799bcadcfc059c312823e1613c
[ "MIT" ]
1
2021-05-11T05:36:06.000Z
2021-05-11T05:36:06.000Z
from ._ptree import ptree, ftree, AsciiPrinter, TreePrinter
30
59
0.816667
7
60
6.857143
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.116667
60
1
60
60
0.90566
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
a10798f55f5157fb4698695f20b350752de5cbd9
128
py
Python
build/lib/drf_advanced_token_manager/admin.py
amp89/drf_advanced_token_manager
2b1dec87cfcadd22ffd8c599a860ade670915dcf
[ "MIT" ]
1
2020-09-07T05:13:49.000Z
2020-09-07T05:13:49.000Z
build/lib/drf_advanced_token_manager/admin.py
amp89/drf_advanced_token_manager
2b1dec87cfcadd22ffd8c599a860ade670915dcf
[ "MIT" ]
1
2020-09-11T01:19:07.000Z
2020-09-11T01:19:07.000Z
drf_advanced_token_manager/admin.py
amp89/drf_advanced_token_manager
2b1dec87cfcadd22ffd8c599a860ade670915dcf
[ "MIT" ]
null
null
null
from django.contrib import admin from drf_advanced_token_manager.models import UserUIKeyLock admin.site.register(UserUIKeyLock)
32
59
0.882813
17
128
6.470588
0.764706
0
0
0
0
0
0
0
0
0
0
0
0.070313
128
4
60
32
0.92437
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
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
1
0
1
0
1
0
0
5
a12329eb96f6666367652d692b2f2a23ac1bc1ff
191
py
Python
demos/time/time_service.py
fruch/rpyc
8db3fdcef2272d468aca562465279370d075be72
[ "MIT" ]
null
null
null
demos/time/time_service.py
fruch/rpyc
8db3fdcef2272d468aca562465279370d075be72
[ "MIT" ]
null
null
null
demos/time/time_service.py
fruch/rpyc
8db3fdcef2272d468aca562465279370d075be72
[ "MIT" ]
null
null
null
import time from rpyc import Service class TimeService(Service): def exposed_get_utc(self): return time.time() def exposed_get_time(self): return time.ctime()
15.916667
31
0.670157
25
191
4.96
0.56
0.16129
0.209677
0
0
0
0
0
0
0
0
0
0.251309
191
11
32
17.363636
0.867133
0
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.285714
0.285714
1
0
1
0
0
null
0
1
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
1
1
0
0
5
a15006956e45228de54f4817e2fd5fdc78421f37
58
py
Python
ACME/visdom/text/__init__.py
mauriziokovacic/ACME
2615b66dd4addfd5c03d9d91a24c7da414294308
[ "MIT" ]
3
2019-10-23T23:10:55.000Z
2021-09-01T07:30:14.000Z
ACME/visdom/text/__init__.py
mauriziokovacic/ACME-Python
2615b66dd4addfd5c03d9d91a24c7da414294308
[ "MIT" ]
null
null
null
ACME/visdom/text/__init__.py
mauriziokovacic/ACME-Python
2615b66dd4addfd5c03d9d91a24c7da414294308
[ "MIT" ]
1
2020-07-11T11:35:43.000Z
2020-07-11T11:35:43.000Z
from .TextPlot import * from .TrainStatPlot import *
19.333333
28
0.706897
6
58
6.833333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.224138
58
2
29
29
0.911111
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
a152ef6fc9a72b5904f117d670438da13477f9bb
657
py
Python
main.py
HoangTheBoss/valorant-skin-cli
258c7797468b6fa58ebb82e179b753cd42182644
[ "MIT" ]
null
null
null
main.py
HoangTheBoss/valorant-skin-cli
258c7797468b6fa58ebb82e179b753cd42182644
[ "MIT" ]
null
null
null
main.py
HoangTheBoss/valorant-skin-cli
258c7797468b6fa58ebb82e179b753cd42182644
[ "MIT" ]
null
null
null
from valclient.client import Client from InquirerPy.utils import color_print from src.startup import Startup # TODO: # - launch with valorant # - detect new releases on github # - clarify some prompts # TODO LATER: # - loadouts if __name__ == "__main__": color_print([("Tomato", ''' _ _____ __ ____ ___ ___ _ ________ __ _ ___ | | / / _ | / / / __ \/ _ \/ _ | / |/ /_ __/______ / /__ (_)__ ________/ (_) | |/ / __ |/ /__/ /_/ / , _/ __ |/ / / / /___(_-</ '_// / _ \/___/ __/ / / |___/_/ |_/____/\____/_/|_/_/ |_/_/|_/ /_/ /___/_/\_\/_/_//_/ \__/_/_/ ''')]) Startup.run()
25.269231
82
0.506849
39
657
5.410256
0.74359
0.094787
0
0
0
0
0
0
0
0
0
0
0.296804
657
26
83
25.269231
0.45671
0.161339
0
0
0
0.272727
0.644037
0.038532
0
0
0
0.038462
0
1
0
true
0
0.272727
0
0.272727
0.181818
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
1
1
0
null
0
0
1
0
0
0
1
0
0
0
0
0
0
5
a160b71562798195e50599b9f415d934d55dadb9
282
py
Python
cegs_portal/search/models/file.py
ReddyLab/cegs-portal
a83703a3557167be328c24bfb866b6aa019ba059
[ "MIT" ]
null
null
null
cegs_portal/search/models/file.py
ReddyLab/cegs-portal
a83703a3557167be328c24bfb866b6aa019ba059
[ "MIT" ]
null
null
null
cegs_portal/search/models/file.py
ReddyLab/cegs-portal
a83703a3557167be328c24bfb866b6aa019ba059
[ "MIT" ]
null
null
null
from django.db import models from cegs_portal.search.models.facets import FacetedModel class File(FacetedModel): filename = models.CharField(max_length=512) description = models.CharField(max_length=4096, null=True) url = models.CharField(max_length=2048, null=True)
28.2
62
0.780142
38
282
5.684211
0.605263
0.208333
0.25
0.333333
0
0
0
0
0
0
0
0.044715
0.12766
282
9
63
31.333333
0.833333
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
0
0
0
null
1
1
1
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
1
0
0
0
0
5
a1a1dee8c5022c25ea664f15a510f51962cb08a2
166
py
Python
tsrc/utils.py
thomashk0/tsrc
c62e1d76703e6af77d743fc7827f357054b5a954
[ "BSD-3-Clause" ]
95
2018-12-17T12:18:05.000Z
2021-01-22T03:18:37.000Z
tsrc/utils.py
thomashk0/tsrc
c62e1d76703e6af77d743fc7827f357054b5a954
[ "BSD-3-Clause" ]
118
2018-11-09T16:29:38.000Z
2021-01-18T13:39:34.000Z
tsrc/utils.py
thomashk0/tsrc
c62e1d76703e6af77d743fc7827f357054b5a954
[ "BSD-3-Clause" ]
16
2019-05-17T09:39:51.000Z
2020-09-04T14:37:38.000Z
import shutil import cli_ui as ui def erase_last_line() -> None: terminal_size = shutil.get_terminal_size() ui.info(" " * terminal_size.columns, end="\r")
18.444444
50
0.698795
25
166
4.36
0.68
0.330275
0
0
0
0
0
0
0
0
0
0
0.174699
166
8
51
20.75
0.79562
0
0
0
0
0
0.018072
0
0
0
0
0
0
1
0.2
false
0
0.4
0
0.6
0
1
0
0
null
1
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
1
0
1
0
0
5
a1de90064a25edf614163f3f50717bd15748cb9e
564
py
Python
common/markdown/markdown.py
ujlbu4/vas3k.club
1ec907cf7e5ae3a74059cde8729ca0b3e2d55a3e
[ "MIT" ]
496
2020-04-24T04:20:32.000Z
2022-03-31T21:55:57.000Z
common/markdown/markdown.py
ujlbu4/vas3k.club
1ec907cf7e5ae3a74059cde8729ca0b3e2d55a3e
[ "MIT" ]
642
2020-04-24T11:54:13.000Z
2022-03-26T15:41:06.000Z
common/markdown/markdown.py
ujlbu4/vas3k.club
1ec907cf7e5ae3a74059cde8729ca0b3e2d55a3e
[ "MIT" ]
243
2020-04-24T11:49:11.000Z
2022-03-24T18:38:48.000Z
import mistune from common.markdown.club_renderer import ClubRenderer from common.markdown.email_renderer import EmailRenderer from common.markdown.plain_renderer import PlainRenderer def markdown_text(text, renderer=ClubRenderer): markdown = mistune.create_markdown( escape=True, renderer=renderer(), plugins=["strikethrough", "url"] ) return (markdown(text) or "").strip() def markdown_plain(text): return markdown_text(text, renderer=PlainRenderer) def markdown_email(text): return markdown_text(text, renderer=EmailRenderer)
26.857143
74
0.776596
65
564
6.6
0.353846
0.111888
0.125874
0.167832
0.158508
0.158508
0
0
0
0
0
0
0.131206
564
20
75
28.2
0.87551
0
0
0
0
0
0.028369
0
0
0
0
0
0
1
0.230769
false
0
0.307692
0.153846
0.769231
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
1
0
0
1
1
1
0
0
5
62b098ca2dde829e61b0519b46730054b0f96e35
46
py
Python
baekjoon/16430/source.py
qilip/ACMStudy
c4d6f31b01358ead4959c92f1fac59a3826f3f77
[ "CC-BY-3.0" ]
4
2020-02-02T08:34:46.000Z
2021-10-01T11:21:17.000Z
baekjoon/16430/source.py
qilip/ACMStudy
c4d6f31b01358ead4959c92f1fac59a3826f3f77
[ "CC-BY-3.0" ]
1
2021-09-04T14:03:50.000Z
2021-09-04T14:03:50.000Z
baekjoon/16430/source.py
qilip/ACMStudy
c4d6f31b01358ead4959c92f1fac59a3826f3f77
[ "CC-BY-3.0" ]
null
null
null
a, b = map(int, input().split()) print(b-a, b)
23
32
0.565217
10
46
2.6
0.7
0.153846
0
0
0
0
0
0
0
0
0
0
0.130435
46
2
33
23
0.65
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
0.5
1
1
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
1
0
0
0
0
1
0
5
62e8e469464b4451d59c193082307778dea7237b
170
py
Python
budget/admin.py
tejaser/budgetproject
3b4f2ef0827bd60cd4c8c6115b4c797d788ff6d6
[ "MIT" ]
null
null
null
budget/admin.py
tejaser/budgetproject
3b4f2ef0827bd60cd4c8c6115b4c797d788ff6d6
[ "MIT" ]
null
null
null
budget/admin.py
tejaser/budgetproject
3b4f2ef0827bd60cd4c8c6115b4c797d788ff6d6
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Project, Category, Expense admin.site.register(Project) admin.site.register(Category) admin.site.register(Expense)
21.25
46
0.817647
23
170
6.043478
0.478261
0.194245
0.366906
0
0
0
0
0
0
0
0
0
0.088235
170
7
47
24.285714
0.896774
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
1
0
0
null
0
1
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
1
0
1
0
0
0
0
5
62ea97bf01118f9f81170f9d19ad579ace9ef680
61
py
Python
tests/cli/public_ip_getter/__init__.py
hbontempo-br/ddns-manager
3d78ba540d433146fc61b4243c62a519830c1fb4
[ "MIT" ]
null
null
null
tests/cli/public_ip_getter/__init__.py
hbontempo-br/ddns-manager
3d78ba540d433146fc61b4243c62a519830c1fb4
[ "MIT" ]
15
2021-06-30T16:05:38.000Z
2021-07-11T16:14:29.000Z
tests/cli/public_ip_getter/__init__.py
hbontempo-br/ddns-manager
3d78ba540d433146fc61b4243c62a519830c1fb4
[ "MIT" ]
null
null
null
from . import * from .base_test import TestPublicIpGetterCLI
20.333333
44
0.819672
7
61
7
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.131148
61
2
45
30.5
0.924528
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
1a16b81302622b76a53e32b131b2d01304d8df13
94
py
Python
subject/models.py
javb92/django_loona_school
aaf4d200b331061410a7d672c86682f7b6809d8e
[ "MIT" ]
null
null
null
subject/models.py
javb92/django_loona_school
aaf4d200b331061410a7d672c86682f7b6809d8e
[ "MIT" ]
5
2021-03-19T03:57:33.000Z
2021-09-22T19:10:12.000Z
subject/models.py
javb92/django_loona_school
aaf4d200b331061410a7d672c86682f7b6809d8e
[ "MIT" ]
null
null
null
from django.db import models from classroom.models import Subjects # Create your models here.
23.5
37
0.819149
14
94
5.5
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.138298
94
4
38
23.5
0.950617
0.255319
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
1a2926c1035b8a5358827defc2ff3eee09db97fb
116
py
Python
esercizi/DizionarioWhileNotWork.py
gdv/python-alfabetizzazione
d87561222de8a230db11d8529c49cf1702aec326
[ "MIT" ]
null
null
null
esercizi/DizionarioWhileNotWork.py
gdv/python-alfabetizzazione
d87561222de8a230db11d8529c49cf1702aec326
[ "MIT" ]
null
null
null
esercizi/DizionarioWhileNotWork.py
gdv/python-alfabetizzazione
d87561222de8a230db11d8529c49cf1702aec326
[ "MIT" ]
1
2019-03-26T11:14:33.000Z
2019-03-26T11:14:33.000Z
diz = {'a': 7, 'b': 3.0 + 5, 'c': 'pippo', 'd': 2 +1j} i = 0 while (i < len(diz)): print diz[i] i = i + 1
14.5
54
0.387931
24
116
1.875
0.708333
0.088889
0
0
0
0
0
0
0
0
0
0.101266
0.318966
116
7
55
16.571429
0.468354
0
0
0
0
0
0.078261
0
0
0
0
0
0
0
null
null
0
0
null
null
0.2
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
5
c5033af8a92d82bb7985f44fe5d2392e20a1008d
3,220
py
Python
pytext/models/test/transformer_sentence_encoder_test.py
baronrustamov/pytext
9790943736e7c0ac53095be2e20177be6fc529a9
[ "BSD-3-Clause" ]
6,199
2018-12-13T15:34:51.000Z
2022-03-26T04:08:58.000Z
pytext/models/test/transformer_sentence_encoder_test.py
baronrustamov/pytext
9790943736e7c0ac53095be2e20177be6fc529a9
[ "BSD-3-Clause" ]
1,356
2018-12-13T15:50:33.000Z
2022-03-03T20:45:58.000Z
pytext/models/test/transformer_sentence_encoder_test.py
baronrustamov/pytext
9790943736e7c0ac53095be2e20177be6fc529a9
[ "BSD-3-Clause" ]
842
2018-12-13T15:35:13.000Z
2022-03-23T13:27:00.000Z
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import unittest import torch from pytext.models.representations.transformer_sentence_encoder import ( TransformerSentenceEncoder, ) class TransformerSentenceEncoderTest(unittest.TestCase): def setUp(self): self.batch_size = 10 self.num_tokens = 20 self.embedding_dim = 1024 self.vocab_size = 1000 self.padding_idx = 0 self.num_encoder_layers = 6 # Generate a tensor of token ids as input tokens self.tokens = ( torch.randint(5, 1000, (self.batch_size, self.num_tokens)) ).long() self.lengths = torch.tensor([self.num_tokens]) self.pad_mask = (torch.ones(self.batch_size, self.num_tokens)).long() self.segment_labels = (torch.ones(self.batch_size, self.num_tokens)).long() self.positions = None def test_monolingual_transformer_sentence_encoder(self): input_tuple = (self.tokens, self.pad_mask, self.segment_labels, self.positions) sentence_encoder = TransformerSentenceEncoder.from_config( TransformerSentenceEncoder.Config( embedding_dim=self.embedding_dim, num_encoder_layers=self.num_encoder_layers, multilingual=False, ), output_encoded_layers=True, padding_idx=self.padding_idx, vocab_size=self.vocab_size, ) encoded_layers, pooled_outputs = sentence_encoder(input_tuple) # Check sizes for pooled output self.assertEqual(pooled_outputs.size()[0], self.batch_size) self.assertEqual(pooled_outputs.size()[1], self.embedding_dim) # Check sizes for encoded_layers self.assertEqual(encoded_layers.__len__(), self.num_encoder_layers + 1) self.assertEqual(encoded_layers[-1].size()[0], self.batch_size) self.assertEqual(encoded_layers[-1].size()[1], self.num_tokens) self.assertEqual(encoded_layers[-1].size()[2], self.embedding_dim) def test_multilingual_transformer_sentence_encoder(self): input_tuple = (self.tokens, self.pad_mask, self.segment_labels, self.positions) sentence_encoder = TransformerSentenceEncoder.from_config( TransformerSentenceEncoder.Config( embedding_dim=self.embedding_dim, num_encoder_layers=self.num_encoder_layers, multilingual=True, ), output_encoded_layers=True, padding_idx=self.padding_idx, vocab_size=self.vocab_size, ) encoded_layers, pooled_outputs = sentence_encoder(input_tuple) # Check sizes for pooled output self.assertEqual(pooled_outputs.size()[0], self.batch_size) self.assertEqual(pooled_outputs.size()[1], self.embedding_dim) # Check sizes for encoded_layers self.assertEqual(encoded_layers.__len__(), self.num_encoder_layers + 1) self.assertEqual(encoded_layers[-1].size()[0], self.batch_size) self.assertEqual(encoded_layers[-1].size()[1], self.num_tokens) self.assertEqual(encoded_layers[-1].size()[2], self.embedding_dim)
39.268293
87
0.676087
375
3,220
5.528
0.224
0.087795
0.050169
0.108056
0.744814
0.744814
0.744814
0.744814
0.728413
0.728413
0
0.015267
0.227019
3,220
81
88
39.753086
0.817597
0.080435
0
0.551724
0
0
0
0
0
0
0
0
0.206897
1
0.051724
false
0
0.051724
0
0.12069
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
c56d940885c03144f187f34d4f73fc565c0f12c8
96
py
Python
samtranslator/public/models.py
hawflau/serverless-application-model
d2cf4b7e23d26cdf677c564d53bb58e6a5b6cac2
[ "Apache-2.0" ]
1,279
2020-08-25T03:33:15.000Z
2022-03-31T09:49:22.000Z
samtranslator/public/models.py
hawflau/serverless-application-model
d2cf4b7e23d26cdf677c564d53bb58e6a5b6cac2
[ "Apache-2.0" ]
797
2020-08-24T23:30:05.000Z
2022-03-31T22:28:29.000Z
samtranslator/public/models.py
hawflau/serverless-application-model
d2cf4b7e23d26cdf677c564d53bb58e6a5b6cac2
[ "Apache-2.0" ]
431
2020-08-27T20:47:26.000Z
2022-03-31T23:57:55.000Z
# flake8: noqa from samtranslator.model.resource_policies import ResourcePolicies, PolicyTypes
24
79
0.854167
10
96
8.1
1
0
0
0
0
0
0
0
0
0
0
0.011494
0.09375
96
3
80
32
0.91954
0.125
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
9ac6507fc8b160f7e1dba50f40494dce11ee9948
16
py
Python
teste.py
Professor-Vanderson/DevOps-GTI
fd638f716eca6e8c48186b088fd96102c933537b
[ "Apache-2.0" ]
null
null
null
teste.py
Professor-Vanderson/DevOps-GTI
fd638f716eca6e8c48186b088fd96102c933537b
[ "Apache-2.0" ]
null
null
null
teste.py
Professor-Vanderson/DevOps-GTI
fd638f716eca6e8c48186b088fd96102c933537b
[ "Apache-2.0" ]
null
null
null
print("DevOps")
8
15
0.6875
2
16
5.5
1
0
0
0
0
0
0
0
0
0
0
0
0.0625
16
1
16
16
0.733333
0
0
0
0
0
0.375
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
1
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
1
0
0
0
0
1
0
5
b11235a3b6feaa743e632e08738cb6b1876dcc21
81
py
Python
jinahub/indexers/searcher/compound/FaissPostgresSearcher/tests/test_dummy.py
vivek2301/executors
8159681d68408ab8f797497bc3374be77e6ca392
[ "Apache-2.0" ]
null
null
null
jinahub/indexers/searcher/compound/FaissPostgresSearcher/tests/test_dummy.py
vivek2301/executors
8159681d68408ab8f797497bc3374be77e6ca392
[ "Apache-2.0" ]
null
null
null
jinahub/indexers/searcher/compound/FaissPostgresSearcher/tests/test_dummy.py
vivek2301/executors
8159681d68408ab8f797497bc3374be77e6ca392
[ "Apache-2.0" ]
null
null
null
def test_dummy(): # required by CI, since the `tests` folder exists pass
20.25
53
0.666667
12
81
4.416667
1
0
0
0
0
0
0
0
0
0
0
0
0.246914
81
3
54
27
0.868852
0.580247
0
0
0
0
0
0
0
0
0
0
0
1
0.5
true
0.5
0
0
0.5
0
1
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
1
1
1
0
0
0
0
0
5
4920dbe0d3df736eb7e0b391b26ddc1f5687dc0c
159
py
Python
app/graph.py
asanoryu/dev_bg_neo4j_flask
c06883b6c136c47868c2597880cb85689e4f7a5b
[ "MIT" ]
null
null
null
app/graph.py
asanoryu/dev_bg_neo4j_flask
c06883b6c136c47868c2597880cb85689e4f7a5b
[ "MIT" ]
null
null
null
app/graph.py
asanoryu/dev_bg_neo4j_flask
c06883b6c136c47868c2597880cb85689e4f7a5b
[ "MIT" ]
null
null
null
from py2neo import Graph from app.config import GRAPH_PASSWORD, GRAPH_URL, GRAPH_USER graph = Graph(GRAPH_URL, username=GRAPH_USER, password=GRAPH_PASSWORD)
26.5
70
0.830189
24
159
5.25
0.416667
0.174603
0
0
0
0
0
0
0
0
0
0.007042
0.106918
159
5
71
31.8
0.880282
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.666667
0.666667
0
0.666667
0
1
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
1
1
0
1
0
0
5
493e03ade05ba9207cb35ffb445f89d363f89b01
128
py
Python
tracker/admin.py
arcanemachine/django-time-tracker
af810e187b0658bbeec528669524a4a186629529
[ "MIT" ]
null
null
null
tracker/admin.py
arcanemachine/django-time-tracker
af810e187b0658bbeec528669524a4a186629529
[ "MIT" ]
null
null
null
tracker/admin.py
arcanemachine/django-time-tracker
af810e187b0658bbeec528669524a4a186629529
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Activity, Timer admin.site.register(Activity) admin.site.register(Timer)
18.285714
35
0.8125
18
128
5.777778
0.555556
0.173077
0.326923
0
0
0
0
0
0
0
0
0
0.101563
128
6
36
21.333333
0.904348
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
1
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
1
0
1
0
0
0
0
5
497abb7f5861632a8ffbc708a849aebc2dce8112
183
py
Python
nosehipchat/test/test_nosehipchat.py
sleibman/nose-hipchat
2a81b29b2a43dd74c8f2312e4623351b548f1d0a
[ "MIT" ]
null
null
null
nosehipchat/test/test_nosehipchat.py
sleibman/nose-hipchat
2a81b29b2a43dd74c8f2312e4623351b548f1d0a
[ "MIT" ]
null
null
null
nosehipchat/test/test_nosehipchat.py
sleibman/nose-hipchat
2a81b29b2a43dd74c8f2312e4623351b548f1d0a
[ "MIT" ]
null
null
null
import nose class TestNoseHipChat(object): def setup(self): pass def teardown(self): pass def passing_test(self): nose.tools.assert_true(True)
14.076923
36
0.622951
22
183
5.090909
0.681818
0.142857
0.196429
0
0
0
0
0
0
0
0
0
0.289617
183
12
37
15.25
0.861538
0
0
0.25
0
0
0
0
0
0
0
0
0.125
1
0.375
false
0.375
0.125
0
0.625
0
1
0
0
null
0
1
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
1
0
0
1
0
0
5
497e7f9c4fedec47ccd0642470c27f5a521bfeb6
22,541
py
Python
reprowd/presenter/image.py
VHUCXAONG/reprowd
6eaa439dda1ae53fc6ea981ea2f585ec8320763c
[ "Apache-2.0" ]
32
2016-09-06T05:24:14.000Z
2020-09-15T07:04:38.000Z
reprowd/presenter/image.py
VHUCXAONG/reprowd
6eaa439dda1ae53fc6ea981ea2f585ec8320763c
[ "Apache-2.0" ]
1
2016-10-17T23:42:29.000Z
2016-10-23T21:35:20.000Z
reprowd/presenter/image.py
VHUCXAONG/reprowd
6eaa439dda1ae53fc6ea981ea2f585ec8320763c
[ "Apache-2.0" ]
1
2018-04-04T22:01:23.000Z
2018-04-04T22:01:23.000Z
# -*- coding: utf-8 -*- from reprowd.presenter.base import * class ImageLabel (BasePresenter): """ ImageLabel is a presenter class direved from base presenter class. It is attacted with project. ImageLabel basically is used for image label tasks. In order to load the images correctly, the map function of set_presenter function should be consistent with the picture format in Javascript part of template. For example, >>> map_func = lambda obj: {'url_b':obj} this means the key of your image url in task info json is 'url_b', which will be passed to Javascript part of template. Thus, in pybossa.taskLoaded function of Javascript part. The key 'url_b' should be used to bind a src attribute to a img tag. >>> img.attr('src', task.info.url_b).css('height', 460); """ def __init__(self): """ Initialize a ImageLabel presenter for a project. Defaultly, question, project name, project shor_name and project description are set as empty, "Image Labeling", "imglabel" and "Help us to label an image" respectively. The template attribute is a string of HTML file, which is the content of presenter. For writing a new template, check http://docs.pybossa.com/en/latest/user/tutorial.html#presenting-the-tasks-to-the-user. >>> presenter = ImageLabel(); >>> presenter.set_name("Do you see a Human face in this picture?") >>> crowddata = cc.CrowdData(object_list, table_name = "test") \\ #doctest: +SKIP ... .set_presenter(presenter, map_func) >>> crowddata.presenter <reprowd.presenter.image.ImageLabel object at 0x...> """ self.question = "" self.name = "Image Labeling" self.short_name = "imglabel" self.description = "Help us to label an image" self.template = """ <!-- Task DOM for loading the Flickr Images It uses the class="skeleton" to identify the elements that belong to the task. --> <div class="row skeleton"> <!-- Start Skeleton Row--> <div class="col-md-6 "><!-- Start of Question and Submission DIV (column) --> <h1 id="question"><span id="i18n_question">${question}</span></h1> <!-- The question will be loaded here --> <div id="answer"> <!-- Start DIV for the submission buttons --> <!-- If the user clicks this button, the saved answer will be value="yes"--> <button class="btn btn-success btn-answer" value='Yes'><i class="icon icon-white icon-thumbs-up"></i> <span id="i18n_yes">Yes</span></button> <!-- If the user clicks this button, the saved answer will be value="no"--> <button class="btn btn-danger btn-answer" value='No'><i class="icon icon-white icon-thumbs-down"></i> No</button> <!-- If the user clicks this button, the saved answer will be value="NoPhoto"--> <button class="btn btn-answer" value='NoPhoto'><i class="icon icon-exclamation"></i> <span id="i18n_no_photo">No photo</span></button> <!-- If the user clicks this button, the saved answer will be value="NotKnown"--> <button class="btn btn-answer" value='NotKnown'><i class="icon icon-white icon-question-sign"></i> <span id="i18n_i_dont_know">I don't know</span></button> </div><!-- End of DIV for the submission buttons --> <!-- Feedback items for the user --> <p><span id="i18n_working_task">You are working now on task:</span> <span id="task-id" class="label label-warning">#</span></p> <p><span id="i18n_tasks_completed">You have completed:</span> <span id="done" class="label label-info"></span> <span id="i18n_tasks_from">tasks from</span> <!-- Progress progress-bar for the user --> <span id="total" class="label label-inverse"></span></p> <div class="progress progress-striped"> <div id="progress" rel="tooltip" title="#" class="progress-bar" style="width: 0%;"></div> </div> <!-- This project uses Disqus to allow users to provide some feedback. The next section includes a button that when a user clicks on it will load the comments, if any, for the given task --> <div id="disqus_show_btn" style="margin-top:5px;"> <button class="btn btn-primary btn-lg btn-disqus" onclick="loadDisqus()"><i class="icon-comments"></i> <span id="i18n_show_comments">Show comments</span></button> <button class="btn btn-lg btn-disqus" onclick="loadDisqus()" style="display:none"><i class="icon-comments"></i> <span id="i18n_hide_comments">Hide comments</span></button> </div><!-- End of Disqus Button section --> <!-- Disqus thread for the given task --> <div id="disqus_thread" style="margin-top:5px;display:none"></div> </div><!-- End of Question and Submission DIV (column) --> <div class="col-md-6"><!-- Start of Photo DIV (column) --> <a id="photo-link" href="#"> <img id="photo" src="http://i.imgur.com/GeHxzb7.png" style="max-width=100%"> </a> </div><!-- End of Photo DIV (columnt) --> </div><!-- End of Skeleton Row --> <script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ /* * * DON'T EDIT BELOW THIS LINE * * */ function loadDisqus() { $("#disqus_thread").toggle(); $(".btn-disqus").toggle(); var disqus_shortname = 'pybossa'; // required: replace example with your forum shortname //var disqus_identifier = taskId; var disqus_developer = 1; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); } </script> <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <script type="text/javascript"> (function() { // Default language var userLocale = "en"; // Translations var messages = {"en": { "i18n_welldone": "Well done!", "i18n_welldone_text": "Your answer has been saved", "i18n_loading_next_task": "Loading next task...", "i18n_task_completed": "The task has been completed!", "i18n_thanks": "Thanks a lot!", "i18n_congratulations": "Congratulations", "i18n_congratulations_text": "You have participated in all available tasks!", "i18n_yes": "Yes", "i18n_no_photo": "No photo", "i18n_i_dont_know": "I don't know", "i18n_working_task": "You are working now on task:", "i18n_tasks_completed": "You have completed:", "i18n_tasks_from": "tasks from", "i18n_show_comments": "Show comments:", "i18n_hide_comments": "Hide comments:", }, "es": { "i18n_welldone": "Bien hecho!", "i18n_welldone_text": "Tu respuesta ha sido guardada", "i18n_loading_next_task": "Cargando la siguiente tarea...", "i18n_task_completed": "La tarea ha sido completadas!", "i18n_thanks": "Muchísimas gracias!", "i18n_congratulations": "Enhorabuena", "i18n_congratulations_text": "Has participado en todas las tareas disponibles!", "i18n_yes": "Sí", "i18n_no_photo": "No hay foto", "i18n_i_dont_know": "No lo sé", "i18n_working_task": "Estás trabajando en la tarea:", "i18n_tasks_completed": "Has completado:", "i18n_tasks_from": "tareas de", "i18n_show_comments": "Mostrar comentarios", "i18n_hide_comments": "Ocultar comentarios", }, }; // Update userLocale with server side information $(document).ready(function(){ userLocale = document.getElementById('PYBOSSA_USER_LOCALE').textContent.trim(); }); function i18n_translate() { var ids = Object.keys(messages[userLocale]) for (i=0; i<ids.length; i++) { console.log("Translating: " + ids[i]); if (document.getElementById(ids[i])) { document.getElementById(ids[i]).innerHTML = messages[userLocale][ids[i]]; } } } function loadUserProgress() { pybossa.userProgress('rm').done(function(data){ var pct = Math.round((data.done*100)/data.total); $("#progress").css("width", pct.toString() +"%"); $("#progress").attr("title", pct.toString() + "% completed!"); $("#progress").tooltip({'placement': 'left'}); $("#total").text(data.total); $("#done").text(data.done); }); } pybossa.taskLoaded(function(task, deferred) { if ( !$.isEmptyObject(task) ) { // load image from flickr var img = $('<img />'); img.load(function() { // continue as soon as the image is loaded deferred.resolve(task); pybossaNotify("", false, "loading"); }); img.attr('src', task.info.url_b).css('height', 460); img.addClass('img-thumbnail'); task.info.image = img; } else { deferred.resolve(task); } }); pybossa.presentTask(function(task, deferred) { if ( !$.isEmptyObject(task) ) { i18n_translate(); $('#photo-link').html('').append(task.info.image); // $("#photo-link").attr("href", task.info.link); $('#task-id').html(task.id); $('.btn-answer').off('click').on('click', function(evt) { var btn = $(this); var answer = btn.attr("value"); if (typeof answer != 'undefined') { pybossa.saveTask(task.id, answer).done(function() { pybossaNotify("Loading picture...", true, "loading"); deferred.resolve(); }); if ($("#disqus_thread").is(":visible")) { $('#disqus_thread').toggle(); $('.btn-disqus').toggle(); } } else { pybossaNotify("Oops... Something went wrong.", true, "error"); } }); pybossaNotify("Loading picture...", false, "loading"); } else { $(".skeleton").hide(); pybossaNotify("Loading picture...", false, "loading"); pybossaNotify("Thanks! You have participated in all available tasks. Enjoy some of your time!", true, "info"); } }); pybossa.run('${short_name}'); })(); </script> """ class ImageCmp(BasePresenter): """ ImageCmp is a presenter class direved from base presenter class. It is attacted with project. ImageCmp basically is used for a pair of images comparing tasks. In order to load the images correctly, the map function of set_presenter function should be consistent with the picture format in Javascript part of template. For example, >>> map_func = lambda obj: {'pic1': obj[0], 'pic2': obj[1]} this means the keys of your images url in task info json are 'pic1' and 'pic2', which will be passed to Javascript part of template. Thus, in pybossa.taskLoaded function of Javascript part. The keys 'pic1' and 'pic2' should be used to bind src attributes to two img tag2. >>> img1.attr('src', task.info.pic1).css('height', 300); >>> img2.attr('src', task.info.pic2).css('height', 300); """ def __init__(self): """ Initialize a ImageCmp presenter for a project. Defaultly, question, project name, project shor_name and project description are set as empty, "Image Comparison", "imgcmp" and "Help us to compare images" respectively. The template attribute is a string of HTML file, which is the content of presenter. For writing a new template, check http://docs.pybossa.com/en/latest/user/tutorial.html#presenting-the-tasks-to-the-user. >>> presenter = ImageCmp(); >>> presenter.set_name("Which picture is more beautiful?") >>> crowddata = cc.CrowdData(object_list, table_name = "test") \\ #doctest: +SKIP ... .set_presenter(presenter, map_func) >>> crowddata.presenter <reprowd.presenter.image.ImageCmp object at 0x...> """ self.question = "" self.name = "Image Comparison" self.short_name = "imgcmp" self.description = "Help us to compare images" self.template = """ <!-- Task DOM for loading the Flickr Images It uses the class="skeleton" to identify the elements that belong to the task. --> <div class="row skeleton"> <!-- Start Skeleton Row--> <div class="col-md-6 " style="width:100%;text-align:center;margin-left:auto;margin-right:auto"><!-- Start of Question and Submission DIV (column) --> <h1 id="question"><span id="i18n_question">${question}</span></h1> <!-- The question will be loaded here --> <br> <div class="col-md-6" style="width:100%"><!-- Start of Photo DIV (column) --> <a class="a-answer" id="photo-link1" href="#" value="left"> <img id="photo" style="float:left"src="http://i.imgur.com/GeHxzb7.png"> </a> <a style="text-transform:none;text-decoration:none;font-size:50px"><b>OR</a> <a class="a-answer" id="photo-link2" href="#" value="right"> <img id="photo" style="float:right" src="http://i.imgur.com/GeHxzb7.png"> </a> </div><!-- End of Photo DIV (columnt) --> </div> </div><!-- End of Skeleton Row --> <script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ /* * * DON'T EDIT BELOW THIS LINE * * */ function loadDisqus() { $("#disqus_thread").toggle(); $(".btn-disqus").toggle(); var disqus_shortname = 'pybossa'; // required: replace example with your forum shortname //var disqus_identifier = taskId; var disqus_developer = 1; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); } </script> <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <script type="text/javascript"> (function() { // Default language var userLocale = "en"; // Translations var messages = {"en": { "i18n_welldone": "Well done!", "i18n_welldone_text": "Your answer has been saved", "i18n_loading_next_task": "Loading next task...", "i18n_task_completed": "The task has been completed!", "i18n_thanks": "Thanks a lot!", "i18n_congratulations": "Congratulations", "i18n_congratulations_text": "You have participated in all available tasks!", "i18n_yes": "Yes", "i18n_no_photo": "No photo", "i18n_i_dont_know": "I don't know", "i18n_working_task": "You are working now on task:", "i18n_tasks_completed": "You have completed:", "i18n_tasks_from": "tasks from", "i18n_show_comments": "Show comments:", "i18n_hide_comments": "Hide comments:", }, "es": { "i18n_welldone": "Bien hecho!", "i18n_welldone_text": "Tu respuesta ha sido guardada", "i18n_loading_next_task": "Cargando la siguiente tarea...", "i18n_task_completed": "La tarea ha sido completadas!", "i18n_thanks": "Muchísimas gracias!", "i18n_congratulations": "Enhorabuena", "i18n_congratulations_text": "Has participado en todas las tareas disponibles!", "i18n_yes": "Sí", "i18n_no_photo": "No hay foto", "i18n_i_dont_know": "No lo sé", "i18n_working_task": "Estás trabajando en la tarea:", "i18n_tasks_completed": "Has completado:", "i18n_tasks_from": "tareas de", "i18n_show_comments": "Mostrar comentarios", "i18n_hide_comments": "Ocultar comentarios", }, }; // Update userLocale with server side information $(document).ready(function(){ userLocale = document.getElementById('PYBOSSA_USER_LOCALE').textContent.trim(); }); function i18n_translate() { var ids = Object.keys(messages[userLocale]) for (i=0; i<ids.length; i++) { console.log("Translating: " + ids[i]); if (document.getElementById(ids[i])) { document.getElementById(ids[i]).innerHTML = messages[userLocale][ids[i]]; } } } function loadUserProgress() { pybossa.userProgress('dd').done(function(data){ var pct = Math.round((data.done*100)/data.total); $("#progress").css("width", pct.toString() +"%"); $("#progress").attr("title", pct.toString() + "% completed!"); $("#progress").tooltip({'placement': 'left'}); $("#total").text(data.total); $("#done").text(data.done); }); } pybossa.taskLoaded(function(task, deferred) { if ( !$.isEmptyObject(task) ) { // load image from flickr var img1 = $('<img />'); var img2 = $('<img />'); img1.load(function() { // continue as soon as the image is loaded deferred.resolve(task); pybossaNotify("", false, "loading"); }); img1.attr('id','pic1'); img1.attr('src', task.info.pic1).css('height', 300); img1.addClass('img-thumbnail'); img2.load(function() { // continue as soon as the image is loaded deferred.resolve(task); pybossaNotify("", false, "loading"); }); img2.attr('id','pic2'); img2.attr('src', task.info.pic2).css('height', 300); img2.addClass('img-thumbnail'); task.info.image1 = img1; task.info.image2 = img2; } else { deferred.resolve(task); } }); function sleep (time) { return new Promise((resolve) => setTimeout(resolve, time)); } pybossa.presentTask(function(task, deferred) { if (!$.isEmptyObject(task)) { // i18n_translate(); var whole_width = 500; $('#photo-link1').html('').append(task.info.image1); var image1 = $('#pic1'); image1.one('load', function(){ var img1_padding = ((whole_width - image1.width()) / 2).toString() + "px"; image1.css("background", "#000000"); image1.css("padding-left", img1_padding); image1.css("padding-right", img1_padding); }).each(function() { if (this.complete) $(this).load(); }); $('#photo-link2').html('').append(task.info.image2); var image2 = $('#pic2'); image2.one('load', function(){ var img2_padding = ((whole_width - image2.width()) / 2).toString() + "px"; image2.css("background", "#000000"); image2.css("padding-left", img2_padding); image2.css("padding-right", img2_padding); }).each(function() { if (this.complete) $(this).load(); }); // $("#photo-link").attr("href", task.info.link); $('#task-id').html(task.id); $('.a-answer').off('click').on('click', function(evt) { var btn = $(this); var answer = btn.attr("value"); if (typeof answer != 'undefined') { pybossa.saveTask(task.id, answer).done(function() { pybossaNotify("Loading picture...", true, "loading"); deferred.resolve(); }); if ($("#disqus_thread").is(":visible")) { $('#disqus_thread').toggle(); $('.btn-disqus').toggle(); } console.log('finish answer'); } else { pybossaNotify("Oops... Something went wrong.", true, "error"); } }); pybossaNotify("Loading picture...", false, "loading"); url = window.location.href; index = url.indexOf(task.id.toString()); pre_id = task.id; } else { url = window.location.href; var url_list = url.split('/'); if (url_list[url_list.length - 1] == 'newtask') { $(".skeleton").hide(); pybossaNotify("Loading picture...", false, "loading"); pybossaNotify("Thanks! You have participated in all available tasks. Enjoy some of your time!", true, "info"); return; } var new_url = url.substring(0, index) + (pre_id + 1).toString(); var query_url = url_list[0] + "//" + url_list[2]+ "/api/task/" + (pre_id + 1).toString(); var i = 0; sleep(10000).then(() => { $.get(query_url, function() { window.location.href = new_url; }).fail(function(){ $(".skeleton").hide(); pybossaNotify("Loading picture...", false, "loading"); pybossaNotify("Thanks! You have participated in all available tasks. Enjoy some of your time!", true, "info"); }); }); } }); pybossa.run('${short_name}'); })(); </script> """
45.263052
183
0.557207
2,500
22,541
4.9396
0.1716
0.010365
0.008098
0.007288
0.793344
0.753502
0.727346
0.714633
0.690825
0.669447
0
0.018385
0.290582
22,541
497
184
45.354125
0.753862
0.13003
0
0.668342
0
0.067839
0.975745
0.26116
0
0
0
0
0
1
0.005025
false
0
0.002513
0
0.015075
0
0
0
0
null
0
0
0
0
1
1
1
0
1
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
5
772778323b600fd1a40a5a6fe431e3637b3ec57d
165
py
Python
covid19api.py
clambin/covid19mon
78a2f7144f4b15c707208115ea99bea772eb95f6
[ "MIT" ]
null
null
null
covid19api.py
clambin/covid19mon
78a2f7144f4b15c707208115ea99bea772eb95f6
[ "MIT" ]
1
2020-11-16T20:57:01.000Z
2020-11-16T20:57:01.000Z
covid19api.py
clambin/covid19mon
78a2f7144f4b15c707208115ea99bea772eb95f6
[ "MIT" ]
null
null
null
from covid19.apiserver.apiserver import main from covid19.apiserver.configuration import get_configuration if __name__ == '__main__': main(get_configuration())
27.5
61
0.812121
19
165
6.526316
0.473684
0.177419
0.322581
0
0
0
0
0
0
0
0
0.027211
0.109091
165
5
62
33
0.816327
0
0
0
0
0
0.048485
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
1
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
1
0
1
0
0
0
0
5
7728affc446017b4e60f4673080a507a14adba71
519
py
Python
flaskr/utils.py
NBens/TTS-Web
f3f961c9336946223778b8b041a48da3fa24289b
[ "BSD-2-Clause" ]
null
null
null
flaskr/utils.py
NBens/TTS-Web
f3f961c9336946223778b8b041a48da3fa24289b
[ "BSD-2-Clause" ]
null
null
null
flaskr/utils.py
NBens/TTS-Web
f3f961c9336946223778b8b041a48da3fa24289b
[ "BSD-2-Clause" ]
null
null
null
from uuid import uuid4 from hashlib import md5 def generate_salt(): """ Generates a random string to use for password generation """ return uuid4().hex[:8].upper() def generate_password_from_salt(salt, password): string = salt + password + "KEY123" return md5(string.encode('utf-8')).hexdigest() def empty(string): return not bool(string.strip()) def allowed_file(filename, allowed_extensions): return '.' in filename and \ filename.rsplit('.', 1)[1].lower() in allowed_extensions
30.529412
68
0.697495
69
519
5.144928
0.565217
0.061972
0
0
0
0
0
0
0
0
0
0.025701
0.175337
519
17
69
30.529412
0.803738
0.1079
0
0
1
0
0.028509
0
0
0
0
0
0
1
0.333333
false
0.166667
0.166667
0.166667
0.833333
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
1
0
1
0
1
1
0
0
5
7750f30a9c31ade14b11e481d59cdf0afba23c25
285
py
Python
src/tsclient/myexceptions.py
joarndt/ts_telegram_bot
fa801f0350a9c0150d17703812a0ddf0100af8d3
[ "MIT" ]
1
2019-04-21T19:31:29.000Z
2019-04-21T19:31:29.000Z
src/tsclient/myexceptions.py
joarndt/ts_telegram_bot
fa801f0350a9c0150d17703812a0ddf0100af8d3
[ "MIT" ]
null
null
null
src/tsclient/myexceptions.py
joarndt/ts_telegram_bot
fa801f0350a9c0150d17703812a0ddf0100af8d3
[ "MIT" ]
null
null
null
from socket import error class TeamspeakConnectionError(error): pass class TeamspeakConnectionLost(TeamspeakConnectionError): pass class TeamspeakConnectionTelnetEOF(TeamspeakConnectionLost): pass class TeamspeakConnectionFailed(TeamspeakConnectionError): pass
15.833333
60
0.817544
20
285
11.65
0.5
0.11588
0
0
0
0
0
0
0
0
0
0
0.140351
285
17
61
16.764706
0.95102
0
0
0.444444
0
0
0
0
0
0
0
0
0
1
0
true
0.444444
0.111111
0
0.555556
0
1
0
1
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
1
0
0
1
0
0
5
624446c2c1b8bd55ee832e18fcd3a61d76f2ca58
9,426
py
Python
tests/integration/offer/condition_tests.py
endgame/django-oscar
e5d78436e20b55902537a6cc82edf4e22568f9d6
[ "BSD-3-Clause" ]
null
null
null
tests/integration/offer/condition_tests.py
endgame/django-oscar
e5d78436e20b55902537a6cc82edf4e22568f9d6
[ "BSD-3-Clause" ]
null
null
null
tests/integration/offer/condition_tests.py
endgame/django-oscar
e5d78436e20b55902537a6cc82edf4e22568f9d6
[ "BSD-3-Clause" ]
1
2019-07-10T06:32:14.000Z
2019-07-10T06:32:14.000Z
from decimal import Decimal from django.test import TestCase from oscar.apps.offer import models from oscar.apps.basket.models import Basket from oscar_testsupport.factories import create_product from tests.unit.offer import OfferTest class TestCountCondition(OfferTest): def setUp(self): super(TestCountCondition, self).setUp() self.condition = models.CountCondition( range=self.range, type="Count", value=2) def test_is_not_satified_by_empty_basket(self): self.assertFalse(self.condition.is_satisfied(self.basket)) def test_not_discountable_product_fails_condition(self): prod1, prod2 = create_product(), create_product() prod2.is_discountable = False prod2.save() self.basket.add_product(prod1) self.basket.add_product(prod2) self.assertFalse(self.condition.is_satisfied(self.basket)) def test_empty_basket_fails_partial_condition(self): self.assertFalse(self.condition.is_partially_satisfied(self.basket)) def test_smaller_quantity_basket_passes_partial_condition(self): self.basket.add_product(create_product(), 1) self.assertTrue(self.condition.is_partially_satisfied(self.basket)) def test_smaller_quantity_basket_upsell_message(self): self.basket.add_product(create_product(), 1) self.assertTrue('Buy 1 more product from ' in self.condition.get_upsell_message(self.basket)) def test_matching_quantity_basket_fails_partial_condition(self): self.basket.add_product(create_product(), 2) self.assertFalse(self.condition.is_partially_satisfied(self.basket)) def test_matching_quantity_basket_passes_condition(self): self.basket.add_product(create_product(), 2) self.assertTrue(self.condition.is_satisfied(self.basket)) def test_greater_quantity_basket_passes_condition(self): self.basket.add_product(create_product(), 3) self.assertTrue(self.condition.is_satisfied(self.basket)) def test_consumption(self): self.basket.add_product(create_product(), 3) self.condition.consume_items(self.basket, []) self.assertEquals(1, self.basket.all_lines()[0].quantity_without_discount) def test_is_satisfied_accounts_for_consumed_items(self): self.basket.add_product(create_product(), 3) self.condition.consume_items(self.basket, []) self.assertFalse(self.condition.is_satisfied(self.basket)) def test_count_condition_is_applied_multpile_times(self): benefit = models.AbsoluteDiscountBenefit(range=self.range, type="Absolute", value=Decimal('10.00')) for i in range(10): self.basket.add_product(create_product(price=Decimal('5.00'), upc='upc_%i' % i), 1) product_range = models.Range.objects.create(name="All products", includes_all_products=True) condition = models.CountCondition(range=product_range, type="Count", value=2) first_discount = benefit.apply(self.basket, condition=condition) self.assertEquals(Decimal('10.00'), first_discount) second_discount = benefit.apply(self.basket, condition=condition) self.assertEquals(Decimal('10.00'), second_discount) class ValueConditionTest(OfferTest): def setUp(self): super(ValueConditionTest, self).setUp() self.condition = models.ValueCondition(range=self.range, type="Value", value=Decimal('10.00')) self.item = create_product(price=Decimal('5.00')) self.expensive_item = create_product(price=Decimal('15.00')) def test_empty_basket_fails_condition(self): self.assertFalse(self.condition.is_satisfied(self.basket)) def test_empty_basket_fails_partial_condition(self): self.assertFalse(self.condition.is_partially_satisfied(self.basket)) def test_less_value_basket_fails_condition(self): self.basket.add_product(self.item, 1) self.assertFalse(self.condition.is_satisfied(self.basket)) def test_not_discountable_item_fails_condition(self): self.expensive_item.is_discountable = False self.expensive_item.save() self.basket.add_product(self.expensive_item, 1) self.assertFalse(self.condition.is_satisfied(self.basket)) def test_upsell_message(self): self.basket.add_product(self.item, 1) self.assertTrue('Spend' in self.condition.get_upsell_message(self.basket)) def test_matching_basket_fails_partial_condition(self): self.basket.add_product(self.item, 2) self.assertFalse(self.condition.is_partially_satisfied(self.basket)) def test_less_value_basket_passes_partial_condition(self): self.basket.add_product(self.item, 1) self.assertTrue(self.condition.is_partially_satisfied(self.basket)) def test_matching_basket_passes_condition(self): self.basket.add_product(self.item, 2) self.assertTrue(self.condition.is_satisfied(self.basket)) def test_greater_than_basket_passes_condition(self): self.basket.add_product(self.item, 3) self.assertTrue(self.condition.is_satisfied(self.basket)) def test_consumption(self): self.basket.add_product(self.item, 3) self.condition.consume_items(self.basket, []) self.assertEquals(1, self.basket.all_lines()[0].quantity_without_discount) def test_consumption_with_high_value_product(self): self.basket.add_product(self.expensive_item, 1) self.condition.consume_items(self.basket, []) self.assertEquals(0, self.basket.all_lines()[0].quantity_without_discount) def test_is_consumed_respects_quantity_consumed(self): self.basket.add_product(self.expensive_item, 1) self.assertTrue(self.condition.is_satisfied(self.basket)) self.condition.consume_items(self.basket, []) self.assertFalse(self.condition.is_satisfied(self.basket)) class TestCoverageCondition(TestCase): def setUp(self): self.products = [create_product(Decimal('5.00')), create_product(Decimal('10.00'))] self.range = models.Range.objects.create(name="Some products") for product in self.products: self.range.included_products.add(product) self.range.included_products.add(product) self.basket = Basket.objects.create() self.condition = models.CoverageCondition(range=self.range, type="Coverage", value=2) def test_empty_basket_fails(self): self.assertFalse(self.condition.is_satisfied(self.basket)) def test_empty_basket_fails_partial_condition(self): self.assertFalse(self.condition.is_partially_satisfied(self.basket)) def test_single_item_fails(self): self.basket.add_product(self.products[0]) self.assertFalse(self.condition.is_satisfied(self.basket)) def test_not_discountable_item_fails(self): self.products[0].is_discountable = False self.products[0].save() self.basket.add_product(self.products[0]) self.basket.add_product(self.products[1]) self.assertFalse(self.condition.is_satisfied(self.basket)) def test_single_item_passes_partial_condition(self): self.basket.add_product(self.products[0]) self.assertTrue(self.condition.is_partially_satisfied(self.basket)) def test_upsell_message(self): self.basket.add_product(self.products[0]) self.assertTrue('Buy 1 more' in self.condition.get_upsell_message(self.basket)) def test_duplicate_item_fails(self): self.basket.add_product(self.products[0]) self.basket.add_product(self.products[0]) self.assertFalse(self.condition.is_satisfied(self.basket)) def test_duplicate_item_passes_partial_condition(self): self.basket.add_product(self.products[0], 2) self.assertTrue(self.condition.is_partially_satisfied(self.basket)) def test_covering_items_pass(self): self.basket.add_product(self.products[0]) self.basket.add_product(self.products[1]) self.assertTrue(self.condition.is_satisfied(self.basket)) def test_covering_items_fail_partial_condition(self): self.basket.add_product(self.products[0]) self.basket.add_product(self.products[1]) self.assertFalse(self.condition.is_partially_satisfied(self.basket)) def test_covering_items_are_consumed(self): self.basket.add_product(self.products[0]) self.basket.add_product(self.products[1]) self.condition.consume_items(self.basket, []) self.assertEquals(0, self.basket.num_items_without_discount) def test_consumed_items_checks_affected_items(self): # Create new offer range = models.Range.objects.create(name="All products", includes_all_products=True) cond = models.CoverageCondition(range=range, type="Coverage", value=2) # Get 4 distinct products in the basket self.products.extend( [create_product(Decimal('15.00')), create_product(Decimal('20.00'))]) for product in self.products: self.basket.add_product(product) self.assertTrue(cond.is_satisfied(self.basket)) cond.consume_items(self.basket, []) self.assertEquals(2, self.basket.num_items_without_discount) self.assertTrue(cond.is_satisfied(self.basket)) cond.consume_items(self.basket, []) self.assertEquals(0, self.basket.num_items_without_discount)
43.437788
107
0.728305
1,203
9,426
5.456359
0.103907
0.127971
0.069317
0.106642
0.787782
0.739336
0.705667
0.683577
0.683577
0.659811
0
0.012686
0.163696
9,426
216
108
43.638889
0.819992
0.005729
0
0.521472
0
0
0.018465
0
0
0
0
0
0.245399
1
0.233129
false
0.055215
0.03681
0
0.288344
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
5
6263dc7a04dca494c0d233ba04943ba23a2e6977
1,977
py
Python
test/test_extractor.py
Usama0121/flashtext
04f6da5ddef290d780f31ecc3563c161fd2a2c70
[ "MIT" ]
5,330
2017-08-22T08:19:43.000Z
2022-03-31T06:17:29.000Z
test/test_extractor.py
Usama0121/flashtext
04f6da5ddef290d780f31ecc3563c161fd2a2c70
[ "MIT" ]
119
2017-08-20T11:42:54.000Z
2022-03-26T15:31:56.000Z
test/test_extractor.py
Usama0121/flashtext
04f6da5ddef290d780f31ecc3563c161fd2a2c70
[ "MIT" ]
666
2017-09-02T04:04:46.000Z
2022-03-31T06:17:24.000Z
from flashtext import KeywordProcessor import logging import unittest import json logger = logging.getLogger(__name__) class TestKeywordExtractor(unittest.TestCase): def setUp(self): logger.info("Starting...") with open('test/keyword_extractor_test_cases.json') as f: self.test_cases = json.load(f) def tearDown(self): logger.info("Ending.") def test_extract_keywords(self): """For each of the test case initialize a new KeywordProcessor. Add the keywords the test case to KeywordProcessor. Extract keywords and check if they match the expected result for the test case. """ for test_id, test_case in enumerate(self.test_cases): keyword_processor = KeywordProcessor() keyword_processor.add_keywords_from_dict(test_case['keyword_dict']) keywords_extracted = keyword_processor.extract_keywords(test_case['sentence']) self.assertEqual(keywords_extracted, test_case['keywords'], "keywords_extracted don't match the expected results for test case: {}".format(test_id)) def test_extract_keywords_case_sensitive(self): """For each of the test case initialize a new KeywordProcessor. Add the keywords the test case to KeywordProcessor. Extract keywords and check if they match the expected result for the test case. """ for test_id, test_case in enumerate(self.test_cases): keyword_processor = KeywordProcessor(case_sensitive=True) keyword_processor.add_keywords_from_dict(test_case['keyword_dict']) keywords_extracted = keyword_processor.extract_keywords(test_case['sentence']) self.assertEqual(keywords_extracted, test_case['keywords_case_sensitive'], "keywords_extracted don't match the expected results for test case: {}".format(test_id)) if __name__ == '__main__': unittest.main()
42.978261
117
0.693981
238
1,977
5.508403
0.264706
0.097635
0.050343
0.033562
0.713959
0.713959
0.713959
0.713959
0.713959
0.713959
0
0
0.227618
1,977
45
118
43.933333
0.858546
0.19474
0
0.285714
0
0
0.178548
0.039895
0
0
0
0
0.071429
1
0.142857
false
0
0.142857
0
0.321429
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
6553d7d3aa60c9705dc22356329ea7bffa951bbd
241
py
Python
Python/benchmark/tests/test_perfect_number.py
kkirstein/proglang-playground
d00be09ba2bb2351c6f5287cc4d93fcaf21f75fd
[ "MIT" ]
null
null
null
Python/benchmark/tests/test_perfect_number.py
kkirstein/proglang-playground
d00be09ba2bb2351c6f5287cc4d93fcaf21f75fd
[ "MIT" ]
null
null
null
Python/benchmark/tests/test_perfect_number.py
kkirstein/proglang-playground
d00be09ba2bb2351c6f5287cc4d93fcaf21f75fd
[ "MIT" ]
null
null
null
from benchmark.perfect_number import is_perfect def test_is_perfect(): assert not is_perfect(1) assert not is_perfect(2) assert is_perfect(6) assert not is_perfect(7) assert not is_perfect(27) assert is_perfect(28)
21.909091
47
0.73444
39
241
4.282051
0.410256
0.431138
0.263473
0.431138
0
0
0
0
0
0
0
0.041451
0.19917
241
10
48
24.1
0.823834
0
0
0
0
0
0
0
0
0
0
0
0.75
1
0.125
true
0
0.125
0
0.25
0
0
0
0
null
1
1
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
1
0
0
1
0
0
0
0
0
0
5
659875c1fe394f58f78c5d0cb55737044fa71350
173
py
Python
pybotters/models/experimental/__init__.py
maruuuui/pybotters
87adfef67ccd8b1c1782156a093be7f74cde5581
[ "MIT" ]
176
2021-03-24T14:48:56.000Z
2022-03-29T19:12:34.000Z
pybotters/models/experimental/__init__.py
maruuuui/pybotters
87adfef67ccd8b1c1782156a093be7f74cde5581
[ "MIT" ]
119
2021-03-25T03:04:26.000Z
2022-03-31T16:23:36.000Z
pybotters/models/experimental/__init__.py
maruuuui/pybotters
87adfef67ccd8b1c1782156a093be7f74cde5581
[ "MIT" ]
47
2021-03-25T02:53:55.000Z
2022-03-24T13:27:13.000Z
from typing import Tuple from .bybit import BybitInverseDataStore, BybitUSDTDataStore __all__: Tuple[str, ...] = ( 'BybitInverseDataStore', 'BybitUSDTDataStore', )
21.625
60
0.745665
14
173
8.928571
0.642857
0.624
0
0
0
0
0
0
0
0
0
0
0.150289
173
7
61
24.714286
0.85034
0
0
0
0
0
0.225434
0.121387
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
1
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
1
0
1
0
0
0
0
5
659956f98881db45b8892be7e25773ce42f2ec38
193
py
Python
output/models/sun_data/elem_decl/name/name008/name00802/name00802_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
1
2021-08-14T17:59:21.000Z
2021-08-14T17:59:21.000Z
output/models/sun_data/elem_decl/name/name008/name00802/name00802_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
4
2020-02-12T21:30:44.000Z
2020-04-15T20:06:46.000Z
output/models/sun_data/elem_decl/name/name008/name00802/name00802_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
null
null
null
from output.models.sun_data.elem_decl.name.name008.name00802.name00802_xsd.name00802 import ( A1234561, A1234562, Root, ) __all__ = [ "A1234561", "A1234562", "Root", ]
16.083333
93
0.663212
21
193
5.761905
0.761905
0.264463
0.330579
0
0
0
0
0
0
0
0
0.300654
0.207254
193
11
94
17.545455
0.490196
0
0
0
0
0
0.103627
0
0
0
0
0
0
1
0
false
0
0.1
0
0.1
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
1
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
5
65b9d2ea48d0079c7d56f6723665dd93e2a46d1f
28
py
Python
main/views/share/error/__init__.py
tiberiucorbu/av-website
f26f44a367d718316442506b130a7034697670b8
[ "MIT" ]
null
null
null
main/views/share/error/__init__.py
tiberiucorbu/av-website
f26f44a367d718316442506b130a7034697670b8
[ "MIT" ]
null
null
null
main/views/share/error/__init__.py
tiberiucorbu/av-website
f26f44a367d718316442506b130a7034697670b8
[ "MIT" ]
null
null
null
from error_handler import *
14
27
0.821429
4
28
5.5
1
0
0
0
0
0
0
0
0
0
0
0
0.142857
28
1
28
28
0.916667
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
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
1
0
1
0
0
0
0
5
65db799da501e72e268e0570a32422a4b5b34de7
24
py
Python
asn1tools/version.py
cromulencellc/asn1tools
30eb88e287cc1616903858aa96ee8791a4d7bf1c
[ "MIT" ]
null
null
null
asn1tools/version.py
cromulencellc/asn1tools
30eb88e287cc1616903858aa96ee8791a4d7bf1c
[ "MIT" ]
null
null
null
asn1tools/version.py
cromulencellc/asn1tools
30eb88e287cc1616903858aa96ee8791a4d7bf1c
[ "MIT" ]
null
null
null
__version__ = '0.161.0'
12
23
0.666667
4
24
3
0.75
0
0
0
0
0
0
0
0
0
0
0.238095
0.125
24
1
24
24
0.333333
0
0
0
0
0
0.291667
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
65e25a46e30e9a1a14bfdc8ed75a6410288196f0
249
py
Python
phy/cluster/__init__.py
fjflores/phy
eb068da48521060f8de45a2c546658015f9515dd
[ "BSD-3-Clause" ]
118
2019-06-03T06:19:43.000Z
2022-03-25T00:05:26.000Z
phy/cluster/__init__.py
fjflores/phy
eb068da48521060f8de45a2c546658015f9515dd
[ "BSD-3-Clause" ]
761
2015-01-08T11:17:41.000Z
2019-05-27T16:12:08.000Z
phy/cluster/__init__.py
fjflores/phy
eb068da48521060f8de45a2c546658015f9515dd
[ "BSD-3-Clause" ]
70
2019-05-30T11:05:26.000Z
2022-03-30T11:51:23.000Z
# -*- coding: utf-8 -*- # flake8: noqa """Manual clustering facilities.""" from ._utils import ClusterMeta, UpdateInfo from .clustering import Clustering from .supervisor import Supervisor, ClusterView, SimilarityView from .views import * # noqa
24.9
63
0.751004
27
249
6.888889
0.62963
0
0
0
0
0
0
0
0
0
0
0.009346
0.140562
249
9
64
27.666667
0.859813
0.281125
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
65e7eecdff3372f3f23fd4aeaa1cb08ac1749f87
270
py
Python
app/admin/__init__.py
codacy-badger/FASTFOODFAST-API
3ddb2715dd2b19bf0eae823b5a17c3a01e963a53
[ "MIT" ]
1
2018-10-05T12:36:17.000Z
2018-10-05T12:36:17.000Z
app/admin/__init__.py
codacy-badger/FASTFOODFAST-API
3ddb2715dd2b19bf0eae823b5a17c3a01e963a53
[ "MIT" ]
1
2018-09-06T17:06:27.000Z
2018-09-06T20:39:59.000Z
app/admin/__init__.py
codacy-badger/FASTFOODFAST-API
3ddb2715dd2b19bf0eae823b5a17c3a01e963a53
[ "MIT" ]
8
2018-09-10T12:04:58.000Z
2020-08-06T17:57:12.000Z
from flask import Blueprint from .admin_views import Foods, SpecificOrder, SpecificFoodItem, AcceptFoodOrders, AcceptedOrders, RejectFoodOrders, CompletedOrders, CompleteFoodOrders, GetOrders, OrderHistoryForSpecificUser admin_blueprint = Blueprint("admin", __name__)
45
192
0.855556
23
270
9.782609
0.73913
0
0
0
0
0
0
0
0
0
0
0
0.085185
270
5
193
54
0.910931
0
0
0
0
0
0.018519
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0.666667
1
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
1
0
1
1
0
5
02aa83396d54d20ab7d98728030e3a1d0ad67ae1
426
py
Python
swagger_server/models/__init__.py
espretto/demo-garage
1cb7a5a56838d565f9dfb8d1b7ce39ed58fe179d
[ "MIT" ]
null
null
null
swagger_server/models/__init__.py
espretto/demo-garage
1cb7a5a56838d565f9dfb8d1b7ce39ed58fe179d
[ "MIT" ]
null
null
null
swagger_server/models/__init__.py
espretto/demo-garage
1cb7a5a56838d565f9dfb8d1b7ce39ed58fe179d
[ "MIT" ]
null
null
null
# coding: utf-8 # flake8: noqa from __future__ import absolute_import # import models into model package from swagger_server.models.api_response import ApiResponse from swagger_server.models.car import Car from swagger_server.models.car_detail import CarDetail from swagger_server.models.car_update import CarUpdate from swagger_server.models.garage import Garage from swagger_server.models.garage_detail import GarageDetail
35.5
60
0.861502
61
426
5.770492
0.409836
0.1875
0.289773
0.392045
0.386364
0
0
0
0
0
0
0.005195
0.096244
426
11
61
38.727273
0.909091
0.138498
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
1
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
1
0
1
0
1
0
0
5
f319c13606232fd61dd1a221c930f8aafe4cc58d
64
py
Python
social_auth/backends/contrib/flickr.py
merutak/django-social-auth
3a6e4414da0e969fcaf625a891852a3b2d7627c0
[ "BSD-2-Clause", "BSD-3-Clause" ]
863
2015-01-01T00:42:07.000Z
2022-03-30T02:47:18.000Z
social_auth/backends/contrib/flickr.py
merutak/django-social-auth
3a6e4414da0e969fcaf625a891852a3b2d7627c0
[ "BSD-2-Clause", "BSD-3-Clause" ]
101
2015-01-08T00:28:16.000Z
2022-03-07T03:11:19.000Z
social_auth/backends/contrib/flickr.py
merutak/django-social-auth
3a6e4414da0e969fcaf625a891852a3b2d7627c0
[ "BSD-2-Clause", "BSD-3-Clause" ]
256
2015-01-02T16:55:36.000Z
2022-03-04T11:10:47.000Z
from social.backends.flickr import FlickrOAuth as FlickrBackend
32
63
0.875
8
64
7
1
0
0
0
0
0
0
0
0
0
0
0
0.09375
64
1
64
64
0.965517
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
b83a9cbe865961405104f5d9a80258680dae0522
815
py
Python
modules/nltk_contrib/classifier/basicimports.py
h4ck3rm1k3/NLP-project
aeba6302f60d27a8b9e65ad28d2d74e1276c7cd6
[ "MIT" ]
123
2015-01-06T10:46:18.000Z
2022-02-01T10:05:16.000Z
nltk_contrib/classifier/basicimports.py
silky/nltk_contrib
c152bde901f05915e90b07a615b232adb123bed8
[ "Apache-2.0" ]
12
2015-01-13T06:27:18.000Z
2020-07-30T23:00:41.000Z
nltk_contrib/classifier/basicimports.py
silky/nltk_contrib
c152bde901f05915e90b07a615b232adb123bed8
[ "Apache-2.0" ]
114
2015-01-13T04:47:49.000Z
2021-11-13T08:16:02.000Z
from nltk_contrib.classifier.attribute import Attribute, Attributes from nltk_contrib.classifier.confusionmatrix import ConfusionMatrix from nltk_contrib.classifier.decisionstump import DecisionStump from nltk_contrib.classifier.decisiontree import DecisionTree from nltk_contrib.classifier.featureselect import FeatureSelection from nltk_contrib.classifier.discretise import Discretiser from nltk_contrib.classifier.instances import TrainingInstances, TestInstances, GoldInstances from nltk_contrib.classifier.instance import TrainingInstance, TestInstance, GoldInstance from nltk_contrib.classifier.knn import IB1 from nltk_contrib.classifier.naivebayes import NaiveBayes from nltk_contrib.classifier.oner import OneR from nltk_contrib.classifier.zeror import ZeroR from nltk_contrib.classifier.format import c45
58.214286
93
0.892025
96
815
7.4375
0.302083
0.145658
0.273109
0.455182
0
0
0
0
0
0
0
0.003958
0.069939
815
13
94
62.692308
0.937995
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
1
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
1
0
1
0
1
0
0
5
b87449c981f4c82bb7439639d1ae0ac7633d9a80
215
py
Python
operations/Annotation/Database.py
BioGRID/CUP-LIMS
5901e0a3e4d804483669c00cc6f904bf7f181dbc
[ "MIT" ]
2
2017-01-15T09:28:49.000Z
2020-06-19T10:54:41.000Z
operations/ViewGenerator/Database.py
BioGRID/ORCA
5901e0a3e4d804483669c00cc6f904bf7f181dbc
[ "MIT" ]
27
2017-02-01T08:06:41.000Z
2017-03-31T08:24:31.000Z
operations/sgRNAProcessing/Database.py
BioGRID/CUP-LIMS
5901e0a3e4d804483669c00cc6f904bf7f181dbc
[ "MIT" ]
2
2016-10-29T05:45:43.000Z
2017-03-22T22:29:16.000Z
# Basic Database Connection Setup import MySQLdb import MySQLdb.cursors import Config db = MySQLdb.connect( Config.DB_HOST, Config.DB_USER, Config.DB_PASS, Config.DB_MAIN, cursorclass=MySQLdb.cursors.DictCursor )
26.875
126
0.818605
30
215
5.733333
0.533333
0.232558
0
0
0
0
0
0
0
0
0
0
0.102326
215
8
126
26.875
0.891192
0.144186
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.25
0.75
0
0.75
0
0
0
0
null
1
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
1
1
0
1
0
0
5
b89578438faa87607b6e0a6bf07c1e5a22487b85
147
py
Python
4_Data_Driven_Testing/Iterators/generator_test.py
turovod/Otus
57433c6944bca155177b07ff361139ff30f7f692
[ "MIT" ]
null
null
null
4_Data_Driven_Testing/Iterators/generator_test.py
turovod/Otus
57433c6944bca155177b07ff361139ff30f7f692
[ "MIT" ]
null
null
null
4_Data_Driven_Testing/Iterators/generator_test.py
turovod/Otus
57433c6944bca155177b07ff361139ff30f7f692
[ "MIT" ]
null
null
null
def ddd(): for i in 'fasdffghdfghjhfgj': yield i a = ddd() print(next(a)) print(next(a)) print(next(a)) print(next(a)) print(next(a))
13.363636
33
0.605442
25
147
3.56
0.4
0.505618
0.561798
0.674157
0.561798
0.561798
0.561798
0.561798
0.561798
0.561798
0
0
0.197279
147
10
34
14.7
0.754237
0
0
0.555556
0
0
0.115646
0
0
0
0
0
0
1
0.111111
false
0
0
0
0.111111
0.555556
1
0
0
null
1
1
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
1
0
5
b89a8e04b826c791daa8236fa21d9d57e69ac96a
125
py
Python
IFSensor/api/v1/manage.py
andrevdl/IFSensor
f77059f7e0c49e3ba39a524a6918206d203153b9
[ "MIT" ]
null
null
null
IFSensor/api/v1/manage.py
andrevdl/IFSensor
f77059f7e0c49e3ba39a524a6918206d203153b9
[ "MIT" ]
null
null
null
IFSensor/api/v1/manage.py
andrevdl/IFSensor
f77059f7e0c49e3ba39a524a6918206d203153b9
[ "MIT" ]
null
null
null
from flask.views import MethodView class ManageAPI(MethodView): def get(self, action): return {"action": action}
25
34
0.704
15
125
5.866667
0.8
0
0
0
0
0
0
0
0
0
0
0
0.192
125
5
35
25
0.871287
0
0
0
0
0
0.047619
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
1
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
1
0
0
0
1
1
0
0
5
b8a5f8ec8fc4c51ab418278daec0e6e3966e8a23
81
py
Python
poc-env.py
jmmorlesin/docker-python
1ed87741572ec4550e5270760b6a021b66ca9c88
[ "MIT" ]
null
null
null
poc-env.py
jmmorlesin/docker-python
1ed87741572ec4550e5270760b6a021b66ca9c88
[ "MIT" ]
1
2021-06-01T23:50:30.000Z
2021-06-01T23:50:30.000Z
poc-env.py
jmmorlesin/docker-python
1ed87741572ec4550e5270760b6a021b66ca9c88
[ "MIT" ]
null
null
null
import os print('Environment variable value: {}'.format(os.environ['ENV_VAR']))
20.25
69
0.728395
11
81
5.272727
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.08642
81
3
70
27
0.783784
0
0
0
0
0
0.45679
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.5
1
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
1
0
1
0
0
1
0
5
b22a5e5333e6ad9eff813a58535b4e68018ad681
84
py
Python
src/algebra.py
alex-knaub/math-adventures-python
dd1c763289b64658342441a6762ea2584e2e448d
[ "MIT" ]
null
null
null
src/algebra.py
alex-knaub/math-adventures-python
dd1c763289b64658342441a6762ea2584e2e448d
[ "MIT" ]
null
null
null
src/algebra.py
alex-knaub/math-adventures-python
dd1c763289b64658342441a6762ea2584e2e448d
[ "MIT" ]
null
null
null
def equation(a, b, c, d): return (d - b) / (a - c) print(equation(2, 5, 0, 13))
21
28
0.511905
17
84
2.529412
0.705882
0
0
0
0
0
0
0
0
0
0
0.079365
0.25
84
4
29
21
0.603175
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
0.666667
0.333333
1
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
1
0
0
0
1
1
0
0
5
a2592904573824f2699f09291c431e78e748e9b5
17,201
py
Python
project/annotations/tests/test_misc.py
beijbom/coralnet
c3f4a44eeb60cb41a079329a0068dc8b34096e89
[ "BSD-2-Clause" ]
31
2019-12-08T14:22:52.000Z
2021-12-27T04:58:12.000Z
project/annotations/tests/test_misc.py
beijbom/coralnet
c3f4a44eeb60cb41a079329a0068dc8b34096e89
[ "BSD-2-Clause" ]
193
2019-12-07T23:27:43.000Z
2022-03-05T08:05:46.000Z
project/annotations/tests/test_misc.py
beijbom/coralnet
c3f4a44eeb60cb41a079329a0068dc8b34096e89
[ "BSD-2-Clause" ]
null
null
null
import math from unittest import skip from bs4 import BeautifulSoup from django.urls import reverse from annotations.model_utils import AnnotationAreaUtils from annotations.tasks import update_sitewide_annotation_count_task from annotations.utils import get_sitewide_annotation_count from images.model_utils import PointGen from lib.tests.utils import BasePermissionTest, ClientTest class PermissionTest(BasePermissionTest): """ Test page and Ajax-submit permissions for misc. views. """ def test_annotation_area_edit(self): img = self.upload_image(self.user, self.source) url = reverse('annotation_area_edit', args=[img.pk]) template = 'annotations/annotation_area_edit.html' self.source_to_private() self.assertPermissionLevel( url, self.SOURCE_EDIT, template=template) self.source_to_public() self.assertPermissionLevel( url, self.SOURCE_EDIT, template=template) class SitewideAnnotationCountTest(ClientTest): """ Test the task which computes the site-wide annotation count. """ @classmethod def setUpTestData(cls): super().setUpTestData() cls.user = cls.create_user() cls.source = cls.create_source(cls.user) labels = cls.create_labels(cls.user, ['A', 'B'], "Group1") cls.create_labelset(cls.user, cls.source, labels) cls.img = cls.upload_image(cls.user, cls.source) cls.add_annotations(cls.user, cls.img, {1: 'A', 2: 'B', 3: 'A'}) def test_set_on_demand(self): self.assertEqual(get_sitewide_annotation_count(), 3) def test_set_in_advance(self): update_sitewide_annotation_count_task.delay() self.assertEqual(get_sitewide_annotation_count(), 3) def test_set_then_update(self): update_sitewide_annotation_count_task.delay() self.assertEqual(get_sitewide_annotation_count(), 3) self.add_annotations(self.user, self.img, {4: 'B'}) update_sitewide_annotation_count_task.delay() self.assertEqual(get_sitewide_annotation_count(), 4) def test_caching(self): update_sitewide_annotation_count_task.delay() self.assertEqual(get_sitewide_annotation_count(), 3) self.add_annotations(self.user, self.img, {4: 'B'}) self.assertEqual(get_sitewide_annotation_count(), 3) class AnnotationAreaEditTest(ClientTest): """ Test the annotation area edit page. """ @classmethod def setUpTestData(cls): super().setUpTestData() cls.user = cls.create_user() cls.source = cls.create_source( cls.user, min_x=19, max_x=62, min_y=7, max_y=90.2) cls.img = cls.upload_image( cls.user, cls.source, image_options=dict(width=40, height=50)) cls.url = reverse('annotation_area_edit', args=[cls.img.pk]) def test_load_page_with_source_annotation_area(self): self.client.force_login(self.user) response = self.client.get(self.url) response_soup = BeautifulSoup(response.content, 'html.parser') self.assertEqual( '7', response_soup.find('input', dict(name='min_x')).attrs.get('value')) self.assertEqual( '24', response_soup.find('input', dict(name='max_x')).attrs.get('value')) self.assertEqual( '3', response_soup.find('input', dict(name='min_y')).attrs.get('value')) self.assertEqual( '45', response_soup.find('input', dict(name='max_y')).attrs.get('value')) def test_load_page_with_image_specific_annotation_area(self): # Set an image specific annotation area self.client.force_login(self.user) self.client.post( self.url, data=dict(min_x=8, max_x=36, min_y=0, max_y=18)) # Ensure it's loaded on the next visit response = self.client.get(self.url) response_soup = BeautifulSoup(response.content, 'html.parser') self.assertEqual( '8', response_soup.find('input', dict(name='min_x')).attrs.get('value')) self.assertEqual( '36', response_soup.find('input', dict(name='max_x')).attrs.get('value')) self.assertEqual( '0', response_soup.find('input', dict(name='min_y')).attrs.get('value')) self.assertEqual( '18', response_soup.find('input', dict(name='max_y')).attrs.get('value')) def test_change_annotation_area(self): self.client.force_login(self.user) response = self.client.post( self.url, data=dict(min_x=8, max_x=36, min_y=0, max_y=18), follow=True) self.assertContains(response, "Annotation area successfully edited.") self.img.metadata.refresh_from_db() self.assertEqual( self.img.metadata.annotation_area, AnnotationAreaUtils.pixels_to_db_format(8, 36, 0, 18), msg="Annotation area should be successfully changed") def test_min_or_max_past_limits(self): self.client.force_login(self.user) response = self.client.post( self.url, data=dict(min_x=-1, max_x=39, min_y=0, max_y=49)) self.assertContains(response, "Please correct the errors below.") self.assertContains( response, "Ensure this value is greater than or equal to 0.") response = self.client.post( self.url, data=dict(min_x=0, max_x=40, min_y=0, max_y=49)) self.assertContains( response, "Ensure this value is less than or equal to 39.") response = self.client.post( self.url, data=dict(min_x=0, max_x=39, min_y=-1, max_y=49)) self.assertContains(response, "Please correct the errors below.") self.assertContains( response, "Ensure this value is greater than or equal to 0.") response = self.client.post( self.url, data=dict(min_x=0, max_x=39, min_y=0, max_y=50)) self.assertContains( response, "Ensure this value is less than or equal to 49.") response = self.client.post( self.url, data=dict(min_x=0, max_x=39, min_y=0, max_y=49), follow=True) self.assertContains( response, "Annotation area successfully edited.") @skip( "There's a bug in the behavior here." " Need to fix that in the annotation area edit form.") def test_min_exceeds_max(self): self.client.force_login(self.user) response = self.client.post( self.url, data=dict(min_x=30, max_x=29, min_y=29, max_y=30)) self.assertContains(response, "Please correct the errors below.") self.assertContains( response, "The right boundary x must be greater than or equal to" " the left boundary x.") response = self.client.post( self.url, data=dict(min_x=0, max_x=1, min_y=1, max_y=0)) self.assertContains( response, "The bottom boundary y must be greater than or equal to" " the top boundary y.") def test_non_integers(self): self.client.force_login(self.user) response = self.client.post( self.url, data=dict(min_x=8, max_x=36, min_y=0, max_y='a')) self.assertContains(response, "Please correct the errors below.") self.assertContains(response, "Enter a whole number.") response = self.client.post( self.url, data=dict(min_x=8.28, max_x=36, min_y=0, max_y=18)) self.assertContains(response, "Please correct the errors below.") self.assertContains(response, "Enter a whole number.") # TODO: Test blank fields class PointGenTest(ClientTest): """ Test generation of annotation points. """ @classmethod def setUpTestData(cls): super().setUpTestData() cls.user = cls.create_user() def assertPointsAreInBounds(self, points, bounds): """ Check that every Point in the given points array is within the bounds specified. bounds is a dict of pixel-position boundaries. For example, dict(min_x=0, max_x=19, min_y=0, max_y=29) """ for pt in points: self.assertTrue(bounds['min_x'] <= pt.column) self.assertTrue(pt.column <= bounds['max_x']) self.assertTrue(bounds['min_y'] <= pt.row) self.assertTrue(pt.row <= bounds['max_y']) def test_simple_random_whole_image(self): source = self.create_source( self.user, point_generation_type=PointGen.Types.SIMPLE, simple_number_of_points=100, min_x=0, max_x=100, min_y=0, max_y=100) # Make the resolution small so that we have a good chance of # testing the annotation area boundaries. img = self.upload_image( self.user, source, image_options=dict(width=20, height=30)) points = img.point_set.all() self.assertEqual( points.count(), 100, "Should generate the correct number of points") self.assertPointsAreInBounds( points, dict(min_x=0, max_x=19, min_y=0, max_y=29)) def test_simple_random_source_annotation_area(self): source = self.create_source( self.user, point_generation_type=PointGen.Types.SIMPLE, simple_number_of_points=100, min_x=19, max_x=62, min_y=7, max_y=90.2) img = self.upload_image( self.user, source, image_options=dict(width=40, height=50)) points = img.point_set.all() self.assertEqual( points.count(), 100, "Should generate the correct number of points") self.assertPointsAreInBounds( points, dict( min_x=math.floor((19/100)*40), max_x=math.floor((62/100)*40), min_y=math.floor((7/100)*50), max_y=math.floor((90.2/100)*50))) def test_simple_random_image_specific_annotation_area(self): source = self.create_source( self.user, point_generation_type=PointGen.Types.SIMPLE, simple_number_of_points=100) img = self.upload_image( self.user, source, image_options=dict(width=40, height=50)) self.client.force_login(self.user) self.client.post( reverse('annotation_area_edit', args=[img.pk]), data=dict(min_x=8, max_x=36, min_y=0, max_y=18)) points = img.point_set.all() self.assertEqual( points.count(), 100, "Should generate the correct number of points") self.assertPointsAreInBounds( points, dict(min_x=8, max_x=36, min_y=0, max_y=18)) def test_stratified_random_whole_image(self): source = self.create_source( self.user, point_generation_type=PointGen.Types.STRATIFIED, number_of_cell_columns=5, number_of_cell_rows=4, stratified_points_per_cell=6, min_x=0, max_x=100, min_y=0, max_y=100) img = self.upload_image( self.user, source, image_options=dict(width=20, height=30)) points = img.point_set.all().order_by('point_number') self.assertEqual( points.count(), 5*4*6, "Should generate the correct number of points") # Check the strata in order by point number. That's row by row, # top to bottom, left to right. point_index = 0 for min_y, max_y in [(0,6), (7,14), (15,21), (22,29)]: for min_x, max_x in [(0,3), (4,7), (8,11), (12,15), (16,19)]: self.assertPointsAreInBounds( points[point_index:point_index+6], dict(min_x=min_x, max_x=max_x, min_y=min_y, max_y=max_y)) point_index += 6 def test_stratified_random_source_annotation_area(self): source = self.create_source( self.user, point_generation_type=PointGen.Types.STRATIFIED, number_of_cell_columns=5, number_of_cell_rows=4, stratified_points_per_cell=6, min_x=19, max_x=62, min_y=7, max_y=90.2) img = self.upload_image( self.user, source, image_options=dict(width=20, height=30)) points = img.point_set.all().order_by('point_number') self.assertEqual( points.count(), 5*4*6, "Should generate the correct number of points") # Check the strata in order by point number. That's row by row, # top to bottom, left to right. point_index = 0 for min_y, max_y in [(2,7), (8,14), (15,20), (21,27)]: for min_x, max_x in [(3,4), (5,6), (7,8), (9,10), (11,12)]: self.assertPointsAreInBounds( points[point_index:point_index+6], dict(min_x=min_x, max_x=max_x, min_y=min_y, max_y=max_y)) point_index += 6 def test_stratified_random_image_specific_annotation_area(self): source = self.create_source( self.user, point_generation_type=PointGen.Types.STRATIFIED, number_of_cell_columns=5, number_of_cell_rows=4, stratified_points_per_cell=6) img = self.upload_image( self.user, source, image_options=dict(width=40, height=50)) self.client.force_login(self.user) self.client.post( reverse('annotation_area_edit', args=[img.pk]), data=dict(min_x=8, max_x=36, min_y=0, max_y=18)) points = img.point_set.all() self.assertEqual( points.count(), 5*4*6, "Should generate the correct number of points") # Check the strata in order by point number. That's row by row, # top to bottom, left to right. point_index = 0 for min_y, max_y in [(0,3), (4,8), (9,13), (14,18)]: for min_x, max_x in [(8,12), (13,18), (19,24), (25,30), (31,36)]: self.assertPointsAreInBounds( points[point_index:point_index+6], dict(min_x=min_x, max_x=max_x, min_y=min_y, max_y=max_y)) point_index += 6 def test_uniform_grid_whole_image(self): source = self.create_source( self.user, point_generation_type=PointGen.Types.UNIFORM, number_of_cell_columns=5, number_of_cell_rows=4, min_x=0, max_x=100, min_y=0, max_y=100) img = self.upload_image( self.user, source, image_options=dict(width=20, height=30)) points = img.point_set.all().order_by('point_number') self.assertEqual( points.count(), 5*4, "Should generate the correct number of points") # Check the points in order by point number. That's row by row, # top to bottom, left to right. point_index = 0 for y in [3, 10, 18, 25]: for x in [1, 5, 9, 13, 17]: self.assertEqual(x, points[point_index].column) self.assertEqual(y, points[point_index].row) point_index += 1 def test_uniform_grid_source_annotation_area(self): source = self.create_source( self.user, point_generation_type=PointGen.Types.UNIFORM, number_of_cell_columns=5, number_of_cell_rows=4, min_x=19, max_x=62, min_y=7, max_y=90.2) img = self.upload_image( self.user, source, image_options=dict(width=20, height=30)) points = img.point_set.all().order_by('point_number') self.assertEqual( points.count(), 5*4, "Should generate the correct number of points") # Check the points in order by point number. That's row by row, # top to bottom, left to right. point_index = 0 for y in [4, 11, 17, 24]: for x in [3, 5, 7, 9, 11]: self.assertEqual(x, points[point_index].column) self.assertEqual(y, points[point_index].row) point_index += 1 def test_uniform_grid_image_specific_annotation_area(self): source = self.create_source( self.user, point_generation_type=PointGen.Types.UNIFORM, number_of_cell_columns=5, number_of_cell_rows=4) img = self.upload_image( self.user, source, image_options=dict(width=40, height=50)) self.client.force_login(self.user) self.client.post( reverse('annotation_area_edit', args=[img.pk]), data=dict(min_x=8, max_x=36, min_y=0, max_y=18)) points = img.point_set.all() self.assertEqual( points.count(), 5*4, "Should generate the correct number of points") # Check the points in order by point number. That's row by row, # top to bottom, left to right. point_index = 0 for y in [1, 6, 11, 16]: for x in [10, 15, 21, 27, 33]: self.assertEqual(x, points[point_index].column) self.assertEqual(y, points[point_index].row) point_index += 1
39.182232
79
0.613569
2,337
17,201
4.314078
0.108686
0.01468
0.016663
0.013489
0.797957
0.784864
0.774945
0.767407
0.747074
0.719599
0
0.03626
0.273705
17,201
438
80
39.27169
0.770752
0.065345
0
0.667665
0
0
0.094716
0.002319
0
0
0
0.002283
0.173653
1
0.071856
false
0
0.026946
0
0.110778
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
a2ab9c50127e6366a820bc61c05864bf57a78603
2,573
py
Python
services/traction/tests/unit/services/v1/test_invitation_parser.py
bcgov/traction
90cec4f1aebccd68eb986cb89dfae5819a07a2ee
[ "Apache-2.0" ]
12
2022-01-29T20:30:03.000Z
2022-03-29T11:46:14.000Z
services/traction/tests/unit/services/v1/test_invitation_parser.py
bcgov/traction
90cec4f1aebccd68eb986cb89dfae5819a07a2ee
[ "Apache-2.0" ]
38
2021-11-22T17:52:50.000Z
2022-03-31T17:52:00.000Z
services/traction/tests/unit/services/v1/test_invitation_parser.py
bcgov/traction
90cec4f1aebccd68eb986cb89dfae5819a07a2ee
[ "Apache-2.0" ]
9
2021-11-22T18:05:48.000Z
2022-03-29T11:25:08.000Z
import pytest from api.services.v1 import invitation_parser pytestmark = pytest.mark.asyncio async def test_uri_to_url(): street_cred_redirect = "id.streetcred://launch/?d_m=eyJsYWJlbCI6IlNuYXBwZXIiLCJpbWFnZVVybCI6bnVsbCwic2VydmljZUVuZHBvaW50IjoiaHR0cHM6Ly90cmluc2ljLW1lZGlhdG9yLWFnZW50LWV1cm9wZS5henVyZXdlYnNpdGVzLm5ldC8iLCJyb3V0aW5nS2V5cyI6WyJDTFBmc3hVaDNMOWR2U2huNjRmYkZKZExrbzZHbmVhQkNEWkJQNjZpWVV3RCJdLCJyZWNpcGllbnRLZXlzIjpbIkc5cDVydVRqcDJiVHhWellIUVpySmZISkNDaENRVUpOVllrUWhTcGlmWTdkIl0sIkBpZCI6IjBiNTc1Zjc4LTNiNTQtNGFhNS1hMzMyLTcwNTljZDg5YzA1NiIsIkB0eXBlIjoiZGlkOnNvdjpCekNic05ZaE1yakhpcVpEVFVBU0hnO3NwZWMvY29ubmVjdGlvbnMvMS4wL2ludml0YXRpb24ifQ%3D%3D&orig=https%3a%2f%2fredir.trinsic.id%2f46yG3VegpCqc" url = invitation_parser.uri_to_url(street_cred_redirect, True) assert url.query async def test_check_invitation_redirect(): trinsic_redirect = "https://trinsic.studio/url/0158bf62-ef48-47ac-b9d7-4f9467bc01e6" result = await invitation_parser.check_invitation(trinsic_redirect) assert result.invitation assert result.invitation_block assert result.label async def test_check_invitation_oob(): oob = "http://traction-agent:8030?oob=eyJAdHlwZSI6ICJodHRwczovL2RpZGNvbW0ub3JnL291dC1vZi1iYW5kLzEuMC9pbnZpdGF0aW9uIiwgIkBpZCI6ICI5ZGNjY2U2OS1iOGQ4LTQ4ODAtODQyNS1lMzYwOTU1Yzk1ZWMiLCAic2VydmljZXMiOiBbeyJpZCI6ICIjaW5saW5lIiwgInR5cGUiOiAiZGlkLWNvbW11bmljYXRpb24iLCAicmVjaXBpZW50S2V5cyI6IFsiZGlkOmtleTp6Nk1raXZtVkpmRVc3cXN6eUJ0MmlacFUzZ2Y1eGk2UXJhenJHNzFQOTNuQWJUMVUiXSwgInNlcnZpY2VFbmRwb2ludCI6ICJodHRwOi8vdHJhY3Rpb24tYWdlbnQ6ODAzMCJ9XSwgImhhbmRzaGFrZV9wcm90b2NvbHMiOiBbImh0dHBzOi8vZGlkY29tbS5vcmcvZGlkZXhjaGFuZ2UvMS4wIl0sICJsYWJlbCI6ICJxd2VydHkifQ==" result = await invitation_parser.check_invitation(oob) assert result.invitation assert result.invitation_block assert result.label async def test_parse_invitation_oob(): oob = "eyJAdHlwZSI6ICJodHRwczovL2RpZGNvbW0ub3JnL291dC1vZi1iYW5kLzEuMC9pbnZpdGF0aW9uIiwgIkBpZCI6ICI5ZGNjY2U2OS1iOGQ4LTQ4ODAtODQyNS1lMzYwOTU1Yzk1ZWMiLCAic2VydmljZXMiOiBbeyJpZCI6ICIjaW5saW5lIiwgInR5cGUiOiAiZGlkLWNvbW11bmljYXRpb24iLCAicmVjaXBpZW50S2V5cyI6IFsiZGlkOmtleTp6Nk1raXZtVkpmRVc3cXN6eUJ0MmlacFUzZ2Y1eGk2UXJhenJHNzFQOTNuQWJUMVUiXSwgInNlcnZpY2VFbmRwb2ludCI6ICJodHRwOi8vdHJhY3Rpb24tYWdlbnQ6ODAzMCJ9XSwgImhhbmRzaGFrZV9wcm90b2NvbHMiOiBbImh0dHBzOi8vZGlkY29tbS5vcmcvZGlkZXhjaGFuZ2UvMS4wIl0sICJsYWJlbCI6ICJxd2VydHkifQ==" result = invitation_parser.parse_invitation(oob) assert result.invitation assert result.invitation_block assert result.label assert result.oob assert result.parsed
65.974359
591
0.907112
146
2,573
15.767123
0.383562
0.057341
0.057341
0.03649
0.180712
0.162467
0.107732
0.107732
0.107732
0.107732
0
0.090535
0.055577
2,573
38
592
67.710526
0.85679
0
0
0.333333
0
0.037037
0.650467
0.416407
0
1
0
0
0.444444
1
0
false
0
0.074074
0
0.074074
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
1
0
0
1
0
0
0
0
0
0
0
0
0
5
a2cea66548e00af09da0511a61139b30aab016da
4,968
py
Python
tests/test_mgaclient.py
key/ublox-mga-py
48390a1411df146edaf44c28ade28eb14788d18b
[ "MIT" ]
null
null
null
tests/test_mgaclient.py
key/ublox-mga-py
48390a1411df146edaf44c28ade28eb14788d18b
[ "MIT" ]
39
2018-10-18T20:18:40.000Z
2021-08-02T20:17:18.000Z
tests/test_mgaclient.py
key/ublox-mga-py
48390a1411df146edaf44c28ade28eb14788d18b
[ "MIT" ]
null
null
null
import os import uuid from io import BytesIO from unittest import TestCase from unittest.mock import patch class MGAClientTestCase(TestCase): def make_response(self): from requests import Response raw_data = b'mga binary code' response = Response() response.status_code = 200 response.raw = BytesIO(raw_data) response.headers = { 'Content-Type': 'application/octet-stream', 'Content-Length': len(raw_data) } return response def test_make_parameters(self): from mgaclient import MGAClient from mgaclient.consts import DATATYPE_EPHEMERIS, DATATYPE_ALMANAC, DATATYPE_AUX, DATATYPE_POS from mgaclient.consts import FORMAT_MGA, FORMAT_AID from mgaclient.consts import GNSS_GPS, GNSS_QZSS, GNSS_BEIDOU, GNSS_GALILEO, GNSS_GLONASS class Item: def __init__(self, token, datatype, dataformat, gnss, result): self.token = token self.datatype = datatype self.dataformat = dataformat self.gnss = gnss self.result = result items = [ Item('tokenA', [DATATYPE_EPHEMERIS], FORMAT_AID, [GNSS_GPS], { 'token': 'tokenA', 'datatype': 'eph', 'format': 'aid', 'gnss': 'gps', }), Item('tokenB', [DATATYPE_EPHEMERIS, DATATYPE_ALMANAC], FORMAT_MGA, [GNSS_GPS, GNSS_QZSS], { 'token': 'tokenB', 'datatype': 'eph,alm', 'format': 'mga', 'gnss': 'gps,qzss', }), Item('tokenC', [DATATYPE_EPHEMERIS, DATATYPE_ALMANAC, DATATYPE_AUX], FORMAT_MGA, [GNSS_GPS, GNSS_QZSS, GNSS_GLONASS], { 'token': 'tokenC', 'datatype': 'eph,alm,aux', 'format': 'mga', 'gnss': 'gps,qzss,glo', }), Item('tokenD', [DATATYPE_POS], FORMAT_MGA, [GNSS_BEIDOU, GNSS_GALILEO], { 'token': 'tokenD', 'datatype': 'pos', 'format': 'mga', 'gnss': 'bds,gal', }), ] for item in items: client = MGAClient(item.token, item.datatype, item.dataformat, item.gnss) self.assertDictEqual(item.result, client.make_parameter()) def test_make_encoded_parameter(self): from mgaclient import MGAClient from mgaclient.consts import DATATYPE_EPHEMERIS, DATATYPE_ALMANAC, DATATYPE_AUX, DATATYPE_POS from mgaclient.consts import FORMAT_MGA, FORMAT_AID from mgaclient.consts import GNSS_GPS, GNSS_QZSS, GNSS_BEIDOU, GNSS_GALILEO, GNSS_GLONASS class Item: def __init__(self, token, datatype, dataformat, gnss, result): self.token = token self.datatype = datatype self.dataformat = dataformat self.gnss = gnss self.result = result items = [ Item('tokenA', [DATATYPE_EPHEMERIS], FORMAT_AID, [GNSS_GPS], 'token=tokenA&datatype=eph&format=aid&gnss=gps'), Item('tokenB', [DATATYPE_EPHEMERIS, DATATYPE_ALMANAC], FORMAT_MGA, [GNSS_GPS, GNSS_QZSS], 'token=tokenB&datatype=eph,alm&format=mga&gnss=gps,qzss'), Item('tokenC', [DATATYPE_EPHEMERIS, DATATYPE_ALMANAC, DATATYPE_AUX], FORMAT_MGA, [GNSS_GPS, GNSS_QZSS, GNSS_GLONASS], 'token=tokenC&datatype=eph,alm,aux&format=mga&gnss=gps,qzss,glo'), Item('tokenD', [DATATYPE_POS], FORMAT_MGA, [GNSS_BEIDOU, GNSS_GALILEO], 'token=tokenD&datatype=pos&format=mga&gnss=bds,gal'), ] for item in items: client = MGAClient(item.token, item.datatype, item.dataformat, item.gnss) self.assertEqual(item.result, client.make_encoded_parameter()) def test_get(self): with patch('requests.get', return_value=self.make_response()) as p: from mgaclient import MGAClient client = MGAClient('token', timeout=0) client.get() self.assertEqual('https://online-live1.services.u-blox.com/GetOnlineData.ashx?token=token&datatype=eph,alm,aux&format=mga&gnss=gps,qzss', p.call_args[0][0]) def test_save(self): test_filename = '%s.bin' % uuid.uuid4() try: with patch('requests.get', return_value=self.make_response()): from mgaclient import MGAClient client = MGAClient('token', timeout=0) client.save(test_filename) self.assertTrue(os.path.exists(test_filename)) with open(test_filename, 'br') as f: self.assertEqual(b'mga binary code', f.read()) finally: if os.path.exists(test_filename): os.unlink(test_filename)
39.11811
168
0.578301
530
4,968
5.243396
0.201887
0.048579
0.060813
0.051817
0.734437
0.717164
0.717164
0.717164
0.717164
0.670025
0
0.002636
0.312802
4,968
126
169
39.428571
0.811365
0
0
0.394231
0
0.019231
0.136675
0.047101
0
0
0
0
0.048077
1
0.067308
false
0
0.153846
0
0.259615
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
a2f6d5648472c198d5a0f4d8d0a4218b14ca9846
67
py
Python
nhget/__init__.py
urain39/Nhget
b5a8a8cf5f05d7245c3370b7917d8ff5ec312102
[ "Apache-2.0" ]
1
2019-02-03T08:04:56.000Z
2019-02-03T08:04:56.000Z
ezreq/__init__.py
urain39/ezReq
d655243e7412e1e6086bd36ae6301180817411a8
[ "Apache-2.0" ]
6
2019-02-04T19:44:41.000Z
2019-09-14T22:51:04.000Z
nhget/__init__.py
urain39/Nhget
b5a8a8cf5f05d7245c3370b7917d8ff5ec312102
[ "Apache-2.0" ]
1
2020-02-29T03:42:36.000Z
2020-02-29T03:42:36.000Z
# Copyright (C) 2019 urain39 <urain39@qq.com> from .base import *
16.75
45
0.701493
10
67
4.7
0.9
0
0
0
0
0
0
0
0
0
0
0.142857
0.164179
67
3
46
22.333333
0.696429
0.641791
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
0c303c7c243fc1f0b75d5d20912a4dabfb08b8d9
216
py
Python
exercises/concept/log-levels/enums.py
gsilvapt/python
d675468b2437d4c09c358d023ef998a05a781f58
[ "MIT" ]
1
2021-09-04T18:42:47.000Z
2021-09-04T18:42:47.000Z
exercises/concept/log-levels/enums.py
gsilvapt/python
d675468b2437d4c09c358d023ef998a05a781f58
[ "MIT" ]
11
2021-05-12T06:08:19.000Z
2022-03-02T12:10:44.000Z
exercises/concept/log-levels/enums.py
gsilvapt/python
d675468b2437d4c09c358d023ef998a05a781f58
[ "MIT" ]
1
2021-09-05T15:33:52.000Z
2021-09-05T15:33:52.000Z
from enum import Enum class LogLevel(Enum): pass def parse_log_level(message): pass def convert_to_short_log(log_level, message): pass def get_warn_alias(): pass def get_members(): pass
9.818182
45
0.694444
32
216
4.40625
0.5625
0.198582
0.212766
0.269504
0.312057
0
0
0
0
0
0
0
0.231481
216
21
46
10.285714
0.849398
0
0
0.454545
0
0
0
0
0
0
0
0
0
1
0.363636
false
0.454545
0.090909
0
0.545455
0
0
0
0
null
0
1
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
1
0
1
0
0
1
0
0
5
0c3f5436f0fbb01be13ed03eb4cd317e2a4cb04b
93
py
Python
neuroir/inputters/__init__.py
niazangels/context_attentive_ir
989fbfee5a0ac6b7ac7429bdee36fe6ed93ee234
[ "MIT" ]
77
2019-07-23T09:40:31.000Z
2021-12-16T06:51:29.000Z
neuroir/inputters/__init__.py
niazangels/context_attentive_ir
989fbfee5a0ac6b7ac7429bdee36fe6ed93ee234
[ "MIT" ]
11
2019-08-13T09:34:15.000Z
2021-12-14T02:41:55.000Z
neuroir/inputters/__init__.py
niazangels/context_attentive_ir
989fbfee5a0ac6b7ac7429bdee36fe6ed93ee234
[ "MIT" ]
22
2019-10-03T03:37:30.000Z
2021-09-14T05:52:44.000Z
__author__ = 'wasi' from .constants import * from .vocabulary import * from . import ranker
15.5
25
0.741935
11
93
5.909091
0.636364
0.307692
0
0
0
0
0
0
0
0
0
0
0.172043
93
5
26
18.6
0.844156
0
0
0
0
0
0.043011
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
1
0
0
null
1
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
1
0
1
0
0
5
a7657682ecdfefe7100a4f2bdcace4100492b3ab
70
py
Python
mindsdb/api/mysql/mysql_proxy/datahub/__init__.py
yarenty/mindsdb
9164bca6f45fd0f5ec329babe973f286ffe59709
[ "MIT" ]
261
2018-09-28T02:32:17.000Z
2018-12-10T06:30:54.000Z
mindsdb/api/mysql/mysql_proxy/datahub/__init__.py
yarenty/mindsdb
9164bca6f45fd0f5ec329babe973f286ffe59709
[ "MIT" ]
27
2018-09-26T08:49:11.000Z
2018-12-10T14:42:52.000Z
mindsdb/api/mysql/mysql_proxy/datahub/__init__.py
yarenty/mindsdb
9164bca6f45fd0f5ec329babe973f286ffe59709
[ "MIT" ]
46
2018-10-06T10:11:18.000Z
2018-12-10T04:02:17.000Z
from mindsdb.api.mysql.mysql_proxy.datahub.datahub import init_datahub
70
70
0.885714
11
70
5.454545
0.727273
0
0
0
0
0
0
0
0
0
0
0
0.042857
70
1
70
70
0.895522
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
a767c914c4dbc159d2ff3e93259453fde5a72f58
3,167
py
Python
WishTalk/util/token.py
BillBillBillBill/WishTalk-server
4bb9bbe5b877d344805450fe2060799aa35d2e1a
[ "MIT" ]
null
null
null
WishTalk/util/token.py
BillBillBillBill/WishTalk-server
4bb9bbe5b877d344805450fe2060799aa35d2e1a
[ "MIT" ]
null
null
null
WishTalk/util/token.py
BillBillBillBill/WishTalk-server
4bb9bbe5b877d344805450fe2060799aa35d2e1a
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from api import GlobalError from jsonResponse import jsonError from functools import wraps from server import redisClient, db from flask import request from model.user import User def token_required(func): '''check token required decorator''' @wraps(func) def _wrapped(*args, **kwargs): # 将ImmutableMultiDict变成Dict类型 request.args = request.args.to_dict() # 如果值为空字符串 删掉对应的键 否则后面的request.args.get()会出问题 for k, v in request.args.items(): if v == '': request.args.pop(k) # print request.args token = request.args.get('token', None) or request.form.get('token', None) if not token: if request.json == None: return jsonError(GlobalError.TOKEN_VALIFY_FAILED), 401 else: token = request.json.get('token', None) if not token: return jsonError(GlobalError.TOKEN_VALIFY_FAILED), 401 try: if len(token.split('$')) == 4: userid = token.split('$')[1] if redisClient.get("token:"+str(userid)) == token: user = User.query.get(userid) if request.method == "POST" and user.is_blocked: return jsonError(GlobalError.OPERATION_BLOCKED_BY_ADMIN), 403 kwargs['current_user'] = user return func(*args, **kwargs) else: return jsonError(GlobalError.TOKEN_VALIFY_FAILED), 401 else: return jsonError(GlobalError.TOKEN_VALIFY_FAILED), 401 except Exception, e: db.session.rollback() err = GlobalError.UNDEFINED_ERROR err['msg'] = str(e) return jsonError(err), 403 return _wrapped def token_required_unnecessary(func): @wraps(func) def _wrapped(*args, **kwargs): # 将ImmutableMultiDict变成Dict类型 request.args = request.args.to_dict() # 如果值为空字符串 删掉对应的键 否则后面的request.args.get()会出问题 for k, v in request.args.items(): if v == '': request.args.pop(k) token = request.args.get('token', None) or request.form.get('token', None) if not token and request.json: token = request.json.get('token', None) try: if not token: kwargs['current_user'] = None return func(*args, **kwargs) if len(token.split('$')) == 4: userid = token.split('$')[1] if redisClient.get("token:"+str(userid)) == token: user = User.query.get(userid) kwargs['current_user'] = user return func(*args, **kwargs) else: return jsonError(GlobalError.TOKEN_VALIFY_FAILED), 401 else: return jsonError(GlobalError.TOKEN_VALIFY_FAILED), 401 except Exception,e: db.session.rollback() err = GlobalError.UNDEFINED_ERROR err['msg'] = str(e) return jsonError(err), 403 return _wrapped
39.5875
85
0.55131
335
3,167
5.122388
0.241791
0.070513
0.106061
0.108392
0.748252
0.748252
0.70979
0.682984
0.653846
0.653846
0
0.015348
0.341648
3,167
80
86
39.5875
0.807674
0.058099
0
0.814286
0
0
0.031282
0
0
0
0
0
0
0
null
null
0
0.085714
null
null
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
5
a7949b45c01cfb8a8c8c2f320786506a56beebc8
107
py
Python
tests/test_methods/test_elections.py
NationalJournal/py-votesmart
9194f28564d8d005386f498b1fc915cc7772f38b
[ "BSD-3-Clause" ]
7
2018-03-08T16:33:02.000Z
2020-12-22T08:12:31.000Z
tests/test_methods/test_elections.py
NationalJournal/py-votesmart
9194f28564d8d005386f498b1fc915cc7772f38b
[ "BSD-3-Clause" ]
7
2018-02-13T02:40:29.000Z
2018-03-08T17:04:53.000Z
tests/test_methods/test_elections.py
NationalJournal/py-votesmart
9194f28564d8d005386f498b1fc915cc7772f38b
[ "BSD-3-Clause" ]
4
2018-02-13T13:41:28.000Z
2021-12-21T22:14:54.000Z
from votesmart.methods.elections import * def test_Election(): method = Election(api_instance='test')
21.4
42
0.757009
13
107
6.076923
0.846154
0
0
0
0
0
0
0
0
0
0
0
0.130841
107
4
43
26.75
0.849462
0
0
0
0
0
0.037383
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0
0.666667
0
1
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
1
0
0
1
0
1
0
0
5
a7b6c9692eb8be9e3a291d50e429e74b1951edcc
58
py
Python
__init__.py
pashango2/finder_object
67dbbf62081a593f6636704ef11bdcd1c1662085
[ "MIT" ]
null
null
null
__init__.py
pashango2/finder_object
67dbbf62081a593f6636704ef11bdcd1c1662085
[ "MIT" ]
null
null
null
__init__.py
pashango2/finder_object
67dbbf62081a593f6636704ef11bdcd1c1662085
[ "MIT" ]
null
null
null
from .finder_object import FinderObject, PopupFinderObject
58
58
0.896552
6
58
8.5
1
0
0
0
0
0
0
0
0
0
0
0
0.068966
58
1
58
58
0.944444
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
ac5dda10f6100383b2d4fee6653852f76a7508ad
30
py
Python
keggler/training/__init__.py
mlisovyi/Keggler
053caa84648b34f8f790ae6323a18674e1e51778
[ "MIT" ]
2
2019-01-10T04:00:34.000Z
2022-01-21T05:03:47.000Z
keggler/training/__init__.py
mlisovyi/Keggler
053caa84648b34f8f790ae6323a18674e1e51778
[ "MIT" ]
null
null
null
keggler/training/__init__.py
mlisovyi/Keggler
053caa84648b34f8f790ae6323a18674e1e51778
[ "MIT" ]
null
null
null
from .training_utils import *
15
29
0.8
4
30
5.75
1
0
0
0
0
0
0
0
0
0
0
0
0.133333
30
1
30
30
0.884615
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
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
1
0
1
0
0
0
0
5
ac65c544cde825f13da82ed448dcc3c9086d7a38
6,943
py
Python
tests/dataverk/views/constants.py
navikt/dataverk
7dd803236433048686dd7a58358bc1c09565b14b
[ "MIT" ]
3
2019-09-29T20:48:46.000Z
2021-03-31T10:16:07.000Z
tests/dataverk/views/constants.py
navikt/dataverk
7dd803236433048686dd7a58358bc1c09565b14b
[ "MIT" ]
148
2019-02-08T12:30:58.000Z
2021-03-11T15:31:55.000Z
tests/dataverk/views/constants.py
navikt/dataverk
7dd803236433048686dd7a58358bc1c09565b14b
[ "MIT" ]
1
2020-11-18T14:10:05.000Z
2020-11-18T14:10:05.000Z
PLOT_JSON = {"data":[{"name":"plotly graph","type":"scatter","x":[1,2,3],"y":[3,4,5]}],"layout":{"template":{"data":{"bar":[{"error_x":{"color":"#2a3f5f"},"error_y":{"color":"#2a3f5f"},"marker":{"line":{"color":"#E5ECF6","width":0.5}},"type":"bar"}],"barpolar":[{"marker":{"line":{"color":"#E5ECF6","width":0.5}},"type":"barpolar"}],"carpet":[{"aaxis":{"endlinecolor":"#2a3f5f","gridcolor":"white","linecolor":"white","minorgridcolor":"white","startlinecolor":"#2a3f5f"},"baxis":{"endlinecolor":"#2a3f5f","gridcolor":"white","linecolor":"white","minorgridcolor":"white","startlinecolor":"#2a3f5f"},"type":"carpet"}],"choropleth":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"choropleth"}],"contour":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"contour"}],"contourcarpet":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"contourcarpet"}],"heatmap":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"heatmap"}],"heatmapgl":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"heatmapgl"}],"histogram":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"histogram"}],"histogram2d":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"histogram2d"}],"histogram2dcontour":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"histogram2dcontour"}],"mesh3d":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"mesh3d"}],"parcoords":[{"line":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"parcoords"}],"pie":[{"automargin":True,"type":"pie"}],"scatter":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatter"}],"scatter3d":[{"line":{"colorbar":{"outlinewidth":0,"ticks":""}},"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatter3d"}],"scattercarpet":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattercarpet"}],"scattergeo":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattergeo"}],"scattergl":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattergl"}],"scattermapbox":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattermapbox"}],"scatterpolar":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterpolar"}],"scatterpolargl":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterpolargl"}],"scatterternary":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterternary"}],"surface":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"surface"}],"table":[{"cells":{"fill":{"color":"#EBF0F8"},"line":{"color":"white"}},"header":{"fill":{"color":"#C8D4E3"},"line":{"color":"white"}},"type":"table"}]},"layout":{"annotationdefaults":{"arrowcolor":"#2a3f5f","arrowhead":0,"arrowwidth":1},"coloraxis":{"colorbar":{"outlinewidth":0,"ticks":""}},"colorscale":{"diverging":[[0,"#8e0152"],[0.1,"#c51b7d"],[0.2,"#de77ae"],[0.3,"#f1b6da"],[0.4,"#fde0ef"],[0.5,"#f7f7f7"],[0.6,"#e6f5d0"],[0.7,"#b8e186"],[0.8,"#7fbc41"],[0.9,"#4d9221"],[1,"#276419"]],"sequential":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"sequentialminus":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]},"colorway":["#636efa","#EF553B","#00cc96","#ab63fa","#FFA15A","#19d3f3","#FF6692","#B6E880","#FF97FF","#FECB52"],"font":{"color":"#2a3f5f"},"geo":{"bgcolor":"white","lakecolor":"white","landcolor":"#E5ECF6","showlakes":True,"showland":True,"subunitcolor":"white"},"hoverlabel":{"align":"left"},"hovermode":"closest","mapbox":{"style":"light"},"paper_bgcolor":"white","plot_bgcolor":"#E5ECF6","polar":{"angularaxis":{"gridcolor":"white","linecolor":"white","ticks":""},"bgcolor":"#E5ECF6","radialaxis":{"gridcolor":"white","linecolor":"white","ticks":""}},"scene":{"xaxis":{"backgroundcolor":"#E5ECF6","gridcolor":"white","gridwidth":2,"linecolor":"white","showbackground":True,"ticks":"","zerolinecolor":"white"},"yaxis":{"backgroundcolor":"#E5ECF6","gridcolor":"white","gridwidth":2,"linecolor":"white","showbackground":True,"ticks":"","zerolinecolor":"white"},"zaxis":{"backgroundcolor":"#E5ECF6","gridcolor":"white","gridwidth":2,"linecolor":"white","showbackground":True,"ticks":"","zerolinecolor":"white"}},"shapedefaults":{"line":{"color":"#2a3f5f"}},"ternary":{"aaxis":{"gridcolor":"white","linecolor":"white","ticks":""},"baxis":{"gridcolor":"white","linecolor":"white","ticks":""},"bgcolor":"#E5ECF6","caxis":{"gridcolor":"white","linecolor":"white","ticks":""}},"title":{"x":0.05},"xaxis":{"automargin":True,"gridcolor":"white","linecolor":"white","ticks":"","title":{"standoff":15},"zerolinecolor":"white","zerolinewidth":2},"yaxis":{"automargin":True,"gridcolor":"white","linecolor":"white","ticks":"","title":{"standoff":15},"zerolinecolor":"white","zerolinewidth":2}}},"xaxis":{"title":{"text":"col1"}},"yaxis":{"range":[0,6],"tickformat":",f","title":{"text":"col2"}}}}
6,943
6,943
0.660809
715
6,943
6.40979
0.226573
0.096007
0.100807
0.124809
0.721798
0.665939
0.579097
0.559022
0.545058
0.545058
0
0.234438
0.000432
6,943
1
6,943
6,943
0.425937
0
0
0
0
0
0.50144
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
1
0
0
1
1
1
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
3bb51c71f3379d207b2bf2cbca09830c586368e2
219
py
Python
applications/users/views/password.py
szypkiwonsz/Physiotherapy-Management-System
36decab47890e2f4be259c8796f47324ffad28fe
[ "MIT" ]
null
null
null
applications/users/views/password.py
szypkiwonsz/Physiotherapy-Management-System
36decab47890e2f4be259c8796f47324ffad28fe
[ "MIT" ]
8
2020-08-17T14:36:02.000Z
2022-03-12T00:33:50.000Z
applications/users/views/password.py
szypkiwonsz/Physiotherapy-Management-System
36decab47890e2f4be259c8796f47324ffad28fe
[ "MIT" ]
null
null
null
from django.contrib.auth.views import PasswordResetConfirmView from applications.users.forms import NewSetPasswordForm class NewPasswordResetConfirmView(PasswordResetConfirmView): form_class = NewSetPasswordForm
27.375
62
0.86758
19
219
9.947368
0.736842
0
0
0
0
0
0
0
0
0
0
0
0.091324
219
7
63
31.285714
0.949749
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
1
0.5
0
1
0
1
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
1
1
0
1
0
0
5
ce105ff4877ad560c766cfe0f567d7574a8e90da
43
py
Python
out/str2.py
FardaleM/metalang
171557c540f3e2c051ec39ea150afb740c1f615f
[ "BSD-2-Clause" ]
22
2017-04-24T10:00:45.000Z
2021-04-01T10:11:05.000Z
out/str2.py
FardaleM/metalang
171557c540f3e2c051ec39ea150afb740c1f615f
[ "BSD-2-Clause" ]
12
2017-03-26T18:34:21.000Z
2019-03-21T19:13:03.000Z
out/str2.py
FardaleM/metalang
171557c540f3e2c051ec39ea150afb740c1f615f
[ "BSD-2-Clause" ]
7
2017-10-14T13:33:33.000Z
2021-03-18T15:18:50.000Z
print("ma petite chaine en or", end='')
8.6
39
0.604651
7
43
3.714286
1
0
0
0
0
0
0
0
0
0
0
0
0.209302
43
4
40
10.75
0.764706
0
0
0
0
0
0.55
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
1
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
1
0
0
0
0
1
0
5
ce20897aea2f8c7ed36df0104e94648b9c4d642d
52
py
Python
quantpy/technical_indicators.py
jobryan/QuantPy
9ebc0db5ab1c05b0bae90232b479d82b1b6e05c1
[ "BSD-4-Clause" ]
1
2015-09-29T05:30:16.000Z
2015-09-29T05:30:16.000Z
quantpy/technical_indicators.py
jobryan/QuantPy
9ebc0db5ab1c05b0bae90232b479d82b1b6e05c1
[ "BSD-4-Clause" ]
null
null
null
quantpy/technical_indicators.py
jobryan/QuantPy
9ebc0db5ab1c05b0bae90232b479d82b1b6e05c1
[ "BSD-4-Clause" ]
null
null
null
def sma(): pass def ema(): pass
5.777778
12
0.384615
6
52
3.333333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.5
52
8
13
6.5
0.769231
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0.5
true
0.5
0
0
0.5
0
1
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
1
1
1
0
0
0
0
0
5
ce27102b98f4ee588570dd29a22efa34a8bc76b9
84
py
Python
lib/plantowerpycom/__init__.py
psidex/PyonAir-pycom
dfe9bb30256ae396799682990b1d53802f240f26
[ "MIT" ]
6
2019-08-07T13:56:43.000Z
2020-11-01T02:58:51.000Z
lib/plantowerpycom/__init__.py
psidex/PyonAir-pycom
dfe9bb30256ae396799682990b1d53802f240f26
[ "MIT" ]
78
2020-03-20T13:58:10.000Z
2021-07-29T08:24:57.000Z
lib/plantowerpycom/__init__.py
psidex/PyonAir-pycom
dfe9bb30256ae396799682990b1d53802f240f26
[ "MIT" ]
5
2019-08-08T10:23:35.000Z
2021-10-06T18:34:03.000Z
from plantowerpycom.plantower import PlantowerReading, Plantower, PlantowerException
84
84
0.904762
7
84
10.857143
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.059524
84
1
84
84
0.962025
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
1
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
1
0
1
0
0
0
0
5
cbfbd528a11ea7a8f32f81517a82723f0b8457e4
303
py
Python
tests/conftest.py
jonathdls/Naval_Architect-Marine_Analysis
8999b0724688b8c0b7ec5b5195a9e2d2af0bcc40
[ "MIT" ]
null
null
null
tests/conftest.py
jonathdls/Naval_Architect-Marine_Analysis
8999b0724688b8c0b7ec5b5195a9e2d2af0bcc40
[ "MIT" ]
null
null
null
tests/conftest.py
jonathdls/Naval_Architect-Marine_Analysis
8999b0724688b8c0b7ec5b5195a9e2d2af0bcc40
[ "MIT" ]
1
2021-07-05T15:52:51.000Z
2021-07-05T15:52:51.000Z
""" Configure truth tests """ import pytest @pytest.fixture(scope='module') def cost(): def _cost(argument): return argument yield _cost @pytest.fixture(scope='module') def stability_margin(): def _stability_margin(argument): return argument return _stability_margin
15.947368
36
0.693069
34
303
5.970588
0.441176
0.206897
0.17734
0.236453
0.26601
0
0
0
0
0
0
0
0.20132
303
18
37
16.833333
0.838843
0.069307
0
0.363636
0
0
0.043796
0
0
0
0
0
0
1
0.363636
false
0
0.090909
0.181818
0.727273
0
0
0
0
null
1
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
1
0
0
0
1
1
0
0
5
5a63ecd45658f22e66c171ada751fb33764d4559
53
py
Python
face_detection/detection/sfd/__init__.py
zhaniya-meruki/ZhaniyaKoishybayevaMasterThesis
4e6cabeea711ef70fbe72e7b648b29f94bca1a66
[ "MIT" ]
5,863
2017-09-19T01:26:21.000Z
2022-03-31T13:31:43.000Z
face_detection/detection/sfd/__init__.py
zhaniya-meruki/ZhaniyaKoishybayevaMasterThesis
4e6cabeea711ef70fbe72e7b648b29f94bca1a66
[ "MIT" ]
281
2017-09-20T07:49:44.000Z
2022-02-16T11:09:12.000Z
face_detection/detection/sfd/__init__.py
zhaniya-meruki/ZhaniyaKoishybayevaMasterThesis
4e6cabeea711ef70fbe72e7b648b29f94bca1a66
[ "MIT" ]
1,279
2017-09-19T07:02:18.000Z
2022-03-31T03:15:37.000Z
from .sfd_detector import SFDDetector as FaceDetector
53
53
0.886792
7
53
6.571429
1
0
0
0
0
0
0
0
0
0
0
0
0.09434
53
1
53
53
0.958333
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
5a6675208b81d9e3a83555577675b0c098fd9c1c
23
py
Python
sites/pycharm-guide/demos/tutorials/visual_pytest/setup/player.py
stevewhitmore/jetbrains_guide
234eb44a3ecc670048e4d02b3b5b39affe4a9e31
[ "Apache-2.0", "CC-BY-4.0" ]
16
2019-02-01T14:03:53.000Z
2019-08-18T13:57:33.000Z
sites/pycharm-guide/demos/tutorials/visual_pytest/setup/player.py
stevewhitmore/jetbrains_guide
234eb44a3ecc670048e4d02b3b5b39affe4a9e31
[ "Apache-2.0", "CC-BY-4.0" ]
3
2019-03-22T07:40:33.000Z
2019-04-03T16:04:35.000Z
sites/pycharm-guide/demos/tutorials/visual_pytest/setup/player.py
stevewhitmore/jetbrains_guide
234eb44a3ecc670048e4d02b3b5b39affe4a9e31
[ "Apache-2.0", "CC-BY-4.0" ]
2
2019-03-25T15:00:12.000Z
2019-08-18T13:57:36.000Z
class Player: pass
7.666667
13
0.652174
3
23
5
1
0
0
0
0
0
0
0
0
0
0
0
0.304348
23
2
14
11.5
0.9375
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
1
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
1
1
0
0
0
0
0
5
5a6dbfd6852de3a8c67b0acb340f21603909a605
142
py
Python
mmtrack/models/aggregators/__init__.py
sht47/mmtracking
5a25e418e9c598d1b576bce8702f5e156cbbefe7
[ "Apache-2.0" ]
2
2021-09-19T10:09:14.000Z
2021-09-24T13:46:58.000Z
mmtrack/models/aggregators/__init__.py
hellock/mmtracking
a22a36b2055d80cf4a7a5ef3913849abb56defcb
[ "Apache-2.0" ]
null
null
null
mmtrack/models/aggregators/__init__.py
hellock/mmtracking
a22a36b2055d80cf4a7a5ef3913849abb56defcb
[ "Apache-2.0" ]
1
2021-07-15T00:26:35.000Z
2021-07-15T00:26:35.000Z
from .embed_aggregator import EmbedAggregator from .selsa_aggregator import SelsaAggregator __all__ = ['EmbedAggregator', 'SelsaAggregator']
28.4
48
0.838028
13
142
8.692308
0.615385
0.283186
0
0
0
0
0
0
0
0
0
0
0.091549
142
4
49
35.5
0.875969
0
0
0
0
0
0.211268
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
1
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
1
0
1
0
0
5
ce528b995345426afe253fbaf001001f2574bd2c
131
py
Python
DeterministicParticleFlowControl/reweighting/__init__.py
dimitra-maoutsa/DeterministicParticleFlowControl
106bc9b01d7a4888e4ded18c5fb5a989fe672386
[ "MIT" ]
6
2021-12-13T14:30:31.000Z
2022-01-24T07:54:57.000Z
DeterministicParticleFlowControl/reweighting/__init__.py
dimitra-maoutsa/DeterministicParticleFlowControl
106bc9b01d7a4888e4ded18c5fb5a989fe672386
[ "MIT" ]
10
2021-12-18T23:04:53.000Z
2022-02-05T02:06:34.000Z
DeterministicParticleFlowControl/reweighting/__init__.py
dimitra-maoutsa/DeterministicParticleFlowControl
106bc9b01d7a4888e4ded18c5fb5a989fe672386
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Module providing particle reweighting functionality. """ from .optimal_transport_reweighting import *
18.714286
52
0.732824
13
131
7.230769
0.923077
0
0
0
0
0
0
0
0
0
0
0.008772
0.129771
131
6
53
21.833333
0.815789
0.572519
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
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
1
0
1
0
1
0
0
5
ce72047b32b2c0eacfd0facba5eb2b6c116f3fcc
83
py
Python
deepctr/__init__.py
lovesilent/DeepCTR
9f155590cc44c14821dcb691811656eb2ef2f49b
[ "Apache-2.0" ]
null
null
null
deepctr/__init__.py
lovesilent/DeepCTR
9f155590cc44c14821dcb691811656eb2ef2f49b
[ "Apache-2.0" ]
null
null
null
deepctr/__init__.py
lovesilent/DeepCTR
9f155590cc44c14821dcb691811656eb2ef2f49b
[ "Apache-2.0" ]
null
null
null
from .utils import check_version __version__ = '0.8.7' check_version(__version__)
16.6
32
0.795181
12
83
4.666667
0.666667
0.428571
0.678571
0
0
0
0
0
0
0
0
0.040541
0.108434
83
4
33
20.75
0.716216
0
0
0
0
0
0.060241
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
1
1
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
1
0
0
0
0
5
ce721aed061e906515c0221a5eadf8d2eba2112f
1,374
py
Python
dophon/tools/__init__.py
Ca11MeE/dophon
6737b0f0dc9ec2c2229865940c3c6d6ee326fc28
[ "Apache-2.0" ]
1
2018-08-13T09:57:34.000Z
2018-08-13T09:57:34.000Z
dophon/tools/__init__.py
Ca11MeE/dophon
6737b0f0dc9ec2c2229865940c3c6d6ee326fc28
[ "Apache-2.0" ]
null
null
null
dophon/tools/__init__.py
Ca11MeE/dophon
6737b0f0dc9ec2c2229865940c3c6d6ee326fc28
[ "Apache-2.0" ]
null
null
null
import platform def is_windows(): return 'Windows' == platform.system() def is_not_windows(): return not is_windows() def show_banner(): print(f""" .o8 oooo "888 `888 .oooo888 .ooooo. oo.ooooo. 888 .oo. .ooooo. ooo. .oo. d88' `888 d88' `88b 888' `88b 888P"Y88b d88' `88b `888P"Y88b 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 `Y8bod88P" `Y8bod8P' 888bod8P' o888o o888o `Y8bod8P' o888o o888o 888 o888o Author:CallMeE Base:Flask or Tornado Url:https://github.com/Ca11MeE/dophon.git https://gitee.com/callmee/dophon.git """) def module_edge_print(module_name): def fun(f): def fields(*args, **kwargs): print('------------------', module_name, '<start>------------------\n') f(*args, **kwargs) print('\n------------------', module_name, '<end>------------------\n\n\n') return fields return fun
34.35
119
0.402475
133
1,374
4.082707
0.383459
0.265193
0.364641
0.464088
0.132597
0.132597
0.132597
0.132597
0.132597
0.132597
0
0.193289
0.457787
1,374
39
120
35.230769
0.53557
0
0
0.068966
0
0.068966
0.707424
0.040757
0
0
0
0
0
1
0.206897
false
0
0.034483
0.068966
0.37931
0.137931
0
0
0
null
1
1
1
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
1
0
0
0
0
0
0
0
5
0c7e59605c4640cc172388fd861c25b9e3925088
155
py
Python
scripts/install_via_pip.py
irisTa56/markdown2textile
692ecea35a1fb18a6c3a141678b158f871d9a777
[ "MIT" ]
null
null
null
scripts/install_via_pip.py
irisTa56/markdown2textile
692ecea35a1fb18a6c3a141678b158f871d9a777
[ "MIT" ]
6
2019-06-18T03:20:39.000Z
2021-02-07T13:04:02.000Z
scripts/install_via_pip.py
irisTa56/markdown2textile
692ecea35a1fb18a6c3a141678b158f871d9a777
[ "MIT" ]
null
null
null
import sys import subprocess subprocess.run( [sys.executable, "-m", "pip", "install"] + sys.argv[1:], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
22.142857
58
0.709677
20
155
5.5
0.65
0.254545
0
0
0
0
0
0
0
0
0
0.007299
0.116129
155
6
59
25.833333
0.79562
0
0
0
0
0
0.077419
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
1
0
0
null
1
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
1
0
1
0
0
0
0
5
0c86b2a866cddca4d5fdfe123d31ddc724907695
69
py
Python
musicautobot/__init__.py
HalleyYoung/musicautobot
075afba70a57ebacfcd8d2bf9dc178a93c05a116
[ "MIT" ]
402
2019-07-31T00:37:10.000Z
2022-03-27T22:21:29.000Z
musicautobot/__init__.py
HalleyYoung/musicautobot
075afba70a57ebacfcd8d2bf9dc178a93c05a116
[ "MIT" ]
26
2019-08-20T13:44:30.000Z
2022-01-27T10:42:28.000Z
musicautobot/__init__.py
HalleyYoung/musicautobot
075afba70a57ebacfcd8d2bf9dc178a93c05a116
[ "MIT" ]
81
2019-08-14T06:55:55.000Z
2022-03-19T09:49:15.000Z
from .utils.setup_musescore import setup_musescore setup_musescore()
23
50
0.869565
9
69
6.333333
0.555556
0.736842
0
0
0
0
0
0
0
0
0
0
0.072464
69
3
51
23
0.890625
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
1
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
1
0
1
0
0
0
0
5
0c97ac15f9260fa0b531890eb547c1461f23fc86
193
py
Python
eelbrain/report/__init__.py
christianbrodbeck/Eelbrain
0c24abcc382abb590c062b8bc683f749265f564f
[ "BSD-3-Clause" ]
32
2015-04-05T15:38:55.000Z
2022-03-12T02:35:09.000Z
eelbrain/report/__init__.py
christianbrodbeck/Eelbrain
0c24abcc382abb590c062b8bc683f749265f564f
[ "BSD-3-Clause" ]
22
2015-07-14T14:55:44.000Z
2022-03-15T17:46:11.000Z
eelbrain/report/__init__.py
christianbrodbeck/Eelbrain
0c24abcc382abb590c062b8bc683f749265f564f
[ "BSD-3-Clause" ]
29
2015-04-23T13:51:09.000Z
2021-08-12T11:28:21.000Z
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from ._source import source_results, source_time_lm, source_time_results from ._uts import time_results from ._uv import scatter_table
32.166667
72
0.839378
27
193
5.62963
0.592593
0.131579
0.197368
0
0
0
0
0
0
0
0
0
0.103627
193
5
73
38.6
0.878613
0.279793
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
1
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
1
0
1
0
0
0
0
5