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
0e324cb472c89265003b53dea2b7e67e74145063
66
py
Python
custom/__init__.py
yoshitomo-matsubara/supervised-compression
6df52222c6407e8fac7d34d5e25b218910f686cf
[ "Apache-2.0" ]
12
2021-11-02T00:38:47.000Z
2022-03-15T12:57:03.000Z
custom/__init__.py
yoshitomo-matsubara/supervised-compression
6df52222c6407e8fac7d34d5e25b218910f686cf
[ "Apache-2.0" ]
null
null
null
custom/__init__.py
yoshitomo-matsubara/supervised-compression
6df52222c6407e8fac7d34d5e25b218910f686cf
[ "Apache-2.0" ]
1
2022-02-22T06:53:35.000Z
2022-02-22T06:53:35.000Z
from custom import loss, misc, model, optim, transform, processor
33
65
0.787879
9
66
5.777778
1
0
0
0
0
0
0
0
0
0
0
0
0.136364
66
1
66
66
0.912281
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
0e4c1b0c8a29daabe45dd2eb48db723cb4ccd09e
138
py
Python
src/clld_phylogeny_plugin/interfaces.py
clld/clld-phylogeny-plugin
097a49d4ae97d835130d33f56ae0140fe42c1c6a
[ "Apache-2.0" ]
1
2018-03-05T15:17:41.000Z
2018-03-05T15:17:41.000Z
src/clld_phylogeny_plugin/interfaces.py
clld/clld-phylogeny-plugin
097a49d4ae97d835130d33f56ae0140fe42c1c6a
[ "Apache-2.0" ]
10
2018-02-06T20:03:14.000Z
2021-07-12T13:08:48.000Z
src/clld_phylogeny_plugin/interfaces.py
clld/clld-phylogeny-plugin
097a49d4ae97d835130d33f56ae0140fe42c1c6a
[ "Apache-2.0" ]
1
2020-05-29T13:18:53.000Z
2020-05-29T13:18:53.000Z
from zope.interface import Interface class IPhylogeny(Interface): """marker """ class ITree(Interface): """marker """
11.5
36
0.630435
13
138
6.692308
0.615385
0.344828
0
0
0
0
0
0
0
0
0
0
0.231884
138
11
37
12.545455
0.820755
0.130435
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
0e553209d6702b74019825277d47549b2a80a063
20
py
Python
automatic/ratelimtemailnoti.py
therealebraheem/Moon
20de5f36d98fa77df86752183feebb735ed98359
[ "Unlicense" ]
null
null
null
automatic/ratelimtemailnoti.py
therealebraheem/Moon
20de5f36d98fa77df86752183feebb735ed98359
[ "Unlicense" ]
null
null
null
automatic/ratelimtemailnoti.py
therealebraheem/Moon
20de5f36d98fa77df86752183feebb735ed98359
[ "Unlicense" ]
null
null
null
# Coming soon in V3
10
19
0.7
4
20
3.5
1
0
0
0
0
0
0
0
0
0
0
0.066667
0.25
20
1
20
20
0.866667
0.85
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
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
0
0
0
0
0
5
0e7434601e5e6c8ecac1fd88c3c29886bcd57f51
38
py
Python
Init.py
madron/wood
a18c07603e3d6f031facb68ac42ed581acb58b58
[ "MIT" ]
null
null
null
Init.py
madron/wood
a18c07603e3d6f031facb68ac42ed581acb58b58
[ "MIT" ]
null
null
null
Init.py
madron/wood
a18c07603e3d6f031facb68ac42ed581acb58b58
[ "MIT" ]
null
null
null
# FreeCAD init script of Wood module
19
37
0.763158
6
38
4.833333
1
0
0
0
0
0
0
0
0
0
0
0
0.210526
38
1
38
38
0.966667
0.894737
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
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
0
0
0
0
0
5
7ed7da2cbf7b90389f57a19a926073b1ba04b490
310
py
Python
octicons16px/check.py
andrewp-as-is/octicons16px.py
1272dc9f290619d83bd881e87dbd723b0c48844c
[ "Unlicense" ]
1
2021-01-28T06:47:39.000Z
2021-01-28T06:47:39.000Z
octicons16px/check.py
andrewp-as-is/octicons16px.py
1272dc9f290619d83bd881e87dbd723b0c48844c
[ "Unlicense" ]
null
null
null
octicons16px/check.py
andrewp-as-is/octicons16px.py
1272dc9f290619d83bd881e87dbd723b0c48844c
[ "Unlicense" ]
null
null
null
OCTICON_CHECK = """ <svg class="octicon octicon-check" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg> """
62
284
0.66129
72
310
2.833333
0.625
0.078431
0.098039
0.078431
0.098039
0
0
0
0
0
0
0.327338
0.103226
310
4
285
77.5
0.406475
0
0
0
0
0.333333
0.925566
0.071197
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
0
0
1
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
7ee7a864d72ce14d6db691a6ba1c7d0d678803a6
6,284
py
Python
r05.py
netlabcode/gc-sim
6bc65ea9b216e3b2d9e2d9d94f33b79c9f4a139f
[ "MIT" ]
null
null
null
r05.py
netlabcode/gc-sim
6bc65ea9b216e3b2d9e2d9d94f33b79c9f4a139f
[ "MIT" ]
null
null
null
r05.py
netlabcode/gc-sim
6bc65ea9b216e3b2d9e2d9d94f33b79c9f4a139f
[ "MIT" ]
null
null
null
import psycopg2 from datetime import datetime import binascii import _thread import time import socket PORT1 = 8805 conn = psycopg2.connect(host="131.180.165.7",database="CRoF",user="postgres", password="crpg") cursor = conn.cursor() #Value id 34-41 cursor.execute('''SELECT value from objects WHERE id=34''') result = cursor.fetchone() record1 = result[0] cursor.execute('''SELECT value from objects WHERE id=35''') result = cursor.fetchone() record2 = result[0] cursor.execute('''SELECT value from objects WHERE id=36''') result = cursor.fetchone() record3 = result[0] cursor.execute('''SELECT value from objects WHERE id=37''') result = cursor.fetchone() record4 = result[0] cursor.execute('''SELECT value from objects WHERE id=38''') result = cursor.fetchone() record5 = result[0] cursor.execute('''SELECT value from objects WHERE id=39''') result = cursor.fetchone() record6 = result[0] cursor.execute('''SELECT value from objects WHERE id=40''') result = cursor.fetchone() record7 = result[0] cursor.execute('''SELECT value from objects WHERE id=41''') result = cursor.fetchone() record8 = result[0] #Value code cursor.execute('''SELECT code from objects WHERE id=34''') result = cursor.fetchone() r1 = result[0] cursor.execute('''SELECT code from objects WHERE id=35''') result = cursor.fetchone() r2 = result[0] cursor.execute('''SELECT code from objects WHERE id=36''') result = cursor.fetchone() r3 = result[0] cursor.execute('''SELECT code from objects WHERE id=37''') result = cursor.fetchone() r4 = result[0] cursor.execute('''SELECT code from objects WHERE id=38''') result = cursor.fetchone() r5 = result[0] cursor.execute('''SELECT code from objects WHERE id=39''') result = cursor.fetchone() r6 = result[0] cursor.execute('''SELECT code from objects WHERE id=40''') result = cursor.fetchone() r7 = result[0] cursor.execute('''SELECT code from objects WHERE id=41''') result = cursor.fetchone() r8 = result[0] try: with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s1: s1.bind(('',PORT1)) s1.listen() conn1, addr = s1.accept() with conn1: print('Server 1 from:',addr) while True: a = 1 while a < 6: #Format: mu01_id+value cursor.execute('''SELECT value from objects WHERE id=34''') result = cursor.fetchone() if record1 != result[0]: print(result[0]) string = "mu01_"+str(r1)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record1 = result[0] cursor.execute('''SELECT value from objects WHERE id=35''') result = cursor.fetchone() if record2 != result[0]: print(result[0]) string = "mu01_"+str(r2)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record2 = result[0] cursor.execute('''SELECT value from objects WHERE id=36''') result = cursor.fetchone() if record3 != result[0]: print(result[0]) string = "mu02_"+str(r3)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record3 = result[0] cursor.execute('''SELECT value from objects WHERE id=37''') result = cursor.fetchone() if record4 != result[0]: print(result[0]) string = "mu02_"+str(r4)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record4 = result[0] cursor.execute('''SELECT value from objects WHERE id=38''') result = cursor.fetchone() if record5 != result[0]: print(result[0]) string = "mu02_"+str(r5)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record5 = result[0] cursor.execute('''SELECT value from objects WHERE id=39''') result = cursor.fetchone() if record6 != result[0]: print(result[0]) string = "mu05_"+str(r6)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record6 = result[0] cursor.execute('''SELECT value from objects WHERE id=40''') result = cursor.fetchone() if record7 != result[0]: print(result[0]) string = "mu03_"+str(r7)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record7 = result[0] cursor.execute('''SELECT value from objects WHERE id=41''') result = cursor.fetchone() if record8 != result[0]: print(result[0]) string = "mu03_"+str(r8)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record8 = result[0] except: print ("Error: unable to start thread") while 1: pass
38.084848
95
0.480267
624
6,284
4.817308
0.152244
0.111776
0.151697
0.143713
0.819029
0.819029
0.810712
0.810712
0.664005
0.664005
0
0.051527
0.400859
6,284
164
96
38.317073
0.746879
0.007161
0
0.615385
0
0
0.164718
0
0
0
0
0
0
1
0
false
0.013986
0.041958
0
0.041958
0.125874
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
7ee89233ad0941c1450d3d35f50b799c3888a6dc
197
py
Python
pymbt/database/__init__.py
klavinslab/pymbt-legacy
d638aecd954664e416ed28b30cdbbcfcb176bae5
[ "ECL-2.0", "Apache-2.0" ]
34
2015-12-26T22:13:51.000Z
2021-11-17T11:46:37.000Z
pymbt/database/__init__.py
klavinslab/pymbt-legacy
d638aecd954664e416ed28b30cdbbcfcb176bae5
[ "ECL-2.0", "Apache-2.0" ]
13
2015-09-11T23:27:51.000Z
2018-06-25T20:44:28.000Z
pymbt/database/__init__.py
klavinslab/pymbt-legacy
d638aecd954664e416ed28b30cdbbcfcb176bae5
[ "ECL-2.0", "Apache-2.0" ]
14
2015-10-08T17:08:48.000Z
2022-02-22T04:25:54.000Z
from ._rebase import Rebase from ._entrez import fetch_genome from ._yeast import fetch_yeast_locus_sequence, get_yeast_sequence from ._yeast import get_yeast_gene_location, get_yeast_promoter_ypa
39.4
67
0.878173
30
197
5.233333
0.466667
0.152866
0.191083
0
0
0
0
0
0
0
0
0
0.091371
197
4
68
49.25
0.877095
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
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
7d069d66d8ae3a788438c6175c7c929321d9d4a3
57
py
Python
fcis/dataset/__init__.py
knorth55/chainer-fcis
a3dcebf5c31395dbd4b596509707bc9fe91a06e0
[ "MIT" ]
45
2017-10-06T12:24:17.000Z
2021-11-10T05:28:31.000Z
fcis/dataset/__init__.py
knorth55/chainer-fcis
a3dcebf5c31395dbd4b596509707bc9fe91a06e0
[ "MIT" ]
14
2017-10-13T11:03:54.000Z
2018-12-12T04:48:35.000Z
fcis/dataset/__init__.py
knorth55/chainer-fcis
a3dcebf5c31395dbd4b596509707bc9fe91a06e0
[ "MIT" ]
10
2017-10-13T09:24:15.000Z
2020-07-12T09:05:47.000Z
from fcis.dataset.convert import concat_examples # NOQA
28.5
56
0.824561
8
57
5.75
1
0
0
0
0
0
0
0
0
0
0
0
0.122807
57
1
57
57
0.92
0.070175
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
7d0aad70bec54148975296774e30ae379ce68953
39
py
Python
vision/__init__.py
cuauv/software
5ad4d52d603f81a7f254f365d9b0fe636d03a260
[ "BSD-3-Clause" ]
70
2015-11-16T18:04:01.000Z
2022-03-05T09:04:02.000Z
vision/__init__.py
cuauv/software
5ad4d52d603f81a7f254f365d9b0fe636d03a260
[ "BSD-3-Clause" ]
1
2016-08-03T05:13:19.000Z
2016-08-03T06:19:39.000Z
vision/__init__.py
cuauv/software
5ad4d52d603f81a7f254f365d9b0fe636d03a260
[ "BSD-3-Clause" ]
34
2015-12-15T17:29:23.000Z
2021-11-18T14:15:12.000Z
__all__ = ['camera_message_framework']
19.5
38
0.794872
4
39
6.25
1
0
0
0
0
0
0
0
0
0
0
0
0.076923
39
1
39
39
0.694444
0
0
0
0
0
0.615385
0.615385
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
0
0
0
1
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
7d106d581d82479cdf2703e168c1853d7d050eac
58
py
Python
kot/game/__init__.py
dragon-hex/kot-two-project
170594ffbac61a967ecf553b4cd0f30e572619ec
[ "MIT" ]
null
null
null
kot/game/__init__.py
dragon-hex/kot-two-project
170594ffbac61a967ecf553b4cd0f30e572619ec
[ "MIT" ]
8
2021-09-23T22:46:12.000Z
2021-11-06T12:53:46.000Z
kot/game/__init__.py
dragon-hex/kot-two-project
170594ffbac61a967ecf553b4cd0f30e572619ec
[ "MIT" ]
null
null
null
from .mGame import kotGame from .credits import kotCredits
29
31
0.844828
8
58
6.125
0.75
0
0
0
0
0
0
0
0
0
0
0
0.12069
58
2
31
29
0.960784
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
7d13bf9c2039bb433a110e86bbb150f3849ef5eb
35,836
py
Python
Practice_Lab/ms08_067_check/ndr.py
hongsofwing/PyQYT-master
9a112d9adbf9885a8b7535b7ef7759b60a0f9a29
[ "CNRI-Python" ]
514
2017-07-23T09:29:52.000Z
2022-03-30T16:45:01.000Z
Practice_Lab/ms08_067_check/ndr.py
hongsofwing/PyQYT-master
9a112d9adbf9885a8b7535b7ef7759b60a0f9a29
[ "CNRI-Python" ]
9
2017-08-02T05:01:19.000Z
2018-12-27T14:40:26.000Z
Practice_Lab/ms08_067_check/ndr.py
hongsofwing/PyQYT-master
9a112d9adbf9885a8b7535b7ef7759b60a0f9a29
[ "CNRI-Python" ]
137
2017-07-29T23:41:38.000Z
2022-03-21T03:50:03.000Z
#!/usr/bin/env python ''' This file is part of the PyMSRPC project and is licensed under the project license. ndr.py This are the functions that provide all the NDR data types. It handles serialization and everything. I have spent a shit load of time on this and yet they are not 100%. This is usually due to structure padding or array serialization but honestly debugging it is such a beating so this is what I have for now. (c) 2007 Cody Pierce - BSD License - See LICENSE.txt ''' import sys, struct, random, re, copy DEBUG = False ####################################################################### # # Opcodes # ####################################################################### class ndr_opcode: def __init__(self, **kwargs): self.opnum = kwargs.get('opnum', 0x0) self.address = kwargs.get('address', 0x00000000) self.elements = kwargs.get('elements', []) self.out = kwargs.get('out', None) self.align_byte = kwargs.get('align_byte', "\xaa") def align(self, data): return self.align_byte * ((4 - (len(data) & 3)) & 3) # Allows us to set a context handle for [in] params def set_context_handle(self, handle): for elem in self.elements: if isinstance(elem, ndr_context_handle): elem.data = handle return True return False def serialize(self): serialdata = "" for elem in self.elements: s = elem.serialize() serialdata += s + self.align(s) return serialdata ####################################################################### # # NDR Parent Classes # ####################################################################### class ndr_primitive(object): def align(self, data): return self.align_byte * ((4 - (len(data) & 3)) & 3) def serialize(self): raise NotImplementedError class ndr_container(object): def align(self, data): return self.align_byte * ((4 - (len(data) & 3)) & 3) def add_static(self, obj): if DEBUG: print "[*] add_static", if not self.parent: if DEBUG: print "self" self.s.append(obj) else: if DEBUG: print "parent" self.parent.add_static(obj) def add_deferred(self, obj): if DEBUG: print "[*] add_deferred", if not self.parent: if DEBUG: print "self" self.d.append(obj) else: if DEBUG: print "parent" self.parent.add_deferred(obj) def serialize(self): raise NotImplementedError ####################################################################### # # Primitives # ####################################################################### class ndr_pad(ndr_primitive): ''' pad placeholder ''' def __init__(self): pass class ndr_byte(ndr_primitive): ''' encode: byte element_1; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', 0x06) self.signed = kwargs.get('signed', False) self.name = kwargs.get('name', "") self.size = 1 def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): if self.signed: return struct.pack("<b", self.data) else: return struct.pack("<B", self.data) class ndr_small(ndr_primitive): ''' encode: small element_1; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', 0x00) self.signed = kwargs.get('signed', False) self.name = kwargs.get('name', "") self.size = 1 def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): if self.signed: return struct.pack("<b", self.data) else: return struct.pack("<B", self.data) class ndr_char(ndr_primitive): ''' encode: char [*] element_1; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', 0x03) self.signed = kwargs.get('signed', False) self.name = kwargs.get('name', "") self.size = 1 if self.signed: raise Exception def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): return chr(self.data) class ndr_wchar(ndr_primitive): ''' encode: wchar element_1; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', 0x42) self.signed = kwargs.get('signed', False) self.name = kwargs.get('name', "") self.size = 2 if self.signed: raise Exception def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): return chr(self.data).encode("utf-16le") class ndr_void(ndr_primitive): ''' encode: void *element_1 ''' def __init__(self, **kwargs): self.data = kwargs.get('data', "") self.name = kwargs.get('name', "") self.size = 4 def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): return self.data class ndr_user_marshal(ndr_primitive): ''' encode: [user_marshal(4)] struct struct_12 * elem_24; Untested/Unsupported because technically ths calls a user function ''' def __init__(self, **kwargs): self.num = kwargs.get('num', 0x4) self.data = kwargs.get('data', "") self.name = kwargs.get('name', "") self.size = 0 def get_size(self): return self.size def get_packed(self): return struct.pack("<L", self.num) class ndr_range(ndr_primitive): ''' encode: [range(0,1000)] long elem_1; ''' def __init__(self, low=0x0, high=0xffffffff, data=""): self.low = kwargs.get('low', 0x0) self.high = kwargs.get('high', 0xffffffff) self.data = kwargs.get('data', "") self.size = 0 def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_size(self): return self.size def serialize(self): if not self.data: self.data = ndr_long(data=random.randint(self.low, self.high)) else: if self.data.get_data() > self.high: self.data.data = self.high elif self.data.get_data() < self.low: self.data.data = self.low return self.data.serialize() class ndr_enum16(ndr_primitive): ''' encode: /* enum16 */ short element_1; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', 0x0004) self.signed = kwargs.get('signed', True) self.name = kwargs.get('name', "") self.size = 2 def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): if self.signed: return struct.pack("<H", self.data) else: return struct.pack("<h", self.data) class ndr_short(ndr_primitive): ''' encode: short element_1; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', 0x0004) self.signed = kwargs.get('signed', True) self.name = kwargs.get('name', "") self.size = 2 def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): if self.signed: return struct.pack("<H", self.data) else: return struct.pack("<h", self.data) class ndr_interface(ndr_primitive): ''' encode: interface(0000000c-0000-0000-c000-000000000046) ''' def __init__(self, **kwargs): self.data = kwargs.get('data', "\x89" * 20) self.name = kwargs.get('name', "") self.size = 20 def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): return self.data class ndr_long(ndr_primitive): ''' encode: long element_1; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', 0x00000002) self.signed = kwargs.get('signed', True) self.name = kwargs.get('name', "") self.size = 4 def set_data(self, new_data): self.data = new_data def get_data(self): return self.data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): if self.signed: return struct.pack("<l", self.data) else: return struct.pack("<L", self.data) class ndr_hyper(ndr_primitive): ''' encode: hyper (aka 64bit) element_1; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', 0x0000000000000005) self.signed = kwargs.get('signed', True) self.name = kwargs.get('name', "") self.size = 8 def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): if self.signed: return struct.pack("<q", self.data) else: return struct.pack("<Q", self.data) class ndr_empty(ndr_primitive): ''' used for default or empty cases in unions/unknown stuff ''' def __init__(self, **kwargs): self.data = kwargs.get('data', "") self.name = kwargs.get('name', "") self.size = 0 def get_data(self): return self.data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): return "" class ndr_float(ndr_primitive): ''' encode: float element_1; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', 0.0) self.name = kwargs.get('name', "") self.size = 4 def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): return struct.pack("<f", self.data) class ndr_double(ndr_primitive): ''' encode: double element_1; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', 0.0) self.name = kwargs.get('name', "") self.size = 8 def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def serialize(self): return struct.pack("<d", self.data) class ndr_string(ndr_primitive): ''' encode: char *element_1; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', "Administrator") self.name = kwargs.get('name', "") self.align_byte = kwargs.get('align_byte', "\xaa") self.size = 0 def pad(self, data): return self.align_byte * ((4 - (len(data) & 3)) & 3) def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return len(self.get_packed()) def serialize(self): # We add our null because it gets counted self.data += "\x00" length = len(self.data) # Conformance varying information return struct.pack("<L", length) \ + struct.pack("<L", 0) \ + struct.pack("<L", length) \ + self.data \ + self.pad(self.data) \ class ndr_wstring(ndr_primitive): ''' encode: wchar *element_1; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', "\\\\EXCHANGE2K3") self.name = kwargs.get('name', "") self.align_byte = kwargs.get('align_byte', "\xaa") self.size = 0 def pad(self, data): return self.align_byte * ((4 - (len(data) & 3)) & 3) def set_data(self, new_data): self.data = new_data def get_data(self): return self.data def get_name(self): return self.name def get_size(self): return len(self.get_packed()) def serialize(self): # Add our wide null because it gets counted data = self.data.encode("utf-16le") + "\x00\x00" length = len(data) / 2 return struct.pack("<L", length) \ + struct.pack("<L", 0) \ + struct.pack("<L", length) \ + data \ + self.pad(data) class ndr_string_nonconformant(ndr_primitive): ''' encode: [string] char element_1[3]; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', "ABCDEFG") self.name = kwargs.get('name', "") self.size = kwargs.get('size', 0) self.align_byte = kwargs.get('align_byte', "\xaa") def pad(self, data): return self.align_byte * ((4 - (len(data) & 3)) & 3) def set_data(self, new_data): self.data = new_data def get_data(self): return self.data def get_name(self): return self.name def get_size(self): return len(self.get_packed()) def serialize(self): # Make sure we stick to our size if len(self.data) < self.size: self.size = len(self.data) data = self.data else: data = self.data[:self.size - 1] # Add our null data += "\x00" return struct.pack("<L", 0) \ + struct.pack("<L", self.size) \ + data \ + self.pad(data) class ndr_wstring_nonconformant(ndr_primitive): ''' encode: [string] wchar_t element_1[3]; ''' def __init__(self, **kwargs): self.data = kwargs.get('data', "ABCDEFG") self.name = kwargs.get('name', "") self.size = kwargs.get('size', 0) self.align_byte = kwargs.get('align_byte', "\xaa") def pad(self, data): return self.align_byte * ((4 - (len(data) & 3)) & 3) def set_data(self, new_data): self.data = new_data def get_data(self): return self.data def get_name(self): return self.name def get_size(self): return len(self.get_packed()) def serialize(self): # Make sure we stick to our size if len(self.data) < self.size: self.size = len(self.data) / 2 data = self.data else: data = self.data[:self.size - 1] # Add our wide null data = data.encode("utf-16le") + "\x00\x00" return struct.pack("<L", 0) \ + struct.pack("<L", self.size) \ + data \ + self.pad(data) class ndr_error_status(ndr_primitive): def __init__(self, **kwargs): self.data = kwargs.get('data', 0x00000000) self.name = kwargs.get('name', "") self.size = 4 def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): return struct.pack("<L", self.data) class ndr_callback(ndr_primitive): ''' encodes size_is(callback_0x12345678) Unsupported because it calls a user function ''' def __init__(self, **kwargs): self.data = kwargs.get('data', 0x00000000) self.name = kwargs.get('name', "") self.size = 4 def get_data(self): return self.data def set_data(self, new_data): self.data = new_data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): return struct.pack("<L", self.data) class ndr_context_handle(ndr_primitive): ''' encodes: [in] context_handle arg_1 ''' def __init__(self, **kwargs): self.data = kwargs.get('data', "\x88" * 20) self.name = kwargs.get('name', "") self.size = 20 def get_data(self): return self.data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): return self.data class ndr_pipe(ndr_primitive): ''' I need an example plz2u ''' def __init__(self, **kwargs): self.data = kwargs.get('data', "\x8a" * 20) self.name = kwargs.get('name', "") self.size = 20 def get_data(self): return self.data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): return self.data class ndr_handle_t(ndr_primitive): ''' encode: handle_t element_1 (not sent on network) ''' def __init__(self, **kwargs): self.data = kwargs.get('data', "") self.name = kwargs.get('name', "") self.size = 0 def get_data(self): return self.data def get_name(self): return self.name def get_size(self): return self.size def serialize(self): return "" ####################################################################### # # Unions # ####################################################################### class ndr_union: ''' NDR Union: data will be a tuple list of (case, ndr_type) ''' def __init__(self, **kwargs): self.elements = kwargs.get('elements', {}) self.switch_dep = kwargs.get('switch_dep', "") self.name = kwargs.get('name', "") self.defname = kwargs.get('defname', "") self.size = 0 def get_data(self): return self.elements def set_data(self, new_data): self.elements = new_data def get_name(self): return self.name def get_size(self): return self.size def add_element(self, case, element): self.elements[case] = element def serialize(self): serialdata = "" switch = self.switch_dep.get_data() if self.elements.has_key(switch): serialdata += self.switch_dep.serialize() # Pack our requested enum serialdata += self.elements[switch].serialize() else: # This allows us to pick a switch for the user newswitch = self.elements.keys()[0] # We need to update our original switch_dep so it passes correlation checks self.switch_dep.set_data(newswitch) serialdata += ndr_long(data=newswitch).serialize() serialdata += self.elements[newswitch].serialize() return serialdata ####################################################################### # # Pointers # ####################################################################### class ndr_unique(ndr_container): def __init__(self, **kwargs): self.name = kwargs.get('name', "") self.data = kwargs.get('data', "") self.type = kwargs.get('type', "") self.align_byte = kwargs.get('align_byte', "\xaa") self.pointer_value = kwargs.get('pointer_value', 0x41424344) self.size = 4 self.alignment = 4 self.parent = None self.s = [] self.d = [] def get_name(self): return self.name def get_size(self): return self.size def get_data(self): return self.data def set_data(self, new_data): # We have to use the objects set_data if its a unique/array self.data.set_data(new_data) def serialize(self): self.add_static(ndr_long(data=self.pointer_value)) if isinstance(self.data, ndr_container): self.data.parent = self self.add_deferred(self.data) if not self.parent: while len(self.d): d = self.d.pop(0) if isinstance(d, ndr_container): d.serialize() else: self.add_static(d) serialdata = "" for s in self.s: if isinstance(s, ndr_pad): serialdata += self.align(serialdata) else: serialdata += s.serialize() self.parent = None self.s = [] self.d = [] return serialdata class ndr_full(ndr_container): def __init__(self, **kwargs): self.name = kwargs.get('name', "") self.data = kwargs.get('data', "") self.type = kwargs.get('type', "") self.align_byte = kwargs.get('align_byte', "\xaa") self.pointer_value = kwargs.get('pointer_value', 0x41424344) self.size = 4 self.alignment = 4 self.parent = None self.s = [] self.d = [] def get_name(self): return self.name def get_size(self): return self.size def get_data(self): return self.data def set_data(self, new_data): # We have to use the objects set_data if its a unique/array self.data.set_data(new_data) def serialize(self): self.add_static(ndr_long(data=self.pointer_value)) if isinstance(self.data, ndr_container): self.data.parent = self self.add_deferred(self.data) if not self.parent: while len(self.d): d = self.d.pop(0) if isinstance(d, ndr_container): d.serialize() else: self.add_static(d) serialdata = "" for s in self.s: if isinstance(s, ndr_pad): serialdata += self.align(serialdata) else: serialdata += s.serialize() self.parent = None self.s = [] self.d = [] return serialdata ####################################################################### # # Structures # ####################################################################### class ndr_struct(ndr_container): def __init__(self, **kwargs): self.elements = kwargs.get('elements', []) self.name = kwargs.get('name', "") self.defname = kwargs.get('defname', "") self.type = kwargs.get('type', "") self.align_byte = kwargs.get('align_byte', "\xaa") self.size = 0 self.alignment = 4 self.parent = None self.s = [] self.d = [] def get_data(self): return self.elements def set_data(self, new_data): self.elements = new_data def add_element(self, element): self.elements.append(element) def del_element(self, eid): del(self.elements[eid]) return True def get_element_by_id(self, eid=0): return self.elements[eid] def get_element_by_name(self, name): for element in self.elements: try: if element.name == name: return element except: if DEBUG: print "[*] Couldnt get name of element" return False def get_name(self): return self.name def get_size(self): return self.size def serialize(self): if DEBUG: print "[*] Serializing ndr_struct" # First we take care of our list serializing all containers first, and adding primitives verbatim for e in self.elements: if isinstance(e, ndr_container): e.parent = self e.serialize() else: self.add_static(e) # If we are the top-most structure lets package it all if not self.parent: if DEBUG: print "[*] Packaging top most struct %s" % self.name self.add_static(ndr_pad()) while len(self.d): d = self.d.pop(0) if isinstance(d, ndr_container): d.serialize() else: self.add_static(d) serialdata = "" for s in self.s: if isinstance(s, ndr_pad): serialdata += self.align(serialdata) else: serialdata += s.serialize() self.parent = None self.s = [] self.d = [] return serialdata ####################################################################### # # Arrays # ####################################################################### class ndr_array(ndr_container): def array_serialize(self, count): for c in range(count): if isinstance(self.basetype, ndr_container): self.basetype.parent = self self.basetype.serialize() else: self.add_static(self.basetype) if not self.parent: if DEBUG: print "[*] Packaging top most array %s" % self.name while len(self.d): d = self.d.pop(0) if isinstance(d, ndr_container): d.serialize() else: self.add_static(d) serialdata = "" for s in self.s: if isinstance(s, ndr_pad): serialdata += self.align(serialdata) else: serialdata += s.serialize() self.parent = None self.s = [] self.d = [] return serialdata + self.align(serialdata) else: self.add_static(ndr_pad()) class ndr_array_fixed(ndr_array): def __init__(self, **kwargs): self.basetype = kwargs.get('basetype', ndr_empty()) self.elements = kwargs.get('elements', []) self.count = kwargs.get('count', 0x0) self.cmod= kwargs.get('cmod', ()) self.cptr = kwargs.get('cptr', 0x0) self.name = kwargs.get('name', "") self.align_byte = kwargs.get('align_byte', "\xaa") self.size = 0 self.parent = None self.s = [] self.d = [] def set_data(self, new_data): # We have to use the objects set_data if its a pointer self.basetype.set_data(new_data) def get_size(self): return self.size def get_count(self): return self.count def serialize(self): if DEBUG: print "[*] Serializing ndr_array" if self.cptr == 1: self.add_static(ndr_long(data=0x41424344)) return self.array_serialize(self.count) class ndr_array_conformant(ndr_array): def __init__(self, **kwargs): self.basetype = kwargs.get('basetype', ndr_empty()) self.elements = kwargs.get('elements', []) self.count = kwargs.get('count', 0x0) self.cmod= kwargs.get('cmod', ()) self.cptr = kwargs.get('cptr', 0x0) self.name = kwargs.get('name', "") self.align_byte = kwargs.get('align_byte', "\xaa") self.packed_count = False self.size = 0 self.parent = None self.s = [] self.d = [] def set_data(self, new_data): # We have to use the objects set_data if its a pointer self.basetype.set_data(new_data) def get_size(self): return self.size def serialize(self): if DEBUG: print "[*] Serializing ndr_array_conformant" if self.cptr == 1: self.add_static(ndr_long(data=0x41424344)) # Pack our count if isinstance(self.count, int): num = self.count self.add_static(ndr_long(data=num)) # If we used a ascii rep of size pack it # YYY: callback_0x12345678 will fail here elif isinstance(self.count, str): num = int(self.count) self.add_static(ndr_long(data=num)) # else we have a ndr object to pack else: # We have to handle the math operators i.e. [size_is(arg1 / 2)] num = self.count.get_data() if self.cmod: if self.cmod[0] == "/": num /= self.cmod[1] elif self.cmod[0] == "*": num *= self.cmod[1] else: print "[!] Problem with operator %s" % self.cmod[0] sys.exit(-1) self.add_static(ndr_long(data=num)) # End pack count return self.array_serialize(num) class ndr_array_varying(ndr_array): def __init__(self, **kwargs): self.basetype = kwargs.get('basetype', ndr_empty()) self.elements = kwargs.get('elements', []) self.count = kwargs.get('count', 0x0) self.cmod= kwargs.get('cmod', ()) self.cptr = kwargs.get('cptr', 0x0) self.name = kwargs.get('name', "") self.align_byte = kwargs.get('align_byte', "\xaa") self.packed_count = False self.size = 0 self.parent = None self.s = [] self.d = [] def set_data(self, new_data): # We have to use the objects set_data if its a pointer self.basetype.set_data(new_data) def get_size(self): return self.size def serialize(self): # Pack offset self.add_static(ndr_long(data=0x0)) # Need example of the cptr stuff if self.cptr == 1: self.add_static(ndr_long(data=0x41424344)) if isinstance(self.count, int): num = self.count elif isinstance(self.count, str): num = int(self.count) else: num = self.count.get_data() if self.cmod: if self.cmod[0] == "/": num /= self.cmod[1] elif self.cmod[0] == "*": num *= self.cmod[1] else: print "[!] Problem with operator %s" % self.cmod[0] sys.exit(-1) # Pack our array count self.add_static(ndr_long(data=num)) return self.array_serialize(num) class ndr_array_conformant_varying(ndr_array): def __init__(self, **kwargs): self.basetype = kwargs.get('basetype', ndr_empty()) self.elements = kwargs.get('elements', []) self.maxcount = kwargs.get('maxcount', 0x0) self.mmod= kwargs.get('mmod', ()) self.mptr = kwargs.get('mptr', 0x0) self.passed = kwargs.get('passed', 0x0) self.pmod= kwargs.get('pmod', ()) self.pptr = kwargs.get('pptr', 0x0) self.name = kwargs.get('name', "") self.align_byte = kwargs.get('align_byte', "\xaa") self.packed_count = True self.size = 0 self.parent = None self.s = [] self.d = [] def set_data(self, new_data): # We have to use the objects set_data if its a pointer self.basetype.set_data(new_data) def get_size(self): return self.size def serialize(self): # Need example of the mptr stuff if self.mptr == 1: self.add_static(ndr_long(data=0x41424344)) # Do conformant stuff if isinstance(self.maxcount, int): mnum = self.maxcount elif isinstance(self.maxcount, str): mnum = int(self.maxcount) else: mnum = self.maxcount.get_data() if self.mmod: if self.mmod[0] == "/": mnum /= self.mmod[1] elif self.mmod[0] == "*": mnum *= self.mmod[1] else: print "[!] Problem with operator %s" % self.mmod[0] sys.exit(-1) # Pack conformant info self.add_static(ndr_long(data=mnum)) # Offset self.add_static(ndr_long(data=0x0)) # Need example of the pptr stuff if self.pptr == 1: self.add_static(ndr_long(data=0x41424344)) # Do varying stuff if isinstance(self.passed, int): pnum = self.passed elif isinstance(self.passed, str): pnum = int(self.passed) else: pnum = self.passed.get_data() if self.pmod: if self.pmod[0] == "/": pnum /= self.pmod[1] elif self.pmod[0] == "*": pnum *= self.pmod[1] else: print "[!] Problem with operator %s" % self.pmod[0] sys.exit(-1) # Add varying count self.add_static(ndr_long(data=pnum)) return self.array_serialize(pnum)
27.822981
105
0.498912
4,065
35,836
4.257565
0.079951
0.058705
0.068758
0.031432
0.749119
0.721096
0.704166
0.695268
0.679263
0.647773
0
0.017619
0.361731
35,836
1,287
106
27.8446
0.739037
0.038872
0
0.788783
0
0
0.038279
0
0
0
0.007128
0
0
0
null
null
0.008353
0.001193
null
null
0.019093
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
7d2400b173be60417d46d4f5dd63e552a6075e8d
101
py
Python
examples/cors_per_route.py
b3cch4/hug
bfbbcd597e2c1307e3f610bd53a4bfdc47766f74
[ "MIT" ]
1
2019-08-20T03:49:20.000Z
2019-08-20T03:49:20.000Z
examples/cors_per_route.py
b3cch4/hug
bfbbcd597e2c1307e3f610bd53a4bfdc47766f74
[ "MIT" ]
5
2021-03-19T09:07:21.000Z
2022-03-12T00:08:15.000Z
examples/cors_per_route.py
b3cch4/hug
bfbbcd597e2c1307e3f610bd53a4bfdc47766f74
[ "MIT" ]
1
2019-05-17T13:11:28.000Z
2019-05-17T13:11:28.000Z
import hug @hug.get() def cors_supported(cors: hug.directives.cors="*"): return "Hello world!"
14.428571
50
0.683168
14
101
4.857143
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.148515
101
6
51
16.833333
0.790698
0
0
0
0
0
0.128713
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
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
1
0
0
0
1
1
0
0
5
7d2ae4be9ab590fdfc00804e9a4d3052f745e9ce
136
py
Python
ivy_mech/position/__init__.py
unifyai/mech
d678c8732ee5aba4a92fb37b96519cd06553c0c6
[ "Apache-2.0" ]
1
2021-10-11T17:58:41.000Z
2021-10-11T17:58:41.000Z
ivy_mech/position/__init__.py
ivy-dl/mech
f3ce5f7b38fe2c453a066f58019ff84dcee517a6
[ "Apache-2.0" ]
null
null
null
ivy_mech/position/__init__.py
ivy-dl/mech
f3ce5f7b38fe2c453a066f58019ff84dcee517a6
[ "Apache-2.0" ]
null
null
null
from . import coordinate_conversions from .coordinate_conversions import * from . import transformations from .transformations import *
27.2
37
0.838235
14
136
8
0.357143
0.178571
0
0
0
0
0
0
0
0
0
0
0.117647
136
4
38
34
0.933333
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
7d40187387b8a9d40229579ed6efa7211e5e38c9
197
py
Python
graphql_django/__init__.py
rigobertocontreras/graphql-django
43704fa79d65fdc9c8356e80ce054efe66232019
[ "MIT" ]
null
null
null
graphql_django/__init__.py
rigobertocontreras/graphql-django
43704fa79d65fdc9c8356e80ce054efe66232019
[ "MIT" ]
null
null
null
graphql_django/__init__.py
rigobertocontreras/graphql-django
43704fa79d65fdc9c8356e80ce054efe66232019
[ "MIT" ]
null
null
null
from .schema import create_schema from .query import create_query from .types import create_types __version__ = "0.1.0" __all__ = ["__version__", "create_schema", "create_query", "create_types"]
24.625
74
0.771574
27
197
4.962963
0.37037
0.268657
0
0
0
0
0
0
0
0
0
0.017241
0.116751
197
7
75
28.142857
0.752874
0
0
0
0
0
0.269036
0
0
0
0
0
0
1
0
false
0
0.6
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
adb944afea42f7494db921c306514314ec187d24
36
py
Python
scraper/smwbot/spiders/__init__.py
nmacri/twitter-bots-smw-2016
35f366c17ace37ea9c56ff7d573097ed2815c790
[ "MIT" ]
3
2016-02-22T16:06:34.000Z
2016-03-02T16:31:46.000Z
scraper/smwbot/spiders/__init__.py
nmacri/twitter-bots-smw-2016
35f366c17ace37ea9c56ff7d573097ed2815c790
[ "MIT" ]
null
null
null
scraper/smwbot/spiders/__init__.py
nmacri/twitter-bots-smw-2016
35f366c17ace37ea9c56ff7d573097ed2815c790
[ "MIT" ]
null
null
null
# Place here all your scrapy spiders
36
36
0.805556
6
36
4.833333
1
0
0
0
0
0
0
0
0
0
0
0
0.166667
36
1
36
36
0.966667
0.944444
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
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
0
0
0
0
0
5
adc191654bc914a9d732407c202fabcee2a6e85a
185
py
Python
Scanner_app/ServPort.py
5O00/Simple-Port-Scanner
cfa1573f2d306b7d2518f631db1321aa6fa408ca
[ "Apache-2.0" ]
1
2020-07-14T16:51:20.000Z
2020-07-14T16:51:20.000Z
Scanner_app/ServPort.py
5O00/Port-Scanner
cfa1573f2d306b7d2518f631db1321aa6fa408ca
[ "Apache-2.0" ]
null
null
null
Scanner_app/ServPort.py
5O00/Port-Scanner
cfa1573f2d306b7d2518f631db1321aa6fa408ca
[ "Apache-2.0" ]
null
null
null
import socket def ServerOnPort(Number_Port, Protocol): ServiceName = socket.getservbyport(Number_Port, Protocol) print("[+] port number %d : %s"%(Number_Port, ServiceName))
37
63
0.724324
21
185
6.238095
0.571429
0.229008
0.274809
0
0
0
0
0
0
0
0
0
0.151351
185
5
63
37
0.834395
0
0
0
0
0
0.126374
0
0
0
0
0
0
1
0.25
false
0
0.25
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
bc01ae30ba28e7a7938507aa444f2a2cf3d3b7f3
4,832
py
Python
bluefoglite/common/tcp/agent_test.py
Bluefog-Lib/Bluefog-Lite
7175a1731f1a401ee55ce8ad94855f0c03ad5604
[ "Apache-2.0" ]
null
null
null
bluefoglite/common/tcp/agent_test.py
Bluefog-Lib/Bluefog-Lite
7175a1731f1a401ee55ce8ad94855f0c03ad5604
[ "Apache-2.0" ]
null
null
null
bluefoglite/common/tcp/agent_test.py
Bluefog-Lib/Bluefog-Lite
7175a1731f1a401ee55ce8ad94855f0c03ad5604
[ "Apache-2.0" ]
null
null
null
import math from unittest.mock import MagicMock, patch import pytest from bluefoglite.common.store import InMemoryStore from bluefoglite.common.tcp.agent import AgentContext from bluefoglite.testing.util import multi_thread_help def mocked_create_pair(self, peer_rank): pair = MagicMock() pair.self_address = f"{self.rank}<-{peer_rank}" pair.connect = MagicMock() self.pairs[peer_rank] = pair return pair @pytest.mark.parametrize("size", [1, 2, 3, 5, 9]) def test_connect_ring(size): store = InMemoryStore() def fn(rank, size): with patch.object(AgentContext, "createPair", new=mocked_create_pair): context = AgentContext( event_loop=MagicMock(), rank=rank, size=size, full_address=MagicMock() ) # Patch createPair, getPair context.connectRing(store) assert len(context.pairs) == min(2, size - 1) # Check if the addr is the right one for peer, pair in context.pairs.items(): if peer == rank: assert pair is None # Each pair should call connect only once. assert len(pair.connect.call_args_list) == 1 pair.connect.assert_called_with(addr=f"{peer}<-{rank}") errors = multi_thread_help(size=size, fn=fn) # TODO check the value stored in the store. # print("Value in store: ", store.store) for e in errors: raise e @pytest.mark.parametrize("size", [1, 2, 3, 5, 8]) def test_connect_full(size): store = InMemoryStore() def fn(rank, size): with patch.object(AgentContext, "createPair", new=mocked_create_pair): context = AgentContext( event_loop=MagicMock(), rank=rank, size=size, full_address=MagicMock() ) context.connectFull(store) assert len(context.pairs) == size - 1 # Check if the addr is the right one for peer, pair in context.pairs.items(): if peer == rank: assert pair is None # Each pair should call connect only once. assert len(pair.connect.call_args_list) == 1 pair.connect.assert_called_with(addr=f"{peer}<-{rank}") errors = multi_thread_help(size=size, fn=fn) # TODO check the value stored in the store. # print("Value in store: ", store.store) for e in errors: raise e @pytest.mark.parametrize("size", [1, 2, 4, 8, 16]) # what if it is not the power of 2? def test_connect_hypercube(size): store = InMemoryStore() def fn(rank, size): with patch.object(AgentContext, "createPair", new=mocked_create_pair): context = AgentContext( event_loop=MagicMock(), rank=rank, size=size, full_address=MagicMock() ) # Patch createPair, getPair context.connectHypercube(store) assert len(context.pairs) == math.floor(math.log2(size)) # Check if the addr is the right one for peer, pair in context.pairs.items(): if peer == rank: assert pair is None # Each pair should call connect only once. assert len(pair.connect.call_args_list) == 1 pair.connect.assert_called_with(addr=f"{peer}<-{rank}") errors = multi_thread_help(size=size, fn=fn) # TODO check the value stored in the store. # print("Value in store: ", store.store) for e in errors: raise e @pytest.mark.parametrize( "size,expected_pairs", [ (1, 0), (2, 1), (3, 2), (4, 3), (5, 4), (6, 4), (7, 6), (8, 5), # (16, 7), # (27, 10), # (32, 9), ], ) def test_connect_exponential2(size, expected_pairs): store = InMemoryStore() def fn(rank, size): with patch.object(AgentContext, "createPair", new=mocked_create_pair): context = AgentContext( event_loop=MagicMock(), rank=rank, size=size, full_address=MagicMock() ) # Patch createPair, getPair context.connectExponentialTwo(store) assert len(context.pairs) == expected_pairs # Check if the addr is the right one for peer, pair in context.pairs.items(): if peer == rank: assert pair is None # Each pair should call connect only once. assert len(pair.connect.call_args_list) == 1 pair.connect.assert_called_with(addr=f"{peer}<-{rank}") errors = multi_thread_help(size=size, fn=fn, timeout=15) # TODO check the value stored in the store. # print("Value in store: ", store.store) for e in errors: raise e
32.870748
87
0.585679
600
4,832
4.618333
0.176667
0.031757
0.027066
0.036088
0.780585
0.743053
0.743053
0.743053
0.731866
0.731866
0
0.016148
0.307947
4,832
146
88
33.09589
0.8125
0.158733
0
0.53125
0
0
0.037367
0.005939
0
0
0
0.006849
0.166667
1
0.09375
false
0
0.0625
0
0.166667
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
bc249e317fb2423e41a247903e285ed72e5ab90a
401
py
Python
src/symbol_table/c_types/__init__.py
AAU-PSix/canary
93b07d23cd9380adc03a6aa1291a13eaa3b3008c
[ "MIT" ]
null
null
null
src/symbol_table/c_types/__init__.py
AAU-PSix/canary
93b07d23cd9380adc03a6aa1291a13eaa3b3008c
[ "MIT" ]
null
null
null
src/symbol_table/c_types/__init__.py
AAU-PSix/canary
93b07d23cd9380adc03a6aa1291a13eaa3b3008c
[ "MIT" ]
null
null
null
from .c_aggregate_type import * from .c_declaration import * from .c_pointer_type import * from .c_primitive_type import * from .c_struct_type import * from .c_subroutine_type import * from .c_symbol_table_builder import * from .c_symbol_table_filler import * from .c_symbol_table import * from .c_type_factory import * from .c_type import * from .c_type_qualifier import * from .c_union_type import *
30.846154
37
0.80798
65
401
4.584615
0.261538
0.218121
0.442953
0.302013
0.221477
0
0
0
0
0
0
0
0.127182
401
13
38
30.846154
0.851429
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
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
1
0
1
0
0
0
0
5
bc2bb25d142a995ec2484ab850366904b9a3fc24
260
py
Python
python/grains/grains.py
baduker/exercism.io
7e1b9ea20aa6f6b0fea947911053cd3e196c0642
[ "MIT" ]
null
null
null
python/grains/grains.py
baduker/exercism.io
7e1b9ea20aa6f6b0fea947911053cd3e196c0642
[ "MIT" ]
null
null
null
python/grains/grains.py
baduker/exercism.io
7e1b9ea20aa6f6b0fea947911053cd3e196c0642
[ "MIT" ]
null
null
null
def validate(number): if not 0 < number <= 64: raise ValueError("Invalid input!") def square(number): validate(number) return 2 ** (number - 1) def total(number): validate(number) return sum(square(i + 1) for i in range(number))
20
52
0.626923
36
260
4.527778
0.583333
0.257669
0.245399
0.319018
0
0
0
0
0
0
0
0.030457
0.242308
260
12
53
21.666667
0.796954
0
0
0.222222
0
0
0.053846
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.555556
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
1
0
0
0
0
1
0
0
5
bc34f26c34b0b083fa64e54c8f8a3eafd3e88b8b
249
py
Python
project_name/lib/common/templatetags/statichelpers.py
tiagoarasilva/django-boilerplate
35ed124d3290417037dcb382936eebe62dd2f13f
[ "MIT" ]
9
2017-11-03T04:51:13.000Z
2020-05-14T00:11:10.000Z
project_name/lib/common/templatetags/statichelpers.py
tiagoarasilva/django-boilerplate
35ed124d3290417037dcb382936eebe62dd2f13f
[ "MIT" ]
17
2017-11-03T10:31:41.000Z
2020-03-30T21:25:48.000Z
project_name/lib/common/templatetags/statichelpers.py
tiagoarasilva/django-boilerplate
35ed124d3290417037dcb382936eebe62dd2f13f
[ "MIT" ]
2
2018-11-06T07:42:43.000Z
2019-05-07T03:58:27.000Z
from django.template import Library from django.contrib.staticfiles.storage import staticfiles_storage register = Library() @register.assignment_tag(name='get_static_path') def static_path(path): return staticfiles_storage.url(path)
24.9
67
0.791165
31
249
6.16129
0.580645
0.282723
0
0
0
0
0
0
0
0
0
0
0.128514
249
9
68
27.666667
0.880184
0
0
0
0
0
0.0625
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0.166667
0.666667
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
0
1
1
1
0
0
5
70b2413de34dfd96192eeb59e7c74f11056fa2db
10,972
py
Python
tests/test_promotion.py
deepan10/python-jenkins
7166f872f50e8c246ee567ca56aeeceaa40e8c7a
[ "BSD-3-Clause" ]
2
2019-06-25T06:14:49.000Z
2019-06-25T06:14:50.000Z
tests/test_promotion.py
deepan10/python-jenkins
7166f872f50e8c246ee567ca56aeeceaa40e8c7a
[ "BSD-3-Clause" ]
null
null
null
tests/test_promotion.py
deepan10/python-jenkins
7166f872f50e8c246ee567ca56aeeceaa40e8c7a
[ "BSD-3-Clause" ]
1
2022-02-08T15:47:07.000Z
2022-02-08T15:47:07.000Z
import json from mock import patch import jenkins from tests.base import JenkinsTestBase from six.moves.urllib.error import HTTPError class JenkinsPromotionsTestBase(JenkinsTestBase): config_xml = """<hudson.plugins.promoted__builds.PromotionProcess> </hudson.plugins.promoted__builds.PromotionProcess>""" class JenkinsGetPromotionNameTest(JenkinsPromotionsTestBase): @patch.object(jenkins.Jenkins, 'jenkins_open') def test_simple(self, jenkins_mock): promotion_name_to_return = {u'name': 'Test Promotion'} jenkins_mock.return_value = json.dumps(promotion_name_to_return) promotion_name = self.j.get_promotion_name(u'Test Promotion', u'Test Job') self.assertEqual(promotion_name, 'Test Promotion') self.assertEqual( jenkins_mock.call_args[0][0].url, self.make_url('job/Test%20Job/promotion/process/' 'Test%20Promotion/api/json?tree=name')) self._check_requests(jenkins_mock.call_args_list) @patch.object(jenkins.Jenkins, 'jenkins_open') def test_return_none(self, jenkins_mock): jenkins_mock.side_effect = jenkins.NotFoundException() promotion_name = self.j.get_promotion_name(u'TestPromotion', u'Test Job') self.assertEqual(promotion_name, None) self.assertEqual( jenkins_mock.call_args[0][0].url, self.make_url('job/Test%20Job/promotion/process/' 'TestPromotion/api/json?tree=name')) self._check_requests(jenkins_mock.call_args_list) @patch.object(jenkins.Jenkins, 'jenkins_open') def test_unexpected_promotion_name(self, jenkins_mock): promotion_name_to_return = {u'name': 'not the right name'} jenkins_mock.return_value = json.dumps(promotion_name_to_return) with self.assertRaises(jenkins.JenkinsException) as context_manager: self.j.get_promotion_name(u'TestPromotion', u'TestJob') self.assertEqual( jenkins_mock.call_args_list[0][0][0].url, self.make_url('job/TestJob/promotion/process/TestPromotion' '/api/json?tree=name')) self.assertEqual( str(context_manager.exception), 'Jenkins returned an unexpected promotion name {0} ' '(expected: {1})'.format(promotion_name_to_return['name'], 'TestPromotion')) self._check_requests(jenkins_mock.call_args_list) class JenkinsAssertPromotionTest(JenkinsPromotionsTestBase): @patch.object(jenkins.Jenkins, 'jenkins_open') def test_promotion_missing(self, jenkins_mock): jenkins_mock.side_effect = jenkins.NotFoundException() with self.assertRaises(jenkins.JenkinsException) as context_manager: self.j.assert_promotion_exists('NonExistent', 'TestJob') self.assertEqual( str(context_manager.exception), 'promotion[NonExistent] does not exist for job[TestJob]') self._check_requests(jenkins_mock.call_args_list) @patch.object(jenkins.Jenkins, 'jenkins_open') def test_promotion_exists(self, jenkins_mock): jenkins_mock.side_effect = [ json.dumps({'name': 'ExistingPromotion'}), ] self.j.assert_promotion_exists('ExistingPromotion', 'TestJob') self._check_requests(jenkins_mock.call_args_list) class JenkinsPromotionExistsTest(JenkinsPromotionsTestBase): @patch.object(jenkins.Jenkins, 'jenkins_open') def test_promotion_missing(self, jenkins_mock): jenkins_mock.side_effect = jenkins.NotFoundException() self.assertEqual(self.j.promotion_exists('NonExistent', 'TestJob'), False) self._check_requests(jenkins_mock.call_args_list) @patch.object(jenkins.Jenkins, 'jenkins_open') def test_promotion_exists(self, jenkins_mock): jenkins_mock.side_effect = [ json.dumps({'name': 'ExistingPromotion'}), ] self.assertEqual(self.j.promotion_exists('ExistingPromotion', 'TestJob'), True) self._check_requests(jenkins_mock.call_args_list) class JenkinsGetPromotionsTest(JenkinsPromotionsTestBase): @patch.object(jenkins.Jenkins, 'jenkins_open') def test_simple(self, jenkins_mock): promotions = { u'url': (u'http://your_url_here/jobs/TestJob/promotions' u'/my_promotion/'), u'name': u'my_promotion', } promotion_info_to_return = {u'processes': promotions} jenkins_mock.return_value = json.dumps(promotion_info_to_return) promotion_info = self.j.get_promotions('TestJob') self.assertEqual(promotion_info, promotions) self.assertEqual( jenkins_mock.call_args[0][0].url, self.make_url('job/TestJob/promotion/api/json?depth=0')) self._check_requests(jenkins_mock.call_args_list) @patch.object(jenkins.Jenkins, 'jenkins_open') def test_nonexistent(self, jenkins_mock): jenkins_mock.side_effect = [ None, HTTPError, ] with self.assertRaises(jenkins.JenkinsException) as context_manager: self.j.get_promotions('TestJob') self.assertEqual( str(context_manager.exception), 'job[TestJob] does not exist') @patch.object(jenkins.Jenkins, 'jenkins_open') def test_invalid_json(self, jenkins_mock): jenkins_mock.return_value = '{invalid_json}' with self.assertRaises(jenkins.JenkinsException) as context_manager: self.j.get_promotions('TestJob') self.assertEqual( str(context_manager.exception), "Could not parse JSON info for promotions of job[TestJob]") class JenkinsDeletePromotionTest(JenkinsPromotionsTestBase): @patch.object(jenkins.Jenkins, 'jenkins_open') def test_simple(self, jenkins_mock): jenkins_mock.side_effect = [ None, jenkins.NotFoundException(), ] self.j.delete_promotion(u'Test Promotion', 'TestJob') self.assertEqual( jenkins_mock.call_args_list[0][0][0].url, self.make_url('job/TestJob/promotion/process/' 'Test%20Promotion/doDelete')) self._check_requests(jenkins_mock.call_args_list) @patch.object(jenkins.Jenkins, 'jenkins_open') def test_failed(self, jenkins_mock): jenkins_mock.side_effect = [ json.dumps({'name': 'TestPromotion'}), json.dumps({'name': 'TestPromotion'}), json.dumps({'name': 'TestPromotion'}), ] with self.assertRaises(jenkins.JenkinsException) as context_manager: self.j.delete_promotion(u'TestPromotion', 'TestJob') self.assertEqual( jenkins_mock.call_args_list[0][0][0].url, self.make_url('job/TestJob/promotion/process/' 'TestPromotion/doDelete')) self.assertEqual( str(context_manager.exception), 'delete[TestPromotion] from job[TestJob] failed') self._check_requests(jenkins_mock.call_args_list) class JenkinsCreatePromotionTest(JenkinsPromotionsTestBase): @patch.object(jenkins.Jenkins, 'jenkins_open') def test_simple(self, jenkins_mock): jenkins_mock.side_effect = [ jenkins.NotFoundException(), None, json.dumps({'name': 'Test Promotion'}), ] self.j.create_promotion(u'Test Promotion', 'Test Job', self.config_xml) self.assertEqual( jenkins_mock.call_args_list[1][0][0].url, self.make_url('job/Test%20Job/promotion/' 'createProcess?name=Test%20Promotion')) self._check_requests(jenkins_mock.call_args_list) @patch.object(jenkins.Jenkins, 'jenkins_open') def test_already_exists(self, jenkins_mock): jenkins_mock.side_effect = [ json.dumps({'name': 'TestPromotion'}), None, ] with self.assertRaises(jenkins.JenkinsException) as context_manager: self.j.create_promotion(u'TestPromotion', 'TestJob', self.config_xml) self.assertEqual( jenkins_mock.call_args_list[0][0][0].url, self.make_url('job/TestJob/promotion/process/' 'TestPromotion/api/json?tree=name')) self.assertEqual( str(context_manager.exception), 'promotion[TestPromotion] already exists at job[TestJob]') self._check_requests(jenkins_mock.call_args_list) @patch.object(jenkins.Jenkins, 'jenkins_open') def test_failed(self, jenkins_mock): jenkins_mock.side_effect = [ jenkins.NotFoundException(), None, jenkins.NotFoundException(), ] with self.assertRaises(jenkins.JenkinsException) as context_manager: self.j.create_promotion(u'TestPromotion', 'TestJob', self.config_xml) self.assertEqual( jenkins_mock.call_args_list[0][0][0].url, self.make_url('job/TestJob/promotion/process/' 'TestPromotion/api/json?tree=name')) self.assertEqual( jenkins_mock.call_args_list[1][0][0].url, self.make_url('job/TestJob/promotion/' 'createProcess?name=TestPromotion')) self.assertEqual( str(context_manager.exception), 'create[TestPromotion] at job[TestJob] failed') self._check_requests(jenkins_mock.call_args_list) class JenkinsReconfigPromotionTest(JenkinsPromotionsTestBase): @patch.object(jenkins.Jenkins, 'jenkins_open') def test_simple(self, jenkins_mock): jenkins_mock.side_effect = [ json.dumps({'name': 'Test Promotion'}), None, ] self.j.reconfig_promotion(u'Test Promotion', u'Test Job', self.config_xml) self.assertEqual(jenkins_mock.call_args[0][0].url, self.make_url('job/Test%20Job/promotion/process/' 'Test%20Promotion/config.xml')) self._check_requests(jenkins_mock.call_args_list) class JenkinsGetPromotionConfigTest(JenkinsPromotionsTestBase): @patch.object(jenkins.Jenkins, 'jenkins_open') def test_encodes_promotion_name(self, jenkins_mock): self.j.get_promotion_config(u'Test Promotion', u'Test Job') self.assertEqual( jenkins_mock.call_args[0][0].url, self.make_url('job/Test%20Job/promotion/process/' 'Test%20Promotion/config.xml')) self._check_requests(jenkins_mock.call_args_list)
38.770318
79
0.640084
1,161
10,972
5.799311
0.099914
0.098025
0.060151
0.076192
0.815981
0.770533
0.748552
0.717511
0.669687
0.614139
0
0.006597
0.253919
10,972
282
80
38.907801
0.815905
0
0
0.651584
0
0
0.181097
0.07911
0
0
0
0
0.153846
1
0.076923
false
0
0.022624
0
0.144796
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
70b64c113396acd9ea80c15c36c3bd7dd9eb4f2e
317
py
Python
recipes/Python/59873_Random_Password_Generation/recipe-59873.py
tdiprima/code
61a74f5f93da087d27c70b2efe779ac6bd2a3b4f
[ "MIT" ]
2,023
2017-07-29T09:34:46.000Z
2022-03-24T08:00:45.000Z
recipes/Python/59873_Random_Password_Generation/recipe-59873.py
unhacker/code
73b09edc1b9850c557a79296655f140ce5e853db
[ "MIT" ]
32
2017-09-02T17:20:08.000Z
2022-02-11T17:49:37.000Z
recipes/Python/59873_Random_Password_Generation/recipe-59873.py
unhacker/code
73b09edc1b9850c557a79296655f140ce5e853db
[ "MIT" ]
780
2017-07-28T19:23:28.000Z
2022-03-25T20:39:41.000Z
from whrandom import choice import string def GenPasswd(): chars = string.letters + string.digits for i in range(8): newpasswd = newpasswd + choice(chars) return newpasswd def GenPasswd2(length=8, chars=string.letters + string.digits): return ''.join([choice(chars) for i in range(length)])
26.416667
63
0.700315
42
317
5.285714
0.47619
0.099099
0.162162
0.216216
0.27027
0
0
0
0
0
0
0.011719
0.192429
317
11
64
28.818182
0.855469
0
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0.444444
0.222222
0.111111
0.666667
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
1
0
1
1
0
0
5
70d98754e0048b59a18f596310cb8d912801300e
208
py
Python
bed_capacity/admin.py
agilghif/temenin-isoman
18a768363420709c3a03a7d1453ddd8fa138c8b5
[ "Unlicense" ]
1
2021-11-04T08:11:18.000Z
2021-11-04T08:11:18.000Z
bed_capacity/admin.py
agilghif/temenin-isoman
18a768363420709c3a03a7d1453ddd8fa138c8b5
[ "Unlicense" ]
1
2021-11-05T03:52:27.000Z
2021-11-05T03:52:27.000Z
bed_capacity/admin.py
agilghif/temenin-isoman
18a768363420709c3a03a7d1453ddd8fa138c8b5
[ "Unlicense" ]
4
2021-10-10T12:55:28.000Z
2021-10-29T18:27:42.000Z
from django.contrib import admin from .models import Wilayah, RumahSakit, BedRequest # Register your models here. admin.site.register(Wilayah) admin.site.register(RumahSakit) admin.site.register(BedRequest)
26
51
0.822115
27
208
6.333333
0.481481
0.157895
0.298246
0
0
0
0
0
0
0
0
0
0.091346
208
7
52
29.714286
0.904762
0.125
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
70e4d437312b0591089da7e4250c6eee939cc082
2,255
py
Python
analysis-master/tra_analysis/NaiveBayes_obj.py
titanscouting/tra-analysis
5153fc3f82b0ca3aa43d4e926127da10d84234dd
[ "BSD-3-Clause" ]
2
2020-09-19T22:27:16.000Z
2021-04-01T08:30:15.000Z
analysis-master/tra_analysis/NaiveBayes_obj.py
titanscouting/red-alliance-analysis
5153fc3f82b0ca3aa43d4e926127da10d84234dd
[ "BSD-3-Clause" ]
23
2020-09-20T02:02:20.000Z
2021-04-01T08:03:09.000Z
analysis-master/tra_analysis/NaiveBayes_obj.py
titanscouting/red-alliance-analysis
5153fc3f82b0ca3aa43d4e926127da10d84234dd
[ "BSD-3-Clause" ]
4
2020-10-09T04:57:59.000Z
2020-10-14T18:46:45.000Z
# Only included for backwards compatibility! Do not update, NaiveBayes is preferred and supported. import sklearn from sklearn import model_selection, naive_bayes from . import ClassificationMetric, RegressionMetric class NaiveBayes: def guassian(self, data, labels, test_size = 0.3, priors = None, var_smoothing = 1e-09): data_train, data_test, labels_train, labels_test = sklearn.model_selection.train_test_split(data, labels, test_size=test_size, random_state=1) model = sklearn.naive_bayes.GaussianNB(priors = priors, var_smoothing = var_smoothing) model.fit(data_train, labels_train) predictions = model.predict(data_test) return model, ClassificationMetric(predictions, labels_test) def multinomial(self, data, labels, test_size = 0.3, alpha=1.0, fit_prior=True, class_prior=None): data_train, data_test, labels_train, labels_test = sklearn.model_selection.train_test_split(data, labels, test_size=test_size, random_state=1) model = sklearn.naive_bayes.MultinomialNB(alpha = alpha, fit_prior = fit_prior, class_prior = class_prior) model.fit(data_train, labels_train) predictions = model.predict(data_test) return model, ClassificationMetric(predictions, labels_test) def bernoulli(self, data, labels, test_size = 0.3, alpha=1.0, binarize=0.0, fit_prior=True, class_prior=None): data_train, data_test, labels_train, labels_test = sklearn.model_selection.train_test_split(data, labels, test_size=test_size, random_state=1) model = sklearn.naive_bayes.BernoulliNB(alpha = alpha, binarize = binarize, fit_prior = fit_prior, class_prior = class_prior) model.fit(data_train, labels_train) predictions = model.predict(data_test) return model, ClassificationMetric(predictions, labels_test) def complement(self, data, labels, test_size = 0.3, alpha=1.0, fit_prior=True, class_prior=None, norm=False): data_train, data_test, labels_train, labels_test = sklearn.model_selection.train_test_split(data, labels, test_size=test_size, random_state=1) model = sklearn.naive_bayes.ComplementNB(alpha = alpha, fit_prior = fit_prior, class_prior = class_prior, norm = norm) model.fit(data_train, labels_train) predictions = model.predict(data_test) return model, ClassificationMetric(predictions, labels_test)
52.44186
144
0.795122
322
2,255
5.298137
0.186335
0.093787
0.065651
0.084408
0.767292
0.767292
0.767292
0.753224
0.753224
0.753224
0
0.011466
0.110421
2,255
43
145
52.44186
0.838983
0.042572
0
0.571429
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.107143
0
0.428571
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
cb4c34b6e47c653960b33d663517cbf13260408c
190
py
Python
ConsoleHelpers/PrintHelper.py
JerecTharen/NuzlockerPY
02752a2b854cda8f04e7c0b23befe5b5f186c6b7
[ "MIT" ]
null
null
null
ConsoleHelpers/PrintHelper.py
JerecTharen/NuzlockerPY
02752a2b854cda8f04e7c0b23befe5b5f186c6b7
[ "MIT" ]
null
null
null
ConsoleHelpers/PrintHelper.py
JerecTharen/NuzlockerPY
02752a2b854cda8f04e7c0b23befe5b5f186c6b7
[ "MIT" ]
null
null
null
class PrintHelper: @staticmethod def PrintBanner(printStr, sep='='): bannerStr = sep * len(printStr) print(bannerStr) print(printStr) print(bannerStr)
27.142857
39
0.615789
17
190
6.882353
0.588235
0.222222
0.376068
0
0
0
0
0
0
0
0
0
0.278947
190
7
40
27.142857
0.854015
0
0
0.285714
0
0
0.005236
0
0
0
0
0
0
1
0.142857
false
0
0
0
0.285714
0.714286
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
0
0
0
1
0
5
cb65f9046676a110edf76f242cf4592079559c24
2,533
py
Python
tests/test_timed.py
akatashev/chouette-iot-client
7ac36c996172a55f8e5b30aa976547b476c8c757
[ "Apache-2.0" ]
null
null
null
tests/test_timed.py
akatashev/chouette-iot-client
7ac36c996172a55f8e5b30aa976547b476c8c757
[ "Apache-2.0" ]
null
null
null
tests/test_timed.py
akatashev/chouette-iot-client
7ac36c996172a55f8e5b30aa976547b476c8c757
[ "Apache-2.0" ]
null
null
null
import json import time import pytest from chouette_iot_client import timed @pytest.mark.parametrize("use_ms, expected_value", ((True, 100), (False, 0.1))) def test_timed_decorator(redis_client, use_ms, expected_value, metrics_queue): """ Timed Decorator test: GIVEN: There is a function wrapped to a timed decorator. WHEN: This function is executed. THEN: In a short time data about it appears in both keys and values. AND: Its name, type and tags are fine. AND: Its value is the expected code execution duration in seconds for 'use_ms'=False or milliseconds for 'use_ms'=True. """ @timed("test.timed.decorator", tags={"producer": "timer"}, use_ms=use_ms) def sleep(): time.sleep(0.1) redis_client.flushall() sleep() time.sleep(0.1) keys = redis_client.zrange(f"{metrics_queue}.keys", 0, -1) assert len(keys) == 1 key = keys.pop() record = json.loads(redis_client.hget(f"{metrics_queue}.values", key)) assert record["metric"] == "test.timed.decorator" assert record["type"] == "histogram" assert record["tags"] == {"producer": "timer"} value = float("%.3f" % record["value"]) # Due to milliseconds calculation that can show 101 ms: assert value in [expected_value, expected_value + 0.01] @pytest.mark.parametrize("use_ms, expected_value", ((True, 100), (False, 0.1))) def test_timed_context_manager(redis_client, use_ms, expected_value, metrics_queue): """ Timed Context Manager test. GIVEN: There is some code wrapped into a timed context manager. WHEN: This code is executed. THEN: In a short time data about it appears in both keys and values. AND: Its name, type and tags are fine. AND: Its value is the expected code execution duration in seconds for 'use_ms'=False or milliseconds for 'use_ms'=True. """ redis_client.flushall() with timed("test.timed.context_manager", tags={"producer": "timer"}, use_ms=use_ms): time.sleep(0.1) time.sleep(0.1) keys = redis_client.zrange(f"{metrics_queue}.keys", 0, -1) assert len(keys) == 1 key = keys.pop() record = json.loads(redis_client.hget(f"{metrics_queue}.values", key)) assert record["metric"] == "test.timed.context_manager" assert record["type"] == "histogram" assert record["tags"] == {"producer": "timer"} value = float("%.3f" % record["value"]) # Due to milliseconds calculation that can show 101 ms: assert value in [expected_value, expected_value + 0.01]
37.80597
88
0.676668
367
2,533
4.553134
0.245232
0.035907
0.056852
0.043088
0.777379
0.764811
0.764811
0.732496
0.732496
0.677439
0
0.018618
0.194236
2,533
66
89
38.378788
0.800098
0.319384
0
0.666667
0
0
0.20438
0.058394
0
0
0
0
0.277778
1
0.083333
false
0
0.111111
0
0.194444
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
cb788e8fea7ad5bf6ff6449d6d6d2810edc3d8d7
264
py
Python
pywizlight/__init__.py
eibanez/pywizlight
fefeb8cae1685df6ceec37524925b30e7189cf10
[ "MIT" ]
null
null
null
pywizlight/__init__.py
eibanez/pywizlight
fefeb8cae1685df6ceec37524925b30e7189cf10
[ "MIT" ]
null
null
null
pywizlight/__init__.py
eibanez/pywizlight
fefeb8cae1685df6ceec37524925b30e7189cf10
[ "MIT" ]
null
null
null
from pywizlight.bulb import PilotBuilder, PilotParser, wizlight # noqa: 401 from pywizlight import discovery # noqa: 401 from pywizlight.scenes import SCENES # noqa: 401 from pywizlight.bulblibrary import BulbLib, BulbType # noqa: 401 __all__ = ["wizlight"]
33
76
0.776515
32
264
6.28125
0.46875
0.278607
0.164179
0.313433
0
0
0
0
0
0
0
0.053571
0.151515
264
7
77
37.714286
0.84375
0.147727
0
0
0
0
0.036364
0
0
0
0
0
0
1
0
false
0
0.8
0
0.8
0
0
0
0
null
1
0
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
1
0
0
5
cb8621a5dd572e33e031c3eed22f70f7881e70b0
306
py
Python
pytorch_toolbelt/losses/__init__.py
mohitktanwr/toolkits
f3acfca5da05cd7ccdd85e8d343d75fa40fb44d9
[ "MIT" ]
2
2020-06-29T03:29:48.000Z
2020-11-26T17:00:41.000Z
pytorch_toolbelt/losses/__init__.py
mohitktanwr/toolkits
f3acfca5da05cd7ccdd85e8d343d75fa40fb44d9
[ "MIT" ]
null
null
null
pytorch_toolbelt/losses/__init__.py
mohitktanwr/toolkits
f3acfca5da05cd7ccdd85e8d343d75fa40fb44d9
[ "MIT" ]
null
null
null
from __future__ import absolute_import from .bitempered_loss import * from .dice import * from .focal import * from .focal_cosine import * from .jaccard import * from .joint_loss import * from .lovasz import * from .soft_bce import * from .soft_ce import * from .soft_f1 import * from .wing_loss import *
21.857143
38
0.767974
45
306
4.955556
0.377778
0.493274
0.188341
0
0
0
0
0
0
0
0
0.003891
0.160131
306
13
39
23.538462
0.863813
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
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
1deab4185fa09f8566f3f8ef02e205952c3283ab
262
py
Python
sc2bench/transforms/__init__.py
yoshitomo-matsubara/sc2-benchmark
e326a337e3dadbad0a02d0d173a59f62e7de4f3c
[ "MIT" ]
null
null
null
sc2bench/transforms/__init__.py
yoshitomo-matsubara/sc2-benchmark
e326a337e3dadbad0a02d0d173a59f62e7de4f3c
[ "MIT" ]
null
null
null
sc2bench/transforms/__init__.py
yoshitomo-matsubara/sc2-benchmark
e326a337e3dadbad0a02d0d173a59f62e7de4f3c
[ "MIT" ]
null
null
null
from . import collator from .codec import CODEC_TRANSFORM_MODULE_DICT from .misc import MISC_TRANSFORM_MODULE_DICT TRANSFORM_MODULE_DICT = dict() TRANSFORM_MODULE_DICT.update(CODEC_TRANSFORM_MODULE_DICT) TRANSFORM_MODULE_DICT.update(MISC_TRANSFORM_MODULE_DICT)
32.75
57
0.885496
37
262
5.783784
0.243243
0.490654
0.621495
0.32243
0.518692
0.35514
0
0
0
0
0
0
0.068702
262
7
58
37.428571
0.877049
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
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
3810be155cfcccacbde2f7f7ae667adc602c8e66
27
py
Python
libapicache/__init__.py
SOBotics/libapicache-py
e9a0f3a77272eeb4f4e9a989eb03168607ffecd4
[ "MIT" ]
1
2017-08-31T04:36:14.000Z
2017-08-31T04:36:14.000Z
libapicache/__init__.py
SOBotics/libapicache-py
e9a0f3a77272eeb4f4e9a989eb03168607ffecd4
[ "MIT" ]
null
null
null
libapicache/__init__.py
SOBotics/libapicache-py
e9a0f3a77272eeb4f4e9a989eb03168607ffecd4
[ "MIT" ]
null
null
null
from .libapicache import *
13.5
26
0.777778
3
27
7
1
0
0
0
0
0
0
0
0
0
0
0
0.148148
27
1
27
27
0.913043
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
381eb7e751bc7f814bca416db656801753579ef9
51
py
Python
mlpouch/bundles/__init__.py
netxph/MLPouch
1ecfb6872f7063c6a61decd8acd61bfce4fe9c90
[ "MIT" ]
null
null
null
mlpouch/bundles/__init__.py
netxph/MLPouch
1ecfb6872f7063c6a61decd8acd61bfce4fe9c90
[ "MIT" ]
null
null
null
mlpouch/bundles/__init__.py
netxph/MLPouch
1ecfb6872f7063c6a61decd8acd61bfce4fe9c90
[ "MIT" ]
null
null
null
from mlpouch.bundles.Recommender import Recommender
51
51
0.901961
6
51
7.666667
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.058824
51
1
51
51
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
3824517f900bd949e1aa3af2171d82bd9c3a03b2
139
py
Python
Addition of two numbers.py
Ratheshprabakar/Python-Programs
fca9d4f0b5f5f5693b3d7e25c6d890f4973dc19e
[ "MIT" ]
2
2019-07-10T06:32:05.000Z
2019-11-13T07:52:53.000Z
Addition of two numbers.py
Ratheshprabakar/Python-Programs
fca9d4f0b5f5f5693b3d7e25c6d890f4973dc19e
[ "MIT" ]
null
null
null
Addition of two numbers.py
Ratheshprabakar/Python-Programs
fca9d4f0b5f5f5693b3d7e25c6d890f4973dc19e
[ "MIT" ]
1
2019-10-12T06:56:13.000Z
2019-10-12T06:56:13.000Z
#To add two numbers a=int(input("Enter the 1st number")) b=int(input("Enter the 2nd number")) c=a+b print("The sum of the two numbers:",c)
23.166667
38
0.697842
29
139
3.344828
0.586207
0.206186
0.268041
0.329897
0
0
0
0
0
0
0
0.016667
0.136691
139
5
39
27.8
0.791667
0.129496
0
0
0
0
0.558333
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
1
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
0
0
0
0
0
5
3830fc4468bec0639e23b97e6a1d1b4fb778688d
145
py
Python
Darlington/phase2/LIST/day 39 solution/qtn9.py
CodedLadiesInnovateTech/-python-challenge-solutions
430cd3eb84a2905a286819eef384ee484d8eb9e7
[ "MIT" ]
6
2020-05-23T19:53:25.000Z
2021-05-08T20:21:30.000Z
Darlington/phase2/LIST/day 39 solution/qtn9.py
CodedLadiesInnovateTech/-python-challenge-solutions
430cd3eb84a2905a286819eef384ee484d8eb9e7
[ "MIT" ]
8
2020-05-14T18:53:12.000Z
2020-07-03T00:06:20.000Z
Darlington/phase2/LIST/day 39 solution/qtn9.py
CodedLadiesInnovateTech/-python-challenge-solutions
430cd3eb84a2905a286819eef384ee484d8eb9e7
[ "MIT" ]
39
2020-05-10T20:55:02.000Z
2020-09-12T17:40:59.000Z
#Python program to clone or copy a list. original_list = [10, 22, 44, 23, 4] new_list = list(original_list) print(original_list) print(new_list)
29
41
0.751724
26
145
4
0.615385
0.346154
0.307692
0
0
0
0
0
0
0
0
0.072
0.137931
145
5
42
29
0.76
0.268966
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
0
0
0
1
0
5
383fe70d465b666b297fdf13b6ca5d85dadb3d81
35
py
Python
_conf.py
LunarWatcher/StackElection.py
e39d7fb9fd508ceea7c4acdf37cc1bfcade42f5a
[ "MIT" ]
null
null
null
_conf.py
LunarWatcher/StackElection.py
e39d7fb9fd508ceea7c4acdf37cc1bfcade42f5a
[ "MIT" ]
null
null
null
_conf.py
LunarWatcher/StackElection.py
e39d7fb9fd508ceea7c4acdf37cc1bfcade42f5a
[ "MIT" ]
null
null
null
API_KEY = "Your API key goes here"
17.5
34
0.714286
7
35
3.428571
0.714286
0.5
0
0
0
0
0
0
0
0
0
0
0.2
35
1
35
35
0.857143
0
0
0
0
0
0.628571
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
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
3846393699bd2f32d668ae091203141450af3e3f
172
py
Python
Silver_Badges/Ayuba_oss_rewards_Bash/oss_bash/admin.py
preciousM494/Voting
295c34814835ed89ddd6ab88a4d5d64a8c86da53
[ "Apache-2.0" ]
5
2021-09-15T08:03:05.000Z
2022-03-31T22:12:35.000Z
Silver_Badges/Ayuba_oss_rewards_Bash/oss_bash/admin.py
preciousM494/Voting
295c34814835ed89ddd6ab88a4d5d64a8c86da53
[ "Apache-2.0" ]
null
null
null
Silver_Badges/Ayuba_oss_rewards_Bash/oss_bash/admin.py
preciousM494/Voting
295c34814835ed89ddd6ab88a4d5d64a8c86da53
[ "Apache-2.0" ]
3
2021-12-10T01:30:38.000Z
2021-12-26T17:45:13.000Z
from django.contrib import admin from oss_bash.models import Address, Developer # Register your models here. admin.site.register(Developer) admin.site.register(Address)
19.111111
46
0.813953
24
172
5.791667
0.583333
0.129496
0.244604
0
0
0
0
0
0
0
0
0
0.110465
172
8
47
21.5
0.908497
0.151163
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
38487b0aa259b2b96c5ca35102206a9a0a1e9715
143
py
Python
easier68k/core/util/input.py
bpas247/Easier68k
30a39883f1e73cd2bd848cf7bd356c96b8664ff4
[ "MIT" ]
16
2018-03-03T21:00:14.000Z
2021-11-04T09:16:08.000Z
easier68k/core/util/input.py
bpas247/Easier68k
30a39883f1e73cd2bd848cf7bd356c96b8664ff4
[ "MIT" ]
99
2018-02-27T19:02:59.000Z
2019-10-29T22:39:26.000Z
easier68k/core/util/input.py
bpas247/Easier68k
30a39883f1e73cd2bd848cf7bd356c96b8664ff4
[ "MIT" ]
5
2018-04-04T02:03:10.000Z
2019-11-19T17:42:42.000Z
def get_input(): """ Wrap input in this method so that it can be wrapped with @patch in tests :return: """ return input('')
23.833333
76
0.601399
21
143
4.047619
0.809524
0
0
0
0
0
0
0
0
0
0
0
0.286713
143
6
77
23.833333
0.833333
0.566434
0
0
0
0
0
0
0
0
0
0
0
1
0.5
true
0
0
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
1
1
0
0
0
1
0
0
5
69a9e242e29154a6a6dab6b8082f8c7d4942043f
77
py
Python
lib/context_processor.py
PudgyPoppins/caps
8e57d1ab970bcb850938b4103e8d736e5afb8e80
[ "Apache-2.0" ]
null
null
null
lib/context_processor.py
PudgyPoppins/caps
8e57d1ab970bcb850938b4103e8d736e5afb8e80
[ "Apache-2.0" ]
null
null
null
lib/context_processor.py
PudgyPoppins/caps
8e57d1ab970bcb850938b4103e8d736e5afb8e80
[ "Apache-2.0" ]
null
null
null
def timezone(request): return {'tz': request.session.get('django_timezone')}
38.5
54
0.753247
10
77
5.7
0.8
0
0
0
0
0
0
0
0
0
0
0
0.064935
77
2
54
38.5
0.791667
0
0
0
0
0
0.217949
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
69cede239e8a4a69103c0bced9614b00355700ed
61
py
Python
zooapi/api/admin.py
ismyblue/zoo
b00d8af5a6d086369cf939e66884bd377fdf8333
[ "Apache-2.0" ]
2
2020-09-18T03:58:16.000Z
2021-03-15T12:28:57.000Z
zooapi/api/admin.py
ismyblue/zoo
b00d8af5a6d086369cf939e66884bd377fdf8333
[ "Apache-2.0" ]
null
null
null
zooapi/api/admin.py
ismyblue/zoo
b00d8af5a6d086369cf939e66884bd377fdf8333
[ "Apache-2.0" ]
null
null
null
# Name: admin.py # Author: HuangHao # Time: 2020/9/18 11:03
12.2
23
0.655738
11
61
3.636364
1
0
0
0
0
0
0
0
0
0
0
0.22
0.180328
61
4
24
15.25
0.58
0.868852
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
69e1d3bdcacf2406cf296bf9bd108c233781434e
48
py
Python
code/abc157_a_01.py
KoyanagiHitoshi/AtCoder
731892543769b5df15254e1f32b756190378d292
[ "MIT" ]
3
2019-08-16T16:55:48.000Z
2021-04-11T10:21:40.000Z
code/abc157_a_01.py
KoyanagiHitoshi/AtCoder
731892543769b5df15254e1f32b756190378d292
[ "MIT" ]
null
null
null
code/abc157_a_01.py
KoyanagiHitoshi/AtCoder
731892543769b5df15254e1f32b756190378d292
[ "MIT" ]
null
null
null
N=int(input()) print(N//2 if N%2==0 else N//2+1)
24
33
0.583333
14
48
2
0.642857
0.214286
0
0
0
0
0
0
0
0
0
0.116279
0.104167
48
2
33
24
0.534884
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
1
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
0
0
0
1
0
5
69f852af5fe9b70bd513ca7c564e031ca826fda7
55
py
Python
ivav/gates/single_qubit/t/t.py
Gopal-Dahale/ivav
f4814ee0405e918986825bb780a678e0d6894d4e
[ "MIT" ]
3
2022-02-27T15:24:29.000Z
2022-02-27T17:17:26.000Z
ivav/gates/single_qubit/t/t.py
Gopal-Dahale/ivav
f4814ee0405e918986825bb780a678e0d6894d4e
[ "MIT" ]
null
null
null
ivav/gates/single_qubit/t/t.py
Gopal-Dahale/ivav
f4814ee0405e918986825bb780a678e0d6894d4e
[ "MIT" ]
null
null
null
"""T Gate""" def t(index, vector): return vector
9.166667
21
0.581818
8
55
4
0.75
0
0
0
0
0
0
0
0
0
0
0
0.236364
55
5
22
11
0.761905
0.109091
0
0
0
0
0
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
0e0befea4f10b45137cc2a70e327a744594a32c4
3,559
py
Python
pyaz/relay/hyco/authorization_rule/__init__.py
py-az-cli/py-az-cli
9a7dc44e360c096a5a2f15595353e9dad88a9792
[ "MIT" ]
null
null
null
pyaz/relay/hyco/authorization_rule/__init__.py
py-az-cli/py-az-cli
9a7dc44e360c096a5a2f15595353e9dad88a9792
[ "MIT" ]
null
null
null
pyaz/relay/hyco/authorization_rule/__init__.py
py-az-cli/py-az-cli
9a7dc44e360c096a5a2f15595353e9dad88a9792
[ "MIT" ]
1
2022-02-03T09:12:01.000Z
2022-02-03T09:12:01.000Z
from .... pyaz_utils import _call_az from . import keys def create(hybrid_connection_name, name, namespace_name, resource_group, rights=None): ''' Create Authorization Rule for given Relay Service Hybrid Connection Required Parameters: - hybrid_connection_name -- name of Hybrid Connection - name -- name of Hybrid Connection Authorization Rule - namespace_name -- Name of Namespace - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>` Optional Parameters: - rights -- Space-separated list of Authorization rule rights ''' return _call_az("az relay hyco authorization-rule create", locals()) def show(hybrid_connection_name, name, namespace_name, resource_group): ''' Shows the details of Authorization Rule for given Relay Service Hybrid Connection Required Parameters: - hybrid_connection_name -- name of Hybrid Connection - name -- name of Hybrid Connection Authorization Rule - namespace_name -- Name of Namespace - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>` ''' return _call_az("az relay hyco authorization-rule show", locals()) def list(hybrid_connection_name, namespace_name, resource_group): ''' shows list of Authorization Rule by Relay Service Hybrid Connection Required Parameters: - hybrid_connection_name -- name of Hybrid Connection - namespace_name -- Name of Namespace - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>` ''' return _call_az("az relay hyco authorization-rule list", locals()) def delete(hybrid_connection_name, name, namespace_name, resource_group): ''' Deletes the Authorization Rule of the given Relay Service Hybrid Connection. Required Parameters: - hybrid_connection_name -- name of Hybrid Connection - name -- name of Hybrid Connection Authorization Rule - namespace_name -- Name of Namespace - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>` ''' return _call_az("az relay hyco authorization-rule delete", locals()) def update(hybrid_connection_name, name, namespace_name, resource_group, rights, add=None, force_string=None, remove=None, set=None): ''' Create Authorization Rule for given Relay Service Hybrid Connection Required Parameters: - hybrid_connection_name -- name of Hybrid Connection - name -- name of Hybrid Connection Authorization Rule - namespace_name -- Name of Namespace - resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>` - rights -- Space-separated list of Authorization rule rights Optional Parameters: - add -- Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string> - force_string -- When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON. - remove -- Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove - set -- Update an object by specifying a property path and value to set. Example: --set property1.property2=<value> ''' return _call_az("az relay hyco authorization-rule update", locals())
45.628205
162
0.7356
459
3,559
5.583878
0.172113
0.149824
0.109247
0.121732
0.732345
0.732345
0.716738
0.716738
0.608272
0.564573
0
0.000692
0.187974
3,559
77
163
46.220779
0.886159
0.693734
0
0
0
0
0.215819
0
0
0
0
0
0
1
0.416667
false
0
0.166667
0
1
0
0
0
0
null
0
0
0
0
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
1
0
0
0
0
1
0
0
5
388020f1c09c83e5da244040c51d38f4ac81bf15
52
py
Python
examples/datetime.datetime.now/ex1.py
mcorne/python-by-example
15339c0909c84b51075587a6a66391100971c033
[ "MIT" ]
null
null
null
examples/datetime.datetime.now/ex1.py
mcorne/python-by-example
15339c0909c84b51075587a6a66391100971c033
[ "MIT" ]
null
null
null
examples/datetime.datetime.now/ex1.py
mcorne/python-by-example
15339c0909c84b51075587a6a66391100971c033
[ "MIT" ]
null
null
null
from datetime import datetime print(datetime.now())
17.333333
29
0.807692
7
52
6
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.096154
52
2
30
26
0.893617
0
0
0
0
0
0
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
38a959dc012c68a95ff3f65b0a9254c26a1ce4a9
136
py
Python
tests/inline_test_resources/2/script.py
thesynman/pybricksdev
6f34cfb7a5f26628fe3cedae1ce51ee6024f57b9
[ "MIT" ]
null
null
null
tests/inline_test_resources/2/script.py
thesynman/pybricksdev
6f34cfb7a5f26628fe3cedae1ce51ee6024f57b9
[ "MIT" ]
null
null
null
tests/inline_test_resources/2/script.py
thesynman/pybricksdev
6f34cfb7a5f26628fe3cedae1ce51ee6024f57b9
[ "MIT" ]
null
null
null
import importA print(importA.foo) # expect the following line to be unchanged, because importB isn't imported here print(importB.flab)
22.666667
80
0.801471
21
136
5.190476
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.132353
136
5
81
27.2
0.923729
0.573529
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
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
1
0
1
0
0
1
0
5
38b3702c9c550e085de00d137cd0a98501db305e
74
py
Python
hddm/tests/__init__.py
twiecki/hddm
854513b2a04dbd43dab84d14fdede64ec64f0eab
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
hddm/tests/__init__.py
twiecki/hddm
854513b2a04dbd43dab84d14fdede64ec64f0eab
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
hddm/tests/__init__.py
twiecki/hddm
854513b2a04dbd43dab84d14fdede64ec64f0eab
[ "BSD-2-Clause-FreeBSD" ]
1
2019-09-04T13:54:49.000Z
2019-09-04T13:54:49.000Z
import unittest from test_models import * from test_likelihoods import *
14.8
30
0.824324
10
74
5.9
0.6
0.271186
0
0
0
0
0
0
0
0
0
0
0.148649
74
4
31
18.5
0.936508
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
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
38c636f94c3ff1e21414030a68d4fd3be95433e0
1,973
py
Python
rpython/translator/backendopt/test/test_innerloop.py
nanjekyejoannah/pypy
e80079fe13c29eda7b2a6b4cd4557051f975a2d9
[ "Apache-2.0", "OpenSSL" ]
381
2018-08-18T03:37:22.000Z
2022-02-06T23:57:36.000Z
rpython/translator/backendopt/test/test_innerloop.py
nanjekyejoannah/pypy
e80079fe13c29eda7b2a6b4cd4557051f975a2d9
[ "Apache-2.0", "OpenSSL" ]
16
2018-09-22T18:12:47.000Z
2022-02-22T20:03:59.000Z
rpython/translator/backendopt/test/test_innerloop.py
nanjekyejoannah/pypy
e80079fe13c29eda7b2a6b4cd4557051f975a2d9
[ "Apache-2.0", "OpenSSL" ]
55
2015-08-16T02:41:30.000Z
2022-03-20T20:33:35.000Z
from rpython.translator.translator import TranslationContext from rpython.translator.backendopt.innerloop import find_inner_loops from rpython.conftest import option def test_simple_loop(): def snippet_fn(x, y): while y > 0: y -= x return y t = TranslationContext() graph = t.buildflowgraph(snippet_fn) if option.view: t.view() loops = find_inner_loops(graph) assert len(loops) == 1 loop = loops[0] assert loop.headblock.operations[0].opname == 'gt' assert len(loop.links) == 2 assert loop.links[0] in loop.headblock.exits assert loop.links[1] in loop.links[0].target.exits assert loop.links[1].target is loop.headblock def test_two_loops(): def snippet_fn(x, y): while y > 0: y -= x while y < 0: y += x return y t = TranslationContext() graph = t.buildflowgraph(snippet_fn) if option.view: t.view() loops = find_inner_loops(graph) assert len(loops) == 2 assert loops[0].headblock is not loops[1].headblock for loop in loops: assert loop.headblock.operations[0].opname in ('gt', 'lt') assert len(loop.links) == 2 assert loop.links[0] in loop.headblock.exits assert loop.links[1] in loop.links[0].target.exits assert loop.links[1].target is loop.headblock def test_nested_loops(): def snippet_fn(x, z): y = 0 while y <= 10: while z < y: z += y y += 1 return z t = TranslationContext() graph = t.buildflowgraph(snippet_fn) if option.view: t.view() loops = find_inner_loops(graph) assert len(loops) == 1 loop = loops[0] assert loop.headblock.operations[0].opname == 'lt' assert len(loop.links) == 2 assert loop.links[0] in loop.headblock.exits assert loop.links[1] in loop.links[0].target.exits assert loop.links[1].target is loop.headblock
30.828125
68
0.620882
278
1,973
4.334532
0.172662
0.112033
0.112033
0.099585
0.781743
0.762656
0.73278
0.73278
0.73278
0.73278
0
0.022176
0.268626
1,973
63
69
31.31746
0.81289
0
0
0.65
0
0
0.004055
0
0
0
0
0
0.316667
1
0.1
false
0
0.05
0
0.2
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
38cb7d0404f5d4973cd5138132204949be5af6e7
60
py
Python
python/pudding/dimension_reduction/__init__.py
Duconnor/Pudding
4565f2ad9a933e83e9eacbc5ebe848599ea9cec1
[ "MIT" ]
3
2022-01-08T05:05:30.000Z
2022-01-09T10:09:57.000Z
python/pudding/dimension_reduction/__init__.py
Duconnor/Pudding
4565f2ad9a933e83e9eacbc5ebe848599ea9cec1
[ "MIT" ]
null
null
null
python/pudding/dimension_reduction/__init__.py
Duconnor/Pudding
4565f2ad9a933e83e9eacbc5ebe848599ea9cec1
[ "MIT" ]
null
null
null
''' Demension reduction algorithms ''' from .pca import PCA
12
30
0.733333
7
60
6.285714
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.15
60
5
31
12
0.862745
0.5
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
38ce51d4536088e1bba3bfefabbf1bb940828026
42
py
Python
8 kyu/Beginner - Lost Without a Map/Beginner - Lost Without a Map.py
anthonyjatoba/codewars
76b0d66dd1ba76a4d136b658920cdf85fd5c4b06
[ "MIT" ]
null
null
null
8 kyu/Beginner - Lost Without a Map/Beginner - Lost Without a Map.py
anthonyjatoba/codewars
76b0d66dd1ba76a4d136b658920cdf85fd5c4b06
[ "MIT" ]
null
null
null
8 kyu/Beginner - Lost Without a Map/Beginner - Lost Without a Map.py
anthonyjatoba/codewars
76b0d66dd1ba76a4d136b658920cdf85fd5c4b06
[ "MIT" ]
null
null
null
def maps(a): return [v * 2 for v in a]
21
29
0.547619
10
42
2.3
0.8
0
0
0
0
0
0
0
0
0
0
0.034483
0.309524
42
2
29
21
0.758621
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0.5
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
1
0
0
0
1
0
0
0
5
38dba5ee426c654bcd5cf2329da97c48375dbbdf
11,158
py
Python
src/Util/test_Array2DUtil.py
CWKSC/Note-CS4186-Computer-Vision-and-Image-Processing
f3ddcb57cd3d78dff4b8df2d7d2de68a7f7c9d5e
[ "MIT" ]
1
2022-03-31T12:01:24.000Z
2022-03-31T12:01:24.000Z
src/Util/test_Array2DUtil.py
CWKSC/Note-CS4186-Computer-Vision-and-Image-Processing
f3ddcb57cd3d78dff4b8df2d7d2de68a7f7c9d5e
[ "MIT" ]
null
null
null
src/Util/test_Array2DUtil.py
CWKSC/Note-CS4186-Computer-Vision-and-Image-Processing
f3ddcb57cd3d78dff4b8df2d7d2de68a7f7c9d5e
[ "MIT" ]
null
null
null
from re import A import pytest import Util.Array2DUtil as Array2DUtil def test_zero(): assert Array2DUtil.zero(1, 1) == [[0]] assert Array2DUtil.zero(2, 2) == [[0, 0], [0, 0]] assert Array2DUtil.zero(3, 3) == [[0, 0, 0], [0, 0, 0], [0, 0, 0]] assert Array2DUtil.zero(4, 4) == [ [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], ] assert Array2DUtil.zero(2, 5) == [ [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], ] assert Array2DUtil.zero(5, 3) == [ [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], ] def test_zero_raise(): with pytest.raises(ValueError): Array2DUtil.zero(-1, -1) with pytest.raises(ValueError): Array2DUtil.zero(-1, 0) with pytest.raises(ValueError): Array2DUtil.zero(0, -1) with pytest.raises(ValueError): Array2DUtil.zero(0, 0) with pytest.raises(ValueError): Array2DUtil.zero(1, 0) with pytest.raises(ValueError): Array2DUtil.zero(0, 1) def test_paddingZero(): assert Array2DUtil.paddingZero(3, 3, 1) == [[0]] assert Array2DUtil.paddingZero(4, 4, 1) == [[0, 0], [0, 0]] assert Array2DUtil.paddingZero(5, 5, 1) == [[0, 0, 0], [0, 0, 0], [0, 0, 0]] assert Array2DUtil.paddingZero(5, 5, 2) == [[0]] assert Array2DUtil.paddingZero(6, 6, 1) == [ [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], ] assert Array2DUtil.paddingZero(6, 6, 2) == [[0, 0], [0, 0]] def test_paddingZero_raise(): with pytest.raises(ValueError): Array2DUtil.paddingZero(0, 0, 0) with pytest.raises(ValueError): Array2DUtil.paddingZero(0, 1, 0) with pytest.raises(ValueError): Array2DUtil.paddingZero(1, 0, 0) with pytest.raises(ValueError): Array2DUtil.paddingZero(3, 3, 2) with pytest.raises(ValueError): Array2DUtil.paddingZero(4, 4, 2) with pytest.raises(ValueError): Array2DUtil.paddingZero(5, 5, 3) def test_getRowCol(): assert Array2DUtil.getRowCol([[1, 2], [3, 4]]) == (2, 2) assert Array2DUtil.getRowCol([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == (3, 3) assert Array2DUtil.getRowCol([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]) == ( 3, 4, ) assert Array2DUtil.getRowCol( [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]] ) == (3, 5) assert Array2DUtil.getRowCol( [ [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], ] ) == (5, 3) def test_getRadius(): assert Array2DUtil.getRadius([[1]]) == 0 assert Array2DUtil.getRadius([[1, 2], [3, 4]]) == 1 assert Array2DUtil.getRadius([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == 1 assert ( Array2DUtil.getRadius( [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]] ) == 2 ) assert ( Array2DUtil.getRadius( [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], ] ) == 2 ) assert ( Array2DUtil.getRadius( [ [1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36], ] ) == 3 ) assert ( Array2DUtil.getRadius( [ [1, 2, 3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13, 14], [15, 16, 17, 18, 19, 20, 21], [22, 23, 24, 25, 26, 27, 28], [29, 30, 31, 32, 33, 34, 35], [36, 37, 38, 39, 40, 41, 42], [43, 44, 45, 46, 47, 48, 49], ] ) == 3 ) def test_getRadius_raise(): with pytest.raises(ValueError): Array2DUtil.getRadius([[]]) == 0 with pytest.raises(ValueError): Array2DUtil.getRadius([[1, 2], [3, 4], [5, 6]]) with pytest.raises(ValueError): Array2DUtil.getRadius([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]) def test_getMinRadius(): assert Array2DUtil.getMinRadius([[1]]) == 0 assert Array2DUtil.getMinRadius([[1, 2], [3, 4]]) == 1 assert Array2DUtil.getMinRadius([[1, 2], [3, 4], [5, 6]]) == 1 assert Array2DUtil.getMinRadius([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == 1 assert ( Array2DUtil.getMinRadius( [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]] ) == 2 ) assert ( Array2DUtil.getMinRadius( [ [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16], [17, 18, 19, 20], ] ) == 2 ) assert ( Array2DUtil.getMinRadius( [ [1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18], [19, 20, 21], ] ) == 1 ) assert ( Array2DUtil.getMinRadius( [ [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16], [17, 18, 19, 20], [21, 22, 23, 24], [25, 26, 27, 28], ] ) == 2 ) def test_iter(): assert list(Array2DUtil.iter([[1, 2], [3, 4]])) == [ (0, 0), (0, 1), (1, 0), (1, 1), ] assert list(Array2DUtil.iter([[1, 2, 3], [4, 5, 6], [7, 8, 9]])) == [ (0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2), ] assert list( Array2DUtil.iter( [ [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16], ] ) ) == [ (0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3), (3, 0), (3, 1), (3, 2), (3, 3), ] assert list(Array2DUtil.iter([[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]])) == [ (0, 0), (0, 1), (1, 0), (1, 1), (2, 0), (2, 1), (3, 0), (3, 1), (4, 0), (4, 1), ] def test_iterEle(): assert list(Array2DUtil.iterEle([[1, 2], [3, 4]])) == [ (1, 0, 0), (2, 0, 1), (3, 1, 0), (4, 1, 1), ] assert list(Array2DUtil.iterEle([[1, 2, 3], [4, 5, 6], [7, 8, 9]])) == [ (1, 0, 0), (2, 0, 1), (3, 0, 2), (4, 1, 0), (5, 1, 1), (6, 1, 2), (7, 2, 0), (8, 2, 1), (9, 2, 2), ] assert list(Array2DUtil.iterEle([[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]])) == [ (1, 0, 0), (2, 0, 1), (3, 1, 0), (4, 1, 1), (5, 2, 0), (6, 2, 1), (7, 3, 0), (8, 3, 1), (9, 4, 0), (10, 4, 1), ] def test_paddingIter(): assert list(Array2DUtil.paddingIter([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1)) == [ (1, 1) ] assert list( Array2DUtil.paddingIter( [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]], 1 ) ) == [ (1, 1), (1, 2), (2, 1), (2, 2), ] assert ( list( Array2DUtil.paddingIter( [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]], 2 ) ) == [] ) assert list( Array2DUtil.paddingIter( [ [1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30], ], 2, ) ) == [(2, 2), (2, 3)] def test_paddingIter_raise(): with pytest.raises(ValueError): list(Array2DUtil.paddingIter([[1, 2, 3], [4, 5, 6], [7, 8, 9]], -1)) with pytest.raises(ValueError): list(Array2DUtil.paddingIter([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 2)) def test_centerAlignOffsetIter(): assert list(Array2DUtil.centerAlignOffsetIter([[1]])) == [(0, 0)] assert list( Array2DUtil.centerAlignOffsetIter([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) ) == [ (-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 0), (0, 1), (1, -1), (1, 0), (1, 1), ] assert list( Array2DUtil.centerAlignOffsetIter( [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], ] ) ) == [ (-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2), (-1, -2), (-1, -1), (-1, 0), (-1, 1), (-1, 2), (0, -2), (0, -1), (0, 0), (0, 1), (0, 2), (1, -2), (1, -1), (1, 0), (1, 1), (1, 2), (2, -2), (2, -1), (2, 0), (2, 1), (2, 2), ] def test_centerAlignOffsetArray2D(): assert list(Array2DUtil.centerAlignOffsetArray2D(0)) == [[(0, 0)]] assert list(Array2DUtil.centerAlignOffsetArray2D(1)) == [ [(-1, -1), (-1, 0), (-1, 1)], [(0, -1), (0, 0), (0, 1)], [(1, -1), (1, 0), (1, 1)], ] assert list(Array2DUtil.centerAlignOffsetArray2D(2)) == [ [(-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2)], [(-1, -2), (-1, -1), (-1, 0), (-1, 1), (-1, 2)], [(0, -2), (0, -1), (0, 0), (0, 1), (0, 2)], [(1, -2), (1, -1), (1, 0), (1, 1), (1, 2)], [(2, -2), (2, -1), (2, 0), (2, 1), (2, 2)], ] def test_map(): assert Array2DUtil.map( [[1, 2, 3], [4, 5, 6], [7, 8, 9]], lambda ele, r, c: ele + 1 ) == [ [2, 3, 4], [5, 6, 7], [8, 9, 10], ] assert Array2DUtil.map( [[0, 0, 0], [0, 0, 0], [0, 0, 0]], lambda ele, r, c: r + c ) == [ [0, 1, 2], [1, 2, 3], [2, 3, 4], ] def test_sum(): assert Array2DUtil.sum([[1, 2], [3, 4]]) == 10 assert Array2DUtil.sum([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == 45 assert ( Array2DUtil.sum([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) == 136 ) assert ( Array2DUtil.sum( [ [1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0], [13.0, 14.0, 15.0, 16.0], ] ) == 136.0 )
24.961969
88
0.360638
1,453
11,158
2.755678
0.057123
0.062937
0.074176
0.077922
0.795704
0.766484
0.733516
0.62038
0.576174
0.562687
0
0.218046
0.422925
11,158
446
89
25.017937
0.403789
0
0
0.460048
0
0
0
0
0
0
0
0
0.133172
1
0.038741
true
0
0.007264
0
0.046005
0
0
0
0
null
0
0
0
0
1
1
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
1
0
0
0
0
0
0
5
2a13062ba53d1b8c8c8cb308d6c37a7fdc3d46b3
237
py
Python
formatters.py
mobileAppSoft/tm.py
cbca078d20c8f99bdf41ced088a66c919f080b1c
[ "MIT" ]
null
null
null
formatters.py
mobileAppSoft/tm.py
cbca078d20c8f99bdf41ced088a66c919f080b1c
[ "MIT" ]
4
2019-08-18T17:42:13.000Z
2021-06-02T00:47:22.000Z
formatters.py
mobileAppSoft/tm.py
cbca078d20c8f99bdf41ced088a66c919f080b1c
[ "MIT" ]
1
2019-08-16T00:53:42.000Z
2019-08-16T00:53:42.000Z
from datetime import datetime DATETIME_TMP = '%Y-%m-%d %H:%M:%S.%f' def formatTSP(timestamp): return datetime.utcfromtimestamp(timestamp).strftime(DATETIME_TMP)[:-3] if timestamp else datetime.utcnow().strftime(DATETIME_TMP)[:-3]
29.625
139
0.742616
33
237
5.242424
0.606061
0.190751
0.219653
0.231214
0
0
0
0
0
0
0
0.009346
0.097046
237
7
140
33.857143
0.799065
0
0
0
0
0
0.084388
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
0.75
0
0
0
0
null
0
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
1
0
0
0
1
0
0
0
5
2a35c09d44c00b5774c3429a59ed704b48f75f90
159
py
Python
events_emitter/events_factory/base_time_series.py
cognitev/events-emitter
9728b843c337bf1e7068c06829cc79e3e13a333c
[ "MIT" ]
null
null
null
events_emitter/events_factory/base_time_series.py
cognitev/events-emitter
9728b843c337bf1e7068c06829cc79e3e13a333c
[ "MIT" ]
2
2020-06-06T01:23:37.000Z
2021-06-10T22:33:08.000Z
events_emitter/events_factory/base_time_series.py
cognitev/events-emitter
9728b843c337bf1e7068c06829cc79e3e13a333c
[ "MIT" ]
null
null
null
from abc import ABC, abstractmethod class BaseTimeSeries(ABC): @abstractmethod def get_event_last_creation(self, event_type, **kwargs): pass
19.875
60
0.72956
19
159
5.894737
0.789474
0.303571
0
0
0
0
0
0
0
0
0
0
0.194969
159
7
61
22.714286
0.875
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0.2
0.2
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
1
0
0
1
0
0
5
2a446780e4ff6167788912e3bdaf6d4d546a0b99
163
py
Python
fullpath.py
SlimyMonkey/divePython
2a9e7c4ee2c5b6bc995eabb718ed417cb76da1a5
[ "CNRI-Python-GPL-Compatible" ]
1
2017-03-07T05:50:12.000Z
2017-03-07T05:50:12.000Z
fullpath.py
SlimyMonkey/divePython
2a9e7c4ee2c5b6bc995eabb718ed417cb76da1a5
[ "CNRI-Python-GPL-Compatible" ]
null
null
null
fullpath.py
SlimyMonkey/divePython
2a9e7c4ee2c5b6bc995eabb718ed417cb76da1a5
[ "CNRI-Python-GPL-Compatible" ]
null
null
null
import sys, os print 'sys.argv[0] =', sys.argv[0] pathname = os.path.dirname(sys.argv[0]) print 'path =', pathname print 'full path =', os.path.abspath(pathname)
23.285714
46
0.687117
27
163
4.148148
0.407407
0.1875
0.214286
0
0
0
0
0
0
0
0
0.020979
0.122699
163
6
47
27.166667
0.762238
0
0
0
0
0
0.184049
0
0
0
0
0
0
0
null
null
0
0.2
null
null
0.6
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
1
0
0
0
0
0
0
1
0
5
2a568530d0802528dc34e76f2b9b693a6cd881f5
1,484
py
Python
app/migrations/0005_auto_20210117_1832.py
XuTiany1/Tianyi-ICS3U-SummativeProject
db6685c4646a9f9d6a7c9a8924f8c8282713a875
[ "MIT" ]
null
null
null
app/migrations/0005_auto_20210117_1832.py
XuTiany1/Tianyi-ICS3U-SummativeProject
db6685c4646a9f9d6a7c9a8924f8c8282713a875
[ "MIT" ]
null
null
null
app/migrations/0005_auto_20210117_1832.py
XuTiany1/Tianyi-ICS3U-SummativeProject
db6685c4646a9f9d6a7c9a8924f8c8282713a875
[ "MIT" ]
null
null
null
# Generated by Django 2.1.15 on 2021-01-17 23:32 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0004_auto_20210115_2343'), ] operations = [ migrations.AlterField( model_name='course', name='name', field=models.CharField(max_length=100), ), migrations.AlterField( model_name='course', name='period', field=models.CharField(max_length=100), ), migrations.AlterField( model_name='course', name='place', field=models.CharField(max_length=100), ), migrations.AlterField( model_name='course', name='price', field=models.PositiveIntegerField(default=0), ), migrations.AlterField( model_name='course_student', name='attend_times', field=models.PositiveIntegerField(default=0), ), migrations.AlterField( model_name='student', name='email', field=models.EmailField(max_length=100), ), migrations.AlterField( model_name='student', name='name', field=models.CharField(max_length=100), ), migrations.AlterField( model_name='student', name='phone', field=models.CharField(max_length=100), ), ]
27.481481
57
0.541779
133
1,484
5.902256
0.353383
0.203822
0.254777
0.295541
0.724841
0.717197
0.617834
0.617834
0.617834
0.369427
0
0.053388
0.343666
1,484
53
58
28
0.752567
0.030997
0
0.680851
1
0
0.091226
0.016017
0
0
0
0
0
1
0
false
0
0.021277
0
0.085106
0
0
0
0
null
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
2a89411c50d33fc069fa6317602aaa71ddfb728a
5,036
py
Python
addons/project/tests/test_project_flow.py
shdkej/odoo_gvm
15b797e60a329f5d2fddb817a2b30a926b5873fa
[ "MIT" ]
1
2019-12-19T01:53:13.000Z
2019-12-19T01:53:13.000Z
apps/odoo/lib/odoo-10.0.post20170615-py2.7.egg/odoo/addons/project/tests/test_project_flow.py
gtfarng/Odoo_migrade
9cc28fae4c379e407645248a29d22139925eafe7
[ "Apache-2.0" ]
3
2020-12-06T11:10:32.000Z
2020-12-06T11:16:48.000Z
apps/odoo/lib/odoo-10.0.post20170615-py2.7.egg/odoo/addons/project/tests/test_project_flow.py
gtfarng/Odoo_migrade
9cc28fae4c379e407645248a29d22139925eafe7
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from .test_project_base import TestProjectBase from odoo.tools import mute_logger EMAIL_TPL = """Return-Path: <whatever-2a840@postmaster.twitter.com> X-Original-To: {to} Delivered-To: {to} To: {to} cc: {cc} Received: by mail1.odoo.com (Postfix, from userid 10002) id 5DF9ABFB2A; Fri, 10 Aug 2012 16:16:39 +0200 (CEST) Message-ID: {msg_id} Date: Tue, 29 Nov 2011 12:43:21 +0530 From: {email_from} MIME-Version: 1.0 Subject: {subject} Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hello, This email should create a new entry in your module. Please check that it effectively works. Thanks, -- Raoul Boitempoils Integrator at Agrolait""" class TestProjectFlow(TestProjectBase): def test_project_process_project_manager_duplicate(self): pigs = self.project_pigs.sudo(self.user_projectmanager) dogs = pigs.copy() self.assertEqual(len(dogs.tasks), 2, 'project: duplicating a project must duplicate its tasks') @mute_logger('odoo.addons.mail.mail_thread') def test_task_process_without_stage(self): # Do: incoming mail from an unknown partner on an alias creates a new task 'Frogs' task = self.format_and_process( EMAIL_TPL, to='project+pigs@mydomain.com, valid.lelitre@agrolait.com', cc='valid.other@gmail.com', email_from='%s' % self.user_projectuser.email, subject='Frogs', msg_id='<1198923581.41972151344608186760.JavaMail@agrolait.com>', target_model='project.task') # Test: one task created by mailgateway administrator self.assertEqual(len(task), 1, 'project: message_process: a new project.task should have been created') # Test: check partner in message followers self.assertIn(self.partner_2, task.message_partner_ids, "Partner in message cc is not added as a task followers.") # Test: messages self.assertEqual(len(task.message_ids), 2, 'project: message_process: newly created task should have 2 messages: creation and email') self.assertEqual(task.message_ids[1].subtype_id.name, 'Task Opened', 'project: message_process: first message of new task should have Task Created subtype') self.assertEqual(task.message_ids[0].author_id, self.user_projectuser.partner_id, 'project: message_process: second message should be the one from Agrolait (partner failed)') self.assertEqual(task.message_ids[0].subject, 'Frogs', 'project: message_process: second message should be the one from Agrolait (subject failed)') # Test: task content self.assertEqual(task.name, 'Frogs', 'project_task: name should be the email subject') self.assertEqual(task.project_id.id, self.project_pigs.id, 'project_task: incorrect project') self.assertEqual(task.stage_id.sequence, False, "project_task: shouldn't have a stage, i.e. sequence=False") @mute_logger('odoo.addons.mail.mail_thread') def test_task_process_with_stages(self): # Do: incoming mail from an unknown partner on an alias creates a new task 'Cats' task = self.format_and_process( EMAIL_TPL, to='project+goats@mydomain.com, valid.lelitre@agrolait.com', cc='valid.other@gmail.com', email_from='%s' % self.user_projectuser.email, subject='Cats', msg_id='<1198923581.41972151344608186760.JavaMail@agrolait.com>', target_model='project.task') # Test: one task created by mailgateway administrator self.assertEqual(len(task), 1, 'project: message_process: a new project.task should have been created') # Test: check partner in message followers self.assertIn(self.partner_2, task.message_partner_ids, "Partner in message cc is not added as a task followers.") # Test: messages self.assertEqual(len(task.message_ids), 2, 'project: message_process: newly created task should have 2 messages: creation and email') self.assertEqual(task.message_ids[1].subtype_id.name, 'Task Opened', 'project: message_process: first message of new task should have Task Created subtype') self.assertEqual(task.message_ids[0].author_id, self.user_projectuser.partner_id, 'project: message_process: second message should be the one from Agrolait (partner failed)') self.assertEqual(task.message_ids[0].subject, 'Cats', 'project: message_process: second message should be the one from Agrolait (subject failed)') # Test: task content self.assertEqual(task.name, 'Cats', 'project_task: name should be the email subject') self.assertEqual(task.project_id.id, self.project_goats.id, 'project_task: incorrect project') self.assertEqual(task.stage_id.sequence, 1, "project_task: should have a stage with sequence=1")
53.574468
122
0.695393
676
5,036
5.057692
0.272189
0.074583
0.066686
0.045627
0.726528
0.726528
0.726528
0.726528
0.726528
0.702545
0
0.032459
0.204726
5,036
93
123
54.150538
0.821223
0.101072
0
0.38806
0
0
0.489145
0.07798
0
0
0
0
0.283582
1
0.044776
false
0
0.029851
0
0.089552
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
2a9372ac18575597b8284202dbb15a4bd4337ce2
86
py
Python
tests/data/program_analysis/PyAST2CAST/if/test_if_2.py
rsulli55/automates
1647a8eef85c4f03086a10fa72db3b547f1a0455
[ "Apache-2.0" ]
17
2018-12-19T16:32:38.000Z
2021-10-05T07:58:15.000Z
tests/data/program_analysis/PyAST2CAST/if/test_if_2.py
rsulli55/automates
1647a8eef85c4f03086a10fa72db3b547f1a0455
[ "Apache-2.0" ]
183
2018-12-20T17:03:01.000Z
2022-02-23T22:21:42.000Z
tests/data/program_analysis/PyAST2CAST/if/test_if_2.py
rsulli55/automates
1647a8eef85c4f03086a10fa72db3b547f1a0455
[ "Apache-2.0" ]
5
2019-01-04T22:37:49.000Z
2022-01-19T17:34:16.000Z
def main(): x = 10 if(x == 5): x = 1 else: x = 2 x = 3
12.285714
15
0.27907
14
86
1.714286
0.714286
0
0
0
0
0
0
0
0
0
0
0.162162
0.569767
86
7
16
12.285714
0.486486
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0
0
0.142857
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
1
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
aa4d37c0a8364d68bd0dc3d9b936b154db9c3325
42
py
Python
backend/__init__.py
Programmeerclub-WLG/Agena-App
941918e44772aca01e7f9b061010c3287e3559f4
[ "Apache-2.0" ]
null
null
null
backend/__init__.py
Programmeerclub-WLG/Agena-App
941918e44772aca01e7f9b061010c3287e3559f4
[ "Apache-2.0" ]
null
null
null
backend/__init__.py
Programmeerclub-WLG/Agena-App
941918e44772aca01e7f9b061010c3287e3559f4
[ "Apache-2.0" ]
null
null
null
# Dummy file to turn this into a package
21
41
0.738095
8
42
3.875
1
0
0
0
0
0
0
0
0
0
0
0
0.238095
42
1
42
42
0.96875
0.904762
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
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
0
0
0
0
0
5
2aee3d733b3a8b4ef51d316c8b90cf5c7a64b210
165
py
Python
govtrack/test/test_structures.py
Joeyrsp/climate-emergency-declarations
115981c478b1b8a36419893026d695c87a884174
[ "MIT" ]
null
null
null
govtrack/test/test_structures.py
Joeyrsp/climate-emergency-declarations
115981c478b1b8a36419893026d695c87a884174
[ "MIT" ]
6
2019-09-02T12:27:21.000Z
2020-05-10T00:31:37.000Z
govtrack/test/test_structures.py
Joeyrsp/climate-emergency-declarations
115981c478b1b8a36419893026d695c87a884174
[ "MIT" ]
4
2019-08-25T07:16:45.000Z
2020-03-10T10:14:12.000Z
from django.test import TestCase from django.urls import reverse from govtrack.models import Country class NodeTests(TestCase): def setUp(self): pass
16.5
35
0.751515
22
165
5.636364
0.727273
0.16129
0
0
0
0
0
0
0
0
0
0
0.193939
165
9
36
18.333333
0.932331
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0.166667
0.5
0
0.833333
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
2af174a0959635590ba8156533d799b4c53d0f57
23
py
Python
Chapter 01/ch1_1.py
bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
f6a4194684515495d00aa38347a725dd08f39a0c
[ "MIT" ]
null
null
null
Chapter 01/ch1_1.py
bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
f6a4194684515495d00aa38347a725dd08f39a0c
[ "MIT" ]
null
null
null
Chapter 01/ch1_1.py
bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
f6a4194684515495d00aa38347a725dd08f39a0c
[ "MIT" ]
null
null
null
print("Thank You God!")
23
23
0.695652
4
23
4
1
0
0
0
0
0
0
0
0
0
0
0
0.086957
23
1
23
23
0.761905
0
0
0
0
0
0.583333
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
2d696ab3d95afb976ced0c3ae0361a61f46679cb
157
py
Python
graphene_pydantic/__init__.py
stabacco/graphene-pydantic
41d62e1879b1f6ebd75319c39b0a872ec6594cc5
[ "Apache-2.0", "MIT" ]
101
2020-07-06T13:44:36.000Z
2022-03-27T18:11:29.000Z
graphene_pydantic/__init__.py
stabacco/graphene-pydantic
41d62e1879b1f6ebd75319c39b0a872ec6594cc5
[ "Apache-2.0", "MIT" ]
37
2020-07-03T17:10:29.000Z
2022-02-07T19:36:36.000Z
graphene_pydantic/__init__.py
stabacco/graphene-pydantic
41d62e1879b1f6ebd75319c39b0a872ec6594cc5
[ "Apache-2.0", "MIT" ]
33
2020-07-14T21:12:05.000Z
2022-02-03T22:47:07.000Z
from .inputobjecttype import PydanticInputObjectType from .objecttype import PydanticObjectType __all__ = ["PydanticObjectType", "PydanticInputObjectType"]
31.4
59
0.853503
11
157
11.818182
0.636364
0
0
0
0
0
0
0
0
0
0
0
0.082803
157
4
60
39.25
0.902778
0
0
0
0
0
0.261147
0.146497
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
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
0
0
1
0
1
0
0
5
2dc24cc2290a86c4283e8483b782c4b00e4602fb
205
py
Python
tests/utils/test_strip.py
arkhn/cleaning-scripts
ffe88598b476b2e6b53fd06e8ce6092ef0351b19
[ "Apache-2.0" ]
9
2019-03-31T03:46:51.000Z
2020-05-20T13:05:06.000Z
tests/utils/test_strip.py
arkhn/cleaning-scripts
ffe88598b476b2e6b53fd06e8ce6092ef0351b19
[ "Apache-2.0" ]
18
2019-09-11T09:19:45.000Z
2021-07-13T09:16:23.000Z
tests/utils/test_strip.py
arkhn/cleaning-scripts
ffe88598b476b2e6b53fd06e8ce6092ef0351b19
[ "Apache-2.0" ]
2
2019-09-18T15:20:10.000Z
2021-07-25T06:46:57.000Z
from scripts import utils def test_clean_identity(): assert utils.strip(None) == "" assert utils.strip("NaN") == "" row_input = "Holà chicanos" assert utils.strip(row_input) == row_input
22.777778
46
0.673171
27
205
4.925926
0.592593
0.24812
0.360902
0
0
0
0
0
0
0
0
0
0.195122
205
8
47
25.625
0.806061
0
0
0
0
0
0.078049
0
0
0
0
0
0.5
1
0.166667
false
0
0.166667
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
1
0
0
0
0
0
0
0
0
0
5
2dfbab6e76087a38164cd2bf66ee8f9eafe9b43d
199
py
Python
html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/meta-refresh.py
meyerweb/wpt
f04261533819893c71289614c03434c06856c13e
[ "BSD-3-Clause" ]
14,668
2015-01-01T01:57:10.000Z
2022-03-31T23:33:32.000Z
html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/meta-refresh.py
meyerweb/wpt
f04261533819893c71289614c03434c06856c13e
[ "BSD-3-Clause" ]
7,642
2018-05-28T09:38:03.000Z
2022-03-31T20:55:48.000Z
html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/meta-refresh.py
meyerweb/wpt
f04261533819893c71289614c03434c06856c13e
[ "BSD-3-Clause" ]
5,941
2015-01-02T11:32:21.000Z
2022-03-31T16:35:46.000Z
def main(request, response): time = request.url_parts.query if request.url_parts.query else u'0' return 200, [[b'Content-Type', b'text/html']], u'<meta http-equiv=refresh content=%s>' % time
49.75
97
0.698492
33
199
4.151515
0.727273
0.145985
0.218978
0.291971
0
0
0
0
0
0
0
0.023256
0.135678
199
3
98
66.333333
0.773256
0
0
0
0
0
0.291457
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
0
0
0
null
0
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
1
0
0
0
0
1
0
0
5
930bf48d98c974370250f583467d78fc0fe646fb
240
py
Python
server/ugrade/schema.py
jauhararifin/ugrade
c5bc0ce3920534cf289c739ffe8b83ceed9f52e8
[ "MIT" ]
15
2019-02-27T19:28:23.000Z
2019-07-20T17:54:46.000Z
server/ugrade/schema.py
jauhararifin/ugrade
c5bc0ce3920534cf289c739ffe8b83ceed9f52e8
[ "MIT" ]
9
2020-09-04T18:30:56.000Z
2022-03-25T18:41:11.000Z
server/ugrade/schema.py
jauhararifin/ugrade
c5bc0ce3920534cf289c739ffe8b83ceed9f52e8
[ "MIT" ]
2
2019-03-29T14:15:47.000Z
2019-04-12T06:08:11.000Z
import graphene import contests.schema class Query(contests.schema.Query, graphene.ObjectType): pass class Mutation(contests.schema.Mutation, graphene.ObjectType): pass schema = graphene.Schema(query=Query, mutation=Mutation)
17.142857
62
0.783333
28
240
6.714286
0.321429
0.223404
0.234043
0
0
0
0
0
0
0
0
0
0.125
240
13
63
18.461538
0.895238
0
0
0.285714
0
0
0
0
0
0
0
0
0
1
0
false
0.285714
0.285714
0
0.571429
0
1
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
0
1
0
0
1
0
0
5
934791c07719c65a23481848d0be36dea07664f2
138
py
Python
menpo/model/__init__.py
jacksoncsy/menpo
3cac491fe30454935ed12fcaa89f453c5f6ec878
[ "BSD-3-Clause" ]
null
null
null
menpo/model/__init__.py
jacksoncsy/menpo
3cac491fe30454935ed12fcaa89f453c5f6ec878
[ "BSD-3-Clause" ]
null
null
null
menpo/model/__init__.py
jacksoncsy/menpo
3cac491fe30454935ed12fcaa89f453c5f6ec878
[ "BSD-3-Clause" ]
null
null
null
from .base import MeanInstanceLinearModel, InstanceLinearModel from .linear import LinearModel, MeanLinearModel from .pca import PCAModel
34.5
62
0.862319
14
138
8.5
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.101449
138
3
63
46
0.959677
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
9356d44a897a955dd502c5c3a639975162b05425
55
py
Python
retro_star/alg/__init__.py
junsu-kim97/self_improved_retro
5bb2e641a57a0623f509dd7a006896e6a105373c
[ "MIT" ]
9
2021-06-21T02:19:57.000Z
2022-02-25T02:56:13.000Z
retro_star/alg/__init__.py
junsu-kim97/self_improved_retro
5bb2e641a57a0623f509dd7a006896e6a105373c
[ "MIT" ]
null
null
null
retro_star/alg/__init__.py
junsu-kim97/self_improved_retro
5bb2e641a57a0623f509dd7a006896e6a105373c
[ "MIT" ]
1
2021-11-25T01:15:10.000Z
2021-11-25T01:15:10.000Z
from retro_star.alg.molstar import molstar, molstar_ens
55
55
0.872727
9
55
5.111111
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.072727
55
1
55
55
0.901961
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
937abedcd16a0b3a53f79904e083b3148ead9b57
24,896
py
Python
matterapi/endpoints/sync_api/data_retention.py
gmerz/MatterApi
b116da58d3a4ca77739970a28e30672e0e611705
[ "MIT" ]
3
2022-01-26T23:31:01.000Z
2022-03-01T13:07:26.000Z
matterapi/endpoints/sync_api/data_retention.py
gmerz/MatterApi
b116da58d3a4ca77739970a28e30672e0e611705
[ "MIT" ]
null
null
null
matterapi/endpoints/sync_api/data_retention.py
gmerz/MatterApi
b116da58d3a4ca77739970a28e30672e0e611705
[ "MIT" ]
null
null
null
""" Module to access the DataRetention endpoints """ # pylint: disable=too-many-lines,too-many-locals,too-many-public-methods,too-few-public-methods from typing import Any, Dict, List, Optional, Union from pydantic import BaseModel from ...models import ( ChannelListWithTeamData, DataRetentionPolicyCreate, DataRetentionPolicyWithTeamAndChannelCounts, DataRetentionPolicyWithTeamAndChannelIds, GetDataRetentionPoliciesCountResponse200, GlobalDataRetentionPolicy, RetentionPolicyForChannelList, RetentionPolicyForTeamList, SearchChannelsForRetentionPolicyJsonBody, SearchTeamsForRetentionPolicyJsonBody, StatusOK, Team, ) from ..base import ApiBaseClass class DataRetentionApi(ApiBaseClass): """Endpoint for getting data retention policy settings.""" def get_team_policies_for_user( self, user_id: str, *, page: Optional[int] = 0, per_page: Optional[int] = 60, ) -> RetentionPolicyForTeamList: """Get the policies which are applied to a user's teams Gets the policies which are applied to the all of the teams to which a user belongs. ##### License Requires an E20 license. Permissions: Must be logged in as the user or have the `manage_system` permission. Minimum Server Version: 5.35 Api Reference: `GetTeamPoliciesForUser <https://api.mattermost.com/#operation/GetTeamPoliciesForUser>`_ """ url = f"/users/{user_id}/data_retention/team_policies" params: Dict[str, Any] = { "page": page, "per_page": per_page, } params = {k: v for k, v in params.items() if v is not None} request_kwargs = { "url": url, "params": params, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.get( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = RetentionPolicyForTeamList.parse_obj(response.json()) return response200 return response def get_channel_policies_for_user( self, user_id: str, *, page: Optional[int] = 0, per_page: Optional[int] = 60, ) -> RetentionPolicyForChannelList: """Get the policies which are applied to a user's channels Gets the policies which are applied to the all of the channels to which a user belongs. ##### License Requires an E20 license. Permissions: Must be logged in as the user or have the `manage_system` permission. Minimum Server Version: 5.35 Api Reference: `GetChannelPoliciesForUser <https://api.mattermost.com/#operation/GetChannelPoliciesForUser>`_ """ url = f"/users/{user_id}/data_retention/channel_policies" params: Dict[str, Any] = { "page": page, "per_page": per_page, } params = {k: v for k, v in params.items() if v is not None} request_kwargs = { "url": url, "params": params, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.get( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = RetentionPolicyForChannelList.parse_obj(response.json()) return response200 return response def get_data_retention_policy( self, ) -> GlobalDataRetentionPolicy: """Get the global data retention policy Gets the current global data retention policy details from the server, including what data should be purged and the cutoff times for each data type that should be purged. ##### License Requires an E20 license. Permissions: Requires an active session but no other permissions. Minimum Server Version: 4.3 Api Reference: `GetDataRetentionPolicy <https://api.mattermost.com/#operation/GetDataRetentionPolicy>`_ """ url = "/data_retention/policy" request_kwargs = { "url": url, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.get( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = GlobalDataRetentionPolicy.parse_obj(response.json()) return response200 return response def get_data_retention_policies_count( self, ) -> GetDataRetentionPoliciesCountResponse200: """Get the number of granular data retention policies Gets the number of granular (i.e. team or channel-specific) data retention policies from the server. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_read_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `GetDataRetentionPoliciesCount <https://api.mattermost.com/#operation/GetDataRetentionPoliciesCount>`_ """ url = "/data_retention/policies_count" request_kwargs = { "url": url, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.get( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = GetDataRetentionPoliciesCountResponse200.parse_obj( response.json() ) return response200 return response def get_data_retention_policies( self, *, page: Optional[int] = 0, per_page: Optional[int] = 60, ) -> List[DataRetentionPolicyWithTeamAndChannelCounts]: """Get the granular data retention policies Gets details about the granular (i.e. team or channel-specific) data retention policies from the server. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_read_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `GetDataRetentionPolicies <https://api.mattermost.com/#operation/GetDataRetentionPolicies>`_ """ url = "/data_retention/policies" params: Dict[str, Any] = { "page": page, "per_page": per_page, } params = {k: v for k, v in params.items() if v is not None} request_kwargs = { "url": url, "params": params, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.get( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = [] _response200 = response.json() for response200_item_data in _response200: response200_item = ( DataRetentionPolicyWithTeamAndChannelCounts.parse_obj( response200_item_data ) ) response200.append(response200_item) return response200 return response def create_data_retention_policy( self, *, json_body: Union[DataRetentionPolicyCreate, Dict], ) -> DataRetentionPolicyWithTeamAndChannelCounts: """Create a new granular data retention policy Creates a new granular data retention policy with the specified display name and post duration. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_write_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `CreateDataRetentionPolicy <https://api.mattermost.com/#operation/CreateDataRetentionPolicy>`_ """ url = "/data_retention/policies" if isinstance(json_body, BaseModel): json_json_body = json_body.dict(exclude_unset=True) else: json_json_body = json_body request_kwargs = { "url": url, "json": json_json_body, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.post( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 201: response201 = DataRetentionPolicyWithTeamAndChannelCounts.parse_obj( response.json() ) return response201 return response def get_data_retention_policy_by_id( self, policy_id: str, ) -> DataRetentionPolicyWithTeamAndChannelCounts: """Get a granular data retention policy Gets details about a granular data retention policies by ID. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_read_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `GetDataRetentionPolicyByID <https://api.mattermost.com/#operation/GetDataRetentionPolicyByID>`_ """ url = f"/data_retention/policies/{policy_id}" request_kwargs = { "url": url, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.get( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = DataRetentionPolicyWithTeamAndChannelCounts.parse_obj( response.json() ) return response200 return response def delete_data_retention_policy( self, policy_id: str, ) -> StatusOK: """Delete a granular data retention policy Deletes a granular data retention policy. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_write_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `DeleteDataRetentionPolicy <https://api.mattermost.com/#operation/DeleteDataRetentionPolicy>`_ """ url = f"/data_retention/policies/{policy_id}" request_kwargs = { "url": url, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.delete( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = StatusOK.parse_obj(response.json()) return response200 return response def patch_data_retention_policy( self, policy_id: str, *, json_body: Union[DataRetentionPolicyWithTeamAndChannelIds, Dict], ) -> DataRetentionPolicyWithTeamAndChannelCounts: """Patch a granular data retention policy Patches (i.e. replaces the fields of) a granular data retention policy. If any fields are omitted, they will not be changed. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_write_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `PatchDataRetentionPolicy <https://api.mattermost.com/#operation/PatchDataRetentionPolicy>`_ """ url = f"/data_retention/policies/{policy_id}" if isinstance(json_body, BaseModel): json_json_body = json_body.dict(exclude_unset=True) else: json_json_body = json_body request_kwargs = { "url": url, "json": json_json_body, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.patch( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = DataRetentionPolicyWithTeamAndChannelCounts.parse_obj( response.json() ) return response200 return response def get_teams_for_retention_policy( self, policy_id: str, *, page: Optional[int] = 0, per_page: Optional[int] = 60, ) -> List[Team]: """Get the teams for a granular data retention policy Gets the teams to which a granular data retention policy is applied. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_read_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `GetTeamsForRetentionPolicy <https://api.mattermost.com/#operation/GetTeamsForRetentionPolicy>`_ """ url = f"/data_retention/policies/{policy_id}/teams" params: Dict[str, Any] = { "page": page, "per_page": per_page, } params = {k: v for k, v in params.items() if v is not None} request_kwargs = { "url": url, "params": params, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.get( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = [] _response200 = response.json() for response200_item_data in _response200: response200_item = Team.parse_obj(response200_item_data) response200.append(response200_item) return response200 return response def add_teams_to_retention_policy( self, policy_id: str, *, json_body: Union[List[str], Dict], ) -> StatusOK: """Add teams to a granular data retention policy Adds teams to a granular data retention policy. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_write_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `AddTeamsToRetentionPolicy <https://api.mattermost.com/#operation/AddTeamsToRetentionPolicy>`_ """ url = f"/data_retention/policies/{policy_id}/teams" json_json_body = json_body request_kwargs = { "url": url, "json": json_json_body, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.post( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = StatusOK.parse_obj(response.json()) return response200 return response def remove_teams_from_retention_policy( self, policy_id: str, *, json_body: Union[List[str], Dict], ) -> StatusOK: """Delete teams from a granular data retention policy Delete teams from a granular data retention policy. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_write_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `RemoveTeamsFromRetentionPolicy <https://api.mattermost.com/#operation/RemoveTeamsFromRetentionPolicy>`_ """ url = f"/data_retention/policies/{policy_id}/teams" json_json_body = json_body request_kwargs = { "url": url, "json": json_json_body, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.delete( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = StatusOK.parse_obj(response.json()) return response200 return response def search_teams_for_retention_policy( self, policy_id: str, *, json_body: Union[SearchTeamsForRetentionPolicyJsonBody, Dict], ) -> List[Team]: """Search for the teams in a granular data retention policy Searches for the teams to which a granular data retention policy is applied. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_read_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `SearchTeamsForRetentionPolicy <https://api.mattermost.com/#operation/SearchTeamsForRetentionPolicy>`_ """ url = f"/data_retention/policies/{policy_id}/teams/search" if isinstance(json_body, BaseModel): json_json_body = json_body.dict(exclude_unset=True) else: json_json_body = json_body request_kwargs = { "url": url, "json": json_json_body, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.post( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = [] _response200 = response.json() for response200_item_data in _response200: response200_item = Team.parse_obj(response200_item_data) response200.append(response200_item) return response200 return response def get_channels_for_retention_policy( self, policy_id: str, *, page: Optional[int] = 0, per_page: Optional[int] = 60, ) -> ChannelListWithTeamData: """Get the channels for a granular data retention policy Gets the channels to which a granular data retention policy is applied. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_read_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `GetChannelsForRetentionPolicy <https://api.mattermost.com/#operation/GetChannelsForRetentionPolicy>`_ """ url = f"/data_retention/policies/{policy_id}/channels" params: Dict[str, Any] = { "page": page, "per_page": per_page, } params = {k: v for k, v in params.items() if v is not None} request_kwargs = { "url": url, "params": params, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.get( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = ChannelListWithTeamData.parse_obj(response.json()) return response200 return response def add_channels_to_retention_policy( self, policy_id: str, *, json_body: Union[List[str], Dict], ) -> StatusOK: """Add channels to a granular data retention policy Adds channels to a granular data retention policy. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_write_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `AddChannelsToRetentionPolicy <https://api.mattermost.com/#operation/AddChannelsToRetentionPolicy>`_ """ url = f"/data_retention/policies/{policy_id}/channels" json_json_body = json_body request_kwargs = { "url": url, "json": json_json_body, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.post( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = StatusOK.parse_obj(response.json()) return response200 return response def remove_channels_from_retention_policy( self, policy_id: str, *, json_body: Union[List[str], Dict], ) -> StatusOK: """Delete channels from a granular data retention policy Delete channels from a granular data retention policy. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_write_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `RemoveChannelsFromRetentionPolicy <https://api.mattermost.com/#operation/RemoveChannelsFromRetentionPolicy>`_ """ url = f"/data_retention/policies/{policy_id}/channels" json_json_body = json_body request_kwargs = { "url": url, "json": json_json_body, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.delete( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = StatusOK.parse_obj(response.json()) return response200 return response def search_channels_for_retention_policy( self, policy_id: str, *, json_body: Union[SearchChannelsForRetentionPolicyJsonBody, Dict], ) -> ChannelListWithTeamData: """Search for the channels in a granular data retention policy Searches for the channels to which a granular data retention policy is applied. ##### License Requires an E20 license. Permissions: Must have the `sysconsole_read_compliance_data_retention` permission. Minimum Server Version: 5.35 Api Reference: `SearchChannelsForRetentionPolicy <https://api.mattermost.com/#operation/SearchChannelsForRetentionPolicy>`_ """ url = f"/data_retention/policies/{policy_id}/channels/search" if isinstance(json_body, BaseModel): json_json_body = json_body.dict(exclude_unset=True) else: json_json_body = json_body request_kwargs = { "url": url, "json": json_json_body, } # pylint: disable-next=protected-access with self.client._get_httpx_client() as httpx_client: response = httpx_client.post( **request_kwargs, ) if self.skip_response_parsing: return response if response.status_code == 200: response200 = ChannelListWithTeamData.parse_obj(response.json()) return response200 return response
28.982538
122
0.59371
2,409
24,896
5.936903
0.087173
0.062719
0.042512
0.043421
0.788211
0.739337
0.724654
0.706055
0.681163
0.672214
0
0.019447
0.330776
24,896
858
123
29.016317
0.838965
0.315914
0
0.755196
0
0
0.054583
0.043288
0
0
0
0
0
1
0.039261
false
0
0.009238
0
0.168591
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
938355932b00891b366a809e1a6e67291fcff895
247
py
Python
pymatgen/phasediagram/entries.py
ltalirz/pymatgen
894cdb2ec7b9bd74f0ac3cdad40d144203ccdcf6
[ "MIT" ]
null
null
null
pymatgen/phasediagram/entries.py
ltalirz/pymatgen
894cdb2ec7b9bd74f0ac3cdad40d144203ccdcf6
[ "MIT" ]
null
null
null
pymatgen/phasediagram/entries.py
ltalirz/pymatgen
894cdb2ec7b9bd74f0ac3cdad40d144203ccdcf6
[ "MIT" ]
null
null
null
import warnings warnings.warn("pymatgen.phasediagram and submodules has been moved to " "pymatgen.analysis.phase_diagram This stub will be " "removed in pmg 2018.01.01.") from pymatgen.analysis.phase_diagram import *
30.875
71
0.708502
32
247
5.40625
0.75
0.184971
0.242775
0.323699
0
0
0
0
0
0
0
0.041451
0.218623
247
7
72
35.285714
0.854922
0
0
0
0
0
0.530364
0.210526
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
0
0
0
null
0
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
1
0
1
0
0
0
0
5
fa7e3549bb371f6769f06b0cd7c2ea45d72ad39b
50
py
Python
phyne/__init__.py
pyrated/phyne
7eae2a74b4049c70fb3f5a38c0c95fb673e8904a
[ "MIT" ]
3
2015-04-08T00:30:37.000Z
2015-10-02T02:21:55.000Z
phyne/__init__.py
pyrated/phyne
7eae2a74b4049c70fb3f5a38c0c95fb673e8904a
[ "MIT" ]
null
null
null
phyne/__init__.py
pyrated/phyne
7eae2a74b4049c70fb3f5a38c0c95fb673e8904a
[ "MIT" ]
null
null
null
from .lexer import Lexer, LexerError, Token, token
50
50
0.8
7
50
5.714286
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.12
50
1
50
50
0.909091
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
fac2ef9391b04d99a68a90a4c5da0613adcdf4fe
37,803
py
Python
clustering.py
clagis/droplets
f9cf3b728e23ef2c9750cc66cca7737e5cf008a2
[ "BSD-3-Clause" ]
null
null
null
clustering.py
clagis/droplets
f9cf3b728e23ef2c9750cc66cca7737e5cf008a2
[ "BSD-3-Clause" ]
null
null
null
clustering.py
clagis/droplets
f9cf3b728e23ef2c9750cc66cca7737e5cf008a2
[ "BSD-3-Clause" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Dec 2 13:48:26 2021 @author: clement """ # ============================================================================= ## Library dependancies # ============================================================================= import os import pandas as pd import numpy as np from pathlib import Path from os.path import isfile, join # ============================================================================= ## Basic functions # ============================================================================= def clustering(data, sort = True): """ Return a new dataframe containing the junctions, the coordinates of theirs centers of masses, theirs members and weight. Parameters: ----------- data: pandas dataframe data must contain at least three columns named x, y and z and one column named nearest, and two columns named polyIndex and beadPosition sort: bool, default True Indicate if you want the junction sorted or not. Returns: -------- data3: pandas dataframe A new dataframe with the junctions, the coordinates of theirs centers of masses, theirs members and weight. """ data2 = data.copy(deep=True) clusters_counter = -1 L = [0 for i in range(len(data2))] full_members = {} for k in range(len(data2)): # if row has no cluster assigned, assign one and update the counter if L[k] == 0: L[k] = clusters_counter clusters_counter -= 1 members = [data.iloc[k][['polyIndex','beadPosition']].to_list()] if data.at[k,'nearest'] != []: M = data.at[k,'nearest'] for elem in M: neighbour = elem[1] members += [elem[2:]] if L[neighbour] == 0: L[neighbour] = L[k] else: I = [index for index, value in enumerate(L) if value == L[k]] for idx in I: L[idx] = L[neighbour] try: for member in members: if member not in full_members[L[k]]: full_members[L[k]] += [member] except KeyError: full_members[L[k]] = members data2['junction'] = L data2.drop(['polyIndex','beadPosition','beadType','nearest'],axis=1,inplace=True) data3 = data2.groupby(['junction']).mean().reset_index() M = [] for key in data3['junction'].to_list(): M += [full_members[key]] data3['members'] = M data3['mass'] = data3['members'].apply(len) # reindexing junction index = 0 for junction_number in data3['junction'].unique().tolist(): data3.loc[data3['junction'] == junction_number, ['junction']] = index index += 1 if sort: data3.sort_values(by = 'junction', inplace=True, kind='quicksort') data3 = data3.astype({'junction': 'int64'}) return data3 else: data3 = data3.astype({'junction': 'int64'}) return data3 def links(data_junctions, data_polymers, boundary ,box_size): """ Return a new dataframe containing the junctions, the coordinates of theirs centers of masses, theirs members and weight. Parameters: ----------- data_junctions: pandas dataframe data_junctions must contain at least one column named members. data_polymers: pandas dataframe data_polymers must contain at least three columns named x, y and z and two columns named polyIndex and beadPosition. boundary: 'pbc' or 'npbc', default 'pbc' Type of boundary. box_size: int Size of the simulation box. Returns: -------- data_junctions: pandas dataframe The input data_junctions but with new columns giving the linked junctions, the minimal distance and the number of links between them. """ #data_junctions['neighbours'] = [[] for i in range(len(data_junctions))] L = [] length = data_polymers.groupby('polyIndex').count()['beadPosition'].head(1).item() if boundary == 'pbc': for i in range(len(data_junctions)): M = [] for member in data_junctions.iloc[i]['members']: # L is a list with all the binding sites on the polymer save the one we look at. L = [(member[0],i) for i in range(length) if i != member[1]] N = [] K = [] for j in range(len(data_junctions)): if j != i: if not set(data_junctions.iloc[j]['members']).isdisjoint(L): N += [j] K += [[value for value in data_junctions.iloc[j]['members'] if value in L]] for elem in N: B = K[N.index(elem)] D = [] for elem2 in B: BS_number = elem2[1] p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == member[1])][['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == BS_number)][['x','y','z']] x_dist, y_dist, z_dist = abs(p0-p1) D += [np.sqrt(min(x_dist,box_size-x_dist)**2 + min(y_dist,box_size-y_dist)**2 + min(z_dist,box_size-z_dist)**2)] #data_junctions.at[i,'neighbours'].append((data_junctions.at[elem,'cluster'],min(D),len(B))) M += [[data_junctions.at[elem,'cluster'],min(D),len(B)]] #data_junctions.at[i,'neighbours'].sort() M.sort() L += [M] data_junctions['neighbors'] = L elif boundary == 'npbc': pass else: print('Boundaries of type {} are not understood, please use pbc for'.format(boundary) + ' periodic boundaries or npbc for non periodic ones.') return data_junctions def linksLinear(data_junctions, data_polymers, boundary, box_size): """ Return a new dataframe containing the junctions, the coordinates of theirs centers of masses, theirs members and weight. Parameters: ----------- data_junctions: pandas dataframe data_junctions must contain at least one column named members. data_polymers: pandas dataframe data_polymers must contain at least three columns named x, y and z and two columns named polyIndex and beadPosition. boundary: 'pbc' or 'npbc' Type of boundary. box_size: int Size of the simulation box. Returns: -------- data_junctions: pandas dataframe The input data_junctions but with new columns giving the linked junctions, the minimal distance and the number of links between them. """ data_junctions['neighbors'] = [[] for i in range(len(data_junctions))] length = data_polymers.groupby('polyIndex').count()['beadPosition'].head(1).item() if boundary == 'pbc': for i in range(len(data_junctions)): N = [] for member in data_junctions.iloc[i]['members']: K = [[member[0], i] for i in range(length) if i != member[1]] #print('K: {}'.format(K)) if all(elem in data_junctions.iloc[i]['members'] for elem in K): pass else: if (member[1] == 0): j = 0 while not ([member[0],1] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == 0)].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == 1)].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(min(x_dist,box_size-x_dist)**2 + min(y_dist,box_size-y_dist)**2 + min(z_dist,box_size-z_dist)**2) N += [[data_junctions.at[j,'junction'],distance]] #print('Neighbors of {}: {}'.format(i,N)) elif (member[1] == (length-1)): j = 0 while not ([member[0],length-2] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == (length-1))].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == (length-2))].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(min(x_dist,box_size-x_dist)**2 + min(y_dist,box_size-y_dist)**2 + min(z_dist,box_size-z_dist)**2) N += [[data_junctions.at[j,'junction'],distance]] else: b = member[1] j = 0 while not ([member[0],b-1] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b)].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b-1)].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(min(x_dist,box_size-x_dist)**2 + min(y_dist,box_size-y_dist)**2 + min(z_dist,box_size-z_dist)**2) N += [[data_junctions.at[j,'junction'],distance]] j = 0 while not ([member[0],b+1] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b)].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b+1)].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(min(x_dist,box_size-x_dist)**2 + min(y_dist,box_size-y_dist)**2 + min(z_dist,box_size-z_dist)**2) N += [[data_junctions.at[j,'junction'],distance]] N.sort() N1 = list(set([x[0] for x in N])) M = [] for elem in N1: N2 = [elm[1] for elm in N if elm[0] == elem] dist = min(N2) strength = len(N2) M += [[elem, dist, strength]] data_junctions.at[i,'neighbors'] = M elif boundary == 'npbc': for i in range(len(data_junctions)): N = [] for member in data_junctions.iloc[i]['members']: K = [[member[0], i] for i in range(length) if i != member[1]] #print('K: {}'.format(K)) if all(elem in data_junctions.iloc[i]['members'] for elem in K): pass else: if (member[1] == 0): j = 0 while not ([member[0],1] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == 0)].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == 1)].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(x_dist**2 + y_dist**2 + z_dist**2) N += [[data_junctions.at[j,'junction'],distance]] #print('Neighbors of {}: {}'.format(i,N)) elif (member[1] == (length-1)): j = 0 while not ([member[0],length-2] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == (length-1))].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == (length-2))].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(x_dist**2 + y_dist**2 + z_dist**2) N += [[data_junctions.at[j,'junction'],distance]] else: b = member[1] j = 0 while not ([member[0],b-1] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b)].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b-1)].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(x_dist**2 + y_dist**2 + z_dist**2) N += [[data_junctions.at[j,'junction'],distance]] j = 0 while not ([member[0],b+1] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b)].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b+1)].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(x_dist**2 + y_dist**2 + z_dist**2) N += [[data_junctions.at[j,'junction'],distance]] N.sort() N1 = list(set([x[0] for x in N])) M = [] for elem in N1: N2 = [elm[1] for elm in N if elm[0] == elem] dist = min(N2) strength = len(N2) M += [[elem, dist, strength]] data_junctions.at[i,'neighbors'] = M else: print('Boundaries of type {} are not understood, please use pbc for'.format(boundary) + ' periodic boundaries or npbc for non periodic ones.') return data_junctions def linksFarLinear(data_junctions, data_polymers, boundary, box_size): """ Return a new dataframe containing the junctions, the coordinates of theirs centers of masses, theirs members and weight. Parameters: ----------- data_junctions: pandas dataframe data_junctions must contain at least one column named members. data_polymers: pandas dataframe data_polymers must contain at least three columns named x, y and z and two columns named polyIndex and beadPosition. boundary: 'pbc' or 'npbc' Type of boundary. box_size: int Size of the simulation box. Returns: -------- data_junctions: pandas dataframe The input data_junctions but with new columns giving the linked junctions, the minimal distance and the number of links between them. """ data_junctions['neighbors'] = [[] for i in range(len(data_junctions))] length = data_polymers.groupby('polyIndex').count()['beadPosition'].head(1).item() if boundary == 'pbc': for i in range(len(data_junctions)): N = [] for member in data_junctions.iloc[i]['members']: K = [[member[0], i] for i in range(length) if i != member[1]] #print('K: {}'.format(K)) if all(elem in data_junctions.iloc[i]['members'] for elem in K): pass else: if (member[1] == 0): j = 0 t = True while t: for k in range(1,length): while not ([member[0],k] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): t = False p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == 0)].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == 1)].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(min(x_dist,box_size-x_dist)**2 + min(y_dist,box_size-y_dist)**2 + min(z_dist,box_size-z_dist)**2) N += [[data_junctions.at[j,'junction'],distance]] #print('Neighbors of {}: {}'.format(i,N)) break elif (member[1] == (length-1)): j = 0 t = True while t: for k in range(length-2, 0, -1): while not ([member[0],k] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): t = False p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == (length-1))].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == (length-2))].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(min(x_dist,box_size-x_dist)**2 + min(y_dist,box_size-y_dist)**2 + min(z_dist,box_size-z_dist)**2) N += [[data_junctions.at[j,'junction'],distance]] break else: b = member[1] j = 0 t = True while t: for k in range(b-1, 0, -1): while not ([member[0],k] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): t = False p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b)].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b-1)].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(min(x_dist,box_size-x_dist)**2 + min(y_dist,box_size-y_dist)**2 + min(z_dist,box_size-z_dist)**2) N += [[data_junctions.at[j,'junction'],distance]] break j = 0 t = True while t: for k in range(b+1, length): while not ([member[0],k] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): t = False p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b)].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b+1)].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(min(x_dist,box_size-x_dist)**2 + min(y_dist,box_size-y_dist)**2 + min(z_dist,box_size-z_dist)**2) N += [[data_junctions.at[j,'junction'],distance]] break N.sort() N1 = list(set([x[0] for x in N])) M = [] for elem in N1: N2 = [elm[1] for elm in N if elm[0] == elem] dist = min(N2) strength = len(N2) M += [[elem, dist, strength]] data_junctions.at[i,'neighbors'] = M elif boundary == 'npbc': for i in range(len(data_junctions)): N = [] for member in data_junctions.iloc[i]['members']: K = [[member[0], i] for i in range(length) if i != member[1]] #print('K: {}'.format(K)) if all(elem in data_junctions.iloc[i]['members'] for elem in K): pass else: if (member[1] == 0): j = 0 while not ([member[0],1] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == 0)].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == 1)].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(x_dist**2 + y_dist**2 + z_dist**2) N += [[data_junctions.at[j,'junction'],distance]] #print('Neighbors of {}: {}'.format(i,N)) elif (member[1] == (length-1)): j = 0 while not ([member[0],length-2] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == (length-1))].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == (length-2))].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(x_dist**2 + y_dist**2 + z_dist**2) N += [[data_junctions.at[j,'junction'],distance]] else: b = member[1] j = 0 while not ([member[0],b-1] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b)].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b-1)].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(x_dist**2 + y_dist**2 + z_dist**2) N += [[data_junctions.at[j,'junction'],distance]] j = 0 while not ([member[0],b+1] in data_junctions.iloc[j]['members']): j += 1 if j >= len(data_junctions): break if j < len(data_junctions): p0 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b)].reset_index()[['x','y','z']] p1 = data_polymers[(data_polymers['polyIndex'] == member[0]) & (data_polymers['beadPosition'] == b+1)].reset_index()[['x','y','z']] x_dist, y_dist, z_dist = abs((p0-p1).iloc[0]) distance = np.sqrt(x_dist**2 + y_dist**2 + z_dist**2) N += [[data_junctions.at[j,'junction'],distance]] N.sort() N1 = list(set([x[0] for x in N])) M = [] for elem in N1: N2 = [elm[1] for elm in N if elm[0] == elem] dist = min(N2) strength = len(N2) M += [[elem, dist, strength]] data_junctions.at[i,'neighbors'] = M else: print('Boundaries of type {} are not understood, please use pbc for'.format(boundary) + ' periodic boundaries or npbc for non periodic ones.') return data_junctions def neighboursList(data): """ Return the same dataframe containing the list of neighbors for each junction. Parameters: ----------- data: pandas dataframe data must contain at least one column named neighbors. Returns: -------- data: pandas dataframe The input data but with a new column giving the list of neighbors for each junction. """ data['neighbors_list'] = [[] for i in range(len(data))] for j in range(len(data)): L = [] for elem in data.at[j,'neighbors']: L += [elem[0]] data.at[j,'neighbors_list'] = L return data def connex(data,K,L): """ Return the list of members of the connex component containing the elements originaly in L. Parameters: ----------- data: pandas dataframe data must contain at least one column named neighbors. K: list The list of members of the connex component so far. L: list The starting element, then the list of members of the connex component reached so far minus the ones that are in K. Returns: -------- K: list The junctions in the connex component containing the elements originaly in L. """ if L == []: K.sort() return K M = [] for elem in L: M += data.at[elem,'neighbors_list'] N = [] for elem2 in M: if not (elem2 in K): N += [elem2] N = list(set(N)) L = N K += L return connex(data,K,L) def connexComponents(data): """ Return the same dataframe with a new column labelling the connex components. Parameters: ----------- data: pandas dataframe data must contain at least one column named neighbors_list. Returns: -------- data: pandas dataframe The input data but with a new column giving the connex components. """ data['component'] = [-1 for i in range(len(data))] start = 0 component = 0 while (-1 in data['component'].to_list()): L = connex(data,[start],[start]) for elem in L: data.at[elem,'component'] = component try: start = data['component'].to_list().index(-1) except ValueError: pass component += 1 return data def smallJunctions(data): """ Return the same dataframe containing a boolean for each junction labelling it as a small junction (mass < 3) or not. Parameters: ----------- data: pandas dataframe data must contain at least one column named mass. Returns: -------- data: pandas dataframe The input data but with a new column giving the list of neighbors for each junction. """ data['small_junction'] = data['mass'].apply(lambda x: 1 if x < 3 else 0) return data def bridges(data): """ Return the same dataframe containing a boolean for each junction labelling it as a bridge (mass = 2) connecting two not small junctions (mass > 2). Parameters: ----------- data: pandas dataframe data must contain at least two columns named mass and neighbors_list. Returns: -------- data: pandas dataframe The input data but with a new column labelling each junction as a bridge or not. """ B = [] for i in range(len(data)): if data.iloc[i]['mass'] == 2: test = [True,True] L = data.iloc[i]['neighbors_list'] try: for i in range(2): if data.iloc[L[i]]['mass'] < 2: test[i] = False B += [test[0]*test[1]] except IndexError: B += [0] else: B += [0] data['bridge'] = B return data def degree(data): """ Return the same dataframe containing the degree and multidegree of each junction. Parameters: ----------- data: pandas dataframe data must contain at least one column named neighbors. Returns: -------- data: pandas dataframe The input data but with new columns giving the degree and multidegree of each junction. """ degreeG = [] degreeMG = [] for i in range(len(data)): A = data.iloc[i][['small_junction','bridge']].to_list() if A == [1,0]: degreeG += [0] degreeMG += [0] elif A == [1,1]: degreeG += [2] degreeMG += [2] else: L = data.iloc[i]['neighbors_list'] degG = 0 degMG = 0 for neighbor in L: if data.iloc[neighbor][['small_junction','bridge']].to_list() == [1,0]: degG += 0 degMG += 0 elif data.iloc[neighbor][['small_junction','bridge']].to_list() == [1,1]: degG += 1 degMG += 1 else: degG += 1 M = data.iloc[i]['neighbors'] n = len(M) j = 0 t = False while ((j < n) and not t): if M[j][0] == neighbor: degMG += M[j][2] t = True else: j += 1 degreeG += [degG] degreeMG += [degMG] data['degreeG'] = degreeG data['degreeMG'] = degreeMG return data # ============================================================================= ## Main function # ============================================================================= def mainClustering(dir_in, dir_out, name, box_size = 48, boundary = 'pbc'): """ Do the clustering, linksLinear, neighbours_list, connex_components, small_junctions, bridges and degree functions for a bunch of file and save the result in a (new) directory. Parameters: ----------- dir_in: string Input directory, where the script will search the directory named name. dir_out: string Output directory, that the script will eventually create and where it will save the {name} subdirectory. name: string Subdirectory in the input directory where the files lie. Returns: -------- Nothing directly. The script will save the files in a new subdirectory {name} under the output directory. """ dir_path = Path(os.getcwd()) path = dir_path.parent.joinpath(dir_in,name) save_path = dir_path.parent.joinpath(dir_out,name) save_path.mkdir(parents=True, exist_ok=True) # work on each files onlyfiles = [f for f in os.listdir(path) if isfile(join(path, f))] file_list = [] for filename in onlyfiles: if filename.endswith('.pkl'): file_list.append(filename) file_list.sort() n = len(file_list) for i in range(n): print("{} file {:02d} / {}".format(name, i+1, n)) file_path = os.path.join(path,file_list[i]) df0 = pd.read_pickle(file_path) df1 = clustering(df0) linksLinear(df1, df0, boundary, box_size) neighboursList(df1) connexComponents(df1) smallJunctions(df1) bridges(df1) degree(df1) save_name = save_path.joinpath(file_list[i]) df1.to_pickle(save_name) L = ['6d48', '6e48', '6f48'] M = ['6e48', '6f48'] for elem in L: mainClustering('neo_KNN/65', 'neo_junctions/65', elem) for elem in M: mainClustering('neo_KNN/4', 'neo_junctions/4', elem)
42.957955
174
0.445705
4,045
37,803
4.044747
0.074166
0.090581
0.040095
0.049875
0.767985
0.755638
0.739502
0.719883
0.712181
0.692378
0
0.021006
0.418194
37,803
879
175
43.006826
0.722879
0.179086
0
0.691312
0
0
0.070279
0
0
0
0
0
0
1
0.020333
false
0.011091
0.009242
0
0.051756
0.007394
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
fadc60d4951697a284ee70c15e53bd8b26d2d18f
96
py
Python
python/pbase/pdata/utils/__init__.py
Impavidity/pinfrastructure
b5577fe1e140e0b360aec2834349ba87647eb000
[ "MIT" ]
10
2017-12-04T03:50:50.000Z
2020-09-25T07:24:32.000Z
python/pbase/pdata/utils/__init__.py
Impavidity/pinfrastructure
b5577fe1e140e0b360aec2834349ba87647eb000
[ "MIT" ]
8
2018-07-14T09:45:38.000Z
2018-09-17T20:56:52.000Z
python/pbase/pdata/utils/__init__.py
Impavidity/pinfrastructure
b5577fe1e140e0b360aec2834349ba87647eb000
[ "MIT" ]
1
2017-11-24T18:31:53.000Z
2017-11-24T18:31:53.000Z
from .ontonotes import Ontonotes, OntonotesSentence from .span_utils import change_coding_schema
48
51
0.885417
12
96
6.833333
0.75
0
0
0
0
0
0
0
0
0
0
0
0.083333
96
2
52
48
0.931818
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
fae37e2485ecab07d0c37d5a526c44070d467f27
74
py
Python
index.py
Jhow-Rambo/bot_jaguar
601ce47c11fdb8d18c5efba896cebc4ace27beec
[ "MIT" ]
1
2021-12-09T20:33:39.000Z
2021-12-09T20:33:39.000Z
index.py
Jhow-Rambo/bot_jaguar
601ce47c11fdb8d18c5efba896cebc4ace27beec
[ "MIT" ]
null
null
null
index.py
Jhow-Rambo/bot_jaguar
601ce47c11fdb8d18c5efba896cebc4ace27beec
[ "MIT" ]
null
null
null
from typing import Any, List import telebot from datetime import datetime
18.5
29
0.837838
11
74
5.636364
0.636364
0
0
0
0
0
0
0
0
0
0
0
0.148649
74
3
30
24.666667
0.984127
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
4f005fe136aebdc267bec5396110723475f5bfea
158
py
Python
observer_pattern/subscriber.py
sebastianmaxwell1/sweepstakes_1
d76f4276e983f7ee971f8c6beefc53dff37c1bb3
[ "MIT" ]
null
null
null
observer_pattern/subscriber.py
sebastianmaxwell1/sweepstakes_1
d76f4276e983f7ee971f8c6beefc53dff37c1bb3
[ "MIT" ]
null
null
null
observer_pattern/subscriber.py
sebastianmaxwell1/sweepstakes_1
d76f4276e983f7ee971f8c6beefc53dff37c1bb3
[ "MIT" ]
null
null
null
class Subscriber: def __init__(self, name): self.name = name def update(self, message): print(f'{self.name} got message {message}')
19.75
51
0.613924
20
158
4.65
0.55
0.258065
0
0
0
0
0
0
0
0
0
0
0.259494
158
7
52
22.571429
0.794872
0
0
0
0
0
0.208861
0
0
0
0
0
0
1
0.4
false
0
0
0
0.6
0.2
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
1
0
0
0
0
1
0
0
5
878f8fabeba36e37e510ad96a7aa201b59f542d0
63
py
Python
ch1p/__init__.py
gch1p/ch1p-py
84e8b8afd6e168ae6e3fa2dd0a31e9566058240f
[ "BSD-2-Clause" ]
null
null
null
ch1p/__init__.py
gch1p/ch1p-py
84e8b8afd6e168ae6e3fa2dd0a31e9566058240f
[ "BSD-2-Clause" ]
null
null
null
ch1p/__init__.py
gch1p/ch1p-py
84e8b8afd6e168ae6e3fa2dd0a31e9566058240f
[ "BSD-2-Clause" ]
null
null
null
from .functions import telegram_notify from .state import State
31.5
38
0.857143
9
63
5.888889
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.111111
63
2
39
31.5
0.946429
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
87b2fb7f1ce3be41a4d7c17e5e9e34baa246a5bc
68
py
Python
gp/__init__.py
sehoonha/hippo
37af5c6eb0e80889d3f987a925fe9d9236dbecb1
[ "MIT" ]
null
null
null
gp/__init__.py
sehoonha/hippo
37af5c6eb0e80889d3f987a925fe9d9236dbecb1
[ "MIT" ]
null
null
null
gp/__init__.py
sehoonha/hippo
37af5c6eb0e80889d3f987a925fe9d9236dbecb1
[ "MIT" ]
null
null
null
from motormap import MotorMap from motion import Step, Page, Motion
22.666667
37
0.823529
10
68
5.6
0.6
0
0
0
0
0
0
0
0
0
0
0
0.147059
68
2
38
34
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
87dfb78936850b9b6ef5635d92c9b18f1055c31d
93
py
Python
app/exceptions.py
mcXrd/rossumtask
c75988a8afd01cfe84e9eab5cdc2d5462824069a
[ "MIT" ]
null
null
null
app/exceptions.py
mcXrd/rossumtask
c75988a8afd01cfe84e9eab5cdc2d5462824069a
[ "MIT" ]
null
null
null
app/exceptions.py
mcXrd/rossumtask
c75988a8afd01cfe84e9eab5cdc2d5462824069a
[ "MIT" ]
null
null
null
class PipelineException(Exception): pass class CredentialsException(Exception): pass
18.6
38
0.784946
8
93
9.125
0.625
0.356164
0
0
0
0
0
0
0
0
0
0
0.150538
93
5
39
18.6
0.924051
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
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
1
0
0
0
0
0
5
87e3e1fd44d5dfa43a55ac62bce9a802cec39678
6,149
py
Python
tests/test_diablo3_community_api.py
trevorphillipscoding/python-blizzardapi
e98e1ee38f4b336bc99baa668691c842a090109c
[ "MIT" ]
10
2020-12-03T14:23:56.000Z
2022-02-01T10:48:42.000Z
tests/test_diablo3_community_api.py
trevorphillipscoding/python-blizzardapi
e98e1ee38f4b336bc99baa668691c842a090109c
[ "MIT" ]
65
2020-12-24T02:09:56.000Z
2022-03-28T20:09:01.000Z
tests/test_diablo3_community_api.py
trevorphillips/python-blizzardapi
92921abd44dbf684ff8b8c06c8dc74539d2e4721
[ "MIT" ]
6
2021-06-24T17:37:55.000Z
2022-02-17T20:36:23.000Z
from blizzardapi import BlizzardApi class TestDiablo3CommunityApi: def setup(self): self.api = BlizzardApi("client_id", "client_secret") self.api.diablo3.community._access_token = "access_token" # D3 Act API def test_get_act_index(self, success_response_mock): self.api.diablo3.community.get_act_index("us", "en_US") params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/data/act", params=params ) def test_get_act(self, success_response_mock): self.api.diablo3.community.get_act("us", "en_US", 1) params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/data/act/1", params=params ) # D3 Artisan and Recipe API def test_get_artisan(self, success_response_mock): self.api.diablo3.community.get_artisan("us", "en_US", "blacksmith") params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/data/artisan/blacksmith", params=params, ) def test_get_recipe(self, success_response_mock): self.api.diablo3.community.get_recipe( "us", "en_US", "blacksmith", "apprentice-flamberge" ) params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/data/artisan/blacksmith/recipe/apprentice-flamberge", params=params, ) # D3 Follower API def test_get_follower(self, success_response_mock): self.api.diablo3.community.get_follower("us", "en_US", "templar") params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/data/follower/templar", params=params, ) # D3 Character Class and Skill API def test_get_character_class(self, success_response_mock): self.api.diablo3.community.get_character_class("us", "en_US", "barbarian") params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/data/hero/barbarian", params=params ) def test_get_api_skill(self, success_response_mock): self.api.diablo3.community.get_api_skill("us", "en_US", "barbarian", "bash") params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/data/hero/barbarian/skill/bash", params=params, ) # D3 Item Type API def test_get_item_type_index(self, success_response_mock): self.api.diablo3.community.get_item_type_index("us", "en_US") params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/data/item-type", params=params ) def test_get_item_type(self, success_response_mock): self.api.diablo3.community.get_item_type("us", "en_US", "sword2h") params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/data/item-type/sword2h", params=params, ) # D3 Item API def test_get_item(self, success_response_mock): self.api.diablo3.community.get_item( "us", "en_US", "corrupted-ashbringer-Unique_Sword_2H_104_x1" ) params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/data/item/corrupted-ashbringer-Unique_Sword_2H_104_x1", params=params, ) # D3 Profile API def test_get_api_account(self, success_response_mock): self.api.diablo3.community.get_api_account("us", "en_US", "Battletag#1234") params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/profile/Battletag#1234/", params=params, ) def test_get_api_hero(self, success_response_mock): self.api.diablo3.community.get_api_hero("us", "en_US", "Battletag#1234", 1) params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/profile/Battletag#1234/hero/1", params=params, ) def test_get_api_detailed_hero_items(self, success_response_mock): self.api.diablo3.community.get_api_detailed_hero_items( "us", "en_US", "Battletag#1234", 1 ) params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/profile/Battletag#1234/hero/1/items", params=params, ) def test_get_api_detailed_follower_items(self, success_response_mock): self.api.diablo3.community.get_api_detailed_follower_items( "us", "en_US", "Battletag#1234", 1 ) params = { "locale": "en_US", "access_token": "access_token", } success_response_mock.assert_called_with( "https://us.api.blizzard.com/d3/profile/Battletag#1234/hero/1/follower-items", params=params, )
34.161111
99
0.599122
715
6,149
4.840559
0.090909
0.095348
0.153713
0.099682
0.800925
0.75614
0.741693
0.722624
0.699509
0.642878
0
0.020018
0.276956
6,149
179
100
34.351955
0.758435
0.020979
0
0.456376
0
0.040268
0.268297
0.007152
0
0
0
0
0.09396
1
0.100671
false
0
0.006711
0
0.114094
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
e203b3bd8fbbd9b9c77c6a546d80f2d9100444ff
152
py
Python
pydirdiff/plumbing/__init__.py
xapple/pydirdiff
4a05dab872c1ee989cff80dbe29684137936e77f
[ "MIT" ]
1
2017-09-15T12:15:43.000Z
2017-09-15T12:15:43.000Z
pydirdiff/plumbing/__init__.py
xapple/pydirdiff
4a05dab872c1ee989cff80dbe29684137936e77f
[ "MIT" ]
null
null
null
pydirdiff/plumbing/__init__.py
xapple/pydirdiff
4a05dab872c1ee989cff80dbe29684137936e77f
[ "MIT" ]
null
null
null
"""These submodules are part of the `plumbing` package and are embedded here to avoid installing dependencies and creating version incompatibilities."""
152
152
0.815789
20
152
6.2
0.9
0
0
0
0
0
0
0
0
0
0
0
0.125
152
1
152
152
0.932331
0.960526
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
355aba80e34859eaad9871f54a2588dec2327e11
43
py
Python
minkf/__init__.py
solbes/minkf
faefdfe20d44273fd6443a3e3d2b25e31956fb87
[ "MIT" ]
1
2021-12-09T15:12:04.000Z
2021-12-09T15:12:04.000Z
minkf/__init__.py
solbes/minkf
faefdfe20d44273fd6443a3e3d2b25e31956fb87
[ "MIT" ]
null
null
null
minkf/__init__.py
solbes/minkf
faefdfe20d44273fd6443a3e3d2b25e31956fb87
[ "MIT" ]
1
2021-12-09T22:28:58.000Z
2021-12-09T22:28:58.000Z
from .methods import * from . import utils
14.333333
22
0.744186
6
43
5.333333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.186047
43
2
23
21.5
0.914286
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
35a46df314f69688c8f383e70386825a13117007
135
py
Python
Leetcode/1000-2000/1859. Sorting the Sentence/1859.py
Next-Gen-UI/Code-Dynamics
a9b9d5e3f27e870b3e030c75a1060d88292de01c
[ "MIT" ]
null
null
null
Leetcode/1000-2000/1859. Sorting the Sentence/1859.py
Next-Gen-UI/Code-Dynamics
a9b9d5e3f27e870b3e030c75a1060d88292de01c
[ "MIT" ]
null
null
null
Leetcode/1000-2000/1859. Sorting the Sentence/1859.py
Next-Gen-UI/Code-Dynamics
a9b9d5e3f27e870b3e030c75a1060d88292de01c
[ "MIT" ]
null
null
null
class Solution: def sortSentence(self, s: str) -> str: return ' '.join([w[:-1] for w in sorted(s.split(), key=lambda x: x[-1])])
33.75
77
0.6
23
135
3.521739
0.782609
0
0
0
0
0
0
0
0
0
0
0.018018
0.177778
135
3
78
45
0.711712
0
0
0
0
0
0.007407
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
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
35aa0e78a6e752c922203a0ad58dd4a026abfdc2
74
py
Python
wattson_abstract_rtu/__init__.py
saegel/wattson-abstract-rtu
11b468a7814aee549a1755de98eb22d9c8d07e8b
[ "MIT" ]
null
null
null
wattson_abstract_rtu/__init__.py
saegel/wattson-abstract-rtu
11b468a7814aee549a1755de98eb22d9c8d07e8b
[ "MIT" ]
2
2021-01-12T14:32:16.000Z
2021-01-20T16:09:50.000Z
wattson_abstract_rtu/__init__.py
saegel/wattson-abstract-rtu
11b468a7814aee549a1755de98eb22d9c8d07e8b
[ "MIT" ]
2
2020-12-23T14:09:44.000Z
2021-01-11T15:35:37.000Z
from .backend_interface import BackendInterface from .util import IOA, COA
37
47
0.851351
10
74
6.2
0.8
0
0
0
0
0
0
0
0
0
0
0
0.108108
74
2
48
37
0.939394
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
35e457d50015b4df1d0baf8d7fcd549adb3aaa3e
155
py
Python
band/__main__.py
Bumish/band
381ce16d2d5465d237cf6c5707f95918ea1a1b41
[ "Apache-2.0" ]
null
null
null
band/__main__.py
Bumish/band
381ce16d2d5465d237cf6c5707f95918ea1a1b41
[ "Apache-2.0" ]
null
null
null
band/__main__.py
Bumish/band
381ce16d2d5465d237cf6c5707f95918ea1a1b41
[ "Apache-2.0" ]
null
null
null
import sys from . import settings, start_server from . import director def main(): start_server(**settings) if __name__ == '__main__': main()
11.923077
36
0.683871
19
155
5.052632
0.578947
0.208333
0
0
0
0
0
0
0
0
0
0
0.206452
155
12
37
12.916667
0.780488
0
0
0
0
0
0.052288
0
0
0
0
0
0
1
0.142857
true
0
0.428571
0
0.571429
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
ea0541d7dea9731e052a655c7e45ef0325edf232
83
py
Python
ui/__init__.py
andrewwjensen/class_invoices
9d2b26ad00c0161ab67ff647ae4545a114066c9e
[ "CC-BY-3.0" ]
null
null
null
ui/__init__.py
andrewwjensen/class_invoices
9d2b26ad00c0161ab67ff647ae4545a114066c9e
[ "CC-BY-3.0" ]
null
null
null
ui/__init__.py
andrewwjensen/class_invoices
9d2b26ad00c0161ab67ff647ae4545a114066c9e
[ "CC-BY-3.0" ]
null
null
null
from ui.MainFrame import MainFrame from ui.ApplicationPanel import ApplicationPanel
41.5
48
0.891566
10
83
7.4
0.5
0.162162
0
0
0
0
0
0
0
0
0
0
0.084337
83
2
48
41.5
0.973684
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
ea3078210fc29d04ed7abee6a5bca51f8c8c7d25
886
py
Python
lintlens/tests/test_git.py
draganHR/lintlens
3a7af837c57a1583fda26e91fd7b20b2664e40c7
[ "MIT" ]
null
null
null
lintlens/tests/test_git.py
draganHR/lintlens
3a7af837c57a1583fda26e91fd7b20b2664e40c7
[ "MIT" ]
1
2020-07-25T15:17:52.000Z
2020-07-25T15:17:52.000Z
lintlens/tests/test_git.py
draganHR/lintlens
3a7af837c57a1583fda26e91fd7b20b2664e40c7
[ "MIT" ]
null
null
null
from __future__ import print_function, unicode_literals from ..git import parse_file_line_numbers, parse_hunk def test_parse_hunk(): assert parse_hunk('@@ -0 +1 @@ Foo bar') == ((0, 1), (1, 1), u'Foo bar') assert parse_hunk('@@ -987 +99999 @@ Foo bar') == ((987, 1), (99999, 1), u'Foo bar') assert parse_hunk('@@ -5,0 +42,5 @@ Foo bar') == ((5, 0), (42, 5), u'Foo bar') assert parse_hunk('@@ -1,3 +42,0 @@ Foo bar') == ((1, 3), (42, 0), u'Foo bar') assert parse_hunk('@@ -0 +1 @@') == ((0, 1), (1, 1), u'') def test_parse_file_line_numbers(): assert parse_file_line_numbers('-0') == (0, 1) assert parse_file_line_numbers('+0') == (0, 1) assert parse_file_line_numbers('+0,0') == (0, 0) assert parse_file_line_numbers('+0,1') == (0, 1) assert parse_file_line_numbers('+0,5') == (0, 5) assert parse_file_line_numbers('+123,5') == (123, 5)
42.190476
88
0.595937
148
886
3.304054
0.182432
0.247444
0.212679
0.327198
0.582822
0.474438
0.329243
0.235174
0.175869
0.175869
0
0.104683
0.180587
886
20
89
44.3
0.568871
0
0
0
0
0
0.172686
0
0
0
0
0
0.733333
1
0.133333
true
0
0.133333
0
0.266667
0.066667
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
576f56f87e791f287237daf5dcbe03fa38f62b1e
15
py
Python
src/human_friendly_alert/models/__init__.py
pistatium/human-friendly-alert
172f2e172c1de40b14a692e9bac650a84d9e6ff3
[ "Apache-2.0" ]
350
2015-01-06T06:26:21.000Z
2022-03-18T11:11:08.000Z
src/human_friendly_alert/models/__init__.py
pistatium/human-friendly-alert
172f2e172c1de40b14a692e9bac650a84d9e6ff3
[ "Apache-2.0" ]
67
2015-02-14T14:06:10.000Z
2022-01-08T20:51:14.000Z
buffer/shard-cpp-test/master-node/_code/task_files/__init__.py
zaqwes8811/micro-apps
7f63fdf613eff5d441a3c2c7b52d2a3d02d9736a
[ "MIT" ]
29
2015-03-21T15:33:08.000Z
2022-03-10T07:51:33.000Z
# coding: utf-8
15
15
0.666667
3
15
3.333333
1
0
0
0
0
0
0
0
0
0
0
0.076923
0.133333
15
1
15
15
0.692308
0.866667
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
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
0
0
0
0
0
5
579e5a4a74562c5ba75cf48a26b76ddbd55878d1
2,422
py
Python
tests/unit/configs/yaml/test_config.py
Egnod/sitri
ca974cce9041bea8296284b0ca67d970a6e072cf
[ "MIT" ]
11
2020-12-16T07:00:29.000Z
2021-05-25T16:24:50.000Z
tests/unit/configs/yaml/test_config.py
Egnod/sitri
ca974cce9041bea8296284b0ca67d970a6e072cf
[ "MIT" ]
6
2019-10-08T22:55:21.000Z
2019-10-11T19:29:53.000Z
tests/unit/configs/yaml/test_config.py
Egnod/sitri
ca974cce9041bea8296284b0ca67d970a6e072cf
[ "MIT" ]
2
2019-10-10T12:09:50.000Z
2019-10-10T23:52:38.000Z
import pytest from sitri.providers.contrib.yaml import YamlConfigProvider def test_no_file_error(): with pytest.raises(FileNotFoundError): YamlConfigProvider(yaml_path="_data.yaml") YamlConfigProvider(yaml_path="_data.yaml", found_file_error=False) @pytest.mark.parametrize( "yaml_config_obj", [pytest.lazy_fixture("yaml_config"), pytest.lazy_fixture("yaml_data_config")] ) def test_metadata(yaml_config_obj) -> None: assert yaml_config_obj.provider_code == "yaml" assert yaml_config_obj.separator == "/" @pytest.mark.parametrize( "yaml_config_obj", [pytest.lazy_fixture("yaml_config"), pytest.lazy_fixture("yaml_data_config")] ) def test_get_by_other(yaml_config_obj) -> None: assert isinstance(yaml_config_obj._get_by_path("test", separator=yaml_config_obj.separator), dict) assert yaml_config_obj._get_by_key("test.test_key2") is None assert yaml_config_obj._get_by_path("test.test_key2", separator=yaml_config_obj.separator) is None assert isinstance(yaml_config_obj._get_by_key("test"), dict) assert yaml_config_obj._get_by_path("test", separator=yaml_config_obj.separator) == yaml_config_obj._get_by_key( "test" ) assert yaml_config_obj._get_by_path( "test/test_key2", separator=yaml_config_obj.separator ) == yaml_config_obj._get_by_key("test").get("test_key2") @pytest.mark.parametrize( "yaml_config_obj", [pytest.lazy_fixture("yaml_config"), pytest.lazy_fixture("yaml_data_config")] ) def test_get(yaml_config_obj): assert isinstance(yaml_config_obj.get("test"), dict) assert isinstance(yaml_config_obj.get("test", path_mode=True), dict) assert yaml_config_obj.get("test", path_mode=True) == yaml_config_obj.get("test") assert yaml_config_obj.get("test/test_key2", path_mode=True) and yaml_config_obj.get( "test/test_key2", path_mode=True ) == yaml_config_obj.get("test").get("test_key2") assert yaml_config_obj.get("test.test_key2", separator=".", path_mode=True) == yaml_config_obj.get( "test/test_key2", path_mode=True ) assert not yaml_config_obj.get("test/test_key2") @pytest.mark.parametrize( "yaml_config_obj", [pytest.lazy_fixture("yaml_config"), pytest.lazy_fixture("yaml_data_config")] ) def test_keys(yaml_config_obj): assert "test" in yaml_config_obj.keys() with pytest.raises(NotImplementedError): yaml_config_obj.keys(path_mode=True)
39.704918
116
0.753922
351
2,422
4.789174
0.133903
0.226056
0.262939
0.171327
0.781083
0.709102
0.703153
0.632957
0.502082
0.502082
0
0.004688
0.119323
2,422
60
117
40.366667
0.783404
0
0
0.212766
0
0
0.151941
0
0
0
0
0
0.319149
1
0.106383
false
0
0.042553
0
0.148936
0
0
0
0
null
1
1
1
0
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
57a3ac8e2b04c7b74979b06405a56904ace96484
198
py
Python
covador/__init__.py
baverman/covador
8c98b2ca6b382af4150ae8b4875faa3bdbd15473
[ "MIT" ]
7
2016-12-28T08:46:21.000Z
2020-09-14T10:28:33.000Z
covador/__init__.py
baverman/covador
8c98b2ca6b382af4150ae8b4875faa3bdbd15473
[ "MIT" ]
3
2016-11-03T11:13:50.000Z
2018-08-22T16:40:34.000Z
covador/__init__.py
baverman/covador
8c98b2ca6b382af4150ae8b4875faa3bdbd15473
[ "MIT" ]
6
2016-11-03T10:57:33.000Z
2018-08-20T19:59:03.000Z
from .utils import wrap_in, dpass from .vdecorator import ValidationDecorator from .types import * version = '0.10.1' schema = make_schema(item_getter) list_schema = make_schema(list_item_getter)
22
43
0.79798
29
198
5.206897
0.62069
0.13245
0.211921
0
0
0
0
0
0
0
0
0.022989
0.121212
198
8
44
24.75
0.844828
0
0
0
0
0
0.030303
0
0
0
0
0
0
1
0
false
0.166667
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
0
1
1
0
0
0
0
5
57a96474014fddbee5913a9310a039d784110aab
48
py
Python
Tools/MagicPanels/panelMoveZm.py
dprojects/Woodworking
24420b248e3343a387ae1328fc6dcbf97e433242
[ "MIT" ]
6
2022-02-25T19:11:40.000Z
2022-03-24T22:03:47.000Z
Tools/MagicPanels/panelMoveZm.py
dprojects/Woodworking
24420b248e3343a387ae1328fc6dcbf97e433242
[ "MIT" ]
1
2022-03-13T09:35:22.000Z
2022-03-13T13:30:36.000Z
Tools/MagicPanels/panelMoveZm.py
dprojects/Woodworking
24420b248e3343a387ae1328fc6dcbf97e433242
[ "MIT" ]
3
2022-02-26T15:01:08.000Z
2022-03-20T21:30:04.000Z
import MagicPanels MagicPanels.panelMove("Zm")
12
27
0.8125
5
48
7.8
0.8
0
0
0
0
0
0
0
0
0
0
0
0.083333
48
3
28
16
0.886364
0
0
0
0
0
0.041667
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
17b0fd7c5a6eabf2814d6998b9dca75441d1dba9
124
py
Python
src/dns/__init__.py
butlerx/SynologyCloudflareDDNS
a9b0add780a07f84b08f2c702cf216692a7925a4
[ "MIT" ]
null
null
null
src/dns/__init__.py
butlerx/SynologyCloudflareDDNS
a9b0add780a07f84b08f2c702cf216692a7925a4
[ "MIT" ]
1
2019-10-04T04:11:41.000Z
2019-10-04T04:11:41.000Z
src/dns/__init__.py
butlerx/SynologyCloudflareDDNS
a9b0add780a07f84b08f2c702cf216692a7925a4
[ "MIT" ]
null
null
null
from .add import add_record from .get import get_dns_records from .update import update_record from .zones import get_zones
24.8
33
0.83871
21
124
4.714286
0.428571
0.20202
0
0
0
0
0
0
0
0
0
0
0.129032
124
4
34
31
0.916667
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
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
17e0ebce919d05df89dc5a2c70530924ae470030
1,889
py
Python
tests/test_process_deltas.py
endjin/pyspark-experimentation
e69fe03622cdc36fee66b137e2e73ac0023d8e67
[ "Apache-2.0" ]
null
null
null
tests/test_process_deltas.py
endjin/pyspark-experimentation
e69fe03622cdc36fee66b137e2e73ac0023d8e67
[ "Apache-2.0" ]
null
null
null
tests/test_process_deltas.py
endjin/pyspark-experimentation
e69fe03622cdc36fee66b137e2e73ac0023d8e67
[ "Apache-2.0" ]
2
2021-04-27T13:47:23.000Z
2021-04-27T13:48:42.000Z
from pyspark.sql import SparkSession from datetime import datetime import pandas as pd from modules import ProcessDeltas spark = (SparkSession.builder.appName('TestSpark').getOrCreate()) def test_load_latest_data_no_delete(): # given data = {'PrimaryKey': [1, 2, 3, 1, 2, 1], 'Data': [10, 20, 30, 11, 21, 12], 'ExtractDate': [ datetime(2021, 3, 1), datetime(2021, 3, 1), datetime(2021, 3, 1), datetime(2021, 3, 2), datetime(2021, 3, 3), datetime(2021, 3, 4)], 'DeleteFlag': [0, 0, 0, 0, 0, 1] } pdf = pd.DataFrame(data) df = spark.createDataFrame(pdf) # when output = ProcessDeltas.load_latest_data(df, ['PrimaryKey'], False) output_pdf = output.toPandas() # then assert output.count() == 3 output_pdf.loc[output_pdf['PrimaryKey'] == 1, 'Data'] == 12 output_pdf.loc[output_pdf['PrimaryKey'] == 2, 'Data'] == 21 output_pdf.loc[output_pdf['PrimaryKey'] == 3, 'Data'] == 30 def test_load_latest_data_with_delete(): # given data = {'PrimaryKey': [1, 2, 3, 1, 2, 1], 'Data': [10, 20, 30, 11, 21, 12], 'ExtractDate': [ datetime(2021, 3, 1), datetime(2021, 3, 1), datetime(2021, 3, 1), datetime(2021, 3, 2), datetime(2021, 3, 3), datetime(2021, 3, 4)], 'DeleteFlag': [0, 0, 0, 0, 0, 1] } pdf = pd.DataFrame(data) df = spark.createDataFrame(pdf) # when output = ProcessDeltas.load_latest_data(df, ['PrimaryKey'], True) output_pdf = output.toPandas() # then assert output.count() == 2 output_pdf.loc[output_pdf['PrimaryKey'] == 2, 'Data'] == 21 output_pdf.loc[output_pdf['PrimaryKey'] == 3, 'Data'] == 30
29.515625
70
0.538909
230
1,889
4.313043
0.230435
0.145161
0.157258
0.084677
0.819556
0.777218
0.745968
0.745968
0.657258
0.657258
0
0.10482
0.3081
1,889
63
71
29.984127
0.65417
0.016411
0
0.681818
0
0
0.091302
0
0
0
0
0
0.045455
1
0.045455
false
0
0.090909
0
0.136364
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
aa1ba19ed8fd72e95aeea5dece3f56e7dd0e606c
27
py
Python
test_basic.py
prankshaw/Beware-web-scraper
371799a3f79bb36aaf9149cd7c465c2af2522d10
[ "MIT" ]
3
2019-03-15T22:49:19.000Z
2022-03-17T02:41:34.000Z
test_basic.py
prankshaw/c-project-scraper
371799a3f79bb36aaf9149cd7c465c2af2522d10
[ "MIT" ]
3
2020-04-22T12:06:59.000Z
2020-04-22T12:07:00.000Z
test_basic.py
prankshaw/c-project-scraper
371799a3f79bb36aaf9149cd7c465c2af2522d10
[ "MIT" ]
2
2020-01-30T18:56:58.000Z
2021-06-27T06:57:08.000Z
def test_scrap(): 1==1
9
17
0.555556
5
27
2.8
0.8
0
0
0
0
0
0
0
0
0
0
0.1
0.259259
27
2
18
13.5
0.6
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
true
0
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
1
1
0
0
0
0
0
0
5
aa252a7b8f5c3b390d066b91de479b3ff7a0a822
308
py
Python
molly/geolocation/providers/__init__.py
mollyproject/mollyproject
3247c6bac3f39ce8d275d19aa410b30c6284b8a7
[ "Apache-2.0" ]
7
2015-05-16T13:27:21.000Z
2019-08-06T11:09:24.000Z
molly/geolocation/providers/__init__.py
mollyproject/mollyproject
3247c6bac3f39ce8d275d19aa410b30c6284b8a7
[ "Apache-2.0" ]
null
null
null
molly/geolocation/providers/__init__.py
mollyproject/mollyproject
3247c6bac3f39ce8d275d19aa410b30c6284b8a7
[ "Apache-2.0" ]
4
2015-11-27T13:36:36.000Z
2021-03-09T17:55:53.000Z
from molly.conf.provider import Provider class BaseGeolocationProvider(Provider): def reverse_geocode(self, lon, lat): return [] def geocode(self, query): return [] from cloudmade import CloudmadeGeolocationProvider from places import PlacesGeolocationProvider
19.25
50
0.707792
29
308
7.482759
0.655172
0.101382
0
0
0
0
0
0
0
0
0
0
0.233766
308
15
51
20.533333
0.919492
0
0
0.25
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.375
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
1
1
0
0
5
aa286f6449f50c91b3f0e326e46ce4b3a949dcff
87
py
Python
dss_vae/structs/__init__.py
baoy-nlp/DSS-VAE
855f5722301b2d22aef622e7bb8fef74a759f9de
[ "Apache-2.0" ]
37
2019-07-05T16:20:13.000Z
2021-12-21T05:04:49.000Z
dss_vae/structs/__init__.py
baoy-nlp/DSS-VAE
855f5722301b2d22aef622e7bb8fef74a759f9de
[ "Apache-2.0" ]
2
2019-08-28T11:51:01.000Z
2021-06-06T11:39:21.000Z
dss_vae/structs/__init__.py
baoy-nlp/DSS-VAE
855f5722301b2d22aef622e7bb8fef74a759f9de
[ "Apache-2.0" ]
3
2020-01-03T06:17:13.000Z
2021-11-29T12:32:01.000Z
from .corpus import Corpus from .dataset import * from .vocab import VocabEntry, Vocab
21.75
36
0.793103
12
87
5.75
0.5
0
0
0
0
0
0
0
0
0
0
0
0.149425
87
3
37
29
0.932432
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
a4c1ed58301f5d813511f97716bbe5d52c862acd
165
py
Python
15_python_qa_allure-master/test_examples.py
turovod/Otus
57433c6944bca155177b07ff361139ff30f7f692
[ "MIT" ]
null
null
null
15_python_qa_allure-master/test_examples.py
turovod/Otus
57433c6944bca155177b07ff361139ff30f7f692
[ "MIT" ]
null
null
null
15_python_qa_allure-master/test_examples.py
turovod/Otus
57433c6944bca155177b07ff361139ff30f7f692
[ "MIT" ]
null
null
null
import allure @allure.severity("HARD") def test_one(): with allure.step("Привет"): assert 10 == 10 with allure.step("Пока"): assert 1 != 1
16.5
31
0.587879
22
165
4.363636
0.636364
0.208333
0.291667
0
0
0
0
0
0
0
0
0.04918
0.260606
165
9
32
18.333333
0.737705
0
0
0
0
0
0.084848
0
0
0
0
0
0.285714
1
0.142857
true
0
0.142857
0
0.285714
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
1
0
0
0
0
0
0
5
a4d80d9e523b484d7cf6b9b50bf1be8c4a26677a
111
py
Python
6KYU/find_senior.py
yaznasivasai/python_codewars
25493591dde4649dc9c1ec3bece8191a3bed6818
[ "MIT" ]
null
null
null
6KYU/find_senior.py
yaznasivasai/python_codewars
25493591dde4649dc9c1ec3bece8191a3bed6818
[ "MIT" ]
null
null
null
6KYU/find_senior.py
yaznasivasai/python_codewars
25493591dde4649dc9c1ec3bece8191a3bed6818
[ "MIT" ]
null
null
null
def find_senior(lst: list) -> list:      return ([i for i in lst if i['age'] == max([i['age'] for i in lst])])
37
73
0.567568
22
111
2.818182
0.545455
0.129032
0.193548
0.290323
0
0
0
0
0
0
0
0
0.216216
111
2
74
55.5
0.712644
0
0
0
0
0
0.054054
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
0
0
null
0
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
1
0
0
0
0
0
0
0
0
5
a4f20a6fbd74369b0a004f3814224c00762552cb
104
py
Python
flags/__init__.py
TwinDragon/Kreusada-Cogs
91dfa446bd8314eb49dea43bb37b14e76f49cff0
[ "MIT" ]
1
2020-10-24T04:35:57.000Z
2020-10-24T04:35:57.000Z
flags/__init__.py
mina9999/Kreusada-Cogs
25ba2d3af8fa6193473f5c2afc966b5fbb8392b9
[ "MIT" ]
1
2020-10-24T19:11:50.000Z
2020-10-24T20:31:39.000Z
flags/__init__.py
kreus7/demaratus
b1e66746ed39d208a6f157419cc1a05a48769119
[ "MIT" ]
5
2020-10-20T15:54:14.000Z
2020-11-04T08:10:27.000Z
from .flags import Flags, __red_end_user_data_statement__ def setup(bot): bot.add_cog(Flags(bot))
17.333333
57
0.769231
17
104
4.176471
0.764706
0
0
0
0
0
0
0
0
0
0
0
0.134615
104
5
58
20.8
0.788889
0
0
0
0
0
0
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
3529afde67fa9d48aa9057372f55fb567e785f52
1,412
py
Python
src/main/python/aut/common.py
ruebot/aut
4200482d4c1e0238898f1ecb4e765f52a936a846
[ "Apache-2.0" ]
113
2017-08-01T15:33:37.000Z
2022-03-11T14:19:36.000Z
src/main/python/aut/common.py
ruebot/aut
4200482d4c1e0238898f1ecb4e765f52a936a846
[ "Apache-2.0" ]
510
2017-07-06T10:33:55.000Z
2022-03-29T13:40:11.000Z
src/main/python/aut/common.py
ruebot/aut
4200482d4c1e0238898f1ecb4e765f52a936a846
[ "Apache-2.0" ]
36
2017-09-20T03:32:52.000Z
2021-11-23T18:10:30.000Z
from pyspark.sql import DataFrame class WebArchive: def __init__(self, sc, sqlContext, path): self.sc = sc self.sqlContext = sqlContext self.loader = sc._jvm.io.archivesunleashed.df.DataFrameLoader(sc._jsc.sc()) self.path = path def all(self): return DataFrame(self.loader.all(self.path), self.sqlContext) def audio(self): return DataFrame(self.loader.audio(self.path), self.sqlContext) def imagegraph(self): return DataFrame(self.loader.imagegraph(self.path), self.sqlContext) def images(self): return DataFrame(self.loader.images(self.path), self.sqlContext) def pdfs(self): return DataFrame(self.loader.pdfs(self.path), self.sqlContext) def presentation_program(self): return DataFrame( self.loader.presentationProgramFiles(self.path), self.sqlContext ) def spreadsheets(self): return DataFrame(self.loader.spreadsheets(self.path), self.sqlContext) def video(self): return DataFrame(self.loader.videos(self.path), self.sqlContext) def webgraph(self): return DataFrame(self.loader.webgraph(self.path), self.sqlContext) def webpages(self): return DataFrame(self.loader.webpages(self.path), self.sqlContext) def word_processor(self): return DataFrame(self.loader.wordProcessorFiles(self.path), self.sqlContext)
31.377778
84
0.688385
167
1,412
5.772455
0.221557
0.099585
0.216805
0.262448
0.590249
0
0
0
0
0
0
0
0.199009
1,412
44
85
32.090909
0.852343
0
0
0
0
0
0
0
0
0
0
0
0
1
0.387097
false
0
0.032258
0.354839
0.806452
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
0
0
1
1
0
0
5
354661f255f5264bc8b00f684e097d80fa1ae7c9
142
py
Python
website/admin.py
ghassemiali/ghassemi7
2ee577a57fdd40df4e14214c16da266351cd7272
[ "MIT" ]
null
null
null
website/admin.py
ghassemiali/ghassemi7
2ee577a57fdd40df4e14214c16da266351cd7272
[ "MIT" ]
null
null
null
website/admin.py
ghassemiali/ghassemi7
2ee577a57fdd40df4e14214c16da266351cd7272
[ "MIT" ]
null
null
null
from django.contrib import admin from website.models import Contact, Newsletter admin.site.register(Contact) admin.site.register(Newsletter)
23.666667
46
0.838028
19
142
6.263158
0.578947
0.151261
0.285714
0
0
0
0
0
0
0
0
0
0.084507
142
5
47
28.4
0.915385
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
101ba56ebcf506e3bd81429877d404c33fa273e8
69
py
Python
devlivery/__main__.py
wlsouza/flasklivery
564c6135d29493ae5efe074488cb0df7f811d889
[ "Unlicense" ]
null
null
null
devlivery/__main__.py
wlsouza/flasklivery
564c6135d29493ae5efe074488cb0df7f811d889
[ "Unlicense" ]
null
null
null
devlivery/__main__.py
wlsouza/flasklivery
564c6135d29493ae5efe074488cb0df7f811d889
[ "Unlicense" ]
null
null
null
print("Hello this is devlivery executed with 'python -m devlivery'")
34.5
68
0.768116
10
69
5.3
0.9
0
0
0
0
0
0
0
0
0
0
0
0.130435
69
1
69
69
0.883333
0
0
0
0
0
0.855072
0
0
0
0
0
0
1
0
true
0
0
0
0
1
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
1
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
10343a6594c4f2619ded05f4e28ac50d836f09f4
2,239
py
Python
tests/fits/test_polynom_fit.py
michael-amat/fit1d
0cd42874e3eba4353c564809c317510b626dee25
[ "BSD-2-Clause" ]
null
null
null
tests/fits/test_polynom_fit.py
michael-amat/fit1d
0cd42874e3eba4353c564809c317510b626dee25
[ "BSD-2-Clause" ]
null
null
null
tests/fits/test_polynom_fit.py
michael-amat/fit1d
0cd42874e3eba4353c564809c317510b626dee25
[ "BSD-2-Clause" ]
9
2019-02-24T12:51:28.000Z
2019-03-22T09:25:45.000Z
import unittest import numpy as np from fit1d.outliers.outlier_by_distance import RemoveOutlierByDistance from fit1d.fits.polynom_fit import PolynomFit from fit1d.common.outlier import OutLierMock class TestPolyFit(unittest.TestCase): def test_empty(self): obj = PolynomFit() obj._fit_data.x = np.array([-2, -1, 0, 1, 2]) obj._fit_data.y = np.array([4, 1, 0, 1, 4]) obj.fit(obj._fit_data.x, obj._fit_data.y) expected_model = {"coefficients": [1, 0, 0]} self.assertEqual(obj.get_fit_data().model, expected_model) def test_calc_fit_linear(self): outlier_obj = RemoveOutlierByDistance() obj = PolynomFit(outlier=outlier_obj, remove_outliers=False, degree=1) obj._fit_data.x = np.array([0, 1, 2, 3]) obj._fit_data.y = np.array([1, 1, 0, 1]) obj._calc_fit() expected_model = {"coefficients": [-0.1, 0.9]} self.assertEqual(obj.get_fit_data().model, expected_model) def test_calc_fit_parab(self): outlier_obj = RemoveOutlierByDistance() obj = PolynomFit(outlier=outlier_obj, remove_outliers=False, degree=2) obj._fit_data.x = np.array([-2, -1, 0, 1, 2]) obj._fit_data.y = np.array([4, 1, 0, 1, 4]) obj.fit(obj._fit_data.x, obj._fit_data.y) expected_model = {"coefficients": [1, 0, 0]} self.assertEqual(obj.get_fit_data().model, expected_model) def test_calc_eval_parab_smiling(self): outlier_obj = RemoveOutlierByDistance() obj = PolynomFit(outlier=outlier_obj, remove_outliers=False, degree=2) obj._fit_data.x = np.array([-2, -1, 0, 1, 2]) obj._fit_data.y = np.array([4, 1, 0, 1, 4]) obj._calc_fit() obj._calc_eval() self.assertEqual(obj.get_fit_data().y_fit.any(), obj.get_fit_data().y.any()) def test_calc_eval_parab_sad(self): outlier_obj = RemoveOutlierByDistance() obj = PolynomFit(outlier=outlier_obj, remove_outliers=False, degree=2) obj._fit_data.x = np.array([-2, -1, 0, 1, 2]) obj._fit_data.y = np.array([-4, -1, 0, -1, -4]) obj._calc_fit() obj._calc_eval() self.assertEqual(obj.get_fit_data().y_fit.any(), obj.get_fit_data().y.any())
41.462963
84
0.645377
334
2,239
4.056886
0.152695
0.108487
0.103321
0.056827
0.778598
0.757196
0.730627
0.730627
0.730627
0.730627
0
0.036723
0.209469
2,239
53
85
42.245283
0.728814
0
0
0.622222
0
0
0.016093
0
0
0
0
0
0.111111
1
0.111111
false
0
0.111111
0
0.244444
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
10429498076252ea134a309b3db5ec25906cd553
113
py
Python
python/testData/intentions/PyConvertTypeCommentToVariableAnnotationIntentionTest/forLoopWithComplexUnpacking_after.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/intentions/PyConvertTypeCommentToVariableAnnotationIntentionTest/forLoopWithComplexUnpacking_after.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/intentions/PyConvertTypeCommentToVariableAnnotationIntentionTest/forLoopWithComplexUnpacking_after.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
y: Tuple[int, ...] x: Tuple[int] z: Tuple[Union[int, str]] for ([y, (x, (z))]) in \ undefined(): pass
18.833333
25
0.495575
18
113
3.111111
0.611111
0.285714
0
0
0
0
0
0
0
0
0
0
0.238938
113
6
26
18.833333
0.651163
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.166667
0
0
0
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
1
0
0
0
0
0
5
108ce85805beb851cf72e5c312173b8b01e326f9
191
py
Python
sweepstakes_stack_manager.py
coreydjordanphx/sweepstakes_project
52050f2df3a1c2a1bfb15135d4c690939b411b0a
[ "MIT" ]
null
null
null
sweepstakes_stack_manager.py
coreydjordanphx/sweepstakes_project
52050f2df3a1c2a1bfb15135d4c690939b411b0a
[ "MIT" ]
null
null
null
sweepstakes_stack_manager.py
coreydjordanphx/sweepstakes_project
52050f2df3a1c2a1bfb15135d4c690939b411b0a
[ "MIT" ]
null
null
null
from stack import Stack class Sweepstakes_stack_manager: def __init__(self): self.stack = Stack() def insert_sweepstakes(self, sweepstakes): Stack.push(sweepstakes)
21.222222
46
0.706806
22
191
5.818182
0.5
0.25
0
0
0
0
0
0
0
0
0
0
0.21466
191
9
47
21.222222
0.853333
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.166667
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
1
0
0
0
0
1
0
0
5
52d780a4942c0bac04e1dae8b6562220200775ef
19
py
Python
main.py
BahramJannesar/Git-Course
9d0be913ef59855f745a81763b6e0b2778599b95
[ "MIT" ]
1
2021-07-13T20:30:38.000Z
2021-07-13T20:30:38.000Z
main.py
BahramJannesar/Git-Course
9d0be913ef59855f745a81763b6e0b2778599b95
[ "MIT" ]
null
null
null
main.py
BahramJannesar/Git-Course
9d0be913ef59855f745a81763b6e0b2778599b95
[ "MIT" ]
null
null
null
print('Git course')
19
19
0.736842
3
19
4.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.052632
19
1
19
19
0.777778
0
0
0
0
0
0.5
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