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
b42703ee292873fb687c5c02085f65faceff3c1b
186
py
Python
ner/gamma/__init__.py
ROBINADC/BiGRU-CRF-with-Attention-for-NER
b9e037ebd6e1d56500ffb60c6030013982c17ded
[ "MIT" ]
27
2020-10-04T07:59:25.000Z
2022-03-31T03:35:35.000Z
ner/gamma/__init__.py
janerjzou/BiGRU-CRF-with-Attention-for-NER
b9e037ebd6e1d56500ffb60c6030013982c17ded
[ "MIT" ]
6
2020-12-28T02:47:58.000Z
2021-11-06T03:47:22.000Z
ner/gamma/__init__.py
janerjzou/BiGRU-CRF-with-Attention-for-NER
b9e037ebd6e1d56500ffb60c6030013982c17ded
[ "MIT" ]
12
2020-06-28T15:48:17.000Z
2022-03-20T19:40:58.000Z
from .model import build_model from .utils import EarlyStopping, attention_padding_mask, cal_accuracy, pad_seq, cal_f1score, load_embeddings from .data import DataLoader, DataProcessing
46.5
109
0.854839
25
186
6.08
0.76
0
0
0
0
0
0
0
0
0
0
0.005952
0.096774
186
3
110
62
0.89881
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
b42b17d3edc2dbb63b3921b64883a9e8b5c8df7c
47
py
Python
tf/writing/syriac.py
ancient-data/text-fabric
c1ccd4a4dc451e94a789f138576576c5d7f13474
[ "MIT" ]
10
2017-10-30T22:38:00.000Z
2018-12-12T06:10:10.000Z
tf/writing/syriac.py
dirkroorda/text-fabric
c0a49f092ceda3e7bab91fd0f1aa84e2dc029cf4
[ "MIT" ]
37
2017-10-19T12:06:54.000Z
2018-12-13T10:18:23.000Z
tf/writing/syriac.py
dirkroorda/text-fabric
c0a49f092ceda3e7bab91fd0f1aa84e2dc029cf4
[ "MIT" ]
3
2018-02-28T12:37:21.000Z
2018-06-23T08:32:54.000Z
""" .. include:: ../docs/writing/syriac.md """
11.75
38
0.553191
5
47
5.2
1
0
0
0
0
0
0
0
0
0
0
0
0.106383
47
3
39
15.666667
0.619048
0.808511
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
b441252568ca99d0eed1c0c47268dcb01310d372
4,558
py
Python
tests/test_rk.py
nutofem/fenics_helpers
2cc7fd40c4642d99ed82c1474a66eb0dc9e95ac4
[ "MIT" ]
null
null
null
tests/test_rk.py
nutofem/fenics_helpers
2cc7fd40c4642d99ed82c1474a66eb0dc9e95ac4
[ "MIT" ]
3
2019-02-07T09:06:25.000Z
2020-03-28T09:24:35.000Z
tests/test_rk.py
nutofem/fenics_helpers
2cc7fd40c4642d99ed82c1474a66eb0dc9e95ac4
[ "MIT" ]
1
2020-12-15T17:35:38.000Z
2020-12-15T17:35:38.000Z
import unittest import dolfin as d from fenics_helpers import rk class TestRungeKuttaWithHeatEq(unittest.TestCase): def setUp(self): d.set_log_level(d.LogLevel.WARNING) N = 50 order = 2 tF = 0.10 # Dirichlet boundary characteristic time tau = tF / 10.0 # time step h = 0.001 self.num_steps = round(tF / h) # Mesh and Function space mesh = d.UnitIntervalMesh(N) V = d.FunctionSpace(mesh, "P", order) w = d.TestFunction(V) v = d.TrialFunction(V) # Initial conditions chosen such that the wave travels to the right uInit = d.Expression( "((1./3 < x[0]) && (x[0] < 2./3)) ? 0.5*(1-cos(2*pi*3*(x[0]-1./3))) : 0.", degree=2, ) u = d.interpolate(uInit, V) # values # Dirichlet boundary on the right with its derivatives g = d.Expression( "(t < total) ? 0.4*(1.-cos(2*pi*t/total))/2. : 0.", degree=2, t=0.0, total=tau, ) dg = d.Expression( "(t < total) ? 0.4*(pi/total) * sin(2*pi*t/total) : 0.", degree=2, t=0.0, total=tau, ) def updateBC(t): g.t = t dg.t = t def right(x, on_boundary): return on_boundary and d.near(x[0], 1.0) bc0 = d.DirichletBC(V, g, right) bc1 = d.DirichletBC(V, dg, right) self.bc = [bc0, bc1] L1 = -d.inner(d.grad(w), d.grad(u)) * d.dx L2 = w * v * d.dx self.parameters = (L1, L2, u, h, updateBC) def test_ERK(self): timeStepper = rk.ERKo1(rk.Euler, *self.parameters) for step in range(self.num_steps): timeStepper.do_step(bc=self.bc) def test_DIRK(self): timeStepper = rk.DIRKo1(rk.ImplicitEuler, *self.parameters) for step in range(self.num_steps): timeStepper.do_step(bc=self.bc) class TestRungeKuttaWithWaveEq(unittest.TestCase): def setUp(self): d.set_log_level(d.LogLevel.WARNING) N = 100 order = 2 tF = 0.01 tau = 0.2 # Dirichlet boundary characteristic time h = 0.001 # time step self.num_steps = round(tF / h) # Mesh and Function space mesh = d.UnitIntervalMesh(N) V = d.FunctionSpace(mesh, "P", order) w = d.TestFunction(V) a = d.TrialFunction(V) # Initial conditions chosen such that the wave travels to the right uInit = d.Expression( "((1./3 < x[0]) && (x[0] < 2./3)) ? 0.5*(1-cos(2*pi*3*(x[0]-1./3))) : 0.", degree=2, ) vInit = d.Expression( "((1./3 < x[0]) && (x[0] < 2./3)) ? -pi*3 * (sin(2*pi*3*(x[0]-1./3))) : 0.", degree=2, ) u = d.interpolate(uInit, V) # values v = d.interpolate(vInit, V) # velocities f = d.Expression( "(t < total) ? sin(2*pi*t/total) : 0.", degree=2, t=0.0, total=tF * 0.1 ) # Dirichlet boundary on the right with its derivatives g = d.Expression( "(t < total) ? 0.4*(1.-cos(2*pi*t/total))/2. : 0.", degree=2, t=0.0, total=tau, ) dg = d.Expression( "(t < total) ? 0.4*(pi/total) * sin(2*pi*t/total) : 0.", degree=2, t=0.0, total=tau, ) ddg = d.Expression( "(t < total) ? 0.4*(pi/total)*(2*pi/total) * cos(2*pi*t/total) : 0.", degree=2, t=0.0, total=tau, ) def updateBC(t): f.t = t g.t = t dg.t = t ddg.t = t def right(x, on_boundary): return on_boundary and d.near(x[0], 1.0) bc0 = d.DirichletBC(V, g, right) bc1 = d.DirichletBC(V, dg, right) bc2 = d.DirichletBC(V, ddg, right) self.bc = [bc0, bc1, bc2] L1 = -d.inner(d.grad(w), d.grad(u)) * d.dx + w * f * d.ds L2 = w * a * d.dx self.parameters = (L1, L2, u, v, h, updateBC) def test_ERK(self): timeStepper = rk.ERKo2(rk.ERK4Classic, *self.parameters) for step in range(self.num_steps): timeStepper.do_step(bc=self.bc) def test_DIRK(self): timeStepper = rk.DIRKo2(rk.CrankNicholson, *self.parameters) for step in range(self.num_steps): timeStepper.do_step(bc=self.bc) if __name__ == "__main__": unittest.main()
28.666667
88
0.494954
642
4,558
3.465732
0.191589
0.03236
0.03236
0.045843
0.795955
0.781573
0.781573
0.755955
0.71191
0.71191
0
0.050477
0.356735
4,558
158
89
28.848101
0.70839
0.089513
0
0.616667
0
0.066667
0.127901
0.041586
0
0
0
0
0
1
0.083333
false
0
0.025
0.016667
0.141667
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
b448d087bed738d3145a29afe6fead760ada47b7
1,403
py
Python
sympy/external/tests/test_importtools.py
sid21g/sympy
440d289ee1e8b54e5e3e5e7262e06651f5ec5878
[ "BSD-3-Clause" ]
null
null
null
sympy/external/tests/test_importtools.py
sid21g/sympy
440d289ee1e8b54e5e3e5e7262e06651f5ec5878
[ "BSD-3-Clause" ]
null
null
null
sympy/external/tests/test_importtools.py
sid21g/sympy
440d289ee1e8b54e5e3e5e7262e06651f5ec5878
[ "BSD-3-Clause" ]
1
2020-02-06T17:54:20.000Z
2020-02-06T17:54:20.000Z
from sympy.external import import_module from sympy.testing.pytest import warns # fixes issue that arose in addressing issue 6533 def test_no_stdlib_collections(): ''' make sure we get the right collections when it is not part of a larger list ''' import collections matplotlib = import_module('matplotlib', __import__kwargs={'fromlist': ['cm', 'collections']}, min_module_version='1.1.0', catch=(RuntimeError,)) if matplotlib: assert collections != matplotlib.collections def test_no_stdlib_collections2(): ''' make sure we get the right collections when it is not part of a larger list ''' import collections matplotlib = import_module('matplotlib', __import__kwargs={'fromlist': ['collections']}, min_module_version='1.1.0', catch=(RuntimeError,)) if matplotlib: assert collections != matplotlib.collections def test_no_stdlib_collections3(): '''make sure we get the right collections with no catch''' import collections matplotlib = import_module('matplotlib', __import__kwargs={'fromlist': ['cm', 'collections']}, min_module_version='1.1.0') if matplotlib: assert collections != matplotlib.collections def test_min_module_version_python3_basestring_error(): with warns(UserWarning): import_module('mpmath', min_module_version='1000.0.1')
34.219512
67
0.699216
169
1,403
5.568047
0.331361
0.1339
0.085016
0.047821
0.716259
0.716259
0.716259
0.682253
0.621679
0.621679
0
0.019608
0.200285
1,403
40
68
35.075
0.819073
0.180328
0
0.615385
0
0
0.108499
0
0
0
0
0
0.115385
1
0.153846
false
0
0.461538
0
0.615385
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
b476c5e49f3cd23fb64e2d0b6ffd096932cde8c6
226
py
Python
data/__init__.py
RichardBlazek/PyImperit
2d93e56e3c12e33098a0cda6cedd8e099ef02955
[ "MIT" ]
null
null
null
data/__init__.py
RichardBlazek/PyImperit
2d93e56e3c12e33098a0cda6cedd8e099ef02955
[ "MIT" ]
null
null
null
data/__init__.py
RichardBlazek/PyImperit
2d93e56e3c12e33098a0cda6cedd8e099ef02955
[ "MIT" ]
null
null
null
from data.player import Player from data.players import Players from data.province import Province from data.provinces import Provinces from data.land import Land from data.lands import Lands from data.settings import Settings
32.285714
36
0.849558
35
226
5.485714
0.285714
0.291667
0
0
0
0
0
0
0
0
0
0
0.119469
226
7
37
32.285714
0.964824
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
c30f4dcb719fcb85d8a1644407b2d73627f3aa62
235
py
Python
spug_api/apps/account/__init__.py
showsmall/spug
9c878d37c3bd732808d43a2a3958735a9ad07cfe
[ "MIT" ]
2
2020-08-10T14:29:46.000Z
2021-05-21T09:06:20.000Z
spug_api/apps/account/__init__.py
xiaoyiios/spug
67c137da9ea1bc451bfa1c34ebfb35c4821825c2
[ "MIT" ]
null
null
null
spug_api/apps/account/__init__.py
xiaoyiios/spug
67c137da9ea1bc451bfa1c34ebfb35c4821825c2
[ "MIT" ]
1
2020-09-07T03:48:44.000Z
2020-09-07T03:48:44.000Z
from apps.account import user from apps.account import role def register_blueprint(app): app.register_blueprint(user.blueprint, url_prefix='/account/users') app.register_blueprint(role.blueprint, url_prefix='/account/roles')
29.375
71
0.791489
32
235
5.65625
0.4375
0.281768
0.165746
0.232044
0
0
0
0
0
0
0
0
0.102128
235
7
72
33.571429
0.85782
0
0
0
0
0
0.119149
0
0
0
0
0
0
1
0.2
false
0
0.4
0
0.6
0.6
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
1
0
5
c3319a79dfb5809a43a4c041669e3926b35fe1a2
117
py
Python
cyder/cydns/cname/urls.py
drkitty/cyder
1babc443cc03aa51fa3c1015bcd22f0ea2e5f0f8
[ "BSD-3-Clause" ]
6
2015-04-16T23:18:22.000Z
2020-08-25T22:50:13.000Z
cyder/cydns/cname/urls.py
drkitty/cyder
1babc443cc03aa51fa3c1015bcd22f0ea2e5f0f8
[ "BSD-3-Clause" ]
267
2015-01-01T00:18:57.000Z
2015-10-14T00:01:13.000Z
cyder/cydns/cname/urls.py
drkitty/cyder
1babc443cc03aa51fa3c1015bcd22f0ea2e5f0f8
[ "BSD-3-Clause" ]
5
2015-03-23T00:57:09.000Z
2019-09-09T22:42:37.000Z
from django.conf.urls.defaults import * from cyder.cydns.urls import cydns_urls urlpatterns = cydns_urls('cname')
16.714286
39
0.786325
17
117
5.294118
0.588235
0.3
0
0
0
0
0
0
0
0
0
0
0.119658
117
6
40
19.5
0.873786
0
0
0
0
0
0.042735
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
c336451ce80787ae53e5e058a4aed32d27b03725
138
py
Python
Logic/Helpers/GlobalID.py
terexdev/BSDS-V39
7deea469fbfbc56c48f8326ba972369679f6b098
[ "Apache-2.0" ]
11
2021-11-04T01:49:50.000Z
2022-01-31T16:50:47.000Z
Logic/Helpers/GlobalID.py
terexdev/BSDS-V39
7deea469fbfbc56c48f8326ba972369679f6b098
[ "Apache-2.0" ]
6
2021-11-04T08:52:01.000Z
2021-12-27T02:33:19.000Z
Logic/Helpers/GlobalID.py
terexdev/BSDS-V39
7deea469fbfbc56c48f8326ba972369679f6b098
[ "Apache-2.0" ]
5
2021-11-04T02:31:56.000Z
2022-03-14T02:04:33.000Z
class GlobalID: def getClassID(self, globalId): return (globalId / 1000000 + (globalId >> 31)) - (globalId * 1125899907 >> 63)
46
86
0.644928
14
138
6.357143
0.714286
0
0
0
0
0
0
0
0
0
0
0.194444
0.217391
138
3
86
46
0.62963
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
c33cf5217d3b5d1deb61f854bf70318ca3655f9b
118
py
Python
killableprocess/__init__.py
tomschenkjr/SublimeREPL
8cfe65d66ce632f97699ca51f2743ed7e3c8df86
[ "BSD-2-Clause" ]
2
2016-02-15T03:13:21.000Z
2019-08-01T19:19:36.000Z
killableprocess/__init__.py
tomschenkjr/SublimeREPL
8cfe65d66ce632f97699ca51f2743ed7e3c8df86
[ "BSD-2-Clause" ]
null
null
null
killableprocess/__init__.py
tomschenkjr/SublimeREPL
8cfe65d66ce632f97699ca51f2743ed7e3c8df86
[ "BSD-2-Clause" ]
null
null
null
from killableprocess import Popen, mswindows if mswindows: from winprocess import STARTUPINFO, STARTF_USESHOWWINDOW
39.333333
57
0.855932
13
118
7.692308
0.769231
0
0
0
0
0
0
0
0
0
0
0
0.118644
118
3
57
39.333333
0.961538
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
c34c847feafa4826ccd64c90faed68a51bb114f4
35
py
Python
steams_logos/__init__.py
akostyuk/steams_logos
234561af2db268699d1d8de23dfff0580954b0e2
[ "MIT" ]
1
2020-12-09T14:30:07.000Z
2020-12-09T14:30:07.000Z
steams_logos/__init__.py
akostyuk/steams_logos
234561af2db268699d1d8de23dfff0580954b0e2
[ "MIT" ]
null
null
null
steams_logos/__init__.py
akostyuk/steams_logos
234561af2db268699d1d8de23dfff0580954b0e2
[ "MIT" ]
null
null
null
from .downloader import Downloader
17.5
34
0.857143
4
35
7.5
0.75
0
0
0
0
0
0
0
0
0
0
0
0.114286
35
1
35
35
0.967742
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
c37f6c1d19a4d48f1cfc1f80c4a87719761a5aca
164
py
Python
pydoc-markdown/src/test/test_utils.py
e8johan/pydoc-markdown
a48298bd58252bbf8832658528e8110f86766047
[ "MIT" ]
null
null
null
pydoc-markdown/src/test/test_utils.py
e8johan/pydoc-markdown
a48298bd58252bbf8832658528e8110f86766047
[ "MIT" ]
1
2020-10-27T20:33:53.000Z
2020-10-27T20:33:53.000Z
pydoc-markdown/src/test/test_utils.py
e8johan/pydoc-markdown
a48298bd58252bbf8832658528e8110f86766047
[ "MIT" ]
1
2020-08-16T18:44:57.000Z
2020-08-16T18:44:57.000Z
def assert_text_equals(a, b): assert '\n'.join([x.rstrip() for x in a.strip().split('\n')]) == \ '\n'.join([x.rstrip() for x in b.strip().split('\n')])
32.8
68
0.542683
29
164
3
0.482759
0.114943
0.137931
0.275862
0.413793
0.413793
0.413793
0
0
0
0
0
0.170732
164
4
69
41
0.639706
0
0
0
0
0
0.04908
0
0
0
0
0
0.666667
1
0.333333
false
0
0
0
0.333333
0
1
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
1
0
0
0
0
0
0
0
5
6f14f4fa49fb04aaa2e61cfc36d41f2526d32c5c
453
py
Python
pg-document-store/db_utils.py
JusticeN/pg-document-store
c9723121ec07023081382350a2596cda3c9cdbe2
[ "Apache-2.0" ]
1
2020-04-06T21:35:03.000Z
2020-04-06T21:35:03.000Z
pg-document-store/db_utils.py
JusticeN/pg-document-store
c9723121ec07023081382350a2596cda3c9cdbe2
[ "Apache-2.0" ]
null
null
null
pg-document-store/db_utils.py
JusticeN/pg-document-store
c9723121ec07023081382350a2596cda3c9cdbe2
[ "Apache-2.0" ]
null
null
null
def sql_create_table(table_name): return "CREATE TABLE {} (id serial PRIMARY KEY, data json);".format(table_name) def sql_insert_in_table(table_name, values): return "INSERT INTO {} (data) VALUES ({});".format(table_name, values) def sql_delete_table(table_name, where): return "DELETE {} WHERE {};".format(table_name, where) def sql_read_table(table_name, where): return "SELECT id, data FROM {} WHERE {};".format(table_name, where)
37.75
83
0.719647
66
453
4.681818
0.333333
0.23301
0.18123
0.122977
0.323625
0
0
0
0
0
0
0
0.139073
453
12
84
37.75
0.792308
0
0
0
0
0
0.302428
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
6f371061f0dbae6483b14fcef7ae190920303b1f
141
py
Python
aptl3/db/__init__.py
matteoterruzzi/aptl3
680ab58ffa79d0eee293729d36f677a588350519
[ "MIT" ]
null
null
null
aptl3/db/__init__.py
matteoterruzzi/aptl3
680ab58ffa79d0eee293729d36f677a588350519
[ "MIT" ]
null
null
null
aptl3/db/__init__.py
matteoterruzzi/aptl3
680ab58ffa79d0eee293729d36f677a588350519
[ "MIT" ]
null
null
null
from .thumbnails import ThumbnailsDatabase from .search import SearchDatabase class Database(SearchDatabase, ThumbnailsDatabase): pass
20.142857
51
0.829787
13
141
9
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.12766
141
6
52
23.5
0.95122
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.25
0.5
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
0
0
0
5
6f5f58139b12220c592afbbf7ab567f98d16c385
37
py
Python
tests/__init__.py
shrinivdeshmukh/bearsql
9c9742419728daf8f349695d8cd38c08a9421d19
[ "MIT" ]
12
2021-06-30T12:29:13.000Z
2022-01-10T13:50:51.000Z
tests/__init__.py
shrinivdeshmukh/bearsql
9c9742419728daf8f349695d8cd38c08a9421d19
[ "MIT" ]
35
2021-07-09T01:55:43.000Z
2022-03-28T01:29:10.000Z
tests/__init__.py
shrinivdeshmukh/bearsql
9c9742419728daf8f349695d8cd38c08a9421d19
[ "MIT" ]
2
2021-06-30T14:32:42.000Z
2021-08-13T14:04:11.000Z
"""Unit test package for bearsql."""
18.5
36
0.675676
5
37
5
1
0
0
0
0
0
0
0
0
0
0
0
0.135135
37
1
37
37
0.78125
0.810811
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
6f66d882e09cb4c15f6ffe92554519b91448e58a
297
py
Python
hc/api/schemas.py
andela/hc-june-bunnies
3f2f3c56a6013d7715bd4bc30cd1f686a3588c03
[ "BSD-3-Clause" ]
null
null
null
hc/api/schemas.py
andela/hc-june-bunnies
3f2f3c56a6013d7715bd4bc30cd1f686a3588c03
[ "BSD-3-Clause" ]
24
2018-06-29T14:55:20.000Z
2018-09-25T09:17:00.000Z
hc/api/schemas.py
andela/hc-june-bunnies
3f2f3c56a6013d7715bd4bc30cd1f686a3588c03
[ "BSD-3-Clause" ]
null
null
null
check = { "properties": { "name": {"type": "string"}, "tags": {"type": "string"}, "timeout": {"type": "number", "minimum": 60, "maximum": 15552000}, "grace": {"type": "number", "minimum": 60, "maximum": 15552000}, "channels": {"type": "string"} } }
29.7
74
0.474747
25
297
5.64
0.56
0.212766
0.241135
0.269504
0.48227
0.48227
0
0
0
0
0
0.091324
0.262626
297
9
75
33
0.552511
0
0
0
0
0
0.390572
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
489f9d18b0656c11a7a308d9223e8486b2957346
19
py
Python
src/vcstools/__version__.py
k-okada/vcstools
2f60f1dd70f395e9be17cc9592582c8f1dbc9b76
[ "BSD-3-Clause" ]
null
null
null
src/vcstools/__version__.py
k-okada/vcstools
2f60f1dd70f395e9be17cc9592582c8f1dbc9b76
[ "BSD-3-Clause" ]
8
2021-02-19T18:42:42.000Z
2022-02-10T17:37:42.000Z
src/vcstools/__version__.py
k-okada/vcstools
2f60f1dd70f395e9be17cc9592582c8f1dbc9b76
[ "BSD-3-Clause" ]
1
2021-04-19T11:55:08.000Z
2021-04-19T11:55:08.000Z
version = '0.1.33'
9.5
18
0.578947
4
19
2.75
1
0
0
0
0
0
0
0
0
0
0
0.25
0.157895
19
1
19
19
0.4375
0
0
0
0
0
0.315789
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
48c0315dc9bfef97e16663d067f61a3d4b5b4cde
129
py
Python
Code/YOLO/darkflow/darkflow/net/framework.py
kalvin-osoro/ml_project
bf0bdc5719f2712682dd070045a5f1edf933a0c4
[ "Apache-2.0" ]
null
null
null
Code/YOLO/darkflow/darkflow/net/framework.py
kalvin-osoro/ml_project
bf0bdc5719f2712682dd070045a5f1edf933a0c4
[ "Apache-2.0" ]
null
null
null
Code/YOLO/darkflow/darkflow/net/framework.py
kalvin-osoro/ml_project
bf0bdc5719f2712682dd070045a5f1edf933a0c4
[ "Apache-2.0" ]
null
null
null
version https://git-lfs.github.com/spec/v1 oid sha256:31f74f1339e5aeecf4c3011997c38aded45e9df87e396b73689da53ddea231a3 size 1603
32.25
75
0.883721
13
129
8.769231
1
0
0
0
0
0
0
0
0
0
0
0.373984
0.046512
129
3
76
43
0.552846
0
0
0
0
0
0
0
0
1
0
0
0
0
null
null
0
0
null
null
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
null
1
0
0
0
1
0
0
0
0
0
0
0
0
5
5b14b2a14ffd0edf0294ba19bdade0f2315b4e00
42
py
Python
test/login.py
SaturnWorld/test001
03e4beba9b2efa307faa2de0560a0c828e088544
[ "MIT" ]
null
null
null
test/login.py
SaturnWorld/test001
03e4beba9b2efa307faa2de0560a0c828e088544
[ "MIT" ]
null
null
null
test/login.py
SaturnWorld/test001
03e4beba9b2efa307faa2de0560a0c828e088544
[ "MIT" ]
null
null
null
a = 1 b = 2 num = 1 num2 = 20 num4 = 45
5.25
9
0.47619
10
42
2
0.9
0
0
0
0
0
0
0
0
0
0
0.36
0.404762
42
7
10
6
0.44
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
5b17b3d1f21c8f005eb86022c54a6473e213eddd
3,655
py
Python
api/migrations/0028_auto_20181012_2330.py
pokotsun/kyutechAppServer2018
9fe579c63e59ee585137e89d11c9cdccd58d3186
[ "MIT" ]
4
2018-08-09T15:19:06.000Z
2021-04-03T12:24:57.000Z
api/migrations/0028_auto_20181012_2330.py
pokotsun/kyutechAppServer2018
9fe579c63e59ee585137e89d11c9cdccd58d3186
[ "MIT" ]
2
2018-10-19T15:32:17.000Z
2020-06-05T19:41:14.000Z
api/migrations/0028_auto_20181012_2330.py
pokotsun/kyutechAppServer2018
9fe579c63e59ee585137e89d11c9cdccd58d3186
[ "MIT" ]
null
null
null
# Generated by Django 2.0.4 on 2018-10-12 14:30 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('api', '0027_auto_20181012_2319'), ] operations = [ migrations.AlterField( model_name='syllabus', name='abstract', field=models.CharField(max_length=2550), ), migrations.AlterField( model_name='syllabus', name='academic_credit_infos', field=models.CharField(max_length=1024), ), migrations.AlterField( model_name='syllabus', name='instruction_out_learning', field=models.CharField(max_length=2550, null=True), ), migrations.AlterField( model_name='syllabus', name='keywords', field=models.CharField(max_length=1024, null=True), ), migrations.AlterField( model_name='syllabus', name='lecture_content', field=models.CharField(max_length=3000), ), migrations.AlterField( model_name='syllabus', name='lecture_processing', field=models.CharField(max_length=2550), ), migrations.AlterField( model_name='syllabus', name='notes', field=models.CharField(max_length=1024, null=True), ), migrations.AlterField( model_name='syllabus', name='performance_target', field=models.CharField(max_length=2550), ), migrations.AlterField( model_name='syllabus', name='positioning', field=models.CharField(max_length=2550), ), migrations.AlterField( model_name='syllabus', name='professor_email', field=models.CharField(max_length=255, null=True), ), migrations.AlterField( model_name='syllabus', name='study_aid_books', field=models.CharField(max_length=2048, null=True), ), migrations.AlterField( model_name='syllabus', name='target_period', field=models.CharField(max_length=255), ), migrations.AlterField( model_name='syllabus', name='target_place', field=models.CharField(max_length=255), ), migrations.AlterField( model_name='syllabus', name='target_school_year', field=models.CharField(max_length=255), ), migrations.AlterField( model_name='syllabus', name='target_term', field=models.CharField(max_length=255), ), migrations.AlterField( model_name='syllabus', name='teacher_name', field=models.CharField(max_length=100), ), migrations.AlterField( model_name='syllabus', name='text_books', field=models.CharField(max_length=1024, null=True), ), migrations.AlterField( model_name='syllabus', name='title', field=models.CharField(max_length=255), ), migrations.AlterField( model_name='syllabus', name='valuation_basis', field=models.CharField(max_length=2550), ), migrations.AlterField( model_name='userschedule', name='syllabus', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Syllabus'), ), ]
31.782609
100
0.558687
331
3,655
5.984894
0.23565
0.201918
0.252398
0.292781
0.763756
0.734478
0.603231
0.572438
0.498233
0.498233
0
0.040783
0.329138
3,655
114
101
32.061404
0.767129
0.012312
0
0.666667
1
0
0.128603
0.018847
0
0
0
0
0
1
0
false
0
0.018519
0
0.046296
0
0
0
0
null
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
5b1d3cbbabbf93493246d4e04e3312f3a4d64850
66
py
Python
delphi/stats/__init__.py
pstefanou12/delphi
e9ed4ddac3b03863684cfeaff4490d8dc282ab80
[ "MIT" ]
null
null
null
delphi/stats/__init__.py
pstefanou12/delphi
e9ed4ddac3b03863684cfeaff4490d8dc282ab80
[ "MIT" ]
null
null
null
delphi/stats/__init__.py
pstefanou12/delphi
e9ed4ddac3b03863684cfeaff4490d8dc282ab80
[ "MIT" ]
null
null
null
from .truncated_linear_regression import TruncatedLinearRegression
66
66
0.939394
6
66
10
1
0
0
0
0
0
0
0
0
0
0
0
0.045455
66
1
66
66
0.952381
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
d2e1279e3d3fff1a796f4c1653f0dd93b7ac0fe8
42
py
Python
api.py
wekesa360/Lecture-Room-Booking-System
93a796c4ca0149a2d3afc85694e80af36e4a89bc
[ "MIT" ]
null
null
null
api.py
wekesa360/Lecture-Room-Booking-System
93a796c4ca0149a2d3afc85694e80af36e4a89bc
[ "MIT" ]
null
null
null
api.py
wekesa360/Lecture-Room-Booking-System
93a796c4ca0149a2d3afc85694e80af36e4a89bc
[ "MIT" ]
null
null
null
import SQLAlchemy from db import Database
14
23
0.857143
6
42
6
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.142857
42
2
24
21
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
d2edd30cd86deba6871759289feed7bb74f117a7
1,009
py
Python
test/collaborative/fedmd/test_nfdp.py
Koukyosyumei/AIJack
9545d3828907b54965ede85e0e12cb32eef54294
[ "MIT" ]
24
2021-11-17T02:16:47.000Z
2022-03-27T01:04:08.000Z
test/collaborative/fedmd/test_nfdp.py
Koukyosyumei/AIJack
9545d3828907b54965ede85e0e12cb32eef54294
[ "MIT" ]
9
2021-12-03T06:09:27.000Z
2022-03-29T06:33:53.000Z
test/collaborative/fedmd/test_nfdp.py
Koukyosyumei/AIJack
9545d3828907b54965ede85e0e12cb32eef54294
[ "MIT" ]
5
2022-01-12T09:58:04.000Z
2022-03-17T09:29:04.000Z
import pytest def test_FedMD_NFDP(): from aijack.collaborative.fedmd import ( get_delta_of_fedmd_nfdp, get_epsilon_of_fedmd_nfdp, get_k_of_fedmd_nfdp, ) assert get_k_of_fedmd_nfdp( get_epsilon_of_fedmd_nfdp(300, 100, replacement=True), 300, replacement=True ) == pytest.approx(100, 0) # assert get_k_of_fedmd_nfdp( # get_epsilon_of_fedmd_nfdp(300, 100, replacement=False), 300, replacement=False # ) == pytest.approx(100, 0) assert get_k_of_fedmd_nfdp( get_epsilon_of_fedmd_nfdp(300, 300, replacement=True), 300, replacement=True ) == pytest.approx(300, 0) assert get_k_of_fedmd_nfdp( get_epsilon_of_fedmd_nfdp(300, 300, replacement=False), 300, replacement=False ) == pytest.approx(300, 0) assert get_delta_of_fedmd_nfdp(300, 120, replacement=True) == pytest.approx( 0.3301, 1e-4 ) assert get_delta_of_fedmd_nfdp(300, 300, replacement=True) == pytest.approx( 0.6327, 1e-4 )
30.575758
87
0.688801
146
1,009
4.390411
0.184932
0.196568
0.223089
0.131045
0.876755
0.776911
0.765991
0.469579
0.419657
0.419657
0
0.097744
0.209118
1,009
32
88
31.53125
0.705514
0.134787
0
0.227273
0
0
0
0
0
0
0
0
0.227273
1
0.045455
true
0
0.090909
0
0.136364
0
0
0
0
null
0
1
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
d2f028e2e0506ef3cb960cf8dcfc520380b59d41
19
py
Python
quantstats/version.py
eudesrodrigo/quantstats
55a0edaccfbde8cba1e845c3cf9cf506895c24eb
[ "Apache-2.0" ]
null
null
null
quantstats/version.py
eudesrodrigo/quantstats
55a0edaccfbde8cba1e845c3cf9cf506895c24eb
[ "Apache-2.0" ]
null
null
null
quantstats/version.py
eudesrodrigo/quantstats
55a0edaccfbde8cba1e845c3cf9cf506895c24eb
[ "Apache-2.0" ]
null
null
null
version = "0.0.47"
9.5
18
0.578947
4
19
2.75
0.75
0
0
0
0
0
0
0
0
0
0
0.25
0.157895
19
1
19
19
0.4375
0
0
0
0
0
0.315789
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
824b3fb4579151b667187a048c5e1a867cd1be46
2,941
py
Python
tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[nb_NO-2013] 1.py
gour/holidata
89c7323f9c5345a3ecbf5cd5a835b0e08cfebc13
[ "MIT" ]
32
2019-04-12T08:01:34.000Z
2022-02-28T04:41:50.000Z
tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[nb_NO-2013] 1.py
gour/holidata
89c7323f9c5345a3ecbf5cd5a835b0e08cfebc13
[ "MIT" ]
74
2019-07-09T16:35:20.000Z
2022-03-09T16:41:34.000Z
tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[nb_NO-2013] 1.py
gour/holidata
89c7323f9c5345a3ecbf5cd5a835b0e08cfebc13
[ "MIT" ]
20
2019-01-28T07:41:02.000Z
2022-02-16T02:38:57.000Z
[ { 'date': '2013-01-01', 'description': 'Nyttårsdag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2013-02-10', 'description': 'Fastelavn', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2013-03-24', 'description': 'Palmesøndag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2013-03-28', 'description': 'Skjærtorsdag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2013-03-29', 'description': 'Langfredag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2013-03-31', 'description': 'Påskedag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2013-04-01', 'description': 'Påskedag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2013-05-01', 'description': 'Offentlig Høytidsdag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2013-05-08', 'description': 'Frigjøringsdag 1945', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2013-05-09', 'description': 'Kristi Himmelfartsdag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2013-05-17', 'description': 'Grunnlovsdag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2013-05-19', 'description': 'Pinsedag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2013-05-20', 'description': 'Pinsedag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NRV' }, { 'date': '2013-12-24', 'description': 'Julaften', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NRF' }, { 'date': '2013-12-25', 'description': 'Juledag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NRF' }, { 'date': '2013-12-26', 'description': 'Juledag', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NRF' }, { 'date': '2013-12-31', 'description': 'Nyttårsaften', 'locale': 'nb-NO', 'notes': '', 'region': '', 'type': 'NF' } ]
21.311594
47
0.356681
224
2,941
4.683036
0.209821
0.129647
0.162059
0.243089
0.702574
0.702574
0.702574
0.676835
0.676835
0.64347
0
0.080137
0.405984
2,941
138
48
21.311594
0.520321
0
0
0.536232
0
0
0.374915
0
0
0
0
0
0
1
0
true
0
0
0
0
0
0
0
0
null
0
0
1
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
828157298f33a1657368b575e05b68134e56976a
224
py
Python
nineml/abstraction/connectionrule/__init__.py
INCF/nineml-python
062a2ac8a9be97cee4dad02938e3858e051cf07c
[ "BSD-3-Clause" ]
6
2017-12-26T14:15:28.000Z
2021-10-10T22:45:51.000Z
nineml/abstraction/connectionrule/__init__.py
INCF/nineml-python
062a2ac8a9be97cee4dad02938e3858e051cf07c
[ "BSD-3-Clause" ]
25
2017-07-05T03:53:53.000Z
2021-01-19T14:14:05.000Z
nineml/abstraction/connectionrule/__init__.py
INCF/nineml-python
062a2ac8a9be97cee4dad02938e3858e051cf07c
[ "BSD-3-Clause" ]
5
2017-12-26T14:15:12.000Z
2021-10-10T22:45:39.000Z
from .base import ( ConnectionRule, one_to_one_connection_rule, explicit_connection_rule, probabilistic_connection_rule, random_fan_in_connection_rule, random_fan_out_connection_rule, all_to_all_connection_rule)
44.8
73
0.857143
30
224
5.733333
0.5
0.488372
0.232558
0.267442
0
0
0
0
0
0
0
0
0.102679
224
4
74
56
0.855721
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
829b2697ef53b029c79539fad5eadc88d4dbaaba
95
py
Python
model/__init__.py
DisaKzionda/ABME
1455a40105248667403560298f0ddb4d5bb90d0a
[ "MIT" ]
74
2021-08-28T03:07:28.000Z
2022-03-30T17:40:17.000Z
model/__init__.py
DisaKzionda/ABME
1455a40105248667403560298f0ddb4d5bb90d0a
[ "MIT" ]
11
2021-08-24T15:33:59.000Z
2022-03-26T09:44:20.000Z
model/__init__.py
DisaKzionda/ABME
1455a40105248667403560298f0ddb4d5bb90d0a
[ "MIT" ]
22
2021-08-30T08:49:25.000Z
2022-02-24T19:20:43.000Z
from .SBMNet import SBMENet from .ABMNet import ABMRNet from .SynthesisNet import SynthesisNet
23.75
38
0.842105
12
95
6.666667
0.583333
0
0
0
0
0
0
0
0
0
0
0
0.126316
95
3
39
31.666667
0.963855
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
7d557fecd50f2eaf52f915498c572d09509ed804
45,578
py
Python
sonic_y_cable/y_cable.py
liorghub/sonic-platform-common
dea756df9444f230afd73981ddbde8a8b356e5ce
[ "Apache-2.0" ]
null
null
null
sonic_y_cable/y_cable.py
liorghub/sonic-platform-common
dea756df9444f230afd73981ddbde8a8b356e5ce
[ "Apache-2.0" ]
1
2021-02-17T10:02:54.000Z
2021-02-17T18:28:45.000Z
sonic_y_cable/y_cable.py
liorghub/sonic-platform-common
dea756df9444f230afd73981ddbde8a8b356e5ce
[ "Apache-2.0" ]
null
null
null
# # y_cable.py # # definitions for implementing Y cable access and configurations # API's for Y cable functionality in SONiC try: import math import struct from ctypes import c_int8 import sonic_platform.platform from sonic_py_common import logger except ImportError as e: # When build python3 xcvrd, it tries to do basic check which will import this file. However, # not all platform supports python3 API now, so it could cause an issue when importing # sonic_platform.platform. We skip the ImportError here. This is safe because: # 1. If any python package is not available, there will be exception when use it # 2. Vendors know their platform API version, they are responsible to use correct python # version when importing this file. pass # definitions of the offset with width accommodated for values # of MUX register specs of upper page 0x04 starting at 640 # info eeprom for Y Cable OFFSET_IDENTFIER_LOWER_PAGE = 0 OFFSET_IDENTFIER_UPPER_PAGE = 128 OFFSET_DETERMINE_CABLE_READ_SIDE = 640 OFFSET_CHECK_LINK_ACTIVE = 641 OFFSET_SWITCH_MUX_DIRECTION = 642 OFFSET_MUX_DIRECTION = 644 OFFSET_ACTIVE_TOR_INDICATOR = 645 OFFSET_MANUAL_SWITCH_COUNT = 669 OFFSET_CONFIGURE_PRBS_TYPE = 768 OFFSET_ENABLE_PRBS = 769 OFFSET_INITIATE_BER_MEASUREMENT = 770 OFFSET_TARGET = 794 OFFSET_ENABLE_LOOPBACK = 793 OFFSET_LANE_1_BER_RESULT = 771 OFFSET_MAX_LANES = 2 OFFSET_INITIATE_EYE_MEASUREMENT = 784 OFFSET_LANE_1_EYE_RESULT = 785 OFFSET_PN_NUMBER = 168 OFFSET_VENDOR_NAME = 148 OFFSET_MANUAL_SWITCH_COUNT = 653 OFFSET_AUTO_SWITCH_COUNT = 657 OFFSET_NIC_CURSOR_VALUES = 661 OFFSET_TOR1_CURSOR_VALUES = 681 OFFSET_TOR2_CURSOR_VALUES = 701 OFFSET_NIC_LANE_ACTIVE = 721 # definitions of targets for getting the cursor # equalization parameters from the register spec # the name of the target denotes which side cursor # values will be retreived TARGET_NIC = 0 TARGET_TOR1 = 1 TARGET_TOR2 = 2 # definitions of targets for getting the EYE/BER # and initiating PRBS/Loopback on the Y cable # the name of the target denotes which side values # will be retreived/initiated EYE_PRBS_TARGET_LOCAL = 0 EYE_PRBS_TARGET_TOR1 = 1 EYE_PRBS_TARGET_TOR2 = 2 EYE_PRBS_TARGET_NIC = 3 # definitions of switch counter types # to be entered by the user in get_switch_count api # for retreiving the counter values SWITCH_COUNT_MANUAL = "manual" SWITCH_COUNT_AUTO = "auto" SYSLOG_IDENTIFIER = "sonic_y_cable" # Global logger instance for helper functions and classes to log helper_logger = logger.Logger(SYSLOG_IDENTIFIER) # Global platform_chassis instance to call get_sfp required for read/write eeprom platform_chassis = None try: platform_chassis = sonic_platform.platform.Platform().get_chassis() helper_logger.log_info("chassis loaded {}".format(platform_chassis)) except Exception as e: helper_logger.log_warning("Failed to load chassis due to {}".format(repr(e))) def y_cable_validate_read_data(result, size, physical_port, message): if result is not None: if isinstance(result, bytearray): if len(result) != size: LOG_MESSAGE_TEMPLATE = "Error: for checking mux_cable {}, eeprom read returned a size {} not equal to 1 for port {}" helper_logger.log_error(LOG_MESSAGE_TEMPLATE.format(message, len(result), physical_port)) return -1 else: LOG_MESSAGE_TEMPLATE = "Error: for checking mux_cable {}, eeprom read returned an instance value of type {} which is not a bytearray for port {}" helper_logger.log_error(LOG_MESSAGE_TEMPLATE.format(message, type(result), physical_port)) return -1 else: LOG_MESSAGE_TEMPLATE = "Error: for checking mux_cable {}, eeprom read returned a None value for port {} which is not expected" helper_logger.log_error(LOG_MESSAGE_TEMPLATE.format(message, physical_port)) return -1 def hook_y_cable_simulator(target): """Decorator to add hook for calling y_cable_simulator_client. This decorator updates the y_cable driver functions to call hook functions defined in the y_cable_simulator_client module if importing the module is successful. If importing the y_cable_simulator_client module failed, just call the original y_cable driver functions defined in this module. Args: target (function): The y_cable driver function to be updated. """ def wrapper(*args, **kwargs): try: import y_cable_simulator_client y_cable_func = getattr(y_cable_simulator_client, target.__name__, None) if y_cable_func and callable(y_cable_func): return y_cable_func(*args, **kwargs) else: return target(*args, **kwargs) except ImportError: return target(*args, **kwargs) wrapper.__name__ = target.__name__ return wrapper @hook_y_cable_simulator def toggle_mux_to_torA(physical_port): """ This API specifically does a hard switch toggle of the Y cable's MUX regardless of link state to TOR A. This means if the Y cable is actively routing, the "check_active_linked_tor_side(physical_port)" API will now return Tor A. It also implies that if the link is actively routing on this port, Y cable MUX will start forwarding packets from TOR A to NIC, and drop packets from TOR B to NIC regardless of previous forwarding state. This API basically writes to upper page 4 offset 130 the value of 0x2 and expects the MUX to toggle to TOR A. Bit 0 value 0 means TOR A. Register Specification at offset 130 is documented below Byte offset bits Name Description 130 7-2 Reserved Reserved 1 Hard vs. soft switch 0b0 - Switch only if a valid TOR link on target; 0b1 Switch to new target regardless of link status 0 Switch Target Switch Target - 0b0 - TOR#1, 0b1 - TOR#2; default is TOR #1 Args: physical_port: an Integer, the actual physical port connected to Y end of a Y cable which can toggle the MUX Returns: a Boolean, true if the toggle succeeded and false if it did not succeed. """ buffer = bytearray([2]) curr_offset = OFFSET_SWITCH_MUX_DIRECTION if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) else: helper_logger.log_error("platform_chassis is not loaded, failed to toggle mux to TOR A") return False return result @hook_y_cable_simulator def toggle_mux_to_torB(physical_port): """ This API specifically does a hard switch toggle of the Y cable's MUX regardless of link state to TOR B. This means if the Y cable is actively routing, the "check_active_linked_tor_side(physical_port)" API will now return Tor B. It also implies that if the link is actively routing on this port, Y cable MUX will start forwarding packets from TOR B to NIC, and drop packets from TOR A to NIC regardless of previous forwarding state. API basically writes to upper page 4 offset 130 the value of 0x3 and expects the MUX to toggle to TOR B. Bit 0 value 1 means TOR B Register Specification at offset 130 is documented below Byte offset bits Name Description 130 7-2 Reserved Reserved 1 Hard vs. soft switch 0b0 - Switch only if a valid TOR link on target; 0b1 Switch to new target regardless of link status 0 Switch Target Switch Target - 0b0 - TOR#1, 0b1 - TOR#2; default is TOR #1 Args: physical_port: an Integer, the actual physical port connected to Y end of a Y cable which can toggle the MUX Returns: a Boolean, true if the toggle succeeded and false if it did not succeed. """ buffer = bytearray([3]) curr_offset = OFFSET_SWITCH_MUX_DIRECTION if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) else: helper_logger.log_error("platform_chassis is not loaded, failed to toggle mux to TOR B") return False return result @hook_y_cable_simulator def check_read_side(physical_port): """ This API specifically checks which side of the Y cable the reads are actually getting performed from, either TOR A or TOR B or NIC and returns the value. API basically reads 1 byte at upper page 4 offset 128 and checks which side of the Y cable the read is being performed from. Register Specification of upper page 0x4 at offset 128 is documented below Byte offset bits Name Description 7-3 Reserved Determine which side of the cable you are reading from - specifically to differentiate TOR #1 and TOR #2: 0b1 : Reading from indicated side, 0b0 not reading from that side. 2 TOR #1 Side 1 TOR #2 Side 0 NIC Side Args: physical_port: an Integer, the actual physical port connected to Y end of a Y cable which can which side reading the MUX from Returns: an Integer, 1 if reading the Y cable from TOR A side(TOR 1). , 2 if reading the Y cable from TOR B side(TOR 2). , 0 if reading the Y cable from NIC side. , -1 if reading the Y cable API fails. """ curr_offset = OFFSET_DETERMINE_CABLE_READ_SIDE if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).read_eeprom(curr_offset, 1) else: helper_logger.log_error("platform_chassis is not loaded, failed to check read side") return -1 if result is not None: if isinstance(result, bytearray): if len(result) != 1: helper_logger.log_error("Error: for checking mux_cable read side, eeprom read returned a size {} not equal to 1 for port {}".format( len(result), physical_port)) return -1 else: helper_logger.log_error("Error: for checking mux_cable read_side, eeprom read returned an instance value of type {} which is not a bytearray for port {}".format( type(result), physical_port)) return -1 else: helper_logger.log_error( "Error: for checking mux_cable read_side, eeprom read returned a None value for port {} which is not expected".format(physical_port)) return -1 regval_read = struct.unpack(">B", result) if ((regval_read[0] >> 2) & 0x01): helper_logger.log_info("Reading from TOR A") return 1 elif ((regval_read[0] >> 1) & 0x01): helper_logger.log_info("Reading from TOR B") return 2 elif (regval_read[0] & 0x01): helper_logger.log_info("Reading from NIC side") return 0 else: helper_logger.log_error( "Error: unknown status for checking which side regval = {} ".format(result)) return -1 @hook_y_cable_simulator def check_mux_direction(physical_port): """ This API specifically checks which side of the Y cable mux is currently point to and returns either TOR A or TOR B. API basically reads 1 byte at upper page 4 offset 132 and checks which side the mux is pointing to Register Specification of upper page 0x4 at offset 133 is documented below Byte offset bits Name Description 132 7-0 MUX Switch Status Register 0x00 : MUX pointing at TOR#2, 0x01 MUX pointing at TOR#1 regardless of connection status Args: physical_port: an Integer, the actual physical port connected to a Y cable Returns: an Integer, 1 if the mux is pointing to TOR A . , 2 if the mux is pointing to TOR B. , -1 if checking which side mux is pointing to API fails. """ curr_offset = OFFSET_MUX_DIRECTION if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).read_eeprom(curr_offset, 1) else: helper_logger.log_error("platform_chassis is not loaded, failed to check Active Linked and routing TOR side") return -1 if result is not None: if isinstance(result, bytearray): if len(result) != 1: helper_logger.log_error("Error: for checking mux_cable mux pointing side, eeprom read returned a size {} not equal to 1 for port {}".format( len(result), physical_port)) return -1 else: helper_logger.log_error("Error: for checking mux_cable mux pointing side, eeprom read returned an instance value of type {} which is not a bytearray for port {}".format( type(result), physical_port)) return -1 else: helper_logger.log_error( "Error: for checking mux_cable mux pointing side, eeprom read returned a None value from eeprom read for port {} which is not expected".format(physical_port)) return -1 regval_read = struct.unpack(">B", result) if ((regval_read[0]) & 0x01): helper_logger.log_info("mux pointing to TOR A") return 1 elif regval_read[0] == 0: helper_logger.log_info("mux pointing to TOR B") return 2 else: helper_logger.log_error( "Error: unknown status for mux direction regval = {} ".format(result)) return -1 return -1 @hook_y_cable_simulator def check_active_linked_tor_side(physical_port): """ This API specifically checks which side of the Y cable is actively linked and routing and returns either TOR A or TOR B. API basically reads 1 byte at upper page 4 offset 133 and checks which side is actively linked and routing. Register Specification of upper page 0x4 at offset 133 is documented below Byte offset bits Name Description 133 7-0 TOR Active Indicator 0x00, no sides linked and routing frames, 0x01 TOR #1 linked and routing, 0x02, TOR #2 linked and routing Args: physical_port: an Integer, the actual physical port connected to a Y cable Returns: an Integer, 1 if TOR A is actively linked and routing(TOR 1). , 2 if TOR B is actively linked and routing(TOR 2). , 0 if nothing linked and actively routing , -1 if checking which side linked for routing API fails. """ curr_offset = OFFSET_ACTIVE_TOR_INDICATOR if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).read_eeprom(curr_offset, 1) else: helper_logger.log_error("platform_chassis is not loaded, failed to check Active Linked and routing TOR side") return -1 if result is not None: if isinstance(result, bytearray): if len(result) != 1: helper_logger.log_error("Error: for checking mux_cable active linked side, eeprom read returned a size {} not equal to 1 for port {}".format( len(result), physical_port)) return -1 else: helper_logger.log_error("Error: for checking mux_cable active linked side, eeprom read returned an instance value of type {} which is not a bytearray for port {}".format( type(result), physical_port)) return -1 else: helper_logger.log_error( "Error: for checking mux_cable active linked side, eeprom read returned a None value from eeprom read for port {} which is not expected".format(physical_port)) return -1 regval_read = struct.unpack(">B", result) if ((regval_read[0] >> 1) & 0x01): helper_logger.log_info("TOR B active linked and actively routing") return 2 elif ((regval_read[0]) & 0x01): helper_logger.log_info("TOR A standby linked and actively routing") return 1 elif regval_read[0] == 0: helper_logger.log_info("Nothing linked for routing") return 0 else: helper_logger.log_error( "Error: unknown status for active TOR regval = {} ".format(result)) return -1 return -1 @hook_y_cable_simulator def check_if_link_is_active_for_NIC(physical_port): """ This API specifically checks if NIC side of the Y cable's link is active API basically reads 1 byte at upper page 4 offset 129 and checks if the link is active on NIC side Register Specification of upper page 0x4 at offset 129 is documented below Byte offset bits Name Description 129 7-3 Reserved Cable link status is for each end. 0b1 : Link up, 0b0 link not up. 2 TOR #1 Side 1 TOR #2 Side 0 NIC Side Args: physical_port: an Integer, the actual physical port connected to a Y cable Returns: a boolean, true if the link is active , false if the link is not active """ curr_offset = OFFSET_CHECK_LINK_ACTIVE if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).read_eeprom(curr_offset, 1) else: helper_logger.log_error("platform_chassis is not loaded, failed to check if link is Active on NIC side") return -1 if result is not None: if isinstance(result, bytearray): if len(result) != 1: helper_logger.log_error("Error: for checking mux_cable link is active on NIC side, eeprom read returned a size {} not equal to 1 for port {}".format( len(result), physical_port)) return -1 else: helper_logger.log_error("Error: for checking mux_cable link is active on NIC side, eeprom read returned an instance value of type {} which is not a bytearray for port {}".format( type(result), physical_port)) return -1 else: helper_logger.log_error( "Error: for checking mux_cable link is active on NIC side, eeprom read returned a None value from eeprom read for port {} which is not expected".format(physical_port)) return -1 regval_read = struct.unpack(">B", result) if (regval_read[0] & 0x01): helper_logger.log_info("NIC link is up") return True else: return False @hook_y_cable_simulator def check_if_link_is_active_for_torA(physical_port): """ This API specifically checks if TOR A side of the Y cable's link is active API basically reads 1 byte at upper page 4 offset 129 and checks if the link is active on NIC side Register Specification of upper page 0x4 at offset 129 is documented below Byte offset bits Name Description 129 7-3 Reserved Cable link status is for each end. 0b1 : Link up, 0b0 link not up. 2 TOR #1 Side 1 TOR #2 Side 0 NIC Side Args: physical_port: an Integer, the actual physical port connected to a Y cable Returns: a boolean, true if the link is active , false if the link is not active """ curr_offset = OFFSET_CHECK_LINK_ACTIVE if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).read_eeprom(curr_offset, 1) else: helper_logger.log_error("platform_chassis is not loaded, failed to check if link is Active on TOR A side") return -1 if result is not None: if isinstance(result, bytearray): if len(result) != 1: helper_logger.log_error("Error: for checking mux_cable link is active on TOR A side, eeprom read returned a size {} not equal to 1 for port {}".format( len(result), physical_port)) return -1 else: helper_logger.log_error("Error: for checking mux_cable link is active on TOR A side, eeprom read returned an instance value of type {} which is not a bytearray for port {}".format( type(result), physical_port)) return -1 else: helper_logger.log_error( "Error: for checking mux_cable link is active on TOR A side, eeprom read returned a None value from eeprom read for port {} which is not expected".format(physical_port)) return -1 regval_read = struct.unpack(">B", result) if ((regval_read[0] >> 2) & 0x01): helper_logger.log_info("TOR A link is up") return True else: return False @hook_y_cable_simulator def check_if_link_is_active_for_torB(physical_port): """ This API specifically checks if TOR B side of the Y cable's link is active API basically reads 1 byte at upper page 4 offset 129 and checks if the link is active on NIC side Register Specification of upper page 0x4 at offset 129 is documented below Byte offset bits Name Description 129 7-3 Reserved Cable link status is for each end. 0b1 : Link up, 0b0 link not up. 2 TOR #1 Side 1 TOR #2 Side 0 NIC Side Args: physical_port: an Integer, the actual physical port connected to a Y cable Returns: a boolean, true if the link is active , false if the link is not active """ curr_offset = OFFSET_CHECK_LINK_ACTIVE if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).read_eeprom(curr_offset, 1) else: helper_logger.log_error("platform_chassis is not loaded, failed to check if link is Active on TOR B side") return -1 if result is not None: if isinstance(result, bytearray): if len(result) != 1: helper_logger.log_error("Error: for checking mux_cable link is active on TOR B side, eeprom read returned a size {} not equal to 1 for port {}".format( len(result), physical_port)) return -1 else: helper_logger.log_error("Error: for checking mux_cable link is active on TOR B side, eeprom read returned an instance value of type {} which is not a bytearray for port {}".format( type(result), physical_port)) return -1 else: helper_logger.log_error( "Error: for checking mux_cable link is active on TOR B side, eeprom read returned a None value from eeprom read for port {} which is not expected".format(physical_port)) return -1 regval_read = struct.unpack(">B", result) if ((regval_read[0] >> 1) & 0x01): helper_logger.log_info("TOR B link is up") return True else: return False @hook_y_cable_simulator def enable_prbs_mode(physical_port, target, mode_value, lane_map): """ This API specifically configures and enables the PRBS mode/type depending upon the mode_value the user provides. The mode_value configures the PRBS Type for generation and BER sensing on a per side basis. Each side can only R/W its own value. 0x00 = PRBS 9, 0x01 = PRBS 15, 0x02 = PRBS 23, 0x03 = PRBS 31, 0x04-0xFF reserved. Target is an integer for selecting which end of the Y cable we want to run PRBS on. LaneMap specifies the lane configuration to run the PRBS on. Register Specification of upper page 0x5 at offset 128, 129 is documented below Byte offset bits Name Description 128 7-0 Reserved PRBS Type for generation and BER sensing on a per side basis. Each side can only R/W its own value. 0x00 = PRBS 9, 0x01 = PRBS 15, 0x02 = PRBS 23, 0x03 = PRBS 31, 0x04-0xFF reserved 129 7-4 Reserved 3 Lane 4 enable "Enable PRBS generation on target lane 0b1 : Enable, 0b0 disable If any lanes are enabled, then that side of cable is removed fro mission mode and no longer passing valid traffic." 2 Lane 3 enable 1 Lane 2 enable 0 Lane 1 enable Args: physical_port: an Integer, the actual physical port connected to a Y cable target: an Integer, the target on which to enable the PRBS EYE_PRBS_TARGET_LOCAL -> local side, EYE_PRBS_TARGET_TOR1 -> TOR 1 EYE_PRBS_TARGET_TOR2 -> TOR 2 EYE_PRBS_TARGET_NIC -> NIC mode_value: an Integer, the mode/type for configuring the PRBS mode. 0x00 = PRBS 9, 0x01 = PRBS 15, 0x02 = PRBS 23, 0x03 = PRBS 31 lane_map: an Integer, representing the lane_map to be run PRBS on 0bit for lane 0, 1bit for lane1 and so on. for example 3 -> 0b'0011 , means running on lane0 and lane1 Returns: a boolean, true if the enable is successful , false if the enable failed """ buffer = bytearray([target]) curr_offset = OFFSET_TARGET if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) if result is False: return result buffer = bytearray([mode_value]) curr_offset = OFFSET_CONFIGURE_PRBS_TYPE result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) if result is False: return result buffer = bytearray([lane_map]) curr_offset = OFFSET_ENABLE_PRBS result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) else: helper_logger.log_error("platform_chassis is not loaded, failed to configure the PRBS type") return -1 return result @hook_y_cable_simulator def disable_prbs_mode(physical_port, target): """ This API specifically disables the PRBS mode on the physcial port. Register Specification of upper page 0x5 at offset 129 is documented below Byte offset bits Name Description 129 7-4 Reserved 3 Lane 4 enable "Enable PRBS generation on target lane 0b1 : Enable, 0b0 disable If any lanes are enabled, then that side of cable is removed fro mission mode and no longer passing valid traffic." 2 Lane 3 enable 1 Lane 2 enable 0 Lane 1 enable Args: physical_port: an Integer, the actual physical port connected to a Y cable target: an Integer, the target on which to enable the PRBS EYE_PRBS_TARGET_LOCAL -> local side, EYE_PRBS_TARGET_TOR1 -> TOR 1 EYE_PRBS_TARGET_TOR2 -> TOR 2 EYE_PRBS_TARGET_NIC -> NIC Returns: a boolean, true if the disable is successful , false if the disable failed """ buffer = bytearray([target]) curr_offset = OFFSET_TARGET if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) if result is False: return result buffer = bytearray([0]) curr_offset = OFFSET_ENABLE_PRBS result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) else: helper_logger.log_error("platform_chassis is not loaded, failed to configure the PRBS type") return -1 return result @hook_y_cable_simulator def enable_loopback_mode(physical_port, target, lane_map): """ This API specifically configures and enables the Loopback mode on the port user provides. Target is an integer for selecting which end of the Y cable we want to run loopback on. LaneMap specifies the lane configuration to run the loopback on. Register Specification of upper page 0x5 at offset 153 is documented below Byte offset bits Name Description 153 7-4 Reserved 3 Lane 4 enable "Enable loopback generation on target lane 0b1 : Enable, 0b0 disable.The cable supports 3 modes of operation : mission mode; PRBS mode or loopback mode. Enabling loopback on any lane of any sides puts cable in loopback mode and disables PRBS. 2 Lane 3 enable 1 Lane 2 enable 0 Lane 1 enable Args: physical_port: an Integer, the actual physical port connected to a Y cable target: an Integer, the target on which to enable the PRBS EYE_PRBS_TARGET_LOCAL -> local side, EYE_PRBS_TARGET_TOR1 -> TOR 1 EYE_PRBS_TARGET_TOR2 -> TOR 2 EYE_PRBS_TARGET_NIC -> NIC lane_map: an Integer, representing the lane_map to be run PRBS on 0bit for lane 0, 1bit for lane1 and so on. for example 3 -> 0b'0011 , means running on lane0 and lane1 Returns: a boolean, true if the enable is successful , false if the enable failed """ buffer = bytearray([target]) curr_offset = OFFSET_TARGET if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) if result is False: return result buffer = bytearray([lane_map]) curr_offset = OFFSET_ENABLE_LOOPBACK result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) else: helper_logger.log_error("platform_chassis is not loaded, failed to configure the PRBS type") return -1 return result @hook_y_cable_simulator def disable_loopback_mode(physical_port, target): """ This API specifically disables the Loopback mode on the port user provides. Target is an integer for selecting which end of the Y cable we want to run loopback on. Register Specification of upper page 0x5 at offset 153 is documented below Byte offset bits Name Description 153 7-4 Reserved 3 Lane 4 enable "Enable loopback generation on target lane 0b1 : Enable, 0b0 disable.The cable supports 3 modes of operation : mission mode; PRBS mode or loopback mode. Enabling loopback on any lane of any sides puts cable in loopback mode and disables PRBS. 2 Lane 3 enable 1 Lane 2 enable 0 Lane 1 enable Args: physical_port: an Integer, the actual physical port connected to a Y cable target: an Integer, the target on which to enable the PRBS EYE_PRBS_TARGET_LOCAL -> local side, EYE_PRBS_TARGET_TOR1 -> TOR 1 EYE_PRBS_TARGET_TOR2 -> TOR 2 EYE_PRBS_TARGET_NIC -> NIC Returns: a boolean, true if the disable is successful , false if the disable failed """ buffer = bytearray([target]) curr_offset = OFFSET_TARGET if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) if result is False: return result buffer = bytearray([0]) curr_offset = OFFSET_ENABLE_LOOPBACK result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) else: helper_logger.log_error("platform_chassis is not loaded, failed to configure the PRBS type") return -1 return result @hook_y_cable_simulator def get_ber_info(physical_port, target): """ This API specifically returns the BER (Bit error rate) value for a specfic port. The target could be local side, TOR1, TOR2, NIC etc. Register Specification of upper page 0x5 at offset 130 is documented below Byte offset bits Name Description 130 1-0 Initiate BER Measurement "Write 0x00 - initiate gated BER measurement on target side with PRBS traffic Write 0x01-0xFF - reserved Read 0x00 - BER Gate in process Read 0x01 - BER Gate complete, valid values in Lane BER registers NB this command is only valid when PRBS has been enabled on at least one lane The cable supports 3 modes of operation : mission mode; PRBS mode or loopback mode. Enabling PRBS on any lane of any sides puts cable in PRBS mode and disables loopback and mission mode." Args: physical_port: an Integer, the actual physical port connected to a Y cable target: an Integer, the target on which to enable the PRBS EYE_PRBS_TARGET_LOCAL -> local side, EYE_PRBS_TARGET_TOR1 -> TOR 1 EYE_PRBS_TARGET_TOR2 -> TOR 2 EYE_PRBS_TARGET_NIC -> NIC Returns: a list, with BER values of lane 0 and lane 1 with corresponding index """ buffer = bytearray([target]) curr_offset = OFFSET_TARGET ber_result = [] if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) if result is False: return result buffer = bytearray([0]) curr_offset = OFFSET_INITIATE_BER_MEASUREMENT result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) if result is False: return result while(True): done = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset, 1) y_cable_validate_read_data(done, 1, physical_port, "BER data ready to read") if done[0] == 1: break idx = 0 maxLane = 2 curr_offset = OFFSET_LANE_1_BER_RESULT for lane in range(maxLane): msb_result = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset+idx, 1) y_cable_validate_read_data(msb_result, 1, physical_port, "BER data msb result") lsb_result = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset+1+idx, 1) y_cable_validate_read_data(lsb_result, 1, physical_port, "BER data lsb result") lane_result = msb_result[0] * math.pow(10, (lsb_result[0]-24)) ber_result.append(lane_result) idx += 2 else: helper_logger.log_error("platform_chassis is not loaded, failed to configure the PRBS type") return -1 return ber_result @hook_y_cable_simulator def get_eye_info(physical_port, target): """ This API specifically returns the EYE height value for a specfic port. The target could be local side, TOR1, TOR2, NIC etc. Register Specification of upper page 0x5 at offset 144 is documented below Byte offset bits Name Description 144 1-0 Initiate EYE Measurement "Write 0x00 - initiate gated eye height measurement on target side with any traffic (PRBS or mission mode) Write 0x01-0xFF - reserved Read 0x00 - Eye Height Measurement in process Read 0x01 - Eye Height Gate complete, valid values in Eye Height Registers NB this command can be issued whenever the side is linked, this does not interrupt mission mode traffic" R/W Args: physical_port: an Integer, the actual physical port connected to a Y cable target: an Integer, the target on which to enable the PRBS EYE_PRBS_TARGET_LOCAL -> local side, EYE_PRBS_TARGET_TOR1 -> TOR 1 EYE_PRBS_TARGET_TOR2 -> TOR 2 EYE_PRBS_TARGET_NIC -> NIC Returns: a list, with EYE values of lane 0 and lane 1 with corresponding index """ buffer = bytearray([target]) curr_offset = OFFSET_TARGET eye_result = [] if platform_chassis is not None: result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) if result is False: return result buffer = bytearray([0]) curr_offset = OFFSET_INITIATE_EYE_MEASUREMENT result = platform_chassis.get_sfp( physical_port).write_eeprom(curr_offset, 1, buffer) if result is False: return result while(True): done = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset, 1) y_cable_validate_read_data(done, 1, physical_port, "EYE data ready to read") if done[0] == 1: break idx = 0 maxLane = 2 for lane in range(maxLane): curr_offset = OFFSET_LANE_1_EYE_RESULT msb_result = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset+idx, 1) y_cable_validate_read_data(msb_result, 1, physical_port, "EYE data msb result") lsb_result = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset+1+idx, 1) y_cable_validate_read_data(lsb_result, 1, physical_port, "EYE data lsb result") lane_result = (msb_result[0] << 8 | lsb_result[0]) eye_result.append(lane_result) idx += 2 else: helper_logger.log_error("platform_chassis is not loaded, failed to configure the PRBS type") return -1 return eye_result @hook_y_cable_simulator def get_pn_number_and_vendor_name(physical_port): """ This API specifically returns the pn number and vendor name for a specfic port. Args: physical_port: an Integer, the actual physical port connected to a Y cable Returns: a tuple, with pn_number and vendor name """ curr_offset = OFFSET_PN_NUMBER if platform_chassis is not None: pn_result = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset, 15) y_cable_validate_read_data(pn_result, 1, physical_port, "PN number") curr_offset = OFFSET_VENDOR_NAME vendor_name = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset, 15) y_cable_validate_read_data(vendor_name, 15, physical_port, "vendor name") else: helper_logger.log_error("platform_chassis is not loaded, failed to get pin results") return -1 return pn_result, vendor_name @hook_y_cable_simulator def get_switch_count(physical_port, count_type): """ This API specifically returns the switch count to change the Active TOR which has been done manually by the user. Args: physical_port: an Integer, the actual physical port connected to a Y cable count_type: a string, for getting the count type "manual" -> manual switch count "auto" -> automatic switch count Returns: an integer, the number of times manually the Y-cable has been switched """ if count_type == SWITCH_COUNT_MANUAL: curr_offset = OFFSET_MANUAL_SWITCH_COUNT elif count_type == SWITCH_COUNT_AUTO: curr_offset = OFFSET_AUTO_SWITCH_COUNT else: helper_logger.log_error("not a valid count_type, failed to get switch count") return -1 count = 0 if platform_chassis is not None: msb_result = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset, 1) y_cable_validate_read_data(msb_result, 1, physical_port, "{} switch count msb result".format(count_type)) msb_result_1 = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset + 1, 1) y_cable_validate_read_data(msb_result_1, 1, physical_port, "{} switch count msb result 1".format(count_type)) msb_result_2 = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset + 2, 1) y_cable_validate_read_data(msb_result_2, 1, physical_port, "{} switch count msb result 2".format(count_type)) lsb_result = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset+3, 1) y_cable_validate_read_data(lsb_result, 1, physical_port, "{} switch count lsb result".format(count_type)) count = (msb_result[0] << 24 | msb_result_1[0] << 16 | msb_result_2[0] << 8 | lsb_result[0]) else: helper_logger.log_error("platform_chassis is not loaded, failed to get manual switch count") return -1 return count @hook_y_cable_simulator def get_target_cursor_values(physical_port, lane, target): """ This API specifically returns the cursor equalization parameters for a target(NIC, TOR1, TOR2). This includes pre one, pre two , main, post one, post two cursor values Args: physical_port: an Integer, the actual physical port connected to a Y cable lane: an Integer, the lane on which to collect the cursor values 1 -> lane 1, 2 -> lane 2 3 -> lane 3 4 -> lane 4 target: an Integer, the actual target to get the cursor values on TARGET_NIC -> NIC, TARGET_TOR1-> TOR1, TARGET_TOR2 -> TOR2 Returns: an list, with pre one, pre two , main, post one, post two cursor values in the order """ curr_offset = OFFSET_NIC_CURSOR_VALUES result = [] if platform_chassis is not None: pre1 = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset + (target)*20 + (lane-1)*5, 1) y_cable_validate_read_data(pre1, 1, physical_port, "target cursor result") result.append(c_int8(pre1[0]).value) pre2 = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset + (target)*20 + (lane-1)*5 + 1, 1) y_cable_validate_read_data(pre2, 1, physical_port, "target cursor result") result.append(c_int8(pre2[0]).value) main = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset + (target)*20 + (lane-1)*5 + 2, 1) y_cable_validate_read_data(main, 1, physical_port, "target cursor result") result.append(c_int8(main[0]).value) post1 = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset + (target)*20 + (lane-1)*5 + 3, 1) y_cable_validate_read_data(post1, 1, physical_port, "target cursor result") result.append(c_int8(post1[0]).value) post2 = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset + (target)*20 + (lane-1)*5 + 4, 1) y_cable_validate_read_data(post2, 1, physical_port, "target cursor result") result.append(c_int8(post2[0]).value) else: helper_logger.log_error("platform_chassis is not loaded, failed to get target cursor values") return -1 return result @hook_y_cable_simulator def check_if_nic_lanes_active(physical_port): """ This API specifically returns the byte value which denotes which nic lanes are detected and active Args: physical_port: an Integer, the actual physical port connected to a Y cable Returns: an integer, with lower 4 bits representing which lanes are active from 1, 2, 3, 4 in that order. """ curr_offset = OFFSET_NIC_LANE_ACTIVE result = None if platform_chassis is not None: res = platform_chassis.get_sfp(physical_port).read_eeprom(curr_offset, 1) y_cable_validate_read_data(res, 1, physical_port, "nic lanes active") result = res[0] else: helper_logger.log_error("platform_chassis is not loaded, failed to get NIC lanes active") return -1 return result
41.135379
192
0.634297
6,244
45,578
4.45836
0.071589
0.058194
0.030175
0.030893
0.804763
0.767225
0.746857
0.723579
0.699476
0.670486
0
0.027546
0.311027
45,578
1,107
193
41.172538
0.858958
0.4403
0
0.612403
0
0.034884
0.1974
0
0
0
0.0015
0
0
1
0.040698
false
0.001938
0.015504
0
0.218992
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
7d83f99a1debf45f7566fff3151da642d51b324c
125
py
Python
wafw00f/plugins/anquanbao.py
wizard531/wafw00f
dce0d0616db0f970013432c520b51aeef62d387f
[ "BSD-3-Clause" ]
10
2015-08-31T10:38:24.000Z
2021-09-30T06:39:13.000Z
wafw00f/plugins/anquanbao.py
wizard531/wafw00f
dce0d0616db0f970013432c520b51aeef62d387f
[ "BSD-3-Clause" ]
null
null
null
wafw00f/plugins/anquanbao.py
wizard531/wafw00f
dce0d0616db0f970013432c520b51aeef62d387f
[ "BSD-3-Clause" ]
17
2015-07-24T20:40:23.000Z
2021-01-08T19:41:18.000Z
#!/usr/bin/env python NAME = 'Anquanbao' def is_waf(self): return self.matchheader(('X-Powered-By-Anquanbao', '.+'))
13.888889
61
0.648
17
125
4.705882
0.882353
0
0
0
0
0
0
0
0
0
0
0
0.144
125
8
62
15.625
0.747664
0.16
0
0
0
0
0.317308
0.211538
0
0
0
0
0
1
0.333333
false
0
0
0.333333
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
7db103ad0cfaa57ca9042826667f838322394f54
38
py
Python
test/inputs/recursive_include_b.py
zaxebo1/preprocess
7cce7848d50af5b8f068127dd67f482568d9648d
[ "MIT" ]
21
2015-12-21T22:35:22.000Z
2022-02-18T03:07:55.000Z
test/inputs/recursive_include_b.py
pombreda/preprocess
7cce7848d50af5b8f068127dd67f482568d9648d
[ "MIT" ]
5
2015-09-11T15:03:03.000Z
2018-02-19T09:53:17.000Z
test/inputs/recursive_include_b.py
pombreda/preprocess
7cce7848d50af5b8f068127dd67f482568d9648d
[ "MIT" ]
10
2015-09-14T08:16:54.000Z
2022-02-18T03:08:09.000Z
# #include "recursive_include_a.py"
9.5
35
0.736842
5
38
5.2
0.8
0
0
0
0
0
0
0
0
0
0
0
0.131579
38
3
36
12.666667
0.787879
0.842105
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
7dc68972ed82e6d750013a89445cd3cbe9f1555c
22
py
Python
dash_evolution/primeros tanteos/graphs.py
BlancaCC/granadaSat_batteries
9302feddddc62c1d26ca4faa7684edd0eeb95aa1
[ "MIT" ]
null
null
null
dash_evolution/primeros tanteos/graphs.py
BlancaCC/granadaSat_batteries
9302feddddc62c1d26ca4faa7684edd0eeb95aa1
[ "MIT" ]
null
null
null
dash_evolution/primeros tanteos/graphs.py
BlancaCC/granadaSat_batteries
9302feddddc62c1d26ca4faa7684edd0eeb95aa1
[ "MIT" ]
null
null
null
import datetime def
5.5
15
0.772727
3
22
5.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.227273
22
4
16
5.5
1
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.5
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
5
7dc8406899c035199da7b5f4aa90e6f6b1c9c85f
42
py
Python
src/atomate2/vasp/jobs/__init__.py
Zhuoying/atomate2
4501c8ff2a72243dee51afb17d93ecff426b3e8c
[ "BSD-3-Clause-LBNL" ]
14
2021-09-24T05:18:02.000Z
2022-03-31T23:12:47.000Z
src/atomate2/vasp/jobs/__init__.py
Zhuoying/atomate2
4501c8ff2a72243dee51afb17d93ecff426b3e8c
[ "BSD-3-Clause-LBNL" ]
83
2021-11-02T17:19:57.000Z
2022-03-31T17:27:00.000Z
src/atomate2/vasp/jobs/__init__.py
Zhuoying/atomate2
4501c8ff2a72243dee51afb17d93ecff426b3e8c
[ "BSD-3-Clause-LBNL" ]
11
2021-11-19T09:50:45.000Z
2022-03-31T05:56:39.000Z
"""Jobs for running VASP calculations."""
21
41
0.714286
5
42
6
1
0
0
0
0
0
0
0
0
0
0
0
0.119048
42
1
42
42
0.810811
0.833333
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
815694f167f098c64949f8ea197f3f9a63dc464d
26
py
Python
cellrank/ul/__init__.py
WeilerP/cellrank
c8c2b9f6bd2448861fb414435aee7620ca5a0bad
[ "BSD-3-Clause" ]
172
2020-03-19T19:50:53.000Z
2022-03-28T09:36:04.000Z
cellrank/ul/__init__.py
WeilerP/cellrank
c8c2b9f6bd2448861fb414435aee7620ca5a0bad
[ "BSD-3-Clause" ]
702
2020-03-19T08:09:04.000Z
2022-03-30T09:55:14.000Z
cellrank/ul/__init__.py
WeilerP/cellrank
c8c2b9f6bd2448861fb414435aee7620ca5a0bad
[ "BSD-3-Clause" ]
17
2020-04-07T03:11:02.000Z
2022-02-02T20:39:16.000Z
import cellrank.ul.models
13
25
0.846154
4
26
5.5
1
0
0
0
0
0
0
0
0
0
0
0
0.076923
26
1
26
26
0.916667
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
815b1cf667ebb2e8dec95429fc5600d4b4bf3b80
10,077
py
Python
tests/app/dao/test_service_email_reply_to_dao.py
cds-snc/notifier-api
90b385ec49efbaee7e607516fc7d9f08991af813
[ "MIT" ]
41
2019-11-28T16:58:41.000Z
2022-01-28T21:11:16.000Z
tests/app/dao/test_service_email_reply_to_dao.py
cds-snc/notification-api
b1c1064f291eb860b494c3fa65ac256ad70bf47c
[ "MIT" ]
1,083
2019-07-08T12:57:24.000Z
2022-03-08T18:53:40.000Z
tests/app/dao/test_service_email_reply_to_dao.py
cds-snc/notifier-api
90b385ec49efbaee7e607516fc7d9f08991af813
[ "MIT" ]
9
2020-01-24T19:56:43.000Z
2022-01-27T21:36:53.000Z
import uuid import pytest from sqlalchemy.exc import SQLAlchemyError from app.dao.service_email_reply_to_dao import ( add_reply_to_email_address_for_service, archive_reply_to_email_address, dao_get_reply_to_by_id, dao_get_reply_to_by_service_id, update_reply_to_email_address, ) from app.errors import InvalidRequest from app.exceptions import ArchiveValidationError from app.models import ServiceEmailReplyTo from tests.app.db import create_reply_to_email, create_service def test_dao_get_reply_to_by_service_id(notify_db_session): service = create_service() default_reply_to = create_reply_to_email(service=service, email_address="something@email.com") second_reply_to = create_reply_to_email(service=service, email_address="second@email.com", is_default=False) another_reply_to = create_reply_to_email(service=service, email_address="another@email.com", is_default=False) results = dao_get_reply_to_by_service_id(service_id=service.id) assert len(results) == 3 assert default_reply_to == results[0] assert another_reply_to == results[1] assert second_reply_to == results[2] def test_dao_get_reply_to_by_service_id_does_not_return_archived_reply_tos( notify_db_session, ): service = create_service() create_reply_to_email(service=service, email_address="something@email.com") create_reply_to_email(service=service, email_address="another@email.com", is_default=False) archived_reply_to = create_reply_to_email( service=service, email_address="second@email.com", is_default=False, archived=True, ) results = dao_get_reply_to_by_service_id(service_id=service.id) assert len(results) == 2 assert archived_reply_to not in results def test_add_reply_to_email_address_for_service_creates_first_email_for_service( notify_db_session, ): service = create_service() add_reply_to_email_address_for_service(service_id=service.id, email_address="new@address.com", is_default=True) results = dao_get_reply_to_by_service_id(service_id=service.id) assert len(results) == 1 assert results[0].email_address == "new@address.com" assert results[0].is_default assert not results[0].archived def test_add_reply_to_email_address_for_service_creates_another_email_for_service( notify_db_session, ): service = create_service() create_reply_to_email(service=service, email_address="first@address.com") add_reply_to_email_address_for_service(service_id=service.id, email_address="second@address.com", is_default=False) results = dao_get_reply_to_by_service_id(service_id=service.id) assert len(results) == 2 for x in results: if x.email_address == "first@address.com": assert x.is_default elif x.email_address == "second@address.com": assert not x.is_default else: assert False def test_add_reply_to_email_address_new_reply_to_is_default_existing_reply_to_is_not( notify_db_session, ): service = create_service() create_reply_to_email(service=service, email_address="first@address.com", is_default=True) add_reply_to_email_address_for_service(service_id=service.id, email_address="second@address.com", is_default=True) results = dao_get_reply_to_by_service_id(service_id=service.id) assert len(results) == 2 for x in results: if x.email_address == "first@address.com": assert not x.is_default elif x.email_address == "second@address.com": assert x.is_default else: assert False def test_add_reply_to_email_address_can_add_a_third_reply_to_address(sample_service): add_reply_to_email_address_for_service(service_id=sample_service.id, email_address="first@address.com", is_default=True) add_reply_to_email_address_for_service( service_id=sample_service.id, email_address="second@address.com", is_default=False, ) add_reply_to_email_address_for_service( service_id=sample_service.id, email_address="third@address.com", is_default=False, ) results = dao_get_reply_to_by_service_id(service_id=sample_service.id) assert len(results) == 3 for x in results: if x.email_address == "first@address.com": assert x.is_default elif x.email_address == "second@address.com": assert not x.is_default elif x.email_address == "third@address.com": assert not x.is_default else: assert False def test_add_reply_to_email_address_ensures_first_reply_to_is_default(sample_service): with pytest.raises(expected_exception=InvalidRequest): add_reply_to_email_address_for_service( service_id=sample_service.id, email_address="first@address.com", is_default=False, ) def test_add_reply_to_email_address_ensure_there_is_not_more_than_one_default( sample_service, ): create_reply_to_email(service=sample_service, email_address="first@email.com", is_default=True) create_reply_to_email(service=sample_service, email_address="second@email.com", is_default=True) with pytest.raises(Exception): add_reply_to_email_address_for_service( service_id=sample_service.id, email_address="third_email@address.com", is_default=False, ) def test_update_reply_to_email_address(sample_service): first_reply_to = create_reply_to_email(service=sample_service, email_address="first@address.com") update_reply_to_email_address( service_id=sample_service.id, reply_to_id=first_reply_to.id, email_address="change_address@email.com", is_default=True, ) updated_reply_to = ServiceEmailReplyTo.query.get(first_reply_to.id) assert updated_reply_to.email_address == "change_address@email.com" assert updated_reply_to.updated_at assert updated_reply_to.is_default def test_update_reply_to_email_address_set_updated_to_default(sample_service): create_reply_to_email(service=sample_service, email_address="first@address.com") second_reply_to = create_reply_to_email(service=sample_service, email_address="second@address.com", is_default=False) update_reply_to_email_address( service_id=sample_service.id, reply_to_id=second_reply_to.id, email_address="change_address@email.com", is_default=True, ) results = ServiceEmailReplyTo.query.all() assert len(results) == 2 for x in results: if x.email_address == "change_address@email.com": assert x.is_default elif x.email_address == "first@address.com": assert not x.is_default else: assert False def test_update_reply_to_email_address_raises_exception_if_single_reply_to_and_setting_default_to_false( sample_service, ): first_reply_to = create_reply_to_email(service=sample_service, email_address="first@address.com") with pytest.raises(expected_exception=InvalidRequest): update_reply_to_email_address( service_id=sample_service.id, reply_to_id=first_reply_to.id, email_address="should@fail.com", is_default=False, ) def test_dao_get_reply_to_by_id(sample_service): reply_to = create_reply_to_email(service=sample_service, email_address="email@address.com") result = dao_get_reply_to_by_id(service_id=sample_service.id, reply_to_id=reply_to.id) assert result == reply_to def test_dao_get_reply_to_by_id_raises_sqlalchemy_error_when_reply_to_does_not_exist( sample_service, ): with pytest.raises(SQLAlchemyError): dao_get_reply_to_by_id(service_id=sample_service.id, reply_to_id=uuid.uuid4()) def test_dao_get_reply_to_by_id_raises_sqlalchemy_error_when_reply_to_is_archived( sample_service, ): create_reply_to_email(service=sample_service, email_address="email@address.com") archived_reply_to = create_reply_to_email( service=sample_service, email_address="email_two@address.com", is_default=False, archived=True, ) with pytest.raises(SQLAlchemyError): dao_get_reply_to_by_id(service_id=sample_service.id, reply_to_id=archived_reply_to.id) def test_dao_get_reply_to_by_id_raises_sqlalchemy_error_when_service_does_not_exist( sample_service, ): reply_to = create_reply_to_email(service=sample_service, email_address="email@address.com") with pytest.raises(SQLAlchemyError): dao_get_reply_to_by_id(service_id=uuid.uuid4(), reply_to_id=reply_to.id) def test_archive_reply_to_email_address(sample_service): create_reply_to_email(service=sample_service, email_address="first@address.com") second_reply_to = create_reply_to_email(service=sample_service, email_address="second@address.com", is_default=False) archive_reply_to_email_address(sample_service.id, second_reply_to.id) assert second_reply_to.archived is True assert second_reply_to.updated_at is not None def test_archive_reply_to_email_address_does_not_archive_a_reply_to_for_a_different_service( sample_service, ): service = create_service(service_name="First service") reply_to = create_reply_to_email(service=sample_service, email_address="first@address.com", is_default=False) with pytest.raises(SQLAlchemyError): archive_reply_to_email_address(service.id, reply_to.id) assert not reply_to.archived def test_archive_reply_to_email_address_raises_an_error_if_attempting_to_archive_a_default( sample_service, ): create_reply_to_email(service=sample_service, email_address="first@address.com", is_default=False) default_reply_to = create_reply_to_email(service=sample_service, email_address="first@address.com") with pytest.raises(ArchiveValidationError) as e: archive_reply_to_email_address(sample_service.id, default_reply_to.id) assert "You cannot delete a default email reply to address" in str(e.value) assert not default_reply_to.archived
37.322222
124
0.76233
1,459
10,077
4.795751
0.072653
0.124053
0.092611
0.081463
0.813206
0.778476
0.739603
0.702015
0.666428
0.645134
0
0.001771
0.159571
10,077
269
125
37.460967
0.824418
0
0
0.521327
0
0
0.086038
0.013893
0
0
0
0
0.170616
1
0.085308
false
0
0.037915
0
0.123223
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
8162935148153678e6d0902642a57d75ab1444e3
351
py
Python
utilities/memory/__init__.py
bootml/agent
84235db931d6e4ef956962961c619994898ebdd5
[ "Apache-2.0" ]
null
null
null
utilities/memory/__init__.py
bootml/agent
84235db931d6e4ef956962961c619994898ebdd5
[ "Apache-2.0" ]
null
null
null
utilities/memory/__init__.py
bootml/agent
84235db931d6e4ef956962961c619994898ebdd5
[ "Apache-2.0" ]
1
2018-09-27T14:31:41.000Z
2018-09-27T14:31:41.000Z
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'cnheider' from utilities.memory.data_structures.segment_tree import * from utilities.memory.data_structures.sum_tree import * from utilities.memory.transition import * from .expandable_circular_buffer import * from .experience_memory import * from .frontier import * from .scrap import *
29.25
59
0.783476
45
351
5.866667
0.555556
0.227273
0.215909
0.174242
0.397727
0
0
0
0
0
0
0.006431
0.11396
351
11
60
31.909091
0.842444
0.125356
0
0
0
0
0.02623
0
0
0
0
0
0
1
0
false
0
0.875
0
0.875
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
81a126cc7ae283471672fa86ce4500e89914e08f
168
py
Python
app/users/tests/test_commands.py
MHMasuk/recepi-api
79cca8643e884f7ddb82715edd23c9306006cf1b
[ "MIT" ]
null
null
null
app/users/tests/test_commands.py
MHMasuk/recepi-api
79cca8643e884f7ddb82715edd23c9306006cf1b
[ "MIT" ]
null
null
null
app/users/tests/test_commands.py
MHMasuk/recepi-api
79cca8643e884f7ddb82715edd23c9306006cf1b
[ "MIT" ]
null
null
null
# from unittest.mock import patch # # from django.users.management import call_command # from django.db.utils import OperationalError # from django.test import TestCase
33.6
50
0.815476
23
168
5.913043
0.652174
0.220588
0
0
0
0
0
0
0
0
0
0
0.119048
168
5
51
33.6
0.918919
0.940476
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
81b5a6b11b35caa05d64b090f33c35893f015212
423
py
Python
apps/products/admin.py
8area8/p8_pure_beurre
9e930f52a5f2c4c6c25a0a52b247f7b61fc7ffe8
[ "MIT" ]
null
null
null
apps/products/admin.py
8area8/p8_pure_beurre
9e930f52a5f2c4c6c25a0a52b247f7b61fc7ffe8
[ "MIT" ]
3
2020-06-05T19:09:18.000Z
2022-02-10T13:20:38.000Z
apps/products/admin.py
8area8/p8_pure_beurre
9e930f52a5f2c4c6c25a0a52b247f7b61fc7ffe8
[ "MIT" ]
null
null
null
"""Products admin.""" from django.contrib import admin from .models import Product, Category, Substitute from django.contrib.auth.decorators import user_passes_test from django.contrib.admin import AdminSite from django.contrib.admin.apps import AdminConfig from django.views.decorators.cache import never_cache @admin.register(Product, Category, Substitute) class Products(admin.ModelAdmin): """Class.""" pass
26.4375
59
0.79669
54
423
6.185185
0.462963
0.149701
0.203593
0.131737
0
0
0
0
0
0
0
0
0.111111
423
15
60
28.2
0.888298
0.052009
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.222222
0.666667
0
0.777778
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
1
1
0
1
0
0
5
81b63a9ac7111da164f521fe1f830112afc6cb9d
126
py
Python
ch5/gen.yield.from.py
ldmcdaniel/learning_python
63717c397cd75e45a8aef909d4b601466cd6036a
[ "MIT" ]
55
2018-07-04T10:12:15.000Z
2022-03-03T19:51:54.000Z
ch5/gen.yield.from.py
ldmcdaniel/learning_python
63717c397cd75e45a8aef909d4b601466cd6036a
[ "MIT" ]
6
2020-03-24T16:37:46.000Z
2021-06-10T21:04:36.000Z
ch5/gen.yield.from.py
ldmcdaniel/learning_python
63717c397cd75e45a8aef909d4b601466cd6036a
[ "MIT" ]
32
2018-07-10T05:56:31.000Z
2021-09-04T23:19:42.000Z
def print_squares(start, end): yield from (n ** 2 for n in range(start, end)) for n in print_squares(2, 5): print(n)
21
50
0.642857
24
126
3.291667
0.541667
0.303797
0.151899
0
0
0
0
0
0
0
0
0.030612
0.222222
126
5
51
25.2
0.77551
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0
0.25
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
1
0
0
0
0
0
1
0
5
c4d7dddf6f6f918df87cd477c992bc2c00044bde
121
py
Python
src/synamic/core/services/filesystem/backends/in_memory_backend.py
SabujXi/Synamic
c9c06ecf874be82dbb2cba890cb483300809de98
[ "MIT" ]
7
2017-10-15T16:58:47.000Z
2020-07-02T01:08:21.000Z
src/synamic/core/services/filesystem/backends/in_memory_backend.py
SabujXi/Synamic
c9c06ecf874be82dbb2cba890cb483300809de98
[ "MIT" ]
2
2020-08-10T12:26:35.000Z
2020-08-10T12:29:26.000Z
src/synamic/core/services/filesystem/backends/in_memory_backend.py
SabujXi/Synamic
c9c06ecf874be82dbb2cba890cb483300809de98
[ "MIT" ]
2
2018-02-04T14:03:38.000Z
2018-02-04T15:25:59.000Z
from synamic.core.contracts import BaseFsBackendContract class InMemoryBackend(BaseFsBackendContract): pass
17.285714
57
0.793388
10
121
9.6
0.9
0
0
0
0
0
0
0
0
0
0
0
0.165289
121
6
58
20.166667
0.950495
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.333333
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
1
1
0
0
0
0
5
f201c0f5ee53fe3aed1433cb7314607e8a681606
183
py
Python
_benchmarks/flask_server.py
axegon/Milvago
4e05e54fa34190c8a5eb4d4913b5231e660e6711
[ "MIT" ]
null
null
null
_benchmarks/flask_server.py
axegon/Milvago
4e05e54fa34190c8a5eb4d4913b5231e660e6711
[ "MIT" ]
1
2020-08-11T12:50:50.000Z
2020-08-11T12:50:50.000Z
_benchmarks/flask_server.py
axegon/Milvago
4e05e54fa34190c8a5eb4d4913b5231e660e6711
[ "MIT" ]
null
null
null
from flask import Flask, Response from common_data import CONTENTS app = Flask(__name__) @app.route('/') def hello_world(): return Response(CONTENTS, mimetype='application/json')
26.142857
58
0.765027
24
183
5.583333
0.708333
0
0
0
0
0
0
0
0
0
0
0
0.120219
183
7
58
26.142857
0.832298
0
0
0
0
0
0.092391
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0.166667
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
1
1
0
0
5
481fd999a88ccbfc351bb6625bc71fd2f8b22dc3
99
py
Python
jinjamator/plugins/content/os/__init__.py
jinjamator/jinjamator
6c48a6eedea9b9f461c66b5dddd609fa39610f0d
[ "Apache-2.0" ]
7
2020-05-06T07:48:14.000Z
2021-12-11T15:57:26.000Z
jinjamator/plugins/content/os/__init__.py
jinjamator/jinjamator
6c48a6eedea9b9f461c66b5dddd609fa39610f0d
[ "Apache-2.0" ]
1
2020-04-11T15:13:07.000Z
2020-04-27T20:01:34.000Z
jinjamator/plugins/content/os/__init__.py
jinjamator/jinjamator
6c48a6eedea9b9f461c66b5dddd609fa39610f0d
[ "Apache-2.0" ]
1
2020-05-29T08:53:08.000Z
2020-05-29T08:53:08.000Z
import os def path(): return os.path def mkdir(path): os.makedirs(path, exist_ok=True)
9.9
36
0.656566
16
99
4
0.625
0
0
0
0
0
0
0
0
0
0
0
0.222222
99
9
37
11
0.831169
0
0
0
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0.2
0.2
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
1
0
0
0
1
1
0
0
5
48293d8b9d8fcdcf9d0a55048fdef348d035b088
186
py
Python
hikyuu/admin/widget/__init__.py
jiangtiantu/hikyuu
46b34ebc24ad163c99532c2d25f254e2a3336d30
[ "MIT" ]
2
2021-07-08T14:09:50.000Z
2021-11-17T11:08:35.000Z
hikyuu/admin/widget/__init__.py
dasuren/hikyuu
d1a1a43c10653d17ac91446e4499e6cfbfdbce12
[ "MIT" ]
null
null
null
hikyuu/admin/widget/__init__.py
dasuren/hikyuu
d1a1a43c10653d17ac91446e4499e6cfbfdbce12
[ "MIT" ]
1
2021-12-19T23:52:13.000Z
2021-12-19T23:52:13.000Z
# -*- coding: utf-8 -*- from .RestDataTableModel import RestDataTableModel from .HkuSessionViewWidget import HkuSessionViewWidget from .HkuUserManagerWidget import HkuUserManagerWidget
31
54
0.83871
15
186
10.4
0.533333
0
0
0
0
0
0
0
0
0
0
0.005952
0.096774
186
5
55
37.2
0.922619
0.112903
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
483648387518a8d200a2bc659ad2f15e69e321fd
686
py
Python
qiskit/providers/aer/noise/errors/__init__.py
zlatko-minev/qiskit-aer
339397ae2b392b31072113cfd940eee4624b016c
[ "Apache-2.0" ]
null
null
null
qiskit/providers/aer/noise/errors/__init__.py
zlatko-minev/qiskit-aer
339397ae2b392b31072113cfd940eee4624b016c
[ "Apache-2.0" ]
null
null
null
qiskit/providers/aer/noise/errors/__init__.py
zlatko-minev/qiskit-aer
339397ae2b392b31072113cfd940eee4624b016c
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # Copyright 2018, IBM. # # This source code is licensed under the Apache License, Version 2.0 found in # the LICENSE.txt file in the root directory of this source tree. """Standard error module for Qiskit Aer.""" from .standard_errors import kraus_error from .standard_errors import mixed_unitary_error from .standard_errors import coherent_unitary_error from .standard_errors import pauli_error from .standard_errors import depolarizing_error from .standard_errors import thermal_relaxation_error from .standard_errors import phase_amplitude_damping_error from .standard_errors import amplitude_damping_error from .standard_errors import phase_damping_error
36.105263
77
0.830904
99
686
5.505051
0.464646
0.198165
0.297248
0.39633
0.52844
0.368807
0.165138
0
0
0
0
0.01157
0.118076
686
18
78
38.111111
0.889256
0.322157
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
48677b1e62ea4f9a50f88a6459e1a506b886d459
37
py
Python
pyatv/airplay/__init__.py
fantomnotabene/pyatv
382805aebcf7560c057e1105ac4b212a5db0ec00
[ "MIT" ]
null
null
null
pyatv/airplay/__init__.py
fantomnotabene/pyatv
382805aebcf7560c057e1105ac4b212a5db0ec00
[ "MIT" ]
null
null
null
pyatv/airplay/__init__.py
fantomnotabene/pyatv
382805aebcf7560c057e1105ac4b212a5db0ec00
[ "MIT" ]
null
null
null
"""AirPlay related functionality."""
18.5
36
0.72973
3
37
9
1
0
0
0
0
0
0
0
0
0
0
0
0.081081
37
1
37
37
0.794118
0.810811
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
6f87988340ddb4f27a8b60e22ab44f64644ce114
101
py
Python
src/the_tale/the_tale/game/mobs/conf.py
al-arz/the-tale
542770257eb6ebd56a5ac44ea1ef93ff4ab19eb5
[ "BSD-3-Clause" ]
85
2017-11-21T12:22:02.000Z
2022-03-27T23:07:17.000Z
src/the_tale/the_tale/game/mobs/conf.py
al-arz/the-tale
542770257eb6ebd56a5ac44ea1ef93ff4ab19eb5
[ "BSD-3-Clause" ]
545
2017-11-04T14:15:04.000Z
2022-03-27T14:19:27.000Z
src/the_tale/the_tale/game/mobs/conf.py
al-arz/the-tale
542770257eb6ebd56a5ac44ea1ef93ff4ab19eb5
[ "BSD-3-Clause" ]
45
2017-11-11T12:36:30.000Z
2022-02-25T06:10:44.000Z
import smart_imports smart_imports.all() mobs_settings = utils_app_settings.app_settings('MOBS')
12.625
55
0.811881
14
101
5.428571
0.571429
0.315789
0
0
0
0
0
0
0
0
0
0
0.09901
101
7
56
14.428571
0.835165
0
0
0
0
0
0.04
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
6fa0dac91015c3b5d3133a867d1e931bcd546942
505
py
Python
rsttace/output/__init__.py
tinokuba/Rst-EvTa
c53230645187fea67ed0d9d8deab08bdc7aba36a
[ "MIT" ]
12
2019-05-20T11:32:42.000Z
2022-03-07T09:30:50.000Z
rsttace/output/__init__.py
tinokuba/Rst-EvTa
c53230645187fea67ed0d9d8deab08bdc7aba36a
[ "MIT" ]
null
null
null
rsttace/output/__init__.py
tinokuba/Rst-EvTa
c53230645187fea67ed0d9d8deab08bdc7aba36a
[ "MIT" ]
2
2022-01-17T03:25:59.000Z
2022-01-19T12:16:51.000Z
# -*- coding: utf-8 -*- """ Created on Sat Nov 23 00:49:01 2018 @author: tinokuba """ from .tableoutputs import RelTableLogger from .tableoutputs import RelTableCliOutput from .tableoutputs import RelTableDummyOutput from .tableoutputs import CompTableLogger from .tableoutputs import CompTableCliOutput from .tableoutputs import CompTableDummyOutput from .tableoutputs import CompareSetTableLogger from .tableoutputs import CompareSetTableCliOutput from .tableoutputs import CompareSetTableDummyOutput
29.705882
52
0.837624
50
505
8.46
0.52
0.340426
0.468085
0
0
0
0
0
0
0
0
0.028825
0.106931
505
16
53
31.5625
0.909091
0.152475
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
6fab89f012d4a2015e2c29dda4e881c218eee9e3
162
py
Python
amr_tv/transmission_events/urls.py
ivansg44/AMR-TV
57f208fc01de5805e63a997586138fa09538611f
[ "MIT" ]
null
null
null
amr_tv/transmission_events/urls.py
ivansg44/AMR-TV
57f208fc01de5805e63a997586138fa09538611f
[ "MIT" ]
4
2020-11-13T20:20:13.000Z
2020-11-29T01:01:41.000Z
amr_tv/transmission_events/urls.py
ivansg44/AMR-TV
57f208fc01de5805e63a997586138fa09538611f
[ "MIT" ]
null
null
null
from django.urls import path from amr_tv.transmission_events.views import transmission_events_view urlpatterns = [ path("", view=transmission_events_view) ]
23.142857
69
0.808642
21
162
5.952381
0.571429
0.432
0.352
0
0
0
0
0
0
0
0
0
0.117284
162
6
70
27
0.874126
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
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
6fb08d5668488d0b907a59ff7ad32d4cff2a5332
187
py
Python
gemmforge/instructions/__init__.py
ravil-mobile/gemmforge
6381584c2d1ce77eaa938de02bc4f130f19cb2e4
[ "MIT" ]
null
null
null
gemmforge/instructions/__init__.py
ravil-mobile/gemmforge
6381584c2d1ce77eaa938de02bc4f130f19cb2e4
[ "MIT" ]
2
2021-02-01T16:31:22.000Z
2021-05-05T13:44:43.000Z
gemmforge/instructions/__init__.py
ravil-mobile/gemmforge
6381584c2d1ce77eaa938de02bc4f130f19cb2e4
[ "MIT" ]
null
null
null
from .ptr_manip import GetElementPtr from .allocate import RegisterAlloc, ShrMemAlloc from .store import StoreRegToGlb from .gemm import GenericGemm from .sync_threads import SyncThreads
31.166667
48
0.855615
23
187
6.869565
0.652174
0
0
0
0
0
0
0
0
0
0
0
0.112299
187
5
49
37.4
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
1
0
0
5
b50034d1dcf3604d49f37dc49a293442f0e59e16
976
py
Python
tests/test_bar.py
docsmooth/arbtt-chart
688d0a0edbd7557a4c6e23b232759f92fef5c158
[ "MIT" ]
7
2021-03-04T03:24:22.000Z
2022-01-28T18:50:55.000Z
tests/test_bar.py
docsmooth/arbtt-chart
688d0a0edbd7557a4c6e23b232759f92fef5c158
[ "MIT" ]
1
2021-03-03T18:47:57.000Z
2021-03-03T18:48:01.000Z
tests/test_bar.py
docsmooth/arbtt-chart
688d0a0edbd7557a4c6e23b232759f92fef5c158
[ "MIT" ]
1
2021-03-03T16:02:47.000Z
2021-03-03T16:02:47.000Z
from types import SimpleNamespace import arbtt_chart as ac def test_bar(): def b(**kwargs): return ac.bar(20, SimpleNamespace(Type='bar', HourFrac=0.5, **kwargs)) assert ac.bar(20, SimpleNamespace(Type='text')) == "" assert b(FracAbove=0, Frac=1 ) == "██████████▓█████████" assert b(FracAbove=0, Frac=0.5 ) == "██████████÷·········" assert b(FracAbove=0, Frac=0.4 ) == "████████··÷·········" assert b(FracAbove=0, Frac=0.43 ) == "████████▋·÷·········" assert b(FracAbove=0.1, Frac=0.43 ) == "··████████▋·········" assert b(FracAbove=0.13, Frac=0.43 ) == "··▐███████▓▏········" assert b(FracAbove=0.145, Frac=0.43 ) == "··▕███████▓▍········" assert b(FracAbove=0.1, Frac=0.01 ) == "··▎·······÷·········" assert b(FracAbove=0.125, Frac=0.015) == "··▕▏······÷·········" assert b(FracAbove=0.145, Frac=0.01 ) == "··▕·······÷·········" assert b(FracAbove=0.125, Frac=0.027) == "··▐▏······÷·········"
48.8
91
0.447746
127
976
5.15748
0.338583
0.117557
0.268702
0.285496
0.435115
0.323664
0.222901
0
0
0
0
0.07911
0.171107
976
19
92
51.368421
0.458591
0
0
0
0
0
0.232582
0
0
0
0
0
0.75
1
0.125
true
0
0.125
0.0625
0.25
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
1
0
0
1
0
0
0
0
0
0
5
b5030c534ff1e3a06e9232511ffcc1ddcf8e78af
3,974
py
Python
HashFolia/deck.py
blouco/hashfolia
406f251f8fb599256ed1e445541f166f909eb859
[ "MIT" ]
null
null
null
HashFolia/deck.py
blouco/hashfolia
406f251f8fb599256ed1e445541f166f909eb859
[ "MIT" ]
2
2021-02-09T21:29:23.000Z
2021-02-10T02:12:36.000Z
HashFolia/deck.py
blouco/hashfolia
406f251f8fb599256ed1e445541f166f909eb859
[ "MIT" ]
1
2021-02-07T18:10:09.000Z
2021-02-07T18:10:09.000Z
deck = { "major": [ { "img": "static/tarot/major/a01.jpg" }, { "img": "static/tarot/major/a02.jpg" }, { "img": "static/tarot/major/a03.jpg" }, { "img": "static/tarot/major/a04.jpg" }, { "img": "static/tarot/major/a05.jpg" }, { "img": "static/tarot/major/a06.jpg" }, { "img": "static/tarot/major/a07.jpg" }, { "img": "static/tarot/major/a08.jpg" }, { "img": "static/tarot/major/a09.jpg" }, { "img": "static/tarot/major/a10.jpg" }, { "img": "static/tarot/major/a11.jpg" }, { "img": "static/tarot/major/a12.jpg" }, { "img": "static/tarot/major/a13.jpg" }, { "img": "static/tarot/major/a14.jpg" }, { "img": "static/tarot/major/a15.jpg" }, { "img": "static/tarot/major/a16.jpg" }, { "img": "static/tarot/major/a17.jpg" }, { "img": "static/tarot/major/a18.jpg" }, { "img": "static/tarot/major/a19.jpg" }, { "img": "static/tarot/major/a20.jpg" }, { "img": "static/tarot/major/a21.jpg" }, { "img": "static/tarot/major/a22.jpg" }, ], "minor": [ { "img": "static/tarot/minor/b01.jpg" }, { "img": "static/tarot/minor/b02.jpg" }, { "img": "static/tarot/minor/b03.jpg" }, { "img": "static/tarot/minor/b04.jpg" }, { "img": "static/tarot/minor/b05.jpg" }, { "img": "static/tarot/minor/b06.jpg" }, { "img": "static/tarot/minor/b07.jpg" }, { "img": "static/tarot/minor/b08.jpg" }, { "img": "static/tarot/minor/b09.jpg" }, { "img": "static/tarot/minor/b10.jpg" }, { "img": "static/tarot/minor/b11.jpg" }, { "img": "static/tarot/minor/b12.jpg" }, { "img": "static/tarot/minor/b13.jpg" }, { "img": "static/tarot/minor/b14.jpg" }, { "img": "static/tarot/minor/c01.jpg" }, { "img": "static/tarot/minor/c02.jpg" }, { "img": "static/tarot/minor/c03.jpg" }, { "img": "static/tarot/minor/c04.jpg" }, { "img": "static/tarot/minor/c05.jpg" }, { "img": "static/tarot/minor/c06.jpg" }, { "img": "static/tarot/minor/c07.jpg" }, { "img": "static/tarot/minor/c08.jpg" }, { "img": "static/tarot/minor/c09.jpg" }, { "img": "static/tarot/minor/c10.jpg" }, { "img": "static/tarot/minor/c11.jpg" }, { "img": "static/tarot/minor/c12.jpg" }, { "img": "static/tarot/minor/c13.jpg" }, { "img": "static/tarot/minor/c14.jpg" }, { "img": "static/tarot/minor/d01.jpg" }, { "img": "static/tarot/minor/d02.jpg" }, { "img": "static/tarot/minor/d03.jpg" }, { "img": "static/tarot/minor/d04.jpg" }, { "img": "static/tarot/minor/d05.jpg" }, { "img": "static/tarot/minor/d06.jpg" }, { "img": "static/tarot/minor/d07.jpg" }, { "img": "static/tarot/minor/d08.jpg" }, { "img": "static/tarot/minor/d09.jpg" }, { "img": "static/tarot/minor/d10.jpg" }, { "img": "static/tarot/minor/d11.jpg" }, { "img": "static/tarot/minor/d12.jpg" }, { "img": "static/tarot/minor/d13.jpg" }, { "img": "static/tarot/minor/d14.jpg" }, { "img": "static/tarot/minor/e01.jpg" }, { "img": "static/tarot/minor/e02.jpg" }, { "img": "static/tarot/minor/e03.jpg" }, { "img": "static/tarot/minor/e04.jpg" }, { "img": "static/tarot/minor/e05.jpg" }, { "img": "static/tarot/minor/e06.jpg" }, { "img": "static/tarot/minor/e07.jpg" }, { "img": "static/tarot/minor/e08.jpg" }, { "img": "static/tarot/minor/e09.jpg" }, { "img": "static/tarot/minor/e10.jpg" }, { "img": "static/tarot/minor/e11.jpg" }, { "img": "static/tarot/minor/e12.jpg" }, { "img": "static/tarot/minor/e13.jpg" }, { "img": "static/tarot/minor/e14.jpg" }, { "img": "static/tarot/minor/z00.jpg" }, { "img": "static/tarot/minor/z01.jpg" }, ] }
45.678161
48
0.506794
483
3,974
4.169772
0.180124
0.357498
0.556107
0.658391
0.852036
0
0
0
0
0
0
0.053548
0.248113
3,974
86
49
46.209302
0.620482
0
0
0
0
0
0.586311
0.523402
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
1
1
1
1
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
0
0
0
0
0
0
0
5
b50a79a4cc519c560575aa48341ec5161c7de5dd
185
py
Python
broadlinkhacktools/__init__.py
felipediel/broadlink-hacktools
3c27e2a37c529d5cc13a023db7e1818d1b4859ce
[ "MIT" ]
8
2020-02-29T06:47:30.000Z
2022-02-07T12:31:11.000Z
broadlinkhacktools/__init__.py
felipediel/broadlink-hacktools
3c27e2a37c529d5cc13a023db7e1818d1b4859ce
[ "MIT" ]
1
2022-02-10T19:57:19.000Z
2022-02-15T00:35:21.000Z
broadlinkhacktools/__init__.py
felipediel/broadlink-hacktools
3c27e2a37c529d5cc13a023db7e1818d1b4859ce
[ "MIT" ]
3
2020-05-20T14:20:02.000Z
2022-01-16T17:02:58.000Z
"""Broadlink hacktools.""" from .decryptor import PacketDecryptor from .printer import PacketPrinter from .protocol.packets import PacketFactory from .storage import PersistenceHandler
30.833333
43
0.837838
19
185
8.157895
0.684211
0
0
0
0
0
0
0
0
0
0
0
0.097297
185
5
44
37
0.928144
0.108108
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
b510630649c7da940e44a626d9ff1c14c5096710
802
py
Python
bread/layout/__init__.py
weblate/bread
e2af05ddabb1d267ccd7b35e646934e560594560
[ "Apache-2.0", "BSD-3-Clause" ]
1
2022-03-20T16:14:51.000Z
2022-03-20T16:14:51.000Z
bread/layout/__init__.py
weblate/bread
e2af05ddabb1d267ccd7b35e646934e560594560
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
bread/layout/__init__.py
weblate/bread
e2af05ddabb1d267ccd7b35e646934e560594560
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
from . import components # noqa from .base import * # noqa from .components import button # noqa from .components import content_switcher # noqa from .components import datatable # noqa from .components import form # noqa from .components import grid # noqa from .components import helpers # noqa from .components import icon # noqa from .components import modal # noqa from .components import multiselect # noqa from .components import notification # noqa from .components import overflow_menu # noqa from .components import progress_indicator # noqa from .components import search # noqa from .components import tabs # noqa from .components import tag # noqa from .components import text_area # noqa from .components import text_input # noqa from .components import toggle # noqa
38.190476
50
0.774314
103
802
5.980583
0.262136
0.246753
0.525974
0.701299
0.090909
0
0
0
0
0
0
0
0.174564
802
20
51
40.1
0.930514
0.123441
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
82ed810da2b934d87a3ea28073321a74cb18d9d9
53
py
Python
fpl_reader/__init__.py
rr-/fpl_reader
d4099a597a3eb2fe18f410334639e3189eac24af
[ "MIT" ]
18
2015-11-12T17:34:04.000Z
2022-01-13T14:42:00.000Z
fpl_reader/__init__.py
rr-/fpl_reader
d4099a597a3eb2fe18f410334639e3189eac24af
[ "MIT" ]
1
2015-11-13T18:14:59.000Z
2015-11-13T18:14:59.000Z
fpl_reader/__init__.py
rr-/fpl_reader
d4099a597a3eb2fe18f410334639e3189eac24af
[ "MIT" ]
1
2015-11-13T18:02:22.000Z
2015-11-13T18:02:22.000Z
from fpl_reader.playlist_reader import read_playlist
26.5
52
0.90566
8
53
5.625
0.75
0
0
0
0
0
0
0
0
0
0
0
0.075472
53
1
53
53
0.918367
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
82f889b9dee38643e10717727410d4f3407c0cd9
640
py
Python
selfsup/multi/basenets/basenet.py
abhaymittal/self-supervision
fe99e707bcccc0eed39dfe8a4651c433caf6f8c4
[ "BSD-3-Clause" ]
29
2017-04-13T17:39:43.000Z
2022-02-17T10:01:10.000Z
selfsup/multi/basenets/basenet.py
abhaymittal/self-supervision
fe99e707bcccc0eed39dfe8a4651c433caf6f8c4
[ "BSD-3-Clause" ]
7
2017-05-10T07:30:16.000Z
2019-09-09T15:38:20.000Z
selfsup/multi/basenets/basenet.py
abhaymittal/self-supervision
fe99e707bcccc0eed39dfe8a4651c433caf6f8c4
[ "BSD-3-Clause" ]
6
2017-09-10T15:57:26.000Z
2020-04-21T06:14:30.000Z
class BaseNet: def __init__(self): pass @property def name(self): raise NotImplemented('Abstract base class') @property def canonical_input_size(self): raise NotImplemented('Abstract base class') @property def hypercolumn_layers(self): """Suggested hypercolumn layers""" return [] @property def layers(self): return [name for name, _ in self.hypercolumn_layers] def build(self): raise NotImplemented('Abstract base class') def save_caffemodel(self, path, session, verbose=False): raise NotImplemented('Abstract base class')
22.068966
60
0.646875
68
640
5.941176
0.411765
0.108911
0.267327
0.306931
0.440594
0.351485
0.252475
0.252475
0
0
0
0
0.2625
640
28
61
22.857143
0.855932
0.04375
0
0.421053
0
0
0.125828
0
0
0
0
0
0
1
0.368421
false
0.052632
0
0.052632
0.526316
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
5
d228c0bad4404e6adde1b2ea198dc345fc6fa409
239
py
Python
exceptions.py
lifearoundfreaks/youtube-download
c54fd177be3d62e32c348bed6134a79b52011104
[ "MIT" ]
1
2021-04-10T18:26:22.000Z
2021-04-10T18:26:22.000Z
exceptions.py
lifearoundfreaks/youtube-download
c54fd177be3d62e32c348bed6134a79b52011104
[ "MIT" ]
1
2021-12-30T12:45:35.000Z
2021-12-30T12:45:35.000Z
exceptions.py
lifearoundfreaks/youtube-download
c54fd177be3d62e32c348bed6134a79b52011104
[ "MIT" ]
3
2021-04-23T19:27:55.000Z
2022-03-28T21:57:42.000Z
class BaseBotException(Exception): pass class InputValidationException(BaseBotException): """ User sent us invalid data """ class ForbiddenUserOperation(BaseBotException): """ User tries to do something we do not allow """
21.727273
54
0.740586
24
239
7.375
0.75
0.225989
0
0
0
0
0
0
0
0
0
0
0.171548
239
10
55
23.9
0.893939
0.288703
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.25
0
0
0.75
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
1
0
0
5
d230d22d13c997a7829086329cbf28de1b4b12b0
119
py
Python
Back/generalchatroom/admin.py
sadeghjafari5528/404-
0499b93cc473ec4def96d95364180eb4f4dafb11
[ "MIT" ]
null
null
null
Back/generalchatroom/admin.py
sadeghjafari5528/404-
0499b93cc473ec4def96d95364180eb4f4dafb11
[ "MIT" ]
1
2020-12-27T14:59:35.000Z
2020-12-27T14:59:35.000Z
Back/generalchatroom/admin.py
sadeghjafari5528/404-
0499b93cc473ec4def96d95364180eb4f4dafb11
[ "MIT" ]
2
2020-10-30T08:08:32.000Z
2020-10-30T20:47:51.000Z
from django.contrib import admin # Register your models here. from .models import Message admin.site.register(Message)
23.8
32
0.815126
17
119
5.705882
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.117647
119
5
33
23.8
0.92381
0.218487
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
966b9d6819973a2fce590f8307f6ce65e20cc972
207
py
Python
wheatley/rhythm/__init__.py
jamesscottbrown/wheatley
c1d83cedad542efeb259475c2c9ba88395aee715
[ "MIT" ]
14
2020-08-16T21:41:13.000Z
2021-07-13T01:15:01.000Z
wheatley/rhythm/__init__.py
jamesscottbrown/wheatley
c1d83cedad542efeb259475c2c9ba88395aee715
[ "MIT" ]
121
2020-08-13T16:54:46.000Z
2021-09-17T10:32:04.000Z
wheatley/rhythm/__init__.py
jamesscottbrown/wheatley
c1d83cedad542efeb259475c2c9ba88395aee715
[ "MIT" ]
10
2020-12-20T03:52:47.000Z
2021-11-22T14:46:15.000Z
""" A module to hold various classes determining when Wheatley rings his bells. """ from .wait_for_user import WaitForUserRhythm from .regression import RegressionRhythm from .abstract_rhythm import Rhythm
34.5
83
0.821256
27
207
6.185185
0.814815
0
0
0
0
0
0
0
0
0
0
0
0.130435
207
5
84
41.4
0.927778
0.362319
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
968f5eaf8fdde5fdace9617fb242f92755cb5289
204
py
Python
bumperboats/snapshot.py
wounded-pixels/bumper-boats
b1da0381271ac97ea0021321f22139c331759720
[ "MIT" ]
null
null
null
bumperboats/snapshot.py
wounded-pixels/bumper-boats
b1da0381271ac97ea0021321f22139c331759720
[ "MIT" ]
null
null
null
bumperboats/snapshot.py
wounded-pixels/bumper-boats
b1da0381271ac97ea0021321f22139c331759720
[ "MIT" ]
null
null
null
from collections import namedtuple Snapshot = namedtuple('Snapshot', 'state estimated_position measurement residual mahalanobis log_likelihood actual_position actual_state actual_id elapsed covariance')
51
167
0.867647
23
204
7.478261
0.73913
0.209302
0
0
0
0
0
0
0
0
0
0
0.093137
204
3
168
68
0.92973
0
0
0
0
0
0.676471
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
1
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
737ee6f737d2b3eea9adfc146b89d4da50a1948d
23,287
py
Python
ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/host_ccc6ee5b5f10dfdd7800ee0a19c9fc08.py
Vibaswan/ixnetwork_restpy
239fedc7050890746cbabd71ea1e91c68d9e5cad
[ "MIT" ]
null
null
null
ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/host_ccc6ee5b5f10dfdd7800ee0a19c9fc08.py
Vibaswan/ixnetwork_restpy
239fedc7050890746cbabd71ea1e91c68d9e5cad
[ "MIT" ]
null
null
null
ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/host_ccc6ee5b5f10dfdd7800ee0a19c9fc08.py
Vibaswan/ixnetwork_restpy
239fedc7050890746cbabd71ea1e91c68d9e5cad
[ "MIT" ]
null
null
null
# MIT LICENSE # # Copyright 1997 - 2020 by IXIA Keysight # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. from ixnetwork_restpy.base import Base from ixnetwork_restpy.files import Files class Host(Base): """A list of simulated hosts which received multicast traffic. The Host class encapsulates a list of host resources that are managed by the user. A list of resources can be retrieved from the server using the Host.find() method. The list can be managed by using the Host.add() and Host.remove() methods. """ __slots__ = () _SDM_NAME = 'host' _SDM_ATT_MAP = { 'EnableImmediateResp': 'enableImmediateResp', 'EnableQueryResMode': 'enableQueryResMode', 'EnableRouterAlert': 'enableRouterAlert', 'EnableSpecificResMode': 'enableSpecificResMode', 'EnableSuppressReport': 'enableSuppressReport', 'EnableUnsolicitedResMode': 'enableUnsolicitedResMode', 'Enabled': 'enabled', 'InterfaceIndex': 'interfaceIndex', 'InterfaceType': 'interfaceType', 'Interfaces': 'interfaces', 'ProtocolInterface': 'protocolInterface', 'ReportFreq': 'reportFreq', 'RobustnessVariable': 'robustnessVariable', 'TrafficGroupId': 'trafficGroupId', 'Version': 'version', } def __init__(self, parent): super(Host, self).__init__(parent) @property def GroupRange(self): """ Returns ------- - obj(ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.grouprange_24a71c3cd8132c5bc9c3c0de300abf10.GroupRange): An instance of the GroupRange class Raises ------ - ServerError: The server has encountered an uncategorized error condition """ from ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.grouprange_24a71c3cd8132c5bc9c3c0de300abf10 import GroupRange if self._properties.get('GroupRange', None) is None: return GroupRange(self) else: return self._properties.get('GroupRange') @property def EnableImmediateResp(self): """ Returns ------- - bool: If enabled, the MLD host will ignore the value specified in the maximum response delay in the query message, assume that the delay is always = 0 seconds, and immediately respond to the query by sending a report. """ return self._get_attribute(self._SDM_ATT_MAP['EnableImmediateResp']) @EnableImmediateResp.setter def EnableImmediateResp(self, value): self._set_attribute(self._SDM_ATT_MAP['EnableImmediateResp'], value) @property def EnableQueryResMode(self): """ Returns ------- - bool: Enables the simulation for the host to respond to general queries. """ return self._get_attribute(self._SDM_ATT_MAP['EnableQueryResMode']) @EnableQueryResMode.setter def EnableQueryResMode(self, value): self._set_attribute(self._SDM_ATT_MAP['EnableQueryResMode'], value) @property def EnableRouterAlert(self): """ Returns ------- - bool: Sets the router alert bit in listener report messages. """ return self._get_attribute(self._SDM_ATT_MAP['EnableRouterAlert']) @EnableRouterAlert.setter def EnableRouterAlert(self, value): self._set_attribute(self._SDM_ATT_MAP['EnableRouterAlert'], value) @property def EnableSpecificResMode(self): """ Returns ------- - bool: Enables the simulation for the host to respond to group specific queries. """ return self._get_attribute(self._SDM_ATT_MAP['EnableSpecificResMode']) @EnableSpecificResMode.setter def EnableSpecificResMode(self, value): self._set_attribute(self._SDM_ATT_MAP['EnableSpecificResMode'], value) @property def EnableSuppressReport(self): """ Returns ------- - bool: Suppress generation of V2 reports on receipt of v1 reports having common groups. If enabled, it indicates that a host/group member will allow its MLDv2 Membership Record to be 'suppressed by a membership report for Version 1. The suppression will only be for group reports received from another port. """ return self._get_attribute(self._SDM_ATT_MAP['EnableSuppressReport']) @EnableSuppressReport.setter def EnableSuppressReport(self, value): self._set_attribute(self._SDM_ATT_MAP['EnableSuppressReport'], value) @property def EnableUnsolicitedResMode(self): """ Returns ------- - bool: If enabled, causes the emulated MLD host to automatically send full membership messages at regular intervals, without waiting for a query message. """ return self._get_attribute(self._SDM_ATT_MAP['EnableUnsolicitedResMode']) @EnableUnsolicitedResMode.setter def EnableUnsolicitedResMode(self, value): self._set_attribute(self._SDM_ATT_MAP['EnableUnsolicitedResMode'], value) @property def Enabled(self): """ Returns ------- - bool: Enables the use of the host in the MLD simulation. """ return self._get_attribute(self._SDM_ATT_MAP['Enabled']) @Enabled.setter def Enabled(self, value): self._set_attribute(self._SDM_ATT_MAP['Enabled'], value) @property def InterfaceIndex(self): """ Returns ------- - number: The assigned protocol interface ID for this MLD interface. """ return self._get_attribute(self._SDM_ATT_MAP['InterfaceIndex']) @InterfaceIndex.setter def InterfaceIndex(self, value): self._set_attribute(self._SDM_ATT_MAP['InterfaceIndex'], value) @property def InterfaceType(self): """ Returns ------- - str: The type of interface to be selected for this MLD interface. """ return self._get_attribute(self._SDM_ATT_MAP['InterfaceType']) @InterfaceType.setter def InterfaceType(self, value): self._set_attribute(self._SDM_ATT_MAP['InterfaceType'], value) @property def Interfaces(self): """ Returns ------- - str(None | /api/v1/sessions/1/ixnetwork/vport/.../interface | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range): The interfaces that are associated with the selected interface type. """ return self._get_attribute(self._SDM_ATT_MAP['Interfaces']) @Interfaces.setter def Interfaces(self, value): self._set_attribute(self._SDM_ATT_MAP['Interfaces'], value) @property def ProtocolInterface(self): """DEPRECATED Returns ------- - str(None | /api/v1/sessions/1/ixnetwork/vport/.../interface): The name of the protocol interface being used for this emulated MLD Host. There may be multiple IPv6 protocol interfaces to select from.NOTE: Only enabled protocol interfaces configured with IPv6 addresses will be listed here. """ return self._get_attribute(self._SDM_ATT_MAP['ProtocolInterface']) @ProtocolInterface.setter def ProtocolInterface(self, value): self._set_attribute(self._SDM_ATT_MAP['ProtocolInterface'], value) @property def ReportFreq(self): """ Returns ------- - number: Can be configured only when the Unsolicited Response Mode option is enabled. Otherwise, it is read-only. When Unsolicited Response Mode is enabled, specifies the frequency, in seconds, with which unsolicited messages are generated. """ return self._get_attribute(self._SDM_ATT_MAP['ReportFreq']) @ReportFreq.setter def ReportFreq(self, value): self._set_attribute(self._SDM_ATT_MAP['ReportFreq'], value) @property def RobustnessVariable(self): """ Returns ------- - number: NOT DEFINED """ return self._get_attribute(self._SDM_ATT_MAP['RobustnessVariable']) @RobustnessVariable.setter def RobustnessVariable(self, value): self._set_attribute(self._SDM_ATT_MAP['RobustnessVariable'], value) @property def TrafficGroupId(self): """ Returns ------- - str(None | /api/v1/sessions/1/ixnetwork/traffic/.../trafficGroup): The name of the group to which this port is assigned, for the purpose of creating traffic streams among source/destination members of the group. """ return self._get_attribute(self._SDM_ATT_MAP['TrafficGroupId']) @TrafficGroupId.setter def TrafficGroupId(self, value): self._set_attribute(self._SDM_ATT_MAP['TrafficGroupId'], value) @property def Version(self): """ Returns ------- - str(version1 | version2): Sets the MLD version number that is to be simulated on the host: 1 or 2. """ return self._get_attribute(self._SDM_ATT_MAP['Version']) @Version.setter def Version(self, value): self._set_attribute(self._SDM_ATT_MAP['Version'], value) def update(self, EnableImmediateResp=None, EnableQueryResMode=None, EnableRouterAlert=None, EnableSpecificResMode=None, EnableSuppressReport=None, EnableUnsolicitedResMode=None, Enabled=None, InterfaceIndex=None, InterfaceType=None, Interfaces=None, ProtocolInterface=None, ReportFreq=None, RobustnessVariable=None, TrafficGroupId=None, Version=None): """Updates host resource on the server. Args ---- - EnableImmediateResp (bool): If enabled, the MLD host will ignore the value specified in the maximum response delay in the query message, assume that the delay is always = 0 seconds, and immediately respond to the query by sending a report. - EnableQueryResMode (bool): Enables the simulation for the host to respond to general queries. - EnableRouterAlert (bool): Sets the router alert bit in listener report messages. - EnableSpecificResMode (bool): Enables the simulation for the host to respond to group specific queries. - EnableSuppressReport (bool): Suppress generation of V2 reports on receipt of v1 reports having common groups. If enabled, it indicates that a host/group member will allow its MLDv2 Membership Record to be 'suppressed by a membership report for Version 1. The suppression will only be for group reports received from another port. - EnableUnsolicitedResMode (bool): If enabled, causes the emulated MLD host to automatically send full membership messages at regular intervals, without waiting for a query message. - Enabled (bool): Enables the use of the host in the MLD simulation. - InterfaceIndex (number): The assigned protocol interface ID for this MLD interface. - InterfaceType (str): The type of interface to be selected for this MLD interface. - Interfaces (str(None | /api/v1/sessions/1/ixnetwork/vport/.../interface | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range)): The interfaces that are associated with the selected interface type. - ProtocolInterface (str(None | /api/v1/sessions/1/ixnetwork/vport/.../interface)): The name of the protocol interface being used for this emulated MLD Host. There may be multiple IPv6 protocol interfaces to select from.NOTE: Only enabled protocol interfaces configured with IPv6 addresses will be listed here. - ReportFreq (number): Can be configured only when the Unsolicited Response Mode option is enabled. Otherwise, it is read-only. When Unsolicited Response Mode is enabled, specifies the frequency, in seconds, with which unsolicited messages are generated. - RobustnessVariable (number): NOT DEFINED - TrafficGroupId (str(None | /api/v1/sessions/1/ixnetwork/traffic/.../trafficGroup)): The name of the group to which this port is assigned, for the purpose of creating traffic streams among source/destination members of the group. - Version (str(version1 | version2)): Sets the MLD version number that is to be simulated on the host: 1 or 2. Raises ------ - ServerError: The server has encountered an uncategorized error condition """ return self._update(self._map_locals(self._SDM_ATT_MAP, locals())) def add(self, EnableImmediateResp=None, EnableQueryResMode=None, EnableRouterAlert=None, EnableSpecificResMode=None, EnableSuppressReport=None, EnableUnsolicitedResMode=None, Enabled=None, InterfaceIndex=None, InterfaceType=None, Interfaces=None, ProtocolInterface=None, ReportFreq=None, RobustnessVariable=None, TrafficGroupId=None, Version=None): """Adds a new host resource on the server and adds it to the container. Args ---- - EnableImmediateResp (bool): If enabled, the MLD host will ignore the value specified in the maximum response delay in the query message, assume that the delay is always = 0 seconds, and immediately respond to the query by sending a report. - EnableQueryResMode (bool): Enables the simulation for the host to respond to general queries. - EnableRouterAlert (bool): Sets the router alert bit in listener report messages. - EnableSpecificResMode (bool): Enables the simulation for the host to respond to group specific queries. - EnableSuppressReport (bool): Suppress generation of V2 reports on receipt of v1 reports having common groups. If enabled, it indicates that a host/group member will allow its MLDv2 Membership Record to be 'suppressed by a membership report for Version 1. The suppression will only be for group reports received from another port. - EnableUnsolicitedResMode (bool): If enabled, causes the emulated MLD host to automatically send full membership messages at regular intervals, without waiting for a query message. - Enabled (bool): Enables the use of the host in the MLD simulation. - InterfaceIndex (number): The assigned protocol interface ID for this MLD interface. - InterfaceType (str): The type of interface to be selected for this MLD interface. - Interfaces (str(None | /api/v1/sessions/1/ixnetwork/vport/.../interface | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range)): The interfaces that are associated with the selected interface type. - ProtocolInterface (str(None | /api/v1/sessions/1/ixnetwork/vport/.../interface)): The name of the protocol interface being used for this emulated MLD Host. There may be multiple IPv6 protocol interfaces to select from.NOTE: Only enabled protocol interfaces configured with IPv6 addresses will be listed here. - ReportFreq (number): Can be configured only when the Unsolicited Response Mode option is enabled. Otherwise, it is read-only. When Unsolicited Response Mode is enabled, specifies the frequency, in seconds, with which unsolicited messages are generated. - RobustnessVariable (number): NOT DEFINED - TrafficGroupId (str(None | /api/v1/sessions/1/ixnetwork/traffic/.../trafficGroup)): The name of the group to which this port is assigned, for the purpose of creating traffic streams among source/destination members of the group. - Version (str(version1 | version2)): Sets the MLD version number that is to be simulated on the host: 1 or 2. Returns ------- - self: This instance with all currently retrieved host resources using find and the newly added host resources available through an iterator or index Raises ------ - ServerError: The server has encountered an uncategorized error condition """ return self._create(self._map_locals(self._SDM_ATT_MAP, locals())) def remove(self): """Deletes all the contained host resources in this instance from the server. Raises ------ - NotFoundError: The requested resource does not exist on the server - ServerError: The server has encountered an uncategorized error condition """ self._delete() def find(self, EnableImmediateResp=None, EnableQueryResMode=None, EnableRouterAlert=None, EnableSpecificResMode=None, EnableSuppressReport=None, EnableUnsolicitedResMode=None, Enabled=None, InterfaceIndex=None, InterfaceType=None, Interfaces=None, ProtocolInterface=None, ReportFreq=None, RobustnessVariable=None, TrafficGroupId=None, Version=None): """Finds and retrieves host resources from the server. All named parameters are evaluated on the server using regex. The named parameters can be used to selectively retrieve host resources from the server. To retrieve an exact match ensure the parameter value starts with ^ and ends with $ By default the find method takes no parameters and will retrieve all host resources from the server. Args ---- - EnableImmediateResp (bool): If enabled, the MLD host will ignore the value specified in the maximum response delay in the query message, assume that the delay is always = 0 seconds, and immediately respond to the query by sending a report. - EnableQueryResMode (bool): Enables the simulation for the host to respond to general queries. - EnableRouterAlert (bool): Sets the router alert bit in listener report messages. - EnableSpecificResMode (bool): Enables the simulation for the host to respond to group specific queries. - EnableSuppressReport (bool): Suppress generation of V2 reports on receipt of v1 reports having common groups. If enabled, it indicates that a host/group member will allow its MLDv2 Membership Record to be 'suppressed by a membership report for Version 1. The suppression will only be for group reports received from another port. - EnableUnsolicitedResMode (bool): If enabled, causes the emulated MLD host to automatically send full membership messages at regular intervals, without waiting for a query message. - Enabled (bool): Enables the use of the host in the MLD simulation. - InterfaceIndex (number): The assigned protocol interface ID for this MLD interface. - InterfaceType (str): The type of interface to be selected for this MLD interface. - Interfaces (str(None | /api/v1/sessions/1/ixnetwork/vport/.../interface | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range | /api/v1/sessions/1/ixnetwork/vport/.../range)): The interfaces that are associated with the selected interface type. - ProtocolInterface (str(None | /api/v1/sessions/1/ixnetwork/vport/.../interface)): The name of the protocol interface being used for this emulated MLD Host. There may be multiple IPv6 protocol interfaces to select from.NOTE: Only enabled protocol interfaces configured with IPv6 addresses will be listed here. - ReportFreq (number): Can be configured only when the Unsolicited Response Mode option is enabled. Otherwise, it is read-only. When Unsolicited Response Mode is enabled, specifies the frequency, in seconds, with which unsolicited messages are generated. - RobustnessVariable (number): NOT DEFINED - TrafficGroupId (str(None | /api/v1/sessions/1/ixnetwork/traffic/.../trafficGroup)): The name of the group to which this port is assigned, for the purpose of creating traffic streams among source/destination members of the group. - Version (str(version1 | version2)): Sets the MLD version number that is to be simulated on the host: 1 or 2. Returns ------- - self: This instance with matching host resources retrieved from the server available through an iterator or index Raises ------ - ServerError: The server has encountered an uncategorized error condition """ return self._select(self._map_locals(self._SDM_ATT_MAP, locals())) def read(self, href): """Retrieves a single instance of host data from the server. Args ---- - href (str): An href to the instance to be retrieved Returns ------- - self: This instance with the host resources from the server available through an iterator or index Raises ------ - NotFoundError: The requested resource does not exist on the server - ServerError: The server has encountered an uncategorized error condition """ return self._read(href) def GetInterfaceAccessorIfaceList(self): """Executes the getInterfaceAccessorIfaceList operation on the server. Gets the interface accesor Iface list. Raises ------ - NotFoundError: The requested resource does not exist on the server - ServerError: The server has encountered an uncategorized error condition """ payload = { "Arg1": self.href } return self._execute('getInterfaceAccessorIfaceList', payload=payload, response_object=None)
60.329016
576
0.707347
2,861
23,287
5.68857
0.117441
0.014747
0.038341
0.04129
0.764117
0.749063
0.720922
0.720922
0.697266
0.63828
0
0.009945
0.201142
23,287
385
577
60.485714
0.864914
0.63645
0
0.119403
0
0
0.139259
0.029913
0
0
0
0
0
1
0.283582
false
0
0.022388
0
0.5
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
1
0
0
0
0
0
0
0
5
73c0ccc19ecea8f9200db4388040901bc6b7a1da
213
py
Python
Graphix.py
MBI-Div-B/pytango-Graphix
e6026a6cc047c38e99572ea6baf81102fdb67997
[ "MIT" ]
null
null
null
Graphix.py
MBI-Div-B/pytango-Graphix
e6026a6cc047c38e99572ea6baf81102fdb67997
[ "MIT" ]
null
null
null
Graphix.py
MBI-Div-B/pytango-Graphix
e6026a6cc047c38e99572ea6baf81102fdb67997
[ "MIT" ]
null
null
null
#!/usr/bin/python3 -u from tango.server import run import os from GraphixSensor import GraphixSensor from GraphixCtrl import GraphixCtrl # Run PhytronMCC2Ctrl and PhytronMCC2Axis run([GraphixCtrl, GraphixSensor])
26.625
41
0.830986
26
213
6.807692
0.576923
0
0
0
0
0
0
0
0
0
0
0.015789
0.107981
213
8
42
26.625
0.915789
0.28169
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.8
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
1
0
1
0
1
0
0
5
fb5c5f3b8c193ffe43931a20c4aab46a60171f23
1,275
py
Python
pyy1/.pycharm_helpers/python_stubs/-1550516950/gi/_gi/InterfaceInfo.py
pyy1988/pyy_test1
6bea878409e658aa87441384419be51aaab061e7
[ "Apache-2.0" ]
null
null
null
pyy1/.pycharm_helpers/python_stubs/-1550516950/gi/_gi/InterfaceInfo.py
pyy1988/pyy_test1
6bea878409e658aa87441384419be51aaab061e7
[ "Apache-2.0" ]
null
null
null
pyy1/.pycharm_helpers/python_stubs/-1550516950/gi/_gi/InterfaceInfo.py
pyy1988/pyy_test1
6bea878409e658aa87441384419be51aaab061e7
[ "Apache-2.0" ]
null
null
null
# encoding: utf-8 # module gi._gi # from /usr/lib/python3/dist-packages/gi/_gi.cpython-35m-x86_64-linux-gnu.so # by generator 1.145 # no doc # imports import _gobject as _gobject # <module '_gobject'> import _glib as _glib # <module '_glib'> import gi as __gi import gobject as __gobject class InterfaceInfo(__gi.RegisteredTypeInfo): # no doc def find_method(self, *args, **kwargs): # real signature unknown pass def find_signal(self, *args, **kwargs): # real signature unknown pass def find_vfunc(self, *args, **kwargs): # real signature unknown pass def get_constants(self, *args, **kwargs): # real signature unknown pass def get_iface_struct(self, *args, **kwargs): # real signature unknown pass def get_methods(self, *args, **kwargs): # real signature unknown pass def get_prerequisites(self, *args, **kwargs): # real signature unknown pass def get_properties(self, *args, **kwargs): # real signature unknown pass def get_signals(self, *args, **kwargs): # real signature unknown pass def get_vfuncs(self, *args, **kwargs): # real signature unknown pass def __init__(self, *args, **kwargs): # real signature unknown pass
25.5
76
0.661176
164
1,275
4.957317
0.329268
0.108241
0.189422
0.243542
0.586716
0.586716
0.586716
0.539975
0.489545
0
0
0.012245
0.231373
1,275
49
77
26.020408
0.817347
0.341176
0
0.407407
0
0
0
0
0
0
0
0
0
1
0.407407
false
0.407407
0.148148
0
0.592593
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
5
fb6d59758165ced60835b3623f19a1de1efc619a
20,369
py
Python
src/coolc/parsetab.py
matcom-compilers-2019/cool-compiler-alexander-leonardo-marcos
874b3155769612fb8dc1dd823c9a024c66169a02
[ "MIT" ]
null
null
null
src/coolc/parsetab.py
matcom-compilers-2019/cool-compiler-alexander-leonardo-marcos
874b3155769612fb8dc1dd823c9a024c66169a02
[ "MIT" ]
null
null
null
src/coolc/parsetab.py
matcom-compilers-2019/cool-compiler-alexander-leonardo-marcos
874b3155769612fb8dc1dd823c9a024c66169a02
[ "MIT" ]
null
null
null
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'rightASSIGNrightNOTnonassocLTEQLTEQleftPLUSMINUSleftMULTIPLYDIVIDErightISVOIDrightINT_COMPleftATleftDOTARROW ASSIGN AT BOOLEAN CASE CLASS COLON COMMA DIVIDE DOT ELSE EQ ESAC FI ID IF IN INHERITS INTEGER INT_COMP ISVOID LBRACE LET LOOP LPAREN LT LTEQ MINUS MULTIPLY NEW NOT OF PLUS POOL RBRACE RPAREN SELF SEMICOLON STRING THEN TYPE WHILE\n program : class_list\n \n class_list : class_list class SEMICOLON\n | class SEMICOLON\n \n class : CLASS TYPE LBRACE features_list_opt RBRACE\n \n class : CLASS TYPE INHERITS TYPE LBRACE features_list_opt RBRACE\n \n features_list_opt : features_list\n | empty\n \n features_list : features_list feature SEMICOLON\n | feature SEMICOLON\n \n feature : ID LPAREN formal_params_list RPAREN COLON TYPE LBRACE expression RBRACE\n \n feature : ID LPAREN RPAREN COLON TYPE LBRACE expression RBRACE\n \n feature : ID COLON TYPE ASSIGN expression\n \n feature : ID COLON TYPE\n \n formal_params_list : formal_params_list COMMA formal_param\n | formal_param\n \n formal_param : ID COLON TYPE\n \n expression : ID\n \n expression : INTEGER\n \n expression : BOOLEAN\n \n expression : STRING\n \n expression : SELF\n \n expression : LBRACE block_list RBRACE\n \n block_list : block_list expression SEMICOLON\n | expression SEMICOLON\n \n expression : ID ASSIGN expression\n \n expression : expression DOT ID LPAREN arguments_list_opt RPAREN\n \n arguments_list_opt : arguments_list\n | empty\n \n arguments_list : arguments_list COMMA expression\n | expression\n \n expression : expression AT TYPE DOT ID LPAREN arguments_list_opt RPAREN\n \n expression : ID LPAREN arguments_list_opt RPAREN\n \n expression : expression PLUS expression\n | expression MINUS expression\n | expression MULTIPLY expression\n | expression DIVIDE expression\n \n expression : expression LT expression\n | expression LTEQ expression\n | expression EQ expression\n \n expression : LPAREN expression RPAREN\n \n expression : IF expression THEN expression ELSE expression FI\n \n expression : WHILE expression LOOP expression POOL\n \n expression : let_expression\n \n let_expression : LET declaration_list IN expression\n \n declaration_list : declaration_list COMMA declaration\n | declaration\n \n declaration : ID COLON TYPE ASSIGN expression\n | ID COLON TYPE\n \n expression : CASE expression OF actions_list ESAC\n \n actions_list : actions_list action\n | action\n \n action : ID COLON TYPE ARROW expression SEMICOLON\n \n expression : NEW TYPE\n \n expression : ISVOID expression\n \n expression : INT_COMP expression\n \n expression : NOT expression\n \n empty :\n ' _lr_action_items = {'CLASS':([0,2,6,8,],[4,4,-3,-2,]),'$end':([1,2,6,8,],[0,-1,-3,-2,]),'SEMICOLON':([3,5,14,17,18,28,35,40,41,42,43,44,45,50,71,76,77,78,79,85,92,93,94,95,96,97,98,99,100,102,110,111,121,124,129,130,134,140,142,143,],[6,8,19,-4,23,-13,-5,-17,-12,-18,-19,-20,-21,-43,101,-53,-54,-55,-56,-25,-33,-34,-35,-36,-37,-38,-39,-22,115,-40,-11,-32,-44,-10,-42,-49,-26,-41,-31,144,]),'TYPE':([4,10,21,30,33,37,52,62,108,132,],[7,16,28,36,39,57,76,91,123,137,]),'LBRACE':([7,16,34,39,46,47,48,49,51,53,54,55,57,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[9,22,46,58,46,46,46,46,46,46,46,46,83,46,46,46,46,46,46,46,46,46,46,46,46,-24,46,46,46,46,46,-23,46,46,46,46,]),'INHERITS':([7,],[10,]),'RBRACE':([9,11,12,13,19,22,23,29,40,42,43,44,45,50,70,76,77,78,79,84,85,92,93,94,95,96,97,98,99,101,102,109,111,115,121,129,130,134,140,142,],[-57,17,-6,-7,-9,-57,-8,35,-17,-18,-19,-20,-21,-43,99,-53,-54,-55,-56,110,-25,-33,-34,-35,-36,-37,-38,-39,-22,-24,-40,124,-32,-23,-44,-42,-49,-26,-41,-31,]),'ID':([9,12,19,20,22,23,32,34,46,47,48,49,51,53,54,55,56,58,59,60,61,63,64,65,66,67,68,69,70,83,101,103,104,105,106,107,112,113,114,115,118,119,128,131,133,135,141,144,],[15,15,-9,24,15,-8,24,40,40,40,40,40,40,40,40,40,82,40,40,40,90,40,40,40,40,40,40,40,40,40,-24,40,40,120,40,82,40,40,127,-23,120,-51,40,-50,40,40,40,-52,]),'LPAREN':([15,34,40,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,90,101,103,104,106,112,113,115,127,128,133,135,141,],[20,47,60,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,113,-24,47,47,47,47,47,-23,135,47,47,47,47,]),'COLON':([15,24,26,31,82,120,],[21,30,33,37,108,132,]),'RPAREN':([20,25,27,36,38,40,42,43,44,45,50,60,72,76,77,78,79,85,86,87,88,89,92,93,94,95,96,97,98,99,102,111,113,121,125,126,129,130,134,135,139,140,142,],[26,31,-15,-16,-14,-17,-18,-19,-20,-21,-43,-57,102,-53,-54,-55,-56,-25,111,-27,-28,-30,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-57,-44,-29,134,-42,-49,-26,-57,142,-41,-31,]),'COMMA':([25,27,36,38,40,42,43,44,45,50,76,77,78,79,80,81,85,87,89,92,93,94,95,96,97,98,99,102,111,121,122,123,125,129,130,134,138,140,142,],[32,-15,-16,-14,-17,-18,-19,-20,-21,-43,-53,-54,-55,-56,107,-46,-25,112,-30,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-44,-45,-48,-29,-42,-49,-26,-47,-41,-31,]),'ASSIGN':([28,40,123,],[34,59,133,]),'INTEGER':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,-24,42,42,42,42,42,-23,42,42,42,42,]),'BOOLEAN':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,-24,43,43,43,43,43,-23,43,43,43,43,]),'STRING':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,-24,44,44,44,44,44,-23,44,44,44,44,]),'SELF':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,-23,45,45,45,45,]),'IF':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,-24,48,48,48,48,48,-23,48,48,48,48,]),'WHILE':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,-24,49,49,49,49,49,-23,49,49,49,49,]),'CASE':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,-24,51,51,51,51,51,-23,51,51,51,51,]),'NEW':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,-24,52,52,52,52,52,-23,52,52,52,52,]),'ISVOID':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,-24,53,53,53,53,53,-23,53,53,53,53,]),'INT_COMP':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,-24,54,54,54,54,54,-23,54,54,54,54,]),'NOT':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,-24,55,55,55,55,55,-23,55,55,55,55,]),'LET':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,101,103,104,106,112,113,115,128,133,135,141,],[56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,-24,56,56,56,56,56,-23,56,56,56,56,]),'DOT':([40,41,42,43,44,45,50,71,72,73,74,75,76,77,78,79,84,85,89,91,92,93,94,95,96,97,98,99,100,102,109,111,116,117,121,125,129,130,134,136,138,140,142,143,],[-17,61,-18,-19,-20,-21,-43,61,61,61,61,61,-53,61,61,61,61,61,61,114,61,61,61,61,61,61,61,-22,61,-40,61,-32,61,61,61,61,-42,-49,-26,61,61,-41,-31,61,]),'AT':([40,41,42,43,44,45,50,71,72,73,74,75,76,77,78,79,84,85,89,92,93,94,95,96,97,98,99,100,102,109,111,116,117,121,125,129,130,134,136,138,140,142,143,],[-17,62,-18,-19,-20,-21,-43,62,62,62,62,62,-53,62,62,62,62,62,62,62,62,62,62,62,62,62,-22,62,-40,62,-32,62,62,62,62,-42,-49,-26,62,62,-41,-31,62,]),'PLUS':([40,41,42,43,44,45,50,71,72,73,74,75,76,77,78,79,84,85,89,92,93,94,95,96,97,98,99,100,102,109,111,116,117,121,125,129,130,134,136,138,140,142,143,],[-17,63,-18,-19,-20,-21,-43,63,63,63,63,63,-53,-54,-55,63,63,63,63,-33,-34,-35,-36,63,63,63,-22,63,-40,63,-32,63,63,63,63,-42,-49,-26,63,63,-41,-31,63,]),'MINUS':([40,41,42,43,44,45,50,71,72,73,74,75,76,77,78,79,84,85,89,92,93,94,95,96,97,98,99,100,102,109,111,116,117,121,125,129,130,134,136,138,140,142,143,],[-17,64,-18,-19,-20,-21,-43,64,64,64,64,64,-53,-54,-55,64,64,64,64,-33,-34,-35,-36,64,64,64,-22,64,-40,64,-32,64,64,64,64,-42,-49,-26,64,64,-41,-31,64,]),'MULTIPLY':([40,41,42,43,44,45,50,71,72,73,74,75,76,77,78,79,84,85,89,92,93,94,95,96,97,98,99,100,102,109,111,116,117,121,125,129,130,134,136,138,140,142,143,],[-17,65,-18,-19,-20,-21,-43,65,65,65,65,65,-53,-54,-55,65,65,65,65,65,65,-35,-36,65,65,65,-22,65,-40,65,-32,65,65,65,65,-42,-49,-26,65,65,-41,-31,65,]),'DIVIDE':([40,41,42,43,44,45,50,71,72,73,74,75,76,77,78,79,84,85,89,92,93,94,95,96,97,98,99,100,102,109,111,116,117,121,125,129,130,134,136,138,140,142,143,],[-17,66,-18,-19,-20,-21,-43,66,66,66,66,66,-53,-54,-55,66,66,66,66,66,66,-35,-36,66,66,66,-22,66,-40,66,-32,66,66,66,66,-42,-49,-26,66,66,-41,-31,66,]),'LT':([40,41,42,43,44,45,50,71,72,73,74,75,76,77,78,79,84,85,89,92,93,94,95,96,97,98,99,100,102,109,111,116,117,121,125,129,130,134,136,138,140,142,143,],[-17,67,-18,-19,-20,-21,-43,67,67,67,67,67,-53,-54,-55,67,67,67,67,-33,-34,-35,-36,None,None,None,-22,67,-40,67,-32,67,67,67,67,-42,-49,-26,67,67,-41,-31,67,]),'LTEQ':([40,41,42,43,44,45,50,71,72,73,74,75,76,77,78,79,84,85,89,92,93,94,95,96,97,98,99,100,102,109,111,116,117,121,125,129,130,134,136,138,140,142,143,],[-17,68,-18,-19,-20,-21,-43,68,68,68,68,68,-53,-54,-55,68,68,68,68,-33,-34,-35,-36,None,None,None,-22,68,-40,68,-32,68,68,68,68,-42,-49,-26,68,68,-41,-31,68,]),'EQ':([40,41,42,43,44,45,50,71,72,73,74,75,76,77,78,79,84,85,89,92,93,94,95,96,97,98,99,100,102,109,111,116,117,121,125,129,130,134,136,138,140,142,143,],[-17,69,-18,-19,-20,-21,-43,69,69,69,69,69,-53,-54,-55,69,69,69,69,-33,-34,-35,-36,None,None,None,-22,69,-40,69,-32,69,69,69,69,-42,-49,-26,69,69,-41,-31,69,]),'THEN':([40,42,43,44,45,50,73,76,77,78,79,85,92,93,94,95,96,97,98,99,102,111,121,129,130,134,140,142,],[-17,-18,-19,-20,-21,-43,103,-53,-54,-55,-56,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-44,-42,-49,-26,-41,-31,]),'LOOP':([40,42,43,44,45,50,74,76,77,78,79,85,92,93,94,95,96,97,98,99,102,111,121,129,130,134,140,142,],[-17,-18,-19,-20,-21,-43,104,-53,-54,-55,-56,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-44,-42,-49,-26,-41,-31,]),'OF':([40,42,43,44,45,50,75,76,77,78,79,85,92,93,94,95,96,97,98,99,102,111,121,129,130,134,140,142,],[-17,-18,-19,-20,-21,-43,105,-53,-54,-55,-56,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-44,-42,-49,-26,-41,-31,]),'ELSE':([40,42,43,44,45,50,76,77,78,79,85,92,93,94,95,96,97,98,99,102,111,116,121,129,130,134,140,142,],[-17,-18,-19,-20,-21,-43,-53,-54,-55,-56,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,128,-44,-42,-49,-26,-41,-31,]),'POOL':([40,42,43,44,45,50,76,77,78,79,85,92,93,94,95,96,97,98,99,102,111,117,121,129,130,134,140,142,],[-17,-18,-19,-20,-21,-43,-53,-54,-55,-56,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,129,-44,-42,-49,-26,-41,-31,]),'FI':([40,42,43,44,45,50,76,77,78,79,85,92,93,94,95,96,97,98,99,102,111,121,129,130,134,136,140,142,],[-17,-18,-19,-20,-21,-43,-53,-54,-55,-56,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-44,-42,-49,-26,140,-41,-31,]),'IN':([40,42,43,44,45,50,76,77,78,79,80,81,85,92,93,94,95,96,97,98,99,102,111,121,122,123,129,130,134,138,140,142,],[-17,-18,-19,-20,-21,-43,-53,-54,-55,-56,106,-46,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-44,-45,-48,-42,-49,-26,-47,-41,-31,]),'ESAC':([118,119,131,144,],[130,-51,-50,-52,]),'ARROW':([137,],[141,]),} _lr_action = {} for _k, _v in _lr_action_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'program':([0,],[1,]),'class_list':([0,],[2,]),'class':([0,2,],[3,5,]),'features_list_opt':([9,22,],[11,29,]),'features_list':([9,22,],[12,12,]),'empty':([9,22,60,113,135,],[13,13,88,88,88,]),'feature':([9,12,22,],[14,18,14,]),'formal_params_list':([20,],[25,]),'formal_param':([20,32,],[27,38,]),'expression':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,103,104,106,112,113,128,133,135,141,],[41,71,72,73,74,75,77,78,79,84,85,89,92,93,94,95,96,97,98,100,109,116,117,121,125,89,136,138,89,143,]),'let_expression':([34,46,47,48,49,51,53,54,55,58,59,60,63,64,65,66,67,68,69,70,83,103,104,106,112,113,128,133,135,141,],[50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,]),'block_list':([46,],[70,]),'declaration_list':([56,],[80,]),'declaration':([56,107,],[81,122,]),'arguments_list_opt':([60,113,135,],[86,126,139,]),'arguments_list':([60,113,135,],[87,87,87,]),'actions_list':([105,],[118,]),'action':([105,118,],[119,131,]),} _lr_goto = {} for _k, _v in _lr_goto_items.items(): for _x, _y in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [ ("S' -> program","S'",1,None,None,None), ('program -> class_list','program',1,'p_program','cooljack.py',34), ('class_list -> class_list class SEMICOLON','class_list',3,'p_class_list','cooljack.py',40), ('class_list -> class SEMICOLON','class_list',2,'p_class_list','cooljack.py',41), ('class -> CLASS TYPE LBRACE features_list_opt RBRACE','class',5,'p_class','cooljack.py',50), ('class -> CLASS TYPE INHERITS TYPE LBRACE features_list_opt RBRACE','class',7,'p_class_inherits','cooljack.py',56), ('features_list_opt -> features_list','features_list_opt',1,'p_feature_list_opt','cooljack.py',62), ('features_list_opt -> empty','features_list_opt',1,'p_feature_list_opt','cooljack.py',63), ('features_list -> features_list feature SEMICOLON','features_list',3,'p_feature_list','cooljack.py',69), ('features_list -> feature SEMICOLON','features_list',2,'p_feature_list','cooljack.py',70), ('feature -> ID LPAREN formal_params_list RPAREN COLON TYPE LBRACE expression RBRACE','feature',9,'p_feature_method','cooljack.py',79), ('feature -> ID LPAREN RPAREN COLON TYPE LBRACE expression RBRACE','feature',8,'p_feature_method_no_formals','cooljack.py',85), ('feature -> ID COLON TYPE ASSIGN expression','feature',5,'p_feature_attr_initialized','cooljack.py',91), ('feature -> ID COLON TYPE','feature',3,'p_feature_attr','cooljack.py',97), ('formal_params_list -> formal_params_list COMMA formal_param','formal_params_list',3,'p_formal_list_many','cooljack.py',103), ('formal_params_list -> formal_param','formal_params_list',1,'p_formal_list_many','cooljack.py',104), ('formal_param -> ID COLON TYPE','formal_param',3,'p_formal','cooljack.py',113), ('expression -> ID','expression',1,'p_expression_object_identifier','cooljack.py',119), ('expression -> INTEGER','expression',1,'p_expression_integer_constant','cooljack.py',125), ('expression -> BOOLEAN','expression',1,'p_expression_boolean_constant','cooljack.py',131), ('expression -> STRING','expression',1,'p_expression_string_constant','cooljack.py',137), ('expression -> SELF','expression',1,'p_expr_self','cooljack.py',143), ('expression -> LBRACE block_list RBRACE','expression',3,'p_expression_block','cooljack.py',149), ('block_list -> block_list expression SEMICOLON','block_list',3,'p_block_list','cooljack.py',155), ('block_list -> expression SEMICOLON','block_list',2,'p_block_list','cooljack.py',156), ('expression -> ID ASSIGN expression','expression',3,'p_expression_assignment','cooljack.py',165), ('expression -> expression DOT ID LPAREN arguments_list_opt RPAREN','expression',6,'p_expression_dispatch','cooljack.py',173), ('arguments_list_opt -> arguments_list','arguments_list_opt',1,'p_arguments_list_opt','cooljack.py',179), ('arguments_list_opt -> empty','arguments_list_opt',1,'p_arguments_list_opt','cooljack.py',180), ('arguments_list -> arguments_list COMMA expression','arguments_list',3,'p_arguments_list','cooljack.py',186), ('arguments_list -> expression','arguments_list',1,'p_arguments_list','cooljack.py',187), ('expression -> expression AT TYPE DOT ID LPAREN arguments_list_opt RPAREN','expression',8,'p_expression_static_dispatch','cooljack.py',196), ('expression -> ID LPAREN arguments_list_opt RPAREN','expression',4,'p_expression_self_dispatch','cooljack.py',202), ('expression -> expression PLUS expression','expression',3,'p_expression_math_operations','cooljack.py',210), ('expression -> expression MINUS expression','expression',3,'p_expression_math_operations','cooljack.py',211), ('expression -> expression MULTIPLY expression','expression',3,'p_expression_math_operations','cooljack.py',212), ('expression -> expression DIVIDE expression','expression',3,'p_expression_math_operations','cooljack.py',213), ('expression -> expression LT expression','expression',3,'p_expression_math_comparisons','cooljack.py',226), ('expression -> expression LTEQ expression','expression',3,'p_expression_math_comparisons','cooljack.py',227), ('expression -> expression EQ expression','expression',3,'p_expression_math_comparisons','cooljack.py',228), ('expression -> LPAREN expression RPAREN','expression',3,'p_expression_with_parenthesis','cooljack.py',239), ('expression -> IF expression THEN expression ELSE expression FI','expression',7,'p_expression_if_conditional','cooljack.py',247), ('expression -> WHILE expression LOOP expression POOL','expression',5,'p_expression_while_loop','cooljack.py',253), ('expression -> let_expression','expression',1,'p_expression_let','cooljack.py',261), ('let_expression -> LET declaration_list IN expression','let_expression',4,'p_let','cooljack.py',267), ('declaration_list -> declaration_list COMMA declaration','declaration_list',3,'p_declaration_list','cooljack.py',273), ('declaration_list -> declaration','declaration_list',1,'p_declaration_list','cooljack.py',274), ('declaration -> ID COLON TYPE ASSIGN expression','declaration',5,'p_declaration','cooljack.py',283), ('declaration -> ID COLON TYPE','declaration',3,'p_declaration','cooljack.py',284), ('expression -> CASE expression OF actions_list ESAC','expression',5,'p_expression_case','cooljack.py',295), ('actions_list -> actions_list action','actions_list',2,'p_actions_list','cooljack.py',301), ('actions_list -> action','actions_list',1,'p_actions_list','cooljack.py',302), ('action -> ID COLON TYPE ARROW expression SEMICOLON','action',6,'p_action_expr','cooljack.py',311), ('expression -> NEW TYPE','expression',2,'p_expression_new','cooljack.py',319), ('expression -> ISVOID expression','expression',2,'p_expression_isvoid','cooljack.py',325), ('expression -> INT_COMP expression','expression',2,'p_expression_integer_complement','cooljack.py',331), ('expression -> NOT expression','expression',2,'p_expression_boolean_complement','cooljack.py',337), ('empty -> <empty>','empty',0,'p_empty','cooljack.py',345), ]
231.465909
9,413
0.650891
4,135
20,369
3.124063
0.071342
0.044124
0.016256
0.016721
0.638721
0.541415
0.459127
0.43242
0.407339
0.343474
0
0.332831
0.08783
20,369
87
9,414
234.126437
0.362433
0.004124
0
0.025974
1
0.012987
0.417751
0.035256
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
1
1
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
fb770fbb9ded7c03c6bfec3f28ece41f0a11e6c1
35
py
Python
umqtt_async/__init__.py
theBASTI0N/umqtt_async
18004ae52387caed6d9f0e266b098acb7961cbc9
[ "MIT" ]
null
null
null
umqtt_async/__init__.py
theBASTI0N/umqtt_async
18004ae52387caed6d9f0e266b098acb7961cbc9
[ "MIT" ]
null
null
null
umqtt_async/__init__.py
theBASTI0N/umqtt_async
18004ae52387caed6d9f0e266b098acb7961cbc9
[ "MIT" ]
null
null
null
from .umqtt_async import MQTTClient
35
35
0.885714
5
35
6
1
0
0
0
0
0
0
0
0
0
0
0
0.085714
35
1
35
35
0.9375
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
fb7a0b0f9236bcb045696e60e70ad8043082fff8
138
py
Python
fidap/settings.py
fidapco/fidap-python-client
bbc47eab1656f28714c0412af082367341d47625
[ "MIT" ]
2
2021-02-02T13:57:48.000Z
2021-11-14T20:09:42.000Z
fidap/settings.py
fidapco/fidap-python-client
bbc47eab1656f28714c0412af082367341d47625
[ "MIT" ]
null
null
null
fidap/settings.py
fidapco/fidap-python-client
bbc47eab1656f28714c0412af082367341d47625
[ "MIT" ]
null
null
null
import os from dotenv import load_dotenv, find_dotenv load_dotenv(find_dotenv()) BASE_URL = os.getenv('BASE_URL', 'https://ws.fidap.com')
27.6
56
0.775362
23
138
4.391304
0.565217
0.19802
0.277228
0.39604
0
0
0
0
0
0
0
0
0.086957
138
4
57
34.5
0.801587
0
0
0
0
0
0.202899
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
fb7fc0ef3c605b486e6c092f6a553f8a4de0bfc8
217
py
Python
adonai/domain/permission.py
Egnod/adonai
b365d81c826fd7b626c9145154ee0136ea73fac1
[ "MIT" ]
6
2020-01-20T20:02:09.000Z
2020-02-24T08:40:23.000Z
adonai/domain/permission.py
Egnod/adonai
b365d81c826fd7b626c9145154ee0136ea73fac1
[ "MIT" ]
null
null
null
adonai/domain/permission.py
Egnod/adonai
b365d81c826fd7b626c9145154ee0136ea73fac1
[ "MIT" ]
null
null
null
from ..permission.internal.defaults import CRUDPermissions from ..permission.internal.permission_set import InternalPermissionSet class DomainPermissions(InternalPermissionSet, CRUDPermissions): name = "domain"
31
70
0.83871
19
217
9.526316
0.631579
0.154696
0.243094
0
0
0
0
0
0
0
0
0
0.092166
217
6
71
36.166667
0.918782
0
0
0
0
0
0.02765
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
fb8aa254f79006b0a6de8c37a079b53e02017ea8
243
py
Python
episcanpy/api/tl.py
LKremer/epiScanpy
607a86a58af52fc4bf8937ddd13cee4a0b72c79f
[ "BSD-3-Clause" ]
1
2021-06-18T09:12:38.000Z
2021-06-18T09:12:38.000Z
episcanpy/api/tl.py
LKremer/epiScanpy
607a86a58af52fc4bf8937ddd13cee4a0b72c79f
[ "BSD-3-Clause" ]
null
null
null
episcanpy/api/tl.py
LKremer/epiScanpy
607a86a58af52fc4bf8937ddd13cee4a0b72c79f
[ "BSD-3-Clause" ]
null
null
null
#from ..tools._impute_meth import readandimputematrix from ..tools._features_selection import rank_features from ..tools._silhouette import silhouette from ..tools._recipe import lazy from ..tools._cell_id import load_markers, identify_cluster
48.6
59
0.847737
32
243
6.09375
0.5625
0.230769
0
0
0
0
0
0
0
0
0
0
0.082305
243
5
59
48.6
0.874439
0.213992
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
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
fbcfc219996ce6b42f4bc0b12f0881e042a1a584
45
py
Python
src/python2/sdp/diagnostic/__init__.py
LeiShi/Synthetic-Diagnostics-Platform
870120d3fd14b2a3c89c6e6e85625d1e9109a2de
[ "BSD-3-Clause" ]
5
2019-08-16T22:08:19.000Z
2021-02-24T02:47:05.000Z
src/python3/sdp/diagnostic/__init__.py
justthepython/Synthetic-Diagnostics-Platform
5f1cb5c29d182490acbd4f3c167f0e09ec211236
[ "BSD-3-Clause" ]
1
2016-05-11T12:58:00.000Z
2016-05-11T17:18:36.000Z
src/python3/sdp/diagnostic/__init__.py
justthepython/Synthetic-Diagnostics-Platform
5f1cb5c29d182490acbd4f3c167f0e09ec211236
[ "BSD-3-Clause" ]
5
2018-04-29T12:35:59.000Z
2020-01-10T03:38:30.000Z
from .availdiags import Available_Diagnostics
45
45
0.911111
5
45
8
1
0
0
0
0
0
0
0
0
0
0
0
0.066667
45
1
45
45
0.952381
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
839189c22ac03869866ff4454b9bb1d004b1d236
246
py
Python
ghostwriter/reporting/apps.py
sebch-/Ghostwriter
db9be82fa028ab5388cf66828f558d0fbceb8a53
[ "BSD-3-Clause" ]
1
2021-09-09T17:24:31.000Z
2021-09-09T17:24:31.000Z
ghostwriter/reporting/apps.py
sebch-/Ghostwriter
db9be82fa028ab5388cf66828f558d0fbceb8a53
[ "BSD-3-Clause" ]
13
2020-07-16T18:04:20.000Z
2020-07-24T17:22:10.000Z
ghostwriter/reporting/apps.py
sebch-/Ghostwriter
db9be82fa028ab5388cf66828f558d0fbceb8a53
[ "BSD-3-Clause" ]
1
2021-04-20T12:46:37.000Z
2021-04-20T12:46:37.000Z
from django.apps import AppConfig class ReportingConfig(AppConfig): name = 'ghostwriter.reporting' def ready(self): try: import ghostwriter.reporting.signals # noqa F401 except ImportError: pass
22.363636
61
0.646341
24
246
6.625
0.833333
0.251572
0
0
0
0
0
0
0
0
0
0.017143
0.288618
246
11
62
22.363636
0.891429
0.036585
0
0
0
0
0.088983
0.088983
0
0
0
0
0
1
0.125
false
0.125
0.375
0
0.75
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
5
83a641b62763a404c2a301cee6c17a2a776a90f1
130
py
Python
enformer/layers/__init__.py
SauravMaheshkar/enformer
779116b81e672438604b793a93662a5debedab10
[ "Apache-2.0" ]
null
null
null
enformer/layers/__init__.py
SauravMaheshkar/enformer
779116b81e672438604b793a93662a5debedab10
[ "Apache-2.0" ]
null
null
null
enformer/layers/__init__.py
SauravMaheshkar/enformer
779116b81e672438604b793a93662a5debedab10
[ "Apache-2.0" ]
null
null
null
from .activation_layers import SoftPlus, GELU from .container_layers import Residual from .pooling_layers import SoftmaxPooling1D
32.5
45
0.869231
16
130
6.875
0.625
0.327273
0
0
0
0
0
0
0
0
0
0.008547
0.1
130
3
46
43.333333
0.931624
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
83ab327309730ca350b83b5c32dc1671842296ae
77
py
Python
tkit_dcn/__init__.py
napoler/tkit_dcn_pytorch
68dc1054f335756bb6b1e4257ab2942da51c7ccc
[ "Apache-2.0" ]
null
null
null
tkit_dcn/__init__.py
napoler/tkit_dcn_pytorch
68dc1054f335756bb6b1e4257ab2942da51c7ccc
[ "Apache-2.0" ]
null
null
null
tkit_dcn/__init__.py
napoler/tkit_dcn_pytorch
68dc1054f335756bb6b1e4257ab2942da51c7ccc
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- #这里是引用库 # from .config import * from .dcn import *
11
23
0.584416
10
77
4.5
0.8
0
0
0
0
0
0
0
0
0
0
0.016667
0.220779
77
6
24
12.833333
0.733333
0.636364
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
83d54fb0291471cb85f6de972dcac0c919fc71f0
121
py
Python
components/wifi_provisioning/python/proto_python/__init__.py
chenqy2018/esp-va-sdk
2196a16586ded4186161fefba2113b6cacf7eaf7
[ "MIT-0" ]
null
null
null
components/wifi_provisioning/python/proto_python/__init__.py
chenqy2018/esp-va-sdk
2196a16586ded4186161fefba2113b6cacf7eaf7
[ "MIT-0" ]
null
null
null
components/wifi_provisioning/python/proto_python/__init__.py
chenqy2018/esp-va-sdk
2196a16586ded4186161fefba2113b6cacf7eaf7
[ "MIT-0" ]
null
null
null
import wifi_config_pb2 import sec0_pb2 import sec1_pb2 import session_pb2 import wifi_constants_pb2 import constants_pb2
17.285714
25
0.900826
20
121
5.05
0.4
0.445545
0
0
0
0
0
0
0
0
0
0.073395
0.099174
121
6
26
20.166667
0.853211
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
83d6a8271c42ae52387a3ce5a8f35a8469745498
13
py
Python
vignettes/one_sample_location_python/PY/sq.py
lwa19/dsc
20b7edf638df71ca4ba3ba0857167bd673b78c21
[ "MIT" ]
6
2016-03-11T20:29:56.000Z
2017-01-16T21:06:39.000Z
vignettes/one_sample_location_python/PY/sq.py
lwa19/dsc
20b7edf638df71ca4ba3ba0857167bd673b78c21
[ "MIT" ]
126
2018-03-14T14:36:15.000Z
2022-03-28T18:59:43.000Z
vignettes/one_sample_location_python/PY/sq.py
lwa19/dsc
20b7edf638df71ca4ba3ba0857167bd673b78c21
[ "MIT" ]
8
2018-12-07T15:42:48.000Z
2021-11-08T01:16:58.000Z
e = (a-b)**2
6.5
12
0.307692
4
13
1
1
0
0
0
0
0
0
0
0
0
0
0.1
0.230769
13
1
13
13
0.3
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
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
5
7916b16b6da75e5e0a9e5bb98b12ebd027bd8e6e
20
py
Python
src/DTM_crypt/__init__.py
TNAlotaibi/DTM-crypt
55cd6279225962cb312a372a41d19f676aeed277
[ "MIT" ]
null
null
null
src/DTM_crypt/__init__.py
TNAlotaibi/DTM-crypt
55cd6279225962cb312a372a41d19f676aeed277
[ "MIT" ]
null
null
null
src/DTM_crypt/__init__.py
TNAlotaibi/DTM-crypt
55cd6279225962cb312a372a41d19f676aeed277
[ "MIT" ]
null
null
null
from .DTM import DTM
20
20
0.8
4
20
4
0.75
0
0
0
0
0
0
0
0
0
0
0
0.15
20
1
20
20
0.941176
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
792f334163bc31d44c06da312019b79eb589a225
59
py
Python
Hbtep/__init__.py
jwbrooks0/johnspythonlibrary2
10ca519276d8c32da0fbd41a597f75c0c98a8736
[ "MIT" ]
null
null
null
Hbtep/__init__.py
jwbrooks0/johnspythonlibrary2
10ca519276d8c32da0fbd41a597f75c0c98a8736
[ "MIT" ]
null
null
null
Hbtep/__init__.py
jwbrooks0/johnspythonlibrary2
10ca519276d8c32da0fbd41a597f75c0c98a8736
[ "MIT" ]
null
null
null
from . import Get from . import Process from . import Plot
14.75
21
0.745763
9
59
4.888889
0.555556
0.681818
0
0
0
0
0
0
0
0
0
0
0.20339
59
3
22
19.666667
0.93617
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
f722d62715166543e56dacac4436571f8c2ee94a
49
py
Python
smartlight_datastore/config.py
ande7590/rpi-smart-lights
599cefb1f3aa63d85b33ab3f8a379faba4eb178c
[ "MIT" ]
null
null
null
smartlight_datastore/config.py
ande7590/rpi-smart-lights
599cefb1f3aa63d85b33ab3f8a379faba4eb178c
[ "MIT" ]
null
null
null
smartlight_datastore/config.py
ande7590/rpi-smart-lights
599cefb1f3aa63d85b33ab3f8a379faba4eb178c
[ "MIT" ]
null
null
null
DB_CONN_STR = 'sqlite:///event_repository.sqlite'
49
49
0.795918
7
49
5.142857
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.040816
49
1
49
49
0.765957
0
0
0
0
0
0.66
0.66
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
f7842a02d725deb7d9aa69e48d95fe4f37742a5b
9,663
py
Python
src/GridCal/Engine/Simulations/OPF/opf_templates.py
vineetjnair9/GridCal
5b63cbae45cbe176b015e5e99164a593f450fe71
[ "BSD-3-Clause" ]
null
null
null
src/GridCal/Engine/Simulations/OPF/opf_templates.py
vineetjnair9/GridCal
5b63cbae45cbe176b015e5e99164a593f450fe71
[ "BSD-3-Clause" ]
null
null
null
src/GridCal/Engine/Simulations/OPF/opf_templates.py
vineetjnair9/GridCal
5b63cbae45cbe176b015e5e99164a593f450fe71
[ "BSD-3-Clause" ]
null
null
null
# This file is part of GridCal. # # GridCal is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # GridCal is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GridCal. If not, see <http://www.gnu.org/licenses/>. from GridCal.Engine.basic_structures import MIPSolvers from GridCal.Engine.Core.snapshot_opf_data import OpfSnapshotCircuit from GridCal.Engine.Core.time_series_opf_data import OpfTimeCircuit from GridCal.ThirdParty.pulp import * class Opf: def __init__(self, numerical_circuit: OpfSnapshotCircuit, solver: MIPSolvers = MIPSolvers.CBC): """ Optimal power flow template class :param numerical_circuit: NumericalCircuit instance """ self.numerical_circuit = numerical_circuit self.theta = None self.Pg = None self.Pb = None self.Pl = None self.E = None self.s_from = None self.s_to = None self.overloads = None self.rating = None self.load_shedding = None self.nodal_restrictions = None self.solver = solver self.problem = self.formulate() def formulate(self): """ Formulate the AC OPF time series in the non-sequential fashion (all to the solver at once) :return: PuLP Problem instance """ # declare problem problem = LpProblem(name='DC_OPF_Time_Series') return problem def solve(self): """ Call PuLP to solve the problem """ # self.problem.writeLP('OPF.lp') if self.solver == MIPSolvers.CBC: params = PULP_CBC_CMD(fracGap=0.00001, threads=None, msg=1) elif self.solver == MIPSolvers.SCIP: params = SCIP_CMD(msg=1) elif self.solver == MIPSolvers.CPLEX: params = CPLEX_CMD(msg=1) elif self.solver == MIPSolvers.GUROBI: params = GUROBI_CMD(msg=1) elif self.solver == MIPSolvers.XPRESS: params = XPRESS(msg=1) else: raise Exception('Solver not supported! ' + str(self.solver)) self.problem.solve(params) return LpStatus[self.problem.status] @staticmethod def extract(arr, make_abs=False): """ Extract values fro the 1D array of LP variables :param arr: 1D array of LP variables :param make_abs: substitute the result by its abs value :return: 1D numpy array """ val = np.zeros(arr.shape) for i in range(val.shape[0]): val[i] = arr[i].value() if make_abs: val = np.abs(val) return val def get_voltage(self): """ return the complex voltages (time, device) :return: 2D array """ angles = self.extract(self.theta) return np.ones_like(angles) * np.exp(-1j * angles) def get_overloads(self): """ return the branch overloads (time, device) :return: 2D array """ return self.extract(self.overloads) def get_loading(self): """ return the branch loading (time, device) :return: 2D array """ return self.extract(self.s_from, make_abs=True) / (self.rating + 1e-12) def get_branch_power(self): """ return the branch loading (time, device) :return: 2D array """ return self.extract(self.s_from, make_abs=True) * self.numerical_circuit.Sbase def get_battery_power(self): """ return the battery dispatch (time, device) :return: 2D array """ return self.extract(self.Pb) * self.numerical_circuit.Sbase def get_generator_power(self): """ return the generator dispatch (time, device) :return: 2D array """ return self.extract(self.Pg) * self.numerical_circuit.Sbase def get_load_shedding(self): """ return the load shedding (time, device) :return: 2D array """ return self.extract(self.load_shedding) * self.numerical_circuit.Sbase def get_load_power(self): """ return the load shedding (time, device) :return: 2D array """ return self.extract(self.Pl) * self.numerical_circuit.Sbase def get_shadow_prices(self): """ Extract values fro the 2D array of LP variables :return: 2D numpy array """ val = np.zeros(self.nodal_restrictions.shape) for i in range(val.shape[0]): if self.nodal_restrictions[i].pi is not None: val[i] = - self.nodal_restrictions[i].pi return val.transpose() def converged(self): return True class OpfTimeSeries: def __init__(self, numerical_circuit: OpfTimeCircuit, start_idx, end_idx, solver: MIPSolvers=MIPSolvers.CBC): """ :param numerical_circuit: :param start_idx: :param end_idx: """ self.numerical_circuit = numerical_circuit self.start_idx = start_idx self.end_idx = end_idx self.solver = solver self.theta = None self.Pg = None self.Pb = None self.Pl = None self.E = None self.s_from = None self.s_to = None self.overloads = None self.rating = None self.load_shedding = None self.nodal_restrictions = None self.problem = self.formulate() def formulate(self): """ Formulate the AC OPF time series in the non-sequential fashion (all to the solver at once) :return: PuLP Problem instance """ # declare problem problem = LpProblem(name='DC_OPF_Time_Series') return problem def solve(self, msg=False): """ Call PuLP to solve the problem """ if self.solver == MIPSolvers.CBC: params = PULP_CBC_CMD(fracGap=0.00001, threads=None, msg=msg) elif self.solver == MIPSolvers.SCIP: params = SCIP_CMD(msg=msg) elif self.solver == MIPSolvers.CPLEX: params = CPLEX_CMD(msg=msg) elif self.solver == MIPSolvers.GUROBI: params = GUROBI_CMD(msg=msg) elif self.solver == MIPSolvers.XPRESS: params = XPRESS(msg=msg) else: raise Exception('Solver not supported! ' + str(self.solver)) self.problem.solve(params) return LpStatus[self.problem.status] @staticmethod def extract2D(arr, make_abs=False): """ Extract values fro the 2D array of LP variables :param arr: 2D array of LP variables :param make_abs: substitute the result by its abs value :return: 2D numpy array """ val = np.zeros(arr.shape) for i, j in product(range(val.shape[0]), range(val.shape[1])): val[i, j] = arr[i, j].value() if make_abs: val = np.abs(val) return val def get_voltage(self): """ return the complex voltages (time, device) :return: 2D array """ angles = self.extract2D(self.theta) return np.ones_like(angles) * np.exp(-1j * angles) def get_overloads(self): """ return the branch overloads (time, device) :return: 2D array """ return self.extract2D(self.overloads) def get_loading(self): """ return the branch loading (time, device) :return: 2D array """ return self.extract2D(self.s_from, make_abs=True) / self.rating def get_branch_power(self): """ return the branch loading (time, device) :return: 2D array """ return self.extract2D(self.s_from, make_abs=True) * self.numerical_circuit.Sbase def get_battery_power(self): """ return the battery dispatch (time, device) :return: 2D array """ return self.extract2D(self.Pb) * self.numerical_circuit.Sbase def get_battery_energy(self): """ return the battery energy (time, device) :return: 2D array """ return self.extract2D(self.E) * self.numerical_circuit.Sbase def get_generator_power(self): """ return the generator dispatch (time, device) :return: 2D array """ return self.extract2D(self.Pg) * self.numerical_circuit.Sbase def get_load_shedding(self): """ return the load shedding (time, device) :return: 2D array """ return self.extract2D(self.load_shedding) * self.numerical_circuit.Sbase def get_load_power(self): """ return the load shedding (time, device) :return: 2D array """ return self.extract2D(self.Pl) * self.numerical_circuit.Sbase def get_shadow_prices(self): """ Extract values fro the 2D array of LP variables :return: 2D numpy array """ val = np.zeros(self.nodal_restrictions.shape) for i, j in product(range(val.shape[0]), range(val.shape[1])): if self.nodal_restrictions[i, j].pi is not None: val[i, j] = - self.nodal_restrictions[i, j].pi return val.transpose()
29.370821
113
0.599296
1,187
9,663
4.776748
0.171862
0.031041
0.038977
0.053968
0.804586
0.781658
0.728042
0.724339
0.685891
0.6097
0
0.009826
0.304874
9,663
328
114
29.460366
0.834301
0.272483
0
0.642857
0
0
0.013006
0
0
0
0
0
0
1
0.2
false
0
0.028571
0.007143
0.428571
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
e3914aba10fdc51ffb4114fe7a68835962808bc8
212
py
Python
dash-address-monitor/apis/coreRpcClient.py
thephez/dash-address-monitor
1a192a6e91ee9513aa82dbaba6b36da3e30a413b
[ "MIT" ]
2
2018-06-01T20:02:13.000Z
2019-02-03T19:44:45.000Z
dash-address-monitor/apis/coreRpcClient.py
thephez/dash-address-monitor
1a192a6e91ee9513aa82dbaba6b36da3e30a413b
[ "MIT" ]
1
2021-06-01T22:12:33.000Z
2021-06-01T22:12:33.000Z
dash-address-monitor/apis/coreRpcClient.py
thephez/dash-address-monitor
1a192a6e91ee9513aa82dbaba6b36da3e30a413b
[ "MIT" ]
null
null
null
# Connect to a the provided Core RPC connection and request address balance def get_balance(rpcConnection, address): balance = rpcConnection.call('getaddressbalance', address)['balance'] return balance
30.285714
75
0.773585
25
212
6.52
0.72
0.257669
0
0
0
0
0
0
0
0
0
0
0.150943
212
6
76
35.333333
0.905556
0.34434
0
0
0
0
0.175182
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
1
0
0
5
e39fbe3a00d4f646198bcca021345a94c6b006cd
685
py
Python
tomotoio/constants.py
kenichi884/tomotoio
dde76bc518dd88fb93483e89c79e177dc0165d6f
[ "MIT" ]
1
2019-09-09T07:28:45.000Z
2019-09-09T07:28:45.000Z
tomotoio/constants.py
kenichi884/tomotoio
dde76bc518dd88fb93483e89c79e177dc0165d6f
[ "MIT" ]
null
null
null
tomotoio/constants.py
kenichi884/tomotoio
dde76bc518dd88fb93483e89c79e177dc0165d6f
[ "MIT" ]
2
2021-09-02T14:20:19.000Z
2021-11-05T10:56:39.000Z
from bluepy.btle import UUID class UUIDs: """UUIDs defined for the services and characteristics for Toio.""" # Service UUID SERVICE = UUID("10B20100-5B3B-4571-9508-CF3EFCD7BBAE") # Characteristic UUIDs TOIO_ID = UUID("10B20101-5B3B-4571-9508-CF3EFCD7BBAE") MOTOR = UUID("10B20102-5B3B-4571-9508-CF3EFCD7BBAE") LIGHT = UUID("10B20103-5B3B-4571-9508-CF3EFCD7BBAE") SOUND = UUID("10B20104-5B3B-4571-9508-CF3EFCD7BBAE") MOTION = UUID("10B20106-5B3B-4571-9508-CF3EFCD7BBAE") BUTTON = UUID("10B20107-5B3B-4571-9508-CF3EFCD7BBAE") BATTERY = UUID("10B20108-5B3B-4571-9508-CF3EFCD7BBAE") CONFIG = UUID("10B201FF-5B3B-4571-9508-CF3EFCD7BBAE")
36.052632
70
0.719708
84
685
5.857143
0.440476
0.146341
0.219512
0.439024
0
0
0
0
0
0
0
0.288889
0.145985
685
18
71
38.055556
0.552137
0.138686
0
0
0
0
0.555746
0.555746
0
0
0
0
0
1
0
false
0
0.090909
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
1
0
0
5
e3ac3e0ae6e59ddb111fae82b6406afab1ee1fae
103
py
Python
veyon/PySwitchTracer/servers/flask_/slaver/__init__.py
IzayoiRin/VirtualVeyonST
d0c4035dba81d02135ad54f4c5a5d463e95f7925
[ "MIT" ]
null
null
null
veyon/PySwitchTracer/servers/flask_/slaver/__init__.py
IzayoiRin/VirtualVeyonST
d0c4035dba81d02135ad54f4c5a5d463e95f7925
[ "MIT" ]
null
null
null
veyon/PySwitchTracer/servers/flask_/slaver/__init__.py
IzayoiRin/VirtualVeyonST
d0c4035dba81d02135ad54f4c5a5d463e95f7925
[ "MIT" ]
null
null
null
from . import receptorView from . import courierVeiw bluePrinters = [receptorView.bp, courierVeiw.bp]
20.6
48
0.796117
11
103
7.454545
0.545455
0.243902
0
0
0
0
0
0
0
0
0
0
0.126214
103
4
49
25.75
0.911111
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
e3bf6189bbfbee7d7efbcbf51fdc68ce1826abb7
37
py
Python
tests/__init__.py
natanbro/copyany
05f74ae42ef8f4b7ee562c147921abdbef5dea1e
[ "MIT" ]
null
null
null
tests/__init__.py
natanbro/copyany
05f74ae42ef8f4b7ee562c147921abdbef5dea1e
[ "MIT" ]
null
null
null
tests/__init__.py
natanbro/copyany
05f74ae42ef8f4b7ee562c147921abdbef5dea1e
[ "MIT" ]
null
null
null
"""Unit test package for copyany."""
18.5
36
0.675676
5
37
5
1
0
0
0
0
0
0
0
0
0
0
0
0.135135
37
1
37
37
0.78125
0.810811
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
e3ef026978d86896d719e6bd32005c36eb6a757f
196
py
Python
kore/components/signals.py
p1c2u/kore
5959afc331a13ad18a5e697a1d69e76d71576f86
[ "Apache-2.0" ]
3
2017-03-14T10:54:57.000Z
2018-05-07T13:50:59.000Z
kore/components/signals.py
p1c2u/kore
5959afc331a13ad18a5e697a1d69e76d71576f86
[ "Apache-2.0" ]
8
2017-03-14T10:52:07.000Z
2017-09-10T21:26:28.000Z
kore/components/signals.py
p1c2u/kore
5959afc331a13ad18a5e697a1d69e76d71576f86
[ "Apache-2.0" ]
null
null
null
from blinker import Namespace __all__ = ['pre_register', 'post_register'] _signals = Namespace() pre_register = _signals.signal('pre_register') post_register = _signals.signal('post_register')
21.777778
48
0.780612
23
196
6.086957
0.434783
0.235714
0.214286
0.328571
0.428571
0
0
0
0
0
0
0
0.102041
196
8
49
24.5
0.795455
0
0
0
0
0
0.255102
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
5418e96efe6f439573e8da06e480c8fd9b24e4e3
4,017
py
Python
model.py
Callifrey/Paddle-CIC
3d91bdf741d13d4267252940d88fbc0c116a3a4a
[ "Apache-2.0" ]
5
2021-09-30T12:03:12.000Z
2022-02-18T15:15:17.000Z
model.py
Callifrey/Paddle-CIC
3d91bdf741d13d4267252940d88fbc0c116a3a4a
[ "Apache-2.0" ]
null
null
null
model.py
Callifrey/Paddle-CIC
3d91bdf741d13d4267252940d88fbc0c116a3a4a
[ "Apache-2.0" ]
null
null
null
import paddle import paddle.nn as nn class Color_model(nn.Layer): def __init__(self): super(Color_model, self).__init__() self.features = nn.Sequential( # conv1 nn.Conv2D(in_channels=1, out_channels=64, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.Conv2D(in_channels=64, out_channels=64, kernel_size=3, stride=2, padding=1), # (H/2, W/2) nn.ReLU(), nn.BatchNorm2D(num_features=64), # conv2 nn.Conv2D(in_channels=64, out_channels=128, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.Conv2D(in_channels=128, out_channels=128, kernel_size=3, stride=2, padding=1), # (H/4,W/4) nn.ReLU(), nn.BatchNorm2D(num_features=128), # conv3 nn.Conv2D(in_channels=128, out_channels=256, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.Conv2D(in_channels=256, out_channels=256, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.Conv2D(in_channels=256, out_channels=256, kernel_size=3, stride=2, padding=1), # (H/8,W/8) nn.ReLU(), nn.BatchNorm2D(num_features=256), # conv4 nn.Conv2D(in_channels=256, out_channels=512, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.Conv2D(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.Conv2D(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=1), # (H/8,H/8) nn.ReLU(), nn.BatchNorm2D(num_features=512), # conv5 nn.Conv2D(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=2, dilation=2), nn.ReLU(), nn.Conv2D(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=2, dilation=2), # (H/8,W/8) nn.ReLU(), nn.Conv2D(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=2, dilation=2), # ks=3, stride=1, pad = 2, dilation=2的扩张卷积不改变特征图尺寸 nn.ReLU(), nn.BatchNorm2D(num_features=512), # conv6 nn.ReLU(), nn.Conv2D(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=2, dilation=2), nn.ReLU(), nn.Conv2D(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=2, dilation=2), nn.ReLU(), nn.Conv2D(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=2, dilation=2), # (H/8,W/8) nn.ReLU(), nn.BatchNorm2D(num_features=512), # conv7 nn.Conv2D(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=1, dilation=1), nn.ReLU(), nn.Conv2D(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=1, dilation=1), nn.ReLU(), nn.Conv2D(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=1, dilation=1), nn.ReLU(), nn.BatchNorm2D(num_features=512), # conv8 nn.Conv2DTranspose(in_channels=512, out_channels=256, kernel_size=4, stride=2, padding=1, dilation=1), nn.ReLU(), nn.Conv2D(in_channels=256, out_channels=256, kernel_size=3, stride=1, padding=1, dilation=1), nn.ReLU(), nn.Conv2D(in_channels=256, out_channels=256, kernel_size=3, stride=1, padding=1, dilation=1), # (H/4,W/4) nn.ReLU(), # conv8_313 nn.Conv2D(in_channels=256, out_channels=313, kernel_size=1, stride=1, dilation=1), # (H/4, W/4, 313) ) def forward(self, gray_image): features = self.features(gray_image) return features if __name__ == '__main__': img = paddle.rand([1, 1, 256, 256]) model = Color_model() feature = model(img) print(feature.shape) # [1, 313, 64, 64]
45.647727
114
0.577545
560
4,017
3.967857
0.110714
0.118812
0.09901
0.178218
0.807831
0.791179
0.766877
0.657066
0.612061
0.612061
0
0.108575
0.28006
4,017
87
115
46.172414
0.659751
0.052278
0
0.588235
0
0
0.002112
0
0
0
0
0
0
1
0.029412
false
0
0.029412
0
0.088235
0.014706
0
0
0
null
0
0
1
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
5
580a474d74bc7a1492493475e16eb398bf79192b
170
py
Python
hotroom/collector/__init__.py
love3forever/hotroom-api
a560936741822257a77a4a52d5c244e41f8633b8
[ "MIT" ]
null
null
null
hotroom/collector/__init__.py
love3forever/hotroom-api
a560936741822257a77a4a52d5c244e41f8633b8
[ "MIT" ]
null
null
null
hotroom/collector/__init__.py
love3forever/hotroom-api
a560936741822257a77a4a52d5c244e41f8633b8
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2017-02-14 16:38:05 # @Author : Your Name (you@example.org) # @Link : http://example.org # @Version : $Id$
24.285714
40
0.570588
26
170
3.730769
0.923077
0.206186
0
0
0
0
0
0
0
0
0
0.109489
0.194118
170
6
41
28.333333
0.59854
0.929412
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
582ec487f48289fc0d0d6b746d9a0622fac67926
41,417
py
Python
geoportal/tests/functional/test_mapserverproxy.py
yjacolin/c2cgeoportal
16a5a37bcae72ed5e4dc11cd026f2aaa13f2440f
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
geoportal/tests/functional/test_mapserverproxy.py
yjacolin/c2cgeoportal
16a5a37bcae72ed5e4dc11cd026f2aaa13f2440f
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
geoportal/tests/functional/test_mapserverproxy.py
yjacolin/c2cgeoportal
16a5a37bcae72ed5e4dc11cd026f2aaa13f2440f
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
# -*- coding: utf-8 -*- # Copyright (c) 2013-2018, Camptocamp SA # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # The views and conclusions contained in the software and documentation are those # of the authors and should not be interpreted as representing official policies, # either expressed or implied, of the FreeBSD Project. # # # ^ # | # | # | # +--------------------------------------------------------------+ area1 # | +--------------------------------------------------------+ | # | | p2 area3 |200045 p3 | | # | +--------------------------------------------------------+ | # | area1 | | # +--------------------------------------------------------------+ # | # +--------------------------------------------------------------+ # | area2 | | # +---+--------------------------------------------------------------+--------> # 599900 599910 | 600090 600100) # | # | # | # | # | # p1 |199955 p4 # | # | # + # # import hashlib import typing from unittest import TestCase from sqlalchemy import Column, types import sqlalchemy.ext.declarative from geoalchemy2 import Geometry, WKTElement import transaction from c2cgeoportal_geoportal.lib import functionality from tests.functional import ( # noqa teardown_common as teardown_module, setup_common as setup_module, create_dummy_request, mapserv_url, create_default_ogcserver, cleanup_db ) # GetMap hash for MapServer 6.0 and 7.0 FOUR_POINTS = ["61cbb0a6d18b72e4a28c1087019de245", "e2fe30a8085b0db4040c9ad0d331b6b8"] TWO_POINTS = ["0a4fac2209d06c6fa36048c125b1679a", "0469e20ee04f22ab7ccdfebaa125f203"] NO_POINT = ["ef33223235b26c782736c88933b35331", "aaa27d9450664d34fd8f53b6e76af1e1"] Base: typing.Any = sqlalchemy.ext.declarative.declarative_base() class PointTest(Base): __tablename__ = "testpoint" __table_args__ = {"schema": "geodata"} id = Column(types.Integer, primary_key=True) geom = Column(Geometry("POINT", srid=21781)) name = Column(types.Unicode) city = Column(types.Unicode) country = Column(types.Unicode) GETFEATURE_REQUEST = """<?xml version='1.0' encoding="UTF-8" ?> <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <wfs:Query typeName="feature:%(feature)s" srsName="EPSG:21781" xmlns:feature="http://mapserver.gis.umn.edu/mapserver"> <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"> <ogc:PropertyIs%(function)s matchCase="false" %(arguments)s> <ogc:PropertyName>%(property)s</ogc:PropertyName> <ogc:Literal>%(value)s</ogc:Literal> </ogc:PropertyIs%(function)s> </ogc:Filter> </wfs:Query> </wfs:GetFeature>""" SUBSTITUTION_GETFEATURE_REQUEST = (GETFEATURE_REQUEST % { "feature": "testpoint_substitution", "function": "NotEqualTo", "arguments": "", "property": "name", "value": "toto", }).encode("utf-8") COLUMN_RESTRICTION_GETFEATURE_REQUEST = (GETFEATURE_REQUEST % { "feature": "testpoint_column_restriction", "function": "NotEqualTo", "arguments": "", "property": "name", "value": "bar", }).encode("utf-8") class TestMapserverproxyView(TestCase): def setup_method(self, _): # Always see the diff # https://docs.python.org/2/library/unittest.html#unittest.TestCase.maxDiff self.maxDiff = None from c2cgeoportal_commons.models import DBSession from c2cgeoportal_commons.models.main import Role, LayerWMS, RestrictionArea, \ Functionality, Interface, OGCServer, OGCSERVER_TYPE_GEOSERVER, OGCSERVER_AUTH_GEOSERVER from c2cgeoportal_commons.models.static import User cleanup_db() ogc_server_internal, _ = create_default_ogcserver() ogcserver_geoserver = OGCServer(name="__test_ogc_server_geoserver") ogcserver_geoserver.url = mapserv_url ogcserver_geoserver.type = OGCSERVER_TYPE_GEOSERVER ogcserver_geoserver.auth = OGCSERVER_AUTH_GEOSERVER PointTest.__table__.create(bind=DBSession.bind, checkfirst=True) geom = WKTElement("POINT(599910 199955)", srid=21781) p1 = PointTest(geom=geom, name="foo", city="Lausanne", country="Swiss") geom = WKTElement("POINT(599910 200045)", srid=21781) p2 = PointTest(geom=geom, name="bar", city="Chambéry", country="France") geom = WKTElement("POINT(600090 200045)", srid=21781) p3 = PointTest(geom=geom, name="éàè", city="Paris", country="France") geom = WKTElement("POINT(600090 199955)", srid=21781) p4 = PointTest(geom=geom, name="123", city="Londre", country="UK") pt1 = Functionality(name="print_template", value="1 Wohlen A4 portrait") pt2 = Functionality(name="print_template", value="2 Wohlen A3 landscape") user1 = User(username="__test_user1", password="__test_user1") role1 = Role(name="__test_role1", description="__test_role1", functionalities=[pt1, pt2]) user1.role_name = role1.name user1.email = "Tarenpion" user2 = User(username="__test_user2", password="__test_user2") role2 = Role(name="__test_role2", description="__test_role2", functionalities=[pt1, pt2]) user2.role_name = role2.name user2.email = "Tarenpion" user3 = User(username="__test_user3", password="__test_user3") role3 = Role(name="__test_role3", description="__test_role3", functionalities=[pt1, pt2]) user3.role_name = role3.name main = Interface(name="main") layer2 = LayerWMS("testpoint_protected", public=False) layer2.layer = "testpoint_protected" layer2.ogc_server = ogc_server_internal layer2.interfaces = [main] layer3 = LayerWMS("testpoint_protected_query_with_collect", public=False) layer3.layer = "testpoint_protected_query_with_collect" layer3.ogc_server = ogc_server_internal layer3.interfaces = [main] area = "POLYGON((599900 200030, 599900 200050, 600100 200050, 600100 200030, 599900 200030))" area = WKTElement(area, srid=21781) restricted_area1 = RestrictionArea("__test_ra1", "", [layer2, layer3], [role1], area) area = "POLYGON((599900 200000, 599900 200020, 600100 200020, 600100 200000, 599900 200000))" area = WKTElement(area, srid=21781) restricted_area2 = RestrictionArea("__test_ra2", "", [layer2, layer3], [role2, role3], area) area = "POLYGON((599905 200043, 599905 200047, 600095 200047, 600095 200043, 599905 200043))" area = WKTElement(area, srid=21781) restricted_area3 = RestrictionArea("__test_ra3", "", [layer3], [role3], area, readwrite=True) DBSession.add_all([ p1, p2, p3, p4, user1, user2, user3, role1, role2, role3, restricted_area1, restricted_area2, restricted_area3, ogcserver_geoserver ]) DBSession.flush() self.id_lausanne = p1.id self.id_paris = p3.id self.ogc_server_id = ogc_server_internal.id self.role1_id = role1.id self.role2_id = role2.id self.role3_id = role3.id transaction.commit() def teardown_method(self, _): from c2cgeoportal_commons.models import DBSession functionality.FUNCTIONALITIES_TYPES = None cleanup_db() PointTest.__table__.drop(bind=DBSession.bind, checkfirst=True) @staticmethod def _create_dummy_request(username=None): request = create_dummy_request({ "admin_interface": { "available_functionalities": [ "mapserver_substitution", "print_template", ] } }, user=username) return request def test_no_params(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() response = MapservProxy(request).proxy() self.assertEqual(response.status_code, 200) def test_get_legend_graphic(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() request.params.update(dict( service="wms", version="1.1.1", request="getlegendgraphic", layer="testpoint_unprotected", srs="EPSG:21781", format="image/png", extraparam="with spéciàl chârs" )) response = MapservProxy(request).proxy() self.assertTrue(response.cache_control.public) self.assertEqual(response.cache_control.max_age, 3600) def test_getlegendgraphic_custom_nocache(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() request.registry.settings.update({ "headers": { "mapserver": { "cache_control_max_age": 0, "access_control_allow_origin": "*" } } }) request.params.update(dict( service="wms", version="1.1.1", request="getlegendgraphic", layer="testpoint_unprotected", srs="EPSG:21781", format="image/png", extraparam="with spéciàl chârs" )) response = MapservProxy(request).proxy() self.assertTrue(response.cache_control.public) self.assertTrue(response.cache_control.no_cache) def test_get_feature_info(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() request.params.update(dict( service="wms", version="1.1.1", request="getfeatureinfo", bbox="599910,199955,600090,200000", layers="testpoint_unprotected", query_layers="testpoint_unprotected", srs="EPSG:21781", format="image/png", info_format="application/vnd.ogc.gml", width="600", height="400", x="0", y="400" )) response = MapservProxy(request).proxy() expected_response = """ <?xmlversion="1.0"encoding="UTF-8"?> <msGMLOutput xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <testpoint_unprotected_layer> <gml:name>countries</gml:name> <testpoint_unprotected_feature> <gml:boundedBy> <gml:Box srsName="EPSG:21781"> <gml:coordinates>599910.000000,199955.000000 599910.000000,199955.000000</gml:coordinates> </gml:Box> </gml:boundedBy> <geom> <gml:Point srsName="EPSG:21781"> <gml:coordinates>599910.000000,199955.000000</gml:coordinates> </gml:Point> </geom> <name>foo</name> <city>Lausanne</city> <country>Swiss</country> </testpoint_unprotected_feature> </testpoint_unprotected_layer> </msGMLOutput> """ import re pattern = re.compile(r"\s+") expected_response = "".join( re.sub(pattern, "", l) for l in expected_response.splitlines() ) response_body = "".join( re.sub(pattern, "", l) for l in response.body.decode("utf-8").splitlines() ).encode("utf-8") self.assertEqual(response_body.decode("utf-8"), expected_response) self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") def test_get_feature_info_jsonp(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() request.params.update(dict( service="wms", version="1.1.1", request="getfeatureinfo", bbox="599910,199955,600090,200000", layers="testpoint_unprotected", query_layers="testpoint_unprotected", srs="EPSG:21781", format="image/png", info_format="application/vnd.ogc.gml", width="600", height="400", x="0", y="400", callback="cb" )) response = MapservProxy(request).proxy() expected_response = """ <?xmlversion="1.0"encoding="UTF-8"?> <msGMLOutput xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <testpoint_unprotected_layer> <gml:name>countries</gml:name> <testpoint_unprotected_feature> <gml:boundedBy> <gml:Box srsName="EPSG:21781"> <gml:coordinates>599910.000000,199955.000000 599910.000000,199955.000000</gml:coordinates> </gml:Box> </gml:boundedBy> <geom> <gml:Point srsName="EPSG:21781"> <gml:coordinates>599910.000000,199955.000000</gml:coordinates> </gml:Point> </geom> <name>foo</name> <city>Lausanne</city> <country>Swiss</country> </testpoint_unprotected_feature> </testpoint_unprotected_layer> </msGMLOutput> """ import re pattern = re.compile(r"\s+") expected_response = "".join( re.sub(pattern, "", l) for l in expected_response.splitlines() ) expected_response = "{0!s}('{1!s}');".format("cb", expected_response) response_body = "".join( re.sub(pattern, "", l) for l in response.body.decode("utf-8").splitlines() ) self.assertEqual(response_body, expected_response) self.assertFalse(response.cache_control.public) self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") def test_get_map_unprotected_layer_anonymous(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() request.params.update(dict( service="wms", version="1.1.1", request="getmap", bbox="599820,199910,600180,200090", layers="testpoint_unprotected", width="600", height="400", srs="EPSG:21781", format="image/png" )) response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") # 4 points md5sum = hashlib.md5(response.body).hexdigest() self.assertIn(md5sum, FOUR_POINTS) def test_get_map_unprotected_layer_user1(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request(username="__test_user1") request.params.update(dict( service="wms", version="1.1.1", request="getmap", bbox="599820,199910,600180,200090", layers="testpoint_unprotected", width="600", height="400", srs="EPSG:21781", format="image/png" )) response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") # 4 points md5sum = hashlib.md5(response.body).hexdigest() self.assertIn(md5sum, FOUR_POINTS) def test_get_map_unprotected_layer_user2(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request(username="__test_user2") request.params.update(dict( service="wms", version="1.1.1", request="getmap", bbox="599820,199910,600180,200090", layers="testpoint_unprotected", width="600", height="400", srs="EPSG:21781", format="image/png" )) response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") # 4 points md5sum = hashlib.md5(response.body).hexdigest() self.assertIn(md5sum, FOUR_POINTS) def test_get_map_protected_layer_anonymous(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() request.params.update(dict( service="wms", version="1.1.1", request="getmap", bbox="599820,199910,600180,200090", layers="testpoint_protected", width="600", height="400", srs="EPSG:21781", format="image/png" )) response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") # empty md5sum = hashlib.md5(response.body).hexdigest() self.assertIn(md5sum, NO_POINT) def test_get_map_protected_layer_user1(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request(username="__test_user1") request.params.update(dict( service="wms", version="1.1.1", request="getmap", bbox="599820,199910,600180,200090", layers="testpoint_protected", width="600", height="400", srs="EPSG:21781", format="image/png" )) response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") # two points md5sum = hashlib.md5(response.body).hexdigest() self.assertIn(md5sum, TWO_POINTS) def test_get_map_protected_layer_user2(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request(username="__test_user2") request.params.update(dict( service="wms", version="1.1.1", request="getmap", bbox="599820,199910,600180,200090", layers="testpoint_protected", width="600", height="400", srs="EPSG:21781", format="image/png" )) response = MapservProxy(request).proxy() self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") # empty md5sum = hashlib.md5(response.body).hexdigest() self.assertIn(md5sum, NO_POINT) def test_get_map_protected_layer_collect_query_user1(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request(username="__test_user1") request.params.update(dict( service="wms", version="1.1.1", request="getmap", bbox="599820,199910,600180,200090", layers="testpoint_protected_query_with_collect", width="600", height="400", srs="EPSG:21781", format="image/png" )) response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") # two points md5sum = hashlib.md5(response.body).hexdigest() self.assertIn(md5sum, TWO_POINTS) def test_get_map_protected_layer_collect_query_user2(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request(username="__test_user2") request.params.update(dict( service="wms", version="1.1.1", request="getmap", bbox="599820,199910,600180,200090", layers="testpoint_protected_query_with_collect", width="600", height="400", srs="EPSG:21781", format="image/png" )) response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") # empty md5sum = hashlib.md5(response.body).hexdigest() self.assertIn(md5sum, NO_POINT) def test_get_map_protected_layer_collect_query_user3(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request(username="__test_user3") request.params.update(dict( service="wms", version="1.1.1", request="getmap", bbox="599820,199910,600180,200090", layers="testpoint_protected_query_with_collect", width="600", height="400", srs="EPSG:21781", format="image/png" )) response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") # two points md5sum = hashlib.md5(response.body).hexdigest() self.assertIn(md5sum, TWO_POINTS) @staticmethod def _create_getcap_request(username=None, additional_settings=None): if additional_settings is None: additional_settings = {} from c2cgeoportal_commons.models import DBSession from c2cgeoportal_commons.models.static import User request = create_dummy_request(additional_settings) request.user = None if username is None else \ DBSession.query(User).filter_by(username=username).one() return request def test_private_layer(self): from c2cgeoportal_geoportal.lib.filter_capabilities import get_private_layers pl = get_private_layers([self.ogc_server_id]) self.assertEqual( {pl[l].name for l in pl}, {"testpoint_protected", "testpoint_protected_query_with_collect"} ) def test_protected_layers1(self): from c2cgeoportal_geoportal.lib.filter_capabilities import get_protected_layers pl = get_protected_layers(self.role1_id, [self.ogc_server_id]) self.assertEqual( {pl[l].name for l in pl}, {"testpoint_protected", "testpoint_protected_query_with_collect"} ) def test_protected_layers2(self): from c2cgeoportal_geoportal.lib.filter_capabilities import get_protected_layers pl = get_protected_layers(self.role2_id, [self.ogc_server_id]) self.assertEqual( {pl[l].name for l in pl}, {"testpoint_protected", "testpoint_protected_query_with_collect"} ) def test_protected_layers3(self): from c2cgeoportal_geoportal.lib.filter_capabilities import get_protected_layers pl = get_protected_layers(self.role3_id, [self.ogc_server_id]) self.assertEqual( {pl[l].name for l in pl}, {"testpoint_protected", "testpoint_protected_query_with_collect"} ) def test_writable_layers1(self): from c2cgeoportal_geoportal.lib.filter_capabilities import get_writable_layers pl = get_writable_layers(self.role1_id, [self.ogc_server_id]) self.assertEqual( {pl[l].name for l in pl}, set() ) def test_writable_layers2(self): from c2cgeoportal_geoportal.lib.filter_capabilities import get_writable_layers pl = get_writable_layers(self.role2_id, [self.ogc_server_id]) self.assertEqual( {pl[l].name for l in pl}, set() ) def test_writable_layers3(self): from c2cgeoportal_geoportal.lib.filter_capabilities import get_writable_layers pl = get_writable_layers(self.role3_id, [self.ogc_server_id]) self.assertEqual( {pl[l].name for l in pl}, {"testpoint_protected_query_with_collect"} ) def test_wms_get_capabilities(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_getcap_request() request.params.update(dict( service="wms", version="1.1.1", request="getcapabilities", )) response = MapservProxy(request).proxy() assert "<Name>testpoint_protected</Name>" not in response.body.decode("utf-8") request = self._create_getcap_request(username="__test_user1") request.params.update(dict( service="wms", version="1.1.1", request="getcapabilities", )) response = MapservProxy(request).proxy() assert "<Name>testpoint_protected</Name>" in response.body.decode("utf-8") def test_wfs_get_capabilities(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_getcap_request() request.params.update(dict( service="wfs", version="1.1.1", request="getcapabilities", )) response = MapservProxy(request).proxy() assert "<Name>testpoint_protected</Name>" not in response.body.decode("utf-8") request = self._create_getcap_request(username="__test_user1") request.params.update(dict( service="wfs", version="1.1.1", request="getcapabilities", )) response = MapservProxy(request).proxy() assert "<Name>testpoint_protected</Name>" in response.body.decode("utf-8") def _get_feature_is_equal_to(self, value): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() request.method = "POST" request.body = (GETFEATURE_REQUEST % { "feature": "testpoint_unprotected", "function": "EqualTo", "arguments": "", "property": "name", "value": value, }).encode("utf-8") return MapservProxy(request).proxy() def test_get_feature_is_equal_to(self): response = self._get_feature_is_equal_to("foo") self.assertTrue(response.status_int, 200) assert "foo" in response.body.decode("utf-8") assert "bar" not in response.body.decode("utf-8") assert "éàè" not in response.body.decode("utf-8") assert "123" not in response.body.decode("utf-8") response = self._get_feature_is_equal_to("éàè") self.assertTrue(response.status_int, 200) # 500) assert "foo" not in response.body.decode("utf-8") assert "bar" not in response.body.decode("utf-8") assert "éàè" in response.body.decode("utf-8") assert "123" not in response.body.decode("utf-8") response = self._get_feature_is_equal_to("123") self.assertTrue(response.status_int, 200) assert "foo" not in response.body.decode("utf-8") assert "bar" not in response.body.decode("utf-8") assert "éàè" not in response.body.decode("utf-8") assert "123" in response.body.decode("utf-8") def _get_feature_is_not_equal_to(self, value): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() request.headers["Content-Type"] = "application/xml; charset=UTF-8" request.method = "POST" request.body = (GETFEATURE_REQUEST % { "feature": "testpoint_unprotected", "function": "NotEqualTo", "arguments": "", "property": "name", "value": value, }).encode("utf-8") return MapservProxy(request).proxy() def test_get_feature_is_not_equal_to(self): response = self._get_feature_is_not_equal_to("foo") self.assertTrue(response.status_int, 200) assert "foo" not in response.body.decode("utf-8") assert "bar" in response.body.decode("utf-8") assert "éàè" in response.body.decode("utf-8") assert "123" in response.body.decode("utf-8") response = self._get_feature_is_not_equal_to("éàè") self.assertTrue(response.status_int, 200) assert "foo" in response.body.decode("utf-8") assert "bar" in response.body.decode("utf-8") assert "éàè" not in response.body.decode("utf-8") assert "123" in response.body.decode("utf-8") response = self._get_feature_is_not_equal_to("123") self.assertTrue(response.status_int, 200) assert "foo" in response.body.decode("utf-8") assert "bar" in response.body.decode("utf-8") assert "éàè" in response.body.decode("utf-8") assert "123" not in response.body.decode("utf-8") def _get_feature_is_like(self, value): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() request.method = "POST" request.body = (GETFEATURE_REQUEST % { "feature": "testpoint_unprotected", "function": "Like", "arguments": 'wildCard="*" singleChar="." escapeChar="!"', "property": "name", "value": value, }).encode("utf-8") return MapservProxy(request).proxy() def test_get_feature_is_like(self): response = self._get_feature_is_like("*o*") self.assertTrue(response.status_int, 200) assert "foo" in response.body.decode("utf-8") assert "bar" not in response.body.decode("utf-8") assert "éàè" not in response.body.decode("utf-8") assert "123" not in response.body.decode("utf-8") response = self._get_feature_is_like("*à*") self.assertTrue(response.status_int, 200) assert "foo" not in response.body.decode("utf-8") assert "bar" not in response.body.decode("utf-8") assert "éàè" in response.body.decode("utf-8") assert "123" not in response.body.decode("utf-8") response = self._get_feature_is_like("*2*") self.assertTrue(response.status_int, 200) assert "foo" not in response.body.decode("utf-8") assert "bar" not in response.body.decode("utf-8") assert "éàè" not in response.body.decode("utf-8") assert "123" in response.body.decode("utf-8") def test_get_feature_feature_id_get(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() featureid = "{typename!s}.{fid1!s},{typename!s}.{fid2!s}".format( typename="testpoint_unprotected", fid1=self.id_lausanne, fid2=self.id_paris ) request.params.update(dict( service="wfs", version="1.0.0", request="getfeature", typename="testpoint_unprotected", featureid=featureid )) response = MapservProxy(request).proxy() assert "Lausanne" in response.body.decode("utf-8") assert "Paris" in response.body.decode("utf-8") assert "Londre" not in response.body.decode("utf-8") assert "Chambéry" not in response.body.decode("utf-8") self.assertEqual(response.content_type, "text/xml") def test_get_feature_feature_id_get_jsonp(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() featureid = "{typename!s}.{fid1!s},{typename!s}.{fid2!s}".format( typename="testpoint_unprotected", fid1=self.id_lausanne, fid2=self.id_paris ) request.params.update(dict( service="wfs", version="1.0.0", request="getfeature", typename="testpoint_unprotected", featureid=featureid, callback="cb" )) response = MapservProxy(request).proxy() assert "Lausanne" in response.body.decode("utf-8") assert "Paris" in response.body.decode("utf-8") assert "Londre" not in response.body.decode("utf-8") assert "Chambéry" not in response.body.decode("utf-8") self.assertEqual(response.content_type, "application/javascript") def test_get_feature_wfs_url(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() featureid = "{typename!s}.{fid1!s},{typename!s}.{fid2!s}".format( typename="testpoint_unprotected", fid1=self.id_lausanne, fid2=self.id_paris ) request.params.update(dict( service="wfs", version="1.0.0", request="getfeature", typename="testpoint_unprotected", featureid=featureid, callback="cb" )) response = MapservProxy(request).proxy() self.assertTrue(response.body != "") self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") def test_get_feature_external_url(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() featureid = "{typename!s}.{fid1!s},{typename!s}.{fid2!s}".format( typename="testpoint_unprotected", fid1=self.id_lausanne, fid2=self.id_paris ) request.params.update(dict( service="wfs", version="1.0.0", request="getfeature", typename="testpoint_unprotected", featureid=featureid, callback="cb", EXTERNAL=1 )) response = MapservProxy(request).proxy() self.assertTrue(response.body != "") self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") def test_get_feature_external_wfs_url(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() featureid = "{typename!s}.{fid1!s},{typename!s}.{fid2!s}".format( typename="testpoint_unprotected", fid1=self.id_lausanne, fid2=self.id_paris ) request.params.update(dict( service="wfs", version="1.0.0", request="getfeature", typename="testpoint_unprotected", featureid=featureid, callback="cb", EXTERNAL=1 )) response = MapservProxy(request).proxy() self.assertTrue(response.body != "") self.assertEqual(str(response.cache_control), "max-age=0, must-revalidate, no-cache, no-store") def test_substitution(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_dummy_request() request.method = "POST" request.headers["Content-Type"] = "application/xml; charset=UTF-8" request.body = SUBSTITUTION_GETFEATURE_REQUEST response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) assert "foo" in response.body.decode("utf-8") assert "bar" not in response.body.decode("utf-8") assert "éàè" not in response.body.decode("utf-8") assert "123" not in response.body.decode("utf-8") request.params.update(dict(s_name="bar")) response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) assert "foo" in response.body.decode("utf-8") assert "bar" not in response.body.decode("utf-8") assert "éàè" not in response.body.decode("utf-8") assert "123" not in response.body.decode("utf-8") request = self._create_dummy_request() request.method = "POST" request.body = SUBSTITUTION_GETFEATURE_REQUEST request.params.update(dict(S_NAME="bar")) response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) assert "foo" in response.body.decode("utf-8") assert "bar" not in response.body.decode("utf-8") assert "éàè" not in response.body.decode("utf-8") assert "123" not in response.body.decode("utf-8") request = self._create_dummy_request() request.method = "POST" request.body = SUBSTITUTION_GETFEATURE_REQUEST request.registry.settings["functionalities"]["anonymous"] = { "mapserver_substitution": ["name=bar"] } response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) assert "foo" not in response.body.decode("utf-8") assert "bar" in response.body.decode("utf-8") assert "éàè" not in response.body.decode("utf-8") assert "123" not in response.body.decode("utf-8") request.body = COLUMN_RESTRICTION_GETFEATURE_REQUEST request.registry.settings["functionalities"]["anonymous"] = { "mapserver_substitution": ["cols=name", "cols=city", "cols=country"] } response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) assert "Lausanne" in response.body.decode("utf-8") assert "Swiss" in response.body.decode("utf-8") request.registry.settings["functionalities"]["anonymous"] = { "mapserver_substitution": ["cols=name", "cols=city"] } response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) assert "Lausanne" in response.body.decode("utf-8") assert "Swiss" not in response.body.decode("utf-8") request.registry.settings["functionalities"]["anonymous"] = { "mapserver_substitution": ["cols=name", "cols=country"] } response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) assert "Lausanne" not in response.body.decode("utf-8") assert "Swiss" in response.body.decode("utf-8") request.registry.settings["functionalities"]["anonymous"] = { "mapserver_substitution": ["cols=name"] } response = MapservProxy(request).proxy() self.assertTrue(response.status_int, 200) assert "Lausanne" not in response.body.decode("utf-8") assert "Swiss" not in response.body.decode("utf-8") request = self._create_dummy_request() request.registry.settings["admin_interface"] = {"available_functionalities": [ "mapserver_substitution" ]} request.method = "POST" request.body = SUBSTITUTION_GETFEATURE_REQUEST request.registry.settings["functionalities"]["anonymous"] = { "mapserver_substitution": ["foo_bar"] } request.params.update(dict( s_test1="to be removed", S_TEST2="to be removed" )) # just pass in the log message response = MapservProxy(request).proxy() def test_geoserver(self): from c2cgeoportal_geoportal.views.mapserverproxy import MapservProxy request = self._create_getcap_request(username="__test_user1", additional_settings={ "mapserverproxy": { "default_ogc_server": "__test_ogc_server_geoserver", } }) request.params.update(dict( service="wms", version="1.1.1", request="getcapabilities", )) response = MapservProxy(request).proxy() assert "<Name>testpoint_protected</Name>" in response.body.decode("utf-8")
42.830403
232
0.627013
4,543
41,417
5.542373
0.105877
0.043369
0.054331
0.063386
0.779181
0.754557
0.726995
0.721037
0.715398
0.709162
0
0.05048
0.24572
41,417
966
233
42.874741
0.755506
0.074993
0
0.684913
0
0.00534
0.237272
0.083022
0
0
0
0
0.188251
1
0.053405
false
0.004005
0.066756
0
0.138852
0.004005
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
5873f2b6cca3de7a8ac279e0557af7cbf08bddb8
15,773
py
Python
bellini/api/_numpyro.py
choderalab/bellin
b6c03b900d34f8a5570c51af22ef2d589da2a050
[ "MIT" ]
3
2021-06-07T20:05:14.000Z
2021-07-03T04:56:32.000Z
bellini/api/_numpyro.py
choderalab/bellin
b6c03b900d34f8a5570c51af22ef2d589da2a050
[ "MIT" ]
4
2021-07-19T21:05:14.000Z
2021-09-14T15:42:04.000Z
bellini/api/_numpyro.py
choderalab/bellin
b6c03b900d34f8a5570c51af22ef2d589da2a050
[ "MIT" ]
1
2021-03-24T07:21:21.000Z
2021-03-24T07:21:21.000Z
""" Module containing functions that compile bellini graphs into numpyro models """ # ============================================================================= # IMPORTS # ============================================================================= import numpyro import bellini import bellini.api.functional as F from bellini.api import utils import jax import jax.numpy as jnp import warnings from bellini.units import get_internal_units, to_internal_units, ureg # ============================================================================= # Compilation # ============================================================================= def _eval_node(node, model_dict, _jit_dist_cache, obs=None): """ Evaluate node values recursively using DP """ if node is None: # allows None nodes return None elif isinstance(node, (list, tuple)): return [_eval_node(subnode, model_dict, _jit_dist_cache, obs) for subnode in node] elif node in model_dict.keys(): pass elif callable(node): # e.g. a function model_dict[node] = node elif isinstance(node, bellini.quantity.Quantity): model_dict[node] = node.jnp() else: # draw directly from numpyro function for simple distribution if isinstance(node, bellini.distributions.SimpleDistribution): name = node.name obs_data = None if obs is not None and node in obs.keys(): obs_data = obs[node].to(node.units).magnitude elif getattr(node, "observed", False): warnings.warn(f"observed node {name} was not given data to condition on. no conditioning performed.") parameters = {} for param_name, param in node.parameters.items(): _eval_node(param, model_dict, _jit_dist_cache, obs) # we assume all the parameters are of the same unit as node # i think this should be reasonable? parameters[param_name] = model_dict[param].to(node.units).magnitude sample = numpyro.sample( name, getattr( numpyro.distributions, node.__class__.__name__, )( **parameters, ), obs = obs_data ) model_dict[node] = bellini.quantity.Quantity( sample, node.units, ) # compute composed distribution based on parameters elif isinstance(node, bellini.distributions.ComposedDistribution): name = node.name op = getattr(F, node.op) distributions = node.distributions for param in distributions: _eval_node(param, model_dict, _jit_dist_cache, obs) assert len(distributions) == 2 sample = op( to_internal_units(model_dict[distributions[0]]).magnitude, to_internal_units(model_dict[distributions[1]]).magnitude, ) dist1_int_units = get_internal_units(model_dict[distributions[0]]) dist2_int_units = get_internal_units(model_dict[distributions[1]]) if node.op in ("add", "sub"): sample_units = dist1_int_units else: sample_units = op( dist1_int_units, dist2_int_units ) if getattr(node, "trace", None): numpyro.deterministic(node.name, sample) model_dict[node] = bellini.quantity.Quantity( sample, sample_units, ).to(node.units) # compute transposed distribution based on parameters elif isinstance(node, bellini.distributions.TransformedDistribution): name = node.name op = getattr(F, node.op) for arg in node.args: _eval_node(arg, model_dict, _jit_dist_cache, obs) def _to_internal_units_mag(arg): return to_internal_units(model_dict[arg]).magnitude args_to_jax = utils._to_x_constructor(_to_internal_units_mag) jax_args = args_to_jax(node.args) sample = op(*jax_args, **node.kwargs) if getattr(node, "trace", None): numpyro.deterministic(node.name, sample) model_dict[node] = bellini.quantity.Quantity( sample, node.units, ) # compute fn outputs based on parameters, with caching elif isinstance(node, bellini.distributions._JITDistribution): name = node.name fn = node.fn inputs = node.inputs label = node.label def _gen_cache_key(inputs): hashable_inputs = [] for key, entry in inputs.items(): if isinstance(entry, dict): hashable_inputs.append( ( key, tuple(entry.items()) ) ) else: hashable_inputs.append((key, entry)) return tuple(hashable_inputs) for arg in inputs.values(): if isinstance(arg, dict): for arg_val in arg.values(): _eval_node(arg_val, model_dict, _jit_dist_cache, obs) elif isinstance(arg, (list, tuple)): model_dict[node] = [_eval_node(subnode, model_dict, _jit_dist_cache, obs) for subnode in node] else: _eval_node(arg, model_dict, _jit_dist_cache, obs) # caching fn outputs since fn could potentially be expensive _cache_key = (fn, _gen_cache_key(inputs)) if _cache_key not in _jit_dist_cache.keys(): sampled_inputs = {} for key, arg in inputs.items(): if isinstance(arg, dict): sampled_inputs[key] = { k: model_dict[v] for k,v in arg.items() } elif arg is None: # for args that are None sampled_inputs[key] = None elif isinstance(arg, list): sampled_inputs[key] = [model_dict[a] for a in arg] elif isinstance(arg, tuple): sampled_inputs[key] = tuple([model_dict[a] for a in arg]) else: sampled_inputs[key] = model_dict[arg] _jit_dist_cache[_cache_key] = fn(**sampled_inputs) sample = _jit_dist_cache[_cache_key][label] if getattr(node, "trace", None): numpyro.deterministic(node.name, sample.magnitude) model_dict[node] = sample.to(node.units) # compute unit scaling elif isinstance(node, bellini.distributions.UnitChangedDistribution): name = node.name dist = node.distribution _eval_node(dist, model_dict, _jit_dist_cache, obs) sample = (model_dict[dist] * dist.scaling_factor).magnitude if getattr(node, "trace", None): numpyro.deterministic(node.name, sample) model_dict[node] = bellini.quantity.Quantity( sample, node.units, ) return model_dict[node] def _lax_eval_node(node, model_dict, _jit_dist_cache, id_to_node={}, obs=None): """ Evaluate node values recursively using jit-able DP """ def eval_unvisited_node(node, model_dict, _jit_dist_cache, id_to_node={}, obs=None): # draw directly from numpyro function for simple distribution if isinstance(node, bellini.distributions.SimpleDistribution): name = node.name obs_data = None if obs is not None and node in obs.keys(): obs_data = obs[node].to(node.units).magnitude elif getattr(node, "observed", False): warnings.warn(f"observed node {name} was not given data to condition on. no conditioning performed.") parameters = {} for param_name, param in node.parameters.items(): _lax_eval_node(param, model_dict, _jit_dist_cache, id_to_node, obs) # we assume all the parameters are of the same unit as node # i think this should be reasonable? parameters[param_name] = model_dict[id(param)].to(node.units).magnitude sample = numpyro.sample( name, getattr( numpyro.distributions, node.__class__.__name__, )( **parameters, ), obs = obs_data ) print("lax sample!", name) model_dict[id(node)] = bellini.quantity.Quantity( sample, node.units, ) # compute composed distribution based on parameters elif isinstance(node, bellini.distributions.ComposedDistribution): name = node.name op = getattr(F, node.op) distributions = node.distributions for param in distributions: _lax_eval_node(param, model_dict, _jit_dist_cache, id_to_node, obs) assert len(distributions) == 2 sample = op( to_internal_units(model_dict[id(distributions[0])]).magnitude, to_internal_units(model_dict[id(distributions[1])]).magnitude, ) dist1_int_units = get_internal_units(model_dict[id(distributions[0])]) dist2_int_units = get_internal_units(model_dict[id(distributions[1])]) if node.op in ("add", "sub"): sample_units = dist1_int_units else: sample_units = op( dist1_int_units, dist2_int_units ) if getattr(node, "trace", None): numpyro.deterministic(node.name, sample) model_dict[id(node)] = bellini.quantity.Quantity( sample, sample_units, ).to(node.units) # compute transposed distribution based on parameters elif isinstance(node, bellini.distributions.TransformedDistribution): name = node.name op = getattr(F, node.op) for arg in node.args: _lax_eval_node(arg, model_dict, _jit_dist_cache, id_to_node, obs) jax_args = [ to_internal_units(model_dict[id(arg)]).magnitude for arg in node.args ] sample = op(*jax_args, **node.kwargs) if getattr(node, "trace", None): numpyro.deterministic(node.name, sample) model_dict[id(node)] = bellini.quantity.Quantity( sample, node.units, ) # compute fn outputs based on parameters, with caching elif isinstance(node, bellini.distributions._JITDistribution): name = node.name fn = node.fn inputs = node.inputs label = node.label def _gen_cache_key(inputs): hashable_inputs = [] for key, entry in inputs.items(): if isinstance(entry, dict): hashable_inputs.append( ( key, tuple(entry.items()) ) ) else: hashable_inputs.append((key, entry)) return tuple(hashable_inputs) for arg in inputs.values(): if isinstance(arg, dict): for arg_val in arg.values(): _lax_eval_node(arg_val, model_dict, _jit_dist_cache, id_to_node, obs) else: _lax_eval_node(arg, model_dict, _jit_dist_cache, id_to_node, obs) # caching fn outputs since fn could potentially be expensive _cache_key = (fn, _gen_cache_key(inputs)) if _cache_key not in _jit_dist_cache.keys(): sampled_inputs = {} for key, arg in inputs.items(): if isinstance(arg, dict): sampled_inputs[key] = { k: model_dict[id(v)] for k,v in arg.items() } else: sampled_inputs[key] = model_dict[id(arg)] _jit_dist_cache[_cache_key] = fn(**sampled_inputs) sample = _jit_dist_cache[_cache_key][label] if getattr(node, "trace", None): numpyro.deterministic(node.name, sample.magnitude) model_dict[id(node)] = sample.to(node.units) # compute unit scaling elif isinstance(node, bellini.distributions.UnitChangedDistribution): name = node.name dist = node.distribution _lax_eval_node(dist, model_dict, _jit_dist_cache, id_to_node, obs) sample = (model_dict[id(dist)] * dist.scaling_factor).magnitude if getattr(node, "trace", None): numpyro.deterministic(node.name, sample) model_dict[id(node)] = bellini.quantity.Quantity( sample, node.units, ) node_id = id(node) #print(node) is_quant = isinstance(node, bellini.quantity.Quantity) if is_quant: # filter out Quantities first to prevent tracer issues #print(type(node)) model_dict[node_id] = node.jnp() else: already_evaled = (node_id in model_dict.keys()) if already_evaled: pass else: eval_unvisited_node(node, model_dict, _jit_dist_cache, id_to_node, obs) #print(model_dict[node_id]) return model_dict[node_id] def _compile(out_node): """ Compile an unobserved node's computation graph """ assert not getattr(out_node, "observed", False), ("no way of observing" " this node using _compile") with bellini.inference(): model_dict = {} # serves as model trace as well as DP lookup table _jit_dist_cache = {} # serves as _jit_dist output cache return _lax_eval_node(out_node, model_dict, _jit_dist_cache, obs=None) def graphs_to_numpyro_model(graph_list): """ Convert a belief graph to a `numpyro` model. The current design involves removing units from parameters, sampling from a numpyro distribution to get a dimensionless quantity, then reapplying units when the sample is being tracked in model_dict. This is because numpyro uses unitless quantities when computing log probs, which leads to dimensionality errors if there are mixed unitless / unit quantities. note: doesn't actually use the explicit nx graph, instead uses implicit param graph? need to think about design """ import networkx as nx G = nx.compose_all(graph_list) observed_nodes = [node for node in G.nodes if getattr(node, "observed", None)] def model(obs = None): with bellini.inference(): model_dict = {} # serves as model trace as well as DP lookup table _jit_dist_cache = {} # serves as _jit_dist output cache for node in observed_nodes: _eval_node(node, model_dict, _jit_dist_cache, obs) return model_dict return model
38.470732
117
0.547201
1,693
15,773
4.868281
0.129947
0.068794
0.040767
0.038826
0.780878
0.766076
0.755157
0.737928
0.71621
0.676899
0
0.001966
0.35491
15,773
409
118
38.564792
0.808059
0.137767
0
0.661074
0
0
0.022588
0
0
0
0
0
0.010067
1
0.030201
false
0.006711
0.030201
0.003356
0.09396
0.003356
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
5888563e5e5f6713e4780f1548d67720bce436d4
138
py
Python
dojo/templatetags/as_json.py
mtcolman/django-DefectDojo
76175aca446e077884bdb5e1d8e2a671a0840775
[ "BSD-3-Clause" ]
1,772
2018-01-22T23:32:15.000Z
2022-03-31T14:49:33.000Z
dojo/templatetags/as_json.py
mtcolman/django-DefectDojo
76175aca446e077884bdb5e1d8e2a671a0840775
[ "BSD-3-Clause" ]
3,461
2018-01-20T19:12:28.000Z
2022-03-31T17:14:39.000Z
dojo/templatetags/as_json.py
mtcolman/django-DefectDojo
76175aca446e077884bdb5e1d8e2a671a0840775
[ "BSD-3-Clause" ]
1,173
2018-01-23T07:10:23.000Z
2022-03-31T14:40:43.000Z
import json from django import template register = template.Library() @register.filter def as_json(value): return json.dumps(value)
15.333333
29
0.768116
19
138
5.526316
0.684211
0
0
0
0
0
0
0
0
0
0
0
0.144928
138
8
30
17.25
0.889831
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0.166667
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
1
1
0
0
5
5891a8ae8362cd04214d9fd8628fb6ce992e830f
49
py
Python
claims_to_quality/analyzer/models/measures/__init__.py
CMSgov/qpp-claims-to-quality-public
1e2da9494faf9e316a17cbe899284db9e61d0902
[ "CC0-1.0" ]
13
2018-09-28T14:02:59.000Z
2021-12-07T21:31:54.000Z
claims_to_quality/analyzer/models/measures/__init__.py
CMSgov/qpp-claims-to-quality-public
1e2da9494faf9e316a17cbe899284db9e61d0902
[ "CC0-1.0" ]
1
2018-10-01T17:49:05.000Z
2018-10-09T01:10:56.000Z
claims_to_quality/analyzer/models/measures/__init__.py
CMSgov/qpp-claims-to-quality-public
1e2da9494faf9e316a17cbe899284db9e61d0902
[ "CC0-1.0" ]
1
2021-02-08T18:32:16.000Z
2021-02-08T18:32:16.000Z
"""Methods and classes related to QPP models."""
24.5
48
0.714286
7
49
5
1
0
0
0
0
0
0
0
0
0
0
0
0.142857
49
1
49
49
0.833333
0.857143
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
589a933d0398fca14a9fd11e832c56bcdf8d92c7
3,567
py
Python
carball/analysis/constants/field_constants.py
jawnv6/carball
9319479e593ebc533a6b05bde7afaec60f805298
[ "Apache-2.0" ]
null
null
null
carball/analysis/constants/field_constants.py
jawnv6/carball
9319479e593ebc533a6b05bde7afaec60f805298
[ "Apache-2.0" ]
null
null
null
carball/analysis/constants/field_constants.py
jawnv6/carball
9319479e593ebc533a6b05bde7afaec60f805298
[ "Apache-2.0" ]
null
null
null
from enum import Enum import pandas as pd import numpy as np from ..simulator.map_constants import MAP_Y class FieldType(Enum): STANDARD = 1 STANDARD_FIELD_LENGTH_HALF = 5120 STANDARD_FIELD_WIDTH_HALF = 4096 STANDARD_GOAL_WIDTH_HALF = 893 HEIGHT_0_BALL_LIM = 95 # Height of car when on ground HEIGHT_0_LIM = 20 # Height of car when on ground HEIGHT_1_LIM = 840 # Goal height MAP_THIRD = MAP_Y / 6 NEUTRAL_ZONE = MAP_Y / 20 class FieldConstants: field_type = FieldType.STANDARD corner = np.array([STANDARD_FIELD_WIDTH_HALF - STANDARD_GOAL_WIDTH_HALF, STANDARD_FIELD_LENGTH_HALF - STANDARD_GOAL_WIDTH_HALF]) near_wall = np.array([STANDARD_FIELD_WIDTH_HALF - STANDARD_GOAL_WIDTH_HALF / 2, STANDARD_FIELD_LENGTH_HALF - STANDARD_GOAL_WIDTH_HALF / 2]) rectangle_lower = np.array(-near_wall) rectangle_higher = np.array(near_wall) def __init__(self, field_type=FieldType.STANDARD): self.field_type = field_type """ All functions here assume the car is on the blue team and the game is played on a standard map. return: Boolean series that can be used to index the original data_frame to sum deltas with. """ def get_neutral_zone(self, player_data_frame, **kwargs): return self.abs(player_data_frame.pos_y) < NEUTRAL_ZONE def get_half_0(self, player_data_frame, **kwargs): return player_data_frame.pos_y < 0 def get_half_1(self, player_data_frame, **kwargs): return player_data_frame.pos_y > 0 def get_third_0(self, player_data_frame, **kwargs): return player_data_frame.pos_y < -MAP_THIRD def get_third_1(self, player_data_frame, **kwargs): return (-MAP_THIRD < player_data_frame.pos_y) & (player_data_frame.pos_y < MAP_THIRD) def get_third_2(self, player_data_frame, **kwargs): return player_data_frame.pos_y > MAP_THIRD def get_height_0(self, player_data_frame, **kwargs): return player_data_frame.pos_z < HEIGHT_0_LIM def get_height_0_ball(self, player_data_frame, **kwargs): return player_data_frame.pos_z < HEIGHT_0_BALL_LIM def get_height_1(self, player_data_frame, **kwargs): return (HEIGHT_0_LIM < player_data_frame.pos_z) & (player_data_frame.pos_z < HEIGHT_1_LIM) def get_height_2(self, player_data_frame, **kwargs): return player_data_frame.pos_z > HEIGHT_1_LIM def get_ball_0(self, player_data_frame, ball_data_frame): """Ball is closer to goal 0 than player""" return player_data_frame.pos_y < ball_data_frame.pos_y def get_ball_1(self, player_data_frame, ball_data_frame): """Ball is closer to goal 1 than player""" return player_data_frame.pos_y > ball_data_frame.pos_y def get_wall_time(self, player_data_frame, **kwargs): return ~((self.rectangle_lower[0] <= player_data_frame.pos_x) & (player_data_frame.pos_x <= self.rectangle_higher[0]) & (self.rectangle_lower[1] <= player_data_frame.pos_y) & (player_data_frame.pos_y <= self.rectangle_higher[1])) def get_corner_time(self, player_data_frame, **kwargs): return (((player_data_frame.pos_x >= self.corner[0]) | (player_data_frame.pos_x <= -self.corner[0])) & ((player_data_frame.pos_y >= self.corner[1]) | (player_data_frame.pos_y <= - self.corner[1]))) def abs(self, value): if value is pd.DataFrame: return value.abs() else: return abs(value)
36.030303
99
0.695262
539
3,567
4.205937
0.174397
0.16277
0.2382
0.17468
0.621085
0.603441
0.581385
0.492722
0.435377
0.435377
0
0.019692
0.216989
3,567
98
100
36.397959
0.79198
0.04037
0
0
0
0
0
0
0
0
0
0
0
1
0.253968
false
0
0.063492
0.190476
0.698413
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
58a35f2c7f6e6d65c826a0ae77eb7cb1abd39337
72
py
Python
biothings-hub/files/nde-hub/hub/dataload/sources/immport/__init__.py
NIAID-Data-Ecosystem/nde-crawlers
c0aff7dc1625ece1e67d03ad56555da7dbdc4a11
[ "Apache-2.0" ]
null
null
null
biothings-hub/files/nde-hub/hub/dataload/sources/immport/__init__.py
NIAID-Data-Ecosystem/nde-crawlers
c0aff7dc1625ece1e67d03ad56555da7dbdc4a11
[ "Apache-2.0" ]
null
null
null
biothings-hub/files/nde-hub/hub/dataload/sources/immport/__init__.py
NIAID-Data-Ecosystem/nde-crawlers
c0aff7dc1625ece1e67d03ad56555da7dbdc4a11
[ "Apache-2.0" ]
null
null
null
from .dumper import ImmPortDumper from .uploader import ImmPortUploader
24
37
0.861111
8
72
7.75
0.75
0
0
0
0
0
0
0
0
0
0
0
0.111111
72
2
38
36
0.96875
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
5431a647e89d49bfacfb8c587f11ade917cdc8d2
9,854
py
Python
pyVali/__init__.py
gpsbird/pyVali
b71b62b5e85aadd824c6fd2c6f5ce06c73821170
[ "MIT" ]
4
2019-09-25T10:48:02.000Z
2020-04-08T14:23:41.000Z
pyVali/__init__.py
gpsbird/pyVali
b71b62b5e85aadd824c6fd2c6f5ce06c73821170
[ "MIT" ]
null
null
null
pyVali/__init__.py
gpsbird/pyVali
b71b62b5e85aadd824c6fd2c6f5ce06c73821170
[ "MIT" ]
null
null
null
#!/usr/bin/python # -*- coding: utf-8 -*- import json import re from json import JSONDecodeError class Int(object): def __init__(self, comment="", required=True, default=None, min_value=None, max_value=None, allow_zero=None, enum=None): """ :param comment: :param required:bool 是否是必须参数 :param default:int 参数的默认值 :param min_value:int :param max_value:int :param allow_zero:bool :param enum:list """ self.comment = comment self.required = required self.default = default self.min_value = min_value self.max_value = max_value self.allow_zero = allow_zero self.enum = enum def validate(self, value): if value is None: if self.required is False: value = 0 if self.default is not None: value = self.default if value is None: return "{%s} 参数不存在" % self.comment, value if type(value) in (str, float): try: value = int(value) except: pass if type(value) is not int: return "{%s} 参数类型错误" % self.comment, value if self.min_value is not None and not self.min_value <= value: return "{%s} 参数小于最小值:%s" % (self.comment, self.min_value), value if self.max_value is not None and not self.max_value >= value: return "{%s} 参数大于最大值:%s" % (self.comment, self.max_value), value if self.allow_zero is False and value == 0: return "{%s} 参数不能为0" % self.comment, value if self.enum is not None and value not in self.enum: return "{%s} 参数枚举值不合法" % self.comment, value return "", value class Float(object): def __init__(self, comment="", required=True, default=None, min_value=None, max_value=None, allow_zero=None, ): """ :param comment: str :param required: bool :param default: float :param min_value: number :param max_value:number :param allow_zero: bool """ self.comment = comment self.required = required self.default = default self.min_value = min_value self.max_value = max_value self.allow_zero = allow_zero def validate(self, value): if value is None: if self.required is False: value = 0.0 if self.default is not None: value = self.default if value is None: return "{%s} 参数不存在" % self.comment, value if type(value) in (int, str): try: value = float(value) except: pass if type(value) is not float: return "{%s} 参数类型错误" % self.comment, value if self.min_value is not None and not self.min_value <= value: return "{%s} 参数小于最小值:%s" % (self.comment, self.min_value), value if self.max_value is not None and not self.max_value >= value: return "{%s} 参数大于最大值:%s" % (self.comment, self.max_value), value if self.allow_zero is False and value == 0.0: return "{%s} 参数不能为0.0" % self.comment, value return "", value class Str(object): def __init__(self, comment="", required=True, default=None, min_length=None, max_length=None, allow_empty=None, pattern=None, enum=None, ): """ :param comment: str :param required: bool :param default: str :param min_length: int :param max_length: int :param allow_empty: bool :param pattern: str :param enum: list """ self.comment = comment self.required = required self.default = default self.min_length = min_length self.max_length = max_length self.allow_empty = allow_empty self.pattern = pattern self.enum = enum def validate(self, value): if value is None: if self.required is False: value = "" if self.default is not None: value = self.default if value is None: return "{%s} 参数不存在" % self.comment, value if type(value) is not str: return "{%s} 参数类型错误" % self.comment, value if self.min_length is not None and not self.min_length <= len(value): return "{%s} 参数长度小于最小值:%s" % (self.comment, self.min_length), value if self.max_length is not None and not self.max_length >= len(value): return "{%s} 参数长度大于最大值:%s" % (self.comment, self.max_length), value if self.allow_empty is False and len(value) == 0: return "{%s} 参数不能为空" % self.comment, value if self.pattern is not None and not re.compile(self.pattern).match(value): return "{%s} 参数不满足正则条件:%s" % (self.comment, self.pattern), value if self.enum is not None and value not in self.enum: return "{%s} 参数枚举值不合法" % self.comment, value return "", value class Dict(object): def __init__(self, struct=None, comment="", required=True, min_length=None, max_length=None, allow_empty=None, ): """ :param struct: 字典 :param comment: str :param required: bool :param min_length: int :param max_length: int :param allow_empty: bool """ self.struct = struct self.comment = comment self.required = required self.min_length = min_length self.max_length = max_length self.allow_empty = allow_empty def validate(self, value): if value is None: if self.required is False: value = {} else: return "{%s} 参数不存在" % self.comment, value if type(value) is str: try: value = json.loads(value) except JSONDecodeError: pass if type(value) is not dict: return "{%s} 参数类型错误" % self.comment, value if self.min_length is not None and not self.min_length <= len(value): return "{%s} 参数长度小于最短长度:%s" % (self.comment, self.min_length), value if self.max_length is not None and not self.max_length >= len(value): return "{%s} 参数长度大于最长长度:%s" % (self.comment, self.min_length), value if self.allow_empty is False and len(value) == 0: return "{%s} 参数不允许为空" % self.comment, value if self.struct is not None: ret = {} for sub_key, sub_struct in self.struct.items(): errMsg, sub_value = sub_struct.validate(value.get(sub_key, None)) if not errMsg: ret[sub_key] = sub_value else: return errMsg, value return "", ret return "", value class List(object): def __init__(self, struct=None, comment="", required=True, min_length=None, max_length=None, allow_empty=None, ): """ :param struct: 长度为1的列表,元素为校验实例 :param comment:str :param required: bool :param min_length:int :param max_length:int :param allow_empty:bool """ self.struct = struct self.comment = comment self.required = required self.min_length = min_length self.max_length = max_length self.allow_empty = allow_empty def validate(self, value): if value is None: if self.required is False: value = [] else: return "{%s} 参数不存在" % self.comment, value if type(value) is str: try: value = json.loads(value) except JSONDecodeError: pass if type(value) is not list: return "{%s} 参数类型错误" % self.comment, value if self.min_length is not None and not self.min_length <= len(value): return "{%s} 参数长度小于最短长度:%s" % (self.comment, self.min_length), value if self.max_length is not None and not self.max_length >= len(value): return "{%s} 参数长度大于最长长度:%s" % (self.comment, self.min_length), value if self.allow_empty is False and len(value) == 0: return "{%s} 参数不允许为空" % self.comment, value if self.struct is not None: ret = [] for sub_value in value: errMsg, sub_value = self.struct[0].validate(sub_value) if not errMsg: ret.append(sub_value) else: return errMsg, value return "", ret return "", value if __name__ == "__main__": value = { "user_id": "32495732", "score": 3.5, "telephone": "13234566513", "user_type": 3, "question_list": [{ "question_id": "asdfsdf", "question": "你好?", "answer": "我很好,你是谁?", "status": 0, }] } schema = Dict({ "user_id": Int(comment="用户id", ), "score": Float(comment="用户评分", min_value=0, max_value=5, required=False), "telephone": Str(comment="用户电话号码", min_length=11, max_length=11, pattern=r"^1[3456789]\d{9}$"), "user_type": Int(comment="用户类型", enum=[0, 1, 2, 3]), "question_list": List( struct=[Dict( {"question_id": Str(comment="问题id"), "question": Str(comment="问题"), "answer": Str(comment="回答"), "status": Int(comment="状态")}, comment="问题")], comment="问题列表", ) }) errMsg, value = schema.validate(value) if errMsg: raise Exception(errMsg) print(errMsg, '====', value)
33.746575
115
0.542622
1,190
9,854
4.370588
0.101681
0.076139
0.044415
0.048452
0.775236
0.756393
0.75024
0.75024
0.73832
0.713517
0
0.008879
0.348488
9,854
291
116
33.862543
0.801246
0.078344
0
0.644231
0
0
0.071085
0
0
0
0
0
0
1
0.048077
false
0.019231
0.014423
0
0.264423
0.004808
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
54653d2348f3b2b64ca1b6f1991d26649cb94ddd
54
py
Python
TextFileSizeChecker/__init__.py
urosjevremovic/txt-file-size-checker
a006de2fa47c53601d352ab52043b422b70c1ef7
[ "MIT" ]
1
2021-05-06T05:56:42.000Z
2021-05-06T05:56:42.000Z
TextFileSizeChecker/__init__.py
urosjevremovic/txt-file-size-checker
a006de2fa47c53601d352ab52043b422b70c1ef7
[ "MIT" ]
null
null
null
TextFileSizeChecker/__init__.py
urosjevremovic/txt-file-size-checker
a006de2fa47c53601d352ab52043b422b70c1ef7
[ "MIT" ]
null
null
null
from TextFileSizeChecker import txt_file_size_checker
27
53
0.925926
7
54
6.714286
1
0
0
0
0
0
0
0
0
0
0
0
0.074074
54
1
54
54
0.94
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
5466a8a15c5882935037615ed184315da7472ec1
44
py
Python
pykrita/glTF_editor/bu_glTF/camera/perspective/__init__.py
akirfin/krita_python_fun
74173d140b39f7f80f43f9474381e4adfa3b5f01
[ "MIT" ]
1
2021-10-01T00:25:43.000Z
2021-10-01T00:25:43.000Z
pykrita/glTF_editor/bu_glTF/camera/perspective/__init__.py
akirfin/krita_python_fun
74173d140b39f7f80f43f9474381e4adfa3b5f01
[ "MIT" ]
null
null
null
pykrita/glTF_editor/bu_glTF/camera/perspective/__init__.py
akirfin/krita_python_fun
74173d140b39f7f80f43f9474381e4adfa3b5f01
[ "MIT" ]
null
null
null
class Perspective(object): """ """
8.8
26
0.5
3
44
7.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.295455
44
4
27
11
0.709677
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
5
546ec9802ed7476445452d29c829e886733e9f36
198
py
Python
src/cars/admin.py
roberthevesi/coolproject
b492b66e340261565ec9723e3db64fddbf38d716
[ "MIT" ]
null
null
null
src/cars/admin.py
roberthevesi/coolproject
b492b66e340261565ec9723e3db64fddbf38d716
[ "MIT" ]
null
null
null
src/cars/admin.py
roberthevesi/coolproject
b492b66e340261565ec9723e3db64fddbf38d716
[ "MIT" ]
null
null
null
from django.contrib import admin # Register your models here. from cars.models import Car, Person class CarAdmin(admin.ModelAdmin): pass admin.site.register(Car) admin.site.register(Person)
16.5
35
0.777778
28
198
5.5
0.607143
0.116883
0.220779
0
0
0
0
0
0
0
0
0
0.136364
198
12
36
16.5
0.900585
0.131313
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.166667
0.333333
0
0.5
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
0
0
0
5
5483c8b68e884c91870f959e1ae25ec666e597df
127
py
Python
python/python5/python5b.py
DaBear57/borak
4932b1d243df1063e091d74332eaa65c5c6d1d4e
[ "MIT" ]
null
null
null
python/python5/python5b.py
DaBear57/borak
4932b1d243df1063e091d74332eaa65c5c6d1d4e
[ "MIT" ]
null
null
null
python/python5/python5b.py
DaBear57/borak
4932b1d243df1063e091d74332eaa65c5c6d1d4e
[ "MIT" ]
null
null
null
import math pi = 0 i = 0 while abs(pi * 4 - math.pi) >= 0.00001: pi += (i % 2 * -2 + 1) / (i * 2 + 1); i += 1 print(i)
15.875
41
0.433071
26
127
2.115385
0.461538
0.218182
0.254545
0
0
0
0
0
0
0
0
0.178571
0.338583
127
8
42
15.875
0.47619
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
0.142857
1
0
0
null
1
1
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
5
5495efa8e8f47461dd059fbb37a0c773baa4b46e
329
py
Python
app/views/main/__init__.py
BMeu/Aerarium
119946cead727ef68b5ecea339990d982c006391
[ "MIT" ]
null
null
null
app/views/main/__init__.py
BMeu/Aerarium
119946cead727ef68b5ecea339990d982c006391
[ "MIT" ]
139
2018-12-26T07:54:31.000Z
2021-06-01T23:14:45.000Z
app/views/main/__init__.py
BMeu/Aerarium
119946cead727ef68b5ecea339990d982c006391
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ The application's main blueprint handling basic functionality such as errors. """ from flask import Blueprint bp = Blueprint('main', __name__) # noinspection PyPep8 from app.views.main import errors # noqa: E402,F401 # noinspection PyPep8 from app.views.main import routes # noqa: E402,F401
21.933333
81
0.726444
44
329
5.340909
0.613636
0.153191
0.187234
0.212766
0.340426
0.340426
0.340426
0
0
0
0
0.054745
0.167173
329
14
82
23.5
0.80292
0.522796
0
0
0
0
0.028369
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0.5
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
1
0
5
54ab570d854e20516c98e8721e1ab0801084ccb3
188
py
Python
index.py
uwanosora999/twitter_bot
d9664a91952d600231f7b33f156dee70278547db
[ "MIT" ]
null
null
null
index.py
uwanosora999/twitter_bot
d9664a91952d600231f7b33f156dee70278547db
[ "MIT" ]
2
2020-06-05T19:36:02.000Z
2021-03-31T19:03:15.000Z
index.py
uwanosora999/twitter_bot
d9664a91952d600231f7b33f156dee70278547db
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import os from bottle import route, run @route("/") def hello_world(): return "" # ここで返す内容は何でもよい run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000)))
17.090909
59
0.62766
29
188
4.034483
0.724138
0.051282
0.051282
0
0
0
0
0
0
0
0
0.056604
0.154255
188
11
59
17.090909
0.679245
0.18617
0
0
0
0
0.07947
0
0
0
0
0
0
1
0.166667
true
0
0.333333
0.166667
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
1
1
0
0
5
49f9a43bd1a4d9c9c9555b2e98ffb4217eaa838c
162
py
Python
tests/sqlite.py
karlicoss/bleanser
fb0fb8b41769086723cb5b9854ebc93012bce279
[ "MIT" ]
13
2021-01-30T05:50:38.000Z
2022-02-11T09:27:42.000Z
tests/sqlite.py
karlicoss/bleanser
fb0fb8b41769086723cb5b9854ebc93012bce279
[ "MIT" ]
null
null
null
tests/sqlite.py
karlicoss/bleanser
fb0fb8b41769086723cb5b9854ebc93012bce279
[ "MIT" ]
null
null
null
from .common import skip_if_not_karlicoss as pytestmark from pathlib import Path def test_process_bluemaestro(tmp_path: Path) -> None: raise RuntimeError
18
55
0.802469
23
162
5.391304
0.826087
0
0
0
0
0
0
0
0
0
0
0
0.154321
162
8
56
20.25
0.905109
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.5
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
5
b7017a3d41f51ed6e960c09dbffcb14b928bad6f
3,206
py
Python
WindRose.py
cmcuervol/Mojana
e5491d6af0b6d5ac1900371ece561b8bf8835f02
[ "MIT" ]
null
null
null
WindRose.py
cmcuervol/Mojana
e5491d6af0b6d5ac1900371ece561b8bf8835f02
[ "MIT" ]
null
null
null
WindRose.py
cmcuervol/Mojana
e5491d6af0b6d5ac1900371ece561b8bf8835f02
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import numpy as np import pandas as pd from windrose import WindroseAxes from matplotlib import pyplot as plt import matplotlib.cm as cm Est_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'Datos/Vientos')) Magang = pd.read_excel(os.path.join(Est_path,'Magangue - Viento.xlsx')) Marcos = pd.read_excel(os.path.join(Est_path,'San Marcos - Viento.xlsx')) Magang_D = Magang['Dirección en °'].values Magang_V = Magang['Vel (m/s)'] .values Marcos_D = Marcos['Dirección en °'].values Marcos_V = Marcos['Vel (m/s)'] .values def WRbar(Dir, Vel, name='', title='', pdf=True, png=True, PathFigs=Est_path ): """ Make wind rose in bars INPUTS Dir : array with directions in north degrees Vel : array with velocities name : string to put as name in file title : string to put as title pdf : Boolean to save figure in pdf format png : Boolean to save figure in png format PathFigs : Aboslute route to directory where figure will be save """ plt.close('all') ax = WindroseAxes.from_ax() ax.bar(Dir, Vel, normed=True, opening=0.8, edgecolor='white') ax.set_legend(loc=4) ax.set_title(title) if pdf == True: plt.savefig(os.path.join(PathFigs, name+'BarWR.pdf'), format='pdf', transparent=True) if png == True: plt.savefig(os.path.join(PathFigs, name+'BarWR.png'), transparent=True) elif png == True: plt.savefig(os.path.join(PathFigs, name+'BarWR.png'), transparent=True) else: print("Graph not saved. To save it at least one of png or pdf parameters must be True.") def WRcontourf(Dir, Vel, cmap='Spectral',name='', title='', pdf=True, png=True, PathFigs=Est_path ): """ Make wind rose in bars INPUTS Dir : array with directions in north degrees Vel : array with velocities cmap : cmap name to color map name : string to put as name in file title : string to put as title pdf : Boolean to save figure in pdf format png : Boolean to save figure in png format PathFigs : Aboslute route to directory where figure will be save """ plt.close('all') ax = WindroseAxes.from_ax() ax.contourf(Dir, Vel, bins=np.arange(0, np.nanmax(Vel), 1),cmap=plt.get_cmap(cmap)) ax.contour (Dir, Vel, bins=np.arange(0, np.nanmax(Vel), 1),colors='black') ax.set_legend(loc=4) ax.set_title(title) if pdf == True: plt.savefig(os.path.join(PathFigs, name+'contourfWR.pdf'), format='pdf', transparent=True) if png == True: plt.savefig(os.path.join(PathFigs, name+'contourfWR.png'), transparent=True) elif png == True: plt.savefig(os.path.join(PathFigs, name+'contourfWR.png'), transparent=True) else: print("Graph not saved. To save it at least one of png or pdf parameters must be True.") WRbar(Magang_D,Magang_V,name='Magangue', title=u'Magangué', ) WRbar(Marcos_D,Marcos_V,name='Marcos', title=u'San Marcos', ) WRcontourf(Magang_D,Magang_V,name='Magangue', title=u'Magangué', ) WRcontourf(Marcos_D,Marcos_V,name='Marcos', title=u'San Marcos', )
36.022472
100
0.660948
489
3,206
4.276074
0.261759
0.031564
0.043042
0.045911
0.736968
0.736968
0.736968
0.736968
0.710187
0.664754
0
0.003557
0.210855
3,206
88
101
36.431818
0.822134
0.241422
0
0.478261
0
0
0.182676
0
0
0
0
0
0
1
0.043478
false
0
0.130435
0
0.173913
0.043478
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
b73493d06226e108e9b83faa4185a728b6241ae9
212
py
Python
passenger/serializers.py
ukjaiswal/travelpoints
6f7f6425ad45ffb5df1b2476fbe3f157dd21badb
[ "BSD-3-Clause" ]
null
null
null
passenger/serializers.py
ukjaiswal/travelpoints
6f7f6425ad45ffb5df1b2476fbe3f157dd21badb
[ "BSD-3-Clause" ]
null
null
null
passenger/serializers.py
ukjaiswal/travelpoints
6f7f6425ad45ffb5df1b2476fbe3f157dd21badb
[ "BSD-3-Clause" ]
null
null
null
from rest_framework import serializers from .models import Passenger class PassengerSerialiser(serializers.ModelSerializer): class Meta: model=Passenger fields=['id', 'name', 'rewardpoints']
26.5
55
0.740566
21
212
7.428571
0.761905
0
0
0
0
0
0
0
0
0
0
0
0.174528
212
7
56
30.285714
0.891429
0
0
0
0
0
0.084906
0
0
0
0
0
0
1
0
false
0.5
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
1
1
0
1
0
0
5
3f7553e9fe1104417c2ddb1c1457b5ec930390d3
13
py
Python
src/jazzy/__init__.py
AstraZeneca/jazzy
d06a5848165d2a256b52b75c3365715da0d36c4d
[ "Apache-2.0" ]
null
null
null
src/jazzy/__init__.py
AstraZeneca/jazzy
d06a5848165d2a256b52b75c3365715da0d36c4d
[ "Apache-2.0" ]
null
null
null
src/jazzy/__init__.py
AstraZeneca/jazzy
d06a5848165d2a256b52b75c3365715da0d36c4d
[ "Apache-2.0" ]
null
null
null
"""Jazzy."""
6.5
12
0.384615
1
13
5
1
0
0
0
0
0
0
0
0
0
0
0
0.076923
13
1
13
13
0.416667
0.461538
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
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
3f759d287be0b77e024310f0ab95ef97ba368904
122
py
Python
stan/__init__.py
thebrahminator/pystan-next
b7929d3a575d7d6880ce46413765c627b034cc0b
[ "ISC" ]
null
null
null
stan/__init__.py
thebrahminator/pystan-next
b7929d3a575d7d6880ce46413765c627b034cc0b
[ "ISC" ]
null
null
null
stan/__init__.py
thebrahminator/pystan-next
b7929d3a575d7d6880ce46413765c627b034cc0b
[ "ISC" ]
null
null
null
import pbr.version from stan.model import build # noqa __version__ = pbr.version.VersionInfo("pystan").version_string()
24.4
64
0.786885
16
122
5.6875
0.6875
0.21978
0
0
0
0
0
0
0
0
0
0
0.106557
122
4
65
30.5
0.834862
0.032787
0
0
0
0
0.051724
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5