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
4db0ccfad3feae69f9eb7e454d317f76034d108c
2,122
py
Python
mlsummary/__init__.py
serafinialessio/mlsummary
c7f6d047fbedf182571f595f7aa59a4652df4229
[ "BSD-3-Clause" ]
null
null
null
mlsummary/__init__.py
serafinialessio/mlsummary
c7f6d047fbedf182571f595f7aa59a4652df4229
[ "BSD-3-Clause" ]
null
null
null
mlsummary/__init__.py
serafinialessio/mlsummary
c7f6d047fbedf182571f595f7aa59a4652df4229
[ "BSD-3-Clause" ]
null
null
null
#__all__ = ['kmeansSummary'] # from mlsummary.classification._knn import knnSummary,knnSummaryCV # from mlsummary.classification._lda import ldaSummary, ldaSummaryCV # from mlsummary.classification._qda import qdaSummary, qdaSummaryCV # from mlsummary.classification._svc import svcSummary, svcSummaryCV # from mlsummary.classification._lgbmClass import lgbmClassSummary,lgbmClassSummaryCV # from mlsummary.classification._AdaBoostClass import AdaBoostClassSummary, AdaBoostClassSummaryCV # from mlsummary.classification._baggingClass import baggingClassSummary, baggingClassSummaryCV # from mlsummary.classification._gaussianNaiveBayes import gnbSummary, gnbSummaryCV # from mlsummary.classification._GradientBoostingClass import GradientBoostingClassSummary, GradientBoostingClassSummaryCV # from mlsummary.classification._NearestCentroidClass import NearestCentroidClassSummary, NearestCentroidClassSummaryCV # from mlsummary.classification._RadiusNeighborsClass import RadiusNeighborsClassSummary, RadiusNeighborsClassSummaryCV # from mlsummary.classification._RandomForestClass import RandomForestClassSummary, RandomForestClassSummaryCV # from mlsummary.classification._SoftmaxRegression import SoftmaxRegressionSummary, SoftmaxRegressionSummaryCV # from mlsummary.classification._TreeClass import TreeClassSummary, TreeClassSummaryCV # from mlsummary.classification._xgboostClass import xgboostClassSummary, xgboostClassSummaryCV # # from mlsummary.outliers._IsolationForest import IsolationForestSummary # from mlsummary.outliers._LocalOutlierFactor import LocalOutlierFactorSummary # from mlsummary.outliers._LocalOutlierFactorNovelty import LocalOutlierFactorNoveltySummary # from mlsummary.outliers._OneClassSVM import OneClassSVMSummary # # # from mlsummary.clustering._kmeans import kmeansSummary # from mlsummary.clustering._gmm import gmmSummary # from mlsummary.clustering._MeanShift import MeanShiftSummary # from mlsummary.clustering._AffinityPropagation import AffinityPropagationSummary # from mlsummary.clustering._dbscan import dbscanSummary # from mlsummary.clustering._optics import opticsSummary
68.451613
122
0.885014
167
2,122
11.071856
0.431138
0.175771
0.219037
0
0
0
0
0
0
0
0
0
0.068332
2,122
31
123
68.451613
0.935255
0.972196
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
1
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
4dbfbfb695ad8e00d8d1f640dbca6470d00bf872
129
py
Python
lab6/zad2.py
R3zn0w/blue-rapier
84cdc33e1e327c0a402a4d2e29a8d6f5cda95e9b
[ "MIT" ]
null
null
null
lab6/zad2.py
R3zn0w/blue-rapier
84cdc33e1e327c0a402a4d2e29a8d6f5cda95e9b
[ "MIT" ]
null
null
null
lab6/zad2.py
R3zn0w/blue-rapier
84cdc33e1e327c0a402a4d2e29a8d6f5cda95e9b
[ "MIT" ]
null
null
null
import sys import collections print(dict(sorted(collections.Counter( [len(x) for x in sys.stdin.read().split()]).items())))
21.5
58
0.705426
19
129
4.789474
0.789474
0
0
0
0
0
0
0
0
0
0
0
0.116279
129
5
59
25.8
0.798246
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
4dce15f4561bf35523190803004ce6a81c1194d4
165
py
Python
test/executor/testScript.py
hysds/sciflo
f706288405c8eee59a2f883bab3dcb5229615367
[ "Apache-2.0" ]
null
null
null
test/executor/testScript.py
hysds/sciflo
f706288405c8eee59a2f883bab3dcb5229615367
[ "Apache-2.0" ]
null
null
null
test/executor/testScript.py
hysds/sciflo
f706288405c8eee59a2f883bab3dcb5229615367
[ "Apache-2.0" ]
1
2019-02-07T01:08:34.000Z
2019-02-07T01:08:34.000Z
import time import testModule2 print(("Random number is %s at epoch %s." % (testModule2.getRandomNum(), time.time())))
27.5
72
0.521212
16
165
5.375
0.6875
0
0
0
0
0
0
0
0
0
0
0.019048
0.363636
165
5
73
33
0.8
0
0
0
0
0
0.193939
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
4dee955a5546063b5f783a954272dffda1d316f8
55
py
Python
tests/fixtures/basic.py
pawamoy/duty
dac90183543b73fdd6e5fab354a56c5484d5762a
[ "0BSD" ]
25
2020-10-09T08:46:12.000Z
2022-03-16T18:58:39.000Z
tests/fixtures/basic.py
pawamoy/duty
dac90183543b73fdd6e5fab354a56c5484d5762a
[ "0BSD" ]
4
2020-11-12T19:27:41.000Z
2021-08-01T13:24:31.000Z
tests/fixtures/basic.py
pawamoy/duty
dac90183543b73fdd6e5fab354a56c5484d5762a
[ "0BSD" ]
null
null
null
from duty import duty @duty def hello(ctx): pass
7.857143
21
0.672727
9
55
4.111111
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.254545
55
6
22
9.166667
0.902439
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0.25
0.25
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
4
15102404f8daf5cef0f89c7594ec522974c6a598
126
py
Python
transformersx/task/__init__.py
aicanhelp/ai-transformers
fa30031fa7360ee6d4fd3d016a3c81a23cfe8af1
[ "MIT" ]
1
2020-08-03T12:59:20.000Z
2020-08-03T12:59:20.000Z
transformersx/task/__init__.py
aicanhelp/ai-transformers
fa30031fa7360ee6d4fd3d016a3c81a23cfe8af1
[ "MIT" ]
null
null
null
transformersx/task/__init__.py
aicanhelp/ai-transformers
fa30031fa7360ee6d4fd3d016a3c81a23cfe8af1
[ "MIT" ]
null
null
null
from .tasks import DefaultTransformerTask, TaskContext, TransformerTask from .task_config import TaskConfig, parse_tasks_args
42
71
0.873016
14
126
7.642857
0.785714
0
0
0
0
0
0
0
0
0
0
0
0.087302
126
2
72
63
0.930435
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
1280f96cad9d30b735c98e9da5067a2b16a892d2
6,309
py
Python
tests/ludwig/modules/test_metric_modules.py
hfurkanbozkurt/ludwig
bfcbd52237c73702764e733ede4351e0146394bd
[ "Apache-2.0" ]
970
2020-12-17T15:09:20.000Z
2022-03-31T22:58:03.000Z
tests/ludwig/modules/test_metric_modules.py
hfurkanbozkurt/ludwig
bfcbd52237c73702764e733ede4351e0146394bd
[ "Apache-2.0" ]
503
2020-12-16T21:44:40.000Z
2022-03-31T18:21:52.000Z
tests/ludwig/modules/test_metric_modules.py
hfurkanbozkurt/ludwig
bfcbd52237c73702764e733ede4351e0146394bd
[ "Apache-2.0" ]
145
2020-12-18T07:38:30.000Z
2022-03-29T19:05:08.000Z
import pytest import torch from ludwig.modules import metric_modules @pytest.mark.parametrize("preds", [torch.arange(6).reshape(3, 2).float()]) @pytest.mark.parametrize("target", [torch.arange(6, 12).reshape(3, 2).float()]) @pytest.mark.parametrize("output", [torch.tensor(6).float()]) def test_rmse_metric(preds: torch.Tensor, target: torch.Tensor, output: torch.Tensor): metric = metric_modules.RMSEMetric() metric.update(preds, target) assert output == metric.compute() @pytest.mark.parametrize("preds", [torch.tensor([0.2, 0.3, 0.8, 0.1])]) @pytest.mark.parametrize("target", [torch.tensor([0, 0, 1, 1])]) @pytest.mark.parametrize("output", [torch.tensor(0.5)]) def test_roc_auc_metric(preds: torch.Tensor, target: torch.Tensor, output: torch.Tensor): metric = metric_modules.ROCAUCMetric() metric.update(preds, target) assert output == metric.compute() @pytest.mark.parametrize("preds", [torch.arange(6).reshape(3, 2).float()]) @pytest.mark.parametrize("target", [torch.arange(6, 12).reshape(3, 2).float()]) @pytest.mark.parametrize("output", [torch.tensor(0.7527).float()]) def test_rmspe_metric(preds: torch.Tensor, target: torch.Tensor, output: torch.Tensor): metric = metric_modules.RMSPEMetric() metric.update(preds, target) assert torch.isclose(output, metric.compute(), rtol=0.0001) @pytest.mark.parametrize( "preds,target,num_outputs,output", [ (torch.arange(3), torch.arange(3, 6), 1, torch.tensor(-12.5)), (torch.arange(6).reshape(3, 2), torch.arange(6, 12).reshape(3, 2), 2, torch.tensor(-12.5)), ], ) def test_r2_score(preds: torch.Tensor, target: torch.Tensor, num_outputs: int, output: torch.Tensor): metric = metric_modules.R2Score(num_outputs=num_outputs) metric.update(preds, target) assert metric.compute() == output @pytest.mark.parametrize("preds", [torch.arange(6).reshape(3, 2).float()]) @pytest.mark.parametrize("target", [torch.arange(6, 12).reshape(3, 2).float()]) @pytest.mark.parametrize("output", [torch.tensor(-21.4655).float()]) def test_bwcewl_metric(preds: torch.Tensor, target: torch.Tensor, output: torch.Tensor): metric = metric_modules.BWCEWLMetric() metric.update(preds, target) assert torch.isclose(output, metric.compute(), rtol=0.0001) @pytest.mark.parametrize("preds", [torch.tensor([[0.5, 0.5], [0.2, 0.8], [0.6, 0.4]])]) @pytest.mark.parametrize("target", [torch.tensor([1, 1, 0])]) @pytest.mark.parametrize("output", [torch.tensor(0.5763)]) def test_softmax_cross_entropy_metric(preds: torch.Tensor, target: torch.Tensor, output: torch.Tensor): metric = metric_modules.SoftmaxCrossEntropyMetric() metric.update(preds, target) assert torch.isclose(output, metric.compute(), rtol=0.0001) @pytest.mark.parametrize("preds", [torch.arange(6).reshape(3, 2).float()]) @pytest.mark.parametrize("target", [torch.arange(6, 12).reshape(3, 2).float()]) @pytest.mark.parametrize("output", [torch.tensor(-42.9311).float()]) def test_sigmoid_cross_entropy_metric(preds: torch.Tensor, target: torch.Tensor, output: torch.Tensor): metric = metric_modules.SigmoidCrossEntropyMetric() metric.update(preds, target) assert torch.isclose(output, metric.compute(), rtol=0.0001) @pytest.mark.parametrize( "preds,target,output", [ ( torch.tensor([[0, 1], [3, 2], [4, 5]]), torch.tensor([[0, 1], [1, 2], [4, 5]]), torch.tensor(0.8), ), ( torch.tensor([[0, 1, 2], [1, 3, 4], [3, 4, 5]]), torch.tensor([[0, 1, 2], [1, 1, 4], [3, 4, 5]]), torch.tensor(0.8750), ), ( torch.tensor([[1, 5, 1, 5, 1, 5, 12, 12, 12], [10, 1, 5, 1, 5, 12, 12, 12, 12]]), torch.tensor([[1, 9, 5, 7, 5, 9, 13, 6, 0], [1, 9, 7, 13, 4, 7, 7, 7, 0]]), torch.tensor(0.05555555), ), ], ) def test_token_accuracy_metric(preds: torch.Tensor, target: torch.Tensor, output: torch.Tensor): metric = metric_modules.TokenAccuracyMetric() metric.update(preds, target) assert torch.allclose(metric.compute(), output) @pytest.mark.parametrize("preds", [torch.arange(6).reshape(3, 2)]) @pytest.mark.parametrize("target", [torch.tensor([[0, 1], [2, 1], [4, 5]]).float()]) @pytest.mark.parametrize("output", [torch.tensor(0.8333).float()]) def test_category_accuracy(preds: torch.Tensor, target: torch.Tensor, output: torch.Tensor): metric = metric_modules.CategoryAccuracy() metric.update(preds, target) assert torch.isclose(output, metric.compute(), rtol=0.0001) @pytest.mark.parametrize( "preds,target,output,k", [ ( torch.tensor([[0.1, 0.9, 0], [0.3, 0.1, 0.6], [0.2, 0.5, 0.3]]), torch.tensor([0, 1, 2]), torch.tensor(0.6667).float(), 2, ) ], ) def test_hits_at_k_metric(preds: torch.Tensor, target: torch.Tensor, output: torch.Tensor, k: int): metric = metric_modules.HitsAtKMetric(top_k=k) metric.update(preds, target) assert torch.isclose(output, metric.compute(), rtol=0.0001) @pytest.mark.parametrize("preds", [torch.arange(6).reshape(3, 2).float()]) @pytest.mark.parametrize("target", [torch.arange(6, 12).reshape(3, 2).float()]) @pytest.mark.parametrize("output", [torch.tensor(6).float()]) def test_mae_metric(preds: torch.Tensor, target: torch.Tensor, output: torch.Tensor): metric = metric_modules.MAEMetric() metric.update(preds, target) assert output == metric.compute() @pytest.mark.parametrize("preds", [torch.arange(6).reshape(3, 2).float()]) @pytest.mark.parametrize("target", [torch.arange(6, 12).reshape(3, 2).float()]) @pytest.mark.parametrize("output", [torch.tensor(36).float()]) def test_mse_metric(preds: torch.Tensor, target: torch.Tensor, output: torch.Tensor): metric = metric_modules.MSEMetric() metric.update(preds, target) assert output == metric.compute() @pytest.mark.parametrize("preds", [torch.tensor([[0, 1], [1, 1]])]) @pytest.mark.parametrize("target", [torch.tensor([[1, 0], [1, 1]])]) @pytest.mark.parametrize("output", [torch.tensor(0.5)]) def test_jaccard_metric(preds: torch.Tensor, target: torch.Tensor, output: torch.Tensor): metric = metric_modules.JaccardMetric() metric.update(preds, target) assert output == metric.compute()
41.781457
103
0.664765
874
6,309
4.737986
0.098398
0.185945
0.167351
0.081623
0.81985
0.808742
0.76624
0.698865
0.676407
0.676407
0
0.054673
0.141861
6,309
150
104
42.06
0.710196
0
0
0.398374
0
0
0.038199
0.008242
0
0
0
0
0.105691
1
0.105691
false
0
0.02439
0
0.130081
0
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
12940d108780f882cb6c340126d918b169b7d9b8
67
py
Python
tuple.py
Shohanurcsevu/Python_Basics_Practice
08bc8834775ab7bfc97a557ac458e15385ec4df0
[ "MIT" ]
1
2021-01-13T09:49:05.000Z
2021-01-13T09:49:05.000Z
tuple.py
Shohanurcsevu/Python_Basics_Practice
08bc8834775ab7bfc97a557ac458e15385ec4df0
[ "MIT" ]
null
null
null
tuple.py
Shohanurcsevu/Python_Basics_Practice
08bc8834775ab7bfc97a557ac458e15385ec4df0
[ "MIT" ]
null
null
null
students_roll = (1,2,3,6,77,90) print(students_roll.index(77))
11.166667
31
0.686567
13
67
3.384615
0.769231
0.545455
0
0
0
0
0
0
0
0
0
0.169492
0.119403
67
6
32
11.166667
0.576271
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
12ac6dd4331b005e586e81ca8b24c0cb5c9da8e6
465
py
Python
lab2/mycollections/lab2_task6/mydefaultdict.py
kinpa200296/python_labs
bb26c426cbe9bb27f45b8ee4c974c38db300468f
[ "MIT" ]
null
null
null
lab2/mycollections/lab2_task6/mydefaultdict.py
kinpa200296/python_labs
bb26c426cbe9bb27f45b8ee4c974c38db300468f
[ "MIT" ]
null
null
null
lab2/mycollections/lab2_task6/mydefaultdict.py
kinpa200296/python_labs
bb26c426cbe9bb27f45b8ee4c974c38db300468f
[ "MIT" ]
null
null
null
#!/usr/bin/env python __author__ = 'kinpa200296' class mydefaultdict(object): def __init__(self): self._dict = dict() def __getitem__(self, item): if item not in self._dict: self._dict[item] = mydefaultdict() return self._dict[item] def __setitem__(self, key, value): self._dict[key] = value def __str__(self): return str(self._dict) def __repr__(self): return repr(self._dict)
20.217391
46
0.610753
56
465
4.517857
0.428571
0.221344
0.094862
0
0
0
0
0
0
0
0
0.017751
0.273118
465
22
47
21.136364
0.730769
0.043011
0
0
0
0
0.024775
0
0
0
0
0
0
1
0.357143
false
0
0
0.142857
0.642857
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
12b1f9d764e61e75bd6a033709b78a98419c5e75
107
py
Python
py_tdlib/constructors/test_call_vector_int_object.py
Mr-TelegramBot/python-tdlib
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
[ "MIT" ]
24
2018-10-05T13:04:30.000Z
2020-05-12T08:45:34.000Z
py_tdlib/constructors/test_call_vector_int_object.py
MrMahdi313/python-tdlib
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
[ "MIT" ]
3
2019-06-26T07:20:20.000Z
2021-05-24T13:06:56.000Z
py_tdlib/constructors/test_call_vector_int_object.py
MrMahdi313/python-tdlib
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
[ "MIT" ]
5
2018-10-05T14:29:28.000Z
2020-08-11T15:04:10.000Z
from ..factory import Method class testCallVectorIntObject(Method): x = None # type: "vector<testInt>"
17.833333
38
0.738318
12
107
6.583333
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.149533
107
5
39
21.4
0.868132
0.214953
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
12be23b0fce08a589f7543dcb61d7903c9fc9738
186
py
Python
Mini_Project1/date_App/urls.py
cs-fullstack-fall-2018/django-mini-project1-psanon19
a0495c6a10b8dfb6410c2bb8b7aa8e0bddbd66c3
[ "Apache-2.0" ]
null
null
null
Mini_Project1/date_App/urls.py
cs-fullstack-fall-2018/django-mini-project1-psanon19
a0495c6a10b8dfb6410c2bb8b7aa8e0bddbd66c3
[ "Apache-2.0" ]
null
null
null
Mini_Project1/date_App/urls.py
cs-fullstack-fall-2018/django-mini-project1-psanon19
a0495c6a10b8dfb6410c2bb8b7aa8e0bddbd66c3
[ "Apache-2.0" ]
null
null
null
from django.urls import path from . import views urlpatterns = [ path('', views.index, name='index'), path('post/<int:pk>/', views.timesheet_detail, name='timesheet_detail'), ]
23.25
76
0.682796
24
186
5.208333
0.583333
0.24
0
0
0
0
0
0
0
0
0
0
0.145161
186
8
77
23.25
0.786164
0
0
0
0
0
0.187166
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
12cb04d2ad6987a9c42dcbcc12889cc536d11a81
100
py
Python
core/admin.py
bakefayat/django-drug
5c1eb79dd39fca57f22cc0c5f1cdf4e76f36f43a
[ "MIT" ]
1
2022-01-08T13:31:45.000Z
2022-01-08T13:31:45.000Z
core/admin.py
bakefayat/django-drug
5c1eb79dd39fca57f22cc0c5f1cdf4e76f36f43a
[ "MIT" ]
null
null
null
core/admin.py
bakefayat/django-drug
5c1eb79dd39fca57f22cc0c5f1cdf4e76f36f43a
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import SiteProfile admin.site.register(SiteProfile)
16.666667
32
0.83
13
100
6.384615
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.11
100
5
33
20
0.932584
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
12f90aabd30e8a2a74810ae3dd8814336e1198c1
128
py
Python
terrascript/provider/dnsimple.py
hugovk/python-terrascript
08fe185904a70246822f5cfbdc9e64e9769ec494
[ "BSD-2-Clause" ]
507
2017-07-26T02:58:38.000Z
2022-01-21T12:35:13.000Z
terrascript/provider/dnsimple.py
hugovk/python-terrascript
08fe185904a70246822f5cfbdc9e64e9769ec494
[ "BSD-2-Clause" ]
135
2017-07-20T12:01:59.000Z
2021-10-04T22:25:40.000Z
terrascript/provider/dnsimple.py
hugovk/python-terrascript
08fe185904a70246822f5cfbdc9e64e9769ec494
[ "BSD-2-Clause" ]
81
2018-02-20T17:55:28.000Z
2022-01-31T07:08:40.000Z
# terrascript/provider/dnsimple.py import terrascript class dnsimple(terrascript.Provider): pass __all__ = ["dnsimple"]
12.8
37
0.757813
13
128
7.153846
0.615385
0.408602
0
0
0
0
0
0
0
0
0
0
0.140625
128
9
38
14.222222
0.845455
0.25
0
0
0
0
0.085106
0
0
0
0
0
0
1
0
false
0.25
0.25
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
42167cd18c01df0f9b43c7f438da6ca4b3697001
205
py
Python
back2back/admin.py
mjtamlyn/back2back
02fd03f48fdc00cd5816b24032ed7b5377ed4e57
[ "BSD-2-Clause" ]
null
null
null
back2back/admin.py
mjtamlyn/back2back
02fd03f48fdc00cd5816b24032ed7b5377ed4e57
[ "BSD-2-Clause" ]
4
2020-02-11T21:30:45.000Z
2021-12-02T15:01:40.000Z
back2back/admin.py
mjtamlyn/back2back
02fd03f48fdc00cd5816b24032ed7b5377ed4e57
[ "BSD-2-Clause" ]
null
null
null
from django.contrib import admin from .models import Entry, Score class EntryAdmin(admin.ModelAdmin): list_filter = ('category',) admin.site.register(Entry, EntryAdmin) admin.site.register(Score)
17.083333
38
0.765854
26
205
6
0.615385
0.192308
0.217949
0
0
0
0
0
0
0
0
0
0.126829
205
11
39
18.636364
0.871508
0
0
0
0
0
0.039024
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.666667
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
4251da7b7c1fdac05ac5ac5a2b29abcec913a5e1
328
py
Python
tests/test_tinytex_2.py
NicklasTegner/PyTinyTeX
7ad0ef7945158bb1d8a04559c654f19aa9d2201a
[ "MIT" ]
null
null
null
tests/test_tinytex_2.py
NicklasTegner/PyTinyTeX
7ad0ef7945158bb1d8a04559c654f19aa9d2201a
[ "MIT" ]
null
null
null
tests/test_tinytex_2.py
NicklasTegner/PyTinyTeX
7ad0ef7945158bb1d8a04559c654f19aa9d2201a
[ "MIT" ]
null
null
null
import shutil import os import pytest from .utils import download_tinytex_2 def test_successful_download(download_tinytex_2): assert os.path.isdir(os.path.join("tests", "tinytex_distribution")) def test_bin_is_in_distribution(download_tinytex_2): assert os.path.isdir(os.path.join("tests", "tinytex_distribution", "bin"))
25.230769
75
0.807927
49
328
5.122449
0.428571
0.095618
0.191235
0.175299
0.533865
0.533865
0.533865
0.533865
0.533865
0.533865
0
0.009967
0.082317
328
12
76
27.333333
0.82392
0
0
0
0
0
0.161585
0
0
0
0
0
0.25
1
0.25
false
0
0.5
0
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
1
0
0
1
0
0
0
0
4
425e7662178beb51f300eecfb7906659696a964d
48
py
Python
python/testData/refactoring/unwrap/whileUnwrapMultipleStatements_before.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/refactoring/unwrap/whileUnwrapMultipleStatements_before.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/refactoring/unwrap/whileUnwrapMultipleStatements_before.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
if True: #comment <caret>x = 1 y = 2
12
16
0.458333
8
48
2.75
1
0
0
0
0
0
0
0
0
0
0
0.071429
0.416667
48
4
17
12
0.714286
0.145833
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
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
4262caf7a1377da3b1e1db524b68cd13af4e03cd
135
py
Python
src/factorial-trailing-zeroes.py
Liuchang0812/leetcode
d71f87b0035e661d0009f4382b39c4787c355f89
[ "MIT" ]
9
2015-09-09T20:28:31.000Z
2019-05-15T09:13:07.000Z
src/factorial-trailing-zeroes.py
liuchang0812/leetcode
d71f87b0035e661d0009f4382b39c4787c355f89
[ "MIT" ]
1
2015-02-25T13:10:09.000Z
2015-02-25T13:10:09.000Z
src/factorial-trailing-zeroes.py
liuchang0812/leetcode
d71f87b0035e661d0009f4382b39c4787c355f89
[ "MIT" ]
1
2016-08-31T19:14:52.000Z
2016-08-31T19:14:52.000Z
class Solution: # @return an integer def trailingZeroes(self, n): return sum(map(lambda x: n / (5**x) , range(1, 31)))
27
60
0.592593
20
135
4
0.85
0
0
0
0
0
0
0
0
0
0
0.039604
0.251852
135
4
61
33.75
0.752475
0.133333
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
4274ee2a161a8f1c792d718637eb7014f8f94bdc
7,678
py
Python
example/python/FaAllocationSamples.py
colinxs/Emporos.jl
53b5fa074338a5eea096d6736453c5692faf7368
[ "MIT" ]
null
null
null
example/python/FaAllocationSamples.py
colinxs/Emporos.jl
53b5fa074338a5eea096d6736453c5692faf7368
[ "MIT" ]
null
null
null
example/python/FaAllocationSamples.py
colinxs/Emporos.jl
53b5fa074338a5eea096d6736453c5692faf7368
[ "MIT" ]
null
null
null
""" Copyright (C) 2019 Interactive Brokers LLC. All rights reserved. This code is subject to the terms and conditions of the IB API Non-Commercial License or the IB API Commercial License, as applicable. """ from ibapi.object_implem import Object class FaAllocationSamples(Object): #! [faonegroup] FaOneGroup = "".join(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" , "<ListOfGroups>" , "<Group>" , "<name>Equal_Quantity</name>" , "<ListOfAccts varName=\"list\">" #Replace with your own accountIds , "<String>DU119915</String>" , "<String>DU119916</String>" , "</ListOfAccts>" , "<defaultMethod>EqualQuantity</defaultMethod>" , "</Group>" , "</ListOfGroups>")) #! [faonegroup] #! [fatwogroups] FaTwoGroups = "".join(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ,"<ListOfGroups>" , "<Group>" , "<name>Equal_Quantity</name>" , "<ListOfAccts varName=\"list\">" #Replace with your own accountIds , "<String>DU119915</String>" , "<String>DU119916</String>" , "</ListOfAccts>" , "<defaultMethod>EqualQuantity</defaultMethod>" , "</Group>" , "<Group>" , "<name>Pct_Change</name>" , "<ListOfAccts varName=\"list\">" #Replace with your own accountIds , "<String>DU119915</String>" , "<String>DU119916</String>" , "</ListOfAccts>" , "<defaultMethod>PctChange</defaultMethod>" , "</Group>" , "</ListOfGroups>")) #! [fatwogroups] #! [faoneprofile] FaOneProfile = "".join(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" , "<ListOfAllocationProfiles>" , "<AllocationProfile>" , "<name>Percent_60_40</name>" , "<type>1</type>" , "<ListOfAllocations varName=\"listOfAllocations\">" , "<Allocation>" #Replace with your own accountIds , "<acct>DU119915</acct>" , "<amount>60.0</amount>" , "</Allocation>" , "<Allocation>" #Replace with your own accountIds , "<acct>DU119916</acct>" , "<amount>40.0</amount>" , "</Allocation>" , "</ListOfAllocations>" , "</AllocationProfile>" , "</ListOfAllocationProfiles>")) #! [faoneprofile] #! [fatwoprofiles] FaTwoProfiles = "".join(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" , "<ListOfAllocationProfiles>" , "<AllocationProfile>" , "<name>Percent_60_40</name>" , "<type>1</type>" , "<ListOfAllocations varName=\"listOfAllocations\">" , "<Allocation>" #Replace with your own accountIds , "<acct>DU119915</acct>" , "<amount>60.0</amount>" , "</Allocation>" , "<Allocation>" #Replace with your own accountIds , "<acct>DU119916</acct>" , "<amount>40.0</amount>" , "</Allocation>" , "</ListOfAllocations>" , "</AllocationProfile>" , "<AllocationProfile>" , "<name>Ratios_2_1</name>" , "<type>2</type>" , "<ListOfAllocations varName=\"listOfAllocations\">" , "<Allocation>" #Replace with your own accountIds , "<acct>DU119915</acct>" , "<amount>2.0</amount>" , "</Allocation>" , "<Allocation>" #Replace with your own accountIds , "<acct>DU119916</acct>" , "<amount>1.0</amount>" , "</Allocation>" , "</ListOfAllocations>" , "</AllocationProfile>" , "</ListOfAllocationProfiles>")) #! [fatwoprofiles] def Test(): print(FaAllocationSamples.FaOneGroup) print(FaAllocationSamples.FaTwoGroups) print(FaAllocationSamples.FaOneProfile) print(FaAllocationSamples.FaTwoProfiles) if "__main__" == __name__: Test()
63.454545
101
0.277807
310
7,678
6.822581
0.270968
0.046809
0.06383
0.076596
0.700236
0.700236
0.653428
0.653428
0.653428
0.653428
0
0.04127
0.630763
7,678
120
102
63.983333
0.704762
0.105887
0
0.781609
0
0
0.230443
0.10908
0
0
0
0
0
1
0.011494
false
0
0.011494
0
0.08046
0.045977
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
1
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
4
c424c482b7e85cc8fc79048e5d675d72a0fedcd1
1,097
py
Python
create_db.py
landportal/landbook-data-access-api
ed49a1fdfec168dbeea50b67a2bcb147e4875e45
[ "MIT" ]
null
null
null
create_db.py
landportal/landbook-data-access-api
ed49a1fdfec168dbeea50b67a2bcb147e4875e45
[ "MIT" ]
null
null
null
create_db.py
landportal/landbook-data-access-api
ed49a1fdfec168dbeea50b67a2bcb147e4875e45
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- # landportal-data-access-api # Copyright (c)2014, WESO, Web Semantics Oviedo. # Written by Herminio García. # This file is part of landportal-data-access-api. # # landportal-data-access-api is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License. # # landportal-data-access-api is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with landportal-data-access-api. If not, see <http://www.gnu.org/licenses/>. # landportal-data-access-api is licensed under the terms of the GPLv2 # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html> """ Created on 10/02/2014 :author: Herminio García """ from app import db if __name__ == '__main__': db.create_all()
32.264706
85
0.74567
175
1,097
4.622857
0.582857
0.103832
0.148331
0.170581
0.284302
0.069221
0
0
0
0
0
0.018339
0.154968
1,097
34
86
32.264706
0.854369
0.891522
0
0
0
0
0.086022
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
c43d28fc8d9f8d5853b8bec16cbe02fa3f7cfb1a
235
py
Python
app/grandchallenge/retina_api/models.py
amickan/grand-challenge.org
6d006ce6c77ff264a2bd608bd4acc5a96bcec037
[ "Apache-2.0" ]
null
null
null
app/grandchallenge/retina_api/models.py
amickan/grand-challenge.org
6d006ce6c77ff264a2bd608bd4acc5a96bcec037
[ "Apache-2.0" ]
null
null
null
app/grandchallenge/retina_api/models.py
amickan/grand-challenge.org
6d006ce6c77ff264a2bd608bd4acc5a96bcec037
[ "Apache-2.0" ]
null
null
null
from django.core.serializers.json import DjangoJSONEncoder from django.db import models class ArchiveDataModel(models.Model): value = models.JSONField(encoder=DjangoJSONEncoder) modified = models.DateTimeField(auto_now=True)
29.375
58
0.812766
27
235
7.037037
0.740741
0.105263
0
0
0
0
0
0
0
0
0
0
0.110638
235
7
59
33.571429
0.909091
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
c4474e40fe3edeb1324e9174cd59fd250555f9bc
813
py
Python
lesson/test2.py
codedthinking/tender-home-bias
c29f92924d39e76528cfcc8165e7cdc754a7a68c
[ "CC0-1.0" ]
null
null
null
lesson/test2.py
codedthinking/tender-home-bias
c29f92924d39e76528cfcc8165e7cdc754a7a68c
[ "CC0-1.0" ]
10
2022-02-08T10:14:05.000Z
2022-02-11T15:41:21.000Z
lesson/test2.py
codedthinking/tender-home-bias
c29f92924d39e76528cfcc8165e7cdc754a7a68c
[ "CC0-1.0" ]
null
null
null
import unittest from main import * # Add imports here! import os DIR = 'data/derived' SAMPLE = DIR + '/analysis-sample.csv' AGGREGATE = DIR + '/country-pairs.csv' def is_file(name): return os.path.isfile(name) def is_dir(name): return os.path.isdir(name) def num_lines(name): return len(open(name, 'rt').readlines()) ### tests def test_history_exists(self): self.failUnless(is_file('history.txt')) def test_derived_dir_exists(self): self.failUnless(is_dir(DIR)) def test_analysis_sample_exists(self): self.failUnless(is_file(SAMPLE)) def test_aggregate_exists(self): self.failUnless(is_file(AGGREGATE)) def test_sample_has_61855_lines(self): self.assertEqual(num_lines(SAMPLE), 61855) def test_aggregate_has_367_lines(self): self.assertEqual(num_lines(AGGREGATE), 367)
21.394737
47
0.744157
121
813
4.77686
0.347107
0.072664
0.096886
0.16609
0.311419
0.266436
0
0
0
0
0
0.022567
0.127921
813
37
48
21.972973
0.792666
0.02829
0
0
0
0
0.080255
0
0
0
0
0
0.083333
1
0.375
false
0
0.125
0.125
0.625
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
c45e0bf1543b1fc839787a2f2bed4c0477ad6388
112
py
Python
docs_src/setup/setup_002.py
cdpath/fastapi_login
4e9cde923b60a6852a24b34292e2a10f4333ced3
[ "MIT" ]
318
2019-10-24T20:18:41.000Z
2022-03-23T16:55:51.000Z
docs_src/setup/setup_002.py
cdpath/fastapi_login
4e9cde923b60a6852a24b34292e2a10f4333ced3
[ "MIT" ]
47
2020-01-24T01:07:33.000Z
2022-03-16T12:59:06.000Z
docs_src/setup/setup_002.py
cdpath/fastapi_login
4e9cde923b60a6852a24b34292e2a10f4333ced3
[ "MIT" ]
39
2020-04-01T07:23:13.000Z
2022-02-25T12:43:40.000Z
from fastapi import FastAPI from fastapi_login import LoginManager app = FastAPI() SECRET = "super-secret-key"
18.666667
38
0.794643
15
112
5.866667
0.6
0.25
0
0
0
0
0
0
0
0
0
0
0.133929
112
6
39
18.666667
0.907216
0
0
0
0
0
0.141593
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
c469c38c8c384debe0d535cffac87fb7f55f0052
176
py
Python
08 IfElse/listDemo.py
codewithsandy/Python-Basic-Exp
4c70ada4a042923a94301453c7bd76e704cd2989
[ "MIT" ]
3
2021-05-08T13:11:41.000Z
2021-05-14T02:43:20.000Z
08 IfElse/listDemo.py
codewithsandy/Python-Basic-Exp
4c70ada4a042923a94301453c7bd76e704cd2989
[ "MIT" ]
null
null
null
08 IfElse/listDemo.py
codewithsandy/Python-Basic-Exp
4c70ada4a042923a94301453c7bd76e704cd2989
[ "MIT" ]
null
null
null
list1 = [5, 7, 3] #print(5 in list1) print(55 in list1) if 5 in list1: print("Yes its in list") print(88 not in list1) if 66 not in list1: print("Not in listt")
11
28
0.613636
35
176
3.085714
0.428571
0.324074
0.333333
0.240741
0
0
0
0
0
0
0
0.130769
0.261364
176
16
29
11
0.7
0.096591
0
0
0
0
0.169811
0
0
0
0
0
0
1
0
false
0
0
0
0
0.571429
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
c4843ab9ab57d690daae75d440360a4811ef1eef
1,705
py
Python
_includes/samples/PriceFeeds/HistoricalPriceConsumer.py
CemmOzdemir/documentation
3c889ffb665399965f44fd2645d1c823e06e129f
[ "MIT" ]
134
2021-05-02T03:16:23.000Z
2022-03-29T19:46:10.000Z
_includes/samples/PriceFeeds/HistoricalPriceConsumer.py
CemmOzdemir/documentation
3c889ffb665399965f44fd2645d1c823e06e129f
[ "MIT" ]
524
2021-04-28T18:14:59.000Z
2022-03-31T07:44:36.000Z
_includes/samples/PriceFeeds/HistoricalPriceConsumer.py
CemmOzdemir/documentation
3c889ffb665399965f44fd2645d1c823e06e129f
[ "MIT" ]
161
2021-04-29T05:12:23.000Z
2022-03-28T20:28:17.000Z
web3 = Web3(Web3.HTTPProvider('https://kovan.infura.io/v3/<infura_project_id>')) abi = '[{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_roundId","type":"uint80"}],"name":"getRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]' addr = '0x9326BFA02ADD2366b30bacB125260Af641031331' contract = web3.eth.contract(address=addr, abi=abi) # Valid roundId must be known. They are NOT incremental. # invalidRoundId = 18446744073709562300 validRoundId = 18446744073709562301 historicalData = contract.functions.getRoundData(validRoundId).call() print(historicalData)
155
1,292
0.696188
165
1,705
7.175758
0.327273
0.050676
0.097128
0.130912
0.534628
0.503378
0.435811
0.435811
0.435811
0.435811
0
0.082085
0.021114
1,705
11
1,293
155
0.627322
0.053959
0
0
0
0.142857
0.852174
0.823602
0
0
0.026087
0
0
1
0
false
0
0
0
0
0.142857
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
c486b2d92ab0f2c43b9ccc5632f7316bedff26d2
169
py
Python
config/settings/local.py
tekneee/modern-django-rest
9eec39f4debb47edcc0d41b6b85b1b6f74aa564b
[ "MIT" ]
null
null
null
config/settings/local.py
tekneee/modern-django-rest
9eec39f4debb47edcc0d41b6b85b1b6f74aa564b
[ "MIT" ]
null
null
null
config/settings/local.py
tekneee/modern-django-rest
9eec39f4debb47edcc0d41b6b85b1b6f74aa564b
[ "MIT" ]
null
null
null
from .base import * SECRET_KEY = env('DJANGO_SECRET_KEY', default='lba85^w6*j#h-$fi1@r*z717!iu%6o&5i&0^gq2hfv6fa1qg8a') DEBUG = env.bool('DJANGO_DEBUG', default=True)
28.166667
99
0.733728
29
169
4.137931
0.793103
0.15
0
0
0
0
0
0
0
0
0
0.090323
0.08284
169
5
100
33.8
0.683871
0
0
0
0
0.333333
0.467456
0.295858
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
670697fb13da9fb992ea850e7825c865b8a430f0
198
py
Python
employees/serializer.py
cliffnyendwe/employee-management-system
bc003ffd8bb5da540a27c1074c5d2015afd90b4f
[ "MIT" ]
null
null
null
employees/serializer.py
cliffnyendwe/employee-management-system
bc003ffd8bb5da540a27c1074c5d2015afd90b4f
[ "MIT" ]
null
null
null
employees/serializer.py
cliffnyendwe/employee-management-system
bc003ffd8bb5da540a27c1074c5d2015afd90b4f
[ "MIT" ]
null
null
null
from rest_framework import serializers from .models import Employees class EmployeesSerializer(serializers.ModelSerializer): class Meta: model = Employees fields = '__all__'
28.285714
55
0.737374
19
198
7.421053
0.736842
0
0
0
0
0
0
0
0
0
0
0
0.212121
198
7
56
28.285714
0.903846
0
0
0
0
0
0.035176
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
67151b69efe038431fc1b9f9094dc7d972fda42b
151
py
Python
mmocr/models/common/losses/__init__.py
yuexy/mmocr
82488024db159266e66ea6b0d6f84a5a18e87362
[ "Apache-2.0" ]
2,261
2021-04-08T03:45:41.000Z
2022-03-31T23:37:46.000Z
mmocr/models/common/losses/__init__.py
yuexy/mmocr
82488024db159266e66ea6b0d6f84a5a18e87362
[ "Apache-2.0" ]
789
2021-04-08T05:40:13.000Z
2022-03-31T09:42:39.000Z
mmocr/models/common/losses/__init__.py
yuexy/mmocr
82488024db159266e66ea6b0d6f84a5a18e87362
[ "Apache-2.0" ]
432
2021-04-08T03:56:16.000Z
2022-03-30T18:44:43.000Z
# Copyright (c) OpenMMLab. All rights reserved. from .dice_loss import DiceLoss from .focal_loss import FocalLoss __all__ = ['DiceLoss', 'FocalLoss']
25.166667
47
0.768212
19
151
5.789474
0.684211
0.181818
0
0
0
0
0
0
0
0
0
0
0.13245
151
5
48
30.2
0.839695
0.298013
0
0
0
0
0.163462
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
67821915738fafe0326881243a3683a614a2c6bf
751
py
Python
dynamicgem/utils/dynamictriad_utils/algorithm/samplers/sampler.py
Sujit-O/dyngem
a879bf362d1e9409faa4e1186c345337ad6d0189
[ "MIT" ]
141
2017-12-07T08:07:04.000Z
2021-12-20T13:56:46.000Z
dynamicgem/utils/dynamictriad_utils/algorithm/samplers/sampler.py
Sujit-O/dyngem
a879bf362d1e9409faa4e1186c345337ad6d0189
[ "MIT" ]
27
2018-03-13T17:23:52.000Z
2021-08-23T03:53:24.000Z
dynamicgem/utils/dynamictriad_utils/algorithm/samplers/sampler.py
Sujit-O/dyngem
a879bf362d1e9409faa4e1186c345337ad6d0189
[ "MIT" ]
54
2017-12-21T03:27:32.000Z
2021-09-02T08:04:10.000Z
from __future__ import print_function class Sampler(object): def pretrain_begin(self, begin, end): pass def pretrain_end(self): pass def pretrain_begin_iteration(self): pass def pretrain_end_iteration(self): pass def online_begin(self, begin, end): pass def online_end(self): pass def online_begin_iteration(self): pass def online_end_iteration(self): pass def make_pretrain_input(self, batch): pass def make_online_input(self, batch): pass def shuffle_sample(self): pass def batches(self, batchsize): raise NotImplementedError() def sample_size(self): raise NotImplementedError()
17.465116
41
0.631158
87
751
5.183908
0.298851
0.170732
0.170732
0.177384
0.476718
0.10643
0
0
0
0
0
0
0.298269
751
42
42
17.880952
0.855787
0
0
0.464286
0
0
0
0
0
0
0
0
0
1
0.464286
false
0.392857
0.035714
0
0.535714
0.035714
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
6791d07201542cc6c4f8bcfa8ec3c3d0298b9f40
26
py
Python
src/pip/__init__.py
NinjaIntheBronx/pip
f46550831d46fd66879d7d8a2a0eb6060efdeb67
[ "MIT" ]
559
2016-05-09T12:54:17.000Z
2022-03-30T22:22:37.000Z
src/pip/__init__.py
NinjaIntheBronx/pip
f46550831d46fd66879d7d8a2a0eb6060efdeb67
[ "MIT" ]
43
2016-05-09T13:39:47.000Z
2022-03-05T02:54:09.000Z
src/pip/__init__.py
NinjaIntheBronx/pip
f46550831d46fd66879d7d8a2a0eb6060efdeb67
[ "MIT" ]
29
2016-05-10T15:32:36.000Z
2022-02-10T19:17:38.000Z
__version__ = "19.1.dev0"
13
25
0.692308
4
26
3.5
1
0
0
0
0
0
0
0
0
0
0
0.173913
0.115385
26
1
26
26
0.434783
0
0
0
0
0
0.346154
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
67e46106a3e0438a7060fcf7a57900b2b46b45d4
122
py
Python
trunk/Documentacion/Memoria/trozos-codigo/codigo-9-tags-class.py
MGautier/security-sensor
7063b1f095cfa02bb56ef2544d0395dbf155310f
[ "MIT" ]
2
2016-08-15T21:25:40.000Z
2020-06-22T12:25:48.000Z
trunk/Documentacion/Memoria/trozos-codigo/codigo-9-tags-class.py
MGautier/security-sensor
7063b1f095cfa02bb56ef2544d0395dbf155310f
[ "MIT" ]
4
2020-06-05T17:32:18.000Z
2021-06-10T19:05:56.000Z
trunk/Documentacion/Memoria/trozos-codigo/codigo-9-tags-class.py
MGautier/security-sensor
7063b1f095cfa02bb56ef2544d0395dbf155310f
[ "MIT" ]
null
null
null
class TagsTestCase(TestCase): def setUp(self): Tags.objects.create(Description="Urgent Pointer", Tag="URGP")
24.4
69
0.696721
14
122
6.071429
1
0
0
0
0
0
0
0
0
0
0
0
0.163934
122
4
70
30.5
0.833333
0
0
0
0
0
0.147541
0
0
0
0
0
0
1
0.333333
false
0
0
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
0
0
1
0
0
4
db025fc5785968aefb4d54c6c7284d45df039753
562
py
Python
information/serializers.py
encrypted-fox/students_performance_monitoring
1a6c80ff70f3738496809586ae3fc204a156ca3b
[ "MIT" ]
null
null
null
information/serializers.py
encrypted-fox/students_performance_monitoring
1a6c80ff70f3738496809586ae3fc204a156ca3b
[ "MIT" ]
22
2020-01-23T17:41:36.000Z
2021-07-02T14:00:00.000Z
information/serializers.py
encrypted-fox/students_performance_monitoring
1a6c80ff70f3738496809586ae3fc204a156ca3b
[ "MIT" ]
null
null
null
from rest_framework import serializers from .models import * class StartYearsSerializer(serializers.ModelSerializer): class Meta: model = StartYears fields = '__all__' class TermsSerializer(serializers.ModelSerializer): class Meta: model = Terms fields = '__all__' class MarksSerializer(serializers.ModelSerializer): class Meta: model = Marks fields = '__all__' class ControlTypesSerializer(serializers.ModelSerializer): class Meta: model = ControlTypes fields = '__all__'
20.071429
58
0.688612
48
562
7.708333
0.416667
0.281081
0.335135
0.378378
0.432432
0
0
0
0
0
0
0
0.243772
562
27
59
20.814815
0.870588
0
0
0.444444
0
0
0.049822
0
0
0
0
0
0
1
0
false
0
0.111111
0
0.555556
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
db22decec521e3ac4a6e9dc1a013934bc6a5d01e
56
py
Python
torch_geometric_temporal/nn/__init__.py
mariaast/pytorch_geometric_temporal
2c99d690cf183e6c9e7ff40d15ba2f8b875c1aaf
[ "MIT" ]
1
2020-11-24T13:10:37.000Z
2020-11-24T13:10:37.000Z
torch_geometric_temporal/nn/__init__.py
mariaast/pytorch_geometric_temporal
2c99d690cf183e6c9e7ff40d15ba2f8b875c1aaf
[ "MIT" ]
null
null
null
torch_geometric_temporal/nn/__init__.py
mariaast/pytorch_geometric_temporal
2c99d690cf183e6c9e7ff40d15ba2f8b875c1aaf
[ "MIT" ]
null
null
null
from .recurrent import * # from .convolutional import *
18.666667
30
0.75
6
56
7
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.160714
56
2
31
28
0.893617
0.5
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
db37c747a9885d40ade0aa637ba706c56ad5e01a
52
py
Python
asyncmy/replication/__init__.py
kijk2869/asyncmy
02e5daa901898dc134bfa5ef56183ca6e7665242
[ "Apache-2.0" ]
82
2021-02-08T03:38:44.000Z
2022-03-23T02:14:36.000Z
asyncmy/replication/__init__.py
kijk2869/asyncmy
02e5daa901898dc134bfa5ef56183ca6e7665242
[ "Apache-2.0" ]
32
2021-03-16T07:30:35.000Z
2022-03-31T22:38:00.000Z
asyncmy/replication/__init__.py
kijk2869/asyncmy
02e5daa901898dc134bfa5ef56183ca6e7665242
[ "Apache-2.0" ]
11
2021-03-16T08:54:46.000Z
2022-03-31T13:24:13.000Z
from .binlogstream import BinLogStream # noqa:F401
26
51
0.807692
6
52
7
0.833333
0
0
0
0
0
0
0
0
0
0
0.066667
0.134615
52
1
52
52
0.866667
0.173077
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
e1df37eaabae10246430f0419f6b9867a1489144
17,172
py
Python
sk/gen_dt.py
gudeh/IWLS2021Final
34b8f867c7008c81d9883aebdc8833f1512dd636
[ "MIT" ]
1
2022-02-06T14:29:22.000Z
2022-02-06T14:29:22.000Z
sk/gen_dt.py
gudeh/IWLS2021Final
34b8f867c7008c81d9883aebdc8833f1512dd636
[ "MIT" ]
null
null
null
sk/gen_dt.py
gudeh/IWLS2021Final
34b8f867c7008c81d9883aebdc8833f1512dd636
[ "MIT" ]
null
null
null
from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier from sys import argv import numpy as np from sklearn.tree import DecisionTreeClassifier, export_graphviz from sklearn.model_selection import cross_val_score from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score import graphviz import os from sklearn.tree import _tree import copy from copy import deepcopy import gen_decision_tree_eqn as eqn import sys import boolean from ctes_trees import * import pandas as pd from itertools import product import sklearn.datasets as ds from math import log from math import ceil from math import sqrt from math import floor from sklearn.tree import * from collections import Counter from statistics import mean from utils import * import os.path from sys import argv def get_all_comparisons_ors_opt(tree, which_out = -1): tree_ = tree.tree_ featureName = ["feat_%d" % (i) if i != _tree.TREE_UNDEFINED else "undefined!" for i in tree_.feature] comparisons = [] ors = [] def recurse(node, depth, expression): indent = "\t" * depth if tree_.feature[node] != _tree.TREE_UNDEFINED: name = featureName[node] threshold = tree_.threshold[node] if [name, threshold] not in comparisons: comparisons.append([name, threshold]) recurse(tree_.children_left[node], depth + 1, deepcopy(expression + [[name, threshold, 'true']])) recurse(tree_.children_right[node], depth + 1, deepcopy(expression + [[name, threshold, 'false']])) else: if which_out == -1: if np.argmax(tree_.value[node]) == 1: ors.append(deepcopy(expression)) else: if np.argmax(tree_.value[node]) == which_out: ors.append(deepcopy(expression)) recurse(0, 1, []) return comparisons, ors def convToExpr_eqn_sep(fHandler, ors, exprIdx): orIdx = 0 andIdx = 0 expr = "" if len(ors) == 0: print("expr_%s = 0;" % (exprIdx), file = fHandler) else: for idx, _or in enumerate(ors): expr = "(" + " * ".join(["%s(comp_%s_%s)" % ("!" if x[2] == 'false' else "", x[0], x[1]) for x in _or]) + ")" expr = expr.replace(".","_") print("expr_%s_or_%d = %s;" % (exprIdx, idx, expr), file = fHandler) orsIdx = range(len(ors)) secOrsList = [] for idx2, partialOrsIdx in enumerate(range(0, len(orsIdx), 30)): secOrsList.append(idx2) expr = " + ".join(["(expr_%s_or_%d)" % (exprIdx, idx) for idx in orsIdx[partialOrsIdx:partialOrsIdx + 30]]) print("partial_expr_%s_%d = %s;" % (exprIdx, idx2, expr), file = fHandler) finalExpr = " + ".join(["(partial_expr_%s_%d)" % (exprIdx, idx) for idx in secOrsList]) print("expr_%s = %s;" % (exprIdx, finalExpr), file = fHandler) def convToExpr_eqn_sep_opt(fHandler, ors, exprIdx): orIdx = 0 andIdx = 0 expr = "" if exprIdx.split("_")[0] == "0": print("expr_%s = 0;" % (exprIdx), file = fHandler) elif len(ors) == 0: print("expr_%s = 0;" % (exprIdx), file = fHandler) else: for idx, _or in enumerate(ors): expr = "(" + " * ".join(["%s(comp_%s_%s)" % ("!" if x[2] == 'false' else "", x[0], x[1]) for x in _or]) + ")" expr = expr.replace(".","_") print("expr_%s_or_%d = %s;" % (exprIdx, idx, expr), file = fHandler) finalExpr = " + ".join(["(expr_%s_or_%d)" % (exprIdx, idx) for idx in range(len(ors))]) print("expr_%s = %s;" % (exprIdx, finalExpr), file = fHandler) def tree_to_eqn(clf, dataset, classifier, fHandler, numTrees, bits_precision): print("started translating") clfToUse = [] if classifier == 'tree': clfToUse.append(clf) elif classifier == 'forest': clfToUse = clf nr_out = outs[dataset] eqn.gen_header(fHandler) global_comparisons = [] for i in range(numTrees): for spec_out in range(nr_out): comparisons, ors = get_all_comparisons_ors_opt(clfToUse[i], spec_out) for comp in comparisons: if comp not in global_comparisons: global_comparisons.append(comp) convToExpr_eqn_sep(fHandler, ors, "%d_%d" % (spec_out, i)) signals = [] comparators = [] existingComparisons = [] for comp in global_comparisons: templateBin = "{0:0%db}" % (bits_precision) constValue = templateBin.format(int(comp[1])).replace("-","") parsedConst = str(comp[1]).replace(".","_") eqn.genCte_eqn(fHandler, "const_%s_%s" % (comp[0], parsedConst), constValue) eqn.genComp_generic_eqn(fHandler, comp[0], "const_%s_%s" % (comp[0], parsedConst), "comp_%s_%s" % (comp[0], parsedConst), bits_precision) exprs = [] if classifier == 'forest': sizeBitsAdd = int(ceil(log(numTrees+1,2))) nrCatBits = sizeBitsAdd - 1 for _out in range(nr_out): signal = {} signal['name'] = 'add_%d' % (_out) signal['size'] = sizeBitsAdd signals.append(deepcopy(signal)) for _out in range(nr_out): for i in range(numTrees): eqn.extendSignal_eqn(fHandler, "expr_%d_%d" % (_out, i), 1, nrCatBits) for _out in range(nr_out): if numTrees == 2: eqn.genAdderNoCout_eqn(fHandler, "expr_%d_0" % (_out), "expr_%d_1" % (_out), "add_%d" % (_out), nrCatBits+1) elif numTrees == 3: eqn.genAdderNoCout_eqn(fHandler, "expr_%d_0" % (_out), "expr_%d_1" % (_out), "part_add_%d_0" % (_out), nrCatBits+1) j = 0 eqn.genAdderNoCout_eqn(fHandler, "part_add_%d_%d" % (_out, j), "expr_%d_%d" % (_out, j+2), "add_%d" % (_out), nrCatBits+1) else: eqn.genAdderNoCout_eqn(fHandler, "expr_%d_0" % (_out), "expr_%d_1" % (_out), "part_add_%d_0" % (_out), nrCatBits+1) j = 0 for j in range(numTrees-3): eqn.genAdderNoCout_eqn(fHandler, "part_add_%d_%d" % (_out, j), "expr_%d_%d" % (_out, j+2), "part_add_%d_%d" % (_out, j+1), nrCatBits+1) eqn.genAdderNoCout_eqn(fHandler, "part_add_%d_%d" % (_out, j+1), "expr_%d_%d" % (_out, j+3), "add_%d" % (_out), nrCatBits+1) comps = [] cmprsnsGlobal = [] highestsGlobal = [] groupings = 2 l = ["add_%d" % (x) for x in range(nr_out)] cmprsns = [l[i:i+groupings] for i in range(0, len(l), groupings)] while len(cmprsns) > 1: nextCmprsns = [] for elem in cmprsns: concatNrs = "_".join(["_".join(x.split("_")[1:]) for x in elem]) if len(elem) < 2: nextCmprsns.append("add_%s" % (concatNrs)) continue sizeBitsAdd = int(ceil(log(numTrees+1,2))) eqn.genCompHeq_eqn(fHandler, elem[0], elem[1], "comp_add_%s" % (concatNrs), sizeBitsAdd) eqn.mux21_eqn(fHandler, elem[0], elem[1], "comp_add_%s" % (concatNrs), "add_%s" % (concatNrs), sizeBitsAdd) comp = {} comp['elems'] = elem highestsGlobal.append('add_%s' % (concatNrs)) cmprsnsGlobal.append('comp_add_%s' % (concatNrs)) idxs = [] nextCmprsns.append("add_%s" % (concatNrs)) comps.append(deepcopy(comp)) cmprsns = [nextCmprsns[i:i+groupings] for i in range(0,len(nextCmprsns),groupings)] comp = {} comp['elems'] = cmprsns[0] sizeBitsAdd = int(ceil(log(numTrees+1,2))) eqn.genCompHeq_eqn(fHandler, cmprsns[0][0], cmprsns[0][1], 'comp_add_%s' % ("_".join(["_".join(x.split("_")[1:]) for x in cmprsns[0]])), sizeBitsAdd) eqn.mux21_eqn(fHandler, cmprsns[0][0], cmprsns[0][1], 'comp_add_%s' % ("_".join(["_".join(x.split("_")[1:]) for x in cmprsns[0]])), 'add_%s' % ("_".join(["_".join(x.split("_")[1:]) for x in cmprsns[0]])), sizeBitsAdd) #print(comp) comps.append(deepcopy(comp)) cmprsnsGlobal.append('comp_add_%s' % ("_".join(["_".join(x.split("_")[1:]) for x in cmprsns[0]]))) if classifier == 'forest': for _out in range(nr_out): elemsContainOut = [] for elem in cmprsnsGlobal: if str(_out) in elem.split("_")[2:]: elemsContainOut.append(elem) eqn.concatSignal_eqn(fHandler, "sel_decision_%d" % (_out), elemsContainOut) seqDecider = "" for code in elemsContainOut: for comp in comps: cats = "comp_add_" + "_".join(comp['elems'][0].split("_")[1:] + comp['elems'][1].split("_")[1:]) add0 = comp['elems'][0].split("_")[1:] add1 = comp['elems'][1].split("_")[1:] if code == cats: if str(_out) in add0: seqDecider += "1" else: seqDecider += "0" eqn.trnsfrmLargeSelIn1bit_eqn(fHandler, "sel_decision_%d" % (_out), "sel_decision_%d_red" % (_out), seqDecider) eqn.attribSignal_eqn(fHandler, "decision_%d" % (_out), "sel_decision_%d_red" % (_out)) if classifier == 'tree': for _out in range(nr_out): eqn.attribSignal_eqn(fHandler, "decision_%d" % (_out), "expr_%d_0" % (_out)) def tree_to_eqn_opt(clf, dataset, classifier, fHandler, numTrees, bits_precision): print("started translating") clfToUse = [] if classifier == 'tree': clfToUse.append(clf) elif classifier == 'forest': clfToUse = clf nr_out = outs[dataset] eqn.gen_header(fHandler) global_comparisons = [] for i in range(numTrees): for spec_out in range(nr_out): comparisons, ors = get_all_comparisons_ors_opt(clfToUse[i], spec_out) for comp in comparisons: if comp not in global_comparisons: global_comparisons.append(comp) convToExpr_eqn_sep_opt(fHandler, ors, "%d_%d" % (spec_out, i)) signals = [] comparators = [] existingComparisons = [] for comp in global_comparisons: templateBin = "{0:0%db}" % (bits_precision) constValue = templateBin.format(int(comp[1])).replace("-","") parsedConst = str(comp[1]).replace(".","_") eqn.genCte_eqn(fHandler, "const_%s_%s" % (comp[0], parsedConst), constValue) eqn.genComp_generic_eqn(fHandler, comp[0], "const_%s_%s" % (comp[0], parsedConst), "comp_%s_%s" % (comp[0], parsedConst), bits_precision) exprs = [] if classifier == 'forest': sizeBitsAdd = int(ceil(log(numTrees+1,2))) nrCatBits = sizeBitsAdd - 1 for _out in range(nr_out): signal = {} signal['name'] = 'add_%d' % (_out) signal['size'] = sizeBitsAdd signals.append(deepcopy(signal)) for _out in range(nr_out): for i in range(numTrees): eqn.extendSignal_eqn(fHandler, "expr_%d_%d" % (_out, i), 1, nrCatBits) for _out in range(nr_out): if numTrees == 2: eqn.genAdderNoCout_eqn(fHandler, "expr_%d_0" % (_out), "expr_%d_1" % (_out), "add_%d" % (_out), nrCatBits+1) elif numTrees == 3: eqn.genAdderNoCout_eqn(fHandler, "expr_%d_0" % (_out), "expr_%d_1" % (_out), "part_add_%d_0" % (_out), nrCatBits+1) j = 0 eqn.genAdderNoCout_eqn(fHandler, "part_add_%d_%d" % (_out, j), "expr_%d_%d" % (_out, j+2), "add_%d" % (_out), nrCatBits+1) else: eqn.genAdderNoCout_eqn(fHandler, "expr_%d_0" % (_out), "expr_%d_1" % (_out), "part_add_%d_0" % (_out), nrCatBits+1) j = 0 for j in range(numTrees-3): eqn.genAdderNoCout_eqn(fHandler, "part_add_%d_%d" % (_out, j), "expr_%d_%d" % (_out, j+2), "part_add_%d_%d" % (_out, j+1), nrCatBits+1) eqn.genAdderNoCout_eqn(fHandler, "part_add_%d_%d" % (_out, j+1), "expr_%d_%d" % (_out, j+3), "add_%d" % (_out), nrCatBits+1) comps = [] cmprsnsGlobal = [] highestsGlobal = [] groupings = 2 l = ["add_%d" % (x) for x in range(nr_out)] cmprsns = [l[i:i+groupings] for i in range(0, len(l), groupings)] while len(cmprsns) > 1: nextCmprsns = [] for elem in cmprsns: concatNrs = "_".join(["_".join(x.split("_")[1:]) for x in elem]) if len(elem) < 2: nextCmprsns.append("add_%s" % (concatNrs)) continue sizeBitsAdd = int(ceil(log(numTrees+1,2))) eqn.genCompHeq_eqn(fHandler, elem[0], elem[1], "comp_add_%s" % (concatNrs), sizeBitsAdd) eqn.mux21_eqn(fHandler, elem[0], elem[1], "comp_add_%s" % (concatNrs), "add_%s" % (concatNrs), sizeBitsAdd) comp = {} comp['elems'] = elem highestsGlobal.append('add_%s' % (concatNrs)) cmprsnsGlobal.append('comp_add_%s' % (concatNrs)) idxs = [] nextCmprsns.append("add_%s" % (concatNrs)) comps.append(deepcopy(comp)) cmprsns = [nextCmprsns[i:i+groupings] for i in range(0,len(nextCmprsns),groupings)] comp = {} comp['elems'] = cmprsns[0] sizeBitsAdd = int(ceil(log(numTrees+1,2))) eqn.genCompHeq_eqn(fHandler, cmprsns[0][0], cmprsns[0][1], 'comp_add_%s' % ("_".join(["_".join(x.split("_")[1:]) for x in cmprsns[0]])), sizeBitsAdd) eqn.mux21_eqn(fHandler, cmprsns[0][0], cmprsns[0][1], 'comp_add_%s' % ("_".join(["_".join(x.split("_")[1:]) for x in cmprsns[0]])), 'add_%s' % ("_".join(["_".join(x.split("_")[1:]) for x in cmprsns[0]])), sizeBitsAdd) #print(comp) comps.append(deepcopy(comp)) cmprsnsGlobal.append('comp_add_%s' % ("_".join(["_".join(x.split("_")[1:]) for x in cmprsns[0]]))) if classifier == 'forest': for _out in range(nr_out): elemsContainOut = [] for elem in cmprsnsGlobal: if str(_out) in elem.split("_")[2:]: elemsContainOut.append(elem) eqn.concatSignal_eqn(fHandler, "sel_decision_%d" % (_out), elemsContainOut) seqDecider = "" for code in elemsContainOut: for comp in comps: cats = "comp_add_" + "_".join(comp['elems'][0].split("_")[1:] + comp['elems'][1].split("_")[1:]) add0 = comp['elems'][0].split("_")[1:] add1 = comp['elems'][1].split("_")[1:] if code == cats: if str(_out) in add0: seqDecider += "1" else: seqDecider += "0" eqn.trnsfrmLargeSelIn1bit_eqn(fHandler, "sel_decision_%d" % (_out), "sel_decision_%d_red" % (_out), seqDecider) eqn.attribSignal_eqn(fHandler, "decision_%d" % (_out), "sel_decision_%d_red" % (_out)) if classifier == 'tree': for _out in range(nr_out): eqn.attribSignal_eqn(fHandler, "decision_%d" % (_out), "expr_%d_0" % (_out)) def initializeSetup(): os.system("mkdir -p EQNS") os.system("mkdir -p AIGS") os.system("mkdir -p COMPRESS2RS_AIGS") os.system("mkdir -p %s" % (dirScripts)) def convertToEqn(classifier, numTrees, maxDepth, dataset, bits_precision, clf): AfileOutEqn = open("EQNS/out_%s_numTrees_%d_maxDepth_%d_bitsPrecision_%d_nosynth.eqn" % (classifier, numTrees, maxDepth, bits_precision), 'w') if classifier == 'forest': tree_to_eqn(clf, dataset, classifier, AfileOutEqn, numTrees, bits_precision) elif classifier == 'tree': #tree_to_eqn(clf, dataset, classifier, AfileOutEqn, numTrees) tree_to_eqn_opt(clf, dataset, classifier, AfileOutEqn, numTrees, bits_precision) AfileOutEqn.close() seed = int(argv[1]) adjustModels = int(argv[2]) np.random.seed(seed) dataset = 'cifar10' fHits = open("%s/hit_values.csv" % (folder_results), "a") if not(os.path.isfile("../data/mini_test_batch")): gen_small_test() initializeSetup() for classifier in classifiers: X = None y = None if adjustModels == 0: X, y = load_dataset() else: X, y = load_dataset_adjust() #apply feature selection methods if applyFS == 1: Xcropped = feature_selection(X, y, use_SKB = useSKB, use_SP = useSP, score_f = score_function, k = k, percent = percent) X = Xcropped ################################ for bits_precision in bits_precisions: featureSizes = gen_featureSizes(X, bits_precision) Xnew = quantize_dataset(X, bits_precision) _numTrees = [1] if classifier == 'tree': _numTrees = [1] elif classifier == 'forest': _numTrees = numTrees for numTree, maxDepth in product(_numTrees, maxDepths): print("started training...") np.random.seed(seed) if adjustModels == 0: clf, accuracy, crossValAccuracy = trnTst(Xnew, y, classifier, numTree, maxDepth, bits_precision, seed, useClassicRF, featureSizes) else: clf, accuracy, crossValAccuracy = trnTst_adjust(Xnew, y, classifier, numTree, maxDepth, bits_precision, seed, useClassicRF, featureSizes) print("finished training...") ands = 0 print("started conversion to eqn") convertToEqn(classifier, numTree, maxDepth, dataset, bits_precision, clf) print("generating aig from eqn") gen_aig("out_%s_numTrees_%d_maxDepth_%d_bitsPrecision_%d_nosynth" % (classifier, numTree, maxDepth, bits_precision)) print("running aig") if adjustModels == 0: run_aig("out_%s_numTrees_%d_maxDepth_%d_bitsPrecision_%d_nosynth" % (classifier, numTree, maxDepth, bits_precision)) else: run_aig_adjust("out_%s_numTrees_%d_maxDepth_%d_bitsPrecision_%d_nosynth" % (classifier, numTree, maxDepth, bits_precision)) compress2rs("out_%s_numTrees_%d_maxDepth_%d_bitsPrecision_%d_nosynth" % (classifier, numTree, maxDepth, bits_precision)) for i in range(nrExtraC2RS): compress2rs("out_%s_numTrees_%d_maxDepth_%d_bitsPrecision_%d_nosynth" % (classifier, numTree, maxDepth, bits_precision), firstC2RS = 0) ands = readAndsNr("out_%s_numTrees_%d_maxDepth_%d_bitsPrecision_%d_nosynth" % (classifier, numTree, maxDepth, bits_precision)) print(",".join([str(x) for x in [dataset, classifier, maxDepth, numTree, bits_precision, accuracy, "_".join([str(x) for x in crossValAccuracy]), mean(crossValAccuracy), nrExtraC2RS+1, ands]]), file=fHits) fHits.close()
34.902439
219
0.638772
2,276
17,172
4.57645
0.11116
0.035906
0.009217
0.016129
0.760177
0.729167
0.717262
0.700845
0.688652
0.669355
0
0.016253
0.193804
17,172
491
220
34.973523
0.736131
0.00658
0
0.685237
0
0
0.118663
0.024496
0.011142
0
0
0
0
1
0.022284
false
0
0.083565
0
0.108635
0.044568
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
e1f9e36db9f3abbef3d85bcb3f29f7691f342020
817
py
Python
photohub/controllers/admin.py
HurTeng/PhotoHub
298b4f24858f53c1744afa8f2114bf61f28509ae
[ "MIT" ]
null
null
null
photohub/controllers/admin.py
HurTeng/PhotoHub
298b4f24858f53c1744afa8f2114bf61f28509ae
[ "MIT" ]
null
null
null
photohub/controllers/admin.py
HurTeng/PhotoHub
298b4f24858f53c1744afa8f2114bf61f28509ae
[ "MIT" ]
null
null
null
# coding=utf-8 from flask import Blueprint from flask import current_app, request, abort, jsonify import photohub.tasks.task as task def login(): # 获取并验证用户名和密码 valid_user = current_app.config['USERNAME'] == request.args.get('username') valid_password = current_app.config['PASSWORD'] == request.args.get('password') if not valid_user or not valid_password: abort(404) bp_admin = Blueprint('admin', __name__, url_prefix='/admin') bp_admin.before_request(login) @bp_admin.route('/refresh_comics') def refresh_comics(): return jsonify(task.refresh_comics()) @bp_admin.route('/refresh_chapters') def refresh_chapters(): return jsonify(task.refresh_chapters()) @bp_admin.route('/refresh_comic_images') def refresh_comic_images(): return jsonify(task.refresh_comic_images())
24.029412
83
0.744186
109
817
5.302752
0.394495
0.060554
0.062284
0.098616
0
0
0
0
0
0
0
0.005634
0.130967
817
33
84
24.757576
0.808451
0.029376
0
0
0
0
0.121519
0.026582
0
0
0
0
0
1
0.210526
false
0.105263
0.157895
0.157895
0.526316
0.105263
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
4
c00c9395e0abe05f89f344f96f576c713f3f74b7
696
py
Python
core/models.py
pytime-osu/api
92702fe813a1fccf51d4e74a20195caab774ada8
[ "Apache-2.0" ]
null
null
null
core/models.py
pytime-osu/api
92702fe813a1fccf51d4e74a20195caab774ada8
[ "Apache-2.0" ]
2
2020-10-22T18:58:32.000Z
2020-11-05T17:42:17.000Z
core/models.py
pytime-osu/api
92702fe813a1fccf51d4e74a20195caab774ada8
[ "Apache-2.0" ]
null
null
null
from django.db import models class Suggestion(models.Model): name = models.CharField(max_length=100, unique=True) class ImageTag(models.Model): game = models.CharField(max_length=100) image = models.CharField(max_length=50) tag = models.CharField(max_length=200) class Favorite(models.Model): user = models.ForeignKey('authentication.CustomUser', on_delete=models.CASCADE) slug = models.CharField(max_length=100) class Meta: unique_together = ('user', 'slug') class Cover(models.Model): game = models.CharField(max_length=100) image = models.CharField(max_length=50) tag = models.CharField(max_length=200) size = models.IntegerField()
25.777778
83
0.722701
89
696
5.539326
0.393258
0.243408
0.292089
0.389452
0.527383
0.41785
0.41785
0.41785
0.41785
0.41785
0
0.037607
0.159483
696
26
84
26.769231
0.805128
0
0
0.352941
0
0
0.047414
0.03592
0
0
0
0
0
1
0
false
0
0.058824
0
0.941176
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
c015d246e1dccb81960950b981d3ef32a0c3ad62
303
py
Python
python/testData/inspections/PyCompatibilityInspection/assignmentStatement.py
teddywest32/intellij-community
e0268d7a1da1d318b441001448cdd3e8929b2f29
[ "Apache-2.0" ]
null
null
null
python/testData/inspections/PyCompatibilityInspection/assignmentStatement.py
teddywest32/intellij-community
e0268d7a1da1d318b441001448cdd3e8929b2f29
[ "Apache-2.0" ]
11
2017-02-27T22:35:32.000Z
2021-12-24T08:07:40.000Z
python/testData/inspections/PyCompatibilityInspection/assignmentStatement.py
teddywest32/intellij-community
e0268d7a1da1d318b441001448cdd3e8929b2f29
[ "Apache-2.0" ]
1
2022-01-02T19:58:08.000Z
2022-01-02T19:58:08.000Z
# PY-2792 x = <warning descr="Python version 2.4 doesn't support this syntax.">True if condition else False</warning> def foo(): # PY-2796 <warning descr="Python version 2.4 doesn't support this syntax. In Python <= 2.4, yield was a statement; it didn't return any value.">a = (yield 1)</warning>
50.5
159
0.70297
53
303
4.018868
0.622642
0.028169
0.169014
0.234742
0.469484
0.469484
0.469484
0.469484
0.469484
0.469484
0
0.059289
0.165017
303
5
160
60.6
0.782609
0.049505
0
0
0
0.333333
0.57193
0
0
0
0
0
0
0
null
null
0
0
null
null
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
2222b670dfba790385513de293be2dd40b349a74
923
py
Python
tests/test_finaImp.py
livysdad27/fina
504191c5a11fb4d4b78159d2a3b5ef77331a305b
[ "MIT" ]
null
null
null
tests/test_finaImp.py
livysdad27/fina
504191c5a11fb4d4b78159d2a3b5ef77331a305b
[ "MIT" ]
null
null
null
tests/test_finaImp.py
livysdad27/fina
504191c5a11fb4d4b78159d2a3b5ef77331a305b
[ "MIT" ]
null
null
null
#!/usr/bin/python from finaLib import finaImp from finaLib import finaExp import unittest, os, pandas, shutil class testImport(unittest.TestCase): '''Tests for importing a CSV file''' def setUp(self): pass def tearDown(self): pass def testDataDirExists(self): '''******Test that the data directory exists''' self.assertTrue(os.path.exists("data")) def testImportCSV(self): '''******Test a good file and make sure importOFX returns a pandas DataFrame object ''' self.assertIsInstance(finaImp.importOFX(open("tests/assets/test.OFX")), pandas.core.frame.DataFrame) def testPickleDataFrame(self): '''******Test that we can pickle a data frame successfully.''' df = finaExp.unPickleData("test.pkl", "tests/assets") finaImp.pickleDataFrame(df, "this.pkl", "tests/assets") self.assertTrue(os.path.isfile("tests/assets/this.pkl")) os.remove("tests/assets/this.pkl")
31.827586
104
0.698808
119
923
5.420168
0.521008
0.085271
0.052713
0.062016
0
0
0
0
0
0
0
0
0.151679
923
28
105
32.964286
0.823755
0.247021
0
0.117647
0
0
0.158754
0.093472
0
0
0
0
0.176471
1
0.294118
false
0.117647
0.352941
0
0.705882
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
1
0
1
0
0
4
22262954d58c0f5fd9311ce7fb27f68c8bb25240
1,441
py
Python
Ene-Jun-2021/perez-sanchez-jose-jahir/Practica2/decorator.py
bryanbalderas/DAS_Sistemas
1e31f088c0de7134471025a5730b0abfc19d936e
[ "MIT" ]
41
2017-09-26T09:36:32.000Z
2022-03-19T18:05:25.000Z
Ene-Jun-2021/perez-sanchez-jose-jahir/Practica2/decorator.py
bryanbalderas/DAS_Sistemas
1e31f088c0de7134471025a5730b0abfc19d936e
[ "MIT" ]
67
2017-09-11T05:06:12.000Z
2022-02-14T04:44:04.000Z
Ene-Jun-2021/perez-sanchez-jose-jahir/Practica2/decorator.py
bryanbalderas/DAS_Sistemas
1e31f088c0de7134471025a5730b0abfc19d936e
[ "MIT" ]
210
2017-09-01T00:10:08.000Z
2022-03-19T18:05:12.000Z
import abc class Character(metaclass=abc.ABCMeta): @abc.abstractmethod def equip(self): pass class CharacterConcreteComponent(Character): def __init__(self,name: str): self._name = name def equip(self): return f"{self._name} equipment:" class CharacterDecorator(Character, metaclass=abc.ABCMeta): def __init__(self,character_component: Character): self._character_component = character_component @abc.abstractmethod def equip(self): pass class ArmorConcreteDecorator(CharacterDecorator): def equip(self): return f"{self._character_component.equip()}\nArmor: Yes" class SwordConcreteDecorator(CharacterDecorator): def equip(self): return f"{self._character_component.equip()}\nSword: Yes" class RingConcreteDecorator(CharacterDecorator): def equip(self): return f"{self._character_component.equip()}\nRing: Yes" class ShieldConcreteDecorator(CharacterDecorator): def equip(self): return f"{self._character_component.equip()}\nShield: Yes" def main(): print(CharacterConcreteComponent("Luxor").equip()) print(ArmorConcreteDecorator(CharacterConcreteComponent("Luxor")).equip()) print(SwordConcreteDecorator(CharacterConcreteComponent("Luxor")).equip()) print(SwordConcreteDecorator(ArmorConcreteDecorator(CharacterConcreteComponent("Luxor"))).equip()) if __name__ == "__main__": main()
29.408163
102
0.725885
137
1,441
7.416058
0.240876
0.055118
0.082677
0.088583
0.473425
0.349409
0.326772
0.251969
0.251969
0.251969
0
0
0.159611
1,441
48
103
30.020833
0.838976
0
0
0.314286
0
0
0.166088
0.119527
0
0
0
0
0
1
0.285714
false
0.057143
0.028571
0.142857
0.657143
0.114286
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
4
97d999d92e92097071f2e9fb0b640c161d1d4b03
195
py
Python
src/napari_akseg/_version.py
piedrro/napari-akseg
305cbeb23c60b0371829e0937340f0fe0d0540a7
[ "BSD-3-Clause" ]
null
null
null
src/napari_akseg/_version.py
piedrro/napari-akseg
305cbeb23c60b0371829e0937340f0fe0d0540a7
[ "BSD-3-Clause" ]
null
null
null
src/napari_akseg/_version.py
piedrro/napari-akseg
305cbeb23c60b0371829e0937340f0fe0d0540a7
[ "BSD-3-Clause" ]
null
null
null
# coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control version = '0.1.dev133+g3c58c47.d20220526' version_tuple = (0, 1, 'dev133', 'g3c58c47.d20220526')
32.5
54
0.738462
30
195
4.733333
0.7
0.056338
0.112676
0.225352
0.352113
0
0
0
0
0
0
0.217647
0.128205
195
5
55
39
0.617647
0.466667
0
0
1
0
0.53
0.29
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
97f66a3f664b9e9d11f5218d373f78aaefa8aa5b
805
py
Python
myrdkit.py
kirthevasank/dragonfly_chemist
31e06cfeed228022749586e452e407e5ee0b55a1
[ "MIT" ]
29
2019-08-07T07:41:25.000Z
2022-03-20T13:10:49.000Z
myrdkit.py
kirthevasank/dragonfly_chemist
31e06cfeed228022749586e452e407e5ee0b55a1
[ "MIT" ]
10
2019-11-02T07:10:37.000Z
2022-03-12T00:03:04.000Z
myrdkit.py
kirthevasank/dragonfly_chemist
31e06cfeed228022749586e452e407e5ee0b55a1
[ "MIT" ]
4
2020-06-29T02:39:59.000Z
2022-02-17T20:52:46.000Z
""" A fix for rdkit broken imports: Import this script in any script to run. """ import rdkit from rdkit import Chem from rdkit.Chem.QED import qed from rdkit.Chem import Descriptors from rdkit import DataStructs from rdkit.Chem import rdmolops from rdkit.Chem.Fingerprints import FingerprintMols from rdkit.Chem.rdMolDescriptors import CalcMolFormula, CalcExactMolWt from rdkit.Chem import Draw from rdkit.Chem import MolSurf, Crippen from rdkit.Chem import rdMolDescriptors as rdmd from rdkit.Chem import rdMolDescriptors try: from rdkit.six.moves import cPickle except: from six.moves import cPickle from rdkit.six import iteritems import rdkit.Chem.EState as EState import rdkit.Chem.rdPartialCharges as rdPartialCharges import rdkit.Chem.rdChemReactions as rdRxns from rdkit import RDLogger
29.814815
70
0.827329
116
805
5.741379
0.344828
0.189189
0.175676
0.171171
0.105105
0
0
0
0
0
0
0
0.130435
805
26
71
30.961538
0.951429
0.089441
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.904762
0
0.904762
0.047619
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
3f1fec84c4be0a8a78aac29a3c1d1db6592b301e
66
py
Python
mindsdb/api/mysql/mysql_proxy/utilities/log.py
yarenty/mindsdb
9164bca6f45fd0f5ec329babe973f286ffe59709
[ "MIT" ]
261
2018-09-28T02:32:17.000Z
2018-12-10T06:30:54.000Z
mindsdb/api/mysql/mysql_proxy/utilities/log.py
yarenty/mindsdb
9164bca6f45fd0f5ec329babe973f286ffe59709
[ "MIT" ]
27
2018-09-26T08:49:11.000Z
2018-12-10T14:42:52.000Z
mindsdb/api/mysql/mysql_proxy/utilities/log.py
yarenty/mindsdb
9164bca6f45fd0f5ec329babe973f286ffe59709
[ "MIT" ]
46
2018-10-06T10:11:18.000Z
2018-12-10T04:02:17.000Z
from mindsdb.utilities.log import get_log log = get_log('mysql')
16.5
41
0.772727
11
66
4.454545
0.636364
0.244898
0
0
0
0
0
0
0
0
0
0
0.121212
66
3
42
22
0.844828
0
0
0
0
0
0.075758
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
3f489c9402dfceb431390ecdcd5fe02e7edce885
117
py
Python
reportspin/__init__.py
glryanon/Trusty-cogs
1d5056ad166a7e7ee5039baa31748b1995ae81f6
[ "MIT" ]
1
2020-12-28T15:58:16.000Z
2020-12-28T15:58:16.000Z
reportspin/__init__.py
glryanon/Trusty-cogs
1d5056ad166a7e7ee5039baa31748b1995ae81f6
[ "MIT" ]
null
null
null
reportspin/__init__.py
glryanon/Trusty-cogs
1d5056ad166a7e7ee5039baa31748b1995ae81f6
[ "MIT" ]
1
2020-07-27T00:04:45.000Z
2020-07-27T00:04:45.000Z
from redbot.core.bot import Red from .reportspin import Reports def setup(bot: Red): bot.add_cog(Reports(bot))
16.714286
31
0.74359
19
117
4.526316
0.631579
0
0
0
0
0
0
0
0
0
0
0
0.153846
117
6
32
19.5
0.868687
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.5
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
0
0
0
4
3f588919199cbb53351c192f74204e94faa96901
197
py
Python
PBO/PBO_18142/latihan_3.3_logika.py
rosnialabania/PBO
597c71d778483b97443a3944a03cea759771fecc
[ "MIT" ]
null
null
null
PBO/PBO_18142/latihan_3.3_logika.py
rosnialabania/PBO
597c71d778483b97443a3944a03cea759771fecc
[ "MIT" ]
null
null
null
PBO/PBO_18142/latihan_3.3_logika.py
rosnialabania/PBO
597c71d778483b97443a3944a03cea759771fecc
[ "MIT" ]
null
null
null
a= True b= False c= a and b print("jika A={} and B={} = {}". format(a,b,c)) c= a or b print("jika A={} or B={} = {}". format(a,b,c)) c= not a print("jika A={} maka not A = {}". format(a,b,c)
16.416667
48
0.502538
43
197
2.302326
0.27907
0.272727
0.30303
0.272727
0.222222
0.222222
0
0
0
0
0
0
0.218274
197
11
49
17.909091
0.642857
0
0
0
0
0
0.35533
0
0
0
0
0
0
0
null
null
0
0
null
null
0.375
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
1
0
0
0
0
0
0
0
0
4
3f64d634c5b6d2b2076444834f6585482677e21c
190
py
Python
utils/helper_functions.py
amansrivastava13/BookstoreApi
63122a3fdcbb576a565c819799d2493f6a40a383
[ "MIT" ]
null
null
null
utils/helper_functions.py
amansrivastava13/BookstoreApi
63122a3fdcbb576a565c819799d2493f6a40a383
[ "MIT" ]
null
null
null
utils/helper_functions.py
amansrivastava13/BookstoreApi
63122a3fdcbb576a565c819799d2493f6a40a383
[ "MIT" ]
null
null
null
import requests from utils.const import UPLOAD_PHOTO_URL async def upload_img_to_server(file): result = requests.post(UPLOAD_PHOTO_URL, files ={"image": file}) print(result.json())
27.142857
68
0.763158
28
190
4.928571
0.714286
0.15942
0.202899
0
0
0
0
0
0
0
0
0
0.131579
190
6
69
31.666667
0.836364
0
0
0
0
0
0.026316
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0.2
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
58ad9fb18dbcd6c57d3b43cc95705ffc348b2eb1
53
py
Python
utils/Vis.py
JMB-McFarlane/SLICE
e3cbcc0058975e6562c0e10cbb1a4b11376fa28b
[ "MIT" ]
null
null
null
utils/Vis.py
JMB-McFarlane/SLICE
e3cbcc0058975e6562c0e10cbb1a4b11376fa28b
[ "MIT" ]
null
null
null
utils/Vis.py
JMB-McFarlane/SLICE
e3cbcc0058975e6562c0e10cbb1a4b11376fa28b
[ "MIT" ]
null
null
null
# Module containing all data visualization functions
26.5
52
0.849057
6
53
7.5
1
0
0
0
0
0
0
0
0
0
0
0
0.132075
53
1
53
53
0.978261
0.943396
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
58b6a3aef20451e47f948642ec9a667360225b21
458
py
Python
PycharmProjects/PythonExercíciosHARDMODE/ex014HM.py
RodrigoMASRamos/Projects.py
ed15981b320914c9667305dcd5fb5b7906fd9b00
[ "MIT" ]
null
null
null
PycharmProjects/PythonExercíciosHARDMODE/ex014HM.py
RodrigoMASRamos/Projects.py
ed15981b320914c9667305dcd5fb5b7906fd9b00
[ "MIT" ]
null
null
null
PycharmProjects/PythonExercíciosHARDMODE/ex014HM.py
RodrigoMASRamos/Projects.py
ed15981b320914c9667305dcd5fb5b7906fd9b00
[ "MIT" ]
null
null
null
# ex014: Escreva um programa que converta uma temperatura digitada em ºC e converta para ºF print('\033[1;30mEste programa irá ler a temperatura digitada e ira converte-la.\033[m') cstr = input('\033[0;32mDigite a temperatura em graus celsius: ') c = float(cstr) f = (9 * (c / 5)) + 32 print('\033[0;36m°.°.°.°.°.°' * 6) print(f'\033[1;30m{c}°C \033[0;34mconvertidos em \033[1;30m°F \033[0;34mé igual a \033[1;30m{f}°F.') print('\033[0;36m°.°.°.°.°.°' * 6)
45.8
100
0.650655
99
458
3.161616
0.444444
0.063898
0.076677
0.076677
0.121406
0.121406
0.121406
0.121406
0.121406
0.121406
0
0.166667
0.135371
458
9
101
50.888889
0.585859
0.194323
0
0.285714
0
0.285714
0.708447
0.171662
0
0
0
0
0
1
0
false
0
0
0
0
0.571429
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
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
58d407cf64b240f52717171dd8e2d8d2976804c0
207
py
Python
ml/bayes/skmnb.py
ruiyangio/ml-sentiment
2fd69d1289faa700b0298ec3dbce47eafe40b756
[ "MIT" ]
null
null
null
ml/bayes/skmnb.py
ruiyangio/ml-sentiment
2fd69d1289faa700b0298ec3dbce47eafe40b756
[ "MIT" ]
null
null
null
ml/bayes/skmnb.py
ruiyangio/ml-sentiment
2fd69d1289faa700b0298ec3dbce47eafe40b756
[ "MIT" ]
null
null
null
from sklearn.naive_bayes import MultinomialNB from modelbase import ModelBase class SkMultinomialNB(ModelBase): def __init__(self): ModelBase.__init__(self) self.model = MultinomialNB()
25.875
45
0.753623
22
207
6.681818
0.590909
0.108844
0
0
0
0
0
0
0
0
0
0
0.178744
207
7
46
29.571429
0.864706
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
58f038c5204ee70dd1f8a46a3efcdce96c684965
598
py
Python
OperatorsAndOperands/operators_and_operands.py
fcampm/PythonSpecialization
308b5d6af6541e4e139a70913d5719ecc6308202
[ "MIT" ]
null
null
null
OperatorsAndOperands/operators_and_operands.py
fcampm/PythonSpecialization
308b5d6af6541e4e139a70913d5719ecc6308202
[ "MIT" ]
null
null
null
OperatorsAndOperands/operators_and_operands.py
fcampm/PythonSpecialization
308b5d6af6541e4e139a70913d5719ecc6308202
[ "MIT" ]
null
null
null
''' Author: Fabián Camp Mussa Github: https://github.com/fcampm Date: May 9, 2021 Topic: Operators and operands ''' print(1 + 2) # Addition operand, result will be 3 print(2 - 2) # Substraction operand, result will be 0 print(5 * 3) # Times operator, result will be 15 print(2 ** 3) # Exponentiation operator, result will be 8 print(10 / 3) # Division operator, result will be 3.3333 print(10 // 3) # Integer Division operator, result will be 3. This operand truncates the decimal part. print(10 % 3) # Modulo (mod) operator, result will be 1. The remainder of the 10/3 division is 1.
42.714286
103
0.705686
98
598
4.306122
0.479592
0.165877
0.199052
0.236967
0.137441
0.137441
0
0
0
0
0
0.078675
0.192308
598
14
104
42.714286
0.795031
0.782609
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
1
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
453bc416d0460a54ff20618a80ada216177668c0
193
py
Python
app/services/v1/__init__.py
rvmoura96/flask-template
d1383be7e17bff580e3ddf61ae580271c30201c4
[ "MIT" ]
2
2019-09-25T19:19:11.000Z
2019-10-08T01:05:35.000Z
app/services/v1/__init__.py
rvmoura96/flask-template
d1383be7e17bff580e3ddf61ae580271c30201c4
[ "MIT" ]
10
2019-09-13T23:41:42.000Z
2020-05-10T21:12:32.000Z
app/services/v1/__init__.py
rvmoura96/flask-template
d1383be7e17bff580e3ddf61ae580271c30201c4
[ "MIT" ]
9
2019-09-30T15:26:23.000Z
2020-09-28T23:36:25.000Z
from .service import ServiceApiV1 from .healthcheck import HealthApiV1 from .working import WorkApiV1 from .info import InfoApiV1 services = [ServiceApiV1, HealthApiV1, WorkApiV1, InfoApiV1,]
27.571429
61
0.823834
21
193
7.571429
0.52381
0
0
0
0
0
0
0
0
0
0
0.047059
0.119171
193
6
62
32.166667
0.888235
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.8
0
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
18d605192f2b87c54337d50b55e045f891781016
4,486
py
Python
geoportal/src/main/webapp/app/common/suave_upload.py
MrYanchos/geoportal-server-catalog
cf66af4b609e4001d66270026275f5950dd19f12
[ "Apache-2.0" ]
null
null
null
geoportal/src/main/webapp/app/common/suave_upload.py
MrYanchos/geoportal-server-catalog
cf66af4b609e4001d66270026275f5950dd19f12
[ "Apache-2.0" ]
null
null
null
geoportal/src/main/webapp/app/common/suave_upload.py
MrYanchos/geoportal-server-catalog
cf66af4b609e4001d66270026275f5950dd19f12
[ "Apache-2.0" ]
null
null
null
import helpers import time import pandas as pd from IPython.display import Markdown, display def printmd(string): display(Markdown(string)) full_notebook_url = "https://datahub.ucsd.edu/user/ivasilie/notebooks/jupyter-cinergi/CinergiDispatch.ipynb?collection=%7B%22id%22%3A%229eb81fc3-a54e-413f-a6ce-cb54d9485b62%22%2C%22collectionId%22%3A%22All%22%2C%22title%22%3A%22Show%20All%22%2C%22collectionlink%22%3A%22%22%2C%22packageType%22%3A%22standalone%22%2C%22briefrecords%22%3A%5B%7B%22identifier%22%3A%22e1c922b1dd514510a5c8affe63369194%22%2C%22recordlink%22%3A%22http%3A%2F%2Fdatadiscoverystudio.org%2Fgeoportal%2Frest%2Fmetadata%2Fitem%2Fe1c922b1dd514510a5c8affe63369194%2Fxml%22%2C%22title%22%3A%22H04900%3A%20NOS%20Hydrographic%20Survey%22%7D%2C%7B%22identifier%22%3A%22d1a7481108cb4a91b28a48bc5e578d87%22%2C%22recordlink%22%3A%22http%3A%2F%2Fdatadiscoverystudio.org%2Fgeoportal%2Frest%2Fmetadata%2Fitem%2Fd1a7481108cb4a91b28a48bc5e578d87%2Fxml%22%2C%22title%22%3A%22Chemistry%22%7D%2C%7B%22identifier%22%3A%2292901e5a15984b1ab58d4ce5df0b6cf0%22%2C%22recordlink%22%3A%22http%3A%2F%2Fdatadiscoverystudio.org%2Fgeoportal%2Frest%2Fmetadata%2Fitem%2F92901e5a15984b1ab58d4ce5df0b6cf0%2Fxml%22%2C%22title%22%3A%22(Table%202)%20Mineralogy%20of%20the%20%3C2-%C2%B5m%20size%20fraction%20at%20DSDP%20Holes%2086-576%2C%2086-578%2C%20and%2086-581%22%7D%2C%7B%22identifier%22%3A%22d6edc2df81054e85a7cddd5f139493ae%22%2C%22recordlink%22%3A%22http%3A%2F%2Fdatadiscoverystudio.org%2Fgeoportal%2Frest%2Fmetadata%2Fitem%2Fd6edc2df81054e85a7cddd5f139493ae%2Fxml%22%2C%22title%22%3A%22An%20Investigation%20of%20the%20intensity%20if%20the%20geomagnetic%20field%20during%20Roman%20times%20using%20magnetically%20anisotropic%20bricks%20and%20titles.%22%7D%2C%7B%22identifier%22%3A%223cdb2feea88d471ba5403d455e7149da%22%2C%22recordlink%22%3A%22http%3A%2F%2Fdatadiscoverystudio.org%2Fgeoportal%2Frest%2Fmetadata%2Fitem%2F3cdb2feea88d471ba5403d455e7149da%2Fxml%22%2C%22title%22%3A%22Still-image%20frame%20grabs%20and%20benthic%20habitat%20interpretation%20of%20underwater%20video%20footage%2C%20March%202014%2C%20Faga%60alu%20Bay%2C%20American%20Samoa%22%7D%2C%7B%22identifier%22%3A%22455a27692dc848c3aca725f0386f1377%22%2C%22recordlink%22%3A%22http%3A%2F%2Fdatadiscoverystudio.org%2Fgeoportal%2Frest%2Fmetadata%2Fitem%2F455a27692dc848c3aca725f0386f1377%2Fxml%22%2C%22title%22%3A%22CBRW3%20--%20from%20National%20Data%20Buoy%20Center%20(NDBC)%22%7D%2C%7B%22identifier%22%3A%22052635cae4c24c82b61b970e6c8fa82b%22%2C%22recordlink%22%3A%22http%3A%2F%2Fdatadiscoverystudio.org%2Fgeoportal%2Frest%2Fmetadata%2Fitem%2F052635cae4c24c82b61b970e6c8fa82b%2Fxml%22%2C%22title%22%3A%22Cruise%20EN521%20on%20RV%20Endeavor%22%7D%2C%7B%22identifier%22%3A%228317cf05d31a41cc8f9751989b2d1432%22%2C%22recordlink%22%3A%22http%3A%2F%2Fdatadiscoverystudio.org%2Fgeoportal%2Frest%2Fmetadata%2Fitem%2F8317cf05d31a41cc8f9751989b2d1432%2Fxml%22%2C%22title%22%3A%22(Table%20II)%20Soil%20geochemistry%20of%20a%20chronosequence%20near%20Lake%20Wellman%22%7D%2C%7B%22identifier%22%3A%229008d57d3f6246e9afd4069663f1ee4b%22%2C%22recordlink%22%3A%22http%3A%2F%2Fdatadiscoverystudio.org%2Fgeoportal%2Frest%2Fmetadata%2Fitem%2F9008d57d3f6246e9afd4069663f1ee4b%2Fxml%22%2C%22title%22%3A%22Moisture%20and%20density%20(MAD)%20measured%20on%20IODP%20Hole%20318-U1360A%22%7D%2C%7B%22identifier%22%3A%225dee4d2db5d7434ca5b3fad369035d26%22%2C%22recordlink%22%3A%22http%3A%2F%2Fdatadiscoverystudio.org%2Fgeoportal%2Frest%2Fmetadata%2Fitem%2F5dee4d2db5d7434ca5b3fad369035d26%2Fxml%22%2C%22title%22%3A%22Cruise%20HRS100603CS%20on%20RV%20Hugh%20R.%20Sharp%22%7D%5D%7D" linkstr = helpers.getLinksFromURL(full_notebook_url) print(linkstr) metable = pd.DataFrame(helpers.getDataFromLinks(linkstr)) print(metable) absolutePath = "" new_file = absolutePath + 'temp.csv' print("A new temporary file will be created at:") print(new_file) metable.to_csv(new_file, index=None) survey_name = "temp" + str(int(time.time()) % 1000) survey_url = "http://suave-dev.sdsc.edu/main/file=Yasha_Picasso_Paintings_clone_.csv" user = "Yasha" views = "1110101" view = "grid" referer = survey_url.split("/main")[0] +"/" upload_url = referer + "uploadCSV" new_survey_url_base = survey_url.split(user)[0] dzc_file = "https://maxim.ucsd.edu/dzgen/lib-staging-uploads/7a1385a0285c814637248104c649234d/content.dzc" print("Survey Name is:" + survey_name) helpers.uploadToSuave(new_file, survey_name, user, views, view, referer, upload_url, new_survey_url_base, dzc_file)
128.171429
3,461
0.842176
604
4,486
6.206954
0.36755
0.03841
0.032275
0.038144
0.355028
0.351027
0.319018
0.246466
0.232062
0.232062
0
0.262954
0.023406
4,486
34
3,462
131.941176
0.592787
0
0
0
0
0.074074
0.824788
0
0
0
0
0
0
1
0.037037
false
0
0.148148
0
0.185185
0.222222
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
1
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
18df115bc7922cff0cff47c9d044e8777fc40c94
74
py
Python
API/__init__.py
Build-Week-Med-Cabinet-3/Data-Science
6743e7a9411e9878c8bfc4df16cdc1709a2d72dc
[ "MIT" ]
null
null
null
API/__init__.py
Build-Week-Med-Cabinet-3/Data-Science
6743e7a9411e9878c8bfc4df16cdc1709a2d72dc
[ "MIT" ]
2
2020-03-02T20:21:32.000Z
2020-03-03T16:58:21.000Z
API/__init__.py
Build-Week-Med-Cabinet-3/Data-Science
6743e7a9411e9878c8bfc4df16cdc1709a2d72dc
[ "MIT" ]
2
2020-07-25T15:45:38.000Z
2020-08-02T09:51:52.000Z
"""Entry point for API""" from .app import create_app APP = create_app()
14.8
27
0.702703
12
74
4.166667
0.666667
0.36
0
0
0
0
0
0
0
0
0
0
0.162162
74
4
28
18.5
0.806452
0.256757
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
18f200fc6e7230fa816b27ce81f9264c5161bcce
104
py
Python
app/website_process/apps.py
lkolacz/semantive
643d5ac91a4c718e027f64f5dd5118128969418f
[ "MIT" ]
null
null
null
app/website_process/apps.py
lkolacz/semantive
643d5ac91a4c718e027f64f5dd5118128969418f
[ "MIT" ]
null
null
null
app/website_process/apps.py
lkolacz/semantive
643d5ac91a4c718e027f64f5dd5118128969418f
[ "MIT" ]
null
null
null
from django.apps import AppConfig class WebsiteProcessConfig(AppConfig): name = 'website_process'
17.333333
38
0.788462
11
104
7.363636
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.144231
104
5
39
20.8
0.910112
0
0
0
0
0
0.144231
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
e14b06db968e687a528b9c95ffe8ee798bf23ad9
663
py
Python
test/test_doc_ast.py
mrossinek/pdoc
8d133d2987f81fc088e4faa07bcd51f1de89c934
[ "Unlicense" ]
null
null
null
test/test_doc_ast.py
mrossinek/pdoc
8d133d2987f81fc088e4faa07bcd51f1de89c934
[ "Unlicense" ]
null
null
null
test/test_doc_ast.py
mrossinek/pdoc
8d133d2987f81fc088e4faa07bcd51f1de89c934
[ "Unlicense" ]
null
null
null
from pdoc.doc_ast import _dedent def test_dedent(): # not indented assert _dedent("def foo(): pass") == "def foo(): pass" # indented assert ( _dedent( """\ def foo(): pass""" ) == "def foo():\n pass" ) # with decorator assert ( _dedent( """\ @foo def foo(): pass""" ) == "@foo\ndef foo():\n pass" ) # with decorator and comment assert ( _dedent( """\ @foo # hello world def foo(): pass""" ) == "@foo\n# hello world\ndef foo():\n pass" )
16.575
58
0.402715
62
663
4.193548
0.33871
0.138462
0.192308
0.176923
0.426923
0.276923
0.276923
0.276923
0
0
0
0
0.45098
663
39
59
17
0.714286
0.095023
0
0.333333
0
0
0.284141
0
0
0
0
0
0.222222
1
0.055556
true
0.222222
0.055556
0
0.111111
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
0
0
0
4
e1773a4b064eb745a5b219c7814268796fff842b
53
py
Python
alphafold2_pytorch/__init__.py
blazingsiyan/alphafold2
3fba13222cfbfa6fe4719d2ebfe8fecc5aa5910d
[ "MIT" ]
3
2021-11-23T13:48:47.000Z
2022-02-09T06:46:31.000Z
alphafold2_pytorch/__init__.py
SuperXiang/alphafold2
a52b4a78ae995f4e17ad9cce62ebda7c81675493
[ "MIT" ]
1
2021-12-18T10:12:42.000Z
2021-12-18T10:12:58.000Z
alphafold2_pytorch/__init__.py
engomarwasfy/alphafold2
95d4e79ed97a99a3c5feb1d85e992a56c8c32dca
[ "MIT" ]
null
null
null
from alphafold2_pytorch.alphafold2 import Alphafold2
26.5
52
0.90566
6
53
7.833333
0.666667
0
0
0
0
0
0
0
0
0
0
0.061224
0.075472
53
1
53
53
0.897959
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
83188ed4e61350f1a6f7c62321fb8249ef216ccf
415
py
Python
product/views/__init__.py
Rafeen/Inventory-Management-and-POS
c6b93fd83e76d8cdee1bdbe1042a29b23bfc36ac
[ "MIT" ]
null
null
null
product/views/__init__.py
Rafeen/Inventory-Management-and-POS
c6b93fd83e76d8cdee1bdbe1042a29b23bfc36ac
[ "MIT" ]
10
2019-07-03T21:28:41.000Z
2022-01-13T01:13:35.000Z
product/views/__init__.py
Rafeen/Inventory-Management-and-POS
c6b93fd83e76d8cdee1bdbe1042a29b23bfc36ac
[ "MIT" ]
null
null
null
from .brand_view import BrandView from .category_view import CategoryView from .product_view import ProductView from .stock_view import StockView from .restock_view import RestockView from .warehouse_view import WarehouseView from .product_location_view import ProductLocationView from .serial_view import SerialView from .vendorsku_view import VendorSkuView from .category_details_view import category_detail_view
37.727273
55
0.879518
54
415
6.5
0.425926
0.2849
0
0
0
0
0
0
0
0
0
0
0.096386
415
10
56
41.5
0.936
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
8330cda99d07db56e8819717604e21bab20e0538
867
py
Python
setup.py
modoboa/radicale-modoboa-auth-token
d23ffa6cefa1695dde8d913728181085f5a39e19
[ "MIT" ]
2
2020-12-02T13:49:19.000Z
2021-02-17T07:10:23.000Z
setup.py
modoboa/radicale-modoboa-auth-token
d23ffa6cefa1695dde8d913728181085f5a39e19
[ "MIT" ]
null
null
null
setup.py
modoboa/radicale-modoboa-auth-token
d23ffa6cefa1695dde8d913728181085f5a39e19
[ "MIT" ]
1
2020-04-09T05:21:22.000Z
2020-04-09T05:21:22.000Z
#!/usr/bin/env python3 from distutils.core import setup setup( name="radicale_modoboa_token_auth", version='0.1.0', description='A token based authentication plugin for Radicale provided by Modoboa.', url='https://github.com/modoboa/radicale-modoboa-auth-token', author='Antoine Nguyen', author_email='tonio@ngyn.org', license='MIT', packages=["radicale_modoboa_token_auth"], install_requires=['radicale', 'requests'], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Operating System :: POSIX', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7' 'Programming Language :: Python :: 3.8' ] )
32.111111
88
0.640138
96
867
5.697917
0.625
0.173675
0.228519
0.23766
0
0
0
0
0
0
0
0.020619
0.21684
867
26
89
33.346154
0.784978
0.024221
0
0
0
0
0.613018
0.063905
0
0
0
0
0
1
0
true
0
0.045455
0
0.045455
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
1
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
835378f6c2763b2c5ab7dbc743f2a4a2904c5a42
96
py
Python
suites/search/__init__.py
jumper2014/web-test-framework-python-unittest-selenium
56fc2a54dfc6c8330f7fbc4dfbfeed7cba400cf6
[ "Apache-2.0" ]
48
2018-08-20T00:15:27.000Z
2021-10-09T03:17:09.000Z
suites/search/__init__.py
jumper2014/web-test-framework-python-unittest-selenium
56fc2a54dfc6c8330f7fbc4dfbfeed7cba400cf6
[ "Apache-2.0" ]
2
2021-03-05T08:42:35.000Z
2021-11-05T09:02:01.000Z
suites/search/__init__.py
jumper2014/web-test-framework-python-unittest-selenium
56fc2a54dfc6c8330f7fbc4dfbfeed7cba400cf6
[ "Apache-2.0" ]
22
2018-08-21T14:32:54.000Z
2022-03-19T02:12:22.000Z
#!/usr/bin/env python # coding=utf-8 # author: zengyuetian if __name__ == '__main__': pass
13.714286
26
0.666667
13
96
4.307692
1
0
0
0
0
0
0
0
0
0
0
0.012658
0.177083
96
7
27
13.714286
0.696203
0.552083
0
0
0
0
0.195122
0
0
0
0
0
0
1
0
true
0.5
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
4
55c1274c2803f2a5b9b75d172f75fb8dec262417
261
py
Python
redleader/resources/__init__.py
mmcdermo/RedLeader
13c5261e839fc3373a8de00d49187220778091a4
[ "Apache-2.0" ]
null
null
null
redleader/resources/__init__.py
mmcdermo/RedLeader
13c5261e839fc3373a8de00d49187220778091a4
[ "Apache-2.0" ]
null
null
null
redleader/resources/__init__.py
mmcdermo/RedLeader
13c5261e839fc3373a8de00d49187220778091a4
[ "Apache-2.0" ]
null
null
null
from .resource import * from .dynamodb import * from .s3 import * from .sqs import * from .ec2 import * from .cloudwatch import * from .codedeploy import * from .iam import * from .permissions import * from .elasticbeanstalk import * from .cloudsearch import *
21.75
31
0.747126
33
261
5.909091
0.393939
0.512821
0
0
0
0
0
0
0
0
0
0.009217
0.168582
261
11
32
23.727273
0.889401
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
55c89277aad329d96b89a8b4024eb63b11969949
543
py
Python
DataObject.py
Byteblaster/2015OSI
fd50e664a0025aa462d0acb8db4b28b5230db0e8
[ "MIT" ]
null
null
null
DataObject.py
Byteblaster/2015OSI
fd50e664a0025aa462d0acb8db4b28b5230db0e8
[ "MIT" ]
null
null
null
DataObject.py
Byteblaster/2015OSI
fd50e664a0025aa462d0acb8db4b28b5230db0e8
[ "MIT" ]
null
null
null
__author__ = 'Tyler Rudie' class article(object): Date = '' Publisher = '' Title = '' URL = '' Term = '' def __init__(self, Date, Publisher, Title, URL, Term): self.Date = Date self.Publisher = Publisher self.Title = Title self.URL = URL self.Term = Term def new_article(Date, Publisher, Title, URL, Term): return article(Date, Publisher, Title, URL, Term)
25.857143
62
0.460405
49
543
4.918367
0.326531
0.215768
0.298755
0.348548
0.473029
0.26556
0
0
0
0
0
0
0.443831
543
21
63
25.857143
0.798013
0
0
0
0
0
0.020221
0
0
0
0
0
0
1
0.133333
false
0
0
0.066667
0.6
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
55d1f0a3444f747e2c5983d5ab219b07e71cda44
89
py
Python
section/apps.py
CGYR/gongchengmiao_BBS
c673497eb72e3960fb7f01521033fe529043d421
[ "MIT" ]
null
null
null
section/apps.py
CGYR/gongchengmiao_BBS
c673497eb72e3960fb7f01521033fe529043d421
[ "MIT" ]
4
2020-06-05T20:32:58.000Z
2021-09-22T18:25:39.000Z
section/apps.py
abdukhashimov/django-base2
87161fa7eea79634093d325414b63edd9f620f62
[ "MIT" ]
null
null
null
from django.apps import AppConfig class SectionConfig(AppConfig): name = 'section'
14.833333
33
0.752809
10
89
6.7
0.9
0
0
0
0
0
0
0
0
0
0
0
0.168539
89
5
34
17.8
0.905405
0
0
0
0
0
0.078652
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
55d6d4311a0fc19ec66621e189d944b6d9fab2bb
77,975
py
Python
src/zope/security/tests/test_proxy.py
cjwatson/zope.security
b2b7ec8bca04be337bd91a6c5c6df61a5e27b418
[ "ZPL-2.1" ]
null
null
null
src/zope/security/tests/test_proxy.py
cjwatson/zope.security
b2b7ec8bca04be337bd91a6c5c6df61a5e27b418
[ "ZPL-2.1" ]
null
null
null
src/zope/security/tests/test_proxy.py
cjwatson/zope.security
b2b7ec8bca04be337bd91a6c5c6df61a5e27b418
[ "ZPL-2.1" ]
null
null
null
############################################################################## # # Copyright (c) 2003 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Security proxy tests """ import unittest from zope.security._compat import PYTHON2, PURE_PYTHON def _skip_if_not_Py2(testfunc): return unittest.skipUnless(PYTHON2, "Only on Py2")(testfunc) # pylint:disable=protected-access,eval-used,too-many-lines,too-many-public-methods if not PYTHON2: # pragma: no cover (Python 3) def coerce(*args): raise NotImplementedError("Not on Python 3") cmp = coerce long = int class AbstractProxyTestBase(object): # pylint:disable=no-member,blacklisted-name assertRaisesRegex = getattr(unittest.TestCase, 'assertRaisesRegex', unittest.TestCase.assertRaisesRegexp) # The names of attributes that are spelled different on Py2 # vs Py3 itruediv = '__itruediv__' if not PYTHON2 else '__idiv__' idiv = itruediv div = '__truediv__' if not PYTHON2 else '__div__' truediv = div getslice = '__getitem__' if not PYTHON2 else '__getslice__' setslice = '__setitem__' if not PYTHON2 else '__setslice__' def _getTargetClass(self): raise NotImplementedError("Subclass responsibility") def _makeOne(self, obj, checker): return self._getTargetClass()(obj, checker) def test_ctor_w_checker_None(self): self.assertRaises(ValueError, self._makeOne, object(), None) def test___getattr___w_checker_ok(self): class Foo(object): bar = 'Bar' target = Foo() checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy.bar, 'Bar') self.assertEqual(getattr(proxy, 'bar'), 'Bar') self.assertEqual(checker._checked, 'bar') self.assertEqual(checker._proxied, 'Bar') def test___getattr___w_checker_unauthorized(self): from zope.security.interfaces import Unauthorized class Foo(object): bar = 'Bar' target = Foo() checker = DummyChecker(Unauthorized) proxy = self._makeOne(target, checker) self.assertRaises(Unauthorized, getattr, proxy, 'bar') self.assertEqual(checker._checked, 'bar') def test___getattr___w_checker_forbidden_attribute(self): from zope.security.interfaces import ForbiddenAttribute class Foo(object): bar = 'Bar' target = Foo() checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): getattr(proxy, 'bar') self.assertEqual(checker._checked, 'bar') def test__getattr__w_checker_ok_dynamic_attribute_called_once(self): class Dynamic(object): count = 0 def __getattr__(self, name): self.count += 1 if self.count == 1: # Called from __getattribute__ raise AttributeError(name) raise AssertionError("We should not be called more than once") target = Dynamic() checker = DummyChecker() proxy = self._makeOne(target, checker) with self.assertRaisesRegex(AttributeError, "name"): getattr(proxy, 'name') self.assertEqual(1, target.count) def test___setattr___w_checker_ok(self): class Foo(object): bar = 'Bar' target = Foo() checker = DummyChecker() proxy = self._makeOne(target, checker) proxy.bar = 'Baz' self.assertEqual(target.bar, 'Baz') self.assertEqual(checker._checked, 'bar') self.assertEqual(checker._proxied, None) def test___setattr___w_checker_unauthorized(self): from zope.security.interfaces import Unauthorized class Foo(object): bar = 'Bar' target = Foo() checker = DummyChecker(Unauthorized) proxy = self._makeOne(target, checker) self.assertRaises(Unauthorized, setattr, proxy, 'bar', 'Baz') self.assertEqual(checker._checked, 'bar') def test___setattr___w_checker_forbidden_attribute(self): from zope.security.interfaces import ForbiddenAttribute class Foo(object): bar = 'Bar' target = Foo() checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, setattr, proxy, 'bar', 'Baz') self.assertEqual(checker._checked, 'bar') def test___delattr___w_checker_ok(self): class Foo(object): bar = None target = Foo() target.bar = 'Bar' checker = DummyChecker() proxy = self._makeOne(target, checker) del proxy.bar self.assertEqual(target.bar, None) self.assertEqual(checker._checked, 'bar') self.assertEqual(checker._proxied, None) def test___delattr___w_checker_unauthorized(self): from zope.security.interfaces import Unauthorized class Foo(object): def __init__(self): self.bar = 'Bar' target = Foo() checker = DummyChecker(Unauthorized) proxy = self._makeOne(target, checker) self.assertRaises(Unauthorized, delattr, proxy, 'bar') self.assertEqual(target.bar, 'Bar') self.assertEqual(checker._checked, 'bar') def test___delattr___w_checker_forbidden_attribute(self): from zope.security.interfaces import ForbiddenAttribute class Foo(object): def __init__(self): self.bar = 'Bar' target = Foo() checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, delattr, proxy, 'bar') self.assertEqual(target.bar, 'Bar') self.assertEqual(checker._checked, 'bar') def test___str___checker_allows_str(self): target = object() checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(str(proxy), str(target)) def test___str___checker_forbids_str(self): from zope.security.interfaces import ForbiddenAttribute from zope.security._compat import _BUILTINS from zope.security.proxy import _fmt_address target = object() checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) address = _fmt_address(target) self.assertEqual(str(proxy), '<security proxied %s.object ' 'instance at %s>' % (_BUILTINS, address)) def test___str___fails_return(self): from zope.security.interfaces import ForbiddenAttribute class CustomStr(object): def __str__(self): "<CustomStr>" # Docstring, not a return target = CustomStr() checker = DummyChecker(ForbiddenAttribute, allowed=('__str__')) proxy = self._makeOne(target, checker) with self.assertRaises(TypeError): str(target) with self.assertRaises(TypeError): str(proxy) def test___repr___checker_allows_str(self): target = object() checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(repr(proxy), repr(target)) def test___repr___checker_forbids_str(self): from zope.security.interfaces import ForbiddenAttribute from zope.security._compat import _BUILTINS from zope.security.proxy import _fmt_address target = object() checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) address = _fmt_address(target) self.assertEqual(repr(proxy), '<security proxied %s.object ' 'instance at %s>' % (_BUILTINS, address)) def test___str___falls_through_to_repr_when_both_allowed(self): from zope.security.interfaces import ForbiddenAttribute class CustomRepr(object): def __repr__(self): return "<CustomRepr>" target = CustomRepr() checker = DummyChecker(ForbiddenAttribute, allowed=("__str__", '__repr__')) proxy = self._makeOne(target, checker) self.assertEqual(repr(proxy), "<CustomRepr>") self.assertEqual(str(target), "<CustomRepr>") self.assertEqual(str(proxy), str(target)) def test___str___doesnot_fall_through_to_repr_when_str_not_allowed(self): from zope.security.interfaces import ForbiddenAttribute class CustomRepr(object): def __repr__(self): return "<CustomRepr>" target = CustomRepr() checker = DummyChecker(ForbiddenAttribute, allowed=('__repr__')) proxy = self._makeOne(target, checker) self.assertEqual(repr(proxy), "<CustomRepr>") self.assertEqual(str(target), "<CustomRepr>") self.assertIn("<security proxied zope.security", str(proxy)) def test___str___doesnot_fall_through_to_repr_when_repr_not_allowed(self): from zope.security.interfaces import ForbiddenAttribute class CustomRepr(object): def __repr__(self): return "<CustomRepr>" target = CustomRepr() checker = DummyChecker(ForbiddenAttribute, allowed=('__str__')) proxy = self._makeOne(target, checker) self.assertEqual(str(target), "<CustomRepr>") self.assertEqual(str(proxy), str(target)) self.assertIn("<security proxied zope.security", repr(proxy)) def test___str___falls_through_to_repr_but_repr_fails_return(self): from zope.security.interfaces import ForbiddenAttribute class CustomRepr(object): def __repr__(self): "<CustomRepr>" # Docstring, not a return target = CustomRepr() checker = DummyChecker(ForbiddenAttribute, allowed=('__repr__')) proxy = self._makeOne(target, checker) with self.assertRaises(TypeError): repr(target) with self.assertRaises(TypeError): repr(proxy) @_skip_if_not_Py2 def test___cmp___w_self(self): target = object() checker = object() # checker not consulted proxy = self._makeOne(target, checker) self.assertEqual(cmp(proxy, proxy), 0) @_skip_if_not_Py2 def test___cmp___w_target(self): target = object() checker = object() # checker not consulted proxy = self._makeOne(target, checker) self.assertEqual(cmp(proxy, target), 0) @_skip_if_not_Py2 def test___cmp___w_other(self): target = object() other = object() checker = object() # checker not consulted proxy = self._makeOne(target, checker) self.assertNotEqual(cmp(proxy, other), 0) @_skip_if_not_Py2 def test___cmp___w_other_proxy(self): target = object() checker = object() # checker not consulted proxy = self._makeOne(target, checker) o_proxy = self._makeOne(target, checker) self.assertEqual(cmp(proxy, o_proxy), 0) def test__le__(self): target = 1 checker = object() # checker not consulted proxy = self._makeOne(target, checker) self.assertTrue(proxy <= 1) def test__ne__(self): target = 1 checker = object() # checker not consulted proxy = self._makeOne(target, checker) self.assertFalse(proxy != 1) def test__ge__(self): target = 1 checker = object() # checker not consulted proxy = self._makeOne(target, checker) self.assertTrue(proxy >= 1) def test__gt__(self): target = 1 checker = object() # checker not consulted proxy = self._makeOne(target, checker) self.assertTrue(proxy > 0) def test___hash___w_self(self): target = object() checker = object() # checker not consulted proxy = self._makeOne(target, checker) self.assertEqual(hash(proxy), hash(target)) def test___call___w_checker_ok(self): class Foo(object): def __call__(self): return 'Bar' target = Foo() checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy(), 'Bar') self.assertEqual(checker._checked, '__call__') self.assertEqual(checker._proxied, 'Bar') def test___call___w_checker_unauthorized(self): from zope.security.interfaces import Unauthorized class Foo(object): def __call__(self): raise AssertionError("Never called") target = Foo() checker = DummyChecker(Unauthorized, ['__name__', '__str__']) proxy = self._makeOne(target, checker) self.assertRaises(Unauthorized, proxy) self.assertEqual(checker._checked, '__call__') def test___call___w_checker_forbidden_attribute(self): from zope.security.interfaces import ForbiddenAttribute class Foo(object): def __call__(self): raise AssertionError("Never called") target = Foo() checker = DummyChecker(ForbiddenAttribute, ['__str__']) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, proxy) self.assertEqual(checker._checked, '__call__') def test___int___w_checker_allows(self): target = 3.0 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(int(proxy), int(target)) self.assertEqual(checker._checked, '__int__') def test___int___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3.0 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, int, proxy) self.assertEqual(checker._checked, '__int__') def test___float___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(float(proxy), float(target)) self.assertEqual(checker._checked, '__float__') def test___float___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, float, proxy) self.assertEqual(checker._checked, '__float__') @_skip_if_not_Py2 def test___long___w_checker_allows(self): target = 3.0 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(long(proxy), long(target)) self.assertEqual(checker._checked, '__long__') @_skip_if_not_Py2 def test___long___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, long, proxy) self.assertEqual(checker._checked, '__long__') @_skip_if_not_Py2 def test___oct___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(oct(proxy), oct(target)) self.assertEqual(checker._checked, '__oct__') @_skip_if_not_Py2 def test___oct___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, oct, proxy) self.assertEqual(checker._checked, '__oct__') @_skip_if_not_Py2 def test___hex___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(hex(proxy), hex(target)) self.assertEqual(checker._checked, '__hex__') @_skip_if_not_Py2 def test___hex___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, hex, proxy) self.assertEqual(checker._checked, '__hex__') def test___add___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy + 2, target + 2) self.assertEqual(checker._checked, '__add__') def test___add___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy + 2) self.assertEqual(checker._checked, '__add__') def test___sub___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy - 2, target - 2) self.assertEqual(checker._checked, '__sub__') def test___sub___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy - 2) self.assertEqual(checker._checked, '__sub__') def test___mul___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy * 2, target * 2) self.assertEqual(checker._checked, '__mul__') def test___mul___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy * 2) self.assertEqual(checker._checked, '__mul__') def test___div___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy / 2, target / 2) self.assertEqual(checker._checked, self.div) def test___div___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy / 2) self.assertEqual(checker._checked, self.div) def test___truediv___w_checker_allows(self): target = 3.0 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy / 2, target / 2) self.assertEqual(checker._checked, self.truediv) def test___truediv___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3.0 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy / 2) self.assertEqual(checker._checked, self.truediv) def test___floordiv___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy // 2, target // 2) self.assertEqual(checker._checked, '__floordiv__') def test___floordiv___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy // 2) self.assertEqual(checker._checked, '__floordiv__') def test___mod___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy % 2, target % 2) self.assertEqual(checker._checked, '__mod__') def test___mod___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy % 2) self.assertEqual(checker._checked, '__mod__') def test___divmod___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(divmod(proxy, 2), divmod(target, 2)) self.assertEqual(checker._checked, '__divmod__') def test___divmod___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: divmod(proxy, 2)) self.assertEqual(checker._checked, '__divmod__') def test___pow___w_x_proxied_allowed(self): x, y, z = 3, 4, 7 checker = DummyChecker() proxy = self._makeOne(x, checker) self.assertEqual(pow(proxy, y, z), pow(x, y, z)) self.assertEqual(checker._checked, '__pow__') def test___pow___w_x_proxied_forbidden(self): from zope.security.interfaces import ForbiddenAttribute y, z = 4, 7 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(y, checker) self.assertRaises(ForbiddenAttribute, lambda: pow(proxy, y, z)) self.assertEqual(checker._checked, '__pow__') def test___pow___w_y_proxied_allowed(self): x, y = 3, 4 checker = DummyChecker() proxy = self._makeOne(y, checker) self.assertEqual(pow(x, proxy), pow(x, y)) self.assertEqual(checker._checked, '__rpow__') def test___pow___w_y_proxied_forbidden(self): from zope.security.interfaces import ForbiddenAttribute x, y = 3, 4 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(y, checker) self.assertRaises(ForbiddenAttribute, lambda: pow(x, proxy)) self.assertEqual(checker._checked, '__rpow__') def test___pow___w_z_proxied_allowed(self): x, y, z = 3, 4, 7 checker = DummyChecker() proxy = self._makeOne(z, checker) self.assertEqual(pow(x, y, proxy), pow(x, y, z)) self.assertEqual(checker._checked, '__3pow__') def test___pow___w_z_proxied_forbidden(self): from zope.security.interfaces import ForbiddenAttribute x, y, z = 3, 4, 7 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(z, checker) self.assertRaises(ForbiddenAttribute, lambda: pow(x, y, proxy)) self.assertEqual(checker._checked, '__3pow__') def test___neg___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(-proxy, -target) self.assertEqual(checker._checked, '__neg__') def test___neg___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: -proxy) self.assertEqual(checker._checked, '__neg__') def test___pos___w_checker_allows(self): target = -3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(+proxy, +target) self.assertEqual(checker._checked, '__pos__') def test___pos___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = -3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: +proxy) self.assertEqual(checker._checked, '__pos__') def test___abs___w_checker_allows(self): target = -3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(abs(proxy), abs(target)) self.assertEqual(checker._checked, '__abs__') def test___abs___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = -3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, abs, proxy) self.assertEqual(checker._checked, '__abs__') def test___bool___(self): target = 12 checker = object() proxy = self._makeOne(target, checker) self.assertEqual(bool(proxy), bool(target)) def test___invert___w_checker_allows(self): target = 47 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(~proxy, ~target) self.assertEqual(checker._checked, '__invert__') def test___invert___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 47 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: ~proxy) self.assertEqual(checker._checked, '__invert__') def test___lshift___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy << 2, target << 2) self.assertEqual(checker._checked, '__lshift__') def test___lshift___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy << 2) self.assertEqual(checker._checked, '__lshift__') def test___rshift___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy >> 2, target >> 2) self.assertEqual(checker._checked, '__rshift__') def test___rshift___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy >> 2) self.assertEqual(checker._checked, '__rshift__') def test___and___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy & 2, target & 2) self.assertEqual(checker._checked, '__and__') def test___and___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy & 2) self.assertEqual(checker._checked, '__and__') def test___xor___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy ^ 2, target ^ 2) self.assertEqual(checker._checked, '__xor__') def test___xor___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy ^ 2) self.assertEqual(checker._checked, '__xor__') def test___or___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy | 2, target | 2) self.assertEqual(checker._checked, '__or__') def test___or___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy | 2) self.assertEqual(checker._checked, '__or__') @_skip_if_not_Py2 def test___coerce___w_checker_allows(self): target = 3 checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(coerce(proxy, 4.0), coerce(target, 4.0)) self.assertEqual(checker._checked, '__coerce__') @_skip_if_not_Py2 def test___coerce___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, coerce, proxy, 4.0) self.assertEqual(checker._checked, '__coerce__') def test___iadd___not_inplace_checker_allows(self): target = 3 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy += 3 self.assertIsNot(proxy, before) self.assertEqual(proxy, 6) self.assertEqual(checker._checked, '__iadd__') def test___iadd___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __iadd__(self, rhs): self.value += rhs return self target = Foo(3) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy += 3 self.assertIs(proxy, before) self.assertEqual(target.value, 6) self.assertEqual(checker._checked, '__iadd__') def test___iadd___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy += 3 self.assertEqual(checker._checked, '__iadd__') def test___isub___not_inplace_checker_allows(self): target = 3 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy -= 3 self.assertIsNot(proxy, before) self.assertEqual(proxy, 0) self.assertEqual(checker._checked, '__isub__') def test___isub___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __isub__(self, rhs): self.value -= rhs return self target = Foo(3) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy -= 3 self.assertIs(proxy, before) self.assertEqual(target.value, 0) self.assertEqual(checker._checked, '__isub__') def test___isub___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy -= 3 self.assertEqual(checker._checked, '__isub__') def test___imul___not_inplace_checker_allows(self): target = 3 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy *= 3 self.assertIsNot(proxy, before) self.assertEqual(proxy, 9) self.assertEqual(checker._checked, '__imul__') def test___imul___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __imul__(self, rhs): self.value *= rhs return self target = Foo(3) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy *= 3 self.assertIs(proxy, before) self.assertEqual(target.value, 9) self.assertEqual(checker._checked, '__imul__') def test___imul___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 3 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy *= 3 self.assertEqual(checker._checked, '__imul__') def test___idiv___not_inplace_checker_allows(self): target = 6 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy /= 3 self.assertIsNot(proxy, before) self.assertEqual(proxy, 2) self.assertEqual(checker._checked, self.idiv) def test___idiv___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __idiv__(self, rhs): self.value /= rhs return self __itruediv__ = __idiv__ target = Foo(6) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy /= 3 self.assertIs(proxy, before) self.assertEqual(target.value, 2) self.assertEqual(checker._checked, self.idiv) def test___idiv___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 6 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy /= 3 self.assertEqual(checker._checked, self.idiv) def test___itruediv___not_inplace_checker_allows(self): target = 6 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy /= 3 self.assertIsNot(proxy, before) self.assertEqual(proxy, 2) self.assertEqual(checker._checked, self.itruediv) def test___itruediv___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __itruediv__(self, rhs): self.value /= rhs return self __idiv__ = __itruediv__ target = Foo(6) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy /= 3 self.assertIs(proxy, before) self.assertEqual(target.value, 2) self.assertEqual(checker._checked, self.itruediv) def test___itruediv___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 6 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy /= 3 self.assertEqual(checker._checked, self.itruediv) def test___ifloordiv___not_inplace_checker_allows(self): target = 6 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy //= 3 self.assertIsNot(proxy, before) self.assertEqual(proxy, 2) self.assertEqual(checker._checked, '__ifloordiv__') def test___ifloordiv___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __ifloordiv__(self, rhs): self.value //= rhs return self target = Foo(6) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy //= 3 self.assertIs(proxy, before) self.assertEqual(target.value, 2) self.assertEqual(checker._checked, '__ifloordiv__') def test___ifloordiv___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 6 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy //= 3 self.assertEqual(checker._checked, '__ifloordiv__') def test___imod___not_inplace_checker_allows(self): target = 6 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy %= 3 self.assertIsNot(proxy, before) self.assertEqual(proxy, 0) self.assertEqual(checker._checked, '__imod__') def test___imod___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __imod__(self, rhs): self.value %= rhs return self target = Foo(6) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy %= 3 self.assertIs(proxy, before) self.assertEqual(target.value, 0) self.assertEqual(checker._checked, '__imod__') def test___imod___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 6 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy %= 3 self.assertEqual(checker._checked, '__imod__') def test___ipow___not_inplace_checker_allows(self): target = 2 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy **= 3 self.assertIsNot(proxy, before) self.assertEqual(proxy, 8) self.assertEqual(checker._checked, '__ipow__') def test___ipow___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __ipow__(self, rhs): self.value **= rhs return self target = Foo(2) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy **= 3 self.assertIs(proxy, before) self.assertEqual(target.value, 8) self.assertEqual(checker._checked, '__ipow__') def test___ipow___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 2 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy **= 3 self.assertEqual(checker._checked, '__ipow__') def test___ilshift___not_inplace_checker_allows(self): target = 2 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy <<= 3 self.assertIsNot(proxy, before) self.assertEqual(proxy, 16) self.assertEqual(checker._checked, '__ilshift__') def test___ilshift___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __ilshift__(self, rhs): self.value <<= rhs return self target = Foo(2) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy <<= 3 self.assertIs(proxy, before) self.assertEqual(target.value, 16) self.assertEqual(checker._checked, '__ilshift__') def test___ilshift___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 2 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy <<= 3 self.assertEqual(checker._checked, '__ilshift__') def test___irshift___not_inplace_checker_allows(self): target = 16 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy >>= 3 self.assertIsNot(proxy, before) self.assertEqual(proxy, 2) self.assertEqual(checker._checked, '__irshift__') def test___irshift___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __irshift__(self, rhs): self.value >>= rhs return self target = Foo(16) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy >>= 3 self.assertIs(proxy, before) self.assertEqual(target.value, 2) self.assertEqual(checker._checked, '__irshift__') def test___irshift___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 16 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy >>= 3 self.assertEqual(checker._checked, '__irshift__') def test___iand___not_inplace_checker_allows(self): target = 7 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy &= 3 self.assertIsNot(proxy, before) self.assertEqual(proxy, 3) self.assertEqual(checker._checked, '__iand__') def test___iand___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __iand__(self, rhs): self.value &= rhs return self target = Foo(7) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy &= 3 self.assertIs(proxy, before) self.assertEqual(target.value, 3) self.assertEqual(checker._checked, '__iand__') def test___iand___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 7 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy &= 3 self.assertEqual(checker._checked, '__iand__') def test___ixor___not_inplace_checker_allows(self): target = 7 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy ^= 3 self.assertIsNot(proxy, before) self.assertEqual(checker._checked, '__ixor__') self.assertEqual(proxy, 4) def test___ixor___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __ixor__(self, rhs): self.value ^= rhs return self target = Foo(7) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy ^= 3 self.assertIs(proxy, before) self.assertEqual(target.value, 4) self.assertEqual(checker._checked, '__ixor__') def test___ixor___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 7 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy ^= 3 self.assertEqual(checker._checked, '__ixor__') def test___ior___not_inplace_checker_allows(self): target = 6 checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy |= 3 self.assertIsNot(proxy, before) self.assertEqual(proxy, 7) self.assertEqual(checker._checked, '__ior__') def test___ior___inplace_checker_allows(self): class Foo(object): def __init__(self, value): self.value = value def __ior__(self, rhs): self.value |= rhs return self target = Foo(6) checker = DummyChecker() proxy = before = self._makeOne(target, checker) proxy |= 3 self.assertIs(proxy, before) self.assertEqual(target.value, 7) self.assertEqual(checker._checked, '__ior__') def test___ior___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = 6 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) with self.assertRaises(ForbiddenAttribute): proxy |= 3 self.assertEqual(checker._checked, '__ior__') def test___len___w_checker_allows(self): target = [0, 1, 2] checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(len(proxy), len(target)) self.assertEqual(checker._checked, '__len__') def test___len___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = [0, 1, 2] checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, len, proxy) self.assertEqual(checker._checked, '__len__') def test__length_hint_w_checker_allows(self): target = iter([0, 1, 2]) checker = DummyChecker() proxy = self._makeOne(target, checker) hint = object.__getattribute__(proxy, '__length_hint__') self.assertEqual(3, hint()) def test__length_hint_dne(self): target = object() checker = DummyChecker() proxy = self._makeOne(target, checker) hint = object.__getattribute__(proxy, '__length_hint__') self.assertEqual(NotImplemented, hint()) def test___contains___hit_w_checker_allows(self): target = [0, 1, 2] checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertTrue(1 in proxy) self.assertEqual(checker._checked, '__contains__') def test___contains___miss_w_checker_allows(self): target = [0, 1, 2] checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertFalse(4 in proxy) self.assertEqual(checker._checked, '__contains__') def test___contains___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = [0, 1, 2] checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: 0 in proxy) self.assertEqual(checker._checked, '__contains__') def test___getitem___sequence_hit_w_checker_allows(self): target = [0, 1, 2] checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy[1], 1) self.assertEqual(checker._checked, '__getitem__') def test___getitem___sequence_miss_w_checker_allows(self): target = [0, 1, 2] checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertRaises(IndexError, lambda: proxy[4]) self.assertEqual(checker._checked, '__getitem__') def test___getitem___sequence_w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = [0, 1, 2] checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy[0]) self.assertEqual(checker._checked, '__getitem__') def test___setitem___sequence_hit_w_checker_allows(self): target = [0, 1, 2] checker = DummyChecker() proxy = self._makeOne(target, checker) proxy[1] = 7 self.assertEqual(target[1], 7) self.assertEqual(checker._checked, '__setitem__') def test___setitem___sequence_miss_w_checker_allows(self): target = [0, 1, 2] checker = DummyChecker() proxy = self._makeOne(target, checker) def _try(): proxy[4] = 7 self.assertRaises(IndexError, _try) self.assertEqual(checker._checked, '__setitem__') def test___setitem___sequence_w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = [0, 1, 2] checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) def _try(): proxy[4] = 7 self.assertRaises(ForbiddenAttribute, _try) self.assertEqual(checker._checked, '__setitem__') @_skip_if_not_Py2 def test___getslice___w_checker_allows(self): target = [0, 1, 2] checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy[1:3], [1, 2]) self.assertEqual(checker._checked, self.getslice) def test___getslice___error_propagates(self): class Missing(Exception): pass class Get(object): def __getitem__(self, x): raise Missing('__getitem__') # pragma: no cover (only py3) def __getslice__(self, start, stop): raise Missing("__getslice__") target = Get() checker = DummyChecker() proxy = self._makeOne(target, checker) with self.assertRaisesRegex(Missing, self.getslice): proxy[1:2] self.assertEqual(checker._checked, self.getslice) def test___getslice___dne_uses_getitem(self): class Missing(Exception): pass class Get(object): def __getitem__(self, x): raise Missing('__getitem__') target = Get() checker = DummyChecker() proxy = self._makeOne(target, checker) with self.assertRaisesRegex(Missing, '__getitem__'): proxy[1:2] self.assertEqual(checker._checked, self.getslice) @_skip_if_not_Py2 def test___getslice___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = [0, 1, 2] checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy[0:2]) self.assertEqual(checker._checked, '__getslice__') @_skip_if_not_Py2 def test___setslice___w_checker_allows(self): target = [0, 1, 2] checker = DummyChecker() proxy = self._makeOne(target, checker) proxy[1:3] = [3, 4] self.assertEqual(target, [0, 3, 4]) self.assertEqual(checker._checked, '__setslice__') @_skip_if_not_Py2 def test___setslice___w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = [0, 1, 2] checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) def _try(): proxy[1:3] = [3, 4] self.assertRaises(ForbiddenAttribute, _try) self.assertEqual(checker._checked, '__setslice__') def test___setslice___error_propagates(self): class Missing(Exception): pass class Set(object): def __setitem__(self, k, v): raise Missing('__setitem__') # pragma: no cover (only py3) def __setslice__(self, start, stop, value): raise Missing("__setslice__") target = Set() checker = DummyChecker() proxy = self._makeOne(target, checker) with self.assertRaisesRegex(Missing, self.setslice): proxy[1:2] = 1 self.assertEqual(checker._checked, self.setslice) def test___setslice___dne_uses_setitem(self): class Missing(Exception): pass class Set(object): def __setitem__(self, k, v): raise Missing('__setitem__') target = Set() checker = DummyChecker() proxy = self._makeOne(target, checker) with self.assertRaisesRegex(Missing, '__setitem__'): proxy[1:2] = 1 self.assertEqual(checker._checked, self.setslice) def test___getitem___mapping_hit_w_checker_allows(self): target = {'a': 0, 'b': 1, 'c': 2} checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertEqual(proxy['b'], 1) self.assertEqual(checker._checked, '__getitem__') def test___getitem___mapping_miss_w_checker_allows(self): target = {'a': 0, 'b': 1, 'c': 2} checker = DummyChecker() proxy = self._makeOne(target, checker) self.assertRaises(KeyError, lambda: proxy['d']) self.assertEqual(checker._checked, '__getitem__') def test___getitem___mapping_w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = {'a': 0, 'b': 1, 'c': 2} checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertRaises(ForbiddenAttribute, lambda: proxy['b']) self.assertEqual(checker._checked, '__getitem__') def test___setitem___mapping_hit_w_checker_allows(self): target = {'a': 0, 'b': 1, 'c': 2} checker = DummyChecker() proxy = self._makeOne(target, checker) proxy['a'] = 7 self.assertEqual(target['a'], 7) self.assertEqual(checker._checked, '__setitem__') def test___setitem___mapping_w_checker_forbids(self): from zope.security.interfaces import ForbiddenAttribute target = {'a': 0, 'b': 1, 'c': 2} checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) def _try(): proxy['a'] = 7 self.assertRaises(ForbiddenAttribute, _try) self.assertEqual(checker._checked, '__setitem__') binops = [ "x+y", "x-y", "x*y", "x/y", "divmod(x, y)", "x**y", "x//y", "x<<y", "x>>y", "x&y", "x|y", "x^y", ] def test_binops(self): from zope.security.proxy import removeSecurityProxy checker = DummyChecker() for expr in self.binops: first = 1 for x in [1, self._makeOne(1, checker)]: for y in [2, self._makeOne(2, checker)]: if first: z = eval(expr) first = 0 else: self.assertEqual(removeSecurityProxy(eval(expr)), z, "x=%r; y=%r; expr=%r" % (x, y, expr)) @_skip_if_not_Py2 def test___unicode___allowed_by_default(self): # https://github.com/zopefoundation/zope.security/issues/10 class Foo(object): def __unicode__(self): return u'I am unicode' checker = object() # checker not consulted target = Foo() proxy = self._makeOne(target, checker) self.assertEqual(unicode(target), u'I am unicode') self.assertEqual(unicode(target), unicode(proxy)) @_skip_if_not_Py2 def test___unicode___falls_through_to_str_by_default(self): # https://github.com/zopefoundation/zope.security/issues/10 class Foo(object): def __str__(self): return 'I am str' checker = object() # checker not consulted target = Foo() proxy = self._makeOne(target, checker) self.assertEqual(unicode(target), u'I am str') self.assertIsInstance(unicode(target), unicode) self.assertEqual(unicode(target), unicode(proxy)) self.assertIsInstance(unicode(proxy), unicode) @_skip_if_not_Py2 def test___unicode___falls_through_to_str_even_if_str_not_allowed(self): # https://github.com/zopefoundation/zope.security/issues/10 # Note that this is inconsistent with str() and probably not a good # idea overall, so this test is strictly a regression test. from zope.security.interfaces import ForbiddenAttribute class Foo(object): def __str__(self): return 'I am str' target = Foo() checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) self.assertEqual(unicode(target), u'I am str') self.assertIsInstance(unicode(target), unicode) # Asking for the unicode of the proxy silently falls through # to the str without any checks self.assertEqual(unicode(target), unicode(proxy)) # And set str itself is checked and proxied self.assertIn("<security proxied", str(proxy)) @unittest.skipIf(PURE_PYTHON, "Needs C extension") class ProxyCTests(AbstractProxyTestBase, unittest.TestCase): def _getTargetClass(self): from zope.security.proxy import _Proxy return _Proxy class ProxyPyTests(AbstractProxyTestBase, unittest.TestCase): def _getTargetClass(self): from zope.security.proxy import ProxyPy return ProxyPy def test_wrapper_checker_unaccessible(self): # Can't access '_wrapped' / '_checker' in C version target = object() checker = object() proxy = self._makeOne(target, checker) self.assertRaises(AttributeError, getattr, proxy, '_wrapped') self.assertRaises(AttributeError, getattr, proxy, '_checker') def test_access_checker_from_subclass(self): target = object() checker = DummyChecker() class Sub(self._getTargetClass()): def get_checker(self): return self._checker sub = Sub(target, checker) self.assertIs(checker, sub.get_checker()) def test_ctor_w_checker(self): from zope.security.proxy import getObjectPy, getCheckerPy # Can't access '_wrapped' / '_checker' in C version target = object() checker = object() proxy = self._makeOne(target, checker) self.assertIs(getObjectPy(proxy), target) self.assertIs(getCheckerPy(proxy), checker) def test___delattr___w__wrapped(self): target = object() checker = object() proxy = self._makeOne(target, checker) def test(): del proxy._wrapped self.assertRaises(AttributeError, test) def test___delattr___w__checker(self): target = object() checker = object() proxy = self._makeOne(target, checker) def test(): del proxy._checker self.assertRaises(AttributeError, test) def test___pow___w_z_proxied_allowed(self): x, y, z = 3, 4, 7 checker = DummyChecker() proxy = self._makeOne(z, checker) # Disabled, because a PyProxy cannot lie about its type, so # pow(i, j, proxy(k)) will fail with a TypeError self.assertRaises(TypeError, pow, (x, y, proxy)) def test___pow___w_z_proxied_forbidden(self): from zope.security.interfaces import ForbiddenAttribute x, y, z = 3, 4, 7 checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(z, checker) # Disabled, because a PyProxy cannot lie about its type, so # pow(i, j, proxy(k)) will fail with a TypeError self.assertRaises(TypeError, pow, (x, y, proxy)) def test_getObjectPy_initial_conditions(self): # Once upon a time, we dynamically set _builtin_isinstance # in z.s.proxy.isinstance itself. And at that time getObjectPy # (aka removeSecurityProxy) called z.s.proxy.isinstance if # _builtin_isinstance was not set...which recursively calls # getObjectPy. The net result was that the very first call # to getObjectPy would falsely return the proxy object if passed # a proxy, not the wrapped object! # This test makes sure we're not dynamically setting that attribute # any more. import zope.security.proxy target = object() checker = object() proxy = self._makeOne(target, checker) orig_builtin_isinstance = zope.security.proxy._builtin_isinstance zope.security.proxy._builtin_isinstance = None try: self.assertRaises(TypeError, zope.security.proxy.getObjectPy, proxy) finally: zope.security.proxy._builtin_isinstance = orig_builtin_isinstance def test_getObjectPy_other_object(self): # If it's not a proxy, return it from zope.security.proxy import getObjectPy self.assertIs(self, getObjectPy(self)) def test_get_reduce(self): class Reduce(object): def __reduce__(self): return 1 def __reduce_ex__(self, prot): return prot reduce_ = Reduce() proxy = self._makeOne(reduce_, DummyChecker()) self.assertEqual(1, proxy.__reduce__()) self.assertEqual(2, proxy.__reduce_ex__(2)) def test__module__(self): class WithModule(object): __module__ = 'foo' module = WithModule() proxy = self._makeOne(module, DummyChecker()) self.assertEqual(WithModule.__module__, proxy.__module__) class DummyChecker(object): _proxied = _checked = None def __init__(self, raising=None, allowed=()): self._raising = raising self._allowed = allowed def check(self, target, name): self._checked = name if name not in self._allowed: if self._raising is not None: raise self._raising(name) check_getattr = check_setattr = check def proxy(self, value): self._proxied = value return value class Test_getTestProxyItems(unittest.TestCase): def _callFUT(self, proxy): from zope.security.proxy import getTestProxyItems return getTestProxyItems(proxy) def test_w_empty_checker(self): from zope.security.checker import Checker from zope.security.proxy import Proxy target = object() proxy = Proxy(target, Checker({})) self.assertEqual(self._callFUT(proxy), []) def test_w_non_empty_checker(self): from zope.security.checker import Checker from zope.security.checker import CheckerPublic from zope.security.proxy import Proxy target = object() permission = object() proxy = Proxy(target, Checker({'foo': CheckerPublic, 'bar': permission})) self.assertEqual(self._callFUT(proxy), [('bar', permission), ('foo', CheckerPublic)]) class Test_isinstance(unittest.TestCase): def _callFUT(self, object, cls): from zope.security.proxy import isinstance return isinstance(object, cls) def test_w_unproxied_object(self): class Foo(object): pass target = Foo() self.assertTrue(self._callFUT(target, Foo)) self.assertFalse(self._callFUT(target, int)) def test_w_proxied_object(self): from zope.security.checker import Checker from zope.security.proxy import Proxy class Foo(object): pass target = Foo() proxy = Proxy(target, Checker({})) self.assertTrue(self._callFUT(proxy, Foo)) self.assertFalse(self._callFUT(proxy, int)) # pre-geddon class Checker(object): ok = 1 unproxied_types = {str,} def check_getattr(self, _object, name): if name not in ("foo", "next", "__class__", "__name__", "__module__"): raise RuntimeError def check_setattr(self, _object, name): if name != "foo": raise RuntimeError def check(self, _object, _opname): if not self.ok: raise RuntimeError def proxy(self, value): from zope.security.proxy import ProxyFactory if type(value) in self.unproxied_types: return value return ProxyFactory(value, self) class Something: def __init__(self): self.foo = [1, 2, 3] def __getitem__(self, key): return self.foo[key] def __setitem__(self, key, value): self.foo[key] = value def __delitem__(self, key): del self.foo[key] def __call__(self, arg): return 42 def __eq__(self, other): return self is other def __hash__(self): return 42 def __iter__(self): return self def __next__(self): return 42 # Infinite sequence next = __next__ def __len__(self): return 42 def __nonzero__(self): return 1 def __getslice__(self, i, j): return [42] def __setslice__(self, i, j, value): if value != [42]: raise AssertionError("Value should be [42]") def __contains__(self, x): return x == 42 class ProxyTests(unittest.TestCase): def setUp(self): from zope.security.proxy import ProxyFactory self.x = Something() self.c = Checker() self.p = ProxyFactory(self.x, self.c) def shouldFail(self, *args): self.c.ok = 0 self.assertRaises(RuntimeError, *args) self.c.ok = 1 def testDerivation(self): from zope.proxy import ProxyBase self.assertIsInstance(self.p, ProxyBase) def testStr(self): from zope.security.proxy import ProxyFactory self.assertEqual(str(self.p), str(self.x)) x = Something() c = Checker() c.ok = 0 p = ProxyFactory(x, c) s = str(p) self.assertTrue(s.startswith( "<security proxied %s.%s instance at" % (x.__class__.__module__, x.__class__.__name__)), s) def testRepr(self): from zope.security.proxy import ProxyFactory self.assertEqual(repr(self.p), repr(self.x)) x = Something() c = Checker() c.ok = 0 p = ProxyFactory(x, c) s = repr(p) self.assertTrue(s.startswith( "<security proxied %s.%s instance at" % (x.__class__.__module__, x.__class__.__name__)), s) def testGetAttrOK(self): from zope.security.proxy import removeSecurityProxy self.assertEqual(removeSecurityProxy(self.p.foo), [1, 2, 3]) def testGetAttrFail(self): self.assertRaises(RuntimeError, lambda: self.p.bar) def testSetAttrOK(self): self.p.foo = 42 self.assertEqual(self.p.foo, 42) def testSetAttrFail(self): def doit(): self.p.bar = 42 self.assertRaises(RuntimeError, doit) def testGetItemOK(self): self.assertEqual(self.p[0], 1) def testGetItemFail(self): self.shouldFail(lambda: self.p[10]) def testSetItemOK(self): self.p[0] = 42 self.assertEqual(self.p[0], 42) def testSetItemFail(self): def doit(): del self.p[0] self.shouldFail(doit) def testDelItemOK(self): self.p[0] = 42 self.assertEqual(self.p[0], 42) del self.p[0] self.shouldFail(lambda: self.p[0]) def testDelItemFail(self): def doit(): self.p[10] = 42 self.shouldFail(doit) def testCallOK(self): self.assertEqual(self.p(None), 42) def testCallFail(self): self.shouldFail(self.p, None) def testRichCompareOK(self): self.assertTrue(self.p == self.x) ## def testRichCompareFail(self): ## self.shouldFail(lambda: self.p == self.x) def testIterOK(self): from zope.security.proxy import removeSecurityProxy self.assertEqual(removeSecurityProxy(iter(self.p)), self.x) def testIterFail(self): self.shouldFail(iter, self.p) def testNextOK(self): self.assertEqual(self.p.next(), 42) def testNextFail(self): self.shouldFail(self.p.next) @_skip_if_not_Py2 def testCompareOK(self): self.assertEqual(cmp(self.p, self.x), 0) ## def testCompareFail(self): ## self.shouldFail(cmp, self.p, self.x) def testHashOK(self): self.assertEqual(hash(self.p), hash(self.x)) ## def testHashFail(self): ## self.shouldFail(hash, self.p) def testNonzeroOK(self): self.assertEqual(not self.p, 0) ## def testNonzeroFail(self): ## self.shouldFail(lambda: not self.p) def testLenOK(self): self.assertEqual(len(self.p), 42) def testLenFail(self): self.shouldFail(len, self.p) @_skip_if_not_Py2 def testSliceOK(self): from zope.security.proxy import removeSecurityProxy self.assertEqual(removeSecurityProxy(self.p[:]), [42]) def testSliceFail(self): self.shouldFail(lambda: self.p[:]) def testSetSliceOK(self): self.p[:] = [42] def testSetSliceFail(self): def doit(): self.p[:] = [42] self.shouldFail(doit) def testContainsOK(self): self.assertTrue(42 in self.p) def testContainsFail(self): self.shouldFail(lambda: 42 in self.p) def testGetObject(self): from zope.security.proxy import removeSecurityProxy self.assertEqual(self.x, removeSecurityProxy(self.p)) def testGetChecker(self): from zope.security.proxy import getChecker self.assertEqual(self.c, getChecker(self.p)) def testProxiedClassicClassAsDictKey(self): from zope.security.proxy import ProxyFactory class C(object): pass d = {C: C()} pC = ProxyFactory(C, self.c) self.assertEqual(d[pC], d[C]) def testProxiedNewClassAsDictKey(self): from zope.security.proxy import ProxyFactory class C(object): pass d = {C: C()} pC = ProxyFactory(C, self.c) self.assertEqual(d[pC], d[C]) unops = ["-x", "+x", "abs(x)", "~x", "int(x)", "float(x)"] if PYTHON2: unops.append("long(x)") def test_unops(self): # We want the starting value of the expressions to be a proxy, # but we don't want to create new proxies as a result of # evaluation, so we have to extend the list of types that # aren't proxied. from zope.security.proxy import ProxyFactory from zope.security.proxy import removeSecurityProxy self.c.unproxied_types = {str, int, float} if PYTHON2: self.c.unproxied_types.add(long) for expr in self.unops: x = 1 y = eval(expr) # Make sure 'x' is a proxy always: x = ProxyFactory(1, self.c) z = eval(expr) self.assertEqual(removeSecurityProxy(z), y, "x=%r; expr=%r" % (x, expr)) self.shouldFail(lambda x: eval(expr), x) @_skip_if_not_Py2 def test_odd_unops(self): # unops that don't return a proxy P = self.c.proxy for func in ( hex, oct, # lambda x: not x, ): self.assertEqual(func(P(100)), func(100)) self.shouldFail(func, P(100)) binops = [ "x+y", "x-y", "x*y", "x/y", "divmod(x, y)", "x**y", "x//y", "x<<y", "x>>y", "x&y", "x|y", "x^y", ] def test_binops(self): from zope.security.proxy import removeSecurityProxy P = self.c.proxy for expr in self.binops: first = 1 for x in [1, P(1)]: for y in [2, P(2)]: if first: z = eval(expr) first = 0 else: self.assertEqual(removeSecurityProxy(eval(expr)), z, "x=%r; y=%r; expr=%r" % (x, y, expr)) self.shouldFail(lambda x, y: eval(expr), x, y) def test_inplace(self): # TODO: should test all inplace operators... from zope.security.proxy import removeSecurityProxy P = self.c.proxy pa = P(1) pa += 2 self.assertEqual(removeSecurityProxy(pa), 3) a = [1, 2, 3] pa = qa = P(a) pa += [4, 5, 6] self.assertIs(pa, qa) self.assertEqual(a, [1, 2, 3, 4, 5, 6]) def doit(): pa = P(1) pa += 2 self.shouldFail(doit) pa = P(2) pa **= 2 self.assertEqual(removeSecurityProxy(pa), 4) def doit2(): pa = P(2) pa **= 2 self.shouldFail(doit2) @_skip_if_not_Py2 def test_coerce(self): from zope.security.proxy import removeSecurityProxy P = self.c.proxy x = P(1) y = P(2) a, b = coerce(x, y) self.assertIs(a, x) self.assertIs(b, y) x = P(1) y = P(2.1) a, b = coerce(x, y) self.assertEqual(removeSecurityProxy(a), 1.0) self.assertIs(b, y) self.assertIs(type(removeSecurityProxy(a)), float) self.assertIs(b, y) x = P(1.1) y = P(2) a, b = coerce(x, y) self.assertIs(a, x) self.assertEqual(removeSecurityProxy(b), 2.0) self.assertIs(a, x) self.assertIs(type(removeSecurityProxy(b)), float) x = P(1) y = 2 a, b = coerce(x, y) self.assertIs(a, x) self.assertIs(b, y) x = P(1) y = 2.1 a, b = coerce(x, y) self.assertIs(type(removeSecurityProxy(a)), float) self.assertIs(b, y) x = P(1.1) y = 2 a, b = coerce(x, y) self.assertIs(a, x) self.assertIs(type(removeSecurityProxy(b)), float) x = 1 y = P(2) a, b = coerce(x, y) self.assertIs(a, x) self.assertIs(b, y) x = 1.1 y = P(2) a, b = coerce(x, y) self.assertIs(a, x) self.assertIs(type(removeSecurityProxy(b)), float) x = 1 y = P(2.1) a, b = coerce(x, y) self.assertIs(type(removeSecurityProxy(a)), float) self.assertIs(b, y) def test_using_mapping_slots_hack(): """The security proxy will use mapping slots, on the checker to go faster If a checker implements normally, a checkers's check and check_getattr methods are used to check operator and attribute access: >>> from zope.security.proxy import ProxyFactory >>> log = [] >>> def dump(): ... out = '\\n'.join(log) ... del log[:] ... return out >>> class Checker(object): ... def check(self, object, name): ... log.append(('check %s' % name)) ... def check_getattr(self, object, name): ... log.append(('check_getattr %s' % name)) ... def proxy(self, object): ... return 1 >>> def f(): ... pass >>> p = ProxyFactory(f, Checker()) >>> p.__name__ 1 >>> dump() 'check_getattr __name__' >>> p() 1 >>> dump() 'check __call__' But, if the checker has a __setitem__ method: >>> def __setitem__(self, object, name): ... log.append(('__setitem__ %s' % name)) >>> Checker.__setitem__ = __setitem__ It will be used rather than either check or check_getattr: >>> p.__name__ 1 >>> dump() '__setitem__ __name__' >>> p() 1 >>> dump() '__setitem__ __call__' If a checker has a __getitem__ method: >>> def __getitem__(self, object): ... return 2 >>> Checker.__getitem__ = __getitem__ It will be used rather than it's proxy method: >>> p.__name__ 2 >>> dump() '__setitem__ __name__' >>> p() 2 >>> dump() '__setitem__ __call__' """ class LocationProxySecurityCheckerTests(unittest.TestCase): def test_LocationProxy_gets_a_security_checker_when_importing_z_security( self): # Regression test for a problem introduced in 3.8.1 and fixed in # 3.8.3. For details see change log. import sys from zope.location.location import LocationProxy import zope.security try: from importlib import reload as _reload except ImportError: _reload = reload # Python 2 # This attribute is set when zope.security.decorator is imported, to # show that it will be set too, if zope.security.proxy is imported # we set it to a different value at first: del LocationProxy.__Security_checker__ self.assertFalse( hasattr(LocationProxy, '__Security_checker__')) # After deleting zope.security.decorator and reloading # zope.security.proxy the attribute is set again: del sys.modules["zope.security.decorator"] _reload(zope.security) self.assertTrue( hasattr(LocationProxy, '__Security_checker__')) def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__)
35.378857
83
0.624905
8,395
77,975
5.467659
0.060393
0.083332
0.056295
0.079475
0.797935
0.756824
0.730398
0.704146
0.683101
0.634605
0
0.010241
0.274921
77,975
2,203
84
35.394916
0.80162
0.061648
0
0.652667
0
0
0.030364
0.000316
0
0
0
0.000454
0.23496
1
0.172531
false
0.00454
0.061294
0.013053
0.301362
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
55e9cb3f9db1e0a25f0294c456bfa2ceff74ce36
233
py
Python
style_transfer/sub_networks/Sub_network.py
haonguyen1107/style_transfer
8df9b20ce8ebc446cf2c0a67393001b3cf318fed
[ "MIT" ]
null
null
null
style_transfer/sub_networks/Sub_network.py
haonguyen1107/style_transfer
8df9b20ce8ebc446cf2c0a67393001b3cf318fed
[ "MIT" ]
6
2021-05-21T16:38:24.000Z
2022-02-10T02:01:14.000Z
style_transfer/sub_networks/Sub_network.py
haonguyen1107/style_transfer
8df9b20ce8ebc446cf2c0a67393001b3cf318fed
[ "MIT" ]
null
null
null
import abc class Sub_network(abc.ABC): @abc.abstractmethod def build_subnetwork(self, inputs, weights, last_layer='conv4_1'): pass @abc.abstractmethod def subnetwork_layer_params(self, layer): pass
19.416667
70
0.690987
29
233
5.344828
0.62069
0.077419
0.258065
0
0
0
0
0
0
0
0
0.010989
0.218884
233
11
71
21.181818
0.840659
0
0
0.5
0
0
0.030043
0
0
0
0
0
0
1
0.25
false
0.25
0.125
0
0.5
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
4
55fa65ad18b1836e2717ba5f8bde2a7306b96d18
2,787
py
Python
Self Havoc (2, update)/map.py
llxSKyWALKeRxll/GamImiTrack
1e490e581f7672de41a12295cadf379ec0cf4a65
[ "MIT" ]
1
2021-02-28T15:19:51.000Z
2021-02-28T15:19:51.000Z
Self Havoc (2, update)/map.py
llxSKyWALKeRxll/GamImiTrack
1e490e581f7672de41a12295cadf379ec0cf4a65
[ "MIT" ]
null
null
null
Self Havoc (2, update)/map.py
llxSKyWALKeRxll/GamImiTrack
1e490e581f7672de41a12295cadf379ec0cf4a65
[ "MIT" ]
null
null
null
from gameSettings import * #Here, W indicates the Walls and the dots indicates the empty space in the map '''string_map = [ #OG = 8 total tuples, 12 columns '111111111111111111111111', '1.222511.........1.....1', '1.....61...1.1..1......1', '3.....61...1....1..1.1.1', '3.222511...111.11..1...1', '4.111111.......1...1...1', '1............1.........1', '114441111111111111111111' ]''' _ = False string_map = [ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, 1], [1, _, _, 1, _, _, _, 1, _, _, _, 1, _, _, _, _, 1, _, 1, _, _, _, _, _, 1], [1, _, _, _, 1, _, 1, _, _, _, 1, 1, 1, _, _, _, _, 1, _, _, _, _, _, _, 1], [1, _, _, _, _, 1, _, _, _, 1, _, _, _, 1, _, _, _, 1, _, _, _, _, _, _, 1], [1, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, 1], #[1, _, _, _, _, _, _, _, 1, _, 1, _, _, _, _, 1, _, _, _, _, 1, _, _, 1], #[1, _, _, _, _, _, _, _, _, 1, _, _, _, _, _, _, 1, _, 1, 1, 1, _, _, 1], #[1, _, _, _, _, _, _, _, _, _, _, _, 1, _, _, _, _, 1, _, _, _, _, _, 1], #[1, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, 1, _, _, _, _, _, 1], [1, 1, 1, 1, 1, 1, _, _, _, _, _, _, _, _, _, _, _, _, 1, 1, 1, 1, 1, 1, 1], [1, 5, 6, 5, 6, 1, _, _, _, _, _, _, _, _, _, _, _, _, 1, _, _, _, _, _, 1], [1, _, _, _, 5, 1, _, _, _, _, _, _, _, _, _, _, _, _, 1, _, _, _, _, _, 1], [1, _, _, _, 6, 1, _, _, _, _, _, _, _, _, _, _, _, _, 1, _, _, _, _, _, 1], [1, _, _, _, 1, 1, _, _, _, _, _, _, _, _, _, _, _, _, 1, _, _, _, _, _, 1], [1, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] ] map_width = len(string_map[0]) * tile map_height = len(string_map) * tile #24 columns #15 rows '''string_map = [ #OG = 8 total tuples, 12 columns '111111111111', '1.222511...1', '1.....61...1', '3.....61...1', '3.222511...1', '4.111111...1', '1..........1', '114441111111' ]''' game_map = {} mini_map = set() for i, row in enumerate(string_map): for j, char in enumerate(row): if char: mini_map.add((j * mini_tile_size, i * mini_tile_size)) if char == 1: game_map[(j * tile, i * tile)] = 1 elif char == 2: game_map[(j * tile, i * tile)] = 2 elif char == 3: game_map[(j * tile, i * tile)] = 3 elif char == 4: game_map[(j * tile, i * tile)] = 4 elif char == 5: game_map[(j * tile, i * tile)] = 5 elif char == 6: game_map[(j * tile, i * tile)] = 6
39.814286
80
0.392896
330
2,787
2.378788
0.175758
0.359236
0.496815
0.616561
0.424204
0.394904
0.233121
0.233121
0.151592
0.151592
0
0.168099
0.331898
2,787
69
81
40.391304
0.253491
0.138859
0
0.081081
0
0
0
0
0
0
0
0
0
1
0
false
0
0.027027
0
0.027027
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
360a0c75998f5238186a24ce2fe40c8363513cca
936
py
Python
qudt/units/energy.py
gnmerritt/pyqudt
2579e824b2e002d2e27a40eae84f1b1449006487
[ "BSD-3-Clause" ]
null
null
null
qudt/units/energy.py
gnmerritt/pyqudt
2579e824b2e002d2e27a40eae84f1b1449006487
[ "BSD-3-Clause" ]
null
null
null
qudt/units/energy.py
gnmerritt/pyqudt
2579e824b2e002d2e27a40eae84f1b1449006487
[ "BSD-3-Clause" ]
null
null
null
################################################################################ # # Copyright (C) 2019 Garrett Brown # This file is part of pyqudt - https://github.com/eigendude/pyqudt # # pyqudt is derived from jQUDT # Copyright (C) 2012-2013 Egon Willighagen <egonw@users.sf.net> # # SPDX-License-Identifier: BSD-3-Clause # See the file LICENSE for more information. # ################################################################################ from qudt.unit import Unit from qudt.ontology.unit_factory import UnitFactory class EnergyUnit(object): """ """ EV: Unit = UnitFactory.get_qudt('EV') JOULE: Unit = UnitFactory.get_qudt('J') BTU: Unit = UnitFactory.get_qudt('BTU_IT') KWH: Unit = UnitFactory.get_qudt('KiloW-HR') NM3_GAS: Unit = UnitFactory.get_qudt('NM3-NAT-GAS') SCM_GAS: Unit = UnitFactory.get_qudt('SCM-NAT-GAS') SFT3_GAS: Unit = UnitFactory.get_qudt('SFT3-NAT-GAS')
32.275862
80
0.580128
112
936
4.741071
0.535714
0.19774
0.237288
0.290019
0.141243
0
0
0
0
0
0
0.021144
0.141026
936
28
81
33.428571
0.639303
0.294872
0
0
0
0
0.106918
0
0
0
0
0
0
1
0
true
0
0.2
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
4
360e5f17431e4a6ccf4006ae611e5382c3136b16
161
py
Python
tests/conftest.py
timofurrer/embedeval
08a69c950c9a0ac59a8a0ca728af2627c7bcc43a
[ "MIT" ]
5
2020-01-12T17:42:12.000Z
2020-04-21T20:01:02.000Z
tests/conftest.py
timofurrer/embedeval
08a69c950c9a0ac59a8a0ca728af2627c7bcc43a
[ "MIT" ]
5
2019-12-19T13:24:38.000Z
2020-01-19T16:16:04.000Z
tests/conftest.py
timofurrer/embedeval
08a69c950c9a0ac59a8a0ca728af2627c7bcc43a
[ "MIT" ]
null
null
null
""" embedeval ~~~~~~~~~ NLP Embedding Evaluation Tool :copyright: (c) 2019 by Timo Furrer <tuxtimo@gmail.com> :license: MIT, see LICENSE for more details. """
16.1
55
0.68323
21
161
5.238095
0.952381
0
0
0
0
0
0
0
0
0
0
0.029197
0.149068
161
9
56
17.888889
0.773723
0.944099
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
361b29a064531758654c77118ede91cf9c83dbb4
3,630
py
Python
DailyProgrammer/DP20130717B.py
DayGitH/Python-Challenges
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
[ "MIT" ]
2
2020-12-23T18:59:22.000Z
2021-04-14T13:16:09.000Z
DailyProgrammer/DP20130717B.py
DayGitH/Python-Challenges
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
[ "MIT" ]
null
null
null
DailyProgrammer/DP20130717B.py
DayGitH/Python-Challenges
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
[ "MIT" ]
null
null
null
""" [07/17/13] Challenge #130 [Intermediate] Foot-Traffic Generator https://www.reddit.com/r/dailyprogrammer/comments/1ihm0q/071713_challenge_130_intermediate_foottraffic/ # [](#IntermediateIcon) *(Intermediate)*: Foot-Traffic Generator This week's [Easy] challenge was [#133: Foot-Traffic Analysis](http://www.reddit.com/r/dailyprogrammer/comments/1iambu/071513_challenge_133_easy_foottraffic_analysis/): part of the challenge was to parse foot-traffic information and print out some room-usage information. What if we wanted to test this program with our own custom data-set? How can we generate a custom log to test our Foot-Traffic Analysis tool with? Real-world programming requires you to often write your own test-generating code! Your goal in this challenge is to do exactly that: write a foot-traffic generator! Read up on the original [[Easy] challenge here](http://www.reddit.com/r/dailyprogrammer/comments/1iambu/071513_challenge_133_easy_foottraffic_analysis/), and take a look at the input-data format as well as the important data-consistency rules. It's very important to understand the previous challenge's input format, as your output here will have to match it! *Original author: /u/nint22* *Note: This is not a particularly difficult challenge, but it is a great example of real-world programming! Make sure you actually test your generator with the previous challenge's program you wrote.* # Formal Inputs & Outputs ## Input Description On standard console input, you will be given one line of five space-delimited integers: E (for the number of events to generate), V (for the number of visitors), R (for the number of rooms), I (for the time at which the earliest event can occur), and O (for the time at which the last event can occur). ## Output Description You must output a data-set that follows the input format for the Foot-Traffic Analysis challenge. You must print off E x2 lines (the x2 is because one "event" is defined as both a visitor going into a room and then eventually out of it), only referring to user indices 0 to V (inclusive) and room indices 0 to R (inclusive). Make sure that the time for any and all events are within the range of I and O (inclusive)! Remember that time is defined as the minute during the day, which will always be between 0 and 24H x 60 minutes (1440). Though your data set can randomly pick the visitor and room index, you must make sure it is logically valid: users that enter a room eventually have to leave it, users cannot enter a room while being in another room, and must always enter a room first before leaving it. Note that we do not enforce the usage of all visitor or room indices: it is possible that with a small E but a large R and V, you only use a small subset of the room and visitor indices. Make sure to [seed your random-number generator](http://en.wikipedia.org/wiki/Random_seed)! It does not matter if your resulting list is ordered (on any column) or not. # Sample Inputs & Outputs ## Sample Input 18 8 32 300 550 ## Sample Output 36 0 11 I 347 1 13 I 307 2 15 I 334 3 6 I 334 4 9 I 334 5 2 I 334 6 2 I 334 7 11 I 334 8 1 I 334 0 11 O 376 1 13 O 321 2 15 O 389 3 6 O 412 4 9 O 418 5 2 O 414 6 2 O 349 7 11 O 418 8 1 O 418 0 12 I 437 1 28 I 343 2 32 I 408 3 15 I 458 4 18 I 424 5 26 I 442 6 7 I 435 7 19 I 456 8 19 I 450 0 12 O 455 1 28 O 374 2 32 O 495 3 15 O 462 4 18 O 500 5 26 O 479 6 7 O 493 7 19 O 471 8 19 O 458 """ def main(): pass if __name__ == "__main__": main()
41.724138
119
0.731129
675
3,630
3.897778
0.391111
0.029266
0.022805
0.014823
0.095021
0.095021
0.066135
0.066135
0.066135
0.066135
0
0.096559
0.215427
3,630
86
120
42.209302
0.827247
0.980165
0
0
0
0
0.125
0
0
0
0
0
0
1
0.25
true
0.25
0
0
0.25
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
1
1
1
0
0
0
0
0
4
362d589be2ca92e96cd890c9e2e855860184da9a
762
py
Python
easy_work_service_sdk/client.py
easyopsapis/easyops-api-python
adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0
[ "Apache-2.0" ]
5
2019-07-31T04:11:05.000Z
2021-01-07T03:23:20.000Z
easy_work_service_sdk/client.py
easyopsapis/easyops-api-python
adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0
[ "Apache-2.0" ]
null
null
null
easy_work_service_sdk/client.py
easyopsapis/easyops-api-python
adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- import easy_work_service_sdk.api.backlog.backlog_client import easy_work_service_sdk.api.calendar_events.calendar_events_client import easy_work_service_sdk.api.system_map.system_map_client class Client(object): def __init__(self, server_ip="", server_port=0, service_name=""): self.backlog = easy_work_service_sdk.api.backlog.backlog_client.BacklogClient(server_ip, server_port, service_name) self.calendar_events = easy_work_service_sdk.api.calendar_events.calendar_events_client.CalendarEventsClient(server_ip, server_port, service_name) self.system_map = easy_work_service_sdk.api.system_map.system_map_client.SystemMapClient(server_ip, server_port, service_name)
38.1
154
0.78084
104
762
5.240385
0.269231
0.088073
0.165138
0.198165
0.724771
0.724771
0.66055
0.517431
0.366972
0.366972
0
0.003035
0.135171
762
19
155
40.105263
0.823976
0.027559
0
0
0
0
0
0
0
0
0
0
0
1
0.125
false
0
0.375
0
0.625
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
364450186be7b510528e48fbb3076e43606b470b
137
py
Python
app/views.py
atulmishra-one/chikitshak
542399ce873d1ded1bea1a0400383b5e530e2666
[ "MIT" ]
1
2021-03-09T07:14:11.000Z
2021-03-09T07:14:11.000Z
app/views.py
atulmishra-one/chikitshak
542399ce873d1ded1bea1a0400383b5e530e2666
[ "MIT" ]
null
null
null
app/views.py
atulmishra-one/chikitshak
542399ce873d1ded1bea1a0400383b5e530e2666
[ "MIT" ]
null
null
null
""" Main Page views """ from django.views.generic import TemplateView class IndexView(TemplateView): template_name = "index.html"
13.7
45
0.737226
16
137
6.25
0.875
0
0
0
0
0
0
0
0
0
0
0
0.153285
137
9
46
15.222222
0.862069
0.109489
0
0
0
0
0.087719
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
367d9bf1aeb41b0a705212b4ec9f7a84109703fd
98
py
Python
conjure-python-core/src/test/resources/services/expected/package_name/product/__init__.py
chewr/conjure-python
ca0ac825f86741c02cd85b1b4ea9456d5786e0ae
[ "Apache-2.0" ]
10
2018-11-21T19:39:54.000Z
2021-12-16T12:05:02.000Z
conjure-python-core/src/test/resources/services/expected/package_name/product/__init__.py
chewr/conjure-python
ca0ac825f86741c02cd85b1b4ea9456d5786e0ae
[ "Apache-2.0" ]
61
2018-11-25T18:48:01.000Z
2022-03-30T02:02:35.000Z
conjure-python-core/src/test/resources/services/expected/package_name/product/__init__.py
chewr/conjure-python
ca0ac825f86741c02cd85b1b4ea9456d5786e0ae
[ "Apache-2.0" ]
10
2018-11-21T21:53:43.000Z
2021-07-29T18:13:38.000Z
# coding=utf-8 from .._impl import ( product_CreateDatasetRequest as CreateDatasetRequest, )
16.333333
57
0.765306
10
98
7.3
0.9
0
0
0
0
0
0
0
0
0
0
0.012048
0.153061
98
5
58
19.6
0.86747
0.122449
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
368bc6afbac9b2ad2d9bcee7fd2428e13d443e6f
384
py
Python
mp_roguelike/event.py
nonk123/mp_roguelike
48785b44dd3f2518a5a639a6609670408e7ea1f5
[ "MIT" ]
null
null
null
mp_roguelike/event.py
nonk123/mp_roguelike
48785b44dd3f2518a5a639a6609670408e7ea1f5
[ "MIT" ]
null
null
null
mp_roguelike/event.py
nonk123/mp_roguelike
48785b44dd3f2518a5a639a6609670408e7ea1f5
[ "MIT" ]
null
null
null
class Sender: def __init__(self): self.subscribers = [] def __call__(self, *args, **kwargs): for subscriber in self.subscribers: subscriber(*args, **kwargs) def __iadd__(self, handler): self.subscribers.append(handler) return self def __isub__(self, handler): self.subscribers.remove(handler) return self
24
43
0.614583
40
384
5.5
0.45
0.272727
0.136364
0.236364
0
0
0
0
0
0
0
0
0.28125
384
15
44
25.6
0.797101
0
0
0.166667
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.583333
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
368efc3ffdf17fdf61c98fe721d230bffacf66e0
1,019
py
Python
tools/leetcode.160.Intersection of Two Linked Lists/leetcode.160.Intersection of Two Linked Lists.submission1.py
tedye/leetcode
975d7e3b8cb9b6be9e80e07febf4bcf6414acd46
[ "MIT" ]
4
2015-10-10T00:30:55.000Z
2020-07-27T19:45:54.000Z
tools/leetcode.160.Intersection of Two Linked Lists/leetcode.160.Intersection of Two Linked Lists.submission1.py
tedye/leetcode
975d7e3b8cb9b6be9e80e07febf4bcf6414acd46
[ "MIT" ]
null
null
null
tools/leetcode.160.Intersection of Two Linked Lists/leetcode.160.Intersection of Two Linked Lists.submission1.py
tedye/leetcode
975d7e3b8cb9b6be9e80e07febf4bcf6414acd46
[ "MIT" ]
null
null
null
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param two ListNodes # @return the intersected ListNode def getIntersectionNode(self, headA, headB): l1 = self.getLength(headA) l2 = self.getLength(headB) if l1 == 0 or l2 == 0: return None if l1 > l2: temp = headB headB = headA headA = temp advance = abs(l1-l2) i = 0 while i < advance: headB = headB.next i += 1 while headA and headB: if headA.val == headB.val: return headA else: headA = headA.next headB = headB.next return None def getLength(self,node): res = 0 while node: node = node.next res += 1 return res
1,019
1,019
0.44946
105
1,019
4.32381
0.380952
0.066079
0.061674
0
0
0
0
0
0
0
0
0.026217
0.475957
1,019
1
1,019
1,019
0.82397
0.957802
0
0.142857
0
0
0
0
0
0
0
0
0
1
0.071429
false
0
0
0
0.25
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
36bbb1dd8e50fd8e859912dfd56df6918a58f256
775
py
Python
master_password/management/commands/make_password.py
ixc/django-master-password
2bae287428c0255d5b1da748a83ccb573a250385
[ "MIT" ]
6
2017-09-26T14:24:23.000Z
2021-09-13T20:39:51.000Z
master_password/management/commands/make_password.py
ixc/django-master-password
2bae287428c0255d5b1da748a83ccb573a250385
[ "MIT" ]
2
2017-10-05T22:17:28.000Z
2020-06-28T05:32:11.000Z
master_password/management/commands/make_password.py
ixc/django-master-password
2bae287428c0255d5b1da748a83ccb573a250385
[ "MIT" ]
5
2017-03-21T10:25:22.000Z
2020-08-04T11:12:32.000Z
import getpass import sys from django.contrib.auth.hashers import make_password from django.core.management.base import BaseCommand from six.moves import input class Command(BaseCommand): help = 'Creates a hashed version of a password.' def handle(self, **options): # We can't redirect stdin to `getpass()` so we have to fallback to # `input()` to test. See: http://pymotw.com/2/getpass/ prompt = getpass.getpass if sys.stdin.isatty() else input try: password = make_password(prompt()) # TODO: Not sure if there is any way to test this? except KeyboardInterrupt: self.stderr.write("\nOperation cancelled.") sys.exit(1) self.stdout.write('Hashed password: %s' % password)
33.695652
74
0.661935
103
775
4.961165
0.650485
0.039139
0
0
0
0
0
0
0
0
0
0.003396
0.24
775
22
75
35.227273
0.864177
0.214194
0
0
0
0
0.132231
0
0
0
0
0.045455
0
1
0.066667
false
0.4
0.333333
0
0.533333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
1
1
0
1
0
0
4
36c16c49c3bff913095c53f52b5868b572611f8a
29
py
Python
data/studio21_generated/introductory/3469/starter_code.py
vijaykumawat256/Prompt-Summarization
614f5911e2acd2933440d909de2b4f86653dc214
[ "Apache-2.0" ]
null
null
null
data/studio21_generated/introductory/3469/starter_code.py
vijaykumawat256/Prompt-Summarization
614f5911e2acd2933440d909de2b4f86653dc214
[ "Apache-2.0" ]
null
null
null
data/studio21_generated/introductory/3469/starter_code.py
vijaykumawat256/Prompt-Summarization
614f5911e2acd2933440d909de2b4f86653dc214
[ "Apache-2.0" ]
null
null
null
def count_consonants(text):
14.5
27
0.793103
4
29
5.5
1
0
0
0
0
0
0
0
0
0
0
0
0.103448
29
2
28
14.5
0.846154
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
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
36d0a1cfb9cc388bc5c8b41ec01b9f37c15d7e47
353
py
Python
chordbook/memberlist/models.py
janno42/chordbook
afb61a91eef058f4aa5a86cd3a6987958eb6d25f
[ "MIT" ]
null
null
null
chordbook/memberlist/models.py
janno42/chordbook
afb61a91eef058f4aa5a86cd3a6987958eb6d25f
[ "MIT" ]
null
null
null
chordbook/memberlist/models.py
janno42/chordbook
afb61a91eef058f4aa5a86cd3a6987958eb6d25f
[ "MIT" ]
null
null
null
from django.db import models from django.utils.translation import ugettext_lazy as _ class Member(models.Model): first_name = models.CharField(max_length=1024, verbose_name=_("first name")) last_name = models.CharField(max_length=1024, verbose_name=_("last name")) member_since = models.DateField(verbose_name=_("member since"), auto_now_add=True)
39.222222
83
0.796034
51
353
5.215686
0.529412
0.12406
0.142857
0.165414
0.323308
0.323308
0.323308
0.323308
0
0
0
0.024922
0.090652
353
8
84
44.125
0.803738
0
0
0
0
0
0.087819
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
36e491f33da3fa9911e16367e62a15fcca538a37
602
py
Python
tests/unit/strictdoc/core/test_level_counter.py
BenGardiner/strictdoc
c927872a8f080ca1f86cdb7e99767fb25398dbd5
[ "Apache-2.0" ]
47
2020-10-27T20:03:12.000Z
2022-03-22T00:01:27.000Z
tests/unit/strictdoc/core/test_level_counter.py
BenGardiner/strictdoc
c927872a8f080ca1f86cdb7e99767fb25398dbd5
[ "Apache-2.0" ]
131
2020-10-27T18:44:24.000Z
2022-03-31T23:51:28.000Z
tests/unit/strictdoc/core/test_level_counter.py
BenGardiner/strictdoc
c927872a8f080ca1f86cdb7e99767fb25398dbd5
[ "Apache-2.0" ]
12
2020-12-29T10:38:57.000Z
2022-03-21T20:57:16.000Z
from strictdoc.core.level_counter import LevelCounter def test_01(): level_counter = LevelCounter() assert level_counter.get_string() == "" level_counter.adjust(1) assert level_counter.get_string() == "1" level_counter.adjust(1) assert level_counter.get_string() == "2" level_counter.adjust(2) assert level_counter.get_string() == "2.1" level_counter.adjust(3) assert level_counter.get_string() == "2.1.1" level_counter.adjust(2) assert level_counter.get_string() == "2.2" level_counter.adjust(1) assert level_counter.get_string() == "3"
24.08
53
0.69103
82
602
4.792683
0.207317
0.458015
0.320611
0.374046
0.737913
0.669211
0.666667
0.590331
0.590331
0.239186
0
0.036364
0.177741
602
24
54
25.083333
0.757576
0
0
0.3125
0
0
0.023256
0
0
0
0
0
0.4375
1
0.0625
false
0
0.0625
0
0.125
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
36edbb575702b4e19e97ee308f32321bf65a6b10
96
py
Python
build/python_loader/cv2/config-3.7.py
pat4life360/LEAP-Camera-Face-Tracker-
be31183f9047f432ae400888aef1e0b0c58ff72b
[ "Apache-2.0" ]
null
null
null
build/python_loader/cv2/config-3.7.py
pat4life360/LEAP-Camera-Face-Tracker-
be31183f9047f432ae400888aef1e0b0c58ff72b
[ "Apache-2.0" ]
null
null
null
build/python_loader/cv2/config-3.7.py
pat4life360/LEAP-Camera-Face-Tracker-
be31183f9047f432ae400888aef1e0b0c58ff72b
[ "Apache-2.0" ]
null
null
null
PYTHON_EXTENSIONS_PATHS = [ '/home/pi/opencv/build/lib/python3' ] + PYTHON_EXTENSIONS_PATHS
24
39
0.760417
12
96
5.75
0.75
0.463768
0.608696
0
0
0
0
0
0
0
0
0.011765
0.114583
96
3
40
32
0.8
0
0
0
0
0
0.34375
0.34375
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
7fe37b3bacfaab255d9ebc264fa168e14d741a09
71
py
Python
Python/html_to_pdf/main.py
Lakshita2002/code-n-stitch
5ae168e541c057e33996bb694903d627846b278f
[ "MIT" ]
50
2020-09-19T16:40:21.000Z
2022-02-05T05:48:42.000Z
Python/html_to_pdf/main.py
Lakshita2002/code-n-stitch
5ae168e541c057e33996bb694903d627846b278f
[ "MIT" ]
266
2020-09-25T17:24:04.000Z
2021-11-29T07:17:57.000Z
Python/html_to_pdf/main.py
Lakshita2002/code-n-stitch
5ae168e541c057e33996bb694903d627846b278f
[ "MIT" ]
113
2020-09-26T10:28:11.000Z
2021-10-15T06:58:53.000Z
import pdfkit pdfkit.from_url(input('Input article url: '), 'out.pdf')
23.666667
56
0.732394
11
71
4.636364
0.727273
0
0
0
0
0
0
0
0
0
0
0
0.098592
71
2
57
35.5
0.796875
0
0
0
0
0
0.366197
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
7ffbbc7ee039f5f108a3943dea96626a2369e093
310
py
Python
python/tuple_inheritance.py
robotlightsyou/test
015f13943fc402d8ce86c5f6d2f5a7d032b3340a
[ "MIT" ]
2
2019-05-26T15:09:34.000Z
2021-09-12T08:01:23.000Z
python/tuple_inheritance.py
robotlightsyou/test
015f13943fc402d8ce86c5f6d2f5a7d032b3340a
[ "MIT" ]
null
null
null
python/tuple_inheritance.py
robotlightsyou/test
015f13943fc402d8ce86c5f6d2f5a7d032b3340a
[ "MIT" ]
1
2021-04-11T20:28:21.000Z
2021-04-11T20:28:21.000Z
class Tuple(tuple): def __new__(cls, *args): assert len(args) == 3 return super().__new__(cls, args) # This doesn't work. # def __init__(self, *args): # assert len(args) == 3 # return tuple.__init__(self, args) # or # return tuple.__init__(self, *args)
25.833333
44
0.56129
39
310
3.948718
0.461538
0.155844
0.233766
0.220779
0.571429
0.311688
0
0
0
0
0
0.009174
0.296774
310
11
45
28.181818
0.697248
0.487097
0
0
0
0
0
0
0
0
0
0
0.25
1
0.25
false
0
0
0
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
1
0
0
0
0
1
0
0
4
3d34b9dcb31a27a7831e53ee010b2d96861f220f
89
py
Python
artikel/apps.py
khudzu/blog
a12aa389fa70efaba468ff8d8c80597859ea508e
[ "Unlicense" ]
1
2020-05-27T16:18:43.000Z
2020-05-27T16:18:43.000Z
artikel/apps.py
khudzu/blog
a12aa389fa70efaba468ff8d8c80597859ea508e
[ "Unlicense" ]
null
null
null
artikel/apps.py
khudzu/blog
a12aa389fa70efaba468ff8d8c80597859ea508e
[ "Unlicense" ]
null
null
null
from django.apps import AppConfig class ArtikelConfig(AppConfig): name = 'artikel'
14.833333
33
0.752809
10
89
6.7
0.9
0
0
0
0
0
0
0
0
0
0
0
0.168539
89
5
34
17.8
0.905405
0
0
0
0
0
0.078652
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
3d52102dd0af0397893525235a54e6badaac16be
182
py
Python
Hackerrank-Solutions/Hackerrank-Python-Solutions/Math/Find Angle MBC.py
HetDaftary/Competitive-Coding-Solutions
a683fa11895410c6eef07b1a68054f3e90aa596b
[ "MIT" ]
null
null
null
Hackerrank-Solutions/Hackerrank-Python-Solutions/Math/Find Angle MBC.py
HetDaftary/Competitive-Coding-Solutions
a683fa11895410c6eef07b1a68054f3e90aa596b
[ "MIT" ]
null
null
null
Hackerrank-Solutions/Hackerrank-Python-Solutions/Math/Find Angle MBC.py
HetDaftary/Competitive-Coding-Solutions
a683fa11895410c6eef07b1a68054f3e90aa596b
[ "MIT" ]
null
null
null
# Enter your code here. Read input from STDIN. Print output to STDOUT import math AB, BC = int(input()), int(input()) print (str(int(round(math.degrees(math.atan2(AB,BC)))))+'°')
30.333333
69
0.681319
31
182
4.032258
0.709677
0.064
0
0
0
0
0
0
0
0
0
0.006369
0.137363
182
5
70
36.4
0.783439
0.368132
0
0
0
0
0.00885
0
0
0
0
0.2
0
1
0
true
0
0.333333
0
0.333333
0.333333
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
1
0
0
0
1
0
1
0
0
0
0
4
3d550486a9592eb0bbc8f8fc50692de90bc1cfab
123
py
Python
markov/__init__.py
house-of-vanity/conf_bot
9b853f6809a0690e5fe4038374b6c44febb5b67b
[ "Apache-2.0" ]
null
null
null
markov/__init__.py
house-of-vanity/conf_bot
9b853f6809a0690e5fe4038374b6c44febb5b67b
[ "Apache-2.0" ]
1
2018-03-05T11:18:03.000Z
2018-03-05T11:18:03.000Z
markov/__init__.py
house-of-vanity/conf_bot
9b853f6809a0690e5fe4038374b6c44febb5b67b
[ "Apache-2.0" ]
1
2018-03-05T09:08:10.000Z
2018-03-05T09:08:10.000Z
"""Markov chain text generator""" from .gen import MarkovChain from .simple import get __all__ = ["MarkovChain", "get"]
15.375
33
0.715447
15
123
5.6
0.733333
0
0
0
0
0
0
0
0
0
0
0
0.154472
123
7
34
17.571429
0.807692
0.219512
0
0
0
0
0.157303
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
e9e6b0c54fad58f9686947413a40759d714801d6
35
py
Python
venv-lib/lib/python3.7/sre_compile.py
migmaciasdiaz/venvs
bcdbb75931cb27fc4b5b30f12fc44be85952157e
[ "MIT" ]
2
2020-03-30T14:17:10.000Z
2020-10-04T12:33:00.000Z
venv-lib/lib/python3.7/sre_compile.py
migmaciasdiaz/venvs
bcdbb75931cb27fc4b5b30f12fc44be85952157e
[ "MIT" ]
1
2020-11-24T03:31:13.000Z
2020-11-24T03:31:13.000Z
venv/lib/python3.7/sre_compile.py
wensu425/aws-eb-webapp
4b149c75c11fe5b33c9a080313ec336fabb45824
[ "MIT" ]
1
2021-05-04T09:18:22.000Z
2021-05-04T09:18:22.000Z
/usr/lib64/python3.7/sre_compile.py
35
35
0.828571
7
35
4
1
0
0
0
0
0
0
0
0
0
0
0.114286
0
35
1
35
35
0.685714
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
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
181106ced33e84dbae7847ce658b6f1282f738ff
343
py
Python
flask_react_template/server/views/controllers.py
victor-iyiola/flask-react-template
7b6d0363499908204fb3db0f519c8dfbf0a805d9
[ "MIT" ]
1
2018-01-31T17:19:09.000Z
2018-01-31T17:19:09.000Z
flask_react_template/server/views/controllers.py
victor-iyiola/flask-react-template
7b6d0363499908204fb3db0f519c8dfbf0a805d9
[ "MIT" ]
null
null
null
flask_react_template/server/views/controllers.py
victor-iyiola/flask-react-template
7b6d0363499908204fb3db0f519c8dfbf0a805d9
[ "MIT" ]
null
null
null
""" @author Victor I. Afolabi A.I. Engineer & Software developer javafolabi@gmail.com Created on 31 January, 2018 @ 4:30 PM. Copyright © 2018. Victor. All rights reserved. """ from flask_react_template.server import app from flask import render_template @app.route('/') def index(): return render_template('index.html')
19.055556
48
0.708455
48
343
5
0.770833
0.075
0
0
0
0
0
0
0
0
0
0.046429
0.183673
343
17
49
20.176471
0.807143
0.492711
0
0
0
0
0.072368
0
0
0
0
0
0
1
0.2
true
0
0.4
0.2
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
1
1
0
0
4
182101038f9aa097bd90ca34fb9f518b79779131
146
py
Python
core/demo_sprite.py
PhoenixPlanet/oled-platformer-game
27ff5d59a99a0b5247343076967b86327df87e36
[ "MIT" ]
null
null
null
core/demo_sprite.py
PhoenixPlanet/oled-platformer-game
27ff5d59a99a0b5247343076967b86327df87e36
[ "MIT" ]
null
null
null
core/demo_sprite.py
PhoenixPlanet/oled-platformer-game
27ff5d59a99a0b5247343076967b86327df87e36
[ "MIT" ]
null
null
null
import PIL import sprites class DemoPlayer(sprites.SpriteUnderGravity): def __init__(self): super().__init__() self.size =
16.222222
45
0.671233
15
146
6
0.733333
0.177778
0
0
0
0
0
0
0
0
0
0
0.232877
146
9
46
16.222222
0.803571
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.333333
null
null
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
1
0
0
0
1
0
0
0
0
4
1881afb436406f5824da8f136fafe36d779c7dbd
5,503
py
Python
artifacts/get_started_tutorial/kernel_db/kernel_db_scripts/parsetab.py
LittleQili/nnfusion
6c1a25db5be459a1053798f1c75bfbd26863ed08
[ "MIT" ]
1
2021-05-14T08:10:30.000Z
2021-05-14T08:10:30.000Z
artifacts/get_started_tutorial/kernel_db/kernel_db_scripts/parsetab.py
LittleQili/nnfusion
6c1a25db5be459a1053798f1c75bfbd26863ed08
[ "MIT" ]
null
null
null
artifacts/get_started_tutorial/kernel_db/kernel_db_scripts/parsetab.py
LittleQili/nnfusion
6c1a25db5be459a1053798f1c75bfbd26863ed08
[ "MIT" ]
1
2021-08-11T09:09:53.000Z
2021-08-11T09:09:53.000Z
# parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = "ID INTEGER FLOAT STRING CHAR WS COMMENT1 COMMENT2 POUND DPOUND SYNC VOID FOR GLOBAL TYPE QUALIFIER ELSE IF SHAREDfunction : signature '{' shared_buffer statements '}'signature : GLOBAL VOID ID '(' parameters ')'parameters : parameter\n | parameters ',' parameter\n parameter : type ID\n | type QUALIFIER ID\n | QUALIFIER type ID\n type : TYPE \n | TYPE '*'\n shared_buffer : shared\n | shared_buffer shared\n | normal\n shared : SHARED TYPE ID '[' INTEGER ']' ';' statements : statement\n | statements statement\n statement : sync\n | for_loop_static\n | normal\n for_loop_static : FOR '(' assign compare increase ')' '{' statements '}'\n assign : TYPE ID '=' INTEGER ';'\n compare : ID '<' INTEGER ';'\n increase : '+' '+' ID\n | ID '+' '+'\n sync : SYNC '(' ')' ';' normal : ';'\n | '{' normal '}'\n " _lr_action_items = {'GLOBAL':([0,],[3,]),'$end':([1,25,],[0,-1,]),'{':([2,4,6,7,8,9,11,14,15,16,17,18,19,24,26,39,45,59,64,65,70,71,],[4,6,6,6,-10,-12,-25,6,-11,-14,-16,-17,-18,-26,-15,-2,-24,65,-13,6,6,-19,]),'VOID':([3,],[5,]),'SHARED':([4,7,8,9,11,15,24,64,],[10,10,-10,-12,-25,-11,-26,-13,]),';':([4,6,7,8,9,11,14,15,16,17,18,19,24,26,35,45,58,62,63,64,65,70,71,],[11,11,11,-10,-12,-25,11,-11,-14,-16,-17,-18,-26,-15,45,-24,64,68,69,-13,11,11,-19,]),'ID':([5,22,32,34,36,37,42,43,44,46,60,68,69,],[12,29,41,-8,47,48,51,52,-9,55,66,-21,-20,]),'SYNC':([7,8,9,11,14,15,16,17,18,19,24,26,45,64,65,70,71,],[20,-10,-12,-25,20,-11,-14,-16,-17,-18,-26,-15,-24,-13,20,20,-19,]),'FOR':([7,8,9,11,14,15,16,17,18,19,24,26,45,64,65,70,71,],[21,-10,-12,-25,21,-11,-14,-16,-17,-18,-26,-15,-24,-13,21,21,-19,]),'TYPE':([10,23,28,33,40,],[22,34,37,34,34,]),'}':([11,13,14,16,17,18,19,24,26,45,70,71,],[-25,24,25,-14,-16,-17,-18,-26,-15,-24,71,-19,]),'(':([12,20,21,],[23,27,28,]),'QUALIFIER':([23,32,34,40,44,],[33,42,-8,33,-9,]),')':([27,30,31,41,50,51,52,53,66,67,],[35,39,-3,-5,-4,-6,-7,59,-22,-23,]),'[':([29,],[38,]),',':([30,31,41,50,51,52,],[40,-3,-5,-4,-6,-7,]),'*':([34,],[44,]),'INTEGER':([38,56,57,],[49,62,63,]),'+':([46,54,55,61,68,],[54,60,61,67,-21,]),'<':([47,],[56,]),'=':([48,],[57,]),']':([49,],[58,]),} _lr_action = {} for _k, _v in _lr_action_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'function':([0,],[1,]),'signature':([0,],[2,]),'shared_buffer':([4,],[7,]),'shared':([4,7,],[8,15,]),'normal':([4,6,7,14,65,70,],[9,13,19,19,19,19,]),'statements':([7,65,],[14,70,]),'statement':([7,14,65,70,],[16,26,16,26,]),'sync':([7,14,65,70,],[17,17,17,17,]),'for_loop_static':([7,14,65,70,],[18,18,18,18,]),'parameters':([23,],[30,]),'parameter':([23,40,],[31,50,]),'type':([23,33,40,],[32,43,32,]),'assign':([28,],[36,]),'compare':([36,],[46,]),'increase':([46,],[53,]),} _lr_goto = {} for _k, _v in _lr_goto_items.items(): for _x, _y in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [ ("S' -> function","S'",1,None,None,None), ('function -> signature { shared_buffer statements }','function',5,'p_functon','cuparse.py',141), ('signature -> GLOBAL VOID ID ( parameters )','signature',6,'p_signature','cuparse.py',147), ('parameters -> parameter','parameters',1,'p_parameters','cuparse.py',152), ('parameters -> parameters , parameter','parameters',3,'p_parameters','cuparse.py',153), ('parameter -> type ID','parameter',2,'p_parameter','cuparse.py',158), ('parameter -> type QUALIFIER ID','parameter',3,'p_parameter','cuparse.py',159), ('parameter -> QUALIFIER type ID','parameter',3,'p_parameter','cuparse.py',160), ('type -> TYPE','type',1,'p_type','cuparse.py',170), ('type -> TYPE *','type',2,'p_type','cuparse.py',171), ('shared_buffer -> shared','shared_buffer',1,'p_shared_buffer','cuparse.py',177), ('shared_buffer -> shared_buffer shared','shared_buffer',2,'p_shared_buffer','cuparse.py',178), ('shared_buffer -> normal','shared_buffer',1,'p_shared_buffer','cuparse.py',179), ('shared -> SHARED TYPE ID [ INTEGER ] ;','shared',7,'p_shared','cuparse.py',184), ('statements -> statement','statements',1,'p_statements','cuparse.py',192), ('statements -> statements statement','statements',2,'p_statements','cuparse.py',193), ('statement -> sync','statement',1,'p_statement','cuparse.py',199), ('statement -> for_loop_static','statement',1,'p_statement','cuparse.py',200), ('statement -> normal','statement',1,'p_statement','cuparse.py',201), ('for_loop_static -> FOR ( assign compare increase ) { statements }','for_loop_static',9,'p_for_loop_static','cuparse.py',207), ('assign -> TYPE ID = INTEGER ;','assign',5,'p_for_loop_static','cuparse.py',208), ('compare -> ID < INTEGER ;','compare',4,'p_for_loop_static','cuparse.py',209), ('increase -> + + ID','increase',3,'p_for_loop_static','cuparse.py',210), ('increase -> ID + +','increase',3,'p_for_loop_static','cuparse.py',211), ('sync -> SYNC ( ) ;','sync',4,'p_sync','cuparse.py',224), ('normal -> ;','normal',1,'p_normal','cuparse.py',229), ('normal -> { normal }','normal',3,'p_normal','cuparse.py',230), ]
98.267857
1,309
0.581319
912
5,503
3.369518
0.178728
0.076147
0.046534
0.01562
0.332899
0.246665
0.18809
0.149691
0.096323
0.084608
0
0.168286
0.121025
5,503
55
1,310
100.054545
0.467025
0.011267
0
0.043478
1
0.021739
0.501563
0
0.021739
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
43e4fad7da42642499c7dd3660c08db696009429
94
py
Python
src/the_impossible/LIVE_SERVER_CLEAN/corefeed.py
micha31r/The-Impossible
7a79dea3169907eb93107107f4003c5813de58dc
[ "MIT" ]
null
null
null
src/the_impossible/LIVE_SERVER_CLEAN/corefeed.py
micha31r/The-Impossible
7a79dea3169907eb93107107f4003c5813de58dc
[ "MIT" ]
2
2020-04-15T03:57:42.000Z
2020-06-06T01:43:34.000Z
src/the_impossible/LIVE_SERVER_CLEAN/corefeed.py
micha31r/The-Impossible
7a79dea3169907eb93107107f4003c5813de58dc
[ "MIT" ]
null
null
null
# Deletes all corefeed from support.models import CoreFeed CoreFeed.objects.all().delete()
13.428571
35
0.776596
12
94
6.083333
0.75
0
0
0
0
0
0
0
0
0
0
0
0.12766
94
6
36
15.666667
0.890244
0.212766
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
43ef4a907208d447033320215c9b65c6d66fff3d
299
py
Python
hello-world/helloworld/run_cmdline.py
beifengle/tutorial-scrapy
7c9046c3eec464e7e098d603c8b0bcd0f79bab31
[ "BSD-2-Clause" ]
null
null
null
hello-world/helloworld/run_cmdline.py
beifengle/tutorial-scrapy
7c9046c3eec464e7e098d603c8b0bcd0f79bab31
[ "BSD-2-Clause" ]
null
null
null
hello-world/helloworld/run_cmdline.py
beifengle/tutorial-scrapy
7c9046c3eec464e7e098d603c8b0bcd0f79bab31
[ "BSD-2-Clause" ]
null
null
null
# -*- coding: utf-8 -*- from scrapy import cmdline ''' @Author: lu @Time: 2020/12/17 17:02 @Desc: 同一个进程下单线程,按代码添加的爬虫顺序地执行 ''' cmdline.execute("scrapy crawl hello".split()) # cmdline.execute("scrapy crawl hello2".split())#如果有多个爬虫,在这添加 # cmdline.execute("scrapy crawl hello3".split())#如果有多个爬虫,在这添加
21.357143
61
0.70903
40
299
5.3
0.625
0.198113
0.283019
0.353774
0
0
0
0
0
0
0
0.05618
0.107023
299
14
62
21.357143
0.737828
0.464883
0
0
0
0
0.225
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
a11c5d5673cb1862811de43add3bbb8bf265e3b9
168
py
Python
main.py
DinGo4DEV/RemoteLruCache
86758efd955f451de1210aa662af9c211cdb0f62
[ "MIT" ]
null
null
null
main.py
DinGo4DEV/RemoteLruCache
86758efd955f451de1210aa662af9c211cdb0f62
[ "MIT" ]
null
null
null
main.py
DinGo4DEV/RemoteLruCache
86758efd955f451de1210aa662af9c211cdb0f62
[ "MIT" ]
null
null
null
from lru_cache import LRUCache import time cache = LRUCache(10,2) cache['a'] = 'a' print(cache) time.sleep(2) cache['b'] = 'b' print(cache) time.sleep(1) print(cache)
14
30
0.696429
29
168
4
0.448276
0.258621
0.241379
0.327586
0
0
0
0
0
0
0
0.034014
0.125
168
12
31
14
0.755102
0
0
0.3
0
0
0.023669
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0.3
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a1227013157af259e87d5a473d51e469c38adedc
7,889
py
Python
functions_generate_grand_mobility_matrix.py
Pecnut/stokesian-dynamics
89b9108f0e15414291f9d7134f312657ee64c496
[ "MIT" ]
13
2019-01-30T14:54:26.000Z
2022-02-28T20:25:07.000Z
functions_generate_grand_mobility_matrix.py
henryleeeee/stokesian-dynamics
89b9108f0e15414291f9d7134f312657ee64c496
[ "MIT" ]
null
null
null
functions_generate_grand_mobility_matrix.py
henryleeeee/stokesian-dynamics
89b9108f0e15414291f9d7134f312657ee64c496
[ "MIT" ]
4
2019-07-05T01:08:11.000Z
2022-01-27T17:05:33.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- # Adam Townsend, adam@adamtownsend.com, 12/05/2014 from functions_generate_Minfinity import generate_Minfinity from functions_generate_R2Bexact import generate_R2Bexact from functions_generate_R2Bexact_periodic import generate_R2Bexact_periodic from functions_generate_Minfinity_periodic import generate_Minfinity_periodic from functions_shared import save_matrix, tick, tock, posdata_data import time from numpy import linalg import numpy as np from inputs import cutoff_factor, num_frames, text_only, viewbox_bottomleft_topright, printout, setup_number, posdata, s_dash_range, lam_range, lam_range_with_reciprocals, XYZ_raw, view_labels, fps, viewing_angle, timestep, trace_paths, two_d_plot, save_positions_every_n_timesteps, save_forces_every_n_timesteps, XYZf, use_XYZd_values, input_form, invert_m_every def generate_grand_resistance_matrix(posdata, last_generated_Minfinity_inverse, regenerate_Minfinity=False, cutoff_factor=2, printout=0, use_XYZd_values=True, use_drag_Minfinity=False, use_Minfinity_only=False, frameno=0, checkpoint_start_from_frame=0, feed_every_n_timesteps=0, mu=1): ''' if use_XYZd_values: d = "-d" else: d = "" ''' d = "-d" Minfinity_start_time = time.time() if not(use_drag_Minfinity): if regenerate_Minfinity: (Minfinity, headingM) = generate_Minfinity(posdata, printout, frameno=frameno, mu=mu) Minfinity_elapsed_time = time.time() - Minfinity_start_time Minfinity_inverse_start_time = time.time() Minfinity_inverse = linalg.inv(Minfinity) if printout > 0: print "Minfinity[0:12]" print np.array_str(Minfinity[0:12, 0:12], max_line_width=100000) else: Minfinity_elapsed_time = time.time() - Minfinity_start_time Minfinity_inverse_start_time = time.time() Minfinity_inverse = last_generated_Minfinity_inverse Minfinity_inverse_elapsed_time = time.time() - Minfinity_inverse_start_time else: (sphere_sizes, sphere_positions, sphere_rotations, dumbbell_sizes, dumbbell_positions, dumbbell_deltax, num_spheres, num_dumbbells, element_sizes, element_positions, element_deltax, num_elements, num_elements_array, element_type, uv_start, uv_size, element_start_count) = posdata_data(posdata) Minfinity_inverse = mu * np.diag([sphere_sizes[i / 3] for i in xrange(3 * num_spheres)] + [1 / 0.75 * sphere_sizes[i / 3]**3 for i in xrange(3 * num_spheres)] + [1 / 0.9 * sphere_sizes[i / 5]**3 for i in xrange(5 * num_spheres)] + [2 * dumbbell_sizes[i / 3] for i in xrange(3 * num_dumbbells)] + [2 * dumbbell_sizes[i / 3] for i in xrange(3 * num_dumbbells)]) Minfinity_elapsed_time = 0 Minfinity_inverse_elapsed_time = 0 if printout > 0: print "Minfinity_inverse" print np.array_str(Minfinity_inverse, max_line_width=100000) if not use_Minfinity_only: R2Bexact_start_time = time.time() # Whether we use the d values or not is selected in inputs.py where we read in XYZ_raw. if printout > 1: print "cutoff_factor is ", cutoff_factor (R2Bexact, heading) = generate_R2Bexact(posdata, printout, cutoff_factor=cutoff_factor, frameno=frameno, checkpoint_start_from_frame=checkpoint_start_from_frame, feed_every_n_timesteps=feed_every_n_timesteps, mu=mu) R2Bexact_elapsed_time = time.time() - R2Bexact_start_time if printout > 0: print "R2Bexact" print np.array_str(R2Bexact.toarray(), max_line_width=100000) grand_resistance_matrix = Minfinity_inverse + R2Bexact.toarray() if printout > 0: print "grand R" print np.array_str(grand_resistance_matrix, max_line_width=100000) else: grand_resistance_matrix = Minfinity_inverse R2Bexact = 0 heading = "" R2Bexact_elapsed_time = 0 if (printout > 1): print "M infinity" print np.array_str(Minfinity, max_line_width=100000) print "\n\nR2Bexact" print np.array_str(R2Bexact.toarray(), max_line_width=100000) print "\n\nGrand resistance matrix" print np.array_str(grand_resistance_matrix, max_line_width=100000) save_matrix(grand_resistance_matrix, "Grand Resistance Matrix", "R-" + str(frameno) + ".txt") gen_times = [Minfinity_elapsed_time, Minfinity_inverse_elapsed_time, R2Bexact_elapsed_time] return (grand_resistance_matrix, heading, Minfinity_inverse, gen_times) def generate_grand_resistance_matrix_periodic(posdata, last_generated_Minfinity_inverse, box_bottom_left, box_top_right, regenerate_Minfinity=False, cutoff_factor=2, printout=0, use_XYZd_values=True, use_drag_Minfinity=False, use_Minfinity_only=False, frameno=0, checkpoint_start_from_frame=0, feed_every_n_timesteps=0, O_infinity=np.array([0, 0, 0]), E_infinity=np.array([[0, 0, 0], [0, 0, 0], [0, 0, 0]]), timestep=0.1, centre_of_background_flow=np.array([0, 0, 0]), mu=1, amplitude=1, frequency=1): d = "-d" if not(use_drag_Minfinity): # i.e. if we should do Minfinity properly: Minfinity_start_time = time.time() if regenerate_Minfinity: (Minfinity, headingM) = generate_Minfinity_periodic(posdata, box_bottom_left, box_top_right, printout, frameno=frameno, O_infinity=O_infinity, E_infinity=E_infinity, timestep=timestep, centre_of_background_flow=centre_of_background_flow, mu=mu, frequency=frequency, amplitude=amplitude) Minfinity_elapsed_time = time.time() - Minfinity_start_time Minfinity_inverse_start_time = time.time() Minfinity_inverse = linalg.inv(Minfinity) else: Minfinity_elapsed_time = time.time() - Minfinity_start_time Minfinity_inverse_start_time = time.time() Minfinity_inverse = last_generated_Minfinity_inverse Minfinity_inverse_elapsed_time = time.time() - Minfinity_inverse_start_time else: (sphere_sizes, sphere_positions, sphere_rotations, dumbbell_sizes, dumbbell_positions, dumbbell_deltax, num_spheres, num_dumbbells, element_sizes, element_positions, element_deltax, num_elements, num_elements_array, element_type, uv_start, uv_size, element_start_count) = posdata_data(posdata) Minfinity_inverse = mu * np.diag([sphere_sizes[i / 3] for i in xrange(3 * num_spheres)] + [1 / 0.75 * sphere_sizes[i / 3]**3 for i in xrange(3 * num_spheres)] + [1 / 0.9 * sphere_sizes[i / 5]**3 for i in xrange(5 * num_spheres)] + [2 * dumbbell_sizes[i / 3] for i in xrange(3 * num_dumbbells)] + [2 * dumbbell_sizes[i / 3] for i in xrange(3 * num_dumbbells)]) Minfinity_elapsed_time = 0 Minfinity_inverse_elapsed_time = 0 if not use_Minfinity_only: R2Bexact_start_time = time.time() (R2Bexact, heading) = generate_R2Bexact_periodic(posdata, box_bottom_left, box_top_right, printout, cutoff_factor=cutoff_factor, frameno=frameno, checkpoint_start_from_frame=checkpoint_start_from_frame, feed_every_n_timesteps=feed_every_n_timesteps, O_infinity=O_infinity, E_infinity=E_infinity, timestep=timestep, centre_of_background_flow=centre_of_background_flow, mu=mu, frequency=frequency, amplitude=amplitude) R2Bexact_elapsed_time = time.time() - R2Bexact_start_time grand_resistance_matrix = Minfinity_inverse + R2Bexact.toarray() else: grand_resistance_matrix = Minfinity_inverse R2Bexact = 0 heading = "" R2Bexact_elapsed_time = 0 gen_times = [Minfinity_elapsed_time, Minfinity_inverse_elapsed_time, R2Bexact_elapsed_time] return (grand_resistance_matrix, heading, Minfinity_inverse, gen_times)
65.741667
503
0.721004
1,047
7,889
5.064947
0.159503
0.048275
0.036206
0.0396
0.765982
0.702998
0.67641
0.636055
0.617764
0.601546
0
0.027236
0.194828
7,889
119
504
66.294118
0.80762
0.027633
0
0.680851
1
0
0.019545
0
0
0
0
0
0
0
null
null
0
0.095745
null
null
0.297872
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
a144b01a14aa7ce45d94abe2d29a2afcf29d2ae8
123
py
Python
weate/forms.py
manulangat1/stackova
9740a546de42e6e3409d597e77d516c360708b90
[ "MIT" ]
1
2020-02-10T08:37:23.000Z
2020-02-10T08:37:23.000Z
weate/forms.py
manulangat1/stackova
9740a546de42e6e3409d597e77d516c360708b90
[ "MIT" ]
null
null
null
weate/forms.py
manulangat1/stackova
9740a546de42e6e3409d597e77d516c360708b90
[ "MIT" ]
null
null
null
from django import forms class Weatherform(forms.Form): city = forms.CharField(label="enter city name",max_length=30)
30.75
65
0.764228
18
123
5.166667
0.833333
0
0
0
0
0
0
0
0
0
0
0.018692
0.130081
123
4
65
30.75
0.850467
0
0
0
0
0
0.120968
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
a160f5c7613a1834133d274cf3cf74094218065c
1,708
py
Python
api/serializers.py
ronnyml/django-movies
2e6d4f43d14d625e19640f1e1b1d4171cfc7b377
[ "Apache-2.0" ]
2
2015-09-30T17:08:14.000Z
2019-01-06T14:35:26.000Z
api/serializers.py
ronnyml/django-movies
2e6d4f43d14d625e19640f1e1b1d4171cfc7b377
[ "Apache-2.0" ]
11
2020-02-12T00:44:07.000Z
2022-02-10T07:32:30.000Z
api/serializers.py
ronnyml/django-react-tv
2e6d4f43d14d625e19640f1e1b1d4171cfc7b377
[ "Apache-2.0" ]
4
2016-03-13T08:49:01.000Z
2019-01-06T14:35:32.000Z
from tv.models import * from rest_framework import serializers class AwardSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Award fields = '__all__' class AwardCategorySerializer(serializers.HyperlinkedModelSerializer): class Meta: model = AwardCategory fields = '__all__' class CitySerializer(serializers.HyperlinkedModelSerializer): class Meta: model = City fields = '__all__' class CountrySerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Country fields = '__all__' class FestivalSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Festival fields = '__all__' class GenreSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Genre fields = '__all__' class LanguageSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Language fields = '__all__' class MovieTVShowSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = MovieTVShow fields = '__all__' class MovieTVShowCategorySerializer(serializers.HyperlinkedModelSerializer): class Meta: model = MovieTVShowCategory fields = '__all__' class OrganizationSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Organization fields = '__all__' class PersonSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Person fields = '__all__' class PersonRoleSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = PersonRole fields = '__all__'
26.6875
76
0.712529
129
1,708
9.054264
0.286822
0.380137
0.431507
0.472603
0.523973
0
0
0
0
0
0
0
0.223068
1,708
63
77
27.111111
0.880181
0
0
0.48
0
0
0.04918
0
0
0
0
0
0
1
0
false
0
0.04
0
0.52
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
a1642f0fa4724f709d362e2fa7bec1bd94209a00
187
py
Python
conftest.py
Verdova/mapbox-sdk-py
510867b263c60435050bf4bf2dc32ae4985d7732
[ "MIT" ]
319
2015-07-21T13:48:20.000Z
2022-02-10T08:36:58.000Z
conftest.py
Verdova/mapbox-sdk-py
510867b263c60435050bf4bf2dc32ae4985d7732
[ "MIT" ]
234
2015-07-21T07:44:28.000Z
2020-02-04T16:25:09.000Z
conftest.py
Verdova/mapbox-sdk-py
510867b263c60435050bf4bf2dc32ae4985d7732
[ "MIT" ]
145
2015-09-05T11:39:18.000Z
2022-03-28T12:15:15.000Z
import os import pytest @pytest.fixture def uploads_dest_id(): version = os.environ.get('TRAVIS_PYTHON_VERSION', 'test') return 'uploads-{0}'.format(version.replace(".", "-"))
18.7
61
0.68984
24
187
5.208333
0.75
0
0
0
0
0
0
0
0
0
0
0.006173
0.13369
187
9
62
20.777778
0.765432
0
0
0
0
0
0.203209
0.112299
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
a1733e1ac2e2098b064522eef1491c9ec4a75433
23,128
py
Python
pyboto3/acm.py
thecraftman/pyboto3
653a0db2b00b06708334431da8f169d1f7c7734f
[ "MIT" ]
null
null
null
pyboto3/acm.py
thecraftman/pyboto3
653a0db2b00b06708334431da8f169d1f7c7734f
[ "MIT" ]
null
null
null
pyboto3/acm.py
thecraftman/pyboto3
653a0db2b00b06708334431da8f169d1f7c7734f
[ "MIT" ]
null
null
null
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ''' def add_tags_to_certificate(CertificateArn=None, Tags=None): """ Adds one or more tags to an ACM Certificate. Tags are labels that you can use to identify and organize your AWS resources. Each tag consists of a key and an optional value . You specify the certificate on input by its Amazon Resource Name (ARN). You specify the tag by using a key-value pair. You can apply a tag to just one certificate if you want to identify a specific characteristic of that certificate, or you can apply the same tag to multiple certificates if you want to filter for a common relationship among those certificates. Similarly, you can apply the same tag to multiple resources if you want to specify a relationship among those resources. For example, you can add the same tag to an ACM Certificate and an Elastic Load Balancing load balancer to indicate that they are both used by the same website. For more information, see Tagging ACM Certificates . To remove one or more tags, use the RemoveTagsFromCertificate action. To view all of the tags that have been applied to the certificate, use the ListTagsForCertificate action. See also: AWS API Documentation :example: response = client.add_tags_to_certificate( CertificateArn='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) :type CertificateArn: string :param CertificateArn: [REQUIRED] String that contains the ARN of the ACM Certificate to which the tag is to be applied. This must be of the form: arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012 For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces . :type Tags: list :param Tags: [REQUIRED] The key-value pair that defines the tag. The tag value is optional. (dict) --A key-value pair that identifies or specifies metadata about an ACM resource. Key (string) -- [REQUIRED]The key of the tag. Value (string) --The value of the tag. """ pass def can_paginate(operation_name=None): """ Check if an operation can be paginated. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator('create_foo'). """ pass def delete_certificate(CertificateArn=None): """ Deletes an ACM Certificate and its associated private key. If this action succeeds, the certificate no longer appears in the list of ACM Certificates that can be displayed by calling the ListCertificates action or be retrieved by calling the GetCertificate action. The certificate will not be available for use by other AWS services. See also: AWS API Documentation :example: response = client.delete_certificate( CertificateArn='string' ) :type CertificateArn: string :param CertificateArn: [REQUIRED] String that contains the ARN of the ACM Certificate to be deleted. This must be of the form: arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012 For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces . """ pass def describe_certificate(CertificateArn=None): """ Returns detailed metadata about the specified ACM Certificate. See also: AWS API Documentation :example: response = client.describe_certificate( CertificateArn='string' ) :type CertificateArn: string :param CertificateArn: [REQUIRED] The Amazon Resource Name (ARN) of the ACM Certificate. The ARN must have the following form: arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012 For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces . :rtype: dict :return: { 'Certificate': { 'CertificateArn': 'string', 'DomainName': 'string', 'SubjectAlternativeNames': [ 'string', ], 'DomainValidationOptions': [ { 'DomainName': 'string', 'ValidationEmails': [ 'string', ], 'ValidationDomain': 'string', 'ValidationStatus': 'PENDING_VALIDATION'|'SUCCESS'|'FAILED' }, ], 'Serial': 'string', 'Subject': 'string', 'Issuer': 'string', 'CreatedAt': datetime(2015, 1, 1), 'IssuedAt': datetime(2015, 1, 1), 'ImportedAt': datetime(2015, 1, 1), 'Status': 'PENDING_VALIDATION'|'ISSUED'|'INACTIVE'|'EXPIRED'|'VALIDATION_TIMED_OUT'|'REVOKED'|'FAILED', 'RevokedAt': datetime(2015, 1, 1), 'RevocationReason': 'UNSPECIFIED'|'KEY_COMPROMISE'|'CA_COMPROMISE'|'AFFILIATION_CHANGED'|'SUPERCEDED'|'CESSATION_OF_OPERATION'|'CERTIFICATE_HOLD'|'REMOVE_FROM_CRL'|'PRIVILEGE_WITHDRAWN'|'A_A_COMPROMISE', 'NotBefore': datetime(2015, 1, 1), 'NotAfter': datetime(2015, 1, 1), 'KeyAlgorithm': 'RSA_2048'|'RSA_1024'|'EC_prime256v1', 'SignatureAlgorithm': 'string', 'InUseBy': [ 'string', ], 'FailureReason': 'NO_AVAILABLE_CONTACTS'|'ADDITIONAL_VERIFICATION_REQUIRED'|'DOMAIN_NOT_ALLOWED'|'INVALID_PUBLIC_DOMAIN'|'OTHER', 'Type': 'IMPORTED'|'AMAZON_ISSUED', 'RenewalSummary': { 'RenewalStatus': 'PENDING_AUTO_RENEWAL'|'PENDING_VALIDATION'|'SUCCESS'|'FAILED', 'DomainValidationOptions': [ { 'DomainName': 'string', 'ValidationEmails': [ 'string', ], 'ValidationDomain': 'string', 'ValidationStatus': 'PENDING_VALIDATION'|'SUCCESS'|'FAILED' }, ] } } } :returns: (string) -- """ pass def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None): """ Generate a presigned url given a client, its method, and arguments :type ClientMethod: string :param ClientMethod: The client method to presign for :type Params: dict :param Params: The parameters normally passed to ClientMethod. :type ExpiresIn: int :param ExpiresIn: The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds) :type HttpMethod: string :param HttpMethod: The http method to use on the generated url. By default, the http method is whatever is used in the method's model. """ pass def get_certificate(CertificateArn=None): """ Retrieves an ACM Certificate and certificate chain for the certificate specified by an ARN. The chain is an ordered list of certificates that contains the root certificate, intermediate certificates of subordinate CAs, and the ACM Certificate. The certificate and certificate chain are base64 encoded. If you want to decode the certificate chain to see the individual certificate fields, you can use OpenSSL. See also: AWS API Documentation :example: response = client.get_certificate( CertificateArn='string' ) :type CertificateArn: string :param CertificateArn: [REQUIRED] String that contains a certificate ARN in the following format: arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012 For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces . :rtype: dict :return: { 'Certificate': 'string', 'CertificateChain': 'string' } """ pass def get_paginator(operation_name=None): """ Create a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator('create_foo'). :rtype: L{botocore.paginate.Paginator} """ pass def get_waiter(): """ """ pass def import_certificate(CertificateArn=None, Certificate=None, PrivateKey=None, CertificateChain=None): """ Imports an SSL/TLS certificate into AWS Certificate Manager (ACM) to use with ACM's integrated AWS services . For more information about importing certificates into ACM, including the differences between certificates that you import and those that ACM provides, see Importing Certificates in the AWS Certificate Manager User Guide . To import a certificate, you must provide the certificate and the matching private key. When the certificate is not self-signed, you must also provide a certificate chain. You can omit the certificate chain when importing a self-signed certificate. The certificate, private key, and certificate chain must be PEM-encoded. For more information about converting these items to PEM format, see Importing Certificates Troubleshooting in the AWS Certificate Manager User Guide . To import a new certificate, omit the CertificateArn field. Include this field only when you want to replace a previously imported certificate. This operation returns the Amazon Resource Name (ARN) of the imported certificate. See also: AWS API Documentation :example: response = client.import_certificate( CertificateArn='string', Certificate=b'bytes', PrivateKey=b'bytes', CertificateChain=b'bytes' ) :type CertificateArn: string :param CertificateArn: The Amazon Resource Name (ARN) of an imported certificate to replace. To import a new certificate, omit this field. :type Certificate: bytes :param Certificate: [REQUIRED] The certificate to import. It must meet the following requirements: Must be PEM-encoded. Must contain a 1024-bit or 2048-bit RSA public key. Must be valid at the time of import. You cannot import a certificate before its validity period begins (the certificate's NotBefore date) or after it expires (the certificate's NotAfter date). :type PrivateKey: bytes :param PrivateKey: [REQUIRED] The private key that matches the public key in the certificate. It must meet the following requirements: Must be PEM-encoded. Must be unencrypted. You cannot import a private key that is protected by a password or passphrase. :type CertificateChain: bytes :param CertificateChain: The certificate chain. It must be PEM-encoded. :rtype: dict :return: { 'CertificateArn': 'string' } """ pass def list_certificates(CertificateStatuses=None, NextToken=None, MaxItems=None): """ Retrieves a list of ACM Certificates and the domain name for each. You can optionally filter the list to return only the certificates that match the specified status. See also: AWS API Documentation :example: response = client.list_certificates( CertificateStatuses=[ 'PENDING_VALIDATION'|'ISSUED'|'INACTIVE'|'EXPIRED'|'VALIDATION_TIMED_OUT'|'REVOKED'|'FAILED', ], NextToken='string', MaxItems=123 ) :type CertificateStatuses: list :param CertificateStatuses: The status or statuses on which to filter the list of ACM Certificates. (string) -- :type NextToken: string :param NextToken: Use this parameter only when paginating results and only in a subsequent request after you receive a response with truncated results. Set it to the value of NextToken from the response you just received. :type MaxItems: integer :param MaxItems: Use this parameter when paginating results to specify the maximum number of items to return in the response. If additional items exist beyond the number you specify, the NextToken element is sent in the response. Use this NextToken value in a subsequent request to retrieve additional items. :rtype: dict :return: { 'NextToken': 'string', 'CertificateSummaryList': [ { 'CertificateArn': 'string', 'DomainName': 'string' }, ] } """ pass def list_tags_for_certificate(CertificateArn=None): """ Lists the tags that have been applied to the ACM Certificate. Use the certificate's Amazon Resource Name (ARN) to specify the certificate. To add a tag to an ACM Certificate, use the AddTagsToCertificate action. To delete a tag, use the RemoveTagsFromCertificate action. See also: AWS API Documentation :example: response = client.list_tags_for_certificate( CertificateArn='string' ) :type CertificateArn: string :param CertificateArn: [REQUIRED] String that contains the ARN of the ACM Certificate for which you want to list the tags. This has the following form: arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012 For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces . :rtype: dict :return: { 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } """ pass def remove_tags_from_certificate(CertificateArn=None, Tags=None): """ Remove one or more tags from an ACM Certificate. A tag consists of a key-value pair. If you do not specify the value portion of the tag when calling this function, the tag will be removed regardless of value. If you specify a value, the tag is removed only if it is associated with the specified value. To add tags to a certificate, use the AddTagsToCertificate action. To view all of the tags that have been applied to a specific ACM Certificate, use the ListTagsForCertificate action. See also: AWS API Documentation :example: response = client.remove_tags_from_certificate( CertificateArn='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) :type CertificateArn: string :param CertificateArn: [REQUIRED] String that contains the ARN of the ACM Certificate with one or more tags that you want to remove. This must be of the form: arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012 For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces . :type Tags: list :param Tags: [REQUIRED] The key-value pair that defines the tag to remove. (dict) --A key-value pair that identifies or specifies metadata about an ACM resource. Key (string) -- [REQUIRED]The key of the tag. Value (string) --The value of the tag. """ pass def request_certificate(DomainName=None, SubjectAlternativeNames=None, IdempotencyToken=None, DomainValidationOptions=None): """ Requests an ACM Certificate for use with other AWS services. To request an ACM Certificate, you must specify the fully qualified domain name (FQDN) for your site. You can also specify additional FQDNs if users can reach your site by using other names. For each domain name you specify, email is sent to the domain owner to request approval to issue the certificate. After receiving approval from the domain owner, the ACM Certificate is issued. For more information, see the AWS Certificate Manager User Guide . See also: AWS API Documentation :example: response = client.request_certificate( DomainName='string', SubjectAlternativeNames=[ 'string', ], IdempotencyToken='string', DomainValidationOptions=[ { 'DomainName': 'string', 'ValidationDomain': 'string' }, ] ) :type DomainName: string :param DomainName: [REQUIRED] Fully qualified domain name (FQDN), such as www.example.com, of the site that you want to secure with an ACM Certificate. Use an asterisk (*) to create a wildcard certificate that protects several sites in the same domain. For example, *.example.com protects www.example.com, site.example.com, and images.example.com. :type SubjectAlternativeNames: list :param SubjectAlternativeNames: Additional FQDNs to be included in the Subject Alternative Name extension of the ACM Certificate. For example, add the name www.example.net to a certificate for which the DomainName field is www.example.com if users can reach your site by using either name. (string) -- :type IdempotencyToken: string :param IdempotencyToken: Customer chosen string that can be used to distinguish between calls to RequestCertificate . Idempotency tokens time out after one hour. Therefore, if you call RequestCertificate multiple times with the same idempotency token within one hour, ACM recognizes that you are requesting only one certificate and will issue only one. If you change the idempotency token for each call, ACM recognizes that you are requesting multiple certificates. :type DomainValidationOptions: list :param DomainValidationOptions: The domain name that you want ACM to use to send you emails to validate your ownership of the domain. (dict) --Contains information about the domain names that you want ACM to use to send you emails to validate your ownership of the domain. DomainName (string) -- [REQUIRED]A fully qualified domain name (FQDN) in the certificate request. ValidationDomain (string) -- [REQUIRED]The domain name that you want ACM to use to send you validation emails. This domain name is the suffix of the email addresses that you want ACM to use. This must be the same as the DomainName value or a superdomain of the DomainName value. For example, if you request a certificate for testing.example.com , you can specify example.com for this value. In that case, ACM sends domain validation emails to the following five addresses: admin@example.com administrator@example.com hostmaster@example.com postmaster@example.com webmaster@example.com :rtype: dict :return: { 'CertificateArn': 'string' } """ pass def resend_validation_email(CertificateArn=None, Domain=None, ValidationDomain=None): """ Resends the email that requests domain ownership validation. The domain owner or an authorized representative must approve the ACM Certificate before it can be issued. The certificate can be approved by clicking a link in the mail to navigate to the Amazon certificate approval website and then clicking I Approve . However, the validation email can be blocked by spam filters. Therefore, if you do not receive the original mail, you can request that the mail be resent within 72 hours of requesting the ACM Certificate. If more than 72 hours have elapsed since your original request or since your last attempt to resend validation mail, you must request a new certificate. See also: AWS API Documentation :example: response = client.resend_validation_email( CertificateArn='string', Domain='string', ValidationDomain='string' ) :type CertificateArn: string :param CertificateArn: [REQUIRED] String that contains the ARN of the requested certificate. The certificate ARN is generated and returned by the RequestCertificate action as soon as the request is made. By default, using this parameter causes email to be sent to all top-level domains you specified in the certificate request. The ARN must be of the form: arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012 :type Domain: string :param Domain: [REQUIRED] The fully qualified domain name (FQDN) of the certificate that needs to be validated. :type ValidationDomain: string :param ValidationDomain: [REQUIRED] The base validation domain that will act as the suffix of the email addresses that are used to send the emails. This must be the same as the Domain value or a superdomain of the Domain value. For example, if you requested a certificate for site.subdomain.example.com and specify a ValidationDomain of subdomain.example.com , ACM sends email to the domain registrant, technical contact, and administrative contact in WHOIS and the following five addresses: admin@subdomain.example.com administrator@subdomain.example.com hostmaster@subdomain.example.com postmaster@subdomain.example.com webmaster@subdomain.example.com """ pass
45.980119
677
0.676107
2,863
23,128
5.430667
0.181628
0.009326
0.012027
0.008361
0.366671
0.329624
0.305377
0.28576
0.265114
0.241703
0
0.022367
0.261544
23,128
502
678
46.071713
0.887991
0.879237
0
0.5
0
0
0
0
0
0
0
0
0
1
0.5
false
0.5
0.035714
0
0.535714
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
a17bc57b64e00ae032e7a334165627f88bb9d047
353
py
Python
onnx_darknet/handlers/frontend/softmax.py
minhoolee/onnx-darknet
d0227c305710b740e6b06315d83b021a183bfdaf
[ "Apache-2.0" ]
6
2019-02-26T07:38:01.000Z
2020-07-08T22:18:22.000Z
onnx_darknet/handlers/frontend/softmax.py
minhoolee/onnx-darknet
d0227c305710b740e6b06315d83b021a183bfdaf
[ "Apache-2.0" ]
1
2019-02-26T07:48:26.000Z
2019-02-26T22:00:22.000Z
onnx_darknet/handlers/frontend/softmax.py
minhoolee/onnx-darknet
d0227c305710b740e6b06315d83b021a183bfdaf
[ "Apache-2.0" ]
null
null
null
from onnx_darknet.handlers.frontend_handler import FrontendHandler from onnx_darknet.handlers.handler import onnx_op from onnx_darknet.handlers.handler import darknet_op @onnx_op("Softmax") @darknet_op("Softmax") class Softmax(FrontendHandler): @classmethod def version_1(cls, node, **kwargs): return cls.make_node_from_tf_node(node, axis=1)
27.153846
66
0.810198
50
353
5.46
0.44
0.087912
0.164835
0.252747
0.263736
0.263736
0
0
0
0
0
0.006289
0.09915
353
12
67
29.416667
0.852201
0
0
0
0
0
0.03966
0
0
0
0
0
0
1
0.111111
false
0
0.333333
0.111111
0.666667
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
4
a19a0a7231f1b280d65d38e86205177a0ec4d6d8
81
py
Python
pyroids/lib/__init__.py
maread99/pyrrhoids
5391b1560c41b7aaef09fec3bf5091e79a438ab9
[ "MIT" ]
1
2020-08-02T16:25:01.000Z
2020-08-02T16:25:01.000Z
pyroids/lib/__init__.py
maread99/pyrrhoids
5391b1560c41b7aaef09fec3bf5091e79a438ab9
[ "MIT" ]
null
null
null
pyroids/lib/__init__.py
maread99/pyrrhoids
5391b1560c41b7aaef09fec3bf5091e79a438ab9
[ "MIT" ]
null
null
null
#! /usr/bin/env python """Initialisation file to recognise lib as subpackage."""
27
57
0.728395
11
81
5.363636
1
0
0
0
0
0
0
0
0
0
0
0
0.123457
81
3
57
27
0.830986
0.901235
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
a19b26f6ef8fa41a06f8c73f04f6fcad0db3aca7
4,295
py
Python
tests/integrational/native_sync/test_history.py
natekspencer/pubnub-python
453ba34104b4067077546d5d9ba3b206559494d1
[ "MIT" ]
146
2015-01-05T03:14:53.000Z
2022-03-16T16:51:52.000Z
tests/integrational/native_sync/test_history.py
natekspencer/pubnub-python
453ba34104b4067077546d5d9ba3b206559494d1
[ "MIT" ]
48
2015-01-15T15:27:41.000Z
2022-03-21T14:17:05.000Z
tests/integrational/native_sync/test_history.py
natekspencer/pubnub-python
453ba34104b4067077546d5d9ba3b206559494d1
[ "MIT" ]
128
2015-01-05T03:40:59.000Z
2022-03-02T20:50:58.000Z
import logging import time import unittest import pubnub import pytest from unittest.mock import patch from pubnub.exceptions import PubNubException from pubnub.models.consumer.history import PNHistoryResult from pubnub.models.consumer.pubsub import PNPublishResult from pubnub.pubnub import PubNub from tests.helper import pnconf_copy, pnconf_enc_copy, pnconf_pam_copy from tests.integrational.vcr_helper import use_cassette_and_stub_time_sleep_native pubnub.set_stream_logger('pubnub', logging.DEBUG) COUNT = 5 class TestPubNubHistory(unittest.TestCase): @use_cassette_and_stub_time_sleep_native('tests/integrational/fixtures/native_sync/history/basic.yaml', filter_query_parameters=['uuid', 'pnsdk', 'l_pub']) def test_basic(self): ch = "history-native-sync-ch" pubnub = PubNub(pnconf_copy()) pubnub.config.uuid = "history-native-sync-uuid" for i in range(COUNT): envelope = pubnub.publish().channel(ch).message("hey-%s" % i).sync() assert isinstance(envelope.result, PNPublishResult) assert envelope.result.timetoken > 0 time.sleep(5) envelope = pubnub.history().channel(ch).count(COUNT).sync() assert isinstance(envelope.result, PNHistoryResult) assert envelope.result.start_timetoken > 0 assert envelope.result.end_timetoken > 0 assert len(envelope.result.messages) == 5 assert envelope.result.messages[0].entry == 'hey-0' assert envelope.result.messages[1].entry == 'hey-1' assert envelope.result.messages[2].entry == 'hey-2' assert envelope.result.messages[3].entry == 'hey-3' assert envelope.result.messages[4].entry == 'hey-4' @patch("pubnub.crypto.PubNubCryptodome.get_initialization_vector", return_value="knightsofni12345") @use_cassette_and_stub_time_sleep_native( 'tests/integrational/fixtures/native_sync/history/encoded.yaml', filter_query_parameters=['uuid', 'pnsdk', 'l_pub'] ) def test_encrypted(self, crypto_mock): ch = "history-native-sync-ch" pubnub = PubNub(pnconf_enc_copy()) pubnub.config.uuid = "history-native-sync-uuid" for i in range(COUNT): envelope = pubnub.publish().channel(ch).message("hey-%s" % i).sync() assert isinstance(envelope.result, PNPublishResult) assert envelope.result.timetoken > 0 time.sleep(5) envelope = pubnub.history().channel(ch).count(COUNT).sync() assert isinstance(envelope.result, PNHistoryResult) assert envelope.result.start_timetoken > 0 assert envelope.result.end_timetoken > 0 assert len(envelope.result.messages) == 5 assert envelope.result.messages[0].entry == 'hey-0' assert envelope.result.messages[1].entry == 'hey-1' assert envelope.result.messages[2].entry == 'hey-2' assert envelope.result.messages[3].entry == 'hey-3' assert envelope.result.messages[4].entry == 'hey-4' @use_cassette_and_stub_time_sleep_native('tests/integrational/fixtures/native_sync/history/not_permitted.yaml', filter_query_parameters=['uuid', 'pnsdk']) def test_not_permitted(self): ch = "history-native-sync-ch" pubnub = PubNub(pnconf_pam_copy()) pubnub.config.uuid = "history-native-sync-uuid" with pytest.raises(PubNubException): pubnub.history().channel(ch).count(5).sync() def test_super_call_with_channel_only(self): ch = "history-native-sync-ch" pubnub = PubNub(pnconf_pam_copy()) pubnub.config.uuid = "history-native-sync-uuid" envelope = pubnub.history().channel(ch).sync() assert isinstance(envelope.result, PNHistoryResult) assert not envelope.status.is_error() def test_super_call_with_all_params(self): ch = "history-native-sync-ch" pubnub = PubNub(pnconf_pam_copy()) pubnub.config.uuid = "history-native-sync-uuid" envelope = pubnub.history().channel(ch).count(2).include_timetoken(True).reverse(True).start(1).end(2).sync() assert isinstance(envelope.result, PNHistoryResult) assert not envelope.status.is_error()
40.140187
117
0.680326
521
4,295
5.458733
0.201536
0.118143
0.112518
0.098453
0.756681
0.733122
0.719409
0.707806
0.694093
0.678973
0
0.011682
0.202794
4,295
106
118
40.518868
0.818925
0
0
0.573171
0
0
0.1383
0.110128
0
0
0
0
0.317073
1
0.060976
false
0
0.146341
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
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a1a9c0f29291d4abcad4b805e0a9dc39cfd941fc
119
py
Python
ubb/fop/BusCompani_exam/model/exceptions.py
AlexanderChristian/private_courses
c80f3526af539e35f93b460f3909f669aaef573c
[ "MIT" ]
null
null
null
ubb/fop/BusCompani_exam/model/exceptions.py
AlexanderChristian/private_courses
c80f3526af539e35f93b460f3909f669aaef573c
[ "MIT" ]
6
2020-03-04T20:52:39.000Z
2022-03-31T00:33:07.000Z
ubb/fop/BusCompani_exam/model/exceptions.py
AlexanderChristian/private_courses
c80f3526af539e35f93b460f3909f669aaef573c
[ "MIT" ]
null
null
null
class BusException(Exception): ''' Class to represent an Exception ''' def __init__(self): pass
19.833333
35
0.605042
12
119
5.666667
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.294118
119
6
36
19.833333
0.809524
0.260504
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0.333333
0
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
1
0
0
0
0
0
4
a1b1475d414457d549ab27dfbc9763b87bafbb1c
117
py
Python
notebooks/_solutions/90_package_numpy8.py
jorisvandenbossche/DS-python-geospatial
893a12edc5c203a75815f6dcb5f1e18c577c8cd5
[ "BSD-3-Clause" ]
58
2020-10-09T10:10:59.000Z
2022-03-07T14:58:07.000Z
notebooks/_solutions/11-numpy8.py
amitkb3/DS-python-geospatial
5f156ebff67e06d59b2a7ef446d1fed746ce0650
[ "BSD-3-Clause" ]
24
2020-09-30T19:57:14.000Z
2021-10-05T07:21:09.000Z
notebooks/_solutions/11-numpy8.py
amitkb3/DS-python-geospatial
5f156ebff67e06d59b2a7ef446d1fed746ce0650
[ "BSD-3-Clause" ]
19
2020-10-05T09:32:18.000Z
2022-03-20T00:09:14.000Z
# Convert to float and make 65535 equal to Nan b4_data_f = b4_data.astype(float) b4_data_f[b4_data == 65535] = np.nan
39
46
0.760684
24
117
3.458333
0.541667
0.289157
0.168675
0.216867
0.313253
0
0
0
0
0
0
0.14
0.145299
117
3
47
39
0.69
0.376068
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a1b8e81dec3d0708e75a57dd08d11f41a448e3e4
75
py
Python
examples/invert.py
mcauser/micropython-ssd1327
cef3dd7ad7c5f3cf13d4b1a37824396e513c63d5
[ "MIT" ]
19
2018-06-12T08:58:58.000Z
2022-02-01T13:34:56.000Z
examples/invert.py
mcauser/micropython-ssd1327
cef3dd7ad7c5f3cf13d4b1a37824396e513c63d5
[ "MIT" ]
4
2018-12-01T06:35:11.000Z
2021-09-11T16:10:26.000Z
examples/invert.py
mcauser/micropython-ssd1327
cef3dd7ad7c5f3cf13d4b1a37824396e513c63d5
[ "MIT" ]
7
2018-09-23T00:14:00.000Z
2021-03-18T17:52:29.000Z
# invert greyscale lookup table display.invert(True) display.invert(False)
18.75
31
0.813333
10
75
6.1
0.7
0.42623
0
0
0
0
0
0
0
0
0
0
0.093333
75
3
32
25
0.897059
0.386667
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
a1b8f2d34b40cc4bc979f4981d83ba69e33c5836
201
py
Python
lib/__init__.py
bayu2309/line-chatbot-boilerplate
9322a08bec0a0516b93131d35664b734d197db6a
[ "MIT" ]
38
2018-03-18T14:25:20.000Z
2022-02-01T03:48:21.000Z
lib/__init__.py
bayu2309/line-chatbot-boilerplate
9322a08bec0a0516b93131d35664b734d197db6a
[ "MIT" ]
2
2021-06-25T12:57:32.000Z
2021-06-25T12:57:32.000Z
lib/__init__.py
bayu2309/line-chatbot-boilerplate
9322a08bec0a0516b93131d35664b734d197db6a
[ "MIT" ]
13
2018-03-18T14:25:22.000Z
2021-06-25T03:33:03.000Z
from .cache import RedisCache from .client import ( StandardClient, TextClient, SimpleWitClient, AdvancedWitClient ) from .handler import ChatbotHandler from .entity import EventEntity
20.1
35
0.771144
19
201
8.157895
0.684211
0
0
0
0
0
0
0
0
0
0
0
0.18408
201
9
36
22.333333
0.945122
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.444444
0
0.444444
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4