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
179c5ce088c794926cd3d66cdddcbad31e2a034f
71
py
Python
1037.py
FelisCatusKR/Baekjoon_Python3
d84dc9421fe956001864d138b6d6ec9ebd793edf
[ "MIT" ]
null
null
null
1037.py
FelisCatusKR/Baekjoon_Python3
d84dc9421fe956001864d138b6d6ec9ebd793edf
[ "MIT" ]
null
null
null
1037.py
FelisCatusKR/Baekjoon_Python3
d84dc9421fe956001864d138b6d6ec9ebd793edf
[ "MIT" ]
null
null
null
# 1037.py input();l=sorted(map(int,input().split()));print(l[0]*l[-1])
35.5
60
0.605634
15
71
2.933333
0.8
0
0
0
0
0
0
0
0
0
0
0.086957
0.028169
71
2
60
35.5
0.536232
0.098592
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
1
0
4
bd746500391c75c48657cf313f8e0de6a6799893
96
py
Python
tests/errors/test_assign1.py
akshanshbhatt/lpython
70fef49dbbb6cbb0447f7013231171e5c8b8e5df
[ "BSD-3-Clause" ]
31
2022-01-07T23:56:33.000Z
2022-03-29T16:09:02.000Z
tests/errors/test_assign1.py
akshanshbhatt/lpython
70fef49dbbb6cbb0447f7013231171e5c8b8e5df
[ "BSD-3-Clause" ]
197
2021-12-29T19:01:41.000Z
2022-03-31T15:58:25.000Z
tests/errors/test_assign1.py
akshanshbhatt/lpython
70fef49dbbb6cbb0447f7013231171e5c8b8e5df
[ "BSD-3-Clause" ]
17
2022-01-06T15:34:36.000Z
2022-03-31T13:55:33.000Z
def test_e1(): a: list[i32] a = [1, 2, 3] b: list[str] b = ['1', '2'] a = b
13.714286
18
0.364583
18
96
1.888889
0.611111
0.117647
0
0
0
0
0
0
0
0
0
0.137931
0.395833
96
6
19
16
0.448276
0
0
0
0
0
0.020833
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.166667
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
bd9fca198553990e454693c0cc1b2e8f6e3e3e83
123
py
Python
setup.py
kangheeyong/PROJECT-SPDRC-ui
2af967447475a7dea50cadb7c1af6cd0886d7aae
[ "MIT" ]
null
null
null
setup.py
kangheeyong/PROJECT-SPDRC-ui
2af967447475a7dea50cadb7c1af6cd0886d7aae
[ "MIT" ]
null
null
null
setup.py
kangheeyong/PROJECT-SPDRC-ui
2af967447475a7dea50cadb7c1af6cd0886d7aae
[ "MIT" ]
null
null
null
from setuptools import setup, find_packages setup(name='SPDRC-ui', packges=find_packages(), version='0.1.0')
17.571429
43
0.682927
17
123
4.823529
0.764706
0.292683
0
0
0
0
0
0
0
0
0
0.029703
0.178862
123
6
44
20.5
0.782178
0
0
0
0
0
0.105691
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
da2765380fe89e233571ba95de3cdbcd20fced10
223
py
Python
Library/Library/views.py
alirezaryahi/Library-with-django-and-ajax
0a84a8cb2f8f62959422ec60df674b47ea77c9a4
[ "MIT" ]
1
2021-02-04T21:20:37.000Z
2021-02-04T21:20:37.000Z
Library/Library/views.py
alirezaryahi/Library-with-django-and-ajax
0a84a8cb2f8f62959422ec60df674b47ea77c9a4
[ "MIT" ]
null
null
null
Library/Library/views.py
alirezaryahi/Library-with-django-and-ajax
0a84a8cb2f8f62959422ec60df674b47ea77c9a4
[ "MIT" ]
null
null
null
from django.shortcuts import render from books.models import Subject def subject(request): subjects = Subject.objects.all() context = {'subjects': subjects} return render(request, 'main/navbar.html', context)
24.777778
55
0.735426
27
223
6.074074
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.156951
223
8
56
27.875
0.87234
0
0
0
0
0
0.107623
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
da31e3c3db4c4dd5042fabc7387c9e0e6e149418
148
py
Python
Designs/3D_Sphere.py
Suhail-Athar/Python
60b020561e9ad4b970ec0063f477de270f904bca
[ "MIT" ]
3
2020-12-14T08:36:52.000Z
2021-12-04T10:14:45.000Z
Designs/3D_Sphere.py
Suhail-Athar/Python
60b020561e9ad4b970ec0063f477de270f904bca
[ "MIT" ]
null
null
null
Designs/3D_Sphere.py
Suhail-Athar/Python
60b020561e9ad4b970ec0063f477de270f904bca
[ "MIT" ]
1
2020-11-11T15:00:05.000Z
2020-11-11T15:00:05.000Z
from vpython import * scene.title = "VPython: Draw a sphere" sphere() # using defaults #see http://www.vpython.org/contents/docs/defaults.html
24.666667
56
0.72973
21
148
5.142857
0.809524
0
0
0
0
0
0
0
0
0
0
0
0.141892
148
6
56
24.666667
0.850394
0.459459
0
0
0
0
0.285714
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
da696aa7a39cfcbf24e717a9b1e321995182678f
53
py
Python
tests/__init__.py
bio2bel/go
eacb21168c05836451dd7280dab1368c27a7bca5
[ "MIT" ]
null
null
null
tests/__init__.py
bio2bel/go
eacb21168c05836451dd7280dab1368c27a7bca5
[ "MIT" ]
5
2017-08-19T14:56:55.000Z
2019-09-06T12:33:05.000Z
tests/__init__.py
bio2bel/go
eacb21168c05836451dd7280dab1368c27a7bca5
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Tests for Bio2BEL GO."""
13.25
27
0.509434
7
53
3.857143
1
0
0
0
0
0
0
0
0
0
0
0.046512
0.188679
53
3
28
17.666667
0.581395
0.830189
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
e505275fc9ff5ff04b7d33fe4461008604086916
1,325
py
Python
exercise/full_bus_tour.py
cutajarj/DynamicProgrammingInPython
9cbd984bdbf4a3062a3838c3a39d8921840e9d24
[ "MIT" ]
9
2019-07-28T15:19:11.000Z
2021-09-01T05:10:45.000Z
exercise/full_bus_tour.py
cutajarj/DynamicProgrammingInPython
9cbd984bdbf4a3062a3838c3a39d8921840e9d24
[ "MIT" ]
null
null
null
exercise/full_bus_tour.py
cutajarj/DynamicProgrammingInPython
9cbd984bdbf4a3062a3838c3a39d8921840e9d24
[ "MIT" ]
10
2019-11-10T12:21:14.000Z
2021-11-06T10:20:57.000Z
# You are developing an online booking portal for a bus tour company. On the website, tourists can book in # groups to come on your company's city bus tour. The company has various buses with different capacities. # You want to determine, from the list of available bookings, if you can completely fill up a particular bus. # The golden rule is that you cannot break groups apart and put them on separate buses. # More formally: # # For: # A bus with capacity: int full_cap # A list of group bookings, where each element represents a group size: int list group_sizes # Write a function that returns true iff groupSizes contains a subset that when you sum it up is equal to c. # That is from the list of group bookings you can completely fill up a bus # # Assume: # capacity full_cap is greater or equal to 0 # each integer in groupSizes is greater than 0 # # Examples: # groupSizes = {4, 13, 5, 12, 6, 1, 8}, full_cap = 11 should return true as subset (5, 6) has a sum of 9 # groupSizes = {1, 1, 1}, full_cap = 3 should return true as subset (1, 1, 1) has a sum of 3 # groupSizes = {4, 5, 6, 7}, full_cap = 100 should return false class FullBusTour: def __init__(self, group_sizes, full_cap): self.group_sizes = group_sizes self.full_cap = full_cap def fits_exactly(self): return False
42.741935
109
0.725283
232
1,325
4.068966
0.474138
0.059322
0.014831
0.027542
0.099576
0.048729
0
0
0
0
0
0.029693
0.212075
1,325
30
110
44.166667
0.874521
0.824906
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.166667
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
e5085f54f9a219ffa464351d288d93ac51d5d606
214
py
Python
notifications/views.py
luterien/django-action-notifications
0843baba73a7c92681a68e32bae550ec9af87555
[ "MIT" ]
1
2017-04-22T11:16:13.000Z
2017-04-22T11:16:13.000Z
notifications/views.py
luterien/django-action-notifications
0843baba73a7c92681a68e32bae550ec9af87555
[ "MIT" ]
null
null
null
notifications/views.py
luterien/django-action-notifications
0843baba73a7c92681a68e32bae550ec9af87555
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render from models import Notification def main(request): return render(request, "hello.html", { "count": 0 })
16.461538
39
0.714953
27
214
5.481481
0.777778
0
0
0
0
0
0
0
0
0
0
0.011236
0.168224
214
12
40
17.833333
0.820225
0.098131
0
0
0
0
0.078947
0
0
0
0
0
0
1
0.142857
false
0
0.428571
0.142857
0.714286
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
0
0
1
1
1
0
0
4
e54fa20b9622a43cadaccadb28f5cb59f9d1dffb
204
py
Python
notifications/tests/sample_notifications/apps.py
pandafy/django-notifications
720c40576a9387a035a44aa800f423efd15c8038
[ "BSD-3-Clause" ]
1,354
2015-01-03T17:22:58.000Z
2022-03-29T11:49:12.000Z
notifications/tests/sample_notifications/apps.py
pandafy/django-notifications
720c40576a9387a035a44aa800f423efd15c8038
[ "BSD-3-Clause" ]
275
2015-01-19T21:32:51.000Z
2022-03-30T10:07:14.000Z
notifications/tests/sample_notifications/apps.py
pandafy/django-notifications
720c40576a9387a035a44aa800f423efd15c8038
[ "BSD-3-Clause" ]
385
2015-01-08T19:51:12.000Z
2022-03-29T10:19:16.000Z
from notifications.apps import Config as NotificationConfig class SampleNotificationsConfig(NotificationConfig): name = 'notifications.tests.sample_notifications' label = 'sample_notifications'
29.142857
59
0.823529
18
204
9.222222
0.722222
0.228916
0
0
0
0
0
0
0
0
0
0
0.117647
204
6
60
34
0.922222
0
0
0
0
0
0.294118
0.196078
0
0
0
0
0
1
0
false
0
0.25
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
0
0
1
0
0
4
e5649d64050b3c927f2c435df5dfbc7f4d2df527
88
py
Python
timemachines/skaters/rvr/rvrinclusion.py
iklasky/timemachines
1820fa9453d31d4daaeff75274a935c7455febe3
[ "MIT" ]
253
2021-01-08T17:33:30.000Z
2022-03-21T17:32:36.000Z
timemachines/skaters/rvr/rvrinclusion.py
iklasky/timemachines
1820fa9453d31d4daaeff75274a935c7455febe3
[ "MIT" ]
65
2021-01-20T16:43:35.000Z
2022-03-30T19:07:22.000Z
timemachines/skaters/rvr/rvrinclusion.py
iklasky/timemachines
1820fa9453d31d4daaeff75274a935c7455febe3
[ "MIT" ]
28
2021-02-04T14:58:30.000Z
2022-01-17T04:35:17.000Z
try: import river using_river = True except ImportError: using_river = False
17.6
23
0.704545
11
88
5.454545
0.727273
0.333333
0
0
0
0
0
0
0
0
0
0
0.25
88
5
23
17.6
0.909091
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
e58a7fdb514f9e1662a022ebfe2722a37977f702
141
py
Python
cards/__init__.py
mrcartoonster/booster_rockets
27eb26da6e0bc6614359046af670bd77a833d5a0
[ "MIT" ]
null
null
null
cards/__init__.py
mrcartoonster/booster_rockets
27eb26da6e0bc6614359046af670bd77a833d5a0
[ "MIT" ]
1
2021-07-27T22:56:25.000Z
2021-07-27T22:56:52.000Z
cards/__init__.py
mrcartoonster/booster_rockets
27eb26da6e0bc6614359046af670bd77a833d5a0
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Top-level package for cards. """ __version__ = "1.0.0" from .api import * # noqa from .cli import app # noqa
14.1
28
0.595745
21
141
3.809524
0.809524
0
0
0
0
0
0
0
0
0
0
0.036036
0.212766
141
9
29
15.666667
0.684685
0.432624
0
0
0
0
0.071429
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
e5aae6e8ac83145e79837ac1322488d9d238e854
30
py
Python
Dangerous/Golismero/tools/xsser/XSSer/post/__init__.py
JeyZeta/Dangerous-
824ea6b571eda98bb855f176361e9b35dfda578e
[ "MIT" ]
null
null
null
Dangerous/Golismero/tools/xsser/XSSer/post/__init__.py
JeyZeta/Dangerous-
824ea6b571eda98bb855f176361e9b35dfda578e
[ "MIT" ]
null
null
null
Dangerous/Golismero/tools/xsser/XSSer/post/__init__.py
JeyZeta/Dangerous-
824ea6b571eda98bb855f176361e9b35dfda578e
[ "MIT" ]
1
2018-07-04T18:35:16.000Z
2018-07-04T18:35:16.000Z
""" Post processing tools """
7.5
21
0.633333
3
30
6.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.166667
30
3
22
10
0.76
0.7
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
e5df42ef4101abc9d0f814da90c94a35b0f5f71d
62
py
Python
model/build_vocab.py
phillipcpark/bert_asm
81ca266af8dd1fd3a3b2820553aa6ed54ce22323
[ "MIT" ]
null
null
null
model/build_vocab.py
phillipcpark/bert_asm
81ca266af8dd1fd3a3b2820553aa6ed54ce22323
[ "MIT" ]
8
2021-08-23T04:42:05.000Z
2021-08-24T16:45:19.000Z
model/build_vocab.py
phillipcpark/bert_asm
81ca266af8dd1fd3a3b2820553aa6ed54ce22323
[ "MIT" ]
null
null
null
from vocab import build if __name__=='__main__': build()
12.4
24
0.693548
8
62
4.375
0.875
0
0
0
0
0
0
0
0
0
0
0
0.193548
62
4
25
15.5
0.7
0
0
0
0
0
0.129032
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
f9124b96c4073ecd53221b795e6e232936fc2806
76
py
Python
PythonExercicios/ex001.py
GabrielProdi/Python_CursoEmVideo
8bfff1b9a73d09c8f42dc3778f895525f1bc946d
[ "MIT" ]
null
null
null
PythonExercicios/ex001.py
GabrielProdi/Python_CursoEmVideo
8bfff1b9a73d09c8f42dc3778f895525f1bc946d
[ "MIT" ]
null
null
null
PythonExercicios/ex001.py
GabrielProdi/Python_CursoEmVideo
8bfff1b9a73d09c8f42dc3778f895525f1bc946d
[ "MIT" ]
null
null
null
#Crie um programa que diga 'Hello World' msg = 'Hello World!' print( msg )
15.2
40
0.684211
12
76
4.333333
0.75
0.384615
0
0
0
0
0
0
0
0
0
0
0.197368
76
4
41
19
0.852459
0.513158
0
0
0
0
0.333333
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
0
0
0
1
0
4
0056d3ab7b7c484da4dec5de5bbb42ab228b4b59
174
py
Python
editBot/todo/models.py
KApilBD/python
9b5c11418c396fcdb10d9615d5d28c3ccdea7b14
[ "MIT" ]
null
null
null
editBot/todo/models.py
KApilBD/python
9b5c11418c396fcdb10d9615d5d28c3ccdea7b14
[ "MIT" ]
null
null
null
editBot/todo/models.py
KApilBD/python
9b5c11418c396fcdb10d9615d5d28c3ccdea7b14
[ "MIT" ]
null
null
null
from django.db import models # Create your models here. class TodoItem(models.Model): content = models.TextField() #it will ne like coulumn for the DB
21.75
69
0.672414
24
174
4.875
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.258621
174
8
70
21.75
0.906977
0.333333
0
0
0
0
0
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
007dfd9135c4df932f8eddd858347d71d5774a8d
345
py
Python
symbol_table.py
Ammar-Raneez/Simple_Script
36af99e6d6dbfd641472d2eb21c218d2e106c0d4
[ "MIT" ]
null
null
null
symbol_table.py
Ammar-Raneez/Simple_Script
36af99e6d6dbfd641472d2eb21c218d2e106c0d4
[ "MIT" ]
null
null
null
symbol_table.py
Ammar-Raneez/Simple_Script
36af99e6d6dbfd641472d2eb21c218d2e106c0d4
[ "MIT" ]
null
null
null
# Will keep track of all the variables and their values class SymbolTable: def __init__(self): self.symbols = {} def get(self, name): value = self.symbols.get(name, None) return value def set(self, name, value): self.symbols[name] = value def remove(self, name): del self.symbols[name]
23
55
0.614493
46
345
4.521739
0.521739
0.211538
0.125
0.163462
0.230769
0
0
0
0
0
0
0
0.284058
345
14
56
24.642857
0.842105
0.153623
0
0
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0
0
0.6
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
00818ae4d66705777029ed38b458a986cd50e250
6,242
py
Python
test/test_npu/test_network_ops/test_multilabel_margin_loss.py
Ascend/pytorch
39849cf72dafe8d2fb68bd1679d8fd54ad60fcfc
[ "BSD-3-Clause" ]
1
2021-12-02T03:07:35.000Z
2021-12-02T03:07:35.000Z
test/test_npu/test_network_ops/test_multilabel_margin_loss.py
Ascend/pytorch
39849cf72dafe8d2fb68bd1679d8fd54ad60fcfc
[ "BSD-3-Clause" ]
1
2021-11-12T07:23:03.000Z
2021-11-12T08:28:13.000Z
test/test_npu/test_network_ops/test_multilabel_margin_loss.py
Ascend/pytorch
39849cf72dafe8d2fb68bd1679d8fd54ad60fcfc
[ "BSD-3-Clause" ]
null
null
null
# Copyright (c) 2020, Huawei Technologies.All rights reserved. # # Licensed under the BSD 3-Clause License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://opensource.org/licenses/BSD-3-Clause # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import torch import numpy as np import sys import copy from common_utils import TestCase, run_tests from common_device_type import dtypes, instantiate_device_type_tests from util_test import create_common_tensor from itertools import repeat, product class TestMultilabelMarginLoss(TestCase): def cpu_op_exec(self, data, target, reduction): output = torch.nn.functional.multilabel_margin_loss(input=data, target=target, reduction=reduction) output = output.to("cpu") output = output.detach().numpy() return output def npu_op_exec(self, data, target, reduction): output = torch.nn.functional.multilabel_margin_loss(input=data, target=target, reduction=reduction) output = output.to("cpu") output = output.to(torch.float32) output = output.detach().numpy() return output def cpu_op_exec_out(self, data, target, c, reduction): output = torch._C._nn.multilabel_margin_loss(input=data, target=target, reduction=reduction, out=c) output = output.to("cpu") output = output.detach().numpy() return output def npu_op_exec_out(self, data, target, c, reduction): output = torch._C._nn.multilabel_margin_loss(input=data, target=target, reduction=reduction, out=c) output = output.to("cpu") output = output.detach().numpy() return output def test_multilabel_margin_loss_1(self, device): data = torch.Tensor([[0.1, 0.2, 0.4, 0.8], [0.1, 0.2, 0.4, 0.8]]).to(torch.float32) target = torch.Tensor([[3, 0, -1, 1], [0, 1, 3, -1]]).to(torch.int64) for reduction in ["mean", "none", "sum"]: data_npu = data.to("npu") target_npu = target.to(torch.int32).to("npu") cpu_output = self.cpu_op_exec(data, target, reduction) npu_output = self.npu_op_exec(data_npu, target_npu, reduction) self.assertRtolEqual(cpu_output, npu_output) def test_multilabel_margin_loss_2(self, device): data = torch.Tensor([[0.1, 0.2, 0.4, 0.8], [0.1, 0.2, 0.4, 0.8]]).to(torch.float32) target = torch.Tensor([[1, 1, 1, 1], [1, 1, 1, 1]]).to(torch.int64) for reduction in ["mean", "none", "sum"]: data_npu = data.to("npu") target_npu = target.to(torch.int32).to("npu") cpu_output = self.cpu_op_exec(data, target, reduction) npu_output = self.npu_op_exec(data_npu, target_npu, reduction) self.assertRtolEqual(cpu_output, npu_output) def test_multilabel_margin_loss_3(self, device): data = torch.Tensor([[0.1, 0.2, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.1], [0.1, 0.2, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.1]]).to(torch.float32) target = torch.Tensor([[3, 0, 7, 8, 1, -1, 1, 2, 2], [4, 5, -1, 1, 1, 1, 1, 2, 2]]).to(torch.int64) for reduction in ["mean", "none", "sum"]: data_npu = data.to("npu") target_npu = target.to(torch.int32).to("npu") cpu_output = self.cpu_op_exec(data, target, reduction) npu_output = self.npu_op_exec(data_npu, target_npu, reduction) self.assertRtolEqual(cpu_output, npu_output) def test_multilabel_margin_loss_out(self, device): data = torch.tensor([[-0.4191, 0.6214], [-0.3765, -0.4781], [ 0.2881, 0.4888]]).to(torch.float32) target = torch.tensor([[ 1, -1], [ 0, -1], [ 1, -1]]).to(torch.int64) for reduction in range(3): data_npu = data.to("npu") target_npu = target.to(torch.int32).to("npu") c = torch.randn(1, 2, 3).float() cpu_output = self.cpu_op_exec_out(data, target, c, reduction) c = torch.randn(1, 2, 3).float() c_npu = c.to("npu") npu_output = self.npu_op_exec_out(data_npu, target_npu, c_npu, reduction) self.assertRtolEqual(cpu_output, npu_output) def test_multilabel_margin_loss_float16_1(self, device): data = torch.Tensor([[0.1, 0.2, 0.4, 0.8], [0.1, 0.2, 0.4, 0.8]]).to(torch.float32) target = torch.Tensor([[3, 0, -1, 1], [0, 1, 3, -1]]).to(torch.int64) for reduction in ["mean", "none", "sum"]: data_npu = data.to(torch.float16).to("npu") target_npu = target.to(torch.int32).to("npu") cpu_output = self.cpu_op_exec(data, target, reduction) npu_output = self.npu_op_exec(data_npu, target_npu, reduction) cpu_output = cpu_output.astype(np.float16) npu_output = npu_output.astype(np.float16) self.assertRtolEqual(cpu_output, npu_output) def test_multilabel_margin_loss_float16_2(self, device): data = torch.Tensor([[0.1, 0.2, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.1], [0.1, 0.2, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.1]]).to(torch.float32) target = torch.Tensor([[3, 0, 7, 8, 1, -1, 1, 2, 2], [4, 5, -1, 1, 1, 1, 1, 2, 2]]).to(torch.int64) for reduction in ["mean", "none", "sum"]: data_npu = data.to(torch.float16).to("npu") target_npu = target.to(torch.int32).to("npu") cpu_output = self.cpu_op_exec(data, target, reduction) npu_output = self.npu_op_exec(data_npu, target_npu, reduction) cpu_output = cpu_output.astype(np.float16) npu_output = npu_output.astype(np.float16) self.assertRtolEqual(cpu_output, npu_output) instantiate_device_type_tests(TestMultilabelMarginLoss, globals(), except_for="cpu") if __name__ == "__main__": run_tests()
46.237037
141
0.618392
932
6,242
3.975322
0.148069
0.018893
0.022672
0.019433
0.754116
0.754116
0.728745
0.707422
0.697976
0.689609
0
0.060593
0.238545
6,242
134
142
46.58209
0.718914
0.091958
0
0.653061
0
0
0.020693
0
0
0
0
0
0.061224
1
0.102041
false
0
0.081633
0
0.234694
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
00873871beace7b6d17a122fee2512aa8fcc8716
756
py
Python
src/Config.py
rdok/cyberpunk2077-usability
9c51038c098166c9bd92bb434d88242b640bf543
[ "MIT" ]
4
2020-12-19T15:51:03.000Z
2020-12-21T13:12:46.000Z
src/Config.py
rdok/cyberpunk2077-usability
9c51038c098166c9bd92bb434d88242b640bf543
[ "MIT" ]
null
null
null
src/Config.py
rdok/cyberpunk2077-usability
9c51038c098166c9bd92bb434d88242b640bf543
[ "MIT" ]
null
null
null
import os import src class Config: input_contexts_path = None input_user_mappings_path = None def root_dir(self): return os.path.dirname(src.__file__) def get_input_user_mappings_path(self): return self.input_user_mappings_path def set_input_user_mappings_path(self, value): path = os.path.abspath(value) self.input_user_mappings_path = path def walk_id(self): return "ad3a8b38-08ce-41bc-bca6-27b4456acb95" def app_name(self): return "Cyberpunk2077 r6-config-editor" def set_input_contexts_path(self, value): path = os.path.abspath(value) self.input_contexts_path = path def get_input_contexts_path(self): return self.input_contexts_path
23.625
53
0.701058
104
756
4.75
0.326923
0.131579
0.172065
0.212551
0.404858
0.178138
0.178138
0.178138
0.178138
0.178138
0
0.037479
0.223545
756
31
54
24.387097
0.804089
0
0
0.095238
0
0
0.087302
0.047619
0
0
0
0
0
1
0.333333
false
0
0.095238
0.238095
0.809524
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
00888c145be4fa8b041e7c2f1369e0bba1d755e7
297
py
Python
taskqueue/EC2/launch.py
matthappens/taskqueue
548979587326b95bf41851eb135052de782e74fc
[ "MIT" ]
1
2017-11-18T18:23:22.000Z
2017-11-18T18:23:22.000Z
taskqueue/EC2/launch.py
matthappens/taskqueue
548979587326b95bf41851eb135052de782e74fc
[ "MIT" ]
null
null
null
taskqueue/EC2/launch.py
matthappens/taskqueue
548979587326b95bf41851eb135052de782e74fc
[ "MIT" ]
null
null
null
from EC2JobsDaemon import EC2JobsDaemon def main (): """ Initializes the EC2 program. """ # TODO: Send args ec2JobsDaemon = EC2JobsDaemon() # ec2JobsDaemon.start() ec2JobsDaemon.run() print "Job started!" # App entry point if __name__ == "__main__": main()
16.5
39
0.636364
29
297
6.241379
0.758621
0.287293
0
0
0
0
0
0
0
0
0
0.031532
0.252525
297
18
40
16.5
0.783784
0.178451
0
0
0
0
0.101523
0
0
0
0
0.055556
0
0
null
null
0
0.142857
null
null
0.142857
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
1
0
1
0
0
0
0
0
0
0
0
4
009ff893a246abac723c2453f610f4f157cd7c08
395
py
Python
flask/tutorial-1-3-router-blueprint/users/views.py
pisitj/practice-python-web-framework
5f7f60737b1cf9618e73ad8047b6c4f556d1feb0
[ "MIT" ]
null
null
null
flask/tutorial-1-3-router-blueprint/users/views.py
pisitj/practice-python-web-framework
5f7f60737b1cf9618e73ad8047b6c4f556d1feb0
[ "MIT" ]
null
null
null
flask/tutorial-1-3-router-blueprint/users/views.py
pisitj/practice-python-web-framework
5f7f60737b1cf9618e73ad8047b6c4f556d1feb0
[ "MIT" ]
null
null
null
# https://github.com/gothinkster/flask-realworld-example-app/blob/master/conduit/user/views.py from flask import Blueprint blueprint = Blueprint('users', __name__, url_prefix='/users') @blueprint.route("/", methods=('GET',)) def get_user_list(): return {"message": "Get List of Users."} @blueprint.route("/", methods=('POST',)) def create_user(): return {"message": "Create a User."}
30.384615
94
0.701266
51
395
5.27451
0.627451
0.133829
0.141264
0.193309
0
0
0
0
0
0
0
0
0.103797
395
13
95
30.384615
0.759887
0.232911
0
0
0
0
0.218543
0
0
0
0
0
0
1
0.25
false
0
0.125
0.25
0.625
0.5
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
0
1
0
4
00c54c446888e403854fc4669b2d29ea91cb5fee
213
py
Python
src/utils.py
marcelogdeandrade/ImageInpating
bcb24e4e9ee0f36a0816306daf2960e4b28ac7fa
[ "MIT" ]
1
2019-12-04T06:09:32.000Z
2019-12-04T06:09:32.000Z
src/utils.py
marcelogdeandrade/ImageInpating
bcb24e4e9ee0f36a0816306daf2960e4b28ac7fa
[ "MIT" ]
null
null
null
src/utils.py
marcelogdeandrade/ImageInpating
bcb24e4e9ee0f36a0816306daf2960e4b28ac7fa
[ "MIT" ]
1
2019-02-25T01:34:42.000Z
2019-02-25T01:34:42.000Z
from keras.datasets import cifar100 from keras.preprocessing import image import numpy as np def load_cifar10(): (x_train, _), (x_test, _) = cifar100.load_data(label_mode='fine') return (x_train, x_test)
26.625
69
0.746479
32
213
4.6875
0.65625
0.12
0.093333
0.146667
0
0
0
0
0
0
0
0.044199
0.150235
213
8
70
26.625
0.78453
0
0
0
0
0
0.018692
0
0
0
0
0
0
1
0.166667
true
0
0.5
0
0.833333
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
00d1529c5ecca87f1ba4388c53bf59a7200f9c94
60
py
Python
py-practice/py-practice-hackerrank/TODO/journey_to_the_moon.py
beenorgone-notebook/python-notebook
48e42b5be70e7ca06e8440a75516c055c961371c
[ "MIT" ]
null
null
null
py-practice/py-practice-hackerrank/TODO/journey_to_the_moon.py
beenorgone-notebook/python-notebook
48e42b5be70e7ca06e8440a75516c055c961371c
[ "MIT" ]
null
null
null
py-practice/py-practice-hackerrank/TODO/journey_to_the_moon.py
beenorgone-notebook/python-notebook
48e42b5be70e7ca06e8440a75516c055c961371c
[ "MIT" ]
1
2018-04-08T13:24:39.000Z
2018-04-08T13:24:39.000Z
# https://www.hackerrank.com/challenges/journey-to-the-moon
30
59
0.783333
9
60
5.222222
1
0
0
0
0
0
0
0
0
0
0
0
0.033333
60
1
60
60
0.810345
0.95
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
da9b2acb77b363a67dd28953baff922ff4c7d24d
99
py
Python
flexlate/constants.py
nickderobertis/flexlate
81d6dbc2d87219a2a89266d6e8fb03310a24a3a1
[ "MIT" ]
null
null
null
flexlate/constants.py
nickderobertis/flexlate
81d6dbc2d87219a2a89266d6e8fb03310a24a3a1
[ "MIT" ]
25
2021-12-05T18:57:53.000Z
2022-03-29T13:45:47.000Z
flexlate/constants.py
nickderobertis/flexlate
81d6dbc2d87219a2a89266d6e8fb03310a24a3a1
[ "MIT" ]
null
null
null
DEFAULT_MERGED_BRANCH_NAME = "flexlate-output" DEFAULT_TEMPLATE_BRANCH_NAME = "flexlate-templates"
33
51
0.858586
12
99
6.583333
0.666667
0.253165
0.455696
0
0
0
0
0
0
0
0
0
0.060606
99
2
52
49.5
0.849462
0
0
0
0
0
0.333333
0
0
0
0
0
0
1
0
false
0
0
0
0
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
dafccf0672e4e3925f86d5bd9e0c2f690873a88d
460
py
Python
tests/pytest/test_with_pytest.py
popokatapepel/requests-mock
8a3026e0a9011e456649b6c28d5a231f56969f3a
[ "Apache-2.0" ]
null
null
null
tests/pytest/test_with_pytest.py
popokatapepel/requests-mock
8a3026e0a9011e456649b6c28d5a231f56969f3a
[ "Apache-2.0" ]
null
null
null
tests/pytest/test_with_pytest.py
popokatapepel/requests-mock
8a3026e0a9011e456649b6c28d5a231f56969f3a
[ "Apache-2.0" ]
null
null
null
import requests def test_simple(requests_mock): requests_mock.get('https://httpbin.org/get', text='data') assert 'data' == requests.get('https://httpbin.org/get').text class TestClass(object): def configure(self, requests_mock): requests_mock.get('https://httpbin.org/get', text='data') def test_one(self, requests_mock): self.configure(requests_mock) assert 'data' == requests.get('https://httpbin.org/get').text
27.058824
69
0.682609
61
460
5.016393
0.311475
0.235294
0.196078
0.235294
0.627451
0.627451
0.627451
0.627451
0.627451
0.346405
0
0
0.154348
460
16
70
28.75
0.786632
0
0
0.4
0
0
0.234783
0
0
0
0
0
0.2
1
0.3
false
0
0.1
0
0.5
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
973c500f0707b8e87adec5762d527c5b23076f9d
156
py
Python
MySchool/apps.py
jramnai/MyShcool
1292d0af0f5c681fe8a6c9b7d9a40cc59da58ba1
[ "MIT" ]
null
null
null
MySchool/apps.py
jramnai/MyShcool
1292d0af0f5c681fe8a6c9b7d9a40cc59da58ba1
[ "MIT" ]
null
null
null
MySchool/apps.py
jramnai/MyShcool
1292d0af0f5c681fe8a6c9b7d9a40cc59da58ba1
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.apps import AppConfig class MyschoolConfig(AppConfig): name = 'MySchool'
17.333333
39
0.737179
18
156
6.111111
0.833333
0
0
0
0
0
0
0
0
0
0
0.007634
0.160256
156
8
40
19.5
0.832061
0.134615
0
0
0
0
0.06015
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
9741184d53e3c5b4b7fcb08bf95a476c491a026d
353
py
Python
twitoff/tweets/forms.py
CodingDuckmx/Twitoff
f0a854daa0d1040d0bec45c261303ab915ed88b3
[ "MIT" ]
null
null
null
twitoff/tweets/forms.py
CodingDuckmx/Twitoff
f0a854daa0d1040d0bec45c261303ab915ed88b3
[ "MIT" ]
4
2021-06-08T21:14:08.000Z
2022-03-12T00:28:05.000Z
twitoff/tweets/forms.py
CodingDuckmx/Twitoff
f0a854daa0d1040d0bec45c261303ab915ed88b3
[ "MIT" ]
null
null
null
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, SubmitField, BooleanField from wtforms.validators import DataRequired, Length, Email, EqualTo class SearchTwitterUser(FlaskForm): twname = StringField('Username', default='Twitter', validators=[DataRequired(), Length(min=2, max=20)]) submit = SubmitField('Sumbit')
50.428571
107
0.790368
38
353
7.315789
0.710526
0.079137
0
0
0
0
0
0
0
0
0
0.009524
0.107649
353
7
108
50.428571
0.873016
0
0
0
0
0
0.059322
0
0
0
0
0
0
1
0
false
0.166667
0.5
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
0
1
1
0
1
0
0
4
8ad9376128f2b2474558b0f79fb81f0884817e1e
184
py
Python
configs/mask_rcnn/mask_rcnn_r50_fpn_1x_trashcan.py
evgps/mmdetection_trashcan
aaf4237c2c0d473425cdc7b741d3009177b79751
[ "Apache-2.0" ]
null
null
null
configs/mask_rcnn/mask_rcnn_r50_fpn_1x_trashcan.py
evgps/mmdetection_trashcan
aaf4237c2c0d473425cdc7b741d3009177b79751
[ "Apache-2.0" ]
null
null
null
configs/mask_rcnn/mask_rcnn_r50_fpn_1x_trashcan.py
evgps/mmdetection_trashcan
aaf4237c2c0d473425cdc7b741d3009177b79751
[ "Apache-2.0" ]
null
null
null
_base_ = [ '../_base_/models/mask_rcnn_r50_fpn_22cls.py', '../_base_/datasets/trashcan_instance.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ]
30.666667
72
0.690217
23
184
4.782609
0.695652
0.163636
0
0
0
0
0
0
0
0
0
0.030488
0.108696
184
5
73
36.8
0.640244
0
0
0
0
0
0.782609
0.782609
0
0
0
0
0
1
0
false
0
0
0
0
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
c122499a8ad62bf1efcd432a5d953e4aa79b81f4
52
py
Python
qunetsim/components/__init__.py
pritamsinha2304/QuNetSim
65a7486d532816724b5c98cfdcc0910404bfe0e2
[ "MIT" ]
61
2020-02-15T00:59:20.000Z
2022-03-08T10:29:23.000Z
qunetsim/components/__init__.py
pritamsinha2304/QuNetSim
65a7486d532816724b5c98cfdcc0910404bfe0e2
[ "MIT" ]
50
2020-01-28T12:18:50.000Z
2021-12-16T21:38:19.000Z
qunetsim/components/__init__.py
pritamsinha2304/QuNetSim
65a7486d532816724b5c98cfdcc0910404bfe0e2
[ "MIT" ]
27
2020-01-21T12:59:28.000Z
2022-02-21T14:23:00.000Z
from .host import Host from .network import Network
17.333333
28
0.807692
8
52
5.25
0.5
0
0
0
0
0
0
0
0
0
0
0
0.153846
52
2
29
26
0.954545
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
c12af9592ee27ac8982b6dfd3268d52ff82b3974
68
py
Python
requirements.py
epicshepich/MChroma
71e85e83eb4e92e85cbba84800de944a4cf5d3ad
[ "MIT" ]
1
2021-08-28T07:44:36.000Z
2021-08-28T07:44:36.000Z
requirements.py
epicshepich/MChroma
71e85e83eb4e92e85cbba84800de944a4cf5d3ad
[ "MIT" ]
null
null
null
requirements.py
epicshepich/MChroma
71e85e83eb4e92e85cbba84800de944a4cf5d3ad
[ "MIT" ]
null
null
null
import subprocess subprocess.run("pip install -r requirements.txt")
22.666667
49
0.808824
9
68
6.111111
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.088235
68
2
50
34
0.887097
0
0
0
0
0
0.455882
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
c162ca1a61347cffcbf226ca02ac8167ad0e4eb1
158
py
Python
tests/test_to_file.py
LeandroBarone/python-ascii_magic
1f5520831401a16d2bf3e663134ebb54b0b56a15
[ "MIT" ]
23
2020-11-27T01:10:05.000Z
2022-03-04T18:50:09.000Z
tests/test_to_file.py
Cu3t0m/python-ascii_magic
1f5520831401a16d2bf3e663134ebb54b0b56a15
[ "MIT" ]
3
2021-02-18T18:58:16.000Z
2022-03-08T06:27:33.000Z
tests/test_to_file.py
Cu3t0m/python-ascii_magic
1f5520831401a16d2bf3e663134ebb54b0b56a15
[ "MIT" ]
10
2020-11-26T21:17:44.000Z
2022-02-15T05:26:40.000Z
from context import ascii_magic ascii_art = ascii_magic.from_image_file('lion.jpg', mode=ascii_magic.Modes.ASCII) ascii_magic.to_file('lion.txt', ascii_art)
31.6
81
0.816456
27
158
4.444444
0.518519
0.333333
0
0
0
0
0
0
0
0
0
0
0.06962
158
4
82
39.5
0.816327
0
0
0
0
0
0.101266
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
c1630f506dd0e0a58c16f025ffdcf6a095025261
142
py
Python
_global/mission.py
BarryZM/KnowYouAI
8c9d96238090fa8fd70b8581ac536bb1b0691eb5
[ "MIT" ]
null
null
null
_global/mission.py
BarryZM/KnowYouAI
8c9d96238090fa8fd70b8581ac536bb1b0691eb5
[ "MIT" ]
null
null
null
_global/mission.py
BarryZM/KnowYouAI
8c9d96238090fa8fd70b8581ac536bb1b0691eb5
[ "MIT" ]
1
2020-12-31T11:13:30.000Z
2020-12-31T11:13:30.000Z
class Mission: def __init__(self, name, func): self.name = name self._func = func def run(self): self._func()
20.285714
35
0.556338
18
142
4.055556
0.444444
0.219178
0
0
0
0
0
0
0
0
0
0
0.330986
142
7
36
20.285714
0.768421
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
c169472cd4e404368905278574a3e430bf38b3ab
157
py
Python
devilry/devilry_qualifiesforexam_plugin_points/__init__.py
aless80/devilry-django
416c262e75170d5662542f15e2d7fecf5ab84730
[ "BSD-3-Clause" ]
null
null
null
devilry/devilry_qualifiesforexam_plugin_points/__init__.py
aless80/devilry-django
416c262e75170d5662542f15e2d7fecf5ab84730
[ "BSD-3-Clause" ]
null
null
null
devilry/devilry_qualifiesforexam_plugin_points/__init__.py
aless80/devilry-django
416c262e75170d5662542f15e2d7fecf5ab84730
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- # Load appconfid default_app_config = 'devilry.devilry_qualifiesforexam_plugin_points.apps.DevilryQualifiesForExamPointsAppConfig'
26.166667
113
0.815287
15
157
8.2
0.933333
0
0
0
0
0
0
0
0
0
0
0.006944
0.082803
157
5
114
31.4
0.847222
0.229299
0
0
0
0
0.762712
0.762712
0
0
0
0
0
1
0
false
0
0
0
0
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
c182ef14cfb1ed02861a45ebbbc80b7e5f52bd4e
4,242
py
Python
HackABechmarkLAPP/benchmark.py
renepickhardt/HackALapp
1e35b4f1cbac9f03940a93636f50f94ce9fea595
[ "Apache-2.0" ]
22
2018-08-22T14:47:45.000Z
2022-02-02T03:47:12.000Z
HackABechmarkLAPP/benchmark.py
sjorsvanheuveln/HackALapp
1e35b4f1cbac9f03940a93636f50f94ce9fea595
[ "Apache-2.0" ]
null
null
null
HackABechmarkLAPP/benchmark.py
sjorsvanheuveln/HackALapp
1e35b4f1cbac9f03940a93636f50f94ce9fea595
[ "Apache-2.0" ]
2
2019-08-29T00:21:35.000Z
2022-02-23T19:56:15.000Z
''' Created on 24.09.2018 @author: rpickhardt https://www.rene-pickhardt.de License APCHE2 ''' import time from lightning.lightning import LightningRpc from matplotlib import pyplot as plt rpc_path_node1 = "PATH_TO_FIRST/lightning-rpc" rpc_path_node2 = "PATH_TO_SECOND/lightning-rpc" if __name__ == '__main__': ln1 = LightningRpc(rpc_path_node1) ln2 = LightningRpc(rpc_path_node2) rounds = 1000 start = time.time() times = [] for i in range(rounds): s = time.time() invoice = ln1.invoice(500000000, str(time.time()), "description") bolt11 = invoice["bolt11"] ln2.pay(bolt11) invoice = ln2.invoice(500000000, str(time.time()), "description") bolt11 = invoice["bolt11"] ln1.pay(bolt11) e = time.time() times.append(e-s) print("\n\n\n\ncompleted pay round", i+1, "transfered BTC: {:4.2f}".format((i+1)*2*500000/100000000.), "tx per second: {:4.2f}".format((i+1)*2/(e-start))) end = time.time() diff = end-start label = [" pay API","sendpay API"] fig, ax = plt.subplots() plt.title("Times for complete round trip payments on the lightning network using two local c-lightning clients") plt.hist(times,40, label=label[0]+" - {:4.2f} payments per second".format(2*len(times)/sum(times))) ax.legend() plt.xlabel("seconds") plt.ylabel("frequency") ax.grid() fig.text(0.90, 0.75, 'by Rene Pickhardt https://www.rene-pickhardt.de', fontsize=15, color='gray', ha='right', va='bottom', alpha=0.5) plt.show() plt.close() node1_id = res = ln1.getinfo()["id"] node2_id = res = ln2.getinfo()["id"] route_to_ln1 = ln2.getroute(node1_id, "500000000", 1, 10)["route"] route_to_ln2 = ln1.getroute(node2_id, "500000000", 1, 10)["route"] start = time.time() times2= [] for i in range(rounds): s = time.time() invoice = ln1.invoice(500000000, str(time.time()), "description") payment_hash = invoice["payment_hash"] ln2.sendpay(route_to_ln1, payment_hash) invoice = ln2.invoice(500000000, str(time.time()), "description") payment_hash = invoice["payment_hash"] ln1.sendpay(route_to_ln2, payment_hash) e = time.time() times2.append(e-s) print("\n\n\n\ncompleted sendpay round", i+1, "transfered BTC: {:4.2f}".format((i+1)*2*500000/100000000.), "tx per second: {:4.2f}".format((i+1)*2/(e-start))) end = time.time() print("pay api:",diff, 1000 // diff) print("sendpay api:", end-start, 1000// (end-start)) label = [" pay API","sendpay API"] fig, ax = plt.subplots() plt.title("Times for complete round trip payments on the lightning network using two local c-lightning clients") plt.hist(times,40, label=label[0]+" - {:4.2f} payments per second".format(2*len(times)/sum(times))) plt.hist(times2,40, label=label[1]+" - {:4.2f} payments per second".format(2*len(times2)/sum(times2))) ax.legend() plt.xlabel("seconds") plt.ylabel("frequency") ax.grid() fig.text(0.90, 0.7, 'by Rene Pickhardt https://www.rene-pickhardt.de', fontsize=15, color='gray', ha='right', va='bottom', alpha=0.5) plt.show() plt.close() label = [" pay API","sendpay API"] fig, ax = plt.subplots() plt.title("90-percentile of times for complete round trip payments on the lightning network using two local c-lightning clients") values = sorted(times) values = values[:int(rounds*0.9)] plt.hist(values,40, label=label[0]+" - {:4.2f} payments per second".format(2*len(values)/sum(values))) values = sorted(times2) values = values[:int(rounds*0.9)] plt.hist(values,40, label=label[1]+" - {:4.2f} payments per second".format(2*len(values)/sum(values))) ax.legend() plt.xlabel("seconds") plt.ylabel("frequency") ax.grid() fig.text(0.90, 0.7, 'by Rene Pickhardt https://www.rene-pickhardt.de', fontsize=15, color='gray', ha='right', va='bottom', alpha=0.5) plt.show() plt.close() print(times) print(times2)
36.568966
133
0.608204
594
4,242
4.279461
0.217172
0.037766
0.023603
0.027537
0.730921
0.706924
0.706924
0.706924
0.6786
0.648702
0
0.07234
0.224422
4,242
115
134
36.886957
0.700304
0.020981
0
0.631579
0
0.010526
0.269305
0.013272
0
0
0
0
0
1
0
false
0
0.031579
0
0.031579
0.063158
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
c18cea3cfbc3448faa6efed2436e4355db3f7456
132
py
Python
dice_roller/forms.py
czambuk/dnd
a1aaa76c2e5108b6a55fe53a5974f6f584208736
[ "MIT" ]
null
null
null
dice_roller/forms.py
czambuk/dnd
a1aaa76c2e5108b6a55fe53a5974f6f584208736
[ "MIT" ]
5
2021-03-19T03:49:43.000Z
2021-09-22T19:04:33.000Z
dice_roller/forms.py
czambuk/dnd
a1aaa76c2e5108b6a55fe53a5974f6f584208736
[ "MIT" ]
null
null
null
from django import forms class DiceRollForm(forms.Form): roll_data = forms.CharField(initial="np. 2k12+3", label="Kod rzutu")
22
72
0.734848
19
132
5.052632
0.894737
0
0
0
0
0
0
0
0
0
0
0.035088
0.136364
132
5
73
26.4
0.807018
0
0
0
0
0
0.143939
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
c18dcecfe86cc544cdea3fdf52088973981db78f
172
py
Python
apis/models/base.py
IndraP24/katana
cf586a1cff5e0e87239a4590d4ca391cf7656497
[ "MIT" ]
102
2020-03-20T19:29:22.000Z
2022-02-01T11:43:18.000Z
apis/models/base.py
IndraP24/katana
cf586a1cff5e0e87239a4590d4ca391cf7656497
[ "MIT" ]
33
2020-03-20T19:32:13.000Z
2021-03-14T05:48:43.000Z
apis/models/base.py
IndraP24/katana
cf586a1cff5e0e87239a4590d4ca391cf7656497
[ "MIT" ]
26
2020-03-21T06:28:24.000Z
2021-12-26T19:19:46.000Z
from pydantic import BaseModel class TrainingStatusResponse(BaseModel): trainingId: str = "056b5d3d-f983-4cd3-8fbd-20b8dad24e0f" status: str = "Training queued"
24.571429
60
0.761628
18
172
7.277778
0.888889
0
0
0
0
0
0
0
0
0
0
0.116438
0.151163
172
6
61
28.666667
0.780822
0
0
0
0
0
0.302326
0.209302
0
0
0
0
0
1
0
true
0
0.25
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
0
0
1
0
0
4
c1905da23d12582a5f7e321cab3aaa45612d6eb9
1,353
py
Python
azure/eventprocessorhost/__init__.py
KieranBrantnerMagee/azure-event-hubs-python
9c80edb06bb3629e5f9c4ce9b091af561405a90b
[ "MIT" ]
64
2017-06-25T01:58:56.000Z
2022-01-28T09:06:48.000Z
azure/eventprocessorhost/__init__.py
KieranBrantnerMagee/azure-event-hubs-python
9c80edb06bb3629e5f9c4ce9b091af561405a90b
[ "MIT" ]
91
2017-06-07T18:12:23.000Z
2019-08-23T00:42:00.000Z
azure/eventprocessorhost/__init__.py
KieranBrantnerMagee/azure-event-hubs-python
9c80edb06bb3629e5f9c4ce9b091af561405a90b
[ "MIT" ]
66
2017-09-06T11:13:49.000Z
2021-03-24T15:07:26.000Z
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- """ The module provides a means to process Azure Event Hubs events at scale. """ try: from azure.eventprocessorhost.abstract_event_processor import AbstractEventProcessor from azure.eventprocessorhost.azure_storage_checkpoint_manager import AzureStorageCheckpointLeaseManager from azure.eventprocessorhost.azure_blob_lease import AzureBlobLease from azure.eventprocessorhost.checkpoint import Checkpoint from azure.eventprocessorhost.eh_config import EventHubConfig from azure.eventprocessorhost.eh_partition_pump import EventHubPartitionPump, PartitionReceiver from azure.eventprocessorhost.eph import EventProcessorHost, EPHOptions from azure.eventprocessorhost.partition_manager import PartitionManager from azure.eventprocessorhost.partition_context import PartitionContext from azure.eventprocessorhost.partition_pump import PartitionPump except (SyntaxError, ImportError): raise ImportError("EventProcessHost is only compatible with Python 3.5 and above.")
61.5
108
0.720621
126
1,353
7.634921
0.571429
0.093555
0.280665
0.112266
0
0
0
0
0
0
0
0.001653
0.105691
1,353
21
109
64.428571
0.793388
0.30303
0
0
0
0
0.066524
0
0
0
0
0
0
1
0
true
0
0.923077
0
0.923077
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
c199ab0fd3b526e5eaec6e04e336cd1dfe0b8b27
177
py
Python
week6/requestpackage.py
mikequaid/DR
3f54ad37d841cd910cffae11176db783681c2479
[ "Apache-2.0" ]
null
null
null
week6/requestpackage.py
mikequaid/DR
3f54ad37d841cd910cffae11176db783681c2479
[ "Apache-2.0" ]
null
null
null
week6/requestpackage.py
mikequaid/DR
3f54ad37d841cd910cffae11176db783681c2479
[ "Apache-2.0" ]
null
null
null
import requests url = 'https://gmit.ie' response = requests.get(url) #print(response.status_code) #print(response.text) #print(response.status_text) #print(response.headers)
16.090909
28
0.762712
24
177
5.541667
0.541667
0.390977
0.285714
0
0
0
0
0
0
0
0
0
0.084746
177
10
29
17.7
0.820988
0.548023
0
0
0
0
0.202703
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
c19e57a85aee9e0459bca7b2a0f0d9a7b41a21a7
98
py
Python
example/core/middlewares.py
AliRn76/panther
a87f1d2789e125aa4ce4bdae71b708cadf6512de
[ "MIT" ]
2
2022-03-28T08:35:56.000Z
2022-03-28T12:19:16.000Z
example/core/middlewares.py
AliRn76/panther
a87f1d2789e125aa4ce4bdae71b708cadf6512de
[ "MIT" ]
null
null
null
example/core/middlewares.py
AliRn76/panther
a87f1d2789e125aa4ce4bdae71b708cadf6512de
[ "MIT" ]
null
null
null
from panther.middlewares import BaseMiddleware class InitialMiddleware(BaseMiddleware): ...
16.333333
46
0.795918
8
98
9.75
0.875
0
0
0
0
0
0
0
0
0
0
0
0.132653
98
5
47
19.6
0.917647
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
c1c154ea75250e1e28c4565f8eb055a64a18e95b
432
py
Python
m3uragen/software.py
TiBeN/m3uragen
45f6f7c76c7a345d01f43a152f1f815a9891441f
[ "Apache-2.0" ]
1
2020-12-19T09:18:13.000Z
2020-12-19T09:18:13.000Z
m3uragen/software.py
TiBeN/m3uragen
45f6f7c76c7a345d01f43a152f1f815a9891441f
[ "Apache-2.0" ]
1
2021-10-22T00:38:17.000Z
2021-12-15T13:48:18.000Z
m3uragen/software.py
TiBeN/m3uragen
45f6f7c76c7a345d01f43a152f1f815a9891441f
[ "Apache-2.0" ]
null
null
null
"""Software class""" class Software: def __init__(self, name): self.name = name self._images = [] def add_image(self, image): self._images.append(image) def images(self): return sorted(self._images, key=lambda i: i.path) def nb_images(self): return len(self._images) def move_images_to(self, out_dir): for i in self._images: i.move_to(out_dir)
18.782609
57
0.597222
59
432
4.101695
0.40678
0.206612
0.107438
0
0
0
0
0
0
0
0
0
0.287037
432
22
58
19.636364
0.785714
0.032407
0
0
0
0
0
0
0
0
0
0
0
1
0.384615
false
0
0
0.153846
0.615385
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
c1c74e0a37142f94307c74d5fe2da53fc9bc4985
89
py
Python
drf_exception_handler/views.py
rahulz/drf_exception_handler
ef295e4d4efcbd9bebe8b80409fa92e7fa0a7dce
[ "BSD-3-Clause" ]
1
2021-09-29T09:56:51.000Z
2021-09-29T09:56:51.000Z
drf_exception_handler/views.py
rahulz/drf_exception_handler
ef295e4d4efcbd9bebe8b80409fa92e7fa0a7dce
[ "BSD-3-Clause" ]
null
null
null
drf_exception_handler/views.py
rahulz/drf_exception_handler
ef295e4d4efcbd9bebe8b80409fa92e7fa0a7dce
[ "BSD-3-Clause" ]
1
2018-11-06T05:01:16.000Z
2018-11-06T05:01:16.000Z
from drf_exception_handler.exception import handler exception_handler = handler.handler
22.25
51
0.876404
11
89
6.818182
0.454545
0.426667
0
0
0
0
0
0
0
0
0
0
0.089888
89
3
52
29.666667
0.925926
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
c1c895145cd175648e80a3b8ba8200bed7026f40
79
py
Python
utils/__init__.py
espetro/anafi_tools
a40407c2d8818f46eb66e36aad9664f94339db23
[ "BSD-3-Clause" ]
2
2019-11-14T16:13:59.000Z
2020-02-28T14:06:52.000Z
utils/__init__.py
espetro/anafi_tools
a40407c2d8818f46eb66e36aad9664f94339db23
[ "BSD-3-Clause" ]
null
null
null
utils/__init__.py
espetro/anafi_tools
a40407c2d8818f46eb66e36aad9664f94339db23
[ "BSD-3-Clause" ]
2
2020-02-28T08:49:04.000Z
2020-06-27T19:19:11.000Z
# from utils import RunTask, BackgroundTask, print_start, print_error, setupRun
79
79
0.835443
10
79
6.4
0.9
0
0
0
0
0
0
0
0
0
0
0
0.101266
79
1
79
79
0.901408
0.974684
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
c1caac8791c7eaa005c5c28323e63e8f5711a97d
1,112
py
Python
aiodiskdb/exceptions.py
mempoolco/aiodiskdb
8d162b637e7059d3d105716e1eba60851258101a
[ "MIT" ]
4
2021-06-04T06:03:06.000Z
2021-06-09T14:24:12.000Z
aiodiskdb/exceptions.py
mempoolco/aiodiskdb
8d162b637e7059d3d105716e1eba60851258101a
[ "MIT" ]
9
2021-06-07T14:50:12.000Z
2021-06-13T12:24:00.000Z
aiodiskdb/exceptions.py
mempoolco/aiodiskdb
8d162b637e7059d3d105716e1eba60851258101a
[ "MIT" ]
null
null
null
class AioDiskDBException(Exception): pass class RunningException(AioDiskDBException): pass class NotRunningException(AioDiskDBException): pass class TimeoutException(AioDiskDBException): pass class ReadTimeoutException(AioDiskDBException): pass class DBNotInitializedException(AioDiskDBException): pass class InvalidDataFileException(AioDiskDBException): pass class ReadOnlyDatabaseException(AioDiskDBException): pass class FilesInconsistencyException(AioDiskDBException): pass class WriteFailedException(AioDiskDBException): pass class InvalidConfigurationException(AioDiskDBException): pass class EmptyTransactionException(AioDiskDBException): pass class TransactionCommitOnGoingException(AioDiskDBException): pass class TransactionAlreadyCommittedException(AioDiskDBException): pass class InvalidDBStateException(AioDiskDBException): pass class IndexDoesNotExist(AioDiskDBException): pass class EmptyPayloadException(AioDiskDBException): pass class InvalidTrimCommandException(AioDiskDBException): pass
15.661972
63
0.807554
72
1,112
12.472222
0.291667
0.170379
0.481069
0
0
0
0
0
0
0
0
0
0.143885
1,112
70
64
15.885714
0.943277
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
0
0
1
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
1
0
0
0
0
0
4
c1e01fc2af034f9aa0f9169117cda2b0ea3cc274
82
py
Python
setup.py
thecesrom/8.1
0a0fa304137d9eca3e9fd8517b2c9569243121e4
[ "MIT" ]
1
2022-03-16T05:51:43.000Z
2022-03-16T05:51:43.000Z
setup.py
thecesrom/8.1
0a0fa304137d9eca3e9fd8517b2c9569243121e4
[ "MIT" ]
3
2022-03-15T21:33:48.000Z
2022-03-22T21:24:46.000Z
setup.py
thecesrom/8.1
0a0fa304137d9eca3e9fd8517b2c9569243121e4
[ "MIT" ]
1
2022-03-16T18:26:53.000Z
2022-03-16T18:26:53.000Z
#!/usr/bin/env python """Ignition API.""" from setuptools import setup setup()
10.25
28
0.682927
11
82
5.090909
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.146341
82
7
29
11.714286
0.8
0.414634
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
a9a87d71c2c57dde0116b350db5138e820e24526
60
py
Python
examples/recursion/callstackdemo2.py
bjucps/cps110
da67f832aeded810fad011a6675d049a2201b2b3
[ "MIT" ]
null
null
null
examples/recursion/callstackdemo2.py
bjucps/cps110
da67f832aeded810fad011a6675d049a2201b2b3
[ "MIT" ]
null
null
null
examples/recursion/callstackdemo2.py
bjucps/cps110
da67f832aeded810fad011a6675d049a2201b2b3
[ "MIT" ]
5
2020-02-06T20:35:55.000Z
2022-02-10T23:01:20.000Z
def f(x: int): y = x def g(i: int): f(i + 2) g(3)
7.5
14
0.383333
15
60
1.533333
0.6
0
0
0
0
0
0
0
0
0
0
0.054054
0.383333
60
7
15
8.571429
0.567568
0
0
0
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0
0
0.4
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
1
0
0
0
0
0
0
0
4
a9c62276c5f7c739c6f842b3e9e7e2122aaa3b13
157
py
Python
src/expression_evaluator/operators/advance/maximum.py
Xett/expression_evaluator
eca895d79f015843a262e9636b86c6dd3d06a69d
[ "MIT" ]
null
null
null
src/expression_evaluator/operators/advance/maximum.py
Xett/expression_evaluator
eca895d79f015843a262e9636b86c6dd3d06a69d
[ "MIT" ]
null
null
null
src/expression_evaluator/operators/advance/maximum.py
Xett/expression_evaluator
eca895d79f015843a262e9636b86c6dd3d06a69d
[ "MIT" ]
null
null
null
from expression_evaluator.token import * class Maximum(AdvanceOperator): symbols = ['max'] @classmethod def _function(a): return max(a)
19.625
40
0.675159
17
157
6.117647
0.882353
0
0
0
0
0
0
0
0
0
0
0
0.22293
157
8
41
19.625
0.852459
0
0
0
0
0
0.018987
0
0
0
0
0
0
1
0.166667
false
0
0.166667
0.166667
0.833333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
4
a9f43dac4b1e149d345e260d7dc4b06d2ea12556
358
py
Python
accounts/models/office.py
GalinaDimitrova/ITUP-kettering-system
37c3cac481d38fe9e2e1618a042e5b4b01a077a9
[ "MIT" ]
null
null
null
accounts/models/office.py
GalinaDimitrova/ITUP-kettering-system
37c3cac481d38fe9e2e1618a042e5b4b01a077a9
[ "MIT" ]
null
null
null
accounts/models/office.py
GalinaDimitrova/ITUP-kettering-system
37c3cac481d38fe9e2e1618a042e5b4b01a077a9
[ "MIT" ]
null
null
null
from django.db import models class Office(models.Model): name = models.CharField(max_length=120) address = models.CharField(max_length=255, blank=True) phone = models.CharField(max_length=64, blank=True) base_menu = models.ForeignKey('orders.BaseMenu', on_delete=models.SET_NULL, blank=True, null=True, default=None, related_name='office')
39.777778
139
0.756983
51
358
5.176471
0.607843
0.170455
0.204545
0.272727
0
0
0
0
0
0
0
0.025397
0.120112
358
8
140
44.75
0.812698
0
0
0
0
0
0.058659
0
0
0
0
0
0
1
0
false
0
0.166667
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
e71dd7c53c595a4cdc0eb9a6907ebb022a382d55
157
py
Python
yield_test.py
sukhyun5/cnn-text-classification-tf
c756ade01fb682b6a20eb6482c69cecd6260436e
[ "Apache-2.0" ]
null
null
null
yield_test.py
sukhyun5/cnn-text-classification-tf
c756ade01fb682b6a20eb6482c69cecd6260436e
[ "Apache-2.0" ]
null
null
null
yield_test.py
sukhyun5/cnn-text-classification-tf
c756ade01fb682b6a20eb6482c69cecd6260436e
[ "Apache-2.0" ]
null
null
null
def test_loop(num): for a in num: print ("a : ", a) yield a num = [1, 2, 3] tl = test_loop(num) for aa in tl: print ("aa : ", aa)
13.083333
25
0.477707
28
157
2.607143
0.5
0.219178
0.30137
0.383562
0
0
0
0
0
0
0
0.03
0.363057
157
11
26
14.272727
0.7
0
0
0
0
0
0.057692
0
0
0
0
0
0
1
0.125
false
0
0
0
0.125
0.25
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
e7670efdf2c1bc9bcdebee7a1fe6b38134124648
531
py
Python
tests/test_validate.py
thomasschus/segcheck
2e28bf634d60186e3a1a05ec15086f5385dfc42c
[ "MIT" ]
null
null
null
tests/test_validate.py
thomasschus/segcheck
2e28bf634d60186e3a1a05ec15086f5385dfc42c
[ "MIT" ]
null
null
null
tests/test_validate.py
thomasschus/segcheck
2e28bf634d60186e3a1a05ec15086f5385dfc42c
[ "MIT" ]
null
null
null
import pytest from .context import _validate from .context import InvalidSegmentError def test_validate_begin_greater_than_end(): """InvalidSegmentError should be thrown when the segment begin is greater than the segment end.""" with pytest.raises(InvalidSegmentError): _validate([[1, 2], [5, 3]]) def test_validate_begin_equals_end(): """InvalidSegmentError should be thrown when the segment begin equals teh segment end.""" with pytest.raises(InvalidSegmentError): _validate([[1, 2], [5, 5]])
33.1875
102
0.736347
67
531
5.656716
0.402985
0.079156
0.08971
0.105541
0.585752
0.585752
0.585752
0.585752
0.585752
0.295515
0
0.018059
0.165725
531
15
103
35.4
0.837472
0.33145
0
0.222222
0
0
0
0
0
0
0
0
0
1
0.222222
true
0
0.333333
0
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
1
0
1
0
0
4
e77a818618ea0ef701742f47fdb1cab82f764cc5
53
py
Python
Lib/site-packages/hackedit/app/widgets/__init__.py
fochoao/cpython
3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9
[ "bzip2-1.0.6", "0BSD" ]
null
null
null
Lib/site-packages/hackedit/app/widgets/__init__.py
fochoao/cpython
3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9
[ "bzip2-1.0.6", "0BSD" ]
20
2021-05-03T18:02:23.000Z
2022-03-12T12:01:04.000Z
Lib/site-packages/hackedit/app/widgets/__init__.py
fochoao/cpython
3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9
[ "bzip2-1.0.6", "0BSD" ]
null
null
null
""" This package contains some internal widgets. """
13.25
44
0.716981
6
53
6.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.150943
53
3
45
17.666667
0.844444
0.830189
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
e798cb4aa77e24a204349596d9b51b568149c52e
27,740
py
Python
tests/scheduling/test_system_newsched.py
AlirezaFarnia/PsyNeuLink
c66f8248d1391830e76c97df4b644e12a02c2b73
[ "Apache-2.0" ]
null
null
null
tests/scheduling/test_system_newsched.py
AlirezaFarnia/PsyNeuLink
c66f8248d1391830e76c97df4b644e12a02c2b73
[ "Apache-2.0" ]
null
null
null
tests/scheduling/test_system_newsched.py
AlirezaFarnia/PsyNeuLink
c66f8248d1391830e76c97df4b644e12a02c2b73
[ "Apache-2.0" ]
null
null
null
import numpy from psyneulink.core.components.functions.statefulfunctions.integratorfunctions import SimpleIntegrator from psyneulink.core.components.functions.distributionfunctions import DriftDiffusionAnalytical from psyneulink.core.components.functions.transferfunctions import Linear, Logistic from psyneulink.core.components.mechanisms.processing.integratormechanism import IntegratorMechanism from psyneulink.core.components.mechanisms.processing.transfermechanism import TransferMechanism from psyneulink.core.components.process import Process from psyneulink.core.components.projections.modulatory.controlprojection import ControlProjection from psyneulink.core.components.system import System from psyneulink.core.scheduling.condition import AfterNCalls, All, Any, AtNCalls, AtPass, EveryNCalls, JustRan, Never from psyneulink.core.scheduling.scheduler import Scheduler from psyneulink.core.scheduling.time import TimeScale from psyneulink.library.components.mechanisms.processing.integrator.ddm import DDM from psyneulink.library.components.mechanisms.modulatory.control.evc.evccontrolmechanism import EVCControlMechanism class TestInit: def test_create_scheduler_from_system_StroopDemo(self): Color_Input = TransferMechanism(name='Color Input', function=Linear(slope=0.2995)) Word_Input = TransferMechanism(name='Word Input', function=Linear(slope=0.2995)) # Processing Mechanisms (Control) Color_Hidden = TransferMechanism( name='Colors Hidden', function=Logistic(gain=(1.0, ControlProjection)), ) Word_Hidden = TransferMechanism( name='Words Hidden', function=Logistic(gain=(1.0, ControlProjection)), ) Output = TransferMechanism( name='Output', function=Logistic(gain=(1.0, ControlProjection)), ) # Decision Mechanisms Decision = DDM( function=DriftDiffusionAnalytical( drift_rate=(1.0), threshold=(0.1654), noise=(0.5), starting_point=(0), t0=0.25, ), name='Decision', ) # Outcome Mechanisms: Reward = TransferMechanism(name='Reward') # Processes: ColorNamingProcess = Process( default_variable=[0], pathway=[Color_Input, Color_Hidden, Output, Decision], name='Color Naming Process', ) WordReadingProcess = Process( default_variable=[0], pathway=[Word_Input, Word_Hidden, Output, Decision], name='Word Reading Process', ) RewardProcess = Process( default_variable=[0], pathway=[Reward], name='RewardProcess', ) # System: mySystem = System( processes=[ColorNamingProcess, WordReadingProcess, RewardProcess], controller=EVCControlMechanism, enable_controller=True, # monitor_for_control=[Reward, (PROBABILITY_UPPER_THRESHOLD, 1, -1)], name='EVC Gratton System', ) sched = Scheduler(system=mySystem) integrator_ColorInputPrediction = mySystem.execution_list[7] integrator_RewardPrediction = mySystem.execution_list[8] integrator_WordInputPrediction = mySystem.execution_list[9] objective_EVC_mech = mySystem.execution_list[10] expected_consideration_queue = [ {Color_Input, Word_Input, Reward, integrator_ColorInputPrediction, integrator_WordInputPrediction, integrator_RewardPrediction}, {Color_Hidden, Word_Hidden}, {Output}, {Decision}, {objective_EVC_mech}, ] assert sched.consideration_queue == expected_consideration_queue class TestLinear: def test_one_run_twice(self): A = IntegratorMechanism( name='A', default_variable=[0], function=SimpleIntegrator( rate=.5, ) ) p = Process( default_variable=[0], pathway=[A], name='p' ) s = System( processes=[p], name='s' ) term_conds = {TimeScale.TRIAL: AfterNCalls(A, 2)} stim_list = {A: [[1]]} s.run( inputs=stim_list, termination_processing=term_conds ) terminal_mech = A expected_output = [ numpy.array([1.]), ] for i in range(len(expected_output)): numpy.testing.assert_allclose(expected_output[i], terminal_mech.get_output_values(s)[i]) def test_two_AAB(self): A = IntegratorMechanism( name='A', default_variable=[0], function=SimpleIntegrator( rate=.5 ) ) B = TransferMechanism( name='B', default_variable=[0], function=Linear(slope=2.0), ) p = Process( default_variable=[0], pathway=[A, B], name='p' ) s = System( processes=[p], name='s' ) term_conds = {TimeScale.TRIAL: AfterNCalls(B, 1)} stim_list = {A: [[1]]} sched = Scheduler(system=s) sched.add_condition(B, EveryNCalls(A, 2)) s.scheduler = sched s.run( inputs=stim_list, termination_processing=term_conds ) terminal_mech = B expected_output = [ numpy.array([2.]), ] for i in range(len(expected_output)): numpy.testing.assert_allclose(expected_output[i], terminal_mech.get_output_values(s)[i]) def test_two_ABB(self): A = TransferMechanism( name='A', default_variable=[0], function=Linear(slope=2.0), ) B = IntegratorMechanism( name='B', default_variable=[0], function=SimpleIntegrator( rate=.5 ) ) p = Process( default_variable=[0], pathway=[A, B], name='p' ) s = System( processes=[p], name='s' ) term_conds = {TimeScale.TRIAL: AfterNCalls(B, 2)} stim_list = {A: [[1]]} sched = Scheduler(system=s) sched.add_condition(A, Any(AtPass(0), AfterNCalls(B, 2))) sched.add_condition(B, Any(JustRan(A), JustRan(B))) s.scheduler = sched s.run( inputs=stim_list, termination_processing=term_conds ) terminal_mech = B expected_output = [ numpy.array([2.]), ] for i in range(len(expected_output)): numpy.testing.assert_allclose(expected_output[i], terminal_mech.get_output_values(s)[i]) class TestBranching: def test_three_ABAC(self): A = IntegratorMechanism( name='A', default_variable=[0], function=SimpleIntegrator( rate=.5 ) ) B = TransferMechanism( name='B', default_variable=[0], function=Linear(slope=2.0), ) C = TransferMechanism( name='C', default_variable=[0], function=Linear(slope=2.0), ) p = Process( default_variable=[0], pathway=[A, B], name='p' ) q = Process( default_variable=[0], pathway=[A, C], name='q' ) s = System( processes=[p, q], name='s' ) term_conds = {TimeScale.TRIAL: AfterNCalls(C, 1)} stim_list = {A: [[1]]} sched = Scheduler(system=s) sched.add_condition(B, Any(AtNCalls(A, 1), EveryNCalls(A, 2))) sched.add_condition(C, EveryNCalls(A, 2)) s.scheduler = sched s.run( inputs=stim_list, termination_processing=term_conds ) terminal_mechs = [B, C] expected_output = [ [ numpy.array([1.]), ], [ numpy.array([2.]), ], ] for m in range(len(terminal_mechs)): for i in range(len(expected_output[m])): numpy.testing.assert_allclose(expected_output[m][i], terminal_mechs[m].get_output_values(s)[i]) def test_three_ABAC_convenience(self): A = IntegratorMechanism( name='A', default_variable=[0], function=SimpleIntegrator( rate=.5 ) ) B = TransferMechanism( name='B', default_variable=[0], function=Linear(slope=2.0), ) C = TransferMechanism( name='C', default_variable=[0], function=Linear(slope=2.0), ) p = Process( default_variable=[0], pathway=[A, B], name='p' ) q = Process( default_variable=[0], pathway=[A, C], name='q' ) s = System( processes=[p, q], name='s' ) term_conds = {TimeScale.TRIAL: AfterNCalls(C, 1)} stim_list = {A: [[1]]} s.scheduler.add_condition(B, Any(AtNCalls(A, 1), EveryNCalls(A, 2))) s.scheduler.add_condition(C, EveryNCalls(A, 2)) s.run( inputs=stim_list, termination_processing=term_conds ) terminal_mechs = [B, C] expected_output = [ [ numpy.array([1.]), ], [ numpy.array([2.]), ], ] for m in range(len(terminal_mechs)): for i in range(len(expected_output[m])): numpy.testing.assert_allclose(expected_output[m][i], terminal_mechs[m].get_output_values(s)[i]) def test_three_ABACx2(self): A = IntegratorMechanism( name='A', default_variable=[0], function=SimpleIntegrator( rate=.5 ) ) B = TransferMechanism( name='B', default_variable=[0], function=Linear(slope=2.0), ) C = TransferMechanism( name='C', default_variable=[0], function=Linear(slope=2.0), ) p = Process( default_variable=[0], pathway=[A, B], name='p' ) q = Process( default_variable=[0], pathway=[A, C], name='q' ) s = System( processes=[p, q], name='s' ) term_conds = {TimeScale.TRIAL: AfterNCalls(C, 2)} stim_list = {A: [[1]]} sched = Scheduler(system=s) sched.add_condition(B, Any(AtNCalls(A, 1), EveryNCalls(A, 2))) sched.add_condition(C, EveryNCalls(A, 2)) s.scheduler = sched s.run( inputs=stim_list, termination_processing=term_conds ) terminal_mechs = [B, C] expected_output = [ [ numpy.array([3.]), ], [ numpy.array([4.]), ], ] for m in range(len(terminal_mechs)): for i in range(len(expected_output[m])): numpy.testing.assert_allclose(expected_output[m][i], terminal_mechs[m].get_output_values(s)[i]) def test_three_2_ABC(self): A = IntegratorMechanism( name='A', default_variable=[0], function=SimpleIntegrator( rate=.5 ) ) B = IntegratorMechanism( name='B', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) C = TransferMechanism( name='C', default_variable=[0], function=Linear(slope=2.0), ) p = Process( default_variable=[0], pathway=[A, C], name='p' ) q = Process( default_variable=[0], pathway=[B, C], name='q' ) s = System( processes=[p, q], name='s' ) term_conds = {TimeScale.TRIAL: AfterNCalls(C, 1)} stim_list = {A: [[1]], B: [[2]]} sched = Scheduler(system=s) sched.add_condition(C, All(EveryNCalls(A, 1), EveryNCalls(B, 1))) s.scheduler = sched s.run( inputs=stim_list, termination_processing=term_conds ) terminal_mechs = [C] expected_output = [ [ numpy.array([5.]), ], ] for m in range(len(terminal_mechs)): for i in range(len(expected_output[m])): numpy.testing.assert_allclose(expected_output[m][i], terminal_mechs[m].get_output_values(s)[i]) def test_three_2_ABCx2(self): A = IntegratorMechanism( name='A', default_variable=[0], function=SimpleIntegrator( rate=.5 ) ) B = IntegratorMechanism( name='B', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) C = TransferMechanism( name='C', default_variable=[0], function=Linear(slope=2.0), ) p = Process( default_variable=[0], pathway=[A, C], name='p' ) q = Process( default_variable=[0], pathway=[B, C], name='q' ) s = System( processes=[p, q], name='s' ) term_conds = {TimeScale.TRIAL: AfterNCalls(C, 2)} stim_list = {A: [[1]], B: [[2]]} sched = Scheduler(system=s) sched.add_condition(C, All(EveryNCalls(A, 1), EveryNCalls(B, 1))) s.scheduler = sched s.run( inputs=stim_list, termination_processing=term_conds ) terminal_mechs = [C] expected_output = [ [ numpy.array([10.]), ], ] for m in range(len(terminal_mechs)): for i in range(len(expected_output[m])): numpy.testing.assert_allclose(expected_output[m][i], terminal_mechs[m].get_output_values(s)[i]) def test_three_integrators(self): A = IntegratorMechanism( name='A', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) B = IntegratorMechanism( name='B', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) C = IntegratorMechanism( name='C', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) p = Process( default_variable=[0], pathway=[A, C], name='p' ) q = Process( default_variable=[0], pathway=[B, C], name='q' ) s = System( processes=[p, q], name='s' ) term_conds = {TimeScale.TRIAL: AfterNCalls(C, 2)} stim_list = {A: [[1]], B: [[1]]} sched = Scheduler(system=s) sched.add_condition(B, EveryNCalls(A, 2)) sched.add_condition(C, Any(EveryNCalls(A, 1), EveryNCalls(B, 1))) s.scheduler = sched s.run( inputs=stim_list, termination_processing=term_conds ) mechs = [A, B, C] expected_output = [ [ numpy.array([2.]), ], [ numpy.array([1.]), ], [ numpy.array([4.]), ], ] for m in range(len(mechs)): for i in range(len(expected_output[m])): numpy.testing.assert_allclose(expected_output[m][i], mechs[m].get_output_values(s)[i]) def test_four_ABBCD(self): A = TransferMechanism( name='A', default_variable=[0], function=Linear(slope=2.0), ) B = IntegratorMechanism( name='B', default_variable=[0], function=SimpleIntegrator( rate=.5 ) ) C = IntegratorMechanism( name='C', default_variable=[0], function=SimpleIntegrator( rate=.5 ) ) D = TransferMechanism( name='D', default_variable=[0], function=Linear(slope=1.0), ) p = Process( default_variable=[0], pathway=[A, B, D], name='p' ) q = Process( default_variable=[0], pathway=[A, C, D], name='q' ) s = System( processes=[p, q], name='s' ) term_conds = {TimeScale.TRIAL: AfterNCalls(D, 1)} stim_list = {A: [[1]]} sched = Scheduler(system=s) sched.add_condition(B, EveryNCalls(A, 1)) sched.add_condition(C, EveryNCalls(A, 2)) sched.add_condition(D, Any(EveryNCalls(B, 3), EveryNCalls(C, 3))) s.scheduler = sched s.run( inputs=stim_list, termination_processing=term_conds ) terminal_mechs = [D] expected_output = [ [ numpy.array([4.]), ], ] for m in range(len(terminal_mechs)): for i in range(len(expected_output[m])): numpy.testing.assert_allclose(expected_output[m][i], terminal_mechs[m].get_output_values(s)[i]) def test_four_integrators_mixed(self): A = IntegratorMechanism( name='A', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) B = IntegratorMechanism( name='B', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) C = IntegratorMechanism( name='C', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) D = IntegratorMechanism( name='D', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) p = Process( default_variable=[0], pathway=[A, C], name='p' ) p1 = Process( default_variable=[0], pathway=[A, D], name='p1' ) q = Process( default_variable=[0], pathway=[B, C], name='q' ) q1 = Process( default_variable=[0], pathway=[B, D], name='q1' ) s = System( processes=[p, p1, q, q1], name='s' ) term_conds = {TimeScale.TRIAL: All(AfterNCalls(C, 1), AfterNCalls(D, 1))} stim_list = {A: [[1]], B: [[1]]} sched = Scheduler(system=s) sched.add_condition(B, EveryNCalls(A, 2)) sched.add_condition(C, EveryNCalls(A, 1)) sched.add_condition(D, EveryNCalls(B, 1)) s.scheduler = sched s.run( inputs=stim_list, termination_processing=term_conds ) mechs = [A, B, C, D] expected_output = [ [ numpy.array([2.]), ], [ numpy.array([1.]), ], [ numpy.array([4.]), ], [ numpy.array([3.]), ], ] for m in range(len(mechs)): for i in range(len(expected_output[m])): numpy.testing.assert_allclose(expected_output[m][i], mechs[m].get_output_values(s)[i]) def test_five_ABABCDE(self): A = TransferMechanism( name='A', default_variable=[0], function=Linear(slope=2.0), ) B = TransferMechanism( name='B', default_variable=[0], function=Linear(slope=2.0), ) C = IntegratorMechanism( name='C', default_variable=[0], function=SimpleIntegrator( rate=.5 ) ) D = TransferMechanism( name='D', default_variable=[0], function=Linear(slope=1.0), ) E = TransferMechanism( name='E', default_variable=[0], function=Linear(slope=2.0), ) p = Process( default_variable=[0], pathway=[A, C, D], name='p' ) q = Process( default_variable=[0], pathway=[B, C, E], name='q' ) s = System( processes=[p, q], name='s' ) term_conds = {TimeScale.TRIAL: AfterNCalls(E, 1)} stim_list = {A: [[1]], B: [[2]]} sched = Scheduler(system=s) sched.add_condition(C, Any(EveryNCalls(A, 1), EveryNCalls(B, 1))) sched.add_condition(D, EveryNCalls(C, 1)) sched.add_condition(E, EveryNCalls(C, 1)) s.scheduler = sched s.run( inputs=stim_list, termination_processing=term_conds ) terminal_mechs = [D, E] expected_output = [ [ numpy.array([3.]), ], [ numpy.array([6.]), ], ] for m in range(len(terminal_mechs)): for i in range(len(expected_output[m])): numpy.testing.assert_allclose(expected_output[m][i], terminal_mechs[m].get_output_values(s)[i]) # # A B # |\/| # C D # |\/| # E F # def test_six_integrators_threelayer_mixed(self): A = IntegratorMechanism( name='A', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) B = IntegratorMechanism( name='B', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) C = IntegratorMechanism( name='C', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) D = IntegratorMechanism( name='D', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) E = IntegratorMechanism( name='E', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) F = IntegratorMechanism( name='F', default_variable=[0], function=SimpleIntegrator( rate=1 ) ) p = [ Process( default_variable=[0], pathway=[A, C, E], name='p' ), Process( default_variable=[0], pathway=[A, C, F], name='p1' ), Process( default_variable=[0], pathway=[A, D, E], name='p2' ), Process( default_variable=[0], pathway=[A, D, F], name='p3' ), Process( default_variable=[0], pathway=[B, C, E], name='q' ), Process( default_variable=[0], pathway=[B, C, F], name='q1' ), Process( default_variable=[0], pathway=[B, D, E], name='q2' ), Process( default_variable=[0], pathway=[B, D, F], name='q3' ) ] s = System( processes=p, name='s' ) term_conds = {TimeScale.TRIAL: All(AfterNCalls(E, 1), AfterNCalls(F, 1))} stim_list = {A: [[1]], B: [[1]]} sched = Scheduler(system=s) sched.add_condition(B, EveryNCalls(A, 2)) sched.add_condition(C, EveryNCalls(A, 1)) sched.add_condition(D, EveryNCalls(B, 1)) sched.add_condition(E, EveryNCalls(C, 1)) sched.add_condition(F, EveryNCalls(D, 2)) s.scheduler = sched s.run( inputs=stim_list, termination_processing=term_conds ) # Intermediate time steps # # 0 1 2 3 # # A 1 2 3 4 # B 1 2 # C 1 4 8 14 # D 3 9 # E 1 8 19 42 # F 23 # expected_output = { A: [ numpy.array([4.]), ], B: [ numpy.array([2.]), ], C: [ numpy.array([14.]), ], D: [ numpy.array([9.]), ], E: [ numpy.array([42.]), ], F: [ numpy.array([23.]), ], } for m in expected_output: for i in range(len(expected_output[m])): numpy.testing.assert_allclose(expected_output[m][i], m.get_output_values(s)[i]) class TestTermination: def test_termination_conditions_reset(self): A = IntegratorMechanism( name='A', default_variable=[0], function=SimpleIntegrator( rate=.5 ) ) B = TransferMechanism( name='B', default_variable=[0], function=Linear(slope=2.0), ) p = Process( default_variable=[0], pathway=[A, B], name='p' ) s = System( processes=[p], name='s', reinitialize_mechanisms_when=Never() ) term_conds = {TimeScale.TRIAL: AfterNCalls(B, 2)} stim_list = {A: [[1]]} sched = Scheduler(system=s) sched.add_condition(B, EveryNCalls(A, 2)) s.scheduler = sched s.run( inputs=stim_list, termination_processing=term_conds ) # A should run four times terminal_mech = B expected_output = [ numpy.array([4.]), ] for i in range(len(expected_output)): numpy.testing.assert_allclose(expected_output[i], terminal_mech.get_output_values(s)[i]) s.run( inputs=stim_list, ) # A should run an additional two times terminal_mech = B expected_output = [ numpy.array([6.]), ] for i in range(len(expected_output)): numpy.testing.assert_allclose(expected_output[i], terminal_mech.get_output_values(s)[i])
25.590406
140
0.476712
2,602
27,740
4.935819
0.071483
0.092268
0.098419
0.082224
0.788056
0.759246
0.735031
0.711282
0.679903
0.6771
0
0.01972
0.409553
27,740
1,083
141
25.614035
0.764393
0.014672
0
0.655367
0
0
0.008606
0
0
0
0
0
0.018079
1
0.016949
false
0.00226
0.015819
0
0.037288
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
e7b2d0f8623d8c01e5e8cfcaab43836833c72daf
88
py
Python
modules/names_test.py
janbodnar/Python-Course
51705ab5a2adef52bcdb99a800e94c0d67144a38
[ "BSD-2-Clause" ]
13
2017-08-22T12:26:07.000Z
2021-07-29T16:13:50.000Z
modules/names_test.py
janbodnar/Python-Course
51705ab5a2adef52bcdb99a800e94c0d67144a38
[ "BSD-2-Clause" ]
1
2021-02-08T10:24:33.000Z
2021-02-08T10:24:33.000Z
modules/names_test.py
janbodnar/Python-Course
51705ab5a2adef52bcdb99a800e94c0d67144a38
[ "BSD-2-Clause" ]
17
2018-08-13T11:10:33.000Z
2021-07-29T16:14:02.000Z
#!/usr/bin/python # names_test.py from names import * print (locals()) show_names()
8.8
19
0.681818
13
88
4.461538
0.846154
0
0
0
0
0
0
0
0
0
0
0
0.159091
88
9
20
9.777778
0.783784
0.340909
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
821bce1900ea953930cfad183d411f7810ca60ba
471
py
Python
pset_challenging_ext/exercises/solutions/p77.py
mottaquikarim/pydev-psets
9749e0d216ee0a5c586d0d3013ef481cc21dee27
[ "MIT" ]
5
2019-04-08T20:05:37.000Z
2019-12-04T20:48:45.000Z
pset_challenging_ext/exercises/solutions/p77.py
mottaquikarim/pydev-psets
9749e0d216ee0a5c586d0d3013ef481cc21dee27
[ "MIT" ]
8
2019-04-15T15:16:05.000Z
2022-02-12T10:33:32.000Z
pset_challenging_ext/exercises/solutions/p77.py
mottaquikarim/pydev-psets
9749e0d216ee0a5c586d0d3013ef481cc21dee27
[ "MIT" ]
2
2019-04-10T00:14:42.000Z
2020-02-26T20:35:21.000Z
""" Please write a program to output a random number, which is divisible by 5 and 7, between 0 and 10 inclusive using random module and list comprehension. """ """Question: Please write a program to output a random number, which is divisible by 5 and 7, between 0 and 10 inclusive using random module and list comprehension. Hints: Use random.choice() to a random element from a list. """ import random print random.choice([i for i in range(201) if i%5==0 and i%7==0])
36.230769
151
0.747346
85
471
4.141176
0.435294
0.059659
0.068182
0.107955
0.693182
0.693182
0.693182
0.693182
0.693182
0.693182
0
0.043702
0.174098
471
12
152
39.25
0.861183
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.5
null
null
0.5
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
1
0
4
821f9e75d062e35840eeb7ce2bc2ae07c8319004
158
py
Python
recipes/Scripts/django-admin.py
GreJerdev/123recipes
8b11ca995f57fce535c435253f9e0b8cef22e28f
[ "Apache-2.0" ]
null
null
null
recipes/Scripts/django-admin.py
GreJerdev/123recipes
8b11ca995f57fce535c435253f9e0b8cef22e28f
[ "Apache-2.0" ]
1
2021-06-10T20:30:59.000Z
2021-06-10T20:30:59.000Z
recipes/Scripts/django-admin.py
GreJerdev/123recipes
8b11ca995f57fce535c435253f9e0b8cef22e28f
[ "Apache-2.0" ]
null
null
null
#!d:\projects\123recipes\recipes\scripts\python.exe from django.core import management if __name__ == "__main__": management.execute_from_command_line()
26.333333
51
0.791139
20
158
5.7
0.9
0
0
0
0
0
0
0
0
0
0
0.020979
0.094937
158
5
52
31.6
0.776224
0.316456
0
0
0
0
0.074766
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
414d080ed059a5c154f2baa6fd8e78959b47d155
631
py
Python
model_prototype/dataset/default.py
EfficientAI/efficient_cv
e308f229e4d99da86ad56f87f3a78b2c81f27ca5
[ "MIT" ]
null
null
null
model_prototype/dataset/default.py
EfficientAI/efficient_cv
e308f229e4d99da86ad56f87f3a78b2c81f27ca5
[ "MIT" ]
null
null
null
model_prototype/dataset/default.py
EfficientAI/efficient_cv
e308f229e4d99da86ad56f87f3a78b2c81f27ca5
[ "MIT" ]
null
null
null
import os import sys import torch # import torchvision # import torchvision.transforms as transforms from torch.utils.data import Dataset sys.path.append(os.path.abspath('.')) # from utils.utils import stringify is_cuda = torch.cuda.is_available() device = torch.device("cuda" if is_cuda else "cpu") class dataset(Dataset): def __init__(self): pass def __getitem__(self, idx): return 0 def __len__(self): return 100 # ################################# Test ###################################### def test(): d = dataset() print(len(d)) if __name__ == "__main__": test()
17.054054
79
0.59271
75
631
4.68
0.506667
0.096866
0
0
0
0
0
0
0
0
0
0.00789
0.196513
631
36
80
17.527778
0.684418
0.161648
0
0
0
0
0.035398
0
0
0
0
0
0
1
0.210526
false
0.052632
0.210526
0.105263
0.578947
0.052632
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
4
41ba669a4eb3aa6262c66835ca59ffe68e0722bb
261
py
Python
Aussie_sales/config/database_management.py
self-involved/AUSSIE
a58a75eabd5bc0db45caba6c90248577c73581bc
[ "MIT" ]
null
null
null
Aussie_sales/config/database_management.py
self-involved/AUSSIE
a58a75eabd5bc0db45caba6c90248577c73581bc
[ "MIT" ]
null
null
null
Aussie_sales/config/database_management.py
self-involved/AUSSIE
a58a75eabd5bc0db45caba6c90248577c73581bc
[ "MIT" ]
null
null
null
import pymysql def connect(): connection = pymysql.connect(host='ec2db.cmvp0kxmic2d.ap-southeast-2.rds.amazonaws.com', port=3306, user='bahamutedean', passwd='jx13805152868', db='Aussie',charset='utf8' ) return connection
32.625
148
0.662835
28
261
6.178571
0.892857
0
0
0
0
0
0
0
0
0
0
0.096154
0.203065
261
7
149
37.285714
0.735577
0
0
0
0
0
0.330769
0.196154
0
0
0
0
0
1
0.2
false
0.2
0.2
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
1
0
0
1
0
0
4
41cda8ff9929bf815e8267edcf162e668c94a24e
755
py
Python
tests/test_typescript_frontend.py
mychiux413/ConstConv
6c2190d1bb37ae5cfef8464f88371db97719b032
[ "MIT" ]
null
null
null
tests/test_typescript_frontend.py
mychiux413/ConstConv
6c2190d1bb37ae5cfef8464f88371db97719b032
[ "MIT" ]
null
null
null
tests/test_typescript_frontend.py
mychiux413/ConstConv
6c2190d1bb37ae5cfef8464f88371db97719b032
[ "MIT" ]
null
null
null
from __future__ import absolute_import from create_multi_langs.creater.typescript_frontend import CreaterTypeScriptFrontEnd # noqa: E501 from . import TYPESCRIPT_FRONTEND_OUTPUT, TYPESCRIPT_FRONTEND_EXPECT_FILE, create_and_compare, ROOT_DIR # noqa: E501 import os from subprocess import call def test_create_python_file(): create_and_compare( CreaterTypeScriptFrontEnd, TYPESCRIPT_FRONTEND_OUTPUT, TYPESCRIPT_FRONTEND_EXPECT_FILE) return_code = call([ "ts-node", "tests/typescript/generated_frontend.test.ts"]) assert return_code == 0 print('[passed] remove typescript frontend output: ', TYPESCRIPT_FRONTEND_OUTPUT) os.remove(TYPESCRIPT_FRONTEND_OUTPUT) os.chdir(ROOT_DIR)
31.458333
117
0.761589
87
755
6.218391
0.436782
0.266174
0.221811
0.18854
0.269871
0.192237
0.192237
0
0
0
0
0.011236
0.174834
755
23
118
32.826087
0.857143
0.027815
0
0
0
0
0.128591
0.058824
0
0
0
0
0.055556
1
0.055556
false
0.055556
0.277778
0
0.333333
0.055556
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
68d1b93f5ebba0994ca5620d07226698ecf244fc
240
py
Python
code/UI.py
PPeltola/tiralabra
c41a9cf76eafe78e23706aeae02ba6e906adba6f
[ "MIT" ]
null
null
null
code/UI.py
PPeltola/tiralabra
c41a9cf76eafe78e23706aeae02ba6e906adba6f
[ "MIT" ]
1
2021-08-25T08:46:43.000Z
2021-08-25T08:46:43.000Z
code/UI.py
PPeltola/tiralabra
c41a9cf76eafe78e23706aeae02ba6e906adba6f
[ "MIT" ]
null
null
null
from PIL import Image import numpy as np def draw_image(i): img = Image.fromarray(np.array(i, dtype=np.uint8), mode='L') return img """ def draw_weight_image(i): img = Image.fromarray(np.array(i, dtype=np.uint8), mode='L') """
26.666667
68
0.670833
41
240
3.853659
0.463415
0.088608
0.113924
0.177215
0.607595
0.607595
0.607595
0.607595
0.607595
0.607595
0
0.00995
0.1625
240
9
68
26.666667
0.776119
0
0
0
0
0
0.006993
0
0
0
0
0
0
1
0.2
false
0
0.4
0
0.8
0
0
0
0
null
0
0
1
0
0
0
0
0
1
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
68d5ef040400abace05fe702974fc6a54021864e
413
py
Python
DQMServices/Core/python/DQM_cfg.py
NTrevisani/cmssw
a212a27526f34eb9507cf8b875c93896e6544781
[ "Apache-2.0" ]
3
2018-08-24T19:10:26.000Z
2019-02-19T11:45:32.000Z
DQMServices/Core/python/DQM_cfg.py
NTrevisani/cmssw
a212a27526f34eb9507cf8b875c93896e6544781
[ "Apache-2.0" ]
8
2020-03-20T23:18:36.000Z
2020-05-27T11:00:06.000Z
DQMServices/Core/python/DQM_cfg.py
NTrevisani/cmssw
a212a27526f34eb9507cf8b875c93896e6544781
[ "Apache-2.0" ]
5
2018-08-21T16:37:52.000Z
2020-01-09T13:33:17.000Z
import FWCore.ParameterSet.Config as cms # needed backend from DQMServices.Core.DQMStore_cfi import * #Temporarily remove for thread safety reasons #DQM = cms.Service("DQM", # debug = cms.untracked.bool(False), # publishFrequency = cms.untracked.double(5.0), # collectorPort = cms.untracked.int32(9090), # collectorHost = cms.untracked.string('localhost'), # filter = cms.untracked.string('') #)
29.5
55
0.726392
49
413
6.102041
0.734694
0.200669
0.120401
0
0
0
0
0
0
0
0
0.022535
0.140436
413
13
56
31.769231
0.819718
0.743341
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
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
68d66c6cfb1838562d4964c8ac30862fd352136b
73
py
Python
modeling/miners/registry.py
melgor/metric_learning.pytorch
955f13b83382d6d79ef067f2275c6875498151ad
[ "MIT" ]
null
null
null
modeling/miners/registry.py
melgor/metric_learning.pytorch
955f13b83382d6d79ef067f2275c6875498151ad
[ "MIT" ]
null
null
null
modeling/miners/registry.py
melgor/metric_learning.pytorch
955f13b83382d6d79ef067f2275c6875498151ad
[ "MIT" ]
1
2020-08-11T09:32:19.000Z
2020-08-11T09:32:19.000Z
from fvcore.common.registry import Registry MINING = Registry("MINING")
18.25
43
0.794521
9
73
6.444444
0.666667
0.482759
0
0
0
0
0
0
0
0
0
0
0.109589
73
3
44
24.333333
0.892308
0
0
0
0
0
0.082192
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
ec1cd4e28474dcf00f7da412a6b2ebf026a9d7e4
6,359
py
Python
tests/test_pagesizes/test_units.py
domdfcoding/domdf_python_tools
eb15c744eac3005e13fae8d8a5582e955137cf22
[ "MIT" ]
null
null
null
tests/test_pagesizes/test_units.py
domdfcoding/domdf_python_tools
eb15c744eac3005e13fae8d8a5582e955137cf22
[ "MIT" ]
57
2020-06-16T15:48:20.000Z
2022-03-31T08:35:09.000Z
tests/test_pagesizes/test_units.py
domdfcoding/domdf_python_tools
eb15c744eac3005e13fae8d8a5582e955137cf22
[ "MIT" ]
null
null
null
# stdlib import re from operator import floordiv, truediv from typing import List, Union # 3rd party import pytest # this package from domdf_python_tools.pagesizes.units import Unit, Unitcm, UnitInch, Unitmm, Unitpc, Unitpt, Unitum units_of_12: List[Unit] = [Unit(12), UnitInch(12), Unitcm(12), Unitmm(12), Unitpc(12), Unitpt(12), Unitum(12)] zero2thousand: List[int] = list(range(0, 1000, 10)) one2thousand: List[int] = list(range(1, 1000, 10)) units_zero2thousand: List[Unit] = [Unit(x) for x in zero2thousand] units_ints_zero2thousand: List[Union[Unit, int]] = [*units_zero2thousand, *zero2thousand] @pytest.mark.parametrize("unit", units_of_12) def test_repr(unit): assert re.match(r"<Unit '12\.000 .*': .*pt", repr(unit)) @pytest.mark.parametrize("unit", units_of_12) def test_str(unit): assert re.match(r"<Unit '12\.000\u205F.*': .*pt", str(unit)) class TestMul: @pytest.mark.parametrize("obj", units_zero2thousand) def test_mul_errors(self, obj): with pytest.raises(NotImplementedError, match="Multiplying a unit by another unit is not allowed."): Unit(17) * obj # pylint: disable=expression-not-assigned @pytest.mark.parametrize("obj", zero2thousand) def test_mul(self, obj: int): assert obj * Unit(17) == obj * 17 assert obj * Unit(17 / 2) == obj * (17 / 2) @pytest.mark.parametrize("obj", units_zero2thousand) def test_rmul_errors(self, obj): with pytest.raises(NotImplementedError, match="Multiplying a unit by another unit is not allowed."): obj * Unit(17) # pylint: disable=expression-not-assigned @pytest.mark.parametrize("obj", units_ints_zero2thousand) def test_pow_errors(self, obj): with pytest.raises(NotImplementedError, match="Powers are not supported for units."): Unit(17)**obj # pylint: disable=expression-not-assigned if isinstance(obj, Unit): with pytest.raises(NotImplementedError, match="Powers are not supported for units."): obj**Unit(17) # pylint: disable=expression-not-assigned class TestDiv: @pytest.mark.parametrize("obj", one2thousand) def test_truediv(self, obj: int): assert truediv(Unit(17), obj) == 17 / obj assert truediv(Unit(17 / 2), obj) == (17 / 2) / obj @pytest.mark.parametrize("obj", units_zero2thousand) def test_truediv_errors(self, obj): with pytest.raises(NotImplementedError, match="Dividing a unit by another unit is not allowed."): truediv(Unit(17), obj) with pytest.raises(NotImplementedError, match="Dividing a unit by another unit is not allowed."): truediv(obj, Unit(17)) @pytest.mark.parametrize("obj", one2thousand) def test_floordiv(self, obj: int): assert floordiv(Unit(17), obj) == 17 // obj assert floordiv(Unit(17 / 2), obj) == (17 / 2) // obj @pytest.mark.parametrize("obj", units_zero2thousand) def test_floordiv_errors(self, obj): with pytest.raises(NotImplementedError, match="Dividing a unit by another unit is not allowed."): floordiv(Unit(17), obj) with pytest.raises(NotImplementedError, match="Dividing a unit by another unit is not allowed."): floordiv(obj, Unit(17)) @pytest.mark.parametrize("obj", units_zero2thousand) def test_modulo_errors(self, obj): with pytest.raises(NotImplementedError, match="Modulo division of a unit by another unit is not allowed."): Unit(17) % obj # pylint: disable=expression-not-assigned with pytest.raises(NotImplementedError, match="Modulo division of a unit by another unit is not allowed."): obj % Unit(17) # pylint: disable=expression-not-assigned @pytest.mark.parametrize("obj", one2thousand) def test_modulo(self, obj: int): assert Unit(17) % obj == 17 % obj @pytest.mark.parametrize("obj", zero2thousand) def test_rtruediv_errors(self, obj): with pytest.raises(NotImplementedError, match="Dividing by a unit is not allowed."): truediv(obj, Unit(17)) # TODO eq @pytest.mark.parametrize("unit", units_of_12) class TestAdd: @pytest.mark.parametrize("obj", zero2thousand) def test_add_unit(self, unit, obj: int): assert isinstance(unit + Unit(obj), Unit) assert (unit + Unit(obj)).name == unit.name assert (unit + Unit(obj)).as_pt() == unit.as_pt() + obj @pytest.mark.parametrize("obj", zero2thousand) def test_radd_unit(self, unit, obj: int): assert isinstance(Unit(obj) + unit, Unit) assert (Unit(obj) + unit).name == "pt" assert (Unit(obj) + unit).as_pt() == unit.as_pt() + obj @pytest.mark.parametrize("obj", zero2thousand) def test_add_number(self, unit, obj: int): assert isinstance(Unit(12) + obj, Unit) assert (Unit(12) + obj).name == "pt" assert (Unit(12) + obj).as_pt() == 12 + obj assert isinstance(UnitInch(1) + obj, Unit) assert (UnitInch(1) + obj).name == "inch" assert (UnitInch(1) + obj) == UnitInch.from_pt(72) + obj @pytest.mark.parametrize("obj", zero2thousand) def test_radd_number(self, unit, obj: int): assert isinstance(obj + Unit(12), Unit) assert (obj + Unit(12)).name == "pt" assert (obj + Unit(12)).as_pt() == 12 + obj assert isinstance(obj + UnitInch(1), Unit) assert (obj + UnitInch(1)).name == "inch" assert (obj + UnitInch(1)) == UnitInch.from_pt(72) + obj @pytest.mark.parametrize("unit", units_of_12) class TestSub: @pytest.mark.parametrize("obj", zero2thousand) def test_sub_unit(self, unit, obj: int): assert isinstance(unit + Unit(obj), Unit) assert (unit - Unit(obj)).name == unit.name assert (unit - Unit(obj)).as_pt() == unit.as_pt() - obj @pytest.mark.parametrize("obj", zero2thousand) def test_rsub_unit(self, unit, obj: int): assert isinstance(Unit(obj) - unit, Unit) assert (Unit(obj) - unit).name == "pt" assert (Unit(obj) - unit).as_pt() == obj - unit.as_pt() @pytest.mark.parametrize("obj", zero2thousand) def test_sub_number(self, unit, obj: int): assert isinstance(Unit(12) - obj, Unit) assert (Unit(12) - obj).name == "pt" assert (Unit(12) - obj).as_pt() == 12 - obj assert isinstance(UnitInch(1) - obj, Unit) assert (UnitInch(1) - obj).name == "inch" assert (UnitInch(1) - obj) == UnitInch.from_pt(72) - obj @pytest.mark.parametrize("obj", zero2thousand) def test_rsub_number(self, unit, obj: int): assert isinstance(obj + Unit(12), Unit) assert (obj - Unit(12)).name == "pt" assert (obj - Unit(12)).as_pt() == obj - 12 assert isinstance(obj - UnitInch(1), Unit) assert (obj - UnitInch(1)).name == "inch" assert (obj - UnitInch(1)) == obj - UnitInch.from_pt(72)
36.545977
110
0.703098
915
6,359
4.804372
0.10929
0.044586
0.109873
0.103731
0.825978
0.822338
0.809145
0.77434
0.628298
0.58667
0
0.034103
0.142318
6,359
173
111
36.757225
0.771911
0.04356
0
0.301587
0
0
0.108714
0
0
0
0
0.00578
0.357143
1
0.166667
false
0
0.039683
0
0.238095
0
0
0
0
null
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
ec1cdd38e19420adf497a3605b8f3a18ec684c93
39
py
Python
mypackage/submoduleD.py
mheikenfeld/package_testing
af87e50524659c7e9929e59278bb52a272a4e934
[ "MIT" ]
null
null
null
mypackage/submoduleD.py
mheikenfeld/package_testing
af87e50524659c7e9929e59278bb52a272a4e934
[ "MIT" ]
null
null
null
mypackage/submoduleD.py
mheikenfeld/package_testing
af87e50524659c7e9929e59278bb52a272a4e934
[ "MIT" ]
null
null
null
def do_D(): out="d" return out
9.75
14
0.512821
7
39
2.714286
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.333333
39
3
15
13
0.730769
0
0
0
0
0
0.025641
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
ec428f097306874710bf9903ca0a9e7a668376c3
111
py
Python
lti_django_skeleton/apps.py
groovy-tunes/lti_django_skeleton
c5136f99c2b527a0d4f081721aeb7a83a3d1c71e
[ "MIT" ]
null
null
null
lti_django_skeleton/apps.py
groovy-tunes/lti_django_skeleton
c5136f99c2b527a0d4f081721aeb7a83a3d1c71e
[ "MIT" ]
4
2020-02-12T00:10:38.000Z
2021-06-10T19:49:34.000Z
lti_django_skeleton/apps.py
groovy-tunes/lti_django_skeleton
c5136f99c2b527a0d4f081721aeb7a83a3d1c71e
[ "MIT" ]
null
null
null
from django.apps import AppConfig class LtiDjangoSkeletonConfig(AppConfig): name = 'lti_django_skeleton'
18.5
41
0.801802
12
111
7.25
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.135135
111
5
42
22.2
0.90625
0
0
0
0
0
0.171171
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
ec43fcbda3934b65c78def281aaec73f20ed4602
271
py
Python
plib/__init__.py
AutuanLiu/Machine-Learning-on-docker
00eb7211a3a40a9da02114923647dfd6ac24f138
[ "Apache-2.0" ]
11
2018-03-18T11:06:59.000Z
2020-02-23T03:24:43.000Z
plib/__init__.py
AutuanLiu/Machine-Learning-on-docker
00eb7211a3a40a9da02114923647dfd6ac24f138
[ "Apache-2.0" ]
null
null
null
plib/__init__.py
AutuanLiu/Machine-Learning-on-docker
00eb7211a3a40a9da02114923647dfd6ac24f138
[ "Apache-2.0" ]
4
2018-03-28T13:04:26.000Z
2019-05-29T05:49:52.000Z
from .barp import barp, stackedbarp, groupedbarp from .boxp import boxp from .histp import histp from .linep import linep from .overhistp import overhistp from .scatterp import scatterp __all__ = [histp, barp, boxp, scatterp, stackedbarp, groupedbarp, linep, overhistp]
30.111111
83
0.797048
35
271
6.057143
0.314286
0.207547
0
0
0
0
0
0
0
0
0
0
0.136531
271
8
84
33.875
0.905983
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.857143
0
0.857143
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
6b662b450b69e0d1ef8844b353f17d64bd478e8c
141
py
Python
vnpy/gateway/hbsdm/__init__.py
tienjunhsu/vnpy
be18953fbe74c408682a3ffd48e5fa93e2386284
[ "MIT" ]
null
null
null
vnpy/gateway/hbsdm/__init__.py
tienjunhsu/vnpy
be18953fbe74c408682a3ffd48e5fa93e2386284
[ "MIT" ]
null
null
null
vnpy/gateway/hbsdm/__init__.py
tienjunhsu/vnpy
be18953fbe74c408682a3ffd48e5fa93e2386284
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # @Time : 2020/4/22 11:27 # @Author : TienjunHsu # @FileName: __init__.py.py from .hbsdm_gateway import HbsdmGateway
23.5
39
0.680851
20
141
4.55
0.95
0
0
0
0
0
0
0
0
0
0
0.1
0.148936
141
5
40
28.2
0.658333
0.652482
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
6b791c9c5ba24e3fcc2fbfe2e08783261d649203
422
py
Python
morepath/tests/fixtures/abbr.py
DuncanBetts/morepath
acad10489b051df9c512f6735a9338854745a599
[ "BSD-3-Clause" ]
null
null
null
morepath/tests/fixtures/abbr.py
DuncanBetts/morepath
acad10489b051df9c512f6735a9338854745a599
[ "BSD-3-Clause" ]
null
null
null
morepath/tests/fixtures/abbr.py
DuncanBetts/morepath
acad10489b051df9c512f6735a9338854745a599
[ "BSD-3-Clause" ]
null
null
null
import morepath class app(morepath.App): pass class Model(object): def __init__(self, id): self.id = id @app.path(model=Model, path='{id}') def get_model(id): return Model(id) with app.view(model=Model) as view: @view() def default(self, request): return "Default view: %s" % self.id @view(name='edit') def edit(self, request): return "Edit view: %s" % self.id
16.230769
43
0.604265
61
422
4.098361
0.360656
0.096
0.136
0.088
0
0
0
0
0
0
0
0
0.246446
422
25
44
16.88
0.786164
0
0
0
0
0
0.087678
0
0
0
0
0
0
1
0.25
false
0.0625
0.0625
0.1875
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
4
6b8cd5b0baeba40372bd04a3a65a865b327c781a
1,301
py
Python
backend/stock/serializers.py
TopWebFullDev/Stock-chart-1
947f72fbb71af9762a12aa2b2c7d4aa2824cd165
[ "MIT" ]
null
null
null
backend/stock/serializers.py
TopWebFullDev/Stock-chart-1
947f72fbb71af9762a12aa2b2c7d4aa2824cd165
[ "MIT" ]
null
null
null
backend/stock/serializers.py
TopWebFullDev/Stock-chart-1
947f72fbb71af9762a12aa2b2c7d4aa2824cd165
[ "MIT" ]
null
null
null
from django.contrib.auth.models import User, Group from rest_framework import serializers from stock.models import PriceHistory from stock.models import SymbolList from stock.models import WatchList, PortfolioList, PortfolioSymbolList class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ['id', 'username', 'email', 'first_name', 'last_name', 'password'] class GroupSerializer(serializers.ModelSerializer): class Meta: model = Group fields = ['url', 'name'] class StockSerializer(serializers.ModelSerializer): class Meta: model = PriceHistory fields = ['id', 'symbol', 'volume', 'high', 'low', 'open', 'datetime', 'close'] class SymbolSerializer(serializers.ModelSerializer): class Meta: model = SymbolList fields = ['id', 'symbol'] class WatchSerializer(serializers.ModelSerializer): class Meta: model = WatchList fields = ['id', 'symbol'] class PortfolioSerializer(serializers.ModelSerializer): class Meta: model = PortfolioList fields = ['id', 'portfolio'] class PortfolioSymbolSerializer(serializers.ModelSerializer): class Meta: model = PortfolioSymbolList fields = ['id', 'portfolio', 'symbol', 'quantity', 'entry']
31.731707
87
0.687932
122
1,301
7.311475
0.385246
0.204036
0.243274
0.274664
0.313901
0
0
0
0
0
0
0
0.199846
1,301
41
88
31.731707
0.856868
0
0
0.272727
0
0
0.110599
0
0
0
0
0
0
1
0
false
0.030303
0.151515
0
0.575758
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
6ba72a4dd285cc91455cae9b87b150aa8405f2d8
55
py
Python
actions/models.py
ContrastingSounds/djax
9f07fa2e517c7231a02c6a37cfe6ab6f667353b3
[ "MIT" ]
1
2021-09-30T05:09:54.000Z
2021-09-30T05:09:54.000Z
actions/models.py
ContrastingSounds/djax
9f07fa2e517c7231a02c6a37cfe6ab6f667353b3
[ "MIT" ]
13
2019-12-26T17:10:35.000Z
2022-03-21T22:16:52.000Z
actions/models.py
ContrastingSounds/djax
9f07fa2e517c7231a02c6a37cfe6ab6f667353b3
[ "MIT" ]
null
null
null
# from django.contrib.postgres.fields import JSONField
27.5
54
0.836364
7
55
6.571429
1
0
0
0
0
0
0
0
0
0
0
0
0.090909
55
1
55
55
0.92
0.945455
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
6ba8ff7f237ad56743996fa735fe67205e1b7fa0
95
py
Python
lesson12/liyongli/devops/apps/bookmanger/apps.py
herrywen-nanj/51reboot
1130c79a360e1b548a6eaad176eb60f8bed22f40
[ "Apache-2.0" ]
null
null
null
lesson12/liyongli/devops/apps/bookmanger/apps.py
herrywen-nanj/51reboot
1130c79a360e1b548a6eaad176eb60f8bed22f40
[ "Apache-2.0" ]
null
null
null
lesson12/liyongli/devops/apps/bookmanger/apps.py
herrywen-nanj/51reboot
1130c79a360e1b548a6eaad176eb60f8bed22f40
[ "Apache-2.0" ]
null
null
null
from django.apps import AppConfig class BookmangerConfig(AppConfig): name = 'bookmanger'
15.833333
34
0.768421
10
95
7.3
0.9
0
0
0
0
0
0
0
0
0
0
0
0.157895
95
5
35
19
0.9125
0
0
0
0
0
0.105263
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
6bca60462e4e82e561787eceb9335981cf5a925e
25
py
Python
example_snippets/multimenus_snippets/Snippets/SciPy/Special functions/Spheroidal Wave Functions/pro_rad1 Prolate spheroidal radial function of the first kind and its derivative.py
kuanpern/jupyterlab-snippets-multimenus
477f51cfdbad7409eab45abe53cf774cd70f380c
[ "BSD-3-Clause" ]
null
null
null
example_snippets/multimenus_snippets/Snippets/SciPy/Special functions/Spheroidal Wave Functions/pro_rad1 Prolate spheroidal radial function of the first kind and its derivative.py
kuanpern/jupyterlab-snippets-multimenus
477f51cfdbad7409eab45abe53cf774cd70f380c
[ "BSD-3-Clause" ]
null
null
null
example_snippets/multimenus_snippets/Snippets/SciPy/Special functions/Spheroidal Wave Functions/pro_rad1 Prolate spheroidal radial function of the first kind and its derivative.py
kuanpern/jupyterlab-snippets-multimenus
477f51cfdbad7409eab45abe53cf774cd70f380c
[ "BSD-3-Clause" ]
1
2021-02-04T04:51:48.000Z
2021-02-04T04:51:48.000Z
special.pro_rad1(m,n,c,x)
25
25
0.76
7
25
2.571429
1
0
0
0
0
0
0
0
0
0
0
0.04
0
25
1
25
25
0.68
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
6bcfcb4a9012be68dd72909561a102bcf1136179
324
py
Python
tests/grooves/test_round.py
pyroll-project/pyroll-core
f59094d58c2f7493ddc6345b3afc4700ca259681
[ "BSD-3-Clause" ]
null
null
null
tests/grooves/test_round.py
pyroll-project/pyroll-core
f59094d58c2f7493ddc6345b3afc4700ca259681
[ "BSD-3-Clause" ]
null
null
null
tests/grooves/test_round.py
pyroll-project/pyroll-core
f59094d58c2f7493ddc6345b3afc4700ca259681
[ "BSD-3-Clause" ]
null
null
null
from numpy import pi, isclose from pyroll.core import RoundGroove def test_round(): g = RoundGroove(depth=15.55, r1=2, r2=15.8) assert isclose(g.usable_width, 31.79180677) assert isclose(g.alpha1, 82.738129 / 180 * pi) assert isclose(g.alpha2, 82.738129 / 180 * pi) assert isclose(g.z1, 17.65722232)
24.923077
50
0.694444
52
324
4.288462
0.615385
0.233184
0.251121
0.116592
0.242152
0.242152
0.242152
0
0
0
0
0.208333
0.185185
324
12
51
27
0.636364
0
0
0
0
0
0
0
0
0
0
0
0.5
1
0.125
false
0
0.25
0
0.375
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
6bd646a75fecd55284419056bf9a471c4704c386
287
py
Python
App/softwares_env/softwares/nuke_wizard/init.py
Wizard-collab/wizard
c2ec623fe011626716493c232b895fb0513f68ff
[ "MIT" ]
null
null
null
App/softwares_env/softwares/nuke_wizard/init.py
Wizard-collab/wizard
c2ec623fe011626716493c232b895fb0513f68ff
[ "MIT" ]
null
null
null
App/softwares_env/softwares/nuke_wizard/init.py
Wizard-collab/wizard
c2ec623fe011626716493c232b895fb0513f68ff
[ "MIT" ]
null
null
null
import nuke from nuke_wizard import plugin from wizard.vars import defaults import sys import os from nuke_wizard import reference_asset reload(reference_asset) ''' nuke.menu( 'Nuke' ).addCommand( 'Wizard/Save', plugin.save, icon='nuke_save.png') reference_asset.set_project_path() '''
22.076923
81
0.794425
42
287
5.238095
0.47619
0.190909
0.127273
0.181818
0
0
0
0
0
0
0
0
0.101045
287
12
82
23.916667
0.852713
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.857143
0
0.857143
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
6bf50a0b9341af2d6fdefb1a6115523291a72c1f
490
py
Python
EnvBase.py
joshuahseaton/lcss-2022
396bc9f10523fc677576e70c8bb14714ae25d083
[ "MIT" ]
null
null
null
EnvBase.py
joshuahseaton/lcss-2022
396bc9f10523fc677576e70c8bb14714ae25d083
[ "MIT" ]
null
null
null
EnvBase.py
joshuahseaton/lcss-2022
396bc9f10523fc677576e70c8bb14714ae25d083
[ "MIT" ]
2
2022-03-15T16:36:15.000Z
2022-03-15T16:52:00.000Z
from __future__ import annotations from abc import abstractmethod, ABC class Env(ABC): @abstractmethod def agents(self): pass class Agent(ABC): def __init__(self, name: str): self._name = name @property def name(self) -> str: return self._name def __str__(self): return self.name class ActionSpace: def get_action_set(self, agent: Agent) -> ActionSet: pass class ActionSet: pass
16.333333
57
0.6
56
490
4.964286
0.410714
0.115108
0.100719
0
0
0
0
0
0
0
0
0
0.322449
490
29
58
16.896552
0.837349
0
0
0.157895
0
0
0
0
0
0
0
0
0
1
0.263158
false
0.157895
0.105263
0.105263
0.684211
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
4
6bf824f6eb375529c98bd8fa7e6b0b36872a1255
140
py
Python
TankPy/test.py
kmcgill88/TankPy
5c214eb452dce6669fd64e0c17b04c02d8709e88
[ "MIT" ]
null
null
null
TankPy/test.py
kmcgill88/TankPy
5c214eb452dce6669fd64e0c17b04c02d8709e88
[ "MIT" ]
null
null
null
TankPy/test.py
kmcgill88/TankPy
5c214eb452dce6669fd64e0c17b04c02d8709e88
[ "MIT" ]
null
null
null
import datetime from dateutil import tz on_off = "OFF" now = datetime.now(tz=tz.gettz('America/Chicago')) print "%s: %s" % (now, on_off)
15.555556
50
0.685714
23
140
4.086957
0.565217
0.106383
0
0
0
0
0
0
0
0
0
0
0.15
140
8
51
17.5
0.789916
0
0
0
0
0
0.172662
0
0
0
0
0
0
0
null
null
0
0.4
null
null
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
1
0
0
0
1
0
0
0
0
4
d41d4613caf54cdb7368daefa715b5cf9354de93
354
py
Python
docsie_universal_importer/providers/google_drive/serializers.py
LikaloLLC/docsie-universal-doc-importer
8db9c705971c71f0152b0d4177ea6eb241021843
[ "BSD-3-Clause" ]
null
null
null
docsie_universal_importer/providers/google_drive/serializers.py
LikaloLLC/docsie-universal-doc-importer
8db9c705971c71f0152b0d4177ea6eb241021843
[ "BSD-3-Clause" ]
16
2021-06-16T15:00:41.000Z
2021-06-30T11:57:15.000Z
docsie_universal_importer/providers/google_drive/serializers.py
LikaloLLC/docsie-universal-doc-importer
8db9c705971c71f0152b0d4177ea6eb241021843
[ "BSD-3-Clause" ]
1
2021-11-17T19:24:45.000Z
2021-11-17T19:24:45.000Z
from docsie_universal_importer.providers.base import StorageTreeRequestSerializer, DownloaderRequestSerializer from .file import GoogleDriveFile class GoogleDriveStorageTreeRequestSerializer(StorageTreeRequestSerializer): pass class GoogleDriveDownloaderSerializer(DownloaderRequestSerializer): class Meta: file_cls = GoogleDriveFile
29.5
110
0.855932
25
354
12
0.68
0
0
0
0
0
0
0
0
0
0
0
0.110169
354
11
111
32.181818
0.952381
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.142857
0.285714
0
0.714286
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
4
d435cfb4c52ce51a06eae5cd686a699daebb4ac6
1,423
py
Python
apps/bednets/urls.py
rapidsms/rapidsms-legacy
43c2ecd41fd1541a2538326edee3d9e816d84529
[ "BSD-3-Clause" ]
null
null
null
apps/bednets/urls.py
rapidsms/rapidsms-legacy
43c2ecd41fd1541a2538326edee3d9e816d84529
[ "BSD-3-Clause" ]
null
null
null
apps/bednets/urls.py
rapidsms/rapidsms-legacy
43c2ecd41fd1541a2538326edee3d9e816d84529
[ "BSD-3-Clause" ]
1
2019-11-02T19:35:54.000Z
2019-11-02T19:35:54.000Z
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import os from django.conf.urls.defaults import * import bednets.views as views urlpatterns = patterns('', url(r'^locgen/?$', views.generate), url(r'^bednets/?$', views.index), url(r'^bednets/summary/(?P<locid>\d*)/?$', views.index), url(r'^bednets/json/?$', views.location_tree), url(r'^bednets/logistics/summary/(?P<locid>\d*)/?$', views.logistics_summary), url(r'^bednets/coupons/summary/(?P<locid>\d*)/?$', views.coupons_summary), url(r'^bednets/bednets/summary/(?P<locid>\d*)/?$', views.bednets_summary), url(r'^bednets/supply/summary/(?P<range>.*)/?(?P<from>.*)/?(?P<to>.*)/?$', views.supply_summary), url(r'^bednets/bednets/daily/(?P<locid>\d*)/?$', views.bednets_daily), url(r'^bednets/bednets/weekly/(?P<locid>\d*)/?$', views.bednets_weekly), url(r'^bednets/bednet/monthly/(?P<locid>\d*)/?$', views.bednets_monthly), url(r'^bednets/coupons/daily/(?P<locid>\d*)/?$', views.coupons_daily), url(r'^bednets/coupons/weekly/(?P<locid>\d*)/?$', views.coupons_weekly), url(r'^bednets/coupons/monthly/(?P<locid>\d*)/?$', views.coupons_monthly), url(r'^bednets/supply/daily/(?P<locid>\d*)/?$', views.supply_daily), url(r'^bednets/supply/weekly/(?P<locid>\d*)/?$', views.supply_weekly), url(r'^bednets/supply/monthly/(?P<locid>\d*)/?$', views.supply_monthly), url(r'^bednets/test/?$', views.index) )
50.821429
101
0.641602
206
1,423
4.364078
0.218447
0.080089
0.208009
0.173526
0.443826
0.057842
0
0
0
0
0
0.002326
0.093465
1,423
27
102
52.703704
0.694574
0.033029
0
0
1
0
0.47016
0.431587
0
0
0
0
0
1
0
false
0
0.130435
0
0.130435
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
1
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
d43a497e81898e3fabbd0d1f6c9139a41ee7e91d
172
py
Python
station/apps.py
rvadim/autosesrvice
34e4dcc6040568ab344743889d7ee10f3377015b
[ "MIT" ]
null
null
null
station/apps.py
rvadim/autosesrvice
34e4dcc6040568ab344743889d7ee10f3377015b
[ "MIT" ]
null
null
null
station/apps.py
rvadim/autosesrvice
34e4dcc6040568ab344743889d7ee10f3377015b
[ "MIT" ]
null
null
null
from django.apps import AppConfig from django.utils.translation import ugettext as _ class StationConfig(AppConfig): name = 'station' verbose_name = _('Station')
21.5
50
0.755814
20
172
6.35
0.7
0.15748
0
0
0
0
0
0
0
0
0
0
0.162791
172
7
51
24.571429
0.881944
0
0
0
0
0
0.081395
0
0
0
0
0
0
1
0
false
0
0.4
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
d4420b8e9ee57881fc82791f0274420cb320cafd
257
py
Python
easygraph/readwrite/pickle.py
tddschn/Easy-Graph
2cdecbde0b67a0c106e2bcf82d13c6fcd0b4c5d8
[ "BSD-3-Clause" ]
1
2022-03-19T11:29:42.000Z
2022-03-19T11:29:42.000Z
easygraph/readwrite/pickle.py
tddschn/Easy-Graph
2cdecbde0b67a0c106e2bcf82d13c6fcd0b4c5d8
[ "BSD-3-Clause" ]
null
null
null
easygraph/readwrite/pickle.py
tddschn/Easy-Graph
2cdecbde0b67a0c106e2bcf82d13c6fcd0b4c5d8
[ "BSD-3-Clause" ]
null
null
null
#!/usr/bin/env python3 def read_pickle(file_name): import pickle with open(file_name, 'rb') as f: return pickle.load(f) def write_pickle(file_name, obj): import pickle with open(file_name, 'wb') as f: pickle.dump(obj, f)
18.357143
36
0.642023
41
257
3.878049
0.512195
0.201258
0.176101
0.251572
0.352201
0.352201
0
0
0
0
0
0.005102
0.237354
257
13
37
19.769231
0.806122
0.081712
0
0.25
0
0
0.017021
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.625
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
d449ae0d8788125a00c58ad9557c704fdd22eccb
372
py
Python
__init__.py
GaboDev98/football-information-skill
d91f4a68af7db7fda5cbfdc9e697bdfc9a8de055
[ "Apache-2.0" ]
null
null
null
__init__.py
GaboDev98/football-information-skill
d91f4a68af7db7fda5cbfdc9e697bdfc9a8de055
[ "Apache-2.0" ]
null
null
null
__init__.py
GaboDev98/football-information-skill
d91f4a68af7db7fda5cbfdc9e697bdfc9a8de055
[ "Apache-2.0" ]
null
null
null
from mycroft import MycroftSkill, intent_file_handler class FootballInformation(MycroftSkill): def __init__(self): MycroftSkill.__init__(self) @intent_file_handler('information.football.intent') def handle_information_football(self, message): self.speak_dialog('information.football') def create_skill(): return FootballInformation()
23.25
55
0.760753
38
372
7.026316
0.552632
0.213483
0.127341
0
0
0
0
0
0
0
0
0
0.153226
372
15
56
24.8
0.847619
0
0
0
0
0
0.126685
0.072776
0
0
0
0
0
1
0.333333
false
0
0.111111
0.111111
0.666667
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
d48010113c74f86004054600a9906996e3c155a7
1,688
py
Python
labs/main.py
eocode/Queens
11a08a315dc76e7d2ddc9c742380dcfa9fd58e23
[ "BSD-3-Clause" ]
null
null
null
labs/main.py
eocode/Queens
11a08a315dc76e7d2ddc9c742380dcfa9fd58e23
[ "BSD-3-Clause" ]
null
null
null
labs/main.py
eocode/Queens
11a08a315dc76e7d2ddc9c742380dcfa9fd58e23
[ "BSD-3-Clause" ]
null
null
null
from simulation.simulation import Simulation from utilities.time import count_elapsed_time @count_elapsed_time def run(n): simulation = Simulation(n) solutions = simulation.start2() print("------------------") print("Solutions") print(len(solutions.get_solutions())) # for i in solutions.get_solutions().values(): # print(i.get_board(), i.get_solution_id(), i.get_safe_x(), i.get_track_solution(), i.get_value_track(), '-', # i.x_values) # print('------------------') # print(len(solutions.get_solutions())) @count_elapsed_time def run2(n): simulation = Simulation(n) solutions = simulation.start() print("------------------") print("Solutions") print(len(solutions.get_solutions())) # for i in solutions.get_solutions().values(): # print(i.get_board(), i.get_solution_id(), i.get_safe_x(), i.get_track_solution(), i.get_value_track(), '-', # i.x_values) # print('------------------') # print(len(solutions.get_solutions())) @count_elapsed_time def run3(n): simulation = Simulation(n) simulation.start3() # print('------------------') # print('Solutions') # print(len(solutions.get_solutions())) # for i in solutions.get_solutions().values(): # print(i.get_board(), i.get_solution_id(), i.get_safe_x(), i.get_track_solution(), i.get_value_track(), '-', # i.x_values) # print('------------------') # print(len(solutions.get_solutions())) @count_elapsed_time def run4(n): simulation = Simulation(n) simulation.start4() if __name__ == "__main__": n = 13 # run(n) # run2(n) # run3(n) run4(n)
28.610169
117
0.593009
203
1,688
4.650246
0.17734
0.063559
0.200212
0.127119
0.822034
0.754237
0.667373
0.667373
0.667373
0.667373
0
0.008041
0.189573
1,688
58
118
29.103448
0.682018
0.498815
0
0.518519
0
0
0.075243
0
0
0
0
0
0
1
0.148148
false
0
0.074074
0
0.222222
0.222222
0
0
0
null
0
1
0
1
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
d4848d298bb869bd40cc70afba7bf3e8ef69d851
83
py
Python
djYMDB/ymdb/apps.py
scadl/elYMDBdj
ba58fe9ec3202bfa535fba11aff88266d2e13b1e
[ "MIT" ]
1
2021-03-07T04:45:24.000Z
2021-03-07T04:45:24.000Z
ymdb/apps.py
scadl/djYMDB
a9c26f1300d45e66a1ce610185f613ca69ea30e8
[ "MIT" ]
1
2022-03-25T18:38:50.000Z
2022-03-25T18:38:50.000Z
ymdb/apps.py
scadl/djYMDB
a9c26f1300d45e66a1ce610185f613ca69ea30e8
[ "MIT" ]
null
null
null
from django.apps import AppConfig class YmdbConfig(AppConfig): name = 'ymdb'
13.833333
33
0.73494
10
83
6.1
0.9
0
0
0
0
0
0
0
0
0
0
0
0.180723
83
5
34
16.6
0.897059
0
0
0
0
0
0.048193
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
2e09e497502850c645e360f495aded36650cbc20
22,399
py
Python
tests/test_logging.py
michaelawyu/nanopie
32e84f072d03a6b3eff33920c929546c81969a64
[ "Apache-2.0" ]
1
2020-09-02T22:34:10.000Z
2020-09-02T22:34:10.000Z
tests/test_logging.py
michaelawyu/nanopie
32e84f072d03a6b3eff33920c929546c81969a64
[ "Apache-2.0" ]
null
null
null
tests/test_logging.py
michaelawyu/nanopie
32e84f072d03a6b3eff33920c929546c81969a64
[ "Apache-2.0" ]
null
null
null
import ast import datetime import logging import time import socket from unittest.mock import MagicMock import uuid import pytest from .marks import fluentd_installed, docker_installed, stackdriver_installed from nanopie import StringField from nanopie.globals import request from nanopie.logger import logger as package_logger from nanopie.logging import ( LogContext, LogContextExtractor, LoggingHandler, LoggingHandlerModes, ) from nanopie.logging.fluentd import FLUENT_INSTALLED, FluentdLoggingHandler from nanopie.logging.logstash import LogstashLoggingHandler from nanopie.logging.stackdriver import STACKDRIVER_INSTALLED, StackdriverLoggingHandler DEFAULT_LOGGER_NAME = "test" @pytest.fixture def simple_logging_handler(): logging_handler = LoggingHandler() yield logging_handler logging_handler.default_logger.handlers = [] @pytest.fixture def teardown_remove_logger_handlers(): yield None logger = logging.getLogger(DEFAULT_LOGGER_NAME) logger.handlers = [] @pytest.fixture def fluentd_container(): try: import docker except ImportError: raise ImportError( "The docker (https://pypi.org/project/docker/)" "package is required to run this test. To " "install this package, run `pip install docker`." ) docker_client = docker.from_env() fluentd_container = docker_client.containers.run( image="nanopie-test/fluentd", ports={24224: 24224}, detach=True ) time.sleep(10) yield fluentd_container fluentd_container.kill() @pytest.fixture def logstash_container(): try: import docker except ImportError: raise ImportError( "The docker (https://pypi.org/project/docker/)" "package is required to run this test. To " "install this package, run `pip install docker`." ) docker_client = docker.from_env() logstash_container = docker_client.containers.run( image="nanopie-test/logstash", ports={"9600/tcp": 9600, "9600/udp": 9600}, detach=True, environment={"XPACK_MONITORING_ENABLED": "False"}, ) time.sleep(40) yield logstash_container logstash_container.kill() @pytest.fixture def stackdriver_logging_client(): try: from google.cloud import logging except ImportError: raise ImportError( "The google-cloud-logging " "(https://pypi.org/project/google-cloud-logging/)" "package is required to run this test. To " "install this package, run `pip install google-cloud-logging`." ) stackdriver_logging_client = logging.Client() return stackdriver_logging_client def test_logging_handler(caplog, capsys, simple_logging_handler): with caplog.at_level(logging.INFO): res = simple_logging_handler() assert res == None assert caplog.record_tuples[0] == ( "nanopie.logging.base", 20, "Entering span unspecified_span.", ) assert caplog.record_tuples[1] == ( "nanopie.logging.base", 20, "Exiting span unspecified_span.", ) captured = capsys.readouterr() stderr_outputs = captured.err.split("\n") log_output_1 = ast.literal_eval(stderr_outputs[0]) log_output_2 = ast.literal_eval(stderr_outputs[1]) assert log_output_1["host"] == socket.gethostname() assert log_output_1["logger"] == "nanopie.logging.base" assert log_output_1["level"] == "INFO" assert log_output_1["module"] == "base" assert log_output_1["func"] == "__call__" assert log_output_1["message"] == "Entering span unspecified_span." assert log_output_2["host"] == socket.gethostname() assert log_output_2["logger"] == "nanopie.logging.base" assert log_output_2["level"] == "INFO" assert log_output_2["module"] == "base" assert log_output_2["func"] == "__call__" assert log_output_2["message"] == "Exiting span unspecified_span." def test_logging_handler_dikt_message(caplog, capsys, simple_logging_handler): logger = simple_logging_handler.default_logger with caplog.at_level(logging.INFO): logger.info({"key": "value"}) assert caplog.record_tuples[0] == ("nanopie.logging.base", 20, "{'key': 'value'}") captured = capsys.readouterr() stderr_outputs = captured.err.split("\n") log_output = ast.literal_eval(stderr_outputs[0]) assert log_output["host"] == socket.gethostname() assert log_output["logger"] == "nanopie.logging.base" assert log_output["level"] == "INFO" assert log_output["module"] == "test_logging" assert log_output["func"] == "test_logging_handler_dikt_message" assert log_output["key"] == "value" def test_logging_handler_get_logger(caplog, capsys, simple_logging_handler): logger = simple_logging_handler.getLogger("test_logger") with caplog.at_level(logging.INFO): logger.info("This is a test message.") assert caplog.record_tuples[0] == ("test_logger", 20, "This is a test message.") captured = capsys.readouterr() stderr_outputs = captured.err.split("\n") log_output = ast.literal_eval(stderr_outputs[0]) assert log_output["host"] == socket.gethostname() assert log_output["logger"] == "test_logger" assert log_output["level"] == "INFO" assert log_output["module"] == "test_logging" assert log_output["func"] == "test_logging_handler_get_logger" assert log_output["message"] == "This is a test message." def test_logging_handler_get_logger_failure_no_name(simple_logging_handler): with pytest.raises(ValueError) as ex: simple_logging_handler.getLogger("") assert "use setup_root_logger method instead" in str(ex.value) def test_logging_handler_setup_root_logger(caplog, capsys, simple_logging_handler): child_logger = logging.getLogger("child") child_logger.setLevel(logging.INFO) child_logger.addHandler(logging.StreamHandler()) root_logger = simple_logging_handler.setup_root_logger( excluded_loggers=["child"], append_handlers=True ) assert root_logger.name == "root" assert root_logger.parent == None assert child_logger.propagate == False with caplog.at_level(logging.INFO): root_logger.info("This is a test message from root logger.") child_logger.info("This is a test message from child logger.") assert len(caplog.record_tuples) == 1 assert caplog.record_tuples[0] == ( "root", 20, "This is a test message from root logger.", ) captured = capsys.readouterr() stderr_outputs = captured.err.split("\n") log_output_1 = ast.literal_eval(stderr_outputs[0]) log_output_2 = stderr_outputs[1] assert log_output_1["host"] == socket.gethostname() assert log_output_1["logger"] == "root" assert log_output_1["level"] == "INFO" assert log_output_1["module"] == "test_logging" assert log_output_1["func"] == "test_logging_handler_setup_root_logger" assert log_output_1["message"] == "This is a test message from root logger." assert log_output_2 == "This is a test message from child logger." def test_logging_handler_log_level(caplog, capsys, teardown_remove_logger_handlers): logging_handler = LoggingHandler( default_logger_name=DEFAULT_LOGGER_NAME, level=logging.WARNING ) with caplog.at_level(logging.DEBUG): logging_handler() captured = capsys.readouterr() stdout_outputs = captured.out stderr_outputs = captured.err assert stdout_outputs == "" assert stderr_outputs == "" def test_logging_handler_custom_fmt(caplog, capsys, teardown_remove_logger_handlers): fmt = { "logger": "%(name)s", "level": "%(levelname)s", "module": "%(module)s", "func": "%(funcName)s", "levelno": "%(levelno)s", } logging_handler = LoggingHandler(default_logger_name=DEFAULT_LOGGER_NAME, fmt=fmt) logger = logging_handler.default_logger with caplog.at_level(logging.INFO): logger.info("This is a test message.") assert len(caplog.record_tuples) == 1 assert caplog.record_tuples[0] == ( DEFAULT_LOGGER_NAME, 20, "This is a test message.", ) captured = capsys.readouterr() stderr_outputs = captured.err.split("\n") log_output = ast.literal_eval(stderr_outputs[0]) assert log_output["logger"] == DEFAULT_LOGGER_NAME assert log_output["level"] == "INFO" assert log_output["module"] == "test_logging" assert log_output["func"] == "test_logging_handler_custom_fmt" assert log_output["levelno"] == "20" def test_logging_handler_custom_datefmt( caplog, capsys, teardown_remove_logger_handlers ): fmt = {"logger": "%(name)s", "time": "%(asctime)s"} datefmt = "custom-datefmt-%Y-%m-%d %H:%M:%S,uuu" logging_handler = LoggingHandler( default_logger_name=DEFAULT_LOGGER_NAME, fmt=fmt, datefmt=datefmt ) logger = logging_handler.default_logger with caplog.at_level(logging.INFO): logger.info("This is a test message.") assert len(caplog.record_tuples) == 1 assert caplog.record_tuples[0] == ( DEFAULT_LOGGER_NAME, 20, "This is a test message.", ) captured = capsys.readouterr() stderr_outputs = captured.err.split("\n") log_output = ast.literal_eval(stderr_outputs[0]) assert log_output["logger"] == DEFAULT_LOGGER_NAME assert "custom-datefmt" in log_output["time"] def test_logging_handler_custom_style_bracket( caplog, capsys, teardown_remove_logger_handlers ): logging_handler = LoggingHandler(style="{", default_logger_name=DEFAULT_LOGGER_NAME) logger = logging_handler.default_logger with caplog.at_level(logging.INFO): logger.info("This is a test message.") assert len(caplog.record_tuples) == 1 assert caplog.record_tuples[0] == ( DEFAULT_LOGGER_NAME, 20, "This is a test message.", ) captured = capsys.readouterr() stderr_outputs = captured.err.split("\n") log_output = ast.literal_eval(stderr_outputs[0]) assert log_output["host"] == socket.gethostname() assert log_output["logger"] == "test" assert log_output["level"] == "INFO" assert log_output["module"] == "test_logging" assert log_output["func"] == "test_logging_handler_custom_style_bracket" def test_logging_handler_custom_style_percent( caplog, capsys, teardown_remove_logger_handlers ): logging_handler = LoggingHandler(style="$", default_logger_name=DEFAULT_LOGGER_NAME) logger = logging_handler.default_logger with caplog.at_level(logging.INFO): logger.info("This is a test message.") assert len(caplog.record_tuples) == 1 assert caplog.record_tuples[0] == ( DEFAULT_LOGGER_NAME, 20, "This is a test message.", ) captured = capsys.readouterr() stderr_outputs = captured.err.split("\n") log_output = ast.literal_eval(stderr_outputs[0]) assert log_output["host"] == socket.gethostname() assert log_output["logger"] == "test" assert log_output["level"] == "INFO" assert log_output["module"] == "test_logging" assert log_output["func"] == "test_logging_handler_custom_style_percent" def test_logging_handler_quiet_mode(caplog, capsys, teardown_remove_logger_handlers): fmt = {"logger": "%(name)s", "missing_key": "%(missing_key)s"} logging_handler = LoggingHandler( default_logger_name=DEFAULT_LOGGER_NAME, fmt=fmt, quiet=True ) logger = logging_handler.default_logger logger.info("This is a test message.") assert len(caplog.record_tuples) == 1 assert caplog.record_tuples[0] == ( DEFAULT_LOGGER_NAME, 20, "This is a test message.", ) captured = capsys.readouterr() stderr_outputs = captured.err.split("\n") log_output = ast.literal_eval(stderr_outputs[0]) assert log_output["logger"] == "test" assert log_output.get("missing_key") == None def test_logging_handler_log_context_extractor( caplog, capsys, setup_ctx, teardown_remove_logger_handlers ): class LoggingContext(LogContext): key = StringField() class LoggingContextExtractor(LogContextExtractor): def extract(self, request): value = request.headers.get("key") return LoggingContext(key=value) request.headers = {"key": "value"} # pylint: disable=assigning-non-slot log_ctx_extractor = LoggingContextExtractor() logging_handler = LoggingHandler( default_logger_name=DEFAULT_LOGGER_NAME, log_ctx_extractor=log_ctx_extractor ) logger = logging_handler.default_logger logger.info("This is a test message.") assert len(caplog.record_tuples) == 1 assert caplog.record_tuples[0] == ( DEFAULT_LOGGER_NAME, 20, "This is a test message.", ) captured = capsys.readouterr() stderr_outputs = captured.err.split("\n") log_output = ast.literal_eval(stderr_outputs[0]) assert log_output.get("key") == "value" def test_logging_handler_failure_no_style( caplog, capsys, teardown_remove_logger_handlers ): with pytest.raises(ValueError) as ex: logging_handler = LoggingHandler( default_logger_name=DEFAULT_LOGGER_NAME, style="^" ) logger = logging_handler.default_logger # pylint: disable=unused-variable assert "Style must be one of" in str(ex.value) def test_logging_handler_failure_unfulfilled_key_in_fmt( caplog, capsys, teardown_remove_logger_handlers ): fmt = {"logger": "%(name)s", "missing_key": "%(missing_key)s"} logging_handler = LoggingHandler( default_logger_name=DEFAULT_LOGGER_NAME, fmt=fmt, quiet=False ) logger = logging_handler.default_logger logger.info("This is a test message.") captured = capsys.readouterr() assert "KeyError" in captured.err assert "missing_key" in captured.err def test_logging_handler_failure_log_context_extraction_error( caplog, capsys, setup_ctx, teardown_remove_logger_handlers ): class LoggingContextExtractor(LogContextExtractor): def extract(self, request): raise RuntimeError log_ctx_extractor = LoggingContextExtractor() logging_handler = LoggingHandler( default_logger_name=DEFAULT_LOGGER_NAME, quiet=False, log_ctx_extractor=log_ctx_extractor, ) logger = logging_handler.default_logger logger.info("This is a test message.") captured = capsys.readouterr() assert "Cannot extract log context" in captured.err assert "RuntimeError" in captured.err def test_logging_handler_get_log_ctx(): class LoggingContext(LogContext): key = StringField() class LoggingContextExtractor(LogContextExtractor): def extract(self, request): value = request.headers.get("key") return LoggingContext(key=value) request.headers = {"key": "value"} # pylint: disable=assigning-non-slot log_ctx_extractor = LoggingContextExtractor() logging_handler = LoggingHandler( default_logger_name=DEFAULT_LOGGER_NAME, log_ctx_extractor=log_ctx_extractor ) log_ctx = logging_handler.get_log_ctx() assert log_ctx.key == "value" @docker_installed @fluentd_installed def test_fluentd_logging_handler(teardown_remove_logger_handlers, fluentd_container): assert fluentd_container.status in ["created", "running"] time.sleep(10) fluentd_logging_handler = FluentdLoggingHandler( default_logger_name=DEFAULT_LOGGER_NAME, ) logger = fluentd_logging_handler.default_logger logger.info("This is a test message.") time.sleep(20) logs = fluentd_container.logs().decode() assert "app" in logs assert "host" in logs assert socket.gethostname() in logs assert "logger" in logs assert DEFAULT_LOGGER_NAME in logs assert "level" in logs assert "INFO" in logs assert "module" in logs assert "test_logging" in logs assert "func" in logs assert "test_fluentd_logging_handler" in logs assert "message" in logs assert "This is a test message" in logs @pytest.mark.skipif(FLUENT_INSTALLED, reason="requires that fluentd is not installed") def test_fluentd_logging_handler_failure_fluentd_not_installed(): with pytest.raises(ImportError) as ex: fluentd_logging_handler = ( FluentdLoggingHandler( # pylint: disable=unused-variable default_logger_name=DEFAULT_LOGGER_NAME ) ) assert "fluent-logger" in str(ex.value) @docker_installed def test_logstash_logging_handler_tcp( teardown_remove_logger_handlers, logstash_container ): assert logstash_container.status in ["created", "running"] time.sleep(10) logstash_logging_handler = LogstashLoggingHandler( default_logger_name=DEFAULT_LOGGER_NAME ) logger = logstash_logging_handler.default_logger logger.info("This is a test message.") time.sleep(20) logs = logstash_container.logs().decode() assert "app" in logs assert "host" in logs assert socket.gethostname() in logs assert "logger" in logs assert DEFAULT_LOGGER_NAME in logs assert "level" in logs assert "INFO" in logs assert "module" in logs assert "test_logging" in logs assert "func" in logs assert "test_fluentd_logging_handler" in logs assert "message" in logs assert "This is a test message" in logs @docker_installed def test_logstash_logging_handler_udp( teardown_remove_logger_handlers, logstash_container ): assert logstash_container.status in ["created", "running"] time.sleep(10) logstash_logging_handler = LogstashLoggingHandler( default_logger_name=DEFAULT_LOGGER_NAME, use_udp=True ) logger = logstash_logging_handler.default_logger logger.info("This is a test message.") time.sleep(20) logs = logstash_container.logs().decode() assert "app" in logs assert "host" in logs assert socket.gethostname() in logs assert "logger" in logs assert DEFAULT_LOGGER_NAME in logs assert "level" in logs assert "INFO" in logs assert "module" in logs assert "test_logging" in logs assert "func" in logs assert "test_fluentd_logging_handler" in logs assert "message" in logs assert "This is a test message" in logs @pytest.mark.skipif( STACKDRIVER_INSTALLED, reason="requires that google-cloud-logging is not installed" ) def test_stackdriver_logging_handler_failure_stackdriver_not_installed(): with pytest.raises(ImportError) as ex: stackdriver_logging_handler = ( StackdriverLoggingHandler( # pylint: disable=unused-variable client=None, default_logger_name=DEFAULT_LOGGER_NAME ) ) assert "google-cloud-logging" in str(ex.value) @stackdriver_installed def test_stackdriver_logging_handler_sync( teardown_remove_logger_handlers, stackdriver_logging_client ): try: from google.cloud.logging.resource import Resource except ImportError: raise ImportError( "The google-cloud-logging " "(https://pypi.org/project/google-cloud-logging/)" "package is required to run this test. To " "install this package, run `pip install google-cloud-logging`." ) identifier = str(uuid.uuid4()) resource = Resource( type="generic_node", labels={ "location": "us-central1-a", "namespace": "default", "node_id": identifier, }, ) stackdriver_logging_handler = StackdriverLoggingHandler( client=stackdriver_logging_client, default_logger_name=DEFAULT_LOGGER_NAME, resource=resource, ) logger = stackdriver_logging_handler.default_logger logger.info("This is a test message.") time.sleep(20) _filter = ( 'resource.type = "generic_node" AND resource.labels.node_id = "{}"'.format( identifier ) ) entries = [] for entry in stackdriver_logging_client.list_entries(filter_=_filter): entries.append(entry) assert len(entries) == 1 log = str(entries[0]) assert "host" in log assert socket.gethostname() in log assert "logger" in log assert DEFAULT_LOGGER_NAME in log assert "level" in log assert "INFO" in log assert "module" in log assert "test_logging" in log assert "func" in log assert "test_fluentd_logging_handler" in log assert "message" in log assert "This is a test message" in log @stackdriver_installed def test_stackdriver_logging_handler_background_thread(): try: from google.cloud.logging.resource import Resource except ImportError: raise ImportError( "The google-cloud-logging " "(https://pypi.org/project/google-cloud-logging/)" "package is required to run this test. To " "install this package, run `pip install google-cloud-logging`." ) identifier = str(uuid.uuid4()) resource = Resource( type="generic_node", labels={ "location": "us-central1-a", "namespace": "default", "node_id": identifier, }, ) stackdriver_logging_handler = StackdriverLoggingHandler( client=stackdriver_logging_client, default_logger_name=DEFAULT_LOGGER_NAME, resource=resource, mode=LoggingHandlerModes.BACKGROUND_THREAD, ) logger = stackdriver_logging_handler.default_logger logger.info("This is a test message.") time.sleep(20) _filter = ( 'resource.type = "generic_node" AND resource.labels.node_id = "{}"'.format( identifier ) ) entries = [] for entry in stackdriver_logging_client.list_entries(filter_=_filter): entries.append(entry) assert len(entries) == 1 log = str(entries[0]) assert "host" in log assert socket.gethostname() in log assert "logger" in log assert DEFAULT_LOGGER_NAME in log assert "level" in log assert "INFO" in log assert "module" in log assert "test_logging" in log assert "func" in log assert "test_fluentd_logging_handler" in log assert "message" in log assert "This is a test message" in log
31.86202
88
0.692843
2,708
22,399
5.479321
0.085672
0.077369
0.058431
0.023723
0.805432
0.757919
0.714112
0.674754
0.641394
0.610594
0
0.007374
0.206929
22,399
702
89
31.907407
0.82791
0.007366
0
0.616462
0
0
0.173205
0.024069
0
0
0
0
0.2662
1
0.054291
false
0
0.057793
0
0.129597
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
2e12101f33a03625ecc2428b45f984cb08d68621
77
py
Python
run.py
JavierLuna/advent-of-code-2020
57429a7973446472fffb07dc770f260160407f0c
[ "MIT" ]
1
2020-12-03T08:57:20.000Z
2020-12-03T08:57:20.000Z
run.py
JavierLuna/advent-of-code-2020
57429a7973446472fffb07dc770f260160407f0c
[ "MIT" ]
null
null
null
run.py
JavierLuna/advent-of-code-2020
57429a7973446472fffb07dc770f260160407f0c
[ "MIT" ]
null
null
null
from solutions.runner.runner import SolutionRunner SolutionRunner().run_all()
38.5
50
0.857143
9
77
7.222222
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.051948
77
2
51
38.5
0.890411
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
2e12e4c0ec3158b8c1e2da9958058ee69164cffa
161
py
Python
internet/udp/handlers/__init__.py
allen546/internet
843e9bb412411a480a940a271f784f2cc3976989
[ "MIT" ]
null
null
null
internet/udp/handlers/__init__.py
allen546/internet
843e9bb412411a480a940a271f784f2cc3976989
[ "MIT" ]
null
null
null
internet/udp/handlers/__init__.py
allen546/internet
843e9bb412411a480a940a271f784f2cc3976989
[ "MIT" ]
null
null
null
class Handler: def __init__(self): self.trace = [] def handle(self, data): self.trace.append(f'HANDLE {data}') return data
23
44
0.552795
19
161
4.473684
0.578947
0.211765
0
0
0
0
0
0
0
0
0
0
0.322981
161
6
45
26.833333
0.779817
0
0
0
0
0
0.083871
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
2e2392d98340190e6b087ad56504b688a8fc7ae8
86
py
Python
examples/atom_babies/show_cheeks.py
3110/uiflow-custom-block-generator
66ac171c002071391ae96d8544adce44026d1998
[ "MIT" ]
2
2022-02-09T02:02:31.000Z
2022-03-20T09:18:06.000Z
atom_babies/show_cheeks.py
3110/atom-babies
4cd326308ec407df0b23b5833213bea43d598934
[ "MIT" ]
null
null
null
atom_babies/show_cheeks.py
3110/atom-babies
4cd326308ec407df0b23b5833213bea43d598934
[ "MIT" ]
null
null
null
_ab_set_cheeks(_ab_get_face_position(), _ab_get_cheek_color(), _ab_get_orientation())
43
85
0.848837
14
86
4.214286
0.642857
0.254237
0
0
0
0
0
0
0
0
0
0
0.034884
86
1
86
86
0.710843
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
2e2fedd2918479521031ddbf47c5221885bc08ab
208
py
Python
service/watch_link.py
uniaim-event-team/watch-link
0ad2665fd88cba2fdb7e7c8f533bb5a8e6d91b31
[ "MIT" ]
2
2020-05-05T14:53:00.000Z
2020-05-05T14:53:13.000Z
service/watch_link.py
uniaim-event-team/watch-link
0ad2665fd88cba2fdb7e7c8f533bb5a8e6d91b31
[ "MIT" ]
1
2021-03-01T02:00:11.000Z
2021-03-01T02:00:11.000Z
service/watch_link.py
uniaim-event-team/watch-link
0ad2665fd88cba2fdb7e7c8f533bb5a8e6d91b31
[ "MIT" ]
null
null
null
from typing import List from mysql_dbcon import Connection from model import WatchLink def get_watch_link_list() -> List[WatchLink]: with Connection() as cn: return cn.s.query(WatchLink).all()
20.8
45
0.740385
30
208
5
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.177885
208
9
46
23.111111
0.877193
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
true
0
0.5
0
0.833333
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
2e418cd2e575d6914d81b69dc3b034f3fe306b9f
136
py
Python
problem/01000~09999/06321/6321.py3.py
njw1204/BOJ-AC
1de41685725ae4657a7ff94e413febd97a888567
[ "MIT" ]
1
2019-04-19T16:37:44.000Z
2019-04-19T16:37:44.000Z
problem/01000~09999/06321/6321.py3.py
njw1204/BOJ-AC
1de41685725ae4657a7ff94e413febd97a888567
[ "MIT" ]
1
2019-04-20T11:42:44.000Z
2019-04-20T11:42:44.000Z
problem/01000~09999/06321/6321.py3.py
njw1204/BOJ-AC
1de41685725ae4657a7ff94e413febd97a888567
[ "MIT" ]
3
2019-04-19T16:37:47.000Z
2021-10-25T00:45:00.000Z
for i in range(int(input())): print('String #',i+1,sep='') for j in input(): print(chr(ord(j)+1).replace('[','A'),end='') print('\n')
34
63
0.558824
25
136
3.04
0.68
0.263158
0
0
0
0
0
0
0
0
0
0.016393
0.102941
136
4
64
34
0.606557
0
0
0
0
0
0.087591
0
0
0
0
0
0
1
0
false
0
0
0
0
0.75
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
0
0
0
1
0
4
2e43b0bc98411a4566f244daec235e930f6c6ea8
333
py
Python
v4_pos+baseline/check_len_graph.py
egeersu/Multihop-GNN
1638eb2408030004112b8c19d4a2f68571eb4011
[ "MIT" ]
2
2021-09-18T17:59:56.000Z
2022-03-03T12:26:26.000Z
v4_pos+baseline/check_len_graph.py
egeersu/Multihop-GNN
1638eb2408030004112b8c19d4a2f68571eb4011
[ "MIT" ]
null
null
null
v4_pos+baseline/check_len_graph.py
egeersu/Multihop-GNN
1638eb2408030004112b8c19d4a2f68571eb4011
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # @Time : 2021/3/21 14:22 # @Author : Anda Zhou # @FileName: check_len_graph.py import dgl a, _ = dgl.load_graphs("graph/train_wikihop_30000_36350_graphs.dgl") # b, _ = dgl.load_graphs("graph/dev_wikihop_3701_5129_graphs.dgl") # c, _ = dgl.load_graphs("graph/dev_wikihop_0_3700_graphs.dgl") print(len(a))
33.3
68
0.717718
55
333
3.981818
0.618182
0.09589
0.178082
0.246575
0.255708
0.255708
0
0
0
0
0
0.119048
0.117117
333
10
69
33.3
0.62585
0.678679
0
0
0
0
0.415842
0.415842
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0.333333
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
1
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
2e54a6eaaf83cd3e48b129a600f196636110f199
516
py
Python
Desafios/Desafio108.py
vaniaferreira/Python
5b3158836d47c0bb7bc446e6636e7b3dcea8a0ab
[ "MIT" ]
null
null
null
Desafios/Desafio108.py
vaniaferreira/Python
5b3158836d47c0bb7bc446e6636e7b3dcea8a0ab
[ "MIT" ]
null
null
null
Desafios/Desafio108.py
vaniaferreira/Python
5b3158836d47c0bb7bc446e6636e7b3dcea8a0ab
[ "MIT" ]
null
null
null
#Adapte o código do desafio 107, criando uma função adicional chamada moeda() que consiga mostrar os valores como um valor #monetário formatado. import moeda p = float(input('Preço: R$')) t = int(input('Taxa %: ')) print(f'{t}% de {moeda.moeda(p)} é igual a {moeda.moeda(moeda.aumentar(p,t))} ') print(f'-{t}% de {moeda.moeda(p)} é igual a {moeda.moeda(moeda.diminuir(p,t))}') print(f'Dobro de {moeda.moeda(p)} é {moeda.moeda(moeda.dobro(p))}') print(f'Metade de {moeda.moeda(p)} é {moeda.moeda(moeda.metade(p))}')
46.909091
122
0.689922
91
516
3.912088
0.450549
0.337079
0.134831
0.146067
0.398876
0.398876
0.398876
0.398876
0.235955
0.235955
0
0.006565
0.114341
516
11
123
46.909091
0.772429
0.273256
0
0
0
0.571429
0.729947
0.339572
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
0.571429
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
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
2e694d312e5b81b2f3f028de91305a94e6a4a95e
135
py
Python
test/test_doctest.py
IloveKanade/k3cat
1ebe8ae95692e857d0b534eae73c91099d27e764
[ "MIT" ]
null
null
null
test/test_doctest.py
IloveKanade/k3cat
1ebe8ae95692e857d0b534eae73c91099d27e764
[ "MIT" ]
1
2022-03-23T06:50:02.000Z
2022-03-23T06:50:02.000Z
test/test_doctest.py
IloveKanade/k3cat
1ebe8ae95692e857d0b534eae73c91099d27e764
[ "MIT" ]
1
2021-08-18T02:57:01.000Z
2021-08-18T02:57:01.000Z
import doctest import k3cat def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite(k3cat)) return tests
15
47
0.755556
17
135
5.941176
0.647059
0
0
0
0
0
0
0
0
0
0
0.017699
0.162963
135
8
48
16.875
0.876106
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
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
5ceda2f63fccc5029aea14c7b81c35171085f67c
167
py
Python
src/python/test_script.py
rdgozum/python-orb
02db5745bb5cc263e6670bcdf2d811f52d1ea510
[ "MIT" ]
null
null
null
src/python/test_script.py
rdgozum/python-orb
02db5745bb5cc263e6670bcdf2d811f52d1ea510
[ "MIT" ]
2
2020-11-23T12:20:41.000Z
2020-11-23T12:22:03.000Z
src/python/test_script.py
rdgozum/python-orb
02db5745bb5cc263e6670bcdf2d811f52d1ea510
[ "MIT" ]
null
null
null
"""This is a test script.""" def hello_world(): """Function that prints Hello World.""" print("Hello World") if __name__ == "__main__": hello_world()
13.916667
43
0.616766
21
167
4.428571
0.714286
0.430108
0
0
0
0
0
0
0
0
0
0
0.215569
167
11
44
15.181818
0.709924
0.335329
0
0
0
0
0.19
0
0
0
0
0
0
1
0.25
true
0
0
0
0.25
0.25
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
1
0
0
0
0
0
0
4
cf539c30d636d3cd258582b3c089fd278d3da13c
644
py
Python
drnalpha/tracker/migrations/0003_remove_tracker_from_task.py
UKGovernmentBEIS/BRE_DigitalRegulationNavigator_Alpha
bfa6d08212bc18034b20b9c922a554a6e1ddd0f1
[ "MIT" ]
null
null
null
drnalpha/tracker/migrations/0003_remove_tracker_from_task.py
UKGovernmentBEIS/BRE_DigitalRegulationNavigator_Alpha
bfa6d08212bc18034b20b9c922a554a6e1ddd0f1
[ "MIT" ]
null
null
null
drnalpha/tracker/migrations/0003_remove_tracker_from_task.py
UKGovernmentBEIS/BRE_DigitalRegulationNavigator_Alpha
bfa6d08212bc18034b20b9c922a554a6e1ddd0f1
[ "MIT" ]
1
2021-04-21T09:41:43.000Z
2021-04-21T09:41:43.000Z
# Generated by Django 3.0.12 on 2021-02-09 14:32 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('tracker', '0002_rename_inserted_at_created_at'), ] operations = [ migrations.RemoveField( model_name='step', name='due_date', ), migrations.RemoveField( model_name='step', name='status', ), migrations.RemoveField( model_name='task', name='status', ), migrations.RemoveField( model_name='task', name='tracker', ), ]
21.466667
58
0.531056
59
644
5.627119
0.576271
0.253012
0.313253
0.361446
0.493976
0.493976
0.277108
0.277108
0
0
0
0.048193
0.35559
644
29
59
22.206897
0.751807
0.071429
0
0.608696
1
0
0.14094
0.057047
0
0
0
0
0
1
0
false
0
0.043478
0
0.173913
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
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
cf8216122934c4201970eaf341a6dad5a9e304a9
2,461
py
Python
tests/test_array.py
pleiszenburg/pyIGRF
2572afd40650ef7f10ba1804aaa4c7f870ef704e
[ "MIT" ]
1
2022-02-13T07:30:05.000Z
2022-02-13T07:30:05.000Z
tests/test_array.py
pleiszenburg/pyCRGI
3a1f394e2df6702432b29d2a7edded4d63cb14da
[ "MIT" ]
null
null
null
tests/test_array.py
pleiszenburg/pyCRGI
3a1f394e2df6702432b29d2a7edded4d63cb14da
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import numpy as np import pytest from pyCRGI import array, jited ITERATIONS = 10_000 @pytest.mark.parametrize( "itype, year", [(itype, year) for itype in (1, 2) for year in (1910.0, 1990.0, 2000.0, 2027.00)], ) def test_array_year(itype, year): offset = 0.0 if itype == 1 else 6371.2 random = np.random.default_rng() lats = random.uniform(low = -90.0, high = 90.0, size = ITERATIONS).astype('f8') lons = random.uniform(low = 0.0, high = 360.0, size = ITERATIONS).astype('f8') alts = random.uniform(low = -100.0, high = 400.0, size = ITERATIONS).astype('f8') + offset array_results = array.get_syn( years = year, lats = lats, elongs = lons, alts = alts, itype = itype, ) lats = [float(number) for number in lats] lons = [float(number) for number in lons] alts = [float(number) for number in alts] jited_results = [ jited.get_syn( year = year, lat = lat, elong = lon, alt = alt, itype = itype, ) for lat, lon, alt in zip(lats, lons, alts) ] assert np.allclose( np.array(jited_results, dtype = 'f8'), array_results, ) @pytest.mark.parametrize( "itype", [1, 2], ) def test_array_years(itype): offset = 0.0 if itype == 1 else 6371.2 random = np.random.default_rng() years = random.uniform(low = 1900.0, high = 2030.0, size = ITERATIONS).astype('f8') lats = random.uniform(low = -90.0, high = 90.0, size = ITERATIONS).astype('f8') lons = random.uniform(low = 0.0, high = 360.0, size = ITERATIONS).astype('f8') alts = random.uniform(low = -100.0, high = 400.0, size = ITERATIONS).astype('f8') + offset array_results = array.get_syn( years = years, lats = lats, elongs = lons, alts = alts, itype = itype, ) years = [float(number) for number in years] lats = [float(number) for number in lats] lons = [float(number) for number in lons] alts = [float(number) for number in alts] jited_results = [ jited.get_syn( year = year, lat = lat, elong = lon, alt = alt, itype = itype, ) for year, lat, lon, alt in zip(years, lats, lons, alts) ] assert np.allclose( np.array(jited_results, dtype = 'f8'), array_results, )
25.635417
94
0.56156
329
2,461
4.142857
0.206687
0.066764
0.082172
0.10785
0.782832
0.729274
0.729274
0.729274
0.676449
0.676449
0
0.061988
0.305161
2,461
95
95
25.905263
0.735088
0.008533
0
0.648649
0
0
0.013946
0
0
0
0
0
0.027027
1
0.027027
false
0
0.040541
0
0.067568
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
cf88124d4cb785041b57005a9d78f1b879d16e70
36,015
py
Python
test/structure_bind_client_messenger_test.py
AustinHellerRepo/SocketQueuedMessageFramework
da17577feb24fba68913f54be4e5eca6f35c9b43
[ "MIT" ]
1
2021-12-16T01:36:31.000Z
2021-12-16T01:36:31.000Z
test/structure_bind_client_messenger_test.py
AustinHellerRepo/SocketQueuedMessageFramework
da17577feb24fba68913f54be4e5eca6f35c9b43
[ "MIT" ]
null
null
null
test/structure_bind_client_messenger_test.py
AustinHellerRepo/SocketQueuedMessageFramework
da17577feb24fba68913f54be4e5eca6f35c9b43
[ "MIT" ]
null
null
null
from __future__ import annotations import unittest from typing import List, Tuple, Dict, Type, Callable, Deque from abc import ABC, abstractmethod import uuid from collections import deque import time from datetime import datetime from src.austin_heller_repo.socket_queued_message_framework import Structure, StructureFactory, ClientServerMessage, SourceTypeEnum, ClientServerMessageTypeEnum, StructureStateEnum, ClientMessengerFactory, ClientMessenger, StructureTransitionException, StructureInfluence, ServerMessenger, ServerMessengerFactory, ServerSocketFactory, HostPointer, ClientSocketFactory from austin_heller_repo.threading import SingletonMemorySequentialQueueFactory, Semaphore from austin_heller_repo.common import StringEnum, SingleDependentDependencyManager, AggregateDependentDependencyManager is_debug = False def get_default_message_manager_client_structure_factory() -> MessageManagerClientStructureFactory: return MessageManagerClientStructureFactory( message_manager_client_messenger_factory=ClientMessengerFactory( client_socket_factory=ClientSocketFactory( to_server_packet_bytes_length=4096 ), server_host_pointer=HostPointer( host_address="localhost", host_port=37440 ), client_server_message_class=MessageManagerClientServerMessage, is_debug=is_debug ) ) def get_default_message_manager_server_messenger_factory() -> ServerMessengerFactory: return ServerMessengerFactory( server_socket_factory_and_local_host_pointer_per_source_type={ MessageManagerSourceTypeEnum.Client: ( ServerSocketFactory( to_client_packet_bytes_length=4096, listening_limit_total=10, accept_timeout_seconds=1.0 ), HostPointer( host_address="localhost", host_port=37440 ) ) }, sequential_queue_factory=SingletonMemorySequentialQueueFactory(), client_server_message_class=MessageManagerClientServerMessage, source_type_enum_class=MessageManagerSourceTypeEnum, server_messenger_source_type=MessageManagerSourceTypeEnum.MessageManager, structure_factory=MessageManagerStructureFactory( uppercase_manager_client_messenger_factory=ClientMessengerFactory( client_socket_factory=ClientSocketFactory( to_server_packet_bytes_length=4096 ), server_host_pointer=HostPointer( host_address="localhost", host_port=37441 ), client_server_message_class=UppercaseManagerClientServerMessage ), reverse_manager_client_messenger_factory=ClientMessengerFactory( client_socket_factory=ClientSocketFactory( to_server_packet_bytes_length=4096 ), server_host_pointer=HostPointer( host_address="localhost", host_port=37442 ), client_server_message_class=ReverseManagerClientServerMessage ) ), is_debug=is_debug ) def get_default_uppercase_manager_server_messenger_factory() -> ServerMessengerFactory: return ServerMessengerFactory( server_socket_factory_and_local_host_pointer_per_source_type={ UppercaseManagerSourceTypeEnum.MessageManager: ( ServerSocketFactory( to_client_packet_bytes_length=4096, listening_limit_total=10, accept_timeout_seconds=1.0 ), HostPointer( host_address="localhost", host_port=37441 ) ) }, sequential_queue_factory=SingletonMemorySequentialQueueFactory(), client_server_message_class=UppercaseManagerClientServerMessage, source_type_enum_class=UppercaseManagerSourceTypeEnum, server_messenger_source_type=UppercaseManagerSourceTypeEnum.UppercaseManager, structure_factory=UppercaseManagerStructureFactory(), is_debug=is_debug ) def get_default_reverse_manager_server_messenger_factory() -> ServerMessengerFactory: return ServerMessengerFactory( server_socket_factory_and_local_host_pointer_per_source_type={ ReverseManagerSourceTypeEnum.MessageManager: ( ServerSocketFactory( to_client_packet_bytes_length=4096, listening_limit_total=10, accept_timeout_seconds=1.0 ), HostPointer( host_address="localhost", host_port=37442 ) ) }, sequential_queue_factory=SingletonMemorySequentialQueueFactory(), client_server_message_class=ReverseManagerClientServerMessage, source_type_enum_class=ReverseManagerSourceTypeEnum, server_messenger_source_type=ReverseManagerSourceTypeEnum.ReverseManager, structure_factory=ReverseManagerStructureFactory(), is_debug=is_debug ) class MessageManagerSourceTypeEnum(SourceTypeEnum): MessageManager = "message_manager" Client = "client" UppercaseManager = "uppercase_manager" ReverseManager = "reverse_manager" class MessageManagerClientServerMessageTypeEnum(ClientServerMessageTypeEnum): FormatMessageRequest = "format_message_request" FormatMessageResponse = "format_message_response" class MessageManagerStructureStateEnum(StructureStateEnum): Active = "active" class FormatTypeEnum(StringEnum): Uppercase = "uppercase" Reverse = "reverse" class MessageManagerClientServerMessage(ClientServerMessage, ABC): @classmethod def get_client_server_message_type_class(cls) -> Type[ClientServerMessageTypeEnum]: return MessageManagerClientServerMessageTypeEnum class FormatMessageRequestMessageManagerClientServerMessage(MessageManagerClientServerMessage): def __init__(self, *, message: str, format_types: List[str], destination_uuid: str): super().__init__( destination_uuid=destination_uuid ) self.__message = message self.__format_types = [FormatTypeEnum(x) for x in format_types] def get_message(self) -> str: return self.__message def get_format_types(self) -> List[FormatTypeEnum]: return self.__format_types @classmethod def get_client_server_message_type(cls) -> ClientServerMessageTypeEnum: return MessageManagerClientServerMessageTypeEnum.FormatMessageRequest def to_json(self) -> Dict: json_object = super().to_json() json_object["message"] = self.__message json_object["format_types"] = [x.value for x in self.__format_types] return json_object def is_ordered(self) -> bool: return True def get_structural_error_client_server_message_response(self, structure_transition_exception: StructureTransitionException, destination_uuid: str) -> ClientServerMessage: return None class FormatMessageResponseMessageManagerClientServerMessage(MessageManagerClientServerMessage): def __init__(self, *, message: str, destination_uuid: str,): super().__init__( destination_uuid=destination_uuid ) self.__message = message def get_message(self) -> str: return self.__message @classmethod def get_client_server_message_type(cls) -> ClientServerMessageTypeEnum: return MessageManagerClientServerMessageTypeEnum.FormatMessageResponse def to_json(self) -> Dict: json_object = super().to_json() json_object["message"] = self.__message return json_object def is_ordered(self) -> bool: return True def get_structural_error_client_server_message_response(self, structure_transition_exception: StructureTransitionException, destination_uuid: str) -> ClientServerMessage: return None # uppercase class UppercaseManagerSourceTypeEnum(SourceTypeEnum): UppercaseManager = "uppercase_manager" MessageManager = "message_manager" class UppercaseManagerClientServerMessageTypeEnum(ClientServerMessageTypeEnum): FormatMessageRequest = "format_message_request" FormatMessageResponse = "format_message_response" class UppercaseManagerStructureStateEnum(StructureStateEnum): Active = "active" class UppercaseManagerClientServerMessage(ClientServerMessage, ABC): @classmethod def get_client_server_message_type_class(cls) -> Type[ClientServerMessageTypeEnum]: return UppercaseManagerClientServerMessageTypeEnum class FormatMessageRequestUppercaseManagerClientServerMessage(UppercaseManagerClientServerMessage): def __init__(self, *, message: str, message_uuid: str, destination_uuid: str): super().__init__( destination_uuid=destination_uuid ) self.__message = message self.__message_uuid = message_uuid def get_message(self) -> str: return self.__message def get_message_uuid(self) -> str: return self.__message_uuid @classmethod def get_client_server_message_type(cls) -> ClientServerMessageTypeEnum: return UppercaseManagerClientServerMessageTypeEnum.FormatMessageRequest def to_json(self) -> Dict: json_object = super().to_json() json_object["message"] = self.__message json_object["message_uuid"] = self.__message_uuid return json_object def is_ordered(self) -> bool: return True def get_structural_error_client_server_message_response(self, structure_transition_exception: StructureTransitionException, destination_uuid: str) -> ClientServerMessage: return None class FormatMessageResponseUppercaseManagerClientServerMessage(UppercaseManagerClientServerMessage): def __init__(self, *, message: str, message_uuid: str, destination_uuid: str): super().__init__( destination_uuid=destination_uuid ) self.__message = message self.__message_uuid = message_uuid def get_message(self) -> str: return self.__message def get_message_uuid(self) -> str: return self.__message_uuid @classmethod def get_client_server_message_type(cls) -> ClientServerMessageTypeEnum: return UppercaseManagerClientServerMessageTypeEnum.FormatMessageResponse def to_json(self) -> Dict: json_object = super().to_json() json_object["message"] = self.__message json_object["message_uuid"] = self.__message_uuid return json_object def is_ordered(self) -> bool: return True def get_structural_error_client_server_message_response(self, structure_transition_exception: StructureTransitionException, destination_uuid: str) -> ClientServerMessage: return None # reverse class ReverseManagerSourceTypeEnum(SourceTypeEnum): ReverseManager = "reverse_manager" MessageManager = "message_manager" class ReverseManagerClientServerMessageTypeEnum(ClientServerMessageTypeEnum): FormatMessageRequest = "format_message_request" FormatMessageResponse = "format_message_response" class ReverseManagerStructureStateEnum(StructureStateEnum): Active = "active" class ReverseManagerClientServerMessage(ClientServerMessage, ABC): @classmethod def get_client_server_message_type_class(cls) -> Type[ClientServerMessageTypeEnum]: return ReverseManagerClientServerMessageTypeEnum class FormatMessageRequestReverseManagerClientServerMessage(ReverseManagerClientServerMessage): def __init__(self, *, message: str, message_uuid: str, destination_uuid: str): super().__init__( destination_uuid=destination_uuid ) self.__message = message self.__message_uuid = message_uuid def get_message(self) -> str: return self.__message def get_message_uuid(self) -> str: return self.__message_uuid @classmethod def get_client_server_message_type(cls) -> ClientServerMessageTypeEnum: return ReverseManagerClientServerMessageTypeEnum.FormatMessageRequest def to_json(self) -> Dict: json_object = super().to_json() json_object["message"] = self.__message json_object["message_uuid"] = self.__message_uuid return json_object def is_ordered(self) -> bool: return True def get_structural_error_client_server_message_response(self, structure_transition_exception: StructureTransitionException, destination_uuid: str) -> ClientServerMessage: return None class FormatMessageResponseReverseManagerClientServerMessage(ReverseManagerClientServerMessage): def __init__(self, *, message: str, message_uuid: str, destination_uuid: str): super().__init__( destination_uuid=destination_uuid ) self.__message = message self.__message_uuid = message_uuid def get_message(self) -> str: return self.__message def get_message_uuid(self) -> str: return self.__message_uuid @classmethod def get_client_server_message_type(cls) -> ClientServerMessageTypeEnum: return ReverseManagerClientServerMessageTypeEnum.FormatMessageResponse def to_json(self) -> Dict: json_object = super().to_json() json_object["message"] = self.__message json_object["message_uuid"] = self.__message_uuid return json_object def is_ordered(self) -> bool: return True def get_structural_error_client_server_message_response(self, structure_transition_exception: StructureTransitionException, destination_uuid: str) -> ClientServerMessage: return None # structures class MessageManagerStructure(Structure): def __init__(self, *, uppercase_manager_client_messenger_factory: ClientMessengerFactory, reverse_manager_client_messenger_factory: ClientMessengerFactory): super().__init__( states=MessageManagerStructureStateEnum, initial_state=MessageManagerStructureStateEnum.Active ) self.__uppercase_manager_client_messenger_factory = uppercase_manager_client_messenger_factory self.__reverse_manager_client_messenger_factory = reverse_manager_client_messenger_factory self.__uppercase_manager_client_messenger_source_uuid = None # type: str self.__reverse_manager_client_messenger_source_uuid = None # type: str self.__message_per_message_uuid = {} # type: Dict[str, str] self.__format_types_per_message_uuid = {} # type: Dict[str, Deque[FormatTypeEnum]] self.__source_uuid_per_message_uuid = {} # type: Dict[str, str] self.add_transition( client_server_message_type=MessageManagerClientServerMessageTypeEnum.FormatMessageRequest, from_source_type=MessageManagerSourceTypeEnum.Client, start_structure_state=MessageManagerStructureStateEnum.Active, end_structure_state=MessageManagerStructureStateEnum.Active, on_transition=self.__format_message_request_transition ) self.add_transition( client_server_message_type=UppercaseManagerClientServerMessageTypeEnum.FormatMessageResponse, from_source_type=MessageManagerSourceTypeEnum.UppercaseManager, start_structure_state=MessageManagerStructureStateEnum.Active, end_structure_state=MessageManagerStructureStateEnum.Active, on_transition=self.__format_message_response_transition ) self.add_transition( client_server_message_type=ReverseManagerClientServerMessageTypeEnum.FormatMessageResponse, from_source_type=MessageManagerSourceTypeEnum.ReverseManager, start_structure_state=MessageManagerStructureStateEnum.Active, end_structure_state=MessageManagerStructureStateEnum.Active, on_transition=self.__format_message_response_transition ) self.__initialize() def __initialize(self): self.__uppercase_manager_client_messenger_source_uuid = self.bind_client_messenger( client_messenger_factory=self.__uppercase_manager_client_messenger_factory, source_type=MessageManagerSourceTypeEnum.UppercaseManager ) self.__reverse_manager_client_messenger_source_uuid = self.bind_client_messenger( client_messenger_factory=self.__reverse_manager_client_messenger_factory, source_type=MessageManagerSourceTypeEnum.ReverseManager ) def __process_next_format_type_for_message_uuid(self, *, message_uuid: str): message = self.__message_per_message_uuid[message_uuid] if message_uuid not in self.__format_types_per_message_uuid: del self.__message_per_message_uuid[message_uuid] source_uuid = self.__source_uuid_per_message_uuid[message_uuid] del self.__source_uuid_per_message_uuid[message_uuid] self.send_client_server_message( client_server_message=FormatMessageResponseMessageManagerClientServerMessage( destination_uuid=source_uuid, message=message ) ) else: format_type = self.__format_types_per_message_uuid[message_uuid].popleft() if not self.__format_types_per_message_uuid[message_uuid]: del self.__format_types_per_message_uuid[message_uuid] if format_type == FormatTypeEnum.Uppercase: self.send_client_server_message( client_server_message=FormatMessageRequestUppercaseManagerClientServerMessage( message=message, message_uuid=message_uuid, destination_uuid=self.__uppercase_manager_client_messenger_source_uuid ) ) elif format_type == FormatTypeEnum.Reverse: self.send_client_server_message( client_server_message=FormatMessageRequestReverseManagerClientServerMessage( message=message, message_uuid=message_uuid, destination_uuid=self.__reverse_manager_client_messenger_source_uuid ) ) else: raise NotImplementedError() def __format_message_request_transition(self, structure_influence: StructureInfluence): client_server_message = structure_influence.get_client_server_message() if isinstance(client_server_message, FormatMessageRequestMessageManagerClientServerMessage): message = client_server_message.get_message() format_types = client_server_message.get_format_types() source_uuid = structure_influence.get_source_uuid() message_uuid = str(uuid.uuid4()) self.__message_per_message_uuid[message_uuid] = message self.__format_types_per_message_uuid[message_uuid] = deque(format_types) self.__source_uuid_per_message_uuid[message_uuid] = source_uuid self.__process_next_format_type_for_message_uuid( message_uuid=message_uuid ) else: raise NotImplementedError() def __format_message_response_transition(self, structure_influence: StructureInfluence): client_server_message = structure_influence.get_client_server_message() if isinstance(client_server_message, FormatMessageResponseUppercaseManagerClientServerMessage): message = client_server_message.get_message() message_uuid = client_server_message.get_message_uuid() self.__message_per_message_uuid[message_uuid] = message self.__process_next_format_type_for_message_uuid( message_uuid=message_uuid ) elif isinstance(client_server_message, FormatMessageResponseReverseManagerClientServerMessage): message = client_server_message.get_message() message_uuid = client_server_message.get_message_uuid() self.__message_per_message_uuid[message_uuid] = message self.__process_next_format_type_for_message_uuid( message_uuid=message_uuid ) else: raise NotImplementedError() class MessageManagerStructureFactory(StructureFactory): def __init__(self, *, uppercase_manager_client_messenger_factory: ClientMessengerFactory, reverse_manager_client_messenger_factory: ClientMessengerFactory): self.__uppercase_manager_client_messenger_factory = uppercase_manager_client_messenger_factory self.__reverse_manager_client_messenger_factory = reverse_manager_client_messenger_factory def get_structure(self) -> Structure: return MessageManagerStructure( uppercase_manager_client_messenger_factory=self.__uppercase_manager_client_messenger_factory, reverse_manager_client_messenger_factory=self.__reverse_manager_client_messenger_factory ) class UppercaseManagerStructure(Structure): def __init__(self): super().__init__( states=UppercaseManagerStructureStateEnum, initial_state=UppercaseManagerStructureStateEnum.Active ) self.add_transition( client_server_message_type=UppercaseManagerClientServerMessageTypeEnum.FormatMessageRequest, from_source_type=UppercaseManagerSourceTypeEnum.MessageManager, start_structure_state=UppercaseManagerStructureStateEnum.Active, end_structure_state=UppercaseManagerStructureStateEnum.Active, on_transition=self.__format_message_request_transition ) def __format_message_request_transition(self, structure_influence: StructureInfluence): client_server_message = structure_influence.get_client_server_message() if isinstance(client_server_message, FormatMessageRequestUppercaseManagerClientServerMessage): print(f"{datetime.utcnow()}: UppercaseManagerStructure: received uppercase format request") message = client_server_message.get_message() message_uuid = client_server_message.get_message_uuid() formatted_message = message.upper() self.send_client_server_message( client_server_message=FormatMessageResponseUppercaseManagerClientServerMessage( destination_uuid=structure_influence.get_source_uuid(), message=formatted_message, message_uuid=message_uuid ) ) else: raise NotImplementedError() class UppercaseManagerStructureFactory(StructureFactory): def get_structure(self) -> Structure: return UppercaseManagerStructure() class ReverseManagerStructure(Structure): def __init__(self): super().__init__( states=ReverseManagerStructureStateEnum, initial_state=ReverseManagerStructureStateEnum.Active ) self.add_transition( client_server_message_type=ReverseManagerClientServerMessageTypeEnum.FormatMessageRequest, from_source_type=ReverseManagerSourceTypeEnum.MessageManager, start_structure_state=ReverseManagerStructureStateEnum.Active, end_structure_state=ReverseManagerStructureStateEnum.Active, on_transition=self.__format_message_request_transition ) def __format_message_request_transition(self, structure_influence: StructureInfluence): client_server_message = structure_influence.get_client_server_message() if isinstance(client_server_message, FormatMessageRequestReverseManagerClientServerMessage): message = client_server_message.get_message() message_uuid = client_server_message.get_message_uuid() formatted_message = message[::-1] self.send_client_server_message( client_server_message=FormatMessageResponseReverseManagerClientServerMessage( destination_uuid=structure_influence.get_source_uuid(), message=formatted_message, message_uuid=message_uuid ) ) else: raise NotImplementedError() class ReverseManagerStructureFactory(StructureFactory): def get_structure(self) -> Structure: return ReverseManagerStructure() class MessageManagerClientStructureStateEnum(StructureStateEnum): Active = "active" class MessageManagerClientStructure(Structure): def __init__(self, *, message_manager_client_messenger_factory: ClientMessengerFactory): super().__init__( states=MessageManagerClientStructureStateEnum, initial_state=MessageManagerClientStructureStateEnum.Active ) self.__message_manager_client_messenger_factory = message_manager_client_messenger_factory self.__message_manager_source_uuid = None # type: str self.__method_semaphore = Semaphore() self.__blocking_semaphore = Semaphore() self.__previous_client_server_message = None # type: ClientServerMessage self.add_transition( client_server_message_type=MessageManagerClientServerMessageTypeEnum.FormatMessageResponse, from_source_type=MessageManagerSourceTypeEnum.MessageManager, start_structure_state=MessageManagerClientStructureStateEnum.Active, end_structure_state=MessageManagerClientStructureStateEnum.Active, on_transition=self.__message_manager_client_structure_on_transition ) self.__initialize() def __initialize(self): self.__blocking_semaphore.acquire() self.__message_manager_source_uuid = self.bind_client_messenger( client_messenger_factory=self.__message_manager_client_messenger_factory, source_type=MessageManagerSourceTypeEnum.MessageManager ) def __message_manager_client_structure_on_transition(self, structure_influence: StructureInfluence): client_server_message = structure_influence.get_client_server_message() self.__previous_client_server_message = client_server_message self.__blocking_semaphore.release() def format_message(self, *, message: str, format_types: List[FormatTypeEnum]) -> str: self.__method_semaphore.acquire() try: self.send_client_server_message( client_server_message=FormatMessageRequestMessageManagerClientServerMessage( message=message, format_types=[x.value for x in format_types], destination_uuid=self.__message_manager_source_uuid ) ) self.__blocking_semaphore.acquire() if not isinstance(self.__previous_client_server_message, FormatMessageResponseMessageManagerClientServerMessage): raise Exception(f"Unexpected message: {self.__previous_client_server_message}") else: message = self.__previous_client_server_message.get_message() finally: self.__method_semaphore.release() return message class MessageManagerClientStructureFactory(StructureFactory): def __init__(self, *, message_manager_client_messenger_factory: ClientMessengerFactory): self.__message_manager_client_messenger_factory = message_manager_client_messenger_factory def get_structure(self) -> MessageManagerClientStructure: return MessageManagerClientStructure( message_manager_client_messenger_factory=self.__message_manager_client_messenger_factory ) class StructureBindClientMessengerTest(unittest.TestCase): def test_initialize(self): uppercase_manager_server_messenger = get_default_uppercase_manager_server_messenger_factory().get_server_messenger() self.assertIsNotNone(uppercase_manager_server_messenger) uppercase_manager_server_messenger.start_receiving_from_clients() reverse_manager_server_messenger = get_default_reverse_manager_server_messenger_factory().get_server_messenger() self.assertIsNotNone(reverse_manager_server_messenger) reverse_manager_server_messenger.start_receiving_from_clients() message_manager_server_messenger = get_default_message_manager_server_messenger_factory().get_server_messenger() self.assertIsNotNone(message_manager_server_messenger) message_manager_server_messenger.start_receiving_from_clients() time.sleep(0.1) message_manager_server_messenger.stop_receiving_from_clients() message_manager_server_messenger.dispose() reverse_manager_server_messenger.stop_receiving_from_clients() reverse_manager_server_messenger.dispose() uppercase_manager_server_messenger.stop_receiving_from_clients() uppercase_manager_server_messenger.dispose() def test_uppercase(self): uppercase_manager_server_messenger = get_default_uppercase_manager_server_messenger_factory().get_server_messenger() uppercase_manager_server_messenger.start_receiving_from_clients() reverse_manager_server_messenger = get_default_reverse_manager_server_messenger_factory().get_server_messenger() reverse_manager_server_messenger.start_receiving_from_clients() message_manager_server_messenger = get_default_message_manager_server_messenger_factory().get_server_messenger() message_manager_server_messenger.start_receiving_from_clients() time.sleep(0.1) # send message message_manager_client_structure = get_default_message_manager_client_structure_factory().get_structure() formatted_message = message_manager_client_structure.format_message( message="test message", format_types=[ FormatTypeEnum.Uppercase ] ) # waiting for messages time.sleep(1.0) message_manager_client_structure.dispose() message_manager_server_messenger.stop_receiving_from_clients() message_manager_server_messenger.dispose() reverse_manager_server_messenger.stop_receiving_from_clients() reverse_manager_server_messenger.dispose() uppercase_manager_server_messenger.stop_receiving_from_clients() uppercase_manager_server_messenger.dispose() self.assertEqual("TEST MESSAGE", formatted_message) def test_reverse(self): uppercase_manager_server_messenger = get_default_uppercase_manager_server_messenger_factory().get_server_messenger() uppercase_manager_server_messenger.start_receiving_from_clients() reverse_manager_server_messenger = get_default_reverse_manager_server_messenger_factory().get_server_messenger() reverse_manager_server_messenger.start_receiving_from_clients() message_manager_server_messenger = get_default_message_manager_server_messenger_factory().get_server_messenger() message_manager_server_messenger.start_receiving_from_clients() time.sleep(0.1) # send message message_manager_client_structure = get_default_message_manager_client_structure_factory().get_structure() for index in range(3): start_datetime = datetime.utcnow() formatted_message = message_manager_client_structure.format_message( message="test message", format_types=[ FormatTypeEnum.Reverse ] ) end_datetime = datetime.utcnow() print(f"{datetime.utcnow()}: test: elapsed time: {(end_datetime - start_datetime).total_seconds()}") # waiting for messages time.sleep(1.0) message_manager_client_structure.dispose() message_manager_server_messenger.stop_receiving_from_clients() message_manager_server_messenger.dispose() reverse_manager_server_messenger.stop_receiving_from_clients() reverse_manager_server_messenger.dispose() uppercase_manager_server_messenger.stop_receiving_from_clients() uppercase_manager_server_messenger.dispose() self.assertEqual("egassem tset", formatted_message) def test_uppercase_reverse(self): uppercase_manager_server_messenger = get_default_uppercase_manager_server_messenger_factory().get_server_messenger() uppercase_manager_server_messenger.start_receiving_from_clients() reverse_manager_server_messenger = get_default_reverse_manager_server_messenger_factory().get_server_messenger() reverse_manager_server_messenger.start_receiving_from_clients() message_manager_server_messenger = get_default_message_manager_server_messenger_factory().get_server_messenger() message_manager_server_messenger.start_receiving_from_clients() time.sleep(0.1) # send message message_manager_client_structure = get_default_message_manager_client_structure_factory().get_structure() formatted_message = message_manager_client_structure.format_message( message="test message", format_types=[ FormatTypeEnum.Uppercase, FormatTypeEnum.Reverse ] ) time.sleep(1.0) message_manager_client_structure.dispose() message_manager_server_messenger.stop_receiving_from_clients() message_manager_server_messenger.dispose() reverse_manager_server_messenger.stop_receiving_from_clients() reverse_manager_server_messenger.dispose() uppercase_manager_server_messenger.stop_receiving_from_clients() uppercase_manager_server_messenger.dispose() self.assertEqual("EGASSEM TSET", formatted_message) def test_reverse_reverse(self): uppercase_manager_server_messenger = get_default_uppercase_manager_server_messenger_factory().get_server_messenger() uppercase_manager_server_messenger.start_receiving_from_clients() reverse_manager_server_messenger = get_default_reverse_manager_server_messenger_factory().get_server_messenger() reverse_manager_server_messenger.start_receiving_from_clients() message_manager_server_messenger = get_default_message_manager_server_messenger_factory().get_server_messenger() message_manager_server_messenger.start_receiving_from_clients() time.sleep(0.1) # send message message_manager_client_structure = get_default_message_manager_client_structure_factory().get_structure() formatted_message = message_manager_client_structure.format_message( message="test message", format_types=[ FormatTypeEnum.Reverse, FormatTypeEnum.Reverse ] ) time.sleep(1.0) message_manager_client_structure.dispose() message_manager_server_messenger.stop_receiving_from_clients() message_manager_server_messenger.dispose() reverse_manager_server_messenger.stop_receiving_from_clients() reverse_manager_server_messenger.dispose() uppercase_manager_server_messenger.stop_receiving_from_clients() uppercase_manager_server_messenger.dispose() self.assertEqual("test message", formatted_message) def test_reverse_reverse_reverse(self): uppercase_manager_server_messenger = get_default_uppercase_manager_server_messenger_factory().get_server_messenger() uppercase_manager_server_messenger.start_receiving_from_clients() reverse_manager_server_messenger = get_default_reverse_manager_server_messenger_factory().get_server_messenger() reverse_manager_server_messenger.start_receiving_from_clients() message_manager_server_messenger = get_default_message_manager_server_messenger_factory().get_server_messenger() message_manager_server_messenger.start_receiving_from_clients() time.sleep(0.1) # send message message_manager_client_structure = get_default_message_manager_client_structure_factory().get_structure() formatted_message = message_manager_client_structure.format_message( message="test message", format_types=[ FormatTypeEnum.Reverse, FormatTypeEnum.Reverse, FormatTypeEnum.Reverse ] ) time.sleep(1.0) message_manager_client_structure.dispose() message_manager_server_messenger.stop_receiving_from_clients() message_manager_server_messenger.dispose() reverse_manager_server_messenger.stop_receiving_from_clients() reverse_manager_server_messenger.dispose() uppercase_manager_server_messenger.stop_receiving_from_clients() uppercase_manager_server_messenger.dispose() self.assertEqual("egassem tset", formatted_message) def test_reverse_many_times(self): uppercase_manager_server_messenger = get_default_uppercase_manager_server_messenger_factory().get_server_messenger() uppercase_manager_server_messenger.start_receiving_from_clients() reverse_manager_server_messenger = get_default_reverse_manager_server_messenger_factory().get_server_messenger() reverse_manager_server_messenger.start_receiving_from_clients() message_manager_server_messenger = get_default_message_manager_server_messenger_factory().get_server_messenger() message_manager_server_messenger.start_receiving_from_clients() time.sleep(0.1) # send message message_manager_client_structure = get_default_message_manager_client_structure_factory().get_structure() for index in range(100): start_datetime = datetime.utcnow() formatted_message = message_manager_client_structure.format_message( message="test message", format_types=[ FormatTypeEnum.Reverse ] ) end_datetime = datetime.utcnow() print(f"{datetime.utcnow()}: test: elapsed time: {(end_datetime - start_datetime).total_seconds()}") # waiting for messages time.sleep(1.0) message_manager_client_structure.dispose() message_manager_server_messenger.stop_receiving_from_clients() message_manager_server_messenger.dispose() reverse_manager_server_messenger.stop_receiving_from_clients() reverse_manager_server_messenger.dispose() uppercase_manager_server_messenger.stop_receiving_from_clients() uppercase_manager_server_messenger.dispose() self.assertEqual("egassem tset", formatted_message) def test_reverse_many_times_recursively(self): uppercase_manager_server_messenger = get_default_uppercase_manager_server_messenger_factory().get_server_messenger() uppercase_manager_server_messenger.start_receiving_from_clients() reverse_manager_server_messenger = get_default_reverse_manager_server_messenger_factory().get_server_messenger() reverse_manager_server_messenger.start_receiving_from_clients() message_manager_server_messenger = get_default_message_manager_server_messenger_factory().get_server_messenger() message_manager_server_messenger.start_receiving_from_clients() time.sleep(0.1) # send message message_manager_client_structure = get_default_message_manager_client_structure_factory().get_structure() avg_total = 4 for index in range(25): avg_sum = 0 for avg_index in range(avg_total): start_datetime = datetime.utcnow() formatted_message = message_manager_client_structure.format_message( message="test message", format_types=[ FormatTypeEnum.Reverse ]*(index + 1) ) end_datetime = datetime.utcnow() avg_sum += (end_datetime - start_datetime).total_seconds() print(f"{datetime.utcnow()}: test: elapsed time: {index}: {avg_sum / avg_total}") # waiting for messages time.sleep(1.0) message_manager_client_structure.dispose() message_manager_server_messenger.stop_receiving_from_clients() message_manager_server_messenger.dispose() reverse_manager_server_messenger.stop_receiving_from_clients() reverse_manager_server_messenger.dispose() uppercase_manager_server_messenger.stop_receiving_from_clients() uppercase_manager_server_messenger.dispose() self.assertEqual("egassem tset", formatted_message)
33.596082
367
0.834652
3,763
36,015
7.439809
0.057135
0.081976
0.099014
0.043506
0.797042
0.764716
0.744999
0.710566
0.654844
0.630947
0
0.003305
0.100958
36,015
1,071
368
33.627451
0.86133
0.009441
0
0.626194
0
0
0.028188
0.007405
0
0
0
0
0.013643
1
0.102319
false
0
0.015007
0.05457
0.248295
0.005457
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
d8713b337260f1e1ed0386200305100b0da5d193
404
py
Python
rasiberryPiGPIOBaseController/equiptments/Pressure.py
onwebbe/rasiberryPiBaseController
bdb81cb5a0e62414fa091635a83db799017249e7
[ "MIT" ]
null
null
null
rasiberryPiGPIOBaseController/equiptments/Pressure.py
onwebbe/rasiberryPiBaseController
bdb81cb5a0e62414fa091635a83db799017249e7
[ "MIT" ]
null
null
null
rasiberryPiGPIOBaseController/equiptments/Pressure.py
onwebbe/rasiberryPiBaseController
bdb81cb5a0e62414fa091635a83db799017249e7
[ "MIT" ]
null
null
null
import time import rasiberryPiGPIOBaseController.driver.BMP180 as devBMP180 class BMP180: def __init__(self, address=0x77): self._address = address self.device = devBMP180.BMP180(address) def getTemperature(self): return self.device.read_temperature() def getPressure(self): return self.device.read_pressure() def getAltitude(self): return self.device.read_altitude()
23.764706
63
0.75
47
404
6.276596
0.468085
0.135593
0.142373
0.20339
0.244068
0
0
0
0
0
0
0.053097
0.160891
404
17
64
23.764706
0.817109
0
0
0
0
0
0
0
0
0
0.009877
0
0
1
0.333333
false
0
0.166667
0.25
0.833333
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
d8b7499450e2fb6517c625a9765410760d469349
1,946
py
Python
apps/plea/migrations/0041_casetracker.py
uk-gov-mirror/ministryofjustice.manchester_traffic_offences_pleas
4c625b13fa2826bdde083a0270dcea1791f6dc18
[ "MIT" ]
3
2015-12-22T16:37:14.000Z
2018-01-22T18:44:38.000Z
apps/plea/migrations/0041_casetracker.py
uk-gov-mirror/ministryofjustice.manchester_traffic_offences_pleas
4c625b13fa2826bdde083a0270dcea1791f6dc18
[ "MIT" ]
145
2015-03-04T11:17:50.000Z
2022-03-21T12:10:13.000Z
apps/plea/migrations/0041_casetracker.py
uk-gov-mirror/ministryofjustice.manchester_traffic_offences_pleas
4c625b13fa2826bdde083a0270dcea1791f6dc18
[ "MIT" ]
3
2015-12-29T14:59:12.000Z
2021-04-11T06:24:11.000Z
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2018-09-06 11:53 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('plea', '0040_auto_20180523_1512'), ] operations = [ migrations.CreateModel( name='CaseTracker', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('last_update', models.DateTimeField(null=True)), ('authentication', models.BooleanField(default=False)), ('details', models.BooleanField(default=False)), ('plea', models.BooleanField(default=False)), ('company_finances', models.BooleanField(default=False)), ('income_base', models.BooleanField(default=False)), ('your_status', models.BooleanField(default=False)), ('your_self_employment', models.BooleanField(default=False)), ('your_out_of_work_benefits', models.BooleanField(default=False)), ('about_your_income', models.BooleanField(default=False)), ('your_benefits', models.BooleanField(default=False)), ('your_pension_credits', models.BooleanField(default=False)), ('your_income', models.BooleanField(default=False)), ('hardship', models.BooleanField(default=False)), ('household_expenses', models.BooleanField(default=False)), ('other_expenses', models.BooleanField(default=False)), ('review', models.BooleanField(default=False)), ('complete', models.BooleanField(default=False)), ('case', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='plea.Case')), ], ), ]
46.333333
116
0.611511
184
1,946
6.304348
0.429348
0.263793
0.366379
0.439655
0.32069
0.068966
0
0
0
0
0
0.022618
0.250257
1,946
41
117
47.463415
0.772447
0.034943
0
0
1
0
0.154133
0.0256
0
0
0
0
0
1
0
false
0
0.088235
0
0.176471
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
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
d8c02fa23250dfd8edbd7e93e10466f07a1bca65
396
py
Python
python/dsalgo/queue.py
mfrata/dsalgo
3f03a84f869b248e064934c71f69ece914e8f4e1
[ "Unlicense" ]
null
null
null
python/dsalgo/queue.py
mfrata/dsalgo
3f03a84f869b248e064934c71f69ece914e8f4e1
[ "Unlicense" ]
null
null
null
python/dsalgo/queue.py
mfrata/dsalgo
3f03a84f869b248e064934c71f69ece914e8f4e1
[ "Unlicense" ]
null
null
null
from collections import deque class Queue: data = deque() size = 0 def enqueue(self, val): self.size += 1 self.data.append(val) def dequeue(self): self.size -= 1 return self.data.popleft() def empty(self): return self.size == 0 def __len__(self): return self.size def __str__(self): return str(self.data)
16.5
34
0.563131
51
396
4.215686
0.411765
0.148837
0.074419
0.167442
0
0
0
0
0
0
0
0.015094
0.330808
396
23
35
17.217391
0.796226
0
0
0
0
0
0
0
0
0
0
0
0
1
0.3125
false
0
0.0625
0.1875
0.8125
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
d8e937d6a19ccbcea7fe89d924c8c6ba1a7df29e
113
py
Python
jetbull/cloud_ml/__init__.py
icoxfog417/jetbull
41d726fa077eaf1634071f1a8bb8395e7a528f40
[ "MIT" ]
null
null
null
jetbull/cloud_ml/__init__.py
icoxfog417/jetbull
41d726fa077eaf1634071f1a8bb8395e7a528f40
[ "MIT" ]
null
null
null
jetbull/cloud_ml/__init__.py
icoxfog417/jetbull
41d726fa077eaf1634071f1a8bb8395e7a528f40
[ "MIT" ]
null
null
null
from pkg_resources import get_distribution #__version__ = get_distribution("jetbull").version __version__ = 0.1
22.6
50
0.823009
14
113
5.857143
0.714286
0.365854
0
0
0
0
0
0
0
0
0
0.019608
0.097345
113
4
51
28.25
0.784314
0.433628
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
d8ff5c6c8b2abd73f2c0d43be6b7d5a375f7aa93
163
py
Python
gdmtl/models/__init__.py
binshengliu/gdmtl
fb8bfe0e87bbd6d8535cc8449012fb4119430d4c
[ "MIT" ]
null
null
null
gdmtl/models/__init__.py
binshengliu/gdmtl
fb8bfe0e87bbd6d8535cc8449012fb4119430d4c
[ "MIT" ]
null
null
null
gdmtl/models/__init__.py
binshengliu/gdmtl
fb8bfe0e87bbd6d8535cc8449012fb4119430d4c
[ "MIT" ]
1
2022-02-26T00:49:03.000Z
2022-02-26T00:49:03.000Z
from .mtl_bart import BartSumRank from .mtl_bert import MtlEncoderRanker from .mtl_t5 import T5SumRank __all__ = ["BartSumRank", "MtlEncoderRanker", "T5SumRank"]
27.166667
58
0.803681
19
163
6.526316
0.526316
0.169355
0
0
0
0
0
0
0
0
0
0.02069
0.110429
163
5
59
32.6
0.834483
0
0
0
0
0
0.220859
0
0
0
0
0
0
1
0
false
0
0.75
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
0
0
1
0
1
0
0
4
2b1b87f1943480fa1e068669f8c8fb418869bc85
166
py
Python
tests/tests_api/test_api.py
ktomaszewska97/TravelBuddy
e0fd23e21a873088f6c77ff01581d1c8c4b829b0
[ "MIT" ]
null
null
null
tests/tests_api/test_api.py
ktomaszewska97/TravelBuddy
e0fd23e21a873088f6c77ff01581d1c8c4b829b0
[ "MIT" ]
null
null
null
tests/tests_api/test_api.py
ktomaszewska97/TravelBuddy
e0fd23e21a873088f6c77ff01581d1c8c4b829b0
[ "MIT" ]
null
null
null
from http import HTTPStatus from app import app def test_hello_world(): response = app.test_client().get("/") assert response.status_code == HTTPStatus.OK
18.444444
48
0.728916
23
166
5.086957
0.695652
0
0
0
0
0
0
0
0
0
0
0
0.168675
166
8
49
20.75
0.847826
0
0
0
0
0
0.006024
0
0
0
0
0
0.2
1
0.2
false
0
0.4
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
2b4d7b269765b503af16b00e638e3f858f73eda3
89
py
Python
python/src/opendp/__init__.py
sarus-tech/opendp
e4b1714fdadd72fe488647be83f6bfc7d1d20064
[ "MIT" ]
95
2021-02-17T19:50:28.000Z
2022-03-31T16:50:59.000Z
python/src/opendp/__init__.py
sarus-tech/opendp
e4b1714fdadd72fe488647be83f6bfc7d1d20064
[ "MIT" ]
299
2021-02-10T00:14:41.000Z
2022-03-31T16:17:33.000Z
python/src/opendp/__init__.py
sarus-tech/opendp
e4b1714fdadd72fe488647be83f6bfc7d1d20064
[ "MIT" ]
13
2021-04-01T14:40:56.000Z
2022-03-27T08:52:46.000Z
from opendp.mod import Transformation, Measurement, OpenDPException, UnknownTypeException
89
89
0.88764
8
89
9.875
1
0
0
0
0
0
0
0
0
0
0
0
0.067416
89
1
89
89
0.951807
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