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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
97f350625d0bb26c9189294b9492db578a06e622
| 53
|
py
|
Python
|
app/ml/objects/imputation/__init__.py
|
PSE-TECO-2020-TEAM1/e2e-ml_model-management
|
7f01a008648e25a29c639a5e16124b2e399eb821
|
[
"MIT"
] | 1
|
2021-05-04T08:46:19.000Z
|
2021-05-04T08:46:19.000Z
|
app/ml/objects/imputation/__init__.py
|
PSE-TECO-2020-TEAM1/e2e-ml_model-management
|
7f01a008648e25a29c639a5e16124b2e399eb821
|
[
"MIT"
] | null | null | null |
app/ml/objects/imputation/__init__.py
|
PSE-TECO-2020-TEAM1/e2e-ml_model-management
|
7f01a008648e25a29c639a5e16124b2e399eb821
|
[
"MIT"
] | 1
|
2022-01-28T21:21:32.000Z
|
2022-01-28T21:21:32.000Z
|
from app.ml.objects.imputation.enum import Imputation
| 53
| 53
| 0.867925
| 8
| 53
| 5.75
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.056604
| 53
| 1
| 53
| 53
| 0.92
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
3f0e0e4ca8eb708437a1d551d11d02992e9739d0
| 212
|
py
|
Python
|
pydatastructs/__init__.py
|
yoshiohasegawa/python-data-structures
|
22fdf2af19a5976d2a79fa944bcbd7337ec72549
|
[
"MIT"
] | null | null | null |
pydatastructs/__init__.py
|
yoshiohasegawa/python-data-structures
|
22fdf2af19a5976d2a79fa944bcbd7337ec72549
|
[
"MIT"
] | null | null | null |
pydatastructs/__init__.py
|
yoshiohasegawa/python-data-structures
|
22fdf2af19a5976d2a79fa944bcbd7337ec72549
|
[
"MIT"
] | 1
|
2021-09-17T03:09:00.000Z
|
2021-09-17T03:09:00.000Z
|
from .stack import Stack
from .queue import Queue
from .tree import Tree
from .binarysearchtree import BinarySearchTree
from .linkedlist import LinkedList
from .maxheap import MaxHeap
from .minheap import MinHeap
| 30.285714
| 46
| 0.839623
| 28
| 212
| 6.357143
| 0.321429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.127358
| 212
| 7
| 47
| 30.285714
| 0.962162
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
3f30fef3817a02784f6b3e6c7ea86b7bad7f7905
| 150
|
py
|
Python
|
Trakttv.bundle/Contents/Libraries/Shared/plugin/scrobbler/methods/__init__.py
|
disrupted/Trakttv.bundle
|
24712216c71f3b22fd58cb5dd89dad5bb798ed60
|
[
"RSA-MD"
] | 1,346
|
2015-01-01T14:52:24.000Z
|
2022-03-28T12:50:48.000Z
|
Trakttv.bundle/Contents/Libraries/Shared/plugin/scrobbler/methods/__init__.py
|
alcroito/Plex-Trakt-Scrobbler
|
4f83fb0860dcb91f860d7c11bc7df568913c82a6
|
[
"RSA-MD"
] | 474
|
2015-01-01T10:27:46.000Z
|
2022-03-21T12:26:16.000Z
|
Trakttv.bundle/Contents/Libraries/Shared/plugin/scrobbler/methods/__init__.py
|
alcroito/Plex-Trakt-Scrobbler
|
4f83fb0860dcb91f860d7c11bc7df568913c82a6
|
[
"RSA-MD"
] | 191
|
2015-01-02T18:27:22.000Z
|
2022-03-29T10:49:48.000Z
|
from plugin.scrobbler.methods.s_logging import Logging
from plugin.scrobbler.methods.s_websocket import WebSocket
__all__ = ['Logging', 'WebSocket']
| 30
| 58
| 0.82
| 19
| 150
| 6.157895
| 0.473684
| 0.17094
| 0.324786
| 0.444444
| 0.461538
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.086667
| 150
| 4
| 59
| 37.5
| 0.854015
| 0
| 0
| 0
| 0
| 0
| 0.106667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
3f3681d0f84d3b3d0aeb65af38002f625efedf5b
| 5,940
|
py
|
Python
|
tests/text/test_text_supervised.py
|
jeziellago/autokeras
|
cf93211c82dc61b239b8542d45ff111ff3b94a08
|
[
"MIT"
] | 1
|
2019-01-03T10:54:41.000Z
|
2019-01-03T10:54:41.000Z
|
tests/text/test_text_supervised.py
|
dive2space/autokeras
|
9d53685a5966b39674e44df9c6b9ce97c7f24b0a
|
[
"MIT"
] | 4
|
2018-10-23T13:08:03.000Z
|
2018-10-23T13:18:22.000Z
|
tests/text/test_text_supervised.py
|
EvgeniyBochenkov/github-move
|
d5f3b36fc220e89b9af243a10ae199358983e98d
|
[
"MIT"
] | null | null | null |
from unittest.mock import patch
import pytest
from autokeras.text.text_supervised import *
from tests.common import clean_dir, MockProcess, simple_transform
def mock_train(**kwargs):
str(kwargs)
return 1, 0
def mock_text_preprocess(x_train, path="dummy_path"):
return x_train
@patch('torch.multiprocessing.Pool', new=MockProcess)
@patch('autokeras.text.text_supervised.text_preprocess', side_effect=mock_text_preprocess)
@patch('autokeras.search.ModelTrainer.train_model', side_effect=mock_train)
def test_fit_predict(_, _1):
Constant.MAX_ITER_NUM = 1
Constant.MAX_MODEL_NUM = 4
Constant.SEARCH_MAX_ITER = 1
Constant.T_MIN = 0.8
path = 'tests/resources/temp'
clean_dir(path)
clf = TextClassifier(path=path, verbose=True)
train_x = np.random.rand(100, 25, 25, 1)
train_y = np.random.randint(0, 5, 100)
clf.fit(train_x, train_y, )
results = clf.predict(train_x)
assert all(map(lambda result: result in train_y, results))
clean_dir(path)
@patch('torch.multiprocessing.Pool', new=MockProcess)
@patch('autokeras.text.text_supervised.text_preprocess', side_effect=mock_text_preprocess)
def test_timeout(_):
# Constant.MAX_MODEL_NUM = 4
Constant.SEARCH_MAX_ITER = 1000
Constant.T_MIN = 0.0001
Constant.DATA_AUGMENTATION = False
path = 'tests/resources/temp'
clean_dir(path)
clf = TextClassifier(path=path, verbose=False)
train_x = np.random.rand(100, 25, 25, 1)
train_y = np.random.randint(0, 5, 100)
with pytest.raises(TimeoutError):
clf.fit(train_x, train_y, time_limit=0)
clean_dir(path)
@patch('torch.multiprocessing.Pool', new=MockProcess)
@patch('autokeras.text.text_supervised.text_preprocess', side_effect=mock_text_preprocess)
@patch('autokeras.search.ModelTrainer.train_model', side_effect=mock_train)
def test_timeout_resume(_, _1):
Constant.MAX_ITER_NUM = 1
# make it impossible to complete within 10sec
Constant.MAX_MODEL_NUM = 1000
Constant.SEARCH_MAX_ITER = 1
Constant.T_MIN = 0.8
train_x = np.random.rand(100, 25, 25, 1)
train_y = np.random.randint(0, 5, 100)
test_x = np.random.rand(100, 25, 25, 1)
path = 'tests/resources/temp'
clean_dir(path)
clf = TextClassifier(path=path, verbose=False, resume=False)
clf.n_epochs = 100
clf.fit(train_x, train_y, time_limit=2)
history_len = len(clf.load_searcher().history)
assert history_len != 0
results = clf.predict(test_x)
assert len(results) == 100
clf = TextClassifier(path=path, verbose=False, resume=True)
assert len(clf.load_searcher().history) == history_len
Constant.MAX_MODEL_NUM = history_len + 1
clf.fit(train_x, train_y)
assert len(clf.load_searcher().history) == history_len + 1
results = clf.predict(test_x)
assert len(results) == 100
clean_dir(path)
@patch('torch.multiprocessing.Pool', new=MockProcess)
@patch('autokeras.bayesian.transform', side_effect=simple_transform)
@patch('autokeras.search.ModelTrainer.train_model', side_effect=mock_train)
@patch('autokeras.text.text_supervised.text_preprocess', side_effect=mock_text_preprocess)
def test_final_fit(_, _1, _2):
Constant.LIMIT_MEMORY = True
path = 'tests/resources/temp'
clean_dir(path)
clf = TextClassifier(path=path, verbose=False)
Constant.MAX_ITER_NUM = 1
Constant.MAX_MODEL_NUM = 1
Constant.SEARCH_MAX_ITER = 1
Constant.N_NEIGHBOURS = 1
Constant.T_MIN = 0.8
train_x = np.random.rand(100, 25, 25, 1)
train_y = np.random.randint(0, 5, 100)
test_x = np.random.rand(100, 25, 25, 1)
test_y = np.random.randint(0, 5, 100)
clf.fit(train_x, train_y)
clf.final_fit(train_x, train_y, test_x, test_y)
results = clf.predict(test_x)
assert len(results) == 100
clean_dir(path)
@patch('torch.multiprocessing.Pool', new=MockProcess)
@patch('autokeras.search.ModelTrainer.train_model', side_effect=mock_train)
@patch('autokeras.text.text_supervised.text_preprocess', side_effect=mock_text_preprocess)
def test_save_continue(_, _1):
Constant.MAX_ITER_NUM = 1
Constant.MAX_MODEL_NUM = 1
Constant.SEARCH_MAX_ITER = 1
Constant.T_MIN = 0.8
train_x = np.random.rand(100, 25, 25, 1)
train_y = np.random.randint(0, 5, 100)
test_x = np.random.rand(100, 25, 25, 1)
path = 'tests/resources/temp'
clean_dir(path)
clf = TextClassifier(path=path, verbose=False, resume=False)
clf.n_epochs = 100
clf.fit(train_x, train_y, time_limit=5)
assert len(clf.load_searcher().history) == 1
Constant.MAX_MODEL_NUM = 2
clf = TextClassifier(verbose=False, path=path, resume=True)
clf.fit(train_x, train_y)
results = clf.predict(test_x)
assert len(results) == 100
assert len(clf.load_searcher().history) == 2
Constant.MAX_MODEL_NUM = 1
clf = TextClassifier(verbose=False, path=path, resume=False)
clf.fit(train_x, train_y)
results = clf.predict(test_x)
assert len(results) == 100
assert len(clf.load_searcher().history) == 1
clean_dir(path)
@patch('autokeras.text.text_supervised.temp_folder_generator', return_value='dummy_path/')
def test_init_image_classifier_with_none_path(_):
clf = TextClassifier()
assert clf.path == 'dummy_path/'
@patch('torch.multiprocessing.Pool', new=MockProcess)
@patch('autokeras.search.ModelTrainer.train_model', side_effect=mock_train)
@patch('autokeras.text.text_supervised.text_preprocess', side_effect=mock_text_preprocess)
def test_evaluate(_, _1):
Constant.MAX_ITER_NUM = 1
Constant.MAX_MODEL_NUM = 1
Constant.SEARCH_MAX_ITER = 1
Constant.T_MIN = 0.8
train_x = np.random.rand(100, 25, 25, 1)
train_y = np.random.randint(0, 5, 100)
path = 'tests/resources/temp'
clean_dir(path)
clf = TextClassifier(path=path, verbose=False, resume=False)
clf.n_epochs = 100
clf.fit(train_x, train_y)
score = clf.evaluate(train_x, train_y)
assert score <= 1.0
| 35.357143
| 90
| 0.72037
| 885
| 5,940
| 4.59096
| 0.123164
| 0.039872
| 0.037903
| 0.032488
| 0.805316
| 0.773566
| 0.764214
| 0.724342
| 0.697514
| 0.672902
| 0
| 0.038631
| 0.158923
| 5,940
| 167
| 91
| 35.568862
| 0.77462
| 0.011785
| 0
| 0.65493
| 0
| 0
| 0.148117
| 0.122209
| 0
| 0
| 0
| 0
| 0.098592
| 1
| 0.06338
| false
| 0
| 0.028169
| 0.007042
| 0.105634
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
3f54538303ab0d71dfe36f1b765709eebc8197ec
| 263
|
py
|
Python
|
downstream/Up-Down_VC/scripts/hdf5_2_bufile.py
|
alfred100p/VC-R-CNN
|
c887f5b6db6932fb5c828c8037e299ce5baadb9e
|
[
"MIT"
] | 344
|
2020-02-27T07:48:49.000Z
|
2022-02-02T10:37:49.000Z
|
downstream/Up-Down_VC/scripts/hdf5_2_bufile.py
|
aLefred0/VC-R-CNN
|
5b01e44618c406592184275b734d3fbd3f11234c
|
[
"MIT"
] | 18
|
2020-03-01T05:22:21.000Z
|
2021-08-12T15:06:34.000Z
|
downstream/Up-Down_VC/scripts/hdf5_2_bufile.py
|
aLefred0/VC-R-CNN
|
5b01e44618c406592184275b734d3fbd3f11234c
|
[
"MIT"
] | 59
|
2020-02-29T12:53:41.000Z
|
2022-03-07T02:17:35.000Z
|
import h5py
import numpy as np
file = h5py.File('/data2/wt/openimages/vc_feature/1coco_train_all_bu_2.hdf5', 'r')
for keys in file:
feature = file[keys]['feature'][:]
np.save('/data2/wt/openimages/vc_feature/coco_vc_all_bu/'+keys+'.npy', feature)
| 32.875
| 84
| 0.703422
| 43
| 263
| 4.093023
| 0.55814
| 0.079545
| 0.193182
| 0.215909
| 0.295455
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030702
| 0.13308
| 263
| 7
| 85
| 37.571429
| 0.741228
| 0
| 0
| 0
| 0
| 0
| 0.453125
| 0.40625
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
188f1f130969fc800f796f0f92d9c965c356079b
| 239
|
py
|
Python
|
my_portal/projects/apps.py
|
cgajagon/my_portal
|
cea810512528ea4ef30bbc7e14873fa25ed2f54f
|
[
"MIT"
] | null | null | null |
my_portal/projects/apps.py
|
cgajagon/my_portal
|
cea810512528ea4ef30bbc7e14873fa25ed2f54f
|
[
"MIT"
] | null | null | null |
my_portal/projects/apps.py
|
cgajagon/my_portal
|
cea810512528ea4ef30bbc7e14873fa25ed2f54f
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class ProjectsConfig(AppConfig):
name = 'my_portal.projects'
def ready(self):
try:
import my_portal.projects.signals # noqa F401
except ImportError:
pass
| 21.727273
| 58
| 0.635983
| 26
| 239
| 5.769231
| 0.807692
| 0.106667
| 0.213333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017857
| 0.297071
| 239
| 11
| 59
| 21.727273
| 0.875
| 0.037657
| 0
| 0
| 0
| 0
| 0.078603
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| false
| 0.125
| 0.375
| 0
| 0.75
| 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
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
18ee3c4330cd87d34002abb7f003a60e643b5bbc
| 160
|
py
|
Python
|
desafios/desafio021.py
|
EricBerlim/PYTHON
|
68a90fe89185f9ed09b89dd60547e696bf1a8082
|
[
"MIT"
] | null | null | null |
desafios/desafio021.py
|
EricBerlim/PYTHON
|
68a90fe89185f9ed09b89dd60547e696bf1a8082
|
[
"MIT"
] | null | null | null |
desafios/desafio021.py
|
EricBerlim/PYTHON
|
68a90fe89185f9ed09b89dd60547e696bf1a8082
|
[
"MIT"
] | null | null | null |
#REPRODUZIR ARQUIVO DE ÁUDIO
"""import pygame
pygame.init()
pygame.mixer.music.load('ex021.ogg')
pygame.mixer.music.play()
pygame.event.wait()"""
#NÃO DEU CERTO
| 22.857143
| 36
| 0.75
| 24
| 160
| 5
| 0.75
| 0.183333
| 0.266667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02027
| 0.075
| 160
| 7
| 37
| 22.857143
| 0.790541
| 0.94375
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
e14e62e9cf89812a6eb1b45884ad26819169d01a
| 166
|
py
|
Python
|
mathcrypto/cryptography/__init__.py
|
czechbol/mathcrypto
|
7d415be0d3207ab00b7f0837134462e2a216d3ce
|
[
"MIT"
] | 2
|
2021-12-29T13:11:34.000Z
|
2022-01-09T18:42:40.000Z
|
mathcrypto/cryptography/__init__.py
|
czechbol/mathcrypto
|
7d415be0d3207ab00b7f0837134462e2a216d3ce
|
[
"MIT"
] | 5
|
2021-04-30T09:02:43.000Z
|
2021-10-01T09:17:03.000Z
|
mathcrypto/cryptography/__init__.py
|
czechbol/mathcrypto
|
7d415be0d3207ab00b7f0837134462e2a216d3ce
|
[
"MIT"
] | null | null | null |
from .primes import Primes # noqa: F401
from .diffie_hellman import DHCryptosystem, DHCracker # noqa: F401
from .elliptic_curves import EllipticCurve # noqa: F401
| 41.5
| 67
| 0.789157
| 21
| 166
| 6.142857
| 0.571429
| 0.186047
| 0.186047
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.06383
| 0.150602
| 166
| 3
| 68
| 55.333333
| 0.851064
| 0.192771
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
e17e0d7c7a8f6ec0014c447c83cd68be275f4cbf
| 92
|
py
|
Python
|
modules/python-codes/modules/modules-packages/sound/effects/echo.py
|
drigols/Studies
|
9c293156935b491ded24be6b511daac67fd43538
|
[
"MIT"
] | 1
|
2020-09-06T22:17:19.000Z
|
2020-09-06T22:17:19.000Z
|
modules/python-codes/modules/modules-packages/sound/effects/echo.py
|
drigols/Studies
|
9c293156935b491ded24be6b511daac67fd43538
|
[
"MIT"
] | null | null | null |
modules/python-codes/modules/modules-packages/sound/effects/echo.py
|
drigols/Studies
|
9c293156935b491ded24be6b511daac67fd43538
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
def echofilter():
print("OK, 'echofilter()' function executed!")
| 18.4
| 48
| 0.608696
| 10
| 92
| 5.6
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012821
| 0.152174
| 92
| 4
| 49
| 23
| 0.705128
| 0.228261
| 0
| 0
| 0
| 0
| 0.536232
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0
| 0
| 0.5
| 0.5
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
e1b2c10bb93bb51cad492f25a510eac064e607ba
| 112
|
py
|
Python
|
py_tdlib/constructors/delete_passport_element.py
|
Mr-TelegramBot/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 24
|
2018-10-05T13:04:30.000Z
|
2020-05-12T08:45:34.000Z
|
py_tdlib/constructors/delete_passport_element.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 3
|
2019-06-26T07:20:20.000Z
|
2021-05-24T13:06:56.000Z
|
py_tdlib/constructors/delete_passport_element.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 5
|
2018-10-05T14:29:28.000Z
|
2020-08-11T15:04:10.000Z
|
from ..factory import Method
class deletePassportElement(Method):
type = None # type: "PassportElementType"
| 18.666667
| 43
| 0.767857
| 11
| 112
| 7.818182
| 0.818182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 112
| 5
| 44
| 22.4
| 0.895833
| 0.241071
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.333333
| 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
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
e1b79d8f1de00e5ff8e8c969d4574344ea6181a5
| 319
|
py
|
Python
|
l10n_br_point_of_sale/models/__init__.py
|
kaoecoito/odoo-brasil
|
6e019efc4e03b2e7be6ca51d08ace095240e0f07
|
[
"MIT"
] | 181
|
2016-11-11T04:39:43.000Z
|
2022-03-14T21:17:19.000Z
|
l10n_br_point_of_sale/models/__init__.py
|
kaoecoito/odoo-brasil
|
6e019efc4e03b2e7be6ca51d08ace095240e0f07
|
[
"MIT"
] | 899
|
2016-11-14T02:42:56.000Z
|
2022-03-29T20:47:39.000Z
|
l10n_br_point_of_sale/models/__init__.py
|
kaoecoito/odoo-brasil
|
6e019efc4e03b2e7be6ca51d08ace095240e0f07
|
[
"MIT"
] | 227
|
2016-11-10T17:16:59.000Z
|
2022-03-26T16:46:38.000Z
|
# -*- coding: utf-8 -*-
# © 2016 Alessandro Fernandes Martini <alessandrofmartini@gmail.com>, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import pos_order
from . import pos_session
from . import invoice_eletronic
from . import account_journal
from . import pos_payment_method
| 31.9
| 79
| 0.76489
| 46
| 319
| 5.195652
| 0.76087
| 0.209205
| 0.16318
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02509
| 0.125392
| 319
| 9
| 80
| 35.444444
| 0.827957
| 0.520376
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
e1cf79962d90bf2d46b4cb5eca776b35133187c6
| 1,604
|
py
|
Python
|
src/sim_components/progressbar.py
|
Meridian-Onset/redwood-violet
|
91be6cdd302b2c319a8f1972c20e431de19b3715
|
[
"MIT"
] | null | null | null |
src/sim_components/progressbar.py
|
Meridian-Onset/redwood-violet
|
91be6cdd302b2c319a8f1972c20e431de19b3715
|
[
"MIT"
] | null | null | null |
src/sim_components/progressbar.py
|
Meridian-Onset/redwood-violet
|
91be6cdd302b2c319a8f1972c20e431de19b3715
|
[
"MIT"
] | null | null | null |
import sys
def update_progresswtime(progress, totime, operation, remainops):
estime = totime * remainops
barLength = 40 # Modify this to change the length of the progress bar
status = ""
if isinstance(progress, int):
progress = float(progress)
status = ('Estimated time to completion: {0}m {1}s'.format(int((estime-estime % 60)/60), int(estime % 60)))
if not isinstance(progress, float):
progress = 0
status = "error: progress var must be float\r\n"
if progress < 0:
progress = 0
status = "Halt...\r\n"
if progress >= 1:
progress = 1
status = "{} Completed...\r\n".format(operation)
block = int(round(barLength*progress))
text = "\rPercent: [{0}] {1}% {2} ".format("#"*block + "-"*(barLength-block), round(progress*100, 3), status)
sys.stdout.write(text)
sys.stdout.flush()
def update_progress(progress, operation):
barLength = 40 # Modify this to change the length of the progress bar dynamically
status = ""
if isinstance(progress, int):
progress = float(progress)
if not isinstance(progress, float):
progress = 0
status = "error: progress var must be float\r\n"
if progress < 0:
progress = 0
status = "Halt...\r\n"
if progress >= 1:
progress = 1
status = "{} Completed...\r\n".format(operation)
block = int(round(barLength*progress))
text = "\rPercent: [{0}] {1}% {2} ".format("#"*block + "-"*(barLength-block), round(progress*100, 3), status)
sys.stdout.write(text)
sys.stdout.flush()
| 32.734694
| 115
| 0.605985
| 200
| 1,604
| 4.85
| 0.27
| 0.05567
| 0.086598
| 0.049485
| 0.793814
| 0.793814
| 0.793814
| 0.793814
| 0.690722
| 0.690722
| 0
| 0.029801
| 0.246883
| 1,604
| 48
| 116
| 33.416667
| 0.773179
| 0.072943
| 0
| 0.871795
| 0
| 0
| 0.154313
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.051282
| false
| 0
| 0.025641
| 0
| 0.076923
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
becbce0959735ae877f4d1a4523e326aa3aa987f
| 31
|
py
|
Python
|
Demo_XRD_patterns_from_dpp/model/__init__.py
|
SHDShim/PMatRes
|
92440c11f2723861dbb82cecdc321fcef9de4443
|
[
"Apache-2.0"
] | 15
|
2017-09-02T13:55:35.000Z
|
2022-03-26T08:20:16.000Z
|
Demo_XRD_patterns_from_dpp/model/__init__.py
|
SHDShim/PMatRes
|
92440c11f2723861dbb82cecdc321fcef9de4443
|
[
"Apache-2.0"
] | null | null | null |
Demo_XRD_patterns_from_dpp/model/__init__.py
|
SHDShim/PMatRes
|
92440c11f2723861dbb82cecdc321fcef9de4443
|
[
"Apache-2.0"
] | 2
|
2018-05-16T13:32:08.000Z
|
2019-06-16T08:09:38.000Z
|
from .model import PeakPoModel
| 15.5
| 30
| 0.83871
| 4
| 31
| 6.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.129032
| 31
| 1
| 31
| 31
| 0.962963
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
8335d300f3e02e67c926da2418922410f872e81b
| 133
|
py
|
Python
|
11_Day_Functions/7.py
|
diegofregolente/30-Days-Of-Python
|
e0cad31f6d5ab1384ad6fa5a5d24a84771d6c267
|
[
"Apache-2.0"
] | null | null | null |
11_Day_Functions/7.py
|
diegofregolente/30-Days-Of-Python
|
e0cad31f6d5ab1384ad6fa5a5d24a84771d6c267
|
[
"Apache-2.0"
] | null | null | null |
11_Day_Functions/7.py
|
diegofregolente/30-Days-Of-Python
|
e0cad31f6d5ab1384ad6fa5a5d24a84771d6c267
|
[
"Apache-2.0"
] | null | null | null |
def calculated_quadratic_equation(a = 0, b = 0, c = 0):
r = a ** 2 + b + c
return r
print(calculated_quadratic_equation())
| 19
| 55
| 0.631579
| 21
| 133
| 3.809524
| 0.571429
| 0.475
| 0.675
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.039604
| 0.240602
| 133
| 6
| 56
| 22.166667
| 0.752475
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.5
| 0.25
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
83401616dfc8cb8b6848d004b28bccb91f6204f8
| 10,068
|
py
|
Python
|
test/test_distance.py
|
GustavoPeredo/jaro-winkler-distance
|
2b97c6fea03e7b469b6065f13c71ce734d1758cf
|
[
"Apache-2.0"
] | null | null | null |
test/test_distance.py
|
GustavoPeredo/jaro-winkler-distance
|
2b97c6fea03e7b469b6065f13c71ce734d1758cf
|
[
"Apache-2.0"
] | null | null | null |
test/test_distance.py
|
GustavoPeredo/jaro-winkler-distance
|
2b97c6fea03e7b469b6065f13c71ce734d1758cf
|
[
"Apache-2.0"
] | null | null | null |
import sys
from pyjarowinkler import distance
if sys.version_info[:2] > (2, 7):
from pyjarowinkler import cydistance
import unittest
__author__ = 'Jean-Bernard Ratte - jean.bernard.ratte@unary.ca'
class TestDistance(unittest.TestCase):
def test_get_jaro_distance(self):
self.assertEqual(0.0, distance.get_jaro_distance("fly", "ant"))
self.assertEqual(0.44, distance.get_jaro_distance("elephant", "hippo"))
self.assertEqual(0.91, distance.get_jaro_distance("ABC Corporation", "ABC Corp"))
self.assertEqual(0.9, distance.get_jaro_distance("PENNSYLVANIA", "PENNCISYLVNIA"))
self.assertEqual(0.93, distance.get_jaro_distance("D N H Enterprises Inc", "D & H Enterprises, Inc."))
self.assertEqual(0.94, distance.get_jaro_distance("My Gym Children's Fitness Center",
"My Gym. Childrens Fitness"))
def test_get_jaro_cydistance(self):
if sys.version_info[:2] > (2, 7):
self.assertEqual(0.0, cydistance.get_jaro_distance("fly", "ant"))
self.assertEqual(0.44, cydistance.get_jaro_distance("elephant", "hippo"))
self.assertEqual(0.91, cydistance.get_jaro_distance("ABC Corporation", "ABC Corp"))
self.assertEqual(0.9, cydistance.get_jaro_distance("PENNSYLVANIA", "PENNCISYLVNIA"))
self.assertEqual(0.93, cydistance.get_jaro_distance("D N H Enterprises Inc",
"D & H Enterprises, Inc."))
self.assertEqual(0.94, cydistance.get_jaro_distance("My Gym Children's Fitness Center",
"My Gym. Childrens Fitness"))
def test_get_jaro_distance_raises(self):
self.assertRaises(distance.JaroDistanceException, distance.get_jaro_distance, None, None)
self.assertRaises(distance.JaroDistanceException, distance.get_jaro_distance, " ", None)
self.assertRaises(distance.JaroDistanceException, distance.get_jaro_distance, None, "")
def test_transposition(self):
self.assertEqual(distance._transpositions("", ""), 0)
self.assertEqual(distance._transpositions("PENNSYLVANIA", "PENNCISYLVNIA"), 4)
def test_get_diff_index(self):
self.assertEqual(distance._get_diff_index(None, None), -1)
self.assertEqual(distance._get_diff_index("", ""), -1)
self.assertEqual(distance._get_diff_index("", "abc"), 0)
self.assertEqual(distance._get_diff_index("abc", ""), 0)
self.assertEqual(distance._get_diff_index("abc", "abc"), -1)
self.assertEqual(distance._get_diff_index("ab", "abxyz"), 2)
self.assertEqual(distance._get_diff_index("abcde", "xyz"), 0)
self.assertEqual(distance._get_diff_index("abcde", "abxyz"), 2)
def test_get_matching_characters(self):
self.assertEqual(distance._get_matching_characters("hello", "halloa"), "hllo")
self.assertEqual(distance._get_matching_characters("ABC Corporation",
"ABC Corp"), "ABC Corp")
self.assertEqual(distance._get_matching_characters("PENNSYLVANIA",
"PENNCISYLVNIA"), "PENNSYLVANI")
self.assertEqual(distance._get_matching_characters("My Gym Children's Fitness Center",
"My Gym. Childrens Fitness"), "My Gym Childrens Fitness")
self.assertEqual(distance._get_matching_characters("D N H Enterprises Inc",
"D & H Enterprises, Inc."), "D H Enterprises Inc")
def test_get_prefix(self):
self.assertEqual(distance._get_prefix(None, None), "")
self.assertEqual(distance._get_prefix("", ""), "")
self.assertEqual(distance._get_prefix("", None), "")
self.assertEqual(distance._get_prefix("", "abc"), "")
self.assertEqual(distance._get_prefix("abc", ""), "")
self.assertEqual(distance._get_prefix("abc", "abc"), "abc")
self.assertEqual(distance._get_prefix("abc", "a"), "a")
self.assertEqual(distance._get_prefix("ab", "abxyz"), "ab")
self.assertEqual(distance._get_prefix("abcde", "abxyz"), "ab")
self.assertEqual(distance._get_prefix("abcde", "xyz"), "")
self.assertEqual(distance._get_prefix("xyz", "abcde"), "")
self.assertEqual(distance._get_prefix("i am a machine", "i am a robot"), "i am a ")
def test_score(self):
self.assertEqual(distance._score("", ""), 0.0)
self.assertEqual(distance._score("", "a"), 0.0)
self.assertEqual(distance._score("ZDVSXA", "ZWEIUHFSAD"), 0.5111111111111111)
self.assertEqual(distance._score("aaapppp", ""), 0.0)
self.assertEqual(distance._score("fly", "ant"), 0.0)
self.assertEqual(distance._score("elephant", "hippo"), 0.44166666666666665)
self.assertEqual(distance._score("hippo", "elephant"), 0.44166666666666665)
self.assertEqual(distance._score("hippo", "zzzzzzzz"), 0.0)
self.assertEqual(distance._score("hello", "hallo"), 0.8666666666666667)
self.assertEqual(distance._score("ABC Corporation", "ABC Corp"), 0.8444444444444444)
self.assertEqual(distance._score("PENNSYLVANIA", "PENNCISYLVNIA"), 0.8300310800310801)
self.assertEqual(distance._score("My Gym Children's Fitness Center",
"My Gym. Childrens Fitness"), 0.9033333333333333)
self.assertEqual(distance._score("D N H Enterprises Inc", "D & H Enterprises, Inc."), 0.9073153899240856)
def test_get_jaro_without_winkler(self):
self.assertEqual(distance.get_jaro_distance("ZDVSXA", "ZWEIUHFSAD",
winkler_ajustment=False), 0.5111111111111111)
self.assertEqual(distance.get_jaro_distance("frog", "fog",
winkler_ajustment=False), 0.9166666666666666)
self.assertEqual(distance.get_jaro_distance("fly", "ant",
winkler_ajustment=False), 0.0)
self.assertEqual(distance.get_jaro_distance("elephant", "hippo",
winkler_ajustment=False), 0.44166666666666665)
self.assertEqual(distance.get_jaro_distance("hippo", "elephant",
winkler_ajustment=False), 0.44166666666666665)
self.assertEqual(distance.get_jaro_distance("hippo", "zzzzzzzz",
winkler_ajustment=False), 0.0)
self.assertEqual(distance.get_jaro_distance("hello", "hallo",
winkler_ajustment=False), 0.8666666666666667)
self.assertEqual(distance.get_jaro_distance("ABC Corporation", "ABC Corp",
winkler_ajustment=False), 0.8444444444444444)
self.assertEqual(distance.get_jaro_distance("PENNSYLVANIA", "PENNCISYLVNIA",
winkler_ajustment=False), 0.8300310800310801)
self.assertEqual(distance.get_jaro_distance("My Gym Children's Fitness Center",
"My Gym. Childrens Fitness",
winkler_ajustment=False), 0.9033333333333333)
self.assertEqual(distance.get_jaro_distance("D N H Enterprises Inc",
"D & H Enterprises, Inc.",
winkler_ajustment=False), 0.9073153899240856)
def test_get_jaro_without_winkler_cy(self):
if sys.version_info[:2] > (2, 7):
self.assertEqual(cydistance.get_jaro_distance("ZDVSXA", "ZWEIUHFSAD",
winkler_ajustment=False), 0.5111111111111111)
self.assertEqual(cydistance.get_jaro_distance("frog", "fog",
winkler_ajustment=False), 0.9166666666666666)
self.assertEqual(cydistance.get_jaro_distance("fly", "ant",
winkler_ajustment=False), 0.0)
self.assertEqual(cydistance.get_jaro_distance("elephant", "hippo",
winkler_ajustment=False), 0.44166666666666665)
self.assertEqual(cydistance.get_jaro_distance("hippo", "elephant",
winkler_ajustment=False), 0.44166666666666665)
self.assertEqual(cydistance.get_jaro_distance("hippo", "zzzzzzzz",
winkler_ajustment=False), 0.0)
self.assertEqual(cydistance.get_jaro_distance("hello", "hallo",
winkler_ajustment=False), 0.8666666666666667)
self.assertEqual(cydistance.get_jaro_distance("ABC Corporation", "ABC Corp",
winkler_ajustment=False), 0.8444444444444444)
self.assertEqual(cydistance.get_jaro_distance("PENNSYLVANIA", "PENNCISYLVNIA",
winkler_ajustment=False), 0.8300310800310801)
self.assertEqual(cydistance.get_jaro_distance("My Gym Children's Fitness Center",
"My Gym. Childrens Fitness",
winkler_ajustment=False), 0.9033333333333333)
self.assertEqual(cydistance.get_jaro_distance("D N H Enterprises Inc",
"D & H Enterprises, Inc.",
winkler_ajustment=False), 0.9073153899240856)
if __name__ == '__main__':
unittest.main()
| 68.489796
| 116
| 0.579559
| 970
| 10,068
| 5.790722
| 0.106186
| 0.197614
| 0.20883
| 0.166637
| 0.862204
| 0.801317
| 0.684885
| 0.626313
| 0.591241
| 0.515756
| 0
| 0.074101
| 0.307012
| 10,068
| 146
| 117
| 68.958904
| 0.730973
| 0
| 0
| 0.234848
| 0
| 0
| 0.144418
| 0.002682
| 0
| 0
| 0
| 0
| 0.583333
| 1
| 0.075758
| false
| 0
| 0.030303
| 0
| 0.113636
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
55cd77f575ac0920065e264e58c3676cbe6f7159
| 73
|
py
|
Python
|
core/multi_thread/__init__.py
|
caserwin/daily-learning-python
|
01fea4c5d4e86cbea2dbef8817146f018b5f1479
|
[
"Apache-2.0"
] | 1
|
2019-05-04T07:27:18.000Z
|
2019-05-04T07:27:18.000Z
|
core/multi_thread/__init__.py
|
caserwin/daily-learning-python
|
01fea4c5d4e86cbea2dbef8817146f018b5f1479
|
[
"Apache-2.0"
] | null | null | null |
core/multi_thread/__init__.py
|
caserwin/daily-learning-python
|
01fea4c5d4e86cbea2dbef8817146f018b5f1479
|
[
"Apache-2.0"
] | 1
|
2018-09-20T01:49:36.000Z
|
2018-09-20T01:49:36.000Z
|
# -*- coding: utf-8 -*-
# @Time : 2018/8/4 下午2:33
# @Author : yidxue
| 18.25
| 28
| 0.506849
| 11
| 73
| 3.363636
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 0.246575
| 73
| 3
| 29
| 24.333333
| 0.490909
| 0.90411
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
55e3acda4bfa74b251f5397af8c0aca0eb9ee2df
| 1,642
|
py
|
Python
|
plotting/enrolment_live_birth.py
|
woojiahao/pds-analysis
|
d84c8353b7f7323d673c530e0d414d87f80d5384
|
[
"MIT"
] | 4
|
2018-08-10T13:56:58.000Z
|
2020-04-09T13:32:08.000Z
|
plotting/enrolment_live_birth.py
|
woojiahao/pds-analysis
|
d84c8353b7f7323d673c530e0d414d87f80d5384
|
[
"MIT"
] | null | null | null |
plotting/enrolment_live_birth.py
|
woojiahao/pds-analysis
|
d84c8353b7f7323d673c530e0d414d87f80d5384
|
[
"MIT"
] | null | null | null |
import pygal
from plotting.custom_styles import style
from plotting.plot import Plot
class EnrolmentLiveBirth:
def __init__(self, engine):
self.engine = engine
def plot_wrong_scatter(self):
scatter_plot = pygal.XY(
stroke=False,
style=style,
show_legend=False,
x_title='Live Birth Rate',
y_title='Primary Enrolment')
scatter_plot.title = 'Correlation between Primary Enrolment and Live Birth Rate'
scatter_plot.add('Correlation', self.query_data('wrong'))
scatter_plot.render_to_file(Plot.generate_plot_name('correlation_enrolment_live_birth_wrong'))
def plot_right_scatter(self):
scatter_plot = pygal.XY(
stroke=False,
style=style,
show_legend=False,
x_title='Live Birth Rate',
y_title='Primary Enrolment')
scatter_plot.title = 'Correlation between Primary Enrolment and Live Birth Rate'
scatter_plot.add('Correlation', self.query_data('right'))
scatter_plot.render_to_file(Plot.generate_plot_name('correlation_enrolment_live_birth_right'))
def query_data(self, version):
if version == 'wrong':
query = 'SELECT e.year, lb.total, SUM(e.enrolment) ' \
'FROM enrolment AS e, live_births AS lb ' \
'WHERE e.year = lb.year AND lb.type=\'Total Live-births\' ' \
'GROUP BY e.year, lb.total ' \
'ORDER BY year;'
else:
query = 'SELECT e.year, lb.total, SUM(e.enrolment) ' \
'FROM enrolment AS e, live_births AS lb ' \
'WHERE e.year = lb.year + 6 AND lb.type=\'Total Live-births\' ' \
'GROUP BY e.year, lb.total ' \
'ORDER BY year;'
print(query)
result = self.engine.execute(query)
return [(row['total'], row['sum']) for row in result]
| 32.84
| 96
| 0.71011
| 238
| 1,642
| 4.714286
| 0.273109
| 0.078431
| 0.037433
| 0.042781
| 0.745098
| 0.745098
| 0.745098
| 0.745098
| 0.745098
| 0.745098
| 0
| 0.000732
| 0.168088
| 1,642
| 49
| 97
| 33.510204
| 0.820644
| 0
| 0
| 0.52381
| 0
| 0
| 0.376979
| 0.046285
| 0
| 0
| 0
| 0
| 0
| 1
| 0.095238
| false
| 0
| 0.071429
| 0
| 0.214286
| 0.02381
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
55ff871ba307e490e724d9f1ca7297ef4970b553
| 112
|
py
|
Python
|
cursoguanabara/desafios/pacote-projeto-d010/quizz.py
|
amauriraimundo/html-css
|
cc0b5bc7819e1423761afaab4bd8a63c12d8c0fb
|
[
"MIT"
] | null | null | null |
cursoguanabara/desafios/pacote-projeto-d010/quizz.py
|
amauriraimundo/html-css
|
cc0b5bc7819e1423761afaab4bd8a63c12d8c0fb
|
[
"MIT"
] | null | null | null |
cursoguanabara/desafios/pacote-projeto-d010/quizz.py
|
amauriraimundo/html-css
|
cc0b5bc7819e1423761afaab4bd8a63c12d8c0fb
|
[
"MIT"
] | null | null | null |
n=6
while n >0:
n-=1
if n % 2 ==0:
print(n, end ="")
if n % 3 == 0:
print(n, end='')
| 16
| 25
| 0.348214
| 21
| 112
| 1.857143
| 0.47619
| 0.153846
| 0.358974
| 0.512821
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.109375
| 0.428571
| 112
| 7
| 26
| 16
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.285714
| 1
| 0
| 1
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
3612961470254ce752b1ebc6cf4826d37207e8f4
| 3,187
|
py
|
Python
|
tests/oxml/unitdata/text.py
|
revvsales/python-docx-1
|
5b3ff2b828cc30f1567cb1682a8cb399143732d7
|
[
"MIT"
] | 3,031
|
2015-01-02T11:11:24.000Z
|
2022-03-30T00:57:17.000Z
|
tests/oxml/unitdata/text.py
|
revvsales/python-docx-1
|
5b3ff2b828cc30f1567cb1682a8cb399143732d7
|
[
"MIT"
] | 934
|
2015-01-06T20:53:56.000Z
|
2022-03-28T10:08:03.000Z
|
tests/oxml/unitdata/text.py
|
revvsales/python-docx-1
|
5b3ff2b828cc30f1567cb1682a8cb399143732d7
|
[
"MIT"
] | 901
|
2015-01-07T18:22:07.000Z
|
2022-03-31T18:38:51.000Z
|
# encoding: utf-8
"""
Test data builders for text XML elements
"""
from ...unitdata import BaseBuilder
from .shared import CT_OnOffBuilder, CT_StringBuilder
class CT_BrBuilder(BaseBuilder):
__tag__ = 'w:br'
__nspfxs__ = ('w',)
__attrs__ = ('w:type', 'w:clear')
class CT_EmptyBuilder(BaseBuilder):
__nspfxs__ = ('w',)
__attrs__ = ()
def __init__(self, tag):
self.__tag__ = tag
super(CT_EmptyBuilder, self).__init__()
class CT_JcBuilder(BaseBuilder):
__tag__ = 'w:jc'
__nspfxs__ = ('w',)
__attrs__ = ('w:val',)
class CT_PBuilder(BaseBuilder):
__tag__ = 'w:p'
__nspfxs__ = ('w',)
__attrs__ = ()
class CT_PPrBuilder(BaseBuilder):
__tag__ = 'w:pPr'
__nspfxs__ = ('w',)
__attrs__ = ()
class CT_RBuilder(BaseBuilder):
__tag__ = 'w:r'
__nspfxs__ = ('w',)
__attrs__ = ()
class CT_RPrBuilder(BaseBuilder):
__tag__ = 'w:rPr'
__nspfxs__ = ('w',)
__attrs__ = ()
class CT_SectPrBuilder(BaseBuilder):
__tag__ = 'w:sectPr'
__nspfxs__ = ('w',)
__attrs__ = ()
class CT_TextBuilder(BaseBuilder):
__tag__ = 'w:t'
__nspfxs__ = ('w',)
__attrs__ = ()
def with_space(self, value):
self._set_xmlattr('xml:space', str(value))
return self
class CT_UnderlineBuilder(BaseBuilder):
__tag__ = 'w:u'
__nspfxs__ = ('w',)
__attrs__ = (
'w:val', 'w:color', 'w:themeColor', 'w:themeTint', 'w:themeShade'
)
def a_b():
return CT_OnOffBuilder('w:b')
def a_bCs():
return CT_OnOffBuilder('w:bCs')
def a_br():
return CT_BrBuilder()
def a_caps():
return CT_OnOffBuilder('w:caps')
def a_cr():
return CT_EmptyBuilder('w:cr')
def a_cs():
return CT_OnOffBuilder('w:cs')
def a_dstrike():
return CT_OnOffBuilder('w:dstrike')
def a_jc():
return CT_JcBuilder()
def a_noProof():
return CT_OnOffBuilder('w:noProof')
def a_shadow():
return CT_OnOffBuilder('w:shadow')
def a_smallCaps():
return CT_OnOffBuilder('w:smallCaps')
def a_snapToGrid():
return CT_OnOffBuilder('w:snapToGrid')
def a_specVanish():
return CT_OnOffBuilder('w:specVanish')
def a_strike():
return CT_OnOffBuilder('w:strike')
def a_tab():
return CT_EmptyBuilder('w:tab')
def a_vanish():
return CT_OnOffBuilder('w:vanish')
def a_webHidden():
return CT_OnOffBuilder('w:webHidden')
def a_p():
return CT_PBuilder()
def a_pPr():
return CT_PPrBuilder()
def a_pStyle():
return CT_StringBuilder('w:pStyle')
def a_sectPr():
return CT_SectPrBuilder()
def a_t():
return CT_TextBuilder()
def a_u():
return CT_UnderlineBuilder()
def an_emboss():
return CT_OnOffBuilder('w:emboss')
def an_i():
return CT_OnOffBuilder('w:i')
def an_iCs():
return CT_OnOffBuilder('w:iCs')
def an_imprint():
return CT_OnOffBuilder('w:imprint')
def an_oMath():
return CT_OnOffBuilder('w:oMath')
def an_outline():
return CT_OnOffBuilder('w:outline')
def an_r():
return CT_RBuilder()
def an_rPr():
return CT_RPrBuilder()
def an_rStyle():
return CT_StringBuilder('w:rStyle')
def an_rtl():
return CT_OnOffBuilder('w:rtl')
| 15.17619
| 73
| 0.644179
| 406
| 3,187
| 4.539409
| 0.211823
| 0.143245
| 0.217037
| 0.227889
| 0.068909
| 0
| 0
| 0
| 0
| 0
| 0
| 0.000398
| 0.210857
| 3,187
| 209
| 74
| 15.248804
| 0.732406
| 0.017885
| 0
| 0.147826
| 0
| 0
| 0.095772
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.304348
| false
| 0
| 0.017391
| 0.286957
| 0.956522
| 0.017391
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
364c0930b2b58a1c4b4166095ff97b540c1140dc
| 133
|
py
|
Python
|
youmin_textclassifier/features/__init__.py
|
WENGIF/youmin_textclassifier
|
15410aaba009019ec387a8e64aec4734ae396922
|
[
"Apache-2.0"
] | 3
|
2019-12-27T04:32:37.000Z
|
2022-03-18T13:27:50.000Z
|
youmin_textclassifier/features/__init__.py
|
WENGIF/youmin_textclassifier
|
15410aaba009019ec387a8e64aec4734ae396922
|
[
"Apache-2.0"
] | null | null | null |
youmin_textclassifier/features/__init__.py
|
WENGIF/youmin_textclassifier
|
15410aaba009019ec387a8e64aec4734ae396922
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
from .generator import token_to_vec, token_to_file
__all__ = [
"token_to_vec",
"token_to_file",
]
| 13.3
| 50
| 0.646617
| 19
| 133
| 3.894737
| 0.578947
| 0.378378
| 0.27027
| 0.405405
| 0.567568
| 0.567568
| 0
| 0
| 0
| 0
| 0
| 0.009434
| 0.203008
| 133
| 9
| 51
| 14.777778
| 0.688679
| 0.157895
| 0
| 0
| 0
| 0
| 0.227273
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 0
| 0.2
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
364ec8c0d0cb1f5298a06385dbe94b2b853b7304
| 31
|
py
|
Python
|
Core/brainSeg/__init__.py
|
YongLiuLab/BrainRadiomicsTools
|
19b440acd554ee920857c306442b6d2c411dca88
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 10
|
2019-09-26T03:12:52.000Z
|
2022-02-25T06:05:38.000Z
|
Core/brainSeg/__init__.py
|
YongLiuLab/BrainRadiomicsTools
|
19b440acd554ee920857c306442b6d2c411dca88
|
[
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
Core/brainSeg/__init__.py
|
YongLiuLab/BrainRadiomicsTools
|
19b440acd554ee920857c306442b6d2c411dca88
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 8
|
2020-02-26T01:54:48.000Z
|
2022-03-19T01:23:55.000Z
|
from . brainSeg import brainSeg
| 31
| 31
| 0.83871
| 4
| 31
| 6.5
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.129032
| 31
| 1
| 31
| 31
| 0.962963
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
3660c3038f012e8e9f7275e104a1384c245a2547
| 23,732
|
py
|
Python
|
pyj2d/vector.py
|
Pandinosaurus/pyj2d
|
feb138668e81747dfd9382630eadbe06c735f459
|
[
"MIT"
] | 1
|
2019-05-31T14:03:10.000Z
|
2019-05-31T14:03:10.000Z
|
pyj2d/vector.py
|
Pandinosaurus/pyj2d
|
feb138668e81747dfd9382630eadbe06c735f459
|
[
"MIT"
] | null | null | null |
pyj2d/vector.py
|
Pandinosaurus/pyj2d
|
feb138668e81747dfd9382630eadbe06c735f459
|
[
"MIT"
] | null | null | null |
#PyJ2D - Copyright (C) 2011 James Garnon <https://gatc.ca/>
#Released under the MIT License <https://opensource.org/licenses/MIT>
from __future__ import generators
from math import sqrt, sin, cos, atan2, pi
class Vector2(object):
"""
Vector2 - 2-dimensional vector.
"""
__slots__ = ['_x', '_y']
def __init__(self, *args, **kwargs):
l = len(args)
if l == 2:
self._x = float(args[0])
self._y = float(args[1])
elif l == 1:
if isinstance(args[0], (int, float)):
self._x = float(args[0])
self._y = float(args[0])
else:
self._x = float(args[0][0])
self._y = float(args[0][1])
else:
if kwargs:
if 'x' in kwargs and 'y' in kwargs:
self._x = float(kwargs['x'])
self._y = float(kwargs['y'])
elif 'x' in kwargs:
self._x = float(kwargs['x'])
self._y = float(kwargs['x'])
else:
self._x = float(kwargs['y'])
self._y = float(kwargs['y'])
else:
self._x = 0.0
self._y = 0.0
def _get_x(self):
return self._x
def _set_x(self, val):
try:
self._x = float(val)
except ValueError:
raise TypeError('float is required')
def _del_x(self):
raise TypeError('Cannot delete the x attribute')
def _get_y(self):
return self._y
def _set_y(self, val):
try:
self._y = float(val)
except ValueError:
raise TypeError('float is required')
def _del_y(self):
raise TypeError('Cannot delete the y attribute')
x = property(_get_x, _set_x, _del_x)
y = property(_get_y, _set_y, _del_y)
def __str__(self):
return '[%g, %g]' % (self._x, self._y)
def __repr__(self):
return '<%s(%g, %g)>' % (self.__class__.__name__, self._x, self._y)
def __getitem__(self, index):
if index in (0, -2):
return self._x
elif index in (1, -1):
return self._y
elif isinstance(index, slice):
return [self._x, self._y][index]
else:
raise IndexError
def __setitem__(self, index, val):
if index == 0:
try:
self._x = float(val)
except ValueError:
raise TypeError
elif index == 1:
try:
self._y = float(val)
except ValueError:
raise TypeError
elif isinstance(index, slice):
l = [self._x, self._y]
l[index] = val
if len(l) != 2:
raise ValueError
self._x = float(l[0])
self._y = float(l[1])
else:
raise IndexError
def __delitem__(self, index):
raise TypeError('Deletion of vector components is not supported')
def __getslice__(self, start, stop):
return [self._x, self._y][start:stop]
def __setslice__(self, lower, upper, val):
l = [self._x, self._y]
l[lower:upper] = val
if len(l) != 2:
raise ValueError
self._x = float(l[0])
self._y = float(l[1])
def __iter__(self):
for val in (self._x, self._y):
yield val
def __len__(self):
return 2
def __bool__(self):
return bool(self._x or self._y)
def __nonzero__(self):
return bool(self._x or self._y)
def dot(self, vector):
"""
Return dot product with other vector.
"""
return (self._x * vector[0]) + (self._y * vector[1])
def cross(self, vector):
"""
Return cross product with other vector.
"""
return (self._x * vector[1]) - (self._y * vector[0])
def magnitude(self):
"""
Return magnitude of vector.
"""
return sqrt((self._x**2) + (self._y**2))
def magnitude_squared(self):
"""
Return squared magnitude of vector.
"""
return ((self._x**2) + (self._y**2))
def length(self):
"""
Return length of vector.
"""
return sqrt((self._x**2) + (self._y**2))
def length_squared(self):
"""
Return squared length of vector.
"""
return ((self._x**2) + (self._y**2))
def normalize(self):
"""
Return normalized vector.
"""
mag = self.magnitude()
if mag == 0:
raise ValueError('Cannot normalize vector of zero length')
return Vector2(self._x/mag, self._y/mag)
def normalize_ip(self):
"""
Normalized this vector.
"""
mag = self.magnitude()
if mag == 0:
raise ValueError('Cannot normalize vector of zero length')
self._x /= mag
self._y /= mag
return None
def is_normalized(self):
"""
Check whether vector is normalized.
"""
return self.magnitude() == 1
def scale_to_length(self, length):
"""
Scale vector to length.
"""
mag = self.magnitude()
if mag == 0:
raise ValueError('Cannot scale vector of zero length')
self._x = (self._x/mag) * length
self._y = (self._y/mag) * length
return None
def reflect(self, vector):
"""
Return reflected vector at given vector.
"""
vn = (self._x * vector[0]) + (self._y * vector[1])
nn = (vector[0] * vector[0]) + (vector[1] * vector[1])
if nn == 0:
raise ValueError('Cannot reflect from normal of zero length')
c = 2 * vn/nn
return Vector2(self._x-(vector[0]*c), self._y-(vector[1]*c))
def reflect_ip(self, vector):
"""
Derive reflected vector at given vector in place.
"""
vn = (self._x * vector[0]) + (self._y * vector[1])
nn = (vector[0] * vector[0]) + (vector[1] * vector[1])
if nn == 0:
raise ValueError('Cannot reflect from normal of zero length')
c = 2 * vn/nn
self._x -= (vector[0]*c)
self._y -= (vector[1]*c)
return None
def distance_to(self, vector):
"""
Return distance to given vector.
"""
return sqrt((self._x-vector[0])**2 + (self._y-vector[1])**2)
def distance_squared_to(self, vector):
"""
Return squared distance to given vector.
"""
return (self._x-vector[0])**2 + (self._y-vector[1])**2
def lerp(self, vector, t):
"""
Return vector linear interpolated by t to the given vector.
"""
if t < 0.0 or t > 1.0:
raise ValueError('Argument t must be in range 0 to 1')
return Vector2(self._x*(1-t) + vector[0]*t,
self._y*(1-t) + vector[1]*t)
def slerp(self, vector, t):
"""
Return vector spherical interpolated by t to the given vector.
"""
if t < -1.0 or t > 1.0:
raise ValueError('Argument t must be in range -1 to 1')
if not hasattr(vector, '__len__') or len(vector) != 2:
raise TypeError('The first argument must be a vector')
smag = sqrt((self._x**2) + (self._y**2))
vmag = sqrt((vector[0]**2) + (vector[1]**2))
if smag==0 or vmag==0:
raise ValueError('Cannot use slerp with zero-vector')
sx = self._x/smag
sy = self._y/smag
vx = vector[0]/vmag
vy = vector[1]/vmag
theta = atan2(vy, vx) - atan2(sy, sx)
_theta = abs(theta)
if _theta-pi > 0.000001:
theta -= (2*pi) * (theta/_theta)
elif -0.000001 < _theta-pi < 0.000001:
raise ValueError('Cannot use slerp on 180 degrees')
if t < 0.0:
t = -t
theta -= (2*pi) * (theta/abs(theta))
sin_theta = sin(theta)
if sin_theta:
a = sin((1.0-t)*theta) / sin_theta
b = sin(t*theta) / sin_theta
else:
a = 1.0
b = 0.0
v = Vector2((sx * a) + (vx * b),
(sy * a) + (vy * b))
smag = ((1.0-t)*smag) + (t*vmag)
v.x *= smag
v.y *= smag
return v
def elementwise(self):
"""
Elementwice operation.
"""
return VectorElementwiseProxy(self._x, self._y)
def rotate(self, angle):
"""
Return vector rotated by angle in degrees.
"""
rad = angle/180.0*pi
c = round(cos(rad),6)
s = round(sin(rad),6)
return Vector2((c*self._x) - (s*self._y),
(s*self._x) + (c*self._y))
def rotate_rad(self, angle):
"""
Return vector rotated by angle in radians.
"""
c = cos(angle)
s = sin(angle)
return Vector2((c*self._x) - (s*self._y),
(s*self._x) + (c*self._y))
def rotate_ip(self, angle):
"""
Rotate vector by angle in degrees.
"""
r = angle/180.0*pi
c = round(cos(r),6)
s = round(sin(r),6)
x = self._x
y = self._y
self._x = (c*x) - (s*y)
self._y = (s*x) + (c*y)
return None
def rotate_ip_rad(self, angle):
"""
Rotate vector by angle in radians.
"""
c = cos(angle)
s = sin(angle)
x = self._x
y = self._y
self._x = (c*x) - (s*y)
self._y = (s*x) + (c*y)
return None
def angle_to(self, vector):
"""
Return angle to given vector.
"""
return (atan2(vector[1], vector[0])
- atan2(self._y, self._x)) * (180.0/pi)
def as_polar(self):
"""
Return radial distance and azimuthal angle.
"""
r = self.magnitude()
phi = atan2(self._y, self._x) * (180.0/pi)
return (r, phi)
def from_polar(self, coordinate):
"""
Set vector with polar coordinate tuple.
"""
if len(coordinate) != 2:
raise TypeError('coodinate must be of length 2')
r = coordinate[0]
phi = coordinate[1] * (pi/180.0)
self._x = round(r * cos(phi), 6)
self._y = round(r * sin(phi), 6)
return None
def update(self, *args, **kwargs):
"""
Update vector.
"""
l = len(args)
if l == 2:
self._x = float(args[0])
self._y = float(args[1])
elif l == 1:
if isinstance(args[0], (int, float)):
self._x = float(args[0])
self._y = float(args[0])
else:
self._x = float(args[0][0])
self._y = float(args[0][1])
else:
if kwargs:
if 'x' in kwargs and 'y' in kwargs:
self._x = float(kwargs['x'])
self._y = float(kwargs['y'])
elif 'x' in kwargs:
self._x = float(kwargs['x'])
self._y = float(kwargs['x'])
else:
self._x = float(kwargs['y'])
self._y = float(kwargs['y'])
else:
self._x = 0.0
self._y = 0.0
def __pos__(self):
return Vector2(self._x, self._y)
def __neg__(self):
return Vector2(-self._x, -self._y)
def __add__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x + other[0], self._y + other[1])
else:
return Vector2(self._x + other, self._y + other)
def __sub__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x - other[0], self._y - other[1])
else:
return Vector2(self._x - other, self._y - other)
def __mul__(self, other):
if hasattr(other, '__len__'):
if not isinstance(other, VectorElementwiseProxy):
return (self._x * other[0]) + (self._y * other[1])
else:
return Vector2(self._x * other[0], self._y * other[1])
else:
return Vector2(self._x * other, self._y * other)
def __div__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x / other[0], self._y / other[1])
else:
return Vector2(self._x / other, self._y / other)
def __truediv__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x / other[0], self._y / other[1])
else:
return Vector2(self._x / other, self._y / other)
def __floordiv__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x // other[0], self._y // other[1])
else:
return Vector2(self._x // other, self._y // other)
def __eq__(self, other):
if hasattr(other, '__len__'):
if len(other) == 2:
return ( abs(self._x-other[0]) < 0.000001 and
abs(self._y-other[1]) < 0.000001 )
else:
return False
else:
return ( abs(self._x-other) < 0.000001 and
abs(self._y-other) < 0.000001 )
def __ne__(self, other):
if hasattr(other, '__len__'):
if len(other) == 2:
return ( abs(self._x-other[0]) > 0.000001 or
abs(self._y-other[1]) > 0.000001 )
else:
return True
else:
return ( abs(self._x-other) > 0.000001 or
abs(self._y-other) > 0.000001 )
def __gt__(self, other):
if not isinstance(other, VectorElementwiseProxy):
msg = 'This operation is not supported by vectors'
raise TypeError(msg)
return NotImplemented
def __ge__(self, other):
if not isinstance(other, VectorElementwiseProxy):
msg = 'This operation is not supported by vectors'
raise TypeError(msg)
return NotImplemented
def __lt__(self, other):
if not isinstance(other, VectorElementwiseProxy):
msg = 'This operation is not supported by vectors'
raise TypeError(msg)
return NotImplemented
def __le__(self, other):
if not isinstance(other, VectorElementwiseProxy):
msg = 'This operation is not supported by vectors'
raise TypeError(msg)
return NotImplemented
def __radd__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x + other[0], self._y + other[1])
else:
return Vector2(self._x + other, self._y + other)
def __rsub__(self, other):
if hasattr(other, '__len__'):
return Vector2(other[0] - self._x, other[1] - self._y)
else:
return Vector2(other - self._x, other - self._y)
def __rmul__(self, other):
if hasattr(other, '__len__'):
if not isinstance(other, VectorElementwiseProxy):
return (self._x * other[0]) + (self._y * other[1])
else:
return Vector2(self._x * other[0], self._y * other[1])
else:
return Vector2(self._x * other, self._y * other)
def __rdiv__(self, other):
if hasattr(other, '__len__'):
return Vector2(other[0] / self._x, other[1] / self._y)
else:
return Vector2(other / self._x, other / self._y)
def __rtruediv__(self, other):
if hasattr(other, '__len__'):
return Vector2(other[0] / self._x, other[1] / self._y)
else:
return Vector2(other / self._x, other / self._y)
def __rfloordiv__(self, other):
if hasattr(other, '__len__'):
return Vector2(other[0] // self._x, other[1] // self._y)
else:
return Vector2(other // self._x, other // self._y)
def __iadd__(self, other):
if hasattr(other, '__len__'):
self._x += other[0]
self._y += other[1]
else:
self._x += other
self._y += other
return self
def __isub__(self, other):
if hasattr(other, '__len__'):
self._x -= other[0]
self._y -= other[1]
else:
self._x -= other
self._y -= other
return self
def __imul__(self, other):
if hasattr(other, '__len__'):
self._x *= other[0]
self._y *= other[1]
else:
self._x *= other
self._y *= other
return self
def __idiv__(self, other):
if hasattr(other, '__len__'):
self._x /= other[0]
self._y /= other[1]
else:
self._x /= other
self._y /= other
return self
def __itruediv__(self, other):
if hasattr(other, '__len__'):
self._x /= other[0]
self._y /= other[1]
else:
self._x /= other
self._y /= other
return self
def __ifloordiv__(self, other):
if hasattr(other, '__len__'):
self._x //= other[0]
self._y //= other[1]
else:
self._x //= other
self._y //= other
return self
class VectorElementwiseProxy(object):
def __init__(self, x, y):
self._x = x
self._y = y
def __getitem__(self, index):
if index in (0, -2):
return self._x
elif index in (1, -1):
return self._y
def __iter__(self):
for val in (self._x, self._y):
yield val
def __len__(self):
return 2
def __bool__(self):
return bool(self._x or self._y)
def __nonzero__(self):
return bool(self._x or self._y)
def __pos__(self):
return Vector2(self._x, self._y)
def __neg__(self):
return Vector2(-self._x, -self._y)
def __abs__(self):
return (abs(self._x), abs(self._y))
def __add__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x + other[0], self._y + other[1])
else:
return Vector2(self._x + other, self._y + other)
def __sub__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x - other[0], self._y - other[1])
else:
return Vector2(self._x - other, self._y - other)
def __mul__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x * other[0], self._y * other[1])
else:
return Vector2(self._x * other, self._y * other)
def __div__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x / other[0], self._y / other[1])
else:
return Vector2(self._x / other, self._y / other)
def __truediv__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x / other[0], self._y / other[1])
else:
return Vector2(self._x / other, self._y / other)
def __floordiv__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x // other[0], self._y // other[1])
else:
return Vector2(self._x // other, self._y // other)
def __pow__(self, other):
if hasattr(other, '__len__'):
if (other[0]%1 and self._x<0) or (other[1]%1 and self._y<0):
raise ValueError('negative number cannot be raised to a fractional power')
return Vector2(self._x**other[0], self._y**other[1])
else:
if other%1 and (self._x<0 or self._y<0):
raise ValueError('negative number cannot be raised to a fractional power')
return Vector2(self._x**other, self._y**other)
def __mod__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x%other[0], self._y%other[1])
else:
return Vector2(self._x%other, self._y%other)
def __eq__(self, other):
if hasattr(other, '__len__'):
if len(other) == 2:
return ( abs(self._x-other[0]) < 0.000001 and
abs(self._y-other[1]) < 0.000001 )
else:
return False
else:
return ( abs(self._x-other) < 0.000001 and
abs(self._y-other) < 0.000001 )
def __ne__(self, other):
if hasattr(other, '__len__'):
if len(other) == 2:
return ( abs(self._x-other[0]) > 0.000001 or
abs(self._y-other[1]) > 0.000001 )
else:
return True
else:
return ( abs(self._x-other) > 0.000001 or
abs(self._y-other) > 0.000001 )
def __gt__(self, other):
if hasattr(other, '__len__'):
return bool(self._x>other[0] and self._y>other[1])
else:
return bool(self._x>other and self._y>other)
def __ge__(self, other):
if hasattr(other, '__len__'):
return bool(self._x>=other[0] and self._y>=other[1])
else:
return bool(self._x>=other and self._y>=other)
def __lt__(self, other):
if hasattr(other, '__len__'):
return bool(self._x<other[0] and self._y<other[1])
else:
return bool(self._x<other and self._y<other)
def __le__(self, other):
if hasattr(other, '__len__'):
return bool(self._x<=other[0] and self._y<=other[1])
else:
return bool(self._x<=other and self._y<=other)
def __radd__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x + other[0], self._y + other[1])
else:
return Vector2(self._x + other, self._y + other)
def __rsub__(self, other):
if hasattr(other, '__len__'):
return Vector2(other[0] - self._x, other[1] - self._y)
else:
return Vector2(other - self._x, other - self._y)
def __rmul__(self, other):
if hasattr(other, '__len__'):
return Vector2(self._x * other[0], self._y * other[1])
else:
return Vector2(self._x * other, self._y * other)
def __rdiv__(self, other):
if hasattr(other, '__len__'):
return Vector2(other[0] / self._x, other[1] / self._y)
else:
return Vector2(other / self._x, other / self._y)
def __rtruediv__(self, other):
if hasattr(other, '__len__'):
return Vector2(other[0] / self._x, other[1] / self._y)
else:
return Vector2(other / self._x, other / self._y)
def __rfloordiv__(self, other):
if hasattr(other, '__len__'):
return Vector2(other[0] // self._x, other[1] // self._y)
else:
return Vector2(other // self._x, other // self._y)
def __rpow__(self, other):
if hasattr(other, '__len__'):
if (other[0]<0 and self._x%1) or (other[1]<0 and self._y%1):
raise ValueError('negative number cannot be raised to a fractional power')
return Vector2(other[0]**self._x, other[1]**self._y)
else:
if other<0 and (self._x%1 or self._y%1):
raise ValueError('negative number cannot be raised to a fractional power')
return Vector2(other**self._x, other**self._y)
def __rmod__(self, other):
if hasattr(other, '__len__'):
return Vector2(other[0]%self._x, other[1]%self._y)
else:
return Vector2(other%self._x, other%self._y)
| 30.981723
| 90
| 0.509439
| 2,974
| 23,732
| 3.784465
| 0.072629
| 0.071524
| 0.07641
| 0.068769
| 0.78223
| 0.756908
| 0.738694
| 0.728476
| 0.709818
| 0.681564
| 0
| 0.03215
| 0.359093
| 23,732
| 765
| 91
| 31.022222
| 0.707824
| 0.044834
| 0
| 0.694974
| 0
| 0
| 0.056806
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.17331
| false
| 0
| 0.003466
| 0.02773
| 0.415945
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
367d6190d8475c6982c11e3c90a8236e7c7bd422
| 295
|
py
|
Python
|
humanizer/tests/__main__.py
|
grimen/python-humanizer
|
20614d8c51179067127c0f144cbaf363ddd0e897
|
[
"MIT"
] | null | null | null |
humanizer/tests/__main__.py
|
grimen/python-humanizer
|
20614d8c51179067127c0f144cbaf363ddd0e897
|
[
"MIT"
] | null | null | null |
humanizer/tests/__main__.py
|
grimen/python-humanizer
|
20614d8c51179067127c0f144cbaf363ddd0e897
|
[
"MIT"
] | null | null | null |
# =========================================
# IMPORTS
# --------------------------------------
import rootpath
rootpath.append()
from humanizer.tests import helper
# =========================================
# RUN
# --------------------------------------
helper.run(__file__)
| 16.388889
| 43
| 0.288136
| 14
| 295
| 5.785714
| 0.714286
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.132203
| 295
| 17
| 44
| 17.352941
| 0.316406
| 0.627119
| 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 | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
36a6ec55b1bd12e9c8b503434e24093201d4be8c
| 10,712
|
py
|
Python
|
common/Layers.py
|
akweury/improved_normal_inference
|
a10ed16f43362c15f2220345275be5c029f31198
|
[
"MIT"
] | null | null | null |
common/Layers.py
|
akweury/improved_normal_inference
|
a10ed16f43362c15f2220345275be5c029f31198
|
[
"MIT"
] | null | null | null |
common/Layers.py
|
akweury/improved_normal_inference
|
a10ed16f43362c15f2220345275be5c029f31198
|
[
"MIT"
] | null | null | null |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.conv import _ConvNd
class Conv(_ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, stride=(1, 1),
padding=(0, 0), dilation=(1, 1), groups=1, bias=True, active_function="LeakyReLU"):
# Call _ConvNd constructor
super(Conv, self).__init__(in_channels, out_channels, kernel_size,
stride, padding, dilation, False, (0, 0),
groups, bias, padding_mode='zeros')
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding, dilation=dilation)
self.active_LeakyReLU = nn.LeakyReLU(0.01)
self.active_ReLU = nn.ReLU()
self.active_Sigmoid = nn.Sigmoid()
self.active_Tanh = nn.Tanh()
self.active_name = active_function
self.bn1 = nn.BatchNorm2d(out_channels)
def forward(self, x):
x = self.bn1(self.conv(x))
if self.active_name == "LeakyReLU":
return self.active_LeakyReLU(x)
elif self.active_name == "Sigmoid":
return self.active_Sigmoid(x)
elif self.active_name == "ReLU":
return self.active_ReLU(x)
elif self.active_name == "Tanh":
return self.active_Tanh(x)
elif self.active_name == "":
return x
else:
raise ValueError
# Normalized Convolution Layer
class GConv(_ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, stride=(1, 1),
padding=(0, 0), dilation=(1, 1), groups=1, bias=True):
# Call _ConvNd constructor
super(GConv, self).__init__(in_channels, out_channels, kernel_size,
stride, padding, dilation, False, (0, 0),
groups, bias, padding_mode='zeros')
self.conv_g = nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding, dilation=dilation)
self.conv_f = nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding, dilation=dilation)
self.active_f = nn.LeakyReLU(0.01)
self.active_g = nn.Sigmoid()
def forward(self, x):
# Normalized Convolution
x_g = self.active_g(self.conv_g(x))
x_f = self.active_f(self.conv_f(x))
x = x_f * x_g
return x
def conv1x1(in_planes: int, out_planes: int, stride) -> nn.Conv2d:
"""1x1 convolution"""
return nn.Conv2d(in_planes, out_planes, kernel_size=(1, 1), stride=stride, bias=False)
def gconv1x1(in_planes: int, out_planes: int, stride) -> GConv:
"""1x1 convolution"""
return GConv(in_planes, out_planes, kernel_size=(1, 1), stride=stride, bias=False)
class GTransp(_ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, stride=(1, 1),
padding=(0, 0), dilation=(1, 1), groups=1, bias=True):
# Call _ConvNd constructor
super(GTransp, self).__init__(in_channels, out_channels, kernel_size,
stride, padding, dilation, False, (0, 0),
groups, bias, padding_mode='zeros')
self.conv_g = nn.ConvTranspose2d(in_channels, out_channels, kernel_size, stride, padding, output_padding=(1, 1))
self.conv_f = nn.ConvTranspose2d(in_channels, out_channels, kernel_size, stride, padding, output_padding=(1, 1))
self.active_f = nn.LeakyReLU(0.01)
self.active_g = nn.Sigmoid()
self.bn1 = nn.BatchNorm2d(out_channels)
def forward(self, x):
# Normalized Convolution
x_g = self.active_g(self.conv_g(x))
x_f = self.active_f(self.conv_f(x))
x = x_f * x_g
return x
def gtransp1x1(in_planes: int, out_planes: int, stride) -> GTransp:
"""1x1 convolution"""
return GTransp(in_planes, out_planes, kernel_size=(1, 1), stride=stride, bias=False)
# Normalized Convolution Layer
class NConv2d(_ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, stride=(1, 1),
padding=(1, 1), dilation=(1, 1), groups=1, bias=True):
# Call _ConvNd constructor
super(NConv2d, self).__init__(in_channels, out_channels, kernel_size, stride, padding, dilation, False, (0, 0),
groups, bias, padding_mode='zeros')
self.eps = 1e-20
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding)
# self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding)
self.active_LeakyReLU = nn.LeakyReLU(0.01)
def forward(self, data, conf):
channel_num = data.size(1)
if conf.size(1) == 1:
conf = conf.repeat(1, channel_num, 1, 1)
else:
conf_0 = conf[:, :1, :, :].repeat(1, channel_num // 2, 1, 1)
conf_1 = conf[:, 1:2, :, :].repeat(1, channel_num // 2, 1, 1)
conf = torch.cat((conf_0, conf_1), 1)
denom = self.conv(conf)
nomin = self.conv(data * conf)
nconv = nomin / (denom + self.eps)
# Add bias
nconv += self.bias.view(1, self.bias.size(0), 1, 1).expand_as(nconv)
# Propagate confidence
cout = F.max_pool2d(conf, self.kernel_size, self.stride, self.padding)
mask = torch.sum(cout, dim=1) > 0
cout = cout.permute(0, 2, 3, 1)
cout[mask] = 1
cout = cout.permute(0, 3, 1, 2)
nconv = self.active_LeakyReLU(nconv)
return nconv, cout
class Transp(_ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, stride=(1, 1),
padding=(0, 0), dilation=(1, 1), groups=1, bias=True):
# Call _ConvNd constructor
super(Transp, self).__init__(in_channels, out_channels, kernel_size,
stride, padding, dilation, False, (0, 0),
groups, bias, padding_mode='zeros')
self.main = nn.ConvTranspose2d(in_channels, out_channels, kernel_size, stride, padding, output_padding=(1, 1))
self.active = nn.LeakyReLU(0.01)
self.bn1 = nn.BatchNorm2d(out_channels)
def forward(self, x):
# Transposed 2d layer
x = self.main(x)
x = self.bn1(x)
x = self.active(x)
return x
class ResidualBlock(_ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, downsample, stride=(1, 1),
padding=(0, 0), dilation=(1, 1), groups=1, bias=True):
# Call _ConvNd constructor
super(ResidualBlock, self).__init__(in_channels, out_channels, kernel_size,
stride, padding, dilation, False, (0, 0),
groups, bias, padding_mode='zeros')
self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding, dilation=dilation)
self.conv2 = nn.Conv2d(out_channels, out_channels, kernel_size, stride, padding, dilation=dilation)
self.active_LeakyReLU = nn.LeakyReLU(0.01)
self.active_ReLU = nn.ReLU()
self.active_Sigmoid = nn.Sigmoid()
self.active_Tanh = nn.Tanh()
self.bn1 = nn.BatchNorm2d(out_channels)
self.bn2 = nn.BatchNorm2d(out_channels)
self.isDown = downsample
self.downsample = nn.Sequential(
conv1x1(in_channels, out_channels, stride),
nn.BatchNorm2d(out_channels)
)
def forward(self, x):
identity = x
out = self.conv1(x)
out = self.bn1(out)
out = self.active_ReLU(out)
out = self.conv2(out)
out = self.bn2(out)
if self.isDown is not None:
identity = self.downsample(x)
out += identity
# out = self.active_ReLU(out)
return out
class GRB(_ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, downsample, stride=(1, 1),
padding=(0, 0), dilation=(1, 1), groups=1, bias=True):
# Call _ConvNd constructor
super(GRB, self).__init__(in_channels, out_channels, kernel_size,
stride, padding, dilation, False, (0, 0),
groups, bias, padding_mode='zeros')
self.conv1 = GConv(in_channels, out_channels, kernel_size, stride, padding, dilation=dilation)
self.conv2 = GConv(out_channels, out_channels, kernel_size, (1, 1), padding, dilation=dilation)
self.active_LeakyReLU = nn.LeakyReLU(0.01)
self.active_ReLU = nn.ReLU()
self.active_Sigmoid = nn.Sigmoid()
self.active_Tanh = nn.Tanh()
self.bn1 = nn.BatchNorm2d(out_channels)
self.bn2 = nn.BatchNorm2d(out_channels)
self.isDown = downsample
self.downsample = nn.Sequential(
gconv1x1(in_channels, out_channels, stride),
nn.BatchNorm2d(out_channels)
)
def forward(self, x):
identity = x
out = self.conv1(x)
out = self.bn1(out)
out = self.active_ReLU(out)
out = self.conv2(out)
out = self.bn2(out)
if self.isDown:
identity = self.downsample(x)
out += identity
# out = self.active_ReLU(out)
return out
class TRB(_ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, upsample, stride=(1, 1),
padding=(0, 0), dilation=(1, 1), groups=1, bias=True):
# Call _ConvNd constructor
super(TRB, self).__init__(in_channels, out_channels, kernel_size,
stride, padding, dilation, False, (0, 0),
groups, bias, padding_mode='zeros')
self.conv1 = GTransp(in_channels, out_channels, kernel_size, stride, padding, dilation=dilation)
self.conv2 = GConv(out_channels, out_channels, kernel_size, (1, 1), padding, dilation=dilation)
self.active_LeakyReLU = nn.LeakyReLU(0.01)
self.active_ReLU = nn.ReLU()
self.active_Sigmoid = nn.Sigmoid()
self.active_Tanh = nn.Tanh()
self.bn1 = nn.BatchNorm2d(out_channels)
self.bn2 = nn.BatchNorm2d(out_channels)
self.isUp = upsample
self.upsample = nn.Sequential(
gtransp1x1(in_channels, out_channels, stride),
nn.BatchNorm2d(out_channels)
)
def forward(self, x):
identity = x
out = self.conv1(x)
out = self.bn1(out)
out = self.active_ReLU(out)
out = self.conv2(out)
out = self.bn2(out)
if self.isUp:
identity = self.upsample(x)
out += identity
# out = self.active_ReLU(out)
return out
| 37.585965
| 120
| 0.596247
| 1,348
| 10,712
| 4.525964
| 0.083086
| 0.086543
| 0.10277
| 0.103262
| 0.794296
| 0.779544
| 0.779053
| 0.760039
| 0.752172
| 0.752172
| 0
| 0.029735
| 0.287341
| 10,712
| 284
| 121
| 37.71831
| 0.769452
| 0.052745
| 0
| 0.562814
| 0
| 0
| 0.007218
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.095477
| false
| 0
| 0.020101
| 0
| 0.231156
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
7fce2958034c61bb81ad7b2762aad902b1e3df68
| 133
|
py
|
Python
|
Main Server/Server/controllers/config.py
|
harsha-ys/e16-3yp-automatic-fish-tank-control-system
|
e5541a97fc10c2e0588290d2a1b9b115fde4add8
|
[
"MIT"
] | null | null | null |
Main Server/Server/controllers/config.py
|
harsha-ys/e16-3yp-automatic-fish-tank-control-system
|
e5541a97fc10c2e0588290d2a1b9b115fde4add8
|
[
"MIT"
] | 1
|
2020-11-07T12:07:05.000Z
|
2020-11-07T12:07:05.000Z
|
Main Server/Server/controllers/config.py
|
harsha-ys/e16-3yp-automatic-fish-tank-control-system
|
e5541a97fc10c2e0588290d2a1b9b115fde4add8
|
[
"MIT"
] | 6
|
2020-10-25T10:43:09.000Z
|
2020-11-14T07:27:41.000Z
|
SECRET_KEY = "9c56a5f72207f203014d4f91598bc7cd35e047a0215097034a876db2904ebaae"
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 30
| 44.333333
| 79
| 0.879699
| 10
| 133
| 11.3
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.395161
| 0.067669
| 133
| 3
| 80
| 44.333333
| 0.516129
| 0
| 0
| 0
| 0
| 0
| 0.514925
| 0.477612
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
7fee30590b358a4beddbf511a0419a9d9ea8c44a
| 100
|
py
|
Python
|
exercises/pythagorean-triplet/pythagorean_triplet.py
|
RJTK/python
|
f9678d629735f75354bbd543eb7f10220a498dae
|
[
"MIT"
] | 1
|
2021-05-15T19:59:04.000Z
|
2021-05-15T19:59:04.000Z
|
exercises/pythagorean-triplet/pythagorean_triplet.py
|
RJTK/python
|
f9678d629735f75354bbd543eb7f10220a498dae
|
[
"MIT"
] | null | null | null |
exercises/pythagorean-triplet/pythagorean_triplet.py
|
RJTK/python
|
f9678d629735f75354bbd543eb7f10220a498dae
|
[
"MIT"
] | 2
|
2018-03-03T08:32:12.000Z
|
2019-08-22T11:55:53.000Z
|
def primitive_triplets():
pass
def triplets_in_range():
pass
def is_triplet():
pass
| 9.090909
| 25
| 0.66
| 13
| 100
| 4.769231
| 0.615385
| 0.225806
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| 100
| 10
| 26
| 10
| 0.826667
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
3d125d7c0b9867b76020644086006605d0e3403e
| 302
|
py
|
Python
|
hashfunctions.py
|
phesmont/phes
|
319fd309b856de0f7115825115132b9807ac24df
|
[
"Unlicense"
] | null | null | null |
hashfunctions.py
|
phesmont/phes
|
319fd309b856de0f7115825115132b9807ac24df
|
[
"Unlicense"
] | null | null | null |
hashfunctions.py
|
phesmont/phes
|
319fd309b856de0f7115825115132b9807ac24df
|
[
"Unlicense"
] | null | null | null |
import hashlib
def sha256_function(data: bytes) -> bytes:
sha256_object = hashlib.sha256()
sha256_object.update(data)
return sha256_object.digest()
def sha256_trim1(data: bytes) -> bytes:
return sha256_function(data)[:1]
def sha256_trim2(data: bytes) -> bytes:
return sha256_function(data)[:2]
| 23.230769
| 42
| 0.758278
| 42
| 302
| 5.261905
| 0.357143
| 0.122172
| 0.244344
| 0.180995
| 0.343891
| 0.343891
| 0.343891
| 0
| 0
| 0
| 0
| 0.116105
| 0.115894
| 302
| 12
| 43
| 25.166667
| 0.71161
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.111111
| 0.222222
| 0.777778
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
3d215bd996bdfc39ead89433323d75d31f50696b
| 51
|
py
|
Python
|
audapter/__main__.py
|
borley1211/adaptune
|
f1d389dd189cc31ad3ada8a17aee42a943075ebd
|
[
"MIT"
] | 1
|
2020-05-21T11:53:24.000Z
|
2020-05-21T11:53:24.000Z
|
audapter/__main__.py
|
borley1211/adaptune
|
f1d389dd189cc31ad3ada8a17aee42a943075ebd
|
[
"MIT"
] | 2
|
2020-03-18T03:10:25.000Z
|
2021-07-14T22:15:34.000Z
|
audapter/__main__.py
|
borley1211/audapter
|
f1d389dd189cc31ad3ada8a17aee42a943075ebd
|
[
"MIT"
] | null | null | null |
import sys
from .helper import cli
sys.exit(cli())
| 12.75
| 23
| 0.745098
| 9
| 51
| 4.222222
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137255
| 51
| 4
| 24
| 12.75
| 0.863636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
3d571691b8b74d95bafa56014b2d5c821f5a8e47
| 186
|
py
|
Python
|
dashboard/views.py
|
baofeng-dong/orange-after-odsurvey
|
588db6587d50bf0a93ab2a525f5cb2cb0d5eb3d4
|
[
"MIT"
] | null | null | null |
dashboard/views.py
|
baofeng-dong/orange-after-odsurvey
|
588db6587d50bf0a93ab2a525f5cb2cb0d5eb3d4
|
[
"MIT"
] | null | null | null |
dashboard/views.py
|
baofeng-dong/orange-after-odsurvey
|
588db6587d50bf0a93ab2a525f5cb2cb0d5eb3d4
|
[
"MIT"
] | 2
|
2017-12-01T21:03:40.000Z
|
2020-10-01T17:29:05.000Z
|
from flask import render_template
from dashboard import app
from dashboard.auth import Auth
@app.route('/')
@Auth.requires_auth
def index():
return render_template("index.html")
| 15.5
| 40
| 0.763441
| 26
| 186
| 5.346154
| 0.538462
| 0.201439
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139785
| 186
| 11
| 41
| 16.909091
| 0.86875
| 0
| 0
| 0
| 0
| 0
| 0.059783
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| true
| 0
| 0.428571
| 0.142857
| 0.714286
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 0
| 0
|
0
| 5
|
1850e5e9f1e7b08116fb4687489fbf207423b0bf
| 85
|
py
|
Python
|
util/functional.py
|
ayobuenavista/sanity-price-monitor
|
d6da819e3bd5fdd797bd2acfd4cf50ae922e21f3
|
[
"MIT"
] | 6
|
2018-01-09T14:27:44.000Z
|
2021-05-21T17:03:06.000Z
|
util/functional.py
|
ayobuenavista/sanity-price-monitor
|
d6da819e3bd5fdd797bd2acfd4cf50ae922e21f3
|
[
"MIT"
] | 13
|
2018-01-17T13:30:39.000Z
|
2021-03-25T21:35:17.000Z
|
util/functional.py
|
ayobuenavista/sanity-price-monitor
|
d6da819e3bd5fdd797bd2acfd4cf50ae922e21f3
|
[
"MIT"
] | 7
|
2018-02-22T01:17:17.000Z
|
2021-03-15T07:43:05.000Z
|
def first(iterable, condition):
return next(x for x in iterable if condition(x))
| 28.333333
| 52
| 0.729412
| 14
| 85
| 4.428571
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.176471
| 85
| 2
| 53
| 42.5
| 0.885714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
43ff1f893954c78a06cec5bf603705fff8d5bbc1
| 21
|
py
|
Python
|
run_in_cron.py
|
denkuzin/captcha_solver
|
cea3a3673df2d9c9529811d0ed4ee0a2244166d3
|
[
"Unlicense"
] | 3
|
2019-02-25T15:16:48.000Z
|
2019-12-04T18:42:31.000Z
|
run_in_cron.py
|
denkuzin/captcha_solver
|
cea3a3673df2d9c9529811d0ed4ee0a2244166d3
|
[
"Unlicense"
] | null | null | null |
run_in_cron.py
|
denkuzin/captcha_solver
|
cea3a3673df2d9c9529811d0ed4ee0a2244166d3
|
[
"Unlicense"
] | null | null | null |
import run
run.job()
| 7
| 10
| 0.714286
| 4
| 21
| 3.75
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 21
| 2
| 11
| 10.5
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
a11863996d9a322e868fd76f6d613fb76338ece0
| 583
|
py
|
Python
|
d10_deques.py
|
DK2K00/100DaysOfCode
|
68a9422b8b0b3aa233b1e11e310a6a58453e35c1
|
[
"MIT"
] | null | null | null |
d10_deques.py
|
DK2K00/100DaysOfCode
|
68a9422b8b0b3aa233b1e11e310a6a58453e35c1
|
[
"MIT"
] | null | null | null |
d10_deques.py
|
DK2K00/100DaysOfCode
|
68a9422b8b0b3aa233b1e11e310a6a58453e35c1
|
[
"MIT"
] | null | null | null |
class deques():
def __init__(self):
self.items = []
def addFront(self,item):
return self.items.append(item)
def addRear(self,item):
return self.items.insert(0,item)
def removeFront(self):
return self.items.pop()
def removeRear(self):
return self.items.pop(1)
def length(self):
return len(self.items)
def IsEmpty(self):
return self.items == []
d = deques()
d.IsEmpty()
d.addFront(10)
d.addFront(20)
d.addRear(30)
d.length()
d.removeRear()
d.removeRear()
d.IsEmpty()
d.removeFront()
d.IsEmpty()
| 17.666667
| 40
| 0.61578
| 79
| 583
| 4.493671
| 0.303797
| 0.177465
| 0.211268
| 0.160563
| 0.253521
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017897
| 0.233276
| 583
| 33
| 41
| 17.666667
| 0.776286
| 0
| 0
| 0.192308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.269231
| false
| 0
| 0
| 0.230769
| 0.538462
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
a134d4a14c68979ba79df936361429b305ab2f01
| 32
|
py
|
Python
|
shadow/__main__.py
|
f1uzz/shadow
|
0c2a1308f8bbe77ce4be005153148aac8ea0b4b2
|
[
"MIT"
] | 1
|
2020-09-10T22:31:54.000Z
|
2020-09-10T22:31:54.000Z
|
shadow/__main__.py
|
f1uzz/shadow
|
0c2a1308f8bbe77ce4be005153148aac8ea0b4b2
|
[
"MIT"
] | 1
|
2020-03-12T15:47:14.000Z
|
2020-09-11T18:46:44.000Z
|
shadow/__main__.py
|
f1uzz/shadow
|
0c2a1308f8bbe77ce4be005153148aac8ea0b4b2
|
[
"MIT"
] | null | null | null |
from shadow import main
main()
| 8
| 23
| 0.75
| 5
| 32
| 4.8
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1875
| 32
| 3
| 24
| 10.666667
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
a13c7ec75a084c6c85233abd2edb74d1dc8472a2
| 951
|
py
|
Python
|
business_register/migrations/0029_auto_20200731_0719.py
|
OlexandrTopuzov/Data_converter
|
0ac2319ccaae790af35ab2202724c65d83d32ecc
|
[
"MIT"
] | null | null | null |
business_register/migrations/0029_auto_20200731_0719.py
|
OlexandrTopuzov/Data_converter
|
0ac2319ccaae790af35ab2202724c65d83d32ecc
|
[
"MIT"
] | null | null | null |
business_register/migrations/0029_auto_20200731_0719.py
|
OlexandrTopuzov/Data_converter
|
0ac2319ccaae790af35ab2202724c65d83d32ecc
|
[
"MIT"
] | null | null | null |
# Generated by Django 3.0.7 on 2020-07-31 07:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('business_register', '0028_auto_20200729_0937'),
]
operations = [
migrations.AlterField(
model_name='fop',
name='code',
field=models.CharField(db_index=True, max_length=675),
),
migrations.AlterField(
model_name='fop',
name='fullname',
field=models.CharField(max_length=175, verbose_name="повне ім'я"),
),
migrations.AlterField(
model_name='historicalfop',
name='code',
field=models.CharField(db_index=True, max_length=675),
),
migrations.AlterField(
model_name='historicalfop',
name='fullname',
field=models.CharField(max_length=175, verbose_name="повне ім'я"),
),
]
| 27.970588
| 78
| 0.57939
| 98
| 951
| 5.459184
| 0.459184
| 0.149533
| 0.186916
| 0.216822
| 0.702804
| 0.702804
| 0.534579
| 0.534579
| 0.534579
| 0.534579
| 0
| 0.064857
| 0.302839
| 951
| 33
| 79
| 28.818182
| 0.742081
| 0.047319
| 0
| 0.740741
| 1
| 0
| 0.128319
| 0.025442
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.037037
| 0
| 0.148148
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
a14b039d7a380b67345060bea5ae1e759caed501
| 67
|
py
|
Python
|
common/models/__init__.py
|
SamusChief/myth-caster-api
|
76a43f48b70c6a4b509c90757d7906689799cc25
|
[
"MIT"
] | null | null | null |
common/models/__init__.py
|
SamusChief/myth-caster-api
|
76a43f48b70c6a4b509c90757d7906689799cc25
|
[
"MIT"
] | null | null | null |
common/models/__init__.py
|
SamusChief/myth-caster-api
|
76a43f48b70c6a4b509c90757d7906689799cc25
|
[
"MIT"
] | 1
|
2021-08-14T18:46:52.000Z
|
2021-08-14T18:46:52.000Z
|
""" Common models """
from .mixins import OwnedModel, PrivateModel
| 22.333333
| 44
| 0.746269
| 7
| 67
| 7.142857
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134328
| 67
| 2
| 45
| 33.5
| 0.862069
| 0.19403
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
a164a0a3659f26198ccb3f4aa73c816f08e634b5
| 68
|
py
|
Python
|
jacdac/wifi/__init__.py
|
microsoft/jacdac-python
|
712ad5559e29065f5eccb5dbfe029c039132df5a
|
[
"MIT"
] | 1
|
2022-02-15T21:30:36.000Z
|
2022-02-15T21:30:36.000Z
|
jacdac/wifi/__init__.py
|
microsoft/jacdac-python
|
712ad5559e29065f5eccb5dbfe029c039132df5a
|
[
"MIT"
] | null | null | null |
jacdac/wifi/__init__.py
|
microsoft/jacdac-python
|
712ad5559e29065f5eccb5dbfe029c039132df5a
|
[
"MIT"
] | 1
|
2022-02-08T19:32:45.000Z
|
2022-02-08T19:32:45.000Z
|
# Autogenerated file.
from .client import WifiClient # type: ignore
| 22.666667
| 45
| 0.779412
| 8
| 68
| 6.625
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.147059
| 68
| 2
| 46
| 34
| 0.913793
| 0.470588
| 0
| 0
| 1
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
a19829f57cc320ba70bf4b5c60be3875ae385a8f
| 234
|
py
|
Python
|
Scrimba/tuples_exercise.py
|
kadulemos/Python
|
3088873fafce87c6aeb28450fa5e228617611fb6
|
[
"MIT"
] | null | null | null |
Scrimba/tuples_exercise.py
|
kadulemos/Python
|
3088873fafce87c6aeb28450fa5e228617611fb6
|
[
"MIT"
] | null | null | null |
Scrimba/tuples_exercise.py
|
kadulemos/Python
|
3088873fafce87c6aeb28450fa5e228617611fb6
|
[
"MIT"
] | null | null | null |
#Tuples - faster Lists you can't change
friends = ['John','Michael','Terry','Eric','Graham']
friends_tuple = ('John','Michael','Terry','Eric','Graham')
print(friends)
print(friends_tuple)
print(friends[2:4])
print(friends_tuple[2:4])
| 29.25
| 58
| 0.709402
| 34
| 234
| 4.794118
| 0.5
| 0.294479
| 0.196319
| 0.245399
| 0.319018
| 0
| 0
| 0
| 0
| 0
| 0
| 0.018433
| 0.07265
| 234
| 8
| 59
| 29.25
| 0.732719
| 0.162393
| 0
| 0
| 0
| 0
| 0.265306
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.666667
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
a19d3625107ce44164ff82f743b2a10b3a7b94b6
| 210
|
py
|
Python
|
api/tasks/test.py
|
lilixiang/cmdb
|
d60857c26b9b81c8a33b72548b637cbde8782fe1
|
[
"MIT"
] | 1
|
2020-02-15T00:13:45.000Z
|
2020-02-15T00:13:45.000Z
|
api/tasks/test.py
|
lilixiang/cmdb
|
d60857c26b9b81c8a33b72548b637cbde8782fe1
|
[
"MIT"
] | null | null | null |
api/tasks/test.py
|
lilixiang/cmdb
|
d60857c26b9b81c8a33b72548b637cbde8782fe1
|
[
"MIT"
] | 1
|
2019-10-31T07:55:20.000Z
|
2019-10-31T07:55:20.000Z
|
# -*- coding:utf-8 -*-
from api.extensions import celery
from flask import current_app
@celery.task(queue="ticket_web")
def test_task():
current_app.logger.info("test task.............................")
| 21
| 69
| 0.62381
| 27
| 210
| 4.703704
| 0.703704
| 0.15748
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005376
| 0.114286
| 210
| 9
| 70
| 23.333333
| 0.677419
| 0.095238
| 0
| 0
| 0
| 0
| 0.255319
| 0.175532
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0.4
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
a1b0c9f9bb3fd77644a959ba6a86c973a9064ff7
| 52,174
|
py
|
Python
|
seaborn_analyzer/_cv_eval_set.py
|
c60evaporator/seaborn-analyzer
|
af1088dffa7d4afb1061a9b3ed220c9fc0ed6a71
|
[
"BSD-3-Clause"
] | 38
|
2021-07-31T23:50:53.000Z
|
2022-03-26T01:50:32.000Z
|
seaborn_analyzer/_cv_eval_set.py
|
c60evaporator/seaborn_analyzer
|
af1088dffa7d4afb1061a9b3ed220c9fc0ed6a71
|
[
"BSD-3-Clause"
] | 5
|
2021-02-06T10:31:40.000Z
|
2021-07-23T14:59:27.000Z
|
seaborn_analyzer/_cv_eval_set.py
|
c60evaporator/seaborn-analyzer
|
af1088dffa7d4afb1061a9b3ed220c9fc0ed6a71
|
[
"BSD-3-Clause"
] | 3
|
2021-08-05T00:43:25.000Z
|
2021-11-19T08:47:20.000Z
|
import copy
from joblib import Parallel
import numpy as np
import time
import numbers
from itertools import product
from collections import defaultdict
from sklearn import clone
from sklearn.pipeline import Pipeline
from sklearn.model_selection import check_cv, GridSearchCV, RandomizedSearchCV
from sklearn.model_selection._validation import _fit_and_score, _insert_error_scores, _aggregate_score_dicts, _normalize_score_results, _translate_train_sizes, _incremental_fit_estimator
from sklearn.utils.validation import indexable, check_random_state, _check_fit_params
from sklearn.metrics import check_scoring
from sklearn.metrics._scorer import _check_multimetric_scoring
from sklearn.base import is_classifier
from sklearn.utils.fixes import delayed
def init_eval_set(src_eval_set_selection, src_fit_params, X, y):
"""
fit_paramsにeval_metricが入力されており、eval_setが入力されていないときの処理
Parameters
----------
src_eval_set_selection : {'all', 'test', 'train', 'original', 'original_transformed'}, optional
eval_setに渡すデータの決め方 ('all': X, 'test': X[test], 'train': X[train], 'original': 入力そのまま, 'original_transformed': 入力そのまま&パイプラインの時は最終学習器以外の変換実行)
src_fit_params : Dict
処理前の学習時パラメータ
"""
fit_params = copy.deepcopy(src_fit_params)
eval_set_selection = src_eval_set_selection
# fit_paramsにeval_metricが設定されているときのみ以下の処理を実施
if 'eval_metric' in src_fit_params and src_fit_params['eval_metric'] is not None:
# fit_paramsにeval_setが存在しないとき、入力データをそのまま追加
if 'eval_set' not in src_fit_params:
print('There is no "eval_set" in fit_params, so "eval_set" is set to (self.X, self.y)')
fit_params['eval_set'] = [(X, y)]
if src_eval_set_selection is None: # eval_set_selection未指定時、eval_setが入力されていなければeval_set_selection='test'とする
eval_set_selection = 'test'
if eval_set_selection not in ['all', 'train', 'test']: # eval_set_selectionの指定が間違っていたらエラーを出す
raise ValueError('The `eval_set_selection` argument should be "all", "train", or "test" when `eval_set` is not in `fit_params`')
# src_fit_paramsにeval_setが存在するとき、eval_set_selection未指定ならばeval_set_selection='original_transformed'とする
else:
if src_eval_set_selection is None:
eval_set_selection = 'original_transformed'
return fit_params, eval_set_selection
def _transform_except_last_estimator(transformer, X_src, X_train):
"""パイプラインのとき、最終学習器以外のtransformを適用"""
if transformer is not None:
transformer.fit(X_train)
X_dst = transformer.transform(X_src)
return X_dst
else:
return X_src
def _eval_set_selection(eval_set_selection, transformer,
fit_params, train, test):
"""eval_setの中から学習データ or テストデータのみを抽出"""
fit_params_modified = copy.deepcopy(fit_params)
# eval_setが存在しない or Noneなら、そのままfit_paramsを返す
eval_sets = [v for v in fit_params.keys() if 'eval_set' in v]
if len(eval_sets) == 0 or fit_params[eval_sets[0]] is None:
return fit_params_modified
eval_set_name = eval_sets[0] # eval_setの列名(pipelineでは列名が変わるため)
# 元のeval_setからX, yを取得
X_fit = fit_params[eval_set_name][0][0]
y_fit = fit_params[eval_set_name][0][1]
# eval_setに該当データを入力し直す
if eval_set_selection == 'train':
fit_params_modified[eval_set_name] = [(_transform_except_last_estimator(transformer, X_fit[train], X_fit[train])\
, y_fit[train])]
elif eval_set_selection == 'test':
fit_params_modified[eval_set_name] = [(_transform_except_last_estimator(transformer, X_fit[test], X_fit[train])\
, y_fit[test])]
elif eval_set_selection == 'all':
fit_params_modified[eval_set_name] = [(_transform_except_last_estimator(transformer, X_fit, X_fit[train])\
, y_fit)]
else:
fit_params_modified[eval_set_name] = [(_transform_except_last_estimator(transformer, X_fit, X_fit)\
, y_fit)]
return fit_params_modified
def _fit_and_score_eval_set(eval_set_selection, transformer,
estimator, X, y, scorer, train, test, verbose,
parameters, fit_params, return_train_score=False,
return_parameters=False, return_n_test_samples=False,
return_times=False, return_estimator=False,
split_progress=None, candidate_progress=None,
error_score=np.nan,
print_message=None):
"""Fit estimator and compute scores for a given dataset split."""
# eval_setの中から学習データ or テストデータのみを抽出
fit_params_modified = _eval_set_selection(eval_set_selection, transformer,
fit_params, train, test)
if print_message is not None:
print(print_message)
# 学習してスコア計算
result = _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters,
fit_params_modified,
return_train_score=return_train_score,
return_parameters=return_parameters, return_n_test_samples=return_n_test_samples,
return_times=return_times, return_estimator=return_estimator,
split_progress=split_progress, candidate_progress=candidate_progress,
error_score=error_score)
return result
def _make_transformer(eval_set_selection, estimator):
"""estimatorがパイプラインのとき、最終学習器以外の変換器(前処理クラスのリスト)を作成"""
if isinstance(estimator, Pipeline) and eval_set_selection != 'original':
transformer = Pipeline([step for i, step in enumerate(estimator.steps) if i < len(estimator) - 1])
return transformer
else:
return None
def cross_validate_eval_set(eval_set_selection,
estimator, X, y=None, groups=None, scoring=None, cv=None,
n_jobs=None, verbose=0, fit_params=None,
pre_dispatch='2*n_jobs', return_train_score=False,
return_estimator=False, error_score=np.nan):
"""
Evaluate a scores by cross-validation with `eval_set` argument in `fit_params`
This method is suitable for calculating cross validation scores with `early_stopping_round` in XGBoost or LightGBM.
Parameters
----------
eval_set_selection : {'all', 'train', 'test', 'original', 'original_transformed'}
Select data passed to `eval_set` in `fit_params`. Available only if "estimator" is LightGBM or XGBoost.
If "all", use all data in `X` and `y`.
If "train", select train data from `X` and `y` using cv.split().
If "test", select test data from `X` and `y` using cv.split().
If "original", use raw `eval_set`.
If "original_transformed", use `eval_set` transformed by fit_transform() of pipeline if `estimater` is pipeline.
estimator : estimator object implementing 'fit'
The object to use to fit the data.
X : array-like of shape (n_samples, n_features)
The data to fit. Can be for example a list, or an array.
y : array-like of shape (n_samples,) or (n_samples, n_outputs), \
default=None
The target variable to try to predict in the case of
supervised learning.
groups : array-like of shape (n_samples,), default=None
Group labels for the samples used while splitting the dataset into
train/test set. Only used in conjunction with a "Group" :term:`cv`
instance (e.g., :class:`GroupKFold`).
scoring : str, callable, list, tuple, or dict, default=None
Strategy to evaluate the performance of the cross-validated model on
the test set.
If `scoring` represents a single score, one can use:
- a single string (see :ref:`scoring_parameter`);
- a callable (see :ref:`scoring`) that returns a single value.
If `scoring` represents multiple scores, one can use:
- a list or tuple of unique strings;
- a callable returning a dictionary where the keys are the metric
names and the values are the metric scores;
- a dictionary with metric names as keys and callables a values.
See :ref:`multimetric_grid_search` for an example.
cv : int, cross-validation generator or an iterable, default=None
Determines the cross-validation splitting strategy.
Possible inputs for cv are:
- None, to use the default 5-fold cross validation,
- int, to specify the number of folds in a `(Stratified)KFold`,
- :term:`CV splitter`,
- An iterable yielding (train, test) splits as arrays of indices.
For int/None inputs, if the estimator is a classifier and ``y`` is
either binary or multiclass, :class:`StratifiedKFold` is used. In all
other cases, :class:`.Fold` is used. These splitters are instantiated
with `shuffle=False` so the splits will be the same across calls.
Refer :ref:`User Guide <cross_validation>` for the various
cross-validation strategies that can be used here.
.. versionchanged:: 0.22
``cv`` default value if None changed from 3-fold to 5-fold.
n_jobs : int, default=None
Number of jobs to run in parallel. Training the estimator and computing
the score are parallelized over the cross-validation splits.
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
for more details.
verbose : int, default=0
The verbosity level.
fit_params : dict, default=None
Parameters to pass to the fit method of the estimator.
pre_dispatch : int or str, default='2*n_jobs'
Controls the number of jobs that get dispatched during parallel
execution. Reducing this number can be useful to avoid an
explosion of memory consumption when more jobs get dispatched
than CPUs can process. This parameter can be:
- None, in which case all the jobs are immediately
created and spawned. Use this for lightweight and
fast-running jobs, to avoid delays due to on-demand
spawning of the jobs
- An int, giving the exact number of total jobs that are
spawned
- A str, giving an expression as a function of n_jobs,
as in '2*n_jobs'
return_train_score : bool, default=False
Whether to include train scores.
Computing training scores is used to get insights on how different
parameter settings impact the overfitting/underfitting trade-off.
However computing the scores on the training set can be computationally
expensive and is not strictly required to select the parameters that
yield the best generalization performance.
.. versionadded:: 0.19
.. versionchanged:: 0.21
Default value was changed from ``True`` to ``False``
return_estimator : bool, default=False
Whether to return the estimators fitted on each split.
.. versionadded:: 0.20
error_score : 'raise' or numeric, default=np.nan
Value to assign to the score if an error occurs in estimator fitting.
If set to 'raise', the error is raised.
If a numeric value is given, FitFailedWarning is raised.
.. versionadded:: 0.20
Returns
-------
scores : dict of float arrays of shape (n_splits,)
Array of scores of the estimator for each run of the cross validation.
"""
X, y, groups = indexable(X, y, groups)
cv = check_cv(cv, y, classifier=is_classifier(estimator))
if callable(scoring):
scorers = scoring
elif scoring is None or isinstance(scoring, str):
scorers = check_scoring(estimator, scoring)
else:
scorers = _check_multimetric_scoring(estimator, scoring)
# 最終学習器以外の前処理変換器作成
transformer = _make_transformer(eval_set_selection, estimator)
# We clone the estimator to make sure that all the folds are
# independent, and that it is pickle-able.
parallel = Parallel(n_jobs=n_jobs, verbose=verbose,
pre_dispatch=pre_dispatch)
results = parallel(
delayed(_fit_and_score_eval_set)(
eval_set_selection, transformer,
clone(estimator), X, y, scorers, train, test, verbose, None,
fit_params, return_train_score=return_train_score,
return_times=True, return_estimator=return_estimator,
error_score=error_score)
for train, test in cv.split(X, y, groups))
# For callabe scoring, the return type is only know after calling. If the
# return type is a dictionary, the error scores can now be inserted with
# the correct key.
if callable(scoring):
_insert_error_scores(results, error_score)
results = _aggregate_score_dicts(results)
ret = {}
ret['fit_time'] = results["fit_time"]
ret['score_time'] = results["score_time"]
if return_estimator:
ret['estimator'] = results["estimator"]
test_scores_dict = _normalize_score_results(results["test_scores"])
if return_train_score:
train_scores_dict = _normalize_score_results(results["train_scores"])
for name in test_scores_dict:
ret['test_%s' % name] = test_scores_dict[name]
if return_train_score:
key = 'train_%s' % name
ret[key] = train_scores_dict[name]
return ret
def cross_val_score_eval_set(eval_set_selection,
estimator, X, y=None, groups=None, scoring=None,
cv=None, n_jobs=None, verbose=0, fit_params=None,
pre_dispatch='2*n_jobs', error_score=np.nan):
"""
Evaluate a score by cross-validation with `eval_set` argument in `fit_params`
This method is suitable for calculating cross validation score with `early_stopping_round` in XGBoost or LightGBM.
Parameters
----------
eval_set_selection : {'all', 'train', 'test', 'original', 'original_transformed'}
Select data passed to `eval_set` in `fit_params`. Available only if "estimator" is LightGBM or XGBoost.
If "all", use all data in `X` and `y`.
If "train", select train data from `X` and `y` using cv.split().
If "test", select test data from `X` and `y` using cv.split().
If "original", use raw `eval_set`.
If "original_transformed", use `eval_set` transformed by fit_transform() of pipeline if `estimater` is pipeline.
estimator : estimator object implementing 'fit'
The object to use to fit the data.
X : array-like of shape (n_samples, n_features)
The data to fit. Can be for example a list, or an array.
y : array-like of shape (n_samples,) or (n_samples, n_outputs), \
default=None
The target variable to try to predict in the case of
supervised learning.
groups : array-like of shape (n_samples,), default=None
Group labels for the samples used while splitting the dataset into
train/test set. Only used in conjunction with a "Group" :term:`cv`
instance (e.g., :class:`GroupKFold`).
scoring : str or callable, default=None
A str (see model evaluation documentation) or
a scorer callable object / function with signature
``scorer(estimator, X, y)`` which should return only
a single value.
Similar to :func:`cross_validate`
but only a single metric is permitted.
If None, the estimator's default scorer (if available) is used.
cv : int, cross-validation generator or an iterable, default=None
Determines the cross-validation splitting strategy.
Possible inputs for cv are:
- None, to use the default 5-fold cross validation,
- int, to specify the number of folds in a `(Stratified)KFold`,
- :term:`CV splitter`,
- An iterable yielding (train, test) splits as arrays of indices.
For int/None inputs, if the estimator is a classifier and ``y`` is
either binary or multiclass, :class:`StratifiedKFold` is used. In all
other cases, :class:`KFold` is used. These splitters are instantiated
with `shuffle=False` so the splits will be the same across calls.
Refer :ref:`User Guide <cross_validation>` for the various
cross-validation strategies that can be used here.
.. versionchanged:: 0.22
``cv`` default value if None changed from 3-fold to 5-fold.
n_jobs : int, default=None
Number of jobs to run in parallel. Training the estimator and computing
the score are parallelized over the cross-validation splits.
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
for more details.
verbose : int, default=0
The verbosity level.
fit_params : dict, default=None
Parameters to pass to the fit method of the estimator.
pre_dispatch : int or str, default='2*n_jobs'
Controls the number of jobs that get dispatched during parallel
execution. Reducing this number can be useful to avoid an
explosion of memory consumption when more jobs get dispatched
than CPUs can process. This parameter can be:
- None, in which case all the jobs are immediately
created and spawned. Use this for lightweight and
fast-running jobs, to avoid delays due to on-demand
spawning of the jobs
- An int, giving the exact number of total jobs that are
spawned
- A str, giving an expression as a function of n_jobs,
as in '2*n_jobs'
error_score : 'raise' or numeric, default=np.nan
Value to assign to the score if an error occurs in estimator fitting.
If set to 'raise', the error is raised.
If a numeric value is given, FitFailedWarning is raised.
.. versionadded:: 0.20
Returns
-------
scores : ndarray of float of shape=(len(list(cv)),)
Array of scores of the estimator for each run of the cross validation.
"""
# To ensure multimetric format is not supported
scorer = check_scoring(estimator, scoring=scoring)
cv_results = cross_validate_eval_set(eval_set_selection=eval_set_selection,
estimator=estimator, X=X, y=y, groups=groups,
scoring={'score': scorer}, cv=cv,
n_jobs=n_jobs, verbose=verbose,
fit_params=fit_params,
pre_dispatch=pre_dispatch,
error_score=error_score)
return cv_results['test_score']
def validation_curve_eval_set(eval_set_selection,
estimator, X, y, param_name, param_range, groups=None,
cv=None, scoring=None, n_jobs=None, pre_dispatch="all",
verbose=0, error_score=np.nan, fit_params=None):
"""Validation curve.
Determine training and test scores for varying parameter values with `eval_set` argument in `fit_params`
Parameters
----------
eval_set_selection : {'all', 'train', 'test', 'original', 'original_transformed'}
Select data passed to `eval_set` in `fit_params`. Available only if "estimator" is LightGBM or XGBoost.
If "all", use all data in `X` and `y`.
If "train", select train data from `X` and `y` using cv.split().
If "test", select test data from `X` and `y` using cv.split().
If "original", use raw `eval_set`.
If "original_transformed", use `eval_set` transformed by fit_transform() of pipeline if `estimater` is pipeline.
estimator : object type that implements the "fit" and "predict" methods
An object of that type which is cloned for each validation.
X : array-like of shape (n_samples, n_features)
Training vector, where n_samples is the number of samples and
n_features is the number of features.
y : array-like of shape (n_samples,) or (n_samples, n_outputs) or None
Target relative to X for classification or regression;
None for unsupervised learning.
param_name : str
Name of the parameter that will be varied.
param_range : array-like of shape (n_values,)
The values of the parameter that will be evaluated.
groups : array-like of shape (n_samples,), default=None
Group labels for the samples used while splitting the dataset into
train/test set. Only used in conjunction with a "Group" :term:`cv`
instance (e.g., :class:`GroupKFold`).
cv : int, cross-validation generator or an iterable, default=None
Determines the cross-validation splitting strategy.
Possible inputs for cv are:
- None, to use the default 5-fold cross validation,
- int, to specify the number of folds in a `(Stratified)KFold`,
- :term:`CV splitter`,
- An iterable yielding (train, test) splits as arrays of indices.
For int/None inputs, if the estimator is a classifier and ``y`` is
either binary or multiclass, :class:`StratifiedKFold` is used. In all
other cases, :class:`KFold` is used. These splitters are instantiated
with `shuffle=False` so the splits will be the same across calls.
Refer :ref:`User Guide <cross_validation>` for the various
cross-validation strategies that can be used here.
.. versionchanged:: 0.22
``cv`` default value if None changed from 3-fold to 5-fold.
scoring : str or callable, default=None
A str (see model evaluation documentation) or
a scorer callable object / function with signature
``scorer(estimator, X, y)``.
n_jobs : int, default=None
Number of jobs to run in parallel. Training the estimator and computing
the score are parallelized over the combinations of each parameter
value and each cross-validation split.
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
for more details.
pre_dispatch : int or str, default='all'
Number of predispatched jobs for parallel execution (default is
all). The option can reduce the allocated memory. The str can
be an expression like '2*n_jobs'.
verbose : int, default=0
Controls the verbosity: the higher, the more messages.
fit_params : dict, default=None
Parameters to pass to the fit method of the estimator.
.. versionadded:: 0.24
error_score : 'raise' or numeric, default=np.nan
Value to assign to the score if an error occurs in estimator fitting.
If set to 'raise', the error is raised.
If a numeric value is given, FitFailedWarning is raised.
.. versionadded:: 0.20
Returns
-------
train_scores : array of shape (n_ticks, n_cv_folds)
Scores on training sets.
test_scores : array of shape (n_ticks, n_cv_folds)
Scores on test set.
"""
X, y, groups = indexable(X, y, groups)
cv = check_cv(cv, y, classifier=is_classifier(estimator))
scorer = check_scoring(estimator, scoring=scoring)
# 最終学習器以外の前処理変換器作成
transformer = _make_transformer(eval_set_selection, estimator)
parallel = Parallel(n_jobs=n_jobs, pre_dispatch=pre_dispatch,
verbose=verbose)
results = parallel(delayed(_fit_and_score_eval_set)(
eval_set_selection, transformer,
clone(estimator), X, y, scorer, train, test, verbose,
parameters={param_name: v}, fit_params=fit_params,
return_train_score=True, error_score=error_score,
print_message=f'Caluculating score. {param_name}={v}')
# NOTE do not change order of iteration to allow one time cv splitters
for train, test in cv.split(X, y, groups) for v in param_range)
n_params = len(param_range)
results = _aggregate_score_dicts(results)
train_scores = results["train_scores"].reshape(-1, n_params).T
test_scores = results["test_scores"].reshape(-1, n_params).T
return train_scores, test_scores
def learning_curve_eval_set(eval_set_selection,
estimator, X, y, groups=None,
train_sizes=np.linspace(0.1, 1.0, 5), cv=None,
scoring=None, exploit_incremental_learning=False,
n_jobs=None, pre_dispatch="all", verbose=0, shuffle=False,
random_state=None, error_score=np.nan, return_times=False,
fit_params=None):
"""Learning curve.
Determines cross-validated training and test scores for different training set sizes with `eval_set` argument in `fit_params`
Parameters
----------
eval_set_selection : {'all', 'train', 'test', 'original', 'original_transformed'}
Select data passed to `eval_set` in `fit_params`. Available only if "estimator" is LightGBM or XGBoost.
If "all", use all data in `X` and `y`.
If "train", select train data from `X` and `y` using cv.split().
If "test", select test data from `X` and `y` using cv.split().
If "original", use raw `eval_set`.
If "original_transformed", use `eval_set` transformed by fit_transform() of pipeline if `estimater` is pipeline.
estimator : object type that implements the "fit" and "predict" methods
An object of that type which is cloned for each validation.
X : array-like of shape (n_samples, n_features)
Training vector, where n_samples is the number of samples and
n_features is the number of features.
y : array-like of shape (n_samples,) or (n_samples, n_outputs)
Target relative to X for classification or regression;
None for unsupervised learning.
groups : array-like of shape (n_samples,), default=None
Group labels for the samples used while splitting the dataset into
train/test set. Only used in conjunction with a "Group" :term:`cv`
instance (e.g., :class:`GroupKFold`).
train_sizes : array-like of shape (n_ticks,), \
default=np.linspace(0.1, 1.0, 5)
Relative or absolute numbers of training examples that will be used to
generate the learning curve. If the dtype is float, it is regarded as a
fraction of the maximum size of the training set (that is determined
by the selected validation method), i.e. it has to be within (0, 1].
Otherwise it is interpreted as absolute sizes of the training sets.
Note that for classification the number of samples usually have to
be big enough to contain at least one sample from each class.
cv : int, cross-validation generator or an iterable, default=None
Determines the cross-validation splitting strategy.
Possible inputs for cv are:
- None, to use the default 5-fold cross validation,
- int, to specify the number of folds in a `(Stratified)KFold`,
- :term:`CV splitter`,
- An iterable yielding (train, test) splits as arrays of indices.
For int/None inputs, if the estimator is a classifier and ``y`` is
either binary or multiclass, :class:`StratifiedKFold` is used. In all
other cases, :class:`KFold` is used. These splitters are instantiated
with `shuffle=False` so the splits will be the same across calls.
Refer :ref:`User Guide <cross_validation>` for the various
cross-validation strategies that can be used here.
.. versionchanged:: 0.22
``cv`` default value if None changed from 3-fold to 5-fold.
scoring : str or callable, default=None
A str (see model evaluation documentation) or
a scorer callable object / function with signature
``scorer(estimator, X, y)``.
exploit_incremental_learning : bool, default=False
If the estimator supports incremental learning, this will be
used to speed up fitting for different training set sizes.
n_jobs : int, default=None
Number of jobs to run in parallel. Training the estimator and computing
the score are parallelized over the different training and test sets.
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
for more details.
pre_dispatch : int or str, default='all'
Number of predispatched jobs for parallel execution (default is
all). The option can reduce the allocated memory. The str can
be an expression like '2*n_jobs'.
verbose : int, default=0
Controls the verbosity: the higher, the more messages.
shuffle : bool, default=False
Whether to shuffle training data before taking prefixes of it
based on``train_sizes``.
random_state : int, RandomState instance or None, default=None
Used when ``shuffle`` is True. Pass an int for reproducible
output across multiple function calls.
See :term:`Glossary <random_state>`.
error_score : 'raise' or numeric, default=np.nan
Value to assign to the score if an error occurs in estimator fitting.
If set to 'raise', the error is raised.
If a numeric value is given, FitFailedWarning is raised.
.. versionadded:: 0.20
return_times : bool, default=False
Whether to return the fit and score times.
fit_params : dict, default=None
Parameters to pass to the fit method of the estimator.
.. versionadded:: 0.24
Returns
-------
train_sizes_abs : array of shape (n_unique_ticks,)
Numbers of training examples that has been used to generate the
learning curve. Note that the number of ticks might be less
than n_ticks because duplicate entries will be removed.
train_scores : array of shape (n_ticks, n_cv_folds)
Scores on training sets.
test_scores : array of shape (n_ticks, n_cv_folds)
Scores on test set.
fit_times : array of shape (n_ticks, n_cv_folds)
Times spent for fitting in seconds. Only present if ``return_times``
is True.
score_times : array of shape (n_ticks, n_cv_folds)
Times spent for scoring in seconds. Only present if ``return_times``
is True.
"""
if exploit_incremental_learning and not hasattr(estimator, "partial_fit"):
raise ValueError("An estimator must support the partial_fit interface "
"to exploit incremental learning")
X, y, groups = indexable(X, y, groups)
cv = check_cv(cv, y, classifier=is_classifier(estimator))
# Store it as list as we will be iterating over the list multiple times
cv_iter = list(cv.split(X, y, groups))
scorer = check_scoring(estimator, scoring=scoring)
n_max_training_samples = len(cv_iter[0][0])
# Because the lengths of folds can be significantly different, it is
# not guaranteed that we use all of the available training data when we
# use the first 'n_max_training_samples' samples.
train_sizes_abs = _translate_train_sizes(train_sizes,
n_max_training_samples)
n_unique_ticks = train_sizes_abs.shape[0]
if verbose > 0:
print("[learning_curve] Training set sizes: " + str(train_sizes_abs))
# 最終学習器以外の前処理変換器作成
transformer = _make_transformer(eval_set_selection, estimator)
parallel = Parallel(n_jobs=n_jobs, pre_dispatch=pre_dispatch,
verbose=verbose)
if shuffle:
rng = check_random_state(random_state)
cv_iter = ((rng.permutation(train), test) for train, test in cv_iter)
if exploit_incremental_learning:
classes = np.unique(y) if is_classifier(estimator) else None
out = parallel(delayed(_incremental_fit_estimator)(
clone(estimator), X, y, classes, train, test, train_sizes_abs,
scorer, verbose, return_times, error_score=error_score,
fit_params=fit_params)
for train, test in cv_iter
)
out = np.asarray(out).transpose((2, 1, 0))
else:
train_test_proportions = []
for train, test in cv_iter:
for n_train_samples in train_sizes_abs:
train_test_proportions.append((train[:n_train_samples], test))
results = parallel(delayed(_fit_and_score_eval_set)(
eval_set_selection, transformer,
clone(estimator), X, y, scorer, train, test, verbose,
parameters=None, fit_params=fit_params, return_train_score=True,
error_score=error_score, return_times=return_times)
for train, test in train_test_proportions
)
results = _aggregate_score_dicts(results)
train_scores = results["train_scores"].reshape(-1, n_unique_ticks).T
test_scores = results["test_scores"].reshape(-1, n_unique_ticks).T
out = [train_scores, test_scores]
if return_times:
fit_times = results["fit_time"].reshape(-1, n_unique_ticks).T
score_times = results["score_time"].reshape(-1, n_unique_ticks).T
out.extend([fit_times, score_times])
ret = train_sizes_abs, out[0], out[1]
if return_times:
ret = ret + (out[2], out[3])
return ret
class GridSearchCVEvalSet(GridSearchCV):
"""
Exhaustive search over specified parameter values for an estimator with `eval_set` argument in `fit_params`.
"""
def fit(self, eval_set_selection,
X, y=None, groups=None, **fit_params):
"""Run fit with all sets of parameters.
Parameters
----------
eval_set_selection : {'all', 'train', 'test', 'original', 'original_transformed'}
Select data passed to `eval_set` in `fit_params`. Available only if "estimator" is LightGBM or XGBoost.
If "all", use all data in `X` and `y`.
If "train", select train data from `X` and `y` using cv.split().
If "test", select test data from `X` and `y` using cv.split().
If "original", use raw `eval_set`.
If "original_transformed", use `eval_set` transformed by fit_transform() of pipeline if `estimater` is pipeline.
X : array-like of shape (n_samples, n_features)
Training vector, where n_samples is the number of samples and
n_features is the number of features.
y : array-like of shape (n_samples, n_output) \
or (n_samples,), default=None
Target relative to X for classification or regression;
None for unsupervised learning.
groups : array-like of shape (n_samples,), default=None
Group labels for the samples used while splitting the dataset into
train/test set. Only used in conjunction with a "Group" :term:`cv`
instance (e.g., :class:`~sklearn.model_selection.GroupKFold`).
**fit_params : dict of str -> object
Parameters passed to the ``fit`` method of the estimator
"""
estimator = self.estimator
refit_metric = "score"
if callable(self.scoring):
scorers = self.scoring
elif self.scoring is None or isinstance(self.scoring, str):
scorers = check_scoring(self.estimator, self.scoring)
else:
scorers = _check_multimetric_scoring(self.estimator, self.scoring)
self._check_refit_for_multimetric(scorers)
refit_metric = self.refit
X, y, groups = indexable(X, y, groups)
fit_params = _check_fit_params(X, fit_params)
cv_orig = check_cv(self.cv, y, classifier=is_classifier(estimator))
n_splits = cv_orig.get_n_splits(X, y, groups)
base_estimator = clone(self.estimator)
# 最終学習器以外の前処理変換器作成
transformer = _make_transformer(eval_set_selection, estimator)
parallel = Parallel(n_jobs=self.n_jobs,
pre_dispatch=self.pre_dispatch)
fit_and_score_kwargs = dict(scorer=scorers,
fit_params=fit_params,
return_train_score=self.return_train_score,
return_n_test_samples=True,
return_times=True,
return_parameters=False,
error_score=self.error_score,
verbose=self.verbose)
results = {}
with parallel:
all_candidate_params = []
all_out = []
all_more_results = defaultdict(list)
def evaluate_candidates(candidate_params, cv=None,
more_results=None):
cv = cv or cv_orig
candidate_params = list(candidate_params)
n_candidates = len(candidate_params)
if self.verbose > 0:
print("Fitting {0} folds for each of {1} candidates,"
" totalling {2} fits".format(
n_splits, n_candidates, n_candidates * n_splits))
out = parallel(delayed(_fit_and_score_eval_set)(
eval_set_selection, transformer,
clone(base_estimator),
X, y,
train=train, test=test,
parameters=parameters,
split_progress=(
split_idx,
n_splits),
candidate_progress=(
cand_idx,
n_candidates),
print_message=f'cand={cand_idx}/{n_candidates}, cv={split_idx}: {parameters}',
**fit_and_score_kwargs)
for (cand_idx, parameters),
(split_idx, (train, test)) in product(
enumerate(candidate_params),
enumerate(cv.split(X, y, groups))))
if len(out) < 1:
raise ValueError('No fits were performed. '
'Was the CV iterator empty? '
'Were there no candidates?')
elif len(out) != n_candidates * n_splits:
raise ValueError('cv.split and cv.get_n_splits returned '
'inconsistent results. Expected {} '
'splits, got {}'
.format(n_splits,
len(out) // n_candidates))
# For callable self.scoring, the return type is only know after
# calling. If the return type is a dictionary, the error scores
# can now be inserted with the correct key. The type checking
# of out will be done in `_insert_error_scores`.
if callable(self.scoring):
_insert_error_scores(out, self.error_score)
all_candidate_params.extend(candidate_params)
all_out.extend(out)
if more_results is not None:
for key, value in more_results.items():
all_more_results[key].extend(value)
nonlocal results
results = self._format_results(
all_candidate_params, n_splits, all_out,
all_more_results)
return results
self._run_search(evaluate_candidates)
# multimetric is determined here because in the case of a callable
# self.scoring the return type is only known after calling
first_test_score = all_out[0]['test_scores']
self.multimetric_ = isinstance(first_test_score, dict)
# check refit_metric now for a callabe scorer that is multimetric
if callable(self.scoring) and self.multimetric_:
self._check_refit_for_multimetric(first_test_score)
refit_metric = self.refit
# For multi-metric evaluation, store the best_index_, best_params_ and
# best_score_ iff refit is one of the scorer names
# In single metric evaluation, refit_metric is "score"
if self.refit or not self.multimetric_:
# If callable, refit is expected to return the index of the best
# parameter set.
if callable(self.refit):
self.best_index_ = self.refit(results)
if not isinstance(self.best_index_, numbers.Integral):
raise TypeError('best_index_ returned is not an integer')
if (self.best_index_ < 0 or
self.best_index_ >= len(results["params"])):
raise IndexError('best_index_ index out of range')
else:
self.best_index_ = results["rank_test_%s"
% refit_metric].argmin()
self.best_score_ = results["mean_test_%s" % refit_metric][
self.best_index_]
self.best_params_ = results["params"][self.best_index_]
if self.refit:
# we clone again after setting params in case some
# of the params are estimators as well.
self.best_estimator_ = clone(clone(base_estimator).set_params(
**self.best_params_))
refit_start_time = time.time()
if y is not None:
self.best_estimator_.fit(X, y, **fit_params)
else:
self.best_estimator_.fit(X, **fit_params)
refit_end_time = time.time()
self.refit_time_ = refit_end_time - refit_start_time
# Store the only scorer not as a dict for single metric evaluation
self.scorer_ = scorers
self.cv_results_ = results
self.n_splits_ = n_splits
return self
class RandomizedSearchCVEvalSet(RandomizedSearchCV):
"""
Randomized search on hyper parameters with `eval_set` argument in `fit_params`.
"""
def fit(self, eval_set_selection,
X, y=None, groups=None, **fit_params):
"""Run fit with all sets of parameters.
Parameters
----------
eval_set_selection : {'all', 'train', 'test', 'original', 'original_transformed'}
Select data passed to `eval_set` in `fit_params`. Available only if "estimator" is LightGBM or XGBoost.
If "all", use all data in `X` and `y`.
If "train", select train data from `X` and `y` using cv.split().
If "test", select test data from `X` and `y` using cv.split().
If "original", use raw `eval_set`.
If "original_transformed", use `eval_set` transformed by fit_transform() of pipeline if `estimater` is pipeline.
X : array-like of shape (n_samples, n_features)
Training vector, where n_samples is the number of samples and
n_features is the number of features.
y : array-like of shape (n_samples, n_output) \
or (n_samples,), default=None
Target relative to X for classification or regression;
None for unsupervised learning.
groups : array-like of shape (n_samples,), default=None
Group labels for the samples used while splitting the dataset into
train/test set. Only used in conjunction with a "Group" :term:`cv`
instance (e.g., :class:`~sklearn.model_selection.GroupKFold`).
**fit_params : dict of str -> object
Parameters passed to the ``fit`` method of the estimator
"""
estimator = self.estimator
refit_metric = "score"
if callable(self.scoring):
scorers = self.scoring
elif self.scoring is None or isinstance(self.scoring, str):
scorers = check_scoring(self.estimator, self.scoring)
else:
scorers = _check_multimetric_scoring(self.estimator, self.scoring)
self._check_refit_for_multimetric(scorers)
refit_metric = self.refit
X, y, groups = indexable(X, y, groups)
fit_params = _check_fit_params(X, fit_params)
cv_orig = check_cv(self.cv, y, classifier=is_classifier(estimator))
n_splits = cv_orig.get_n_splits(X, y, groups)
base_estimator = clone(self.estimator)
# 最終学習器以外の前処理変換器作成
transformer = _make_transformer(eval_set_selection, estimator)
parallel = Parallel(n_jobs=self.n_jobs,
pre_dispatch=self.pre_dispatch)
fit_and_score_kwargs = dict(scorer=scorers,
fit_params=fit_params,
return_train_score=self.return_train_score,
return_n_test_samples=True,
return_times=True,
return_parameters=False,
error_score=self.error_score,
verbose=self.verbose)
results = {}
with parallel:
all_candidate_params = []
all_out = []
all_more_results = defaultdict(list)
def evaluate_candidates(candidate_params, cv=None,
more_results=None):
cv = cv or cv_orig
candidate_params = list(candidate_params)
n_candidates = len(candidate_params)
if self.verbose > 0:
print("Fitting {0} folds for each of {1} candidates,"
" totalling {2} fits".format(
n_splits, n_candidates, n_candidates * n_splits))
out = parallel(delayed(_fit_and_score_eval_set)(
eval_set_selection, transformer,
clone(base_estimator),
X, y,
train=train, test=test,
parameters=parameters,
split_progress=(
split_idx,
n_splits),
candidate_progress=(
cand_idx,
n_candidates),
print_message=f'cand={cand_idx}/{n_candidates}, cv={split_idx}: {parameters}',
**fit_and_score_kwargs)
for (cand_idx, parameters),
(split_idx, (train, test)) in product(
enumerate(candidate_params),
enumerate(cv.split(X, y, groups))))
if len(out) < 1:
raise ValueError('No fits were performed. '
'Was the CV iterator empty? '
'Were there no candidates?')
elif len(out) != n_candidates * n_splits:
raise ValueError('cv.split and cv.get_n_splits returned '
'inconsistent results. Expected {} '
'splits, got {}'
.format(n_splits,
len(out) // n_candidates))
# For callable self.scoring, the return type is only know after
# calling. If the return type is a dictionary, the error scores
# can now be inserted with the correct key. The type checking
# of out will be done in `_insert_error_scores`.
if callable(self.scoring):
_insert_error_scores(out, self.error_score)
all_candidate_params.extend(candidate_params)
all_out.extend(out)
if more_results is not None:
for key, value in more_results.items():
all_more_results[key].extend(value)
nonlocal results
results = self._format_results(
all_candidate_params, n_splits, all_out,
all_more_results)
return results
self._run_search(evaluate_candidates)
# multimetric is determined here because in the case of a callable
# self.scoring the return type is only known after calling
first_test_score = all_out[0]['test_scores']
self.multimetric_ = isinstance(first_test_score, dict)
# check refit_metric now for a callabe scorer that is multimetric
if callable(self.scoring) and self.multimetric_:
self._check_refit_for_multimetric(first_test_score)
refit_metric = self.refit
# For multi-metric evaluation, store the best_index_, best_params_ and
# best_score_ iff refit is one of the scorer names
# In single metric evaluation, refit_metric is "score"
if self.refit or not self.multimetric_:
# If callable, refit is expected to return the index of the best
# parameter set.
if callable(self.refit):
self.best_index_ = self.refit(results)
if not isinstance(self.best_index_, numbers.Integral):
raise TypeError('best_index_ returned is not an integer')
if (self.best_index_ < 0 or
self.best_index_ >= len(results["params"])):
raise IndexError('best_index_ index out of range')
else:
self.best_index_ = results["rank_test_%s"
% refit_metric].argmin()
self.best_score_ = results["mean_test_%s" % refit_metric][
self.best_index_]
self.best_params_ = results["params"][self.best_index_]
if self.refit:
# we clone again after setting params in case some
# of the params are estimators as well.
self.best_estimator_ = clone(clone(base_estimator).set_params(
**self.best_params_))
refit_start_time = time.time()
if y is not None:
self.best_estimator_.fit(X, y, **fit_params)
else:
self.best_estimator_.fit(X, **fit_params)
refit_end_time = time.time()
self.refit_time_ = refit_end_time - refit_start_time
# Store the only scorer not as a dict for single metric evaluation
self.scorer_ = scorers
self.cv_results_ = results
self.n_splits_ = n_splits
return self
| 44.746141
| 186
| 0.611933
| 6,447
| 52,174
| 4.770436
| 0.085311
| 0.022078
| 0.023411
| 0.010405
| 0.76238
| 0.741798
| 0.71946
| 0.705089
| 0.703073
| 0.689286
| 0
| 0.003516
| 0.313221
| 52,174
| 1,166
| 187
| 44.746141
| 0.854795
| 0.472918
| 0
| 0.61978
| 0
| 0.004396
| 0.057266
| 0.002432
| 0
| 0
| 0
| 0
| 0
| 1
| 0.028571
| false
| 0
| 0.035165
| 0
| 0.103297
| 0.021978
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
a1b169ddd2786bebc309b574b7e01a7c888a0665
| 320
|
py
|
Python
|
ci/ci/utils.py
|
3vivekb/hail
|
82c9e0f3ec2154335f91f2219b84c0fb5dbac526
|
[
"MIT"
] | 1
|
2022-01-03T13:46:08.000Z
|
2022-01-03T13:46:08.000Z
|
ci/ci/utils.py
|
3vivekb/hail
|
82c9e0f3ec2154335f91f2219b84c0fb5dbac526
|
[
"MIT"
] | 2
|
2016-08-12T18:38:24.000Z
|
2018-09-05T15:26:35.000Z
|
ci/ci/utils.py
|
3vivekb/hail
|
82c9e0f3ec2154335f91f2219b84c0fb5dbac526
|
[
"MIT"
] | null | null | null |
import string
import secrets
def generate_token(size=12):
assert size > 0
alpha = string.ascii_lowercase
alnum = string.ascii_lowercase + string.digits
return secrets.choice(alpha) + ''.join([secrets.choice(alnum) for _ in range(size - 1)])
def flatten(xxs):
return [x for xs in xxs for x in xs]
| 22.857143
| 92
| 0.696875
| 48
| 320
| 4.5625
| 0.541667
| 0.100457
| 0.182648
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015625
| 0.2
| 320
| 13
| 93
| 24.615385
| 0.839844
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 1
| 0.222222
| false
| 0
| 0.222222
| 0.111111
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
a1b2f026a109f995bc10f5b5c1affde7cce010bf
| 3,940
|
py
|
Python
|
profil/migrations/0007_auto_20210708_1004.py
|
dafis/skilldb
|
b14f5951de6b64a625fe26a022cbf65644851f1f
|
[
"MIT"
] | null | null | null |
profil/migrations/0007_auto_20210708_1004.py
|
dafis/skilldb
|
b14f5951de6b64a625fe26a022cbf65644851f1f
|
[
"MIT"
] | 6
|
2021-07-08T07:16:08.000Z
|
2021-07-12T11:09:06.000Z
|
profil/migrations/0007_auto_20210708_1004.py
|
dafis/skilldb
|
b14f5951de6b64a625fe26a022cbf65644851f1f
|
[
"MIT"
] | 1
|
2021-07-08T07:26:22.000Z
|
2021-07-08T07:26:22.000Z
|
# Generated by Django 3.2.5 on 2021-07-08 10:04
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0023_add_choose_permissions'),
('profil', '0006_auto_20210708_0919'),
]
operations = [
migrations.RemoveField(
model_name='softskill',
name='description',
),
migrations.AlterField(
model_name='certificate',
name='description',
field=models.TextField(verbose_name='Description'),
),
migrations.AlterField(
model_name='certificate',
name='name',
field=models.CharField(max_length=100, verbose_name='Title'),
),
migrations.AlterField(
model_name='certificate',
name='provider',
field=models.CharField(max_length=100, verbose_name='Instution'),
),
migrations.AlterField(
model_name='education',
name='description',
field=models.TextField(verbose_name='Description'),
),
migrations.AlterField(
model_name='education',
name='from_date',
field=models.DateField(verbose_name='From'),
),
migrations.AlterField(
model_name='education',
name='name',
field=models.CharField(max_length=100, verbose_name='Title'),
),
migrations.AlterField(
model_name='education',
name='provider',
field=models.TextField(max_length=100, verbose_name='Institution'),
),
migrations.AlterField(
model_name='education',
name='to_date',
field=models.DateField(verbose_name='To'),
),
migrations.AlterField(
model_name='employment',
name='description',
field=models.TextField(verbose_name='Description'),
),
migrations.AlterField(
model_name='employment',
name='employer',
field=models.TextField(max_length=100, verbose_name='Employer'),
),
migrations.AlterField(
model_name='employment',
name='name',
field=models.CharField(max_length=100, verbose_name='Title'),
),
migrations.AlterField(
model_name='profilepage',
name='birth_date',
field=models.DateField(blank=True, null=True, verbose_name='Birth Date'),
),
migrations.AlterField(
model_name='profilepage',
name='first_name',
field=models.CharField(max_length=100, verbose_name='First Name'),
),
migrations.AlterField(
model_name='profilepage',
name='last_name',
field=models.CharField(max_length=100, verbose_name='Last Name'),
),
migrations.AlterField(
model_name='profilepage',
name='profile_image',
field=models.ForeignKey(help_text='Profile Image', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
),
migrations.AlterField(
model_name='softskill',
name='name',
field=models.CharField(max_length=100, verbose_name='Name'),
),
migrations.AlterField(
model_name='training',
name='description',
field=models.TextField(verbose_name='Description'),
),
migrations.AlterField(
model_name='training',
name='name',
field=models.CharField(max_length=100, verbose_name='Title'),
),
migrations.AlterField(
model_name='training',
name='provider',
field=models.CharField(max_length=100, verbose_name='Provider'),
),
]
| 34.26087
| 164
| 0.571827
| 355
| 3,940
| 6.16338
| 0.202817
| 0.082267
| 0.217093
| 0.251828
| 0.740402
| 0.738574
| 0.542505
| 0.498629
| 0.429159
| 0.386197
| 0
| 0.024945
| 0.308122
| 3,940
| 114
| 165
| 34.561404
| 0.777696
| 0.011421
| 0
| 0.740741
| 1
| 0
| 0.154123
| 0.012844
| 0.009259
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.018519
| 0
| 0.046296
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
a1bda72acf4b8cb36f3428edb54aefbd7a90a2f5
| 288
|
py
|
Python
|
PytorchCudaOpExtension/adaptive_sigmoid/setup.py
|
Zhaoyi-Yan/PFDNet
|
86798fbc4fadc673e7912c08492ea3611bc20154
|
[
"MIT"
] | 4
|
2021-07-12T00:00:30.000Z
|
2022-01-26T12:05:50.000Z
|
PytorchCudaOpExtension/adaptive_sigmoid/setup.py
|
Zhaoyi-Yan/PFDNet
|
86798fbc4fadc673e7912c08492ea3611bc20154
|
[
"MIT"
] | 2
|
2021-01-07T03:29:48.000Z
|
2021-07-12T07:41:58.000Z
|
PytorchCudaOpExtension/adaptive_sigmoid/setup.py
|
Zhaoyi-Yan/PFDNet
|
86798fbc4fadc673e7912c08492ea3611bc20154
|
[
"MIT"
] | 3
|
2021-07-12T00:00:32.000Z
|
2022-03-09T07:08:46.000Z
|
from setuptools import setup
from torch.utils.cpp_extension import CppExtension, BuildExtension, CUDAExtension
setup(name='adaptive_sigmoid', ext_modules=[CUDAExtension('adaptive_sigmoid_gpu',['adaptive_sigmoid.cpp', 'adaptive_sigmoid_cuda.cu']),], cmdclass={'build_ext': BuildExtension})
| 96
| 177
| 0.829861
| 34
| 288
| 6.764706
| 0.617647
| 0.26087
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.048611
| 288
| 3
| 177
| 96
| 0.839416
| 0
| 0
| 0
| 0
| 0
| 0.307958
| 0.083045
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
a1d66f8efe44b3b4e3f8d7778640e65dee87f7ef
| 865
|
py
|
Python
|
reasoning/python/prime.py
|
pmoura/eye
|
03a4be110f5e9f8f21a6b1ac2756d79cc6518386
|
[
"MIT"
] | null | null | null |
reasoning/python/prime.py
|
pmoura/eye
|
03a4be110f5e9f8f21a6b1ac2756d79cc6518386
|
[
"MIT"
] | null | null | null |
reasoning/python/prime.py
|
pmoura/eye
|
03a4be110f5e9f8f21a6b1ac2756d79cc6518386
|
[
"MIT"
] | null | null | null |
# See https://en.wikipedia.org/wiki/Prime_number
from sympy import primerange, isprime, nextprime, totient
if __name__ == "__main__":
cases = [
"list(primerange(0, 100))",
"list(primerange(1000000, 1000100))",
"isprime(6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151)",
"nextprime(6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151)",
"totient(271)",
"totient(2718281)",
"totient(27182818284)",
"totient(271828182845904)",
"totient(2718281828459045235360287471352662497757247)"
]
for c in cases:
print('[] :python-answer """%s = %s""".' % (c, eval(c)))
| 43.25
| 179
| 0.734104
| 53
| 865
| 11.811321
| 0.716981
| 0.044728
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.563786
| 0.157225
| 865
| 19
| 180
| 45.526316
| 0.294925
| 0.053179
| 0
| 0
| 0
| 0
| 0.680539
| 0.531212
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.066667
| 0
| 0.066667
| 0.066667
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
6299acd6ec1fa2d7e7e8dbb4a017c93d56711e17
| 258
|
py
|
Python
|
import-from-dir/mods/Math.py
|
brenordv/python-snippets
|
aa69d4d64f7b9cea958ad852248210f4e869fe50
|
[
"MIT"
] | 2
|
2020-04-10T21:20:22.000Z
|
2021-01-17T19:28:32.000Z
|
import-from-dir/mods/Math.py
|
brenordv/python-snippets
|
aa69d4d64f7b9cea958ad852248210f4e869fe50
|
[
"MIT"
] | null | null | null |
import-from-dir/mods/Math.py
|
brenordv/python-snippets
|
aa69d4d64f7b9cea958ad852248210f4e869fe50
|
[
"MIT"
] | 2
|
2020-07-20T20:24:01.000Z
|
2022-02-27T15:40:40.000Z
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Math.py: Just a sample file with a function.
This material is part of this post:
http://raccoon.ninja/pt/dev-pt/python-importando-todos-os-arquivos-de-um-diretorio/
"""
def calc_sum(a, b):
return a + b
| 21.5
| 83
| 0.678295
| 45
| 258
| 3.866667
| 0.844444
| 0.022989
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004545
| 0.147287
| 258
| 12
| 84
| 21.5
| 0.786364
| 0.802326
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 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
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
62a0640c8f73a1c6b06f7ab04290a621510f7049
| 2,130
|
py
|
Python
|
libs/models/__init__.py
|
awesome-archive/deeplab-pytorch
|
f7a07fee9b05c7131c1ce4795f03c74dbf842efb
|
[
"MIT"
] | null | null | null |
libs/models/__init__.py
|
awesome-archive/deeplab-pytorch
|
f7a07fee9b05c7131c1ce4795f03c74dbf842efb
|
[
"MIT"
] | null | null | null |
libs/models/__init__.py
|
awesome-archive/deeplab-pytorch
|
f7a07fee9b05c7131c1ce4795f03c74dbf842efb
|
[
"MIT"
] | null | null | null |
from __future__ import absolute_import
from .resnet import *
from .deeplabv2 import *
from .deeplabv3 import *
from .deeplabv3plus import *
from .msc import *
def init_weights(model):
for m in model.modules():
if isinstance(m, nn.Conv2d):
nn.init.kaiming_normal_(m.weight)
if m.bias is not None:
nn.init.constant_(m.bias, 0)
elif isinstance(m, nn.Linear):
nn.init.kaiming_normal_(m.weight)
if m.bias is not None:
nn.init.constant_(m.bias, 0)
elif isinstance(m, nn.BatchNorm2d):
nn.init.constant_(m.weight, 1)
if m.bias is not None:
nn.init.constant_(m.bias, 0)
def DeepLabV2_ResNet101_MSC(n_classes):
return MSC(
base=DeepLabV2(
n_classes=n_classes, n_blocks=[3, 4, 23, 3], atrous_rates=[6, 12, 18, 24]
),
scales=[0.5, 0.75],
)
def DeepLabV2S_ResNet101_MSC(n_classes):
return MSC(
base=DeepLabV2(
n_classes=n_classes, n_blocks=[3, 4, 23, 3], atrous_rates=[3, 6, 9, 12]
),
scales=[0.5, 0.75],
)
def DeepLabV3_ResNet101_MSC(n_classes, output_stride):
if output_stride == 16:
atrous_rates = [6, 12, 18]
elif output_stride == 8:
atrous_rates = [12, 24, 36]
else:
NotImplementedError
return MSC(
base=DeepLabV3(
n_classes=n_classes,
n_blocks=[3, 4, 23, 3],
atrous_rates=atrous_rates,
multi_grids=[1, 2, 4],
output_stride=output_stride,
),
scales=[0.5, 0.75],
)
def DeepLabV3Plus_ResNet101_MSC(n_classes, output_stride):
if output_stride == 16:
atrous_rates = [6, 12, 18]
elif output_stride == 8:
atrous_rates = [12, 24, 36]
else:
NotImplementedError
return MSC(
base=DeepLabV3Plus(
n_classes=n_classes,
n_blocks=[3, 4, 23, 3],
atrous_rates=atrous_rates,
multi_grids=[1, 2, 4],
output_stride=output_stride,
),
scales=[0.5, 0.75],
)
| 26.296296
| 85
| 0.566197
| 280
| 2,130
| 4.092857
| 0.228571
| 0.08377
| 0.062827
| 0.052356
| 0.746946
| 0.742583
| 0.715532
| 0.715532
| 0.715532
| 0.715532
| 0
| 0.07953
| 0.321127
| 2,130
| 80
| 86
| 26.625
| 0.713001
| 0
| 0
| 0.647059
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.073529
| false
| 0
| 0.088235
| 0.029412
| 0.220588
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
62fcd1aa7110f3d652916384bcacfc13a25b44ca
| 74
|
py
|
Python
|
vsmlib/corpus/__init__.py
|
berntham/vsmlib
|
b2ed762ff50b5dcdd6999ad75c205557e70c6598
|
[
"Apache-2.0"
] | 16
|
2017-01-04T05:18:42.000Z
|
2021-08-08T09:31:08.000Z
|
vsmlib/corpus/__init__.py
|
berntham/vsmlib
|
b2ed762ff50b5dcdd6999ad75c205557e70c6598
|
[
"Apache-2.0"
] | 8
|
2017-07-01T04:23:53.000Z
|
2019-01-04T04:03:45.000Z
|
vsmlib/corpus/__init__.py
|
berntham/vsmlib
|
b2ed762ff50b5dcdd6999ad75c205557e70c6598
|
[
"Apache-2.0"
] | 2
|
2017-10-31T02:21:08.000Z
|
2021-01-07T00:03:23.000Z
|
from .corpus import load_file_as_ids, FileTokenIterator, DirTokenIterator
| 37
| 73
| 0.878378
| 9
| 74
| 6.888889
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.081081
| 74
| 1
| 74
| 74
| 0.911765
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
1a1a220bade2062cfa4f0c459a5dad0b80a6806b
| 60
|
py
|
Python
|
test/regression/features/integers/unary_minus.py
|
ppelleti/berp
|
30925288376a6464695341445688be64ac6b2600
|
[
"BSD-3-Clause"
] | 137
|
2015-02-13T21:03:23.000Z
|
2021-11-24T03:53:55.000Z
|
test/regression/features/integers/unary_minus.py
|
ppelleti/berp
|
30925288376a6464695341445688be64ac6b2600
|
[
"BSD-3-Clause"
] | 4
|
2015-04-01T13:49:13.000Z
|
2019-07-09T19:28:56.000Z
|
test/regression/features/integers/unary_minus.py
|
bjpop/berp
|
30925288376a6464695341445688be64ac6b2600
|
[
"BSD-3-Clause"
] | 8
|
2015-04-25T03:47:52.000Z
|
2019-07-27T06:33:56.000Z
|
print(-1)
print(-0)
print(-(6))
print(-(12*2))
print(- -10)
| 10
| 14
| 0.55
| 11
| 60
| 3
| 0.636364
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.148148
| 0.1
| 60
| 5
| 15
| 12
| 0.462963
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
1a2051a759d02409e969560f11dca813c8a4b804
| 6,971
|
py
|
Python
|
examples/FFBPmp_demo.py
|
jks7592/RITSAR
|
8ecfef00bc8db779a60698d8dd0698551ed78cd5
|
[
"MIT"
] | null | null | null |
examples/FFBPmp_demo.py
|
jks7592/RITSAR
|
8ecfef00bc8db779a60698d8dd0698551ed78cd5
|
[
"MIT"
] | null | null | null |
examples/FFBPmp_demo.py
|
jks7592/RITSAR
|
8ecfef00bc8db779a60698d8dd0698551ed78cd5
|
[
"MIT"
] | 1
|
2022-03-06T07:38:20.000Z
|
2022-03-06T07:38:20.000Z
|
##############################################################################
# #
# This is a demonstration of the Fast Factorized Backprojection algorithm. #
# Data sets can be switched in and out by commenting/uncommenting the lines #
# of code below. #
# #
##############################################################################
#Add include directories to default path list
from sys import path
path.append('../')
path.append('./dictionaries')
#Include Dictionaries
from SARplatform import plat_dict
#Include standard library dependencies
import matplotlib.pylab as plt
from time import time
#Include SARIT toolset
from ritsar import phsTools
from ritsar import phsRead
from ritsar import imgTools
if __name__ == '__main__':
'''
#simulated FFBP demo
##############################################################################
#Create platform dictionary
platform = plat_dict()
#Create image plane dictionary
img_plane = imgTools.img_plane_dict(platform, aspect = 1, res_factor=0.9)
#Simulate phase history
nsamples = platform['nsamples']
npulses = platform['npulses']
x = img_plane['u']; y = img_plane['v']
points = [[0,0,0],
[200,0,0],
[0,100,0]]
amplitudes = [1,1,1]
phs = phsTools.simulate_phs(platform, points, amplitudes)
#Apply RVP correction
phs = phsTools.RVP_correct(phs, platform)
#full backprojection
start = time()
img_bp = imgTools.backprojection(phs, platform, img_plane, taylor = 17, upsample = 2)
bp_time = time()-start
#Fast-factorized backprojection without multi-processing
start = time()
img_FFBP = imgTools.FFBP(phs, platform, img_plane, taylor = 17, factor_max = 4)
fbp_time = time()-start
#Fast-factorized backprojection with multi-processing
start = time()
img_FFBP = imgTools.FFBPmp(phs, platform, img_plane, taylor = 17, factor_max = 4)
fbpmp_time = time()-start
#Output image
u = img_plane['u']; v = img_plane['v']
extent = [u.min(), u.max(), v.min(), v.max()]
plt.subplot(2,1,1)
plt.title('Full Backprojection \n \
Runtime = %i s'%bp_time)
imgTools.imshow(img_bp, dB_scale = [-25,0], extent = extent)
plt.xlabel('meters'); plt.ylabel('meters')
plt.subplot(2,2,3)
plt.title('Fast Factorized Backprojection \n w/o multi-processing \n \
Runtime = %i s'%fbp_time)
imgTools.imshow(img_FFBP, dB_scale = [-25,0], extent = extent)
plt.xlabel('meters'); plt.ylabel('meters')
plt.subplot(2,2,4)
plt.title('Fast Factorized Backprojection \n w/ multi-processing \n \
Runtime = %i s'%fbpmp_time)
imgTools.imshow(img_FFBP, dB_scale = [-25,0], extent = extent)
plt.xlabel('meters'); plt.ylabel('meters')
plt.tight_layout()
'''
#AFRL DSBP demo
###############################################################################
#Define top level directory containing *.mat file
#and choose polarization and starting azimuth
pol = 'HH'
directory = './data/AFRL/pass1'
start_az = 1
#Import phase history and create platform dictionary
[phs, platform] = phsRead.AFRL(directory, start_az, pol, n_az = 4)
#Create image plane dictionary
img_plane = imgTools.img_plane_dict(platform, res_factor = 1.0, upsample = True, aspect = 1.0)
#full backprojection
start = time()
img_bp = imgTools.backprojection(phs, platform, img_plane, taylor = 17, upsample = 2)
bp_time = time()-start
#Fast-factorized backprojection without multi-processing
start = time()
img_FFBP = imgTools.FFBP(phs, platform, img_plane, taylor = 17, factor_max = 2)
fbp_time = time()-start
#Fast-factorized backprojection with multi-processing
start = time()
img_FFBP = imgTools.FFBPmp(phs, platform, img_plane, taylor = 17, factor_max = 2)
fbpmp_time = time()-start
#Output image
u = img_plane['u']; v = img_plane['v']
extent = [u.min(), u.max(), v.min(), v.max()]
plt.subplot(2,1,1)
plt.title('Full Backprojection \n \
Runtime = %i s'%bp_time)
imgTools.imshow(img_bp, dB_scale = [-30,0], extent = extent)
plt.xlabel('meters'); plt.ylabel('meters')
plt.subplot(2,2,3)
plt.title('Fast Factorized Backprojection \n w/o multi-processing \n \
Runtime = %i s'%fbp_time)
imgTools.imshow(img_FFBP, dB_scale = [-30,0], extent = extent)
plt.xlabel('meters'); plt.ylabel('meters')
plt.subplot(2,2,4)
plt.title('Fast Factorized Backprojection \n w/ multi-processing \n \
Runtime = %i s'%fbpmp_time)
imgTools.imshow(img_FFBP, dB_scale = [-30,0], extent = extent)
plt.xlabel('meters'); plt.ylabel('meters')
plt.tight_layout()
'''
#DIRSIG DSBP demo
###############################################################################
#Define directory containing *.au2 and *.phs files
directory = './data/DIRSIG/'
#Import phase history and create platform dictionary
[phs, platform] = phsRead.DIRSIG(directory)
#Correct for reisdual video phase
phs_corr = phsTools.RVP_correct(phs, platform)
#Import image plane dictionary from './parameters/img_plane'
img_plane = imgTools.img_plane_dict(platform, res_factor = 1.0, aspect = 1.0)
#full backprojection
start = time()
img_bp = imgTools.backprojection(phs, platform, img_plane, taylor = 17, upsample = 2)
bp_time = time()-start
#Fast-factorized backprojection without multi-processing
start = time()
img_FFBP = imgTools.FFBP(phs, platform, img_plane, taylor = 17, factor_max = 4)
fbp_time = time()-start
#Fast-factorized backprojection with multi-processing
start = time()
img_FFBP = imgTools.FFBPmp(phs, platform, img_plane, taylor = 17, factor_max = 4)
fbpmp_time = time()-start
#Output image
u = img_plane['u']; v = img_plane['v']
extent = [u.min(), u.max(), v.min(), v.max()]
plt.subplot(2,1,1)
plt.title('Full Backprojection \n \
Runtime = %i s'%bp_time)
imgTools.imshow(img_bp, dB_scale = [-25,0], extent = extent)
plt.xlabel('meters'); plt.ylabel('meters')
plt.subplot(2,2,3)
plt.title('Fast Factorized Backprojection \n w/o multi-processing \n \
Runtime = %i s'%fbp_time)
imgTools.imshow(img_FFBP, dB_scale = [-25,0], extent = extent)
plt.xlabel('meters'); plt.ylabel('meters')
plt.subplot(2,2,4)
plt.title('Fast Factorized Backprojection \n w/ multi-processing \n \
Runtime = %i s'%fbpmp_time)
imgTools.imshow(img_FFBP, dB_scale = [-25,0], extent = extent)
plt.xlabel('meters'); plt.ylabel('meters')
plt.tight_layout()'''
| 36.689474
| 98
| 0.595754
| 863
| 6,971
| 4.695249
| 0.177289
| 0.047384
| 0.089832
| 0.042201
| 0.742843
| 0.728529
| 0.728529
| 0.728529
| 0.728529
| 0.728036
| 0
| 0.020841
| 0.229092
| 6,971
| 189
| 99
| 36.883598
| 0.73316
| 0.107302
| 0
| 0.190476
| 0
| 0
| 0.044662
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.02381
| 0.166667
| 0
| 0.166667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
1a25270da7717d7b03f84005224e492e27f7ad02
| 31
|
py
|
Python
|
objectio/__init__.py
|
tmbdev/objectio
|
3c037fe47dd01cdd13a9338112ad10c1d2aeafb8
|
[
"BSD-3-Clause"
] | 1
|
2020-06-30T09:25:21.000Z
|
2020-06-30T09:25:21.000Z
|
objectio/__init__.py
|
tmbdev/objectio
|
3c037fe47dd01cdd13a9338112ad10c1d2aeafb8
|
[
"BSD-3-Clause"
] | 1
|
2020-05-21T02:20:42.000Z
|
2020-05-21T02:20:42.000Z
|
objectio/__init__.py
|
tmbdev/objectio
|
3c037fe47dd01cdd13a9338112ad10c1d2aeafb8
|
[
"BSD-3-Clause"
] | 2
|
2020-04-15T16:44:33.000Z
|
2020-12-01T21:08:32.000Z
|
from .io import objopen, gopen
| 15.5
| 30
| 0.774194
| 5
| 31
| 4.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16129
| 31
| 1
| 31
| 31
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
c51156d3f6b100b0f18b8a5cadc03415f53c1892
| 56
|
py
|
Python
|
Judger/Judger_Data/__init__.py
|
cmd2001/Open-TesutoHime
|
2c30aa35650383adfb99496aebd425dffd287eda
|
[
"MIT"
] | 11
|
2020-11-28T16:45:35.000Z
|
2021-08-31T07:56:26.000Z
|
Judger/Judger_Data/__init__.py
|
ACMClassOJ/Open-TesutoHime
|
2c30aa35650383adfb99496aebd425dffd287eda
|
[
"MIT"
] | null | null | null |
Judger/Judger_Data/__init__.py
|
ACMClassOJ/Open-TesutoHime
|
2c30aa35650383adfb99496aebd425dffd287eda
|
[
"MIT"
] | 2
|
2021-09-04T11:39:51.000Z
|
2021-09-23T02:01:43.000Z
|
from .data import get_data, ProblemConfig, Group, Detail
| 56
| 56
| 0.821429
| 8
| 56
| 5.625
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107143
| 56
| 1
| 56
| 56
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
c5549d3850ed1dc9af489b12b669560c442d46c8
| 40
|
py
|
Python
|
rasa_nlu/extractors/__init__.py
|
MartinoMensio/rasa_nlu
|
29251aa35ce57db25538c819babfb0f0fb42dac6
|
[
"Apache-2.0"
] | null | null | null |
rasa_nlu/extractors/__init__.py
|
MartinoMensio/rasa_nlu
|
29251aa35ce57db25538c819babfb0f0fb42dac6
|
[
"Apache-2.0"
] | null | null | null |
rasa_nlu/extractors/__init__.py
|
MartinoMensio/rasa_nlu
|
29251aa35ce57db25538c819babfb0f0fb42dac6
|
[
"Apache-2.0"
] | null | null | null |
class EntityExtractor(object):
pass
| 13.333333
| 30
| 0.75
| 4
| 40
| 7.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.175
| 40
| 2
| 31
| 20
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
c56204c5ffa2d500573d8c1aa63e49c4772763e1
| 78
|
py
|
Python
|
oms_cms/backend/menu/urls.py
|
RomanYarovoi/oms_cms
|
49c6789242d7a35e81f4f208c04b18fb79249be7
|
[
"BSD-3-Clause"
] | 18
|
2019-07-11T18:34:10.000Z
|
2021-11-20T06:34:39.000Z
|
oms_cms/backend/menu/urls.py
|
RomanYarovoi/oms_cms
|
49c6789242d7a35e81f4f208c04b18fb79249be7
|
[
"BSD-3-Clause"
] | 13
|
2019-07-24T11:27:58.000Z
|
2022-03-28T01:07:31.000Z
|
oms_cms/backend/menu/urls.py
|
RomanYarovoi/oms_cms
|
49c6789242d7a35e81f4f208c04b18fb79249be7
|
[
"BSD-3-Clause"
] | 18
|
2019-07-08T18:07:21.000Z
|
2021-11-03T10:33:07.000Z
|
from django.urls import path
# from .views import *
# urlpatterns = [
#
# ]
| 9.75
| 28
| 0.641026
| 9
| 78
| 5.555556
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.230769
| 78
| 8
| 29
| 9.75
| 0.833333
| 0.487179
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
c56b31f965e36ba4276a3ceb9419a55ca9e119e1
| 301
|
py
|
Python
|
codes/mod/modlog.py
|
Kevinmuahahaha/posty
|
a7ae2f9b1bc08860df460a1d2f1b0ee4ea00282f
|
[
"MIT"
] | null | null | null |
codes/mod/modlog.py
|
Kevinmuahahaha/posty
|
a7ae2f9b1bc08860df460a1d2f1b0ee4ea00282f
|
[
"MIT"
] | null | null | null |
codes/mod/modlog.py
|
Kevinmuahahaha/posty
|
a7ae2f9b1bc08860df460a1d2f1b0ee4ea00282f
|
[
"MIT"
] | null | null | null |
def debug( content ):
print( "[*] " + str(content) , flush=True)
def bad( content ):
print( "[-] " + str(content) , flush=True)
def good( content ):
print( "[+] " + str(content) , flush=True)
# sample output:
# [*] Gimme yo money
# [-] Money taken by chad.
# [+] Chad receives the money.
| 25.083333
| 46
| 0.578073
| 37
| 301
| 4.702703
| 0.513514
| 0.206897
| 0.258621
| 0.37931
| 0.568966
| 0.568966
| 0.390805
| 0
| 0
| 0
| 0
| 0
| 0.219269
| 301
| 11
| 47
| 27.363636
| 0.740426
| 0.289037
| 0
| 0
| 0
| 0
| 0.057416
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0
| 0.5
| 0.5
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
3da5c8007c55b210ea8c7b9aaa0cd0e615ab4ca6
| 93
|
py
|
Python
|
bento2seldon4recsys/router/ab_test/model.py
|
bryanoliveira/bento2seldon4recsys
|
024a899cf7e71634868a5d444a0e208d58a85dd2
|
[
"Apache-2.0"
] | 1
|
2022-03-01T18:34:39.000Z
|
2022-03-01T18:34:39.000Z
|
bento2seldon4recsys/router/ab_test/model.py
|
bryanoliveira/bento2seldon4recsys
|
024a899cf7e71634868a5d444a0e208d58a85dd2
|
[
"Apache-2.0"
] | 235
|
2021-11-01T13:28:51.000Z
|
2022-03-31T13:35:05.000Z
|
bento2seldon4recsys/router/ab_test/model.py
|
bryanoliveira/bento2seldon4recsys
|
024a899cf7e71634868a5d444a0e208d58a85dd2
|
[
"Apache-2.0"
] | 1
|
2022-02-28T21:34:08.000Z
|
2022-02-28T21:34:08.000Z
|
from bento2seldon.model import Settings
class ABTestSettings(Settings):
b_ratio: float
| 15.5
| 39
| 0.795699
| 11
| 93
| 6.636364
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012658
| 0.150538
| 93
| 5
| 40
| 18.6
| 0.911392
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
9a9b053d9e12493e317841f95c2dde45e6581829
| 176
|
py
|
Python
|
python/packages/isce3/core/Ellipsoid.py
|
piyushrpt/isce3
|
1741af321470cb5939693459765d11a19c5c6fc2
|
[
"Apache-2.0"
] | null | null | null |
python/packages/isce3/core/Ellipsoid.py
|
piyushrpt/isce3
|
1741af321470cb5939693459765d11a19c5c6fc2
|
[
"Apache-2.0"
] | null | null | null |
python/packages/isce3/core/Ellipsoid.py
|
piyushrpt/isce3
|
1741af321470cb5939693459765d11a19c5c6fc2
|
[
"Apache-2.0"
] | null | null | null |
#-*- coding: utf-8 -*-
# Import the extension
from .. import isceextension
class Ellipsoid(isceextension.pyEllipsoid):
"""
Wrapper for pyEllipsoid.
"""
pass
| 14.666667
| 43
| 0.647727
| 17
| 176
| 6.705882
| 0.823529
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007299
| 0.221591
| 176
| 11
| 44
| 16
| 0.824818
| 0.380682
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.333333
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
9ab87a5910f62f6308dd8a8795d65adecbd588ec
| 66
|
py
|
Python
|
DailyData/io/__init__.py
|
JEElsner/DailyData
|
17d430af52922cc0b60ba57abb8e42de576d942c
|
[
"MIT"
] | 1
|
2021-01-04T07:05:07.000Z
|
2021-01-04T07:05:07.000Z
|
DailyData/io/__init__.py
|
JEElsner/DailyData
|
17d430af52922cc0b60ba57abb8e42de576d942c
|
[
"MIT"
] | null | null | null |
DailyData/io/__init__.py
|
JEElsner/DailyData
|
17d430af52922cc0b60ba57abb8e42de576d942c
|
[
"MIT"
] | null | null | null |
from .timelog_io import TimelogIO
from .db import DatabaseWrapper
| 22
| 33
| 0.848485
| 9
| 66
| 6.111111
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.121212
| 66
| 2
| 34
| 33
| 0.948276
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
9ad9b8c82fd1ce90fa11dab7b080f92febdb9892
| 36
|
py
|
Python
|
contrib/tests/__init__.py
|
Memrise/django-social-auth
|
ddfecb6f78f1dc53e66689264f1c95fc81b5d3be
|
[
"BSD-2-Clause",
"BSD-3-Clause"
] | 1
|
2018-06-11T17:35:10.000Z
|
2018-06-11T17:35:10.000Z
|
contrib/tests/__init__.py
|
Memrise/django-social-auth
|
ddfecb6f78f1dc53e66689264f1c95fc81b5d3be
|
[
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null |
contrib/tests/__init__.py
|
Memrise/django-social-auth
|
ddfecb6f78f1dc53e66689264f1c95fc81b5d3be
|
[
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null |
from .test_core import BackendsTest
| 18
| 35
| 0.861111
| 5
| 36
| 6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 36
| 1
| 36
| 36
| 0.9375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
b119b2abcfa468d035a7582ea1f8017da366461f
| 911
|
py
|
Python
|
test/test_create_new_group.py
|
kazinets/python_training
|
84a56e6069fa775ca02101011d6051865fbcfb6d
|
[
"Apache-2.0"
] | null | null | null |
test/test_create_new_group.py
|
kazinets/python_training
|
84a56e6069fa775ca02101011d6051865fbcfb6d
|
[
"Apache-2.0"
] | null | null | null |
test/test_create_new_group.py
|
kazinets/python_training
|
84a56e6069fa775ca02101011d6051865fbcfb6d
|
[
"Apache-2.0"
] | null | null | null |
from model.group import Group
from sys import maxsize
def test_create_empty_group(app):
app.group.open_group_page()
old_groups = app.group.get_group_list()
group = Group(name="", header="", footer="")
app.group.create(Group(name="", header="", footer=""))
new_groups = app.group.get_group_list()
assert len(old_groups) + 1 == len(new_groups)
old_groups.append(group)
assert sorted(old_groups, key=Group.id_or_max)==sorted(new_groups,key=Group.id_or_max)
def test_create_group(app):
app.group.open_group_page()
old_groups=app.group.get_group_list()
group=Group(name="First Group", header="logo", footer="comment 1")
app.group.create(group)
new_groups = app.group.get_group_list()
assert len(old_groups)+1 == len(new_groups)
old_groups.append(group)
assert sorted(old_groups, key=Group.id_or_max) ==sorted(new_groups, key=Group.id_or_max)
| 29.387097
| 92
| 0.714599
| 142
| 911
| 4.309859
| 0.232394
| 0.104575
| 0.091503
| 0.111111
| 0.712418
| 0.712418
| 0.712418
| 0.712418
| 0.712418
| 0.712418
| 0
| 0.003851
| 0.144896
| 911
| 30
| 93
| 30.366667
| 0.781772
| 0
| 0
| 0.6
| 0
| 0
| 0.026403
| 0
| 0
| 0
| 0
| 0
| 0.2
| 1
| 0.1
| false
| 0
| 0.1
| 0
| 0.2
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
b1763b1cf8c60e2f901dbcffe9395c67043e6911
| 511
|
py
|
Python
|
custom_exceptions.py
|
Demon000/updater-1
|
eab6c9c008935cf2cfe0df27adc22e4fd1da6eca
|
[
"Apache-2.0"
] | 81
|
2017-12-28T12:52:59.000Z
|
2022-03-26T08:42:44.000Z
|
custom_exceptions.py
|
Demon000/updater-1
|
eab6c9c008935cf2cfe0df27adc22e4fd1da6eca
|
[
"Apache-2.0"
] | 30
|
2017-12-27T06:32:37.000Z
|
2022-02-07T16:41:44.000Z
|
custom_exceptions.py
|
Demon000/updater-1
|
eab6c9c008935cf2cfe0df27adc22e4fd1da6eca
|
[
"Apache-2.0"
] | 53
|
2017-12-27T06:27:21.000Z
|
2022-02-28T06:45:51.000Z
|
#!/usr/bin/env python3
#pylint: disable=missing-docstring
class DeviceNotFoundException(Exception):
status_code = 404
def __init__(self, message):
Exception.__init__(self)
self.message = message
def to_dict(self):
return {'message': self.message}
class UpstreamApiException(Exception):
status_code = 502
def __init__(self, message):
Exception.__init__(self)
self.message = message
def to_dict(self):
return {'message': self.message}
| 22.217391
| 41
| 0.669276
| 56
| 511
| 5.75
| 0.410714
| 0.204969
| 0.118012
| 0.111801
| 0.559006
| 0.559006
| 0.559006
| 0.559006
| 0.559006
| 0.559006
| 0
| 0.017722
| 0.227006
| 511
| 22
| 42
| 23.227273
| 0.797468
| 0.105675
| 0
| 0.714286
| 0
| 0
| 0.030769
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0
| 0.142857
| 0.714286
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
b182ff31e474dc1427e4f386206bd761fd4c94fb
| 386
|
py
|
Python
|
src/app/main/service/products.py
|
Abh4git/PythonMongoService
|
f64fcb7c4db0db41adb8b74736c82e8de5f6dbec
|
[
"MIT"
] | 1
|
2021-05-22T06:08:01.000Z
|
2021-05-22T06:08:01.000Z
|
src/app/main/service/products.py
|
Abh4git/PythonMongoService
|
f64fcb7c4db0db41adb8b74736c82e8de5f6dbec
|
[
"MIT"
] | null | null | null |
src/app/main/service/products.py
|
Abh4git/PythonMongoService
|
f64fcb7c4db0db41adb8b74736c82e8de5f6dbec
|
[
"MIT"
] | null | null | null |
from flask import jsonify, request, url_for, g, abort
from app.main import db
from app.main.model.products import Product
from app.main.service import bp
from app.main.service.auth import token_auth
from app.main.service.errors import bad_request
@bp.route('/products/', methods=['GET'])
#@token_auth.login_required
def get_products():
return "{ testproducts:['book1','Food1']}"
| 29.692308
| 53
| 0.764249
| 59
| 386
| 4.898305
| 0.525424
| 0.121107
| 0.190311
| 0.186851
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005831
| 0.111399
| 386
| 12
| 54
| 32.166667
| 0.836735
| 0.067358
| 0
| 0
| 0
| 0
| 0.128134
| 0.086351
| 0
| 0
| 0
| 0
| 0
| 1
| 0.111111
| true
| 0
| 0.666667
| 0.111111
| 0.888889
| 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
| 1
| 0
| 0
|
0
| 5
|
49548e5900ceef52f647af9925d1f7673c4ca297
| 5,231
|
py
|
Python
|
skyportal/tests/api/test_observing_runs.py
|
bparazin/skyportal
|
c160610ca0cc28eef9f36c2d11cc15bd9bcbfe56
|
[
"BSD-3-Clause"
] | 52
|
2018-11-02T00:53:21.000Z
|
2022-03-08T16:03:52.000Z
|
skyportal/tests/api/test_observing_runs.py
|
bparazin/skyportal
|
c160610ca0cc28eef9f36c2d11cc15bd9bcbfe56
|
[
"BSD-3-Clause"
] | 1,944
|
2017-04-27T18:51:20.000Z
|
2022-03-31T20:17:44.000Z
|
skyportal/tests/api/test_observing_runs.py
|
bparazin/skyportal
|
c160610ca0cc28eef9f36c2d11cc15bd9bcbfe56
|
[
"BSD-3-Clause"
] | 63
|
2017-05-13T01:40:47.000Z
|
2022-03-12T11:32:11.000Z
|
from skyportal.tests import api
def test_token_user_add_new_observing_run(
lris, upload_data_token, red_transients_group
):
run_details = {
'instrument_id': lris.id,
'pi': 'Danny Goldstein',
'observers': 'D. Goldstein, P. Nugent',
'group_id': red_transients_group.id,
'calendar_date': '2020-02-16',
}
status, data = api(
'POST', 'observing_run', data=run_details, token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
run_id = data['data']['id']
status, data = api('GET', f'observing_run/{run_id}', token=upload_data_token)
assert status == 200
assert data['status'] == 'success'
for key in run_details:
assert data['data'][key] == run_details[key]
def test_super_admin_user_delete_nonowned_observing_run(
lris, upload_data_token, super_admin_token, red_transients_group
):
run_details = {
'instrument_id': lris.id,
'pi': 'Danny Goldstein',
'observers': 'D. Goldstein, P. Nugent',
'group_id': red_transients_group.id,
'calendar_date': '2020-02-16',
}
status, data = api(
'POST', 'observing_run', data=run_details, token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
run_id = data['data']['id']
status, data = api('DELETE', f'observing_run/{run_id}', token=super_admin_token)
assert status == 200
assert data['status'] == 'success'
def test_unauthorized_user_delete_nonowned_observing_run(
lris, upload_data_token, manage_sources_token, red_transients_group
):
run_details = {
'instrument_id': lris.id,
'pi': 'Danny Goldstein',
'observers': 'D. Goldstein, P. Nugent',
'group_id': red_transients_group.id,
'calendar_date': '2020-02-16',
}
status, data = api(
'POST', 'observing_run', data=run_details, token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
run_id = data['data']['id']
status, data = api('DELETE', f'observing_run/{run_id}', token=manage_sources_token)
assert status == 400
assert data['status'] == 'error'
def test_authorized_user_modify_owned_observing_run(
lris, upload_data_token, red_transients_group
):
run_details = {
'instrument_id': lris.id,
'pi': 'Danny Goldstein',
'observers': 'D. Goldstein, P. Nugent',
'group_id': red_transients_group.id,
'calendar_date': '2020-02-16',
}
status, data = api(
'POST', 'observing_run', data=run_details, token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
run_id = data['data']['id']
new_date = {'calendar_date': '2020-02-17'}
run_details.update(new_date)
status, data = api(
'PUT', f'observing_run/{run_id}', data=new_date, token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
status, data = api('GET', f'observing_run/{run_id}', token=upload_data_token)
assert status == 200
assert data['status'] == 'success'
for key in run_details:
assert data['data'][key] == run_details[key]
def test_unauthorized_user_modify_unowned_observing_run(
lris, upload_data_token, manage_sources_token, red_transients_group
):
run_details = {
'instrument_id': lris.id,
'pi': 'Danny Goldstein',
'observers': 'D. Goldstein, P. Nugent',
'group_id': red_transients_group.id,
'calendar_date': '2020-02-16',
}
status, data = api(
'POST', 'observing_run', data=run_details, token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
run_id = data['data']['id']
new_date = {'calendar_date': '2020-02-17'}
run_details.update(new_date)
status, data = api(
'PUT', f'observing_run/{run_id}', data=new_date, token=manage_sources_token
)
assert status == 400
assert data['status'] == 'error'
def test_observing_run_assignment_group_names(
public_assignment,
public_source,
view_only_token,
public_group,
public_group2,
upload_data_token_two_groups,
):
# Save the obj associated with the public_assignment to a group the run
# owner is not a part of
status, data = api(
"POST",
"sources",
data={
"id": public_source.id,
"ra": 234.22,
"dec": -22.33,
"redshift": 3,
"transient": False,
"ra_dis": 2.3,
"group_ids": [public_group2.id],
},
token=upload_data_token_two_groups,
)
assert status == 200
assert data['status'] == 'success'
# Get the observing run and associated assignments and check that public_group2
# is not in the accessible_group_ids
status, data = api(
'GET', f'observing_run/{public_assignment.run.id}', token=view_only_token
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']["assignments"]) == 1
assert (
public_group2.name
not in data['data']["assignments"][0]["accessible_group_names"]
)
| 28.584699
| 87
| 0.628178
| 658
| 5,231
| 4.714286
| 0.155015
| 0.073501
| 0.072534
| 0.074468
| 0.789168
| 0.771438
| 0.771438
| 0.749839
| 0.722115
| 0.700516
| 0
| 0.028385
| 0.23896
| 5,231
| 182
| 88
| 28.741758
| 0.750816
| 0.039189
| 0
| 0.655172
| 0
| 0
| 0.21908
| 0.038638
| 0
| 0
| 0
| 0
| 0.206897
| 1
| 0.041379
| false
| 0
| 0.006897
| 0
| 0.048276
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
496fb42bfc2450c5a1c85b74a37798c9b9f96c34
| 227
|
py
|
Python
|
h1st/h1st/schema/validators/base.py
|
Mou-Ikkai/h1st
|
da47a8f1ad6af532c549e075fba19e3b3692de89
|
[
"Apache-2.0"
] | 2
|
2020-08-21T07:49:08.000Z
|
2020-08-21T07:49:13.000Z
|
h1st/h1st/schema/validators/base.py
|
Mou-Ikkai/h1st
|
da47a8f1ad6af532c549e075fba19e3b3692de89
|
[
"Apache-2.0"
] | 3
|
2020-11-13T19:06:07.000Z
|
2022-02-10T02:06:03.000Z
|
h1st/h1st/schema/validators/base.py
|
Mou-Ikkai/h1st
|
da47a8f1ad6af532c549e075fba19e3b3692de89
|
[
"Apache-2.0"
] | null | null | null |
class BaseValidator:
"""
Base class for validator
"""
def is_applicable(self, schema):
raise NotImplementedError()
def validate_type(self, upstream, downstream):
raise NotImplementedError()
| 22.7
| 50
| 0.665198
| 21
| 227
| 7.095238
| 0.761905
| 0.322148
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.246696
| 227
| 9
| 51
| 25.222222
| 0.871345
| 0.105727
| 0
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
497a82fc0f55394fc105e283969a6fe2edc93a22
| 409
|
py
|
Python
|
cmdb/SegNer/AbsolutePath.py
|
Emmonss/SegmentAndNER-Web
|
4a50c6f6d53a94ff612b832eb5fdc202a09afac0
|
[
"MIT"
] | 5
|
2019-07-12T07:55:32.000Z
|
2022-03-02T12:07:56.000Z
|
cmdb/SegNer/AbsolutePath.py
|
immense8342/SegmentAndNER-Web
|
4a50c6f6d53a94ff612b832eb5fdc202a09afac0
|
[
"MIT"
] | 1
|
2019-07-12T07:56:09.000Z
|
2020-08-18T02:02:57.000Z
|
cmdb/SegNer/AbsolutePath.py
|
immense8342/SegmentAndNER-Web
|
4a50c6f6d53a94ff612b832eb5fdc202a09afac0
|
[
"MIT"
] | 2
|
2021-04-02T08:19:05.000Z
|
2021-09-09T06:43:42.000Z
|
CrfSegMoodPath = 'E:\python_code\Djangotest2\cmdb\model\msr.crfsuite'
HmmDIC = 'E:\python_code\Djangotest2\cmdb\model\HMMDic.pkl'
HmmDISTRIBUTION = 'E:\python_code\Djangotest2\cmdb\model\HMMDistribution.pkl'
CrfNERMoodPath = 'E:\python_code\Djangotest2\cmdb\model\PKU.crfsuite'
BiLSTMCXPath = 'E:\python_code\Djangotest2\cmdb\model\BiLSTMCX'
BiLSTMNERPath = 'E:\python_code\Djangotest2\cmdb\model\BiLSTMNER'
| 51.125
| 77
| 0.811736
| 52
| 409
| 6.269231
| 0.346154
| 0.128834
| 0.202454
| 0.404908
| 0.570552
| 0.570552
| 0
| 0
| 0
| 0
| 0
| 0.015385
| 0.046455
| 409
| 7
| 78
| 58.428571
| 0.820513
| 0
| 0
| 0
| 0
| 0
| 0.730392
| 0.730392
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
77044bfa111857bb0f077d5c461a5c4ae07bd4d2
| 136
|
py
|
Python
|
src/aiortc/exceptions.py
|
thedilletante/aiortc
|
c0504b6962484ac26ba8ad065191794ac6f607a4
|
[
"BSD-3-Clause"
] | 1,021
|
2018-02-28T07:56:06.000Z
|
2022-03-15T04:45:57.000Z
|
src/aiortc/exceptions.py
|
thedilletante/aiortc
|
c0504b6962484ac26ba8ad065191794ac6f607a4
|
[
"BSD-3-Clause"
] | 137
|
2018-02-28T08:00:16.000Z
|
2019-01-29T12:59:50.000Z
|
src/aiortc/exceptions.py
|
thedilletante/aiortc
|
c0504b6962484ac26ba8ad065191794ac6f607a4
|
[
"BSD-3-Clause"
] | 149
|
2018-03-08T08:23:51.000Z
|
2022-03-22T16:45:29.000Z
|
class InternalError(Exception):
pass
class InvalidAccessError(Exception):
pass
class InvalidStateError(Exception):
pass
| 12.363636
| 36
| 0.75
| 12
| 136
| 8.5
| 0.5
| 0.382353
| 0.352941
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.183824
| 136
| 10
| 37
| 13.6
| 0.918919
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
77340ab223932a1b6abe85c5ebd1914714376a81
| 2,735
|
py
|
Python
|
tensorflow/python/ops/ragged/__init__.py
|
uve/tensorflow
|
e08079463bf43e5963acc41da1f57e95603f8080
|
[
"Apache-2.0"
] | null | null | null |
tensorflow/python/ops/ragged/__init__.py
|
uve/tensorflow
|
e08079463bf43e5963acc41da1f57e95603f8080
|
[
"Apache-2.0"
] | null | null | null |
tensorflow/python/ops/ragged/__init__.py
|
uve/tensorflow
|
e08079463bf43e5963acc41da1f57e95603f8080
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Ragged Tensors.
This package defines ops for manipulating ragged tensors (`tf.RaggedTensor`),
which are tensors with non-uniform shapes. In particular, each `RaggedTensor`
has one or more *ragged dimensions*, which are dimensions whose slices may have
different lengths. For example, the inner (column) dimension of
`rt=[[3, 1, 4, 1], [], [5, 9, 2], [6], []]` is ragged, since the column slices
(`rt[0, :]`, ..., `rt[4, :]`) have different lengths. For a more detailed
description of ragged tensors, see the `tf.RaggedTensor` class documentation
and the [Ragged Tensor Guide](/guide/ragged_tensors).
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.ops.ragged import ragged_array_ops
from tensorflow.python.ops.ragged import ragged_batch_gather_ops
from tensorflow.python.ops.ragged import ragged_batch_gather_with_default_op
from tensorflow.python.ops.ragged import ragged_concat_ops
from tensorflow.python.ops.ragged import ragged_conversion_ops
from tensorflow.python.ops.ragged import ragged_dispatch
from tensorflow.python.ops.ragged import ragged_factory_ops
from tensorflow.python.ops.ragged import ragged_functional_ops
from tensorflow.python.ops.ragged import ragged_gather_ops
from tensorflow.python.ops.ragged import ragged_getitem
from tensorflow.python.ops.ragged import ragged_map_ops
from tensorflow.python.ops.ragged import ragged_math_ops
from tensorflow.python.ops.ragged import ragged_operators
from tensorflow.python.ops.ragged import ragged_string_ops
from tensorflow.python.ops.ragged import ragged_tensor
from tensorflow.python.ops.ragged import ragged_tensor_shape
from tensorflow.python.ops.ragged import ragged_tensor_value
from tensorflow.python.ops.ragged import ragged_where_op
from tensorflow.python.ops.ragged import segment_id_ops
# Add a list of the ops that support Ragged Tensors.
__doc__ += ragged_dispatch.ragged_op_list() # pylint: disable=redefined-builtin
| 51.603774
| 81
| 0.772212
| 388
| 2,735
| 5.28866
| 0.373711
| 0.12963
| 0.185185
| 0.212963
| 0.415692
| 0.415692
| 0.415692
| 0.276803
| 0.077973
| 0.053606
| 0
| 0.007566
| 0.130165
| 2,735
| 52
| 82
| 52.596154
| 0.854981
| 0.493601
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.956522
| 0
| 0.956522
| 0.043478
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
7747239b5b3fb6df24b10d7249566a11ad970f0a
| 122
|
py
|
Python
|
menu/admin.py
|
pawelszopa/django_api_menu
|
292c117aa4fea57aed80bbfc9cc2bece5c0da434
|
[
"Beerware"
] | null | null | null |
menu/admin.py
|
pawelszopa/django_api_menu
|
292c117aa4fea57aed80bbfc9cc2bece5c0da434
|
[
"Beerware"
] | null | null | null |
menu/admin.py
|
pawelszopa/django_api_menu
|
292c117aa4fea57aed80bbfc9cc2bece5c0da434
|
[
"Beerware"
] | null | null | null |
from django.contrib import admin
from menu.models import Menu, Dish
admin.site.register(Menu)
admin.site.register(Dish)
| 17.428571
| 34
| 0.803279
| 19
| 122
| 5.157895
| 0.526316
| 0.183673
| 0.346939
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.106557
| 122
| 6
| 35
| 20.333333
| 0.899083
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
776107564fb7c0d83de0531664cfd9d4598811ee
| 86
|
py
|
Python
|
scent/scent.py
|
Onlinehead/lavanda
|
d75f537164121083eeef43e29a300af2bf39e63b
|
[
"MIT"
] | null | null | null |
scent/scent.py
|
Onlinehead/lavanda
|
d75f537164121083eeef43e29a300af2bf39e63b
|
[
"MIT"
] | null | null | null |
scent/scent.py
|
Onlinehead/lavanda
|
d75f537164121083eeef43e29a300af2bf39e63b
|
[
"MIT"
] | null | null | null |
import sys
import os
sys.path.append(os.path.join(os.path.realpath(__file__), "../"))
| 21.5
| 64
| 0.72093
| 14
| 86
| 4.142857
| 0.571429
| 0.206897
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.069767
| 86
| 3
| 65
| 28.666667
| 0.725
| 0
| 0
| 0
| 0
| 0
| 0.034884
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
6200631409798b3faea6fad215270a2c342024d6
| 116
|
py
|
Python
|
braintree/exceptions/http/connection_error.py
|
futureironman/braintree_python
|
26bb8a857bc29322a8bca2e8e0fe6d99cfe6a1ac
|
[
"MIT"
] | 182
|
2015-01-09T05:26:46.000Z
|
2022-03-16T14:10:06.000Z
|
braintree/exceptions/http/connection_error.py
|
futureironman/braintree_python
|
26bb8a857bc29322a8bca2e8e0fe6d99cfe6a1ac
|
[
"MIT"
] | 95
|
2015-02-24T23:29:56.000Z
|
2022-03-13T03:27:58.000Z
|
braintree/exceptions/http/connection_error.py
|
futureironman/braintree_python
|
26bb8a857bc29322a8bca2e8e0fe6d99cfe6a1ac
|
[
"MIT"
] | 93
|
2015-02-19T17:59:06.000Z
|
2022-03-19T17:01:25.000Z
|
from braintree.exceptions.unexpected_error import UnexpectedError
class ConnectionError(UnexpectedError):
pass
| 23.2
| 65
| 0.853448
| 11
| 116
| 8.909091
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103448
| 116
| 4
| 66
| 29
| 0.942308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.333333
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
|
0
| 5
|
6227bc1f8c4d06c6020ea72eff787d0ed61be626
| 136
|
py
|
Python
|
keras_bert/activations/gelu_tensorflow.py
|
Saumitra-Shukla/keras-bert
|
e60785d31129199ec0f922159e76bb63db330e00
|
[
"MIT"
] | 9
|
2018-11-25T11:18:12.000Z
|
2021-04-10T11:47:45.000Z
|
keras_bert/activations/gelu_tensorflow.py
|
VictorMadu/keras-bert
|
26bdfe3c36e77fa0524902f31263a920ccd62efb
|
[
"MIT"
] | null | null | null |
keras_bert/activations/gelu_tensorflow.py
|
VictorMadu/keras-bert
|
26bdfe3c36e77fa0524902f31263a920ccd62efb
|
[
"MIT"
] | 1
|
2020-04-16T16:17:36.000Z
|
2020-04-16T16:17:36.000Z
|
from tensorflow.python.ops.math_ops import erf, sqrt
__all__ = ['gelu']
def gelu(x):
return 0.5 * x * (1.0 + erf(x / sqrt(2.0)))
| 17
| 52
| 0.617647
| 25
| 136
| 3.16
| 0.68
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.055046
| 0.198529
| 136
| 7
| 53
| 19.428571
| 0.669725
| 0
| 0
| 0
| 0
| 0
| 0.029412
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
627a56b87c39ef432f8cfb75aa8b417ee189c675
| 160
|
py
|
Python
|
344_reverse_string.py
|
dakotaw/leetcode
|
c48bd51e2d8c5342460d2a71683395b3d5b56f6a
|
[
"MIT"
] | null | null | null |
344_reverse_string.py
|
dakotaw/leetcode
|
c48bd51e2d8c5342460d2a71683395b3d5b56f6a
|
[
"MIT"
] | null | null | null |
344_reverse_string.py
|
dakotaw/leetcode
|
c48bd51e2d8c5342460d2a71683395b3d5b56f6a
|
[
"MIT"
] | null | null | null |
# Write a function that takes a string as input and returns the string reversed.
class Solution(object):
def reverseString(self, s):
return s[::-1]
| 32
| 80
| 0.7
| 24
| 160
| 4.666667
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007937
| 0.2125
| 160
| 5
| 81
| 32
| 0.880952
| 0.4875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0.333333
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
628d5e5ed2c473715b00c8b6c44cc6d18ec3c737
| 176
|
py
|
Python
|
pywi/benchmark/__init__.py
|
jeremiedecock/mrif
|
094b0dd81ff2be0e24bf3871caab48da1b5d138b
|
[
"MIT"
] | 1
|
2021-07-06T06:02:45.000Z
|
2021-07-06T06:02:45.000Z
|
pywi/benchmark/__init__.py
|
jeremiedecock/mrif
|
094b0dd81ff2be0e24bf3871caab48da1b5d138b
|
[
"MIT"
] | null | null | null |
pywi/benchmark/__init__.py
|
jeremiedecock/mrif
|
094b0dd81ff2be0e24bf3871caab48da1b5d138b
|
[
"MIT"
] | 1
|
2019-01-07T10:50:38.000Z
|
2019-01-07T10:50:38.000Z
|
"""Benchmark modules
This package contains modules used to assess image processing algorithms.
"""
from . import core
from . import io
from . import metrics
from . import ui
| 17.6
| 73
| 0.761364
| 24
| 176
| 5.583333
| 0.708333
| 0.298507
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.176136
| 176
| 9
| 74
| 19.555556
| 0.924138
| 0.522727
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
6554757bca11fadafd1eb936bad911081cf9579d
| 1,342
|
py
|
Python
|
halo/cursor.py
|
FarzinVatani/halo
|
6f83362f6754d52cc68c4d7d352329feaeeac8e1
|
[
"MIT"
] | null | null | null |
halo/cursor.py
|
FarzinVatani/halo
|
6f83362f6754d52cc68c4d7d352329feaeeac8e1
|
[
"MIT"
] | null | null | null |
halo/cursor.py
|
FarzinVatani/halo
|
6f83362f6754d52cc68c4d7d352329feaeeac8e1
|
[
"MIT"
] | null | null | null |
"""
Source: https://stackoverflow.com/a/10455937/2692667
"""
import sys
import os
if os.name == "nt":
import ctypes
class _CursorInfo(ctypes.Structure):
_fields_ = [("size", ctypes.c_int),
("visible", ctypes.c_byte)]
def hide(stream=sys.stdout):
"""Hide cursor.
Parameters
----------
stream: sys.stdout, Optional
Defines stream to write output to.
"""
if os.name == "nt":
ci = _CursorInfo()
handle = ctypes.windll.kernel32.GetStdHandle(-11)
ctypes.windll.kernel32.GetConsoleCursorInfo(handle, ctypes.byref(ci))
ci.visible = False
ctypes.windll.kernel32.SetConsoleCursorInfo(handle, ctypes.byref(ci))
elif os.name == "posix":
stream.write("\033[?25l")
stream.flush()
def show(stream=sys.stdout):
"""Show cursor.
Parameters
----------
stream: sys.stdout, Optional
Defines stream to write output to.
"""
if os.name == "nt":
ci = _CursorInfo()
handle = ctypes.windll.kernel32.GetStdHandle(-11)
ctypes.windll.kernel32.GetConsoleCursorInfo(handle, ctypes.byref(ci))
ci.visible = True
ctypes.windll.kernel32.SetConsoleCursorInfo(handle, ctypes.byref(ci))
elif os.name == "posix":
stream.write("\033[?25h")
stream.flush()
| 26.84
| 77
| 0.608048
| 148
| 1,342
| 5.466216
| 0.351351
| 0.088999
| 0.148331
| 0.093943
| 0.704574
| 0.704574
| 0.704574
| 0.704574
| 0.704574
| 0.704574
| 0
| 0.040434
| 0.244411
| 1,342
| 49
| 78
| 27.387755
| 0.757396
| 0.19225
| 0
| 0.555556
| 0
| 0
| 0.043945
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.074074
| false
| 0
| 0.111111
| 0
| 0.259259
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
65633b6f97b44d28cb24938f8949b0ea69e44560
| 104
|
py
|
Python
|
authenticator/admin.py
|
didoogan/attractgroup-test
|
fb31bb8962da057962d8b7fe9bd9161c9c507faf
|
[
"MIT"
] | null | null | null |
authenticator/admin.py
|
didoogan/attractgroup-test
|
fb31bb8962da057962d8b7fe9bd9161c9c507faf
|
[
"MIT"
] | null | null | null |
authenticator/admin.py
|
didoogan/attractgroup-test
|
fb31bb8962da057962d8b7fe9bd9161c9c507faf
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Authenticator
admin.site.register(Authenticator)
| 17.333333
| 34
| 0.836538
| 13
| 104
| 6.692308
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105769
| 104
| 5
| 35
| 20.8
| 0.935484
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
6591fa1c18af7d309f5653ff6ae7fa64b277aafc
| 74
|
py
|
Python
|
xyw_eyes/spider/__init__.py
|
xue0228/rss
|
ede005fec298493134ed047d9c119e7c4908e170
|
[
"MIT"
] | null | null | null |
xyw_eyes/spider/__init__.py
|
xue0228/rss
|
ede005fec298493134ed047d9c119e7c4908e170
|
[
"MIT"
] | null | null | null |
xyw_eyes/spider/__init__.py
|
xue0228/rss
|
ede005fec298493134ed047d9c119e7c4908e170
|
[
"MIT"
] | null | null | null |
from xyw_eyes.spider.spider import Spider, Request
from lxml import etree
| 24.666667
| 50
| 0.837838
| 12
| 74
| 5.083333
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.121622
| 74
| 2
| 51
| 37
| 0.938462
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
659a29fd19e7b39767febb48f7dad48aaa7dce32
| 77,779
|
py
|
Python
|
frontend/parsetable.py
|
zengljnwpu/yaspc
|
5e85efb5fb8bee02471814b10e950dfb5b04c5d5
|
[
"MIT"
] | null | null | null |
frontend/parsetable.py
|
zengljnwpu/yaspc
|
5e85efb5fb8bee02471814b10e950dfb5b04c5d5
|
[
"MIT"
] | null | null | null |
frontend/parsetable.py
|
zengljnwpu/yaspc
|
5e85efb5fb8bee02471814b10e950dfb5b04c5d5
|
[
"MIT"
] | null | null | null |
# parsetable.py
# This file is automatically generated. Do not edit.
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'AND ARRAY ASSIGNMENT BINDIGSEQ CASE CHAR COLON COMMA COMMENT CONST DIGSEQ DIV DO DOT DOTDOT DOWNTO ELSE END EQUAL FOR FORWARD FUNCTION GE GOTO GT HEXDIGSEQ IDENTIFIER IF IN LABEL LBRAC LE LPAREN LT MINUS MOD NIL NOT NOTEQUAL OCTDIGSEQ OF OR OTHERWISE PACKED PBEGIN PFILE PLUS PROCEDURE PROGRAM RBRAC REALNUMBER RECORD REPEAT RPAREN SEMICOLON SET SLASH STAR STARSTAR STRING THEN TO TYPE UNTIL UPARROW UNPACKED VAR WHILE WITHfile : program\n program : PROGRAM identifier LPAREN identifier_list RPAREN semicolon block DOT\n program : PROGRAM identifier semicolon block DOTidentifier_list : identifier_list comma identifieridentifier_list : identifierblock : label_declaration_part constant_definition_part type_definition_part variable_declaration_part procedure_and_function_declaration_part statement_partlabel_declaration_part : LABEL label_list semicolonlabel_declaration_part : emptylabel_list : label_list comma labellabel_list : labellabel : DIGSEQconstant_definition_part : CONST constant_listconstant_definition_part : emptyconstant_list : constant_list constant_definitionconstant_list : constant_definitionconstant_definition : identifier EQUAL cexpression semicoloncexpression : csimple_expressioncexpression : csimple_expression relop csimple_expressioncsimple_expression : ctermcsimple_expression : csimple_expression addop ctermcterm : cfactorcterm : cterm mulop cfactorcfactor : sign cfactorcfactor : cprimarycprimary : identifiercprimary : LPAREN cexpression RPARENcprimary : unsigned_constantcprimary : NOT cprimaryconstant : non_stringconstant : sign non_stringconstant : STRINGconstant : CHARsign : PLUSsign : MINUSnon_string : DIGSEQnon_string : identifiernon_string : REALNUMBERtype_definition_part : TYPE type_definition_listtype_definition_part : emptytype_definition_list : type_definition_list type_definitiontype_definition_list : type_definitiontype_definition : identifier EQUAL type_denoter semicolontype_denoter : identifiertype_denoter : new_typenew_type : new_ordinal_typenew_type : new_structured_typenew_type : new_pointer_typenew_ordinal_type : enumerated_typenew_ordinal_type : subrange_typeenumerated_type : LPAREN identifier_list RPARENsubrange_type : constant DOTDOT constantnew_structured_type : structured_typenew_structured_type : PACKED structured_typestructured_type : array_typestructured_type : record_typestructured_type : set_typestructured_type : file_typearray_type : ARRAY LBRAC index_list RBRAC OF component_typeindex_list : index_list comma index_typeindex_list : index_typeindex_type : ordinal_typeordinal_type : new_ordinal_typeordinal_type : identifiercomponent_type : type_denoterrecord_type : RECORD record_section_list ENDrecord_type : RECORD record_section_list semicolon variant_part ENDrecord_type : RECORD variant_part ENDrecord_section_list : record_section_list semicolon record_sectionrecord_section_list : record_sectionrecord_section : identifier_list COLON type_denotervariant_selector : tag_field COLON tag_typevariant_selector : tag_typevariant_list : variant_list semicolon variantvariant_list : variantvariant : case_constant_list COLON LPAREN record_section_list RPARENvariant : case_constant_list COLON LPAREN record_section_list semicolon variant_part RPARENvariant : case_constant_list COLON LPAREN variant_part RPARENvariant_part : CASE variant_selector OF variant_listvariant_part : CASE variant_selector OF variant_list semicolonvariant_part : emptycase_constant_list : case_constant_list comma case_constantcase_constant_list : case_constantcase_constant : constantcase_constant : constant DOTDOT constanttag_field : identifiertag_type : identifierset_type : SET OF base_typebase_type : ordinal_typefile_type : PFILE OF component_typenew_pointer_type : UPARROW domain_typedomain_type : identifiervariable_declaration_part : VAR variable_declaration_list semicolonvariable_declaration_part : emptyvariable_declaration_list : variable_declaration_list semicolon variable_declarationvariable_declaration_list : variable_declarationvariable_declaration : identifier_list COLON type_denoterprocedure_and_function_declaration_part : proc_or_func_declaration_list semicolonprocedure_and_function_declaration_part : emptyproc_or_func_declaration_list : proc_or_func_declaration_list semicolon proc_or_func_declarationproc_or_func_declaration_list : proc_or_func_declarationproc_or_func_declaration : procedure_declarationproc_or_func_declaration : function_declarationprocedure_declaration : procedure_heading semicolon procedure_blockprocedure_heading : procedure_identificationprocedure_heading : procedure_identification formal_parameter_listformal_parameter_list : LPAREN formal_parameter_section_list RPARENformal_parameter_section_list : formal_parameter_section_list semicolon formal_parameter_sectionformal_parameter_section_list : formal_parameter_sectionformal_parameter_section : value_parameter_specificationformal_parameter_section : variable_parameter_specificationformal_parameter_section : procedural_parameter_specificationformal_parameter_section : functional_parameter_specificationvalue_parameter_specification : identifier_list COLON identifier\n variable_parameter_specification : VAR identifier_list COLON identifier\n procedural_parameter_specification : procedure_headingfunctional_parameter_specification : function_headingprocedure_identification : PROCEDURE identifierprocedure_block : block\n function_declaration : function_identification semicolon function_block\n function_declaration : function_heading semicolon function_blockfunction_heading : FUNCTION identifier COLON result_typefunction_heading : FUNCTION identifier formal_parameter_list COLON result_typeresult_type : identifierfunction_identification : FUNCTION identifierfunction_block : blockstatement_part : compound_statementcompound_statement : PBEGIN statement_sequence ENDstatement_sequence : statement_sequence semicolon statementstatement_sequence : statementstatement : open_statementstatement : closed_statementopen_statement : label COLON non_labeled_open_statementopen_statement : non_labeled_open_statementclosed_statement : label COLON non_labeled_closed_statementclosed_statement : non_labeled_closed_statementnon_labeled_open_statement : open_with_statementnon_labeled_open_statement : open_if_statementnon_labeled_open_statement : open_while_statementnon_labeled_open_statement : open_for_statement\n non_labeled_closed_statement : assignment_statement\n | procedure_statement\n | goto_statement\n | compound_statement\n | case_statement\n | repeat_statement\n | closed_with_statement\n | closed_if_statement\n | closed_while_statement\n | closed_for_statement\n | empty\n repeat_statement : REPEAT statement_sequence UNTIL boolean_expressionopen_while_statement : WHILE boolean_expression DO open_statementclosed_while_statement : WHILE boolean_expression DO closed_statementopen_for_statement : FOR control_variable ASSIGNMENT initial_value direction final_value DO open_statementclosed_for_statement : FOR control_variable ASSIGNMENT initial_value direction final_value DO closed_statementopen_with_statement : WITH record_variable_list DO open_statementclosed_with_statement : WITH record_variable_list DO closed_statementopen_if_statement : IF boolean_expression THEN statementopen_if_statement : IF boolean_expression THEN closed_statement ELSE open_statementclosed_if_statement : IF boolean_expression THEN closed_statement ELSE closed_statementassignment_statement : variable_access ASSIGNMENT expressionvariable_access : identifiervariable_access : indexed_variablevariable_access : field_designatorvariable_access : variable_access UPARROWindexed_variable : variable_access LBRAC index_expression_list RBRACindex_expression_list : index_expression_list comma index_expressionindex_expression_list : index_expressionindex_expression : expressionfield_designator : variable_access DOT identifierprocedure_statement : identifier paramsprocedure_statement : identifierparams : LPAREN actual_parameter_list RPARENactual_parameter_list : actual_parameter_list comma actual_parameteractual_parameter_list : actual_parameteractual_parameter : expressionactual_parameter : expression COLON expressionactual_parameter : expression COLON expression COLON expressiongoto_statement : GOTO labelcase_statement : CASE case_index OF case_list_element_list END\n case_statement : CASE case_index OF case_list_element_list SEMICOLON END\n case_statement : CASE case_index OF case_list_element_list semicolon otherwisepart statement ENDcase_statement : CASE case_index OF case_list_element_list semicolon otherwisepart statement SEMICOLON ENDcase_index : expression\n case_list_element_list : case_list_element_list semicolon case_list_element\n case_list_element_list : case_list_elementcase_list_element : case_constant_list COLON statementotherwisepart : OTHERWISEotherwisepart : OTHERWISE COLONcontrol_variable : identifierinitial_value : expressiondirection : TOdirection : DOWNTOfinal_value : expressionrecord_variable_list : record_variable_list comma variable_accessrecord_variable_list : variable_accessboolean_expression : expressionexpression : simple_expressionexpression : simple_expression relop simple_expressionsimple_expression : termsimple_expression : simple_expression addop termterm : factorterm : term mulop factorfactor : sign factorfactor : primaryprimary : variable_accessprimary : unsigned_constantprimary : function_designatorprimary : set_constructorprimary : LPAREN expression RPARENprimary : NOT primaryunsigned_constant : unsigned_numberunsigned_constant : STRINGunsigned_constant : NILunsigned_constant : CHARunsigned_number : unsigned_integerunsigned_number : unsigned_realunsigned_integer : DIGSEQunsigned_integer : HEXDIGSEQunsigned_integer : OCTDIGSEQunsigned_integer : BINDIGSEQunsigned_real : REALNUMBERfunction_designator : identifier paramsset_constructor : LBRAC member_designator_list RBRACset_constructor : LBRAC RBRAC\n member_designator_list : member_designator_list comma member_designator\n member_designator_list : member_designatormember_designator : member_designator DOTDOT expressionmember_designator : expressionaddop : PLUSaddop : MINUSaddop : ORmulop : STARmulop : SLASHmulop : DIVmulop : MODmulop : ANDrelop : EQUALrelop : NOTEQUALrelop : LTrelop : GTrelop : LErelop : GErelop : INidentifier : IDENTIFIERsemicolon : SEMICOLONcomma : COMMAempty : '
_lr_action_items = {'OTHERWISE':([370,371,],[390,-246,]),'NOTEQUAL':([5,62,63,65,66,68,69,70,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,222,230,231,233,234,235,236,239,241,243,247,288,292,298,299,304,326,327,328,331,334,354,],[-245,-19,-222,-215,-217,-212,-219,136,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,-20,-26,-205,-208,-206,-202,136,-207,-200,-209,-162,-165,-204,-225,-211,-223,-170,-201,-210,-224,-203,-166,-173,]),'STAR':([5,62,63,65,66,68,69,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,222,230,231,233,234,236,239,241,243,247,288,292,298,299,304,326,327,328,331,334,354,],[-245,127,-222,-215,-217,-212,-219,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,127,-26,-205,-208,-206,-202,-207,127,-209,-162,-165,-204,-225,-211,-223,-170,127,-210,-224,-203,-166,-173,]),'SLASH':([5,62,63,65,66,68,69,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,222,230,231,233,234,236,239,241,243,247,288,292,298,299,304,326,327,328,331,334,354,],[-245,129,-222,-215,-217,-212,-219,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,129,-26,-205,-208,-206,-202,-207,129,-209,-162,-165,-204,-225,-211,-223,-170,129,-210,-224,-203,-166,-173,]),'DO':([5,63,65,66,68,69,72,77,78,79,80,81,189,192,230,231,233,234,235,236,239,240,241,243,244,247,249,250,251,288,292,298,299,304,325,326,327,328,331,334,338,354,377,380,395,396,424,],[-245,-222,-215,-217,-212,-219,-213,-220,-218,-214,-221,-216,-164,-163,-205,-208,-206,-202,-198,-207,-200,297,-209,-162,-197,-165,305,-196,-162,-204,-225,-211,-223,-170,-199,-201,-210,-224,-203,-166,-195,-173,397,401,408,-194,426,]),'ASSIGNMENT':([5,164,187,189,192,247,254,255,304,334,379,],[-245,246,-162,-164,-163,-165,308,-190,-170,-166,400,]),'THEN':([5,63,65,66,68,69,72,77,78,79,80,81,189,192,230,231,233,234,235,236,239,241,243,244,247,259,288,292,298,299,304,325,326,327,328,331,334,354,382,],[-245,-222,-215,-217,-212,-219,-213,-220,-218,-214,-221,-216,-164,-163,-205,-208,-206,-202,-198,-207,-200,-209,-162,-197,-165,312,-204,-225,-211,-223,-170,-199,-201,-210,-224,-203,-166,-173,402,]),'EQUAL':([5,30,40,62,63,65,66,68,69,70,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,222,230,231,233,234,235,236,239,241,243,247,288,292,298,299,304,326,327,328,331,334,354,],[-245,42,61,-19,-222,-215,-217,-212,-219,138,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,-20,-26,-205,-208,-206,-202,138,-207,-200,-209,-162,-165,-204,-225,-211,-223,-170,-201,-210,-224,-203,-166,-173,]),'GOTO':([6,91,178,229,256,297,305,312,372,378,381,389,390,397,401,402,407,408,419,426,],[-246,179,179,179,179,179,179,179,179,179,179,179,-188,179,179,179,-189,179,179,179,]),'LABEL':([6,7,33,93,95,96,],[-246,11,11,11,11,11,]),'CHAR':([6,24,42,61,64,67,71,76,82,98,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,162,168,186,202,206,213,218,232,237,238,242,245,246,261,277,289,290,296,307,308,311,317,323,329,330,335,347,353,355,356,363,368,370,371,373,374,375,376,386,400,403,418,],[-246,-247,65,120,65,-34,-33,65,65,120,-237,-233,65,-234,-235,-236,65,-241,65,-239,-243,-238,-232,-240,-242,-230,-244,-231,65,65,65,120,120,120,120,65,65,65,65,65,65,65,120,65,65,65,120,65,65,120,120,65,65,65,65,65,65,65,120,120,120,-246,120,65,-193,-192,120,65,65,65,]),'PBEGIN':([6,7,9,10,15,17,25,27,28,29,31,33,35,37,38,39,41,47,49,60,86,91,93,95,96,97,147,178,214,229,256,297,305,312,372,378,381,389,390,397,401,402,407,408,419,426,],[-246,-248,-8,-248,-248,-13,-248,-39,-12,-15,-7,-248,-248,-93,-41,-38,-14,91,-98,-40,-97,91,-248,-248,-248,-92,-16,91,-42,91,91,91,91,91,91,91,91,91,-188,91,91,91,-189,91,91,91,]),'WHILE':([6,91,178,229,256,297,305,312,372,378,381,389,390,397,401,402,407,408,419,426,],[-246,162,162,162,162,162,162,347,162,162,347,162,-188,347,347,347,-189,162,347,347,]),'PROGRAM':([0,],[3,]),'REPEAT':([6,91,178,229,256,297,305,312,372,378,381,389,390,397,401,402,407,408,419,426,],[-246,178,178,178,178,178,178,178,178,178,178,178,-188,178,178,178,-189,178,178,178,]),'CONST':([6,7,9,10,31,33,93,95,96,],[-246,-248,-8,16,-7,-248,-248,-248,-248,]),'DIV':([5,62,63,65,66,68,69,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,222,230,231,233,234,236,239,241,243,247,288,292,298,299,304,326,327,328,331,334,354,],[-245,130,-222,-215,-217,-212,-219,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,130,-26,-205,-208,-206,-202,-207,130,-209,-162,-165,-204,-225,-211,-223,-170,130,-210,-224,-203,-166,-173,]),'WITH':([6,91,178,229,256,297,305,312,372,378,381,389,390,397,401,402,407,408,419,426,],[-246,166,166,166,166,166,166,350,166,166,350,166,-188,350,350,350,-189,166,350,350,]),'MINUS':([5,6,24,42,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,83,98,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,146,162,168,186,189,192,202,206,213,218,219,220,221,222,230,231,232,233,234,235,236,237,238,239,241,243,245,246,247,261,277,288,289,290,292,296,298,299,304,307,308,311,317,323,325,326,327,328,329,330,331,334,335,347,353,354,355,356,363,368,370,371,373,374,375,376,386,400,403,418,],[-245,-246,-247,67,67,-19,-222,67,-215,-217,-34,-212,-219,144,-33,-213,-24,-27,-21,67,-220,-218,-214,-221,-216,-25,67,-237,-233,67,-234,-235,-236,-23,67,-241,67,-239,-243,-238,-232,-240,-242,-230,-244,-231,-28,67,67,67,-164,-163,67,67,67,67,-22,-20,144,-26,-205,-208,67,-206,-202,144,-207,67,67,-200,-209,-162,67,67,-165,67,67,-204,67,67,-225,67,-211,-223,-170,67,67,67,67,67,144,-201,-210,-224,67,67,-203,-166,67,67,67,-173,67,67,67,67,67,-246,67,67,-193,-192,67,67,67,67,]),'DOT':([5,12,44,89,90,164,187,189,192,228,233,243,247,250,251,304,334,338,],[-245,21,85,-6,-126,248,-162,-164,-163,-127,248,-162,-165,248,-162,-170,-166,248,]),'REALNUMBER':([6,24,42,61,64,67,71,76,82,98,102,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,162,168,186,202,206,213,218,232,237,238,242,245,246,261,277,289,290,296,307,308,311,317,323,329,330,335,347,353,355,356,363,368,370,371,373,374,375,376,386,400,403,418,],[-246,-247,63,100,63,-34,-33,63,63,100,100,-237,-233,63,-234,-235,-236,63,-241,63,-239,-243,-238,-232,-240,-242,-230,-244,-231,63,63,63,100,100,100,100,63,63,63,63,63,63,63,100,63,63,63,100,63,63,100,100,63,63,63,63,63,63,63,100,100,100,-246,100,63,-193,-192,100,63,63,63,]),'CASE':([6,91,110,178,229,256,275,297,305,312,372,378,381,389,390,397,401,402,404,407,408,419,421,426,],[-246,168,207,168,168,168,207,168,168,168,168,168,168,168,-188,168,168,168,207,-189,168,168,207,168,]),'LE':([5,62,63,65,66,68,69,70,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,222,230,231,233,234,235,236,239,241,243,247,288,292,298,299,304,326,327,328,331,334,354,],[-245,-19,-222,-215,-217,-212,-219,141,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,-20,-26,-205,-208,-206,-202,141,-207,-200,-209,-162,-165,-204,-225,-211,-223,-170,-201,-210,-224,-203,-166,-173,]),'RPAREN':([5,6,13,14,34,46,62,63,65,66,68,69,70,72,73,74,75,77,78,79,80,81,83,87,94,100,101,103,104,105,107,109,111,114,116,117,119,120,121,122,124,125,132,145,146,149,150,152,153,156,157,158,159,189,192,203,204,205,208,212,215,216,217,219,220,221,222,224,230,231,233,234,235,236,239,241,243,247,263,264,265,266,267,268,269,274,276,281,282,283,284,286,288,291,292,298,299,304,313,314,315,316,319,321,324,325,326,327,328,331,334,354,357,359,362,383,384,386,387,404,405,411,412,413,420,421,422,425,427,],[-245,-246,-5,22,-4,-104,-19,-222,-215,-217,-212,-219,-17,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-105,-117,-37,-57,-45,-46,-55,-31,-29,-48,-49,-56,-35,-54,-32,-52,-44,-47,-43,-23,222,-28,-109,-110,-111,224,-115,-112,-116,-108,-164,-163,-36,-30,-53,-69,-80,-90,-91,281,-22,-20,-18,-26,-106,-205,-208,-206,-202,-198,-207,-200,-209,-162,-165,-123,-121,-51,-87,-88,-62,-63,-65,-67,-50,-64,-89,-107,-113,-204,327,-225,-211,-223,-170,354,-175,-176,-122,-68,-70,-114,-199,-201,-210,-224,-203,-166,-173,-74,-78,-66,-174,-177,-79,-58,-248,-73,-178,420,422,-75,-248,-77,427,-76,]),'SEMICOLON':([4,5,6,18,19,20,22,43,45,46,48,51,53,54,55,56,57,59,62,63,65,66,68,69,70,72,73,74,75,77,78,79,80,81,83,84,87,89,90,91,92,94,100,101,103,104,105,107,109,111,113,114,116,117,119,120,121,122,124,125,132,146,148,149,150,152,153,156,157,158,159,160,161,163,165,167,170,171,172,174,175,176,177,178,180,181,182,183,184,185,187,188,189,190,191,192,195,196,197,198,199,200,201,203,204,205,208,209,215,216,219,220,221,222,224,228,229,230,231,233,234,235,236,239,241,243,244,247,256,257,258,260,263,264,265,266,267,268,269,274,276,281,282,283,284,286,287,288,292,297,298,299,303,304,305,309,310,312,316,319,321,324,325,326,327,328,331,332,333,334,336,337,340,342,346,348,352,354,357,359,362,369,372,378,381,387,389,390,391,392,393,397,398,399,401,402,405,406,407,408,410,412,414,416,417,419,420,422,423,426,427,],[6,-245,-246,6,-10,-11,6,-9,6,-104,-100,6,6,-102,-101,6,6,-95,-19,-222,-215,-217,-212,-219,-17,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,6,-105,-6,-126,-248,-124,-117,-37,-57,-45,-46,-55,-31,-29,-48,6,-49,-56,-35,-54,-32,-52,-44,-47,-43,-23,-28,-99,-109,-110,-111,6,-115,-112,-116,-108,-147,6,-142,-136,-131,-143,-140,-141,-129,-138,-150,-145,-248,-148,-139,-130,-144,-137,-149,-172,-146,-164,-133,-135,-163,-119,-125,-103,-118,-120,-94,-96,-36,-30,-53,-69,6,-90,-91,-22,-20,-18,-26,-106,-127,-248,-205,-208,-206,-202,-198,-207,-200,-209,-162,-197,-165,-248,6,-179,-171,-123,-121,-51,-87,-88,-62,-63,-65,-67,-50,-64,-89,-107,-113,-128,-204,-225,-248,-211,-223,-161,-170,-248,-132,-134,-248,-122,-68,-70,-114,-199,-201,-210,-224,-203,-153,-152,-166,-157,-156,-186,371,-151,-131,-158,-173,-74,6,-66,-180,-248,-248,-248,-58,-248,-188,-185,-181,-187,-248,-160,-159,-248,-248,-73,415,-189,-248,-131,6,-182,-155,-154,-248,-75,-77,-183,-248,-76,]),'RECORD':([61,98,106,218,277,363,],[110,110,110,110,110,110,]),'RBRAC':([5,63,65,66,68,69,72,77,78,79,80,81,100,107,109,111,114,117,120,189,192,203,204,230,231,233,234,235,236,238,239,241,243,247,265,268,269,278,279,280,281,288,292,293,294,295,298,299,300,301,302,304,325,326,327,328,331,334,354,364,365,366,367,],[-245,-222,-215,-217,-212,-219,-213,-220,-218,-214,-221,-216,-37,-31,-29,-48,-49,-35,-32,-164,-163,-36,-30,-205,-208,-206,-202,-198,-207,292,-200,-209,-162,-165,-51,-62,-63,-60,-61,322,-50,-204,-225,328,-227,-229,-211,-223,334,-168,-169,-170,-199,-201,-210,-224,-203,-166,-173,-59,-226,-228,-167,]),'PLUS':([5,6,24,42,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,83,98,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,146,162,168,186,189,192,202,206,213,218,219,220,221,222,230,231,232,233,234,235,236,237,238,239,241,243,245,246,247,261,277,288,289,290,292,296,298,299,304,307,308,311,317,323,325,326,327,328,329,330,331,334,335,347,353,354,355,356,363,368,370,371,373,374,375,376,386,400,403,418,],[-245,-246,-247,71,71,-19,-222,71,-215,-217,-34,-212,-219,142,-33,-213,-24,-27,-21,71,-220,-218,-214,-221,-216,-25,71,-237,-233,71,-234,-235,-236,-23,71,-241,71,-239,-243,-238,-232,-240,-242,-230,-244,-231,-28,71,71,71,-164,-163,71,71,71,71,-22,-20,142,-26,-205,-208,71,-206,-202,142,-207,71,71,-200,-209,-162,71,71,-165,71,71,-204,71,71,-225,71,-211,-223,-170,71,71,71,71,71,142,-201,-210,-224,71,71,-203,-166,71,71,71,-173,71,71,71,71,71,-246,71,71,-193,-192,71,71,71,71,]),'DOTDOT':([5,63,65,66,68,69,72,77,78,79,80,81,99,100,107,109,117,120,125,189,192,203,204,230,231,233,234,235,236,239,241,243,247,269,288,292,294,295,298,299,304,325,326,327,328,331,334,339,354,365,366,],[-245,-222,-215,-217,-212,-219,-213,-220,-218,-214,-221,-216,202,-37,-31,-29,-35,-32,-36,-164,-163,-36,-30,-205,-208,-206,-202,-198,-207,-200,-209,-162,-165,-36,-204,-225,330,-229,-211,-223,-170,-199,-201,-210,-224,-203,-166,368,-173,330,-228,]),'TO':([5,63,65,66,68,69,72,77,78,79,80,81,189,192,230,231,233,234,235,236,239,241,243,247,288,292,298,299,304,325,326,327,328,331,334,344,345,354,409,],[-245,-222,-215,-217,-212,-219,-213,-220,-218,-214,-221,-216,-164,-163,-205,-208,-206,-202,-198,-207,-200,-209,-162,-165,-204,-225,-211,-223,-170,-199,-201,-210,-224,-203,-166,376,-191,-173,376,]),'LT':([5,62,63,65,66,68,69,70,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,222,230,231,233,234,235,236,239,241,243,247,288,292,298,299,304,326,327,328,331,334,354,],[-245,-19,-222,-215,-217,-212,-219,140,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,-20,-26,-205,-208,-206,-202,140,-207,-200,-209,-162,-165,-204,-225,-211,-223,-170,-201,-210,-224,-203,-166,-173,]),'COLON':([5,13,20,34,58,63,65,66,68,69,72,77,78,79,80,81,92,100,107,109,117,120,155,173,189,192,193,203,204,211,223,224,226,230,231,233,234,235,236,239,241,243,247,271,272,288,292,298,299,304,315,325,326,327,328,331,334,339,341,343,351,354,358,384,388,390,394,],[-245,-5,-11,-4,98,-222,-215,-217,-212,-219,-213,-220,-218,-214,-221,-216,194,-37,-31,-29,-35,-32,227,256,-164,-163,262,-36,-30,277,194,-106,285,-205,-208,-206,-202,-198,-207,-200,-209,-162,-165,-85,318,-204,-225,-211,-223,-170,356,-199,-201,-210,-224,-203,-166,-83,-82,372,381,-173,385,403,-84,407,-81,]),'PACKED':([61,98,218,277,363,],[106,106,106,106,106,]),'HEXDIGSEQ':([24,42,64,67,71,76,82,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,162,168,186,232,237,238,242,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,375,376,400,403,418,],[-247,69,69,-34,-33,69,69,-237,-233,69,-234,-235,-236,69,-241,69,-239,-243,-238,-232,-240,-242,-230,-244,-231,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,-193,-192,69,69,69,]),'COMMA':([5,13,14,18,19,20,34,43,58,63,65,66,68,69,72,77,78,79,80,81,100,107,109,111,114,117,120,155,189,192,203,204,211,217,226,230,231,233,234,235,236,239,241,243,247,249,250,251,265,268,269,278,279,280,281,288,292,293,294,295,298,299,300,301,302,304,313,314,315,325,326,327,328,331,334,338,339,341,343,354,358,364,365,366,367,380,383,384,388,394,411,],[-245,-5,24,24,-10,-11,-4,-9,24,-222,-215,-217,-212,-219,-213,-220,-218,-214,-221,-216,-37,-31,-29,-48,-49,-35,-32,24,-164,-163,-36,-30,24,24,24,-205,-208,-206,-202,-198,-207,-200,-209,-162,-165,24,-196,-162,-51,-62,-63,-60,-61,24,-50,-204,-225,24,-227,-229,-211,-223,24,-168,-169,-170,24,-175,-176,-199,-201,-210,-224,-203,-166,-195,-83,-82,24,-173,24,-59,-226,-228,-167,24,-174,-177,-84,-81,-178,]),'ARRAY':([61,98,106,218,277,363,],[112,112,112,112,112,112,]),'IDENTIFIER':([3,6,8,16,23,24,26,28,29,36,38,39,41,42,50,52,60,61,64,67,71,76,82,88,91,97,98,102,110,115,118,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,147,151,154,162,166,168,169,178,186,194,202,206,207,213,214,218,225,227,229,232,237,238,242,245,246,248,256,261,262,275,277,285,289,290,296,297,305,306,307,308,311,312,317,318,323,329,330,335,347,349,350,353,355,356,363,368,370,371,372,373,374,375,376,378,381,386,389,390,397,400,401,402,403,404,407,408,418,419,421,426,],[5,-246,5,5,5,-247,5,5,-15,5,-41,5,-14,5,5,5,-40,5,5,-34,-33,5,5,5,5,5,5,5,5,5,5,-237,-233,5,-234,-235,-236,5,-241,5,-239,-243,-238,-232,-240,-242,-230,-244,-231,-16,5,5,5,5,5,5,5,5,5,5,5,5,5,-42,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,-246,5,5,5,-193,-192,5,5,5,5,-188,5,5,5,5,5,5,-189,5,5,5,5,5,]),'$end':([1,2,21,85,],[-1,0,-3,-2,]),'FUNCTION':([6,7,9,10,15,17,25,27,28,29,31,33,35,37,38,39,41,60,86,88,93,95,96,97,147,214,225,],[-246,-248,-8,-248,-248,-13,-248,-39,-12,-15,-7,-248,50,-93,-41,-38,-14,-40,50,151,-248,-248,-248,-92,-16,-42,151,]),'GT':([5,62,63,65,66,68,69,70,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,222,230,231,233,234,235,236,239,241,243,247,288,292,298,299,304,326,327,328,331,334,354,],[-245,-19,-222,-215,-217,-212,-219,134,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,-20,-26,-205,-208,-206,-202,134,-207,-200,-209,-162,-165,-204,-225,-211,-223,-170,-201,-210,-224,-203,-166,-173,]),'END':([5,6,20,63,65,66,68,69,72,77,78,79,80,81,91,100,101,103,104,105,107,109,110,111,114,116,117,119,120,121,122,124,125,160,161,163,165,167,170,171,172,174,175,176,177,180,181,182,183,184,185,187,188,189,190,191,192,203,204,205,208,209,210,212,215,216,228,229,230,231,233,234,235,236,239,241,243,244,247,256,258,260,265,266,267,268,269,274,275,276,281,282,283,287,288,292,297,298,299,303,304,305,309,310,312,319,320,321,325,326,327,328,331,332,333,334,336,337,340,342,346,348,352,354,357,359,362,369,371,372,378,381,386,387,389,390,391,392,393,397,398,399,401,402,405,406,407,408,410,414,415,416,417,419,420,422,423,426,427,],[-245,-246,-11,-222,-215,-217,-212,-219,-213,-220,-218,-214,-221,-216,-248,-37,-57,-45,-46,-55,-31,-29,-248,-48,-49,-56,-35,-54,-32,-52,-44,-47,-43,-147,228,-142,-136,-131,-143,-140,-141,-129,-138,-150,-145,-148,-139,-130,-144,-137,-149,-172,-146,-164,-133,-135,-163,-36,-30,-53,-69,274,276,-80,-90,-91,-127,-248,-205,-208,-206,-202,-198,-207,-200,-209,-162,-197,-165,-248,-179,-171,-51,-87,-88,-62,-63,-65,-248,-67,-50,-64,-89,-128,-204,-225,-248,-211,-223,-161,-170,-248,-132,-134,-248,-68,362,-70,-199,-201,-210,-224,-203,-153,-152,-166,-157,-156,-186,369,-151,-131,-158,-173,-74,-78,-66,-180,392,-248,-248,-248,-79,-58,-248,-188,-185,-181,-187,-248,-160,-159,-248,-248,-73,414,-189,-248,-131,-182,423,-155,-154,-248,-75,-77,-183,-248,-76,]),'STRING':([6,24,42,61,64,67,71,76,82,98,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,162,168,186,202,206,213,218,232,237,238,242,245,246,261,277,289,290,296,307,308,311,317,323,329,330,335,347,353,355,356,363,368,370,371,373,374,375,376,386,400,403,418,],[-246,-247,72,107,72,-34,-33,72,72,107,-237,-233,72,-234,-235,-236,72,-241,72,-239,-243,-238,-232,-240,-242,-230,-244,-231,72,72,72,107,107,107,107,72,72,72,72,72,72,72,107,72,72,72,107,72,72,107,107,72,72,72,72,72,72,72,107,107,107,-246,107,72,-193,-192,107,72,72,72,]),'FOR':([6,91,178,229,256,297,305,312,372,378,381,389,390,397,401,402,407,408,419,426,],[-246,169,169,169,169,169,169,349,169,169,349,169,-188,349,349,349,-189,169,349,349,]),'UPARROW':([5,61,98,164,187,189,192,218,233,243,247,250,251,277,304,334,338,363,],[-245,115,115,247,-162,-164,-163,115,247,-162,-165,247,-162,115,-170,-166,247,115,]),'ELSE':([5,20,63,65,66,68,69,72,77,78,79,80,81,160,163,170,171,172,176,177,180,183,185,187,188,189,191,192,228,230,231,233,234,235,236,239,241,243,244,247,256,258,260,288,292,297,298,299,303,304,305,310,312,325,326,327,328,331,332,334,336,346,348,354,369,378,381,392,397,398,401,402,408,410,414,416,419,423,426,],[-245,-11,-222,-215,-217,-212,-219,-213,-220,-218,-214,-221,-216,-147,-142,-143,-140,-141,-150,-145,-148,-144,-149,-172,-146,-164,-135,-163,-127,-205,-208,-206,-202,-198,-207,-200,-209,-162,-197,-165,-248,-179,-171,-204,-225,-248,-211,-223,-161,-170,-248,-134,-248,-199,-201,-210,-224,-203,-153,-166,-157,-151,378,-173,-180,-248,-248,-181,-248,-160,-248,-248,-248,419,-182,-155,-248,-183,-248,]),'GE':([5,62,63,65,66,68,69,70,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,222,230,231,233,234,235,236,239,241,243,247,288,292,298,299,304,326,327,328,331,334,354,],[-245,-19,-222,-215,-217,-212,-219,137,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,-20,-26,-205,-208,-206,-202,137,-207,-200,-209,-162,-165,-204,-225,-211,-223,-170,-201,-210,-224,-203,-166,-173,]),'SET':([61,98,106,218,277,363,],[108,108,108,108,108,108,]),'LPAREN':([4,5,24,42,46,61,64,67,71,76,82,92,94,98,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,162,168,186,187,206,213,218,223,232,237,238,242,243,245,246,261,277,289,290,296,308,311,323,329,330,335,347,353,355,356,363,374,375,376,385,400,403,418,],[8,-245,-247,76,88,118,76,-34,-33,76,76,88,-117,118,-237,-233,76,-234,-235,-236,76,-241,76,-239,-243,-238,-232,-240,-242,-230,-244,-231,237,237,237,261,118,118,118,88,237,237,237,237,261,237,237,237,118,237,237,237,237,237,118,237,237,237,237,237,237,237,118,237,-193,-192,404,237,237,237,]),'IN':([5,62,63,65,66,68,69,70,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,222,230,231,233,234,235,236,239,241,243,247,288,292,298,299,304,326,327,328,331,334,354,],[-245,-19,-222,-215,-217,-212,-219,143,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,-20,-26,-205,-208,-206,-202,143,-207,-200,-209,-162,-165,-204,-225,-211,-223,-170,-201,-210,-224,-203,-166,-173,]),'VAR':([6,7,9,10,15,17,25,27,28,29,31,33,38,39,41,60,88,93,95,96,147,214,225,],[-246,-248,-8,-248,-248,-13,36,-39,-12,-15,-7,-248,-41,-38,-14,-40,154,-248,-248,-248,-16,-42,154,]),'UNTIL':([5,6,20,63,65,66,68,69,72,77,78,79,80,81,160,163,165,167,170,171,172,174,175,176,177,178,180,181,182,183,184,185,187,188,189,190,191,192,228,229,230,231,233,234,235,236,239,241,243,244,247,256,257,258,260,287,288,292,297,298,299,303,304,305,309,310,312,325,326,327,328,331,332,333,334,336,337,346,348,352,354,369,378,381,392,397,398,399,401,402,408,410,414,416,417,419,423,426,],[-245,-246,-11,-222,-215,-217,-212,-219,-213,-220,-218,-214,-221,-216,-147,-142,-136,-131,-143,-140,-141,-129,-138,-150,-145,-248,-148,-139,-130,-144,-137,-149,-172,-146,-164,-133,-135,-163,-127,-248,-205,-208,-206,-202,-198,-207,-200,-209,-162,-197,-165,-248,311,-179,-171,-128,-204,-225,-248,-211,-223,-161,-170,-248,-132,-134,-248,-199,-201,-210,-224,-203,-153,-152,-166,-157,-156,-151,-131,-158,-173,-180,-248,-248,-181,-248,-160,-159,-248,-248,-248,-131,-182,-155,-154,-248,-183,-248,]),'PROCEDURE':([6,7,9,10,15,17,25,27,28,29,31,33,35,37,38,39,41,60,86,88,93,95,96,97,147,214,225,],[-246,-248,-8,-248,-248,-13,-248,-39,-12,-15,-7,-248,52,-93,-41,-38,-14,-40,52,52,-248,-248,-248,-92,-16,-42,52,]),'IF':([6,91,178,229,256,297,305,312,372,378,381,389,390,397,401,402,407,408,419,426,],[-246,186,186,186,186,186,186,353,186,186,353,186,-188,353,353,353,-189,186,353,353,]),'AND':([5,62,63,65,66,68,69,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,222,230,231,233,234,236,239,241,243,247,288,292,298,299,304,326,327,328,331,334,354,],[-245,126,-222,-215,-217,-212,-219,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,126,-26,-205,-208,-206,-202,-207,126,-209,-162,-165,-204,-225,-211,-223,-170,126,-210,-224,-203,-166,-173,]),'OCTDIGSEQ':([24,42,64,67,71,76,82,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,162,168,186,232,237,238,242,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,375,376,400,403,418,],[-247,77,77,-34,-33,77,77,-237,-233,77,-234,-235,-236,77,-241,77,-239,-243,-238,-232,-240,-242,-230,-244,-231,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,-193,-192,77,77,77,]),'LBRAC':([5,24,67,71,112,126,127,129,130,131,134,136,137,138,139,140,141,142,143,144,162,164,168,186,187,189,192,232,233,237,238,242,243,245,246,247,250,251,261,289,290,296,304,308,311,329,330,334,335,338,347,353,355,356,374,375,376,400,403,418,],[-245,-247,-34,-33,213,-237,-233,-234,-235,-236,-241,-239,-243,-238,-232,-240,-242,-230,-244,-231,238,245,238,238,-162,-164,-163,238,245,238,238,238,-162,238,238,-165,245,-162,238,238,238,238,-170,238,238,238,238,-166,238,245,238,238,238,238,238,-193,-192,238,238,238,]),'NIL':([24,42,64,67,71,76,82,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,162,168,186,232,237,238,242,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,375,376,400,403,418,],[-247,79,79,-34,-33,79,79,-237,-233,79,-234,-235,-236,79,-241,79,-239,-243,-238,-232,-240,-242,-230,-244,-231,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,-193,-192,79,79,79,]),'PFILE':([61,98,106,218,277,363,],[123,123,123,123,123,123,]),'OF':([5,63,65,66,68,69,72,77,78,79,80,81,108,123,189,192,230,231,233,234,235,236,239,241,243,247,252,253,270,271,273,288,292,298,299,304,322,325,326,327,328,331,334,354,360,361,],[-245,-222,-215,-217,-212,-219,-213,-220,-218,-214,-221,-216,206,218,-164,-163,-205,-208,-206,-202,-198,-207,-200,-209,-162,-165,307,-184,317,-86,-72,-204,-225,-211,-223,-170,363,-199,-201,-210,-224,-203,-166,-173,-86,-71,]),'DOWNTO':([5,63,65,66,68,69,72,77,78,79,80,81,189,192,230,231,233,234,235,236,239,241,243,247,288,292,298,299,304,325,326,327,328,331,334,344,345,354,409,],[-245,-222,-215,-217,-212,-219,-213,-220,-218,-214,-221,-216,-164,-163,-205,-208,-206,-202,-198,-207,-200,-209,-162,-165,-204,-225,-211,-223,-170,-199,-201,-210,-224,-203,-166,375,-191,-173,375,]),'BINDIGSEQ':([24,42,64,67,71,76,82,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,162,168,186,232,237,238,242,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,375,376,400,403,418,],[-247,80,80,-34,-33,80,80,-237,-233,80,-234,-235,-236,80,-241,80,-239,-243,-238,-232,-240,-242,-230,-244,-231,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,-193,-192,80,80,80,]),'NOT':([24,42,64,67,71,76,82,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,162,168,186,232,237,238,242,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,375,376,400,403,418,],[-247,82,82,-34,-33,82,82,-237,-233,82,-234,-235,-236,82,-241,82,-239,-243,-238,-232,-240,-242,-230,-244,-231,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,-193,-192,242,242,242,]),'DIGSEQ':([6,11,24,32,42,61,64,67,71,76,82,91,98,102,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,162,168,178,179,186,202,206,213,218,229,232,237,238,242,245,246,261,277,289,290,296,297,305,307,308,311,312,317,323,329,330,335,347,353,355,356,363,368,370,371,372,373,374,375,376,378,386,389,390,397,400,401,402,403,407,408,418,419,426,],[-246,20,-247,20,78,117,78,-34,-33,78,78,20,117,117,-237,-233,78,-234,-235,-236,78,-241,78,-239,-243,-238,-232,-240,-242,-230,-244,-231,78,78,20,20,78,117,117,117,117,20,78,78,78,78,78,78,78,117,78,78,78,20,20,117,78,78,20,117,117,78,78,78,78,78,78,78,117,117,117,-246,20,117,78,-193,-192,20,117,20,-188,20,78,20,20,78,-189,20,78,20,20,]),'TYPE':([6,7,9,10,15,17,28,29,31,33,41,93,95,96,147,],[-246,-248,-8,-248,26,-13,-12,-15,-7,-248,-14,-248,-248,-248,-16,]),'OR':([5,62,63,65,66,68,69,70,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,221,222,230,231,233,234,235,236,239,241,243,247,288,292,298,299,304,325,326,327,328,331,334,354,],[-245,-19,-222,-215,-217,-212,-219,139,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,-20,139,-26,-205,-208,-206,-202,139,-207,-200,-209,-162,-165,-204,-225,-211,-223,-170,139,-201,-210,-224,-203,-166,-173,]),'MOD':([5,62,63,65,66,68,69,72,73,74,75,77,78,79,80,81,83,132,146,189,192,219,220,222,230,231,233,234,236,239,241,243,247,288,292,298,299,304,326,327,328,331,334,354,],[-245,131,-222,-215,-217,-212,-219,-213,-24,-27,-21,-220,-218,-214,-221,-216,-25,-23,-28,-164,-163,-22,131,-26,-205,-208,-206,-202,-207,131,-209,-162,-165,-204,-225,-211,-223,-170,131,-210,-224,-203,-166,-173,]),}
_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 = {'cterm':([42,76,133,135,],[62,62,220,62,]),'file_type':([61,98,106,218,277,363,],[101,101,101,101,101,101,]),'variable_declaration_part':([25,],[35,]),'closed_if_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,]),'new_type':([61,98,218,277,363,],[122,122,122,122,122,]),'comma':([14,18,58,155,211,217,226,249,280,293,300,313,343,358,380,],[23,32,23,23,23,23,23,306,323,329,335,355,373,373,306,]),'closed_statement':([91,178,229,297,305,312,372,378,389,397,401,402,408,419,426,],[167,167,167,332,336,348,167,398,167,332,336,410,416,398,416,]),'otherwisepart':([370,],[389,]),'final_value':([374,418,],[395,424,]),'field_designator':([91,162,166,168,178,186,229,232,237,238,242,245,246,256,261,289,290,296,297,305,306,308,311,312,329,330,335,347,350,353,355,356,372,374,378,381,389,397,400,401,402,403,408,418,419,426,],[189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,]),'procedure_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,]),'index_type':([213,323,],[278,364,]),'enumerated_type':([61,98,206,213,218,277,323,363,],[111,111,111,111,111,111,111,111,]),'program':([0,],[1,]),'variable_parameter_specification':([88,225,],[150,150,]),'type_definition_list':([26,],[39,]),'formal_parameter_list':([46,92,223,],[87,193,193,]),'formal_parameter_section_list':([88,],[153,]),'index_expression_list':([245,],[300,]),'index_list':([213,],[280,]),'domain_type':([115,],[215,]),'cfactor':([42,64,76,128,133,135,],[75,132,75,219,75,75,]),'case_list_element':([307,370,],[340,391,]),'case_constant':([307,317,370,373,386,],[341,341,341,394,341,]),'case_list_element_list':([307,],[342,]),'type_definition':([26,39,],[38,60,]),'term':([162,168,186,237,238,245,246,261,289,290,308,311,329,330,335,347,353,355,356,374,400,403,418,],[239,239,239,239,239,239,239,239,239,326,239,239,239,239,239,239,239,239,239,239,239,239,239,]),'closed_with_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,]),'record_type':([61,98,106,218,277,363,],[105,105,105,105,105,105,]),'boolean_expression':([162,186,311,347,353,],[240,259,346,377,382,]),'actual_parameter':([261,355,],[314,383,]),'identifier':([3,8,16,23,26,28,36,39,42,50,52,61,64,76,82,88,91,97,98,102,110,115,118,128,133,135,151,154,162,166,168,169,178,186,194,202,206,207,213,218,225,227,229,232,237,238,242,245,246,248,256,261,262,275,277,285,289,290,296,297,305,306,307,308,311,312,317,318,323,329,330,335,347,349,350,353,355,356,363,368,370,372,373,374,378,381,386,389,397,400,401,402,403,404,408,418,419,421,426,],[4,13,30,34,40,30,13,40,83,92,94,125,83,83,83,13,187,13,125,203,13,216,13,83,83,83,223,13,243,251,243,255,187,243,263,203,269,271,269,125,13,286,187,243,243,243,243,243,243,304,187,243,263,13,125,324,243,243,243,187,187,251,203,243,243,187,203,360,269,243,243,243,243,255,251,243,243,243,125,203,203,187,203,243,187,187,203,187,187,243,187,187,243,13,187,243,187,13,187,]),'unsigned_integer':([42,64,76,82,128,133,135,162,168,186,232,237,238,242,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,400,403,418,],[81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,]),'actual_parameter_list':([261,],[313,]),'label_list':([11,],[18,]),'sign':([42,61,64,76,98,128,133,135,162,168,186,202,206,213,218,232,237,238,245,246,261,277,289,290,296,307,308,311,317,323,329,330,335,347,353,355,356,363,368,370,373,374,386,400,403,418,],[64,102,64,64,102,64,64,64,232,232,232,102,102,102,102,232,232,232,232,232,232,102,232,232,232,102,232,232,102,102,232,232,232,232,232,232,232,102,102,102,102,232,102,232,232,232,]),'procedure_identification':([35,86,88,225,],[46,46,46,46,]),'goto_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,]),'unsigned_real':([42,64,76,82,128,133,135,162,168,186,232,237,238,242,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,400,403,418,],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,]),'open_with_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,]),'tag_field':([207,],[272,]),'simple_expression':([162,168,186,237,238,245,246,261,289,308,311,329,330,335,347,353,355,356,374,400,403,418,],[235,235,235,235,235,235,235,235,325,235,235,235,235,235,235,235,235,235,235,235,235,235,]),'constant_definition_part':([10,],[15,]),'ordinal_type':([206,213,323,],[267,279,279,]),'compound_statement':([47,91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[90,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,]),'member_designator_list':([238,],[293,]),'statement_part':([47,],[89,]),'label':([11,32,91,178,179,229,297,305,312,372,378,389,397,401,402,408,419,426,],[19,43,173,173,258,173,173,173,351,173,173,173,351,351,351,173,351,351,]),'proc_or_func_declaration':([35,86,],[48,148,]),'unsigned_number':([42,64,76,82,128,133,135,162,168,186,232,237,238,242,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,400,403,418,],[68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,]),'type_denoter':([61,98,218,277,363,],[113,201,282,321,282,]),'procedural_parameter_specification':([88,225,],[152,152,]),'closed_while_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,]),'cprimary':([42,64,76,82,128,133,135,],[73,73,73,146,73,73,73,]),'open_for_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,]),'record_variable_list':([166,350,],[249,380,]),'set_type':([61,98,106,218,277,363,],[116,116,116,116,116,116,]),'case_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,183,]),'open_if_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,]),'array_type':([61,98,106,218,277,363,],[119,119,119,119,119,119,]),'case_index':([168,],[252,]),'type_definition_part':([15,],[25,]),'constant_list':([16,],[28,]),'function_declaration':([35,86,],[54,54,]),'component_type':([218,363,],[283,387,]),'function_heading':([35,86,88,225,],[56,56,158,158,]),'label_declaration_part':([7,33,93,95,96,],[10,10,10,10,10,]),'expression':([162,168,186,237,238,245,246,261,308,311,329,330,335,347,353,355,356,374,400,403,418,],[244,253,244,291,295,302,303,315,345,244,295,366,302,244,244,315,384,396,345,411,396,]),'new_pointer_type':([61,98,218,277,363,],[124,124,124,124,124,]),'index_expression':([245,335,],[301,367,]),'mulop':([62,220,239,326,],[128,128,296,296,]),'statement_sequence':([91,178,],[161,257,]),'cexpression':([42,76,],[84,145,]),'indexed_variable':([91,162,166,168,178,186,229,232,237,238,242,245,246,256,261,289,290,296,297,305,306,308,311,312,329,330,335,347,350,353,355,356,372,374,378,381,389,397,400,401,402,403,408,418,419,426,],[192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,]),'primary':([162,168,186,232,237,238,242,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,400,403,418,],[230,230,230,230,230,230,298,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,]),'control_variable':([169,349,],[254,379,]),'constant_definition':([16,28,],[29,41,]),'set_constructor':([162,168,186,232,237,238,242,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,400,403,418,],[241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,]),'proc_or_func_declaration_list':([35,],[45,]),'value_parameter_specification':([88,225,],[149,149,]),'variable_declaration':([36,97,],[59,200,]),'assignment_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,]),'params':([187,243,],[260,299,]),'statement':([91,178,229,312,372,389,402,],[174,174,287,352,393,406,352,]),'csimple_expression':([42,76,135,],[70,70,221,]),'non_labeled_open_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[190,190,190,309,190,190,190,190,190,309,190,190,190,190,190,190,190,]),'empty':([7,10,15,25,33,35,91,93,95,96,110,178,229,256,275,297,305,312,372,378,381,389,397,401,402,404,408,419,421,426,],[9,17,27,37,9,49,176,9,9,9,212,176,176,176,212,176,176,176,176,176,176,176,176,176,176,212,176,176,212,176,]),'repeat_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,]),'addop':([70,221,235,325,],[133,133,290,290,]),'direction':([344,409,],[374,418,]),'subrange_type':([61,98,206,213,218,277,323,363,],[114,114,114,114,114,114,114,114,]),'factor':([162,168,186,232,237,238,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,400,403,418,],[234,234,234,288,234,234,234,234,234,234,234,331,234,234,234,234,234,234,234,234,234,234,234,234,234,]),'open_statement':([91,178,229,297,305,312,372,378,389,397,401,402,408,419,426,],[182,182,182,333,337,182,182,399,182,333,337,182,417,399,417,]),'record_section_list':([110,404,],[209,412,]),'variable_declaration_list':([36,],[57,]),'closed_for_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,]),'new_ordinal_type':([61,98,206,213,218,277,323,363,],[103,103,268,268,103,103,268,103,]),'procedure_heading':([35,86,88,225,],[53,53,156,156,]),'record_section':([110,275,404,421,],[208,319,208,319,]),'procedure_declaration':([35,86,],[55,55,]),'initial_value':([308,400,],[344,409,]),'variant_list':([317,],[359,]),'non_labeled_closed_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[191,191,191,310,191,191,191,191,191,310,191,191,191,191,191,191,191,]),'functional_parameter_specification':([88,225,],[157,157,]),'constant':([61,98,202,206,213,218,277,307,317,323,363,368,370,373,386,],[99,99,265,99,99,99,99,339,339,99,99,388,339,339,339,]),'semicolon':([4,18,22,45,51,53,56,57,84,113,153,161,209,257,342,359,412,],[7,31,33,86,93,95,96,97,147,214,225,229,275,229,370,386,421,]),'function_designator':([162,168,186,232,237,238,242,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,400,403,418,],[231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,]),'new_structured_type':([61,98,218,277,363,],[104,104,104,104,104,]),'file':([0,],[2,]),'variant_selector':([207,],[270,]),'procedure_and_function_declaration_part':([35,],[47,]),'non_string':([61,98,102,202,206,213,218,277,307,317,323,363,368,370,373,386,],[109,109,204,109,109,109,109,109,109,109,109,109,109,109,109,109,]),'variable_access':([91,162,166,168,178,186,229,232,237,238,242,245,246,256,261,289,290,296,297,305,306,308,311,312,329,330,335,347,350,353,355,356,372,374,378,381,389,397,400,401,402,403,408,418,419,426,],[164,233,250,233,164,233,164,233,233,233,233,233,233,164,233,233,233,233,164,164,338,233,233,164,233,233,233,233,250,233,233,233,164,233,164,164,164,164,233,164,164,233,164,233,164,164,]),'base_type':([206,],[266,]),'member_designator':([238,329,],[294,365,]),'structured_type':([61,98,106,218,277,363,],[121,121,205,121,121,121,]),'open_while_statement':([91,178,229,256,297,305,312,372,378,381,389,397,401,402,408,419,426,],[175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,]),'procedure_block':([95,],[197,]),'variant':([317,386,],[357,405,]),'unsigned_constant':([42,64,76,82,128,133,135,162,168,186,232,237,238,242,245,246,261,289,290,296,308,311,329,330,335,347,353,355,356,374,400,403,418,],[74,74,74,74,74,74,74,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,]),'function_identification':([35,86,],[51,51,]),'variant_part':([110,275,404,421,],[210,320,413,425,]),'function_block':([93,96,],[195,199,]),'identifier_list':([8,36,88,97,110,118,154,225,275,404,421,],[14,58,155,58,211,217,226,155,211,211,211,]),'case_constant_list':([307,317,370,386,],[343,358,343,358,]),'relop':([70,235,],[135,289,]),'formal_parameter_section':([88,225,],[159,284,]),'block':([7,33,93,95,96,],[12,44,196,198,196,]),'result_type':([194,262,],[264,316,]),'tag_type':([207,318,],[273,361,]),}
_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' -> file","S'",1,None,None,None),
('file -> program','file',1,'p_file_1','parser.py',57),
('program -> PROGRAM identifier LPAREN identifier_list RPAREN semicolon block DOT','program',8,'p_program_1','parser.py',63),
('program -> PROGRAM identifier semicolon block DOT','program',5,'p_program_2','parser.py',70),
('identifier_list -> identifier_list comma identifier','identifier_list',3,'p_identifier_list_1','parser.py',76),
('identifier_list -> identifier','identifier_list',1,'p_identifier_list_2','parser.py',82),
('block -> label_declaration_part constant_definition_part type_definition_part variable_declaration_part procedure_and_function_declaration_part statement_part','block',6,'p_block_1','parser.py',88),
('label_declaration_part -> LABEL label_list semicolon','label_declaration_part',3,'p_label_declaration_part_1','parser.py',94),
('label_declaration_part -> empty','label_declaration_part',1,'p_label_declaration_part_2','parser.py',100),
('label_list -> label_list comma label','label_list',3,'p_label_list_1','parser.py',105),
('label_list -> label','label_list',1,'p_label_list_2','parser.py',111),
('label -> DIGSEQ','label',1,'p_label_1','parser.py',117),
('constant_definition_part -> CONST constant_list','constant_definition_part',2,'p_constant_definition_part_1','parser.py',123),
('constant_definition_part -> empty','constant_definition_part',1,'p_constant_definition_part_2','parser.py',128),
('constant_list -> constant_list constant_definition','constant_list',2,'p_constant_list_1','parser.py',133),
('constant_list -> constant_definition','constant_list',1,'p_constant_list_2','parser.py',139),
('constant_definition -> identifier EQUAL cexpression semicolon','constant_definition',4,'p_constant_definition_1','parser.py',145),
('cexpression -> csimple_expression','cexpression',1,'p_cexpression_1','parser.py',151),
('cexpression -> csimple_expression relop csimple_expression','cexpression',3,'p_cexpression_2','parser.py',156),
('csimple_expression -> cterm','csimple_expression',1,'p_csimple_expression_1','parser.py',162),
('csimple_expression -> csimple_expression addop cterm','csimple_expression',3,'p_csimple_expression_2','parser.py',167),
('cterm -> cfactor','cterm',1,'p_cterm_1','parser.py',173),
('cterm -> cterm mulop cfactor','cterm',3,'p_cterm_2','parser.py',178),
('cfactor -> sign cfactor','cfactor',2,'p_cfactor_1','parser.py',184),
('cfactor -> cprimary','cfactor',1,'p_cfactor_2','parser.py',190),
('cprimary -> identifier','cprimary',1,'p_cprimary_1','parser.py',195),
('cprimary -> LPAREN cexpression RPAREN','cprimary',3,'p_cprimary_2','parser.py',200),
('cprimary -> unsigned_constant','cprimary',1,'p_cprimary_3','parser.py',205),
('cprimary -> NOT cprimary','cprimary',2,'p_cprimary_4','parser.py',210),
('constant -> non_string','constant',1,'p_constant_1','parser.py',216),
('constant -> sign non_string','constant',2,'p_constant_2','parser.py',221),
('constant -> STRING','constant',1,'p_constant_3','parser.py',227),
('constant -> CHAR','constant',1,'p_constant_4','parser.py',233),
('sign -> PLUS','sign',1,'p_sign_1','parser.py',239),
('sign -> MINUS','sign',1,'p_sign_2','parser.py',244),
('non_string -> DIGSEQ','non_string',1,'p_non_string_1','parser.py',249),
('non_string -> identifier','non_string',1,'p_non_string_2','parser.py',255),
('non_string -> REALNUMBER','non_string',1,'p_non_string_3','parser.py',261),
('type_definition_part -> TYPE type_definition_list','type_definition_part',2,'p_type_definition_part_1','parser.py',267),
('type_definition_part -> empty','type_definition_part',1,'p_type_definition_part_2','parser.py',272),
('type_definition_list -> type_definition_list type_definition','type_definition_list',2,'p_type_definition_list_1','parser.py',277),
('type_definition_list -> type_definition','type_definition_list',1,'p_type_definition_list_2','parser.py',283),
('type_definition -> identifier EQUAL type_denoter semicolon','type_definition',4,'p_type_definition_1','parser.py',289),
('type_denoter -> identifier','type_denoter',1,'p_type_denoter_1','parser.py',295),
('type_denoter -> new_type','type_denoter',1,'p_type_denoter_2','parser.py',301),
('new_type -> new_ordinal_type','new_type',1,'p_new_type_1','parser.py',306),
('new_type -> new_structured_type','new_type',1,'p_new_type_2','parser.py',311),
('new_type -> new_pointer_type','new_type',1,'p_new_type_3','parser.py',316),
('new_ordinal_type -> enumerated_type','new_ordinal_type',1,'p_new_ordinal_type_1','parser.py',321),
('new_ordinal_type -> subrange_type','new_ordinal_type',1,'p_new_ordinal_type_2','parser.py',326),
('enumerated_type -> LPAREN identifier_list RPAREN','enumerated_type',3,'p_enumerated_type_1','parser.py',331),
('subrange_type -> constant DOTDOT constant','subrange_type',3,'p_subrange_type_1','parser.py',337),
('new_structured_type -> structured_type','new_structured_type',1,'p_new_structured_type_1','parser.py',343),
('new_structured_type -> PACKED structured_type','new_structured_type',2,'p_new_structured_type_2','parser.py',348),
('structured_type -> array_type','structured_type',1,'p_structured_type_1','parser.py',354),
('structured_type -> record_type','structured_type',1,'p_structured_type_2','parser.py',359),
('structured_type -> set_type','structured_type',1,'p_structured_type_3','parser.py',364),
('structured_type -> file_type','structured_type',1,'p_structured_type_4','parser.py',369),
('array_type -> ARRAY LBRAC index_list RBRAC OF component_type','array_type',6,'p_array_type_1','parser.py',375),
('index_list -> index_list comma index_type','index_list',3,'p_index_list_1','parser.py',381),
('index_list -> index_type','index_list',1,'p_index_list_2','parser.py',387),
('index_type -> ordinal_type','index_type',1,'p_index_type_1','parser.py',393),
('ordinal_type -> new_ordinal_type','ordinal_type',1,'p_ordinal_type_1','parser.py',398),
('ordinal_type -> identifier','ordinal_type',1,'p_ordinal_type_2','parser.py',403),
('component_type -> type_denoter','component_type',1,'p_component_type_1','parser.py',408),
('record_type -> RECORD record_section_list END','record_type',3,'p_record_type_1','parser.py',413),
('record_type -> RECORD record_section_list semicolon variant_part END','record_type',5,'p_record_type_2','parser.py',419),
('record_type -> RECORD variant_part END','record_type',3,'p_record_type_3','parser.py',425),
('record_section_list -> record_section_list semicolon record_section','record_section_list',3,'p_record_section_list_1','parser.py',431),
('record_section_list -> record_section','record_section_list',1,'p_record_section_list_2','parser.py',437),
('record_section -> identifier_list COLON type_denoter','record_section',3,'p_record_section_1','parser.py',443),
('variant_selector -> tag_field COLON tag_type','variant_selector',3,'p_variant_selector_1','parser.py',449),
('variant_selector -> tag_type','variant_selector',1,'p_variant_selector_2','parser.py',455),
('variant_list -> variant_list semicolon variant','variant_list',3,'p_variant_list_1','parser.py',461),
('variant_list -> variant','variant_list',1,'p_variant_list_2','parser.py',467),
('variant -> case_constant_list COLON LPAREN record_section_list RPAREN','variant',5,'p_variant_1','parser.py',473),
('variant -> case_constant_list COLON LPAREN record_section_list semicolon variant_part RPAREN','variant',7,'p_variant_2','parser.py',479),
('variant -> case_constant_list COLON LPAREN variant_part RPAREN','variant',5,'p_variant_3','parser.py',485),
('variant_part -> CASE variant_selector OF variant_list','variant_part',4,'p_variant_part_1','parser.py',491),
('variant_part -> CASE variant_selector OF variant_list semicolon','variant_part',5,'p_variant_part_2','parser.py',497),
('variant_part -> empty','variant_part',1,'p_variant_part_3','parser.py',503),
('case_constant_list -> case_constant_list comma case_constant','case_constant_list',3,'p_case_constant_list_1','parser.py',508),
('case_constant_list -> case_constant','case_constant_list',1,'p_case_constant_list_2','parser.py',514),
('case_constant -> constant','case_constant',1,'p_case_constant_1','parser.py',520),
('case_constant -> constant DOTDOT constant','case_constant',3,'p_case_constant_2','parser.py',526),
('tag_field -> identifier','tag_field',1,'p_tag_field_1','parser.py',532),
('tag_type -> identifier','tag_type',1,'p_tag_type_1','parser.py',537),
('set_type -> SET OF base_type','set_type',3,'p_set_type_1','parser.py',542),
('base_type -> ordinal_type','base_type',1,'p_base_type_1','parser.py',548),
('file_type -> PFILE OF component_type','file_type',3,'p_file_type_1','parser.py',553),
('new_pointer_type -> UPARROW domain_type','new_pointer_type',2,'p_new_pointer_type_1','parser.py',559),
('domain_type -> identifier','domain_type',1,'p_domain_type_1','parser.py',565),
('variable_declaration_part -> VAR variable_declaration_list semicolon','variable_declaration_part',3,'p_variable_declaration_part_1','parser.py',571),
('variable_declaration_part -> empty','variable_declaration_part',1,'p_variable_declaration_part_2','parser.py',576),
('variable_declaration_list -> variable_declaration_list semicolon variable_declaration','variable_declaration_list',3,'p_variable_declaration_list_1','parser.py',581),
('variable_declaration_list -> variable_declaration','variable_declaration_list',1,'p_variable_declaration_list_2','parser.py',587),
('variable_declaration -> identifier_list COLON type_denoter','variable_declaration',3,'p_variable_declaration_1','parser.py',593),
('procedure_and_function_declaration_part -> proc_or_func_declaration_list semicolon','procedure_and_function_declaration_part',2,'p_procedure_and_function_declaration_part_1','parser.py',599),
('procedure_and_function_declaration_part -> empty','procedure_and_function_declaration_part',1,'p_procedure_and_function_declaration_part_2','parser.py',604),
('proc_or_func_declaration_list -> proc_or_func_declaration_list semicolon proc_or_func_declaration','proc_or_func_declaration_list',3,'p_proc_or_func_declaration_list_1','parser.py',609),
('proc_or_func_declaration_list -> proc_or_func_declaration','proc_or_func_declaration_list',1,'p_proc_or_func_declaration_list_2','parser.py',615),
('proc_or_func_declaration -> procedure_declaration','proc_or_func_declaration',1,'p_proc_or_func_declaration_1','parser.py',621),
('proc_or_func_declaration -> function_declaration','proc_or_func_declaration',1,'p_proc_or_func_declaration_2','parser.py',626),
('procedure_declaration -> procedure_heading semicolon procedure_block','procedure_declaration',3,'p_procedure_declaration_1','parser.py',631),
('procedure_heading -> procedure_identification','procedure_heading',1,'p_procedure_heading_1','parser.py',637),
('procedure_heading -> procedure_identification formal_parameter_list','procedure_heading',2,'p_procedure_heading_2','parser.py',643),
('formal_parameter_list -> LPAREN formal_parameter_section_list RPAREN','formal_parameter_list',3,'p_formal_parameter_list_1','parser.py',649),
('formal_parameter_section_list -> formal_parameter_section_list semicolon formal_parameter_section','formal_parameter_section_list',3,'p_formal_parameter_section_list_1','parser.py',654),
('formal_parameter_section_list -> formal_parameter_section','formal_parameter_section_list',1,'p_formal_parameter_section_list_2','parser.py',660),
('formal_parameter_section -> value_parameter_specification','formal_parameter_section',1,'p_formal_parameter_section_1','parser.py',666),
('formal_parameter_section -> variable_parameter_specification','formal_parameter_section',1,'p_formal_parameter_section_2','parser.py',671),
('formal_parameter_section -> procedural_parameter_specification','formal_parameter_section',1,'p_formal_parameter_section_3','parser.py',676),
('formal_parameter_section -> functional_parameter_specification','formal_parameter_section',1,'p_formal_parameter_section_4','parser.py',681),
('value_parameter_specification -> identifier_list COLON identifier','value_parameter_specification',3,'p_value_parameter_specification_1','parser.py',686),
('variable_parameter_specification -> VAR identifier_list COLON identifier','variable_parameter_specification',4,'p_variable_parameter_specification_1','parser.py',693),
('procedural_parameter_specification -> procedure_heading','procedural_parameter_specification',1,'p_procedural_parameter_specification_1','parser.py',700),
('functional_parameter_specification -> function_heading','functional_parameter_specification',1,'p_functional_parameter_specification_1','parser.py',706),
('procedure_identification -> PROCEDURE identifier','procedure_identification',2,'p_procedure_identification_1','parser.py',712),
('procedure_block -> block','procedure_block',1,'p_procedure_block_1','parser.py',717),
('function_declaration -> function_identification semicolon function_block','function_declaration',3,'p_function_declaration_1','parser.py',723),
('function_declaration -> function_heading semicolon function_block','function_declaration',3,'p_function_declaration_2','parser.py',730),
('function_heading -> FUNCTION identifier COLON result_type','function_heading',4,'p_function_heading_1','parser.py',736),
('function_heading -> FUNCTION identifier formal_parameter_list COLON result_type','function_heading',5,'p_function_heading_2','parser.py',742),
('result_type -> identifier','result_type',1,'p_result_type_1','parser.py',748),
('function_identification -> FUNCTION identifier','function_identification',2,'p_function_identification_1','parser.py',754),
('function_block -> block','function_block',1,'p_function_block_1','parser.py',760),
('statement_part -> compound_statement','statement_part',1,'p_statement_part_1','parser.py',765),
('compound_statement -> PBEGIN statement_sequence END','compound_statement',3,'p_compound_statement_1','parser.py',770),
('statement_sequence -> statement_sequence semicolon statement','statement_sequence',3,'p_statement_sequence_1','parser.py',775),
('statement_sequence -> statement','statement_sequence',1,'p_statement_sequence_2','parser.py',781),
('statement -> open_statement','statement',1,'p_statement_1','parser.py',787),
('statement -> closed_statement','statement',1,'p_statement_2','parser.py',792),
('open_statement -> label COLON non_labeled_open_statement','open_statement',3,'p_open_statement_1','parser.py',797),
('open_statement -> non_labeled_open_statement','open_statement',1,'p_open_statement_2','parser.py',803),
('closed_statement -> label COLON non_labeled_closed_statement','closed_statement',3,'p_closed_statement_1','parser.py',808),
('closed_statement -> non_labeled_closed_statement','closed_statement',1,'p_closed_statement_2','parser.py',814),
('non_labeled_open_statement -> open_with_statement','non_labeled_open_statement',1,'p_non_labeled_open_statement_1','parser.py',819),
('non_labeled_open_statement -> open_if_statement','non_labeled_open_statement',1,'p_non_labeled_open_statement_2','parser.py',824),
('non_labeled_open_statement -> open_while_statement','non_labeled_open_statement',1,'p_non_labeled_open_statement_3','parser.py',829),
('non_labeled_open_statement -> open_for_statement','non_labeled_open_statement',1,'p_non_labeled_open_statement_4','parser.py',834),
('non_labeled_closed_statement -> assignment_statement','non_labeled_closed_statement',1,'p_non_labeled_closed_statement','parser.py',840),
('non_labeled_closed_statement -> procedure_statement','non_labeled_closed_statement',1,'p_non_labeled_closed_statement','parser.py',841),
('non_labeled_closed_statement -> goto_statement','non_labeled_closed_statement',1,'p_non_labeled_closed_statement','parser.py',842),
('non_labeled_closed_statement -> compound_statement','non_labeled_closed_statement',1,'p_non_labeled_closed_statement','parser.py',843),
('non_labeled_closed_statement -> case_statement','non_labeled_closed_statement',1,'p_non_labeled_closed_statement','parser.py',844),
('non_labeled_closed_statement -> repeat_statement','non_labeled_closed_statement',1,'p_non_labeled_closed_statement','parser.py',845),
('non_labeled_closed_statement -> closed_with_statement','non_labeled_closed_statement',1,'p_non_labeled_closed_statement','parser.py',846),
('non_labeled_closed_statement -> closed_if_statement','non_labeled_closed_statement',1,'p_non_labeled_closed_statement','parser.py',847),
('non_labeled_closed_statement -> closed_while_statement','non_labeled_closed_statement',1,'p_non_labeled_closed_statement','parser.py',848),
('non_labeled_closed_statement -> closed_for_statement','non_labeled_closed_statement',1,'p_non_labeled_closed_statement','parser.py',849),
('non_labeled_closed_statement -> empty','non_labeled_closed_statement',1,'p_non_labeled_closed_statement','parser.py',850),
('repeat_statement -> REPEAT statement_sequence UNTIL boolean_expression','repeat_statement',4,'p_repeat_statement_1','parser.py',858),
('open_while_statement -> WHILE boolean_expression DO open_statement','open_while_statement',4,'p_open_while_statement_1','parser.py',864),
('closed_while_statement -> WHILE boolean_expression DO closed_statement','closed_while_statement',4,'p_closed_while_statement_1','parser.py',870),
('open_for_statement -> FOR control_variable ASSIGNMENT initial_value direction final_value DO open_statement','open_for_statement',8,'p_open_for_statement_1','parser.py',876),
('closed_for_statement -> FOR control_variable ASSIGNMENT initial_value direction final_value DO closed_statement','closed_for_statement',8,'p_closed_for_statement_1','parser.py',882),
('open_with_statement -> WITH record_variable_list DO open_statement','open_with_statement',4,'p_open_with_statement_1','parser.py',888),
('closed_with_statement -> WITH record_variable_list DO closed_statement','closed_with_statement',4,'p_closed_with_statement_1','parser.py',894),
('open_if_statement -> IF boolean_expression THEN statement','open_if_statement',4,'p_open_if_statement_1','parser.py',900),
('open_if_statement -> IF boolean_expression THEN closed_statement ELSE open_statement','open_if_statement',6,'p_open_if_statement_2','parser.py',906),
('closed_if_statement -> IF boolean_expression THEN closed_statement ELSE closed_statement','closed_if_statement',6,'p_closed_if_statement_1','parser.py',912),
('assignment_statement -> variable_access ASSIGNMENT expression','assignment_statement',3,'p_assignment_statement_1','parser.py',918),
('variable_access -> identifier','variable_access',1,'p_variable_access_1','parser.py',924),
('variable_access -> indexed_variable','variable_access',1,'p_variable_access_2','parser.py',930),
('variable_access -> field_designator','variable_access',1,'p_variable_access_3','parser.py',935),
('variable_access -> variable_access UPARROW','variable_access',2,'p_variable_access_4','parser.py',940),
('indexed_variable -> variable_access LBRAC index_expression_list RBRAC','indexed_variable',4,'p_indexed_variable_1','parser.py',946),
('index_expression_list -> index_expression_list comma index_expression','index_expression_list',3,'p_index_expression_list_1','parser.py',952),
('index_expression_list -> index_expression','index_expression_list',1,'p_index_expression_list_2','parser.py',958),
('index_expression -> expression','index_expression',1,'p_index_expression_1','parser.py',964),
('field_designator -> variable_access DOT identifier','field_designator',3,'p_field_designator_1','parser.py',969),
('procedure_statement -> identifier params','procedure_statement',2,'p_procedure_statement_1','parser.py',975),
('procedure_statement -> identifier','procedure_statement',1,'p_procedure_statement_2','parser.py',981),
('params -> LPAREN actual_parameter_list RPAREN','params',3,'p_params_1','parser.py',987),
('actual_parameter_list -> actual_parameter_list comma actual_parameter','actual_parameter_list',3,'p_actual_parameter_list_1','parser.py',992),
('actual_parameter_list -> actual_parameter','actual_parameter_list',1,'p_actual_parameter_list_2','parser.py',998),
('actual_parameter -> expression','actual_parameter',1,'p_actual_parameter_1','parser.py',1004),
('actual_parameter -> expression COLON expression','actual_parameter',3,'p_actual_parameter_2','parser.py',1010),
('actual_parameter -> expression COLON expression COLON expression','actual_parameter',5,'p_actual_parameter_3','parser.py',1017),
('goto_statement -> GOTO label','goto_statement',2,'p_goto_statement_1','parser.py',1024),
('case_statement -> CASE case_index OF case_list_element_list END','case_statement',5,'p_case_statement_1','parser.py',1030),
('case_statement -> CASE case_index OF case_list_element_list SEMICOLON END','case_statement',6,'p_case_statement_2','parser.py',1037),
('case_statement -> CASE case_index OF case_list_element_list semicolon otherwisepart statement END','case_statement',8,'p_case_statement_3','parser.py',1044),
('case_statement -> CASE case_index OF case_list_element_list semicolon otherwisepart statement SEMICOLON END','case_statement',9,'p_case_statement_4','parser.py',1050),
('case_index -> expression','case_index',1,'p_case_index_1','parser.py',1056),
('case_list_element_list -> case_list_element_list semicolon case_list_element','case_list_element_list',3,'p_case_list_element_list_1','parser.py',1062),
('case_list_element_list -> case_list_element','case_list_element_list',1,'p_case_list_element_list_2','parser.py',1069),
('case_list_element -> case_constant_list COLON statement','case_list_element',3,'p_case_list_element_1','parser.py',1075),
('otherwisepart -> OTHERWISE','otherwisepart',1,'p_otherwisepart_1','parser.py',1081),
('otherwisepart -> OTHERWISE COLON','otherwisepart',2,'p_otherwisepart_2','parser.py',1086),
('control_variable -> identifier','control_variable',1,'p_control_variable_1','parser.py',1091),
('initial_value -> expression','initial_value',1,'p_initial_value_1','parser.py',1096),
('direction -> TO','direction',1,'p_direction_1','parser.py',1101),
('direction -> DOWNTO','direction',1,'p_direction_2','parser.py',1106),
('final_value -> expression','final_value',1,'p_final_value_1','parser.py',1111),
('record_variable_list -> record_variable_list comma variable_access','record_variable_list',3,'p_record_variable_list_1','parser.py',1116),
('record_variable_list -> variable_access','record_variable_list',1,'p_record_variable_list_2','parser.py',1122),
('boolean_expression -> expression','boolean_expression',1,'p_boolean_expression_1','parser.py',1128),
('expression -> simple_expression','expression',1,'p_expression_1','parser.py',1133),
('expression -> simple_expression relop simple_expression','expression',3,'p_expression_2','parser.py',1138),
('simple_expression -> term','simple_expression',1,'p_simple_expression_1','parser.py',1144),
('simple_expression -> simple_expression addop term','simple_expression',3,'p_simple_expression_2','parser.py',1149),
('term -> factor','term',1,'p_term_1','parser.py',1155),
('term -> term mulop factor','term',3,'p_term_2','parser.py',1160),
('factor -> sign factor','factor',2,'p_factor_1','parser.py',1166),
('factor -> primary','factor',1,'p_factor_2','parser.py',1172),
('primary -> variable_access','primary',1,'p_primary_1','parser.py',1177),
('primary -> unsigned_constant','primary',1,'p_primary_2','parser.py',1183),
('primary -> function_designator','primary',1,'p_primary_3','parser.py',1188),
('primary -> set_constructor','primary',1,'p_primary_4','parser.py',1193),
('primary -> LPAREN expression RPAREN','primary',3,'p_primary_5','parser.py',1198),
('primary -> NOT primary','primary',2,'p_primary_6','parser.py',1203),
('unsigned_constant -> unsigned_number','unsigned_constant',1,'p_unsigned_constant_1','parser.py',1209),
('unsigned_constant -> STRING','unsigned_constant',1,'p_unsigned_constant_2','parser.py',1214),
('unsigned_constant -> NIL','unsigned_constant',1,'p_unsigned_constant_3','parser.py',1220),
('unsigned_constant -> CHAR','unsigned_constant',1,'p_unsigned_constant_4','parser.py',1226),
('unsigned_number -> unsigned_integer','unsigned_number',1,'p_unsigned_number_1','parser.py',1232),
('unsigned_number -> unsigned_real','unsigned_number',1,'p_unsigned_number_2','parser.py',1237),
('unsigned_integer -> DIGSEQ','unsigned_integer',1,'p_unsigned_integer_1','parser.py',1242),
('unsigned_integer -> HEXDIGSEQ','unsigned_integer',1,'p_unsigned_integer_2','parser.py',1248),
('unsigned_integer -> OCTDIGSEQ','unsigned_integer',1,'p_unsigned_integer_3','parser.py',1254),
('unsigned_integer -> BINDIGSEQ','unsigned_integer',1,'p_unsigned_integer_4','parser.py',1260),
('unsigned_real -> REALNUMBER','unsigned_real',1,'p_unsigned_real_1','parser.py',1266),
('function_designator -> identifier params','function_designator',2,'p_function_designator_1','parser.py',1272),
('set_constructor -> LBRAC member_designator_list RBRAC','set_constructor',3,'p_set_constructor_1','parser.py',1278),
('set_constructor -> LBRAC RBRAC','set_constructor',2,'p_set_constructor_2','parser.py',1284),
('member_designator_list -> member_designator_list comma member_designator','member_designator_list',3,'p_member_designator_list_1','parser.py',1291),
('member_designator_list -> member_designator','member_designator_list',1,'p_member_designator_list_2','parser.py',1298),
('member_designator -> member_designator DOTDOT expression','member_designator',3,'p_member_designator_1','parser.py',1304),
('member_designator -> expression','member_designator',1,'p_member_designator_2','parser.py',1310),
('addop -> PLUS','addop',1,'p_addop_1','parser.py',1315),
('addop -> MINUS','addop',1,'p_addop_2','parser.py',1321),
('addop -> OR','addop',1,'p_addop_3','parser.py',1327),
('mulop -> STAR','mulop',1,'p_mulop_1','parser.py',1333),
('mulop -> SLASH','mulop',1,'p_mulop_2','parser.py',1339),
('mulop -> DIV','mulop',1,'p_mulop_3','parser.py',1345),
('mulop -> MOD','mulop',1,'p_mulop_4','parser.py',1351),
('mulop -> AND','mulop',1,'p_mulop_5','parser.py',1357),
('relop -> EQUAL','relop',1,'p_relop_1','parser.py',1363),
('relop -> NOTEQUAL','relop',1,'p_relop_2','parser.py',1369),
('relop -> LT','relop',1,'p_relop_3','parser.py',1375),
('relop -> GT','relop',1,'p_relop_4','parser.py',1381),
('relop -> LE','relop',1,'p_relop_5','parser.py',1387),
('relop -> GE','relop',1,'p_relop_6','parser.py',1393),
('relop -> IN','relop',1,'p_relop_7','parser.py',1399),
('identifier -> IDENTIFIER','identifier',1,'p_identifier_1','parser.py',1405),
('semicolon -> SEMICOLON','semicolon',1,'p_semicolon_1','parser.py',1411),
('comma -> COMMA','comma',1,'p_comma_1','parser.py',1416),
('empty -> <empty>','empty',0,'p_empty_1','parser.py',1429),
]
| 279.780576
| 26,706
| 0.731766
| 14,384
| 77,779
| 3.789905
| 0.065768
| 0.036394
| 0.021297
| 0.004549
| 0.566772
| 0.47663
| 0.43077
| 0.386818
| 0.360935
| 0.332667
| 0
| 0.338539
| 0.032669
| 77,779
| 277
| 26,707
| 280.790614
| 0.386015
| 0.000823
| 0
| 0.007463
| 1
| 0.003731
| 0.437428
| 0.160158
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
659c68c86555763d7ff3f0f16c9cb09e6543f538
| 55
|
py
|
Python
|
emtf_nnet/keras/losses/__init__.py
|
jiafulow/emtf-nnet
|
70a6c747c221178f9db940197ea886bdb60bf3ba
|
[
"Apache-2.0"
] | null | null | null |
emtf_nnet/keras/losses/__init__.py
|
jiafulow/emtf-nnet
|
70a6c747c221178f9db940197ea886bdb60bf3ba
|
[
"Apache-2.0"
] | null | null | null |
emtf_nnet/keras/losses/__init__.py
|
jiafulow/emtf-nnet
|
70a6c747c221178f9db940197ea886bdb60bf3ba
|
[
"Apache-2.0"
] | null | null | null |
from .huber import Huber
from .log_cosh import LogCosh
| 18.333333
| 29
| 0.818182
| 9
| 55
| 4.888889
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.145455
| 55
| 2
| 30
| 27.5
| 0.93617
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
65b80a77f9e1c4b491b2fcebb4556c22c0d7d1e2
| 13,743
|
py
|
Python
|
tests/_processors/test_todatetime.py
|
ikalnytskyi/holocron
|
f0bda50f1aab7d1013fac5bd8fb01f7ebeb7bdc3
|
[
"BSD-3-Clause"
] | 6
|
2016-11-27T11:53:18.000Z
|
2021-02-08T00:37:59.000Z
|
tests/_processors/test_todatetime.py
|
ikalnytskyi/holocron
|
f0bda50f1aab7d1013fac5bd8fb01f7ebeb7bdc3
|
[
"BSD-3-Clause"
] | 25
|
2017-04-12T15:27:55.000Z
|
2022-01-21T23:37:37.000Z
|
tests/_processors/test_todatetime.py
|
ikalnytskyi/holocron
|
f0bda50f1aab7d1013fac5bd8fb01f7ebeb7bdc3
|
[
"BSD-3-Clause"
] | 1
|
2020-11-15T17:49:36.000Z
|
2020-11-15T17:49:36.000Z
|
"""Todatetime processor test suite."""
import collections.abc
import datetime
import pathlib
import dateutil.tz
import pytest
import holocron
from holocron._processors import todatetime
_TZ_UTC = dateutil.tz.gettz("UTC")
_TZ_EET = dateutil.tz.gettz("EET")
@pytest.fixture(scope="function")
def testapp():
return holocron.Application()
@pytest.mark.parametrize(
["timestamp", "parsed"],
[
pytest.param(
"2019-01-15T21:07:07+00:00",
datetime.datetime(2019, 1, 15, 21, 7, 7, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15T21:07:07+00",
datetime.datetime(2019, 1, 15, 21, 7, 7, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15T21:07:07Z",
datetime.datetime(2019, 1, 15, 21, 7, 7, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15T21:07:07",
datetime.datetime(2019, 1, 15, 21, 7, 7, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15T21:07+00:00",
datetime.datetime(2019, 1, 15, 21, 7, 0, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15T21:07+00",
datetime.datetime(2019, 1, 15, 21, 7, 0, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15T21:07Z",
datetime.datetime(2019, 1, 15, 21, 7, 0, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15T21:07",
datetime.datetime(2019, 1, 15, 21, 7, 0, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15T21+00:00",
datetime.datetime(2019, 1, 15, 21, 0, 0, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15T21+00",
datetime.datetime(2019, 1, 15, 21, 0, 0, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15T21Z",
datetime.datetime(2019, 1, 15, 21, 0, 0, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15T21",
datetime.datetime(2019, 1, 15, 21, 0, 0, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15",
datetime.datetime(2019, 1, 15, 0, 0, 0, tzinfo=_TZ_UTC),
),
pytest.param(
"20190115T210707Z",
datetime.datetime(2019, 1, 15, 21, 7, 7, tzinfo=_TZ_UTC),
),
pytest.param(
"2019-01-15T21:07:07+02:00",
datetime.datetime(2019, 1, 15, 21, 7, 7, tzinfo=_TZ_EET),
),
pytest.param(
"2019/01/11",
datetime.datetime(2019, 1, 11, 0, 0, 0, tzinfo=_TZ_UTC),
),
pytest.param(
"01/11/2019",
datetime.datetime(2019, 1, 11, 0, 0, 0, tzinfo=_TZ_UTC),
),
pytest.param(
"01-11-2019",
datetime.datetime(2019, 1, 11, 0, 0, 0, tzinfo=_TZ_UTC),
),
pytest.param(
"01.11.2019",
datetime.datetime(2019, 1, 11, 0, 0, 0, tzinfo=_TZ_UTC),
),
],
)
def test_item(testapp, timestamp, parsed):
"""Todatetime processor has to work."""
stream = todatetime.process(
testapp,
[
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": timestamp,
}
)
],
todatetime="timestamp",
)
assert isinstance(stream, collections.abc.Iterable)
assert list(stream) == [
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": parsed,
}
)
]
@pytest.mark.parametrize(
["amount"],
[
pytest.param(0),
pytest.param(1),
pytest.param(2),
pytest.param(5),
pytest.param(10),
],
)
def test_item_many(testapp, amount):
"""Todatetime processor has to work with stream."""
stream = todatetime.process(
testapp,
[
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": "2019-01-%d" % (i + 1),
}
)
for i in range(amount)
],
todatetime="timestamp",
)
assert isinstance(stream, collections.abc.Iterable)
assert list(stream) == [
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": datetime.datetime(2019, 1, i + 1, tzinfo=_TZ_UTC),
}
)
for i in range(amount)
]
def test_item_timestamp_missing(testapp):
"""Todatetime processor has to ignore items with missing timestamp."""
stream = todatetime.process(
testapp,
[holocron.Item({"content": "the Force is strong with this one"})],
todatetime="timestamp",
)
assert isinstance(stream, collections.abc.Iterable)
assert list(stream) == [
holocron.Item({"content": "the Force is strong with this one"})
]
def test_item_timestamp_bad_value(testapp):
"""Todatetime processor has to error if a timestamp cannot be parsed."""
stream = todatetime.process(
testapp,
[
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": "yoda",
}
)
],
todatetime="timestamp",
)
assert isinstance(stream, collections.abc.Iterable)
with pytest.raises(Exception) as excinfo:
next(stream)
assert str(excinfo.value) == "('Unknown string format:', 'yoda')"
@pytest.mark.parametrize(
["timestamp"],
[
pytest.param("2019-01-11", id="str"),
pytest.param(pathlib.Path("2019-01-11"), id="path"),
],
)
def test_args_todatetime(testapp, timestamp):
"""Todatetime processor has to respect "writeto" argument."""
stream = todatetime.process(
testapp,
[
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": timestamp,
}
)
],
todatetime=["timestamp", "published"],
)
assert isinstance(stream, collections.abc.Iterable)
assert list(stream) == [
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": timestamp,
"published": datetime.datetime(2019, 1, 11, 0, 0, 0, tzinfo=_TZ_UTC),
}
)
]
@pytest.mark.parametrize(
["timestamp", "parsearea"],
[
pytest.param("2019/01/11/luke-skywalker-part-1.txt", r"\d{4}/\d{2}/\d{2}"),
pytest.param("2019-01-11-luke-skywalker-part-1.txt", r"\d{4}-\d{2}-\d{2}"),
pytest.param("2019/01/11/luke-skywalker-part-1.txt", r"\d{4}.\d{2}.\d{2}"),
pytest.param("2019-01-11-luke-skywalker-part-1.txt", r"\d{4}.\d{2}.\d{2}"),
],
)
def test_args_parsearea(testapp, timestamp, parsearea):
"""Todatetime processor has to respect "parsearea" argument."""
stream = todatetime.process(
testapp,
[
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": timestamp,
}
)
],
todatetime="timestamp",
parsearea=parsearea,
fuzzy=True,
)
assert isinstance(stream, collections.abc.Iterable)
assert list(stream) == [
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": datetime.datetime(2019, 1, 11, tzinfo=_TZ_UTC),
}
)
]
def test_args_parsearea_not_found(testapp):
"""Todatetime processor has to respect "parsearea" argument."""
stream = todatetime.process(
testapp,
[
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": "luke-skywalker-part-1.txt",
}
)
],
todatetime="timestamp",
parsearea=r"\d{4}-\d{2}-\d{2}",
)
assert isinstance(stream, collections.abc.Iterable)
assert list(stream) == [
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": "luke-skywalker-part-1.txt",
}
)
]
@pytest.mark.parametrize(
["timestamp"],
[
pytest.param("2019/01/11/luke-skywalker.txt"),
pytest.param("2019/01/11/luke-skywalker/index.txt"),
pytest.param("/2019/01/11/luke-skywalker.txt"),
pytest.param("/2019/01/11/luke-skywalker/index.txt"),
pytest.param("http://example.com/2019/01/11/luke-skywalker.txt"),
pytest.param("http://example.com/2019/01/11/luke-skywalker/index.txt"),
pytest.param("2019-01-11-luke-skywalker.txt"),
pytest.param("posts/2019-01-11-luke-skywalker.txt"),
pytest.param("/posts/2019-01-11-luke-skywalker.txt"),
pytest.param("http://example.com/posts/2019-01-11-luke-skywalker.txt"),
],
)
def test_args_fuzzy(testapp, timestamp):
"""Todatetime processor has to respect "fuzzy" argument."""
stream = todatetime.process(
testapp,
[
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": timestamp,
}
)
],
todatetime="timestamp",
fuzzy=True,
)
assert isinstance(stream, collections.abc.Iterable)
assert list(stream) == [
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": datetime.datetime(2019, 1, 11, tzinfo=_TZ_UTC),
}
)
]
@pytest.mark.parametrize(["tz"], [pytest.param("EET"), pytest.param("UTC")])
def test_args_timezone(testapp, tz):
"""Todatetime processor has to respect "timezone" argument."""
stream = todatetime.process(
testapp,
[
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": "2019-01-15T21:07+00:00",
}
),
holocron.Item(
{
"content": "may the Force be with you",
"timestamp": "2019-01-15T21:07",
}
),
],
todatetime="timestamp",
# Custom timezone has to be attached only to timestamps without
# explicit timezone information. So this argument is nothing more
# but a fallback.
timezone=tz,
)
assert isinstance(stream, collections.abc.Iterable)
assert list(stream) == [
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": datetime.datetime(2019, 1, 15, 21, 7, tzinfo=_TZ_UTC),
}
),
holocron.Item(
{
"content": "may the Force be with you",
"timestamp": datetime.datetime(
2019, 1, 15, 21, 7, tzinfo=dateutil.tz.gettz(tz)
),
}
),
]
@pytest.mark.parametrize(["tz"], [pytest.param("EET"), pytest.param("UTC")])
def test_args_timezone_fallback(testapp, tz):
"""Todatetime processor has to respect "timezone" argument (fallback)."""
# Custom timezone has to be attached only to timestamps without
# explicit timezone information. So this option is nothing more
# but a fallback.
testapp.metadata.update({"timezone": tz})
stream = todatetime.process(
testapp,
[
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": "2019-01-15T21:07+00:00",
}
),
holocron.Item(
{
"content": "may the Force be with you",
"timestamp": "2019-01-15T21:07",
}
),
],
todatetime="timestamp",
)
assert isinstance(stream, collections.abc.Iterable)
assert list(stream) == [
holocron.Item(
{
"content": "the Force is strong with this one",
"timestamp": datetime.datetime(2019, 1, 15, 21, 7, tzinfo=_TZ_UTC),
}
),
holocron.Item(
{
"content": "may the Force be with you",
"timestamp": datetime.datetime(
2019, 1, 15, 21, 7, tzinfo=dateutil.tz.gettz(tz)
),
}
),
]
@pytest.mark.parametrize(
["args", "error"],
[
pytest.param(
{"todatetime": 42},
"todatetime: 42 is not of type 'string'",
id="todatetime-int",
),
pytest.param(
{"parsearea": 42},
"parsearea: 42 is not of type 'string'",
id="parsearea-int",
),
pytest.param(
{"timezone": "Europe/Kharkiv"},
"timezone: 'Europe/Kharkiv' is not a 'timezone'",
id="timezone-wrong",
),
pytest.param(
{"fuzzy": 42}, "fuzzy: 42 is not of type 'boolean'", id="fuzzy-int"
),
],
)
def test_args_bad_value(testapp, args, error):
"""Todatetime processor has to validate input arguments."""
with pytest.raises(ValueError) as excinfo:
next(todatetime.process(testapp, [], **args))
assert str(excinfo.value) == error
| 29.054968
| 85
| 0.511679
| 1,448
| 13,743
| 4.799033
| 0.101519
| 0.075982
| 0.077709
| 0.081594
| 0.796661
| 0.763851
| 0.754497
| 0.729745
| 0.712764
| 0.68643
| 0
| 0.082884
| 0.352107
| 13,743
| 472
| 86
| 29.116525
| 0.697552
| 0.067816
| 0
| 0.523573
| 0
| 0
| 0.209415
| 0.044096
| 0
| 0
| 0
| 0
| 0.052109
| 1
| 0.029777
| false
| 0
| 0.01737
| 0.002481
| 0.049628
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
028ff9c0ad0e76f557d8978df893fa055850f2ff
| 121
|
py
|
Python
|
app/__init__.py
|
joepasquale/sql-query-tool
|
f73a4bdfea03d660475af9e009b69678e03ae655
|
[
"MIT"
] | null | null | null |
app/__init__.py
|
joepasquale/sql-query-tool
|
f73a4bdfea03d660475af9e009b69678e03ae655
|
[
"MIT"
] | null | null | null |
app/__init__.py
|
joepasquale/sql-query-tool
|
f73a4bdfea03d660475af9e009b69678e03ae655
|
[
"MIT"
] | null | null | null |
from flask import Flask
import os
app = Flask(__name__)
app.secret_key = os.urandom(16)
from app import views
| 13.444444
| 32
| 0.710744
| 19
| 121
| 4.263158
| 0.578947
| 0.271605
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.021277
| 0.223141
| 121
| 8
| 33
| 15.125
| 0.840426
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.6
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
02b8000d5fc29ee6d8f4b59559f6e499093c8c8a
| 28
|
py
|
Python
|
Candle/__init__.py
|
naoto64/LED-Candle-for-Raspberry-Pi
|
5b884136cf181fbe53ecae5ebea3c0786a0bed59
|
[
"MIT"
] | null | null | null |
Candle/__init__.py
|
naoto64/LED-Candle-for-Raspberry-Pi
|
5b884136cf181fbe53ecae5ebea3c0786a0bed59
|
[
"MIT"
] | null | null | null |
Candle/__init__.py
|
naoto64/LED-Candle-for-Raspberry-Pi
|
5b884136cf181fbe53ecae5ebea3c0786a0bed59
|
[
"MIT"
] | null | null | null |
from Candle.Candle import *
| 14
| 27
| 0.785714
| 4
| 28
| 5.5
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 28
| 1
| 28
| 28
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
02c0de0a3f74bc87abd35c3d0c7b577d70be9871
| 59
|
py
|
Python
|
code/simulator/__init__.py
|
FrederikWR/course-02443-stochastic-virus-outbreak
|
4f1d7f1fa4aa197b31ed86c4daf420d5a637974e
|
[
"MIT"
] | null | null | null |
code/simulator/__init__.py
|
FrederikWR/course-02443-stochastic-virus-outbreak
|
4f1d7f1fa4aa197b31ed86c4daf420d5a637974e
|
[
"MIT"
] | null | null | null |
code/simulator/__init__.py
|
FrederikWR/course-02443-stochastic-virus-outbreak
|
4f1d7f1fa4aa197b31ed86c4daf420d5a637974e
|
[
"MIT"
] | null | null | null |
from .simulator import Simulator
from .state import State
| 14.75
| 32
| 0.813559
| 8
| 59
| 6
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.152542
| 59
| 3
| 33
| 19.666667
| 0.96
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
02f5fba984f2ccabd31eaecebfffa41c5bd5a650
| 85
|
py
|
Python
|
bnf/test/fixtures/__init__.py
|
Nikita-Boyarskikh/bnf
|
1293b0f2187593989e2484a7af9612477fa8bbe0
|
[
"MIT"
] | null | null | null |
bnf/test/fixtures/__init__.py
|
Nikita-Boyarskikh/bnf
|
1293b0f2187593989e2484a7af9612477fa8bbe0
|
[
"MIT"
] | null | null | null |
bnf/test/fixtures/__init__.py
|
Nikita-Boyarskikh/bnf
|
1293b0f2187593989e2484a7af9612477fa8bbe0
|
[
"MIT"
] | null | null | null |
# flake8: noqa
from .rule_builders import *
from .bnfs import *
from .rules import *
| 17
| 28
| 0.729412
| 12
| 85
| 5.083333
| 0.666667
| 0.327869
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014286
| 0.176471
| 85
| 4
| 29
| 21.25
| 0.857143
| 0.141176
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
f31ef5eefcb8f341e5d999d7c3c57972048d4288
| 55
|
py
|
Python
|
tests/akagi_tests/__init__.py
|
pauchan/akagi
|
7cf1f5a52b8f1ebfdc74a527bf6b26254f99343b
|
[
"MIT"
] | 26
|
2017-05-18T11:52:04.000Z
|
2018-08-25T22:03:07.000Z
|
tests/akagi_tests/__init__.py
|
pauchan/akagi
|
7cf1f5a52b8f1ebfdc74a527bf6b26254f99343b
|
[
"MIT"
] | 325
|
2017-05-08T07:22:28.000Z
|
2022-03-31T15:43:18.000Z
|
tests/akagi_tests/__init__.py
|
pauchan/akagi
|
7cf1f5a52b8f1ebfdc74a527bf6b26254f99343b
|
[
"MIT"
] | 7
|
2017-05-02T02:06:15.000Z
|
2020-04-09T05:32:11.000Z
|
from tests.akagi_tests.data_file_bundle_tests import *
| 27.5
| 54
| 0.872727
| 9
| 55
| 4.888889
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.072727
| 55
| 1
| 55
| 55
| 0.862745
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b831e92af2b2dc1674b110f33b0351f40403ab70
| 321
|
py
|
Python
|
db_upgrade.py
|
jeff350/vulnerable-company-webapp-flask
|
3148cdb4f345d91bf9670a13dc1b4864adb12810
|
[
"MIT"
] | null | null | null |
db_upgrade.py
|
jeff350/vulnerable-company-webapp-flask
|
3148cdb4f345d91bf9670a13dc1b4864adb12810
|
[
"MIT"
] | 1
|
2017-04-06T16:54:40.000Z
|
2017-04-06T16:55:50.000Z
|
db_upgrade.py
|
jeff350/vuln-corp
|
3148cdb4f345d91bf9670a13dc1b4864adb12810
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
api.upgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
print('Current database version: ' + str(v))
| 32.1
| 68
| 0.841121
| 45
| 321
| 5.711111
| 0.466667
| 0.210117
| 0.245136
| 0.202335
| 0.326848
| 0.326848
| 0
| 0
| 0
| 0
| 0
| 0
| 0.087227
| 321
| 9
| 69
| 35.666667
| 0.877133
| 0.062305
| 0
| 0
| 0
| 0
| 0.086667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0.166667
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
b83d630ee1d5a11646af26b38adbcda191de83e6
| 41
|
py
|
Python
|
drklauns/core/mixins/__init__.py
|
Ameriks/drklauns
|
bc8febd72ed6d3f685cf9ad48b487d5c9bb4170e
|
[
"MIT"
] | null | null | null |
drklauns/core/mixins/__init__.py
|
Ameriks/drklauns
|
bc8febd72ed6d3f685cf9ad48b487d5c9bb4170e
|
[
"MIT"
] | null | null | null |
drklauns/core/mixins/__init__.py
|
Ameriks/drklauns
|
bc8febd72ed6d3f685cf9ad48b487d5c9bb4170e
|
[
"MIT"
] | null | null | null |
from .model_mixins import TimestampMixin
| 20.5
| 40
| 0.878049
| 5
| 41
| 7
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.097561
| 41
| 1
| 41
| 41
| 0.945946
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
b8420a83db17aed6e586235001b7fc6010dc7be8
| 3,120
|
py
|
Python
|
app/tests/v1/test_party_record_views.py
|
Joshuakemboi/Politic_API
|
0cc9eea6a107b8e8686d3839fe5d3efcd4329fd1
|
[
"MIT"
] | null | null | null |
app/tests/v1/test_party_record_views.py
|
Joshuakemboi/Politic_API
|
0cc9eea6a107b8e8686d3839fe5d3efcd4329fd1
|
[
"MIT"
] | null | null | null |
app/tests/v1/test_party_record_views.py
|
Joshuakemboi/Politic_API
|
0cc9eea6a107b8e8686d3839fe5d3efcd4329fd1
|
[
"MIT"
] | null | null | null |
from .base_test import *
import unittest
from io import BytesIO
testapp = app.test_client()
class TestParty(unittest.TestCase):
def party(self,party_name , party_headquarters_address ,party_logo_url):
return testapp.post('/api/v1/party',data=dict(party_name=party_name,
party_headquarters_address = party_headquarters_address, party_logo_url = party_logo_url),follow_redirects=True)
def test_valid_inputs(self):
response = self.party(party_name='jubilee',party_headquarters_address = "jossgmail",party_logo_url = "lion")
self.assertEqual(response.status_code,201)
def put_party(self,party_name , party_headquarters_address ,party_logo_url):
return testapp.put('/api/v1/party/1',data=dict(party_name=party_name,
party_headquarters_address = party_headquarters_address, party_logo_url = party_logo_url),follow_redirects=True)
def test_put_valid_inputs(self):
response = self.put_party(party_name='jubilee',party_headquarters_address = "jos@gmail.com",party_logo_url = "lion")
self.assertEqual(response.status_code,201)
def test_put_taken_party_name(self):
response = self.put_party(party_name='taken_party',party_headquarters_address = "jos@gmail.com",party_logo_url = "lion")
self.assertEqual(response.status_code,400)
def test_put_taken_hq_address(self):
response = self.put_party(party_name='jubilee',party_headquarters_address = "taken_hq",party_logo_url = "lion")
self.assertEqual(response.status_code,400)
def party_missing_fields(self):
return testapp.post('/api/v1/party',data=dict(),follow_redirects=True)
def test_party_missing_fields(self):
response = self.party_missing_fields()
self.assertEqual(response.status_code,400)
def party_edit_missing_fields(self):
return testapp.put('/api/v1/party/1000',data=dict(),follow_redirects=True)
def test_party_edit_missing_fields(self):
response = self.party_edit_missing_fields()
self.assertEqual(response.status_code,400)
def get_party(self):
return testapp.get('/api/v1/party/1000')
def test_get_party(self):
response = self.get_party()
self.assertEqual(response.status_code, 200)
def get_missing_party(self):
return testapp.get('/api/v1/party/999')
def test_get_missing_party(self):
response = self.get_missing_party()
self.assertEqual(response.status_code, 400)
def get_parties(self):
return testapp.get('/api/v1/party')
def test_get_parties(self):
response = self.get_parties()
self.assertEqual(response.status_code, 200)
def delete_party(self):
return testapp.delete('/api/v1/party/100')
def test_delete_party(self):
response = self.delete_party()
self.assertEqual(response.status_code,201)
def delete_missing_party(self):
return testapp.delete('/api/v1/party/99')
def test_delete_missing_party(self):
response = self.delete_missing_party()
self.assertEqual(response.status_code,404)
| 41.6
| 128
| 0.721474
| 415
| 3,120
| 5.113253
| 0.144578
| 0.059378
| 0.082941
| 0.15033
| 0.854383
| 0.753534
| 0.698398
| 0.565504
| 0.414703
| 0.365693
| 0
| 0.022815
| 0.171154
| 3,120
| 75
| 129
| 41.6
| 0.797757
| 0
| 0
| 0.206897
| 0
| 0
| 0.074015
| 0
| 0
| 0
| 0
| 0
| 0.189655
| 1
| 0.344828
| false
| 0
| 0.051724
| 0.155172
| 0.568966
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
b86151314cad1edb056a6d40f13842833238117f
| 61
|
py
|
Python
|
cyder/api/v1/endpoints/dhcp/static_interface/__init__.py
|
drkitty/cyder
|
1babc443cc03aa51fa3c1015bcd22f0ea2e5f0f8
|
[
"BSD-3-Clause"
] | 6
|
2015-04-16T23:18:22.000Z
|
2020-08-25T22:50:13.000Z
|
cyder/api/v1/endpoints/dhcp/static_interface/__init__.py
|
drkitty/cyder
|
1babc443cc03aa51fa3c1015bcd22f0ea2e5f0f8
|
[
"BSD-3-Clause"
] | 267
|
2015-01-01T00:18:57.000Z
|
2015-10-14T00:01:13.000Z
|
cyder/api/v1/endpoints/dhcp/static_interface/__init__.py
|
drkitty/cyder
|
1babc443cc03aa51fa3c1015bcd22f0ea2e5f0f8
|
[
"BSD-3-Clause"
] | 5
|
2015-03-23T00:57:09.000Z
|
2019-09-09T22:42:37.000Z
|
from cyder.api.v1.endpoints.dhcp.static_interface import api
| 30.5
| 60
| 0.852459
| 10
| 61
| 5.1
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017544
| 0.065574
| 61
| 1
| 61
| 61
| 0.877193
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b884cebffcb0a9005890608dc3213e26c0b2fcfe
| 132
|
py
|
Python
|
mundo1python/Aulas/aula006/desafio001.py
|
PhabloSouza/Curso-Python3
|
cda031cd298cc910a7c337e8762f03dae77e80db
|
[
"MIT"
] | null | null | null |
mundo1python/Aulas/aula006/desafio001.py
|
PhabloSouza/Curso-Python3
|
cda031cd298cc910a7c337e8762f03dae77e80db
|
[
"MIT"
] | null | null | null |
mundo1python/Aulas/aula006/desafio001.py
|
PhabloSouza/Curso-Python3
|
cda031cd298cc910a7c337e8762f03dae77e80db
|
[
"MIT"
] | null | null | null |
n1 = int(input('Digite o valor: '))
n2 = int(input('Digite o valor: '))
s = n1+n2
print('A soma de {} e {} é {}'.format(n1, n2, s))
| 26.4
| 49
| 0.560606
| 25
| 132
| 2.96
| 0.6
| 0.216216
| 0.378378
| 0.405405
| 0.540541
| 0
| 0
| 0
| 0
| 0
| 0
| 0.056075
| 0.189394
| 132
| 4
| 50
| 33
| 0.635514
| 0
| 0
| 0
| 0
| 0
| 0.409091
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.25
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
b8c46191bcb2cd3f6f501328cba36b38e1645b21
| 40
|
py
|
Python
|
pyrobud/mt4/__init__.py
|
look416/pyrobud
|
0387021963be4a145d812903db7faf048c7b39c2
|
[
"MIT"
] | null | null | null |
pyrobud/mt4/__init__.py
|
look416/pyrobud
|
0387021963be4a145d812903db7faf048c7b39c2
|
[
"MIT"
] | 15
|
2021-11-02T17:39:21.000Z
|
2022-03-28T20:01:04.000Z
|
pyrobud/mt4/__init__.py
|
look416/pyrobud
|
0387021963be4a145d812903db7faf048c7b39c2
|
[
"MIT"
] | null | null | null |
from .zeromq import DWX_ZeroMQ_Connector
| 40
| 40
| 0.9
| 6
| 40
| 5.666667
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.075
| 40
| 1
| 40
| 40
| 0.918919
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
b21e9be2f49bfcb4245d13c241e251fa736810de
| 102
|
py
|
Python
|
enthought/graphcanvas/graph_node_hover_tool.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 3
|
2016-12-09T06:05:18.000Z
|
2018-03-01T13:00:29.000Z
|
enthought/graphcanvas/graph_node_hover_tool.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 1
|
2020-12-02T00:51:32.000Z
|
2020-12-02T08:48:55.000Z
|
enthought/graphcanvas/graph_node_hover_tool.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | null | null | null |
# proxy module
from __future__ import absolute_import
from graphcanvas.graph_node_hover_tool import *
| 25.5
| 47
| 0.862745
| 14
| 102
| 5.714286
| 0.785714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107843
| 102
| 3
| 48
| 34
| 0.879121
| 0.117647
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b269e933b8cebaba4c34ac654d5c6f213ce81ea9
| 204
|
py
|
Python
|
moto/ec2/__init__.py
|
argos83/moto
|
d3df810065c9c453d40fcc971f9be6b7b2846061
|
[
"Apache-2.0"
] | 1
|
2021-03-06T22:01:41.000Z
|
2021-03-06T22:01:41.000Z
|
moto/ec2/__init__.py
|
marciogh/moto
|
d3df810065c9c453d40fcc971f9be6b7b2846061
|
[
"Apache-2.0"
] | null | null | null |
moto/ec2/__init__.py
|
marciogh/moto
|
d3df810065c9c453d40fcc971f9be6b7b2846061
|
[
"Apache-2.0"
] | 1
|
2017-10-19T00:53:28.000Z
|
2017-10-19T00:53:28.000Z
|
from __future__ import unicode_literals
from .models import ec2_backends
from ..core.models import MockAWS, base_decorator
ec2_backend = ec2_backends['us-east-1']
mock_ec2 = base_decorator(ec2_backends)
| 29.142857
| 49
| 0.828431
| 30
| 204
| 5.233333
| 0.566667
| 0.210191
| 0.203822
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.032609
| 0.098039
| 204
| 6
| 50
| 34
| 0.820652
| 0
| 0
| 0
| 0
| 0
| 0.044118
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.6
| 0
| 0.6
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b287a2e3241aab20535c83d2213b3ba04319f419
| 9,118
|
py
|
Python
|
etl/parsers/etw/Microsoft_Windows_WMPNSS_PublicAPI.py
|
IMULMUL/etl-parser
|
76b7c046866ce0469cd129ee3f7bb3799b34e271
|
[
"Apache-2.0"
] | 104
|
2020-03-04T14:31:31.000Z
|
2022-03-28T02:59:36.000Z
|
etl/parsers/etw/Microsoft_Windows_WMPNSS_PublicAPI.py
|
IMULMUL/etl-parser
|
76b7c046866ce0469cd129ee3f7bb3799b34e271
|
[
"Apache-2.0"
] | 7
|
2020-04-20T09:18:39.000Z
|
2022-03-19T17:06:19.000Z
|
etl/parsers/etw/Microsoft_Windows_WMPNSS_PublicAPI.py
|
IMULMUL/etl-parser
|
76b7c046866ce0469cd129ee3f7bb3799b34e271
|
[
"Apache-2.0"
] | 16
|
2020-03-05T18:55:59.000Z
|
2022-03-01T10:19:28.000Z
|
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-WMPNSS-PublicAPI
GUID : 614696c9-85af-4e64-b389-d2c0db4ff87b
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import Sid
from etl.parsers.etw.core import Etw, declare, guid
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=100, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_100_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=101, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_101_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=102, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_102_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=103, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_103_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=104, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_104_0(Etw):
pattern = Struct(
"LibraryName" / WString,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=105, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_105_0(Etw):
pattern = Struct(
"LibraryName" / WString,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=106, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_106_0(Etw):
pattern = Struct(
"LibraryName" / WString,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=107, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_107_0(Etw):
pattern = Struct(
"LibraryName" / WString,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=108, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_108_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=109, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_109_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=110, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_110_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=111, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_111_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=112, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_112_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=113, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_113_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=114, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_114_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=115, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_115_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=116, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_116_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=117, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_117_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=118, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_118_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=119, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_119_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=120, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_120_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=121, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_121_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=122, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_122_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=123, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_123_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=124, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_124_0(Etw):
pattern = Struct(
"MACAddress" / WString,
"FriendlyName" / WString,
"Authorize" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=125, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_125_0(Etw):
pattern = Struct(
"MACAddress" / WString,
"FriendlyName" / WString,
"Authorize" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=126, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_126_0(Etw):
pattern = Struct(
"MACAddress" / WString,
"Authorize" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=127, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_127_0(Etw):
pattern = Struct(
"MACAddress" / WString,
"Authorize" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=128, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_128_0(Etw):
pattern = Struct(
"Devices" / Int64ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=129, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_129_0(Etw):
pattern = Struct(
"Devices" / Int64ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=130, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_130_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=131, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_131_0(Etw):
pattern = Struct(
"Enable" / Int8ul,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=132, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_132_0(Etw):
pattern = Struct(
"DeviceID" / WString,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=133, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_133_0(Etw):
pattern = Struct(
"DeviceID" / WString,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=134, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_134_0(Etw):
pattern = Struct(
"SecurityGroup" / WString,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=135, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_135_0(Etw):
pattern = Struct(
"SecurityGroup" / WString,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=136, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_136_0(Etw):
pattern = Struct(
"SecurityGroup" / WString,
"HResult" / Int32ul
)
@declare(guid=guid("614696c9-85af-4e64-b389-d2c0db4ff87b"), event_id=137, version=0)
class Microsoft_Windows_WMPNSS_PublicAPI_137_0(Etw):
pattern = Struct(
"SecurityGroup" / WString,
"HResult" / Int32ul
)
| 28.404984
| 123
| 0.688748
| 1,088
| 9,118
| 5.5625
| 0.084559
| 0.103106
| 0.141771
| 0.199769
| 0.921679
| 0.921679
| 0.91573
| 0.639458
| 0.631031
| 0.631031
| 0
| 0.162013
| 0.182935
| 9,118
| 320
| 124
| 28.49375
| 0.650336
| 0.011077
| 0
| 0.504202
| 0
| 0
| 0.221137
| 0.151865
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.016807
| 0
| 0.336134
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
b28ceaf5bd92c0cb6d6502524cdbcfd4230f8c55
| 44
|
py
|
Python
|
solutions/server/server-12-crud-lists/server/models/__init__.py
|
FroeMic/CDTM-Backend-Workshop
|
de3ef16dc89dfd1217565ab2dd4aec753e59cda0
|
[
"MIT"
] | null | null | null |
solutions/server/server-12-crud-lists/server/models/__init__.py
|
FroeMic/CDTM-Backend-Workshop
|
de3ef16dc89dfd1217565ab2dd4aec753e59cda0
|
[
"MIT"
] | null | null | null |
solutions/server/server-12-crud-lists/server/models/__init__.py
|
FroeMic/CDTM-Backend-Workshop
|
de3ef16dc89dfd1217565ab2dd4aec753e59cda0
|
[
"MIT"
] | null | null | null |
from task import Task
from list import List
| 14.666667
| 21
| 0.818182
| 8
| 44
| 4.5
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 44
| 2
| 22
| 22
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
b2a342bfd6fbe7623314fbfc7408eabb47d84fb6
| 176
|
py
|
Python
|
WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/inspect/inspect_getmembers_class.py
|
webdevhub42/Lambda
|
b04b84fb5b82fe7c8b12680149e25ae0d27a0960
|
[
"MIT"
] | null | null | null |
WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/inspect/inspect_getmembers_class.py
|
webdevhub42/Lambda
|
b04b84fb5b82fe7c8b12680149e25ae0d27a0960
|
[
"MIT"
] | null | null | null |
WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/inspect/inspect_getmembers_class.py
|
webdevhub42/Lambda
|
b04b84fb5b82fe7c8b12680149e25ae0d27a0960
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python3
"""Using getmembers()
"""
# end_pymotw_header
import inspect
from pprint import pprint
import example
pprint(inspect.getmembers(example.A), width=65)
| 14.666667
| 47
| 0.761364
| 24
| 176
| 5.5
| 0.708333
| 0.181818
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.019231
| 0.113636
| 176
| 11
| 48
| 16
| 0.826923
| 0.329545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.75
| 0
| 0.75
| 0.5
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
|
0
| 5
|
a24843359077fdbfb093b2864f7ecae00f4db49d
| 312
|
py
|
Python
|
main.py
|
elipie/ecolor
|
5d98dd26cd0730fd9d473d42f873aead7357a8e3
|
[
"MIT"
] | 1
|
2020-10-21T19:53:53.000Z
|
2020-10-21T19:53:53.000Z
|
main.py
|
elipie/ecolor
|
5d98dd26cd0730fd9d473d42f873aead7357a8e3
|
[
"MIT"
] | null | null | null |
main.py
|
elipie/ecolor
|
5d98dd26cd0730fd9d473d42f873aead7357a8e3
|
[
"MIT"
] | null | null | null |
from ecolor import slow_color, slow_print, ecolor
ecolor("This is red text", "red")
ecolor("This is bold blue text", "bold_blue")
slow_print("This is slow_print\n", 0.025)
slow_color("This is slow_print but colorful\n", "blue", 0.025)
slow_color("This is slow_print but colorful and bold\n", "bold_blue", 0.025)
| 44.571429
| 76
| 0.74359
| 58
| 312
| 3.827586
| 0.310345
| 0.202703
| 0.135135
| 0.202703
| 0.351351
| 0.351351
| 0.351351
| 0.351351
| 0.351351
| 0.351351
| 0
| 0.043636
| 0.11859
| 312
| 6
| 77
| 52
| 0.763636
| 0
| 0
| 0
| 0
| 0
| 0.50641
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.166667
| 0
| 0.166667
| 0.666667
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
a24ce406d4fcc6e884ef778f46367c6e6d6fd331
| 20,179
|
py
|
Python
|
grr/server/grr_response_server/foreman_test.py
|
ahmednofal/grr
|
08a57f6873ee13f425d0106e4143663bc6dbdd60
|
[
"Apache-2.0"
] | null | null | null |
grr/server/grr_response_server/foreman_test.py
|
ahmednofal/grr
|
08a57f6873ee13f425d0106e4143663bc6dbdd60
|
[
"Apache-2.0"
] | null | null | null |
grr/server/grr_response_server/foreman_test.py
|
ahmednofal/grr
|
08a57f6873ee13f425d0106e4143663bc6dbdd60
|
[
"Apache-2.0"
] | 2
|
2020-08-24T00:22:03.000Z
|
2020-11-14T08:34:43.000Z
|
#!/usr/bin/env python
"""Tests for the GRR Foreman."""
from __future__ import absolute_import
from __future__ import unicode_literals
from grr_response_core.lib import flags
from grr_response_core.lib import rdfvalue
from grr_response_core.lib import utils
from grr_response_core.lib.rdfvalues import client as rdf_client
from grr_response_core.lib.rdfvalues import protodict as rdf_protodict
from grr_response_server import aff4
from grr_response_server import data_store
from grr_response_server import flow
from grr_response_server import foreman
from grr_response_server import foreman_rules
from grr_response_server import queue_manager
from grr_response_server.aff4_objects import aff4_grr
from grr_response_server.hunts import implementation
from grr_response_server.hunts import standard
from grr.test_lib import db_test_lib
from grr.test_lib import test_lib
class ForemanTests(test_lib.GRRBaseTest):
"""Tests the Foreman."""
clients_launched = []
def setUp(self):
super(ForemanTests, self).setUp()
aff4_grr.GRRAFF4Init().Run()
def StartFlow(self, client_id, flow_name, token=None, **kw):
# Make sure the foreman is launching these
self.assertEqual(token.username, "Foreman")
# Make sure we pass the argv along
self.assertEqual(kw["foo"], "bar")
# Keep a record of all the clients
self.clients_launched.append((client_id, flow_name))
def testOperatingSystemSelection(self):
"""Tests that we can distinguish based on operating system."""
self.SetupClient(1, system="Windows XP")
self.SetupClient(2, system="Linux")
self.SetupClient(3, system="Windows 7")
with utils.Stubber(flow, "StartAFF4Flow", self.StartFlow):
# Now setup the filters
now = rdfvalue.RDFDatetime.Now()
expires = now + rdfvalue.Duration("1h")
foreman_obj = foreman.GetForeman(token=self.token)
# Make a new rule
rule = foreman_rules.ForemanRule(
created=now, expires=expires, description="Test rule")
# Matches Windows boxes
rule.client_rule_set = foreman_rules.ForemanClientRuleSet(rules=[
foreman_rules.ForemanClientRule(
rule_type=foreman_rules.ForemanClientRule.Type.OS,
os=foreman_rules.ForemanOsClientRule(os_windows=True))
])
# Will run Test Flow
rule.actions.Append(
flow_name="Test Flow", argv=rdf_protodict.Dict(foo="bar"))
# Clear the rule set and add the new rule to it.
rule_set = foreman_obj.Schema.RULES()
rule_set.Append(rule)
# Assign it to the foreman
foreman_obj.Set(foreman_obj.Schema.RULES, rule_set)
foreman_obj.Close()
self.clients_launched = []
foreman_obj.AssignTasksToClient(u"C.1000000000000001")
foreman_obj.AssignTasksToClient(u"C.1000000000000002")
foreman_obj.AssignTasksToClient(u"C.1000000000000003")
# Make sure that only the windows machines ran
self.assertEqual(len(self.clients_launched), 2)
self.assertEqual(self.clients_launched[0][0],
rdf_client.ClientURN(u"C.1000000000000001"))
self.assertEqual(self.clients_launched[1][0],
rdf_client.ClientURN(u"C.1000000000000003"))
self.clients_launched = []
# Run again - This should not fire since it did already
foreman_obj.AssignTasksToClient(u"C.1000000000000001")
foreman_obj.AssignTasksToClient(u"C.1000000000000002")
foreman_obj.AssignTasksToClient(u"C.1000000000000003")
self.assertEqual(len(self.clients_launched), 0)
def testIntegerComparisons(self):
"""Tests that we can use integer matching rules on the foreman."""
base_time = rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1336480583.077736)
boot_time = rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1336300000.000000)
self.SetupClient(0x11, system="Windows XP", install_time=base_time)
self.SetupClient(0x12, system="Windows 7", install_time=base_time)
# This one was installed one week earlier.
one_week_ago = base_time - rdfvalue.Duration("1w")
self.SetupClient(0x13, system="Windows 7", install_time=one_week_ago)
self.SetupClient(0x14, system="Windows 7", last_boot_time=boot_time)
with utils.Stubber(flow, "StartAFF4Flow", self.StartFlow):
# Now setup the filters
now = rdfvalue.RDFDatetime.Now()
expires = now + rdfvalue.Duration("1h")
foreman_obj = foreman.GetForeman(token=self.token)
# Make a new rule
rule = foreman_rules.ForemanRule(
created=now, expires=expires, description="Test rule(old)")
# Matches the old client
one_hour_ago = base_time - rdfvalue.Duration("1h")
rule.client_rule_set = foreman_rules.ForemanClientRuleSet(rules=[
foreman_rules.ForemanClientRule(
rule_type=foreman_rules.ForemanClientRule.Type.INTEGER,
integer=foreman_rules.ForemanIntegerClientRule(
field="INSTALL_TIME",
operator=foreman_rules.ForemanIntegerClientRule.Operator.
LESS_THAN,
value=one_hour_ago.AsSecondsSinceEpoch()))
])
old_flow = "Test flow for old clients"
# Will run Test Flow
rule.actions.Append(
flow_name=old_flow, argv=rdf_protodict.Dict(dict(foo="bar")))
# Clear the rule set and add the new rule to it.
rule_set = foreman_obj.Schema.RULES()
rule_set.Append(rule)
# Make a new rule
rule = foreman_rules.ForemanRule(
created=now, expires=expires, description="Test rule(new)")
# Matches the newer clients
rule.client_rule_set = foreman_rules.ForemanClientRuleSet(rules=[
foreman_rules.ForemanClientRule(
rule_type=foreman_rules.ForemanClientRule.Type.INTEGER,
integer=foreman_rules.ForemanIntegerClientRule(
field="INSTALL_TIME",
operator=foreman_rules.ForemanIntegerClientRule.Operator.
GREATER_THAN,
value=one_hour_ago.AsSecondsSinceEpoch()))
])
new_flow = "Test flow for newer clients"
# Will run Test Flow
rule.actions.Append(
flow_name=new_flow, argv=rdf_protodict.Dict(dict(foo="bar")))
rule_set.Append(rule)
# Make a new rule
rule = foreman_rules.ForemanRule(
created=now, expires=expires, description="Test rule(eq)")
# Note that this also tests the handling of nonexistent attributes.
rule.client_rule_set = foreman_rules.ForemanClientRuleSet(rules=[
foreman_rules.ForemanClientRule(
rule_type=foreman_rules.ForemanClientRule.Type.INTEGER,
integer=foreman_rules.ForemanIntegerClientRule(
field="LAST_BOOT_TIME",
operator="EQUAL",
value=boot_time.AsSecondsSinceEpoch()))
])
eq_flow = "Test flow for LAST_BOOT_TIME"
rule.actions.Append(
flow_name=eq_flow, argv=rdf_protodict.Dict(dict(foo="bar")))
rule_set.Append(rule)
# Assign it to the foreman
foreman_obj.Set(foreman_obj.Schema.RULES, rule_set)
foreman_obj.Close()
self.clients_launched = []
foreman_obj.AssignTasksToClient(u"C.1000000000000011")
foreman_obj.AssignTasksToClient(u"C.1000000000000012")
foreman_obj.AssignTasksToClient(u"C.1000000000000013")
foreman_obj.AssignTasksToClient(u"C.1000000000000014")
# Make sure that the clients ran the correct flows.
self.assertEqual(len(self.clients_launched), 4)
self.assertEqual(self.clients_launched[0][0],
rdf_client.ClientURN(u"C.1000000000000011"))
self.assertEqual(self.clients_launched[0][1], new_flow)
self.assertEqual(self.clients_launched[1][0],
rdf_client.ClientURN(u"C.1000000000000012"))
self.assertEqual(self.clients_launched[1][1], new_flow)
self.assertEqual(self.clients_launched[2][0],
rdf_client.ClientURN(u"C.1000000000000013"))
self.assertEqual(self.clients_launched[2][1], old_flow)
self.assertEqual(self.clients_launched[3][0],
rdf_client.ClientURN(u"C.1000000000000014"))
self.assertEqual(self.clients_launched[3][1], eq_flow)
def testRuleExpiration(self):
with test_lib.FakeTime(1000):
foreman_obj = foreman.GetForeman(token=self.token)
hunt_id = rdfvalue.SessionID("aff4:/hunts/foremantest")
rules = []
rules.append(
foreman_rules.ForemanRule(
created=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1000),
expires=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1500),
description="Test rule1"))
rules.append(
foreman_rules.ForemanRule(
created=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1000),
expires=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1200),
description="Test rule2"))
rules.append(
foreman_rules.ForemanRule(
created=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1000),
expires=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1500),
description="Test rule3"))
rules.append(
foreman_rules.ForemanRule(
created=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1000),
expires=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1300),
description="Test rule4",
actions=[foreman_rules.ForemanRuleAction(hunt_id=hunt_id)]))
client_id = u"C.0000000000000021"
fd = aff4.FACTORY.Create(
client_id, aff4_grr.VFSGRRClient, token=self.token)
fd.Close()
# Clear the rule set and add the new rules to it.
rule_set = foreman_obj.Schema.RULES()
for rule in rules:
# Add some regex that does not match the client.
rule.client_rule_set = foreman_rules.ForemanClientRuleSet(rules=[
foreman_rules.ForemanClientRule(
rule_type=foreman_rules.ForemanClientRule.Type.REGEX,
regex=foreman_rules.ForemanRegexClientRule(
field="SYSTEM", attribute_regex="XXX"))
])
rule_set.Append(rule)
foreman_obj.Set(foreman_obj.Schema.RULES, rule_set)
foreman_obj.Close()
fd = aff4.FACTORY.Create(client_id, aff4_grr.VFSGRRClient, token=self.token)
for now, num_rules in [(1000, 4), (1250, 3), (1350, 2), (1600, 0)]:
with test_lib.FakeTime(now):
fd.Set(fd.Schema.LAST_FOREMAN_TIME(100))
fd.Flush()
foreman_obj = foreman.GetForeman(token=self.token)
foreman_obj.AssignTasksToClient(client_id)
rules = foreman_obj.Get(foreman_obj.Schema.RULES)
self.assertEqual(len(rules), num_rules)
# Expiring rules that trigger hunts creates a notification for that hunt.
with queue_manager.QueueManager(token=self.token) as manager:
notifications = manager.GetNotificationsForAllShards(hunt_id.Queue())
self.assertEqual(len(notifications), 1)
self.assertEqual(notifications[0].session_id, hunt_id)
class RelationalForemanTests(db_test_lib.RelationalDBEnabledMixin,
test_lib.GRRBaseTest):
"""Tests the Foreman."""
clients_started = []
def StartClients(self, hunt_id, clients):
# Keep a record of all the clients
for client in clients:
self.clients_started.append((hunt_id, client))
def testOperatingSystemSelection(self):
"""Tests that we can distinguish based on operating system."""
self.SetupTestClientObject(1, system="Windows XP")
self.SetupTestClientObject(2, system="Linux")
self.SetupTestClientObject(3, system="Windows 7")
with utils.Stubber(implementation.GRRHunt, "StartClients",
self.StartClients):
# Now setup the filters
now = rdfvalue.RDFDatetime.Now()
expiration_time = now + rdfvalue.Duration("1h")
# Make a new rule
rule = foreman_rules.ForemanCondition(
creation_time=now,
expiration_time=expiration_time,
description="Test rule",
hunt_name=standard.GenericHunt.__name__,
hunt_id="H:111111")
# Matches Windows boxes
rule.client_rule_set = foreman_rules.ForemanClientRuleSet(rules=[
foreman_rules.ForemanClientRule(
rule_type=foreman_rules.ForemanClientRule.Type.OS,
os=foreman_rules.ForemanOsClientRule(os_windows=True))
])
data_store.REL_DB.WriteForemanRule(rule)
self.clients_started = []
foreman_obj = foreman.GetForeman()
foreman_obj.AssignTasksToClient(u"C.1000000000000001")
foreman_obj.AssignTasksToClient(u"C.1000000000000002")
foreman_obj.AssignTasksToClient(u"C.1000000000000003")
# Make sure that only the windows machines ran
self.assertEqual(len(self.clients_started), 2)
self.assertEqual(self.clients_started[0][1], u"C.1000000000000001")
self.assertEqual(self.clients_started[1][1], u"C.1000000000000003")
self.clients_started = []
# Run again - This should not fire since it did already
foreman_obj.AssignTasksToClient(u"C.1000000000000001")
foreman_obj.AssignTasksToClient(u"C.1000000000000002")
foreman_obj.AssignTasksToClient(u"C.1000000000000003")
self.assertEqual(len(self.clients_started), 0)
def testIntegerComparisons(self):
"""Tests that we can use integer matching rules on the foreman."""
base_time = rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1336480583.077736)
boot_time = rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1336300000.000000)
self.SetupTestClientObject(
0x11, system="Windows XP", install_time=base_time)
self.SetupTestClientObject(0x12, system="Windows 7", install_time=base_time)
# This one was installed one week earlier.
one_week_ago = base_time - rdfvalue.Duration("1w")
self.SetupTestClientObject(
0x13, system="Windows 7", install_time=one_week_ago)
self.SetupTestClientObject(
0x14, system="Windows 7", last_boot_time=boot_time)
with utils.Stubber(implementation.GRRHunt, "StartClients",
self.StartClients):
now = rdfvalue.RDFDatetime.Now()
expiration_time = now + rdfvalue.Duration("1h")
# Make a new rule
rule = foreman_rules.ForemanCondition(
creation_time=now,
expiration_time=expiration_time,
description="Test rule(old)",
hunt_name=standard.GenericHunt.__name__,
hunt_id="H:111111")
# Matches the old client
one_hour_ago = base_time - rdfvalue.Duration("1h")
rule.client_rule_set = foreman_rules.ForemanClientRuleSet(rules=[
foreman_rules.ForemanClientRule(
rule_type=foreman_rules.ForemanClientRule.Type.INTEGER,
integer=foreman_rules.ForemanIntegerClientRule(
field="INSTALL_TIME",
operator=foreman_rules.ForemanIntegerClientRule.Operator.
LESS_THAN,
value=one_hour_ago.AsSecondsSinceEpoch()))
])
data_store.REL_DB.WriteForemanRule(rule)
# Make a new rule
rule = foreman_rules.ForemanCondition(
creation_time=now,
expiration_time=expiration_time,
description="Test rule(new)",
hunt_name=standard.GenericHunt.__name__,
hunt_id="H:222222")
# Matches the newer clients
rule.client_rule_set = foreman_rules.ForemanClientRuleSet(rules=[
foreman_rules.ForemanClientRule(
rule_type=foreman_rules.ForemanClientRule.Type.INTEGER,
integer=foreman_rules.ForemanIntegerClientRule(
field="INSTALL_TIME",
operator=foreman_rules.ForemanIntegerClientRule.Operator.
GREATER_THAN,
value=one_hour_ago.AsSecondsSinceEpoch()))
])
data_store.REL_DB.WriteForemanRule(rule)
# Make a new rule
rule = foreman_rules.ForemanCondition(
creation_time=now,
expiration_time=expiration_time,
description="Test rule(eq)",
hunt_name=standard.GenericHunt.__name__,
hunt_id="H:333333")
# Note that this also tests the handling of nonexistent attributes.
rule.client_rule_set = foreman_rules.ForemanClientRuleSet(rules=[
foreman_rules.ForemanClientRule(
rule_type=foreman_rules.ForemanClientRule.Type.INTEGER,
integer=foreman_rules.ForemanIntegerClientRule(
field="LAST_BOOT_TIME",
operator="EQUAL",
value=boot_time.AsSecondsSinceEpoch()))
])
data_store.REL_DB.WriteForemanRule(rule)
foreman_obj = foreman.GetForeman()
self.clients_started = []
foreman_obj.AssignTasksToClient(u"C.1000000000000011")
foreman_obj.AssignTasksToClient(u"C.1000000000000012")
foreman_obj.AssignTasksToClient(u"C.1000000000000013")
foreman_obj.AssignTasksToClient(u"C.1000000000000014")
# Make sure that the clients ran the correct flows.
self.assertEqual(len(self.clients_started), 4)
self.assertEqual(self.clients_started[0][1], u"C.1000000000000011")
self.assertEqual("H:222222", self.clients_started[0][0].Basename())
self.assertEqual(self.clients_started[1][1], u"C.1000000000000012")
self.assertEqual("H:222222", self.clients_started[1][0].Basename())
self.assertEqual(self.clients_started[2][1], u"C.1000000000000013")
self.assertEqual("H:111111", self.clients_started[2][0].Basename())
self.assertEqual(self.clients_started[3][1], u"C.1000000000000014")
self.assertEqual("H:333333", self.clients_started[3][0].Basename())
def testRuleExpiration(self):
with test_lib.FakeTime(1000):
foreman_obj = foreman.GetForeman()
rules = []
rules.append(
foreman_rules.ForemanCondition(
creation_time=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1000),
expiration_time=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1500),
description="Test rule1",
hunt_id="H:111111"))
rules.append(
foreman_rules.ForemanCondition(
creation_time=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1000),
expiration_time=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1200),
description="Test rule2",
hunt_id="H:222222"))
rules.append(
foreman_rules.ForemanCondition(
creation_time=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1000),
expiration_time=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1500),
description="Test rule3",
hunt_id="H:333333"))
rules.append(
foreman_rules.ForemanCondition(
creation_time=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1000),
expiration_time=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(1300),
description="Test rule4",
hunt_id="H:444444"))
client_id = self.SetupTestClientObject(0x21).client_id
# Clear the rule set and add the new rules to it.
for rule in rules:
# Add some regex that does not match the client.
rule.client_rule_set = foreman_rules.ForemanClientRuleSet(rules=[
foreman_rules.ForemanClientRule(
rule_type=foreman_rules.ForemanClientRule.Type.REGEX,
regex=foreman_rules.ForemanRegexClientRule(
field="SYSTEM", attribute_regex="XXX"))
])
data_store.REL_DB.WriteForemanRule(rule)
for now, num_rules in [(1000, 4), (1250, 3), (1350, 2), (1600, 0)]:
with test_lib.FakeTime(now):
data_store.REL_DB.WriteClientMetadata(
client_id,
last_foreman=rdfvalue.RDFDatetime.FromSecondsSinceEpoch(100))
foreman_obj.AssignTasksToClient(client_id)
rules = data_store.REL_DB.ReadAllForemanRules()
self.assertEqual(len(rules), num_rules)
def main(argv):
# Run the full test suite
test_lib.main(argv)
if __name__ == "__main__":
flags.StartMain(main)
| 40.438878
| 80
| 0.683136
| 2,255
| 20,179
| 5.921951
| 0.11796
| 0.055714
| 0.047776
| 0.04493
| 0.852179
| 0.814063
| 0.761869
| 0.713494
| 0.699041
| 0.669912
| 0
| 0.057261
| 0.221963
| 20,179
| 498
| 81
| 40.52008
| 0.793312
| 0.089003
| 0
| 0.641667
| 0
| 0
| 0.071409
| 0.001257
| 0
| 0
| 0.001967
| 0
| 0.088889
| 1
| 0.027778
| false
| 0
| 0.05
| 0
| 0.088889
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
a26d7621cc495c2c74a8bbd8eb423c8bb0f6fdfa
| 86
|
py
|
Python
|
cl/__main__.py
|
aalto-speech/speechbrain-cl
|
57263893bc79ae3bd4358984d81bf9bb393c5886
|
[
"MIT"
] | null | null | null |
cl/__main__.py
|
aalto-speech/speechbrain-cl
|
57263893bc79ae3bd4358984d81bf9bb393c5886
|
[
"MIT"
] | null | null | null |
cl/__main__.py
|
aalto-speech/speechbrain-cl
|
57263893bc79ae3bd4358984d81bf9bb393c5886
|
[
"MIT"
] | null | null | null |
from . import cli_dispatcher
if __name__ == '__main__':
cli_dispatcher.dispatch()
| 21.5
| 29
| 0.744186
| 10
| 86
| 5.4
| 0.8
| 0.481481
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.151163
| 86
| 4
| 29
| 21.5
| 0.739726
| 0
| 0
| 0
| 0
| 0
| 0.091954
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
a2eb91e8b6e036aa6ecb1d2d75a4b4c57187a9fd
| 417
|
py
|
Python
|
challenges/radix_sort/test_radix_sort.py
|
jayadams011/data-structures-and-algorithms
|
b9a49c65ca769c82b2a34d840bd1e4dd626be025
|
[
"MIT"
] | null | null | null |
challenges/radix_sort/test_radix_sort.py
|
jayadams011/data-structures-and-algorithms
|
b9a49c65ca769c82b2a34d840bd1e4dd626be025
|
[
"MIT"
] | 4
|
2018-03-22T16:56:06.000Z
|
2018-03-28T23:30:29.000Z
|
challenges/radix_sort/test_radix_sort.py
|
jayadams011/data-structures-and-algorithms
|
b9a49c65ca769c82b2a34d840bd1e4dd626be025
|
[
"MIT"
] | null | null | null |
"""Test and test imports."""
from .radix_sort import radix_sort
import pytest
def test_empty_radix_sort():
"""Test empty radix sort."""
assert radix_sort([]) == []
def test_small_radix_sort():
"""Test small radix sort."""
assert radix_sort([1, 2, 3]) == [1, 2, 3]
def test_large_radix_sort():
"""Test large radix sort."""
assert radix_sort([910, 78, 56, 34, 12]) == [12, 34, 56, 78, 910]
| 23.166667
| 69
| 0.628297
| 64
| 417
| 3.875
| 0.328125
| 0.399194
| 0.157258
| 0.241935
| 0.290323
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 0.194245
| 417
| 18
| 69
| 23.166667
| 0.654762
| 0.218225
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.375
| 1
| 0.375
| true
| 0
| 0.25
| 0
| 0.625
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
0c5282075d2e779c69ae90f8dae7bee592dd4453
| 59
|
py
|
Python
|
CodeWars/7 Kyu/Convert Integer to Binary.py
|
anubhab-code/Competitive-Programming
|
de28cb7d44044b9e7d8bdb475da61e37c018ac35
|
[
"MIT"
] | null | null | null |
CodeWars/7 Kyu/Convert Integer to Binary.py
|
anubhab-code/Competitive-Programming
|
de28cb7d44044b9e7d8bdb475da61e37c018ac35
|
[
"MIT"
] | null | null | null |
CodeWars/7 Kyu/Convert Integer to Binary.py
|
anubhab-code/Competitive-Programming
|
de28cb7d44044b9e7d8bdb475da61e37c018ac35
|
[
"MIT"
] | null | null | null |
def to_binary(n):
return "{:0b}".format(n & 0xffffffff)
| 29.5
| 41
| 0.644068
| 9
| 59
| 4.111111
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.04
| 0.152542
| 59
| 2
| 41
| 29.5
| 0.7
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 0
| 0
| 0
| 0.166667
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
0c649388099364c439f66b94de22274ac7a4cd77
| 61
|
py
|
Python
|
convlab2/policy/ppo/multiwoz/__init__.py
|
Malavikka/ConvLab-2
|
f2a0d251e4fab9e36e9d9f04df6308623d2d780c
|
[
"Apache-2.0"
] | 339
|
2020-03-04T09:43:22.000Z
|
2022-03-26T17:27:38.000Z
|
convlab2/policy/ppo/multiwoz/__init__.py
|
Malavikka/ConvLab-2
|
f2a0d251e4fab9e36e9d9f04df6308623d2d780c
|
[
"Apache-2.0"
] | 122
|
2020-04-12T04:19:06.000Z
|
2022-03-23T14:20:57.000Z
|
convlab2/policy/ppo/multiwoz/__init__.py
|
Malavikka/ConvLab-2
|
f2a0d251e4fab9e36e9d9f04df6308623d2d780c
|
[
"Apache-2.0"
] | 138
|
2020-02-18T16:48:04.000Z
|
2022-03-26T17:27:43.000Z
|
from convlab2.policy.ppo.multiwoz.ppo_policy import PPOPolicy
| 61
| 61
| 0.885246
| 9
| 61
| 5.888889
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017241
| 0.04918
| 61
| 1
| 61
| 61
| 0.896552
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
a740d0c7b82bdf8729896c55466011835339141d
| 140
|
py
|
Python
|
3_extracting_mtf_pymfe/pymfe/__init__.py
|
FelSiq/ts-pymfe-tests
|
b11000d9745b7822f026b966d91255ecc7f77564
|
[
"MIT"
] | 86
|
2019-03-21T23:56:22.000Z
|
2022-02-06T23:18:33.000Z
|
pymfe/__init__.py
|
Menelau/pymfe
|
4e43c9210a19e3123d9d24a22efa4e65099ed129
|
[
"MIT"
] | 100
|
2019-03-21T18:32:30.000Z
|
2021-03-19T16:38:41.000Z
|
pymfe/__init__.py
|
Menelau/pymfe
|
4e43c9210a19e3123d9d24a22efa4e65099ed129
|
[
"MIT"
] | 24
|
2019-04-22T17:10:56.000Z
|
2021-06-01T14:26:49.000Z
|
"""EXtracts metafeatures from structured datasets.
Todo:
More information here.
"""
from ._version import __version__ # noqa: ignore
| 17.5
| 50
| 0.742857
| 15
| 140
| 6.6
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.171429
| 140
| 7
| 51
| 20
| 0.853448
| 0.678571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 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
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.