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
c2e840143b232839b8c09aefc74a47c5eeedd6a4
85
py
Python
code/answer_3-1-64.py
KoyanagiHitoshi/AtCoder-Python-Introduction
6d014e333a873f545b4d32d438e57cf428b10b96
[ "MIT" ]
1
2022-03-29T13:50:12.000Z
2022-03-29T13:50:12.000Z
code/answer_3-1-64.py
KoyanagiHitoshi/AtCoder-Python-Introduction
6d014e333a873f545b4d32d438e57cf428b10b96
[ "MIT" ]
null
null
null
code/answer_3-1-64.py
KoyanagiHitoshi/AtCoder-Python-Introduction
6d014e333a873f545b4d32d438e57cf428b10b96
[ "MIT" ]
null
null
null
A, B = map(int, input().split()) print(A*B if 1 <= A <= 9 and 1 <= B <= 9 else "-1")
28.333333
51
0.482353
19
85
2.157895
0.631579
0.097561
0
0
0
0
0
0
0
0
0
0.076923
0.235294
85
2
52
42.5
0.553846
0
0
0
0
0
0.023529
0
0
0
0
0
0
1
0
true
0
0
0
0
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
0
0
0
1
0
4
c2f58214c0fde9d084ee94559b93a222772defce
2,201
py
Python
tests/test_inline_text_checkbox.py
Bass-03/SnakeMD
ce768a3ee8b8823bdd9a989d71bc2fc41a20dd18
[ "MIT" ]
9
2021-07-15T19:35:55.000Z
2022-02-21T12:22:40.000Z
tests/test_inline_text_checkbox.py
Bass-03/SnakeMD
ce768a3ee8b8823bdd9a989d71bc2fc41a20dd18
[ "MIT" ]
41
2021-07-15T19:23:48.000Z
2022-01-19T03:21:14.000Z
tests/test_inline_text_checkbox.py
Bass-03/SnakeMD
ce768a3ee8b8823bdd9a989d71bc2fc41a20dd18
[ "MIT" ]
3
2021-07-22T03:33:28.000Z
2021-12-30T18:51:22.000Z
from snakemd import CheckBox def test_checkbox_empty(): text = CheckBox("") assert str(text) == "[ ] " def test_checkbox_str(): text = CheckBox("Hello, World!") assert str(text) == "[ ] Hello, World!" def test_checkbox_checked(): text = CheckBox("Hello, World!", checked=True) assert str(text) == "[X] Hello, World!" def test_checkbox_bold(): text = CheckBox("Hello, World!", bold=True) assert str(text) == "[ ] **Hello, World!**" def test_checkbox_bold_method(): text = CheckBox("Hello, World!").bold() assert str(text) == "[ ] **Hello, World!**" def test_checkbox_unbold_method(): text = CheckBox("Hello, World!", bold=True).unbold() assert str(text) == "[ ] Hello, World!" def test_checkbox_italics(): text = CheckBox("Hello, World!", italics=True) assert str(text) == "[ ] *Hello, World!*" def test_checkbox_italics_method(): text = CheckBox("Hello, World!").italicize() assert str(text) == "[ ] *Hello, World!*" def test_checkbox_bold_italics(): text = CheckBox("Hello, World!", italics=True, bold=True) assert str(text) == "[ ] ***Hello, World!***" def test_checkbox_bold_italics_methods(): text = CheckBox("Hello, World!").bold().italicize() assert str(text) == "[ ] ***Hello, World!***" def test_checkbox_code(): text = CheckBox("x = 7", code=True) assert str(text) == "[ ] `x = 7`" def test_checkbox_url(): text = CheckBox("Here", url="https://google.com") assert str(text) == "[ ] [Here](https://google.com)" def test_checkbox_image(): text = CheckBox("Here", url="https://google.com", image=True) assert str(text) == "[ ] ![Here](https://google.com)" def test_checkbox_image_minus_url(): text = CheckBox("Here", image=True) assert str(text) == "[ ] Here" def test_checkbox_verify_empty(): text = CheckBox("") assert text.verify().passes_inspection() def test_checkbox_verify_invalid_url(): text = CheckBox("Bad URL Test", url="adlsfhaisu") assert not text.verify().passes_inspection() def test_checkbox_verify_no_image_url(): text = CheckBox("Bad URL Test", image=True) assert not text.verify().passes_inspection()
25.011364
65
0.638346
273
2,201
4.959707
0.139194
0.132939
0.188331
0.146233
0.771049
0.704579
0.521418
0.426883
0.301329
0.190547
0
0.001107
0.17901
2,201
87
66
25.298851
0.748201
0
0
0.230769
0
0
0.211268
0
0
0
0
0
0.326923
1
0.326923
false
0.057692
0.019231
0
0.346154
0
0
0
0
null
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
4
c2f72aa31412d602907616171f4198a1db258dc6
85
py
Python
F_Machine_learning/2_Supervised-Learning/solutions/ex1_1.py
oercompbiomed/CBM101
20010dcb99fbf218c4789eb5918dcff8ceb94898
[ "MIT" ]
7
2019-07-03T07:41:55.000Z
2022-02-06T20:25:37.000Z
F_Machine_learning/2_Supervised-Learning/solutions/ex1_1.py
oercompbiomed/CBM101
20010dcb99fbf218c4789eb5918dcff8ceb94898
[ "MIT" ]
9
2019-03-14T15:15:09.000Z
2019-08-01T14:18:21.000Z
F_Machine_learning/2_Supervised-Learning/solutions/ex1_1.py
oercompbiomed/CBM101
20010dcb99fbf218c4789eb5918dcff8ceb94898
[ "MIT" ]
11
2019-03-12T10:43:11.000Z
2021-10-05T12:15:00.000Z
# Answer: # what we look for is separability, so either petal length or petal width.
42.5
74
0.752941
14
85
4.571429
0.928571
0
0
0
0
0
0
0
0
0
0
0
0.188235
85
2
74
42.5
0.927536
0.952941
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
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
c2ffec1219ad64fdddb311b1794f63fc42b98a22
126
py
Python
tests/__init__.py
florimondmanca/tvseries
47bd79b34d409405396e9640c18578837d45e91b
[ "MIT" ]
2
2018-10-05T07:31:02.000Z
2018-10-05T07:34:03.000Z
tests/__init__.py
florimondmanca/tvseries
47bd79b34d409405396e9640c18578837d45e91b
[ "MIT" ]
37
2018-10-09T15:02:44.000Z
2018-11-06T10:28:46.000Z
tests/__init__.py
florimondmanca/tvseries
47bd79b34d409405396e9640c18578837d45e91b
[ "MIT" ]
4
2018-12-11T13:31:32.000Z
2021-12-31T06:33:25.000Z
import socket def nope(*args, **kwargs): raise Exception('A test tried to access the internet!') socket.socket = nope
14
59
0.698413
18
126
4.888889
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.190476
126
8
60
15.75
0.862745
0
0
0
0
0
0.285714
0
0
0
0
0
0
1
0.25
true
0
0.25
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
0
0
0
4
6c26627a97de3fa82c35cd34ed83da551704cac7
268
py
Python
pandas/lib.py
lorenzocestaro/pandas
a73e4518cf3d10fd239cdbd1be3bcda43443bf2a
[ "PSF-2.0", "Apache-2.0", "BSD-2-Clause", "MIT", "BSD-3-Clause" ]
null
null
null
pandas/lib.py
lorenzocestaro/pandas
a73e4518cf3d10fd239cdbd1be3bcda43443bf2a
[ "PSF-2.0", "Apache-2.0", "BSD-2-Clause", "MIT", "BSD-3-Clause" ]
null
null
null
pandas/lib.py
lorenzocestaro/pandas
a73e4518cf3d10fd239cdbd1be3bcda43443bf2a
[ "PSF-2.0", "Apache-2.0", "BSD-2-Clause", "MIT", "BSD-3-Clause" ]
null
null
null
# flake8: noqa import warnings warnings.warn("The pandas.lib module is deprecated and will be " "removed in a future version. Please import from " "the pandas._libs.lib instead", FutureWarning, stacklevel=2) from pandas._libs.lib import *
33.5
74
0.69403
36
268
5.111111
0.722222
0.097826
0.141304
0
0
0
0
0
0
0
0
0.009662
0.227612
268
7
75
38.285714
0.879227
0.044776
0
0
0
0
0.488189
0
0
0
0
0
0
1
0
true
0
0.6
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
6c4135d690151c4109278adbbabbeda9c1c911a4
275
py
Python
cpdd_dataset/data/__init__.py
rnett/cpdd-dataset
f68d40832067775eb1cbe8dd691b78d15c554cb6
[ "MIT" ]
null
null
null
cpdd_dataset/data/__init__.py
rnett/cpdd-dataset
f68d40832067775eb1cbe8dd691b78d15c554cb6
[ "MIT" ]
null
null
null
cpdd_dataset/data/__init__.py
rnett/cpdd-dataset
f68d40832067775eb1cbe8dd691b78d15c554cb6
[ "MIT" ]
null
null
null
from ._location import get_download_location, set_download_location from ._run_data import CylindricalDataFile, Data, DataFile, DataSource, PinholeDataFile, PinholeDataFileSide, \ SphericalDataFile, SplitData from ._side import Side from ._crop import crop_pinhole_to_90
45.833333
111
0.847273
32
275
6.90625
0.625
0.144796
0
0
0
0
0
0
0
0
0
0.00813
0.105455
275
5
112
55
0.890244
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.8
0
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
6c44411f3ce93d201e73428e9aefe97342824a17
872
py
Python
tests/factory/data_factory.py
PedroRTeles/MusicLinkConverter
bfc88b561121c299e2e8bba004147dc6f1c9b7a9
[ "Unlicense" ]
2
2020-11-14T03:25:28.000Z
2021-09-02T13:44:55.000Z
tests/factory/data_factory.py
PedroRTeles/MusicLinkConverter
bfc88b561121c299e2e8bba004147dc6f1c9b7a9
[ "Unlicense" ]
null
null
null
tests/factory/data_factory.py
PedroRTeles/MusicLinkConverter
bfc88b561121c299e2e8bba004147dc6f1c9b7a9
[ "Unlicense" ]
null
null
null
from requests import Response from .helper import json_helper def mock_success_spotify_token_response(): response = Response() response.status_code = 200 response._content = json_helper.get_json_mock('spotify_token_response_success.json') return response def mock_failure_spotify_token_response(): response = Response() response.status_code = 500 response._content = None return response def mock_success_spotify_search_music_response(): response = Response() response.status_code = 200 response._content = json_helper.get_json_mock('spotify_search_response_success.json') return response def mock_success_spotify_track_detail_response(): response = Response() response.status_code = 200 response._content = json_helper.get_json_mock('spotify_track_detail_response_success.json') return response
24.914286
95
0.776376
107
872
5.897196
0.224299
0.304279
0.304279
0.202853
0.779715
0.727417
0.649762
0.522979
0.418384
0.418384
0
0.016304
0.155963
872
34
96
25.647059
0.841033
0
0
0.5
0
0
0.129587
0.129587
0
0
0
0
0
1
0.181818
false
0
0.090909
0
0.454545
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
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
6c6378f96bc94fb9f64113e81308a0af8e7bd8c7
120
py
Python
TorchFly/torchfly/distributed/__init__.py
mrazizi/TextGAIL
9b6e0e62669e0bd4fbb1a8b64098c8432b0d725d
[ "MIT" ]
null
null
null
TorchFly/torchfly/distributed/__init__.py
mrazizi/TextGAIL
9b6e0e62669e0bd4fbb1a8b64098c8432b0d725d
[ "MIT" ]
null
null
null
TorchFly/torchfly/distributed/__init__.py
mrazizi/TextGAIL
9b6e0e62669e0bd4fbb1a8b64098c8432b0d725d
[ "MIT" ]
null
null
null
from .distributed import init_distributed, barrier, get_rank, \ get_world_size, all_reduce_item, sync_workers, mutex
60
63
0.816667
17
120
5.352941
0.882353
0
0
0
0
0
0
0
0
0
0
0
0.116667
120
2
64
60
0.858491
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
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
4
6c659358ffbf7449f56c6c0d4103bb16ad6b47b8
197
py
Python
examples/retrieve_user_information.py
mayaizart/convertapi-python
9afbd4a3b75ebfa7a13366d42801f486eb55cd22
[ "MIT" ]
40
2018-11-05T01:15:21.000Z
2022-02-04T21:11:55.000Z
examples/retrieve_user_information.py
mayaizart/convertapi-python
9afbd4a3b75ebfa7a13366d42801f486eb55cd22
[ "MIT" ]
20
2018-09-03T12:31:11.000Z
2021-11-17T08:06:36.000Z
examples/retrieve_user_information.py
mayaizart/convertapi-python
9afbd4a3b75ebfa7a13366d42801f486eb55cd22
[ "MIT" ]
15
2018-09-25T12:59:52.000Z
2021-12-17T18:19:13.000Z
import convertapi import os convertapi.api_secret = os.environ['CONVERT_API_SECRET'] # your api secret # Retrieve user information # https://www.convertapi.com/doc/user print(convertapi.user())
19.7
74
0.781726
27
197
5.592593
0.592593
0.178808
0
0
0
0
0
0
0
0
0
0
0.106599
197
9
75
21.888889
0.857955
0.390863
0
0
0
0
0.155172
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.25
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
0
0
4
66701fedc0ebe9d629acbfff11d2b6c988d523c7
239
py
Python
chess/pieces/pawn.py
rdebek/chess
0f72894ded5b464994ae03993c5224f705dc8eb7
[ "MIT" ]
null
null
null
chess/pieces/pawn.py
rdebek/chess
0f72894ded5b464994ae03993c5224f705dc8eb7
[ "MIT" ]
null
null
null
chess/pieces/pawn.py
rdebek/chess
0f72894ded5b464994ae03993c5224f705dc8eb7
[ "MIT" ]
null
null
null
from typing import Tuple class Pawn: @staticmethod def has_pawn_moved(init_cords: Tuple[int, int], pawn_color: str) -> bool: return (pawn_color == 'B' and init_cords[0] != 1) or (pawn_color == 'W' and init_cords[0] != 6)
29.875
103
0.656904
38
239
3.921053
0.631579
0.181208
0.161074
0.174497
0
0
0
0
0
0
0
0.021053
0.205021
239
7
104
34.142857
0.763158
0
0
0
0
0
0.008368
0
0
0
0
0
0
1
0.2
false
0
0.2
0.2
0.8
0
0
0
0
null
0
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
0
1
1
0
0
4
6692f5321352f46527d52c91a248cf3fb30a7e5b
1,286
py
Python
CaRM_HD189733/scripts/misc.py
EduardoCristo/CaRM
9ccc87bfbf33b38f2ffab1fb95fbdf2b2d4606e4
[ "MIT" ]
null
null
null
CaRM_HD189733/scripts/misc.py
EduardoCristo/CaRM
9ccc87bfbf33b38f2ffab1fb95fbdf2b2d4606e4
[ "MIT" ]
null
null
null
CaRM_HD189733/scripts/misc.py
EduardoCristo/CaRM
9ccc87bfbf33b38f2ffab1fb95fbdf2b2d4606e4
[ "MIT" ]
null
null
null
def boltoint(inputlist): b = [] nb = [] for x in range(len(inputlist)): b += [[]] nb += [[]] for y in inputlist[x]: if y == True: b[x] += [1] nb[x] += [0] else: b[x] += [0] nb[x] += [1] return(b, nb) def multiply(a, b): if len(a) != len(b): import sys sys.exit( "Dimensions in the multiplication are not the same! Check the input parameters.") c = [] for x in range(len(a)): print(x) c += [[]] for y in range(len(a[x])): c[x] += [a[x][y]*b[x][y]] return(c) #parpos=boltoint([[True, True, True, False, True, True, False, False, False, False, True, True], [True, False, False, False, False, False, False, False, False, False, True, False]]) """ pguess=[ [-1.47400000e+01,1.19497102e-01 , 8.51000000e-02 , 8.76000000e+00, 8.65900000e+01,-5.00000000e+00,6.50478516e-01,4.70000000e+00, 9.00000000e+01,5.82144273e-06,0.00000000e+00 -1.60000000e+01], [-1.47400000e+01,1.19497102e-01,8.51000000e-02,8.76000000e+00, 8.65900000e+01 -5.00000000e+00,6.50478516e-01,4.70000000e+00, 9.00000000e+01,5.82144273e-06,0.00000000e+00 ,-1.60000000e+01]] print(multiply(pguess,parpos[1])) """
29.906977
181
0.545879
193
1,286
3.637306
0.284974
0.156695
0.192308
0.19943
0.576923
0.525641
0.474359
0.474359
0.410256
0.410256
0
0.283755
0.26283
1,286
42
182
30.619048
0.456751
0.139969
0
0
0
0
0.116244
0
0
0
0
0
0
1
0.076923
false
0
0.038462
0
0.115385
0.038462
0
0
0
null
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
669eb99723b1e3520a5faa0519d7ab3bd8dbb32b
293
py
Python
测试/pytest-codes/test_mark_xfail.py
hhyluor/Code_Repository-
0b692bcd5b00312b5c9fd19d55b50c495d27de2b
[ "MIT" ]
null
null
null
测试/pytest-codes/test_mark_xfail.py
hhyluor/Code_Repository-
0b692bcd5b00312b5c9fd19d55b50c495d27de2b
[ "MIT" ]
null
null
null
测试/pytest-codes/test_mark_xfail.py
hhyluor/Code_Repository-
0b692bcd5b00312b5c9fd19d55b50c495d27de2b
[ "MIT" ]
null
null
null
# 测试方法标记为预期失败 # 一般可能在被测试的代码还没有完成的情况,打标记 # @pytest.mark.xfail(condition=bool 表达式,reason=原因) import pytest def upgrade_python_to_4(): raise NotImplemented('xxxx') @pytest.mark.xfail(condition=True, reason='python 目前最高版本是 3.9') def test_upgrade_python_to_4(): upgrade_python_to_4()
18.3125
63
0.764505
41
293
5.219512
0.609756
0.182243
0.21028
0.224299
0
0
0
0
0
0
0
0.019305
0.116041
293
15
64
19.533333
0.80695
0.286689
0
0
0
0
0.107317
0
0
0
0
0
0
1
0.333333
true
0
0.166667
0
0.5
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
1
0
0
0
0
0
0
4
66aa4d5b77a31145f9ae592158bae3df79d99e47
171
py
Python
dockerfiles/scripts/createsuperuser.py
m-me-102427215189576/common
1c6dcd76bdcf4c94ee992e201778fc31e0586e5f
[ "MIT" ]
21
2020-04-28T21:33:59.000Z
2022-02-08T19:11:31.000Z
dockerfiles/scripts/createsuperuser.py
m-me-102427215189576/common
1c6dcd76bdcf4c94ee992e201778fc31e0586e5f
[ "MIT" ]
29
2019-10-03T16:06:40.000Z
2022-03-18T21:48:33.000Z
dockerfiles/scripts/createsuperuser.py
m4ta1l/Common
cba60512f640b5ae30a74e37261808fb01b95c72
[ "MS-PL" ]
28
2020-03-10T19:14:33.000Z
2022-03-20T17:48:28.000Z
from django.contrib.auth.models import User if not User.objects.filter(username='admin').exists(): User.objects.create_superuser('admin', 'admin@admin.com', 'admin')
34.2
70
0.748538
24
171
5.291667
0.708333
0.173228
0
0
0
0
0
0
0
0
0
0
0.087719
171
4
71
42.75
0.814103
0
0
0
0
0
0.175439
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
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
0
0
0
4
66acc410921d91066af687fb2e61aef7e3688542
75
py
Python
pyNeuralEMPC/utils.py
Enderdead/pyNeuralEMPC
032a3675b10389c10bf3e687633462b489b5f26f
[ "MIT" ]
2
2021-08-23T19:05:35.000Z
2022-02-24T20:32:04.000Z
pyNeuralEMPC/utils.py
Enderdead/pyNeuralEMPC
032a3675b10389c10bf3e687633462b489b5f26f
[ "MIT" ]
null
null
null
pyNeuralEMPC/utils.py
Enderdead/pyNeuralEMPC
032a3675b10389c10bf3e687633462b489b5f26f
[ "MIT" ]
null
null
null
# This file will contain all the auxilary functions needed in this library.
75
75
0.813333
12
75
5.083333
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.16
75
1
75
75
0.968254
0.973333
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
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
dd09f6b250e490878de8760b3aeaa1d5d04c772b
882
py
Python
setup.py
holtzmanjon/tools
37df5f9a3bfd3de7ff0fa6eb3820b7e37ef43920
[ "MIT" ]
null
null
null
setup.py
holtzmanjon/tools
37df5f9a3bfd3de7ff0fa6eb3820b7e37ef43920
[ "MIT" ]
null
null
null
setup.py
holtzmanjon/tools
37df5f9a3bfd3de7ff0fa6eb3820b7e37ef43920
[ "MIT" ]
1
2020-09-15T16:47:47.000Z
2020-09-15T16:47:47.000Z
from setuptools import setup setup( name='holtz-tools', version='0.2.0', description='Python utility tools', url='https://github.com/holtzmanjon/tools', author='Jon Holtzman', author_email='holtz@nmsu.edu', license='MIT', packages=['tools'], package_dir={"": "python"}, install_requires=[ 'numpy', ], classifiers=[ 'Development Status :: 1 - Planning', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: BSD License', 'Operating System :: POSIX :: Linux', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', ], )
29.4
53
0.535147
81
882
5.790123
0.666667
0.202559
0.266525
0.166311
0
0
0
0
0
0
0
0.019901
0.316327
882
29
54
30.413793
0.757877
0
0
0.076923
0
0
0.500568
0
0
0
0
0
0
1
0
true
0
0.038462
0
0.038462
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
0
0
0
0
0
4
dd128ea64cc58f1be93814fa31610c9f169a51cb
123
py
Python
help.py
PraghadeshManivannan/Built-in-Functions-Python
a3120641e03e7be8e1408dd467997ad6fdf04d87
[ "MIT" ]
null
null
null
help.py
PraghadeshManivannan/Built-in-Functions-Python
a3120641e03e7be8e1408dd467997ad6fdf04d87
[ "MIT" ]
null
null
null
help.py
PraghadeshManivannan/Built-in-Functions-Python
a3120641e03e7be8e1408dd467997ad6fdf04d87
[ "MIT" ]
null
null
null
#help(object) #the object will be the built-in functions #it returns the object details clearly print(help('print'))
20.5
43
0.731707
19
123
4.736842
0.684211
0.2
0
0
0
0
0
0
0
0
0
0
0.170732
123
5
44
24.6
0.882353
0.731707
0
0
0
0
0.2
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
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
dd15882ce1fa28ea2e58eee2815097f60cc121d8
92
py
Python
sys_users/apps.py
ensarman/mailapi
3da9f34409d30c431a3235c32074abf60bf253c9
[ "MIT" ]
null
null
null
sys_users/apps.py
ensarman/mailapi
3da9f34409d30c431a3235c32074abf60bf253c9
[ "MIT" ]
null
null
null
sys_users/apps.py
ensarman/mailapi
3da9f34409d30c431a3235c32074abf60bf253c9
[ "MIT" ]
null
null
null
from django.apps import AppConfig class SysUsersConfig(AppConfig): name = 'sys_users'
15.333333
33
0.76087
11
92
6.272727
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.163043
92
5
34
18.4
0.896104
0
0
0
0
0
0.097826
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
dd2aa26255e92b46cce1f14e6677000b9f6023e7
97
py
Python
wwwdccn/proceedings/apps.py
marvinxu99/dccnsys
8f53728d06b859cace42cc84bc190bc89950d252
[ "MIT" ]
16
2020-03-15T15:33:30.000Z
2021-11-26T21:57:27.000Z
wwwdccn/proceedings/apps.py
marvinxu99/dccnsys
8f53728d06b859cace42cc84bc190bc89950d252
[ "MIT" ]
11
2019-04-27T19:15:43.000Z
2022-03-11T23:43:08.000Z
wwwdccn/proceedings/apps.py
marvinxu99/dccnsys
8f53728d06b859cace42cc84bc190bc89950d252
[ "MIT" ]
10
2020-03-14T09:25:39.000Z
2022-02-21T16:46:33.000Z
from django.apps import AppConfig class ProceedingsConfig(AppConfig): name = 'proceedings'
16.166667
35
0.773196
10
97
7.5
0.9
0
0
0
0
0
0
0
0
0
0
0
0.154639
97
5
36
19.4
0.914634
0
0
0
0
0
0.113402
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
dd2cd736490aff6b115544410876115492de218d
87
py
Python
microsoft_student_partners/qpower/apps.py
smriti-chaudhary/Microsoft-Student-Partners
db8d36149e45ba3b33bf5a431b6e9c2b324cd804
[ "MIT" ]
15
2020-04-11T17:56:30.000Z
2021-11-07T20:38:49.000Z
microsoft_student_partners/qpower/apps.py
smriti-chaudhary/Microsoft-Student-Partners
db8d36149e45ba3b33bf5a431b6e9c2b324cd804
[ "MIT" ]
23
2020-04-12T06:20:49.000Z
2020-08-09T05:34:45.000Z
microsoft_student_partners/qpower/apps.py
smriti-chaudhary/Microsoft-Student-Partners
db8d36149e45ba3b33bf5a431b6e9c2b324cd804
[ "MIT" ]
28
2020-04-11T18:22:33.000Z
2020-05-08T17:09:52.000Z
from django.apps import AppConfig class QpowerConfig(AppConfig): name = "qpower"
14.5
33
0.747126
10
87
6.5
0.9
0
0
0
0
0
0
0
0
0
0
0
0.172414
87
5
34
17.4
0.902778
0
0
0
0
0
0.068966
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
dd40912dffc13b90be9a69d12184ebc63b568df2
197
py
Python
src/HCRProbeDesign/__init__.py
gofflab/HCRProbeDesign
d131545907be99b05645940b6a065879d14ad149
[ "MIT" ]
2
2021-03-01T01:39:08.000Z
2021-12-29T01:34:55.000Z
src/HCRProbeDesign/__init__.py
gofflab/HCRProbeDesign
d131545907be99b05645940b6a065879d14ad149
[ "MIT" ]
null
null
null
src/HCRProbeDesign/__init__.py
gofflab/HCRProbeDesign
d131545907be99b05645940b6a065879d14ad149
[ "MIT" ]
null
null
null
from . import probeDesign from . import thermo from . import sequencelib import os _ROOT = os.path.abspath(os.path.dirname(__file__)) def index_path(): return os.path.join(_ROOT, 'indices')
17.909091
50
0.741117
28
197
4.964286
0.571429
0.215827
0
0
0
0
0
0
0
0
0
0
0.147208
197
10
51
19.7
0.827381
0
0
0
0
0
0.035533
0
0
0
0
0
0
1
0.142857
false
0
0.571429
0.142857
0.857143
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
0
0
1
1
0
0
0
4
dd5ac51ae7305c305693af502e77b91f51724dcd
1,084
py
Python
myRedis.py
Invoker-liu/shadowsocks_yangmao
69b2bac597298706853276715070096b992b6d48
[ "Apache-2.0" ]
8
2019-09-18T09:49:39.000Z
2021-02-24T17:24:57.000Z
myRedis.py
brave-orange/shadowsock_yangmao
69b2bac597298706853276715070096b992b6d48
[ "Apache-2.0" ]
1
2020-10-30T07:46:58.000Z
2020-11-03T15:57:29.000Z
myRedis.py
Invoker-liu/shadowsocks_yangmao
69b2bac597298706853276715070096b992b6d48
[ "Apache-2.0" ]
3
2020-10-30T06:36:28.000Z
2022-01-29T16:26:25.000Z
#!/usr/bin/env python # encoding=utf-8 import redis class RedisDb: def __init__(self,host,port,password): self.pool = redis.ConnectionPool(host=host , port=port, password =password, decode_responses=True) def lpush(self,name,data): conn = redis.Redis(connection_pool=self.pool) conn.lpush(name,data) def rpush(self,name,data): conn = redis.Redis(connection_pool=self.pool) conn.rpush(name,data) def lrange(self,name,start,stop): conn = redis.Redis(connection_pool=self.pool) res = conn.lrange(name,start,stop) return res def lpop(self,name): conn = redis.Redis(connection_pool=self.pool) res = conn.lpop(name) return res def llen(self,name): conn = redis.Redis(connection_pool=self.pool) return conn.llen(name) def set(self,name,data,timeout): conn = redis.Redis(connection_pool=self.pool) return conn.set(name,data,ex=timeout) def get(self,name): conn = redis.Redis(connection_pool=self.pool) return conn.get(name)
36.133333
106
0.656827
150
1,084
4.666667
0.26
0.091429
0.14
0.24
0.502857
0.502857
0.502857
0.502857
0.502857
0.302857
0
0.001183
0.22048
1,084
30
107
36.133333
0.827219
0.032288
0
0.333333
0
0
0
0
0
0
0
0
0
1
0.296296
false
0.074074
0.037037
0
0.555556
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
0
1
0
0
4
dd5bd353d7d68f0e0607d865778dc61eabab47e2
89
py
Python
flirt/eda/__init__.py
adrian-lison/flirt
55fb2b4c608d0eaa53f6f586a57c87c41b650d8d
[ "MIT" ]
18
2020-10-19T21:05:18.000Z
2022-03-03T14:56:27.000Z
flirt/eda/__init__.py
adrian-lison/flirt
55fb2b4c608d0eaa53f6f586a57c87c41b650d8d
[ "MIT" ]
2
2021-03-04T16:15:49.000Z
2021-03-04T16:21:31.000Z
flirt/eda/__init__.py
adrian-lison/flirt
55fb2b4c608d0eaa53f6f586a57c87c41b650d8d
[ "MIT" ]
9
2020-12-11T18:44:43.000Z
2022-02-23T08:13:47.000Z
from .feature_calculation import get_eda_features __all__ = [ "get_eda_features", ]
14.833333
49
0.764045
11
89
5.363636
0.727273
0.20339
0.474576
0
0
0
0
0
0
0
0
0
0.157303
89
5
50
17.8
0.786667
0
0
0
0
0
0.179775
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
dd6ee0d92a344ec61a96c820beb4538b84b58bc1
310
py
Python
src/encoded/upgrade/user.py
Lattice-Data/encoded
94bb4f7cb51970523715e0598d84699a28f90861
[ "MIT" ]
null
null
null
src/encoded/upgrade/user.py
Lattice-Data/encoded
94bb4f7cb51970523715e0598d84699a28f90861
[ "MIT" ]
10
2020-07-22T20:16:15.000Z
2021-06-16T19:17:44.000Z
src/encoded/upgrade/user.py
Lattice-Data/encoded
94bb4f7cb51970523715e0598d84699a28f90861
[ "MIT" ]
null
null
null
from snovault import upgrade_step @upgrade_step('user', '1', '2') def user_1_2(value, system): if 'job_title' in value: value['job_title'] = value['job_title'].split(',') @upgrade_step('user', '2', '3') def user_2_3(value, system): if 'job_title' in value: value['job_title'] = value['job_title'][0]
22.142857
52
0.670968
51
310
3.823529
0.352941
0.246154
0.266667
0.164103
0.553846
0.553846
0.553846
0.553846
0.553846
0.553846
0
0.033333
0.129032
310
13
53
23.846154
0.688889
0
0
0.222222
0
0
0.216129
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0
0.333333
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
0
0
0
4
dd80a682d3496f90bfa0b980075b66d1166d1de0
2,180
py
Python
vega/smtlib/vega/Fnode.py
K-atc/vega-solver
2919e6ee4ee9db1879e26fbc572a5f18e0eef08e
[ "MIT" ]
1
2020-05-01T10:47:16.000Z
2020-05-01T10:47:16.000Z
vega/smtlib/vega/Fnode.py
K-atc/vega-solver
2919e6ee4ee9db1879e26fbc572a5f18e0eef08e
[ "MIT" ]
null
null
null
vega/smtlib/vega/Fnode.py
K-atc/vega-solver
2919e6ee4ee9db1879e26fbc572a5f18e0eef08e
[ "MIT" ]
null
null
null
from .SymbolType import SymbolType class Fnode: def __init__(self, name, args): self.name = name self._args = args def __repr__(self): return "{}({}, {})".format(self.__class__.__name__, self.name, args) def args(self): return self._args def node_type(self): return self.__class__.__name__ def symbol_name(self): return None def is_and(self): return False def is_or(self): return False def is_not(self): return False def is_implies(self): return False def is_bool_constant(self): return False def is_symbol(self): return False def is_equals(self): return False def is_ite(self): return False class Blank(Fnode): def __init__(self): Fnode.__init__(self) class DataType(Fnode): def __init__(self, name, values): assert name self.name = name self.values = values def __repr__(self): return "{}(name={}, values={})".format(self.__class__.__name__, self.name, self.values) class And(Fnode): def is_and(self): return True class Or(Fnode): def is_or(self): return True class Not(Fnode): def is_not(self): return True class Implies(Fnode): def is_implies(self): return True class BoolConstant(Fnode): def __init__(self, name): self.name = name def __repr__(self): return "{}({})".format(self.__class__.__name__, self.name) def constant_value(self): return bool(self.name) def is_bool_constant(self): return True class Symbol(Fnode): def __init__(self, name, _type): assert isinstance(_type, SymbolType) self.name = name self.type = _type def __repr__(self): return "{}({})".format(self.__class__.__name__, self.name) def symbol_name(self): return self.name def symbol_type(self): return self.type def is_symbol(self): return True class Equals(Fnode): def is_equals(self): return True class Ite(Fnode): def is_ite(self): return True
19.818182
95
0.601376
273
2,180
4.406593
0.128205
0.216126
0.099751
0.104738
0.541147
0.221114
0.114713
0.114713
0.114713
0.114713
0
0
0.292661
2,180
110
96
19.818182
0.780156
0
0
0.556962
0
0
0.020174
0
0
0
0
0
0.025316
1
0.392405
false
0
0.012658
0.329114
0.873418
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
dd91cbcaa760eaa0db1c7a60b78282e3e2c42e1f
2,041
py
Python
tests/test_example.py
ribeiroale/rita
c5d4c709a8d9384b679f9ffb5150f5057bc271b3
[ "MIT" ]
null
null
null
tests/test_example.py
ribeiroale/rita
c5d4c709a8d9384b679f9ffb5150f5057bc271b3
[ "MIT" ]
null
null
null
tests/test_example.py
ribeiroale/rita
c5d4c709a8d9384b679f9ffb5150f5057bc271b3
[ "MIT" ]
null
null
null
# =========================================================================== # # test_example.py # # =========================================================================== # """Unit Testing the 'example' module""" # =========================================================================== # # Imports # # =========================================================================== # import unittest from rita import example # =========================================================================== # # Unit Test Case # # =========================================================================== # class TestExample(unittest.TestCase): def test_add(self) -> None: self.assertEqual(example.add(10, 5), 15) self.assertEqual(example.add(-1, 1), 0) self.assertEqual(example.add(-1, -1), -2) def test_subtract(self) -> None: self.assertEqual(example.subtract(10, 5), 5) self.assertEqual(example.subtract(-1, 1), -2) self.assertEqual(example.subtract(-1, -1), 0) def test_multiply(self) -> None: self.assertEqual(example.multiply(10, 5), 50) self.assertEqual(example.multiply(-1, 1), -1) self.assertEqual(example.multiply(-1, -1), 1) def test_divide(self) -> None: self.assertEqual(example.divide(10, 5), 2) self.assertEqual(example.divide(-1, 1), -1) self.assertEqual(example.divide(-1, -1), 1) self.assertEqual(example.divide(5, 2), 2.5) with self.assertRaises(ValueError): example.divide(10, 0) # =========================================================================== # # __name__ Guard # # =========================================================================== # if __name__ == "__main__": unittest.main()
41.653061
79
0.351788
149
2,041
4.704698
0.255034
0.278174
0.407989
0.131241
0.562054
0.39087
0.222539
0.128388
0.128388
0.128388
0
0.032407
0.259187
2,041
48
80
42.520833
0.431217
0.468888
0
0
0
0
0.00759
0
0
0
0
0
0.583333
1
0.166667
false
0
0.083333
0
0.291667
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
06c5450d9ca2bcbc0bddf89caa6e35619c089b31
157
py
Python
abc/058/b/answer.py
TakuyaNoguchi/atcoder
d079402e6fe9c9aaf3a6fc9272331ee71fc497da
[ "MIT" ]
null
null
null
abc/058/b/answer.py
TakuyaNoguchi/atcoder
d079402e6fe9c9aaf3a6fc9272331ee71fc497da
[ "MIT" ]
null
null
null
abc/058/b/answer.py
TakuyaNoguchi/atcoder
d079402e6fe9c9aaf3a6fc9272331ee71fc497da
[ "MIT" ]
null
null
null
from itertools import zip_longest O, E = input(), input() for (o, e) in zip_longest(O, E): s = ''.join([o or '', e or '']) print(s, end='') print()
19.625
35
0.55414
27
157
3.148148
0.555556
0.070588
0.258824
0.282353
0
0
0
0
0
0
0
0
0.22293
157
8
36
19.625
0.696721
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0.333333
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
0
0
0
0
0
0
0
0
0
4
06c7c7633ec9bcda32bf5b738d481dcbe26ecf4a
99
py
Python
middlewares/__init__.py
Lisovq/markov-chain-bot
b7fb8c1e47c0abda6ccc9dfed1d0b35b8a6eaff1
[ "MIT" ]
null
null
null
middlewares/__init__.py
Lisovq/markov-chain-bot
b7fb8c1e47c0abda6ccc9dfed1d0b35b8a6eaff1
[ "MIT" ]
null
null
null
middlewares/__init__.py
Lisovq/markov-chain-bot
b7fb8c1e47c0abda6ccc9dfed1d0b35b8a6eaff1
[ "MIT" ]
null
null
null
from .message_validate import ValidateMessageMiddleware middlewares = [ValidateMessageMiddleware]
24.75
55
0.878788
7
99
12.285714
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.080808
99
3
56
33
0.945055
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
661f03ffd3192a988deb854fb4ee7e2f69a750b1
91
py
Python
src/backend/common/environment/tasks/tasks_remote_config.py
guineawheek/ftc-data-take-2
337bff2077eadb3bd6bbebd153cbb6181c99516f
[ "MIT" ]
null
null
null
src/backend/common/environment/tasks/tasks_remote_config.py
guineawheek/ftc-data-take-2
337bff2077eadb3bd6bbebd153cbb6181c99516f
[ "MIT" ]
null
null
null
src/backend/common/environment/tasks/tasks_remote_config.py
guineawheek/ftc-data-take-2
337bff2077eadb3bd6bbebd153cbb6181c99516f
[ "MIT" ]
null
null
null
from dataclasses import dataclass @dataclass class TasksRemoteConfig: ngrok_url: str
13
33
0.802198
10
91
7.2
0.9
0
0
0
0
0
0
0
0
0
0
0
0.164835
91
6
34
15.166667
0.947368
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.25
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
4
b0bcc37376604337545d7bdace6fbc289ac32a26
143
py
Python
source-code-from-author-book/Listings-for-Second-Edition/listing_6_19.py
robrac/algorithms-exercises-with-python
5780171517eacc1c7133fdc32cf079623cd14cf9
[ "MIT" ]
null
null
null
source-code-from-author-book/Listings-for-Second-Edition/listing_6_19.py
robrac/algorithms-exercises-with-python
5780171517eacc1c7133fdc32cf079623cd14cf9
[ "MIT" ]
null
null
null
source-code-from-author-book/Listings-for-Second-Edition/listing_6_19.py
robrac/algorithms-exercises-with-python
5780171517eacc1c7133fdc32cf079623cd14cf9
[ "MIT" ]
null
null
null
def insert(self,k): self.heapList.append(k) self.currentSize = self.currentSize + 1 self.percUp(self.currentSize)
23.833333
47
0.622378
17
143
5.235294
0.529412
0.505618
0
0
0
0
0
0
0
0
0
0.009524
0.265734
143
5
48
28.6
0.838095
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
0
0
4
b0d0636b3ec85c63b1ac7bfe78e41529882a7577
298
py
Python
tests/__init__.py
dbuchko/python_cowbull_server
1ae24267ed9ed499e09996e42976a2376f6db798
[ "Apache-2.0" ]
null
null
null
tests/__init__.py
dbuchko/python_cowbull_server
1ae24267ed9ed499e09996e42976a2376f6db798
[ "Apache-2.0" ]
null
null
null
tests/__init__.py
dbuchko/python_cowbull_server
1ae24267ed9ed499e09996e42976a2376f6db798
[ "Apache-2.0" ]
null
null
null
# Import required tests - Note new package placement. from tests.TestV1Routes import TestV1Routes from tests.TestGameController import TestGameController from tests.TestGameObject import TestGameObject from tests.TestGameMode import TestGameMode from tests.TestErrorHandler import TestErrorHandler
42.571429
55
0.875839
32
298
8.15625
0.40625
0.172414
0
0
0
0
0
0
0
0
0
0.007435
0.097315
298
6
56
49.666667
0.962825
0.171141
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
b022bc6f1c05dbe26aac4373eadb743fa12ea46a
632
py
Python
fdk_client/platform/models/GoogleSpreadSheetConfig.py
kavish-d/fdk-client-python
a1023eb530473322cb52e095fc4ceb226c1e6037
[ "MIT" ]
null
null
null
fdk_client/platform/models/GoogleSpreadSheetConfig.py
kavish-d/fdk-client-python
a1023eb530473322cb52e095fc4ceb226c1e6037
[ "MIT" ]
null
null
null
fdk_client/platform/models/GoogleSpreadSheetConfig.py
kavish-d/fdk-client-python
a1023eb530473322cb52e095fc4ceb226c1e6037
[ "MIT" ]
null
null
null
"""Platform Models.""" from marshmallow import fields, Schema from marshmallow.validate import OneOf from ..enums import * from ..models.BaseSchema import BaseSchema from .ArchiveConfig import ArchiveConfig class GoogleSpreadSheetConfig(BaseSchema): # Inventory swagger.json range = fields.Str(required=False) sheet_id = fields.Str(required=False) client_secret_location = fields.Str(required=False) cred_storage_directory = fields.Str(required=False) local_dir = fields.Str(required=False) archive_config = fields.Nested(ArchiveConfig, required=False)
16.631579
65
0.718354
68
632
6.573529
0.5
0.174497
0.190157
0.246085
0
0
0
0
0
0
0
0
0.199367
632
37
66
17.081081
0.883399
0.063291
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.416667
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
b065820bfc1b1ce17d6e56e1ac7806256c741e41
206
py
Python
pythonizame/core/custom_storages.py
kiubtech/pythonizame
6483aa90859fc1bfbc01540efe4ffcf6fe87e450
[ "MIT" ]
6
2017-08-17T22:11:28.000Z
2021-12-23T13:31:28.000Z
pythonizame/core/custom_storages.py
kiubtech/pythonizame
6483aa90859fc1bfbc01540efe4ffcf6fe87e450
[ "MIT" ]
4
2018-04-04T21:02:52.000Z
2021-06-10T20:38:56.000Z
pythonizame/core/custom_storages.py
kiubtech/pythonizame
6483aa90859fc1bfbc01540efe4ffcf6fe87e450
[ "MIT" ]
3
2017-10-27T22:21:41.000Z
2019-09-27T17:38:58.000Z
from pythonizame.core.aws import MEDIAFILES_LOCATION from storages.backends.s3boto3 import S3Boto3Storage class MediaStorage(S3Boto3Storage): location = MEDIAFILES_LOCATION file_overwrite = False
25.75
52
0.830097
22
206
7.636364
0.727273
0.214286
0
0
0
0
0
0
0
0
0
0.033333
0.126214
206
7
53
29.428571
0.9
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
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
0
0
1
0
0
0
0
4
b06cc16e18449896e0f013af89e8ee4aca30d14e
86
py
Python
scikit/scikit4 - Supervised Learning - Linear Regression - Least Square Regression.py
jjsalomon/python-analytics
c2b486864451c42cc3ba2aeb75b2c003112f98ee
[ "MIT" ]
null
null
null
scikit/scikit4 - Supervised Learning - Linear Regression - Least Square Regression.py
jjsalomon/python-analytics
c2b486864451c42cc3ba2aeb75b2c003112f98ee
[ "MIT" ]
null
null
null
scikit/scikit4 - Supervised Learning - Linear Regression - Least Square Regression.py
jjsalomon/python-analytics
c2b486864451c42cc3ba2aeb75b2c003112f98ee
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Fri Jun 2 00:59:53 2017 @author: azkei """ #
10.75
35
0.546512
14
86
3.357143
1
0
0
0
0
0
0
0
0
0
0
0.179104
0.22093
86
8
36
10.75
0.522388
0.860465
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
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
b06dadae5b75a50aefc5ed279633a2ec2fe9626e
102
py
Python
Lista04/ex008.py
Guilherme-Schwann/Listas-de-Exercicios-UFV-CCF-110
f306c8dc6385ee8c9580e687afa16a49ace68f95
[ "MIT" ]
2
2021-09-05T22:29:33.000Z
2021-09-09T00:13:16.000Z
Lista04/ex008.py
Guilherme-Schwann/Listas-de-Exercicios-UFV-CCF-110
f306c8dc6385ee8c9580e687afa16a49ace68f95
[ "MIT" ]
null
null
null
Lista04/ex008.py
Guilherme-Schwann/Listas-de-Exercicios-UFV-CCF-110
f306c8dc6385ee8c9580e687afa16a49ace68f95
[ "MIT" ]
null
null
null
#Ex.14 num = int(input()) if num >= 0: res = pow(num, 1/2) else: res = pow(num, 2) print(res)
12.75
23
0.529412
20
102
2.7
0.65
0.222222
0.333333
0
0
0
0
0
0
0
0
0.078947
0.254902
102
7
24
14.571429
0.631579
0.04902
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.166667
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
0
0
4
b07127b2ee48b9e12896a6948bdb64cc5bd32e52
231
py
Python
0-hello.py
tusharsadhwani/pythonic
39f80663bcbe68d858075ebf395dc62883f5a1bf
[ "MIT" ]
null
null
null
0-hello.py
tusharsadhwani/pythonic
39f80663bcbe68d858075ebf395dc62883f5a1bf
[ "MIT" ]
null
null
null
0-hello.py
tusharsadhwani/pythonic
39f80663bcbe68d858075ebf395dc62883f5a1bf
[ "MIT" ]
null
null
null
class Hello: def __init__(self): self._message = 'Hello world!' def get_message(self): return self._message def main(self): message = self.get_message() print(message) Hello().main()
16.5
38
0.593074
27
231
4.777778
0.407407
0.255814
0
0
0
0
0
0
0
0
0
0
0.290043
231
13
39
17.769231
0.786585
0
0
0
0
0
0.051948
0
0
0
0
0
0
1
0.333333
false
0
0
0.111111
0.555556
0.111111
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
1
0
0
0
1
0
0
0
4
c65e3a06d7f1f443475410c6f052f5ae934659fc
103
py
Python
django_inventory/apps/photos/conf/settings.py
alka653/inventory
b8fc944962666652189ff73ae53b1c2194553e02
[ "Apache-2.0" ]
null
null
null
django_inventory/apps/photos/conf/settings.py
alka653/inventory
b8fc944962666652189ff73ae53b1c2194553e02
[ "Apache-2.0" ]
null
null
null
django_inventory/apps/photos/conf/settings.py
alka653/inventory
b8fc944962666652189ff73ae53b1c2194553e02
[ "Apache-2.0" ]
1
2020-06-08T11:57:08.000Z
2020-06-08T11:57:08.000Z
from django.conf import settings MAX_PHOTO_SIZE = getattr(settings, 'PHOTOS_MAX_PHOTO_SIZE', 1000000)
25.75
68
0.825243
15
103
5.333333
0.733333
0.2
0.3
0
0
0
0
0
0
0
0
0.075269
0.097087
103
3
69
34.333333
0.784946
0
0
0
0
0
0.203884
0.203884
0
0
0
0
0
1
0
false
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
0
0
1
0
0
0
0
4
c66fce8eeed0651b55db9a29512d00669ac5e013
32
py
Python
notebooks/_solutions/13-raster-processing38.py
jorisvandenbossche/DS-python-geospatial
893a12edc5c203a75815f6dcb5f1e18c577c8cd5
[ "BSD-3-Clause" ]
58
2020-10-09T10:10:59.000Z
2022-03-07T14:58:07.000Z
notebooks/_solutions/13-raster-processing38.py
jorisvandenbossche/DS-python-geospatial
893a12edc5c203a75815f6dcb5f1e18c577c8cd5
[ "BSD-3-Clause" ]
24
2020-09-30T19:57:14.000Z
2021-10-05T07:21:09.000Z
notebooks/_solutions/13-raster-processing38.py
jorisvandenbossche/DS-python-geospatial
893a12edc5c203a75815f6dcb5f1e18c577c8cd5
[ "BSD-3-Clause" ]
19
2020-10-05T09:32:18.000Z
2022-03-20T00:09:14.000Z
plt.imshow(1 - roads_buffer_arr)
32
32
0.8125
6
32
4
1
0
0
0
0
0
0
0
0
0
0
0.033333
0.0625
32
1
32
32
0.766667
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
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
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
c6bd723994bdac77faef4642058db6cec9af0cfc
453
py
Python
cmdb/admin.py
endereye/SevenLema
2bf330f4b787e8747d3e848475a08a12aad39257
[ "Apache-2.0" ]
5
2020-07-09T07:35:25.000Z
2021-06-13T12:02:16.000Z
cmdb/admin.py
RickWayne1125/SevenLema
2bf330f4b787e8747d3e848475a08a12aad39257
[ "Apache-2.0" ]
null
null
null
cmdb/admin.py
RickWayne1125/SevenLema
2bf330f4b787e8747d3e848475a08a12aad39257
[ "Apache-2.0" ]
4
2020-07-09T07:35:26.000Z
2021-02-21T01:51:26.000Z
from django.contrib import admin from .models.dish import Dish from .models.dish_order import DishOrder from .models.order import Order from .models.shop import Shop from .models.tag import Tag from .models.tag_shop import TagShop from .models.user import User admin.site.register(Dish) admin.site.register(DishOrder) admin.site.register(Order) admin.site.register(Shop) admin.site.register(Tag) admin.site.register(TagShop) admin.site.register(User)
25.166667
40
0.81457
70
453
5.242857
0.214286
0.190736
0.324251
0
0
0
0
0
0
0
0
0
0.090508
453
17
41
26.647059
0.890777
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.533333
0
0.533333
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
c6d01b6ba0185e61ba9a4367cd63435226c56ce2
176
py
Python
mmdet/datasets/clouds.py
UsmannK/cloud-mmdetection
1b83d86e23f2188501825c8dfc16f9c1cd2dfc9e
[ "Apache-2.0" ]
null
null
null
mmdet/datasets/clouds.py
UsmannK/cloud-mmdetection
1b83d86e23f2188501825c8dfc16f9c1cd2dfc9e
[ "Apache-2.0" ]
null
null
null
mmdet/datasets/clouds.py
UsmannK/cloud-mmdetection
1b83d86e23f2188501825c8dfc16f9c1cd2dfc9e
[ "Apache-2.0" ]
null
null
null
from .coco import CocoDataset from .registry import DATASETS @DATASETS.register_module class CloudsDataset(CocoDataset): CLASSES = ('fish', 'sugar', 'gravel', 'flower')
19.555556
51
0.744318
19
176
6.842105
0.789474
0
0
0
0
0
0
0
0
0
0
0
0.136364
176
8
52
22
0.855263
0
0
0
0
0
0.119318
0
0
0
0
0
0
1
0
false
0
0.4
0
0.8
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
0
1
0
1
0
0
4
c6dfeecedc9049d8750bf076947f2dab87f65714
138
py
Python
addressbook/apps.py
webskate101/django-polymer-addressbook
bf41b6a83e7b9228b383129958488f1c8075c728
[ "Apache-2.0" ]
null
null
null
addressbook/apps.py
webskate101/django-polymer-addressbook
bf41b6a83e7b9228b383129958488f1c8075c728
[ "Apache-2.0" ]
null
null
null
addressbook/apps.py
webskate101/django-polymer-addressbook
bf41b6a83e7b9228b383129958488f1c8075c728
[ "Apache-2.0" ]
null
null
null
from __future__ import unicode_literals from django.apps import AppConfig class AddressbookConfig(AppConfig): name = 'addressbook'
17.25
39
0.804348
15
138
7.066667
0.8
0
0
0
0
0
0
0
0
0
0
0
0.144928
138
7
40
19.714286
0.898305
0
0
0
0
0
0.07971
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
c6ef927b992c77cc081e226a5c68b05afcb45952
56
py
Python
beewarecustomlibexample/src/beewarecustomlibexample/mylib/testlib.py
zasoliton/beeware_custom_lib
6a2d3cb4d7fa247db26d5e6e87e63e9a3b37c6f6
[ "Apache-2.0" ]
null
null
null
beewarecustomlibexample/src/beewarecustomlibexample/mylib/testlib.py
zasoliton/beeware_custom_lib
6a2d3cb4d7fa247db26d5e6e87e63e9a3b37c6f6
[ "Apache-2.0" ]
null
null
null
beewarecustomlibexample/src/beewarecustomlibexample/mylib/testlib.py
zasoliton/beeware_custom_lib
6a2d3cb4d7fa247db26d5e6e87e63e9a3b37c6f6
[ "Apache-2.0" ]
null
null
null
def test(text: str) -> str: return f"Hello: {text}"
18.666667
27
0.589286
9
56
3.666667
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.214286
56
2
28
28
0.75
0
0
0
0
0
0.232143
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
0
0
0
4
c6fca9232413bfdd232bd3d703c60ae6a1de5e06
320
py
Python
kubedriver/kubeclient/os_api_ctl_factory.py
manojn97/kubernetes-driver
06f554e7e74927d528bce51807ed52b4a3a77aa4
[ "Apache-2.0" ]
2
2021-07-19T07:11:36.000Z
2021-08-20T00:42:31.000Z
kubedriver/kubeclient/os_api_ctl_factory.py
manojn97/kubernetes-driver
06f554e7e74927d528bce51807ed52b4a3a77aa4
[ "Apache-2.0" ]
39
2020-08-21T07:39:31.000Z
2022-03-21T09:26:08.000Z
kubedriver/kubeclient/os_api_ctl_factory.py
manojn97/kubernetes-driver
06f554e7e74927d528bce51807ed52b4a3a77aa4
[ "Apache-2.0" ]
11
2020-09-29T06:03:50.000Z
2022-03-07T06:29:36.000Z
from ignition.service.framework import Service, Capability from .os_api_ctl import OpenshiftApiController class OpenshiftApiControllerFactory(Service, Capability): def build(self, kube_location): return OpenshiftApiController(kube_location.client, default_namespace=kube_location.default_object_namespace)
40
117
0.84375
34
320
7.705882
0.647059
0.137405
0
0
0
0
0
0
0
0
0
0
0.1
320
7
118
45.714286
0.909722
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.4
0.2
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
4
05b5b100581d2001237acdae098c529bc1a5b273
13,192
py
Python
harvester/core/tests/views/test_extension.py
nppo/search-portal
aedf21e334f178c049f9d6cf37cafd6efc07bc0d
[ "MIT" ]
1
2022-01-10T00:26:12.000Z
2022-01-10T00:26:12.000Z
harvester/core/tests/views/test_extension.py
nppo/search-portal
aedf21e334f178c049f9d6cf37cafd6efc07bc0d
[ "MIT" ]
48
2021-11-11T13:43:09.000Z
2022-03-30T11:33:37.000Z
harvester/core/tests/views/test_extension.py
nppo/search-portal
aedf21e334f178c049f9d6cf37cafd6efc07bc0d
[ "MIT" ]
null
null
null
from django.test import TestCase from django.contrib.auth.models import User class TestExtensionAPI(TestCase): fixtures = ["datasets-history"] @classmethod def setUpClass(cls): super().setUpClass() cls.user = User.objects.create(username="supersurf") cls.parent_properties = { "title": "title", "description": "description", "language": "nl", "copyright": "cc-by-40" } cls.extension_properties = { "authors": [ {"name": "Monty Python"} ], "parties": [ {"name": "I love the 90's"} ], "themes": [ {"label": "90's"} ], "keywords": [ {"label": "90's"} ] } def setUp(self): super().setUp() self.client.force_login(self.user) def assert_properties(self, properties, external_id="external-id", is_parent=False): # First we assert the basic props self.assertEqual(properties.pop("external_id"), external_id) # Then we assert all properties related to parentship for key in self.parent_properties.keys(): if not is_parent: self.assertNotIn(key, properties) else: self.assertEqual(properties.pop(key), self.parent_properties[key]) # All remaining properties should be regular extension properties for key in self.extension_properties.keys(): self.assertEqual(properties[key], self.extension_properties[key]) def test_list(self): response = self.client.get("/api/v1/extension/") self.assertEqual(response.status_code, 200) response_data = response.json() self.assertEqual(len(response_data), 2) extension = response_data[0] self.assertIn("properties", extension) def test_create_parent(self): """ When creating a parent Extension we should be able to set properties like: title and description, because when an Extension is a parent there exists no Document that provides that data. """ children = [ "5af0e26f-c4d2-4ddd-94ab-7dd0bd531751", "5be6dfeb-b9ad-41a8-b4f5-94b9438e4257" ] body = { "is_parent": True, "external_id": "external-id", "children": children, **self.extension_properties, **self.parent_properties, } response = self.client.post("/api/v1/extension/", body, content_type="application/json") self.assertEqual(response.status_code, 201) response_data = response.json() self.assertIsInstance(response_data, dict) self.assertTrue(response_data["is_parent"]) self.assertEqual(response_data["properties"].pop("children"), children) self.assert_properties(response_data["properties"], is_parent=True) def test_create_parent_no_children(self): """ It should be possible to create a "parent" extension that does not have children (yet) """ body = { "is_parent": True, "external_id": "external-id", **self.extension_properties, **self.parent_properties } response = self.client.post("/api/v1/extension/", body, content_type="application/json") self.assertEqual(response.status_code, 201) response_data = response.json() self.assertIsInstance(response_data, dict) self.assertTrue(response_data["is_parent"]) self.assert_properties(response_data["properties"], is_parent=True) def test_create_no_parent(self): """ It should be possible to create a "non-parent", that has children. This only means that the Extension itself is not a parent, but the underlying Document might be. We also test making a child of a Document """ external_id = "5be6dfeb-b9ad-41a8-b4f5-94b9438e4257" children = [ "5af0e26f-c4d2-4ddd-94ab-7dd0bd531751" ] parents = [ "63903863-6c93-4bda-b850-277f3c9ec00e" ] body = { "external_id": external_id, "children": children, "parents": parents, **self.extension_properties } response = self.client.post("/api/v1/extension/", body, content_type="application/json") self.assertEqual(response.status_code, 201) response_data = response.json() self.assertIsInstance(response_data, dict) self.assertFalse(response_data["is_parent"]) self.assertEqual(response_data["properties"].pop("children"), children) self.assertEqual(response_data["properties"].pop("parents"), parents) self.assert_properties(response_data.pop("properties"), is_parent=False, external_id=external_id) def test_update_parent(self): """ Updating an existing Extension means that all properties will get overridden. There is no merging done for properties. """ external_id = "custom-extension" children = [ "5af0e26f-c4d2-4ddd-94ab-7dd0bd531751", "5be6dfeb-b9ad-41a8-b4f5-94b9438e4257" ] body = { "external_id": external_id, "is_parent": True, "children": children, **self.extension_properties, **self.parent_properties, } response = self.client.put(f"/api/v1/extension/{external_id}/", body, content_type="application/json") self.assertEqual(response.status_code, 200) response_data = response.json() self.assertIsInstance(response_data, dict) self.assertTrue(response_data["is_parent"]) self.assertEqual(response_data["properties"].pop("children"), children) self.assert_properties(response_data["properties"], is_parent=True, external_id=external_id) def test_update_no_parent(self): """ Updating an existing Extension means that all properties will get overridden. There is no merging done for properties. """ external_id = "5af0e26f-c4d2-4ddd-94ab-7dd0bd531751" children = [ "5be6dfeb-b9ad-41a8-b4f5-94b9438e4257" ] body = { "external_id": external_id, "is_parent": False, "children": children, **self.extension_properties, } response = self.client.put(f"/api/v1/extension/{external_id}/", body, content_type="application/json") self.assertEqual(response.status_code, 200) response_data = response.json() self.assertIsInstance(response_data, dict) self.assertFalse(response_data["is_parent"]) self.assertEqual(response_data["properties"].pop("children"), children) self.assert_properties(response_data["properties"], is_parent=False, external_id=external_id) def test_invalid_update_parent(self): """ Once an Extension is created as parent we can't go back. It is however possible to remove the children. This effectively tells Elastic to keep using the Extension as a source for data. It's expected that at a later time new children get added. """ external_id = "custom-extension" body = { "external_id": external_id, "is_parent": False, **self.extension_properties } response = self.client.put(f"/api/v1/extension/{external_id}/", body, content_type="application/json") self.assertEqual( response.status_code, 400, "Did not expect that updating a parent extension to a non-parent extension is allowed" ) external_id = "custom-extension" body = { "external_id": external_id, "is_parent": True, "children": [] } response = self.client.put(f"/api/v1/extension/{external_id}/", body, content_type="application/json") self.assertEqual(response.status_code, 200) response_data = response.json() self.assertEqual(response_data["properties"]["children"], []) def test_delete(self): external_id = "custom-extension" response = self.client.delete(f"/api/v1/extension/{external_id}/", content_type="application/json") self.assertEqual(response.status_code, 204) external_id = "5af0e26f-c4d2-4ddd-94ab-7dd0bd531751" response = self.client.delete(f"/api/v1/extension/{external_id}/", content_type="application/json") self.assertEqual(response.status_code, 204) external_id = "does-not-exist" response = self.client.delete(f"/api/v1/extension/{external_id}/", content_type="application/json") self.assertEqual(response.status_code, 404) def test_invalid_external_id(self): # It should be impossible to create non-parent Extensions if a Document with given external_id does not exist external_id = "not-a-document" body = { "external_id": external_id, "is_parent": False, **self.extension_properties, } response = self.client.post("/api/v1/extension/", body, content_type="application/json") self.assertEqual(response.status_code, 400) # It should be impossible to update an Extension when external_id in path and body mismatch external_id = "custom-extension" body = { "external_id": "body-id", "is_parent": True, **self.extension_properties, } response = self.client.put(f"/api/v1/extension/{external_id}/", body, content_type="application/json") self.assertEqual(response.status_code, 400) def test_invalid_parents(self): external_id = "5be6dfeb-b9ad-41a8-b4f5-94b9438e4257" children = [ "5af0e26f-c4d2-4ddd-94ab-7dd0bd531751" ] parents = [ "does-not-exist" ] body = { "external_id": external_id, "children": children, "parents": parents, **self.extension_properties } response = self.client.post("/api/v1/extension/", body, content_type="application/json") self.assertEqual(response.status_code, 400) external_id = "5af0e26f-c4d2-4ddd-94ab-7dd0bd531751" body = { "external_id": external_id, "children": children, "parents": parents, **self.extension_properties } response = self.client.put(f"/api/v1/extension/{external_id}/", body, content_type="application/json") self.assertEqual(response.status_code, 400) def test_invalid_children(self): external_id = "5be6dfeb-b9ad-41a8-b4f5-94b9438e4257" children = [ "does-not-exist" ] parents = [ "63903863-6c93-4bda-b850-277f3c9ec00e" ] body = { "external_id": external_id, "children": children, "parents": parents, **self.extension_properties } response = self.client.post("/api/v1/extension/", body, content_type="application/json") self.assertEqual(response.status_code, 400) external_id = "5af0e26f-c4d2-4ddd-94ab-7dd0bd531751" body = { "external_id": external_id, "children": children, "parents": parents, **self.extension_properties } response = self.client.put(f"/api/v1/extension/{external_id}/", body, content_type="application/json") self.assertEqual(response.status_code, 400) def test_invalid_properties_non_parent(self): children = [ "5af0e26f-c4d2-4ddd-94ab-7dd0bd531751", "5be6dfeb-b9ad-41a8-b4f5-94b9438e4257" ] body = { "is_parent": False, "external_id": "external-id", "children": children, **self.extension_properties, **self.parent_properties, } response = self.client.post("/api/v1/extension/", body, content_type="application/json") self.assertEqual(response.status_code, 400) external_id = "custom-extension" children = [ "5af0e26f-c4d2-4ddd-94ab-7dd0bd531751", "5be6dfeb-b9ad-41a8-b4f5-94b9438e4257" ] body = { "external_id": external_id, "is_parent": False, "children": children, **self.extension_properties, **self.parent_properties, } response = self.client.put(f"/api/v1/extension/{external_id}/", body, content_type="application/json") self.assertEqual(response.status_code, 400) def test_duplicate_parent(self): external_id = "5af0e26f-c4d2-4ddd-94ab-7dd0bd531751" body = { "external_id": external_id, **self.extension_properties } response = self.client.post("/api/v1/extension/", body, content_type="application/json") self.assertEqual(response.status_code, 400)
40.342508
117
0.611355
1,405
13,192
5.582206
0.143772
0.090527
0.076246
0.051001
0.750606
0.733775
0.729185
0.706235
0.69323
0.683794
0
0.048605
0.274788
13,192
326
118
40.466258
0.771193
0.099075
0
0.656934
0
0
0.22574
0.094814
0
0
0
0
0.175182
1
0.058394
false
0
0.007299
0
0.072993
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
05c5d06b605074512817d9d1e040129c2017a92e
65
py
Python
jybase/database/__init__.py
cnds/wxdemo
a445ea19ccd0b47caf6ea94e1ddec2ce3faf7d5e
[ "MIT" ]
null
null
null
jybase/database/__init__.py
cnds/wxdemo
a445ea19ccd0b47caf6ea94e1ddec2ce3faf7d5e
[ "MIT" ]
null
null
null
jybase/database/__init__.py
cnds/wxdemo
a445ea19ccd0b47caf6ea94e1ddec2ce3faf7d5e
[ "MIT" ]
null
null
null
from .redisbase import RedisBase from .mongobase import MongoBase
32.5
32
0.861538
8
65
7
0.5
0
0
0
0
0
0
0
0
0
0
0
0.107692
65
2
33
32.5
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
0
0
0
4
05ceca4b3248a5e32c4df1518fc61d2097b1c30a
52
py
Python
gitintro/hello.py
SDhn2a/cs257
51ca9fac0c056a77ddc5f4c53bae3e3afe504643
[ "MIT" ]
null
null
null
gitintro/hello.py
SDhn2a/cs257
51ca9fac0c056a77ddc5f4c53bae3e3afe504643
[ "MIT" ]
null
null
null
gitintro/hello.py
SDhn2a/cs257
51ca9fac0c056a77ddc5f4c53bae3e3afe504643
[ "MIT" ]
null
null
null
#Soren DeHaan, Carl Tankersley print("hello world")
17.333333
30
0.769231
7
52
5.714286
1
0
0
0
0
0
0
0
0
0
0
0
0.115385
52
2
31
26
0.869565
0.557692
0
0
0
0
0.5
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
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
05df6a9ecd77fd62361ed4b180bdd7fe7eb25cc7
158
py
Python
src/__init__.py
EliCDavis/PyChart
d466a6760c9acc82fac5ed2f84b99b0b4a731d56
[ "MIT" ]
5
2016-02-07T05:07:07.000Z
2020-01-18T11:53:29.000Z
src/__init__.py
EliCDavis/PyChart
d466a6760c9acc82fac5ed2f84b99b0b4a731d56
[ "MIT" ]
8
2016-01-29T05:35:45.000Z
2020-07-08T18:51:34.000Z
src/__init__.py
EliCDavis/PyChart
d466a6760c9acc82fac5ed2f84b99b0b4a731d56
[ "MIT" ]
2
2016-01-29T18:11:54.000Z
2018-05-22T18:06:31.000Z
__author__ = 'Eli Davis' from src.Chart import Chart from src.ColorSelector import ColorSelector from src.Export import export_charts __name__ = "PyCharts"
19.75
43
0.810127
21
158
5.666667
0.571429
0.176471
0
0
0
0
0
0
0
0
0
0
0.132911
158
7
44
22.571429
0.868613
0
0
0
0
0
0.107595
0
0
0
0
0
0
1
0
false
0
0.6
0
0.6
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
0
1
0
1
0
0
4
05e9937f09c78883b127066add95263bb8176b41
324
py
Python
djangocms_page_sitemap/admin.py
vipulnarang95/djangocms-page-sitemap
607ec13d8c76bc0fa4b51084e37c2d9ec8b1b6c8
[ "BSD-3-Clause" ]
null
null
null
djangocms_page_sitemap/admin.py
vipulnarang95/djangocms-page-sitemap
607ec13d8c76bc0fa4b51084e37c2d9ec8b1b6c8
[ "BSD-3-Clause" ]
null
null
null
djangocms_page_sitemap/admin.py
vipulnarang95/djangocms-page-sitemap
607ec13d8c76bc0fa4b51084e37c2d9ec8b1b6c8
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals from cms.extensions import PageExtensionAdmin from django.contrib import admin from .models import PageSitemapProperties @admin.register(PageSitemapProperties) class PageSitemapPropertiesAdmin(PageExtensionAdmin): pass
24.923077
72
0.82716
33
324
7.909091
0.69697
0
0
0
0
0
0
0
0
0
0
0.00346
0.108025
324
12
73
27
0.899654
0.064815
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.142857
0.571429
0
0.714286
0.142857
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
1
0
0
4
05eabee85d627390a59b6c296586093ad71490c3
91
py
Python
pytition/petition/apps.py
Quenty31/Pytition
0d2cd2ae50c823bc174fe1036f2d435f105ea125
[ "BSD-3-Clause" ]
64
2019-03-07T15:32:37.000Z
2022-03-13T19:05:44.000Z
pytition/petition/apps.py
Quenty31/Pytition
0d2cd2ae50c823bc174fe1036f2d435f105ea125
[ "BSD-3-Clause" ]
157
2019-02-28T07:32:03.000Z
2021-09-24T07:07:09.000Z
pytition/petition/apps.py
Quenty31/Pytition
0d2cd2ae50c823bc174fe1036f2d435f105ea125
[ "BSD-3-Clause" ]
33
2019-04-14T23:40:33.000Z
2022-03-25T11:11:05.000Z
from django.apps import AppConfig class PetitionConfig(AppConfig): name = 'petition'
15.166667
33
0.758242
10
91
6.9
0.9
0
0
0
0
0
0
0
0
0
0
0
0.164835
91
5
34
18.2
0.907895
0
0
0
0
0
0.087912
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
af26552a78ebb45871afd59830852403309e229a
367
py
Python
tests/test_util.py
parallelstream/kines
d7a879df96babf0deeb54d9607e14c020332f78c
[ "MIT" ]
47
2019-09-24T07:33:12.000Z
2022-03-30T10:14:08.000Z
tests/test_util.py
parallelstream/kines
d7a879df96babf0deeb54d9607e14c020332f78c
[ "MIT" ]
11
2019-10-11T09:24:22.000Z
2021-06-22T14:17:23.000Z
tests/test_util.py
parallelstream/kines
d7a879df96babf0deeb54d9607e14c020332f78c
[ "MIT" ]
4
2019-10-08T13:33:22.000Z
2020-11-20T02:48:36.000Z
from kines import util def test_convert_size(): assert "0B" == util.convert_size(0) assert "2.0 GB" == util.convert_size(2147483648) def test_get_or_default(): test_array = ["a", "b", "c"] assert "c" == util.get_or_default(test_array, 2) assert 0 == util.get_or_default(test_array, 3) assert "d" == util.get_or_default(test_array, 3, "d")
26.214286
57
0.66485
60
367
3.783333
0.383333
0.088106
0.211454
0.281938
0.431718
0.339207
0.229075
0
0
0
0
0.059801
0.179837
367
13
58
28.230769
0.694352
0
0
0
0
0
0.038147
0
0
0
0
0
0.555556
1
0.222222
false
0
0.111111
0
0.333333
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
1
0
1
0
0
0
0
0
0
0
4
af51d07a86163cbb2ffd73d6145708c629524e48
540
py
Python
lab/lab03/tests/q1.py
surajrampure/data-94-sp21
074543103579c28d796c681f78f3c38449825328
[ "BSD-3-Clause" ]
1
2020-11-21T09:42:52.000Z
2020-11-21T09:42:52.000Z
lab/lab03/tests/q1.py
surajrampure/data-94-sp21
074543103579c28d796c681f78f3c38449825328
[ "BSD-3-Clause" ]
null
null
null
lab/lab03/tests/q1.py
surajrampure/data-94-sp21
074543103579c28d796c681f78f3c38449825328
[ "BSD-3-Clause" ]
null
null
null
test = { 'name': 'q1', 'points': 0, 'suites': [ { 'cases': [ {'code': '>>> pairwise_multiply([2, 3, 4], [10, 20, 30]) == [20, 60, 120]\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> pairwise_multiply(list(range(1, 10)), list(range(9, 0, -1))) == [9, 16, 21, 24, 25, 24, 21, 16, 9]\nTrue', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
60
191
0.396296
56
540
3.785714
0.642857
0.113208
0.188679
0.207547
0.254717
0
0
0
0
0
0
0.116279
0.362963
540
8
192
67.5
0.5
0
0
0
0
0.25
0.485185
0.096296
0
0
0
0
0
1
0
false
0
0
0
0
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
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
af550a7aa60231318aa43d587d47df17ac5647ac
112
py
Python
src/sample2/goodbye.py
Tocyuki/python-sample-package
4306d65aee036556a6eba56f4bdd81997ad71724
[ "MIT" ]
null
null
null
src/sample2/goodbye.py
Tocyuki/python-sample-package
4306d65aee036556a6eba56f4bdd81997ad71724
[ "MIT" ]
null
null
null
src/sample2/goodbye.py
Tocyuki/python-sample-package
4306d65aee036556a6eba56f4bdd81997ad71724
[ "MIT" ]
null
null
null
def goodbye(): return 'Good Bye' def main(): print(goodbye()) if __name__ == '__main__': main()
10.181818
26
0.571429
13
112
4.307692
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.258929
112
10
27
11.2
0.674699
0
0
0
0
0
0.142857
0
0
0
0
0
0
1
0.333333
true
0
0
0.166667
0.5
0.166667
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
1
0
0
1
0
0
0
4
af83e693cd5237a3db9fbf1e5ba503f832cf4a05
37
py
Python
gpsdio/cli/__init__.py
SkyTruth/gpsdio
22c5a9ef9636ef8de1e7be6d7858cc4b27baa561
[ "Apache-2.0" ]
4
2015-11-14T20:05:05.000Z
2017-10-10T13:29:55.000Z
gpsdio/cli/__init__.py
GlobalFishingWatch/gpsdio
22c5a9ef9636ef8de1e7be6d7858cc4b27baa561
[ "Apache-2.0" ]
110
2015-05-18T16:49:47.000Z
2016-05-11T17:00:03.000Z
gpsdio/cli/__init__.py
GlobalFishingWatch/gpsdio
22c5a9ef9636ef8de1e7be6d7858cc4b27baa561
[ "Apache-2.0" ]
3
2015-09-08T18:10:00.000Z
2018-09-11T16:30:45.000Z
""" gpsdio commandline interface """
9.25
28
0.702703
3
37
8.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.135135
37
3
29
12.333333
0.8125
0.756757
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
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
afab89f88bd14bf287f22e5be7db231ce0278af1
294
py
Python
sfdata_stream_parser/types.py
SocialFinanceDigitalLabs/sfdata-stream-parser
27d7275403094b376cbd624c270ddb43e45f8bc0
[ "MIT" ]
1
2022-03-29T12:13:05.000Z
2022-03-29T12:13:05.000Z
sfdata_stream_parser/types.py
SocialFinanceDigitalLabs/sfdata-stream-parser
27d7275403094b376cbd624c270ddb43e45f8bc0
[ "MIT" ]
null
null
null
sfdata_stream_parser/types.py
SocialFinanceDigitalLabs/sfdata-stream-parser
27d7275403094b376cbd624c270ddb43e45f8bc0
[ "MIT" ]
null
null
null
from typing import Iterator, Callable, Union from sfdata_stream_parser import events FilteredValue = Union[events.ParseEvent, Iterator[events.ParseEvent]] EventFilter = Callable[[events.ParseEvent], FilteredValue] FilterErrorHandler = Callable[[events.ParseEvent, Exception], FilteredValue]
32.666667
76
0.826531
30
294
8.033333
0.5
0.26556
0.19917
0
0
0
0
0
0
0
0
0
0.088435
294
8
77
36.75
0.899254
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
afb0d9b4de0c514ef377f6cd5b7f8437527e8c55
52
py
Python
mzdeepnet/preprocess/__init__.py
MobtgZhang/mzdeepnet
7856461444d9874de2fce9883e23bcd571834364
[ "MIT" ]
null
null
null
mzdeepnet/preprocess/__init__.py
MobtgZhang/mzdeepnet
7856461444d9874de2fce9883e23bcd571834364
[ "MIT" ]
null
null
null
mzdeepnet/preprocess/__init__.py
MobtgZhang/mzdeepnet
7856461444d9874de2fce9883e23bcd571834364
[ "MIT" ]
null
null
null
from .scalers import (StandardScaler,UniformScaler)
26
51
0.846154
5
52
8.8
1
0
0
0
0
0
0
0
0
0
0
0
0.076923
52
1
52
52
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
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
4
afbb3b27c489cc8622b69a864a0d9f4747d7253d
393
py
Python
tests/test_records.py
footings/footings-actuarial
731f3cc4fc9d5f9446d4269b1eb375bf64e80326
[ "BSD-3-Clause" ]
null
null
null
tests/test_records.py
footings/footings-actuarial
731f3cc4fc9d5f9446d4269b1eb375bf64e80326
[ "BSD-3-Clause" ]
3
2021-04-21T10:57:39.000Z
2021-05-04T10:33:52.000Z
tests/test_records.py
footings/long-duration-mdk
731f3cc4fc9d5f9446d4269b1eb375bf64e80326
[ "BSD-3-Clause" ]
null
null
null
import pandas as pd from long_duration_mdk import convert_to_records def test_convert_to_records(): df = pd.DataFrame({"X": [1, 2], "y": [2, 4]}) assert convert_to_records(df) == [{"X": 1, "y": 2}, {"X": 2, "y": 4}] assert convert_to_records(df, "lower") == [{"x": 1, "y": 2}, {"x": 2, "y": 4}] assert convert_to_records(df, "upper") == [{"X": 1, "Y": 2}, {"X": 2, "Y": 4}]
35.727273
82
0.554707
67
393
3.059701
0.343284
0.219512
0.390244
0.35122
0.473171
0.473171
0.35122
0.35122
0.312195
0.312195
0
0.049844
0.183206
393
10
83
39.3
0.588785
0
0
0
0
0
0.061069
0
0
0
0
0
0.428571
1
0.142857
false
0
0.285714
0
0.428571
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
afbebe1a55660e02ddff4d5402a0b49fdceeedd8
2,751
py
Python
src/tests/lukuvinkki_repository_test.py
msha/ohtuminiproject
d0cc4dc2509fc761c8de78c7f86499f1bd270c26
[ "MIT" ]
null
null
null
src/tests/lukuvinkki_repository_test.py
msha/ohtuminiproject
d0cc4dc2509fc761c8de78c7f86499f1bd270c26
[ "MIT" ]
null
null
null
src/tests/lukuvinkki_repository_test.py
msha/ohtuminiproject
d0cc4dc2509fc761c8de78c7f86499f1bd270c26
[ "MIT" ]
null
null
null
import unittest # pylint: disable=unused-import, disable=line-too-long from app import db from entities.lukuvinkki import Lukuvinkki from repositories.lukuvinkki_repository import LukuvinkkiRepository class TestLukuvinkkiRepository(unittest.TestCase): def setUp(self): self.lukuvinkki_repository = LukuvinkkiRepository() self.lukuvinkki = Lukuvinkki( "A title", "An author", "isbn", "A link", "A description", "A comment", ) def test_repository_creates_lukuvinkkis(self): self.lukuvinkki_repository.create(self.lukuvinkki) testvinkkis = self.lukuvinkki_repository.find_all() title = testvinkkis[0].title author = testvinkkis[0].author isbn = testvinkkis[0].isbn descript = testvinkkis[0].descript link = testvinkkis[0].link comment = testvinkkis[0].comment self.lukuvinkki_repository.delete_lukuvinkki(testvinkkis[0].lukuvinkki_id) self.assertEqual(title, "A title") self.assertEqual(author, "An author") self.assertEqual(isbn, "isbn") self.assertEqual(descript, "A description") self.assertEqual(link, "A link") self.assertEqual(comment, "A comment") def test_repository_checks_lukuvinkki_that_exists(self): self.lukuvinkki_repository.create(self.lukuvinkki) testvinkkis = self.lukuvinkki_repository.find_all() flag = self.lukuvinkki_repository.check_lukuvinkki("A title") self.lukuvinkki_repository.delete_lukuvinkki(testvinkkis[0].lukuvinkki_id) self.assertTrue(flag) def test_repository_checks_lukuvinkki_that_does_not_exist(self): flag = self.lukuvinkki_repository.check_lukuvinkki("A title that probably does not exit because the name is super long and obscure vol.2") self.assertFalse(flag) def test_repository_checks_lukuvinkki_that_does_not_exists(self): self.lukuvinkki_repository.create(self.lukuvinkki) testvinkkis = self.lukuvinkki_repository.find_all() title = testvinkkis[0].title author = testvinkkis[0].author isbn = testvinkkis[0].isbn descript = testvinkkis[0].descript link = testvinkkis[0].link comment = testvinkkis[0].comment self.lukuvinkki_repository.delete_lukuvinkki(testvinkkis[0].lukuvinkki_id) self.assertEqual(title, "A title") self.assertEqual(author, "An author") self.assertEqual(isbn, "isbn") self.assertEqual(descript, "A description") self.assertEqual(link, "A link") self.assertEqual(comment, "A comment")
42.984375
146
0.668848
290
2,751
6.186207
0.217241
0.124861
0.160535
0.06243
0.751394
0.737458
0.716834
0.716834
0.662207
0.608696
0
0.007667
0.241367
2,751
63
147
43.666667
0.851941
0.018902
0
0.589286
0
0
0.087134
0
0
0
0
0
0.25
1
0.089286
false
0
0.071429
0
0.178571
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
afc00d3ed76f6eccebd6cb851c983ef948505bc7
647
py
Python
MLGeometry/loss.py
yanghuihe/MLconnections
366c260b2f37ec50348debe9a1fd418de1875f2e
[ "MIT" ]
2
2020-12-16T13:33:13.000Z
2021-01-28T19:04:59.000Z
MLGeometry/loss.py
yidiq7/MLGeometry
589c168ac9d464f61e01839879de3e691b0ca5e6
[ "MIT" ]
null
null
null
MLGeometry/loss.py
yidiq7/MLGeometry
589c168ac9d464f61e01839879de3e691b0ca5e6
[ "MIT" ]
null
null
null
import tensorflow as tf import tensorflow.python.keras.backend as K __all__ = ['weighted_MAPE','weighted_MSE','max_error','MAPE_plus_max_error'] def weighted_MAPE(y_true, y_pred, mass): weights = mass / K.sum(mass) return K.sum(K.abs(y_true - y_pred) / y_true * weights) def weighted_MSE(y_true, y_pred, mass): weights = mass / K.sum(mass) return K.sum(tf.square(y_pred / y_true - 1) * weights) def max_error(y_true, y_pred, mass): return tf.math.reduce_max(K.abs(y_true - y_pred) / y_true) def MAPE_plus_max_error(y_true, y_pred, mass): return 1*max_error(y_true, y_pred, mass) + weighted_MAPE(y_true, y_pred, mass)
32.35
82
0.720247
118
647
3.618644
0.237288
0.128806
0.112412
0.187354
0.562061
0.562061
0.562061
0.421546
0.201405
0.201405
0
0.003636
0.149923
647
19
83
34.052632
0.772727
0
0
0.153846
0
0
0.082043
0
0
0
0
0
0
1
0.307692
false
0
0.153846
0.153846
0.769231
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
bba4cee11efc7905c1e4ef8a06cb2f91fa54e20d
5,473
py
Python
challenges/networks/magpienet/source/file.py
malcolmseyd/magpieCTF2022-public
b54a0dd5ec298c3a0dc7873f2a3a6d5b203e2710
[ "MIT" ]
13
2022-02-27T23:53:32.000Z
2022-03-22T17:44:11.000Z
challenges/networks/magpienet/source/file.py
malcolmseyd/magpieCTF2022-public
b54a0dd5ec298c3a0dc7873f2a3a6d5b203e2710
[ "MIT" ]
null
null
null
challenges/networks/magpienet/source/file.py
malcolmseyd/magpieCTF2022-public
b54a0dd5ec298c3a0dc7873f2a3a6d5b203e2710
[ "MIT" ]
1
2022-02-28T22:27:20.000Z
2022-02-28T22:27:20.000Z
import sys import time import socket import threading # RC2 encrypted with a key of n3tw0rk1ng # and no IV on CyberChef NOTE = "e7b67e867772b6f5868422df420bcb54dfee39665332664967c2cc33a3e51f0450f59744329e583c39cd86f1df93e9da069ce13bb8854effec4889c755e474914bfebb3ec7b45125ce8e5a7d3098385b901f725f6c91d0003994cb8a8fd6e60bc134a6306eb915794082df02798aa6f00eb24e58ff9707905d254143956e9cc0cb3cff030e5a8cbd4aabe324b2ec20742adebbc3f1fb00d4df73f1b4f862c7c2483d8177547e6ea60059498715e8fe279f613a86e52dcdebc045ddfde8b18952614e64736dbbb14b2173aa0763b16d8541cac32b5aa17e8434282551e54cf9529b046fb6b8f4b5b2d44a2d950184c3b0d2d60c338547317e1b7e212c92e0cf3ce9df727e39235e852bebfa5bb844491d991b88d1c714cdbd7875dfdc8b2dacc926c5ffc080517a6b3b9d9d55411b4b7a6f190a19835929caab044d647119a5a47e9afebf91d012312169ea9474d4554d4ed42ac582ce4ac12490636a6660872c5cd6075b747067be9fe22f1bbc448abfb1d0862b27bc843900d784860c214d923659f7674e2039c4148db3ea121197f4d786266c421d17330c64a9b97ac1f6ce7fe55898d2278206841ff44840749caeec0b39183d462f10aa0749b66c47a628d38f6cd24b49ab5effea698c98ea410f59b0ca74b98d3720c52bfe8bde079b968342a72b45e5c6475b939be6d15734404ebf640eacc1b62e39cddbb3fe6c0a991517f66774a8fb87635d2a79cf950fb216e6d3d997f341e8939f8b72d50a2d84a79ddb55d4d3cfc0aadec2405017c6710e0d6c7daac17fded01b519c66fc069ab7bfe32a55ae3aec40a89068b46de88f157a80a8948e540446d93a8127fd707564c6a6b0fdb6c96302f6dc4e4ae5a4e60b48af117b739dd9c7b9b6ed1fab11de39b305a828716c406b52cac5b4ab8aba53b0aa886edffb86d8616f46158ec5c1ef15f74e8e058f1e208a8283e566b445f104759bd50e42f0def5fa837b3901f6bb78522afc5a353836afe2079fb2b0cf6fc49ba457a092323c185c984138af3ea4087e8820e3f7191626fe346757061fbd588ee133f11f94c687801669716118f010500e9ee42e44093e084f289ec95985cd21630d73e0eba8233229a75412b982aeb459519a3a369b04e17dffebca38a29603b6cb196ff4afc13015b6fc195011c7c13e94550708f3a8e380959fa62a125ab84520219419b09cf73d660272bfd4b1692dc83e8508064e7f4d42590d10d081a3f865af65e0f7c712a57fa1e040cba7a625313729b05191f8d08b3b035b1e7c44ae1996641a156118cbab85d10f81ae0eeba6b37629179515edffd4a72d27407869d793df77b30cb89db847fa8f189ce8495ea9d8c4a5adf7c27e2c246fd2df6d6913bd2d34becba822197de6ea4324309d084cf4a404c5d99439bc7a29498d8de14a12a9f9d0b81b665568428be53aa2a011a608fc5f1b0e53bab7491e5969bf18168ec313afff723293a9ac1d918dd6f7456659ffcf542350338bb1d9ce0bfb418ff086c89dfeb585fccf1f51c617bdae06cf3f34dc521752a0909e6d0821dd18a39f8cf74305358afc25a804" README = "TODO: Finish writing the readme for this and the encryption/decryption node" def split_note(n): split_strings = [NOTE[i:i+n] for i in range(0, len(NOTE), n)] print(split_strings) return split_strings class ClientThread(threading.Thread): def __init__(self, sock, addr): threading.Thread.__init__(self) self.sock = sock self.addr = addr self.didquit = False def run(self): try: while not self.didquit: self.send("\n---------MagpieNet Filesystem---------\n") self.send("- Current Files: note.txt, readme.txt\n") self.send("- Type HELP for options\n") self.send("> ") data = self.sock.recv(1024).decode('utf-8').strip() if len(data) > 0: self.handle_msg(data) self.sock.close() except Exception as e: print(f"ERROR: {e}") self.sock.close() def send(self, msg): self.sock.send(msg.encode()) def handle_msg(self, msg): global NOTE global README if msg == "HELP": self.send("\n------------HELP options------------\n") self.send("OPEN <filename> - Opens file with input name\n") self.send("QUIT - Close the filesystem\n") elif msg == "QUIT": self.send("\nGoodbye...\n") self.didquit = True elif msg == "OPEN note.txt": self.send("\n") self.send(NOTE) self.send("\n") elif msg == "OPEN readme.txt": self.send("\n") self.send(README) self.send("\n") def handle_user_connections(port): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(("0.0.0.0", port)) while True: try: s.listen(1) csock, caddr = s.accept() csock.settimeout(30) t = ClientThread(csock, caddr) t.start() except RuntimeError as e: print(f"ERROR: (TOTAL THREADS: {threading.enumerate()}) - Runtime error - {e} ") def handle_network_connection(ip, port): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((ip, port)) s.send(b"JOIN") address = s.recv(1024).decode('utf-8').strip() print(f"LOG: Received address of {address}") msg = f"SETRETPORT {address.split('.')[1]} {sys.argv[2]}" s.send(msg.encode()) msg = f"RENAME {address.split('.')[1]} fileserver" s.send(msg.encode()) while True: time.sleep(0.01) # Just wait here pass s.close() if __name__ == "__main__": threads = [] tu = threading.Thread(target=handle_user_connections, args=[int(sys.argv[2])]) tn = threading.Thread(target=handle_network_connection, args=["srv3.momandpopsflags.ca", int(sys.argv[1])]) threads.append(tu) threads.append(tn) tu.start() tn.start() print("LOG: File nodes started, threads running...") for t in threads: t.join()
54.188119
2,249
0.742189
417
5,473
9.654676
0.359712
0.027819
0.015648
0.007948
0.051167
0.044213
0.022851
0.022851
0.022851
0.022851
0
0.320887
0.168098
5,473
100
2,250
54.73
0.563365
0.013886
0
0.159091
0
0
0.536622
0.44428
0
1
0
0
0
1
0.079545
false
0.011364
0.045455
0
0.147727
0.056818
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
1
null
1
0
0
0
0
0
0
0
0
0
0
0
0
4
bbd7e2f6dc5f91f3aa7ff6d307161f559384407d
1,071
py
Python
vagrant_manager/helpers/args.py
vgrt/vagrant-manager
c1211bc0442a9eb6d120eb00c1c56939813fb5f0
[ "MIT" ]
null
null
null
vagrant_manager/helpers/args.py
vgrt/vagrant-manager
c1211bc0442a9eb6d120eb00c1c56939813fb5f0
[ "MIT" ]
null
null
null
vagrant_manager/helpers/args.py
vgrt/vagrant-manager
c1211bc0442a9eb6d120eb00c1c56939813fb5f0
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import sys run_args = sys.argv[1:] def has_args(): return len(run_args) > 0 def get_arg(index): array_length = len(run_args) if array_length == 0: return None if array_length > 0 and array_length <= index: return None return run_args[index] def has_arg(index): return run_args.get_arg(index) is not None def is_unit_test(): if not has_args(): return False if '--unittest' in run_args: return True return False def get_main_arg(): return get_arg(0) def is_start(): return get_main_arg() == 'start' def is_pause(): return get_main_arg() == 'pause' def is_stop(): return get_main_arg() == 'stop' def is_restart(): return get_main_arg() == 'restart' def is_status(): return get_main_arg() == 'status' def is_login(): return get_main_arg() == 'login' def is_delete(): return get_main_arg() == 'delete' def is_reinstall(): return get_main_arg() == 'reinstall' def is_share(): return get_main_arg() == 'share'
13.909091
50
0.625584
159
1,071
3.918239
0.251572
0.080257
0.160514
0.23114
0
0
0
0
0
0
0
0.007426
0.245565
1,071
76
51
14.092105
0.763614
0.019608
0
0.102564
0
0
0.05916
0
0
0
0
0
0
1
0.358974
false
0
0.025641
0.307692
0.846154
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
bbfa2eb634145ba537c8ea0a9cf4d6b9e37e292b
83
py
Python
HARK/__init__.py
FredericMartenet/HARK
6392c70736ecda088a6baa39289c8d57a8088309
[ "Apache-2.0" ]
null
null
null
HARK/__init__.py
FredericMartenet/HARK
6392c70736ecda088a6baa39289c8d57a8088309
[ "Apache-2.0" ]
null
null
null
HARK/__init__.py
FredericMartenet/HARK
6392c70736ecda088a6baa39289c8d57a8088309
[ "Apache-2.0" ]
1
2020-10-26T22:43:50.000Z
2020-10-26T22:43:50.000Z
from __future__ import absolute_import from .core import * __version__ = '0.10.3'
16.6
38
0.771084
12
83
4.583333
0.75
0
0
0
0
0
0
0
0
0
0
0.056338
0.144578
83
4
39
20.75
0.71831
0
0
0
0
0
0.072289
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
a52627b1d44f0d6eaadd7e6552527e4645162f8c
140
py
Python
settings.py
sergekhakhin/pyokdesk
3023464d30fda4bc390ab5c28792961eaba6d2d7
[ "MIT" ]
null
null
null
settings.py
sergekhakhin/pyokdesk
3023464d30fda4bc390ab5c28792961eaba6d2d7
[ "MIT" ]
null
null
null
settings.py
sergekhakhin/pyokdesk
3023464d30fda4bc390ab5c28792961eaba6d2d7
[ "MIT" ]
null
null
null
from os import getenv api_uri = 'https://uvercom.okdesk.ru/api/v1' api_token = getenv('OKDESK_API_TOKEN') token = {'api_token': api_token}
23.333333
44
0.742857
23
140
4.26087
0.521739
0.326531
0.265306
0
0
0
0
0
0
0
0
0.008
0.107143
140
5
45
28
0.776
0
0
0
0
0
0.407143
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a52ef2b4e8975466b1f0b63442b7e3bd657cf2c9
78
py
Python
designer-ers.py
bcgov/nr-designer-erstudio
9e8ad8e11f52a04dd4c52fd39349ade855d38fb2
[ "CC0-1.0" ]
null
null
null
designer-ers.py
bcgov/nr-designer-erstudio
9e8ad8e11f52a04dd4c52fd39349ade855d38fb2
[ "CC0-1.0" ]
5
2020-10-21T22:20:44.000Z
2022-03-02T21:31:03.000Z
designer-ers.py
bcgov/nr-designer-erstudio
9e8ad8e11f52a04dd4c52fd39349ade855d38fb2
[ "CC0-1.0" ]
1
2020-10-28T20:32:37.000Z
2020-10-28T20:32:37.000Z
from erstudiolib.main import ersmain if __name__ == '__main__': ersmain()
19.5
36
0.730769
9
78
5.444444
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.166667
78
4
37
19.5
0.753846
0
0
0
0
0
0.101266
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
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
0
0
0
4
a538d67117734d855cdf3eeac9d204fa68c3aed4
313
py
Python
mac/pyobjc-core/Lib/objc/_gnustep.py
albertz/music-player
d23586f5bf657cbaea8147223be7814d117ae73d
[ "BSD-2-Clause" ]
132
2015-01-01T10:02:42.000Z
2022-03-09T12:51:01.000Z
mac/pyobjc-core/Lib/objc/_gnustep.py
mba811/music-player
7998986b34cfda2244ef622adefb839331b81a81
[ "BSD-2-Clause" ]
6
2015-01-06T08:23:19.000Z
2019-03-14T12:22:06.000Z
mac/pyobjc-core/Lib/objc/_gnustep.py
mba811/music-player
7998986b34cfda2244ef622adefb839331b81a81
[ "BSD-2-Clause" ]
27
2015-02-23T11:51:43.000Z
2022-03-07T02:34:18.000Z
__all__ = ['pathForFramework', 'infoForFramework'] # # TODO - I have no idea what the semantics are for GNUStep .. # from objc._framework import infoForFramework def ensure_unicode(s): if isinstance(s, str): return unicode(s) return s def pathForFramework(path): return ensure_unicode(path)
22.357143
61
0.71885
39
313
5.589744
0.692308
0.119266
0
0
0
0
0
0
0
0
0
0
0.188498
313
13
62
24.076923
0.858268
0.188498
0
0
0
0
0.128
0
0
0
0
0.076923
0
1
0.25
false
0
0.125
0.125
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
1
1
0
0
4
a53f32a18e6a8871f31949db35904a37ff6f1ab8
130
py
Python
combine1d/core/exception.py
phigre/cobi
bb6cd9a49eb22862be6d87f0a2b0c8baf65cadb5
[ "BSD-3-Clause" ]
4
2021-02-08T20:10:42.000Z
2022-03-09T12:43:16.000Z
combine1d/core/exception.py
phigre/cobi
bb6cd9a49eb22862be6d87f0a2b0c8baf65cadb5
[ "BSD-3-Clause" ]
5
2018-10-18T07:11:58.000Z
2018-12-09T23:16:10.000Z
combine1d/core/exception.py
phigre/COBBI
bb6cd9a49eb22862be6d87f0a2b0c8baf65cadb5
[ "BSD-3-Clause" ]
2
2018-12-30T13:13:55.000Z
2020-03-11T16:15:11.000Z
# Exception if maximum clauclation time of minimisation algorithm is reached class MaxCalculationTimeReached(Exception): pass
32.5
76
0.830769
14
130
7.714286
0.928571
0
0
0
0
0
0
0
0
0
0
0
0.138462
130
3
77
43.333333
0.964286
0.569231
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
4
a54baa3d492df3ac33e3718995754dac26f5909e
98
py
Python
src/ttkcreator/__main__.py
jongbatax/ttkbootstrap
768014ad3282a1b54480abf50861d155b7c76035
[ "MIT" ]
null
null
null
src/ttkcreator/__main__.py
jongbatax/ttkbootstrap
768014ad3282a1b54480abf50861d155b7c76035
[ "MIT" ]
null
null
null
src/ttkcreator/__main__.py
jongbatax/ttkbootstrap
768014ad3282a1b54480abf50861d155b7c76035
[ "MIT" ]
null
null
null
from . import CreatorBaseChooser if __name__ == '__main__': CreatorBaseChooser().mainloop()
16.333333
35
0.734694
8
98
8
0.875
0
0
0
0
0
0
0
0
0
0
0
0.153061
98
5
36
19.6
0.771084
0
0
0
0
0
0.081633
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
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
0
0
0
4
a54c20e20ed0c9b72310800a0ed1dc37f3139454
153
py
Python
9_uzdevums.py
Maris86/Uzdevums
d94daacb2dabcba1486af3ee56d8aca4e5e206fc
[ "MIT" ]
null
null
null
9_uzdevums.py
Maris86/Uzdevums
d94daacb2dabcba1486af3ee56d8aca4e5e206fc
[ "MIT" ]
null
null
null
9_uzdevums.py
Maris86/Uzdevums
d94daacb2dabcba1486af3ee56d8aca4e5e206fc
[ "MIT" ]
null
null
null
svars = float(input("Ievadi savu svaru kg: ")) augums = float(input("Ievadi savu augumu m: ")) kmi = svars / (augums * augums) print("Tavs ĶMI ir:", kmi)
38.25
47
0.666667
23
153
4.434783
0.652174
0.196078
0.313725
0.392157
0
0
0
0
0
0
0
0
0.156863
153
4
48
38.25
0.790698
0
0
0
0
0
0.363636
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
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
0
0
0
0
0
0
0
0
0
4
a56da02186c547cd7a3517706e5b8144c821245d
8,666
py
Python
restApp/views.py
ibamacsr/painelmma_api
a11a6cd63e312f09f445b139fcff8c11ab383764
[ "MIT" ]
null
null
null
restApp/views.py
ibamacsr/painelmma_api
a11a6cd63e312f09f445b139fcff8c11ab383764
[ "MIT" ]
null
null
null
restApp/views.py
ibamacsr/painelmma_api
a11a6cd63e312f09f445b139fcff8c11ab383764
[ "MIT" ]
null
null
null
from rest_framework.generics import ListAPIView #from .models import DailyAlertaAwifs, DailyAlertaDeter from .serializers import * from loginApp.models import UserPermited from .filter_functions import filter_mapa from .utils import create_list class grafico1(ListAPIView): queryset = [0] def get_serializer_class(self): tipo = self.request.GET.get('tipo', None) permited = bool(UserPermited.objects.filter(username=self.request.user.username)) if tipo == 'AWIFS' and self.request.user.is_authenticated() and permited: serializer_class = DailyAlertaAwifsSerializer elif tipo == 'DETER' and self.request.user.is_authenticated() and permited: serializer_class = DailyAlertaDeterSerializer elif tipo == 'DETER' and not permited: serializer_class = PublicAlertaDeterSerializer elif tipo == 'DETER_QUALIF' and self.request.user.is_authenticated() and permited: serializer_class = DailyAlertaDeterSerializer elif tipo == 'DETER_QUALIF' and not permited: serializer_class = PublicAlertaDeterSerializer return serializer_class class grafico2(ListAPIView): queryset = [] def get_queryset(self): ano = self.request.GET.get('ano', None) mes = self.request.GET.get('mes', None) series = 2 + int(self.request.GET.get('frequencia',0)) if self.request.GET.get('frequencia',0) else 2 if int(mes) > 7: queryset = [str(int(ano) - i) + '-' + str(int(ano) - i + 1) for i in range(0,series)] # queryset = [str(ano) + '-' + str((int(ano) + 1)), str((int(ano) - 1)) + '-' + str(ano)] else: queryset = [str(int(ano) - i - 1) + '-' + str(int(ano) - i) for i in range(0,series)] # queryset = [str((int(ano) - 1)) + '-' + str(ano), str((int(ano) - 2)) + '-' + str((int(ano) - 1))] return queryset def get_serializer_class(self): serializer_class = MontlySerializer return serializer_class class grafico3(ListAPIView): queryset = ['Diferença','Parcial'] def get_serializer_class(self): serializer_class = IndiceSerializer return serializer_class class grafico4(ListAPIView): queryset = [] def get_queryset(self): ano = self.request.GET.get('ano', None) mes = self.request.GET.get('mes', None) series = 2 + int(self.request.GET.get('frequencia',0)) if self.request.GET.get('frequencia',0) else 2 if int(mes) > 7: queryset = [str(int(ano) - i) + '-' + str(int(ano) - i + 1) for i in range(0,series)] # queryset = [str(ano) + '-' + str((int(ano) + 1)), str((int(ano) - 1)) + '-' + str(ano)] else: queryset = [str(int(ano) - i - 1) + '-' + str(int(ano) - i) for i in range(0,series)] # queryset = [str((int(ano) - 1)) + '-' + str(ano), str((int(ano) - 2)) + '-' + str((int(ano) - 1))] return queryset def get_serializer_class(self): serializer_class = UFSerializer return serializer_class class grafico5(ListAPIView): queryset = ['PRODES', 'DETER', 'AWIFS'] def get_serializer_class(self): serializer_class = AcumuladoSerializer return serializer_class class grafico6(ListAPIView): queryset = ['PRODES', 'DETER', 'AWIFS'] def get_serializer_class(self): serializer_class = UFComparativoSerializer return serializer_class class grafico7(ListAPIView): # queryset = ['2013-2014', '2014-2015'] def get_queryset(self): ano = self.request.GET.get('ano', None) mes = self.request.GET.get('mes', None) series = 2 + int(self.request.GET.get('frequencia',0)) if self.request.GET.get('frequencia',0) else 2 if int(mes) > 7: queryset = [str(int(ano) - i) + '-' + str(int(ano) - i + 1) for i in range(0,series)] # queryset = [str(ano) + '-' + str((int(ano) + 1)), str((int(ano) - 1)) + '-' + str(ano)] else: queryset = [str(int(ano) - i - 1) + '-' + str(int(ano) - i) for i in range(0,series)] # queryset = [str((int(ano) - 1)) + '-' + str(ano), str((int(ano) - 2)) + '-' + str((int(ano) - 1))] return queryset def get_serializer_class(self): serializer_class = NuvemSerializer return serializer_class class grafico8(ListAPIView): # queryset = ['2015-2016'] queryset = [] def get_queryset(self): ano = self.request.GET.get('ano', None) mes = self.request.GET.get('mes', None) indice = self.request.GET.get('indice', 0) if int(mes) > 7: queryset = [str(int(ano) + int(indice)) + '-' + str((int(ano) + int(indice) + 1))] else: queryset = [str((int(ano) + int(indice) - 1)) + '-' + str(int(ano) + int(indice))] # if int(mes) > 7: # queryset = [str(ano) + '-' + str((int(ano) + 1)), str((int(ano) - 1)) + '-' + str(ano)] # else: # queryset = [str((int(ano) - 1)) + '-' + str(ano), str((int(ano) - 2)) + '-' + str((int(ano) - 1))] return queryset def get_serializer_class(self): serializer_class = UFPeriodoSerializer return serializer_class class grafico9(ListAPIView): queryset = [0] def get_serializer_class(self): serializer_class = UFMesPeriodoSerializer return serializer_class class gauge1(ListAPIView): def get_queryset(self): ano = self.request.GET.get('ano', None) return [int(ano)-1, int(ano)] def get_serializer_class(self): serializer_class = ComparativoPeriodosSerializer return serializer_class class gauge2(ListAPIView): def get_queryset(self): ano = self.request.GET.get('ano', None) return [int(ano)-1, int(ano)] def get_serializer_class(self): serializer_class = ComparativoProdesPeriodosSerializer return serializer_class class mapa(ListAPIView): def get_queryset(self): tipo = self.request.GET.get('tipo', None) estagio = self.request.GET.get('estagio', None) permited = bool(UserPermited.objects.filter(username=self.request.user.username)) if tipo == 'AWIFS' and self.request.user.is_authenticated() and permited: queryset = DailyAlertaAwifs.objects.all().filter(estagio=estagio) queryset = filter_mapa( queryset, self.request.GET ) queryset = queryset elif tipo == 'DETER' or tipo == 'DETER_QUALIF': if self.request.user.is_authenticated() and permited: queryset = DailyAlertaDeter.objects.all() elif not permited: queryset = PublicAlertaDeter.objects.all() queryset = filter_mapa( queryset, self.request.GET ) queryset = queryset return queryset def get_serializer_class(self): tipo = self.request.GET.get('tipo', None) permited = bool(UserPermited.objects.filter(username=self.request.user.username)) if tipo == 'AWIFS' and self.request.user.is_authenticated() and permited: serializer_class = DailyAwifsSerializer elif tipo == 'DETER' or tipo == 'DETER_QUALIF': if self.request.user.is_authenticated() and permited: serializer_class = DailyDeterSerializer elif not permited: serializer_class = PublicDeterSerializer return serializer_class class cruzamentoGrafico1(ListAPIView): queryset = [0] def get_serializer_class(self): serializer_class = CruzamentoGrafico1Serializer return serializer_class class cruzamentoGrafico2(ListAPIView): queryset = [0] def get_serializer_class(self): # tipo = self.request.GET.get('tipo', None) # permited = bool(UserPermited.objects.filter(username=self.request.user.username)) serializer_class = CruzamentoGrafico2Serializer # elif tipo == 'DETER' and self.request.user.is_authenticated() and permited: # serializer_class = DailyAlertaDeterSerializer # elif tipo == 'DETER' and not permited: # serializer_class = PublicAlertaDeterSerializer # elif tipo == 'DETER_QUALIF' and self.request.user.is_authenticated() and permited: # serializer_class = DailyAlertaDeterSerializer # elif tipo == 'DETER_QUALIF' and not permited: # serializer_class = PublicAlertaDeterSerializer return serializer_class
33.459459
112
0.608239
973
8,666
5.320658
0.102775
0.150666
0.062585
0.072243
0.743674
0.734595
0.722233
0.711802
0.697315
0.672783
0
0.015156
0.261482
8,666
259
113
33.459459
0.79375
0.169167
0
0.677632
0
0
0.035386
0
0
0
0
0
0
1
0.138158
false
0
0.032895
0
0.467105
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a59b8847efeef7fdcca63774068a1711f1fc726b
179
py
Python
aurifere/providers/__init__.py
jarondl/aurifere
818b8a6254d5f3723763ca763fe1376d7f714737
[ "0BSD" ]
null
null
null
aurifere/providers/__init__.py
jarondl/aurifere
818b8a6254d5f3723763ca763fe1376d7f714737
[ "0BSD" ]
null
null
null
aurifere/providers/__init__.py
jarondl/aurifere
818b8a6254d5f3723763ca763fe1376d7f714737
[ "0BSD" ]
null
null
null
# A provider has a constructor that takes a name and a dir, a upstream_version method, and a fetch_upstream_method # TODO: document this with an abc when I make another provider
44.75
114
0.793296
32
179
4.34375
0.71875
0.057554
0
0
0
0
0
0
0
0
0
0
0.178771
179
3
115
59.666667
0.945578
0.96648
0
null
0
null
0
0
null
0
0
0.333333
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
1
0
0
0
1
0
0
0
0
0
0
4
3c071f5b4804527f717d2488a0de5b26762e55b1
74
py
Python
ABC176/A.py
shimomura314/AtcoderCodes
db1d62a7715f5f1b3c40eceff8d34f0f34839f41
[ "MIT" ]
null
null
null
ABC176/A.py
shimomura314/AtcoderCodes
db1d62a7715f5f1b3c40eceff8d34f0f34839f41
[ "MIT" ]
null
null
null
ABC176/A.py
shimomura314/AtcoderCodes
db1d62a7715f5f1b3c40eceff8d34f0f34839f41
[ "MIT" ]
null
null
null
import math n,x,t = map(int,input().split()) print(int(math.ceil(n/x))*t)
18.5
32
0.648649
16
74
3
0.6875
0.083333
0.125
0
0
0
0
0
0
0
0
0
0.081081
74
4
33
18.5
0.705882
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
3c0cd49bfb7ef081e8096c9293aab4a9b2e8b482
63
py
Python
encoding/spooky/__init__.py
metro-source/arctic-ledger
5941335af6faaa262b799a843edb08365bbbb1f0
[ "MIT" ]
null
null
null
encoding/spooky/__init__.py
metro-source/arctic-ledger
5941335af6faaa262b799a843edb08365bbbb1f0
[ "MIT" ]
null
null
null
encoding/spooky/__init__.py
metro-source/arctic-ledger
5941335af6faaa262b799a843edb08365bbbb1f0
[ "MIT" ]
null
null
null
""" Abandon hope all ye who enter the depths of this module """
21
55
0.714286
11
63
4.090909
1
0
0
0
0
0
0
0
0
0
0
0
0.190476
63
3
56
21
0.882353
0.873016
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
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
3c1134c266171c7bd289e60a42464e7250b5d856
82
py
Python
api/achievements/100points/100points.py
sachinkamath/picoCTF-Platform-2
1e70d633ff2975a7e01c7cb8ba44fffbb8620345
[ "MIT" ]
10
2015-09-11T03:16:20.000Z
2021-08-11T23:49:01.000Z
api/achievements/100points/100points.py
sachinkamath/picoCTF-Platform-2
1e70d633ff2975a7e01c7cb8ba44fffbb8620345
[ "MIT" ]
8
2015-08-29T19:34:02.000Z
2016-02-01T18:15:54.000Z
api/achievements/100points/100points.py
sachinkamath/picoCTF-Platform-2
1e70d633ff2975a7e01c7cb8ba44fffbb8620345
[ "MIT" ]
2
2019-08-29T11:51:23.000Z
2021-04-10T19:59:08.000Z
def process(api, data): return api.stats.get_score(tid=data["tid"]) > 100, {}
27.333333
57
0.646341
13
82
4
0.769231
0
0
0
0
0
0
0
0
0
0
0.042857
0.146341
82
2
58
41
0.7
0
0
0
0
0
0.036585
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
0
0
0
4
3c28433535c11d84395a177aa9e14d1b36af46bc
88
py
Python
run.py
nanome-ai/plugin-url-loader
3e9e327bcf9785534712caa9371b58df9beb59d2
[ "MIT" ]
null
null
null
run.py
nanome-ai/plugin-url-loader
3e9e327bcf9785534712caa9371b58df9beb59d2
[ "MIT" ]
null
null
null
run.py
nanome-ai/plugin-url-loader
3e9e327bcf9785534712caa9371b58df9beb59d2
[ "MIT" ]
1
2020-02-22T00:39:44.000Z
2020-02-22T00:39:44.000Z
from nanome_url_loader import URLLoader if __name__ == "__main__": URLLoader.main()
22
39
0.761364
11
88
5.181818
0.818182
0
0
0
0
0
0
0
0
0
0
0
0.147727
88
4
40
22
0.76
0
0
0
0
0
0.089888
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
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
0
0
0
4
3c66fdb8612fd5dc5bd923d6e5c451e24db0fe6f
107
py
Python
test.py
vectorcrumb/3D-face-tracker
688f0db1a392a26a12cc4ad5c4b427fba336a9fb
[ "MIT" ]
null
null
null
test.py
vectorcrumb/3D-face-tracker
688f0db1a392a26a12cc4ad5c4b427fba336a9fb
[ "MIT" ]
null
null
null
test.py
vectorcrumb/3D-face-tracker
688f0db1a392a26a12cc4ad5c4b427fba336a9fb
[ "MIT" ]
null
null
null
import cv2 print(cv2.__version__) if cv2.__version__ is '2.4.10': print("Install working!") exit(0)
11.888889
31
0.691589
17
107
3.882353
0.764706
0.30303
0
0
0
0
0
0
0
0
0
0.088889
0.158879
107
8
32
13.375
0.644444
0
0
0
0
0
0.205607
0
0
0
0
0
0
1
0
true
0
0.2
0
0.2
0.4
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
3c7d17627bf7c41fc6c5adc22cb0b59637f4eccc
215
py
Python
ttr/plugins/returners/__init__.py
dmulyalin/template-text-renderer
f1993b6e8f652d55207b7d0961673dea8e7ffec1
[ "MIT" ]
5
2021-01-27T03:58:04.000Z
2022-02-06T14:20:26.000Z
ttr/plugins/returners/__init__.py
dmulyalin/template-text-renderer
f1993b6e8f652d55207b7d0961673dea8e7ffec1
[ "MIT" ]
1
2021-12-21T15:17:55.000Z
2021-12-23T07:31:26.000Z
ttr/plugins/returners/__init__.py
dmulyalin/template-text-renderer
f1993b6e8f652d55207b7d0961673dea8e7ffec1
[ "MIT" ]
null
null
null
from . import file_returner from . import terminal_returner from . import self_returner returners_plugins = { "self": self_returner.dump, "file": file_returner.dump, "terminal": terminal_returner.dump }
23.888889
38
0.748837
26
215
5.923077
0.346154
0.194805
0.233766
0
0
0
0
0
0
0
0
0
0.15814
215
9
39
23.888889
0.850829
0
0
0
0
0
0.074074
0
0
0
0
0
0
1
0
false
0
0.375
0
0.375
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
b1bad96e26c2ffa06f0f17be76c49b42c7bfc199
12,556
py
Python
target_decisioning_engine/tests/test_context_provider.py
adobe/target-python-sdk
f3e9b1bb6c8e1984e3d758ab1fe1a71225ade13e
[ "Apache-2.0" ]
3
2021-05-25T20:10:46.000Z
2021-06-15T05:49:18.000Z
target_decisioning_engine/tests/test_context_provider.py
adobe/target-python-sdk
f3e9b1bb6c8e1984e3d758ab1fe1a71225ade13e
[ "Apache-2.0" ]
15
2021-01-13T22:53:25.000Z
2021-09-03T23:11:25.000Z
target_decisioning_engine/tests/test_context_provider.py
adobe/target-python-sdk
f3e9b1bb6c8e1984e3d758ab1fe1a71225ade13e
[ "Apache-2.0" ]
4
2021-01-04T18:44:01.000Z
2022-03-15T21:30:11.000Z
# Copyright 2021 Adobe. All rights reserved. # This file is licensed to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. You may obtain a copy # of the License at http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software distributed under # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS # OF ANY KIND, either express or implied. See the License for the specific language # governing permissions and limitations under the License. """Unit tests for target_decisioning_engine.context_provider module""" import unittest from delivery_api_client import Context from delivery_api_client import ChannelType from delivery_api_client import Address from delivery_api_client import MboxRequest from delivery_api_client import Geo from delivery_api_client import DeliveryRequest from target_decisioning_engine.context_provider import create_page_context from target_decisioning_engine.context_provider import create_referring_context from target_decisioning_engine.context_provider import create_mbox_context from target_decisioning_engine.context_provider import create_geo_context from target_decisioning_engine.context_provider import create_decisioning_context from target_decisioning_engine.types.decisioning_context import UserContext from target_decisioning_engine.types.decisioning_context import PageContext from target_decisioning_engine.types.decisioning_context import GeoContext from target_decisioning_engine.types.decisioning_context import DecisioningContext from target_tools.constants import EMPTY_STRING FIREFOX_USER_AGENT = \ "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" TEST_URL = "http://Blog.Myfavesite.GeoCities.com/Posts?Page=1#Bottom" class TestContextProvider(unittest.TestCase): def test_create_browser_context(self): request_context = Context(channel=ChannelType.WEB, user_agent=FIREFOX_USER_AGENT) request = DeliveryRequest(context=request_context) result = create_decisioning_context(request) self.assertTrue(isinstance(result.get("user"), UserContext)) self.assertEqual(result.get("user").get("browserType"), "firefox") self.assertEqual(result.get("user").get("platform"), "Windows") self.assertEqual(result.get("user").get("locale"), "en") self.assertEqual(result.get("user").get("browserVersion"), 47) def test_create_page_context_url_empty_string(self): address = Address(url=EMPTY_STRING) result = create_page_context(address) self.assertTrue(isinstance(result, PageContext)) for key in result.values(): self.assertEqual(key, EMPTY_STRING) def test_create_page_context_non_empty_url(self): address = Address(url=TEST_URL) result = create_page_context(address) self.assertTrue(isinstance(result, PageContext)) self.assertEqual(result.get("domain"), "geocities") self.assertEqual(result.get("domain_lc"), "geocities") self.assertEqual(result.get("fragment"), "Bottom") self.assertEqual(result.get("fragment_lc"), "bottom") self.assertEqual(result.get("path"), "/Posts") self.assertEqual(result.get("path_lc"), "/posts") self.assertEqual(result.get("query"), "Page=1") self.assertEqual(result.get("query_lc"), "page=1") self.assertEqual(result.get("subdomain"), "blog.myfavesite") self.assertEqual(result.get("subdomain_lc"), "blog.myfavesite") self.assertEqual(result.get("topLevelDomain"), "com") self.assertEqual(result.get("topLevelDomain_lc"), "com") self.assertEqual(result.get("url"), "http://Blog.Myfavesite.GeoCities.com/Posts?Page=1#Bottom") self.assertEqual(result.get("url_lc"), "http://blog.myfavesite.geocities.com/posts?page=1#bottom") def test_create_page_context_applookout(self): address = Address(url="https://stage.applookout.net/") result = create_page_context(address) self.assertTrue(isinstance(result, PageContext)) self.assertEqual(result.get("domain"), "applookout") self.assertEqual(result.get("domain_lc"), "applookout") self.assertEqual(result.get("fragment"), "") self.assertEqual(result.get("fragment_lc"), "") self.assertEqual(result.get("path"), "/") self.assertEqual(result.get("path_lc"), "/") self.assertEqual(result.get("query"), "") self.assertEqual(result.get("query_lc"), "") self.assertEqual(result.get("subdomain"), "stage") self.assertEqual(result.get("subdomain_lc"), "stage") self.assertEqual(result.get("topLevelDomain"), "net") self.assertEqual(result.get("topLevelDomain_lc"), "net") self.assertEqual(result.get("url"), "https://stage.applookout.net/") self.assertEqual(result.get("url_lc"), "https://stage.applookout.net/") def test_create_referring_context_url_empty_string(self): address = Address(referring_url=EMPTY_STRING) result = create_referring_context(address) self.assertTrue(isinstance(result, PageContext)) for attribute in result.__dict__.values(): self.assertEqual(attribute, EMPTY_STRING) def test_create_referring_context_non_empty_url(self): address = Address(referring_url=TEST_URL) result = create_referring_context(address) self.assertTrue(isinstance(result, PageContext)) self.assertEqual(result.get("domain"), "geocities") self.assertEqual(result.get("domain_lc"), "geocities") self.assertEqual(result.get("fragment"), "Bottom") self.assertEqual(result.get("fragment_lc"), "bottom") self.assertEqual(result.get("path"), "/Posts") self.assertEqual(result.get("path_lc"), "/posts") self.assertEqual(result.get("query"), "Page=1") self.assertEqual(result.get("query_lc"), "page=1") self.assertEqual(result.get("subdomain"), "blog.myfavesite") self.assertEqual(result.get("subdomain_lc"), "blog.myfavesite") self.assertEqual(result.get("topLevelDomain"), "com") self.assertEqual(result.get("topLevelDomain_lc"), "com") self.assertEqual(result.get("url"), "http://Blog.Myfavesite.GeoCities.com/Posts?Page=1#Bottom") self.assertEqual(result.get("url_lc"), "http://blog.myfavesite.geocities.com/posts?page=1#bottom") def test_create_mbox_context(self): params = { "a": "FirstParam", "b": "SecondOne", "c": "third" } mbox = MboxRequest(parameters=params) result = create_mbox_context(mbox) self.assertEqual(result.get("a"), "FirstParam") self.assertEqual(result.get("b"), "SecondOne") self.assertEqual(result.get("c"), "third") self.assertEqual(result.get("a_lc"), "firstparam") self.assertEqual(result.get("b_lc"), "secondone") self.assertEqual(result.get("c_lc"), "third") def test_create_geo_context_no_geo(self): result = create_geo_context(None) for val in result.__dict__.values(): self.assertEqual(val, None) def test_create_geo_context(self): geo = Geo(country_code="US", state_code="CA", city="San Francisco", latitude=38.8, longitude=-77.0 ) result = create_geo_context(geo) self.assertTrue(isinstance(result, GeoContext)) self.assertEqual(result.get("country"), "US") self.assertEqual(result.get("region"), "CA") self.assertEqual(result.get("city"), "San Francisco") self.assertEqual(result.get("latitude"), 38.8) self.assertEqual(result.get("longitude"), -77.0) def test_create_timing_context(self): request_context = Context(ChannelType.WEB) request = DeliveryRequest(context=request_context) result = create_decisioning_context(request) self.assertTrue(result.get("current_day") > 0) self.assertTrue(result.get("current_day") < 8) self.assertEqual(len(result.get("current_time")), 4) self.assertTrue(result.get("current_timestamp") > 0) def test_create_decisioning_context_generate_blank_context(self): request_context = Context(ChannelType.WEB) request = DeliveryRequest(context=request_context) result = create_decisioning_context(request) self.assertTrue(isinstance(result, DecisioningContext)) # timing self.assertIsNotNone(result.get("current_time")) self.assertIsNotNone(result.get("current_timestamp")) self.assertIsNotNone(result.get("current_day")) # geo self.assertIsNone(result.get("geo").get("latitude")) self.assertIsNone(result.get("geo").get("longitude")) self.assertIsNone(result.get("geo").get("country")) self.assertIsNone(result.get("geo").get("region")) self.assertIsNone(result.get("geo").get("city")) # page self.assertEqual(result.get("page").get("domain"), "") self.assertEqual(result.get("page").get("domain_lc"), "") self.assertEqual(result.get("page").get("fragment"), "") self.assertEqual(result.get("page").get("fragment_lc"), "") self.assertEqual(result.get("page").get("path"), "") self.assertEqual(result.get("page").get("path_lc"), "") self.assertEqual(result.get("page").get("query"), "") self.assertEqual(result.get("page").get("query_lc"), "") self.assertEqual(result.get("page").get("subdomain"), "") self.assertEqual(result.get("page").get("subdomain_lc"), "") self.assertEqual(result.get("page").get("topLevelDomain"), "") self.assertEqual(result.get("page").get("topLevelDomain_lc"), "") self.assertEqual(result.get("page").get("url"), "") self.assertEqual(result.get("page").get("url_lc"), "") # referring self.assertEqual(result.get("referring").get("domain"), "") self.assertEqual(result.get("referring").get("domain_lc"), "") self.assertEqual(result.get("referring").get("fragment"), "") self.assertEqual(result.get("referring").get("fragment_lc"), "") self.assertEqual(result.get("referring").get("path"), "") self.assertEqual(result.get("referring").get("path_lc"), "") self.assertEqual(result.get("referring").get("query"), "") self.assertEqual(result.get("referring").get("query_lc"), "") self.assertEqual(result.get("referring").get("subdomain"), "") self.assertEqual(result.get("referring").get("subdomain_lc"), "") self.assertEqual(result.get("referring").get("topLevelDomain"), "") self.assertEqual(result.get("referring").get("topLevelDomain_lc"), "") self.assertEqual(result.get("referring").get("url"), "") self.assertEqual(result.get("referring").get("url_lc"), "") # user self.assertEqual(result.get("user").get("browserType"), "unknown") self.assertEqual(result.get("user").get("platform"), "Unknown") self.assertEqual(result.get("user").get("locale"), "en") self.assertEqual(result.get("user").get("browserVersion"), -1) def validate_object_values(self, obj): """Verify truthiness for all values in the obj""" for val in obj.__dict__.values(): self.assertTrue(val) def test_create_decisioning_context(self): geo = Geo(country_code="US", state_code="CA", city="San Francisco", latitude=38.8, longitude=-77.0 ) address = Address(url=TEST_URL, referring_url=TEST_URL) request_context = Context(channel=ChannelType.WEB, user_agent=FIREFOX_USER_AGENT, address=address, geo=geo) request = DeliveryRequest(context=request_context) result = create_decisioning_context(request) self.assertTrue(isinstance(result, DecisioningContext)) self.assertIsNotNone(result.get("current_time")) self.assertIsNotNone(result.get("current_timestamp")) self.assertIsNotNone(result.get("current_day")) self.validate_object_values(result.get("geo")) self.validate_object_values(result.get("user")) self.validate_object_values(result.get("page")) self.validate_object_values(result.get("referring"))
49.825397
115
0.679675
1,454
12,556
5.708391
0.134801
0.118193
0.225181
0.257349
0.798193
0.709036
0.613253
0.421928
0.387711
0.358313
0
0.006184
0.175773
12,556
251
116
50.023904
0.795826
0.057821
0
0.334975
0
0.004926
0.166003
0
0
0
0
0
0.576355
1
0.064039
false
0
0.083744
0
0.152709
0
0
0
0
null
0
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
b1cf31bf747471020ea115b247936834df6b1aa9
136
py
Python
django_makesuperuser/apps.py
looking-for-a-job/django-makesuperuser.py
7bb6e3599f3c8ee9462ea45b6a81c6941376207c
[ "Unlicense" ]
null
null
null
django_makesuperuser/apps.py
looking-for-a-job/django-makesuperuser.py
7bb6e3599f3c8ee9462ea45b6a81c6941376207c
[ "Unlicense" ]
null
null
null
django_makesuperuser/apps.py
looking-for-a-job/django-makesuperuser.py
7bb6e3599f3c8ee9462ea45b6a81c6941376207c
[ "Unlicense" ]
null
null
null
#!/usr/bin/env python from django.apps import AppConfig class DjangoMakeSuperUserConfig(AppConfig): name = 'django_makesuperuser'
19.428571
43
0.786765
15
136
7.066667
0.866667
0
0
0
0
0
0
0
0
0
0
0
0.125
136
6
44
22.666667
0.890756
0.147059
0
0
0
0
0.173913
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
b1d7baba865b93718c6cb6f18a0c4d9bfc5c5e1c
545
py
Python
pyfeedbacker/stages/isgood.py
mporcheron/pyfeedbacker
c6ddd03cd35dfc1761383914004a0c763bfa0852
[ "MIT" ]
1
2022-03-31T13:19:33.000Z
2022-03-31T13:19:33.000Z
pyfeedbacker/stages/isgood.py
mporcheron/pyfeedbacker
c6ddd03cd35dfc1761383914004a0c763bfa0852
[ "MIT" ]
null
null
null
pyfeedbacker/stages/isgood.py
mporcheron/pyfeedbacker
c6ddd03cd35dfc1761383914004a0c763bfa0852
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from pyfeedbacker.app import stage class StageIsgood(stage.HandlerForm): pass # This is a dynamic stage that is handled entirely by the configuration # and the UI (i.e., the configuration specifies the form options and the # UI draws that). # The stage handler (HandlerForm) auto generates the appropriate outcomes # and information for the UI from the configuration, passing an OutputForm # object to the view. This uses an adapter (AdapterForm) to convert this # into UI elements.
32.058824
78
0.719266
76
545
5.157895
0.644737
0.122449
0.040816
0
0
0
0
0
0
0
0
0.002347
0.218349
545
17
79
32.058824
0.91784
0.755963
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.333333
0.333333
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
1
0
0
4
59246e73294c8152402339004bd8794e70b45aad
8,509
py
Python
oxe-api/test/resource/network/test_import_taxonomy.py
CybersecurityLuxembourg/openxeco
8d4e5578bde6a07f5d6d569b16b4de224abf7bf0
[ "BSD-2-Clause" ]
null
null
null
oxe-api/test/resource/network/test_import_taxonomy.py
CybersecurityLuxembourg/openxeco
8d4e5578bde6a07f5d6d569b16b4de224abf7bf0
[ "BSD-2-Clause" ]
null
null
null
oxe-api/test/resource/network/test_import_taxonomy.py
CybersecurityLuxembourg/openxeco
8d4e5578bde6a07f5d6d569b16b4de224abf7bf0
[ "BSD-2-Clause" ]
null
null
null
from test.BaseCase import BaseCase from utils.serializer import Serializer from unittest.mock import patch import json class TestImportTaxonomy(BaseCase): @BaseCase.login @BaseCase.grant_access("/network/import_taxonomy") @patch('resource.network.import_taxonomy.request.get_request') def test_ok(self, mock_get_request, token): mock_get_request.return_value = json.dumps({ "categories": [ {"name": "CAT", "active_on_articles": True} ], "values": [ {"id": 1, "category": "CAT", "name": "VAL"} ], "category_hierarchy": [], "value_hierarchy": [] }) self.db.insert({"id": 4, "api_endpoint": "https://random.url/feed"}, self.db.tables["NetworkNode"]) self.db.insert({"name": "OTHER CAT"}, self.db.tables["TaxonomyCategory"]) payload = { "network_node_id": 4, "taxonomy_category": "CAT", } response = self.application.post('/network/import_taxonomy', headers=self.get_standard_post_header(token), json=payload) categories = self.db.get(self.db.tables["TaxonomyCategory"]) values = self.db.get(self.db.tables["TaxonomyValue"]) self.assertEqual(200, response.status_code) self.assertEqual(len(categories), 2) self.assertEqual(len(values), 1) self.assertEqual( Serializer.serialize(categories[0], self.db.tables["TaxonomyCategory"]), { 'accepted_article_types': None, 'active_on_articles': 1, 'active_on_companies': 0, 'is_standard': 0, 'name': 'CAT', 'sync_global': 0, 'sync_hierarchy': 0, 'sync_node': 4, 'sync_status': 'OK', 'sync_values': 0 } ) @BaseCase.login @BaseCase.grant_access("/network/import_taxonomy") @patch('resource.network.import_taxonomy.request.get_request') def test_ok_with_param_and_hierarchy(self, mock_get_request, token): mock_get_request.return_value = json.dumps({ "categories": [ {"name": "CAT", "active_on_articles": True, "active_on_companies": True, "is_standard": True, "accepted_article_types": "JOB"}, {"name": "PARENT CAT", "active_on_articles": True, "active_on_companies": True, "is_standard": True, "accepted_article_types": "JOB"} ], "values": [ {"id": 1, "category": "CAT", "name": "VAL"}, {"id": 2, "category": "PARENT CAT", "name": "VAL2"} ], "category_hierarchy": [ {"parent_category": "PARENT CAT", "child_category": "CAT"} ], "value_hierarchy": [ {"parent_value": 2, "child_value": 1} ] }) self.db.insert({"id": 4, "api_endpoint": "https://random.url/feed"}, self.db.tables["NetworkNode"]) payload = { "network_node_id": 4, "taxonomy_category": "CAT", "sync_global": True, "sync_values": True, "sync_hierarchy": True, } response = self.application.post('/network/import_taxonomy', headers=self.get_standard_post_header(token), json=payload) categories = self.db.get(self.db.tables["TaxonomyCategory"]) values = self.db.get(self.db.tables["TaxonomyValue"]) category_hierarchy = self.db.get(self.db.tables["TaxonomyCategoryHierarchy"]) value_hierarchy = self.db.get(self.db.tables["TaxonomyValueHierarchy"]) self.assertEqual(200, response.status_code) self.assertEqual(len(categories), 2) self.assertEqual(len(values), 2) self.assertEqual(len(category_hierarchy), 1) self.assertEqual(len(value_hierarchy), 1) self.assertEqual( Serializer.serialize(categories, self.db.tables["TaxonomyCategory"]), [ { 'accepted_article_types': "JOB", 'active_on_articles': 1, 'active_on_companies': 1, 'is_standard': 1, 'name': 'CAT', 'sync_global': 1, 'sync_hierarchy': 1, 'sync_node': 4, 'sync_status': 'OK', 'sync_values': 1 }, { 'accepted_article_types': "JOB", 'active_on_articles': 1, 'active_on_companies': 1, 'is_standard': 1, 'name': 'PARENT CAT', 'sync_global': 1, 'sync_hierarchy': 1, 'sync_node': 4, 'sync_status': 'OK', 'sync_values': 1 } ] ) self.assertEqual( Serializer.serialize(category_hierarchy, self.db.tables["TaxonomyCategoryHierarchy"]), [{"parent_category": "PARENT CAT", "child_category": "CAT"}] ) self.assertEqual( Serializer.serialize(value_hierarchy, self.db.tables["TaxonomyValueHierarchy"]), [{"parent_value": 2, "child_value": 1}] ) @BaseCase.login @BaseCase.grant_access("/network/import_taxonomy") def test_ko_category_already_existing(self, token): self.db.insert({"name": "CAT"}, self.db.tables["TaxonomyCategory"]) payload = { "network_node_id": 4, "taxonomy_category": "CAT", } response = self.application.post('/network/import_taxonomy', headers=self.get_standard_post_header(token), json=payload) self.assertEqual( "422 Object already existing : Taxonomy category with this name", response.status ) @BaseCase.login @BaseCase.grant_access("/network/import_taxonomy") def test_ko_node_not_found(self, token): self.db.insert({"id": 5, "api_endpoint": "https://random.url/feed"}, self.db.tables["NetworkNode"]) payload = { "network_node_id": 4, "taxonomy_category": "CAT", } response = self.application.post('/network/import_taxonomy', headers=self.get_standard_post_header(token), json=payload) self.assertEqual( "422 Object not found : Network node", response.status ) @BaseCase.login @BaseCase.grant_access("/network/import_taxonomy") @patch('resource.network.import_taxonomy.request.get_request') def test_ko_remote_category_not_found(self, mock_get_request, token): mock_get_request.return_value = json.dumps({ "categories": [], "values": [], "category_hierarchy": [], "value_hierarchy": [] }) self.db.insert({"id": 4, "api_endpoint": "https://random.url/feed"}, self.db.tables["NetworkNode"]) payload = { "network_node_id": 4, "taxonomy_category": "CAT", } response = self.application.post('/network/import_taxonomy', headers=self.get_standard_post_header(token), json=payload) self.assertEqual( "422 Object not found : Taxonomy category on target node", response.status ) @BaseCase.login @BaseCase.grant_access("/network/import_taxonomy") def test_ko_error_request(self, token): self.db.insert({"id": 4, "api_endpoint": "https://random.url/feed"}, self.db.tables["NetworkNode"]) payload = { "network_node_id": 4, "taxonomy_category": "CAT", } response = self.application.post('/network/import_taxonomy', headers=self.get_standard_post_header(token), json=payload) self.assertEqual( "500 Error while fetching the network node taxonomy", response.status )
37.650442
116
0.529557
797
8,509
5.429109
0.129235
0.041599
0.047146
0.036053
0.809799
0.804946
0.758262
0.688468
0.681303
0.681303
0
0.011653
0.344459
8,509
225
117
37.817778
0.764073
0
0
0.603093
0
0
0.273005
0.076155
0
0
0
0
0.082474
1
0.030928
false
0
0.103093
0
0.139175
0
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
593e4b5d6dc2682f530087a2c99473fb943a3042
159
py
Python
tests/test_models.py
GamzeUnlu95/message_ix
ccf80600991362874424b786e10a688d8d24ca74
[ "Apache-2.0", "CC-BY-4.0" ]
null
null
null
tests/test_models.py
GamzeUnlu95/message_ix
ccf80600991362874424b786e10a688d8d24ca74
[ "Apache-2.0", "CC-BY-4.0" ]
null
null
null
tests/test_models.py
GamzeUnlu95/message_ix
ccf80600991362874424b786e10a688d8d24ca74
[ "Apache-2.0", "CC-BY-4.0" ]
null
null
null
from message_ix.models import gams_release def test_gams_release(): result = gams_release().split('.') assert len(result) == 3 and result[0] >= '24'
22.714286
49
0.685535
23
159
4.521739
0.73913
0.317308
0
0
0
0
0
0
0
0
0
0.030303
0.169811
159
6
50
26.5
0.757576
0
0
0
0
0
0.018868
0
0
0
0
0
0.25
1
0.25
false
0
0.25
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
1
0
0
0
0
0
0
0
4
594bcc588ccfa4a5604493003fd6e4ff14f128fa
56
py
Python
screen2.py
Nkromin/screenFIlter
599a886a293cb7f57ba2d5b7448ed24c0f4d99b2
[ "Apache-2.0" ]
null
null
null
screen2.py
Nkromin/screenFIlter
599a886a293cb7f57ba2d5b7448ed24c0f4d99b2
[ "Apache-2.0" ]
null
null
null
screen2.py
Nkromin/screenFIlter
599a886a293cb7f57ba2d5b7448ed24c0f4d99b2
[ "Apache-2.0" ]
null
null
null
from mss import mss with mss() as sct: sct.shot()
6.222222
19
0.625
10
56
3.5
0.7
0
0
0
0
0
0
0
0
0
0
0
0.267857
56
8
20
7
0.853659
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
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
0
0
0
4
3cc6e3113a24a1a0ff66b427c0d7d31a7a367ec6
434
py
Python
mandaw/__init__.py
TheKralGameOfficial/MandawEngine
6fe7fe0a2a6ababfe05d9dcb065ea24d062f82c9
[ "MIT" ]
null
null
null
mandaw/__init__.py
TheKralGameOfficial/MandawEngine
6fe7fe0a2a6ababfe05d9dcb065ea24d062f82c9
[ "MIT" ]
null
null
null
mandaw/__init__.py
TheKralGameOfficial/MandawEngine
6fe7fe0a2a6ababfe05d9dcb065ea24d062f82c9
[ "MIT" ]
null
null
null
import os os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide" from mandaw.main import Mandaw from mandaw.gameobject import GameObject from mandaw.line import Line from mandaw.color import Color from mandaw.sprite import Sprite from mandaw.text import Text from mandaw.input import Controls from mandaw.audio import Audio from mandaw.animation import Animation from mandaw.light import Light from mandaw.particle import ParticleSpawner
28.933333
49
0.841014
64
434
5.65625
0.34375
0.303867
0
0
0
0
0
0
0
0
0
0
0.115207
434
14
50
31
0.942708
0
0
0
0
0
0.069124
0.059908
0
0
0
0
0
1
0
true
0
0.923077
0
0.923077
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
3ce6a231e16fd003f4ee50810216496d28d083ed
285
py
Python
examples/flask-sample/settings.py
Laneglos/error-tracker
b07366e94199fc5157ddc5623fa12c8c0d07c483
[ "BSD-3-Clause" ]
16
2019-12-17T10:57:43.000Z
2022-01-30T13:03:53.000Z
examples/flask-sample/settings.py
Laneglos/error-tracker
b07366e94199fc5157ddc5623fa12c8c0d07c483
[ "BSD-3-Clause" ]
15
2020-01-08T12:08:32.000Z
2022-01-28T13:16:48.000Z
examples/flask-sample/settings.py
Laneglos/error-tracker
b07366e94199fc5157ddc5623fa12c8c0d07c483
[ "BSD-3-Clause" ]
8
2020-01-08T14:10:14.000Z
2021-01-31T22:26:07.000Z
APP_ERROR_SEND_NOTIFICATION = True APP_ERROR_RECIPIENT_EMAIL = ('dev@example.com',) APP_ERROR_EMAIL_SENDER = "server@example.com" APP_ERROR_SUBJECT_PREFIX = "" APP_ERROR_MASK_WITH = "**************" APP_ERROR_MASKED_KEY_HAS = ("password", "secret") APP_ERROR_URL_PREFIX = "/dev/error"
35.625
49
0.757895
40
285
4.85
0.55
0.28866
0.134021
0.185567
0
0
0
0
0
0
0
0
0.077193
285
7
50
40.714286
0.737643
0
0
0
0
0
0.249123
0
0
0
0
0
0
1
0
false
0.142857
0
0
0
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
1
0
0
0
0
0
4
3ce9e206cc202aa1a9ecc17cd824023b3e41fc6e
1,519
py
Python
test/test_parse_midi.py
ethan-leba/transcriboid-backend
2b146bb71d8512c15d4f90c6aeab336345a4eb49
[ "MIT" ]
null
null
null
test/test_parse_midi.py
ethan-leba/transcriboid-backend
2b146bb71d8512c15d4f90c6aeab336345a4eb49
[ "MIT" ]
null
null
null
test/test_parse_midi.py
ethan-leba/transcriboid-backend
2b146bb71d8512c15d4f90c6aeab336345a4eb49
[ "MIT" ]
null
null
null
import unittest from src import parse_midi class TestParseMidi(unittest.TestCase): def test_relative_note(self): self.assertEqual(parse_midi.relative_note(72, "C"), 72) self.assertEqual(parse_midi.relative_note(69, "A"), 72) self.assertEqual(parse_midi.relative_note(71, "B"), 72) self.assertEqual(parse_midi.relative_note(74, "D"), 72) def test_valid_note(self): self.assertTrue(parse_midi.valid_note(69, "A")) self.assertTrue(parse_midi.valid_note(73, "A")) self.assertTrue(parse_midi.valid_note(74, "A")) self.assertTrue(parse_midi.valid_note(72, "C")) self.assertTrue(parse_midi.valid_note(84, "C")) self.assertTrue(parse_midi.valid_note(86, "C")) self.assertFalse(parse_midi.valid_note(72, "A")) def test_transpose(self): self.assertEqual(parse_midi.transpose(-13), -1) self.assertEqual(parse_midi.transpose(240), 12) self.assertEqual(parse_midi.transpose(-240), -12) self.assertEqual(parse_midi.transpose(23), 11) self.assertEqual(parse_midi.transpose(-3), -3) def test_scale_degree(self): self.assertEqual(parse_midi.scale_degree(72, "C"), 0) self.assertEqual(parse_midi.scale_degree(74, "C"), 1) self.assertEqual(parse_midi.scale_degree(71, "C"), -1) self.assertEqual(parse_midi.scale_degree(85, "A"), 2) self.assertEqual(parse_midi.scale_degree(61, "A"), -5) self.assertEqual(parse_midi.scale_degree(93, "E"), 3)
43.4
63
0.678078
211
1,519
4.658768
0.218009
0.21058
0.305188
0.366226
0.784334
0.681587
0.46999
0.186165
0.110885
0.110885
0
0.053514
0.175774
1,519
34
64
44.676471
0.731629
0
0
0
0
0
0.011192
0
0
0
0
0
0.758621
1
0.137931
false
0
0.068966
0
0.241379
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
a7081d9a0df4f92aaa694ecb618533cf636bff29
362
py
Python
src/003-largest-prime-factor/python/test/test_solver.py
xfbs/ProjectEulerRust
e26768c56ff87b029cb2a02f56dc5cd32e1f7c87
[ "MIT" ]
1
2018-01-26T21:18:12.000Z
2018-01-26T21:18:12.000Z
src/003-largest-prime-factor/python/test/test_solver.py
xfbs/ProjectEulerRust
e26768c56ff87b029cb2a02f56dc5cd32e1f7c87
[ "MIT" ]
3
2017-12-09T14:49:30.000Z
2017-12-09T14:59:39.000Z
src/003-largest-prime-factor/python/test/test_solver.py
xfbs/ProjectEulerRust
e26768c56ff87b029cb2a02f56dc5cd32e1f7c87
[ "MIT" ]
null
null
null
import unittest import solver class TestSolution(unittest.TestCase): def test_solve(self): self.assertEqual(solver.solve(10), 5) self.assertEqual(solver.solve(15), 5) self.assertEqual(solver.solve(20), 5) self.assertEqual(solver.solve(9), 3) self.assertEqual(solver.solve(91), 13) self.assertEqual(solver.solve(323), 19)
27.846154
45
0.696133
48
362
5.229167
0.4375
0.358566
0.501992
0.621514
0.322709
0
0
0
0
0
0
0.066445
0.168508
362
12
46
30.166667
0.767442
0
0
0
0
0
0
0
0
0
0
0
0.6
1
0.1
false
0
0.2
0
0.4
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
59704e4704525f0b977036d3842dfa217ad2c4be
95
py
Python
course_contents/exercice_templates/project_archi_template/project_archi_template/server/views.py
maganoegi/python_course_autumn_2021
0b297040f4e1eba654f125ee60ac4fa8e06b093b
[ "MIT" ]
null
null
null
course_contents/exercice_templates/project_archi_template/project_archi_template/server/views.py
maganoegi/python_course_autumn_2021
0b297040f4e1eba654f125ee60ac4fa8e06b093b
[ "MIT" ]
null
null
null
course_contents/exercice_templates/project_archi_template/project_archi_template/server/views.py
maganoegi/python_course_autumn_2021
0b297040f4e1eba654f125ee60ac4fa8e06b093b
[ "MIT" ]
1
2021-12-07T07:15:19.000Z
2021-12-07T07:15:19.000Z
from server import app @app.route("/") def home(): print("success") return "success"
11.875
22
0.621053
12
95
4.916667
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.210526
95
8
23
11.875
0.786667
0
0
0
0
0
0.159574
0
0
0
0
0
0
1
0.2
true
0
0.2
0
0.6
0.2
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
0
0
1
0
0
4
59a59891019c4bd83e013c00395f8b2e3723ff36
62
py
Python
test_qualify_local/resources/rds/__init__.py
praveern/AWS_boto3
ebceef58ae345bbbf59ebc90cf672550dbd921c6
[ "MIT" ]
null
null
null
test_qualify_local/resources/rds/__init__.py
praveern/AWS_boto3
ebceef58ae345bbbf59ebc90cf672550dbd921c6
[ "MIT" ]
null
null
null
test_qualify_local/resources/rds/__init__.py
praveern/AWS_boto3
ebceef58ae345bbbf59ebc90cf672550dbd921c6
[ "MIT" ]
null
null
null
from test_qualify_local.resources.rds.resource import DemoRDS
31
61
0.887097
9
62
5.888889
1
0
0
0
0
0
0
0
0
0
0
0
0.064516
62
1
62
62
0.913793
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
0
0
0
4
59ad9e9b8e8a2981b39872bd9779374581f65554
169
py
Python
hello.py
TokyoPython/tpsc1
c5ef6a38d073e0bd6377b97b6db881808277db3d
[ "Apache-2.0" ]
null
null
null
hello.py
TokyoPython/tpsc1
c5ef6a38d073e0bd6377b97b6db881808277db3d
[ "Apache-2.0" ]
null
null
null
hello.py
TokyoPython/tpsc1
c5ef6a38d073e0bd6377b97b6db881808277db3d
[ "Apache-2.0" ]
null
null
null
def hello(name): return 'Hello, {}.'.format(name) def test_hello(): assert 'Hello, Fred.' == hello('Fred') if __name__ == '__main__': print(hello('Taro'))
18.777778
42
0.60355
21
169
4.428571
0.571429
0.193548
0
0
0
0
0
0
0
0
0
0
0.183432
169
8
43
21.125
0.673913
0
0
0
0
0
0.224852
0
0
0
0
0
0.166667
1
0.333333
false
0
0
0.166667
0.5
0.166667
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
0
0
0
4
59af78ba0eced520c5525bb49501d8891e05bd79
242
py
Python
locadora/api/admin.py
veryjoh/car_api
b2d1f42e47acabf56fe16b6d3c2d612f77ac255c
[ "MIT" ]
null
null
null
locadora/api/admin.py
veryjoh/car_api
b2d1f42e47acabf56fe16b6d3c2d612f77ac255c
[ "MIT" ]
null
null
null
locadora/api/admin.py
veryjoh/car_api
b2d1f42e47acabf56fe16b6d3c2d612f77ac255c
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import CarModel, Car # Register your models here. class CarAdmin(admin.ModelAdmin): search_fields = ["color", "model__name"] admin.site.register(CarModel) admin.site.register(Car, CarAdmin)
24.2
44
0.772727
32
242
5.75
0.625
0.097826
0.184783
0
0
0
0
0
0
0
0
0
0.119835
242
9
45
26.888889
0.86385
0.107438
0
0
0
0
0.074766
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.666667
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
0
0
1
0
1
0
0
4
59b5ef827f204f6f54a776a361d995945e7ac4c3
62
py
Python
src/pyjen/utils/__init__.py
TheFriendlyCoder/pyjen
a3d7e8f69cb53f80f627300f8d3aa0d4302a5ac1
[ "Apache-2.0" ]
5
2017-12-14T13:39:04.000Z
2020-07-06T09:46:02.000Z
src/pyjen/utils/__init__.py
TheFriendlyCoder/pyjen
a3d7e8f69cb53f80f627300f8d3aa0d4302a5ac1
[ "Apache-2.0" ]
119
2016-09-13T01:39:31.000Z
2020-08-31T03:06:19.000Z
src/pyjen/utils/__init__.py
TheFriendlyCoder/pyjen
a3d7e8f69cb53f80f627300f8d3aa0d4302a5ac1
[ "Apache-2.0" ]
3
2015-03-17T18:49:22.000Z
2019-07-03T14:10:27.000Z
"""Sub-package for common utilities used by the PyJen APIs"""
31
61
0.741935
10
62
4.6
1
0
0
0
0
0
0
0
0
0
0
0
0.145161
62
1
62
62
0.867925
0.887097
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
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
59bf435dac294a2573f339fa8f0e9ad9346885ec
163
py
Python
tests/test_cli.py
amzyang/kafka-shell
1ffcfcf07d46a401d338b64b612e5b32cdffb257
[ "Apache-2.0" ]
109
2019-03-20T02:05:55.000Z
2022-01-21T07:52:31.000Z
tests/test_cli.py
amzyang/kafka-shell
1ffcfcf07d46a401d338b64b612e5b32cdffb257
[ "Apache-2.0" ]
20
2019-03-20T02:13:43.000Z
2020-09-19T04:10:46.000Z
tests/test_cli.py
amzyang/kafka-shell
1ffcfcf07d46a401d338b64b612e5b32cdffb257
[ "Apache-2.0" ]
11
2019-04-26T09:28:29.000Z
2021-12-04T14:54:11.000Z
# import pexpect # # # def test_run_cli(): # child = pexpect.spawn('python ./kafkashell/main.py', [], 5) # child.expect("> ") # child.sendline('exit')
20.375
65
0.588957
19
163
4.947368
0.842105
0
0
0
0
0
0
0
0
0
0
0.007634
0.196319
163
7
66
23.285714
0.709924
0.907975
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
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
59cc8e9462e4240a002289416867621e35c2337a
164
py
Python
settings.py
hishamkaram/data_manager
c3430cb7132b67ef2e8635df7f70334167a78f0e
[ "MIT" ]
null
null
null
settings.py
hishamkaram/data_manager
c3430cb7132b67ef2e8635df7f70334167a78f0e
[ "MIT" ]
5
2020-07-16T18:54:21.000Z
2022-03-15T19:07:22.000Z
settings.py
hishamkaram/data_manager
c3430cb7132b67ef2e8635df7f70334167a78f0e
[ "MIT" ]
1
2020-11-13T14:13:13.000Z
2020-11-13T14:13:13.000Z
# -*- coding: utf-8 -*- INSTALLED_APPS += ("ags2sld",) DATA_UPLOAD_MAX_MEMORY_SIZE = 1073741824 FILE_UPLOAD_MAX_MEMORY_SIZE = 1073741824 # maximum file upload 1GB
32.8
67
0.762195
22
164
5.272727
0.681818
0.155172
0.258621
0.327586
0.5
0
0
0
0
0
0
0.159722
0.121951
164
4
68
41
0.645833
0.27439
0
0
0
0
0.060345
0
0
0
0
0
0
1
0
false
0
0
0
0
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
0
0
0
0
0
0
0
0
0
4
59d80147dbe219cb6f0568f848247d7b6acbf526
389
py
Python
stdlib/xml/validate/test_schema_validation.py
bpuderer/python-snippets27
8d51ff34c48bee1247575536d8ed506eafde8631
[ "MIT" ]
3
2015-11-20T14:30:53.000Z
2015-12-19T05:55:19.000Z
stdlib/xml/validate/test_schema_validation.py
bpuderer/python-snippets27
8d51ff34c48bee1247575536d8ed506eafde8631
[ "MIT" ]
null
null
null
stdlib/xml/validate/test_schema_validation.py
bpuderer/python-snippets27
8d51ff34c48bee1247575536d8ed506eafde8631
[ "MIT" ]
1
2016-01-05T20:54:49.000Z
2016-01-05T20:54:49.000Z
import unittest from xml_utils import validate_schema_from_files class SchemaValidationTestCase(unittest.TestCase): def test_schema_valid(self): validate_schema_from_files('./example.xsd', './valid_example.xml') def test_schema_invalid(self): validate_schema_from_files('./example.xsd', './invalid_example.xml') if __name__ == '__main__': unittest.main()
24.3125
76
0.745501
47
389
5.659574
0.446809
0.157895
0.203008
0.259399
0.278195
0.278195
0.278195
0
0
0
0
0
0.141388
389
15
77
25.933333
0.796407
0
0
0
0
0
0.190231
0.053985
0
0
0
0
0
1
0.222222
false
0
0.222222
0
0.555556
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
0
1
0
0
4
59dde12e1f17a74a3e88295e265b8f8ff65f3c28
43
py
Python
ddddsr/__init__.py
ashawkey/ddddsr
4c31d9bd8ef817d89ef0f9b4e9469556fffcbbf3
[ "Apache-2.0" ]
1
2022-01-29T10:56:56.000Z
2022-01-29T10:56:56.000Z
ddddsr/__init__.py
ashawkey/ddddsr
4c31d9bd8ef817d89ef0f9b4e9469556fffcbbf3
[ "Apache-2.0" ]
1
2022-02-03T16:54:41.000Z
2022-02-08T06:26:32.000Z
ddddsr/__init__.py
ashawkey/ddddsr
4c31d9bd8ef817d89ef0f9b4e9469556fffcbbf3
[ "Apache-2.0" ]
1
2022-01-29T11:03:42.000Z
2022-01-29T11:03:42.000Z
from .core import SR __version__ = "0.1.5"
14.333333
21
0.697674
8
43
3.25
1
0
0
0
0
0
0
0
0
0
0
0.083333
0.162791
43
3
21
14.333333
0.638889
0
0
0
0
0
0.113636
0
0
0
0
0
0
1
0
false
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
0
0
1
0
0
0
0
4
ab6ee407b81dd86f66740861bc076cedc5bd1028
90
py
Python
bflib/languages/bugbear.py
ChrisLR/BasicDungeonRL
b293d40bd9a0d3b7aec41b5e1d58441165997ff1
[ "MIT" ]
3
2017-10-28T11:28:38.000Z
2018-09-12T09:47:00.000Z
bflib/languages/bugbear.py
ChrisLR/BasicDungeonRL
b293d40bd9a0d3b7aec41b5e1d58441165997ff1
[ "MIT" ]
null
null
null
bflib/languages/bugbear.py
ChrisLR/BasicDungeonRL
b293d40bd9a0d3b7aec41b5e1d58441165997ff1
[ "MIT" ]
null
null
null
from bflib.languages.base import Language class Bugbear(Language): name = "Bugbear"
15
41
0.744444
11
90
6.090909
0.818182
0
0
0
0
0
0
0
0
0
0
0
0.166667
90
5
42
18
0.893333
0
0
0
0
0
0.077778
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
ab7b85b264ed41df1abd65bd05e4962871f91b9b
2,390
py
Python
tests/test_config.py
dbaio/loganom
6e4e116d543d5714eeb145e1f4039d8d80af4b8f
[ "BSD-2-Clause" ]
1
2020-07-17T00:39:34.000Z
2020-07-17T00:39:34.000Z
tests/test_config.py
dbaio/loganom
6e4e116d543d5714eeb145e1f4039d8d80af4b8f
[ "BSD-2-Clause" ]
null
null
null
tests/test_config.py
dbaio/loganom
6e4e116d543d5714eeb145e1f4039d8d80af4b8f
[ "BSD-2-Clause" ]
null
null
null
"""Configuration Tests""" import unittest from collections import OrderedDict import pytest from loganom.config import read_config, Config class TestConfigDefault(unittest.TestCase): """Unittest for config.read_config().""" def setUp(self): """Populate config dictionary.""" # Simulating argparse dictionary self.config = OrderedDict() self.config.name = "tests/data/config-sample.ini" def test_config_read_sample(self): """Test for Read the Sample Config File.""" try: open(self.config.name) except FileNotFoundError: pytest.skip("config file not found") config_obj = read_config(self.config) self.assertIsInstance(config_obj, Config) def test_config_smtp_false(self): """Test for Read the Sample Config File (Smtp Section).""" try: open(self.config.name) except FileNotFoundError: pytest.skip("config file not found") config_obj = read_config(self.config) self.assertFalse(config_obj.smtp.enabled) def test_config_mm_false(self): """Test for Read the Sample Config File (MM Section).""" try: open(self.config.name) except FileNotFoundError: pytest.skip("config file not found") config_obj = read_config(self.config) self.assertFalse(config_obj.mattermost.enabled) class TestConfigTrue(unittest.TestCase): """Unittest for config.read_config() with True values""" def setUp(self): """Populate config dictionary.""" # Simulating argparse dictionary self.config = OrderedDict() self.config.name = "tests/data/config2.ini" def test_config_smtp_true(self): """Test for Read the Sample Config File (Smtp Section).""" try: open(self.config.name) except FileNotFoundError: pytest.skip("config file not found") config_obj = read_config(self.config) self.assertTrue(config_obj.smtp.enabled) def test_config_mm_true(self): """Test for Read the Sample Config File (MM Section).""" try: open(self.config.name) except FileNotFoundError: pytest.skip("config file not found") config_obj = read_config(self.config) self.assertTrue(config_obj.mattermost.enabled)
28.452381
66
0.642259
274
2,390
5.481752
0.186131
0.093209
0.065246
0.049933
0.788948
0.788948
0.788948
0.731691
0.674434
0.66245
0
0.000564
0.257741
2,390
83
67
28.795181
0.84611
0.196653
0
0.617021
0
0
0.082976
0.026767
0
0
0
0
0.106383
1
0.148936
false
0
0.085106
0
0.276596
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
abaf3d290fed5abb6c7b71561040bf1e9b65aa2b
164
py
Python
input/CasePropertiesBase.py
tomrobin-teschner/OpenFOAMCaseGenerator
4d0b2e22a62ea7863de94a38eb3999e0ade475cc
[ "MIT" ]
3
2020-12-23T11:12:12.000Z
2021-05-19T15:18:15.000Z
input/CasePropertiesBase.py
tomrobin-teschner/OpenFOAMCaseGenerator
4d0b2e22a62ea7863de94a38eb3999e0ade475cc
[ "MIT" ]
null
null
null
input/CasePropertiesBase.py
tomrobin-teschner/OpenFOAMCaseGenerator
4d0b2e22a62ea7863de94a38eb3999e0ade475cc
[ "MIT" ]
3
2021-01-18T19:31:13.000Z
2021-06-08T12:28:38.000Z
from abc import ABCMeta, abstractmethod class CasePropertiesBase(metaclass=ABCMeta): @staticmethod @abstractmethod def get_properties(): pass
18.222222
44
0.731707
15
164
7.933333
0.866667
0
0
0
0
0
0
0
0
0
0
0
0.207317
164
8
45
20.5
0.915385
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
true
0.166667
0.166667
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
4
abafe99b13221e1262be963756e83a6c2221f344
2,464
py
Python
stockfighter/validators.py
akshaynanavati/python-stockfighter
85a896c6c306099a407fcda74e32cb256db8bf6e
[ "Apache-2.0" ]
2
2015-12-30T20:21:01.000Z
2016-03-29T21:33:43.000Z
stockfighter/validators.py
akshaynanavati/python-stockfighter
85a896c6c306099a407fcda74e32cb256db8bf6e
[ "Apache-2.0" ]
null
null
null
stockfighter/validators.py
akshaynanavati/python-stockfighter
85a896c6c306099a407fcda74e32cb256db8bf6e
[ "Apache-2.0" ]
null
null
null
from schematics.models import Model from schematics.types import StringType, IntType from schematics.types.base import BooleanType from schematics.types.compound import ListType, ModelType class SFBaseValidator(Model): def __init__(self, raw_data=None, **kwargs): self.json = raw_data super(SFBaseValidator, self).__init__(raw_data=raw_data, **kwargs) # TODO can we abstract away the 'ok' check to the validator? class Symbol(SFBaseValidator): name = StringType(required=True) symbol = StringType(required=True) class Stocks(SFBaseValidator): symbols = ListType(ModelType(Symbol)) class BidOrAsk(SFBaseValidator): price = IntType(required=True) qty = IntType(required=True) isBuy = BooleanType(required=True) class Orderbook(SFBaseValidator): venue = StringType(required=True) symbol = StringType(required=True) bids = ListType(ModelType(BidOrAsk)) asks = ListType(ModelType(BidOrAsk)) ts = StringType(required=True) class Fills(SFBaseValidator): price = IntType(required=True) qty = IntType(required=True) ts = StringType(required=True) class Order(SFBaseValidator): symbol = StringType(required=True) venue = StringType(required=True) direction = StringType(required=True) originalQty = IntType(required=True) qty = IntType(required=True) price = IntType(required=True) type = StringType(required=True) id = IntType(required=True) account = StringType(required=True) ts = StringType(required=True) fills = ListType(ModelType(Fills)) totalFilled = IntType(required=True) open = BooleanType(required=True) def __init__(self, raw_data=None, **kwargs): if isinstance(raw_data, dict) and 'orderType' in raw_data: raw_data['type'] = raw_data['orderType'] super(Order, self).__init__(raw_data=raw_data, **kwargs) class Orders(SFBaseValidator): venue = StringType(required=True) orders = ListType(Order) class Quote(SFBaseValidator): symbol = StringType(required=True) venue = StringType(required=True) bid = IntType(required=True) ask = IntType(required=True) bidSize = IntType(required=True) askSize = IntType(required=True) bidDepth = IntType(required=True) askDepth = IntType(required=True) last = IntType(required=True) lastSize = IntType(required=True) lastTrade = StringType(required=True) quoteTime = StringType(required=True)
30.04878
74
0.719156
277
2,464
6.299639
0.274368
0.247564
0.214327
0.064183
0.384527
0.329513
0.295129
0.150143
0.150143
0
0
0
0.175731
2,464
81
75
30.419753
0.859183
0.023539
0
0.311475
0
0
0.009151
0
0
0
0
0.012346
0
1
0.032787
false
0
0.065574
0
0.918033
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
1
0
0
0
0
0
0
0
1
0
0
4
abc0da8d2e46751b828bb8c3cae9cfcd8fb5ebe5
1,332
py
Python
tests/test_types.py
theno/utlz
bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389
[ "MIT" ]
2
2018-10-29T18:35:12.000Z
2019-01-14T12:56:15.000Z
tests/test_types.py
Bhanditz/utlz
bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389
[ "MIT" ]
null
null
null
tests/test_types.py
Bhanditz/utlz
bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389
[ "MIT" ]
1
2019-01-14T11:11:32.000Z
2019-01-14T11:11:32.000Z
from utlz.types import SimpleEnum, EnumeratedEnum, Enum def test_simple_enum(): states = SimpleEnum(STATE_0=0, STATE_1=1, STATE_2=2, STATE_3=3, STATE_123=123) assert isinstance(states, object) assert str(states) == "<class 'utlz.types.SimpleEnum'>" assert states.STATE_1 == 1 assert states.STATE_2 == 2 assert states.STATE_3 == 3 assert states.STATE_123 == 123 def test_enumerated_enum(): states = EnumeratedEnum('STATE_0', 'STATE_1', 'STATE_2', 'STATE_3', STATE_123=123) assert isinstance(states, object) assert str(states) == "<class 'utlz.types.EnumeratedEnum'>" assert states.STATE_0 == 0 assert states.STATE_1 == 1 assert states.STATE_2 == 2 assert states.STATE_3 == 3 assert states.STATE_123 == 123 def test_named_enum(): states = Enum('STATE_0', 'STATE_1', 'STATE_2', 'STATE_3', STATE_123=123) assert isinstance(states, object) assert str(states) == "<class 'utlz.types.Enum'>" assert states.STATE_0 == 0 assert states.STATE_1 == 1 assert states.STATE_2 == 2 assert states.STATE_3 == 3 assert states.STATE_123 == 123 assert states.reverse == { 0: 'STATE_0', 1: 'STATE_1', 2: 'STATE_2', 3: 'STATE_3', 123: 'STATE_123', }
26.64
76
0.623874
183
1,332
4.322404
0.136612
0.22756
0.300885
0.085967
0.689001
0.689001
0.689001
0.689001
0.689001
0.689001
0
0.088088
0.25
1,332
49
77
27.183673
0.703704
0
0
0.527778
0
0
0.138138
0.039039
0
0
0
0
0.583333
1
0.083333
false
0
0.027778
0
0.111111
0
0
0
0
null
1
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
050da8b3ad18422432b4df551902c64ff89b88c8
11,439
py
Python
apt-webindex.py
charlesfendt/apt-webindex
b47e392984ecf2a8f10bdb9b3f20e6a96321d9db
[ "MIT" ]
null
null
null
apt-webindex.py
charlesfendt/apt-webindex
b47e392984ecf2a8f10bdb9b3f20e6a96321d9db
[ "MIT" ]
null
null
null
apt-webindex.py
charlesfendt/apt-webindex
b47e392984ecf2a8f10bdb9b3f20e6a96321d9db
[ "MIT" ]
null
null
null
#!/usr/bin/python3 # © 2021 Cyril Brulebois <cyril@debamax.com> """ Build an index page for a given APT repository, providing an overview of the available suites, packages, and versions. """ # pylint: disable-msg=C0103 import functools import os import re import time import apt_pkg import dominate from dominate.tags import a, attr, br, h1, h4, span, style, table, td, th, tr, div from dominate.util import text, raw TITLE = 'aptly-webindex' CSS = ''' h1 { text-align: center; color: #a80030; text-decoration: underline; } h4 { text-align: center; font-weight: normal; } table { width: 100%; border: 1px solid #333; border-collapse: collapse; } th { background-color: #a80030; color: #FFF; } th.distribution { background-color: #880020; } td { vertical-align: top; border: 1px solid black; padding: 2px 5px; white-space: nowrap; } td.centered { text-align: center; } td.versions { white-space: normal; } .mono { font-family: monospace; } /* Multi-dist support: try to align columns across tables */ .col1 { width: 15%; } .col2 { width: 10%; } .col3 { width: 5%; } .col4 { width: 70%; } /* Newness indicators, the higher the hotter */ .hot1 { background-color: #555753; } .hot2 { background-color: #d3d7cf; } .hot3 { background-color: #edd400; } .hot4 { background-color: #f57900; } .hot5 { background-color: #cc0000; } ''' def get_time_info(diff): """Return a human representation based of the delta against current time""" if diff > 60 * 24 * 3600: desc = '%d+ months ago' % (diff/(30*24*3600)) color = 'hot1' elif diff > 2 * 24 * 3600: desc = '%d+ days ago' % (diff/(1*24*3600)) color = 'hot2' elif diff > 2 * 3600: desc = '%d+ hours ago' % (diff/(1*3600)) color = 'hot3' elif diff > 2 * 60: desc = '%d+ minutes ago' % (diff/(1*60)) color = 'hot4' else: desc = '%d seconds ago' % diff color = 'hot5' return desc, color def render_dist_html(dist): """Render the HTML table for the specified distribution""" archs = [re.sub(r'^binary-', '', x) for x in os.listdir('dists/%s/main' % dist) if x.startswith('binary')] # Store [source_arch, package, version, actual_arch, filename]: data = [] for arch in archs: with open('dists/%s/main/binary-%s/Packages' % (dist, arch), 'r') as packages_fp: tagfile = apt_pkg.TagFile(packages_fp) for stanza in tagfile: # pylint: disable=invalid-name fp = stanza['Package'] fv = stanza['Version'] fa = stanza['Architecture'] ff = stanza['Filename'] data.append([arch, fp, fv, fa, ff]) now_ts = time.time() packages = sorted(list(set(row[1] for row in data))) for package in packages: versions = sorted(list(set(row[2] for row in data if row[1] == package)), reverse=True, key=functools.cmp_to_key(apt_pkg.version_compare)) # Extract version information: newest_version = versions[0] older_versions = ' | '.join(versions[1:]) # Filter lines matching newest version: newest_items = sorted([row for row in data if row[1] == package and row[2] == newest_version]) # Extract the dirname of one of the Filename fields: pool_dir = re.sub(r'/[^/]+$', '', newest_items[0][4]) # Prepare links to debs: newest_debs = sorted(list(set((row[3], row[4]) for row in newest_items))) # XXX: The following could be surprising if one of the builds # is delayed for whatever reason (e.g. missing build-dep # on a CI worker). # # Get timestamp from the first matching filename: file_ts = os.stat(newest_items[0][4]).st_mtime diff_desc, time_color = get_time_info(now_ts - file_ts) time_desc = time.strftime('%Y-%m-%d %H:%M:%SZ', time.gmtime(file_ts)) tooltip = '%s\n%s' % (diff_desc, time_desc) with tr(): td(a(package, href=pool_dir)) td(newest_version, title=tooltip, _class='centered %s' % time_color) with td(_class='centered'): # XXX: "manual join" for i, row in enumerate(newest_debs): if i != 0: text(' | ') a(row[0], href=row[1]) td(older_versions, _class='versions') if __name__ == '__main__': # XXX: Better CGI vs. CLI detection? if 'REQUEST_METHOD' in os.environ: print('Content-Type: text/html; charset=utf-8\n') # XXX: Maybe call cgitb.enable() # XXX: Maybe error out if that doesn't return anything, or if # dists/<item>/Release is missing dists = sorted(os.listdir('dists')) apt_pkg.init_system() doc = dominate.document(title=TITLE) with doc.head: style(CSS) with doc.body: div(raw('<svg height="48" version="1.1" viewBox="0 0 2048 256" xmlns="http://www.w3.org/2000/svg"><title>APT-Webindex</title><g transform="translate(228)" fill="none" stroke-width="8.0213"><path d="m182.81 125.89a32.085 32.085 0 0 1-16.043 27.787 32.085 32.085 0 0 1-32.085 0 32.085 32.085 0 0 1-16.043-27.787" stroke="#000"/><path d="m182.48 94.125a44.919 44.919 0 0 1 11.626 43.389 44.919 44.919 0 0 1-31.763 31.763 44.919 44.919 0 0 1-43.389-11.626" stroke="#1e010b"/><path d="m150.72 68.134a57.753 57.753 0 0 1 57.753 57.753 57.753 57.753 0 0 1-57.753 57.753" stroke="#3d0217"/><path d="m100.81 75.974a70.587 70.587 0 0 1 68.182-18.269 70.587 70.587 0 0 1 49.913 49.913 70.587 70.587 0 0 1-18.269 68.182" stroke="#5c0423"/><path d="m67.3 256v-130.11a83.421 83.421 0 0 1 83.421-83.421 83.421 83.421 0 0 1 83.421 83.421" stroke="#7a052f"/><path d="m54.466 256v-129.92a96.255 96.255 0 0 1 59.332-89.083 96.255 96.255 0 0 1 104.99 20.829" stroke="#99073b"/><path d="m41.632 256v-130.07a109.09 109.09 0 0 1 31.937-77.165 109.09 109.09 0 0 1 77.153-31.966" stroke="#b80847"/><path d="m28.799 256v-130.57a121.92 121.92 0 0 1 35.71-85.751" stroke="#d70a53"/></g><path d="M74.992 228.88h24.48l20.128-51.408h82.96l20.128 51.408h25.296l-72.352-190.4h-28.016zm51.68-72.896 34.272-91.664 34.544 91.664zM471.33 38.481v21.76h61.744v168.64h23.664v-168.64h61.744v-21.76z" fill="#7a052f"/><path d="M750.3 38.481 l55.488 190.4h28.288l43.248-150.96 43.52 150.96h28.288l55.76-190.4h-24.48l-44.88 159.94-45.152-159.94h-23.936l-46.784 159.94-44.608-159.94zM1018.8 122.26c-5.44 10.88-8.16 23.12-8.16 37.264s2.72 26.384 8.432 37.264 13.872 19.04 24.208 25.024c10.336 5.984 22.304 8.704 36.176 8.704 15.776 0 29.104-4.352 39.984-13.328s17.68-20.672 20.4-34.816h-22.576c-2.448 8.976-7.072 16.048-14.144 20.944s-15.504 7.344-25.296 7.344c-13.056 0-23.392-4.08-31.28-12.24-8.16-8.16-12.24-19.04-12.512-32.64v-1.904h107.71c0.272-4.352 0.544-7.344 0.544-9.52-0.544-13.328-3.536-25.024-8.976-35.088-5.712-9.792-13.328-17.408-23.12-22.848-9.792-5.168-21.216-7.888-33.728-7.888-13.056 0-24.48 2.992-34.272 8.976-10.064 5.984-17.952 14.144-23.392 24.752zm100.37 23.12h-83.776c1.088-10.88 5.44-19.856 13.6-26.928 7.888-6.8 17.136-10.336 27.744-10.336 11.696 0 21.488 3.264 29.104 9.792s12.24 15.776 13.328 27.472zM1272.2 96.961c-10.064-5.44-21.488-8.432-34.272-8.432-20.128 0-36.176 8.16-47.6 23.936v-73.984h-22.304v190.4h19.312l2.992-21.216c4.352 7.072 10.608 12.784 18.768 16.864 7.888 4.08 17.408 5.984 28.832 5.984 12.512 0 23.936-2.992 34.272-8.976 10.064-5.984 17.952-14.144 23.664-25.024 5.712-10.608 8.704-22.848 8.704-36.992 0-14.688-2.992-27.2-8.704-38.08-5.712-10.608-13.6-18.768-23.664-24.48zm-3.264 99.552c-8.432 9.52-19.584 14.144-33.184 14.144-8.976 0-16.864-2.176-23.936-6.528s-12.24-10.336-16.048-18.224-5.712-16.864-5.712-26.928c0-9.792 1.904-18.496 5.712-26.112s8.976-13.6 16.048-17.952 14.96-6.528 23.936-6.528c13.6 0 24.752 4.896 33.184 14.416s12.784 21.76 12.784 36.72c0 15.232-4.352 27.472-12.784 36.992zM1351.6 40.657c-2.72-2.72-6.256-4.08-10.336-4.08-4.352 0-7.616 1.36-10.336 4.08s-4.08 6.256-4.08 10.336c0 4.352 1.36 7.616 4.08 10.336s5.984 4.08 10.336 4.08c4.08 0 7.616-1.36 10.336-4.08s4.08-5.984 4.08-10.336c0-4.08-1.36-7.616-4.08-10.336zm-21.488 49.504v138.72h22.304v-138.72zM1491.2 103.76c-10.336-10.064-23.664-15.232-40.528-15.232-20.128 0-35.36 6.8-45.696 20.4l-2.992-18.768h-19.312v138.72h22.304v-69.36c0-15.504 3.536-27.744 11.152-36.992 7.344-8.976 17.68-13.6 30.736-13.6 11.968 0 21.216 3.808 27.744 11.424s9.792 18.496 9.792 32.64v75.888h22.304v-77.248c0-21.76-5.168-37.536-15.504-47.872zM1666.8 38.481h-22.304v72.896c-4.624-7.072-10.88-12.512-18.768-16.592-8.16-4.08-17.68-6.256-28.832-6.256-12.784 0-24.208 2.992-34.272 8.976-10.336 5.984-18.224 14.416-23.936 25.024-5.712 10.88-8.432 23.12-8.432 36.992 0 14.688 2.72 27.472 8.432 38.08 5.712 10.88 13.6 19.04 23.664 24.48 10.064 5.712 21.488 8.432 34.544 8.432 20.128 0 35.904-7.888 47.6-23.936l2.992 22.304h19.312zm-44.064 165.92c-7.072 4.352-14.96 6.256-23.664 6.256-13.872 0-25.024-4.624-33.456-14.144-8.4321-9.52-12.512-21.76-12.512-36.992 0-14.96 4.0799-27.2 12.512-36.72 8.432-9.52 19.584-14.416 33.456-14.416 8.704 0 16.592 2.176 23.664 6.528s12.512 10.608 16.32 18.496 5.712 16.864 5.712 26.656-1.904 18.768-5.712 26.384-9.248 13.6-16.32 17.952zM1700.4 122.26c-5.44 10.88-8.16 23.12-8.16 37.264s2.72 26.384 8.432 37.264 13.872 19.04 24.208 25.024 22.304 8.704 36.176 8.704c15.776 0 29.104-4.352 39.984-13.328s17.68-20.672 20.4-34.816h-22.576c-2.448 8.976-7.072 16.048-14.144 20.944s-15.504 7.344-25.296 7.344c-13.056 0-23.392-4.08-31.28-12.24-8.16-8.16-12.24-19.04-12.512-32.64v-1.904h107.71c0.272-4.352 0.544-7.344 0.544-9.52-0.544-13.328-3.536-25.024-8.976-35.088-5.712-9.792-13.328-17.408-23.12-22.848-9.792-5.168-21.216-7.888-33.728-7.888-13.056 0-24.48 2.992-34.272 8.976-10.064 5.984-17.952 14.144-23.392 24.752zm100.37 23.12h-83.776c1.088-10.88 5.44-19.856 13.6-26.928 7.888-6.8 17.136-10.336 27.744-10.336 11.696 0 21.488 3.264 29.104 9.792s12.24 15.776 13.328 27.472zM1884 157.62l-52.768 71.264h24.752l40.8-55.76 40.8 55.76h26.656l-53.04-71.264 49.504-67.456h-24.752l-37.536 51.408-36.992-51.408h-26.656z" fill="#333"/></svg>'), style='cursor: pointer;', onclick='location.href=\'https://github.com/CyrilBrulebois/apt-webindex\'') #h1(TITLE) with h4(): text('Available distributions: ') # XXX: "manual join" for i, dist in enumerate(dists): if i != 0: text(' | ') a(dist, href='#%s' % dist, _class='mono') text(' — ') text('direct access: ') a('dists', href='dists/', _class='mono') text(' | ') a('pool', href='pool/', _class='mono') text(' — ') text('freshness scale: ') for i in range(5): span('    ', _class='hot%d' % (i+1)) for dist in dists: with doc.add(table()): with tr(): attr(id=dist) th('Distribution: %s' % dist, colspan=4, _class='distribution') with tr(): th(raw('Package<br>name'), _class='col1') th(raw('Newest<br>versions'), _class='col2') th(raw('Newest<br>debs'), _class='col3') th(raw('Older<br>versions'), _class='col4') render_dist_html(dist) br() print(doc)
54.995192
5,315
0.622607
2,259
11,439
3.124834
0.278442
0.005383
0.00765
0.005667
0.240827
0.209661
0.196628
0.169146
0.158096
0.158096
0
0.371865
0.198357
11,439
207
5,316
55.26087
0.397601
0.083923
0
0.086093
0
0.006623
0.63969
0.198161
0
0
0
0
0
1
0.013245
false
0
0.05298
0
0.072848
0.013245
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0526f1d690941428914033976ccd90cf0b233ef9
187
py
Python
examples/coolmagic/__init__.py
est/werkzeug
1a852423e6fc6d9bd3a0e0c756dde5680c38cee0
[ "BSD-3-Clause" ]
1
2020-08-08T21:54:22.000Z
2020-08-08T21:54:22.000Z
examples/coolmagic/__init__.py
est/werkzeug
1a852423e6fc6d9bd3a0e0c756dde5680c38cee0
[ "BSD-3-Clause" ]
1
2019-05-11T16:26:21.000Z
2019-05-11T16:26:21.000Z
examples/coolmagic/__init__.py
est/werkzeug
1a852423e6fc6d9bd3a0e0c756dde5680c38cee0
[ "BSD-3-Clause" ]
1
2021-01-14T08:58:12.000Z
2021-01-14T08:58:12.000Z
# -*- coding: utf-8 -*- """ coolmagic ~~~~~~~~~ Package description goes here. :copyright: 2007 Pallets :license: BSD-3-Clause """ from .application import make_app
15.583333
34
0.593583
20
187
5.5
1
0
0
0
0
0
0
0
0
0
0
0.041958
0.235294
187
11
35
17
0.727273
0.657754
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
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
4