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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1de81bb477ab8ad84c3bb89808f801c13c0ca84d
| 244
|
py
|
Python
|
integration/fresnel.py
|
lemming52/white_knight
|
9932aeb4b2a2bfa4270a0cd6d39fd054242890cf
|
[
"MIT"
] | 2
|
2021-02-23T19:25:02.000Z
|
2021-02-23T19:25:48.000Z
|
integration/fresnel.py
|
lemming52/white_knight
|
9932aeb4b2a2bfa4270a0cd6d39fd054242890cf
|
[
"MIT"
] | null | null | null |
integration/fresnel.py
|
lemming52/white_knight
|
9932aeb4b2a2bfa4270a0cd6d39fd054242890cf
|
[
"MIT"
] | 1
|
2021-02-23T19:25:53.000Z
|
2021-02-23T19:25:53.000Z
|
# External Packages
import numpy as np
# Functions for evaluating the fresnel integrals.
def cos_integrand(x, coeff):
return np.cos(np.power(x, 2)*coeff)
def sin_integrand(x, coeff):
return np.sin(np.power(x, 2)*coeff)
| 18.769231
| 50
| 0.680328
| 38
| 244
| 4.315789
| 0.552632
| 0.121951
| 0.182927
| 0.256098
| 0.45122
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010363
| 0.209016
| 244
| 12
| 51
| 20.333333
| 0.839378
| 0.266393
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0.2
| 0.4
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
1dfd78dec98a9b953b72f65dd557ac359b5c468b
| 30
|
py
|
Python
|
scripts/extract_dataset.py
|
Fedioun/flair
|
5504bdc6ec4232e3321483c9611bc929c9557175
|
[
"MIT"
] | null | null | null |
scripts/extract_dataset.py
|
Fedioun/flair
|
5504bdc6ec4232e3321483c9611bc929c9557175
|
[
"MIT"
] | null | null | null |
scripts/extract_dataset.py
|
Fedioun/flair
|
5504bdc6ec4232e3321483c9611bc929c9557175
|
[
"MIT"
] | null | null | null |
def main():
main()
| 3
| 11
| 0.366667
| 3
| 30
| 3.666667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.466667
| 30
| 9
| 12
| 3.333333
| 0.6875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
3836048cadc3d13946611a6b6c35734490a2e66e
| 94
|
py
|
Python
|
python/testData/completion/hasattrCompletion/hasattrInConditionalExpression.py
|
Sajaki/intellij-community
|
6748af2c40567839d11fd652ec77ba263c074aad
|
[
"Apache-2.0"
] | 2
|
2019-04-28T07:48:50.000Z
|
2020-12-11T14:18:08.000Z
|
python/testData/completion/hasattrCompletion/hasattrInConditionalExpression.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 2
|
2022-02-19T09:45:05.000Z
|
2022-02-27T20:32:55.000Z
|
python/testData/completion/hasattrCompletion/hasattrInConditionalExpression.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 2
|
2020-03-15T08:57:37.000Z
|
2020-04-07T04:48:14.000Z
|
def foo(x):
some_var = (x.<caret> if hasattr(x, "foo") else 42) if hasattr(x, "bar") else 42
| 47
| 82
| 0.62766
| 19
| 94
| 3.052632
| 0.578947
| 0.310345
| 0.344828
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.051282
| 0.170213
| 94
| 2
| 82
| 47
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0.063158
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
6985121e4268d20ce7367271b05fed46203f93b5
| 1,096
|
py
|
Python
|
tools/plane_utils.py
|
lolrudy/GPV_pose
|
f326a623b3e45e6edfc1963b068e8e7aaea2bfff
|
[
"MIT"
] | 10
|
2022-03-16T02:14:56.000Z
|
2022-03-31T19:01:34.000Z
|
tools/plane_utils.py
|
lolrudy/GPV_pose
|
f326a623b3e45e6edfc1963b068e8e7aaea2bfff
|
[
"MIT"
] | 1
|
2022-03-18T06:43:16.000Z
|
2022-03-18T06:56:35.000Z
|
tools/plane_utils.py
|
lolrudy/GPV_pose
|
f326a623b3e45e6edfc1963b068e8e7aaea2bfff
|
[
"MIT"
] | 2
|
2022-03-19T13:06:28.000Z
|
2022-03-19T16:08:18.000Z
|
import torch
def get_plane(pc, pc_w):
# min least square
n = pc.shape[0]
A = torch.cat([pc[:, :2], torch.ones([n, 1], device=pc.device)], dim=-1)
b = pc[:, 2].view(-1, 1)
W = torch.diag(pc_w)
WA = torch.mm(W, A)
ATWA = torch.mm(A.permute(1, 0), WA)
ATWA_1 = torch.inverse(ATWA)
Wb = torch.mm(W, b)
ATWb = torch.mm(A.permute(1, 0), Wb)
X = torch.mm(ATWA_1, ATWb)
# return dn
dn_up = torch.cat([X[0] * X[2], X[1] * X[2], -X[2]], dim=0),
dn_norm = X[0] * X[0] + X[1] * X[1] + 1.0
dn = dn_up[0] / dn_norm
normal_n = dn / torch.norm(dn)
for_p2plane = X[2] / torch.sqrt(dn_norm)
return normal_n, dn, for_p2plane
def get_plane_parameter(pc, pc_w):
# min least square
n = pc.shape[0]
A = torch.cat([pc[:, :2], torch.ones([n, 1], device=pc.device)], dim=-1)
b = pc[:, 2].view(-1, 1)
W = torch.diag(pc_w)
WA = torch.mm(W, A)
ATWA = torch.mm(A.permute(1, 0), WA)
ATWA_1 = torch.inverse(ATWA)
Wb = torch.mm(W, b)
ATWb = torch.mm(A.permute(1, 0), Wb)
X = torch.mm(ATWA_1, ATWb)
return X
| 30.444444
| 76
| 0.547445
| 211
| 1,096
| 2.748815
| 0.189573
| 0.12069
| 0.055172
| 0.103448
| 0.703448
| 0.703448
| 0.703448
| 0.703448
| 0.703448
| 0.703448
| 0
| 0.050909
| 0.247263
| 1,096
| 36
| 77
| 30.444444
| 0.652121
| 0.039234
| 0
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.066667
| false
| 0
| 0.033333
| 0
| 0.166667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
698898b86818fab584b81963d400deef9b7fa972
| 76
|
py
|
Python
|
bandit/backends/__init__.py
|
russelljk/django-email-bandit
|
d7f319afb7ee1f663cb93c0f13b3a6c9b3ce6077
|
[
"BSD-3-Clause"
] | null | null | null |
bandit/backends/__init__.py
|
russelljk/django-email-bandit
|
d7f319afb7ee1f663cb93c0f13b3a6c9b3ce6077
|
[
"BSD-3-Clause"
] | null | null | null |
bandit/backends/__init__.py
|
russelljk/django-email-bandit
|
d7f319afb7ee1f663cb93c0f13b3a6c9b3ce6077
|
[
"BSD-3-Clause"
] | null | null | null |
from bandit.backends.smtp import HijackSMTPBackend as HijackBackend # noqa
| 38
| 75
| 0.842105
| 9
| 76
| 7.111111
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.118421
| 76
| 1
| 76
| 76
| 0.955224
| 0.052632
| 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
|
698f1212ea06d52e65226b59e55178e3802e4570
| 77
|
py
|
Python
|
PythonMusic/__init__.py
|
Andereoo/PythonMusic
|
85f33267898c75ae8da5e1ae15cc17f03cdb1896
|
[
"MIT"
] | null | null | null |
PythonMusic/__init__.py
|
Andereoo/PythonMusic
|
85f33267898c75ae8da5e1ae15cc17f03cdb1896
|
[
"MIT"
] | null | null | null |
PythonMusic/__init__.py
|
Andereoo/PythonMusic
|
85f33267898c75ae8da5e1ae15cc17f03cdb1896
|
[
"MIT"
] | null | null | null |
from PythonMusic.__main__ import custom_sound, wait, note, PythonMusic_help
| 38.5
| 76
| 0.844156
| 10
| 77
| 5.9
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103896
| 77
| 1
| 77
| 77
| 0.855072
| 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
|
69ea19602ba77cfc14fce77372bf9054c051b673
| 29,121
|
py
|
Python
|
tests/st/numpy_native/test_array_creations.py
|
kungfu-team/mindspore-bert
|
71501cf52ae01db9d6a73fb64bcfe68a6509dc32
|
[
"Apache-2.0"
] | null | null | null |
tests/st/numpy_native/test_array_creations.py
|
kungfu-team/mindspore-bert
|
71501cf52ae01db9d6a73fb64bcfe68a6509dc32
|
[
"Apache-2.0"
] | null | null | null |
tests/st/numpy_native/test_array_creations.py
|
kungfu-team/mindspore-bert
|
71501cf52ae01db9d6a73fb64bcfe68a6509dc32
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""unit tests for numpy array operations"""
import pytest
import numpy as onp
import mindspore.numpy as mnp
from .utils import rand_int, rand_bool, match_array, match_res, match_meta, \
match_all_arrays, run_multi_test, to_tensor
class Cases():
def __init__(self):
self.all_shapes = [
1, 2, (1,), (2,), (1, 2, 3), [1], [2], [1, 2, 3]
]
self.onp_dtypes = [onp.int32, 'int32', int,
onp.float32, 'float32', float,
onp.uint32, 'uint32',
onp.bool_, 'bool', bool]
self.mnp_dtypes = [mnp.int32, 'int32', int,
mnp.float32, 'float32', float,
mnp.uint32, 'uint32',
mnp.bool_, 'bool', bool]
self.array_sets = [1, 1.1, True, [1, 0, True], [1, 1.0, 2], (1,),
[(1, 2, 3), (4, 5, 6)], onp.random.random( # pylint: disable=no-member
(100, 100)).astype(onp.float32).tolist(),
onp.random.random((100, 100)).astype(onp.bool).tolist()]
self.arrs = [
rand_int(2),
rand_int(2, 3),
rand_int(2, 3, 4),
rand_int(2, 3, 4, 5),
]
# scalars expanded across the 0th dimension
self.scalars = [
rand_int(),
rand_int(1),
rand_int(1, 1),
rand_int(1, 1, 1),
]
# arrays of the same size expanded across the 0th dimension
self.expanded_arrs = [
rand_int(2, 3),
rand_int(1, 2, 3),
rand_int(1, 1, 2, 3),
rand_int(1, 1, 1, 2, 3),
]
# arrays with dimensions of size 1
self.nested_arrs = [
rand_int(1),
rand_int(1, 2),
rand_int(3, 1, 8),
rand_int(1, 3, 9, 1),
]
# arrays which can be broadcast
self.broadcastables = [
rand_int(5),
rand_int(6, 1),
rand_int(7, 1, 5),
rand_int(8, 1, 6, 1)
]
# boolean arrays which can be broadcast
self.bool_broadcastables = [
rand_bool(),
rand_bool(1),
rand_bool(5),
rand_bool(6, 1),
rand_bool(7, 1, 5),
rand_bool(8, 1, 6, 1),
]
self.mnp_prototypes = [
mnp.ones((2, 3, 4)),
mnp.ones((1, 3, 1, 2, 5)),
mnp.ones((2, 7, 1)),
[mnp.ones(3), (1, 2, 3), mnp.ones(3), [4, 5, 6]],
([(1, 2), mnp.ones(2)], (mnp.ones(2), [3, 4])),
]
self.onp_prototypes = [
onp.ones((2, 3, 4)),
onp.ones((1, 3, 1, 2, 5)),
onp.ones((2, 7, 1)),
[onp.ones(3), (1, 2, 3), onp.ones(3), [4, 5, 6]],
([(1, 2), onp.ones(2)], (onp.ones(2), [3, 4])),
]
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_asarray():
test_case = Cases()
for array in test_case.array_sets:
# Check for dtype matching
actual = onp.asarray(array)
expected = mnp.asarray(array).asnumpy()
# Since we set float32/int32 as the default dtype in mindspore, we need
# to make a conversion between numpy.asarray and mindspore.numpy.asarray
if actual.dtype is onp.dtype('float64'):
assert expected.dtype == onp.dtype('float32')
elif actual.dtype is onp.dtype('int64'):
assert expected.dtype == onp.dtype('int32')
else:
assert actual.dtype == expected.dtype
match_array(actual, expected, error=7)
for i in range(len(test_case.onp_dtypes)):
actual = onp.asarray(array, test_case.onp_dtypes[i])
expected = mnp.asarray(array, test_case.mnp_dtypes[i]).asnumpy()
match_array(actual, expected, error=7)
# Additional tests for nested tensor mixture
mnp_input = [(mnp.ones(3,), mnp.ones(3)), [[1, 1, 1], (1, 1, 1)]]
onp_input = [(onp.ones(3,), onp.ones(3)), [[1, 1, 1], (1, 1, 1)]]
actual = onp.asarray(onp_input)
expected = mnp.asarray(mnp_input).asnumpy()
match_array(actual, expected, error=7)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_array():
# array's function is very similar to asarray, so we mainly test the
# `copy` argument.
test_case = Cases()
for array in test_case.array_sets:
arr1 = mnp.asarray(array)
arr2 = mnp.array(arr1, copy=False)
arr3 = mnp.array(arr1)
arr4 = mnp.asarray(array, dtype='int32')
arr5 = mnp.asarray(arr4, dtype=mnp.int32)
assert arr1 is arr2
assert arr1 is not arr3
assert arr4 is arr5
# Additional tests for nested tensor/numpy_array mixture
mnp_input = [(mnp.ones(3,), mnp.ones(3)), [[1, 1, 1], (1, 1, 1)]]
onp_input = [(onp.ones(3,), onp.ones(3)), [[1, 1, 1], (1, 1, 1)]]
actual = onp.array(onp_input)
expected = mnp.array(mnp_input).asnumpy()
match_array(actual, expected, error=7)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_asfarray():
test_case = Cases()
for array in test_case.array_sets:
# Check for dtype matching
actual = onp.asfarray(array)
expected = mnp.asfarray(array).asnumpy()
# Since we set float32/int32 as the default dtype in mindspore, we need
# to make a conversion between numpy.asarray and mindspore.numpy.asarray
if actual.dtype is onp.dtype('float64'):
assert expected.dtype == onp.dtype('float32')
else:
assert actual.dtype == expected.dtype
match_array(actual, expected, error=7)
for i in range(len(test_case.onp_dtypes)):
actual = onp.asfarray(array, test_case.onp_dtypes[i])
expected = mnp.asfarray(array, test_case.mnp_dtypes[i]).asnumpy()
match_array(actual, expected, error=7)
# Additional tests for nested tensor/numpy_array mixture
mnp_input = [(mnp.ones(3,), mnp.ones(3)), [[1, 1, 1], (1, 1, 1)]]
onp_input = [(onp.ones(3,), onp.ones(3)), [[1, 1, 1], (1, 1, 1)]]
actual = onp.asfarray(onp_input)
expected = mnp.asfarray(mnp_input).asnumpy()
match_array(actual, expected, error=7)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_zeros():
test_case = Cases()
for shape in test_case.all_shapes:
for i in range(len(test_case.onp_dtypes)):
actual = onp.zeros(shape, test_case.onp_dtypes[i])
expected = mnp.zeros(shape, test_case.mnp_dtypes[i]).asnumpy()
match_array(actual, expected)
actual = onp.zeros(shape)
expected = mnp.zeros(shape).asnumpy()
match_array(actual, expected)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_ones():
test_case = Cases()
for shape in test_case.all_shapes:
for i in range(len(test_case.onp_dtypes)):
actual = onp.ones(shape, test_case.onp_dtypes[i])
expected = mnp.ones(shape, test_case.mnp_dtypes[i]).asnumpy()
match_array(actual, expected)
actual = onp.ones(shape)
expected = mnp.ones(shape).asnumpy()
match_array(actual, expected)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_full():
actual = onp.full((2, 2), [1, 2])
expected = mnp.full((2, 2), [1, 2]).asnumpy()
match_array(actual, expected)
actual = onp.full((2, 3), True)
expected = mnp.full((2, 3), True).asnumpy()
match_array(actual, expected)
actual = onp.full((3, 4, 5), 7.5)
expected = mnp.full((3, 4, 5), 7.5).asnumpy()
match_array(actual, expected)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_eye():
test_case = Cases()
for i in range(len(test_case.onp_dtypes)):
for m in range(1, 5):
actual = onp.eye(m, dtype=test_case.onp_dtypes[i])
expected = mnp.eye(m, dtype=test_case.mnp_dtypes[i]).asnumpy()
match_array(actual, expected)
for n in range(1, 5):
for k in range(0, 5):
actual = onp.eye(m, n, k, dtype=test_case.onp_dtypes[i])
expected = mnp.eye(
m, n, k, dtype=test_case.mnp_dtypes[i]).asnumpy()
match_array(actual, expected)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_identity():
test_case = Cases()
for i in range(len(test_case.onp_dtypes)):
for m in range(1, 5):
actual = onp.identity(m, dtype=test_case.onp_dtypes[i])
expected = mnp.identity(m, dtype=test_case.mnp_dtypes[i]).asnumpy()
match_array(actual, expected)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_arange():
actual = onp.arange(10)
expected = mnp.arange(10).asnumpy()
match_array(actual, expected)
actual = onp.arange(0, 10)
expected = mnp.arange(0, 10).asnumpy()
match_array(actual, expected)
actual = onp.arange(start=10)
expected = mnp.arange(start=10).asnumpy()
match_array(actual, expected)
actual = onp.arange(start=10, step=0.1)
expected = mnp.arange(start=10, step=0.1).asnumpy()
match_array(actual, expected, error=6)
actual = onp.arange(10, step=0.1)
expected = mnp.arange(10, step=0.1).asnumpy()
match_array(actual, expected, error=6)
actual = onp.arange(0.1, 9.9)
expected = mnp.arange(0.1, 9.9).asnumpy()
match_array(actual, expected, error=6)
@pytest.mark.level0
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_linspace():
actual = onp.linspace(2.0, 3.0, dtype=onp.float32)
expected = mnp.linspace(2.0, 3.0).asnumpy()
match_array(actual, expected, error=6)
actual = onp.linspace(2.0, 3.0, num=5, dtype=onp.float32)
expected = mnp.linspace(2.0, 3.0, num=5).asnumpy()
match_array(actual, expected, error=6)
actual = onp.linspace(
2.0, 3.0, num=5, endpoint=False, dtype=onp.float32)
expected = mnp.linspace(2.0, 3.0, num=5, endpoint=False).asnumpy()
match_array(actual, expected, error=6)
actual = onp.linspace(2.0, 3.0, num=5, retstep=True, dtype=onp.float32)
expected = mnp.linspace(2.0, 3.0, num=5, retstep=True)
match_array(actual[0], expected[0].asnumpy())
assert actual[1] == expected[1].asnumpy()
actual = onp.linspace(2.0, [3, 4, 5], num=5,
endpoint=False, dtype=onp.float32)
expected = mnp.linspace(
2.0, [3, 4, 5], num=5, endpoint=False).asnumpy()
match_array(actual, expected, error=6)
actual = onp.linspace(2.0, [[3, 4, 5]], num=5, endpoint=False, axis=2)
expected = mnp.linspace(2.0, [[3, 4, 5]], num=5, endpoint=False, axis=2).asnumpy()
match_array(actual, expected, error=6)
start = onp.random.random([2, 1, 4]).astype("float32")
stop = onp.random.random([1, 5, 1]).astype("float32")
actual = onp.linspace(start, stop, num=20, retstep=True,
endpoint=False, dtype=onp.float32)
expected = mnp.linspace(to_tensor(start), to_tensor(stop), num=20,
retstep=True, endpoint=False)
match_array(actual[0], expected[0].asnumpy(), error=6)
match_array(actual[1], expected[1].asnumpy(), error=6)
actual = onp.linspace(start, stop, num=20, retstep=True,
endpoint=False, dtype=onp.int16)
expected = mnp.linspace(to_tensor(start), to_tensor(stop), num=20,
retstep=True, endpoint=False, dtype=mnp.int16)
match_array(actual[0], expected[0].asnumpy(), error=6)
match_array(actual[1], expected[1].asnumpy(), error=6)
for axis in range(2):
actual = onp.linspace(start, stop, num=20, retstep=False,
endpoint=False, dtype=onp.float32, axis=axis)
expected = mnp.linspace(to_tensor(start), to_tensor(stop), num=20,
retstep=False, endpoint=False, dtype=mnp.float32, axis=axis)
match_array(actual, expected.asnumpy(), error=6)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_logspace():
actual = onp.logspace(2.0, 3.0, dtype=onp.float32)
expected = mnp.logspace(2.0, 3.0).asnumpy()
match_array(actual, expected, error=3)
actual = onp.logspace(2.0, 3.0, num=5, dtype=onp.float32)
expected = mnp.logspace(2.0, 3.0, num=5).asnumpy()
match_array(actual, expected, error=3)
actual = onp.logspace(
2.0, 3.0, num=5, endpoint=False, dtype=onp.float32)
expected = mnp.logspace(2.0, 3.0, num=5, endpoint=False).asnumpy()
match_array(actual, expected, error=3)
actual = onp.logspace(2.0, [3, 4, 5], num=5, base=2,
endpoint=False, dtype=onp.float32)
expected = mnp.logspace(
2.0, [3, 4, 5], num=5, base=2, endpoint=False).asnumpy()
match_array(actual, expected, error=3)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_empty():
test_case = Cases()
for shape in test_case.all_shapes:
for mnp_dtype, onp_dtype in zip(test_case.mnp_dtypes,
test_case.onp_dtypes):
actual = mnp.empty(shape, mnp_dtype).asnumpy()
expected = onp.empty(shape, onp_dtype)
match_meta(actual, expected)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_empty_like():
test_case = Cases()
for mnp_proto, onp_proto in zip(test_case.mnp_prototypes, test_case.onp_prototypes):
actual = mnp.empty_like(mnp_proto).asnumpy()
expected = onp.empty_like(onp_proto)
assert actual.shape == expected.shape
for mnp_dtype, onp_dtype in zip(test_case.mnp_dtypes,
test_case.onp_dtypes):
actual = mnp.empty_like(mnp_proto, dtype=mnp_dtype).asnumpy()
expected = onp.empty_like(onp_proto, dtype=onp_dtype)
match_meta(actual, expected)
def run_x_like(mnp_fn, onp_fn):
test_case = Cases()
for mnp_proto, onp_proto in zip(test_case.mnp_prototypes, test_case.onp_prototypes):
actual = mnp_fn(mnp_proto).asnumpy()
expected = onp_fn(onp_proto)
match_array(actual, expected)
for shape in test_case.all_shapes:
actual = mnp_fn(mnp_proto, shape=shape).asnumpy()
expected = onp_fn(onp_proto, shape=shape)
match_array(actual, expected)
for mnp_dtype, onp_dtype in zip(test_case.mnp_dtypes,
test_case.onp_dtypes):
actual = mnp_fn(mnp_proto, dtype=mnp_dtype).asnumpy()
expected = onp_fn(onp_proto, dtype=onp_dtype)
match_array(actual, expected)
actual = mnp_fn(mnp_proto, dtype=mnp_dtype,
shape=shape).asnumpy()
expected = onp_fn(onp_proto, dtype=onp_dtype, shape=shape)
match_array(actual, expected)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_ones_like():
run_x_like(mnp.ones_like, onp.ones_like)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_zeros_like():
run_x_like(mnp.zeros_like, onp.zeros_like)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_full_like():
test_case = Cases()
for mnp_proto, onp_proto in zip(test_case.mnp_prototypes, test_case.onp_prototypes):
shape = onp.zeros_like(onp_proto).shape
fill_value = rand_int()
actual = mnp.full_like(mnp_proto, to_tensor(fill_value)).asnumpy()
expected = onp.full_like(onp_proto, fill_value)
match_array(actual, expected)
for i in range(len(shape) - 1, 0, -1):
fill_value = rand_int(*shape[i:])
actual = mnp.full_like(mnp_proto, to_tensor(fill_value)).asnumpy()
expected = onp.full_like(onp_proto, fill_value)
match_array(actual, expected)
fill_value = rand_int(1, *shape[i + 1:])
actual = mnp.full_like(mnp_proto, to_tensor(fill_value)).asnumpy()
expected = onp.full_like(onp_proto, fill_value)
match_array(actual, expected)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_tri_triu_tril():
x = mnp.ones((16, 32), dtype="bool")
match_array(mnp.tril(x).asnumpy(), onp.tril(x.asnumpy()))
match_array(mnp.tril(x, -1).asnumpy(), onp.tril(x.asnumpy(), -1))
match_array(mnp.triu(x).asnumpy(), onp.triu(x.asnumpy()))
match_array(mnp.triu(x, -1).asnumpy(), onp.triu(x.asnumpy(), -1))
x = mnp.ones((64, 64), dtype="uint8")
match_array(mnp.tril(x).asnumpy(), onp.tril(x.asnumpy()))
match_array(mnp.tril(x, 25).asnumpy(), onp.tril(x.asnumpy(), 25))
match_array(mnp.triu(x).asnumpy(), onp.triu(x.asnumpy()))
match_array(mnp.triu(x, 25).asnumpy(), onp.triu(x.asnumpy(), 25))
match_array(mnp.tri(64, 64).asnumpy(), onp.tri(64, 64))
match_array(mnp.tri(64, 64, -10).asnumpy(), onp.tri(64, 64, -10))
@pytest.mark.level1
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_nancumsum():
x = rand_int(2, 3, 4, 5)
x[0][2][1][3] = onp.nan
x[1][0][2][4] = onp.nan
x[1][1][1][1] = onp.nan
match_res(mnp.nancumsum, onp.nancumsum, x)
match_res(mnp.nancumsum, onp.nancumsum, x, axis=-2)
match_res(mnp.nancumsum, onp.nancumsum, x, axis=0)
match_res(mnp.nancumsum, onp.nancumsum, x, axis=3)
def mnp_diagonal(arr):
return mnp.diagonal(arr, offset=2, axis1=-1, axis2=0)
def onp_diagonal(arr):
return onp.diagonal(arr, offset=2, axis1=-1, axis2=0)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_diagonal():
arr = rand_int(3, 5)
for i in [-1, 0, 2]:
match_res(mnp.diagonal, onp.diagonal, arr, offset=i, axis1=0, axis2=1)
match_res(mnp.diagonal, onp.diagonal, arr, offset=i, axis1=1, axis2=0)
arr = rand_int(7, 4, 9)
for i in [-1, 0, 2]:
match_res(mnp.diagonal, onp.diagonal, arr, offset=i, axis1=0, axis2=-1)
match_res(mnp.diagonal, onp.diagonal, arr, offset=i, axis1=-2, axis2=2)
match_res(mnp.diagonal, onp.diagonal, arr,
offset=i, axis1=-1, axis2=-2)
def mnp_trace(arr):
return mnp.trace(arr, offset=4, axis1=1, axis2=2)
def onp_trace(arr):
return onp.trace(arr, offset=4, axis1=1, axis2=2)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_trace():
arr = rand_int(3, 5)
for i in [-1, 0]:
match_res(mnp.trace, onp.trace, arr, offset=i, axis1=0, axis2=1)
match_res(mnp.trace, onp.trace, arr, offset=i, axis1=1, axis2=0)
arr = rand_int(7, 4, 9)
for i in [-1, 0, 2]:
match_res(mnp.trace, onp.trace, arr, offset=i, axis1=0, axis2=-1)
match_res(mnp.trace, onp.trace, arr, offset=i, axis1=-2, axis2=2)
match_res(mnp.trace, onp.trace, arr, offset=i, axis1=-1, axis2=-2)
def mnp_meshgrid(*xi):
a = mnp.meshgrid(*xi)
b = mnp.meshgrid(*xi, sparse=True)
c = mnp.meshgrid(*xi, indexing='ij')
d = mnp.meshgrid(*xi, sparse=False, indexing='ij')
return a, b, c, d
def onp_meshgrid(*xi):
a = onp.meshgrid(*xi)
b = onp.meshgrid(*xi, sparse=True)
c = onp.meshgrid(*xi, indexing='ij')
d = onp.meshgrid(*xi, sparse=False, indexing='ij')
return a, b, c, d
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_meshgrid():
xi = (onp.full(3, 2), onp.full(1, 5), onp.full(
(2, 3), 9), onp.full((4, 5, 6), 7))
for i in range(len(xi)):
arrs = xi[i:]
mnp_arrs = map(to_tensor, arrs)
for mnp_res, onp_res in zip(mnp_meshgrid(*mnp_arrs), onp_meshgrid(*arrs)):
match_all_arrays(mnp_res, onp_res)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_mgrid():
mnp_res = mnp.mgrid[0:5]
onp_res = onp.mgrid[0:5]
match_all_arrays(mnp_res, onp_res, error=5)
mnp_res = mnp.mgrid[2:30:4j, -10:20:7, 2:5:0.5]
onp_res = onp.mgrid[2:30:4j, -10:20:7, 2:5:0.5]
match_all_arrays(mnp_res, onp_res, error=5)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_ogrid():
mnp_res = mnp.ogrid[0:5]
onp_res = onp.ogrid[0:5]
match_all_arrays(mnp_res, onp_res, error=5)
mnp_res = mnp.ogrid[2:30:4j, -10:20:7, 2:5:0.5]
onp_res = onp.ogrid[2:30:4j, -10:20:7, 2:5:0.5]
match_all_arrays(mnp_res, onp_res, error=5)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_diagflat():
arrs = [rand_int(2, 3)]
for arr in arrs:
for i in [-2, 0, 7]:
match_res(mnp.diagflat, onp.diagflat, arr, k=i)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_diag():
arrs = [rand_int(7), rand_int(5, 5), rand_int(3, 8), rand_int(9, 6)]
for arr in arrs:
for i in [-10, -5, -1, 0, 2, 5, 6, 10]:
match_res(mnp.diag, onp.diag, arr, k=i)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_diag_indices():
mnp_res = mnp.diag_indices(5, 7)
onp_res = onp.diag_indices(5, 7)
match_all_arrays(mnp_res, onp_res)
def mnp_ix_(*args):
return mnp.ix_(*args)
def onp_ix_(*args):
return onp.ix_(*args)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_ix_():
arrs = [rand_int(i + 1) for i in range(10)]
for i in range(10):
test_arrs = arrs[:i + 1]
match_res(mnp_ix_, onp_ix_, *test_arrs)
def mnp_indices():
a = mnp.indices((2, 3))
b = mnp.indices((2, 3, 4), sparse=True)
return a, b
def onp_indices():
a = onp.indices((2, 3))
b = onp.indices((2, 3, 4), sparse=True)
return a, b
def test_indices():
run_multi_test(mnp_indices, onp_indices, ())
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_geomspace():
start = onp.arange(1, 7).reshape(2, 3)
end = [1000, 2000, 3000]
match_array(mnp.geomspace(1, 256, num=9).asnumpy(),
onp.geomspace(1, 256, num=9), error=1)
match_array(mnp.geomspace(1, 256, num=8, endpoint=False).asnumpy(),
onp.geomspace(1, 256, num=8, endpoint=False), error=1)
match_array(mnp.geomspace(to_tensor(start), end, num=4).asnumpy(),
onp.geomspace(start, end, num=4), error=1)
match_array(mnp.geomspace(to_tensor(start), end, num=4, endpoint=False).asnumpy(),
onp.geomspace(start, end, num=4, endpoint=False), error=1)
match_array(mnp.geomspace(to_tensor(start), end, num=4, axis=-1).asnumpy(),
onp.geomspace(start, end, num=4, axis=-1), error=1)
match_array(mnp.geomspace(to_tensor(start), end, num=4, endpoint=False, axis=-1).asnumpy(),
onp.geomspace(start, end, num=4, endpoint=False, axis=-1), error=1)
start = onp.arange(1, 1 + 2*3*4*5).reshape(2, 3, 4, 5)
end = [1000, 2000, 3000, 4000, 5000]
for i in range(-5, 5):
match_array(mnp.geomspace(to_tensor(start), end, num=4, axis=i).asnumpy(),
onp.geomspace(start, end, num=4, axis=i), error=1)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_vander():
arrs = [rand_int(i + 3) for i in range(3)]
for i in range(3):
mnp_vander = mnp.vander(to_tensor(arrs[i]))
onp_vander = onp.vander(arrs[i])
match_all_arrays(mnp_vander, onp_vander, error=1e-4)
mnp_vander = mnp.vander(to_tensor(arrs[i]), N=2, increasing=True)
onp_vander = onp.vander(arrs[i], N=2, increasing=True)
match_all_arrays(mnp_vander, onp_vander, error=1e-4)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_asarray_exception():
with pytest.raises(TypeError):
mnp.asarray({1, 2, 3})
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_linspace_exception():
with pytest.raises(TypeError):
mnp.linspace(0, 1, num=2.5)
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_x86_cpu
@pytest.mark.env_onecard
def test_empty_like_exception():
with pytest.raises(ValueError):
mnp.empty_like([[1, 2, 3], [4, 5]])
| 34.709178
| 98
| 0.6553
| 4,366
| 29,121
| 4.176592
| 0.062529
| 0.104195
| 0.124376
| 0.109405
| 0.812503
| 0.779051
| 0.735893
| 0.705182
| 0.661695
| 0.642062
| 0
| 0.049059
| 0.206243
| 29,121
| 838
| 99
| 34.750597
| 0.739823
| 0.050754
| 0
| 0.497738
| 0
| 0
| 0.004274
| 0
| 0
| 0
| 0
| 0
| 0.015083
| 1
| 0.067873
| false
| 0
| 0.006033
| 0.00905
| 0.090498
| 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
|
38a571922fb7193e479260aa552a5cd7bb096155
| 114
|
py
|
Python
|
day3/test_package/__init__.py
|
tdouris1/pynet_test
|
6c68161a5759c2d82b14dc92fec70fda1aba679c
|
[
"Apache-2.0"
] | null | null | null |
day3/test_package/__init__.py
|
tdouris1/pynet_test
|
6c68161a5759c2d82b14dc92fec70fda1aba679c
|
[
"Apache-2.0"
] | null | null | null |
day3/test_package/__init__.py
|
tdouris1/pynet_test
|
6c68161a5759c2d82b14dc92fec70fda1aba679c
|
[
"Apache-2.0"
] | 1
|
2020-06-03T08:41:10.000Z
|
2020-06-03T08:41:10.000Z
|
from test_package.test1 import my_func
from test_package.test2 import my_func2
__all__ = ['my_func', 'my_func2']
| 22.8
| 39
| 0.798246
| 19
| 114
| 4.263158
| 0.526316
| 0.197531
| 0.37037
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.039604
| 0.114035
| 114
| 4
| 40
| 28.5
| 0.762376
| 0
| 0
| 0
| 0
| 0
| 0.131579
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
38d6a70cb87c8e2b6a999d7239f94a7970939034
| 102
|
py
|
Python
|
duplicates_parser/duplicates/__init__.py
|
LilianBoulard/utils
|
84acd0f24afc976a92aa422bfd8ec5c725800b98
|
[
"MIT"
] | 2
|
2020-12-15T11:54:58.000Z
|
2021-01-21T17:34:06.000Z
|
duplicates_parser/duplicates/__init__.py
|
Phaide/utils
|
84acd0f24afc976a92aa422bfd8ec5c725800b98
|
[
"MIT"
] | null | null | null |
duplicates_parser/duplicates/__init__.py
|
Phaide/utils
|
84acd0f24afc976a92aa422bfd8ec5c725800b98
|
[
"MIT"
] | null | null | null |
from .parser import DuplicateParser
from .extractor import Extractor
from .dashboard import Dashboard
| 25.5
| 35
| 0.852941
| 12
| 102
| 7.25
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.117647
| 102
| 3
| 36
| 34
| 0.966667
| 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
|
2a0d88802085de00f4ec7be9e5ba21be1c97a13f
| 530
|
py
|
Python
|
dealbot/buttons.py
|
whyh/FavourDemo
|
1b19882fb2e79dee9c3332594bf45c91e7476eaa
|
[
"Unlicense"
] | 1
|
2020-09-14T12:10:22.000Z
|
2020-09-14T12:10:22.000Z
|
dealbot/buttons.py
|
whyh/FavourDemo
|
1b19882fb2e79dee9c3332594bf45c91e7476eaa
|
[
"Unlicense"
] | 4
|
2021-04-30T20:54:31.000Z
|
2021-06-02T00:28:04.000Z
|
dealbot/buttons.py
|
whyh/FavourDemo
|
1b19882fb2e79dee9c3332594bf45c91e7476eaa
|
[
"Unlicense"
] | null | null | null |
from aiogram.types import InlineKeyboardButton
from common import sed, tg
import phrases as phr
def replenish(lang: str) -> InlineKeyboardButton:
return InlineKeyboardButton(phr.REPLENISH(lang), url=tg.BOT_DEEPLINK + sed.encode(**{sed.kv.ACT: sed.kv.ACT_REPL}))
def close_deal(lang: str, creator: bool, contributor: bool) -> InlineKeyboardButton:
return InlineKeyboardButton(phr.CONFIRM(lang), callback_data=sed.encode(**{sed.kv.ACT: sed.kv.ACT_CLOSE_DEAL, sed.kv.CONTRIBUTOR: contributor, sed.kv.CREATOR: creator}))
| 40.769231
| 173
| 0.773585
| 72
| 530
| 5.611111
| 0.430556
| 0.074257
| 0.079208
| 0.242574
| 0.123762
| 0.123762
| 0.123762
| 0.123762
| 0
| 0
| 0
| 0
| 0.101887
| 530
| 12
| 174
| 44.166667
| 0.84874
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0.428571
| 0.285714
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 5
|
2a17ed45d324b329b727b3376dacf24cf485b3ef
| 157
|
py
|
Python
|
example/text_output.py
|
vputz/pyntegrant
|
6c54c03286b57e883577795440f4d304bfca2506
|
[
"Apache-2.0"
] | null | null | null |
example/text_output.py
|
vputz/pyntegrant
|
6c54c03286b57e883577795440f4d304bfca2506
|
[
"Apache-2.0"
] | null | null | null |
example/text_output.py
|
vputz/pyntegrant
|
6c54c03286b57e883577795440f4d304bfca2506
|
[
"Apache-2.0"
] | null | null | null |
from pprint import pformat
from interfaces import Output
class TextOutput(Output):
def format_output(self, d: dict) -> str:
return pformat(d)
| 17.444444
| 44
| 0.713376
| 21
| 157
| 5.285714
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.210191
| 157
| 8
| 45
| 19.625
| 0.895161
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.4
| 0.2
| 1
| 0.2
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 5
|
2a28a20a75291ead3bbcd19f230575ab146edf1c
| 83
|
py
|
Python
|
openpype/hosts/flame/api/plugin.py
|
philipluk/OpenPype
|
103de741de5f71063a9572f0338e879b6361fb31
|
[
"MIT"
] | 44
|
2019-03-19T04:56:35.000Z
|
2021-04-23T12:05:08.000Z
|
openpype/hosts/flame/api/plugin.py
|
philipluk/OpenPype
|
103de741de5f71063a9572f0338e879b6361fb31
|
[
"MIT"
] | 655
|
2020-03-17T15:10:21.000Z
|
2021-04-23T18:22:52.000Z
|
openpype/hosts/flame/api/plugin.py
|
BigRoy/OpenPype
|
dd0e3657b4e66740f55feddb2693acfd14e2c9ef
|
[
"MIT"
] | 21
|
2019-03-19T04:56:38.000Z
|
2021-04-23T09:10:59.000Z
|
# Creator plugin functions
# Publishing plugin functions
# Loader plugin functions
| 20.75
| 29
| 0.819277
| 9
| 83
| 7.555556
| 0.555556
| 0.661765
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.144578
| 83
| 3
| 30
| 27.666667
| 0.957746
| 0.915663
| 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
|
2a2a5994acd3bb8bcc7231e2ae957c92474828a9
| 420
|
py
|
Python
|
Database/Project/login/models.py
|
ChoKyuWon/SchoolProjects
|
71a5decefc85ae941ba2d537c4507ba8e615cc34
|
[
"MIT"
] | null | null | null |
Database/Project/login/models.py
|
ChoKyuWon/SchoolProjects
|
71a5decefc85ae941ba2d537c4507ba8e615cc34
|
[
"MIT"
] | null | null | null |
Database/Project/login/models.py
|
ChoKyuWon/SchoolProjects
|
71a5decefc85ae941ba2d537c4507ba8e615cc34
|
[
"MIT"
] | null | null | null |
from django.db import models
class User(models.Model):
uid = models.IntegerField(default=0, primary_key=True)
user_id = models.IntegerField(default=0)
user_passwordhash = models.CharField(max_length=100)
user_isadmin = models.BinaryField(default=b'0')
user_classroom_id = models.IntegerField(default=0)
def __str__(self):
return str(self.user_id)
# Create your models here.
| 32.307692
| 59
| 0.716667
| 56
| 420
| 5.160714
| 0.571429
| 0.186851
| 0.259516
| 0.269896
| 0.193772
| 0
| 0
| 0
| 0
| 0
| 0
| 0.020408
| 0.183333
| 420
| 12
| 60
| 35
| 0.822157
| 0.057143
| 0
| 0
| 0
| 0
| 0.002618
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.111111
| false
| 0.111111
| 0.111111
| 0.111111
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 5
|
2a6bdde53bd210d14a14d2a03fae66b1645df387
| 244
|
py
|
Python
|
Framework/KeyboardListener.py
|
EpicTofuu/Froggers
|
0395ef801fe11a7881fd32fd570bf3135a4a761f
|
[
"MIT"
] | 1
|
2020-11-17T04:32:55.000Z
|
2020-11-17T04:32:55.000Z
|
Framework/KeyboardListener.py
|
EpicTofuu/Froggers
|
0395ef801fe11a7881fd32fd570bf3135a4a761f
|
[
"MIT"
] | null | null | null |
Framework/KeyboardListener.py
|
EpicTofuu/Froggers
|
0395ef801fe11a7881fd32fd570bf3135a4a761f
|
[
"MIT"
] | null | null | null |
# gets key presses. Only helpful for key down strokes
class KeyboardListener:
def KeyDown (self, event):
pass
def get_keydown (oldkeystate, newkeystate, keys):
return any ([newkeystate[k] and not oldkeystate[k] for k in keys])
| 30.5
| 70
| 0.717213
| 34
| 244
| 5.117647
| 0.735294
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.20082
| 244
| 8
| 70
| 30.5
| 0.892308
| 0.209016
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0.2
| 0
| 0.2
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 5
|
2a6d03024f5e00d5dca546e48a657e2f58e03241
| 182
|
py
|
Python
|
bin/iamonds/polyiamonds-12345-trapezoid-1.py
|
tiwo/puzzler
|
7ad3d9a792f0635f7ec59ffa85fb46b54fd77a7e
|
[
"Intel"
] | null | null | null |
bin/iamonds/polyiamonds-12345-trapezoid-1.py
|
tiwo/puzzler
|
7ad3d9a792f0635f7ec59ffa85fb46b54fd77a7e
|
[
"Intel"
] | null | null | null |
bin/iamonds/polyiamonds-12345-trapezoid-1.py
|
tiwo/puzzler
|
7ad3d9a792f0635f7ec59ffa85fb46b54fd77a7e
|
[
"Intel"
] | 1
|
2022-01-02T16:54:14.000Z
|
2022-01-02T16:54:14.000Z
|
#!/usr/bin/env python
# $Id$
"""98,807 solutions"""
import puzzler
from puzzler.puzzles.polyiamonds12345 import Polyiamonds12345Trapezoid1
puzzler.run(Polyiamonds12345Trapezoid1)
| 18.2
| 71
| 0.802198
| 19
| 182
| 7.684211
| 0.789474
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.13253
| 0.087912
| 182
| 9
| 72
| 20.222222
| 0.746988
| 0.230769
| 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
|
2a70865a93c827c819b1cb18d2b9e53e0147e60a
| 324
|
py
|
Python
|
configs/deepim/ycbvPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_ycbvPbr_SO/FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_Pbr_13_24Bowl_bop_test.py
|
THU-DA-6D-Pose-Group/self6dpp
|
c267cfa55e440e212136a5e9940598720fa21d16
|
[
"Apache-2.0"
] | 33
|
2021-12-15T07:11:47.000Z
|
2022-03-29T08:58:32.000Z
|
configs/deepim/ycbvPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_ycbvPbr_SO/FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_Pbr_13_24Bowl_bop_test.py
|
THU-DA-6D-Pose-Group/self6dpp
|
c267cfa55e440e212136a5e9940598720fa21d16
|
[
"Apache-2.0"
] | 3
|
2021-12-15T11:39:54.000Z
|
2022-03-29T07:24:23.000Z
|
configs/deepim/ycbvPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_ycbvPbr_SO/FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_Pbr_13_24Bowl_bop_test.py
|
THU-DA-6D-Pose-Group/self6dpp
|
c267cfa55e440e212136a5e9940598720fa21d16
|
[
"Apache-2.0"
] | null | null | null |
_base_ = (
"./FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_Pbr_01_02MasterChefCan_bop_test.py"
)
OUTPUT_DIR = "output/deepim/ycbvPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_ycbvPbr_SO/13_24Bowl"
DATASETS = dict(TRAIN=("ycbv_024_bowl_train_pbr",))
| 54
| 137
| 0.873457
| 44
| 324
| 5.727273
| 0.704545
| 0.087302
| 0.206349
| 0.293651
| 0.539683
| 0.539683
| 0.539683
| 0.539683
| 0.539683
| 0.539683
| 0
| 0.100324
| 0.046296
| 324
| 5
| 138
| 64.8
| 0.71521
| 0
| 0
| 0
| 0
| 0
| 0.799383
| 0.799383
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
aa841f3cf45dd5c21b74bbfb9c2259f8efaa5d5e
| 7,114
|
py
|
Python
|
tests/test_aiohttp_path_params.py
|
iterait/apistrap
|
e83460fa97f13a95a928971b0d2defe0ac611911
|
[
"MIT"
] | 6
|
2018-09-06T18:32:48.000Z
|
2021-05-28T01:03:32.000Z
|
tests/test_aiohttp_path_params.py
|
iterait/apistrap
|
e83460fa97f13a95a928971b0d2defe0ac611911
|
[
"MIT"
] | 53
|
2018-09-06T16:16:53.000Z
|
2021-05-19T14:36:58.000Z
|
tests/test_aiohttp_path_params.py
|
iterait/apistrap
|
e83460fa97f13a95a928971b0d2defe0ac611911
|
[
"MIT"
] | null | null | null |
import json
import pytest
from aiohttp import web
from aiohttp.web_request import Request
from apistrap.aiohttp import AioHTTPApistrap
@pytest.fixture(scope="function")
def app_without_request_param():
oapi = AioHTTPApistrap()
app = web.Application()
routes = web.RouteTableDef()
oapi.init_app(app)
@routes.get('/')
async def view():
return web.Response(content_type="application/json", text=json.dumps({
"status": "OK"
}))
app.add_routes(routes)
yield app
async def test_aiohttp_spec_no_request_param_spec(app_without_request_param, aiohttp_initialized_client):
client = await aiohttp_initialized_client(app_without_request_param)
response = await client.get('/spec.json')
assert response.status == 200
data = await response.json()
assert 'paths' in data
assert '/' in data['paths']
response = await client.get('/spec.json')
assert response.status == 200
new_data = await response.json()
assert new_data == data
async def test_aiohttp_spec_no_request_param_invocation(app_without_request_param, aiohttp_initialized_client):
client = await aiohttp_initialized_client(app_without_request_param)
response = await client.get('/')
assert response.status == 200
data = await response.json()
assert data == {"status": "OK"}
@pytest.fixture(scope="function")
def app_with_params_as_args():
oapi = AioHTTPApistrap()
app = web.Application()
routes = web.RouteTableDef()
oapi.init_app(app)
@routes.get('/{param_a}/{param_b}')
async def view(param_a: str, param_b: int):
return web.Response(content_type="application/json", text=json.dumps({
"a": param_a,
"b": param_b
}))
app.add_routes(routes)
yield app
async def test_aiohttp_path_params_as_args_spec(aiohttp_initialized_client, app_with_params_as_args):
client = await aiohttp_initialized_client(app_with_params_as_args)
response = await client.get('/spec.json')
assert response.status == 200
data = await response.json()
parameters = data["paths"]["/{param_a}/{param_b}"]["get"]["parameters"]
assert len(parameters) == 2
param_a = next(filter(lambda p: p["name"] == "param_a", parameters), None)
param_b = next(filter(lambda p: p["name"] == "param_b", parameters), None)
assert param_a == {"in": "path", "name": "param_a", "required": True, "schema": {"type": "string"}}
assert param_b == {"in": "path", "name": "param_b", "required": True, "schema": {"type": "integer"}}
async def test_aiohttp_path_params_as_args_arg_assignment(aiohttp_initialized_client, app_with_params_as_args):
client = await aiohttp_initialized_client(app_with_params_as_args)
response = await client.get("/a/42")
assert response.status == 200
data = await response.json()
assert data == {
"a": "a",
"b": 42
}
@pytest.fixture(scope="function")
def app_with_optional_parameter():
oapi = AioHTTPApistrap()
app = web.Application()
routes = web.RouteTableDef()
oapi.init_app(app)
@routes.get('/')
@routes.get('/{param}')
async def view(param: str = "Default"):
return web.Response(content_type="application/json", text=json.dumps({
"param": param,
}))
app.add_routes(routes)
yield app
async def test_aiohttp_path_param_optional_spec(aiohttp_initialized_client, app_with_optional_parameter):
client = await aiohttp_initialized_client(app_with_optional_parameter)
response = await client.get("spec.json")
assert response.status == 200
data = await response.json()
assert len(data["paths"]) == 2
async def test_aiohttp_path_param_optional_invocation(aiohttp_initialized_client, app_with_optional_parameter):
client = await aiohttp_initialized_client(app_with_optional_parameter)
response = await client.get("/value")
assert response.status == 200
data = await response.json()
assert data["param"] == "value"
async def test_aiohttp_path_param_optional_invocation_default(aiohttp_initialized_client, app_with_optional_parameter):
client = await aiohttp_initialized_client(app_with_optional_parameter)
response = await client.get("/")
assert response.status == 200
data = await response.json()
assert data["param"] == "Default"
async def test_aiohttp_path_param_multiple_request_parameters(aiohttp_initialized_client):
oapi = AioHTTPApistrap()
app = web.Application()
routes = web.RouteTableDef()
oapi.init_app(app)
with pytest.raises(TypeError):
@routes.get('/')
@routes.get('/{param}')
async def view(request_1: Request, request_2: Request, param: str = "Default"):
return web.Response(content_type="application/json", text=json.dumps({
"param": param,
}))
app.add_routes(routes)
client = await aiohttp_initialized_client(app)
await client.get("/spec.json")
async def test_aiohttp_path_param_unsupported_parameter(aiohttp_initialized_client):
oapi = AioHTTPApistrap()
app = web.Application()
routes = web.RouteTableDef()
oapi.init_app(app)
with pytest.raises(TypeError):
@routes.get('/{param}')
async def view(param: dict):
return web.Response(content_type="application/json", text=json.dumps({
"param": param,
}))
app.add_routes(routes)
client = await aiohttp_initialized_client(app)
await client.get("/spec.json")
@pytest.fixture(scope="function")
def app_with_unannotated_parameter():
oapi = AioHTTPApistrap()
app = web.Application()
routes = web.RouteTableDef()
oapi.init_app(app)
@routes.get('/{param}')
async def view(param):
return web.Response(content_type="application/json", text=json.dumps({
"param": param,
}))
app.add_routes(routes)
yield app
async def test_aiohttp_path_unannotated_parameter_spec(aiohttp_initialized_client, app_with_unannotated_parameter):
client = await aiohttp_initialized_client(app_with_unannotated_parameter)
response = await client.get('/spec.json')
assert response.status == 200
data = await response.json()
parameters = data["paths"]["/{param}"]["get"]["parameters"]
assert parameters == [
{"in": "path", "name": "param", "required": True, "schema": {"type": "string"}}
]
async def test_aiohttp_path_unannotated_parameter_arg_assignment(aiohttp_initialized_client, app_with_unannotated_parameter):
client = await aiohttp_initialized_client(app_with_unannotated_parameter)
response = await client.get("/42")
assert response.status == 200
data = await response.json()
assert data == {
"param": "42"
}
async def test_aiohttp_path_params_invalid_value(aiohttp_initialized_client, app_with_params_as_args):
client = await aiohttp_initialized_client(app_with_params_as_args)
response = await client.get("/a/foobar")
assert response.status == 400
| 29.036735
| 125
| 0.69061
| 869
| 7,114
| 5.38435
| 0.100115
| 0.092327
| 0.123103
| 0.115409
| 0.858089
| 0.837786
| 0.810216
| 0.745458
| 0.692883
| 0.692883
| 0
| 0.0078
| 0.189064
| 7,114
| 244
| 126
| 29.155738
| 0.803259
| 0
| 0
| 0.621951
| 0
| 0
| 0.082232
| 0
| 0
| 0
| 0
| 0
| 0.146341
| 1
| 0.02439
| false
| 0
| 0.030488
| 0
| 0.091463
| 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
|
2ab96079a3123222dcb751c18b6a701bbb6857cc
| 212
|
py
|
Python
|
src/forms/__init__.py
|
nnecklace/webi-shoppi
|
140d1e6ea8d019aa10ee2104e1bbd2baf0b9aa0f
|
[
"MIT"
] | null | null | null |
src/forms/__init__.py
|
nnecklace/webi-shoppi
|
140d1e6ea8d019aa10ee2104e1bbd2baf0b9aa0f
|
[
"MIT"
] | 2
|
2020-06-02T13:55:02.000Z
|
2020-06-16T17:58:55.000Z
|
src/forms/__init__.py
|
nnecklace/webi-shoppi
|
140d1e6ea8d019aa10ee2104e1bbd2baf0b9aa0f
|
[
"MIT"
] | null | null | null |
from .authentication import LoginForm, RegisterForm
from .search import SearchForm
from .products import ProductForm
from .users import UserForm, ChangePasswordForm, BalanceForm
from .comments import CommentForm
| 35.333333
| 60
| 0.853774
| 23
| 212
| 7.869565
| 0.652174
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108491
| 212
| 5
| 61
| 42.4
| 0.957672
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.2
| 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
| 1
| 1
| 0
| 0
| 0
|
0
| 5
|
2ac2926b460fad71cc4d177ac4785a717685f8ec
| 348
|
py
|
Python
|
waldur_core/monitoring/managers.py
|
opennode/nodeconductor
|
d6c17a9592bb6c49c33567542eef8d099605a46a
|
[
"MIT"
] | 23
|
2015-01-15T13:29:53.000Z
|
2017-05-04T05:12:24.000Z
|
waldur_core/monitoring/managers.py
|
opennode/nodeconductor
|
d6c17a9592bb6c49c33567542eef8d099605a46a
|
[
"MIT"
] | null | null | null |
waldur_core/monitoring/managers.py
|
opennode/nodeconductor
|
d6c17a9592bb6c49c33567542eef8d099605a46a
|
[
"MIT"
] | 8
|
2015-01-11T18:51:47.000Z
|
2017-06-29T18:53:12.000Z
|
from django.db import models as django_models
from waldur_core.core.managers import GenericKeyMixin
class ResourceSlaManager(GenericKeyMixin, django_models.Manager):
pass
class ResourceItemManager(GenericKeyMixin, django_models.Manager):
pass
class ResourceSlaStateTransitionManager(GenericKeyMixin, django_models.Manager):
pass
| 21.75
| 80
| 0.83046
| 36
| 348
| 7.888889
| 0.444444
| 0.169014
| 0.285211
| 0.359155
| 0.43662
| 0.302817
| 0
| 0
| 0
| 0
| 0
| 0
| 0.117816
| 348
| 15
| 81
| 23.2
| 0.925081
| 0
| 0
| 0.375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.375
| 0.25
| 0
| 0.625
| 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
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
2aed056bb066a479a54e413c288e5126a4d1f5dc
| 33
|
py
|
Python
|
cupy_alias/logic/__init__.py
|
fixstars/clpy
|
693485f85397cc110fa45803c36c30c24c297df0
|
[
"BSD-3-Clause"
] | 142
|
2018-06-07T07:43:10.000Z
|
2021-10-30T21:06:32.000Z
|
cupy_alias/logic/__init__.py
|
fixstars/clpy
|
693485f85397cc110fa45803c36c30c24c297df0
|
[
"BSD-3-Clause"
] | 282
|
2018-06-07T08:35:03.000Z
|
2021-03-31T03:14:32.000Z
|
cupy_alias/logic/__init__.py
|
fixstars/clpy
|
693485f85397cc110fa45803c36c30c24c297df0
|
[
"BSD-3-Clause"
] | 19
|
2018-06-19T11:07:53.000Z
|
2021-05-13T20:57:04.000Z
|
from clpy.logic import * # NOQA
| 16.5
| 32
| 0.69697
| 5
| 33
| 4.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.212121
| 33
| 1
| 33
| 33
| 0.884615
| 0.121212
| 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
|
630052d9f2112b73f5bc04c7356f6192727bcb06
| 99
|
py
|
Python
|
tests/unit/test_instrument.py
|
StarostinV/qmap_interpolation
|
bc432f33a461339e29ff8dfbc73a54fae10d5d34
|
[
"MIT"
] | null | null | null |
tests/unit/test_instrument.py
|
StarostinV/qmap_interpolation
|
bc432f33a461339e29ff8dfbc73a54fae10d5d34
|
[
"MIT"
] | null | null | null |
tests/unit/test_instrument.py
|
StarostinV/qmap_interpolation
|
bc432f33a461339e29ff8dfbc73a54fae10d5d34
|
[
"MIT"
] | null | null | null |
import pytest
def test_instrument(instrument):
assert instrument.hot_pixel_threshold is None
| 16.5
| 49
| 0.818182
| 13
| 99
| 6
| 0.846154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.141414
| 99
| 5
| 50
| 19.8
| 0.917647
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.333333
| 1
| 0.333333
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
6320b64f9aaab098bc7711582825b97349aebdfb
| 29
|
py
|
Python
|
src/services/message_management/__init__.py
|
b1team/trada
|
22ceaf4d50fe3a38ff402315c029e574773ca9e0
|
[
"MIT"
] | null | null | null |
src/services/message_management/__init__.py
|
b1team/trada
|
22ceaf4d50fe3a38ff402315c029e574773ca9e0
|
[
"MIT"
] | 1
|
2021-03-12T15:16:03.000Z
|
2021-03-12T15:16:03.000Z
|
src/services/message_management/__init__.py
|
b1team/trada
|
22ceaf4d50fe3a38ff402315c029e574773ca9e0
|
[
"MIT"
] | null | null | null |
from .api import send_message
| 29
| 29
| 0.862069
| 5
| 29
| 4.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103448
| 29
| 1
| 29
| 29
| 0.923077
| 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
|
2da047e1ebf2d0eb3800443c040c822ad70bd18d
| 49
|
py
|
Python
|
tkdet/solver/__init__.py
|
tkhe/tkdetection
|
54e6c112ef2930e755f457e38449736f5743a9ea
|
[
"MIT"
] | 1
|
2020-10-09T02:27:13.000Z
|
2020-10-09T02:27:13.000Z
|
tkdet/solver/__init__.py
|
tkhe/tkdetection
|
54e6c112ef2930e755f457e38449736f5743a9ea
|
[
"MIT"
] | null | null | null |
tkdet/solver/__init__.py
|
tkhe/tkdetection
|
54e6c112ef2930e755f457e38449736f5743a9ea
|
[
"MIT"
] | null | null | null |
from .build import *
from .lr_scheduler import *
| 16.333333
| 27
| 0.755102
| 7
| 49
| 5.142857
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.163265
| 49
| 2
| 28
| 24.5
| 0.878049
| 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
|
2dc5f270797144470894757dfd7b6d2c8cfa92e6
| 92
|
py
|
Python
|
dbaas/maintenance/async_jobs/__init__.py
|
perry-contribs/database-as-a-service
|
db8fbee3982bbc32abf32aa86f7387de01a243be
|
[
"BSD-3-Clause"
] | 303
|
2015-01-08T10:35:54.000Z
|
2022-02-28T08:54:06.000Z
|
dbaas/maintenance/async_jobs/__init__.py
|
nouraellm/database-as-a-service
|
5e655c9347bea991b7218a01549f5e44f161d7be
|
[
"BSD-3-Clause"
] | 124
|
2015-01-14T12:56:15.000Z
|
2022-03-22T20:45:11.000Z
|
dbaas/maintenance/async_jobs/__init__.py
|
nouraellm/database-as-a-service
|
5e655c9347bea991b7218a01549f5e44f161d7be
|
[
"BSD-3-Clause"
] | 110
|
2015-01-02T11:59:48.000Z
|
2022-02-28T08:54:06.000Z
|
from .base import *
from .restart_database import *
from .remove_instance_database import *
| 23
| 39
| 0.804348
| 12
| 92
| 5.916667
| 0.583333
| 0.28169
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130435
| 92
| 3
| 40
| 30.666667
| 0.8875
| 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
|
2dd4db3496199ea8dc43d1819271bdaa264939dd
| 387
|
py
|
Python
|
api/generateKey.py
|
JumboCode/South-Florida-Jewish-Academy
|
02034d083a7311c3c09b86b06517cbf084a2794a
|
[
"MIT"
] | 5
|
2019-12-11T14:33:11.000Z
|
2020-08-12T21:06:04.000Z
|
api/generateKey.py
|
JumboCode/South-Florida-Jewish-Academy
|
02034d083a7311c3c09b86b06517cbf084a2794a
|
[
"MIT"
] | 155
|
2019-09-29T14:42:03.000Z
|
2022-02-26T18:26:37.000Z
|
api/generateKey.py
|
JumboCode/South-Florida-Jewish-Academy
|
02034d083a7311c3c09b86b06517cbf084a2794a
|
[
"MIT"
] | 4
|
2019-09-29T16:32:11.000Z
|
2020-07-23T01:57:06.000Z
|
import random
import string
import secrets
#generates a unique key as a string of 1 + 15 random letters/numbers
def generateKey():
# key = str(1)
# for i in range(0,15):
# letterOrNum = random.randint(0,1)
# if letterOrNum == 0:
# key = key + random.choice(string.ascii_letters)
# else:
# key = key + str(random.randint(0,9))
# print(key)
return secrets.token_hex(1024)
| 24.1875
| 68
| 0.682171
| 60
| 387
| 4.366667
| 0.566667
| 0.045802
| 0.10687
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.051118
| 0.191214
| 387
| 15
| 69
| 25.8
| 0.785942
| 0.687339
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0.6
| 0.2
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 1
| 0
|
0
| 5
|
93290c62368395b618b2c95673065f4f79449d52
| 29,817
|
py
|
Python
|
makahiki/apps/widgets/smartgrid/migrations/0001_initial.py
|
justinslee/Wai-Not-Makahiki
|
4b7dd685012ec64758affe0ecee3103596d16aa7
|
[
"MIT"
] | 1
|
2015-07-22T11:31:20.000Z
|
2015-07-22T11:31:20.000Z
|
makahiki/apps/widgets/smartgrid/migrations/0001_initial.py
|
justinslee/Wai-Not-Makahiki
|
4b7dd685012ec64758affe0ecee3103596d16aa7
|
[
"MIT"
] | null | null | null |
makahiki/apps/widgets/smartgrid/migrations/0001_initial.py
|
justinslee/Wai-Not-Makahiki
|
4b7dd685012ec64758affe0ecee3103596d16aa7
|
[
"MIT"
] | null | null | null |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Level'
db.create_table('smartgrid_level', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=50)),
('priority', self.gf('django.db.models.fields.IntegerField')(default=1)),
('unlock_condition', self.gf('django.db.models.fields.CharField')(max_length=400, null=True, blank=True)),
('unlock_condition_text', self.gf('django.db.models.fields.CharField')(max_length=400, null=True, blank=True)),
))
db.send_create_signal('smartgrid', ['Level'])
# Adding model 'Category'
db.create_table('smartgrid_category', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, null=True, db_index=True)),
('priority', self.gf('django.db.models.fields.IntegerField')(default=1)),
))
db.send_create_signal('smartgrid', ['Category'])
# Adding model 'TextPromptQuestion'
db.create_table('smartgrid_textpromptquestion', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('action', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['smartgrid.Action'])),
('question', self.gf('django.db.models.fields.TextField')()),
('answer', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
))
db.send_create_signal('smartgrid', ['TextPromptQuestion'])
# Adding model 'QuestionChoice'
db.create_table('smartgrid_questionchoice', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('question', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['smartgrid.TextPromptQuestion'])),
('action', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['smartgrid.Action'])),
('choice', self.gf('django.db.models.fields.CharField')(max_length=255)),
))
db.send_create_signal('smartgrid', ['QuestionChoice'])
# Adding model 'ConfirmationCode'
db.create_table('smartgrid_confirmationcode', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('action', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['smartgrid.Action'])),
('code', self.gf('django.db.models.fields.CharField')(unique=True, max_length=50, db_index=True)),
('is_active', self.gf('django.db.models.fields.BooleanField')(default=True)),
))
db.send_create_signal('smartgrid', ['ConfirmationCode'])
# Adding model 'Action'
db.create_table('smartgrid_action', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=20)),
('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)),
('title', self.gf('django.db.models.fields.CharField')(max_length=200)),
('image', self.gf('django.db.models.fields.files.ImageField')(max_length=255, null=True, blank=True)),
('video_id', self.gf('django.db.models.fields.CharField')(max_length=200, null=True, blank=True)),
('video_source', self.gf('django.db.models.fields.CharField')(max_length=20, null=True, blank=True)),
('embedded_widget', self.gf('django.db.models.fields.CharField')(max_length=50, null=True, blank=True)),
('description', self.gf('django.db.models.fields.TextField')()),
('type', self.gf('django.db.models.fields.CharField')(max_length=20)),
('level', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['smartgrid.Level'], null=True, blank=True)),
('category', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['smartgrid.Category'], null=True, blank=True)),
('priority', self.gf('django.db.models.fields.IntegerField')(default=1000)),
('pub_date', self.gf('django.db.models.fields.DateField')(default=datetime.date(2012, 6, 8))),
('expire_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
('unlock_condition', self.gf('django.db.models.fields.CharField')(max_length=400, null=True, blank=True)),
('unlock_condition_text', self.gf('django.db.models.fields.CharField')(max_length=400, null=True, blank=True)),
('related_resource', self.gf('django.db.models.fields.CharField')(max_length=20, null=True, blank=True)),
('social_bonus', self.gf('django.db.models.fields.IntegerField')(default=0)),
('is_canopy', self.gf('django.db.models.fields.BooleanField')(default=False)),
('is_group', self.gf('django.db.models.fields.BooleanField')(default=False)),
('point_value', self.gf('django.db.models.fields.IntegerField')(default=0)),
))
db.send_create_signal('smartgrid', ['Action'])
# Adding model 'Commitment'
db.create_table('smartgrid_commitment', (
('action_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['smartgrid.Action'], unique=True, primary_key=True)),
('duration', self.gf('django.db.models.fields.IntegerField')(default=5)),
))
db.send_create_signal('smartgrid', ['Commitment'])
# Adding model 'Activity'
db.create_table('smartgrid_activity', (
('action_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['smartgrid.Action'], unique=True, primary_key=True)),
('duration', self.gf('django.db.models.fields.IntegerField')()),
('point_range_start', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
('point_range_end', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
('confirm_type', self.gf('django.db.models.fields.CharField')(default='text', max_length=20)),
('confirm_prompt', self.gf('django.db.models.fields.TextField')(blank=True)),
))
db.send_create_signal('smartgrid', ['Activity'])
# Adding model 'Event'
db.create_table('smartgrid_event', (
('action_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['smartgrid.Action'], unique=True, primary_key=True)),
('duration', self.gf('django.db.models.fields.IntegerField')()),
('event_date', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('event_location', self.gf('django.db.models.fields.CharField')(max_length=200, null=True, blank=True)),
('event_max_seat', self.gf('django.db.models.fields.IntegerField')(default=1000)),
))
db.send_create_signal('smartgrid', ['Event'])
# Adding model 'ActionMember'
db.create_table('smartgrid_actionmember', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
('action', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['smartgrid.Action'])),
('question', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['smartgrid.TextPromptQuestion'], null=True, blank=True)),
('submission_date', self.gf('django.db.models.fields.DateTimeField')()),
('completion_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
('award_date', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('approval_status', self.gf('django.db.models.fields.CharField')(default='pending', max_length=20)),
('social_bonus_awarded', self.gf('django.db.models.fields.BooleanField')(default=False)),
('comment', self.gf('django.db.models.fields.TextField')(blank=True)),
('social_email', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
('social_email2', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
('response', self.gf('django.db.models.fields.TextField')(blank=True)),
('admin_comment', self.gf('django.db.models.fields.TextField')(blank=True)),
('image', self.gf('django.db.models.fields.files.ImageField')(max_length=1024, blank=True)),
('points_awarded', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, null=True, blank=True)),
))
db.send_create_signal('smartgrid', ['ActionMember'])
# Adding unique constraint on 'ActionMember', fields ['user', 'action', 'submission_date']
db.create_unique('smartgrid_actionmember', ['user_id', 'action_id', 'submission_date'])
# Adding model 'EmailReminder'
db.create_table('smartgrid_emailreminder', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
('action', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['smartgrid.Action'])),
('send_at', self.gf('django.db.models.fields.DateTimeField')()),
('sent', self.gf('django.db.models.fields.BooleanField')(default=False)),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, null=True, blank=True)),
('email_address', self.gf('django.db.models.fields.EmailField')(max_length=75)),
))
db.send_create_signal('smartgrid', ['EmailReminder'])
# Adding unique constraint on 'EmailReminder', fields ['user', 'action']
db.create_unique('smartgrid_emailreminder', ['user_id', 'action_id'])
# Adding model 'TextReminder'
db.create_table('smartgrid_textreminder', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
('action', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['smartgrid.Action'])),
('send_at', self.gf('django.db.models.fields.DateTimeField')()),
('sent', self.gf('django.db.models.fields.BooleanField')(default=False)),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, null=True, blank=True)),
('text_number', self.gf('django.contrib.localflavor.us.models.PhoneNumberField')(max_length=20)),
('text_carrier', self.gf('django.db.models.fields.CharField')(max_length=50, null=True, blank=True)),
))
db.send_create_signal('smartgrid', ['TextReminder'])
# Adding unique constraint on 'TextReminder', fields ['user', 'action']
db.create_unique('smartgrid_textreminder', ['user_id', 'action_id'])
def backwards(self, orm):
# Removing unique constraint on 'TextReminder', fields ['user', 'action']
db.delete_unique('smartgrid_textreminder', ['user_id', 'action_id'])
# Removing unique constraint on 'EmailReminder', fields ['user', 'action']
db.delete_unique('smartgrid_emailreminder', ['user_id', 'action_id'])
# Removing unique constraint on 'ActionMember', fields ['user', 'action', 'submission_date']
db.delete_unique('smartgrid_actionmember', ['user_id', 'action_id', 'submission_date'])
# Deleting model 'Level'
db.delete_table('smartgrid_level')
# Deleting model 'Category'
db.delete_table('smartgrid_category')
# Deleting model 'TextPromptQuestion'
db.delete_table('smartgrid_textpromptquestion')
# Deleting model 'QuestionChoice'
db.delete_table('smartgrid_questionchoice')
# Deleting model 'ConfirmationCode'
db.delete_table('smartgrid_confirmationcode')
# Deleting model 'Action'
db.delete_table('smartgrid_action')
# Deleting model 'Commitment'
db.delete_table('smartgrid_commitment')
# Deleting model 'Activity'
db.delete_table('smartgrid_activity')
# Deleting model 'Event'
db.delete_table('smartgrid_event')
# Deleting model 'ActionMember'
db.delete_table('smartgrid_actionmember')
# Deleting model 'EmailReminder'
db.delete_table('smartgrid_emailreminder')
# Deleting model 'TextReminder'
db.delete_table('smartgrid_textreminder')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 6, 8, 0, 44, 51, 736311)'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 6, 8, 0, 44, 51, 736127)'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'notifications.usernotification': {
'Meta': {'object_name': 'UserNotification'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']", 'null': 'True', 'blank': 'True'}),
'contents': ('django.db.models.fields.TextField', [], {}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'display_alert': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'level': ('django.db.models.fields.IntegerField', [], {'default': '20'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'recipient': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
'unread': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
'score_mgr.pointstransaction': {
'Meta': {'ordering': "('-transaction_date',)", 'unique_together': "(('user', 'transaction_date', 'message'),)", 'object_name': 'PointsTransaction'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']", 'null': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
'points': ('django.db.models.fields.IntegerField', [], {}),
'transaction_date': ('django.db.models.fields.DateTimeField', [], {}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'smartgrid.action': {
'Meta': {'object_name': 'Action'},
'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['smartgrid.Category']", 'null': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {}),
'embedded_widget': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
'expire_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'is_canopy': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_group': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'level': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['smartgrid.Level']", 'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
'point_value': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'priority': ('django.db.models.fields.IntegerField', [], {'default': '1000'}),
'pub_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date(2012, 6, 8)'}),
'related_resource': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
'social_bonus': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
'unlock_condition': ('django.db.models.fields.CharField', [], {'max_length': '400', 'null': 'True', 'blank': 'True'}),
'unlock_condition_text': ('django.db.models.fields.CharField', [], {'max_length': '400', 'null': 'True', 'blank': 'True'}),
'users': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'through': "orm['smartgrid.ActionMember']", 'symmetrical': 'False'}),
'video_id': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'video_source': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'})
},
'smartgrid.actionmember': {
'Meta': {'unique_together': "(('user', 'action', 'submission_date'),)", 'object_name': 'ActionMember'},
'action': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['smartgrid.Action']"}),
'admin_comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'approval_status': ('django.db.models.fields.CharField', [], {'default': "'pending'", 'max_length': '20'}),
'award_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'completion_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '1024', 'blank': 'True'}),
'points_awarded': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['smartgrid.TextPromptQuestion']", 'null': 'True', 'blank': 'True'}),
'response': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'social_bonus_awarded': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'social_email': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'social_email2': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'submission_date': ('django.db.models.fields.DateTimeField', [], {}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'smartgrid.activity': {
'Meta': {'object_name': 'Activity', '_ormbases': ['smartgrid.Action']},
'action_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['smartgrid.Action']", 'unique': 'True', 'primary_key': 'True'}),
'confirm_prompt': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'confirm_type': ('django.db.models.fields.CharField', [], {'default': "'text'", 'max_length': '20'}),
'duration': ('django.db.models.fields.IntegerField', [], {}),
'point_range_end': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'point_range_start': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
},
'smartgrid.category': {
'Meta': {'object_name': 'Category'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'priority': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'null': 'True', 'db_index': 'True'})
},
'smartgrid.commitment': {
'Meta': {'object_name': 'Commitment', '_ormbases': ['smartgrid.Action']},
'action_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['smartgrid.Action']", 'unique': 'True', 'primary_key': 'True'}),
'duration': ('django.db.models.fields.IntegerField', [], {'default': '5'})
},
'smartgrid.confirmationcode': {
'Meta': {'object_name': 'ConfirmationCode'},
'action': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['smartgrid.Action']"}),
'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
},
'smartgrid.emailreminder': {
'Meta': {'unique_together': "(('user', 'action'),)", 'object_name': 'EmailReminder'},
'action': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['smartgrid.Action']"}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'email_address': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'send_at': ('django.db.models.fields.DateTimeField', [], {}),
'sent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'smartgrid.event': {
'Meta': {'object_name': 'Event', '_ormbases': ['smartgrid.Action']},
'action_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['smartgrid.Action']", 'unique': 'True', 'primary_key': 'True'}),
'duration': ('django.db.models.fields.IntegerField', [], {}),
'event_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'event_location': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'event_max_seat': ('django.db.models.fields.IntegerField', [], {'default': '1000'})
},
'smartgrid.level': {
'Meta': {'object_name': 'Level'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'priority': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
'unlock_condition': ('django.db.models.fields.CharField', [], {'max_length': '400', 'null': 'True', 'blank': 'True'}),
'unlock_condition_text': ('django.db.models.fields.CharField', [], {'max_length': '400', 'null': 'True', 'blank': 'True'})
},
'smartgrid.questionchoice': {
'Meta': {'object_name': 'QuestionChoice'},
'action': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['smartgrid.Action']"}),
'choice': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['smartgrid.TextPromptQuestion']"})
},
'smartgrid.textpromptquestion': {
'Meta': {'object_name': 'TextPromptQuestion'},
'action': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['smartgrid.Action']"}),
'answer': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'question': ('django.db.models.fields.TextField', [], {})
},
'smartgrid.textreminder': {
'Meta': {'unique_together': "(('user', 'action'),)", 'object_name': 'TextReminder'},
'action': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['smartgrid.Action']"}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'send_at': ('django.db.models.fields.DateTimeField', [], {}),
'sent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'text_carrier': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
'text_number': ('django.contrib.localflavor.us.models.PhoneNumberField', [], {'max_length': '20'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
}
}
complete_apps = ['smartgrid']
| 72.547445
| 182
| 0.597981
| 3,198
| 29,817
| 5.454972
| 0.063164
| 0.102264
| 0.17816
| 0.254514
| 0.813872
| 0.789911
| 0.778332
| 0.73104
| 0.670737
| 0.588019
| 0
| 0.009761
| 0.182245
| 29,817
| 410
| 183
| 72.72439
| 0.705697
| 0.038334
| 0
| 0.280702
| 0
| 0
| 0.535368
| 0.333322
| 0
| 0
| 0
| 0
| 0
| 1
| 0.005848
| false
| 0.002924
| 0.011696
| 0
| 0.026316
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
934acfe844bcf7b5cb0acba9d290acc4e3e9503a
| 97
|
py
|
Python
|
class9/exercise6/mytest/__init__.py
|
gleydsonm/pynet_ex
|
c7095b431d9d0de0e30f65d66a212a950afdb5d6
|
[
"Apache-2.0"
] | null | null | null |
class9/exercise6/mytest/__init__.py
|
gleydsonm/pynet_ex
|
c7095b431d9d0de0e30f65d66a212a950afdb5d6
|
[
"Apache-2.0"
] | null | null | null |
class9/exercise6/mytest/__init__.py
|
gleydsonm/pynet_ex
|
c7095b431d9d0de0e30f65d66a212a950afdb5d6
|
[
"Apache-2.0"
] | null | null | null |
from world import func1, MyClass, MyChildClass
__all__ = ('func1', 'MyClass', 'MyChildClass')
| 19.4
| 47
| 0.721649
| 10
| 97
| 6.6
| 0.7
| 0.363636
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.024096
| 0.14433
| 97
| 4
| 48
| 24.25
| 0.771084
| 0
| 0
| 0
| 0
| 0
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 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
|
937e88169ca913629339d0e3321817d78ab8c3a6
| 101
|
py
|
Python
|
.scripts/diff.py
|
GreenBlast/dotfiles
|
12de7c9e5d8eda0a7f314ed6d19974e7ea549116
|
[
"MIT"
] | 2
|
2018-08-08T12:39:10.000Z
|
2019-03-19T13:24:15.000Z
|
.scripts/diff.py
|
GreenBlast/dotfiles
|
12de7c9e5d8eda0a7f314ed6d19974e7ea549116
|
[
"MIT"
] | null | null | null |
.scripts/diff.py
|
GreenBlast/dotfiles
|
12de7c9e5d8eda0a7f314ed6d19974e7ea549116
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python
import sys
import os
os.system('vim -d "%s" "%s"' % (sys.argv[2], sys.argv[5]))
| 12.625
| 58
| 0.584158
| 19
| 101
| 3.105263
| 0.684211
| 0.237288
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.023256
| 0.148515
| 101
| 7
| 59
| 14.428571
| 0.662791
| 0.158416
| 0
| 0
| 0
| 0
| 0.192771
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
fa986ed6a152d7d89cf1586dcc5279a1a7eeab23
| 26
|
py
|
Python
|
pycdft/elcoupling/__init__.py
|
wwwennie/pycdft
|
3bd6c71d8e0661993af33147225db6396aa5729d
|
[
"MIT"
] | 21
|
2020-05-23T17:36:55.000Z
|
2022-01-24T01:26:02.000Z
|
pycdft/elcoupling/__init__.py
|
wwwennie/pycdft
|
3bd6c71d8e0661993af33147225db6396aa5729d
|
[
"MIT"
] | 5
|
2020-10-28T13:07:12.000Z
|
2021-12-17T15:53:08.000Z
|
pycdft/elcoupling/__init__.py
|
wwwennie/pycdft
|
3bd6c71d8e0661993af33147225db6396aa5729d
|
[
"MIT"
] | 4
|
2020-03-14T21:01:11.000Z
|
2021-05-09T01:37:03.000Z
|
from .elcoupling import *
| 13
| 25
| 0.769231
| 3
| 26
| 6.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.153846
| 26
| 1
| 26
| 26
| 0.909091
| 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
|
fafca969cf2663ef2c1da62b9e4563c3318885a7
| 159
|
py
|
Python
|
asios/kernel/fixup.py
|
Paolo-Maffei/retro
|
bf30cec3d82672eb2805392e77f3b21705129fc0
|
[
"Unlicense"
] | 1
|
2022-02-12T19:35:39.000Z
|
2022-02-12T19:35:39.000Z
|
asios/kernel/fixup.py
|
Paolo-Maffei/retro
|
bf30cec3d82672eb2805392e77f3b21705129fc0
|
[
"Unlicense"
] | null | null | null |
asios/kernel/fixup.py
|
Paolo-Maffei/retro
|
bf30cec3d82672eb2805392e77f3b21705129fc0
|
[
"Unlicense"
] | null | null | null |
Import("env")
def fixLinkFlag (s):
return s[4:] if s.startswith('-Wl,-T') else s
env.Replace(LINKFLAGS = [fixLinkFlag(i) for i in env['LINKFLAGS']])
| 22.714286
| 67
| 0.641509
| 25
| 159
| 4.08
| 0.68
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007576
| 0.169811
| 159
| 6
| 68
| 26.5
| 0.765152
| 0
| 0
| 0
| 0
| 0
| 0.113208
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
878732079fb88bf39d43439fbebda5f3bbaf31e8
| 137
|
py
|
Python
|
python/testData/quickFixes/RenameElementQuickFixTest/protectedMember_after.py
|
teddywest32/intellij-community
|
e0268d7a1da1d318b441001448cdd3e8929b2f29
|
[
"Apache-2.0"
] | 2
|
2018-12-29T09:53:39.000Z
|
2018-12-29T09:53:42.000Z
|
python/testData/quickFixes/RenameElementQuickFixTest/protectedMember_after.py
|
teddywest32/intellij-community
|
e0268d7a1da1d318b441001448cdd3e8929b2f29
|
[
"Apache-2.0"
] | null | null | null |
python/testData/quickFixes/RenameElementQuickFixTest/protectedMember_after.py
|
teddywest32/intellij-community
|
e0268d7a1da1d318b441001448cdd3e8929b2f29
|
[
"Apache-2.0"
] | 1
|
2020-11-27T10:36:50.000Z
|
2020-11-27T10:36:50.000Z
|
class A:
def __init__(self):
self.a = 1
def _foo(self):
pass
a_class = A()
a_class._foo()
print(a_class.a)
| 9.133333
| 23
| 0.540146
| 22
| 137
| 2.954545
| 0.409091
| 0.276923
| 0.215385
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.01087
| 0.328467
| 137
| 14
| 24
| 9.785714
| 0.695652
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0.125
| 0
| 0
| 0.375
| 0.125
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
87f057379dfe6ad11655907ca1ebe6ffd8044984
| 111
|
py
|
Python
|
banklite/services/base.py
|
mharrisb1/banklite
|
d99b224682cc13f914fdc9ba371c0f3789d90a11
|
[
"MIT"
] | 1
|
2021-09-28T17:34:11.000Z
|
2021-09-28T17:34:11.000Z
|
banklite/services/base.py
|
mharrisb1/banklite
|
d99b224682cc13f914fdc9ba371c0f3789d90a11
|
[
"MIT"
] | null | null | null |
banklite/services/base.py
|
mharrisb1/banklite
|
d99b224682cc13f914fdc9ba371c0f3789d90a11
|
[
"MIT"
] | null | null | null |
import sqlite3
class BaseService:
def __init__(self, conn: sqlite3.Connection):
self.conn = conn
| 15.857143
| 49
| 0.693694
| 13
| 111
| 5.615385
| 0.692308
| 0.219178
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.023256
| 0.225225
| 111
| 6
| 50
| 18.5
| 0.825581
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
87fbf87762acd039641ddaf0e279649716086f46
| 102
|
py
|
Python
|
test.py
|
ecrax/hexo-recover-files
|
20d09ee035feca54e2c8512b57cf73256a7e1af2
|
[
"MIT"
] | 1
|
2019-11-05T20:01:16.000Z
|
2019-11-05T20:01:16.000Z
|
test.py
|
ecrax/hexo-recover-files
|
20d09ee035feca54e2c8512b57cf73256a7e1af2
|
[
"MIT"
] | 5
|
2018-12-09T18:34:16.000Z
|
2020-10-19T13:07:40.000Z
|
test.py
|
ecrax/hexo-recover-files
|
20d09ee035feca54e2c8512b57cf73256a7e1af2
|
[
"MIT"
] | 3
|
2019-11-05T20:01:27.000Z
|
2021-09-30T19:47:02.000Z
|
import convert_html
import json
convert_html.build_file("Fitting-Polynomial-Regressions-in-Python")
| 17
| 67
| 0.843137
| 14
| 102
| 5.928571
| 0.785714
| 0.26506
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.068627
| 102
| 5
| 68
| 20.4
| 0.873684
| 0
| 0
| 0
| 0
| 0
| 0.39604
| 0.39604
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
355b2f78245bbb3c3fdf65730818a4fbe98d8c7f
| 74
|
py
|
Python
|
7 kyu/Vowel Count/Vowel Count.py
|
anthonyjatoba/codewars
|
76b0d66dd1ba76a4d136b658920cdf85fd5c4b06
|
[
"MIT"
] | null | null | null |
7 kyu/Vowel Count/Vowel Count.py
|
anthonyjatoba/codewars
|
76b0d66dd1ba76a4d136b658920cdf85fd5c4b06
|
[
"MIT"
] | null | null | null |
7 kyu/Vowel Count/Vowel Count.py
|
anthonyjatoba/codewars
|
76b0d66dd1ba76a4d136b658920cdf85fd5c4b06
|
[
"MIT"
] | null | null | null |
def getCount(inputStr):
return sum(inputStr.count(v) for v in 'aeiou')
| 37
| 50
| 0.716216
| 12
| 74
| 4.416667
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.148649
| 74
| 2
| 50
| 37
| 0.84127
| 0
| 0
| 0
| 0
| 0
| 0.066667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
35d68d8d6a1ec41494bcaa4e9c609c7ec5144ea3
| 32,345
|
py
|
Python
|
objective/metadata/datamodel.py
|
ronaldoussoren/objective.metadata
|
799408cbe696f954c96d0738bd10ea1d87c3cace
|
[
"MIT"
] | 2
|
2020-11-15T08:02:53.000Z
|
2021-11-23T04:00:39.000Z
|
objective/metadata/datamodel.py
|
ronaldoussoren/objective.metadata
|
799408cbe696f954c96d0738bd10ea1d87c3cace
|
[
"MIT"
] | 11
|
2020-07-25T19:34:23.000Z
|
2021-05-15T15:59:20.000Z
|
objective/metadata/datamodel.py
|
ronaldoussoren/objective.metadata
|
799408cbe696f954c96d0738bd10ea1d87c3cace
|
[
"MIT"
] | null | null | null |
""""
Datamodel for the metadata scanner.
This file is currently incomplete. The following needs to be added
- Add types and additional fields for exception files
- Add helper methods for extracting exception information
from the model.
- Deal with alternatives (sets of scanned files that have different
definitions, for example constants that aren't the same
for x86_64 and arm64)
"""
import json
import os
from dataclasses import dataclass, field
from typing import (
TYPE_CHECKING,
Dict,
Generic,
List,
Optional,
Set,
Tuple,
TypedDict,
TypeVar,
Union,
)
from dataclasses_json import Undefined, config, dataclass_json
from . import util
FILE_TYPE = Union[str, os.PathLike[str]]
def bytes_decode(value: Union[None, str, List[str]]) -> Optional[bytes]:
if isinstance(value, list):
# Backward compatibility with existing metadata exceptions:
# [ 32-bit, 64-bit], use only 64-bit value.
#
# To be removed when PyObjC is converted to the new tooling.
value = value[-1]
elif value is None:
return None
return value.encode("ascii")
bytes_config = config(
encoder=lambda value: None if value is None else value.decode("ascii"),
decoder=bytes_decode,
)
argdict_config = config(
encoder=lambda value: None if value is None else {str(k) for k, v in value.items()},
decoder=lambda value: None if value is None else {int(k) for k, v in value.items()},
# The field_name in existing metadata exception files needs to be changed,
# the alternative name will be removed when PyObjC is converted to the new
# tooling.
field_name="arguments",
)
T = TypeVar("T")
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class MergedInfo(Generic[T]):
"""
At a number of places information
will be different between different
CPU architectures.
This generic class is used to represent
those cases.
"""
# Value on x86_64 architecture
x86_64: T
# Value on arm64 architecture
arm64: T
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class AvailabilityInfo:
"""Information about API availability"""
# API is unavailable for some reason
unavailable: Optional[bool] = None
# Explict suggestion for unavailable APIs
suggestion: Optional[str] = None
# macOS version where the API was introduced,
# encoded in an integer (format is the same
# as the MAC_OS_VERSION_... constants)
introduced: Optional[int] = None
# macOS version where the API was deprecated,
# encoded in an integer.
deprecated: Optional[int] = None
# Explicit message with a deprecated API.
deprecated_message: Optional[str] = None
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class EnumTypeInfo:
"""Information about a C enum type"""
# Type encoding (as used by PyObjC)
typestr: bytes = field(metadata=bytes_config)
# API Availability
availability: Optional[AvailabilityInfo] = None
# True if this is a flag enum
flags: bool = False
# Used to mark APIs as ignored in exception
# files.
ignore: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class EnumInfo:
"""Information about individual enum labels"""
# Value for this enum label
value: Union[int, MergedInfo[int]]
# Name of the associated enum type
# This is optional for exception data, should
# be set otherwise!
enum_type: Optional[str] = None
# API availability
availability: Optional[AvailabilityInfo] = None
# Used to mark APIs as ignored in exception
# files.
ignore: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class StructInfo:
"""Information about a C structure"""
# Type encoding (as used by PyObjC)
typestr: bytes = field(metadata=bytes_config)
# If true the *typestr* is not the same as
# what will be seen in the ObjC Runtime.
#
# Primarily used to mark anonymous structs
# where the metadata will contain a
# generated name.
typestr_special: bool
# List of names for the struct fields
fieldnames: List[str]
# API Availability
availability: Optional[AvailabilityInfo] = None
# Used to mark APIs as ignored in exception
# files.
ignore: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class ExternInfo:
"""Information about C global variable (constants)"""
# Type encoding (as used by PyObjC)
typestr: Union[bytes, MergedInfo[bytes]] = field(metadata=bytes_config)
# Name of the type associated with *typestr*, will
# by used when there is a better type name than
# the default.
type_name: Optional[str] = None
# If true the value is a magic value. This is used with
# _C_ID values where the pointer itself is special and
# not a reference to an ObjC object.
magic_cookie: bool = False
# API Availability
availability: Optional[AvailabilityInfo] = None
# Used to mark APIs as ignored in exception
# files.
ignore: bool = False
#
# Information about callables. The data structure can represent
# functions/methods with a callback (function or block) as one
# of its arguments, where one of the arguments for the callback
# has itself an argument that is a callback.
#
# The nested callback can not have callback arguments. This is
# primarily because the tooling used does not support this without
# more code replication, and the current level of nesting is good
# enough.
#
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class CallbackArgInfo2:
"""Information about the argument of a callback to a callback"""
# Type encoding (as used by PyObjC)
typestr: bytes = field(metadata=bytes_config)
# Name of the type associated with *typestr*, will
# by used when there is a better type name than
# the default.
type_name: Optional[str] = None
# Is *NULL* and acceptable value for the C API?
# - True: yes
# - False: no
# - None: don't know (treated as True by PyObjC)
null_accepted: Optional[bool] = None
# Used with pointers to _C_ID: If *true* a value
# returned through this argument is already retained
# (caller has to call -release when it no longer
# needds the value).
already_retained: Optional[bool] = False
# Used with pointers to CoreFoundation objects.
# If *true* a value returned through this argument is
# already retained # (caller has to call CFRelease when
# it no longer needds the value).
already_cfretained: Optional[bool] = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class CallbackInfo2:
"""Information about a callback signature for a callback"""
# Information about the return value
retval: Optional[CallbackArgInfo2]
# Information about all arguments
args: List[CallbackArgInfo2]
# Is this a variadic function?
variadic: bool = False
# Which of the fixed arguments for a varidic function
# is a printf format string (if any)
printf_format: Optional[int] = None
# Does this variadic function have a number of
# arguments of the same time, ending with a NUL value
# for the type?
null_terminated: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class CallbackArgInfo:
"""Information about the argument of a callback"""
# Type encoding (as used by PyObjC)
typestr: bytes = field(metadata=bytes_config)
# True if *typestr* is not the same as the value
# in the ObjC runtime.
typestr_special: bool = False
# Name of the type associated with *typestr*, will
# by used when there is a better type name than
# the default.
type_name: Optional[str] = None
# Is *NULL* and acceptable value for the C API?
# - True: yes
# - False: no
# - None: don't know (treated as True by PyObjC)
null_accepted: Optional[bool] = None
# Used with pointers to _C_ID: If *true* a value
# returned through this argument is already retained
# (caller has to call -release when it no longer
# needds the value).
already_retained: Optional[bool] = False
# Used with pointers to CoreFoundation objects.
# If *true* a value returned through this argument is
# already retained # (caller has to call CFRelease when
# it no longer needds the value).
already_cfretained: Optional[bool] = False
# Information about the signature for a argument
# that is a block or function.
callable: Optional[CallbackInfo2] = None
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class CallbackInfo:
"""Information about a callback signature"""
# Information about the return value
retval: CallbackArgInfo
# Information about all arguments
args: List[CallbackArgInfo] = field(metadata=config(field_name="arguments"))
# Is this a variadic function?
variadic: bool = False
# Which of the fixed arguments for a varidic function
# is a printf format string (if any)
printf_format: Optional[int] = None
# Does this variadic function have a number of
# arguments of the same time, ending with a NUL value
# for the type?
null_terminated: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class ArgInfo:
"""Information about a function/method argument"""
# Type encoding (as used by PyObjC)
typestr: bytes = field(metadata=bytes_config)
# Name of the argument
name: Optional[str] = None
# True if *typestr* is not the same as the value
# in the ObjC runtime.
typestr_special: bool = False
# Name of the type associated with *typestr*, will
# by used when there is a better type name than
# the default.
type_name: Optional[str] = None
# For pointer arguments (_C_PTR) mark if the data is
# passed in (_C_IN), out (_C_OUT) or both (_C_INOUT).
type_modifier: Optional[bytes] = field(metadata=bytes_config, default=None)
# For pointer (_C_PTR) or object (_C_ID) arguments
# tell if NULL is an acceptable value for the argument in C.
null_accepted: Optional[bool] = None
# If true this argument is a printf format string for
# variadic callable.
printf_format: bool = False
# Used with pointers to _C_ID: If *true* a value
# returned through this argument is already retained
# (caller has to call -release when it no longer
# needds the value).
already_retained: Optional[bool] = False
# Used with pointers to CoreFoundation objects.
# If *true* a value returned through this argument is
# already retained # (caller has to call CFRelease when
# it no longer needds the value).
already_cfretained: Optional[bool] = False
# Signature information for a block or function argument
callable: Optional[CallbackInfo] = None
# True if the callable is stored by the called API
callable_retained: Optional[bool] = None
# If the argument is a C array with the size in another
# argument this option describes which argument contains
# the size.
# - value: The argument containing the size
# - (in_value, out_value); The *in_value*-th argument
# contains the size of the array before the call, the
# *out_value* contains the (effective) size after the call.
c_array_length_in_arg: Optional[Union[int, Tuple[int, int]]] = None
# If true the argument is a C array (with a length specified by one
# of the other options). The effective length of the array on return
# is in the return value of the function/method.
c_array_length_in_result: bool = False
# If true the argument is a C-array for which the
# required size is either not known or cannot be described
# by the metadata system.
c_array_of_variable_length: bool = False
# If true the argument is a C-array with the type-appropriated
# NUL-value at the end. Python users won't use the delimiter.
c_array_delimited_by_null: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class ArgExceptionInfo:
"""Information about a function/method argument"""
# Can there be a shared superclass with ArgInfo?
# Type encoding (as used by PyObjC)
typestr: Optional[bytes] = field(metadata=bytes_config, default=None)
# Name of the argument
name: Optional[str] = None
# Name of the type associated with *typestr*, will
# by used when there is a better type name than
# the default.
type_name: Optional[str] = None
# For pointer arguments (_C_PTR) mark if the data is
# passed in (_C_IN), out (_C_OUT) or both (_C_INOUT).
type_modifier: Optional[bytes] = field(metadata=bytes_config, default=None)
# For pointer (_C_PTR) or object (_C_ID) arguments
# tell if NULL is an acceptable value for the argument in C.
null_accepted: Optional[bool] = None
# If true this argument is a printf format string for
# variadic callable.
printf_format: bool = False
# Used with pointers to _C_ID: If *true* a value
# returned through this argument is already retained
# (caller has to call -release when it no longer
# needds the value).
already_retained: Optional[bool] = None
# Used with pointers to CoreFoundation objects.
# If *true* a value returned through this argument is
# already retained # (caller has to call CFRelease when
# it no longer needds the value).
already_cfretained: Optional[bool] = None
# Signature information for a block or function argument
callable: Optional[CallbackInfo] = None
# True if the callable is stored by the called API
callable_retained: Optional[bool] = None
# If the argument is a C array with the size in another
# argument this option describes which argument contains
# the size.
# - value: The argument containing the size
# - (in_value, out_value); The *in_value*-th argument
# contains the size of the array before the call, the
# *out_value* contains the (effective) size after the call.
c_array_length_in_arg: Optional[Union[int, Tuple[int, int]]] = None
# If true the argument is a C array (with a length specified by one
# of the other options). The effective length of the array on return
# is in the return value of the function/method.
c_array_length_in_result: Optional[bool] = None
# If true the argument is a C-array for which the
# required size is either not known or cannot be described
# by the metadata system.
c_array_of_variable_length: Optional[bool] = None
# If true the argument is a C-array with the type-appropriated
# NUL-value at the end. Python users won't use the delimiter.
c_array_delimited_by_null: Optional[bool] = None
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class ReturnInfo:
"""Information about a function/method return value"""
# Type encoding (as used by PyObjC)
typestr: bytes = field(metadata=bytes_config)
# True if *typestr* is not the same as the value
# in the ObjC runtime.
typestr_special: bool = False
# Name of the type associated with *typestr*, will
# by used when there is a better type name than
# the default.
type_name: Optional[str] = None
# For pointer (_C_PTR) or object (_C_ID) arguments
# tell if NULL is an acceptable value for the argument in C.
null_accepted: Optional[bool] = None
# Used with pointers to _C_ID: If *true* a value
# returned through this argument is already retained
# (caller has to call -release when it no longer
# needds the value).
already_retained: Optional[bool] = False
# Used with pointers to CoreFoundation objects.
# If *true* a value returned through this argument is
# already retained # (caller has to call CFRelease when
# it no longer needds the value).
already_cfretained: Optional[bool] = False
# Signature information for a block or function argument
callable: Optional[CallbackInfo] = None
# If true the argument is a C-array for which the
# required size is either not known or cannot be described
# by the metadata system.
c_array_of_variable_length: bool = False
# If true the argument is a C-array with the type-appropriated
# NUL-value at the end. Python users won't use the delimiter.
c_array_delimited_by_null: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass(frozen=True)
class ReturnExceptionInfo:
"""Information about a function/method return value"""
# Type encoding (as used by PyObjC)
typestr: Optional[bytes] = field(metadata=bytes_config, default=None)
# For pointer (_C_PTR) or object (_C_ID) arguments
# tell if NULL is an acceptable value for the argument in C.
null_accepted: Optional[bool] = None
# Used with pointers to _C_ID: If *true* a value
# returned through this argument is already retained
# (caller has to call -release when it no longer
# needds the value).
already_retained: Optional[bool] = False
# Used with pointers to CoreFoundation objects.
# If *true* a value returned through this argument is
# already retained # (caller has to call CFRelease when
# it no longer needds the value).
already_cfretained: Optional[bool] = False
# Signature information for a block or function argument
callable: Optional[CallbackInfo] = None
# If true the argument is a C-array for which the
# required size is either not known or cannot be described
# by the metadata system.
c_array_of_variable_length: Optional[bool] = None
# If true the argument is a C-array with the type-appropriated
# NUL-value at the end. Python users won't use the delimiter.
c_array_delimited_by_null: Optional[bool] = None
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class FunctionInfo:
"""Information about a function"""
# Information about the return value
retval: ReturnInfo
# Information about all arguments
args: List[ArgInfo]
# Is this an inline function?
inline: bool = False
# Is this a variadic method
variadic: bool = False
@property
def is_k_and_r(self):
""" K&R style declaration """
return self.variadic and not self.args
# Argument index for a variadic function
# that is the printf_format (if any)
printf_format: Optional[int] = None
# API Availability
availability: Optional[AvailabilityInfo] = None
# To be removed
ignore: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class FunctionExceptionInfo:
"""Exception data for a function"""
# Information about the return value
retval: Optional[ReturnExceptionInfo] = None
# Information about all arguments
args: Optional[Dict[int, ArgExceptionInfo]] = field(
default=None, metadata=argdict_config
)
# Is this an inline function?
inline: bool = False
# Is this a variadic method
variadic: bool = False
# API Availability
availability: Optional[AvailabilityInfo] = None
# Used to mark APIs as ignored in exception
# files.
ignore: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class MethodInfo:
"""Information about a method in an ObjC class or protocol"""
# Selector for the method
selector: str
# Is this a class method?
class_method: bool
# Information about the return value
retval: ReturnInfo
# Information about all arguments
args: List[ArgInfo]
# Used in protocols: is this a required method
# (maybe split into two classes?)
required: Optional[bool] = None
# Is this a variadic method
variadic: bool = False
# Argument index for a variadic function
# that is the printf_format (if any)
printf_format: Optional[int] = None
# Category that this method is defined in
# (*None* for methods in the main class
# definition)
category: Optional[str] = None
# API Availability
availability: Optional[AvailabilityInfo] = None
# Used to mark APIs as ignored in exception
# files.
# To be removed
ignore: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class MethodExceptionInfo:
"""Override Information about a method in an ObjC class or protocol"""
# Selector for the method
selector: str
# Is this a class method?
class_method: bool
# Information about the return value
retval: Optional[ReturnExceptionInfo] = None
# Information about all arguments
args: Optional[Dict[int, ArgExceptionInfo]] = field(
default=None, metadata=argdict_config
)
# Is this a variadic method
variadic: Optional[bool] = None
# Argument index for a variadic function
# that is the printf_format (if any)
printf_format: Optional[int] = None
# API Availability
availability: Optional[AvailabilityInfo] = None
# Used to mark APIs as ignored in exception
# files.
ignore: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class PropertyInfo:
"""class property"""
# Name of the property
name: str
# Type encoding (as used by PyObjC)
typestr: bytes = field(metadata=bytes_config)
# True if *typestr* is not the same as the value
# in the ObjC runtime.
typestr_special: bool
# Name of the type associated with *typestr*, will
# by used when there is a better type name than
# the default.
type_name: Optional[str] = None
# Name of getter if it is not default
getter: Optional[str] = None
# Name of setter if it is not default
setter: Optional[str] = None
# Property attributes (such as readonline, readwrite)
# ... -> should extract custom getter/setter into its
# own attribute
attributes: Set[str] = field(default_factory=util.sorted_set)
# Category that this method is defined in
# (*None* for methods in the main class
# definition)
category: Optional[str] = None
# API Availability
availability: Optional[AvailabilityInfo] = None
# Used to mark APIs as ignored in exception
# files.
ignore: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class ProtocolInfo:
"""Objective-C protocol, or deduced informal protocol (category)"""
# List of names for protocols this protocol
# implements (subclassing for protocols)
implements: List[str]
# List of methods in this protocol
methods: List[MethodInfo]
# List of properties in this protocol
properties: List[PropertyInfo]
# API Availability
availability: Optional[AvailabilityInfo] = None
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class ClassInfo:
"""Objective-C class"""
# Superclass for this class.
# This will be *None* in two cases:
# - Root classes (NSObject/NSProxy)
# - Categories on classes defined in another framework
super: Optional[str]
# List of names for protocols this protocol
# implements (subclassing for protocols)
implements: List[str] = field(metadata=config(field_name="protocols"))
# List of methods in this protocol
methods: List[MethodInfo]
# List of properties in this protocol
properties: List[PropertyInfo]
# API Availability
availability: Optional[AvailabilityInfo] = None
final: bool = False
# Categories defined on this class
categories: Set[str] = field(default_factory=util.sorted_set)
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class ClassExceptionInfo:
"""Objective-C class"""
# Superclass for this class.
# This will be *None* in two cases:
# - Root classes (NSObject/NSProxy)
# - Categories on classes defined in another framework
super: Optional[str]
# List of names for protocols this protocol
# implements (subclassing for protocols)
implements: List[str] = field(metadata=config(field_name="protocols"))
# List of methods in this protocol
methods: List[MethodExceptionInfo] = field(default_factory=list)
# List of properties in this protocol
properties: List[PropertyInfo] = field(default_factory=list)
# API Availability
availability: Optional[AvailabilityInfo] = None
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class CFTypeInfo:
"""Information about a CoreFoundation type"""
# Type encoding (as used by PyObjC)
typestr: bytes = field(metadata=bytes_config)
# Name of the ...GetTypeID function for this CFType
# (can be None when autodetection fails)
gettypeid_func: Optional[str] = None
# Name of the ObjC class this type is tollfree bridged to.
tollfree: Optional[str] = None
# Used in exception information
# Need to investigate why this is needed, should not happen!
opaque: Optional[bool] = None
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class LiteralInfo:
"""Named literals other than enums"""
# Value of the literal
value: Union[None, int, float, str, MergedInfo[Union[None, int, float, str]]]
# False if this "str" represents a byte literal
unicode: Optional[bool] = False
# API Availability
availability: Optional[AvailabilityInfo] = None
# For exception information: ignore this declaration
ignore: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class AliasInfo:
"""Name that aliases another name"""
# What this name is an alias for
alias: str
# If this is an alias for an item in a named
# enum this field contains that name.
enum_type: Optional[str] = None
# API Availability
availability: Optional[AvailabilityInfo] = None
# Used to mark APIs as ignored in exception
# files.
ignore: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class ExpressionInfo:
"""A C define that evaluates to a constant expression"""
# The expression
expression: str
# API Availability
availability: Optional[AvailabilityInfo] = None
# Used to mark APIs as ignored in exception
# files.
ignore: bool = False
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class FunctionMacroInfo:
"""
A C define with parameters that can be evaluated as a Python function
"""
# String that evaluates to the function
definition: str
# API Availability
availability: Optional[AvailabilityInfo] = None
# To be removed
ignore: bool = False
class FUNCTION_MACRO_UPDATE_DICT(TypedDict, total=False):
definition: str
availability: AvailabilityInfo
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class FunctionMacroExceptionInfo:
"""
A C define with parameters that can be evaluated as a Python function
"""
# String that evaluates to the function
definition: Optional[str]
# API Availability
availability: Optional[AvailabilityInfo] = None
# Used to mark APIs as ignored in exception
# files.
ignore: bool = False
def exception_info(self) -> FUNCTION_MACRO_UPDATE_DICT:
result: FUNCTION_MACRO_UPDATE_DICT = {}
if self.definition is not None:
result["definition"] = self.definition
if self.availability is not None:
result["availability"] = self.availability
return result
@dataclass_json(undefined=Undefined.RAISE)
@dataclass
class FrameworkMetadata:
architectures: Set[str] = field(default_factory=util.sorted_set)
sdk_version: Optional[str] = None
enum_type: Dict[str, EnumTypeInfo] = field(default_factory=dict)
enum: Dict[str, EnumInfo] = field(default_factory=dict)
structs: Dict[str, StructInfo] = field(default_factory=dict)
externs: Dict[str, ExternInfo] = field(default_factory=dict)
cftypes: Dict[str, CFTypeInfo] = field(default_factory=dict)
literals: Dict[str, LiteralInfo] = field(default_factory=dict)
formal_protocols: Dict[str, ProtocolInfo] = field(default_factory=dict)
informal_protocols: Dict[str, ProtocolInfo] = field(default_factory=dict)
classes: Dict[str, ClassInfo] = field(default_factory=dict)
aliases: Dict[str, AliasInfo] = field(default_factory=dict)
expressions: Dict[str, ExpressionInfo] = field(default_factory=dict)
func_macros: Dict[str, FunctionMacroInfo] = field(default_factory=dict)
functions: Dict[str, FunctionInfo] = field(default_factory=dict)
@classmethod
def from_file(cls, path: FILE_TYPE) -> "FrameworkMetadata":
with open(path, "r") as stream:
raw_data = stream.read()
# Strip optional leading comment block
while raw_data.startswith("//"):
_, _, raw_data = raw_data.partition("\n")
data = json.loads(raw_data)
del raw_data
return FrameworkMetadata.from_dict(data["definitions"])
def to_file(self, path: FILE_TYPE) -> None:
data = self.to_dict()
with open(path, "w") as stream:
json.dump({"definitions": data}, stream)
if TYPE_CHECKING:
# Dataclasses_json adds (amongst others) methods from_dict and
# to_dict which mypy doesn't know about.
#
# The declaration below teach the typechecker about these methods.
@classmethod
def from_dict(cls, value: dict) -> "FrameworkMetadata":
...
def to_dict(self) -> dict:
...
@dataclass_json
@dataclass
class ExceptionData:
"""
Exceptions data
This is work in progress, at least some of the dataclasses
should have variants for the exception file (required field
in regular file, optional in exception file; likewise for the
'ignored' field which is only used in exception data)
"""
enum_type: Dict[str, EnumTypeInfo] = field(default_factory=dict)
enum: Dict[str, EnumInfo] = field(default_factory=dict)
# structs: Dict[str, StructInfo] = field(default_factory=dict)
externs: Dict[str, ExternInfo] = field(default_factory=dict)
# cftypes: Dict[str, CFTypeInfo] = field(default_factory=dict)
literals: Dict[str, LiteralInfo] = field(default_factory=dict)
# formal_protocols: Dict[str, ProtocolInfo] = field(default_factory=dict)
# informal_protocols: Dict[str, ProtocolInfo] = field(default_factory=dict)
# classes: Dict[str, ClassExceptionInfo] = field(default_factory=dict)
aliases: Dict[str, AliasInfo] = field(default_factory=dict)
expressions: Dict[str, ExpressionInfo] = field(default_factory=dict)
func_macros: Dict[str, FunctionMacroExceptionInfo] = field(default_factory=dict)
functions: Dict[str, FunctionExceptionInfo] = field(default_factory=dict)
@classmethod
def from_file(cls, path: FILE_TYPE) -> "ExceptionData":
with open(path, "r") as stream:
raw_data = stream.read()
# Strip optional leading comment block
while raw_data.startswith("//"):
_, _, raw_data = raw_data.partition("\n")
data = json.loads(raw_data)
del raw_data
if "formal_protocols" in data["definitions"]:
del data["definitions"]["formal_protocols"]
if "informal_protocols" in data["definitions"]:
del data["definitions"]["informal_protocols"]
if "cftypes" in data["definitions"]:
del data["definitions"]["cftypes"]
return ExceptionData.from_dict(data["definitions"], infer_missing=True)
def to_file(self, path: FILE_TYPE) -> None:
data = self.to_dict()
with open(path, "w") as stream:
json.dump({"definitions": data}, stream)
if TYPE_CHECKING:
# Dataclasses_json adds (amongst others) methods from_dict and
# to_dict which mypy doesn't know about.
#
# The declaration below teach the typechecker about these methods.
@classmethod
def from_dict(cls, value: dict, infer_missing: bool = False) -> "ExceptionData":
...
def to_dict(self) -> dict:
...
| 30.571834
| 88
| 0.696089
| 4,251
| 32,345
| 5.220889
| 0.106563
| 0.019465
| 0.026539
| 0.040506
| 0.771335
| 0.761287
| 0.745517
| 0.72015
| 0.705326
| 0.700099
| 0
| 0.001199
| 0.226341
| 32,345
| 1,057
| 89
| 30.600757
| 0.88571
| 0.474138
| 0
| 0.624339
| 0
| 0
| 0.020278
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.029101
| false
| 0
| 0.015873
| 0
| 0.65873
| 0.018519
| 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
|
ea150c16d6654306f46761e12d203f0728e7c7de
| 34
|
py
|
Python
|
ckg/report_manager/__init__.py
|
igg-bioinfo/CKG
|
7984ae239c5010545b95c9be3201a899682294de
|
[
"MIT"
] | 189
|
2020-05-11T16:26:39.000Z
|
2022-03-30T08:24:37.000Z
|
ckg/report_manager/__init__.py
|
igg-bioinfo/CKG
|
7984ae239c5010545b95c9be3201a899682294de
|
[
"MIT"
] | 51
|
2020-05-12T04:24:28.000Z
|
2022-03-30T10:51:55.000Z
|
ckg/report_manager/__init__.py
|
igg-bioinfo/CKG
|
7984ae239c5010545b95c9be3201a899682294de
|
[
"MIT"
] | 44
|
2020-05-13T09:53:21.000Z
|
2022-03-27T08:43:53.000Z
|
#This is just an empty directory
| 11.333333
| 32
| 0.764706
| 6
| 34
| 4.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.205882
| 34
| 2
| 33
| 17
| 0.962963
| 0.911765
| 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
|
ea1a270da507b384a6f136a99cfaf7d632154b44
| 8,183
|
py
|
Python
|
tests/test_hilbertcurve.py
|
binfnstats/hilbertcurve
|
6599899ee2156fe7833b15447325f330cf5b8113
|
[
"MIT"
] | 129
|
2019-03-10T22:01:18.000Z
|
2022-02-24T18:04:28.000Z
|
tests/test_hilbertcurve.py
|
binfnstats/hilbertcurve
|
6599899ee2156fe7833b15447325f330cf5b8113
|
[
"MIT"
] | 12
|
2019-03-03T18:08:11.000Z
|
2022-03-13T03:39:25.000Z
|
tests/test_hilbertcurve.py
|
galtay/hilbert_curve
|
6599899ee2156fe7833b15447325f330cf5b8113
|
[
"MIT"
] | 19
|
2015-11-08T19:48:05.000Z
|
2018-11-21T14:40:08.000Z
|
"""Test the functions in hilbert.py"""
import pytest
import unittest
import numpy as np
from hilbertcurve.hilbertcurve import HilbertCurve
class TestHilbertIntegerToTranspose(unittest.TestCase):
"""Test hilbert_integer_to_transpose."""
def test_10590(self):
"""Assert that a 15 bit hilber integer is correctly transposed into
a 3-d vector ...
ABCDEFGHIJKLMNO
10590 (0b010100101011110)
ADGJM
X[0] = 0b01101 = 13
BEHKN
X[1] = 0b10011 = 19
CFILO
X[2] = 0b00110 = 6
"""
p = 5
n = 3
hilbert_curve = HilbertCurve(p, n)
h = 10590
expected_x = [13, 19, 6]
actual_x = hilbert_curve._hilbert_integer_to_transpose(h)
self.assertEqual(actual_x, expected_x)
class TestTransposeToHilbertInteger(unittest.TestCase):
"""Test _transpose_to_hilbert_integer."""
def test_13_19_6(self):
"""Assert that a 15 bit hilber integer is correctly recovered from its
transposed 3-d vector ...
ABCDEFGHIJKLMNO
10590 (0b010100101011110)
ADGJM
X[0] = 0b01101 = 13
BEHKN
X[1] = 0b10011 = 19
CFILO
X[2] = 0b00110 = 6
"""
p = 5
n = 3
hilbert_curve = HilbertCurve(p, n)
x = [13, 19, 6]
expected_h = 10590
actual_h = hilbert_curve._transpose_to_hilbert_integer(x)
self.assertEqual(actual_h, expected_h)
class TestReversibility(unittest.TestCase):
"""Test that transpose2axes and axes2transpose are consistent."""
def test_reversibility(self):
"""Assert points_from_distances and distances_from_points
are inverse operations."""
n = 3
p = 5
hilbert_curve = HilbertCurve(p, n)
n_h = 2**(n * p)
distances = list(range(n_h))
coordinates = hilbert_curve.points_from_distances(distances)
distances_check = hilbert_curve.distances_from_points(coordinates)
for dist, dist_check in zip(distances, distances_check):
self.assertEqual(dist, dist_check)
class TestInitIntConversion(unittest.TestCase):
"""Test __init__ conversion of floating point to integers."""
def test_pt_oh(self):
"""Assert x.0 goes to x"""
n = 3.0
n_int = 3
p = 5
hilbert_curve = HilbertCurve(p, n)
self.assertTrue(isinstance(hilbert_curve.n, int))
self.assertEqual(hilbert_curve.n, n_int)
n = 3
p_int = 5
p = 5.0
hilbert_curve = HilbertCurve(p, n)
self.assertTrue(isinstance(hilbert_curve.p, int))
self.assertEqual(hilbert_curve.p, p_int)
def test_pt_one(self):
"""Assert x.1 raises an error"""
n = 3
p = 5.1
with pytest.raises(TypeError):
hilbert_curve = HilbertCurve(p, n)
n = 3.1
p = 5
with pytest.raises(TypeError):
hilbert_curve = HilbertCurve(p, n)
class TestInitBounds(unittest.TestCase):
"""Test __init__ bounds on n and p."""
def test_pt_one(self):
"""Assert x=0 raises an error"""
n = 0
p = 5
with pytest.raises(ValueError):
hilbert_curve = HilbertCurve(p, n)
n = 3
p = 0
with pytest.raises(ValueError):
hilbert_curve = HilbertCurve(p, n)
class TestInitUnmodified(unittest.TestCase):
"""Test distances_from_points does not modify input."""
def test_base(self):
"""Assert list is unmodified"""
n = 4
p = 8
hilbert_curve = HilbertCurve(p, n)
x = [[1, 5, 3, 19]]
x_in = list(x)
h = hilbert_curve.distances_from_points(x_in)
self.assertEqual(x, x_in)
class TestTypeMatch(unittest.TestCase):
"""Test match_type kwarg"""
def test_points_from_distances_list(self):
"""Assert list type matching works in points_from_distances"""
n = 2
p = 3
hilbert_curve = HilbertCurve(p, n)
dists = list(np.arange(hilbert_curve.max_h + 1))
points = hilbert_curve.points_from_distances(dists, match_type=True)
target_type = type(dists)
self.assertTrue(isinstance(points, target_type))
self.assertTrue(
all(isinstance(vec, target_type) for vec in points)
)
def test_points_from_distances_tuple(self):
"""Assert tuple type matching works in points_from_distances"""
n = 2
p = 3
hilbert_curve = HilbertCurve(p, n)
dists = tuple(np.arange(hilbert_curve.max_h + 1))
points = hilbert_curve.points_from_distances(dists, match_type=True)
target_type = type(dists)
self.assertTrue(isinstance(points, target_type))
self.assertTrue(
all(isinstance(vec, target_type) for vec in points)
)
def test_points_from_distances_ndarray(self):
"""Assert tuple type matching works in points_from_distances"""
n = 2
p = 3
hilbert_curve = HilbertCurve(p, n)
dists = np.arange(hilbert_curve.max_h + 1)
points = hilbert_curve.points_from_distances(dists, match_type=True)
target_type = type(dists)
self.assertTrue(isinstance(points, target_type))
self.assertTrue(
all(isinstance(vec, target_type) for vec in points)
)
def test_distances_from_points_list(self):
"""Assert list type matching works in distances_from_points"""
n = 2
p = 3
hilbert_curve = HilbertCurve(p, n)
points = [
[0,0],
[7,7],
]
distances = hilbert_curve.distances_from_points(points, match_type=True)
target_type = type(points)
self.assertTrue(isinstance(distances, target_type))
def test_distances_from_points_tuple(self):
"""Assert tuple type matching works in distances_from_points"""
n = 2
p = 3
hilbert_curve = HilbertCurve(p, n)
points = tuple([
tuple([0,0]),
tuple([7,7]),
])
distances = hilbert_curve.distances_from_points(points, match_type=True)
target_type = type(points)
self.assertTrue(isinstance(distances, target_type))
def test_distances_from_points_ndarray(self):
"""Assert ndarray type matching works in distances_from_points"""
n = 2
p = 3
hilbert_curve = HilbertCurve(p, n)
points = np.array([
[0,0],
[7,7],
])
distances = hilbert_curve.distances_from_points(points, match_type=True)
target_type = type(points)
self.assertTrue(isinstance(distances, target_type))
class TestInitIntConversion(unittest.TestCase):
"""Test __init__ conversion of floating point to integers."""
def test_pt_oh(self):
"""Assert x.0 goes to x"""
n = 3.0
n_int = 3
p = 5
hilbert_curve = HilbertCurve(p, n)
self.assertTrue(isinstance(hilbert_curve.n, int))
self.assertEqual(hilbert_curve.n, n_int)
n = 3
p_int = 5
p = 5.0
hilbert_curve = HilbertCurve(p, n)
self.assertTrue(isinstance(hilbert_curve.p, int))
self.assertEqual(hilbert_curve.p, p_int)
def test_pt_one(self):
"""Assert x.1 raises an error"""
n = 3
p = 5.1
with pytest.raises(TypeError):
hilbert_curve = HilbertCurve(p, n)
n = 3.1
p = 5
with pytest.raises(TypeError):
hilbert_curve = HilbertCurve(p, n)
class TestInitBounds(unittest.TestCase):
"""Test __init__ bounds on n and p."""
def test_pt_one(self):
"""Assert x=0 raises an error"""
n = 0
p = 5
with pytest.raises(ValueError):
hilbert_curve = HilbertCurve(p, n)
n = 3
p = 0
with pytest.raises(ValueError):
hilbert_curve = HilbertCurve(p, n)
if __name__ == '__main__':
unittest.main()
| 30.533582
| 80
| 0.593059
| 991
| 8,183
| 4.684157
| 0.133199
| 0.113744
| 0.113744
| 0.118483
| 0.754201
| 0.724472
| 0.717148
| 0.717148
| 0.69776
| 0.69776
| 0
| 0.038182
| 0.311866
| 8,183
| 267
| 81
| 30.64794
| 0.786184
| 0.194305
| 0
| 0.700565
| 0
| 0
| 0.001271
| 0
| 0
| 0
| 0
| 0
| 0.118644
| 1
| 0.090395
| false
| 0
| 0.022599
| 0
| 0.163842
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
ea2edeaa95f50fa7cad47eb83a8c5f2533e1c2b1
| 555
|
py
|
Python
|
tests/test_07_end_to_end/conftest.py
|
primal100/aionetworking
|
a29cbb022cbae1a4ad1c3d44327e9d0b0c930227
|
[
"MIT"
] | null | null | null |
tests/test_07_end_to_end/conftest.py
|
primal100/aionetworking
|
a29cbb022cbae1a4ad1c3d44327e9d0b0c930227
|
[
"MIT"
] | 1
|
2018-12-23T00:50:33.000Z
|
2018-12-23T00:50:33.000Z
|
tests/test_07_end_to_end/conftest.py
|
primal100/aionetworking
|
a29cbb022cbae1a4ad1c3d44327e9d0b0c930227
|
[
"MIT"
] | null | null | null |
from tests.test_06_senders.conftest import *
import pytest
from aionetworking.formats.contrib.json import JSONObject
@pytest.fixture
def echo_exception_response_encoded() -> bytes:
return b'{"id": 2, "error": "InvalidRequestError"}'
@pytest.fixture
def echo_exception_response() -> dict:
return {'id': 2, 'error': 'InvalidRequestError'}
@pytest.fixture
def echo_exception_response_object(echo_exception_response_encoded, echo_exception_response) -> JSONObject:
return JSONObject(echo_exception_response_encoded, echo_exception_response)
| 29.210526
| 107
| 0.798198
| 66
| 555
| 6.409091
| 0.424242
| 0.21513
| 0.347518
| 0.141844
| 0.621749
| 0.621749
| 0.534279
| 0.3026
| 0.3026
| 0.3026
| 0
| 0.008032
| 0.102703
| 555
| 18
| 108
| 30.833333
| 0.841365
| 0
| 0
| 0.25
| 0
| 0
| 0.120721
| 0.03964
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 0.75
| 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
|
ea898b485b0efc642f4f48aea338018daf8ca642
| 39
|
py
|
Python
|
AtC_Gra_Con_001-010/AGC001/C.py
|
yosho-18/AtCoder
|
50f6d5c92a01792552c31ac912ce1cd557b06fb0
|
[
"MIT"
] | null | null | null |
AtC_Gra_Con_001-010/AGC001/C.py
|
yosho-18/AtCoder
|
50f6d5c92a01792552c31ac912ce1cd557b06fb0
|
[
"MIT"
] | null | null | null |
AtC_Gra_Con_001-010/AGC001/C.py
|
yosho-18/AtCoder
|
50f6d5c92a01792552c31ac912ce1cd557b06fb0
|
[
"MIT"
] | null | null | null |
print("Yes" if (True|False) else "No")
| 19.5
| 38
| 0.641026
| 7
| 39
| 3.571429
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.128205
| 39
| 1
| 39
| 39
| 0.735294
| 0
| 0
| 0
| 0
| 0
| 0.128205
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
575d82504efcdc7feac7686d860ba8c82a642669
| 183
|
py
|
Python
|
viberio/types/requests/seen_request.py
|
vorlov-bash/viberio
|
8bea3bb4f39f68e9b83f1d1876d293b641ee6a06
|
[
"MIT"
] | 18
|
2019-02-20T15:24:21.000Z
|
2022-03-24T12:48:30.000Z
|
viberio/types/requests/seen_request.py
|
vorlov-bash/viberio
|
8bea3bb4f39f68e9b83f1d1876d293b641ee6a06
|
[
"MIT"
] | null | null | null |
viberio/types/requests/seen_request.py
|
vorlov-bash/viberio
|
8bea3bb4f39f68e9b83f1d1876d293b641ee6a06
|
[
"MIT"
] | 10
|
2019-04-05T17:09:03.000Z
|
2021-09-17T17:17:08.000Z
|
import attr
from viberio.types.requests import ViberReqestObject
@attr.s
class ViberSeenRequest(ViberReqestObject):
message_token: int = attr.ib()
user_id: str = attr.ib()
| 18.3
| 52
| 0.754098
| 23
| 183
| 5.913043
| 0.73913
| 0.088235
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.153005
| 183
| 9
| 53
| 20.333333
| 0.877419
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.833333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
576a0c3fe5b7d8dc4550313c920a489973592447
| 3,381
|
py
|
Python
|
test/contrib/train/test_gcmc_dataset.py
|
hirosassa/redshells
|
7824381a7d1f042405014b4572a5d5824338fc74
|
[
"MIT"
] | 42
|
2019-01-02T01:31:39.000Z
|
2022-01-29T08:56:12.000Z
|
test/contrib/train/test_gcmc_dataset.py
|
hirosassa/redshells
|
7824381a7d1f042405014b4572a5d5824338fc74
|
[
"MIT"
] | 29
|
2019-03-28T02:33:01.000Z
|
2021-09-27T00:45:25.000Z
|
test/contrib/train/test_gcmc_dataset.py
|
hirosassa/redshells
|
7824381a7d1f042405014b4572a5d5824338fc74
|
[
"MIT"
] | 17
|
2019-02-21T03:08:20.000Z
|
2022-02-17T23:27:48.000Z
|
import unittest
from logging import getLogger
import numpy as np
from redshells.contrib.model.gcmc_dataset import GcmcDataset
from redshells.contrib.model.graph_convolutional_matrix_completion import GcmcGraphDataset
logger = getLogger(__name__)
class TestGCMCDataset(unittest.TestCase):
def test_without_information(self):
user_ids = np.array([1, 1, 2, 2, 2])
item_ids = np.array([1, 2, 1, 2, 3])
ratings = np.array([1, 0, 1, 0, 1])
rating_data = GcmcDataset(user_ids=user_ids, item_ids=item_ids, ratings=ratings)
test_size = 0.0
dataset = GcmcGraphDataset(rating_data, test_size)
data = dataset.train_data()
self.assertEqual(user_ids.shape, data['user'].shape)
self.assertEqual(item_ids.shape, data['item'].shape)
self.assertEqual((ratings.shape[0], 2), data['label'].shape)
self.assertEqual(ratings.shape, data['rating'].shape)
self.assertEqual(user_ids.shape, data['user_feature_indices'].shape)
self.assertEqual(item_ids.shape, data['item_feature_indices'].shape)
def test_with_information(self):
user_ids = np.array([1, 1, 2, 2, 2])
item_ids = np.array([1, 2, 1, 2, 3])
ratings = np.array([1, 0, 1, 0, 1])
test_size = 0.0
user_features = [{1: np.array([10, 11]), 2: np.array([20, 21])}]
item_features = [{1: np.array([10, 11, 12]), 2: np.array([20, 21, 22]), 3: np.array([30, 31, 32])}]
dataset = GcmcDataset(user_ids=user_ids, item_ids=item_ids, ratings=ratings, user_features=user_features, item_features=item_features)
graph_dataset = GcmcGraphDataset(dataset, test_size)
data = graph_dataset.train_data()
self.assertEqual(user_ids.shape, data['user'].shape)
self.assertEqual(item_ids.shape, data['item'].shape)
self.assertEqual((ratings.shape[0], 2), data['label'].shape)
self.assertEqual(ratings.shape, data['rating'].shape)
self.assertEqual(user_ids.shape, data['user_feature_indices'].shape)
self.assertEqual(item_ids.shape, data['item_feature_indices'].shape)
def test_with_click_threshold(self):
user_ids = np.array([1, 1, 2, 2, 2, 3])
item_ids = np.array([1, 2, 1, 2, 3, 1])
ratings = np.array([1, 0, 1, 0, 1, 0])
test_size = 0.0
user_features = [{1: np.array([10, 11]), 2: np.array([20, 21]), 3: np.array([30, 31])}]
item_features = [{1: np.array([10, 11, 12]), 2: np.array([20, 21, 22]), 3: np.array([30, 31, 32])}]
dataset = GcmcDataset(user_ids=user_ids, item_ids=item_ids, ratings=ratings, user_features=user_features, item_features=item_features)
graph_dataset = GcmcGraphDataset(dataset, test_size, min_user_click_count=3)
np.testing.assert_almost_equal([0, 0, 1, 1, 1, 0], graph_dataset._user.indices)
np.testing.assert_almost_equal([1, 2, 1, 2, 3, 1], graph_dataset._item.indices)
data = graph_dataset.train_data()
self.assertEqual(item_ids.shape, graph_dataset._item.indices.shape)
self.assertEqual((ratings.shape[0], 2), data['label'].shape)
self.assertEqual(ratings.shape, data['rating'].shape)
self.assertEqual(user_ids.shape, data['user_feature_indices'].shape)
self.assertEqual(item_ids.shape, data['item_feature_indices'].shape)
if __name__ == '__main__':
unittest.main()
| 51.227273
| 142
| 0.664892
| 488
| 3,381
| 4.393443
| 0.139344
| 0.065299
| 0.130597
| 0.030784
| 0.788246
| 0.752799
| 0.749534
| 0.726679
| 0.717817
| 0.708955
| 0
| 0.050798
| 0.184857
| 3,381
| 65
| 143
| 52.015385
| 0.727141
| 0
| 0
| 0.553571
| 0
| 0
| 0.052351
| 0
| 0
| 0
| 0
| 0
| 0.339286
| 1
| 0.053571
| false
| 0
| 0.089286
| 0
| 0.160714
| 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
|
57a8b542e671291b0e80e91e4b98cc123a9bbdc9
| 51
|
py
|
Python
|
python/testData/resolve/InnerFuncVar.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 2
|
2019-04-28T07:48:50.000Z
|
2020-12-11T14:18:08.000Z
|
python/testData/resolve/InnerFuncVar.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 173
|
2018-07-05T13:59:39.000Z
|
2018-08-09T01:12:03.000Z
|
python/testData/resolve/InnerFuncVar.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 2
|
2020-03-15T08:57:37.000Z
|
2020-04-07T04:48:14.000Z
|
def f1():
foo = 1
def f2():
return f<ref>oo
| 12.75
| 19
| 0.509804
| 10
| 51
| 2.6
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.085714
| 0.313725
| 51
| 4
| 19
| 12.75
| 0.657143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.25
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
57d7857179f2e84e738fd6577a396d3e3eb97702
| 61
|
py
|
Python
|
cls2det/utils/__init__.py
|
Media-Smart/cls2det
|
2e0eaeec0a74edfe6946ebb6bc1df8a17a8e478a
|
[
"Apache-2.0"
] | 22
|
2020-06-11T07:00:02.000Z
|
2020-12-14T15:20:59.000Z
|
cls2det/utils/__init__.py
|
Media-Smart/cls2det
|
2e0eaeec0a74edfe6946ebb6bc1df8a17a8e478a
|
[
"Apache-2.0"
] | null | null | null |
cls2det/utils/__init__.py
|
Media-Smart/cls2det
|
2e0eaeec0a74edfe6946ebb6bc1df8a17a8e478a
|
[
"Apache-2.0"
] | 4
|
2020-10-22T05:49:01.000Z
|
2021-12-18T22:57:54.000Z
|
from .config import Config
from .eval_coco import COCOeval
| 20.333333
| 32
| 0.803279
| 9
| 61
| 5.333333
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.163934
| 61
| 2
| 33
| 30.5
| 0.941176
| 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
|
57e4badd97a2191740da4d29e3b8ae498ff8a1d0
| 97
|
py
|
Python
|
bayonet/__init__.py
|
Bayonet-Client/bayonet-python
|
4d1e44c8f7f1bb85971481bcf319a4ee0604b609
|
[
"MIT"
] | 1
|
2022-03-28T15:08:47.000Z
|
2022-03-28T15:08:47.000Z
|
bayonet/__init__.py
|
Bayonet-Client/bayonet-python
|
4d1e44c8f7f1bb85971481bcf319a4ee0604b609
|
[
"MIT"
] | null | null | null |
bayonet/__init__.py
|
Bayonet-Client/bayonet-python
|
4d1e44c8f7f1bb85971481bcf319a4ee0604b609
|
[
"MIT"
] | null | null | null |
from .bayonet import BayonetClient
from .exceptions import BayonetError, InvalidClientSetupError
| 32.333333
| 61
| 0.876289
| 9
| 97
| 9.444444
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.092784
| 97
| 2
| 62
| 48.5
| 0.965909
| 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
|
57fc66ae4d38898c681aed3c62c534311b378945
| 44
|
py
|
Python
|
000403StepPyThin/000403_02_05_Task03_Lists_v02_Stepik_20200223.py
|
SafonovMikhail/python_000577
|
739f764e80f1ca354386f00b8e9db1df8c96531d
|
[
"Apache-2.0"
] | null | null | null |
000403StepPyThin/000403_02_05_Task03_Lists_v02_Stepik_20200223.py
|
SafonovMikhail/python_000577
|
739f764e80f1ca354386f00b8e9db1df8c96531d
|
[
"Apache-2.0"
] | null | null | null |
000403StepPyThin/000403_02_05_Task03_Lists_v02_Stepik_20200223.py
|
SafonovMikhail/python_000577
|
739f764e80f1ca354386f00b8e9db1df8c96531d
|
[
"Apache-2.0"
] | null | null | null |
print(sum(int(i) for i in input().split()))
| 22
| 43
| 0.636364
| 9
| 44
| 3.111111
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.113636
| 44
| 1
| 44
| 44
| 0.717949
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
17dd56dba05a23d70f3cf46848269359903d5449
| 215
|
py
|
Python
|
akika_venv/lib/python3.6/site-packages/django_seo_js/templatetags/django_seo_js.py
|
laetitia123/akikatest
|
812f26155b6e3d003ac7e48c08c16df406e11086
|
[
"MIT"
] | 183
|
2015-01-02T09:02:21.000Z
|
2022-02-24T05:09:08.000Z
|
akika_venv/lib/python3.6/site-packages/django_seo_js/templatetags/django_seo_js.py
|
laetitia123/akikatest
|
812f26155b6e3d003ac7e48c08c16df406e11086
|
[
"MIT"
] | 31
|
2015-02-03T21:15:53.000Z
|
2022-03-22T15:07:01.000Z
|
akika_venv/lib/python3.6/site-packages/django_seo_js/templatetags/django_seo_js.py
|
laetitia123/akikatest
|
812f26155b6e3d003ac7e48c08c16df406e11086
|
[
"MIT"
] | 55
|
2015-02-03T04:00:55.000Z
|
2022-02-24T05:09:10.000Z
|
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def seo_js_head(*args):
return mark_safe("""<meta name="fragment" content="!">""")
| 21.5
| 62
| 0.748837
| 29
| 215
| 5.37931
| 0.758621
| 0.128205
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116279
| 215
| 9
| 63
| 23.888889
| 0.821053
| 0
| 0
| 0
| 0
| 0
| 0.15814
| 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
|
17ed7bf6db6f082c4acf28a7ed3741a338d07ec8
| 86
|
py
|
Python
|
phash/__init__.py
|
vkulikov/python-phash
|
c61c955c76ec9e987ead86318cff72a5f6a1fbae
|
[
"CC0-1.0"
] | 14
|
2015-02-23T14:17:24.000Z
|
2021-12-17T17:48:38.000Z
|
phash/__init__.py
|
vkulikov/python-phash
|
c61c955c76ec9e987ead86318cff72a5f6a1fbae
|
[
"CC0-1.0"
] | 8
|
2015-07-09T15:07:50.000Z
|
2020-09-25T10:15:36.000Z
|
phash/__init__.py
|
vkulikov/python-phash
|
c61c955c76ec9e987ead86318cff72a5f6a1fbae
|
[
"CC0-1.0"
] | 15
|
2015-01-08T19:41:45.000Z
|
2019-05-23T11:39:11.000Z
|
# encoding: utf-8
from __future__ import absolute_import
from .phash_ctypes import *
| 17.2
| 38
| 0.802326
| 12
| 86
| 5.25
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013514
| 0.139535
| 86
| 4
| 39
| 21.5
| 0.837838
| 0.174419
| 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
|
aa04c5c882ae862c8f69d34dd5b1460ca1800a20
| 1,274
|
py
|
Python
|
envi/interactive.py
|
rnui2k/vivisect
|
b7b00f2d03defef28b4b8c912e3a8016e956c5f7
|
[
"ECL-2.0",
"Apache-2.0"
] | 16
|
2015-12-10T06:18:16.000Z
|
2021-09-11T21:42:16.000Z
|
envi/interactive.py
|
rnui2k/vivisect
|
b7b00f2d03defef28b4b8c912e3a8016e956c5f7
|
[
"ECL-2.0",
"Apache-2.0"
] | 5
|
2018-10-12T21:07:24.000Z
|
2018-10-12T21:08:49.000Z
|
envi/interactive.py
|
rnui2k/vivisect
|
b7b00f2d03defef28b4b8c912e3a8016e956c5f7
|
[
"ECL-2.0",
"Apache-2.0"
] | 6
|
2016-03-20T11:15:51.000Z
|
2021-08-06T07:32:42.000Z
|
def dbg_interact(lcls, gbls):
intro = "Let's interact!"
try:
import IPython.Shell
ipsh = IPython.Shell.IPShell(argv=[''], user_ns=lcls, user_global_ns=gbls)
print(intro)
ipsh.mainloop()
except ImportError as e:
try:
from IPython.terminal.interactiveshell import TerminalInteractiveShell
ipsh = TerminalInteractiveShell()
ipsh.user_global_ns.update(gbls)
ipsh.user_global_ns.update(lcls)
ipsh.autocall = 2 # don't require parenthesis around *everything*. be smart!
print(intro)
ipsh.mainloop()
except ImportError as e:
try:
from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
ipsh = TerminalInteractiveShell()
ipsh.user_global_ns.update(gbls)
ipsh.user_global_ns.update(lcls)
ipsh.autocall = 2 # don't require parenthesis around *everything*. be smart!
print(intro)
ipsh.mainloop()
except ImportError as e:
print(e)
shell = code.InteractiveConsole(gbls)
print(intro)
shell.interact()
| 35.388889
| 99
| 0.573783
| 124
| 1,274
| 5.798387
| 0.33871
| 0.069541
| 0.083449
| 0.089013
| 0.748261
| 0.748261
| 0.748261
| 0.748261
| 0.748261
| 0.748261
| 0
| 0.00241
| 0.348509
| 1,274
| 35
| 100
| 36.4
| 0.863855
| 0.090267
| 0
| 0.7
| 0
| 0
| 0.01301
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.033333
| false
| 0
| 0.2
| 0
| 0.233333
| 0.166667
| 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
|
aa141914ada6cff96aaeff0da123370b82943071
| 259
|
py
|
Python
|
django_sha2/models.py
|
fwenzel/django-sha2
|
f4519bf0cc9b1dd7a7d78394fa4aec4504bc86e9
|
[
"BSD-3-Clause"
] | 9
|
2015-01-20T23:21:32.000Z
|
2020-05-03T14:33:12.000Z
|
django_sha2/models.py
|
h4ck3rm1k3/django-sha2
|
f4519bf0cc9b1dd7a7d78394fa4aec4504bc86e9
|
[
"BSD-3-Clause"
] | 1
|
2016-01-28T10:32:28.000Z
|
2017-04-12T21:15:47.000Z
|
django_sha2/models.py
|
h4ck3rm1k3/django-sha2
|
f4519bf0cc9b1dd7a7d78394fa4aec4504bc86e9
|
[
"BSD-3-Clause"
] | 3
|
2015-01-11T22:08:47.000Z
|
2021-12-06T19:40:29.000Z
|
"""Make sure django.contrib.auth monkeypatching happens on load."""
from django.conf import settings
# If we don't have password hashers, we need to monkey patch the auth module.
if not hasattr(settings, 'PASSWORD_HASHERS'):
from django_sha2 import auth
| 37
| 77
| 0.772201
| 40
| 259
| 4.95
| 0.725
| 0.10101
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004545
| 0.150579
| 259
| 6
| 78
| 43.166667
| 0.895455
| 0.532819
| 0
| 0
| 0
| 0
| 0.13913
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.333333
| 0.666667
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
aa195c2f2bc34413e2c9f3104d6fdeacb926f7b6
| 70
|
py
|
Python
|
manticore/__init__.py
|
etcd/manticore
|
87073d9985c4ca445217b7b135a6af0a51044b21
|
[
"Apache-2.0"
] | null | null | null |
manticore/__init__.py
|
etcd/manticore
|
87073d9985c4ca445217b7b135a6af0a51044b21
|
[
"Apache-2.0"
] | null | null | null |
manticore/__init__.py
|
etcd/manticore
|
87073d9985c4ca445217b7b135a6af0a51044b21
|
[
"Apache-2.0"
] | 1
|
2021-07-12T01:14:03.000Z
|
2021-07-12T01:14:03.000Z
|
from .manticore import Manticore
from .utils.helpers import issymbolic
| 35
| 37
| 0.857143
| 9
| 70
| 6.666667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 70
| 2
| 37
| 35
| 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
|
a4c7930242b7ab38d1ef4a3c38f8b64620326022
| 46
|
py
|
Python
|
cellphonedb/src/exceptions/NoReleasesException.py
|
BioTuring-Notebooks/CellphoneDB
|
9ab48d8888f11259bb3030c8d149d7bc7cdaf6e1
|
[
"MIT"
] | 278
|
2018-10-03T22:12:09.000Z
|
2022-03-28T15:33:17.000Z
|
cellphonedb/src/exceptions/NoReleasesException.py
|
BioTuring-Notebooks/CellphoneDB
|
9ab48d8888f11259bb3030c8d149d7bc7cdaf6e1
|
[
"MIT"
] | 263
|
2018-11-16T14:41:31.000Z
|
2022-03-30T08:38:26.000Z
|
cellphonedb/src/exceptions/NoReleasesException.py
|
BioTuring-Notebooks/CellphoneDB
|
9ab48d8888f11259bb3030c8d149d7bc7cdaf6e1
|
[
"MIT"
] | 106
|
2018-10-18T15:11:57.000Z
|
2022-03-14T19:50:27.000Z
|
class NoReleasesException(Exception):
pass
| 23
| 37
| 0.804348
| 4
| 46
| 9.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130435
| 46
| 2
| 38
| 23
| 0.925
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
a4e409bd9fec15fb2ba0d2facec117e18e9e39d8
| 87
|
py
|
Python
|
lapy/__init__.py
|
AhmedFaisal95/LaPy
|
caf84eaf11d7d152cf64fd283dfe1ece65a6ca64
|
[
"MIT"
] | 8
|
2021-03-19T14:38:06.000Z
|
2022-02-10T15:45:02.000Z
|
lapy/__init__.py
|
AhmedFaisal95/LaPy
|
caf84eaf11d7d152cf64fd283dfe1ece65a6ca64
|
[
"MIT"
] | 4
|
2021-03-29T05:45:56.000Z
|
2022-03-21T13:54:30.000Z
|
lapy/__init__.py
|
AhmedFaisal95/LaPy
|
caf84eaf11d7d152cf64fd283dfe1ece65a6ca64
|
[
"MIT"
] | 3
|
2021-11-10T08:51:38.000Z
|
2022-03-21T11:59:58.000Z
|
from .TriaMesh import TriaMesh
from .TetMesh import TetMesh
from .Solver import Solver
| 21.75
| 30
| 0.827586
| 12
| 87
| 6
| 0.416667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137931
| 87
| 3
| 31
| 29
| 0.96
| 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
|
3509b3ab904c82d0b43a60e623f3879ee4697a8a
| 129
|
py
|
Python
|
fedot/core/debug/metrics.py
|
rozlana-g/FEDOT
|
a909d6c0ef481cc1cf7a5f10f7b1292d8d2def5c
|
[
"BSD-3-Clause"
] | 358
|
2020-06-11T09:34:53.000Z
|
2022-03-31T12:56:22.000Z
|
fedot/core/debug/metrics.py
|
rozlana-g/FEDOT
|
a909d6c0ef481cc1cf7a5f10f7b1292d8d2def5c
|
[
"BSD-3-Clause"
] | 467
|
2020-06-11T13:49:45.000Z
|
2022-03-31T14:19:48.000Z
|
fedot/core/debug/metrics.py
|
rozlana-g/FEDOT
|
a909d6c0ef481cc1cf7a5f10f7b1292d8d2def5c
|
[
"BSD-3-Clause"
] | 48
|
2020-07-13T14:50:45.000Z
|
2022-03-26T09:37:13.000Z
|
from random import randint
class RandomMetric:
@staticmethod
def get_value() -> float:
return randint(0, 1000)
| 16.125
| 31
| 0.674419
| 15
| 129
| 5.733333
| 0.933333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.051546
| 0.248062
| 129
| 7
| 32
| 18.428571
| 0.835052
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 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
| 0
| 1
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
101c1593b514ccca65296f630e94b70c22f43bd9
| 231
|
py
|
Python
|
unbalanced_dataset/under_sampling/tests/test_tomek_links.py
|
kmike/UnbalancedDataset
|
777f26cee73c04ae2f3d59e43c990cbfd1725b23
|
[
"MIT"
] | 6
|
2016-06-02T09:27:41.000Z
|
2021-04-21T06:46:12.000Z
|
unbalanced_dataset/under_sampling/tests/test_tomek_links.py
|
kmike/UnbalancedDataset
|
777f26cee73c04ae2f3d59e43c990cbfd1725b23
|
[
"MIT"
] | null | null | null |
unbalanced_dataset/under_sampling/tests/test_tomek_links.py
|
kmike/UnbalancedDataset
|
777f26cee73c04ae2f3d59e43c990cbfd1725b23
|
[
"MIT"
] | 1
|
2018-08-25T03:11:05.000Z
|
2018-08-25T03:11:05.000Z
|
"""Test the module Tomek's links."""
from __future__ import print_function
from unbalanced_dataset.under_sampling import TomekLinks
def test_tomek_links():
"""Test the Tomek links function."""
print('Test Tomek Links')
| 21
| 56
| 0.748918
| 31
| 231
| 5.290323
| 0.548387
| 0.182927
| 0.170732
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.151515
| 231
| 10
| 57
| 23.1
| 0.836735
| 0.264069
| 0
| 0
| 0
| 0
| 0.100629
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0.5
| 0
| 0.75
| 0.5
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 1
| 1
|
0
| 5
|
105d2841d52ad4cee04c9a461fa6e857b4f0d1e0
| 94
|
py
|
Python
|
enthought/envisage/plugin_activator.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 3
|
2016-12-09T06:05:18.000Z
|
2018-03-01T13:00:29.000Z
|
enthought/envisage/plugin_activator.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 1
|
2020-12-02T00:51:32.000Z
|
2020-12-02T08:48:55.000Z
|
enthought/envisage/plugin_activator.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | null | null | null |
# proxy module
from __future__ import absolute_import
from envisage.plugin_activator import *
| 23.5
| 39
| 0.851064
| 12
| 94
| 6.166667
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.117021
| 94
| 3
| 40
| 31.333333
| 0.891566
| 0.12766
| 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
|
1086d4970cb973ca918a7eeb7488f9e0559978a0
| 29
|
py
|
Python
|
widgy/contrib/urlconf_include/__init__.py
|
IndiumTechnology/django-widgy
|
3cb5ea0a38b22f7430fe4cfcd12530739d396d70
|
[
"Apache-2.0"
] | 168
|
2015-01-04T17:22:45.000Z
|
2022-01-28T09:53:35.000Z
|
widgy/contrib/urlconf_include/__init__.py
|
IndiumTechnology/django-widgy
|
3cb5ea0a38b22f7430fe4cfcd12530739d396d70
|
[
"Apache-2.0"
] | 82
|
2015-01-09T18:14:32.000Z
|
2020-10-08T18:13:07.000Z
|
widgy/contrib/urlconf_include/__init__.py
|
IndiumTechnology/django-widgy
|
3cb5ea0a38b22f7430fe4cfcd12530739d396d70
|
[
"Apache-2.0"
] | 61
|
2015-01-09T17:16:51.000Z
|
2021-07-03T08:52:27.000Z
|
from . import signalhandlers
| 14.5
| 28
| 0.827586
| 3
| 29
| 8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137931
| 29
| 1
| 29
| 29
| 0.96
| 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
|
52bf512d72fe94f08ab12d7b12b8bd7ff8518152
| 184
|
py
|
Python
|
DevOps/generate_new.py
|
Gorialis/vrchat-smarthands
|
ce6c5a297d6e24fca1c35bdacdcfd7e4817cb165
|
[
"MIT"
] | 2
|
2021-04-02T18:10:15.000Z
|
2021-08-09T08:18:00.000Z
|
DevOps/generate_new.py
|
Gorialis/vrchat-smarthands
|
ce6c5a297d6e24fca1c35bdacdcfd7e4817cb165
|
[
"MIT"
] | null | null | null |
DevOps/generate_new.py
|
Gorialis/vrchat-smarthands
|
ce6c5a297d6e24fca1c35bdacdcfd7e4817cb165
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
import os
git_revision_count = os.getenv("GIT_REV_COUNT")
git_revision_hash = os.getenv("GIT_REV_HASH")
print(f"{git_revision_count=} {git_revision_hash=}")
| 20.444444
| 52
| 0.733696
| 29
| 184
| 4.241379
| 0.448276
| 0.357724
| 0.260163
| 0.227642
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006024
| 0.097826
| 184
| 8
| 53
| 23
| 0.73494
| 0.11413
| 0
| 0
| 0
| 0
| 0.416149
| 0.130435
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0.25
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
52cd3e252b074f1380f5db09e854dc07760c144a
| 135
|
py
|
Python
|
test/utils.py
|
eosW/pyds
|
20ae4a2f6f102de39e02559357e75bfeb01dfe35
|
[
"MIT"
] | null | null | null |
test/utils.py
|
eosW/pyds
|
20ae4a2f6f102de39e02559357e75bfeb01dfe35
|
[
"MIT"
] | null | null | null |
test/utils.py
|
eosW/pyds
|
20ae4a2f6f102de39e02559357e75bfeb01dfe35
|
[
"MIT"
] | null | null | null |
def inorder(node):
if not node:
return
yield from inorder(node.left)
yield node
yield from inorder(node.right)
| 19.285714
| 34
| 0.644444
| 19
| 135
| 4.578947
| 0.526316
| 0.37931
| 0.367816
| 0.45977
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.281481
| 135
| 6
| 35
| 22.5
| 0.896907
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0
| 0
| 0.333333
| 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
|
5e01c881a17afaf2b218ed81a8d5919dd3915903
| 28
|
py
|
Python
|
be/transform/art_line.py
|
lacti/artline
|
1822a6b8b9946bba0b699728ccfefaa59e3f1aa6
|
[
"MIT"
] | null | null | null |
be/transform/art_line.py
|
lacti/artline
|
1822a6b8b9946bba0b699728ccfefaa59e3f1aa6
|
[
"MIT"
] | 1
|
2021-07-13T01:46:41.000Z
|
2021-07-13T01:46:41.000Z
|
be/transform/art_line.py
|
lacti/artline
|
1822a6b8b9946bba0b699728ccfefaa59e3f1aa6
|
[
"MIT"
] | null | null | null |
class FeatureLoss:
pass
| 9.333333
| 18
| 0.714286
| 3
| 28
| 6.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| 28
| 2
| 19
| 14
| 0.952381
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
5e2589eb75208c2d5f9a2fb3fb64472c92a7aa40
| 5,121
|
py
|
Python
|
code/models/sen_re.py
|
bflashcp3f/REtology
|
0645fee683d947ff23dba008bfd5ad2f55b6a912
|
[
"MIT"
] | 1
|
2021-04-29T19:46:03.000Z
|
2021-04-29T19:46:03.000Z
|
code/models/sen_re.py
|
bflashcp3f/REtology
|
0645fee683d947ff23dba008bfd5ad2f55b6a912
|
[
"MIT"
] | null | null | null |
code/models/sen_re.py
|
bflashcp3f/REtology
|
0645fee683d947ff23dba008bfd5ad2f55b6a912
|
[
"MIT"
] | null | null | null |
import torch
from constants import *
from utils import *
from transformers import BertTokenizer, BertModel, BertPreTrainedModel, BertConfig, BertForSequenceClassification
from transformers import RobertaTokenizer, RobertaModel, RobertaConfig, RobertaForSequenceClassification
from torch import nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss, MSELoss
class BertEMES(BertPreTrainedModel):
def __init__(self, config):
super(BertEMES, self).__init__(config)
self.num_labels = config.num_labels
self.hidden_size = config.hidden_size
self.bert = BertModel(config)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
# self.classifier = nn.Linear(config.hidden_size, self.config.num_labels)
self.classifier = nn.Linear(config.hidden_size * 2, self.config.num_labels)
self.init_weights()
def forward(self, input_ids, token_type_ids=None,
attention_mask=None, labels=None,
position_ids=None, head_mask=None,
subj_ent_start=None, obj_ent_start=None):
outputs = self.bert(input_ids, attention_mask=attention_mask)
# outputs = self.bert(input_ids_new, attention_mask=attention_mask_new)
sequence_output = outputs[0]
pooled_output = outputs[1]
# Take the representation for 'SUBJ' token
subj_ent_output = torch.cat([a[i].unsqueeze(0) for a, i in zip(sequence_output, subj_ent_start)])
# Take the representation for 'OBJ' token
obj_ent_output = torch.cat([a[i].unsqueeze(0) for a, i in zip(sequence_output, obj_ent_start)])
ent_output = torch.cat([subj_ent_output, obj_ent_output], dim=1)
bag_output = self.dropout(ent_output)
logits = self.classifier(bag_output)
outputs = (logits,) + outputs[2:] # add hidden states and attention if they are here
if labels is not None:
if self.num_labels == 1:
# We are doing regression
loss_fct = MSELoss()
loss = loss_fct(logits.view(-1), labels.view(-1))
else:
loss_fct = CrossEntropyLoss()
loss = loss_fct(logits.view(-1, self.num_labels), labels.view(-1))
outputs = (loss,) + outputs
return outputs # (loss), logits, (hidden_states), (attentions)
class RobertaEMES(BertPreTrainedModel):
config_class = RobertaConfig
# pretrained_model_archive_map = ROBERTA_PRETRAINED_MODEL_ARCHIVE_MAP
base_model_prefix = "roberta"
def __init__(self, config):
super(RobertaEMES, self).__init__(config)
self.num_labels = config.num_labels
self.hidden_size = config.hidden_size
self.roberta = RobertaModel(config)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
# self.classifier = nn.Linear(config.hidden_size, self.config.num_labels)
self.classifier = nn.Linear(config.hidden_size * 2, self.config.num_labels)
self.init_weights()
def forward(self, input_ids, token_type_ids=None,
attention_mask=None, labels=None,
position_ids=None, head_mask=None,
subj_ent_start=None, obj_ent_start=None):
outputs = self.roberta(input_ids, attention_mask=attention_mask)
# outputs = self.bert(input_ids_new, attention_mask=attention_mask_new)
sequence_output = outputs[0]
pooled_output = outputs[1]
# Take the representation for 'SUBJ' token
subj_ent_output = torch.cat([a[i].unsqueeze(0) for a, i in zip(sequence_output, subj_ent_start)])
# Take the representation for 'OBJ' token
obj_ent_output = torch.cat([a[i].unsqueeze(0) for a, i in zip(sequence_output, obj_ent_start)])
ent_output = torch.cat([subj_ent_output, obj_ent_output], dim=1)
bag_output = self.dropout(ent_output)
logits = self.classifier(bag_output)
outputs = (logits,) + outputs[2:] # add hidden states and attention if they are here
if labels is not None:
if self.num_labels == 1:
# We are doing regression
loss_fct = MSELoss()
loss = loss_fct(logits.view(-1), labels.view(-1))
else:
loss_fct = CrossEntropyLoss()
loss = loss_fct(logits.view(-1, self.num_labels), labels.view(-1))
outputs = (loss,) + outputs
# print("outputs: ", outputs)
return outputs # (loss), logits, (hidden_states), (attentions)
MODELS = {'bert-base-uncased': {'tokenizer': BertTokenizer,
'config': BertConfig,
'emes': BertEMES},
'SpanBERT/spanbert-base-cased': {'tokenizer': BertTokenizer,
'config': BertConfig,
'emes': BertEMES},
'roberta-base': {'tokenizer': RobertaTokenizer,
'config': RobertaConfig,
'emes': RobertaEMES}
}
| 39.091603
| 113
| 0.628393
| 598
| 5,121
| 5.150502
| 0.177258
| 0.035065
| 0.025325
| 0.037013
| 0.778896
| 0.763312
| 0.730844
| 0.730844
| 0.699351
| 0.699351
| 0
| 0.006464
| 0.274946
| 5,121
| 131
| 114
| 39.091603
| 0.823054
| 0.156415
| 0
| 0.707317
| 0
| 0
| 0.028172
| 0.006519
| 0
| 0
| 0
| 0
| 0
| 1
| 0.04878
| false
| 0
| 0.097561
| 0
| 0.219512
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
5e2e156bea2ccddc245b78bc5d88ca9a2549fc21
| 116
|
py
|
Python
|
fossil/fb/utils.py
|
Remember-Fossil/Fossil-Server
|
45b9002a8431fa9377ee3eba23ab01aeb564559a
|
[
"MIT"
] | null | null | null |
fossil/fb/utils.py
|
Remember-Fossil/Fossil-Server
|
45b9002a8431fa9377ee3eba23ab01aeb564559a
|
[
"MIT"
] | null | null | null |
fossil/fb/utils.py
|
Remember-Fossil/Fossil-Server
|
45b9002a8431fa9377ee3eba23ab01aeb564559a
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
def urldecode(res):
return dict([data.split('=') for data in res.split('&') if True])
| 19.333333
| 69
| 0.577586
| 17
| 116
| 3.941176
| 0.823529
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010526
| 0.181034
| 116
| 5
| 70
| 23.2
| 0.694737
| 0.181034
| 0
| 0
| 0
| 0
| 0.021739
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
eaaeb27b171d2a304c9cbaaf9929ffd182fb5023
| 91
|
py
|
Python
|
library_sql/tool.py
|
TwinIsland/CTD
|
88118f2f2a9436ae1f893a94d79d9307dcc993da
|
[
"Apache-2.0"
] | null | null | null |
library_sql/tool.py
|
TwinIsland/CTD
|
88118f2f2a9436ae1f893a94d79d9307dcc993da
|
[
"Apache-2.0"
] | null | null | null |
library_sql/tool.py
|
TwinIsland/CTD
|
88118f2f2a9436ae1f893a94d79d9307dcc993da
|
[
"Apache-2.0"
] | null | null | null |
import library
library = library.library()
library.cleanDataBase()
library.save_change()
| 13
| 27
| 0.791209
| 10
| 91
| 7.1
| 0.5
| 0.788732
| 0.887324
| 0.788732
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098901
| 91
| 7
| 28
| 13
| 0.865854
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 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
|
d811c3db204845dfc0e6447eec5a348863df40a0
| 19
|
py
|
Python
|
website/settings/__init__.py
|
vanderland/vdl_site
|
43b9ad3e5e7b9a2d35fc3cbb6a378cc8374699f1
|
[
"MIT"
] | null | null | null |
website/settings/__init__.py
|
vanderland/vdl_site
|
43b9ad3e5e7b9a2d35fc3cbb6a378cc8374699f1
|
[
"MIT"
] | null | null | null |
website/settings/__init__.py
|
vanderland/vdl_site
|
43b9ad3e5e7b9a2d35fc3cbb6a378cc8374699f1
|
[
"MIT"
] | null | null | null |
from .DEVL import *
| 19
| 19
| 0.736842
| 3
| 19
| 4.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 19
| 1
| 19
| 19
| 0.875
| 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
|
d8180101eb1386e1435cb2c5cdb3900b1eaa341c
| 7,043
|
py
|
Python
|
Uwallet/tests/_test_jsonrpc.py
|
monotone/Ulord-platform
|
8ec19bbb8845db8f22df925d33b118b22dab0d0b
|
[
"MIT"
] | 28
|
2018-04-27T08:02:18.000Z
|
2020-01-14T05:08:34.000Z
|
Uwallet/tests/_test_jsonrpc.py
|
monotone/Ulord-platform
|
8ec19bbb8845db8f22df925d33b118b22dab0d0b
|
[
"MIT"
] | 2
|
2018-05-16T08:29:20.000Z
|
2018-06-17T04:51:08.000Z
|
Uwallet/tests/_test_jsonrpc.py
|
monotone/Ulord-platform
|
8ec19bbb8845db8f22df925d33b118b22dab0d0b
|
[
"MIT"
] | 4
|
2018-05-14T11:43:31.000Z
|
2018-09-29T09:58:58.000Z
|
#-*- coding: UTF-8 -*-
import time
from jsonrpclib import Server
def profiler(func):
def do_profile(*args, **kw_args):
n = func.func_name
t0 = time.time()
o = func(*args, **kw_args)
t = time.time() - t0
print "[profiler] %s %f" % (n, t)
return o
# return lambda *args, **kw_args: do_profile(func, args, kw_args)
return do_profile
# server = Server('http://192.168.14.240:8000')
server = Server('http://192.168.14.241:8000')
@profiler
def publish(user, password, claim_name, skip_update_check):
"""
:return: {u'fee': u'0.000359', u'success': True, u'tx': u'01000000026cd6a90cd9e7d486aa9e52261bf74969181ac7a691a398df243bfccb24daee7d000000006a47304402205c07adc5ab1f5ae4830f8c2a71355e10fa647bd598ba55ce95f2cb326c8d3f8e02205f524450cb52d35dd91cac39e2ff8cce66444bd9e21087c367a49ee234b715e0012102521dcd489d7740aac35616320091cad6656b127a86a7a84fbe7622557ad14be6ffffffff6cd6a90cd9e7d486aa9e52261bf74969181ac7a691a398df243bfccb24daee7d010000006b483045022100f1061ea1eef46c97c2e9d3d511523ddb1753687283848bc578d4301a90bc6d37022002dd3868ad8e5931000b7d9c8f6b109385dbc25e2c0c5dfb3b26442929acdf49012102521dcd489d7740aac35616320091cad6656b127a86a7a84fbe7622557ad14be6ffffffff023fc0650300000000fd3a01b70968657431616f31313114e190209f6b4e6d5d3ea17c191d75d7a5e01f97504cfd080110011af601080112bc01080410011a0d57686174206973204c4252593f223057686174206973204c4252593f20416e20696e74726f64756374696f6e207769746820416c6578205461626172726f6b2a0c53616d75656c20427279616e32084c42525920496e6338004224080110011a19824fe527d791ec681899527ab5902de65c247e84792da6ac4c259a99993f4a2f68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f66696c65732e6c6272792e696f2f6c6f676f2e706e6752005a0060021a33080110011a2212206c10c5cece33226e2cc5c56d999fd7874494a1bebf47be0416a09bf53b8954262209766964656f2f6d70346d6d76a9144fe527d791ec681899527ab5902de65c247e847988ac5871263f170000001976a9144fe527d791ec681899527ab5902de65c247e847988ac00000000', u'txid': u'325dbf4ed36ccc50f84118e322b1452aeb0f385d71f5accbd326ecd4df3df121', u'amount': u'0.56999999', u'claim_id': u'50971fe0a5d7751d197ca13e5d6d4e6b9f2090e1', u'nout': 0}
"""
metadata = {
"license": "LBRY Inc",
"description": "update test",
"language": "en",
"title": "What is LBRY?",
"author": "Samuel Bryan",
"version": "_0_1_0",
"nsfw": False,
"licenseUrl": "",
"preview": "",
"thumbnail": "https://s3.amazonaws.com/files.lbry.io/logo.png",
"tag": ["action", "sss"]
}
# sourceHash = "d5169241150022f996fa7cd6a9a1c421937276a3275eb912790bd07ba7aec1fac5fd45431d226b8fb402691e79aeb24b"
sourceHash = "QmVcVaHhMeWNNetSLTZArmqaHMpu5ycqntx7mFZaci63VF"
contentType = "video/mp4"
currency = "UT"
amount = 1.56
bid = 0.59
return server.publish(user, password, claim_name, metadata, contentType, sourceHash, currency, amount, bid, None, None, skip_update_check)
@profiler
def consume(claim_id):
"""
:return: {u'success': True, u'tx': u'3ecce656dbfeea5b38f385549ac51e550bfa6d70bba9d2042dacdd3c1def662a'}
"""
user = 'ht'
password = '123'
return server.consume(user, password, claim_id)
@profiler
def create(user, password, use_change):
"""
:return: {u'seed': u'faculty claim ghost cushion helmet sweet solution dirt night bottom gift trophy', u'success': True}
"""
return server.create(user, password, use_change)
@profiler
def getbalance(user, password):
"""
:return: {u'confirmed': u'9999.99965899', u'success': True, u'unconfirmed': 1.33, u'unmatured': 9.2}
"""
return server.getbalance(user, password)
@profiler
def pay(receive_user, amount):
"""
:param send_user:
:param password:
:return: {u'success': True, u'txid': u'b6b921500444b575b48745e33a8808c692a5bbe3c6ecfae4714c264d81696daf'}
"""
send_user = 'ht'
password = '123'
# send_user = 'shu'
# password = 'pbkdf2:sha256:50000$oEw0SZX0$f8d9951addfa90213e63bb4553cacc7e3cc8e78d9d59f5e707da1fc09dd4d675'
return server.pay(send_user, password, receive_user, amount)
@profiler
def update_claim(user, password, claim_name, claim_id, txid):
metadata = {
"license": "LBRY Inc",
"description": "What is LBRY? An introduction with Alex Tabarrok",
"language": "en",
"title": "What is LBRY?",
"author": "Samuel Bryan",
"version": "_0_1_0",
"nsfw": False,
"licenseUrl": "",
"preview": "",
"thumbnail": "https://s3.amazonaws.com/files.lbry.io/logo.png",
"tag": ["action", "sss"]
}
source_hash = "QmVcVaHhMeWNNetSLTZArmqaHMpu5ycqntx7mFZaci63VF"
content_type = "video/mp4"
currency = "UT"
amount = 1.2
bid = 0.57
address = None
tx_fee = None
nout = 0
return server.update_claim(user, password, claim_name, claim_id, txid, nout, metadata,
content_type, source_hash, currency, amount, bid, address, tx_fee)
@profiler
def delete(user):
return server.delete(user)
@profiler
def mul_test():
def wrap_publish():
print publish(user, password, claim_name, False)
def wrap_getbalance():
print getbalance(user, password)
def wrap_create(user):
print create('test_'+ str(user), 123)
from multiprocessing import Process
plist=[]
for i in range(1):
if i % 2 == 0:
# p = Process(target=wrap_publish, args=())
p = Process(target=wrap_create, args=(i,))
else:
p = Process(target=wrap_create, args=(i,))
p.start()
plist.append(p)
print 11
for pl in plist:
pl.join()
if __name__ == '__main__':
user = 'hetao'
password = '123'
# password = 'pbkdf2:sha256:50000$oEw0SZX0$f8d9951addfa90213e63bb4553cacc7e3cc8e78d9d59f5e707da1fc09dd4d675'
claim_name = 'fd32773a648611e8bc56f4dsf9c8ab'
claim_id = 'e2b29a45d8ee5b39c549a9ff6e7ac667bd18f776'
txid = '8aab1a95d08ccf814980d3d10f1af5e959468a1703f8eb3e6063fdbe78651e2b'
# print create(user, password, True) # 0.48
# print pay(user, 10) # 0.95
print getbalance(user, password) # 0.14
# print publish(user, password, claim_name, True) # 3.67
# print update_claim(user, password, claim_name, claim_id, txid) # 1.56 amount
# print consume(claim_id) # 1.4
# print delete('ht')
# ==================================================================
cln_password = 'pbkdf2:sha256:50000$wxOHrzn9$bb0569c6e78b5ed621917e28c401499e1e830a86e81febd38b04c6cec49a0460'
# print server.listaddresses()
# print server.password('shuxudong', '123', 'pbkdf2:sha256:50000$oEw0SZX0$f8d9951addfa90213e63bb4553cacc7e3cc8e78d9d59f5e707da1fc09dd4d675')
# print server.is_wallet_exists('5d42b27e581c11e88b12f48e3889c8ab_user1')
# print server.pay(user, password, 'hetao1', 1008)
# print server.create('cln', cln_password)
# print server.pay('cln', cln_password, 'ht', 2)
# print getbalance('cln', cln_password) # 0.14
| 40.477011
| 1,566
| 0.711629
| 620
| 7,043
| 7.964516
| 0.306452
| 0.041312
| 0.027542
| 0.029769
| 0.23066
| 0.171932
| 0.092953
| 0.081207
| 0.081207
| 0.055083
| 0
| 0.273008
| 0.171518
| 7,043
| 173
| 1,567
| 40.710983
| 0.573265
| 0.178901
| 0
| 0.371429
| 0
| 0
| 0.225736
| 0.08771
| 0
| 1
| 0
| 0
| 0
| 0
| null | null | 0.161905
| 0.028571
| null | null | 0.057143
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
dc1dda7394304c8f667ff1f895674f1aefb2b377
| 2,061
|
py
|
Python
|
floodsystem/plot.py
|
cued-ia-computing/flood-hln35-nc580
|
81ecb652ca932d8e05253982c6efe6befd2bf670
|
[
"MIT"
] | null | null | null |
floodsystem/plot.py
|
cued-ia-computing/flood-hln35-nc580
|
81ecb652ca932d8e05253982c6efe6befd2bf670
|
[
"MIT"
] | null | null | null |
floodsystem/plot.py
|
cued-ia-computing/flood-hln35-nc580
|
81ecb652ca932d8e05253982c6efe6befd2bf670
|
[
"MIT"
] | null | null | null |
import matplotlib.pyplot as plt
import datetime
from datetime import timedelta
import matplotlib.dates
import numpy as np
from .station import MonitoringStation
from .analysis import polyfit
def plot_water_levels(station, dates, levels):
if all(isinstance(level,float) for level in levels) is True and len(dates) == len(levels):
typical_low = [station.typical_range[0]]*len(dates)
typical_high = [station.typical_range[1]]*len(dates)
# Plot
plt.plot(dates, levels)
plt.plot(dates, typical_low, color= 'blue', label = 'typical low')
plt.plot(dates, typical_high, color= 'red', label = 'typical high')
# Add axis labels, rotate date labels and add plot title
plt.xlabel('date')
plt.ylabel('water level (m)')
plt.xticks(rotation=45)
plt.title(station.name)
# Display plot
plt.tight_layout() # This makes sure plot does not cut off date labels
plt.legend()
plt.show()
else:
pass
# Define function that plots the water level data and the best-fit polynomial
def plot_water_level_with_fit(station, dates, levels, p):
if all(isinstance(level,float) for level in levels) is True and len(dates) == len(levels):
poly, d0 = polyfit(dates, levels, p)
typical_low = [station.typical_range[0]]*len(dates)
typical_high = [station.typical_range[1]]*len(dates)
# Plot
plt.plot(dates, levels, '.')
plt.plot(dates, typical_low, color= 'blue', label = 'typical low')
plt.plot(dates, typical_high, color= 'red', label = 'typical high')
plt.plot(dates, poly(matplotlib.dates.date2num(dates)-d0), color='m')
# Add axis labels, rotate date labels and add plot title
plt.xlabel('date')
plt.ylabel('water level (m)')
plt.xticks(rotation=45)
plt.title(station.name)
# Display plot
plt.tight_layout() # This makes sure plot does not cut off date labels
plt.legend()
plt.show()
else:
pass
| 36.803571
| 94
| 0.644347
| 281
| 2,061
| 4.654804
| 0.288256
| 0.037462
| 0.06422
| 0.058104
| 0.707951
| 0.707951
| 0.707951
| 0.707951
| 0.707951
| 0.707951
| 0
| 0.007069
| 0.245027
| 2,061
| 56
| 95
| 36.803571
| 0.833548
| 0.15575
| 0
| 0.682927
| 0
| 0
| 0.05777
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.04878
| false
| 0.04878
| 0.170732
| 0
| 0.219512
| 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
|
dc476291ec9f8a75c832e296b82b45660b5de1fb
| 293
|
py
|
Python
|
Toolz/fimap/src/pybing/__init__.py
|
thezakman/CTF-Toolz
|
b369246ea6766165cce0852e537fb6a0c970869b
|
[
"Unlicense"
] | 71
|
2019-02-02T11:38:46.000Z
|
2022-03-31T14:08:27.000Z
|
Exploitation/Web-Exploitation/PathTraversal/fimap/src/pybing/__init__.py
|
bhattsameer/TID3xploits
|
b57d8bae454081a3883a5684679e2a329e72d6e5
|
[
"MIT"
] | null | null | null |
Exploitation/Web-Exploitation/PathTraversal/fimap/src/pybing/__init__.py
|
bhattsameer/TID3xploits
|
b57d8bae454081a3883a5684679e2a329e72d6e5
|
[
"MIT"
] | 15
|
2019-08-07T06:32:04.000Z
|
2022-03-09T12:48:20.000Z
|
# This file is part of PyBing (http://pybing.googlecode.com).
#
# Copyright (C) 2009 JJ Geewax http://geewax.org/
# All rights reserved.
#
# This software is licensed as described in the file COPYING.txt,
# which you should have received as part of this distribution.
from bing import Bing
| 29.3
| 65
| 0.740614
| 46
| 293
| 4.717391
| 0.76087
| 0.0553
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.016461
| 0.170648
| 293
| 9
| 66
| 32.555556
| 0.876543
| 0.870307
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
dc68f4f353acebf9802b1f24bea27b810ccacaaa
| 21
|
py
|
Python
|
samples/LuceneInAction/lia/analysis/positional/__init__.py
|
romanchyla/pylucene-trunk
|
990079ff0c76b972ce5ef2bac9b85334a0a1f27a
|
[
"Apache-2.0"
] | 15
|
2015-05-21T09:28:01.000Z
|
2022-03-18T23:41:49.000Z
|
samples/LuceneInAction/lia/analysis/positional/__init__.py
|
fnp/pylucene
|
fb16ac375de5479dec3919a5559cda02c899e387
|
[
"Apache-2.0"
] | 1
|
2021-09-30T03:59:43.000Z
|
2021-09-30T03:59:43.000Z
|
samples/LuceneInAction/lia/analysis/positional/__init__.py
|
romanchyla/pylucene-trunk
|
990079ff0c76b972ce5ef2bac9b85334a0a1f27a
|
[
"Apache-2.0"
] | 13
|
2015-04-18T23:05:11.000Z
|
2021-11-29T21:23:26.000Z
|
# positional package
| 10.5
| 20
| 0.809524
| 2
| 21
| 8.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 21
| 1
| 21
| 21
| 0.944444
| 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
|
dc9b7465c2c6a7fa0faf003130db52c6e600a1a2
| 90
|
py
|
Python
|
rjax/environments/__init__.py
|
charlesjsun/rjax
|
8b56f78b34f593f442db3cc0315a3b6f22191442
|
[
"MIT"
] | null | null | null |
rjax/environments/__init__.py
|
charlesjsun/rjax
|
8b56f78b34f593f442db3cc0315a3b6f22191442
|
[
"MIT"
] | null | null | null |
rjax/environments/__init__.py
|
charlesjsun/rjax
|
8b56f78b34f593f442db3cc0315a3b6f22191442
|
[
"MIT"
] | null | null | null |
from .episode_monitor import EpisodeMonitor
from .single_precision import SinglePrecision
| 30
| 45
| 0.888889
| 10
| 90
| 7.8
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.088889
| 90
| 2
| 46
| 45
| 0.95122
| 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
|
f4de710791b1943c75278d91827b0b25fd5d001c
| 350
|
py
|
Python
|
framework/oktopus/utils/parser.py
|
charlee593/oktopus_framework
|
2835c44c61d1b6170682f014450b8c2203786347
|
[
"MIT"
] | 1
|
2022-02-21T12:03:17.000Z
|
2022-02-21T12:03:17.000Z
|
framework/oktopus/utils/parser.py
|
charlee593/oktopus_framework
|
2835c44c61d1b6170682f014450b8c2203786347
|
[
"MIT"
] | 4
|
2020-07-02T00:56:32.000Z
|
2020-07-02T00:56:45.000Z
|
framework/oktopus/utils/parser.py
|
charlee593/oktopus_framework
|
2835c44c61d1b6170682f014450b8c2203786347
|
[
"MIT"
] | 1
|
2022-02-21T12:03:03.000Z
|
2022-02-21T12:03:03.000Z
|
from ..dataset import parse_objects
from ..multicast.network import Node, Link
from ..multicast.session import Session
def load_sessions(file_path):
return parse_objects(file_path, cls=Session)
def load_nodes(file_path):
return parse_objects(file_path, cls=Node)
def load_links(file_path):
return parse_objects(file_path, cls=Link)
| 21.875
| 48
| 0.782857
| 52
| 350
| 5.019231
| 0.365385
| 0.183908
| 0.16092
| 0.218391
| 0.425287
| 0.425287
| 0.425287
| 0.425287
| 0
| 0
| 0
| 0
| 0.131429
| 350
| 15
| 49
| 23.333333
| 0.858553
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 5
|
52168f186fd44c528191530d5524611f29ac2837
| 81
|
py
|
Python
|
src/super_batch/__init__.py
|
Nashavi/batch-config
|
29d18e8a5c7ac0b69e3c97006ecd4c8f881f269e
|
[
"MIT"
] | null | null | null |
src/super_batch/__init__.py
|
Nashavi/batch-config
|
29d18e8a5c7ac0b69e3c97006ecd4c8f881f269e
|
[
"MIT"
] | null | null | null |
src/super_batch/__init__.py
|
Nashavi/batch-config
|
29d18e8a5c7ac0b69e3c97006ecd4c8f881f269e
|
[
"MIT"
] | null | null | null |
"""
__init__
"""
from .client import Client
from .BatchConfig import BatchConfig
| 13.5
| 36
| 0.765432
| 9
| 81
| 6.444444
| 0.555556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.135802
| 81
| 5
| 37
| 16.2
| 0.828571
| 0.098765
| 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
|
5260321fccf67775a88f45333c5c317a15c8cde8
| 7,966
|
py
|
Python
|
tests/test_pytorch.py
|
leonbottou/pymanopt
|
7d8c46f4513c3746234ba804604694b11db62d0a
|
[
"BSD-3-Clause"
] | 1
|
2021-09-21T14:28:10.000Z
|
2021-09-21T14:28:10.000Z
|
tests/test_pytorch.py
|
leonbottou/pymanopt
|
7d8c46f4513c3746234ba804604694b11db62d0a
|
[
"BSD-3-Clause"
] | null | null | null |
tests/test_pytorch.py
|
leonbottou/pymanopt
|
7d8c46f4513c3746234ba804604694b11db62d0a
|
[
"BSD-3-Clause"
] | null | null | null |
import unittest
import numpy.random as rnd
import numpy.testing as np_testing
import numpy as np
import torch
from pymanopt.tools.autodiff import PytorchBackend
class TestVector(unittest.TestCase):
def setUp(self):
np.seterr(all='raise')
self.cost = lambda X: torch.exp(torch.sum(X.pow(2)))
n = self.n = 15
Y = self.Y = rnd.randn(n)
A = self.A = rnd.randn(n)
# Calculate correct cost and grad...
self.correct_cost = np.exp(np.sum(Y ** 2))
self.correct_grad = 2 * Y * np.exp(np.sum(Y ** 2))
# ... and hess
# First form hessian matrix H
# Convert Y and A into matrices (row vectors)
Ymat = np.matrix(Y)
Amat = np.matrix(A)
diag = np.eye(n)
H = np.exp(np.sum(Y ** 2)) * (4 * Ymat.T.dot(Ymat) + 2 * diag)
# Then 'left multiply' H by A
self.correct_hess = np.squeeze(np.array(Amat.dot(H)))
self.backend = PytorchBackend()
self.arg = torch.Tensor()
def test_compile(self):
cost_compiled = self.backend.compile_function(self.cost, self.arg)
np_testing.assert_allclose(self.correct_cost, cost_compiled(self.Y))
def test_grad(self):
grad = self.backend.compute_gradient(self.cost, self.arg)
np_testing.assert_allclose(self.correct_grad, grad(self.Y))
def test_hessian(self):
hess = self.backend.compute_hessian(self.cost, self.arg)
# Now test hess
np_testing.assert_allclose(self.correct_hess, hess(self.Y, self.A))
class TestMatrix(unittest.TestCase):
def setUp(self):
np.seterr(all='raise')
self.cost = lambda X: torch.exp(torch.sum(X.pow(2)))
m = self.m = 10
n = self.n = 15
Y = self.Y = rnd.randn(m, n)
A = self.A = rnd.randn(m, n)
# Calculate correct cost and grad...
self.correct_cost = np.exp(np.sum(Y ** 2))
self.correct_grad = 2 * Y * np.exp(np.sum(Y ** 2))
# ... and hess
# First form hessian tensor H (4th order)
Y1 = Y.reshape(m, n, 1, 1)
Y2 = Y.reshape(1, 1, m, n)
# Create an m x n x m x n array with diag[i,j,k,l] == 1 iff
# (i == k and j == l), this is a 'diagonal' tensor.
diag = np.eye(m * n).reshape(m, n, m, n)
H = np.exp(np.sum(Y ** 2)) * (4 * Y1 * Y2 + 2 * diag)
# Then 'right multiply' H by A
Atensor = A.reshape(1, 1, m, n)
self.correct_hess = np.sum(H * Atensor, axis=(2, 3))
self.backend = PytorchBackend()
self.arg = torch.Tensor()
def test_compile(self):
cost_compiled = self.backend.compile_function(self.cost, self.arg)
np_testing.assert_allclose(self.correct_cost, cost_compiled(self.Y))
def test_grad(self):
grad = self.backend.compute_gradient(self.cost, self.arg)
np_testing.assert_allclose(self.correct_grad, grad(self.Y))
def test_hessian(self):
hess = self.backend.compute_hessian(self.cost, self.arg)
# Now test hess
np_testing.assert_allclose(self.correct_hess, hess(self.Y, self.A))
class TestTensor3(unittest.TestCase):
def setUp(self):
np.seterr(all='raise')
self.cost = lambda X: torch.exp(torch.sum(X.pow(2)))
n1 = self.n1 = 3
n2 = self.n2 = 4
n3 = self.n3 = 5
Y = self.Y = rnd.randn(n1, n2, n3)
A = self.A = rnd.randn(n1, n2, n3)
# Calculate correct cost and grad...
self.correct_cost = np.exp(np.sum(Y ** 2))
self.correct_grad = 2 * Y * np.exp(np.sum(Y ** 2))
# ... and hess
# First form hessian tensor H (6th order)
Y1 = Y.reshape(n1, n2, n3, 1, 1, 1)
Y2 = Y.reshape(1, 1, 1, n1, n2, n3)
# Create an n1 x n2 x n3 x n1 x n2 x n3 diagonal tensor
diag = np.eye(n1 * n2 * n3).reshape(n1, n2, n3, n1, n2, n3)
H = np.exp(np.sum(Y ** 2)) * (4 * Y1 * Y2 + 2 * diag)
# Then 'right multiply' H by A
Atensor = A.reshape(1, 1, 1, n1, n2, n3)
self.correct_hess = np.sum(H * Atensor, axis=(3, 4, 5))
self.backend = PytorchBackend()
self.arg = torch.Tensor()
def test_compile(self):
cost_compiled = self.backend.compile_function(self.cost, self.arg)
np_testing.assert_allclose(self.correct_cost, cost_compiled(self.Y))
def test_grad(self):
grad = self.backend.compute_gradient(self.cost, self.arg)
np_testing.assert_allclose(self.correct_grad, grad(self.Y))
def test_hessian(self):
hess = self.backend.compute_hessian(self.cost, self.arg)
# Now test hess
np_testing.assert_allclose(self.correct_hess, hess(self.Y, self.A))
class TestMixed(unittest.TestCase):
# Test autograd on a tuple containing vector, matrix and tensor3.
def setUp(self):
np.seterr(all='raise')
def torchf(x):
return (torch.exp(torch.sum(x[0]**2)) +
torch.exp(torch.sum(x[1]**2)) +
torch.exp(torch.sum(x[2]**2)))
def npf(x):
return (np.exp(np.sum(x[0]**2)) + np.exp(np.sum(x[1]**2)) +
np.exp(np.sum(x[2]**2)))
self.cost = torchf
n1 = self.n1 = 3
n2 = self.n2 = 4
n3 = self.n3 = 5
n4 = self.n4 = 6
n5 = self.n5 = 7
n6 = self.n6 = 8
self.y = y = (rnd.randn(n1), rnd.randn(n2, n3), rnd.randn(n4, n5, n6))
self.a = a = (rnd.randn(n1), rnd.randn(n2, n3), rnd.randn(n4, n5, n6))
self.correct_cost = npf(y)
# CALCULATE CORRECT GRAD
g1 = 2 * y[0] * np.exp(np.sum(y[0] ** 2))
g2 = 2 * y[1] * np.exp(np.sum(y[1] ** 2))
g3 = 2 * y[2] * np.exp(np.sum(y[2] ** 2))
self.correct_grad = (g1, g2, g3)
# CALCULATE CORRECT HESS
# 1. VECTOR
Ymat = np.matrix(y[0])
Amat = np.matrix(a[0])
diag = np.eye(n1)
H = np.exp(np.sum(y[0] ** 2)) * (4 * Ymat.T.dot(Ymat) + 2 * diag)
# Then 'left multiply' H by A
h1 = np.array(Amat.dot(H)).flatten()
# 2. MATRIX
# First form hessian tensor H (4th order)
Y1 = y[1].reshape(n2, n3, 1, 1)
Y2 = y[1].reshape(1, 1, n2, n3)
# Create an m x n x m x n array with diag[i,j,k,l] == 1 iff
# (i == k and j == l), this is a 'diagonal' tensor.
diag = np.eye(n2 * n3).reshape(n2, n3, n2, n3)
H = np.exp(np.sum(y[1] ** 2)) * (4 * Y1 * Y2 + 2 * diag)
# Then 'right multiply' H by A
Atensor = a[1].reshape(1, 1, n2, n3)
h2 = np.sum(H * Atensor, axis=(2, 3))
# 3. Tensor3
# First form hessian tensor H (6th order)
Y1 = y[2].reshape(n4, n5, n6, 1, 1, 1)
Y2 = y[2].reshape(1, 1, 1, n4, n5, n6)
# Create an n1 x n2 x n3 x n1 x n2 x n3 diagonal tensor
diag = np.eye(n4 * n5 * n6).reshape(n4, n5, n6, n4, n5, n6)
H = np.exp(np.sum(y[2] ** 2)) * (4 * Y1 * Y2 + 2 * diag)
# Then 'right multiply' H by A
Atensor = a[2].reshape(1, 1, 1, n4, n5, n6)
h3 = np.sum(H * Atensor, axis=(3, 4, 5))
self.correct_hess = (h1, h2, h3)
self.backend = PytorchBackend()
self.arg = torch.Tensor()
def test_compile(self):
cost_compiled = self.backend.compile_function(self.cost, self.arg)
np_testing.assert_allclose(self.correct_cost, cost_compiled(self.y))
def test_grad(self):
grad = self.backend.compute_gradient(self.cost, self.arg)
for k in range(len(grad(self.y))):
np_testing.assert_allclose(self.correct_grad[k], grad(self.y)[k])
def test_hessian(self):
hess = self.backend.compute_hessian(self.cost, self.arg)
# Now test hess
for k in range(len(hess(self.y, self.a))):
np_testing.assert_allclose(self.correct_hess[k], hess(self.y,
self.a)[k])
| 31.239216
| 78
| 0.55423
| 1,253
| 7,966
| 3.458899
| 0.106145
| 0.060914
| 0.029072
| 0.041532
| 0.821412
| 0.78311
| 0.755653
| 0.702123
| 0.678819
| 0.634518
| 0
| 0.045926
| 0.297514
| 7,966
| 254
| 79
| 31.362205
| 0.728556
| 0.13407
| 0
| 0.478873
| 0
| 0
| 0.002914
| 0
| 0
| 0
| 0
| 0
| 0.084507
| 1
| 0.126761
| false
| 0
| 0.042254
| 0.014085
| 0.211268
| 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
|
52643663802bad4266844936b7315d11534ceb83
| 174
|
py
|
Python
|
cornflow_client/core/instance.py
|
baobabsoluciones/cornflow-client
|
f9996f0b841885d26639cb63c8ba6090387de57f
|
[
"MIT"
] | 3
|
2021-05-12T11:21:26.000Z
|
2022-02-22T19:23:46.000Z
|
cornflow_client/core/instance.py
|
baobabsoluciones/cornflow-client
|
f9996f0b841885d26639cb63c8ba6090387de57f
|
[
"MIT"
] | 17
|
2021-03-14T17:09:46.000Z
|
2022-02-28T19:12:37.000Z
|
cornflow_client/core/instance.py
|
baobabsoluciones/cornflow-client
|
f9996f0b841885d26639cb63c8ba6090387de57f
|
[
"MIT"
] | 2
|
2020-10-03T20:00:19.000Z
|
2022-03-24T11:52:22.000Z
|
from .instance_solution import InstanceSolutionCore
from abc import ABC
class InstanceCore(InstanceSolutionCore, ABC):
"""
The instance template.
"""
pass
| 15.818182
| 51
| 0.724138
| 17
| 174
| 7.352941
| 0.647059
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.206897
| 174
| 10
| 52
| 17.4
| 0.905797
| 0.126437
| 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
| 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
|
5289b1731729bfd468d9dfbe0d831465f12f90d8
| 243
|
py
|
Python
|
feedler/urls.py
|
pcoder/public-health-ch
|
cebc4849653560c54238b67814074353ff7c01f3
|
[
"MIT"
] | 2
|
2020-10-29T16:27:21.000Z
|
2021-06-07T12:47:46.000Z
|
feedler/urls.py
|
pcoder/public-health-ch
|
cebc4849653560c54238b67814074353ff7c01f3
|
[
"MIT"
] | 11
|
2017-05-09T10:50:28.000Z
|
2021-12-15T17:01:23.000Z
|
feedler/urls.py
|
pcoder/public-health-ch
|
cebc4849653560c54238b67814074353ff7c01f3
|
[
"MIT"
] | 4
|
2017-04-24T13:06:55.000Z
|
2021-06-04T02:18:32.000Z
|
from django.conf.urls import include, url
from django.conf import settings
from django.contrib import admin
from django.conf.urls.i18n import i18n_patterns
from .api import api_router
urlpatterns = [
url(r'^api/v2/', api_router.urls),
]
| 22.090909
| 47
| 0.773663
| 38
| 243
| 4.868421
| 0.447368
| 0.216216
| 0.227027
| 0.194595
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02381
| 0.135802
| 243
| 10
| 48
| 24.3
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0.032922
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.625
| 0
| 0.625
| 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
|
8715d0dbd8a1e86ae583871af9880e05cb566fe2
| 3,774
|
py
|
Python
|
intro/part04-11_first_second_last/test/test_first_second_last_2.py
|
Hannah-Abi/python-pro-21
|
2ce32c4bf118054329d19afdf83c50561be1ada8
|
[
"MIT"
] | null | null | null |
intro/part04-11_first_second_last/test/test_first_second_last_2.py
|
Hannah-Abi/python-pro-21
|
2ce32c4bf118054329d19afdf83c50561be1ada8
|
[
"MIT"
] | null | null | null |
intro/part04-11_first_second_last/test/test_first_second_last_2.py
|
Hannah-Abi/python-pro-21
|
2ce32c4bf118054329d19afdf83c50561be1ada8
|
[
"MIT"
] | null | null | null |
import unittest
from unittest.mock import patch
from tmc import points
from tmc.utils import load_module, reload_module, get_stdout, check_source
from functools import reduce
import os
exercise = 'src.first_second_last'
@points('4.first_second_last')
class ETjaVSanaTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
with patch('builtins.input', side_effect=["2"] * 10):
cls.module = load_module(exercise, 'en')
def test_5_second_word_function_ok(self):
for row in ["once upon a time there was a programmer", "happily ever after", "Lorem ipsum dolor sit amet consectetur adipiscing elit", "first second", "please write a program which keeps asking the user for words"]:
with patch('builtins.input', side_effect=["2 2"] * 10):
reload_module(self.module)
output_at_start = get_stdout()
from src.first_second_last import second_word
try:
res = second_word(row)
except:
self.assertTrue(False, f'Make sure, that function can be called as follows:\nsecond_word("{row}")')
output_all = get_stdout().replace(output_at_start, '', 1)
expected = row.split(' ')[1]
self.assertFalse(res == None, f'Calling second_word("{row}") should return\n{expected}\nnow it does not return anything. Make sure that you use return command in any cases in your function!')
self.assertEqual(res, expected, f'Calling second_word("{row}") should return\n{expected}\nnow it returns\n{res}')
self.assertFalse(len(output_all)>0, f'Calling second_word("{row}") should not print out anything, but it prints out\n{output_all}\nremove print commands inside function')
def test_6_last_word_exists(self):
try:
from src.first_second_last import last_word
except:
self.assertTrue(False, f'Your code should contain function named as last_word')
try:
from src.first_second_last import last_word
last_word("once upon a time there was a programmer")
except:
self.assertTrue(False, f'Make sure, that function can be called as follows:\last_word("once upon a time there was a programmer")')
def test_7_last_word_function_ok(self):
for row in ["once upon a time there was a programmer", "happily ever after", "Lorem ipsum dolor sit amet consectetur adipiscing elit", "first second", "please write a program which keeps asking the user for words"]:
with patch('builtins.input', side_effect=["2 2"] * 10):
reload_module(self.module)
output_at_start = get_stdout()
from src.first_second_last import last_word
try:
res = last_word(row)
except:
self.assertTrue(False, f'Make sure, that function can be called as follows:\nlast_word("{row}")')
output_all = get_stdout().replace(output_at_start, '', 1)
odotettu = row.split(' ')[-1]
self.assertFalse(res == None, f'Calling last_word("{row}") should return\n{odotettu}\nnow it does not return anything. Make sure that you use return command in any cases in your function!')
self.assertEqual(res, odotettu, f'Calling last_word("{row}") should return\n{odotettu}\nnow it returns\n{res}')
self.assertFalse(len(output_all)>0, f'Calling last_word("{row}") should not print out anything, but it prints out\n{output_all}\nremove print commands inside function')
if __name__ == '__main__':
unittest.main()
| 55.5
| 223
| 0.635135
| 503
| 3,774
| 4.60835
| 0.272366
| 0.041415
| 0.038827
| 0.038827
| 0.789905
| 0.778689
| 0.774374
| 0.760138
| 0.756687
| 0.69629
| 0
| 0.007617
| 0.269475
| 3,774
| 68
| 224
| 55.5
| 0.833152
| 0
| 0
| 0.381818
| 0
| 0.090909
| 0.403974
| 0.064901
| 0
| 0
| 0
| 0
| 0.181818
| 1
| 0.072727
| false
| 0
| 0.181818
| 0
| 0.272727
| 0.036364
| 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
|
872711be818b82146685f1ba6c025fbe68c6d4ee
| 49
|
py
|
Python
|
Code/Mayank.py
|
mayankparida/CintaKamu
|
7a0ef976fca8fb01daf443f0cc0276ba7111c0c3
|
[
"MIT"
] | null | null | null |
Code/Mayank.py
|
mayankparida/CintaKamu
|
7a0ef976fca8fb01daf443f0cc0276ba7111c0c3
|
[
"MIT"
] | null | null | null |
Code/Mayank.py
|
mayankparida/CintaKamu
|
7a0ef976fca8fb01daf443f0cc0276ba7111c0c3
|
[
"MIT"
] | null | null | null |
# Mayank Parida
# India
print("Aku Cinta Kamu")
| 16.333333
| 23
| 0.693878
| 7
| 49
| 4.857143
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.183673
| 49
| 3
| 23
| 16.333333
| 0.85
| 0.387755
| 0
| 0
| 0
| 0
| 0.538462
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
874f21782d9d52d2f58ab3d407790f047f0692bd
| 47
|
py
|
Python
|
tf/writing/hebrew.py
|
ancient-data/text-fabric
|
c1ccd4a4dc451e94a789f138576576c5d7f13474
|
[
"MIT"
] | 10
|
2017-10-30T22:38:00.000Z
|
2018-12-12T06:10:10.000Z
|
tf/writing/hebrew.py
|
dirkroorda/text-fabric
|
c0a49f092ceda3e7bab91fd0f1aa84e2dc029cf4
|
[
"MIT"
] | 37
|
2017-10-19T12:06:54.000Z
|
2018-12-13T10:18:23.000Z
|
tf/writing/hebrew.py
|
dirkroorda/text-fabric
|
c0a49f092ceda3e7bab91fd0f1aa84e2dc029cf4
|
[
"MIT"
] | 3
|
2018-02-28T12:37:21.000Z
|
2018-06-23T08:32:54.000Z
|
"""
.. include:: ../docs/writing/hebrew.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
|
8761d62310dd4238e28323002772232119d7b174
| 187
|
py
|
Python
|
handlers/user/__init__.py
|
DataAkbar/jayhunGulshaniBot
|
963876ef8831e7119386832e8f5a260cd9e4189d
|
[
"MIT"
] | null | null | null |
handlers/user/__init__.py
|
DataAkbar/jayhunGulshaniBot
|
963876ef8831e7119386832e8f5a260cd9e4189d
|
[
"MIT"
] | null | null | null |
handlers/user/__init__.py
|
DataAkbar/jayhunGulshaniBot
|
963876ef8831e7119386832e8f5a260cd9e4189d
|
[
"MIT"
] | null | null | null |
from .menu import dp
from .cart import dp
from .wallet import dp
from .catalog import dp
from .delivery_status import dp
from .sos import dp
from .create_order import dp
__all__ = ['dp']
| 20.777778
| 31
| 0.770053
| 32
| 187
| 4.3125
| 0.40625
| 0.405797
| 0.521739
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.165775
| 187
| 9
| 32
| 20.777778
| 0.884615
| 0
| 0
| 0
| 0
| 0
| 0.010638
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.875
| 0
| 0.875
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
876478db338992cb14041cf125dd1388dae96a25
| 71
|
py
|
Python
|
autokeras/__init__.py
|
uditjuneja1/autokeras
|
4770d60f343f3ed0cee689518c3ccefa263402d8
|
[
"MIT"
] | null | null | null |
autokeras/__init__.py
|
uditjuneja1/autokeras
|
4770d60f343f3ed0cee689518c3ccefa263402d8
|
[
"MIT"
] | 1
|
2022-02-10T06:00:55.000Z
|
2022-02-10T06:00:55.000Z
|
autokeras/__init__.py
|
uditjuneja1/autokeras
|
4770d60f343f3ed0cee689518c3ccefa263402d8
|
[
"MIT"
] | 1
|
2019-05-17T19:16:26.000Z
|
2019-05-17T19:16:26.000Z
|
from autokeras.image_supervised import ImageClassifier, ImageRegressor
| 35.5
| 70
| 0.901408
| 7
| 71
| 9
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.070423
| 71
| 1
| 71
| 71
| 0.954545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
5e4808858eb12b351fe77d8781119a6c729eead6
| 41
|
py
|
Python
|
cpt test 2.py
|
Pyroooooooo/GameBot
|
4355ee33320450a6d1afe5bb832741761d366aec
|
[
"MIT"
] | 3
|
2021-03-10T04:23:34.000Z
|
2022-01-05T08:47:17.000Z
|
cpt test 2.py
|
39x/GameBot
|
230c1f076a9be07d14e6bc6026cfbc565467e74d
|
[
"MIT"
] | null | null | null |
cpt test 2.py
|
39x/GameBot
|
230c1f076a9be07d14e6bc6026cfbc565467e74d
|
[
"MIT"
] | 4
|
2021-03-10T04:20:03.000Z
|
2021-07-12T11:42:46.000Z
|
import os
os.system("node cpt/index.js")
| 13.666667
| 30
| 0.731707
| 8
| 41
| 3.75
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.097561
| 41
| 2
| 31
| 20.5
| 0.810811
| 0
| 0
| 0
| 0
| 0
| 0.414634
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
5e9f44126889eaa8f6fc3dee2bded6269561aeaa
| 61
|
py
|
Python
|
enthought/pyface/split_application_window.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 3
|
2016-12-09T06:05:18.000Z
|
2018-03-01T13:00:29.000Z
|
enthought/pyface/split_application_window.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 1
|
2020-12-02T00:51:32.000Z
|
2020-12-02T08:48:55.000Z
|
enthought/pyface/split_application_window.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | null | null | null |
# proxy module
from pyface.split_application_window import *
| 20.333333
| 45
| 0.836066
| 8
| 61
| 6.125
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.114754
| 61
| 2
| 46
| 30.5
| 0.907407
| 0.196721
| 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
|
5ea53f9ed277b5ca3f470257b54336e64a7040fa
| 7,503
|
py
|
Python
|
2015/day_01_both.py
|
jorvis/AdventOfCode
|
97c42037abc28c1c16cc3e48a30f2689ca950fb5
|
[
"MIT"
] | null | null | null |
2015/day_01_both.py
|
jorvis/AdventOfCode
|
97c42037abc28c1c16cc3e48a30f2689ca950fb5
|
[
"MIT"
] | null | null | null |
2015/day_01_both.py
|
jorvis/AdventOfCode
|
97c42037abc28c1c16cc3e48a30f2689ca950fb5
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python3
challenge = '((((()(()(((((((()))(((()((((()())(())()(((()((((((()((()(()(((()(()((())))()((()()())))))))))()((((((())((()))(((((()(((((((((()()))((()(())()((())((()(()))((()))()))()(((((()(((()()))()())((()((((())()())()((((())()(()(()(((()(())(()(())(((((((())()()(((())(()(()(()(())))(()((((())((()))(((()(()()(((((()()(()(((()(((((())()))()((()(()))()((()((((())((((())(()(((())()()(()()()()()(())((((())((())(()()))()((((())))((((()())()((((())((()())((())(())(((((()((((()(((()((((())(()(((()()))()))((((((()((())()())))(((()(()))(()()(()(((()(()))((()()()())((()()()(((())())()())())())((()))(()(()))(((((()(()(())((()(())(())()((((()())()))((((())(())((())())((((()(((())(())((()()((((()((((((()(())()()(()(()()((((()))(())()())()))(())))(())))())()()(())(()))()((()(()(())()()))(()())))))(()))(()()))(())(((((()(()(()()((())()())))))((())())((())(()(())((()))(())(((()((((((((()()()(()))()()(((()))()((()()(())(())())()(()(())))(((((()(())(())(()))))())()))(()))()(()(((((((()((((())))())())())())()((((((((((((((()()((((((()()()())())()())())())(())(())))())((()())((()(()))))))()))))))))))))))))())((())((())()()))))))(((()((()(()()))((())(()()))()()())))(())))))))(()(((())))())()())))()()(())()))()(()))())((()()))))(()))))()))(()()(())))))))()(((()))))()(()))(())())))))()))((()))((()))())(())))))))))((((())()))()))()))())(())()()(())))())))(()())()))((()()(())))(())((((((()(())((()(((()(()()(())))()))))))()))()(()((()))()(()))(()(((())((((())())(())(()))))))))())))))))())())))))())))))()()(((())()(()))))))))())))))(())()()()))()))()))(()(())()()())())))))))())()(()(()))))()()()))))())(()))))()()))))()())))))(((())()()))(()))))))))))()()))))()()()))))(()())())()()())()(()))))()(()))(())))))))(((((())(())())()()))()()))(())))))()(()))))(())(()()))()())()))()))()))()))))())()()))())())))(()))(()))))))())()(((())()))))))))()))()())))())))())))()))))))))))()()))(()()))))))(())()(()))))())(()))))(()))))(()())))))())())()()))))())()))))))))(()))))()))))))()(()())))))))()))())))())))())))())))))))())(()()))))))(()())())))()())()))))))))))))))())))()(())))()))())()()(())(()()))(())))())()())(()(()(()))))())))))))))))())(()))()))()))))(())()())()())))))))))))()()))))))))))))())())))))(()())))))))))))())(())))()))))))))())())(()))()))(())))()))()()(())()))))))()((((())()))())())))))()))()))))((()())()))))())))(())))))))))))))))))()))))()()())()))()()))))())()))((()())))())))(()))(()())))))))()))()))))(())))))))(())))))())()()(()))())()))()()))))())()()))))())()))())))))))(()))))()())()))))))))(()))())))(()))()))))(())()))())())(())())())))))))((((())))))()))()))()())()(())))()))()))()())(()())()()(()())()))))())())))))(()))()))))())(()()(())))))(())()()((())())))))(())(())))))))())))))))))()(())))))))()())())())()(()))))))))(()))))))))())()()))()(()))))))()))))))())))))))(())))()()(())()())))))(((())))()((())()))())))(()()))())(())())))()(((()())))))()(()()())))()()(()()(()()))())()(()()()))())()()))()())(()))))())))))())))(())()()))))(()))))(())(()))(())))))()()))()))))())()))()()(())())))((()))())()))))))()()))))((()(()))))()()))))))())))))())(()((()())))))))))))()())())))()))(()))))))(()))(())()())))(()))))))))())()()()()))))(()())))))))((())))()))(()))(())(())()())()))))))))(())))())))(()))()()))(()()))(()))())))()(())))())((()((()(())))((())))()))))((((())())()())))(())))()))))))())(()()((())))())()(()())))))(()())()))())))))))((())())))))))(()(()))())()()(()()(((()(((()())))))()))))))()(())(()()((()()(())()()))())()())()))()())())())))))))(((())))))))()()))))))(((())()))(()()))(()()))))(()(()()((((())()())((()()))))(()(())))))()((()()()())()()((()((()()))(()))(((()()()))(((())))()(((())()))))))((()(())())))(()())(((((()(()))(()((()))(()())()))))(()(()))()(()))(())(((())(()()))))()()))(((()))))(()()()()))())))((()()()(())()))()))))()()))()))))))((((((()()()))))())((()()(((()))))(()(())(()()())())())))()(((()()))(())((())))(()))(()()()())((())())())(()))))()))()((()(())()(()()(())(()))(())()))(())(()))))(())(())())(()()(()((()()((())))((()))()((())))(((()()()()((((()))(()()))()()()(((())((())())(()()(()()()))()((())(())()))())(((()()(())))()((()()())()())(()(())())(((())(())())((())(())()(((()()))(())))((())(()())())(())((()()()((((((())))((()(((((())()))()))(())(()()))()))(())()()))(())((()()())()()(()))())()((())))()((()()())((((()())((())())())((()((()))()))((())((()()(()((()()(((())(()()))))((()((())()(((())(()((())())((())(()((((((())())()(()())()(())(((())((((((()(())(()((()()()((()()(()()()())))()()(((((()()))()((((((()))()(()(()(()(((()())((()))())()((()))(())))()))()()))())()()))())((((())(()(()))(((((((())(((()(((((()(((()()((((())(((())())))(()()()(()(()))()))((((((()))((()(((()(())((()((((()((((((())(((((())))(((()(()))))(((()(((())()((())(()((()))(((()()(((())((((()(()(((((()))(((()(((((((()(()()()(()(()(()()())(())(((((()(())())()())(()(()(()))()(()()()())(()()(()((()))()((())())()(()))((())(()))()(()))()(((()(()(()((((((()()()()())()(((((()()(((()()()((()(((((()))((((((((()()()(((((()))))))(()()()(())(()))(()()))))(())()))(((((()(((((()()(()(()())(((()))((((()((()(()(()((()(()((())))()(((()((()))((()))(((((((((()((()((()(())))()((((()((()()))((())(((()(((((()()(()(()()((()(()()()(((((((())())()())))))((((()()(()))()))(()((())()(()(((((((((()()(((()(()())(()((()())((())())((((()(((()(((()((((()((()((((()(()((((((())((((((((((((()()(()()((((((((((((((()((()()))()((((((((((((())((((()(()())((()(()(()))()(((((()()(((()()))()())(())((()(((((()((())(((((()((()(((((()))()()((((())()((((())(((((((((()(())(()(())))())(()((())(((())(())(())())(()(()(())()()((()((())()(((()(((((()(())))()(((()((())))((()()()(((()(((()((()(()(())(()((()())(()(()(((()(((((((((())(()((((()()))(()((((()()()()(((()((((((((()(()()((((((()(()()(()((()((((((((((()()(((((((()())(())))(((()()))(((((()((()()())(()()((((())((()((((()))))(())((()(()()(((()(()(((()((((()(((((()))())())(()((())()))(((()())((())((())((((()((()((((((())(()((((()()))((((((())()(()))((()(((())((((((((((()()(((((()(((((()((()()()((((())))(()))()((()(())()()((()((((((((((()((())(())(((((()(()(()()))((((()((((()()((()(((()(((((((((()(()((()((()))((((((()(((())()()((()(((((((()())))()()(()((()((()()(((()(()()()()((((()((())((((()(((((((((()(((()()(((()(()(((()(((()((())()(()((()(()(()(()))()(((()))(()((((()((())((((())((((((())(()))(()((((())((()(()((((((((()()((((((()(()(()()()(())((()((()()(((()(((((((()()((()(((((((()))(((((()(((()(()()()(()(((()((()()((())(()(((((((((()(()((()((((((()()((())()))(((((()((())()())()(((((((((((()))((((()()()()())(()()(()(()()))()))(()))(()(((()()))())(()(()))()()((())(()())()())()(()))()))(()()(()((((((())((()(((((((((((()(())()((()(()((()((()(()((()((((((((((()()())((())()(())))((())()())()(((((()(()())((((()((()(())(()))(((())()((()))(((((())(()))()()(()))(((())((((()((((()(())))(((((((()))))())()())(())((())()(()()((()(()))()(()()(()()((()())((())((()()))((((()))()()))(()()(())()()(((((()(())((()((((()))()))(()())())(((()()(()()))(())))))(()))((())(((((()((((()))()((((()))()((())(((())))(((()())))((()(()()(('
floor = 0
position = 1
basement_entered = False
for c in challenge:
if c == '(':
floor += 1
elif c == ')':
floor -= 1
else:
raise Exception("Error: unrecognized character: {0}".format(c))
if floor < 0 and basement_entered is False:
print("INFO: Santa first entered the basement on position {0}".format(position))
basement_entered = True
position += 1
print("INFO: Final floor is {0}".format(floor))
| 312.625
| 7,014
| 0.040784
| 66
| 7,503
| 4.590909
| 0.515152
| 0.148515
| 0.046205
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.001357
| 0.017593
| 7,503
| 23
| 7,015
| 326.217391
| 0.03975
| 0.002799
| 0
| 0
| 0
| 0
| 0.950942
| 0.935704
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.125
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
5eaf4a9b3d3e763db16e158d2364c82c37b5e125
| 322
|
py
|
Python
|
Services/registrationWorkerService.py
|
prodProject/WorkkerAndConsumerServer
|
95496f026109279c9891e08af46040c7b9487c81
|
[
"MIT"
] | null | null | null |
Services/registrationWorkerService.py
|
prodProject/WorkkerAndConsumerServer
|
95496f026109279c9891e08af46040c7b9487c81
|
[
"MIT"
] | null | null | null |
Services/registrationWorkerService.py
|
prodProject/WorkkerAndConsumerServer
|
95496f026109279c9891e08af46040c7b9487c81
|
[
"MIT"
] | null | null | null |
from RegisrationModule.registrationWorker import RegistrationWorker
class RegistrationWorkerService:
m_registrationWorker = RegistrationWorker()
def registration(self,registrationRequestPb):
self.m_registrationWorker.start(workerPb=registrationRequestPb)
return self.m_registrationWorker.done()
| 32.2
| 71
| 0.81677
| 25
| 322
| 10.4
| 0.6
| 0.219231
| 0.176923
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.127329
| 322
| 9
| 72
| 35.777778
| 0.925267
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.166667
| 0
| 0.833333
| 0
| 1
| 0
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
5ed64734b56af8c427299608905c03b1b2c09972
| 88
|
py
|
Python
|
VSCode_work/chapter2/chapter2_2_2.py
|
yangyahu-1994/Python-Crash-Course
|
6f8ef7fe8466d88931a0d3cc423ba5d966663b9d
|
[
"MIT"
] | 12
|
2020-10-22T14:03:27.000Z
|
2022-03-28T08:14:22.000Z
|
VSCode_work/chapter2/chapter2_2_2.py
|
yangyahu-1994/Python-Crash-Course
|
6f8ef7fe8466d88931a0d3cc423ba5d966663b9d
|
[
"MIT"
] | null | null | null |
VSCode_work/chapter2/chapter2_2_2.py
|
yangyahu-1994/Python-Crash-Course
|
6f8ef7fe8466d88931a0d3cc423ba5d966663b9d
|
[
"MIT"
] | 9
|
2020-12-22T10:22:12.000Z
|
2022-03-28T08:14:53.000Z
|
message = "hello python world!"
print(message)
message = "hello world!"
print(message)
| 14.666667
| 31
| 0.727273
| 11
| 88
| 5.818182
| 0.454545
| 0.375
| 0.53125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.136364
| 88
| 5
| 32
| 17.6
| 0.842105
| 0
| 0
| 0.5
| 0
| 0
| 0.352273
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
0d80cbf1ddb51f16703490502f66660450b362a4
| 375
|
py
|
Python
|
nets/base.py
|
yd8534976/FashionAI-TF
|
9bb4e84a5d32cb696756d20b34d448a4dd7433dd
|
[
"MIT"
] | 20
|
2018-07-01T06:31:44.000Z
|
2021-12-21T10:14:38.000Z
|
nets/base.py
|
yd8534976/FashionAI-TF
|
9bb4e84a5d32cb696756d20b34d448a4dd7433dd
|
[
"MIT"
] | 1
|
2019-03-20T06:44:28.000Z
|
2019-03-20T08:16:45.000Z
|
nets/base.py
|
yd8534976/FashionAI-TF
|
9bb4e84a5d32cb696756d20b34d448a4dd7433dd
|
[
"MIT"
] | 3
|
2018-07-13T14:37:13.000Z
|
2018-12-28T06:40:58.000Z
|
class BaseModel(object):
def __init__(self):
pass
def build_inputs(self):
raise NotImplementedError
def build_inference(self):
raise NotImplementedError
def build_loss(self):
raise NotImplementedError
def build_solver(self):
raise NotImplementedError
def train_op(self):
raise NotImplementedError
| 18.75
| 33
| 0.669333
| 37
| 375
| 6.540541
| 0.432432
| 0.18595
| 0.578512
| 0.512397
| 0.446281
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.274667
| 375
| 19
| 34
| 19.736842
| 0.889706
| 0
| 0
| 0.384615
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.461538
| false
| 0.076923
| 0
| 0
| 0.538462
| 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
|
0dd1f53ecd9b545e07c14c5a4940688d51838472
| 215
|
py
|
Python
|
index/admin.py
|
CPLUG/cplug.org-backend
|
04ed152b0571dcd616afa4ca2c3951660705336f
|
[
"MIT"
] | null | null | null |
index/admin.py
|
CPLUG/cplug.org-backend
|
04ed152b0571dcd616afa4ca2c3951660705336f
|
[
"MIT"
] | 1
|
2018-02-25T07:22:54.000Z
|
2018-02-25T07:22:54.000Z
|
index/admin.py
|
CPLUG/cplug.org-backend
|
04ed152b0571dcd616afa4ca2c3951660705336f
|
[
"MIT"
] | 1
|
2018-02-11T08:53:16.000Z
|
2018-02-11T08:53:16.000Z
|
from django.contrib import admin
from adminsortable.admin import SortableAdmin
from .models import Event, Officer
# Register your models here.
admin.site.register(Event)
admin.site.register(Officer, SortableAdmin)
| 26.875
| 45
| 0.827907
| 28
| 215
| 6.357143
| 0.5
| 0.101124
| 0.191011
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.102326
| 215
| 7
| 46
| 30.714286
| 0.92228
| 0.12093
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.6
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
0dd2b932fbf79c1401af47aabf74be1d39c4b0b4
| 187
|
py
|
Python
|
map_service/meteo/views.py
|
berthakim/map-service
|
881647a4a2627c633094d45519b0cf6b2c7050b9
|
[
"MIT"
] | null | null | null |
map_service/meteo/views.py
|
berthakim/map-service
|
881647a4a2627c633094d45519b0cf6b2c7050b9
|
[
"MIT"
] | null | null | null |
map_service/meteo/views.py
|
berthakim/map-service
|
881647a4a2627c633094d45519b0cf6b2c7050b9
|
[
"MIT"
] | null | null | null |
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic import TemplateView
def meteo(request):
return render(request, 'meteo/meteo.html')
| 26.714286
| 46
| 0.807487
| 25
| 187
| 6.04
| 0.6
| 0.198676
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.117647
| 187
| 6
| 47
| 31.166667
| 0.915152
| 0
| 0
| 0
| 0
| 0
| 0.085562
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.6
| 0.2
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 5
|
21b38c0fc0286c99e1ff712e33ccd64db436a01e
| 48
|
py
|
Python
|
slack/signature/__init__.py
|
TheFRedFox/python-slackclient
|
909959a1390d8d634263cb1b528f019e35cb88d1
|
[
"MIT"
] | 1
|
2020-10-21T03:22:06.000Z
|
2020-10-21T03:22:06.000Z
|
slack/signature/__init__.py
|
TheFRedFox/python-slackclient
|
909959a1390d8d634263cb1b528f019e35cb88d1
|
[
"MIT"
] | 2
|
2021-10-05T10:39:19.000Z
|
2022-01-19T08:41:06.000Z
|
slack/signature/__init__.py
|
TheFRedFox/python-slackclient
|
909959a1390d8d634263cb1b528f019e35cb88d1
|
[
"MIT"
] | null | null | null |
from .verifier import SignatureVerifier # noqa
| 24
| 47
| 0.8125
| 5
| 48
| 7.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.145833
| 48
| 1
| 48
| 48
| 0.95122
| 0.083333
| 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
|
21b54963bf372bdb57445936a639b7dcb3b635d9
| 12,751
|
py
|
Python
|
tests/test_tf/test_mnist_tf.py
|
SymbioticLab/Salus
|
b2a194e7e4654b51dbd8d8fc1577fb1e9915ca6f
|
[
"Apache-2.0"
] | 104
|
2019-02-12T20:41:07.000Z
|
2022-03-07T16:58:47.000Z
|
tests/test_tf/test_mnist_tf.py
|
SymbioticLab/Salus
|
b2a194e7e4654b51dbd8d8fc1577fb1e9915ca6f
|
[
"Apache-2.0"
] | 9
|
2019-08-24T03:23:21.000Z
|
2021-06-06T17:59:07.000Z
|
tests/test_tf/test_mnist_tf.py
|
SymbioticLab/Salus
|
b2a194e7e4654b51dbd8d8fc1577fb1e9915ca6f
|
[
"Apache-2.0"
] | 18
|
2019-03-04T07:45:41.000Z
|
2021-09-15T22:13:07.000Z
|
from __future__ import print_function
import unittest
import numpy as np
from datetime import datetime
from timeit import default_timer
from parameterized import parameterized
import tensorflow as tf
from . import run_on_rpc_and_gpu, run_on_devices, run_on_sessions, assertAllClose, tfDistributedEndpointOrSkip
from .lib import tfhelper
from .lib.datasets import fake_data
def run_mnist_softmax(sess, batch_size=50):
batch_size = tfhelper.batch_size_from_env(batch_size)
print('Using batch_size {}'.format(batch_size))
x_image, y_, num_classes = fake_data(batch_size, None, height=28, width=28, depth=1, num_classes=10)
y_ = tf.one_hot(y_, num_classes)
x = tf.reshape(x_image, [-1, 784])
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
y = tf.matmul(x, W) + b
cross_entropy = tf.reduce_mean(
tf.nn.softmax_cross_entropy_with_logits_v2(labels=tf.stop_gradient(y_), logits=y))
train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy)
salus_marker = tf.no_op("salus_main_iter")
with tfhelper.initialized_scope(sess) as coord:
jct = default_timer()
speeds = []
losses = []
for i in range(tfhelper.iteration_num_from_env()):
if coord.should_stop():
break
print("{}: Start running step {}".format(datetime.now(), i))
start_time = default_timer()
_, loss_value, _ = sess.run([train_step, cross_entropy, salus_marker])
duration = default_timer() - start_time
examples_per_sec = batch_size / duration
sec_per_batch = float(duration)
speeds.append(sec_per_batch)
losses.append(loss_value)
fmt_str = '{}: step {}, loss = {:.2f} ({:.1f} examples/sec; {:.3f} sec/batch)'
print(fmt_str.format(datetime.now(), i, loss_value, examples_per_sec, sec_per_batch))
jct = default_timer() - jct
print('Training time is %.3f sec' % jct)
print('Average: %.3f sec/batch' % np.average(speeds))
if len(speeds) > 1:
print('First iteration: %.3f sec/batch' % speeds[0])
print('Average excluding first iteration: %.3f sec/batch' %
np.average(speeds[1:]))
return losses
def run_mnist_conv(sess, batch_size=50):
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
initial = tf.constant(0.1, shape=shape)
return tf.Variable(initial)
def conv2d(x, W):
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
def max_pool_2x2(x):
return tf.nn.max_pool(x, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME')
batch_size = tfhelper.batch_size_from_env(batch_size)
print('Using batch_size {}'.format(batch_size))
x_image, y_, num_classes = fake_data(batch_size, None, height=28, width=28, depth=1, num_classes=10)
y_ = tf.one_hot(y_, num_classes)
keep_prob = tf.placeholder(tf.float32)
W_conv1 = weight_variable([5, 5, 1, 32])
b_conv1 = bias_variable([32])
h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)
h_pool1 = max_pool_2x2(h_conv1)
W_conv2 = weight_variable([5, 5, 32, 64])
b_conv2 = bias_variable([64])
h_conv2 = tf.nn.relu(conv2d(h_pool1, W_conv2) + b_conv2)
h_pool2 = max_pool_2x2(h_conv2)
W_fc1 = weight_variable([7 * 7 * 64, 1024])
b_fc1 = bias_variable([1024])
h_pool2_flat = tf.reshape(h_pool2, [-1, 7 * 7 * 64])
h_fc1 = tf.nn.relu(tf.matmul(h_pool2_flat, W_fc1) + b_fc1)
h_fc1_drop = tf.nn.dropout(h_fc1, keep_prob)
W_fc2 = weight_variable([1024, 10])
b_fc2 = bias_variable([10])
y_fc2 = tf.matmul(h_fc1_drop, W_fc2) + b_fc2
cross_entropy = tf.reduce_mean(
tf.nn.softmax_cross_entropy_with_logits_v2(labels=tf.stop_gradient(y_), logits=y_fc2))
train_step = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)
salus_marker = tf.no_op("salus_main_iter")
speeds = []
losses = []
with tfhelper.initialized_scope(sess) as coord:
jct = default_timer()
for i in range(tfhelper.iteration_num_from_env()):
if coord.should_stop():
break
print("{}: Start running step {}".format(datetime.now(), i))
start_time = default_timer()
sess.run([train_step, salus_marker], feed_dict={keep_prob: 0.5})
duration = default_timer() - start_time
examples_per_sec = batch_size / duration
sec_per_batch = float(duration)
speeds.append(sec_per_batch)
loss_value = sess.run(cross_entropy, feed_dict={keep_prob: 0.5})
losses.append(loss_value)
fmt_str = '{}: step {}, loss = {:.2f} ({:.1f} examples/sec; {:.3f} sec/batch)'
print(fmt_str.format(datetime.now(), i, loss_value, examples_per_sec, sec_per_batch))
jct = default_timer() - jct
print('Training time is %.3f sec' % jct)
print('Average: %.3f sec/batch' % np.average(speeds))
if len(speeds) > 1:
print('First iteration: %.3f sec/batch' % speeds[0])
print('Average excluding first iteration: %.3f sec/batch' %
np.average(speeds[1:]))
return losses
def run_mnist_large(sess, batch_size=50):
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
initial = tf.constant(0.1, shape=shape)
return tf.Variable(initial)
def conv2d(x, W):
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
def max_pool_2x2(x):
return tf.nn.max_pool(x, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME')
batch_size = tfhelper.batch_size_from_env(batch_size)
print('Using batch_size {}'.format(batch_size))
x_image, y_, num_classes = fake_data(batch_size, None, height=28, width=28, depth=1, num_classes=10)
y_ = tf.one_hot(y_, num_classes)
keep_prob = tf.placeholder(tf.float32)
W_conv1 = weight_variable([5, 5, 1, 32])
b_conv1 = bias_variable([32])
h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)
h_pool1 = max_pool_2x2(h_conv1)
W_conv2 = weight_variable([5, 5, 32, 64])
b_conv2 = bias_variable([64])
h_conv2 = tf.nn.relu(conv2d(h_pool1, W_conv2) + b_conv2)
h_pool2 = max_pool_2x2(h_conv2)
W_conv3 = weight_variable([5, 5, 64, 64])
b_conv3 = bias_variable([64])
h_conv3 = tf.nn.relu(conv2d(h_pool2, W_conv3) + b_conv3)
h_pool3 = max_pool_2x2(h_conv3)
W_conv4 = weight_variable([5, 5, 64, 128])
b_conv4 = bias_variable([128])
h_conv4 = tf.nn.relu(conv2d(h_pool3, W_conv4) + b_conv4)
h_pool4 = max_pool_2x2(h_conv4)
h_pool_flat = tf.reshape(h_pool4, [-1, 512])
W_fc1 = weight_variable([512, 1024])
b_fc1 = bias_variable([1024])
h_fc1 = tf.nn.relu(tf.matmul(h_pool_flat, W_fc1) + b_fc1)
h_fc1_drop = tf.nn.dropout(h_fc1, keep_prob)
W_fc11 = weight_variable([1024, 1024])
b_fc11 = bias_variable([1024])
h_fc11 = tf.nn.relu(tf.matmul(h_fc1_drop, W_fc11) + b_fc11)
h_fc11_drop = tf.nn.dropout(h_fc11, keep_prob)
W_fc2 = weight_variable([1024, 10])
b_fc2 = bias_variable([10])
y_fc2 = tf.matmul(h_fc11_drop, W_fc2) + b_fc2
cross_entropy = tf.reduce_mean(
tf.nn.softmax_cross_entropy_with_logits_v2(labels=tf.stop_gradient(y_), logits=y_fc2))
train_step = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)
salus_marker = tf.no_op("salus_main_iter")
speeds = []
inbetween = []
last_end_time = 0
losses = []
with tfhelper.initialized_scope(sess) as coord:
jct = default_timer()
for i in range(tfhelper.iteration_num_from_env()):
if coord.should_stop():
break
print("{}: Start running step {}".format(datetime.now(), i))
start_time = default_timer()
_, loss_value, _ = sess.run([train_step, cross_entropy, salus_marker], feed_dict={keep_prob: 0.5})
end_time = default_timer()
if last_end_time > 0:
inbetween.append(start_time - last_end_time)
last_end_time = end_time
duration = end_time - start_time
examples_per_sec = batch_size / duration
sec_per_batch = float(duration)
speeds.append(sec_per_batch)
losses.append(loss_value)
fmt_str = '{}: step {}, loss = {:.2f} ({:.1f} examples/sec; {:.3f} sec/batch)'
print(fmt_str.format(datetime.now(), i,
loss_value, examples_per_sec, sec_per_batch))
jct = default_timer() - jct
print('Training time is %.3f sec' % jct)
print('Average: %.3f sec/batch' % np.average(speeds))
if len(speeds) > 1:
print('First iteration: %.3f sec/batch' % speeds[0])
print('Average excluding first iteration: %.3f sec/batch' %
np.average(speeds[1:]))
return losses
class MnistConvBase(unittest.TestCase):
def _runner(self, batch_size):
return None
def _config(self, **kwargs):
c = tf.ConfigProto()
# c.graph_options.optimizer_options.opt_level = tf.OptimizerOptions.L0
c.allow_soft_placement = True
return c
@parameterized.expand([(25,), (50,), (100,)])
def test_gpu(self, batch_size):
config = self._config(batch_size=batch_size)
config.allow_soft_placement = True
run_on_devices(self._runner(batch_size), '/device:GPU:0', config=config)
@unittest.skip("No need to run on CPU")
def test_cpu(self):
run_on_devices(self._runner(50), '/device:CPU:0', config=self._config())
@parameterized.expand([(25,), (50,), (100,)])
def test_rpc(self, batch_size):
run_on_sessions(self._runner(batch_size), 'zrpc://tcp://127.0.0.1:5501', dev='/device:GPU:0',
config=self._config(batch_size=batch_size))
@parameterized.expand([(25,), (50,), (100,)])
def test_distributed(self, batch_size):
run_on_sessions(self._runner(batch_size),
tfDistributedEndpointOrSkip(),
dev='/job:tfworker/device:GPU:0',
config=self._config(batch_size=batch_size))
@parameterized.expand([(25,), (50,), (100,)])
def test_correctness(self, batch_size):
actual, expected = run_on_rpc_and_gpu(self._runner(batch_size), config=self._config())
assertAllClose(actual, expected, rtol=1e-3)
class TestMnistSoftmax(MnistConvBase):
def _runner(self, batch_size):
return lambda: run_mnist_softmax(tf.get_default_session(), batch_size)
class TestMnistConv(MnistConvBase):
def _runner(self, batch_size):
return lambda: run_mnist_conv(tf.get_default_session(), batch_size)
def _config(self, **kwargs):
MB = 1024 * 1024
memusages = {
25: (100 * MB - 38 * MB, 38 * MB),
50: (128 * MB - 58 * MB, 58 * MB),
100: (182 * MB - 112 * MB, 112 * MB),
}
batch_size = kwargs.get('batch_size', 50)
config = tf.ConfigProto()
config.allow_soft_placement = True
config.salus_options.resource_map.temporary['MEMORY:GPU'] = memusages[batch_size][0]
config.salus_options.resource_map.persistant['MEMORY:GPU'] = memusages[batch_size][1]
config.salus_options.resource_map.temporary['MEMORY:GPU0'] = memusages[batch_size][0]
config.salus_options.resource_map.persistant['MEMORY:GPU0'] = memusages[batch_size][1]
return config
class TestMnistLarge(MnistConvBase):
def _runner(self, batch_size):
return lambda: run_mnist_large(tf.get_default_session(), batch_size)
def _config(self, **kwargs):
MB = 1024 * 1024
memusages = {
25: (110 * MB - 61 * MB, 61 * MB),
50: (136 * MB - 86 * MB, 86 * MB),
100: (197 * MB - 137 * MB, 137 * MB),
}
batch_size = kwargs.get('batch_size', 50)
config = tf.ConfigProto()
config.allow_soft_placement = True
config.salus_options.resource_map.temporary['MEMORY:GPU'] = memusages[batch_size][0]
config.salus_options.resource_map.persistant['MEMORY:GPU'] = memusages[batch_size][1]
config.salus_options.resource_map.temporary['MEMORY:GPU0'] = memusages[batch_size][0]
config.salus_options.resource_map.persistant['MEMORY:GPU0'] = memusages[batch_size][1]
return config
del MnistConvBase
if __name__ == '__main__':
unittest.main()
| 38.062687
| 110
| 0.63548
| 1,785
| 12,751
| 4.260504
| 0.136134
| 0.067456
| 0.015779
| 0.02735
| 0.791716
| 0.763314
| 0.749901
| 0.730309
| 0.718606
| 0.718606
| 0
| 0.049933
| 0.23355
| 12,751
| 334
| 111
| 38.176647
| 0.728231
| 0.005333
| 0
| 0.659004
| 0
| 0.011494
| 0.078858
| 0.004179
| 0
| 0
| 0
| 0
| 0.007663
| 1
| 0.088123
| false
| 0
| 0.038314
| 0.030651
| 0.210728
| 0.084291
| 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
|
21bd8783fffbe261278ff38adced4f074a1cc239
| 181
|
py
|
Python
|
CodePi/led.py
|
koushikjay66/NKTR
|
03acc4ed7f31d00ce9c164828579b7f6cff90d12
|
[
"Apache-2.0"
] | 1
|
2017-04-03T03:46:29.000Z
|
2017-04-03T03:46:29.000Z
|
CodePi/led.py
|
koushikjay66/NKTR
|
03acc4ed7f31d00ce9c164828579b7f6cff90d12
|
[
"Apache-2.0"
] | null | null | null |
CodePi/led.py
|
koushikjay66/NKTR
|
03acc4ed7f31d00ce9c164828579b7f6cff90d12
|
[
"Apache-2.0"
] | 2
|
2018-01-19T16:24:17.000Z
|
2019-07-28T07:06:23.000Z
|
import time
def setUpChor():
GPIO.setup(11,GPIO.OUT)
def chor():
setUpChor()
GPIO.output(11, True)
time.sleep(2)
GPIO.output(11, False)
GPIO.cleanup(11)
| 12.928571
| 27
| 0.618785
| 26
| 181
| 4.307692
| 0.576923
| 0.232143
| 0.214286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.064748
| 0.232044
| 181
| 13
| 28
| 13.923077
| 0.741007
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| true
| 0
| 0.111111
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
21c1d72b8790c64ab258761cabf0bd24d181209c
| 12
|
py
|
Python
|
notebooks/python_recap/_solutions/python_rehearsal54.py
|
rprops/Python_DS-WS
|
b2fc449a74be0c82863e5fcf1ddbe7d64976d530
|
[
"BSD-3-Clause"
] | 3
|
2019-07-23T15:14:03.000Z
|
2020-11-10T06:12:18.000Z
|
notebooks/python_recap/_solutions/python_rehearsal54.py
|
rprops/Python_DS-WS
|
b2fc449a74be0c82863e5fcf1ddbe7d64976d530
|
[
"BSD-3-Clause"
] | null | null | null |
notebooks/python_recap/_solutions/python_rehearsal54.py
|
rprops/Python_DS-WS
|
b2fc449a74be0c82863e5fcf1ddbe7d64976d530
|
[
"BSD-3-Clause"
] | 3
|
2020-03-04T23:40:20.000Z
|
2021-11-04T16:41:10.000Z
|
a_list[::-1]
| 12
| 12
| 0.583333
| 3
| 12
| 2
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 0
| 12
| 1
| 12
| 12
| 0.416667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
21c4d97f793a9e4591c558d4eb992c8348cf7aaf
| 223
|
py
|
Python
|
dependencies/utils/get_data.py
|
narayana1043/pyspark-emr-etl
|
56f397e7d3da09bf1f8818629a695129adbfb9d1
|
[
"CNRI-Python"
] | 2
|
2021-03-02T05:07:36.000Z
|
2021-12-02T12:10:53.000Z
|
dependencies/utils/get_data.py
|
narayana1043/pyspark-emr-etl
|
56f397e7d3da09bf1f8818629a695129adbfb9d1
|
[
"CNRI-Python"
] | null | null | null |
dependencies/utils/get_data.py
|
narayana1043/pyspark-emr-etl
|
56f397e7d3da09bf1f8818629a695129adbfb9d1
|
[
"CNRI-Python"
] | 1
|
2021-12-09T12:41:54.000Z
|
2021-12-09T12:41:54.000Z
|
import json
import requests
from dependencies.utils import conn
from dependencies.utils import utils
# module level connections
es = conn.get_es_conn()
countries = utils.get_countries()
def get_sample():
return None
| 17.153846
| 36
| 0.789238
| 31
| 223
| 5.548387
| 0.548387
| 0.186047
| 0.244186
| 0.313953
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.147982
| 223
| 12
| 37
| 18.583333
| 0.905263
| 0.107623
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| false
| 0
| 0.5
| 0.125
| 0.75
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 5
|
21dbff63a6adc6f0999ef71e4dc0aa67f14c4954
| 96
|
py
|
Python
|
venv/lib/python3.8/site-packages/poetry/installation/operations/install.py
|
Retraces/UkraineBot
|
3d5d7f8aaa58fa0cb8b98733b8808e5dfbdb8b71
|
[
"MIT"
] | 2
|
2022-03-13T01:58:52.000Z
|
2022-03-31T06:07:54.000Z
|
venv/lib/python3.8/site-packages/poetry/installation/operations/install.py
|
DesmoSearch/Desmobot
|
b70b45df3485351f471080deb5c785c4bc5c4beb
|
[
"MIT"
] | 19
|
2021-11-20T04:09:18.000Z
|
2022-03-23T15:05:55.000Z
|
venv/lib/python3.8/site-packages/poetry/installation/operations/install.py
|
DesmoSearch/Desmobot
|
b70b45df3485351f471080deb5c785c4bc5c4beb
|
[
"MIT"
] | null | null | null |
/home/runner/.cache/pip/pool/7a/ba/1e/4220847eb639bf77544e7bd4812cd9d227f5bcddefcbb1b8e61cb116a3
| 96
| 96
| 0.895833
| 9
| 96
| 9.555556
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.364583
| 0
| 96
| 1
| 96
| 96
| 0.53125
| 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
|
21f0250f840385273bd5a42f57aeabffbad8a885
| 133
|
py
|
Python
|
filterflow/proposal/__init__.py
|
JTT94/filterflow
|
536f71105dc263472f54e80f2ef4ad5e4ee6621f
|
[
"Apache-2.0"
] | 23
|
2020-05-26T14:38:10.000Z
|
2022-02-05T12:49:36.000Z
|
filterflow/proposal/__init__.py
|
JTT94/filterflow
|
536f71105dc263472f54e80f2ef4ad5e4ee6621f
|
[
"Apache-2.0"
] | 3
|
2021-05-16T22:03:03.000Z
|
2021-12-15T07:43:10.000Z
|
filterflow/proposal/__init__.py
|
JTT94/filterflow
|
536f71105dc263472f54e80f2ef4ad5e4ee6621f
|
[
"Apache-2.0"
] | 3
|
2020-06-03T14:40:07.000Z
|
2021-07-27T20:55:58.000Z
|
from .base import ProposalModelBase
from .bootstrap import BootstrapProposalModel
from .optimal_proposal import OptimalProposalModel
| 33.25
| 50
| 0.887218
| 13
| 133
| 9
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090226
| 133
| 3
| 51
| 44.333333
| 0.966942
| 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
|
df06d5f150eacf01d29f3ef90be79e621792186a
| 91
|
py
|
Python
|
oembed/contrib/models.py
|
EightMedia/djangoembed
|
ee325f7375c48405f9c3e7e2c0fa7f5a08fafd48
|
[
"MIT"
] | 8
|
2015-02-06T19:18:49.000Z
|
2021-01-01T05:46:02.000Z
|
oembed/contrib/models.py
|
EightMedia/djangoembed
|
ee325f7375c48405f9c3e7e2c0fa7f5a08fafd48
|
[
"MIT"
] | null | null | null |
oembed/contrib/models.py
|
EightMedia/djangoembed
|
ee325f7375c48405f9c3e7e2c0fa7f5a08fafd48
|
[
"MIT"
] | 5
|
2015-03-15T11:41:26.000Z
|
2018-03-08T09:45:26.000Z
|
# ,___,
# (6v6)
# (_^(_\
# ^^^"^" \\^^^^
# ^^^^^^^^^^^^^
| 15.166667
| 18
| 0.087912
| 1
| 91
| 3
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.043478
| 0.494505
| 91
| 5
| 19
| 18.2
| 0.021739
| 0.835165
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
df3e25db25936865e1b6f2f5708e2914d8ba8b2a
| 79
|
py
|
Python
|
python/testData/paramInfo/Py3kPastTupleArg.py
|
truthiswill/intellij-community
|
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
|
[
"Apache-2.0"
] | 2
|
2019-04-28T07:48:50.000Z
|
2020-12-11T14:18:08.000Z
|
python/testData/paramInfo/Py3kPastTupleArg.py
|
truthiswill/intellij-community
|
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
|
[
"Apache-2.0"
] | 173
|
2018-07-05T13:59:39.000Z
|
2018-08-09T01:12:03.000Z
|
python/testData/paramInfo/Py3kPastTupleArg.py
|
truthiswill/intellij-community
|
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
|
[
"Apache-2.0"
] | 2
|
2020-03-15T08:57:37.000Z
|
2020-04-07T04:48:14.000Z
|
def foo(*arg, a=1, b=2):
pass
foo(<arg1>1, <arg2>2, <arg3>b=10, <arg4>a=20)
| 15.8
| 45
| 0.556962
| 19
| 79
| 2.315789
| 0.736842
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.179104
| 0.151899
| 79
| 4
| 46
| 19.75
| 0.477612
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0.333333
| 0
| null | null | 0
| 1
| 0
| 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
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
df411bf97a895b1bd617aa9e3afdd02d21c1d825
| 38
|
py
|
Python
|
ggnnmols/models/__init__.py
|
YunjaeChoi/ggnnmols
|
543c578eddde1a9572a089d646d05a5e3da2c1ff
|
[
"MIT"
] | 4
|
2020-08-10T12:36:58.000Z
|
2022-02-20T11:15:20.000Z
|
ggnnmols/models/__init__.py
|
YunjaeChoi/ggnnmols
|
543c578eddde1a9572a089d646d05a5e3da2c1ff
|
[
"MIT"
] | null | null | null |
ggnnmols/models/__init__.py
|
YunjaeChoi/ggnnmols
|
543c578eddde1a9572a089d646d05a5e3da2c1ff
|
[
"MIT"
] | 2
|
2020-05-11T09:53:03.000Z
|
2020-08-10T01:31:35.000Z
|
from ggnnmols.models.ggnn import GGNN
| 19
| 37
| 0.842105
| 6
| 38
| 5.333333
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 38
| 1
| 38
| 38
| 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
|
df7342900704dfdc24ab6422461a84980361abb2
| 36
|
py
|
Python
|
src/betterjira.py
|
jamesbroadhead/betterjira
|
847f1c9c658ca1a2407523bf0d209878e9afb5da
|
[
"Apache-2.0"
] | null | null | null |
src/betterjira.py
|
jamesbroadhead/betterjira
|
847f1c9c658ca1a2407523bf0d209878e9afb5da
|
[
"Apache-2.0"
] | 2
|
2018-09-19T12:09:16.000Z
|
2021-06-01T22:57:56.000Z
|
src/betterjira.py
|
jamesbroadhead/betterjira
|
847f1c9c658ca1a2407523bf0d209878e9afb5da
|
[
"Apache-2.0"
] | null | null | null |
class BetterJira(object):
pass
| 9
| 25
| 0.694444
| 4
| 36
| 6.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.222222
| 36
| 3
| 26
| 12
| 0.892857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
10c51ac249ba4e9fc8474d35946a6d82fee561c6
| 459
|
py
|
Python
|
numbercrunch.py
|
TechyTommy3/NumberCrunch
|
b507f9da80c1786b8ddc21794f741fe7f4d02a91
|
[
"MIT"
] | null | null | null |
numbercrunch.py
|
TechyTommy3/NumberCrunch
|
b507f9da80c1786b8ddc21794f741fe7f4d02a91
|
[
"MIT"
] | null | null | null |
numbercrunch.py
|
TechyTommy3/NumberCrunch
|
b507f9da80c1786b8ddc21794f741fe7f4d02a91
|
[
"MIT"
] | 1
|
2021-09-07T16:41:38.000Z
|
2021-09-07T16:41:38.000Z
|
print("NOTE: NumberCrunch is not a random number generator.")
print("NumberCrunch")
while 0 == 0:
number = input("Enter in a number to crunch: ")
print("Crunching...")
number = int(number)
number2 = (((number * number) * 2) - number + (number * 2)) * number * (number * number) - (number * number - number * (number * number)) - (number * 2) * (number * 2) - (number - 6) * (number * number - number) * (number * 3 - number)
print(number2)
| 57.375
| 239
| 0.607843
| 56
| 459
| 4.982143
| 0.392857
| 0.55914
| 0.580645
| 0.602151
| 0.286738
| 0.193548
| 0.193548
| 0.193548
| 0
| 0
| 0
| 0.027778
| 0.215686
| 459
| 8
| 240
| 57.375
| 0.747222
| 0
| 0
| 0
| 0
| 0
| 0.228261
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
10c6b61cd942fc1a795e98b155716d4c93e003f3
| 872
|
py
|
Python
|
common/boto/fps/test/test_verify_signature.py
|
bopopescu/drawquest-web
|
8d8f9149b6efeb65202809a5f8916386f58a1b3b
|
[
"BSD-3-Clause"
] | 61
|
2015-11-10T17:13:46.000Z
|
2021-08-06T17:58:30.000Z
|
common/boto/fps/test/test_verify_signature.py
|
bopopescu/drawquest-web
|
8d8f9149b6efeb65202809a5f8916386f58a1b3b
|
[
"BSD-3-Clause"
] | 13
|
2015-11-11T07:49:41.000Z
|
2021-06-09T03:45:31.000Z
|
common/boto/fps/test/test_verify_signature.py
|
bopopescu/drawquest-web
|
8d8f9149b6efeb65202809a5f8916386f58a1b3b
|
[
"BSD-3-Clause"
] | 18
|
2015-11-11T04:50:04.000Z
|
2021-08-20T00:57:11.000Z
|
from boto.fps.connection import FPSConnection
conn = FPSConnection()
# example response from the docs
params = 'expiry=08%2F2015&signature=ynDukZ9%2FG77uSJVb5YM0cadwHVwYKPMKOO3PNvgADbv6VtymgBxeOWEhED6KGHsGSvSJnMWDN%2FZl639AkRe9Ry%2F7zmn9CmiM%2FZkp1XtshERGTqi2YL10GwQpaH17MQqOX3u1cW4LlyFoLy4celUFBPq1WM2ZJnaNZRJIEY%2FvpeVnCVK8VIPdY3HMxPAkNi5zeF2BbqH%2BL2vAWef6vfHkNcJPlOuOl6jP4E%2B58F24ni%2B9ek%2FQH18O4kw%2FUJ7ZfKwjCCI13%2BcFybpofcKqddq8CuUJj5Ii7Pdw1fje7ktzHeeNhF0r9siWcYmd4JaxTP3NmLJdHFRq2T%2FgsF3vK9m3gw%3D%3D&signatureVersion=2&signatureMethod=RSA-SHA1&certificateUrl=https%3A%2F%2Ffps.sandbox.amazonaws.com%2Fcerts%2F090909%2FPKICert.pem&tokenID=A5BB3HUNAZFJ5CRXIPH72LIODZUNAUZIVP7UB74QNFQDSQ9MN4HPIKISQZWPLJXF&status=SC&callerReference=callerReferenceMultiUse1'
endpoint = 'http://vamsik.desktop.amazon.com:8080/ipn.jsp'
conn.verify_signature(endpoint, params)
| 124.571429
| 665
| 0.893349
| 70
| 872
| 11.114286
| 0.885714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.127811
| 0.030963
| 872
| 6
| 666
| 145.333333
| 0.792899
| 0.034404
| 0
| 0
| 0
| 0.2
| 0.83693
| 0.782974
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 0
| 0.2
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
10cd5d86ca23d561452f1734af88fb5d09bc0932
| 134
|
py
|
Python
|
agentk/utils.py
|
bolaum/agentk
|
9c616930d3c8748e488fbb9fcabdff3da553f94c
|
[
"MIT"
] | 1
|
2019-04-18T16:21:39.000Z
|
2019-04-18T16:21:39.000Z
|
agentk/utils.py
|
bolaum/agentk
|
9c616930d3c8748e488fbb9fcabdff3da553f94c
|
[
"MIT"
] | null | null | null |
agentk/utils.py
|
bolaum/agentk
|
9c616930d3c8748e488fbb9fcabdff3da553f94c
|
[
"MIT"
] | null | null | null |
def bigint_to_bytes(num, extra_bytes=0):
return num.to_bytes(length=((num.bit_length() + 7) // 8) + extra_bytes, byteorder='big')
| 44.666667
| 92
| 0.701493
| 22
| 134
| 4
| 0.636364
| 0.159091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.025424
| 0.119403
| 134
| 2
| 93
| 67
| 0.720339
| 0
| 0
| 0
| 0
| 0
| 0.022388
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.