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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6641015418842d24e0eff43ebf9fb9187f9f350c | 57 | py | Python | froide/problem/__init__.py | manonthemat/froide | 698c49935eaf2e922f3c9f6a46af0fd545ccbbbb | [
"MIT"
] | null | null | null | froide/problem/__init__.py | manonthemat/froide | 698c49935eaf2e922f3c9f6a46af0fd545ccbbbb | [
"MIT"
] | null | null | null | froide/problem/__init__.py | manonthemat/froide | 698c49935eaf2e922f3c9f6a46af0fd545ccbbbb | [
"MIT"
] | null | null | null | default_app_config = 'froide.problem.apps.ProblemConfig'
| 28.5 | 56 | 0.842105 | 7 | 57 | 6.571429 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.052632 | 57 | 1 | 57 | 57 | 0.851852 | 0 | 0 | 0 | 0 | 0 | 0.578947 | 0.578947 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6649ec97684d93a0fbb59f5d0ab7f6a0239302df | 193 | py | Python | doc/core/number.py | ponyatov/metaLeds | e017f4b14dcdf87275154d8220fbdae06cd9f370 | [
"MIT"
] | null | null | null | doc/core/number.py | ponyatov/metaLeds | e017f4b14dcdf87275154d8220fbdae06cd9f370 | [
"MIT"
] | null | null | null | doc/core/number.py | ponyatov/metaLeds | e017f4b14dcdf87275154d8220fbdae06cd9f370 | [
"MIT"
] | null | null | null | ## floating point
class Number(Primitive):
def __init__(self, V, prec=4):
Primitive.__init__(self, float(V))
## precision: digits after decimal `.`
self.prec = prec
| 27.571429 | 46 | 0.621762 | 23 | 193 | 4.869565 | 0.695652 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006897 | 0.248705 | 193 | 6 | 47 | 32.166667 | 0.765517 | 0.259067 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b093b6a83644240cc9d3741f06bd2e57216233f3 | 254 | py | Python | tutorials/W0D4_Calculus/solutions/W0D4_Tutorial3_Solution_5348a4df.py | eduardojdiniz/CompNeuro | 20269e66540dc4e802273735c97323020ee37406 | [
"CC-BY-4.0",
"BSD-3-Clause"
] | 2,294 | 2020-05-11T12:05:35.000Z | 2022-03-28T21:23:34.000Z | tutorials/W0D4_Calculus/solutions/W0D4_Tutorial3_Solution_5348a4df.py | pellet/course-content | bb383857992469e0e7a9c36639ac0d05e842d9bd | [
"CC-BY-4.0",
"BSD-3-Clause"
] | 629 | 2020-05-11T15:42:26.000Z | 2022-03-29T12:23:35.000Z | tutorials/W0D4_Calculus/solutions/W0D4_Tutorial3_Solution_5348a4df.py | pellet/course-content | bb383857992469e0e7a9c36639ac0d05e842d9bd | [
"CC-BY-4.0",
"BSD-3-Clause"
] | 917 | 2020-05-11T12:47:53.000Z | 2022-03-31T12:14:41.000Z |
"""
1. The larger the time-step $\Delta t$ the more the estimate $p_1$ deviates
from the exact $p(t_1)$.
2. There is a linear relationship between $\Delta t$ and $e_1$: double the time-step double the error.
3. Make more shorter time-steps
""" | 28.222222 | 104 | 0.685039 | 46 | 254 | 3.717391 | 0.608696 | 0.081871 | 0.128655 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029557 | 0.200787 | 254 | 9 | 105 | 28.222222 | 0.812808 | 0.933071 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b093c6e08262619daa4ab9321c078c038951e534 | 380 | py | Python | src/Stage/stage.py | yuduki24/Rikako | 989a0499d06bd37b5a6d826b1fb898369a50bbfb | [
"MIT"
] | null | null | null | src/Stage/stage.py | yuduki24/Rikako | 989a0499d06bd37b5a6d826b1fb898369a50bbfb | [
"MIT"
] | null | null | null | src/Stage/stage.py | yuduki24/Rikako | 989a0499d06bd37b5a6d826b1fb898369a50bbfb | [
"MIT"
] | null | null | null | from Enemy.enemy import *
from Enemy.enemy1 import *
from Enemy.boss1 import *
from Enemy.boss2 import *
from Enemy.boss3 import *
class Stage():
def __init__(self):
self.deployEnemy()
def deployEnemy(self):
for i in range(0, 1):
x = 100 + int(i % 10) * 40
y = 50 + int(i / 10) * 40
enemy = Enemy((x, y))
| 25.333333 | 39 | 0.544737 | 52 | 380 | 3.903846 | 0.5 | 0.221675 | 0.295567 | 0.078818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075697 | 0.339474 | 380 | 14 | 40 | 27.142857 | 0.733068 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.384615 | 0 | 0.615385 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
b0a3964d43a9624507dee2d5fdbb0a7884aa288e | 2,220 | py | Python | USA/prepare_USA_ERA5.py | KatharinaGruber/windpower_GWA | 6d4eddc48f37cb66ac33ebab431b9a223366d4e1 | [
"MIT"
] | 4 | 2020-03-30T13:17:11.000Z | 2021-02-21T12:57:48.000Z | USA/prepare_USA_ERA5.py | KatharinaGruber/windpower_GWA | 6d4eddc48f37cb66ac33ebab431b9a223366d4e1 | [
"MIT"
] | null | null | null | USA/prepare_USA_ERA5.py | KatharinaGruber/windpower_GWA | 6d4eddc48f37cb66ac33ebab431b9a223366d4e1 | [
"MIT"
] | 1 | 2020-11-19T23:50:21.000Z | 2020-11-19T23:50:21.000Z | # Script for preparing ERA5 reanalysis data:
# 1. Calculate effective wind speeds from u and v wind speeds in two heights (10 and 100m)
# 2. Calculate alpha friction coefficient
from paths_usa import era_path
import glob
import numpy as np
import xarray as xr
files = glob.glob(era_path+'/*.nc')
files.sort()
out_files = glob.glob(era_path + '/eff_ws/*')
for year in range(0,31,2):
i1 = year * 12
i2 = i1 + 24
wfile = era_path+'/eff_ws/era5_wind_USA_' + str(1987+year) + '-' + str(1987+year+1) + '.nc'
afile = era_path+'/eff_ws/era5_alpha_USA_' + str(1987+year) + '-' + str(1987+year+1) + '.nc'
if wfile not in out_files:
print('calculating wind ' + str(1987+year) + '-' + str(1987+year+1))
data = xr.open_mfdataset(files[i1:i2], chunks = {'time': 38})
wh10 = ((data.u10**2+data.v10**2)**0.5).compute()
wh100 = ((data.u100**2+data.v100**2)**0.5).compute()
print('saving wind ' + str(1987+year) + '-' + str(1987+year+1))
eff_ws = xr.Dataset({'wh10': wh10,
'wh100': wh100})
eff_ws.to_netcdf(wfile)
eff_ws.close()
del(eff_ws)
if afile not in out_files:
print('calculating alpha ' + str(1987+year) + '-' + str(1987+year+1))
eff_ws = xr.open_dataset(wfile)
alpha = (xr.ufuncs.log(eff_ws.wh100/eff_ws.wh10)/np.log(100/10)).compute()
print('saving alpha ' + str(1987+year) + '-' + str(1987+year+1))
xr.Dataset({'alpha': alpha}).to_netcdf(afile)
del(alpha)
# 2019
wfile = era_path+'/eff_ws/era5_wind_USA_2019.nc'
afile = era_path+'/eff_ws/era5_alpha_USA_2019.nc'
if wfile not in out_files:
print('calculating wind 2019')
data = xr.open_mfdataset(files[-12:], chunks = {'time': 38})
wh10 = ((data.u10**2+data.v10**2)**0.5).compute()
wh100 = ((data.u100**2+data.v100**2)**0.5).compute()
print('saving wind 2019')
eff_ws = xr.Dataset({'wh10': wh10,
'wh100': wh100})
eff_ws.to_netcdf(wfile)
eff_ws.close()
del(eff_ws)
if afile not in out_files:
print('calculating alpha 2019')
eff_ws = xr.open_dataset(wfile)
alpha = (xr.ufuncs.log(eff_ws.wh100/eff_ws.wh10)/np.log(100/10)).compute()
print('saving alpha 2019')
xr.Dataset({'alpha': alpha}).to_netcdf(afile)
del(alpha) | 35.806452 | 93 | 0.642342 | 363 | 2,220 | 3.785124 | 0.220386 | 0.069141 | 0.09607 | 0.061135 | 0.788937 | 0.724891 | 0.724891 | 0.724891 | 0.652838 | 0.513828 | 0 | 0.108862 | 0.176577 | 2,220 | 62 | 94 | 35.806452 | 0.642779 | 0.079279 | 0 | 0.52 | 0 | 0 | 0.148039 | 0.05098 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.08 | 0 | 0.08 | 0.16 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b0b23ecfb69ff678353a4498bf739fb54d74d8e3 | 510 | py | Python | morphsnakes/__init__.py | Borda/morph-snakes | 0e3f7366eacf217ee328146baae6f15b04f7bad4 | [
"BSD-3-Clause"
] | 10 | 2017-08-31T16:10:29.000Z | 2021-03-10T19:27:13.000Z | morphsnakes/__init__.py | Borda/morph-snakes | 0e3f7366eacf217ee328146baae6f15b04f7bad4 | [
"BSD-3-Clause"
] | 1 | 2017-07-11T10:01:15.000Z | 2017-08-11T11:47:14.000Z | morphsnakes/__init__.py | Borda/morph-snakes | 0e3f7366eacf217ee328146baae6f15b04f7bad4 | [
"BSD-3-Clause"
] | 3 | 2018-05-27T04:43:28.000Z | 2020-04-29T11:39:05.000Z | import os
import logging
import matplotlib
if os.environ.get('DISPLAY','') == '':
logging.warning('No display found. Using non-interactive Agg backend')
matplotlib.use('Agg')
import warnings
try:
from .cmorphsnakes import MorphACWE, MorphGAC
except ImportError:
warnings.warn("Could not load cmorphsnakes; "
"using the pure Python implementation.")
from .morphsnakes import MorphACWE, MorphGAC
from .morphsnakes import gborders, glines, evolve_visual, evolve_visual3d
| 26.842105 | 74 | 0.731373 | 59 | 510 | 6.288136 | 0.661017 | 0.080863 | 0.123989 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002392 | 0.180392 | 510 | 18 | 75 | 28.333333 | 0.885167 | 0 | 0 | 0 | 0 | 0 | 0.24902 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.571429 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
b0c43838ca235f859ec40f793f1beb5aeccca8c5 | 469 | py | Python | tests/assertions.py | stamler/charade | 9ff3d2266e376fb3165a29ce5c01c0257cf02882 | [
"MIT"
] | null | null | null | tests/assertions.py | stamler/charade | 9ff3d2266e376fb3165a29ce5c01c0257cf02882 | [
"MIT"
] | 12 | 2018-06-21T15:02:38.000Z | 2018-06-30T01:33:14.000Z | tests/assertions.py | stamler/charade | 9ff3d2266e376fb3165a29ce5c01c0257cf02882 | [
"MIT"
] | null | null | null | import json
from os.path import join, dirname
from jsonschema import validate
def assert_valid_schema(data: str, schema_file: str):
""" return nothing if given data is valid
else raise exceptions """
schema = _load_json_schema_from_file(schema_file)
return validate(data, schema)
def _load_json_schema_from_file(filename: str) -> str:
with open(join(dirname(__file__), filename)) as schema_file:
return json.loads(schema_file.read()) | 33.5 | 64 | 0.742004 | 67 | 469 | 4.895522 | 0.462687 | 0.121951 | 0.085366 | 0.109756 | 0.134146 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172708 | 469 | 14 | 65 | 33.5 | 0.845361 | 0.127932 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.222222 | false | 0 | 0.333333 | 0 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
b0cfbc8f9b7841fa1596db36ea680151423c48b6 | 134 | py | Python | population/pair.py | jluech/PGAcloud_Initializer | b6c33631d1062974df1c7da35b62d2adbf279dd3 | [
"MIT"
] | null | null | null | population/pair.py | jluech/PGAcloud_Initializer | b6c33631d1062974df1c7da35b62d2adbf279dd3 | [
"MIT"
] | null | null | null | population/pair.py | jluech/PGAcloud_Initializer | b6c33631d1062974df1c7da35b62d2adbf279dd3 | [
"MIT"
] | null | null | null | class Pair(object):
def __init__(self, individual1, individual2):
self.ind1 = individual1
self.ind2 = individual2
| 26.8 | 49 | 0.671642 | 14 | 134 | 6.142857 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0.238806 | 134 | 4 | 50 | 33.5 | 0.784314 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b0e4388e146f49551dde44dd0d3d180ab09a121a | 425 | py | Python | sample.py | dharshini-raman/Q1_Python | 5ac23c4773a6ec46176c37c1a4af6326749d5522 | [
"Apache-2.0"
] | null | null | null | sample.py | dharshini-raman/Q1_Python | 5ac23c4773a6ec46176c37c1a4af6326749d5522 | [
"Apache-2.0"
] | null | null | null | sample.py | dharshini-raman/Q1_Python | 5ac23c4773a6ec46176c37c1a4af6326749d5522 | [
"Apache-2.0"
] | null | null | null | class atom(object):
def __init__(self,atno,x,y,z):
self.atno = atno
self.position = (x,y,z)
# this is constructor
def symbol(self): # a class method
return atno__to__Symbol[atno]
def __repr__(self): # a class method
return '%d %10.4f %10.4f %10.4f%'
(self.atno, self.position[0], self.position[1],
self.position[2])
# toString
| 30.357143 | 56 | 0.548235 | 58 | 425 | 3.810345 | 0.465517 | 0.217195 | 0.027149 | 0.144796 | 0.199095 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041667 | 0.322353 | 425 | 13 | 57 | 32.692308 | 0.725694 | 0.136471 | 0 | 0 | 0 | 0 | 0.068768 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0 | 0.1 | 0.6 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
7c0b20cc06233e716789bb6818253eb079f049ae | 161 | py | Python | twitch/settings.py | Kedyn/tictactoe | fb029ed66e9cb4193aba828fa8bf6e4a0e3dcfd8 | [
"MIT"
] | null | null | null | twitch/settings.py | Kedyn/tictactoe | fb029ed66e9cb4193aba828fa8bf6e4a0e3dcfd8 | [
"MIT"
] | null | null | null | twitch/settings.py | Kedyn/tictactoe | fb029ed66e9cb4193aba828fa8bf6e4a0e3dcfd8 | [
"MIT"
] | null | null | null | HOST = "irc.twitch.tv"
PORT = 6667
NICK = "simpleaibot"
PASS = "oauth:tldegtq435nf1dgdps8ik9opfw9pin"
CHAN = "simpleaibot"
OWNER = ["sinstr_syko", "aloeblinka"]
| 23 | 45 | 0.732919 | 17 | 161 | 6.882353 | 0.941176 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.077465 | 0.118012 | 161 | 6 | 46 | 26.833333 | 0.746479 | 0 | 0 | 0 | 0 | 0 | 0.571429 | 0.223602 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
b01228f806635321f1cb2ac104d32d8dd71f9277 | 72 | py | Python | chumpy/version.py | metabolize/chumpy | e00dc1cea95c94812c1552935407743e081c2f7a | [
"MIT"
] | 5 | 2018-07-14T19:43:27.000Z | 2019-06-17T17:51:24.000Z | chumpy/version.py | metabolize/chumpy | e00dc1cea95c94812c1552935407743e081c2f7a | [
"MIT"
] | 6 | 2018-07-14T02:33:19.000Z | 2018-09-09T03:30:31.000Z | chumpy/version.py | metabolize/chumpy | e00dc1cea95c94812c1552935407743e081c2f7a | [
"MIT"
] | 2 | 2018-10-11T00:09:18.000Z | 2019-03-05T09:12:53.000Z | version = '0.67.6.post2'
short_version = version
full_version = version
| 18 | 24 | 0.763889 | 11 | 72 | 4.818182 | 0.636364 | 0.528302 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.079365 | 0.125 | 72 | 3 | 25 | 24 | 0.761905 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b027cbac2e40b03749179bbea97a7fee6fcef191 | 14,124 | py | Python | src/tasks/task3/config.py | GirZ0n/cryptography | 3302aaf251710f0baf42f4a90aa4afd55fdfebb3 | [
"Unlicense"
] | null | null | null | src/tasks/task3/config.py | GirZ0n/cryptography | 3302aaf251710f0baf42f4a90aa4afd55fdfebb3 | [
"Unlicense"
] | null | null | null | src/tasks/task3/config.py | GirZ0n/cryptography | 3302aaf251710f0baf42f4a90aa4afd55fdfebb3 | [
"Unlicense"
] | null | null | null | SBOX = (
(0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76),
(0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0),
(0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15),
(0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75),
(0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84),
(0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF),
(0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8),
(0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2),
(0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73),
(0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB),
(0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79),
(0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08),
(0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A),
(0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E),
(0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF),
(0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16),
)
INV_SBOX = (
(0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB),
(0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB),
(0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E),
(0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25),
(0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92),
(0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84),
(0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06),
(0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B),
(0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73),
(0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E),
(0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B),
(0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4),
(0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F),
(0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF),
(0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61),
(0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D),
)
RCON = (
(0x01, 0x00, 0x00, 0x00),
(0x02, 0x00, 0x00, 0x00),
(0x04, 0x00, 0x00, 0x00),
(0x08, 0x00, 0x00, 0x00),
(0x10, 0x00, 0x00, 0x00),
(0x20, 0x00, 0x00, 0x00),
(0x40, 0x00, 0x00, 0x00),
(0x80, 0x00, 0x00, 0x00),
(0x1B, 0x00, 0x00, 0x00),
(0x36, 0x00, 0x00, 0x00),
)
# ----------------------------------------------------------------------------------------------------------------------
_MULTIPLY_BY_1 = tuple(range(256))
_MULTIPLY_BY_2 = (
0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E,
0x20, 0x22, 0x24, 0x26, 0x28, 0x2A, 0x2C, 0x2E, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3A, 0x3C, 0x3E,
0x40, 0x42, 0x44, 0x46, 0x48, 0x4A, 0x4C, 0x4E, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5A, 0x5C, 0x5E,
0x60, 0x62, 0x64, 0x66, 0x68, 0x6A, 0x6C, 0x6E, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7A, 0x7C, 0x7E,
0x80, 0x82, 0x84, 0x86, 0x88, 0x8A, 0x8C, 0x8E, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9A, 0x9C, 0x9E,
0xA0, 0xA2, 0xA4, 0xA6, 0xA8, 0xAA, 0xAC, 0xAE, 0xB0, 0xB2, 0xB4, 0xB6, 0xB8, 0xBA, 0xBC, 0xBE,
0xC0, 0xC2, 0xC4, 0xC6, 0xC8, 0xCA, 0xCC, 0xCE, 0xD0, 0xD2, 0xD4, 0xD6, 0xD8, 0xDA, 0xDC, 0xDE,
0xE0, 0xE2, 0xE4, 0xE6, 0xE8, 0xEA, 0xEC, 0xEE, 0xF0, 0xF2, 0xF4, 0xF6, 0xF8, 0xFA, 0xFC, 0xFE,
0x1B, 0x19, 0x1F, 0x1D, 0x13, 0x11, 0x17, 0x15, 0x0B, 0x09, 0x0F, 0x0D, 0x03, 0x01, 0x07, 0x05,
0x3B, 0x39, 0x3F, 0x3D, 0x33, 0x31, 0x37, 0x35, 0x2B, 0x29, 0x2F, 0x2D, 0x23, 0x21, 0x27, 0x25,
0x5B, 0x59, 0x5F, 0x5D, 0x53, 0x51, 0x57, 0x55, 0x4B, 0x49, 0x4F, 0x4D, 0x43, 0x41, 0x47, 0x45,
0x7B, 0x79, 0x7F, 0x7D, 0x73, 0x71, 0x77, 0x75, 0x6B, 0x69, 0x6F, 0x6D, 0x63, 0x61, 0x67, 0x65,
0x9B, 0x99, 0x9F, 0x9D, 0x93, 0x91, 0x97, 0x95, 0x8B, 0x89, 0x8F, 0x8D, 0x83, 0x81, 0x87, 0x85,
0xBB, 0xB9, 0xBF, 0xBD, 0xB3, 0xB1, 0xB7, 0xB5, 0xAB, 0xA9, 0xAF, 0xAD, 0xA3, 0xA1, 0xA7, 0xA5,
0xDB, 0xD9, 0xDF, 0xDD, 0xD3, 0xD1, 0xD7, 0xD5, 0xCB, 0xC9, 0xCF, 0xCD, 0xC3, 0xC1, 0xC7, 0xC5,
0xFB, 0xF9, 0xFF, 0xFD, 0xF3, 0xF1, 0xF7, 0xF5, 0xEB, 0xE9, 0xEF, 0xED, 0xE3, 0xE1, 0xE7, 0xE5,
)
_MULTIPLY_BY_3 = (
0x00, 0x03, 0x06, 0x05, 0x0C, 0x0F, 0x0A, 0x09, 0x18, 0x1B, 0x1E, 0x1D, 0x14, 0x17, 0x12, 0x11,
0x30, 0x33, 0x36, 0x35, 0x3C, 0x3F, 0x3A, 0x39, 0x28, 0x2B, 0x2E, 0x2D, 0x24, 0x27, 0x22, 0x21,
0x60, 0x63, 0x66, 0x65, 0x6C, 0x6F, 0x6A, 0x69, 0x78, 0x7B, 0x7E, 0x7D, 0x74, 0x77, 0x72, 0x71,
0x50, 0x53, 0x56, 0x55, 0x5C, 0x5F, 0x5A, 0x59, 0x48, 0x4B, 0x4E, 0x4D, 0x44, 0x47, 0x42, 0x41,
0xC0, 0xC3, 0xC6, 0xC5, 0xCC, 0xCF, 0xCA, 0xC9, 0xD8, 0xDB, 0xDE, 0xDD, 0xD4, 0xD7, 0xD2, 0xD1,
0xF0, 0xF3, 0xF6, 0xF5, 0xFC, 0xFF, 0xFA, 0xF9, 0xE8, 0xEB, 0xEE, 0xED, 0xE4, 0xE7, 0xE2, 0xE1,
0xA0, 0xA3, 0xA6, 0xA5, 0xAC, 0xAF, 0xAA, 0xA9, 0xB8, 0xBB, 0xBE, 0xBD, 0xB4, 0xB7, 0xB2, 0xB1,
0x90, 0x93, 0x96, 0x95, 0x9C, 0x9F, 0x9A, 0x99, 0x88, 0x8B, 0x8E, 0x8D, 0x84, 0x87, 0x82, 0x81,
0x9B, 0x98, 0x9D, 0x9E, 0x97, 0x94, 0x91, 0x92, 0x83, 0x80, 0x85, 0x86, 0x8F, 0x8C, 0x89, 0x8A,
0xAB, 0xA8, 0xAD, 0xAE, 0xA7, 0xA4, 0xA1, 0xA2, 0xB3, 0xB0, 0xB5, 0xB6, 0xBF, 0xBC, 0xB9, 0xBA,
0xFB, 0xF8, 0xFD, 0xFE, 0xF7, 0xF4, 0xF1, 0xF2, 0xE3, 0xE0, 0xE5, 0xE6, 0xEF, 0xEC, 0xE9, 0xEA,
0xCB, 0xC8, 0xCD, 0xCE, 0xC7, 0xC4, 0xC1, 0xC2, 0xD3, 0xD0, 0xD5, 0xD6, 0xDF, 0xDC, 0xD9, 0xDA,
0x5B, 0x58, 0x5D, 0x5E, 0x57, 0x54, 0x51, 0x52, 0x43, 0x40, 0x45, 0x46, 0x4F, 0x4C, 0x49, 0x4A,
0x6B, 0x68, 0x6D, 0x6E, 0x67, 0x64, 0x61, 0x62, 0x73, 0x70, 0x75, 0x76, 0x7F, 0x7C, 0x79, 0x7A,
0x3B, 0x38, 0x3D, 0x3E, 0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2F, 0x2C, 0x29, 0x2A,
0x0B, 0x08, 0x0D, 0x0E, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1F, 0x1C, 0x19, 0x1A,
)
_MULTIPLY_BY_9 = (
0x00, 0x09, 0x12, 0x1B, 0x24, 0x2D, 0x36, 0x3F, 0x48, 0x41, 0x5A, 0x53, 0x6C, 0x65, 0x7E, 0x77,
0x90, 0x99, 0x82, 0x8B, 0xB4, 0xBD, 0xA6, 0xAF, 0xD8, 0xD1, 0xCA, 0xC3, 0xFC, 0xF5, 0xEE, 0xE7,
0x3B, 0x32, 0x29, 0x20, 0x1F, 0x16, 0x0D, 0x04, 0x73, 0x7A, 0x61, 0x68, 0x57, 0x5E, 0x45, 0x4C,
0xAB, 0xA2, 0xB9, 0xB0, 0x8F, 0x86, 0x9D, 0x94, 0xE3, 0xEA, 0xF1, 0xF8, 0xC7, 0xCE, 0xD5, 0xDC,
0x76, 0x7F, 0x64, 0x6D, 0x52, 0x5B, 0x40, 0x49, 0x3E, 0x37, 0x2C, 0x25, 0x1A, 0x13, 0x08, 0x01,
0xE6, 0xEF, 0xF4, 0xFD, 0xC2, 0xCB, 0xD0, 0xD9, 0xAE, 0xA7, 0xBC, 0xB5, 0x8A, 0x83, 0x98, 0x91,
0x4D, 0x44, 0x5F, 0x56, 0x69, 0x60, 0x7B, 0x72, 0x05, 0x0C, 0x17, 0x1E, 0x21, 0x28, 0x33, 0x3A,
0xDD, 0xD4, 0xCF, 0xC6, 0xF9, 0xF0, 0xEB, 0xE2, 0x95, 0x9C, 0x87, 0x8E, 0xB1, 0xB8, 0xA3, 0xAA,
0xEC, 0xE5, 0xFE, 0xF7, 0xC8, 0xC1, 0xDA, 0xD3, 0xA4, 0xAD, 0xB6, 0xBF, 0x80, 0x89, 0x92, 0x9B,
0x7C, 0x75, 0x6E, 0x67, 0x58, 0x51, 0x4A, 0x43, 0x34, 0x3D, 0x26, 0x2F, 0x10, 0x19, 0x02, 0x0B,
0xD7, 0xDE, 0xC5, 0xCC, 0xF3, 0xFA, 0xE1, 0xE8, 0x9F, 0x96, 0x8D, 0x84, 0xBB, 0xB2, 0xA9, 0xA0,
0x47, 0x4E, 0x55, 0x5C, 0x63, 0x6A, 0x71, 0x78, 0x0F, 0x06, 0x1D, 0x14, 0x2B, 0x22, 0x39, 0x30,
0x9A, 0x93, 0x88, 0x81, 0xBE, 0xB7, 0xAC, 0xA5, 0xD2, 0xDB, 0xC0, 0xC9, 0xF6, 0xFF, 0xE4, 0xED,
0x0A, 0x03, 0x18, 0x11, 0x2E, 0x27, 0x3C, 0x35, 0x42, 0x4B, 0x50, 0x59, 0x66, 0x6F, 0x74, 0x7D,
0xA1, 0xA8, 0xB3, 0xBA, 0x85, 0x8C, 0x97, 0x9E, 0xE9, 0xE0, 0xFB, 0xF2, 0xCD, 0xC4, 0xDF, 0xD6,
0x31, 0x38, 0x23, 0x2A, 0x15, 0x1C, 0x07, 0x0E, 0x79, 0x70, 0x6B, 0x62, 0x5D, 0x54, 0x4F, 0x46,
)
_MULTIPLY_BY_11 = (
0x00, 0x0B, 0x16, 0x1D, 0x2C, 0x27, 0x3A, 0x31, 0x58, 0x53, 0x4E, 0x45, 0x74, 0x7F, 0x62, 0x69,
0xB0, 0xBB, 0xA6, 0xAD, 0x9C, 0x97, 0x8A, 0x81, 0xE8, 0xE3, 0xFE, 0xF5, 0xC4, 0xCF, 0xD2, 0xD9,
0x7B, 0x70, 0x6D, 0x66, 0x57, 0x5C, 0x41, 0x4A, 0x23, 0x28, 0x35, 0x3E, 0x0F, 0x04, 0x19, 0x12,
0xCB, 0xC0, 0xDD, 0xD6, 0xE7, 0xEC, 0xF1, 0xFA, 0x93, 0x98, 0x85, 0x8E, 0xBF, 0xB4, 0xA9, 0xA2,
0xF6, 0xFD, 0xE0, 0xEB, 0xDA, 0xD1, 0xCC, 0xC7, 0xAE, 0xA5, 0xB8, 0xB3, 0x82, 0x89, 0x94, 0x9F,
0x46, 0x4D, 0x50, 0x5B, 0x6A, 0x61, 0x7C, 0x77, 0x1E, 0x15, 0x08, 0x03, 0x32, 0x39, 0x24, 0x2F,
0x8D, 0x86, 0x9B, 0x90, 0xA1, 0xAA, 0xB7, 0xBC, 0xD5, 0xDE, 0xC3, 0xC8, 0xF9, 0xF2, 0xEF, 0xE4,
0x3D, 0x36, 0x2B, 0x20, 0x11, 0x1A, 0x07, 0x0C, 0x65, 0x6E, 0x73, 0x78, 0x49, 0x42, 0x5F, 0x54,
0xF7, 0xFC, 0xE1, 0xEA, 0xDB, 0xD0, 0xCD, 0xC6, 0xAF, 0xA4, 0xB9, 0xB2, 0x83, 0x88, 0x95, 0x9E,
0x47, 0x4C, 0x51, 0x5A, 0x6B, 0x60, 0x7D, 0x76, 0x1F, 0x14, 0x09, 0x02, 0x33, 0x38, 0x25, 0x2E,
0x8C, 0x87, 0x9A, 0x91, 0xA0, 0xAB, 0xB6, 0xBD, 0xD4, 0xDF, 0xC2, 0xC9, 0xF8, 0xF3, 0xEE, 0xE5,
0x3C, 0x37, 0x2A, 0x21, 0x10, 0x1B, 0x06, 0x0D, 0x64, 0x6F, 0x72, 0x79, 0x48, 0x43, 0x5E, 0x55,
0x01, 0x0A, 0x17, 0x1C, 0x2D, 0x26, 0x3B, 0x30, 0x59, 0x52, 0x4F, 0x44, 0x75, 0x7E, 0x63, 0x68,
0xB1, 0xBA, 0xA7, 0xAC, 0x9D, 0x96, 0x8B, 0x80, 0xE9, 0xE2, 0xFF, 0xF4, 0xC5, 0xCE, 0xD3, 0xD8,
0x7A, 0x71, 0x6C, 0x67, 0x56, 0x5D, 0x40, 0x4B, 0x22, 0x29, 0x34, 0x3F, 0x0E, 0x05, 0x18, 0x13,
0xCA, 0xC1, 0xDC, 0xD7, 0xE6, 0xED, 0xF0, 0xFB, 0x92, 0x99, 0x84, 0x8F, 0xBE, 0xB5, 0xA8, 0xA3,
)
_MULTIPLY_BY_13 = (
0x00, 0x0D, 0x1A, 0x17, 0x34, 0x39, 0x2E, 0x23, 0x68, 0x65, 0x72, 0x7F, 0x5C, 0x51, 0x46, 0x4B,
0xD0, 0xDD, 0xCA, 0xC7, 0xE4, 0xE9, 0xFE, 0xF3, 0xB8, 0xB5, 0xA2, 0xAF, 0x8C, 0x81, 0x96, 0x9B,
0xBB, 0xB6, 0xA1, 0xAC, 0x8F, 0x82, 0x95, 0x98, 0xD3, 0xDE, 0xC9, 0xC4, 0xE7, 0xEA, 0xFD, 0xF0,
0x6B, 0x66, 0x71, 0x7C, 0x5F, 0x52, 0x45, 0x48, 0x03, 0x0E, 0x19, 0x14, 0x37, 0x3A, 0x2D, 0x20,
0x6D, 0x60, 0x77, 0x7A, 0x59, 0x54, 0x43, 0x4E, 0x05, 0x08, 0x1F, 0x12, 0x31, 0x3C, 0x2B, 0x26,
0xBD, 0xB0, 0xA7, 0xAA, 0x89, 0x84, 0x93, 0x9E, 0xD5, 0xD8, 0xCF, 0xC2, 0xE1, 0xEC, 0xFB, 0xF6,
0xD6, 0xDB, 0xCC, 0xC1, 0xE2, 0xEF, 0xF8, 0xF5, 0xBE, 0xB3, 0xA4, 0xA9, 0x8A, 0x87, 0x90, 0x9D,
0x06, 0x0B, 0x1C, 0x11, 0x32, 0x3F, 0x28, 0x25, 0x6E, 0x63, 0x74, 0x79, 0x5A, 0x57, 0x40, 0x4D,
0xDA, 0xD7, 0xC0, 0xCD, 0xEE, 0xE3, 0xF4, 0xF9, 0xB2, 0xBF, 0xA8, 0xA5, 0x86, 0x8B, 0x9C, 0x91,
0x0A, 0x07, 0x10, 0x1D, 0x3E, 0x33, 0x24, 0x29, 0x62, 0x6F, 0x78, 0x75, 0x56, 0x5B, 0x4C, 0x41,
0x61, 0x6C, 0x7B, 0x76, 0x55, 0x58, 0x4F, 0x42, 0x09, 0x04, 0x13, 0x1E, 0x3D, 0x30, 0x27, 0x2A,
0xB1, 0xBC, 0xAB, 0xA6, 0x85, 0x88, 0x9F, 0x92, 0xD9, 0xD4, 0xC3, 0xCE, 0xED, 0xE0, 0xF7, 0xFA,
0xB7, 0xBA, 0xAD, 0xA0, 0x83, 0x8E, 0x99, 0x94, 0xDF, 0xD2, 0xC5, 0xC8, 0xEB, 0xE6, 0xF1, 0xFC,
0x67, 0x6A, 0x7D, 0x70, 0x53, 0x5E, 0x49, 0x44, 0x0F, 0x02, 0x15, 0x18, 0x3B, 0x36, 0x21, 0x2C,
0x0C, 0x01, 0x16, 0x1B, 0x38, 0x35, 0x22, 0x2F, 0x64, 0x69, 0x7E, 0x73, 0x50, 0x5D, 0x4A, 0x47,
0xDC, 0xD1, 0xC6, 0xCB, 0xE8, 0xE5, 0xF2, 0xFF, 0xB4, 0xB9, 0xAE, 0xA3, 0x80, 0x8D, 0x9A, 0x97,
)
_MULTIPLY_BY_14 = (
0x00, 0x0E, 0x1C, 0x12, 0x38, 0x36, 0x24, 0x2A, 0x70, 0x7E, 0x6C, 0x62, 0x48, 0x46, 0x54, 0x5A,
0xE0, 0xEE, 0xFC, 0xF2, 0xD8, 0xD6, 0xC4, 0xCA, 0x90, 0x9E, 0x8C, 0x82, 0xA8, 0xA6, 0xB4, 0xBA,
0xDB, 0xD5, 0xC7, 0xC9, 0xE3, 0xED, 0xFF, 0xF1, 0xAB, 0xA5, 0xB7, 0xB9, 0x93, 0x9D, 0x8F, 0x81,
0x3B, 0x35, 0x27, 0x29, 0x03, 0x0D, 0x1F, 0x11, 0x4B, 0x45, 0x57, 0x59, 0x73, 0x7D, 0x6F, 0x61,
0xAD, 0xA3, 0xB1, 0xBF, 0x95, 0x9B, 0x89, 0x87, 0xDD, 0xD3, 0xC1, 0xCF, 0xE5, 0xEB, 0xF9, 0xF7,
0x4D, 0x43, 0x51, 0x5F, 0x75, 0x7B, 0x69, 0x67, 0x3D, 0x33, 0x21, 0x2F, 0x05, 0x0B, 0x19, 0x17,
0x76, 0x78, 0x6A, 0x64, 0x4E, 0x40, 0x52, 0x5C, 0x06, 0x08, 0x1A, 0x14, 0x3E, 0x30, 0x22, 0x2C,
0x96, 0x98, 0x8A, 0x84, 0xAE, 0xA0, 0xB2, 0xBC, 0xE6, 0xE8, 0xFA, 0xF4, 0xDE, 0xD0, 0xC2, 0xCC,
0x41, 0x4F, 0x5D, 0x53, 0x79, 0x77, 0x65, 0x6B, 0x31, 0x3F, 0x2D, 0x23, 0x09, 0x07, 0x15, 0x1B,
0xA1, 0xAF, 0xBD, 0xB3, 0x99, 0x97, 0x85, 0x8B, 0xD1, 0xDF, 0xCD, 0xC3, 0xE9, 0xE7, 0xF5, 0xFB,
0x9A, 0x94, 0x86, 0x88, 0xA2, 0xAC, 0xBE, 0xB0, 0xEA, 0xE4, 0xF6, 0xF8, 0xD2, 0xDC, 0xCE, 0xC0,
0x7A, 0x74, 0x66, 0x68, 0x42, 0x4C, 0x5E, 0x50, 0x0A, 0x04, 0x16, 0x18, 0x32, 0x3C, 0x2E, 0x20,
0xEC, 0xE2, 0xF0, 0xFE, 0xD4, 0xDA, 0xC8, 0xC6, 0x9C, 0x92, 0x80, 0x8E, 0xA4, 0xAA, 0xB8, 0xB6,
0x0C, 0x02, 0x10, 0x1E, 0x34, 0x3A, 0x28, 0x26, 0x7C, 0x72, 0x60, 0x6E, 0x44, 0x4A, 0x58, 0x56,
0x37, 0x39, 0x2B, 0x25, 0x0F, 0x01, 0x13, 0x1D, 0x47, 0x49, 0x5B, 0x55, 0x7F, 0x71, 0x63, 0x6D,
0xD7, 0xD9, 0xCB, 0xC5, 0xEF, 0xE1, 0xF3, 0xFD, 0xA7, 0xA9, 0xBB, 0xB5, 0x9F, 0x91, 0x83, 0x8D,
)
MIX_COLUMNS_MATRIX = (
(_MULTIPLY_BY_2, _MULTIPLY_BY_3, _MULTIPLY_BY_1, _MULTIPLY_BY_1),
(_MULTIPLY_BY_1, _MULTIPLY_BY_2, _MULTIPLY_BY_3, _MULTIPLY_BY_1),
(_MULTIPLY_BY_1, _MULTIPLY_BY_1, _MULTIPLY_BY_2, _MULTIPLY_BY_3),
(_MULTIPLY_BY_3, _MULTIPLY_BY_1, _MULTIPLY_BY_1, _MULTIPLY_BY_2),
)
INV_MIX_COLUMNS_MATRIX = (
(_MULTIPLY_BY_14, _MULTIPLY_BY_11, _MULTIPLY_BY_13, _MULTIPLY_BY_9),
(_MULTIPLY_BY_9, _MULTIPLY_BY_14, _MULTIPLY_BY_11, _MULTIPLY_BY_13),
(_MULTIPLY_BY_13, _MULTIPLY_BY_9, _MULTIPLY_BY_14, _MULTIPLY_BY_11),
(_MULTIPLY_BY_11, _MULTIPLY_BY_13, _MULTIPLY_BY_9, _MULTIPLY_BY_14),
)
| 77.180328 | 120 | 0.635939 | 2,219 | 14,124 | 3.992339 | 0.123479 | 0.044023 | 0.013546 | 0.017158 | 0.0447 | 0.041088 | 0.041088 | 0.041088 | 0.041088 | 0.040524 | 0 | 0.421164 | 0.195766 | 14,124 | 182 | 121 | 77.604396 | 0.358746 | 0.008355 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.596401 | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b045689f64bd3d350b9d022d7a9afcd14044e532 | 392 | py | Python | tests/test_scale.py | charlottepierce/music_basics | 097a2bb14373662fcb0f6b585abca2913a8affb0 | [
"MIT"
] | 6 | 2018-03-22T03:09:24.000Z | 2021-08-13T16:19:21.000Z | tests/test_scale.py | charlottepierce/music_basics | 097a2bb14373662fcb0f6b585abca2913a8affb0 | [
"MIT"
] | 3 | 2018-06-19T02:09:52.000Z | 2018-06-20T00:09:46.000Z | tests/test_scale.py | charlottepierce/music_basics | 097a2bb14373662fcb0f6b585abca2913a8affb0 | [
"MIT"
] | 1 | 2018-06-18T19:07:03.000Z | 2018-06-18T19:07:03.000Z | import pytest
from music_essentials import Note, Scale
def test_non_note_tonic_str():
with pytest.raises(TypeError):
Scale.build_scale('dlsfk', 'major')
def test_non_note_tonic_int():
with pytest.raises(TypeError):
Scale.build_scale(1, 'major')
def test_unsupported_scale_type():
with pytest.raises(ValueError):
Scale.build_scale(Note('C', 4), 'scale') | 26.133333 | 48 | 0.714286 | 54 | 392 | 4.907407 | 0.462963 | 0.079245 | 0.181132 | 0.10566 | 0.445283 | 0.301887 | 0.301887 | 0 | 0 | 0 | 0 | 0.006116 | 0.165816 | 392 | 15 | 48 | 26.133333 | 0.804281 | 0 | 0 | 0.181818 | 0 | 0 | 0.053435 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | true | 0 | 0.181818 | 0 | 0.454545 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b049dda7fe1aa2162bd5af76a651a486caa6b6de | 655 | py | Python | task2_3.py | Joeolegik/homework_1 | 7abf13e893d9cd758c19a0de52642013561bd498 | [
"MIT"
] | null | null | null | task2_3.py | Joeolegik/homework_1 | 7abf13e893d9cd758c19a0de52642013561bd498 | [
"MIT"
] | null | null | null | task2_3.py | Joeolegik/homework_1 | 7abf13e893d9cd758c19a0de52642013561bd498 | [
"MIT"
] | null | null | null | my_list = ['в', '5', 'часов', '17', 'минут',
'температура', 'воздуха',
'была', '+5', 'градусов']
idx = 0
while idx < len(my_list):
if my_list[idx].isdigit():
my_list.insert(idx, '"')
my_list[idx + 1] = f'{int(my_list[idx + 1]):02}'
my_list.insert(idx + 2, '"')
idx += 2
elif (my_list[idx].startswith('+') or my_list[idx].startswith('-')) and my_list[idx][1:].isdigit():
my_list.insert(idx, '"')
my_list[idx + 1] = f'{my_list[idx + 1][0]}{int(my_list[idx + 1]):02}'
my_list.insert(idx + 2, '"')
idx += 2
idx += 1
out_info = ' '.join(my_list)
print(out_info)
| 34.473684 | 103 | 0.516031 | 99 | 655 | 3.232323 | 0.313131 | 0.3 | 0.253125 | 0.1875 | 0.425 | 0.425 | 0.425 | 0.425 | 0.425 | 0.425 | 0 | 0.043033 | 0.254962 | 655 | 18 | 104 | 36.388889 | 0.612705 | 0 | 0 | 0.333333 | 0 | 0 | 0.192366 | 0.033588 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.055556 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b05d022060692c4b15c4b388c59f574a60debb61 | 318 | py | Python | Linguagens/Python/Exercicios/cursos_em_video/aulas-01_a_21/018.py | rafaelvizu/Estudos | eef5e3e3706ff99959226c51b9907b6af4377bfe | [
"MIT"
] | null | null | null | Linguagens/Python/Exercicios/cursos_em_video/aulas-01_a_21/018.py | rafaelvizu/Estudos | eef5e3e3706ff99959226c51b9907b6af4377bfe | [
"MIT"
] | null | null | null | Linguagens/Python/Exercicios/cursos_em_video/aulas-01_a_21/018.py | rafaelvizu/Estudos | eef5e3e3706ff99959226c51b9907b6af4377bfe | [
"MIT"
] | null | null | null | print('Exercício Python #018 - Seno, Cosseno e Tangente')
import math
a = float(input('Digite o ângulo que você deseja: '))
sen = math.sin(math.radians(a))
print('Sen = {:.2f}'.format(sen))
cos = math.cos(math.radians(a))
print('Cos = {:.2f}'.format(cos))
tg = math.tan(math.radians(a))
print('Tg = {:.2f}'.format(tg)) | 35.333333 | 57 | 0.660377 | 52 | 318 | 4.038462 | 0.519231 | 0.157143 | 0.171429 | 0.242857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021277 | 0.113208 | 318 | 9 | 58 | 35.333333 | 0.723404 | 0 | 0 | 0 | 0 | 0 | 0.363636 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.111111 | 0.444444 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
b06aedb136b55bd050260e9b890785bd454eb2a8 | 94 | py | Python | com/tfstudents/GUI/test1.py | TFStudents/PythonLearn | 84bdf926db3cc5b92599022b34dee6279a3ff399 | [
"MIT"
] | 9 | 2017-07-21T06:53:21.000Z | 2021-03-20T02:31:04.000Z | com/tfstudents/GUI/test1.py | TFStudents/PythonLearn | 84bdf926db3cc5b92599022b34dee6279a3ff399 | [
"MIT"
] | 2 | 2017-07-22T16:08:19.000Z | 2017-07-25T17:17:01.000Z | com/tfstudents/GUI/test1.py | TFStudents/PythonLearn | 84bdf926db3cc5b92599022b34dee6279a3ff399 | [
"MIT"
] | 8 | 2017-07-21T06:57:12.000Z | 2020-04-27T00:24:50.000Z | #!/usr/bin/python
# encoding: utf-8
import Tkinter
top = Tkinter.Tk()
# 进入消息循环
top.mainloop() | 13.428571 | 18 | 0.702128 | 14 | 94 | 4.714286 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012195 | 0.12766 | 94 | 7 | 19 | 13.428571 | 0.792683 | 0.414894 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
c67b99ac932145fe14ba5101a6e98fd8a34532de | 700 | py | Python | data/tidepool_import.py | WesleyAC/hophacks | 94f5044eee66ad8eff22d19ede4c6d127c1af03d | [
"MIT"
] | null | null | null | data/tidepool_import.py | WesleyAC/hophacks | 94f5044eee66ad8eff22d19ede4c6d127c1af03d | [
"MIT"
] | 10 | 2017-09-17T01:18:50.000Z | 2017-09-17T12:18:49.000Z | data/tidepool_import.py | WesleyAC/hophacks | 94f5044eee66ad8eff22d19ede4c6d127c1af03d | [
"MIT"
] | null | null | null | from data.main import RawData, AvgData
from datetime import time, datetime, timedelta
import requests
def tidepool_import(username, passwd):
#TODO(Wesley) deal with wrong passwd/errors
r = requests.post('https://api.tidepool.org/auth/login', auth=(username, passwd))
user_id = r.json()["userid"]
tidepool_session = r.headers["x-tidepool-session-token"]
headers = {
"x-tidepool-session-token": tidepool_session,
"Content-Type": "application/json"
}
r = requests.get('https://api.tidepool.org/data/{}'.format(user_id), headers=headers)
#TODO(Wesley) fix hardcoded date
return AvgData(RawData(r.json()), datetime(2017, 5, 29, 0, 0, 0), timedelta(1))
| 41.176471 | 89 | 0.692857 | 94 | 700 | 5.106383 | 0.521277 | 0.125 | 0.066667 | 0.079167 | 0.116667 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018644 | 0.157143 | 700 | 16 | 90 | 43.75 | 0.794915 | 0.104286 | 0 | 0 | 0 | 0 | 0.2384 | 0.0768 | 0 | 0 | 0 | 0.0625 | 0 | 1 | 0.076923 | false | 0.153846 | 0.307692 | 0 | 0.461538 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
c67cfb8203f5f499e21afc076eecd1967c9a4109 | 1,283 | py | Python | minotor/tests/unit_tests/test_data_types.py | datarmada/minotor | 06079926d717f0cd882152319aaeaa7edc9ba087 | [
"Apache-2.0"
] | 25 | 2020-04-11T17:51:31.000Z | 2022-03-21T16:26:36.000Z | minotor/tests/unit_tests/test_data_types.py | datarmada/minotor | 06079926d717f0cd882152319aaeaa7edc9ba087 | [
"Apache-2.0"
] | 1 | 2022-02-28T04:07:01.000Z | 2022-02-28T04:07:01.000Z | minotor/tests/unit_tests/test_data_types.py | datarmada/minotor | 06079926d717f0cd882152319aaeaa7edc9ba087 | [
"Apache-2.0"
] | null | null | null | import unittest
import numpy as np
import pandas as pd
from minotor.data_managers.data_types import DataType
class TestDataType(unittest.TestCase):
def test_numpy_float2data_type(self):
arr = np.array([[1.0, 1.2]])
dtype = arr.dtype
self.assertEqual(DataType.type2value(dtype), DataType.FLOAT)
def test_numpy_int2data_type(self):
arr = np.array([[1, 1]])
dtype = arr.dtype
self.assertEqual(DataType.type2value(dtype), DataType.INT)
def test_numpy_bool2data_type(self):
arr = np.array([[True, False]])
dtype = arr.dtype
self.assertEqual(DataType.type2value(dtype), DataType.BOOL)
def test_pandas_int2data_type(self):
s = pd.Series([1, 2])
self.assertEqual(DataType.type2value(s.dtype), DataType.INT)
def test_pandas_float2data_type(self):
s = pd.Series([1.0, 2.0])
self.assertEqual(DataType.type2value(s.dtype), DataType.FLOAT)
def test_pandas_cat2data_type(self):
s = pd.Series(["cat1", "cat2"], dtype="category")
self.assertEqual(DataType.type2value(s.dtype), DataType.CATEGORY)
def test_pandas_bool2data_type(self):
s = pd.Series([True, False])
self.assertEqual(DataType.type2value(s.dtype), DataType.BOOL)
| 32.075 | 73 | 0.67576 | 167 | 1,283 | 5.053892 | 0.251497 | 0.058057 | 0.190758 | 0.273697 | 0.633886 | 0.520142 | 0.432464 | 0.209716 | 0.209716 | 0 | 0 | 0.027264 | 0.199532 | 1,283 | 39 | 74 | 32.897436 | 0.794547 | 0 | 0 | 0.103448 | 0 | 0 | 0.012471 | 0 | 0 | 0 | 0 | 0 | 0.241379 | 1 | 0.241379 | false | 0 | 0.137931 | 0 | 0.413793 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c684c648fb588eca550ec871c800246d76bb0892 | 1,715 | py | Python | snapfs/transform.py | beesperester/python-snapfs | 4486cec82e1b2f9320968ced5455f1e091a03612 | [
"MIT"
] | null | null | null | snapfs/transform.py | beesperester/python-snapfs | 4486cec82e1b2f9320968ced5455f1e091a03612 | [
"MIT"
] | null | null | null | snapfs/transform.py | beesperester/python-snapfs | 4486cec82e1b2f9320968ced5455f1e091a03612 | [
"MIT"
] | null | null | null | from __future__ import annotations
import json
import re
from typing import BinaryIO, Dict, Any, Callable, Sequence, TypeVar
from hashlib import sha256
from pathlib import Path
T = TypeVar("T")
def apply(callback: Callable[[T], Any], values: Sequence[T]) -> None:
for value in values:
callback(value)
def as_dict(instance: object) -> Dict[str, Any]:
return instance.__dict__
def slug(string: str) -> str:
matches = re.findall(re.compile(r"(\w+)"), string)
return "".join(list(matches))
def dict_as_json(data: Dict[str, Any]) -> str:
return json.dumps(data, indent=2, sort_keys=True)
def json_as_dict(data: str) -> Dict[str, Any]:
return json.loads(data)
def hashid_as_path(hashid: str, parts: int = 1, length: int = 2) -> str:
return "/".join(
filter(
bool,
[
hashid[(i * length) : (i * length) + length]
for i in range(parts)
]
+ [hashid[(parts * length) :]],
)
)
def string_as_hashid(string: str) -> str:
sha256_hash = sha256()
sha256_hash.update(string.encode("utf-8"))
return sha256_hash.hexdigest()
def dict_as_hashid(data: Dict[str, Any]) -> str:
return string_as_hashid(dict_as_json(data))
def file_as_hashid(path: Path) -> str:
sha256_hash = sha256()
with open(str(path), "rb") as f:
# Read and update hash string value in blocks of 4K
for byte_block in iter(lambda: f.read(4096), b""):
sha256_hash.update(byte_block)
return sha256_hash.hexdigest()
def bytes_as_hashid(buffer: bytes) -> str:
sha256_hash = sha256()
sha256_hash.update(buffer)
return sha256_hash.hexdigest()
| 21.987179 | 72 | 0.629738 | 236 | 1,715 | 4.411017 | 0.34322 | 0.086455 | 0.038425 | 0.054755 | 0.165226 | 0.111431 | 0.067243 | 0 | 0 | 0 | 0 | 0.036895 | 0.241399 | 1,715 | 77 | 73 | 22.272727 | 0.763259 | 0.028571 | 0 | 0.130435 | 0 | 0 | 0.008413 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217391 | false | 0 | 0.130435 | 0.108696 | 0.543478 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c68cd790142c78f93f33db014e088d26ea105440 | 94 | py | Python | examp.py | Gerrydh/Algor | de9a63421b21876f61af49749e76e14dd57e233b | [
"Apache-2.0"
] | null | null | null | examp.py | Gerrydh/Algor | de9a63421b21876f61af49749e76e14dd57e233b | [
"Apache-2.0"
] | null | null | null | examp.py | Gerrydh/Algor | de9a63421b21876f61af49749e76e14dd57e233b | [
"Apache-2.0"
] | null | null | null | def count(index):
print(index)
if index < 2:
count(index + 1)
count(0)
| 13.428571 | 25 | 0.510638 | 13 | 94 | 3.692308 | 0.615385 | 0.416667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05 | 0.361702 | 94 | 6 | 26 | 15.666667 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c6c88706cf8572c9325b52fd70a4a39a925d3d8c | 379 | py | Python | wsgi.py | youralphadevelopers/RedditClone | 14f652fd5f57bb31d6910d0d078c9765b4e3e25e | [
"MIT"
] | null | null | null | wsgi.py | youralphadevelopers/RedditClone | 14f652fd5f57bb31d6910d0d078c9765b4e3e25e | [
"MIT"
] | null | null | null | wsgi.py | youralphadevelopers/RedditClone | 14f652fd5f57bb31d6910d0d078c9765b4e3e25e | [
"MIT"
] | null | null | null | from app import create_app, db
from app.models import User, Reply
app = create_app('default')
@app.shell_context_processor
def make_shell_context():
return dict(db=db)
# @app.context_processor
# def get_votes(reply):
# replies = ReplyVote.query.filter_by(reply_id=reply.id).all()
# sum = 0
# for reply in replies:
# sum += reply.count
# return sum
| 22.294118 | 66 | 0.691293 | 56 | 379 | 4.5 | 0.535714 | 0.055556 | 0.150794 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003279 | 0.195251 | 379 | 16 | 67 | 23.6875 | 0.822951 | 0.498681 | 0 | 0 | 0 | 0 | 0.038462 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.166667 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
c6d0b91807ca98b540f4291945f4bf28d620f497 | 21,331 | py | Python | python/bbgo_pb2.py | Yukaii/bbgo | 1f1fcdedc450901f9f9dc99bc58eab262003c126 | [
"MIT"
] | null | null | null | python/bbgo_pb2.py | Yukaii/bbgo | 1f1fcdedc450901f9f9dc99bc58eab262003c126 | [
"MIT"
] | null | null | null | python/bbgo_pb2.py | Yukaii/bbgo | 1f1fcdedc450901f9f9dc99bc58eab262003c126 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bbgo.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nbbgo.proto\x12\x04\x62\x62go\"\x07\n\x05\x45mpty\"2\n\x05\x45rror\x12\x12\n\nerror_code\x18\x01 \x01(\x03\x12\x15\n\rerror_message\x18\x02 \x01(\t\"\"\n\x0fUserDataRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\"\xc4\x01\n\x08UserData\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x1e\n\x07\x63hannel\x18\x03 \x01(\x0e\x32\r.bbgo.Channel\x12\x1a\n\x05\x65vent\x18\x04 \x01(\x0e\x32\x0b.bbgo.Event\x12\x1f\n\x08\x62\x61lances\x18\x05 \x03(\x0b\x32\r.bbgo.Balance\x12\x1b\n\x06trades\x18\x06 \x03(\x0b\x32\x0b.bbgo.Trade\x12\x1b\n\x06orders\x18\x07 \x03(\x0b\x32\x0b.bbgo.Order\"=\n\x10SubscribeRequest\x12)\n\rsubscriptions\x18\x01 \x03(\x0b\x32\x12.bbgo.Subscription\"q\n\x0cSubscription\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x1e\n\x07\x63hannel\x18\x02 \x01(\x0e\x32\r.bbgo.Channel\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\r\n\x05\x64\x65pth\x18\x04 \x01(\t\x12\x10\n\x08interval\x18\x05 \x01(\t\"\xa1\x02\n\nMarketData\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x1e\n\x07\x63hannel\x18\x04 \x01(\x0e\x32\r.bbgo.Channel\x12\x1a\n\x05\x65vent\x18\x05 \x01(\x0e\x32\x0b.bbgo.Event\x12\x1a\n\x05\x64\x65pth\x18\x06 \x01(\x0b\x32\x0b.bbgo.Depth\x12\x1a\n\x05kline\x18\x07 \x01(\x0b\x32\x0b.bbgo.KLine\x12\x1c\n\x06ticker\x18\t \x01(\x0b\x32\x0c.bbgo.Ticker\x12\x1b\n\x06trades\x18\x08 \x03(\x0b\x32\x0b.bbgo.Trade\x12\x15\n\rsubscribed_at\x18\x0c \x01(\x03\x12\x1a\n\x05\x65rror\x18\r \x01(\x0b\x32\x0b.bbgo.Error\"k\n\x05\x44\x65pth\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x1f\n\x04\x61sks\x18\x03 \x03(\x0b\x32\x11.bbgo.PriceVolume\x12\x1f\n\x04\x62ids\x18\x04 \x03(\x0b\x32\x11.bbgo.PriceVolume\",\n\x0bPriceVolume\x12\r\n\x05price\x18\x01 \x01(\t\x12\x0e\n\x06volume\x18\x02 \x01(\t\"\xc7\x01\n\x05Trade\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\n\n\x02id\x18\x04 \x01(\t\x12\r\n\x05price\x18\x05 \x01(\t\x12\x10\n\x08quantity\x18\x06 \x01(\t\x12\x12\n\ncreated_at\x18\x07 \x01(\x03\x12\x18\n\x04side\x18\x08 \x01(\x0e\x32\n.bbgo.Side\x12\x14\n\x0c\x66\x65\x65_currency\x18\t \x01(\t\x12\x0b\n\x03\x66\x65\x65\x18\n \x01(\t\x12\r\n\x05maker\x18\x0b \x01(\x08\"r\n\x06Ticker\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x0c\n\x04open\x18\x03 \x01(\x01\x12\x0c\n\x04high\x18\x04 \x01(\x01\x12\x0b\n\x03low\x18\x05 \x01(\x01\x12\r\n\x05\x63lose\x18\x06 \x01(\x01\x12\x0e\n\x06volume\x18\x07 \x01(\x01\"\x93\x02\n\x05Order\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\n\n\x02id\x18\x03 \x01(\t\x12\x18\n\x04side\x18\x04 \x01(\x0e\x32\n.bbgo.Side\x12#\n\norder_type\x18\x05 \x01(\x0e\x32\x0f.bbgo.OrderType\x12\r\n\x05price\x18\x06 \x01(\t\x12\x12\n\nstop_price\x18\x07 \x01(\t\x12\x0e\n\x06status\x18\t \x01(\t\x12\x10\n\x08quantity\x18\x0b \x01(\t\x12\x19\n\x11\x65xecuted_quantity\x18\x0c \x01(\t\x12\x17\n\x0f\x63lient_order_id\x18\x0e \x01(\t\x12\x10\n\x08group_id\x18\x0f \x01(\x03\x12\x12\n\ncreated_at\x18\n \x01(\x03\"\xdf\x01\n\x0bSubmitOrder\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x18\n\x04side\x18\x04 \x01(\x0e\x32\n.bbgo.Side\x12\r\n\x05price\x18\x06 \x01(\t\x12\x10\n\x08quantity\x18\x05 \x01(\t\x12\x12\n\nstop_price\x18\x07 \x01(\t\x12#\n\norder_type\x18\x08 \x01(\x0e\x32\x0f.bbgo.OrderType\x12\x17\n\x0f\x63lient_order_id\x18\t \x01(\t\x12\x10\n\x08group_id\x18\n \x01(\x03\"s\n\x07\x42\x61lance\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x10\n\x08\x63urrency\x18\x03 \x01(\t\x12\x11\n\tavailable\x18\x04 \x01(\t\x12\x0e\n\x06locked\x18\x05 \x01(\t\x12\x10\n\x08\x62orrowed\x18\x06 \x01(\t\"O\n\x12SubmitOrderRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12(\n\rsubmit_orders\x18\x02 \x03(\x0b\x32\x11.bbgo.SubmitOrder\"_\n\x13SubmitOrderResponse\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x1b\n\x06orders\x18\x02 \x03(\x0b\x32\x0b.bbgo.Order\x12\x1a\n\x05\x65rror\x18\x03 \x01(\x0b\x32\x0b.bbgo.Error\"P\n\x12\x43\x61ncelOrderRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08order_id\x18\x02 \x01(\t\x12\x17\n\x0f\x63lient_order_id\x18\x03 \x01(\t\"M\n\x13\x43\x61ncelOrderResponse\x12\x1a\n\x05order\x18\x01 \x01(\x0b\x32\x0b.bbgo.Order\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"I\n\x11QueryOrderRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\t\x12\x17\n\x0f\x63lient_order_id\x18\x03 \x01(\t\"L\n\x12QueryOrderResponse\x12\x1a\n\x05order\x18\x01 \x01(\x0b\x32\x0b.bbgo.Order\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"\xa9\x01\n\x12QueryOrdersRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\r\n\x05state\x18\x03 \x03(\t\x12\x10\n\x08order_by\x18\x04 \x01(\t\x12\x10\n\x08group_id\x18\x05 \x01(\x03\x12\x12\n\npagination\x18\x06 \x01(\x08\x12\x0c\n\x04page\x18\x07 \x01(\x03\x12\r\n\x05limit\x18\x08 \x01(\x03\x12\x0e\n\x06offset\x18\t \x01(\x03\"N\n\x13QueryOrdersResponse\x12\x1b\n\x06orders\x18\x01 \x03(\x0b\x32\x0b.bbgo.Order\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"\xb6\x01\n\x12QueryTradesRequest\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x11\n\ttimestamp\x18\x03 \x01(\x03\x12\x0c\n\x04\x66rom\x18\x04 \x01(\x03\x12\n\n\x02to\x18\x05 \x01(\x03\x12\x10\n\x08order_by\x18\x06 \x01(\t\x12\x12\n\npagination\x18\x07 \x01(\x08\x12\x0c\n\x04page\x18\x08 \x01(\x03\x12\r\n\x05limit\x18\t \x01(\x03\x12\x0e\n\x06offset\x18\n \x01(\x03\"N\n\x13QueryTradesResponse\x12\x1b\n\x06trades\x18\x01 \x03(\x0b\x32\x0b.bbgo.Trade\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"}\n\x12QueryKLinesRequest\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x10\n\x08interval\x18\x03 \x01(\t\x12\x12\n\nstart_time\x18\x04 \x01(\x03\x12\x10\n\x08\x65nd_time\x18\x05 \x01(\x03\x12\r\n\x05limit\x18\x06 \x01(\x03\"N\n\x13QueryKLinesResponse\x12\x1b\n\x06klines\x18\x01 \x03(\x0b\x32\x0b.bbgo.KLine\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"\xce\x01\n\x05KLine\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x0c\n\x04open\x18\x04 \x01(\t\x12\x0c\n\x04high\x18\x05 \x01(\t\x12\x0b\n\x03low\x18\x06 \x01(\t\x12\r\n\x05\x63lose\x18\x07 \x01(\t\x12\x0e\n\x06volume\x18\x08 \x01(\t\x12\x14\n\x0cquote_volume\x18\t \x01(\t\x12\x12\n\nstart_time\x18\n \x01(\x03\x12\x10\n\x08\x65nd_time\x18\x0b \x01(\x03\x12\x0e\n\x06\x63losed\x18\x0c \x01(\x08*n\n\x05\x45vent\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0e\n\nSUBSCRIBED\x10\x01\x12\x10\n\x0cUNSUBSCRIBED\x10\x02\x12\x0c\n\x08SNAPSHOT\x10\x03\x12\n\n\x06UPDATE\x10\x04\x12\x11\n\rAUTHENTICATED\x10\x05\x12\t\n\x05\x45RROR\x10\x63*M\n\x07\x43hannel\x12\x08\n\x04\x42OOK\x10\x00\x12\t\n\x05TRADE\x10\x01\x12\n\n\x06TICKER\x10\x02\x12\t\n\x05KLINE\x10\x03\x12\x0b\n\x07\x42\x41LANCE\x10\x04\x12\t\n\x05ORDER\x10\x05*\x19\n\x04Side\x12\x07\n\x03\x42UY\x10\x00\x12\x08\n\x04SELL\x10\x01*a\n\tOrderType\x12\n\n\x06MARKET\x10\x00\x12\t\n\x05LIMIT\x10\x01\x12\x0f\n\x0bSTOP_MARKET\x10\x02\x12\x0e\n\nSTOP_LIMIT\x10\x03\x12\r\n\tPOST_ONLY\x10\x04\x12\r\n\tIOC_LIMIT\x10\x05\x32\x94\x01\n\x11MarketDataService\x12\x39\n\tSubscribe\x12\x16.bbgo.SubscribeRequest\x1a\x10.bbgo.MarketData\"\x00\x30\x01\x12\x44\n\x0bQueryKLines\x12\x18.bbgo.QueryKLinesRequest\x1a\x19.bbgo.QueryKLinesResponse\"\x00\x32I\n\x0fUserDataService\x12\x36\n\tSubscribe\x12\x15.bbgo.UserDataRequest\x1a\x0e.bbgo.UserData\"\x00\x30\x01\x32\xeb\x02\n\x0eTradingService\x12\x44\n\x0bSubmitOrder\x12\x18.bbgo.SubmitOrderRequest\x1a\x19.bbgo.SubmitOrderResponse\"\x00\x12\x44\n\x0b\x43\x61ncelOrder\x12\x18.bbgo.CancelOrderRequest\x1a\x19.bbgo.CancelOrderResponse\"\x00\x12\x41\n\nQueryOrder\x12\x17.bbgo.QueryOrderRequest\x1a\x18.bbgo.QueryOrderResponse\"\x00\x12\x44\n\x0bQueryOrders\x12\x18.bbgo.QueryOrdersRequest\x1a\x19.bbgo.QueryOrdersResponse\"\x00\x12\x44\n\x0bQueryTrades\x12\x18.bbgo.QueryTradesRequest\x1a\x19.bbgo.QueryTradesResponse\"\x00\x42\x07Z\x05../pbb\x06proto3')
_EVENT = DESCRIPTOR.enum_types_by_name['Event']
Event = enum_type_wrapper.EnumTypeWrapper(_EVENT)
_CHANNEL = DESCRIPTOR.enum_types_by_name['Channel']
Channel = enum_type_wrapper.EnumTypeWrapper(_CHANNEL)
_SIDE = DESCRIPTOR.enum_types_by_name['Side']
Side = enum_type_wrapper.EnumTypeWrapper(_SIDE)
_ORDERTYPE = DESCRIPTOR.enum_types_by_name['OrderType']
OrderType = enum_type_wrapper.EnumTypeWrapper(_ORDERTYPE)
UNKNOWN = 0
SUBSCRIBED = 1
UNSUBSCRIBED = 2
SNAPSHOT = 3
UPDATE = 4
AUTHENTICATED = 5
ERROR = 99
BOOK = 0
TRADE = 1
TICKER = 2
KLINE = 3
BALANCE = 4
ORDER = 5
BUY = 0
SELL = 1
MARKET = 0
LIMIT = 1
STOP_MARKET = 2
STOP_LIMIT = 3
POST_ONLY = 4
IOC_LIMIT = 5
_EMPTY = DESCRIPTOR.message_types_by_name['Empty']
_ERROR = DESCRIPTOR.message_types_by_name['Error']
_USERDATAREQUEST = DESCRIPTOR.message_types_by_name['UserDataRequest']
_USERDATA = DESCRIPTOR.message_types_by_name['UserData']
_SUBSCRIBEREQUEST = DESCRIPTOR.message_types_by_name['SubscribeRequest']
_SUBSCRIPTION = DESCRIPTOR.message_types_by_name['Subscription']
_MARKETDATA = DESCRIPTOR.message_types_by_name['MarketData']
_DEPTH = DESCRIPTOR.message_types_by_name['Depth']
_PRICEVOLUME = DESCRIPTOR.message_types_by_name['PriceVolume']
_TRADE = DESCRIPTOR.message_types_by_name['Trade']
_TICKER = DESCRIPTOR.message_types_by_name['Ticker']
_ORDER = DESCRIPTOR.message_types_by_name['Order']
_SUBMITORDER = DESCRIPTOR.message_types_by_name['SubmitOrder']
_BALANCE = DESCRIPTOR.message_types_by_name['Balance']
_SUBMITORDERREQUEST = DESCRIPTOR.message_types_by_name['SubmitOrderRequest']
_SUBMITORDERRESPONSE = DESCRIPTOR.message_types_by_name['SubmitOrderResponse']
_CANCELORDERREQUEST = DESCRIPTOR.message_types_by_name['CancelOrderRequest']
_CANCELORDERRESPONSE = DESCRIPTOR.message_types_by_name['CancelOrderResponse']
_QUERYORDERREQUEST = DESCRIPTOR.message_types_by_name['QueryOrderRequest']
_QUERYORDERRESPONSE = DESCRIPTOR.message_types_by_name['QueryOrderResponse']
_QUERYORDERSREQUEST = DESCRIPTOR.message_types_by_name['QueryOrdersRequest']
_QUERYORDERSRESPONSE = DESCRIPTOR.message_types_by_name['QueryOrdersResponse']
_QUERYTRADESREQUEST = DESCRIPTOR.message_types_by_name['QueryTradesRequest']
_QUERYTRADESRESPONSE = DESCRIPTOR.message_types_by_name['QueryTradesResponse']
_QUERYKLINESREQUEST = DESCRIPTOR.message_types_by_name['QueryKLinesRequest']
_QUERYKLINESRESPONSE = DESCRIPTOR.message_types_by_name['QueryKLinesResponse']
_KLINE = DESCRIPTOR.message_types_by_name['KLine']
Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), {
'DESCRIPTOR' : _EMPTY,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.Empty)
})
_sym_db.RegisterMessage(Empty)
Error = _reflection.GeneratedProtocolMessageType('Error', (_message.Message,), {
'DESCRIPTOR' : _ERROR,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.Error)
})
_sym_db.RegisterMessage(Error)
UserDataRequest = _reflection.GeneratedProtocolMessageType('UserDataRequest', (_message.Message,), {
'DESCRIPTOR' : _USERDATAREQUEST,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.UserDataRequest)
})
_sym_db.RegisterMessage(UserDataRequest)
UserData = _reflection.GeneratedProtocolMessageType('UserData', (_message.Message,), {
'DESCRIPTOR' : _USERDATA,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.UserData)
})
_sym_db.RegisterMessage(UserData)
SubscribeRequest = _reflection.GeneratedProtocolMessageType('SubscribeRequest', (_message.Message,), {
'DESCRIPTOR' : _SUBSCRIBEREQUEST,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.SubscribeRequest)
})
_sym_db.RegisterMessage(SubscribeRequest)
Subscription = _reflection.GeneratedProtocolMessageType('Subscription', (_message.Message,), {
'DESCRIPTOR' : _SUBSCRIPTION,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.Subscription)
})
_sym_db.RegisterMessage(Subscription)
MarketData = _reflection.GeneratedProtocolMessageType('MarketData', (_message.Message,), {
'DESCRIPTOR' : _MARKETDATA,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.MarketData)
})
_sym_db.RegisterMessage(MarketData)
Depth = _reflection.GeneratedProtocolMessageType('Depth', (_message.Message,), {
'DESCRIPTOR' : _DEPTH,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.Depth)
})
_sym_db.RegisterMessage(Depth)
PriceVolume = _reflection.GeneratedProtocolMessageType('PriceVolume', (_message.Message,), {
'DESCRIPTOR' : _PRICEVOLUME,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.PriceVolume)
})
_sym_db.RegisterMessage(PriceVolume)
Trade = _reflection.GeneratedProtocolMessageType('Trade', (_message.Message,), {
'DESCRIPTOR' : _TRADE,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.Trade)
})
_sym_db.RegisterMessage(Trade)
Ticker = _reflection.GeneratedProtocolMessageType('Ticker', (_message.Message,), {
'DESCRIPTOR' : _TICKER,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.Ticker)
})
_sym_db.RegisterMessage(Ticker)
Order = _reflection.GeneratedProtocolMessageType('Order', (_message.Message,), {
'DESCRIPTOR' : _ORDER,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.Order)
})
_sym_db.RegisterMessage(Order)
SubmitOrder = _reflection.GeneratedProtocolMessageType('SubmitOrder', (_message.Message,), {
'DESCRIPTOR' : _SUBMITORDER,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.SubmitOrder)
})
_sym_db.RegisterMessage(SubmitOrder)
Balance = _reflection.GeneratedProtocolMessageType('Balance', (_message.Message,), {
'DESCRIPTOR' : _BALANCE,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.Balance)
})
_sym_db.RegisterMessage(Balance)
SubmitOrderRequest = _reflection.GeneratedProtocolMessageType('SubmitOrderRequest', (_message.Message,), {
'DESCRIPTOR' : _SUBMITORDERREQUEST,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.SubmitOrderRequest)
})
_sym_db.RegisterMessage(SubmitOrderRequest)
SubmitOrderResponse = _reflection.GeneratedProtocolMessageType('SubmitOrderResponse', (_message.Message,), {
'DESCRIPTOR' : _SUBMITORDERRESPONSE,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.SubmitOrderResponse)
})
_sym_db.RegisterMessage(SubmitOrderResponse)
CancelOrderRequest = _reflection.GeneratedProtocolMessageType('CancelOrderRequest', (_message.Message,), {
'DESCRIPTOR' : _CANCELORDERREQUEST,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.CancelOrderRequest)
})
_sym_db.RegisterMessage(CancelOrderRequest)
CancelOrderResponse = _reflection.GeneratedProtocolMessageType('CancelOrderResponse', (_message.Message,), {
'DESCRIPTOR' : _CANCELORDERRESPONSE,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.CancelOrderResponse)
})
_sym_db.RegisterMessage(CancelOrderResponse)
QueryOrderRequest = _reflection.GeneratedProtocolMessageType('QueryOrderRequest', (_message.Message,), {
'DESCRIPTOR' : _QUERYORDERREQUEST,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.QueryOrderRequest)
})
_sym_db.RegisterMessage(QueryOrderRequest)
QueryOrderResponse = _reflection.GeneratedProtocolMessageType('QueryOrderResponse', (_message.Message,), {
'DESCRIPTOR' : _QUERYORDERRESPONSE,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.QueryOrderResponse)
})
_sym_db.RegisterMessage(QueryOrderResponse)
QueryOrdersRequest = _reflection.GeneratedProtocolMessageType('QueryOrdersRequest', (_message.Message,), {
'DESCRIPTOR' : _QUERYORDERSREQUEST,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.QueryOrdersRequest)
})
_sym_db.RegisterMessage(QueryOrdersRequest)
QueryOrdersResponse = _reflection.GeneratedProtocolMessageType('QueryOrdersResponse', (_message.Message,), {
'DESCRIPTOR' : _QUERYORDERSRESPONSE,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.QueryOrdersResponse)
})
_sym_db.RegisterMessage(QueryOrdersResponse)
QueryTradesRequest = _reflection.GeneratedProtocolMessageType('QueryTradesRequest', (_message.Message,), {
'DESCRIPTOR' : _QUERYTRADESREQUEST,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.QueryTradesRequest)
})
_sym_db.RegisterMessage(QueryTradesRequest)
QueryTradesResponse = _reflection.GeneratedProtocolMessageType('QueryTradesResponse', (_message.Message,), {
'DESCRIPTOR' : _QUERYTRADESRESPONSE,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.QueryTradesResponse)
})
_sym_db.RegisterMessage(QueryTradesResponse)
QueryKLinesRequest = _reflection.GeneratedProtocolMessageType('QueryKLinesRequest', (_message.Message,), {
'DESCRIPTOR' : _QUERYKLINESREQUEST,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.QueryKLinesRequest)
})
_sym_db.RegisterMessage(QueryKLinesRequest)
QueryKLinesResponse = _reflection.GeneratedProtocolMessageType('QueryKLinesResponse', (_message.Message,), {
'DESCRIPTOR' : _QUERYKLINESRESPONSE,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.QueryKLinesResponse)
})
_sym_db.RegisterMessage(QueryKLinesResponse)
KLine = _reflection.GeneratedProtocolMessageType('KLine', (_message.Message,), {
'DESCRIPTOR' : _KLINE,
'__module__' : 'bbgo_pb2'
# @@protoc_insertion_point(class_scope:bbgo.KLine)
})
_sym_db.RegisterMessage(KLine)
_MARKETDATASERVICE = DESCRIPTOR.services_by_name['MarketDataService']
_USERDATASERVICE = DESCRIPTOR.services_by_name['UserDataService']
_TRADINGSERVICE = DESCRIPTOR.services_by_name['TradingService']
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'Z\005../pb'
_EVENT._serialized_start=3305
_EVENT._serialized_end=3415
_CHANNEL._serialized_start=3417
_CHANNEL._serialized_end=3494
_SIDE._serialized_start=3496
_SIDE._serialized_end=3521
_ORDERTYPE._serialized_start=3523
_ORDERTYPE._serialized_end=3620
_EMPTY._serialized_start=20
_EMPTY._serialized_end=27
_ERROR._serialized_start=29
_ERROR._serialized_end=79
_USERDATAREQUEST._serialized_start=81
_USERDATAREQUEST._serialized_end=115
_USERDATA._serialized_start=118
_USERDATA._serialized_end=314
_SUBSCRIBEREQUEST._serialized_start=316
_SUBSCRIBEREQUEST._serialized_end=377
_SUBSCRIPTION._serialized_start=379
_SUBSCRIPTION._serialized_end=492
_MARKETDATA._serialized_start=495
_MARKETDATA._serialized_end=784
_DEPTH._serialized_start=786
_DEPTH._serialized_end=893
_PRICEVOLUME._serialized_start=895
_PRICEVOLUME._serialized_end=939
_TRADE._serialized_start=942
_TRADE._serialized_end=1141
_TICKER._serialized_start=1143
_TICKER._serialized_end=1257
_ORDER._serialized_start=1260
_ORDER._serialized_end=1535
_SUBMITORDER._serialized_start=1538
_SUBMITORDER._serialized_end=1761
_BALANCE._serialized_start=1763
_BALANCE._serialized_end=1878
_SUBMITORDERREQUEST._serialized_start=1880
_SUBMITORDERREQUEST._serialized_end=1959
_SUBMITORDERRESPONSE._serialized_start=1961
_SUBMITORDERRESPONSE._serialized_end=2056
_CANCELORDERREQUEST._serialized_start=2058
_CANCELORDERREQUEST._serialized_end=2138
_CANCELORDERRESPONSE._serialized_start=2140
_CANCELORDERRESPONSE._serialized_end=2217
_QUERYORDERREQUEST._serialized_start=2219
_QUERYORDERREQUEST._serialized_end=2292
_QUERYORDERRESPONSE._serialized_start=2294
_QUERYORDERRESPONSE._serialized_end=2370
_QUERYORDERSREQUEST._serialized_start=2373
_QUERYORDERSREQUEST._serialized_end=2542
_QUERYORDERSRESPONSE._serialized_start=2544
_QUERYORDERSRESPONSE._serialized_end=2622
_QUERYTRADESREQUEST._serialized_start=2625
_QUERYTRADESREQUEST._serialized_end=2807
_QUERYTRADESRESPONSE._serialized_start=2809
_QUERYTRADESRESPONSE._serialized_end=2887
_QUERYKLINESREQUEST._serialized_start=2889
_QUERYKLINESREQUEST._serialized_end=3014
_QUERYKLINESRESPONSE._serialized_start=3016
_QUERYKLINESRESPONSE._serialized_end=3094
_KLINE._serialized_start=3097
_KLINE._serialized_end=3303
_MARKETDATASERVICE._serialized_start=3623
_MARKETDATASERVICE._serialized_end=3771
_USERDATASERVICE._serialized_start=3773
_USERDATASERVICE._serialized_end=3846
_TRADINGSERVICE._serialized_start=3849
_TRADINGSERVICE._serialized_end=4212
# @@protoc_insertion_point(module_scope)
| 62.189504 | 8,256 | 0.790962 | 2,969 | 21,331 | 5.423712 | 0.124284 | 0.018133 | 0.02869 | 0.040241 | 0.362541 | 0.267714 | 0.25045 | 0.206732 | 0.192324 | 0.102714 | 0 | 0.125087 | 0.058928 | 21,331 | 342 | 8,257 | 62.371345 | 0.677095 | 0.081431 | 0 | 0.197802 | 1 | 0.003663 | 0.497162 | 0.411924 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.021978 | 0 | 0.021978 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c6f951ac482a5b94ae35c48c565523df7e3ce1c9 | 3,293 | py | Python | tests/exchange_tests.py | AndTornes/rabbitpy | 0b805f308c868ae69825cb6366e2b0a1e74c1f2b | [
"BSD-3-Clause"
] | 149 | 2015-01-08T21:55:20.000Z | 2022-02-28T10:43:53.000Z | tests/exchange_tests.py | AndTornes/rabbitpy | 0b805f308c868ae69825cb6366e2b0a1e74c1f2b | [
"BSD-3-Clause"
] | 71 | 2015-01-04T22:28:56.000Z | 2022-02-06T09:23:30.000Z | tests/exchange_tests.py | AndTornes/rabbitpy | 0b805f308c868ae69825cb6366e2b0a1e74c1f2b | [
"BSD-3-Clause"
] | 56 | 2015-01-07T11:06:05.000Z | 2022-03-18T08:45:40.000Z | """
Test the rabbitpy.exchange classes
"""
import mock
from pamqp import specification
from rabbitpy import exchange
from . import helpers
class TxTests(helpers.TestCase):
@mock.patch('rabbitpy.exchange.Exchange._rpc')
def test_bind_sends_exchange_declare(self, rpc):
rpc.return_value = specification.Exchange.DeclareOk
obj = exchange.Exchange(self.channel, 'foo')
obj.declare()
self.assertIsInstance(rpc.mock_calls[0][1][0],
specification.Exchange.Declare)
@mock.patch('rabbitpy.exchange.Exchange._rpc')
def test_bind_sends_exchange_delete(self, rpc):
rpc.return_value = specification.Exchange.DeleteOk
obj = exchange.Exchange(self.channel, 'foo')
obj.delete()
self.assertIsInstance(rpc.mock_calls[0][1][0],
specification.Exchange.Delete)
@mock.patch('rabbitpy.exchange.Exchange._rpc')
def test_bind_sends_exchange_bind(self, rpc):
rpc.return_value = specification.Exchange.BindOk
obj = exchange.Exchange(self.channel, 'foo')
obj.bind('a', 'b')
self.assertIsInstance(rpc.mock_calls[0][1][0],
specification.Exchange.Bind)
@mock.patch('rabbitpy.exchange.Exchange._rpc')
def test_bind_sends_exchange_unbind(self, rpc):
rpc.return_value = specification.Exchange.UnbindOk
obj = exchange.Exchange(self.channel, 'foo')
obj.unbind('a', 'b')
self.assertIsInstance(rpc.mock_calls[0][1][0],
specification.Exchange.Unbind)
@mock.patch('rabbitpy.exchange.Exchange._rpc')
def test_bind_sends_exchange_bind_obj(self, rpc):
rpc.return_value = specification.Exchange.BindOk
obj = exchange.Exchange(self.channel, 'foo')
val = mock.Mock()
val.name = 'bar'
obj.bind(val, 'b')
self.assertIsInstance(rpc.mock_calls[0][1][0],
specification.Exchange.Bind)
@mock.patch('rabbitpy.exchange.Exchange._rpc')
def test_bind_sends_exchange_unbind_obj(self, rpc):
rpc.return_value = specification.Exchange.UnbindOk
obj = exchange.Exchange(self.channel, 'foo')
val = mock.Mock()
val.name = 'bar'
obj.unbind(val, 'b')
self.assertIsInstance(rpc.mock_calls[0][1][0],
specification.Exchange.Unbind)
class DirectExchangeCreationTests(helpers.TestCase):
def test_init_creates_direct_exchange(self):
obj = exchange.DirectExchange(self.channel, 'direct-test')
self.assertEqual(obj.type, 'direct')
class FanoutExchangeCreationTests(helpers.TestCase):
def test_init_creates_direct_exchange(self):
obj = exchange.FanoutExchange(self.channel, 'fanout-test')
self.assertEqual(obj.type, 'fanout')
class HeadersExchangeCreationTests(helpers.TestCase):
def test_init_creates_direct_exchange(self):
obj = exchange.HeadersExchange(self.channel, 'headers-test')
self.assertEqual(obj.type, 'headers')
class TopicExchangeCreationTests(helpers.TestCase):
def test_init_creates_direct_exchange(self):
obj = exchange.TopicExchange(self.channel, 'topic-test')
self.assertEqual(obj.type, 'topic')
| 35.031915 | 68 | 0.666262 | 370 | 3,293 | 5.767568 | 0.154054 | 0.089972 | 0.047798 | 0.070291 | 0.770384 | 0.721649 | 0.721649 | 0.645736 | 0.642924 | 0.642924 | 0 | 0.006988 | 0.217735 | 3,293 | 93 | 69 | 35.408602 | 0.821429 | 0.010325 | 0 | 0.507463 | 0 | 0 | 0.087385 | 0.057231 | 0 | 0 | 0 | 0 | 0.149254 | 1 | 0.149254 | false | 0 | 0.059701 | 0 | 0.283582 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c6f9f93a8d7edc08d1629c9af8d5173f61f8a94f | 223 | py | Python | api/helper/__init__.py | matchd-ch/matchd-backend | 84be4aab1b4708cae50a8988301b15df877c8db0 | [
"Apache-2.0"
] | 1 | 2022-03-03T09:55:57.000Z | 2022-03-03T09:55:57.000Z | api/helper/__init__.py | matchd-ch/matchd-backend | 84be4aab1b4708cae50a8988301b15df877c8db0 | [
"Apache-2.0"
] | 7 | 2022-02-09T10:44:53.000Z | 2022-03-28T03:29:43.000Z | api/helper/__init__.py | matchd-ch/matchd-backend | 84be4aab1b4708cae50a8988301b15df877c8db0 | [
"Apache-2.0"
] | null | null | null | from .admin_notification import notify_managers_new_user_registration
from .query import is_me_query
from .relay import extract_ids, resolve_node_id, resolve_node_ids
from .user_request_email import send_user_request_email
| 44.6 | 69 | 0.892377 | 35 | 223 | 5.2 | 0.6 | 0.120879 | 0.175824 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.080717 | 223 | 4 | 70 | 55.75 | 0.887805 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
059c23587051c7c92c152a857188771f5832dca3 | 2,413 | py | Python | infra/base-images/base-msan-builder/packages/package.py | rbehjati/oss-fuzz | a31e58fb5c9984915fdc79610660b326df20b937 | [
"Apache-2.0"
] | 17 | 2019-05-20T18:29:33.000Z | 2021-10-10T08:20:01.000Z | infra/base-images/base-msan-builder/packages/package.py | rbehjati/oss-fuzz | a31e58fb5c9984915fdc79610660b326df20b937 | [
"Apache-2.0"
] | 10 | 2020-08-06T11:48:16.000Z | 2021-06-28T10:17:12.000Z | infra/base-images/base-msan-builder/packages/package.py | rbehjati/oss-fuzz | a31e58fb5c9984915fdc79610660b326df20b937 | [
"Apache-2.0"
] | 2 | 2019-08-13T12:58:14.000Z | 2021-03-24T08:21:42.000Z | #!/usr/bin/env python
# Copyright 2017 Google Inc.
#
# 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.
#
################################################################################
import os
import subprocess
import apt
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
def ApplyPatch(source_directory, patch_name):
"""Apply custom patch."""
subprocess.check_call(['patch', '-p1', '-i',
os.path.join(SCRIPT_DIR, patch_name)],
cwd=source_directory)
class PackageException(Exception):
"""Base package exception."""
class Package(object):
"""Base package."""
def __init__(self, name, apt_version):
self.name = name
self.apt_version = apt_version
def PreBuild(self, source_directory, env, custom_bin_dir):
return
def PostBuild(self, source_directory, env, custom_bin_dir):
return
def PreDownload(self, download_directory):
return
def PostDownload(self, source_directory):
return
def InstallBuildDeps(self):
"""Install build dependencies for a package."""
subprocess.check_call(['apt-get', 'update'])
subprocess.check_call(['apt-get', 'build-dep', '-y', self.name])
# Reload package after update.
self.apt_version = (
apt.Cache()[self.apt_version.package.name].candidate)
def DownloadSource(self, download_directory):
"""Download the source for a package."""
self.PreDownload(download_directory)
source_directory = self.apt_version.fetch_source(download_directory)
self.PostDownload(source_directory)
return source_directory
def Build(self, source_directory, env, custom_bin_dir):
"""Build .deb packages."""
self.PreBuild(source_directory, env, custom_bin_dir)
subprocess.check_call(
['dpkg-buildpackage', '-us', '-uc', '-B'],
cwd=source_directory, env=env)
self.PostBuild(source_directory, env, custom_bin_dir)
| 29.072289 | 80 | 0.683796 | 303 | 2,413 | 5.283828 | 0.412541 | 0.11243 | 0.067458 | 0.074953 | 0.14366 | 0.11243 | 0.074953 | 0.053716 | 0.053716 | 0 | 0 | 0.004523 | 0.1753 | 2,413 | 82 | 81 | 29.426829 | 0.8 | 0.312889 | 0 | 0.108108 | 0 | 0 | 0.043137 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.243243 | false | 0 | 0.081081 | 0.108108 | 0.513514 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
05c16c4740ea2a0bec27426337d8961531831659 | 162 | py | Python | tsukino/response.py | Linzolle/tsukino | 1be9dc6f053036d6eac7fac8b678c968ea9a53fc | [
"MIT"
] | 1 | 2016-10-18T23:04:53.000Z | 2016-10-18T23:04:53.000Z | tsukino/response.py | Linzolle/tsukino | 1be9dc6f053036d6eac7fac8b678c968ea9a53fc | [
"MIT"
] | null | null | null | tsukino/response.py | Linzolle/tsukino | 1be9dc6f053036d6eac7fac8b678c968ea9a53fc | [
"MIT"
] | 4 | 2016-11-30T19:27:37.000Z | 2018-12-24T07:18:43.000Z | class Response:
def __init__(self, content, private=False, file=False):
self.content = content
self.private = private
self.file = file | 32.4 | 59 | 0.641975 | 19 | 162 | 5.263158 | 0.473684 | 0.22 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.265432 | 162 | 5 | 60 | 32.4 | 0.840336 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
05ccfaad64c1d5b3a128e80e805a0f0bdd22e356 | 2,559 | py | Python | tests/integration/controllers/test_collection_exercise_static_functions.py | ONSdigital/ras-frontstage | e8ff1931b49cb3ab47b421aed6780e9e944dceea | [
"MIT"
] | 8 | 2017-06-30T12:32:02.000Z | 2022-02-25T09:07:28.000Z | tests/integration/controllers/test_collection_exercise_static_functions.py | ONSdigital/ras-frontstage | e8ff1931b49cb3ab47b421aed6780e9e944dceea | [
"MIT"
] | 256 | 2017-05-16T09:38:09.000Z | 2022-03-28T13:38:42.000Z | tests/integration/controllers/test_collection_exercise_static_functions.py | ONSdigital/ras-frontstage | e8ff1931b49cb3ab47b421aed6780e9e944dceea | [
"MIT"
] | 4 | 2017-09-29T08:58:36.000Z | 2021-04-11T07:44:27.000Z | import unittest
from datetime import datetime, timedelta
from frontstage.controllers.collection_exercise_controller import (
due_date_converter,
ordinal_date_formatter,
)
class TestCollectionExerciseStaticFunctions(unittest.TestCase):
def test_ordinal_date_formatter_for_st(self):
fist_jan = datetime(2009, 1, 1, 0, 0)
response = ordinal_date_formatter("{S} %B %Y, %H:%M", fist_jan)
self.assertEqual("1st January 2009, 00:00", response)
def test_ordinal_date_formatter_for_nd(self):
fist_jan = datetime(2009, 1, 2, 0, 0)
response = ordinal_date_formatter("{S} %B %Y, %H:%M", fist_jan)
self.assertEqual("2nd January 2009, 00:00", response)
def test_ordinal_date_formatter_for_th(self):
fist_jan = datetime(2009, 1, 20, 0, 0)
response = ordinal_date_formatter("{S} %B %Y, %H:%M", fist_jan)
self.assertEqual("20th January 2009, 00:00", response)
def test_due_date_convertor_for_today(self):
today = datetime.now() + timedelta(seconds=60)
response = due_date_converter(today)
self.assertEqual("Due today", response)
def test_due_date_convertor_for_tomorrow(self):
today = datetime.now() + timedelta(days=1)
response = due_date_converter(today)
self.assertEqual("Due tomorrow", response)
def test_due_date_convertor_for_days(self):
today = datetime.now() + timedelta(days=3)
response = due_date_converter(today)
self.assertEqual("Due in 2 days", response)
def test_due_date_convertor_for_a_month(self):
today = datetime.now() + timedelta(days=30)
response = due_date_converter(today)
self.assertEqual("Due in a month", response)
def test_due_date_convertor_for_two_month(self):
today = datetime.now() + timedelta(days=60)
response = due_date_converter(today)
self.assertEqual("Due in 2 months", response)
def test_due_date_convertor_for_three_month(self):
today = datetime.now() + timedelta(days=90)
response = due_date_converter(today)
self.assertEqual("Due in 3 months", response)
def test_due_date_convertor_for_over_three_month(self):
today = datetime.now() + timedelta(days=120)
response = due_date_converter(today)
self.assertEqual("Due in over 3 months", response)
def test_due_date_convertor_date_in_past(self):
today = datetime.now() - timedelta(days=120)
response = due_date_converter(today)
self.assertEqual(None, response)
| 39.369231 | 71 | 0.692458 | 337 | 2,559 | 4.976261 | 0.189911 | 0.07096 | 0.089445 | 0.085868 | 0.815742 | 0.79845 | 0.698271 | 0.542636 | 0.412045 | 0.320215 | 0 | 0.035837 | 0.203986 | 2,559 | 64 | 72 | 39.984375 | 0.787433 | 0 | 0 | 0.215686 | 0 | 0 | 0.084408 | 0 | 0 | 0 | 0 | 0 | 0.215686 | 1 | 0.215686 | false | 0 | 0.058824 | 0 | 0.294118 | 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 | 0 | 0 | 0 | 0 | 3 |
05cd458c7de9811bc6564f0be82bdb82bc4161b4 | 482 | py | Python | tammy/__init__.py | tpoisot/tammy | 0fbe0820c877fb06e1a95a38ab14099312b6a0cc | [
"BSD-2-Clause"
] | 2 | 2015-09-20T05:14:14.000Z | 2015-12-31T22:40:59.000Z | tammy/__init__.py | tpoisot/tammy | 0fbe0820c877fb06e1a95a38ab14099312b6a0cc | [
"BSD-2-Clause"
] | 1 | 2015-08-21T16:54:58.000Z | 2015-08-21T16:54:58.000Z | tammy/__init__.py | tpoisot/tammy | 0fbe0820c877fb06e1a95a38ab14099312b6a0cc | [
"BSD-2-Clause"
] | null | null | null | """
.. automodule:: tammy
"""
import os
from os.path import expanduser
from os.path import isfile
# TODO
# Validate ALL the things!!!
# citeprocjs-schema-url = "https://raw.githubusercontent.com/citation-style-language/schema/master/csl-data.json"
from .keygen import *
from tammy.classes import library, record
from tammy.services import from_crossref_doi, from_peerj
import tammy.IO
import tammy.cleanup
__all__ = ['library', 'record', 'IO', 'keygen', 'services' ,'keygen']
| 21.909091 | 113 | 0.746888 | 65 | 482 | 5.430769 | 0.569231 | 0.033994 | 0.056657 | 0.090652 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.120332 | 482 | 21 | 114 | 22.952381 | 0.832547 | 0.344398 | 0 | 0 | 0 | 0 | 0.114379 | 0 | 0 | 0 | 0 | 0.047619 | 0 | 1 | 0 | false | 0 | 0.888889 | 0 | 0.888889 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
05e2137441847a5d0871581e428d606bd8f861a4 | 311 | py | Python | WEEKS/wk17/CodeSignal-Solutions/39_-_knapsackLight.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/wk17/CodeSignal-Solutions/39_-_knapsackLight.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/wk17/CodeSignal-Solutions/39_-_knapsackLight.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | def knapsackLight(value1, weight1, value2, weight2, maxW):
if weight1 + weight2 <= maxW:
return value1 + value2
if weight1 <= maxW and (weight2 > maxW or value1 >= value2):
return value1
if weight2 <= maxW and (weight1 > maxW or value2 >= value1):
return value2
return 0
| 34.555556 | 64 | 0.633441 | 38 | 311 | 5.184211 | 0.315789 | 0.22335 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084444 | 0.276527 | 311 | 8 | 65 | 38.875 | 0.791111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
af627c13e5ac169c0c1ce77e4ec4186ad505094e | 50 | py | Python | example_snippets/multimenus_snippets/Snippets/SciPy/Physical and mathematical constants/CODATA physical constants/P/Planck temperature.py | kuanpern/jupyterlab-snippets-multimenus | 477f51cfdbad7409eab45abe53cf774cd70f380c | [
"BSD-3-Clause"
] | null | null | null | example_snippets/multimenus_snippets/Snippets/SciPy/Physical and mathematical constants/CODATA physical constants/P/Planck temperature.py | kuanpern/jupyterlab-snippets-multimenus | 477f51cfdbad7409eab45abe53cf774cd70f380c | [
"BSD-3-Clause"
] | null | null | null | example_snippets/multimenus_snippets/Snippets/SciPy/Physical and mathematical constants/CODATA physical constants/P/Planck temperature.py | kuanpern/jupyterlab-snippets-multimenus | 477f51cfdbad7409eab45abe53cf774cd70f380c | [
"BSD-3-Clause"
] | 1 | 2021-02-04T04:51:48.000Z | 2021-02-04T04:51:48.000Z | constants.physical_constants["Planck temperature"] | 50 | 50 | 0.88 | 5 | 50 | 8.6 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02 | 50 | 1 | 50 | 50 | 0.877551 | 0 | 0 | 0 | 0 | 0 | 0.352941 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
af7a2aa7b17dec440f72909192e7111b07571c7f | 551 | py | Python | tranquil/core/__init__.py | ysenarath/twespy | 7db1604ad5497825dfc7bf20c3cc0690f1032dc5 | [
"MIT"
] | null | null | null | tranquil/core/__init__.py | ysenarath/twespy | 7db1604ad5497825dfc7bf20c3cc0690f1032dc5 | [
"MIT"
] | null | null | null | tranquil/core/__init__.py | ysenarath/twespy | 7db1604ad5497825dfc7bf20c3cc0690f1032dc5 | [
"MIT"
] | null | null | null | from tranquil.core.component import *
from tranquil.core.element import *
from tranquil.core.state import *
from tranquil.core.template import *
__all__ = [
'Element',
'Component',
'Template',
'State',
'ref',
'html',
]
class ElementType(type):
def __getattr__(cls, item):
return cls(item)
class ElementBuilder(object, metaclass=ElementType):
def __init__(self, tag):
self.tag = tag
def __call__(self, *args, **kwargs):
return Element(self.tag, *args, **kwargs)
html = ElementBuilder
| 18.366667 | 52 | 0.653358 | 62 | 551 | 5.548387 | 0.451613 | 0.139535 | 0.186047 | 0.19186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.219601 | 551 | 29 | 53 | 19 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.065336 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.190476 | 0.095238 | 0.52381 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
af94651fdecaa934753243c8b102f59e9e0f8da4 | 63 | py | Python | __init__.py | akononovicius/pyjsd | 33fc69449a9114f50bdfd8528346f1e888667c13 | [
"Unlicense"
] | 1 | 2019-09-18T12:32:05.000Z | 2019-09-18T12:32:05.000Z | __init__.py | akononovicius/pyjsd | 33fc69449a9114f50bdfd8528346f1e888667c13 | [
"Unlicense"
] | null | null | null | __init__.py | akononovicius/pyjsd | 33fc69449a9114f50bdfd8528346f1e888667c13 | [
"Unlicense"
] | null | null | null | # -*- coding: utf-8 -*-
from .jsd import JSD
__all__=["JSD"]
| 10.5 | 23 | 0.571429 | 9 | 63 | 3.555556 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019608 | 0.190476 | 63 | 5 | 24 | 12.6 | 0.607843 | 0.333333 | 0 | 0 | 0 | 0 | 0.075 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
afb1e06fc008389af2d20c6dec7176060507b4dd | 194 | py | Python | tests/chp2/video2/test_mapmaker_start.py | gulgis/unit-pytest | a2855dfede6e3a3f72c762213a85828712087c09 | [
"MIT"
] | null | null | null | tests/chp2/video2/test_mapmaker_start.py | gulgis/unit-pytest | a2855dfede6e3a3f72c762213a85828712087c09 | [
"MIT"
] | null | null | null | tests/chp2/video2/test_mapmaker_start.py | gulgis/unit-pytest | a2855dfede6e3a3f72c762213a85828712087c09 | [
"MIT"
] | null | null | null | from scripts.chp2.video2.mapmaker_start import Point
def test_make_one_point():
point_01 = Point('Brasília', -15.7784, -47.9286)
assert point_01.get_lat_long() == (-15.7784, -47.9286)
| 27.714286 | 58 | 0.716495 | 31 | 194 | 4.225806 | 0.709677 | 0.10687 | 0.122137 | 0.183206 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178571 | 0.134021 | 194 | 6 | 59 | 32.333333 | 0.60119 | 0 | 0 | 0 | 0 | 0 | 0.041237 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
afc8061ef0394a9871d0200d31e39c521c376056 | 135 | py | Python | project9/test.py | shashoul/Getting-Started-Terraform | 5340425b5e5b3e69a1ad392c2a5e718ced3f6aed | [
"MIT"
] | null | null | null | project9/test.py | shashoul/Getting-Started-Terraform | 5340425b5e5b3e69a1ad392c2a5e718ced3f6aed | [
"MIT"
] | null | null | null | project9/test.py | shashoul/Getting-Started-Terraform | 5340425b5e5b3e69a1ad392c2a5e718ced3f6aed | [
"MIT"
] | null | null | null | import importlib
_module = importlib.import_module("utils")
func = getattr(_module, "assignmentString")
print(func("name","shady"))
| 16.875 | 43 | 0.748148 | 15 | 135 | 6.533333 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096296 | 135 | 7 | 44 | 19.285714 | 0.803279 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
afd2d18c4f7ddc632cbfe948c3f0bf81ebf5cb5d | 121 | gyp | Python | binding.gyp | linonetwo/node-gyp-swig-experiment | 9144291a199da17130b8aec770ec573e11c9c0ff | [
"MIT"
] | null | null | null | binding.gyp | linonetwo/node-gyp-swig-experiment | 9144291a199da17130b8aec770ec573e11c9c0ff | [
"MIT"
] | null | null | null | binding.gyp | linonetwo/node-gyp-swig-experiment | 9144291a199da17130b8aec770ec573e11c9c0ff | [
"MIT"
] | null | null | null | {
"targets": [
{
"target_name": "example",
"sources": [ "example.cxx", "example_wrap.cxx" ]
}
]
} | 15.125 | 54 | 0.471074 | 10 | 121 | 5.5 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.305785 | 121 | 8 | 55 | 15.125 | 0.654762 | 0 | 0 | 0 | 0 | 0 | 0.483607 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bb8bafd32a81a00a84274c8e610ce539b44cb556 | 323 | py | Python | test/parsing_tests/TestImmoscoutParser.py | kmarable/swiss_apartment_search | bddc92dceadfea0a3e849d54791c992f1caff39f | [
"MIT"
] | null | null | null | test/parsing_tests/TestImmoscoutParser.py | kmarable/swiss_apartment_search | bddc92dceadfea0a3e849d54791c992f1caff39f | [
"MIT"
] | null | null | null | test/parsing_tests/TestImmoscoutParser.py | kmarable/swiss_apartment_search | bddc92dceadfea0a3e849d54791c992f1caff39f | [
"MIT"
] | null | null | null | from test.parsing_tests.TestListing import TestListing
from src.parser.listing.ImmoscoutListing import ImmoscoutListing
from src.utilities import response_from_text
class TestImmoscout(TestListing):
def setUp(self):
test = response_from_text('old immoscout text')
self.parser = ImmoscoutListing(test)
| 32.3 | 64 | 0.79257 | 38 | 323 | 6.605263 | 0.526316 | 0.055777 | 0.12749 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142415 | 323 | 9 | 65 | 35.888889 | 0.906137 | 0 | 0 | 0 | 0 | 0 | 0.055728 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 0 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
bb9bba6727626b42ac8e42ade96925a348cee495 | 984 | py | Python | xunit/api.py | fhirt/python-xunit | ace8bb85a3ecc9e8c5d9fca2fa9deb296f0bb340 | [
"MIT"
] | 1 | 2021-12-11T15:30:48.000Z | 2021-12-11T15:30:48.000Z | xunit/api.py | fhirt/python-xunit | ace8bb85a3ecc9e8c5d9fca2fa9deb296f0bb340 | [
"MIT"
] | 1 | 2021-12-11T15:59:58.000Z | 2021-12-11T15:59:58.000Z | xunit/api.py | fhirt/python-xunit | ace8bb85a3ecc9e8c5d9fca2fa9deb296f0bb340 | [
"MIT"
] | null | null | null | class TestResult:
def __init__(self, test_case) -> None:
self.__test_case = test_case
self.__failed = False
self.__reason = None
def record_failure(self, reason: str):
self.__reason = reason
self.__failed = True
def test_case(self) -> str:
return type(self.__test_case).__name__
def test_name(self) -> str:
return self.__test_case.name()
def failed(self) -> bool:
return self.__failed
def reason(self) -> str:
return self.__reason
class IReport:
def record_test_result(self, test_result: TestResult):
raise NotImplementedError
def test_results(self) -> dict[str, list]:
raise NotImplementedError
def run_count(self) -> int:
raise NotImplementedError
def failure_count(self) -> int:
raise NotImplementedError
class IFormatter:
@classmethod
def format(cls, test_report: IReport) -> any:
raise NotImplementedError
| 22.883721 | 58 | 0.648374 | 113 | 984 | 5.283186 | 0.309735 | 0.080402 | 0.080402 | 0.053601 | 0.184255 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.265244 | 984 | 42 | 59 | 23.428571 | 0.825726 | 0 | 0 | 0.172414 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.37931 | false | 0 | 0 | 0.137931 | 0.62069 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
bbaeeb55f49ffc720f40ef1fca690c4dc3b0fd9e | 224 | py | Python | notebook/os_getcwd_chdir.py | vhn0912/python-snippets | 80b2e1d6b2b8f12ae30d6dbe86d25bb2b3a02038 | [
"MIT"
] | 174 | 2018-05-30T21:14:50.000Z | 2022-03-25T07:59:37.000Z | notebook/os_getcwd_chdir.py | vhn0912/python-snippets | 80b2e1d6b2b8f12ae30d6dbe86d25bb2b3a02038 | [
"MIT"
] | 5 | 2019-08-10T03:22:02.000Z | 2021-07-12T20:31:17.000Z | notebook/os_getcwd_chdir.py | vhn0912/python-snippets | 80b2e1d6b2b8f12ae30d6dbe86d25bb2b3a02038 | [
"MIT"
] | 53 | 2018-04-27T05:26:35.000Z | 2022-03-25T07:59:37.000Z | import os
path = os.getcwd()
print(path)
# /Users/mbp/Documents/my-project/python-snippets/notebook
print(type(path))
# <class 'str'>
os.chdir('../')
print(os.getcwd())
# /Users/mbp/Documents/my-project/python-snippets
| 14.933333 | 58 | 0.705357 | 32 | 224 | 4.9375 | 0.53125 | 0.101266 | 0.21519 | 0.240506 | 0.506329 | 0.506329 | 0.506329 | 0 | 0 | 0 | 0 | 0 | 0.09375 | 224 | 14 | 59 | 16 | 0.778325 | 0.526786 | 0 | 0 | 0 | 0 | 0.029412 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.5 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
bbb6a39b2b4cf806279cce188a6e1e2f48d1dba7 | 118 | py | Python | pythonExercises/test.py | CITMUniversityExercises/AR_Exercises | edc4b3b928170b6ad6279a881d749d55bfce1159 | [
"MIT"
] | null | null | null | pythonExercises/test.py | CITMUniversityExercises/AR_Exercises | edc4b3b928170b6ad6279a881d749d55bfce1159 | [
"MIT"
] | null | null | null | pythonExercises/test.py | CITMUniversityExercises/AR_Exercises | edc4b3b928170b6ad6279a881d749d55bfce1159 | [
"MIT"
] | null | null | null | # --- Starting python tests ---
#Funct
def functione(x,y):
return x*y
# call
print(format(functione(2,3))) | 11.8 | 33 | 0.610169 | 17 | 118 | 4.235294 | 0.823529 | 0.055556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021505 | 0.211864 | 118 | 10 | 33 | 11.8 | 0.752688 | 0.330508 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.333333 | 0.666667 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
bbcbad069bb106e8256df3ed15b16996b201dec6 | 558 | py | Python | libapp/views/notifier.py | octopi-labs/bazzinga | fcdd8e925cbaa31cacbec10dd1d599e72b84c588 | [
"MIT"
] | null | null | null | libapp/views/notifier.py | octopi-labs/bazzinga | fcdd8e925cbaa31cacbec10dd1d599e72b84c588 | [
"MIT"
] | 3 | 2021-03-20T00:43:11.000Z | 2022-01-06T22:33:23.000Z | libapp/views/notifier.py | octopi-labs/bazzinga | fcdd8e925cbaa31cacbec10dd1d599e72b84c588 | [
"MIT"
] | null | null | null | from flask import render_template
from libapp import app
from libapp.config import libconf
from libapp.sender import publish_msg
from libapp.tasks import subscribe_data
@app.route("/bazzinga/notify")
def notify():
subscribe_data.apply_async(queue=libconf.EMAIL_Q, serializer='json')
return render_template("notify.html")
@app.route("/bazzinga/publisher", methods=["GET", "POST"])
def publisher():
publish_msg(source_q=libconf.PUB_EMAIL_Q, dest_q=libconf.EMAIL_Q) #.apply_async(serializer='json')
return render_template("publisher.html")
| 29.368421 | 102 | 0.775986 | 78 | 558 | 5.358974 | 0.448718 | 0.095694 | 0.076555 | 0.124402 | 0.162679 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.103943 | 558 | 18 | 103 | 31 | 0.836 | 0.055556 | 0 | 0 | 0 | 0 | 0.134981 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | true | 0 | 0.384615 | 0 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
bbe365af00ffd8157af0bee56b4e8a02d8ebf4d6 | 249 | py | Python | test/test.py | DeewakarChakraborty/PlantDiseaseClassifier | 9efa37fa2adb86663579c2f92f32df1da8f091ee | [
"MIT"
] | 3 | 2021-08-13T08:45:32.000Z | 2021-08-22T13:45:44.000Z | test/test.py | DeewakarChakraborty/PlantDiseaseClassifier | 9efa37fa2adb86663579c2f92f32df1da8f091ee | [
"MIT"
] | null | null | null | test/test.py | DeewakarChakraborty/PlantDiseaseClassifier | 9efa37fa2adb86663579c2f92f32df1da8f091ee | [
"MIT"
] | null | null | null | import requests
# https://your-heroku-app-name.herokuapp.com/predict
# http://localhost:5000/predict
resp = requests.post("https://leaf-disease-classifier.herokuapp.com/predict", files={'file': open('test/test.JPG', 'rb')})
print(resp.text) | 35.571429 | 123 | 0.718876 | 34 | 249 | 5.264706 | 0.764706 | 0.134078 | 0.212291 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017544 | 0.084337 | 249 | 7 | 124 | 35.571429 | 0.767544 | 0.321285 | 0 | 0 | 0 | 0 | 0.447205 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
bbe9f8d5f9ad36d73fdc77224c453bd5b1ccd6a0 | 931 | py | Python | utils/jsonserver.py | nasa-gibs/onearth-image-analytics | 8088490d31a8440ce8ad5738026ae3483541399e | [
"Apache-2.0"
] | 5 | 2019-08-16T02:57:22.000Z | 2021-04-07T06:28:31.000Z | utils/jsonserver.py | nasa-gibs/onearth-image-analytics | 8088490d31a8440ce8ad5738026ae3483541399e | [
"Apache-2.0"
] | 2 | 2020-03-31T18:53:03.000Z | 2022-02-14T04:52:20.000Z | utils/jsonserver.py | nasa-gibs/onearth-image-analytics | 8088490d31a8440ce8ad5738026ae3483541399e | [
"Apache-2.0"
] | null | null | null |
# tile = Tile("MODIS_Terra_Brightness_Temp_Band31_Day", date=date, verbose=True)
# r = {}
# r['meta'] = [{'short_name' : tile.layer, 'time': {'start': 1306886400, 'iso_stop': \
# '{}T00:00:00+0000'.format(d2.strftime('%Y-%m-%d')), 'iso_start': '{}T00:00:00+0000'.format(d1.strftime('%Y-%m-%d')), \
# 'stop': 1401580800}, 'bounds': {'west': -26.467181536012703, 'east': 0.5631315220428235, 'north': -11.26263044085647, \
# 'south' : -38.85607502095485}}]
# r['data'] = []
# for entry in info:
# r['data'].append([{'std' : np.sqrt(entry[4]), 'cnt' : 3000, 'iso_time' : \
# '{}T00:00:00+0000'.format(entry[0]), 'min' : entry[2], 'max' : entry[3], 'time' : 0, 'ds' : 0, 'mean' : entry[1]}])
# r['stats'] = {}
# with open("../app/data.json", "w") as f:
# f.write(json.dumps(r))
# tiles = get_all_tiles('1km', '2')
# means = np.array([tile.mean() for tile in tiles])
# print(means.mean())
| 37.24 | 129 | 0.562836 | 132 | 931 | 3.886364 | 0.606061 | 0.02924 | 0.040936 | 0.064327 | 0.099415 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170732 | 0.163265 | 931 | 24 | 130 | 38.791667 | 0.487805 | 0.955961 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a53080974a16fc34195942d8d760175b8e0d3986 | 429 | py | Python | components/server/src/data_model/meta/subject.py | kargaranamir/quality-time | 1c427c61bee9d31c3526f0a01be2218a7e167c23 | [
"Apache-2.0"
] | 33 | 2016-01-20T07:35:48.000Z | 2022-03-14T09:20:51.000Z | components/server/src/data_model/meta/subject.py | kargaranamir/quality-time | 1c427c61bee9d31c3526f0a01be2218a7e167c23 | [
"Apache-2.0"
] | 2,410 | 2016-01-22T18:13:01.000Z | 2022-03-31T16:57:34.000Z | components/server/src/data_model/meta/subject.py | kargaranamir/quality-time | 1c427c61bee9d31c3526f0a01be2218a7e167c23 | [
"Apache-2.0"
] | 21 | 2016-01-16T11:49:23.000Z | 2022-01-14T21:53:22.000Z | """Data model subject."""
from pydantic import BaseModel, Field # pylint: disable=no-name-in-module
from .base import DescribedModel
class Subject(DescribedModel): # pylint: disable=too-few-public-methods
"""Base model for subjects."""
metrics: list[str] = Field(..., min_items=1)
class Subjects(BaseModel): # pylint: disable=too-few-public-methods
"""Subjects mapping."""
__root__: dict[str, Subject]
| 23.833333 | 74 | 0.701632 | 53 | 429 | 5.584906 | 0.603774 | 0.131757 | 0.108108 | 0.128378 | 0.216216 | 0.216216 | 0 | 0 | 0 | 0 | 0 | 0.002755 | 0.153846 | 429 | 17 | 75 | 25.235294 | 0.812672 | 0.407925 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a53c07c769c58027769959248f8e1152a6e89fd3 | 220 | py | Python | Python/Find a String/main.py | hugolribeiro/hackerrank_exercises | d2757b24479c26ec39e01091e3a15e8980e97864 | [
"MIT"
] | null | null | null | Python/Find a String/main.py | hugolribeiro/hackerrank_exercises | d2757b24479c26ec39e01091e3a15e8980e97864 | [
"MIT"
] | null | null | null | Python/Find a String/main.py | hugolribeiro/hackerrank_exercises | d2757b24479c26ec39e01091e3a15e8980e97864 | [
"MIT"
] | null | null | null | def count_substring(string, sub_string):
times = 0
length = len(sub_string)
for letter in range(0, len(string)):
if string[letter:letter+length] == sub_string:
times += 1
return times
| 27.5 | 54 | 0.627273 | 30 | 220 | 4.466667 | 0.533333 | 0.201493 | 0.208955 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018634 | 0.268182 | 220 | 7 | 55 | 31.428571 | 0.813665 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.285714 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
a53f5d06b943ba8db2a7c5e37b33254a408e6493 | 150 | py | Python | src/backend/modules/ctf/api/urls.py | EnhboldH/OyuBook | f92b38fa6d43461c1b215b768ce20241f760293e | [
"Apache-2.0"
] | 1 | 2020-08-10T03:35:36.000Z | 2020-08-10T03:35:36.000Z | src/backend/modules/ctf/api/urls.py | EnhboldH/OyuBook | f92b38fa6d43461c1b215b768ce20241f760293e | [
"Apache-2.0"
] | null | null | null | src/backend/modules/ctf/api/urls.py | EnhboldH/OyuBook | f92b38fa6d43461c1b215b768ce20241f760293e | [
"Apache-2.0"
] | null | null | null | from django.urls import path
from .views import ChallengeListView
# For future
urlpatterns = [
path('challenges/', ChallengeListView.as_view())
] | 21.428571 | 52 | 0.76 | 17 | 150 | 6.647059 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.14 | 150 | 7 | 53 | 21.428571 | 0.875969 | 0.066667 | 0 | 0 | 0 | 0 | 0.079137 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a540f1ff619ed3133058580d1a1da053fde29f50 | 91 | py | Python | busspottingbackend/spotting/apps.py | bmsleight/busspottingapp | 603a31eca9551852c1bdd917233b767d7fb776d7 | [
"MIT"
] | null | null | null | busspottingbackend/spotting/apps.py | bmsleight/busspottingapp | 603a31eca9551852c1bdd917233b767d7fb776d7 | [
"MIT"
] | null | null | null | busspottingbackend/spotting/apps.py | bmsleight/busspottingapp | 603a31eca9551852c1bdd917233b767d7fb776d7 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class SpottingConfig(AppConfig):
name = 'spotting'
| 15.166667 | 33 | 0.758242 | 10 | 91 | 6.9 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164835 | 91 | 5 | 34 | 18.2 | 0.907895 | 0 | 0 | 0 | 0 | 0 | 0.087912 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a556b8e8b991849b6822983c9067e24c9da953d9 | 140 | py | Python | tests/test_pydantic_model_init.py | sbl1996/hstudio | 24c7565252b0b28552c5e1dc02e50cec019c1c9e | [
"MIT"
] | null | null | null | tests/test_pydantic_model_init.py | sbl1996/hstudio | 24c7565252b0b28552c5e1dc02e50cec019c1c9e | [
"MIT"
] | null | null | null | tests/test_pydantic_model_init.py | sbl1996/hstudio | 24c7565252b0b28552c5e1dc02e50cec019c1c9e | [
"MIT"
] | null | null | null | from hstudio.service.worker import WorkerInfo
info = WorkerInfo(
id="local-1", runtime_type="cpu", session_start="2021-06-09 09:41:55") | 35 | 74 | 0.742857 | 22 | 140 | 4.636364 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12 | 0.107143 | 140 | 4 | 74 | 35 | 0.696 | 0 | 0 | 0 | 0 | 0 | 0.205674 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a5592584ecc4e1443b41eae7f56ac621fffa5abd | 2,399 | py | Python | compnat/tp2/charts/tp2/results/Params.py | RenatoUtsch/compnat | f01ab1ef6ac0a1efc1ad88a74c9b06801bc31abf | [
"Apache-2.0"
] | null | null | null | compnat/tp2/charts/tp2/results/Params.py | RenatoUtsch/compnat | f01ab1ef6ac0a1efc1ad88a74c9b06801bc31abf | [
"Apache-2.0"
] | null | null | null | compnat/tp2/charts/tp2/results/Params.py | RenatoUtsch/compnat | f01ab1ef6ac0a1efc1ad88a74c9b06801bc31abf | [
"Apache-2.0"
] | null | null | null | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: results
import flatbuffers
# /// Parameters used during execution.
class Params(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsParams(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = Params()
x.Init(buf, n + offset)
return x
# Params
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# /// Global seed used to seed the executions.
# Params
def Seed(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
return 0
# /// Number of executions.
# Params
def NumExecutions(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
return 0
# /// Number of iterations.
# Params
def NumIterations(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
return 0
# /// Number of ants.
# Params
def NumAnts(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
return 0
# /// decay.
# Params
def Decay(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
return 0.0
def ParamsStart(builder): builder.StartObject(5)
def ParamsAddSeed(builder, seed): builder.PrependUint32Slot(0, seed, 0)
def ParamsAddNumExecutions(builder, numExecutions): builder.PrependUint32Slot(1, numExecutions, 0)
def ParamsAddNumIterations(builder, numIterations): builder.PrependUint32Slot(2, numIterations, 0)
def ParamsAddNumAnts(builder, numAnts): builder.PrependUint32Slot(3, numAnts, 0)
def ParamsAddDecay(builder, decay): builder.PrependFloat32Slot(4, decay, 0.0)
def ParamsEnd(builder): return builder.EndObject()
| 34.768116 | 98 | 0.678199 | 295 | 2,399 | 5.39322 | 0.271186 | 0.070396 | 0.138278 | 0.069139 | 0.416719 | 0.416719 | 0.405405 | 0.405405 | 0.405405 | 0.405405 | 0 | 0.02633 | 0.20842 | 2,399 | 68 | 99 | 35.279412 | 0.81148 | 0.122134 | 0 | 0.302326 | 1 | 0 | 0.001913 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.325581 | false | 0 | 0.023256 | 0.023256 | 0.651163 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
a56c46931064681209e1e7ba62b5876085f76684 | 1,643 | py | Python | example/fit2txt.py | zhuchangzhan/TVOI | 3071a70383ce5d7770cd000a2b439f1e857d14bf | [
"MIT"
] | null | null | null | example/fit2txt.py | zhuchangzhan/TVOI | 3071a70383ce5d7770cd000a2b439f1e857d14bf | [
"MIT"
] | null | null | null | example/fit2txt.py | zhuchangzhan/TVOI | 3071a70383ce5d7770cd000a2b439f1e857d14bf | [
"MIT"
] | 1 | 2020-04-12T04:21:42.000Z | 2020-04-12T04:21:42.000Z | # -*- encoding: utf-8 -*-
"""
convert the data into csv format that
"""
import os,sys,glob
DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(DIR, '../..'))
from src.util.common_task import convert_fits_to_txt
#convert_fits_to_txt(4,1028594,"../../input/Sector4/tess2018292075959-s0004-0000000001028594-0124-s_lc.fits.gz")
#for TIC in [168847194,44743153,260160482,176831592,153708460,309146836,121078334,261136000,65347864,65448527]:
# convert_fits_to_txt(4,TIC)
"""
for TIC in [469979014,471013508]:
convert_fits_to_txt(1,TIC)
for TIC in [50380257,160081043]:
convert_fits_to_txt(2,TIC)
for TIC in [146539195,77350951]:
convert_fits_to_txt(5,TIC,savepath="output5")
for TIC in [25133286,60585499,153096543,272551828,445146149,
471013582,96918621]:
convert_fits_to_txt(6,TIC,savepath="output6")
#for TIC in [178366477,64260391]:
# convert_fits_to_txt(7,TIC,savepath="output7")
for TIC in [141494666,356069146]:
convert_fits_to_txt(8,TIC,savepath="output_saul")
for TIC in [141494666,356069146]:
convert_fits_to_txt(9,TIC,savepath="output_saul")
"""
"""
for TIC in [9560142, 25133286, 379121408]:
convert_fits_to_txt(10,TIC,savepath="output_saul2")
"""
"""
for TIC in glob.glob("very_interesting/*.png"):
#for TIC in [9560142, 25133286, 379121408]:
print(TIC.split("/")[-1].split("_")[2],end=",")
"""
for TIC in [360205899,141978095,399421408,
360148823,150166721,107548305,
120472041,272551828,75934024,359892714,159864583,149160359,179966966]:
convert_fits_to_txt(11,TIC,savepath="output_saul_11")
| 26.934426 | 112 | 0.718198 | 231 | 1,643 | 4.896104 | 0.458874 | 0.116711 | 0.137931 | 0.169761 | 0.198055 | 0.167993 | 0.118479 | 0.074271 | 0.074271 | 0 | 0 | 0.338698 | 0.13025 | 1,643 | 61 | 113 | 26.934426 | 0.452764 | 0.191114 | 0 | 0 | 0 | 0 | 0.044706 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a5890b1ca172498b8c0b320f6774675a1898fff7 | 600 | py | Python | Lecture Files/lecture4.py | rwelsh98/isat252 | c2647bfa1200aefb7aba9b911e3e2f625af445c4 | [
"MIT"
] | null | null | null | Lecture Files/lecture4.py | rwelsh98/isat252 | c2647bfa1200aefb7aba9b911e3e2f625af445c4 | [
"MIT"
] | null | null | null | Lecture Files/lecture4.py | rwelsh98/isat252 | c2647bfa1200aefb7aba9b911e3e2f625af445c4 | [
"MIT"
] | null | null | null | """
lec 4, tuple and dictionary
"""
my_tuple='a','b','c','d','e'
print(my_tuple)
my_2nd_tuple=('a','b','c','d','e')
print(my_2nd_tuple)
test='a'
print(type(test)) #not a tuple bc no comma
Test='a',
print(type(Test))
print(my_tuple[1])
print(my_tuple[-1])
print(my_tuple[1:3])
print(my_tuple[1:])
print(my_tuple[:3])
my_car={
'color':'red',
'maker':'toyota',
'year':2015
}
print(my_car['year'])
print(my_car.get('year'))
my_car['model']='corolla'
print(my_car)
my_car['year']=2020
print(my_car)
print(len(my_car))
print('color'in my_car)
print('mile' in my_car) | 15.789474 | 42 | 0.626667 | 109 | 600 | 3.256881 | 0.321101 | 0.216901 | 0.202817 | 0.146479 | 0.377465 | 0.276056 | 0.276056 | 0.205634 | 0 | 0 | 0 | 0.032819 | 0.136667 | 600 | 38 | 43 | 15.789474 | 0.65251 | 0.085 | 0 | 0.074074 | 0 | 0 | 0.125461 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.592593 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
36feb5d1c9cb5bbb58f416737170b701f707e081 | 84 | py | Python | public/__init__.py | ikcam/django-skeleton | c07e5c1de41e5d1ea32ebe4e27fd4e577191893c | [
"BSD-3-Clause"
] | 3 | 2017-04-26T10:15:49.000Z | 2019-10-13T14:13:44.000Z | public/__init__.py | ikcam/django-skeleton | c07e5c1de41e5d1ea32ebe4e27fd4e577191893c | [
"BSD-3-Clause"
] | null | null | null | public/__init__.py | ikcam/django-skeleton | c07e5c1de41e5d1ea32ebe4e27fd4e577191893c | [
"BSD-3-Clause"
] | null | null | null | from core.checks import * # NOQA
default_app_config = 'public.apps.PublicConfig'
| 16.8 | 47 | 0.761905 | 11 | 84 | 5.636364 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 84 | 4 | 48 | 21 | 0.861111 | 0.047619 | 0 | 0 | 0 | 0 | 0.307692 | 0.307692 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3c0523d7378158a07cacc749be25d28847cdd387 | 127 | py | Python | sovrin/common/constants.py | sovrin-foundation/old-sovrin | d4e705054b7252c62fea00114060035c6eb314a4 | [
"Apache-2.0"
] | 3 | 2017-07-19T14:26:31.000Z | 2020-05-16T16:09:37.000Z | sovrin/common/constants.py | sovrin-foundation/old-sovrin | d4e705054b7252c62fea00114060035c6eb314a4 | [
"Apache-2.0"
] | null | null | null | sovrin/common/constants.py | sovrin-foundation/old-sovrin | d4e705054b7252c62fea00114060035c6eb314a4 | [
"Apache-2.0"
] | 3 | 2017-10-28T08:19:00.000Z | 2021-06-06T10:48:55.000Z | from typing import NamedTuple
Environment = NamedTuple("Environment", [
("poolLedger", str),
("domainLedger", str)
])
| 18.142857 | 41 | 0.677165 | 11 | 127 | 7.818182 | 0.727273 | 0.488372 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173228 | 127 | 6 | 42 | 21.166667 | 0.819048 | 0 | 0 | 0 | 0 | 0 | 0.259843 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3c0a4db0c41d5852bb18fc235541d3ed3d53c4ea | 56 | py | Python | aiohttp_remotes/log.py | rgacote/aiohttp-remotes | 8b28757bc10ed7878e1bbc0539dcfb3b37cb5e96 | [
"MIT"
] | 474 | 2015-01-18T00:11:24.000Z | 2022-03-21T20:09:00.000Z | aiohttp_remotes/log.py | rgacote/aiohttp-remotes | 8b28757bc10ed7878e1bbc0539dcfb3b37cb5e96 | [
"MIT"
] | 271 | 2017-12-18T15:57:38.000Z | 2022-03-25T03:20:15.000Z | aiohttp_remotes/log.py | rgacote/aiohttp-remotes | 8b28757bc10ed7878e1bbc0539dcfb3b37cb5e96 | [
"MIT"
] | 79 | 2015-02-17T18:40:37.000Z | 2022-02-26T08:44:43.000Z | import logging
logger = logging.getLogger(__package__)
| 14 | 39 | 0.821429 | 6 | 56 | 7 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.107143 | 56 | 3 | 40 | 18.666667 | 0.84 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3c4b9aaf529f6a07e13d75998f8dc97b1bd9bd8b | 258 | py | Python | emailapp/admin.py | yashpatel7025/django-email-service-AUS | 1a584c6e3c4df4264b18c05060553f9a80ea9b96 | [
"MIT"
] | null | null | null | emailapp/admin.py | yashpatel7025/django-email-service-AUS | 1a584c6e3c4df4264b18c05060553f9a80ea9b96 | [
"MIT"
] | null | null | null | emailapp/admin.py | yashpatel7025/django-email-service-AUS | 1a584c6e3c4df4264b18c05060553f9a80ea9b96 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import *
# Register your models here.
class EmailAdmin(admin.ModelAdmin):
list_display = ('id','from_email','to_email','subject', 'body_text', 'sent_via', 'created')
admin.site.register(Email, EmailAdmin)
| 28.666667 | 95 | 0.74031 | 34 | 258 | 5.470588 | 0.705882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116279 | 258 | 8 | 96 | 32.25 | 0.815789 | 0.100775 | 0 | 0 | 0 | 0 | 0.221739 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
3c5a8d7b30bb0c3ba8059e8867811892b1f6d968 | 329 | py | Python | src/dsalgo/lowest_common_ancestor_test.py | kagemeka/python-algorithms | dface89b8c618845cf524429aa8e97c4b2b10ceb | [
"MIT"
] | 1 | 2022-02-10T02:13:07.000Z | 2022-02-10T02:13:07.000Z | src/dsalgo/lowest_common_ancestor_test.py | kagemeka/python-algorithms | dface89b8c618845cf524429aa8e97c4b2b10ceb | [
"MIT"
] | 6 | 2022-01-05T09:15:54.000Z | 2022-01-09T05:48:43.000Z | src/dsalgo/lowest_common_ancestor_test.py | kagemeka/python-algorithms | dface89b8c618845cf524429aa8e97c4b2b10ceb | [
"MIT"
] | null | null | null | class TestHLD:
# edges = [
# (0, 1),
# (0, 6),
# (0, 10),
# (1, 2),
# (1, 5),
# (2, 3),
# (2, 4),
# (6, 7),
# (7, 8),
# (7, 9),
# (10, 11),
# ]
# root = 0
# get_lca = lca_hld(edges, root)
# print(get_lca(3, 5))
...
| 15.666667 | 36 | 0.255319 | 38 | 329 | 2.131579 | 0.526316 | 0.148148 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 0.510638 | 329 | 20 | 37 | 16.45 | 0.329193 | 0.629179 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3c6084fcc8cf7ffb6759a13b2eee952bd33bd039 | 4,233 | py | Python | dragonflow/db/model_proxy.py | qianyuqiao/dragonflow | 0f154d4f794b02ac5b7fd61a3417d89e7b10912d | [
"Apache-2.0"
] | null | null | null | dragonflow/db/model_proxy.py | qianyuqiao/dragonflow | 0f154d4f794b02ac5b7fd61a3417d89e7b10912d | [
"Apache-2.0"
] | null | null | null | dragonflow/db/model_proxy.py | qianyuqiao/dragonflow | 0f154d4f794b02ac5b7fd61a3417d89e7b10912d | [
"Apache-2.0"
] | null | null | null | # 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.
import copy
import six
from oslo_log import log
from dragonflow._i18n import _
from dragonflow.common import exceptions
from dragonflow.db import db_store
LOG = log.getLogger(__name__)
class _ModelProxyBase(object):
'''Base for proxy objects
Responsible for providing direct access to ID field and to fetching the
backing object on demand.
Lazyness can be specified on per-instance basis, lazy objects will delay
fetching the actual model until a field (other than ID) is accessed, eager
objects will fetch the backing model right away.
'''
def __init__(self, id, lazy=True):
self._id = id
self._obj = None
if not lazy:
self.get_object()
def _fetch_obj(self):
# _model attribute is provided by the deriving class
obj = db_store.get_instance().get_one(self._model(id=self._id))
# FIXME fetch from NbApi
return obj
def get_object(self):
if self._obj is None:
self._obj = self._fetch_obj()
elif self._obj._is_object_stale:
self._obj = self._fetch_obj()
return self._obj
@property
def id(self):
return self._id
@id.setter
def id_setter(self, value):
raise RuntimeError(_('Setting ID of model-proxy is not allowed'))
def to_struct(self):
return {'id': self._id}
@classmethod
def get_proxied_model(cls):
return cls._model
def __repr__(self):
return '{0}(id={1})'.format(self.__class__.__name__, self._id)
def __eq__(self, other):
if type(other) is not type(self):
return False
return self._id == other.id
def __ne__(self, other):
return not self == other
def __getattr__(self, name):
if name == '_obj':
return
obj = self.get_object()
if obj is None:
raise exceptions.ReferencedObjectNotFound(proxy=self)
return getattr(obj, name)
def __copy__(self):
return self.__class__(self._id)
def __deepcopy__(self, memo):
return copy.copy(self)
def _memoize_model_proxies(f):
"""
A memoization decorator targeted for `create_model_proxy`.
"""
memo = {}
@six.wraps(f)
def func(model):
try:
return memo[model]
except KeyError:
result = f(model)
memo[model] = result
return result
return func
@_memoize_model_proxies
def create_model_proxy(model):
'''This creates a proxy class for a specific model type, this class can
then be used to create references.
>>> LportProxy = create_model_proxy(Lport)
>>> ref_to_lport = LportProxy(id='some-id')
>>> ref_to_lport.name
'port-name'
'''
attrs = {'_model': model}
return type(
'{name}Proxy'.format(name=model.__name__),
(_ModelProxyBase,),
attrs,
)
def create_reference(model, id=None, lazy=True, **kwargs):
"""
Create a reference to an instance of a model. lazy states the entire model
is retrieved only upon access. If lazy is False, the entire model is read
upon reference creation
If kwargs is empty, or no ID field is given in kwargs, None is returned. If
more granularity is needed, use `create_model_proxy` above.
>>> ref_to_lport = create_reference(Lport, id='some-id')
>>> ref_to_lport.name
'port-name'
"""
if not id:
return None
reference_model = create_model_proxy(model)
instance = reference_model(lazy=lazy, id=id, **kwargs)
return instance
def is_model_proxy(model):
return isinstance(model, _ModelProxyBase)
| 27.309677 | 79 | 0.650839 | 571 | 4,233 | 4.609457 | 0.323993 | 0.018237 | 0.030395 | 0.012158 | 0.037234 | 0.022796 | 0.022796 | 0.022796 | 0.022796 | 0 | 0 | 0.002563 | 0.262698 | 4,233 | 154 | 80 | 27.487013 | 0.840756 | 0.385306 | 0 | 0.025316 | 0 | 0 | 0.029947 | 0 | 0 | 0 | 0 | 0.006494 | 0 | 1 | 0.227848 | false | 0 | 0.075949 | 0.101266 | 0.56962 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
3c8b1b8cd8f07c34029d915c2b9e2eb79dee6969 | 422 | py | Python | src/acru_l/services/api/wsgi/src/handler.py | quadio-media/acru-l | 3bcc1e1bc83e605c8029169bef21775f1de7b69f | [
"MIT"
] | null | null | null | src/acru_l/services/api/wsgi/src/handler.py | quadio-media/acru-l | 3bcc1e1bc83e605c8029169bef21775f1de7b69f | [
"MIT"
] | null | null | null | src/acru_l/services/api/wsgi/src/handler.py | quadio-media/acru-l | 3bcc1e1bc83e605c8029169bef21775f1de7b69f | [
"MIT"
] | 1 | 2020-12-30T19:42:37.000Z | 2020-12-30T19:42:37.000Z | import os
from apig_wsgi import make_lambda_handler
from acrul_toolkit.module_loading import import_string
WSGI_APPLICATION = os.environ.get("WSGI_APPLICATION")
application = import_string(WSGI_APPLICATION)
handle_request = make_lambda_handler(application, binary_support=True)
def main(event, context):
if "httpMethod" not in event:
return {"status": "success"}
return handle_request(event, context)
| 26.375 | 70 | 0.791469 | 55 | 422 | 5.8 | 0.581818 | 0.141066 | 0.106583 | 0.169279 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130332 | 422 | 15 | 71 | 28.133333 | 0.86921 | 0 | 0 | 0 | 0 | 0 | 0.092417 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.4 | 0 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
b1cab309247d1c7528c4a53378e0baea34baeda0 | 2,278 | py | Python | models/orpac/containers.py | olitheolix/ds2data | f0d11a5f2b02c132da7604ba9ced17089969afda | [
"Apache-2.0"
] | 2 | 2017-08-18T05:38:45.000Z | 2018-05-08T14:15:22.000Z | models/orpac/containers.py | olitheolix/ds2data | f0d11a5f2b02c132da7604ba9ced17089969afda | [
"Apache-2.0"
] | null | null | null | models/orpac/containers.py | olitheolix/ds2data | f0d11a5f2b02c132da7604ba9ced17089969afda | [
"Apache-2.0"
] | null | null | null | import math
class Shape:
"""Container to store 3D Image/array/feature/tensor sizes.
This is a convenience class because size specifications are often required
yet their format is ambigous. Sometimes, images are specified as CHW
(Tensorflow), sometimes as HWC (NumPy, Matplotlib). Sometimes, only the
width and height are needed which Tensorflow needs as (height, width) yet
eg. PIL returns as (width, height).
This container class accepts the three size parameters and can return them
in all possible formats.
Inputs:
chan: int
Number of channels. Must be non-negative or None.
height: int
Must be non-negative (can *not* be None).
width: int
Must be non-negative (can *not* be None).
"""
def __init__(self, chan, height, width):
# Sanity checks.
assert chan is None or isinstance(chan, int) and chan >= 0
assert isinstance(width, int) and width >= 0
assert isinstance(height, int) and height >= 0
# Store the parameters.
self.chan = chan
self.height = height
self.width = width
def __repr__(self):
return f'Shape(chan={self.chan}, height={self.height}, width={self.width})'
def __eq__(self, ref):
try:
assert isinstance(ref, Shape)
assert ref.chan == self.chan
assert ref.height == self.height
assert ref.width == self.width
return True
except AssertionError:
return False
def copy(self):
return Shape(self.chan, self.height, self.width)
def isSquare(self):
return self.width == self.height
def isPow2(self):
try:
assert self.height > 1
assert self.width > 1
assert 2 ** int(math.log2(self.height)) == self.height
assert 2 ** int(math.log2(self.width)) == self.width
return True
except AssertionError:
return False
def chw(self):
return (self.chan, self.height, self.width)
def hwc(self):
return (self.height, self.width, self.chan)
def hw(self):
return (self.height, self.width)
def wh(self):
return (self.width, self.height)
| 30.783784 | 83 | 0.604478 | 291 | 2,278 | 4.690722 | 0.32646 | 0.087912 | 0.054945 | 0.055678 | 0.295238 | 0.29304 | 0.175824 | 0.131868 | 0.131868 | 0.084982 | 0 | 0.006949 | 0.305092 | 2,278 | 73 | 84 | 31.205479 | 0.855338 | 0.321773 | 0 | 0.195122 | 0 | 0 | 0.044008 | 0.02979 | 0 | 0 | 0 | 0 | 0.317073 | 1 | 0.243902 | false | 0 | 0.02439 | 0.170732 | 0.560976 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
b1d0515716abbab8f46f163184c3f060e7336936 | 47 | py | Python | aiohttp_socks/core_socks/_version.py | maemo-leste-extras/aiohttp-socks | 4771b8bc73bd85f41a158600171b931de8e0c414 | [
"Apache-2.0"
] | 1 | 2022-02-24T01:29:58.000Z | 2022-02-24T01:29:58.000Z | aiohttp_socks/core_socks/_version.py | maemo-leste-extras/aiohttp-socks | 4771b8bc73bd85f41a158600171b931de8e0c414 | [
"Apache-2.0"
] | null | null | null | aiohttp_socks/core_socks/_version.py | maemo-leste-extras/aiohttp-socks | 4771b8bc73bd85f41a158600171b931de8e0c414 | [
"Apache-2.0"
] | null | null | null | __title__ = 'core-socks'
__version__ = '0.1.4'
| 15.666667 | 24 | 0.680851 | 7 | 47 | 3.428571 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.073171 | 0.12766 | 47 | 2 | 25 | 23.5 | 0.512195 | 0 | 0 | 0 | 0 | 0 | 0.319149 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b1e690682351a83debf20450d0fa463f3aeed8fe | 125 | py | Python | unicorn/apps/color/apps.py | mkoistinen/homebridge-pi-lamp | e618e7d8073636532d87d0cffb39eda212bfca2c | [
"MIT"
] | null | null | null | unicorn/apps/color/apps.py | mkoistinen/homebridge-pi-lamp | e618e7d8073636532d87d0cffb39eda212bfca2c | [
"MIT"
] | 4 | 2020-06-06T00:00:02.000Z | 2021-06-10T19:08:58.000Z | unicorn/apps/color/apps.py | mkoistinen/homebridge-pi-lamp | e618e7d8073636532d87d0cffb39eda212bfca2c | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class ColorConfig(AppConfig):
name = 'unicorn.apps.color'
verbose_name = 'Color'
| 17.857143 | 33 | 0.728 | 15 | 125 | 6 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176 | 125 | 6 | 34 | 20.833333 | 0.873786 | 0 | 0 | 0 | 0 | 0 | 0.184 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
b1f04fffceea97623c5d2af946476a6ef855c65b | 299 | py | Python | scale_client/sensors/raw_analog_physical_sensor.py | prav33nv/scale_client | dcbd6ed4c8f4a27606ebef5b5f9dabb2e4f3b806 | [
"BSD-2-Clause-FreeBSD"
] | 3 | 2018-05-24T00:59:05.000Z | 2020-01-03T08:03:33.000Z | scale_client/sensors/raw_analog_physical_sensor.py | prav33nv/scale_client | dcbd6ed4c8f4a27606ebef5b5f9dabb2e4f3b806 | [
"BSD-2-Clause-FreeBSD"
] | 26 | 2015-01-19T22:47:07.000Z | 2017-05-03T01:43:10.000Z | scale_client/sensors/raw_analog_physical_sensor.py | prav33nv/scale_client | dcbd6ed4c8f4a27606ebef5b5f9dabb2e4f3b806 | [
"BSD-2-Clause-FreeBSD"
] | 6 | 2015-01-20T20:05:09.000Z | 2017-06-01T02:19:01.000Z | from scale_client.sensors.analog_physical_sensor import AnalogPhysicalSensor
# TODO: document the purpose of this class. How/why is it different from its parent?
class RawAnalogPhysicalSensor(AnalogPhysicalSensor):
DEFAULT_PRIORITY = 9
def policy_check(self, data):
return True
| 27.181818 | 85 | 0.782609 | 37 | 299 | 6.189189 | 0.918919 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004016 | 0.167224 | 299 | 10 | 86 | 29.9 | 0.915663 | 0.277592 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
b1f23bd1683f6074618c13d3d02dd3630f7e458a | 1,224 | py | Python | Server/models.py | osscat/YaKan | 0b1f6d957d0ba564e67821bd989cc5e188b1f422 | [
"MIT"
] | 3 | 2018-07-04T00:49:40.000Z | 2019-06-12T05:16:46.000Z | Server/models.py | osscat/YaKan | 0b1f6d957d0ba564e67821bd989cc5e188b1f422 | [
"MIT"
] | null | null | null | Server/models.py | osscat/YaKan | 0b1f6d957d0ba564e67821bd989cc5e188b1f422 | [
"MIT"
] | 1 | 2019-06-12T05:16:48.000Z | 2019-06-12T05:16:48.000Z | from django.db import models
class Project(models.Model):
title = models.TextField(blank=False)
description = models.TextField(blank=True)
owner_id = models.IntegerField(blank=False)
status = models.IntegerField(default=0, blank=False)
def __str__(self):
return self.title
class ProjectMember(models.Model):
project_id = models.IntegerField(blank=False)
user_id = models.IntegerField(blank=False)
class Lane(models.Model):
project_id = models.IntegerField(blank=False)
title = models.TextField(blank=False)
status = models.IntegerField(default=0, blank=False)
order = models.IntegerField(blank=False)
class Task(models.Model):
title = models.TextField(blank=False)
order = models.IntegerField(blank=False)
user_id = models.IntegerField(blank=True,null=True)
man_day = models.FloatField(blank=False)
status = models.IntegerField(default=0, blank=False)
lane_id = models.IntegerField(blank=False)
label_id = models.IntegerField(blank=True,null=True)
delete_flag = models.IntegerField(default=0, blank=False)
class Label(models.Model):
name = models.TextField(blank=False)
color = models.CharField(blank=False, max_length=6) | 31.384615 | 61 | 0.735294 | 155 | 1,224 | 5.716129 | 0.270968 | 0.191874 | 0.233634 | 0.197517 | 0.708804 | 0.612867 | 0.572235 | 0.38149 | 0.30474 | 0 | 0 | 0.004812 | 0.151144 | 1,224 | 39 | 62 | 31.384615 | 0.847931 | 0 | 0 | 0.357143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.035714 | false | 0 | 0.035714 | 0.035714 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
59023a60ff74014293ffc66148d3dd79ee813dfe | 5,496 | py | Python | src/OTLMOW/OTLModel/Datatypes/KlBestratingselementAfmetingLxB.py | davidvlaminck/OTLClassPython | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | 2 | 2022-02-01T08:58:11.000Z | 2022-02-08T13:35:17.000Z | src/OTLMOW/OTLModel/Datatypes/KlBestratingselementAfmetingLxB.py | davidvlaminck/OTLMOW | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | null | null | null | src/OTLMOW/OTLModel/Datatypes/KlBestratingselementAfmetingLxB.py | davidvlaminck/OTLMOW | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | null | null | null | # coding=utf-8
from OTLMOW.OTLModel.Datatypes.KeuzelijstField import KeuzelijstField
from OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde import KeuzelijstWaarde
# Generated with OTLEnumerationCreator. To modify: extend, do not edit
class KlBestratingselementAfmetingLxB(KeuzelijstField):
"""De afmetingen of aanduidingen voor bestrating van betonstraatstenen."""
naam = 'KlBestratingselementAfmetingLxB'
label = 'Afmeting bestratingselement lengte x breedte'
objectUri = 'https://wegenenverkeer.data.vlaanderen.be/ns/onderdeel#KlBestratingselementAfmetingLxB'
definition = 'De afmetingen of aanduidingen voor bestrating van betonstraatstenen.'
codelist = 'https://wegenenverkeer.data.vlaanderen.be/id/conceptscheme/KlBestratingselementAfmetingLxB'
options = {
'1000-x-1000': KeuzelijstWaarde(invulwaarde='1000-x-1000',
label='1000 x 1000',
definitie='1000 x 1000',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/1000-x-1000'),
'150-x-150': KeuzelijstWaarde(invulwaarde='150-x-150',
label='150 x 150',
definitie='150 x 150',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/150-x-150'),
'200-x-200': KeuzelijstWaarde(invulwaarde='200-x-200',
label='200 x 200',
definitie='200 x 200',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/200-x-200'),
'200-x-200-voegstenen': KeuzelijstWaarde(invulwaarde='200-x-200-voegstenen',
label='200 x 200 voegstenen',
definitie='200 x 200 voegstenen',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/200-x-200-voegstenen'),
'220-x-110': KeuzelijstWaarde(invulwaarde='220-x-110',
label='220 x 110',
definitie='220 x 110',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/220-x-110'),
'220-x-220': KeuzelijstWaarde(invulwaarde='220-x-220',
label='220 x 220',
definitie='220 x 220',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/220-x-220'),
'220-x-220-voegstenen': KeuzelijstWaarde(invulwaarde='220-x-220-voegstenen',
label='220 x 220 voegstenen',
definitie='220 x 220 voegstenen',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/220-x-220-voegstenen'),
'300-x-300': KeuzelijstWaarde(invulwaarde='300-x-300',
label='300 x 300',
definitie='300 x 300',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/300-x-300'),
'400-x-400': KeuzelijstWaarde(invulwaarde='400-x-400',
label='400 x 400',
definitie='400 x 400',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/400-x-400'),
'500-x-500': KeuzelijstWaarde(invulwaarde='500-x-500',
label='500 x 500',
definitie='500 x 500',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/500-x-500'),
'600-x-600': KeuzelijstWaarde(invulwaarde='600-x-600',
label='600 x 600',
definitie='600 x 600',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/600-x-600'),
'800-x-800': KeuzelijstWaarde(invulwaarde='800-x-800',
label='800 x 800',
definitie='800 x 800',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/800-x-800'),
'afmetingen-volgens-de-opdrachtdocumenten': KeuzelijstWaarde(invulwaarde='afmetingen-volgens-de-opdrachtdocumenten',
label='afmetingen volgens de opdrachtdocumenten',
definitie='afmetingen volgens de opdrachtdocumenten',
objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBestratingselementAfmetingLxB/afmetingen-volgens-de-opdrachtdocumenten')
}
| 79.652174 | 207 | 0.541849 | 452 | 5,496 | 6.588496 | 0.143805 | 0.095702 | 0.11585 | 0.166219 | 0.497314 | 0.451645 | 0.424446 | 0.424446 | 0.38415 | 0.158496 | 0 | 0.105189 | 0.358261 | 5,496 | 68 | 208 | 80.823529 | 0.739155 | 0.027475 | 0 | 0 | 1 | 0.209677 | 0.427956 | 0.020798 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.032258 | 0 | 0.145161 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
59052538cacc6c6eb96db8733c1d60eb11caf1fa | 219 | py | Python | bookstore/admin.py | julesc00/admin_area_customization | 6f225cd10c2f266a3a31193c34bcdae3ff303221 | [
"MIT"
] | null | null | null | bookstore/admin.py | julesc00/admin_area_customization | 6f225cd10c2f266a3a31193c34bcdae3ff303221 | [
"MIT"
] | null | null | null | bookstore/admin.py | julesc00/admin_area_customization | 6f225cd10c2f266a3a31193c34bcdae3ff303221 | [
"MIT"
] | null | null | null | from django.contrib import admin
class BookstoreAdminArea(admin.AdminSite):
site_header = "Bookstore Admin Area"
bookstore_site_area = BookstoreAdminArea(name="BookstoreAdmin")
# bookstore_site_area.register()
| 19.909091 | 63 | 0.803653 | 24 | 219 | 7.125 | 0.625 | 0.152047 | 0.19883 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114155 | 219 | 10 | 64 | 21.9 | 0.881443 | 0.136986 | 0 | 0 | 0 | 0 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
5914659b94751baf4cbfe87e6ea3640a5b8be2ba | 130 | py | Python | ch-2/light_led.py | PacktPublishing/Raspberry-Pi-Pico-Robotics-for-Workbench-Wizards | fd4b0cb544f383acf6fa9c14c53c17fdd3c7dcab | [
"MIT"
] | null | null | null | ch-2/light_led.py | PacktPublishing/Raspberry-Pi-Pico-Robotics-for-Workbench-Wizards | fd4b0cb544f383acf6fa9c14c53c17fdd3c7dcab | [
"MIT"
] | null | null | null | ch-2/light_led.py | PacktPublishing/Raspberry-Pi-Pico-Robotics-for-Workbench-Wizards | fd4b0cb544f383acf6fa9c14c53c17fdd3c7dcab | [
"MIT"
] | null | null | null | import board
import digitalio
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
led.value = True
| 21.666667 | 42 | 0.815385 | 17 | 130 | 6.235294 | 0.529412 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 130 | 5 | 43 | 26 | 0.905983 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
59326cc32743da60e1af5bcfbb43718c1e1245c4 | 1,646 | py | Python | testers/applicative_law_tester.py | przemyslawjanpietrzak/pyMonet | 94610ee4f1c71aa5f50e0813539bf1a2ea279d70 | [
"MIT"
] | 33 | 2017-07-05T07:04:52.000Z | 2022-03-03T07:54:18.000Z | testers/applicative_law_tester.py | przemyslawjanpietrzak/pyMonet | 94610ee4f1c71aa5f50e0813539bf1a2ea279d70 | [
"MIT"
] | 46 | 2017-06-28T20:48:31.000Z | 2020-04-21T21:46:12.000Z | testers/applicative_law_tester.py | przemyslawjanpietrzak/MonetPy | 94610ee4f1c71aa5f50e0813539bf1a2ea279d70 | [
"MIT"
] | null | null | null | from pymonet.utils import identity
class ApplicativeLawTester:
def __init__(self, applicative, value, mapper1, mapper2, get_fn=identity):
self.applicative = applicative
self.value = value
self.mapper1 = mapper1
self.mapper2 = mapper2
self.get_fn = get_fn
def _assert(self, x, y):
assert self.get_fn(x) == self.get_fn(y)
def identity_test(self):
x = self.applicative(identity).ap(self.applicative(self.value))
y = self.applicative(self.value)
self._assert(x, y)
def composition_test(self):
def lambda_fn(fn1):
return lambda fn2: lambda value: fn1(fn2(value))
x = self.applicative(lambda_fn)\
.ap(self.applicative(self.mapper1))\
.ap(self.applicative(self.mapper2))\
.ap(self.applicative(self.value))
y = self.applicative(self.mapper1).ap(
self.applicative(self.mapper2).ap(self.applicative(self.value))
)
self._assert(x, y)
def homomorphism_test(self):
x = self.applicative(self.mapper1).ap(self.applicative(self.value))
y = self.applicative(
self.mapper1(self.value)
)
self._assert(x, y)
def interchange_test(self):
x = self.applicative(self.mapper1).ap(self.applicative(self.value))
y = self.applicative(lambda fn: fn(self.value)).ap(
self.applicative(self.mapper1)
)
self._assert(x, y)
def test(self):
self.identity_test()
self.composition_test()
self.homomorphism_test()
self.interchange_test()
| 29.927273 | 78 | 0.608141 | 196 | 1,646 | 4.984694 | 0.142857 | 0.291709 | 0.272262 | 0.193449 | 0.511771 | 0.441146 | 0.441146 | 0.416581 | 0.416581 | 0.333675 | 0 | 0.015038 | 0.272783 | 1,646 | 54 | 79 | 30.481481 | 0.80117 | 0 | 0 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.190476 | false | 0 | 0.02381 | 0.02381 | 0.261905 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
593a8e480d36534efe615ba2a521c826c3ed23f3 | 482 | py | Python | test/test_day_4.py | Sh4der/adventofcode | 1823d7bac33778ef850e384d914843a0c0ded869 | [
"MIT"
] | null | null | null | test/test_day_4.py | Sh4der/adventofcode | 1823d7bac33778ef850e384d914843a0c0ded869 | [
"MIT"
] | null | null | null | test/test_day_4.py | Sh4der/adventofcode | 1823d7bac33778ef850e384d914843a0c0ded869 | [
"MIT"
] | 1 | 2020-12-12T01:11:08.000Z | 2020-12-12T01:11:08.000Z | from test.helper import use_example
class part_1:
@use_example(1)
def test_example_1(self, problem):
assert problem.solve_1() == 2
def test_solution(self, problem):
assert problem.solve_1() == 216
class part_2:
@use_example(2)
def test_example_2(self, problem):
assert problem.solve_2() == 0
@use_example(3)
def test_example_3(self, problem):
assert problem.solve_2() == 4
def test_solution(self, problem):
assert problem.solve_2() == 150
| 20.083333 | 36 | 0.697095 | 74 | 482 | 4.283784 | 0.283784 | 0.11041 | 0.268139 | 0.378549 | 0.567823 | 0.567823 | 0.277603 | 0.277603 | 0 | 0 | 0 | 0.05598 | 0.184647 | 482 | 23 | 37 | 20.956522 | 0.750636 | 0 | 0 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.3125 | 1 | 0.3125 | false | 0 | 0.0625 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3ca3238bee975c05807b04e4c579bdd7598bc7b7 | 17 | py | Python | my_settings.py | marcopodda/mldatautils | 57bf5d6ee2fb62d9dffd4b344d7d91eb8795457d | [
"MIT"
] | 2 | 2020-03-06T19:55:53.000Z | 2020-03-07T14:14:53.000Z | my_settings.py | marcopodda/mldatautils | 57bf5d6ee2fb62d9dffd4b344d7d91eb8795457d | [
"MIT"
] | null | null | null | my_settings.py | marcopodda/mldatautils | 57bf5d6ee2fb62d9dffd4b344d7d91eb8795457d | [
"MIT"
] | null | null | null | EXP_NAME = "EXP"
| 8.5 | 16 | 0.647059 | 3 | 17 | 3.333333 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 17 | 1 | 17 | 17 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3cab4915f783d07a751ef743ff04900e0626f0e0 | 1,047 | py | Python | pandajedi/jedicore/JediDBProxyPool.py | PanDAWMS/panda-jedi | e4c90563b3b9e9521cb73ccdedaa8ecaa38af5ed | [
"Apache-2.0"
] | 2 | 2020-04-17T10:24:09.000Z | 2020-05-12T17:59:06.000Z | pandajedi/jedicore/JediDBProxyPool.py | PanDAWMS/panda-jedi | e4c90563b3b9e9521cb73ccdedaa8ecaa38af5ed | [
"Apache-2.0"
] | 20 | 2015-08-25T13:40:14.000Z | 2022-03-29T12:50:46.000Z | pandajedi/jedicore/JediDBProxyPool.py | PanDAWMS/panda-jedi | e4c90563b3b9e9521cb73ccdedaa8ecaa38af5ed | [
"Apache-2.0"
] | 10 | 2015-05-27T14:01:42.000Z | 2021-09-20T17:38:02.000Z | from pandaserver import taskbuffer
import taskbuffer.DBProxyPool
from . import JediDBProxy
# use customized proxy
taskbuffer.DBProxyPool.DBProxy = JediDBProxy
class DBProxyPool(taskbuffer.DBProxyPool.DBProxyPool):
# constructor
def __init__(self, dbhost, dbpasswd, nConnection, useTimeout=False):
taskbuffer.DBProxyPool.DBProxyPool.__init__(self, dbhost, dbpasswd,
nConnection, useTimeout)
# get a DBProxyObj containing a proxy
def get(self):
proxy_obj = DBProxyObj(db_proxy_pool=self)
return proxy_obj
# object of context manager for db proxy
class DBProxyObj(object):
# constructor
def __init__(self, db_proxy_pool):
self.proxy_pool = db_proxy_pool
self.proxy = None
# get proxy
def __enter__(self):
self.proxy = self.proxy_pool.getProxy()
return self.proxy
# release proxy
def __exit__(self, type, value, traceback):
self.proxy_pool.putProxy(self.proxy)
self.proxy = None
| 28.297297 | 76 | 0.679083 | 116 | 1,047 | 5.862069 | 0.362069 | 0.119118 | 0.048529 | 0.066176 | 0.185294 | 0.126471 | 0 | 0 | 0 | 0 | 0 | 0 | 0.249284 | 1,047 | 36 | 77 | 29.083333 | 0.86514 | 0.136581 | 0 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0.095238 | 0.142857 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
3cb110c1c8c028971af0db83aed5406a2dc9ec95 | 84 | py | Python | generator/AnalyticsModel/history_action_type.py | CoveoWhisper/ModelGenerator | f20743ab075d9a965df00e63eaf4907aa57ed849 | [
"MIT"
] | null | null | null | generator/AnalyticsModel/history_action_type.py | CoveoWhisper/ModelGenerator | f20743ab075d9a965df00e63eaf4907aa57ed849 | [
"MIT"
] | null | null | null | generator/AnalyticsModel/history_action_type.py | CoveoWhisper/ModelGenerator | f20743ab075d9a965df00e63eaf4907aa57ed849 | [
"MIT"
] | null | null | null | from enum import Enum
class HistoryActionType(Enum):
SEARCH = 1
CLICK = 2
| 12 | 30 | 0.678571 | 11 | 84 | 5.181818 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032258 | 0.261905 | 84 | 6 | 31 | 14 | 0.887097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
3cbaa4f9546f8522e72da8f91c27e2b670a41b78 | 108 | py | Python | tests/data/disc1_problem.py | relf/WhatsOpt-CLI | 85551102c28b2bd404207521fd9020435415d469 | [
"Apache-2.0"
] | 5 | 2019-11-13T08:05:57.000Z | 2022-01-03T14:35:49.000Z | tests/data/disc1_problem.py | relf/WhatsOpt-CLI | 85551102c28b2bd404207521fd9020435415d469 | [
"Apache-2.0"
] | 4 | 2019-12-19T14:43:17.000Z | 2021-06-21T09:28:31.000Z | tests/data/disc1_problem.py | relf/WhatsOpt-CLI | 85551102c28b2bd404207521fd9020435415d469 | [
"Apache-2.0"
] | 5 | 2019-03-29T09:51:25.000Z | 2021-06-08T14:10:52.000Z | from openmdao.api import Problem
from disc1 import Disc1
pb = Problem(Disc1())
pb.setup()
pb.final_setup()
| 15.428571 | 32 | 0.759259 | 17 | 108 | 4.764706 | 0.529412 | 0.17284 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031915 | 0.12963 | 108 | 6 | 33 | 18 | 0.829787 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3cbdf22ffe0d536766b679fa6d4387afad17970b | 325 | py | Python | tests/eth2/core/beacon/chains/test_chains.py | dendisuhubdy/trinity | 001664781259c7dd0779a0ef6f822451b608ded4 | [
"MIT"
] | null | null | null | tests/eth2/core/beacon/chains/test_chains.py | dendisuhubdy/trinity | 001664781259c7dd0779a0ef6f822451b608ded4 | [
"MIT"
] | null | null | null | tests/eth2/core/beacon/chains/test_chains.py | dendisuhubdy/trinity | 001664781259c7dd0779a0ef6f822451b608ded4 | [
"MIT"
] | null | null | null | import pytest
from eth2.beacon.chains.testnet import SkeletonLakeChain
@pytest.mark.parametrize("chain_klass", (SkeletonLakeChain,))
def test_chain_class_well_defined(base_db, chain_klass, config):
chain = chain_klass(base_db, config)
assert chain.sm_configuration is not () and chain.sm_configuration is not None
| 32.5 | 82 | 0.803077 | 45 | 325 | 5.555556 | 0.6 | 0.12 | 0.16 | 0.176 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003472 | 0.113846 | 325 | 9 | 83 | 36.111111 | 0.864583 | 0 | 0 | 0 | 0 | 0 | 0.033846 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3cbfbe06556c0a197b63243051b1182d61cbbd1d | 21 | py | Python | documents.py | Snakeeeees/parser_for_kundelik | 8ff1a85bab826f6f746bb445263c4d5dc2fe88a6 | [
"MIT"
] | null | null | null | documents.py | Snakeeeees/parser_for_kundelik | 8ff1a85bab826f6f746bb445263c4d5dc2fe88a6 | [
"MIT"
] | null | null | null | documents.py | Snakeeeees/parser_for_kundelik | 8ff1a85bab826f6f746bb445263c4d5dc2fe88a6 | [
"MIT"
] | null | null | null | documents_all = set() | 21 | 21 | 0.761905 | 3 | 21 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 21 | 1 | 21 | 21 | 0.789474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 3 |
3ccb91a980ec6da201282bddaca955c5f43c0aa1 | 149 | py | Python | students/K33401/laboratory_works/Kasatkin_Daniil/LR3/hotel_app/apps.py | aglaya-pill/ITMO_ICT_WebDevelopment_2021-2022 | a63691317a72fb9b29ae537bc3d7766661458c22 | [
"MIT"
] | null | null | null | students/K33401/laboratory_works/Kasatkin_Daniil/LR3/hotel_app/apps.py | aglaya-pill/ITMO_ICT_WebDevelopment_2021-2022 | a63691317a72fb9b29ae537bc3d7766661458c22 | [
"MIT"
] | null | null | null | students/K33401/laboratory_works/Kasatkin_Daniil/LR3/hotel_app/apps.py | aglaya-pill/ITMO_ICT_WebDevelopment_2021-2022 | a63691317a72fb9b29ae537bc3d7766661458c22 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class HotelAppConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'hotel_app'
| 21.285714 | 56 | 0.765101 | 18 | 149 | 6.166667 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147651 | 149 | 6 | 57 | 24.833333 | 0.874016 | 0 | 0 | 0 | 0 | 0 | 0.255034 | 0.194631 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
3cd9974eec884b1d31d61027c6657c607854d01f | 199 | py | Python | neo/clis/login.py | sdmoko/neo-cli | 5881c3e9db7c4995fba1bb776a8e64a5acab65f8 | [
"MIT"
] | null | null | null | neo/clis/login.py | sdmoko/neo-cli | 5881c3e9db7c4995fba1bb776a8e64a5acab65f8 | [
"MIT"
] | null | null | null | neo/clis/login.py | sdmoko/neo-cli | 5881c3e9db7c4995fba1bb776a8e64a5acab65f8 | [
"MIT"
] | null | null | null | from neo.clis.base import Base
from neo.libs import login as login_lib
class Login(Base):
"""
usage: login
Log in to Neo Cloud
"""
def execute(self):
return login_lib.do_login()
| 13.266667 | 39 | 0.673367 | 32 | 199 | 4.09375 | 0.625 | 0.10687 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.231156 | 199 | 14 | 40 | 14.214286 | 0.856209 | 0.165829 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0.2 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
a71a8eca354038c49db5a79bee0d129f3a67da22 | 1,283 | py | Python | travo.py | psorus/morm | de4efc3d4479be9a6865bffb58a9c64fce3a3bdc | [
"MIT"
] | null | null | null | travo.py | psorus/morm | de4efc3d4479be9a6865bffb58a9c64fce3a3bdc | [
"MIT"
] | null | null | null | travo.py | psorus/morm | de4efc3d4479be9a6865bffb58a9c64fce3a3bdc | [
"MIT"
] | null | null | null | from xevo import eobj
from rndtrafos import trafos
import random
import numpy as np
class travo(eobj):
"""eobj transforming x and y to maximize linearity"""
def __init__(s,x=None,y=None,hx=None,hy=None):
s.initial()
s.x=x
s.y=y
if hx is None:hx=[]
if hy is None:hy=[]
s.hx=hx
s.hy=hy
def _visx(s):
return "-".join(s.hx)
def _visy(s):
return "-".join(s.hy)
def __str__(s):
return "X:"+s._visx()+" Y:"+s._visy()
def __add__(a,b):
x=[(a+b)/2 for a,b in zip(a.x,b.x)]
y=[(a+b)/2 for a,b in zip(a.y,b.y)]
return travo(x=x,y=y,hx=["mean("+a._visx()+"|"+b._visx()+")"],hy=["mean("+a._visy()+"|"+b._visy()+")"])
def randomize(s):
return s.mutate()
def rndtrafo(s,x,o):
q=random.choice(trafos)
return q["n"],q["q"](x,o)
def mutate(s):
x,y=[q for q in s.x],[q for q in s.y]
hx=[q for q in s.hx]
hy=[q for q in s.hy]
if random.random()<0.5:
tx,x=s.rndtrafo(x,y)
hx.append(tx)
else:
ty,y=s.rndtrafo(y,x)
hy.append(ty)
return travo(x,y,hx,hy)
def calcstrength(s):
ret= np.corrcoef(s.x,s.y)[1,0]
if np.isnan(ret):return -2
return ret
def _copy(s):
return travo([q for q in s.x],[q for q in s.y],[q for q in s.hx],[q for q in s.hy]) | 24.673077 | 107 | 0.55417 | 264 | 1,283 | 2.613636 | 0.227273 | 0.046377 | 0.057971 | 0.081159 | 0.155072 | 0.155072 | 0.092754 | 0.092754 | 0.092754 | 0.052174 | 0 | 0.007114 | 0.233048 | 1,283 | 52 | 108 | 24.673077 | 0.694106 | 0.036633 | 0 | 0 | 0 | 0 | 0.018684 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.088889 | 0.111111 | 0.533333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
a71c61ed2728f597373bdbdd908ebb2522d08cdd | 366 | py | Python | tests/test_stp.py | KennethSoelberg/AOS-Switch | a5a2c54917bbb69fab044bf0b313bcf795642d30 | [
"MIT"
] | null | null | null | tests/test_stp.py | KennethSoelberg/AOS-Switch | a5a2c54917bbb69fab044bf0b313bcf795642d30 | [
"MIT"
] | 1 | 2020-12-24T15:36:56.000Z | 2021-01-28T23:19:57.000Z | tests/test_stp.py | KennethSoelberg/AOS-Switch | a5a2c54917bbb69fab044bf0b313bcf795642d30 | [
"MIT"
] | 1 | 2021-02-16T23:26:28.000Z | 2021-02-16T23:26:28.000Z | import pytest
def test_get_stp(client):
print(client.stp.get_stp())
def test_get_stp_ports(client):
print(client.stp.get_stp_ports())
@pytest.mark.asyncio
async def test_get_stp_async(async_client):
await async_client.stp.get_stp()
@pytest.mark.asyncio
async def test_get_stp_ports_async(async_client):
await async_client.stp.get_stp_ports()
| 18.3 | 49 | 0.775956 | 60 | 366 | 4.366667 | 0.216667 | 0.183206 | 0.152672 | 0.198473 | 0.90458 | 0.778626 | 0.580153 | 0.580153 | 0.312977 | 0 | 0 | 0 | 0.120219 | 366 | 19 | 50 | 19.263158 | 0.813665 | 0 | 0 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.090909 | 0 | 0.272727 | 0.181818 | 0 | 0 | 0 | null | 0 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a71d76d04c462a05f1f3754a54059a65ecb74dfb | 99 | gyp | Python | binding.gyp | wearefractal/yolo | bbc5dbb9cdb039cfebf112a37280ac1ad8d68f68 | [
"MIT"
] | 2 | 2018-07-12T14:53:29.000Z | 2019-08-11T02:31:57.000Z | binding.gyp | wearefractal/yolo | bbc5dbb9cdb039cfebf112a37280ac1ad8d68f68 | [
"MIT"
] | null | null | null | binding.gyp | wearefractal/yolo | bbc5dbb9cdb039cfebf112a37280ac1ad8d68f68 | [
"MIT"
] | null | null | null | {
"targets": [
{
"target_name": "yolo",
"sources": [ "src/yolo.cc" ]
}
]
}
| 11 | 34 | 0.383838 | 8 | 99 | 4.625 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.373737 | 99 | 8 | 35 | 12.375 | 0.596774 | 0 | 0 | 0 | 0 | 0 | 0.40404 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a72ebb2a27d563659e973ade8a065bc4452f3e51 | 200 | py | Python | web/demo/bff/flaskr/models/trisa_ds_entry.py | trisacrypto/testnet | 46574df999a82ad72dc47c38eb3a36ddef00fdb4 | [
"MIT"
] | 1 | 2022-01-20T23:49:28.000Z | 2022-01-20T23:49:28.000Z | web/demo/bff/flaskr/models/trisa_ds_entry.py | trisacrypto/testnet | 46574df999a82ad72dc47c38eb3a36ddef00fdb4 | [
"MIT"
] | 23 | 2020-12-16T18:26:41.000Z | 2021-06-14T20:18:41.000Z | web/demo/bff/flaskr/models/trisa_ds_entry.py | trisacrypto/testnet | 46574df999a82ad72dc47c38eb3a36ddef00fdb4 | [
"MIT"
] | 1 | 2021-07-21T01:59:56.000Z | 2021-07-21T01:59:56.000Z | from dataclasses import dataclass
from dataclasses_json import dataclass_json
@dataclass_json
@dataclass
class TrisaDsEntry:
trisa_ds_id: str
display_name: str
trisa_protocol_host: str
| 16.666667 | 43 | 0.805 | 26 | 200 | 5.884615 | 0.576923 | 0.196078 | 0.287582 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.165 | 200 | 11 | 44 | 18.181818 | 0.916168 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a734cd9e274f539a4659311a11d1351960a8f9f0 | 1,040 | py | Python | streams/core_streams/junction_stream.py | hvuhsg/streams | b181d23890259579c0675704c9057f3426652048 | [
"MIT"
] | 2 | 2019-08-13T11:58:23.000Z | 2021-03-25T20:18:37.000Z | streams/core_streams/junction_stream.py | hvuhsg/streams | b181d23890259579c0675704c9057f3426652048 | [
"MIT"
] | null | null | null | streams/core_streams/junction_stream.py | hvuhsg/streams | b181d23890259579c0675704c9057f3426652048 | [
"MIT"
] | null | null | null | from threading import current_thread
from streams.core_streams.basic_stream import BasicStream
from streams.Helpers import check_stream
class JunctionStream(BasicStream):
def __init__(self, stream_name):
super(JunctionStream, self).__init__(stream_name)
self._next_stream_options = dict()
self._next_stream_id_storage = dict() # for multi threading systems
def connect(self, next_stream, next_stream_id, *args, **kwargs):
check_stream(next_stream) # check stream type
if next_stream_id in self._next_stream_options:
raise Warning("next_stream_id already defined")
self._next_stream_options[next_stream_id] = next_stream
def next_stream(self):
return self._next_stream_options[self.next_stream_id]
@property
def next_stream_id(self):
return self._next_stream_id_storage[current_thread()]
@next_stream_id.setter
def next_stream_id(self, next_stream_id):
self._next_stream_id_storage[current_thread()] = next_stream_id
| 32.5 | 76 | 0.742308 | 139 | 1,040 | 5.086331 | 0.28777 | 0.29703 | 0.220651 | 0.113154 | 0.281471 | 0.175389 | 0.175389 | 0.135785 | 0.135785 | 0.135785 | 0 | 0 | 0.184615 | 1,040 | 31 | 77 | 33.548387 | 0.833726 | 0.043269 | 0 | 0 | 0 | 0 | 0.030334 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0 | 0.142857 | 0.095238 | 0.52381 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
595b7ed6082d8aa42b7ec91fcdecd862dd671cd2 | 210 | py | Python | rsa/rsa/__init__.py | andrew-kulikov/crypto | c81cf7965d58da23ce234435676c8516daf3c649 | [
"MIT"
] | null | null | null | rsa/rsa/__init__.py | andrew-kulikov/crypto | c81cf7965d58da23ce234435676c8516daf3c649 | [
"MIT"
] | null | null | null | rsa/rsa/__init__.py | andrew-kulikov/crypto | c81cf7965d58da23ce234435676c8516daf3c649 | [
"MIT"
] | null | null | null | from rsa.key import newkeys, PrivateKey, PublicKey
from rsa.pkcs1 import encrypt, decrypt, DecryptionError
__all__ = ['newkeys', 'encrypt', 'decrypt', 'PublicKey',
'PrivateKey', 'DecryptionError']
| 30 | 56 | 0.719048 | 21 | 210 | 7 | 0.571429 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00565 | 0.157143 | 210 | 6 | 57 | 35 | 0.824859 | 0 | 0 | 0 | 0 | 0 | 0.261905 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
5968cd2cd509daa5ac3a94dd12b69ebfa16a62c2 | 286 | py | Python | analytics.py | WGierke/weightlifting_germany_server | 2477ce6d7c6a19dfe7b79728ddcb1b6f6ccf5756 | [
"Apache-2.0"
] | 1 | 2016-09-08T13:19:32.000Z | 2016-09-08T13:19:32.000Z | analytics.py | WGierke/weightlifting_germany_server | 2477ce6d7c6a19dfe7b79728ddcb1b6f6ccf5756 | [
"Apache-2.0"
] | 1 | 2016-09-05T08:42:07.000Z | 2017-10-12T08:12:06.000Z | analytics.py | WGierke/weightlifting_germany_server | 2477ce6d7c6a19dfe7b79728ddcb1b6f6ccf5756 | [
"Apache-2.0"
] | null | null | null | from utils import notify_users, print_buli_filters, print_blog_filters, print_shared_protocols
if __name__ == '__main__':
print "Cleaning outdated tokens ..."
notify_users("A", "A", "A", "A", "A#A")
print_buli_filters()
print_blog_filters()
print_shared_protocols() | 35.75 | 94 | 0.72028 | 38 | 286 | 4.842105 | 0.473684 | 0.054348 | 0.065217 | 0.065217 | 0.597826 | 0.565217 | 0.565217 | 0.565217 | 0.565217 | 0 | 0 | 0 | 0.153846 | 286 | 8 | 95 | 35.75 | 0.760331 | 0 | 0 | 0 | 0 | 0 | 0.149826 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.142857 | null | null | 0.714286 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
5974f84e83065b629c5277f42bc8ee83f77e0931 | 341 | py | Python | dingdang/client/mute_alsa.py | Suhine/SmartAudioHome | d213c13fe00d75b51016c20c0167e8fde9f3b564 | [
"MIT"
] | 2 | 2019-05-03T04:26:37.000Z | 2019-05-13T15:02:48.000Z | dingdang/client/mute_alsa.py | Suhine/SmartAudioHome | d213c13fe00d75b51016c20c0167e8fde9f3b564 | [
"MIT"
] | null | null | null | dingdang/client/mute_alsa.py | Suhine/SmartAudioHome | d213c13fe00d75b51016c20c0167e8fde9f3b564 | [
"MIT"
] | null | null | null | import ctypes
ERROR_HANDLER_FUNC = ctypes.CFUNCTYPE(None, ctypes.c_char_p, ctypes.c_int,
ctypes.c_char_p, ctypes.c_int,
ctypes.c_char_p)
def py_error_handler(filename, line, function, err, fmt):
pass
c_error_handler = ERROR_HANDLER_FUNC(py_error_handler)
| 24.357143 | 74 | 0.618768 | 45 | 341 | 4.288889 | 0.422222 | 0.310881 | 0.170984 | 0.186529 | 0.290155 | 0.290155 | 0.290155 | 0.290155 | 0.290155 | 0.290155 | 0 | 0 | 0.31085 | 341 | 13 | 75 | 26.230769 | 0.821277 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.142857 | 0.142857 | 0 | 0.285714 | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
5982f26db1b354784262e0f91e25bc33059ad416 | 7,932 | py | Python | doc/jupyter_execute/examples/kafka/cifar10/cifar10_kafka.py | edshee/seldon-core | 78c10fbca16a5e2a0c25b9673aa3deb220070e26 | [
"Apache-2.0"
] | null | null | null | doc/jupyter_execute/examples/kafka/cifar10/cifar10_kafka.py | edshee/seldon-core | 78c10fbca16a5e2a0c25b9673aa3deb220070e26 | [
"Apache-2.0"
] | null | null | null | doc/jupyter_execute/examples/kafka/cifar10/cifar10_kafka.py | edshee/seldon-core | 78c10fbca16a5e2a0c25b9673aa3deb220070e26 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# # Seldon Kafka Integration Example with CIFAR10 Model
#
# In this example we will run SeldonDeployments for a CIFAR10 Tensorflow model which take their inputs from a Kafka topic and push their outputs to a Kafka topic. We will experiment with both REST and gRPC Seldon graphs. For REST we will load our input topic with Tensorflow JSON requests and for gRPC we will load Tensorflow PredictRequest protoBuffers.
# ## Requirements
#
# * [Install gsutil](https://cloud.google.com/storage/docs/gsutil_install)
#
# In[ ]:
get_ipython().system('pip install -r requirements.txt')
# ## Setup Kafka
# Install Strimzi on cluster
# In[ ]:
get_ipython().system('helm repo add strimzi https://strimzi.io/charts/')
# In[ ]:
get_ipython().system('helm install my-release strimzi/strimzi-kafka-operator')
# Set the following to whether you are running a local Kind cluster or a cloud based cluster.
# In[ ]:
clusterType = "kind"
# clusterType="cloud"
# In[ ]:
if clusterType == "kind":
get_ipython().system('kubectl apply -f cluster-kind.yaml')
else:
get_ipython().system('kubectl apply -f cluster-cloud.yaml')
# Get broker endpoint.
# In[ ]:
if clusterType == "kind":
res = get_ipython().getoutput("kubectl get service my-cluster-kafka-external-bootstrap -n default -o=jsonpath='{.spec.ports[0].nodePort}'")
port = res[0]
get_ipython().run_line_magic('env', 'BROKER=172.17.0.2:$port')
else:
res = get_ipython().getoutput("kubectl get service my-cluster-kafka-external-bootstrap -o=jsonpath='{.status.loadBalancer.ingress[0].hostname}'")
if len(res) == 1:
hostname = res[0]
get_ipython().run_line_magic('env', 'BROKER=$h:9094')
else:
res = get_ipython().getoutput("kubectl get service my-cluster-kafka-external-bootstrap -o=jsonpath='{.status.loadBalancer.ingress[0].ip}'")
ip = res[0]
get_ipython().run_line_magic('env', 'BROKER=$ip:9094')
# In[ ]:
get_ipython().run_cell_magic('writefile', 'topics.yaml', 'apiVersion: kafka.strimzi.io/v1beta1\nkind: KafkaTopic\nmetadata:\n name: cifar10-rest-input\n labels:\n strimzi.io/cluster: "my-cluster"\nspec:\n partitions: 2\n replicas: 1\n---\napiVersion: kafka.strimzi.io/v1beta1\nkind: KafkaTopic\nmetadata:\n name: cifar10-rest-output\n labels:\n strimzi.io/cluster: "my-cluster"\nspec:\n partitions: 2\n replicas: 1\n---\napiVersion: kafka.strimzi.io/v1beta1\nkind: KafkaTopic\nmetadata:\n name: cifar10-grpc-input\n labels:\n strimzi.io/cluster: "my-cluster"\nspec:\n partitions: 2\n replicas: 1\n---\napiVersion: kafka.strimzi.io/v1beta1\nkind: KafkaTopic\nmetadata:\n name: cifar10-grpc-output\n labels:\n strimzi.io/cluster: "my-cluster"\nspec:\n partitions: 2\n replicas: 1')
# In[ ]:
get_ipython().system('kubectl apply -f topics.yaml')
# ## Install Seldon
#
# * [Install Seldon](https://docs.seldon.io/projects/seldon-core/en/latest/workflow/install.html)
# * [Follow our docs to intstall the Grafana analytics](https://docs.seldon.io/projects/seldon-core/en/latest/analytics/analytics.html).
# ## Download Test Request Data
# We have two example datasets containing 50,000 requests in tensorflow serving format for CIFAR10. One in JSON format and one as length encoded proto buffers.
# In[ ]:
get_ipython().system('gsutil cp gs://seldon-datasets/cifar10/requests/tensorflow/cifar10_tensorflow.json.gz cifar10_tensorflow.json.gz')
get_ipython().system('gunzip cifar10_tensorflow.json.gz')
get_ipython().system('gsutil cp gs://seldon-datasets/cifar10/requests/tensorflow/cifar10_tensorflow.proto cifar10_tensorflow.proto')
# ## Test CIFAR10 REST Model
# Upload tensorflow serving rest requests to kafka. This may take some time dependent on your network connection.
# In[ ]:
get_ipython().system('python ../../../util/kafka/test-client.py produce $BROKER cifar10-rest-input --file cifar10_tensorflow.json')
# In[ ]:
res = get_ipython().getoutput("kubectl get service my-cluster-kafka-external-bootstrap -o=jsonpath='{.spec.clusterIP}'")
ip = res[0]
get_ipython().run_line_magic('env', 'BROKER_CIP=$ip')
# In[ ]:
get_ipython().run_cell_magic('writefile', 'cifar10_rest.yaml', 'apiVersion: machinelearning.seldon.io/v1\nkind: SeldonDeployment\nmetadata:\n name: tfserving-cifar10\nspec:\n protocol: tensorflow\n transport: rest\n serverType: kafka \n predictors:\n - componentSpecs:\n - spec:\n containers:\n - args: \n - --port=8500\n - --rest_api_port=8501\n - --model_name=resnet32\n - --model_base_path=gs://seldon-models/tfserving/cifar10/resnet32\n - --enable_batching\n image: tensorflow/serving\n name: resnet32\n ports:\n - containerPort: 8501\n name: http\n svcOrchSpec:\n env:\n - name: KAFKA_BROKER\n value: BROKER_IP\n - name: KAFKA_INPUT_TOPIC\n value: cifar10-rest-input\n - name: KAFKA_OUTPUT_TOPIC\n value: cifar10-rest-output\n graph:\n name: resnet32\n type: MODEL\n endpoint:\n service_port: 8501\n name: model\n replicas: 1')
# In[ ]:
get_ipython().system('cat cifar10_rest.yaml | sed s/BROKER_IP/$BROKER_CIP:9094/ | kubectl apply -f -')
# Looking at the metrics dashboard for Seldon you should see throughput we are getting. For a single replica on GKE with n1-standard-4 nodes we can see roughly 150 requests per second being processed.
#
# 
# In[ ]:
get_ipython().system('kubectl delete -f cifar10_rest.yaml')
# ## Test CIFAR10 gRPC Model
# Upload tensorflow serving rest requests to kafka. This is a file of protobuffer `tenserflow.serving.PredictRequest` ([defn](https://github.com/tensorflow/serving/blob/master/tensorflow_serving/apis/predict.proto)). Each binary protobuffer is prefixed by the numbre of bytes. Out test-client python script reads them and sends to our topic. This may take some time dependent on your network connection.
# In[ ]:
get_ipython().system('python ../../../util/kafka/test-client.py produce $BROKER cifar10-grpc-input --file cifar10_tensorflow.proto --proto_name tensorflow.serving.PredictRequest')
# In[ ]:
res = get_ipython().getoutput("kubectl get service my-cluster-kafka-external-bootstrap -o=jsonpath='{.spec.clusterIP}'")
ip = res[0]
get_ipython().run_line_magic('env', 'BROKER_CIP=$ip')
# In[ ]:
get_ipython().run_cell_magic('writefile', 'cifar10_grpc.yaml', 'apiVersion: machinelearning.seldon.io/v1\nkind: SeldonDeployment\nmetadata:\n name: tfserving-cifar10\nspec:\n protocol: tensorflow\n transport: grpc\n serverType: kafka \n predictors:\n - componentSpecs:\n - spec:\n containers:\n - args: \n - --port=8500\n - --rest_api_port=8501\n - --model_name=resnet32\n - --model_base_path=gs://seldon-models/tfserving/cifar10/resnet32\n - --enable_batching \n image: tensorflow/serving\n name: resnet32\n ports:\n - containerPort: 8500\n name: http\n svcOrchSpec:\n env:\n - name: KAFKA_BROKER\n value: BROKER_IP\n - name: KAFKA_INPUT_TOPIC\n value: cifar10-grpc-input\n - name: KAFKA_OUTPUT_TOPIC\n value: cifar10-grpc-output\n graph:\n name: resnet32\n type: MODEL\n endpoint:\n service_port: 8500\n name: model\n replicas: 2')
# In[ ]:
get_ipython().system('cat cifar10_grpc.yaml | sed s/BROKER_IP/$BROKER_CIP:9094/ | kubectl apply -f -')
# Looking at the metrics dashboard for Seldon you should see throughput we are getting. For a single replica on GKE with n1-standard-4 nodes we can see around 220 requests per second being processed.
#
# 
# In[ ]:
get_ipython().system('kubectl delete -f cifar10_grpc.yaml')
# In[ ]:
| 42.645161 | 1,033 | 0.698185 | 1,114 | 7,932 | 4.888689 | 0.232496 | 0.051414 | 0.044069 | 0.036357 | 0.693353 | 0.665626 | 0.656261 | 0.61715 | 0.61715 | 0.556188 | 0 | 0.027858 | 0.167297 | 7,932 | 185 | 1,034 | 42.875676 | 0.796669 | 0.291856 | 0 | 0.3 | 0 | 0.275 | 0.778198 | 0.297117 | 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 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
59a3b991d3f090bd0fc86225401086b6affae078 | 96 | py | Python | src/hypertrace/version.py | hypertrace/pythonagent | 283e18c61807f4ae653d147be9ff1424b0b0a6eb | [
"Apache-2.0"
] | 4 | 2021-05-19T16:16:26.000Z | 2022-01-16T04:48:43.000Z | src/hypertrace/version.py | hypertrace/pythonagent | 283e18c61807f4ae653d147be9ff1424b0b0a6eb | [
"Apache-2.0"
] | 48 | 2021-04-27T07:25:48.000Z | 2021-08-30T21:27:27.000Z | src/hypertrace/version.py | hypertrace/pythonagent | 283e18c61807f4ae653d147be9ff1424b0b0a6eb | [
"Apache-2.0"
] | null | null | null | # Code generated by ./release.sh. DO NOT EDIT.
"""Package version"""
__version__ = "0.9.5-dev"
| 19.2 | 46 | 0.666667 | 15 | 96 | 4 | 0.933333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036585 | 0.145833 | 96 | 4 | 47 | 24 | 0.695122 | 0.635417 | 0 | 0 | 1 | 0 | 0.310345 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
59cb1a808d8b3e2a8c5f39027ceb2e7adb8a97de | 14,690 | py | Python | resources/libraries/python/LispSetup.py | nidhyanandhan/csit | 2156583b4e66f2c3c35903c854b1823b76a4e9a6 | [
"Apache-2.0"
] | null | null | null | resources/libraries/python/LispSetup.py | nidhyanandhan/csit | 2156583b4e66f2c3c35903c854b1823b76a4e9a6 | [
"Apache-2.0"
] | null | null | null | resources/libraries/python/LispSetup.py | nidhyanandhan/csit | 2156583b4e66f2c3c35903c854b1823b76a4e9a6 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2016-2020 Cisco and/or its affiliates.
# 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.
"""Library to set up Lisp in topology."""
from enum import IntEnum
from ipaddress import ip_address
from resources.libraries.python.IPUtil import IPUtil
from resources.libraries.python.PapiExecutor import PapiSocketExecutor
class EidType(IntEnum):
"""EID types."""
PREFIX = 0
MAC = 1
NSH = 2
class LispEid:
"""Class for lisp eid."""
@staticmethod
def create_eid(eid, prefix_len):
"""Create lisp eid object.
:param eid: Eid value.
:param prefix_len: Prefix len if the eid is IP address.
:type eid: str
:type prefix_len: int
"""
eid_addr = dict(prefix=IPUtil.create_prefix_object(
ip_address(eid), prefix_len)
) if prefix_len else dict(mac=str(eid))
return dict(
type=getattr(
EidType, u"PREFIX" if prefix_len else u"MAC"
).value,
address=eid_addr
)
class LispRemoteLocator:
"""Class for lisp remote locator."""
@staticmethod
def create_rloc(ip_addr, priority=0, weight=0):
"""Create lisp remote locator object.
:param ip_addr: IP/IPv6 address.
:param priority: Priority of the remote locator.
:param weight: Weight of the remote locator.
:type ip_addr: str
:type priority: int
:type weight: int
"""
return [
dict(
priority=priority,
weight=weight,
ip_address=ip_address(ip_addr)
)
]
class LispStatus:
"""Class for lisp API."""
@staticmethod
def vpp_lisp_enable_disable(node, state):
"""Enable/Disable lisp in the VPP node in topology.
:param node: Node of the test topology.
:param state: State of the lisp, enable or disable.
:type node: dict
:type state: str
"""
args = dict(is_enable=bool(state == u"enable"))
cmd = u"lisp_enable_disable"
err_msg = f"Failed to set LISP status on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
class LispRemoteMapping:
"""Class for lisp remote mapping API."""
@staticmethod
def vpp_add_lisp_remote_mapping(
node, vni, deid, deid_prefix, seid, seid_prefix, rloc,
is_mac=False):
"""Add lisp remote mapping on the VPP node in topology.
:param node: VPP node.
:param vni: Vni.
:param deid: Destination eid address.
:param deid_prefix: Destination eid address prefix_len.
:param seid: Source eid address.
:param seid_prefix: Source eid address prefix_len.
:param rloc: Receiver locator.
:param is_mac: Set to True if the deid/seid is MAC address.
:type node: dict
:type vni: int
:type deid: str
:type deid_prefix: int
:type seid: str
:type seid_prefix: int
:type rloc: str
:type is_mac: bool
"""
args = dict(
is_add=True,
is_src_dst=True,
vni=int(vni),
deid=LispEid.create_eid(deid, deid_prefix if not is_mac else None),
seid=LispEid.create_eid(seid, seid_prefix if not is_mac else None),
rloc_num=1,
rlocs=LispRemoteLocator.create_rloc(rloc)
)
cmd = u"lisp_add_del_remote_mapping"
err_msg = f"Failed to add remote mapping on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
@staticmethod
def vpp_del_lisp_remote_mapping(
node, vni, deid, deid_prefix, seid, seid_prefix, rloc):
"""Delete lisp remote mapping on the VPP node in topology.
:param node: VPP node.
:param vni: Vni.
:param deid: Destination eid address.
:param deid_prefix: Destination eid address prefix_len.
:param seid: Source eid address.
:param seid_prefix: Source eid address prefix_len.
:param rloc: Receiver locator.
:type node: dict
:type vni: int
:type deid: str
:type deid_prefix: int
:type seid: str
:type seid_prefix: int
:type rloc: str
"""
# used only with IPs
args = dict(
is_add=False,
is_src_dst=True,
vni=int(vni),
deid=LispEid.create_eid(deid, deid_prefix),
seid=LispEid.create_eid(seid, seid_prefix),
rloc_num=1,
rlocs=LispRemoteLocator.create_rloc(rloc)
)
cmd = u"lisp_add_del_remote_mapping"
err_msg = f"Failed to delete remote mapping on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
class LispAdjacency:
"""Class for lisp adjacency API."""
@staticmethod
def vpp_add_lisp_adjacency(
node, vni, deid, deid_prefix, seid, seid_prefix, is_mac=False):
"""Add lisp adjacency on the VPP node in topology.
:param node: VPP node.
:param vni: Vni.
:param deid: Destination eid address.
:param deid_prefix: Destination eid address prefix_len.
:param seid: Source eid address.
:param seid_prefix: Source eid address prefix_len.
:param is_mac: Set to True if the deid/seid is MAC address.
:type node: dict
:type vni: int
:type deid: str
:type deid_prefix: int
:type seid: str
:type seid_prefix: int
:type is_mac: bool
"""
args = dict(
is_add=True,
vni=int(vni),
reid=LispEid.create_eid(deid, deid_prefix if not is_mac else None),
leid=LispEid.create_eid(seid, seid_prefix if not is_mac else None)
)
cmd = u"lisp_add_del_adjacency"
err_msg = f"Failed to add lisp adjacency on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
@staticmethod
def vpp_del_lisp_adjacency(
node, vni, deid, deid_prefix, seid, seid_prefix):
"""Delete lisp adjacency on the VPP node in topology.
:param node: VPP node.
:param vni: Vni.
:param deid: Destination eid address.
:param deid_prefix: Destination eid address prefix_len.
:param seid: Source eid address.
:param seid_prefix: Source eid address prefix_len.
:type node: dict
:type vni: int
:type deid: str
:type deid_prefix: int
:type seid: str
:type seid_prefix: int
"""
# used only with IPs
args = dict(
is_add=False,
vni=int(vni),
eid=LispEid.create_eid(deid, deid_prefix),
leid=LispEid.create_eid(seid, seid_prefix)
)
cmd = u"lisp_add_del_adjacency"
err_msg = f"Failed to delete lisp adjacency on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
class LispGpeStatus:
"""Class for LISP GPE status manipulation."""
@staticmethod
def vpp_lisp_gpe_enable_disable(node, state):
"""Change the state of LISP GPE - enable or disable.
:param node: VPP node.
:param state: Requested state - enable or disable.
:type node: dict
:type state: str
"""
args = dict(is_enable=bool(state == u"enable"))
cmd = u"gpe_enable_disable"
err_msg = f"Failed to set LISP GPE status on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
class LispLocalEid:
"""Class for Lisp local eid API."""
@staticmethod
def vpp_add_lisp_local_eid(
node, locator_set_name, vni, eid, prefix_len=None):
"""Set lisp eid address on the VPP node in topology.
:param node: VPP node.
:param locator_set_name: Name of the locator_set.
:param vni: Vni value.
:param eid: Eid value.
:param prefix_len: Prefix len if the eid is IP address.
:type node: dict
:type locator_set_name: str
:type vni: int
:type eid: str
:type prefix_len: int
"""
args = dict(
is_add=True,
eid=LispEid.create_eid(eid, prefix_len),
locator_set_name=locator_set_name,
vni=int(vni)
)
cmd = u"lisp_add_del_local_eid"
err_msg = f"Failed to add local eid on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
@staticmethod
def vpp_del_lisp_local_eid(
node, locator_set_name, vni, eid, prefix_len=None):
"""Set lisp eid address on the VPP node in topology.
:param node: VPP node.
:param locator_set_name: Name of the locator_set.
:param vni: Vni value.
:param eid: Eid value.
:param prefix_len: Prefix len if the eid is IP address.
:type node: dict
:type locator_set_name: str
:type vni: int
:type eid: str
:type prefix_len: int
"""
args = dict(
is_add=False,
eid=LispEid.create_eid(eid, prefix_len),
locator_set_name=locator_set_name,
vni=int(vni)
)
cmd = u"lisp_add_del_local_eid"
err_msg = f"Failed to delete local eid on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
class LispLocator:
"""Class for the Lisp Locator API."""
@staticmethod
def vpp_add_lisp_locator(node, locator_name, sw_if_index, priority, weight):
"""Set lisp locator on the VPP node in topology.
:param node: VPP node.
:param locator_name: Name of the locator_set.
:param sw_if_index: Sw_if_index if the interface.
:param priority: Priority of the locator.
:param weight: Weight of the locator.
:type node: dict
:type locator_name: str
:type sw_if_index: int
:type priority: int
:type weight: int
"""
args = dict(
is_add=True,
locator_set_name=locator_name,
sw_if_index=sw_if_index,
priority=priority,
weight=weight
)
cmd = u"lisp_add_del_locator"
err_msg = f"Failed to add locator on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
@staticmethod
def vpp_del_lisp_locator(node, locator_name, sw_if_index, priority, weight):
"""Unset lisp locator on the VPP node in topology.
:param node: VPP node.
:param locator_name: Name of the locator_set.
:param sw_if_index: Sw_if_index if the interface.
:param priority: Priority of the locator.
:param weight: Weight of the locator.
:type node: dict
:type locator_name: str
:type sw_if_index: int
:type priority: int
:type weight: int
"""
args = dict(
is_add=False,
locator_set_name=locator_name,
sw_if_index=sw_if_index,
priority=priority,
weight=weight
)
cmd = u"lisp_add_del_locator"
err_msg = f"Failed to delete locator on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
class LispLocatorSet:
"""Class for Lisp Locator Set API."""
@staticmethod
def vpp_add_lisp_locator_set(node, name):
"""Add lisp locator_set on VPP.
:param node: VPP node.
:param name: VPP locator name.
:type node: dict
:type name: str
"""
args = dict(
is_add=True,
locator_set_name=name,
locator_num=0,
locators=[]
)
cmd = u"lisp_add_del_locator_set"
err_msg = f"Failed to add locator set on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
@staticmethod
def vpp_del_lisp_locator_set(node, name):
"""Del lisp locator_set on VPP.
:param node: VPP node.
:param name: VPP locator name.
:type node: dict
:type name: str
"""
args = dict(
is_add=False,
locator_set_name=name,
locator_num=0,
locators=[]
)
cmd = u"lisp_add_del_locator_set"
err_msg = f"Failed to delete locator set on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
class LispEidTableMap:
"""
Class for EID table map.
"""
@staticmethod
def vpp_lisp_eid_table_mapping(node, vni, bd_id=None, vrf=None):
"""
Map LISP VNI to either bridge domain ID, or VRF ID.
:param node: VPP node.
:param vni: Lisp VNI.
:param bd_id: Bridge domain ID.
:param vrf: VRF id.
:type node: dict
:type vni: int
:type bd_id: int
:type vrf: int
"""
# adding default mapping vni=0, vrf=0 needs to be skipped
if bd_id is not None or int(vrf if vrf else 0) or int(vni):
args = dict(
is_add=True,
vni=int(vni),
dp_table=int(bd_id) if bd_id is not None else int(vrf),
is_l2=bool(bd_id is not None)
)
cmd = u"lisp_eid_table_add_del_map"
err_msg = f"Failed to add eid table map on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.add(cmd, **args).get_reply(err_msg)
| 31.796537 | 80 | 0.597958 | 1,966 | 14,690 | 4.293489 | 0.098169 | 0.031987 | 0.02322 | 0.024642 | 0.763298 | 0.748016 | 0.716384 | 0.689136 | 0.682857 | 0.660111 | 0 | 0.002583 | 0.314772 | 14,690 | 461 | 81 | 31.86551 | 0.835983 | 0.359156 | 0 | 0.545 | 0 | 0 | 0.120446 | 0.026766 | 0 | 0 | 0 | 0 | 0 | 1 | 0.075 | false | 0 | 0.02 | 0 | 0.175 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ab72c7e3630454c55675ca860718f37a81d3167e | 2,019 | py | Python | testapp/migrations/0001_initial.py | darklow/django-cryptographic-fields | b8f761a390847fe30085d1ba53176cdca8ed987d | [
"MIT"
] | 28 | 2015-04-30T11:24:26.000Z | 2022-02-28T17:56:51.000Z | testapp/migrations/0001_initial.py | darklow/django-cryptographic-fields | b8f761a390847fe30085d1ba53176cdca8ed987d | [
"MIT"
] | 21 | 2015-05-11T17:02:46.000Z | 2022-03-09T03:24:17.000Z | testapp/migrations/0001_initial.py | darklow/django-cryptographic-fields | b8f761a390847fe30085d1ba53176cdca8ed987d | [
"MIT"
] | 25 | 2015-05-11T16:51:04.000Z | 2022-01-15T19:16:07.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import cryptographic_fields.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='TestModel',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('enc_char_field', cryptographic_fields.fields.EncryptedCharField(max_length=396)),
('enc_text_field', cryptographic_fields.fields.EncryptedTextField()),
('enc_date_field', cryptographic_fields.fields.EncryptedDateField(max_length=100, null=True)),
('enc_date_now_field', cryptographic_fields.fields.EncryptedDateField(auto_now=True, max_length=100, null=True)),
('enc_date_now_add_field', cryptographic_fields.fields.EncryptedDateField(auto_now_add=True, max_length=100, null=True)),
('enc_datetime_field', cryptographic_fields.fields.EncryptedDateTimeField(max_length=100, null=True)),
('enc_boolean_field', cryptographic_fields.fields.EncryptedBooleanField(default=True, max_length=100)),
('enc_null_boolean_field', cryptographic_fields.fields.EncryptedNullBooleanField(max_length=100)),
('enc_integer_field', cryptographic_fields.fields.EncryptedIntegerField(null=True)),
('enc_positive_integer_field', cryptographic_fields.fields.EncryptedPositiveIntegerField(null=True)),
('enc_small_integer_field', cryptographic_fields.fields.EncryptedSmallIntegerField(null=True)),
('enc_positive_small_integer_field', cryptographic_fields.fields.EncryptedPositiveSmallIntegerField(null=True)),
('enc_big_integer_field', cryptographic_fields.fields.EncryptedBigIntegerField(null=True)),
],
options={
},
bases=(models.Model,),
),
]
| 54.567568 | 137 | 0.691431 | 195 | 2,019 | 6.815385 | 0.328205 | 0.20015 | 0.263356 | 0.293454 | 0.407073 | 0.231753 | 0.151242 | 0.045147 | 0 | 0 | 0 | 0.013631 | 0.200594 | 2,019 | 36 | 138 | 56.083333 | 0.809789 | 0.010401 | 0 | 0 | 0 | 0 | 0.135772 | 0.073146 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.1 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ab748fc7fe44f54c011f25c13b8d6be442829fae | 521 | py | Python | tests/test_batch_overview.py | Inch4Tk/label_server | 3d0c39dd5a0c456794a1375051ca4f93a438ebf6 | [
"MIT"
] | null | null | null | tests/test_batch_overview.py | Inch4Tk/label_server | 3d0c39dd5a0c456794a1375051ca4f93a438ebf6 | [
"MIT"
] | null | null | null | tests/test_batch_overview.py | Inch4Tk/label_server | 3d0c39dd5a0c456794a1375051ca4f93a438ebf6 | [
"MIT"
] | null | null | null | import pytest
def test_index(client, auth):
response = client.get("/")
assert response.headers["Location"] == "http://localhost/auth/login"
auth.login()
response = client.get("/")
assert b"Log Out" in response.data
assert b"burger_crawled_example" in response.data
assert b"yt_extract" in response.data
assert b"Images: 5" in response.data
assert b"Labels: 5" in response.data
assert b"Percentage: 100.0" in response.data
assert b'href="/label_images/1/"' in response.data
| 28.944444 | 72 | 0.68906 | 76 | 521 | 4.657895 | 0.447368 | 0.138418 | 0.276836 | 0.338983 | 0.361582 | 0.124294 | 0 | 0 | 0 | 0 | 0 | 0.016471 | 0.184261 | 521 | 17 | 73 | 30.647059 | 0.816471 | 0 | 0 | 0.153846 | 0 | 0 | 0.257692 | 0.086538 | 0 | 0 | 0 | 0 | 0.615385 | 1 | 0.076923 | false | 0 | 0.076923 | 0 | 0.153846 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ab86671d54ec4a8c8b4a53cc97a2cc4cabe806d5 | 26 | py | Python | codemach/tests/source/loop_0x0.py | chuck1/myexecutor | 6b70d2e7bc9ace0efde8e38f75be2b928393bfdf | [
"MIT"
] | null | null | null | codemach/tests/source/loop_0x0.py | chuck1/myexecutor | 6b70d2e7bc9ace0efde8e38f75be2b928393bfdf | [
"MIT"
] | 37 | 2017-06-29T22:42:08.000Z | 2019-01-22T18:22:57.000Z | codemach/tests/source/loop_0x0.py | chuck1/myexecutor | 6b70d2e7bc9ace0efde8e38f75be2b928393bfdf | [
"MIT"
] | null | null | null | for a in [0, 1]: continue
| 13 | 25 | 0.615385 | 6 | 26 | 2.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 0.230769 | 26 | 1 | 26 | 26 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 3 |
ab904fdb1d242e1dd88886df93589aa1ed8af0f7 | 2,441 | py | Python | tests/base_validation_case.py | ThomasSchuetz/ThermalBuildingModel | f1a9417451374ac5632980df62f859a51e91851a | [
"MIT"
] | null | null | null | tests/base_validation_case.py | ThomasSchuetz/ThermalBuildingModel | f1a9417451374ac5632980df62f859a51e91851a | [
"MIT"
] | null | null | null | tests/base_validation_case.py | ThomasSchuetz/ThermalBuildingModel | f1a9417451374ac5632980df62f859a51e91851a | [
"MIT"
] | 1 | 2020-10-17T21:18:56.000Z | 2020-10-17T21:18:56.000Z | # -*- coding: utf-8 -*-
import numpy as np
class BaseValidationCase:
def __init__(self, times_per_hour=60, total_days=60):
self.times_per_hour = times_per_hour
hours_per_day = 24
self.total_days = total_days
self.total_timesteps = hours_per_day * times_per_hour * total_days
self.total_hours = total_days * hours_per_day # used for result evaluation
self.timesteps_day = int(hours_per_day * times_per_hour)
def get_building_parameters(self):
return {}
def get_ventilation_rate(self):
return np.zeros(self.total_timesteps)
def get_solar_radiation(self):
return np.zeros((self.total_timesteps, 1))
def get_internal_gains_convective(self):
# Q_ig
return np.zeros(self.total_timesteps)
def get_internal_gains_radiative(self):
#source_igRad
return np.zeros(self.total_timesteps)
def get_alpha_radiative(self):
return np.zeros(self.total_timesteps) + 5
def get_equal_air_temperature(self):
return np.zeros(self.total_timesteps) + 295.15
def get_weather_temperature(self):
return np.zeros(self.total_timesteps) + 295.15
def get_k_radiative(self):
return 1
def get_set_temperature_heating(self):
return np.zeros(self.total_timesteps)
def get_set_temperature_cooling(self):
return np.zeros(self.total_timesteps) + 600
def get_maximum_heater_output(self):
return np.zeros((self.total_timesteps, 3)) + 1e10
def get_maximum_chiller_output(self):
return np.zeros((self.total_timesteps, 3)) - 1e10
def get_heater_order(self):
return np.array([1,2,3])
def get_chiller_order(self):
return np.array([1,2,3])
def get_time_discretization(self):
return int(3600 / self.times_per_hour)
def get_initial_temperatures(self):
return dict(T_air_init=295.15, T_iw_init=295.15, T_ow_init=295.15)
def _get_profile(self, base_value, peak_value, peak_begin, peak_end):
result = np.zeros(self.timesteps_day) + base_value
index_peak_begin = int(peak_begin * self.times_per_hour)
index_peak_end = int(peak_end * self.times_per_hour)
result[index_peak_begin : index_peak_end] = peak_value
return np.tile(result, self.total_days)
| 32.546667 | 82 | 0.662843 | 336 | 2,441 | 4.470238 | 0.25 | 0.071904 | 0.143808 | 0.124501 | 0.406791 | 0.390812 | 0.360186 | 0.29028 | 0.241012 | 0.186418 | 0 | 0.030618 | 0.250717 | 2,441 | 74 | 83 | 32.986486 | 0.790596 | 0.027038 | 0 | 0.163265 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.387755 | false | 0 | 0.020408 | 0.346939 | 0.795918 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ab95bd7579333919b139cce33da6652e7ed03930 | 1,402 | py | Python | students/k3343/practical_works/Suzdaltseva_Margarita/simple_django_web_project/project_first_app/models.py | TonikX/ITMO_ICT_-WebProgramming_2020 | ba566c1b3ab04585665c69860b713741906935a0 | [
"MIT"
] | 10 | 2020-03-20T09:06:12.000Z | 2021-07-27T13:06:02.000Z | students/k3343/practical_works/Suzdaltseva_Margarita/simple_django_web_project/project_first_app/models.py | TonikX/ITMO_ICT_-WebProgramming_2020 | ba566c1b3ab04585665c69860b713741906935a0 | [
"MIT"
] | 134 | 2020-03-23T09:47:48.000Z | 2022-03-12T01:05:19.000Z | students/k3343/practical_works/Suzdaltseva_Margarita/simple_django_web_project/project_first_app/models.py | TonikX/ITMO_ICT_-WebProgramming_2020 | ba566c1b3ab04585665c69860b713741906935a0 | [
"MIT"
] | 71 | 2020-03-20T12:45:56.000Z | 2021-10-31T19:22:25.000Z | from django.db import models
from django.contrib.auth.models import AbstractUser
from django.conf import settings
from django.utils import timezone
class Car(models.Model):
trademark = models.CharField(max_length=50)
model = models.CharField(max_length=50)
color = models.CharField(max_length=50)
number = models.CharField(max_length=50)
class CarOwner(AbstractUser):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
birth_date = models.DateField(default=timezone.now)
cars = models.ManyToManyField(Car, through='Ownership')
passport = models.CharField(max_length=10)
address = models.CharField(max_length=100)
nationality = models.CharField(max_length=50)
class DriversLicense(models.Model):
TYPES = (
('A','moto'),
('B','autoB'),
('C','autoC'),
('D', 'autoD'),
('E', 'autoE'),
# и так далее
)
number = models.CharField(max_length=50)
date_given = models.DateField()
type = models.CharField(max_length=1, choices=TYPES)
owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
class Ownership(models.Model):
owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
car = models.ForeignKey(Car, on_delete=models.CASCADE)
start_date = models.DateField()
end_date = models.DateField()
| 34.195122 | 81 | 0.708274 | 176 | 1,402 | 5.505682 | 0.380682 | 0.170279 | 0.204334 | 0.272446 | 0.375645 | 0.29515 | 0.130031 | 0.130031 | 0.130031 | 0.130031 | 0 | 0.0189 | 0.169757 | 1,402 | 40 | 82 | 35.05 | 0.813574 | 0.007846 | 0 | 0.117647 | 0 | 0 | 0.027378 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.029412 | 0.117647 | 0 | 0.823529 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
ab9fd3ca3369e6d3b9d89ccb610f0b38cec27c57 | 211 | py | Python | meiduo/meiduo/apps/orders/urls.py | q934744153/meiduo_mall | 6f5b0ae38cc80c21ddca161c428fea09584d4b95 | [
"MIT"
] | null | null | null | meiduo/meiduo/apps/orders/urls.py | q934744153/meiduo_mall | 6f5b0ae38cc80c21ddca161c428fea09584d4b95 | [
"MIT"
] | null | null | null | meiduo/meiduo/apps/orders/urls.py | q934744153/meiduo_mall | 6f5b0ae38cc80c21ddca161c428fea09584d4b95 | [
"MIT"
] | null | null | null | from django.urls import re_path,path
from . import views
urlpatterns = [
re_path(r'^orders/settlement/$', views.OrderSettlementView.as_view()),
path('orders/commit/', views.OrderCommitView.as_view()),
] | 30.142857 | 74 | 0.734597 | 27 | 211 | 5.592593 | 0.592593 | 0.07947 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113744 | 211 | 7 | 75 | 30.142857 | 0.807487 | 0 | 0 | 0 | 0 | 0 | 0.160377 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
abbc38b875593641adb56aca748ef1d03d92365d | 347 | py | Python | test/__init__.py | jouvin/SLAM | 89bb877f4947b40b8a97699ae7fbc7e9b18b7519 | [
"Apache-2.0"
] | 1 | 2017-02-25T14:24:23.000Z | 2017-02-25T14:24:23.000Z | test/__init__.py | jouvin/SLAM | 89bb877f4947b40b8a97699ae7fbc7e9b18b7519 | [
"Apache-2.0"
] | 11 | 2015-05-01T13:07:03.000Z | 2019-01-03T11:01:22.000Z | test/__init__.py | jouvin/SLAM | 89bb877f4947b40b8a97699ae7fbc7e9b18b7519 | [
"Apache-2.0"
] | 2 | 2015-03-25T09:25:07.000Z | 2018-10-09T06:08:35.000Z | import os
import sys
sys.path.append("test/")
sys.path.append("src/")
os.environ["DJANGO_SETTINGS_MODULE"] = "webinterface.settings"
from django.core.management import call_command
from django.conf import settings
def setup():
call_command("syncdb", interactive=False)
def teardown():
os.unlink(settings.DATABASES["default"]["NAME"])
| 20.411765 | 62 | 0.74928 | 46 | 347 | 5.565217 | 0.608696 | 0.054688 | 0.101563 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106628 | 347 | 16 | 63 | 21.6875 | 0.825806 | 0 | 0 | 0 | 0 | 0 | 0.198847 | 0.123919 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | true | 0 | 0.363636 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
abc68aba951184f1aef40622c14a5884300b9ab1 | 2,459 | py | Python | nmfTools/NMFtoolbox/diagonalitySoftConstraintsNMF.py | avinashpujala/av_segmentation | 7b6180f2f30df74a4059880cefa7761bf86a0c2b | [
"MIT"
] | 2 | 2020-06-28T03:13:40.000Z | 2020-07-29T11:26:35.000Z | nmfTools/NMFtoolbox/diagonalitySoftConstraintsNMF.py | avinashpujala/av_segmentation | 7b6180f2f30df74a4059880cefa7761bf86a0c2b | [
"MIT"
] | null | null | null | nmfTools/NMFtoolbox/diagonalitySoftConstraintsNMF.py | avinashpujala/av_segmentation | 7b6180f2f30df74a4059880cefa7761bf86a0c2b | [
"MIT"
] | null | null | null | """
Name: diagonalitySoftConstraintsNMF
Date: Jun 2019
Programmer: Christian Dittmar, Yiğitcan Özer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
If you use the 'NMF toolbox' please refer to:
[1] Patricio López-Serrano, Christian Dittmar, Yiğitcan Özer, and Meinard
Müller
NMF Toolbox: Music Processing Applications of Nonnegative Matrix
Factorization
In Proceedings of the International Conference on Digital Audio Effects
(DAFx), 2019.
License:
This file is part of 'NMF toolbox'.
https://www.audiolabs-erlangen.de/resources/MIR/NMFtoolbox/
'NMF toolbox' is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
'NMF toolbox' is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along
with 'NMF toolbox'. If not, see http://www.gnu.org/licenses/.
"""
import numpy as np
from NMFtoolbox.utils import conv2
def diagonalitySoftConstraintsNMF(W, H, iter, numIter, parameter):
"""Implements a simplified version of the soft constraints in [2].
Name: diagonalitySoftConstraintsNMF
Date: Jun 2019
Programmer: Christian Dittmar, Yiğitcan Özer
References:
[2] Jonathan Driedger, Thomas Prätzlich, and Meinard Müller
Let It Bee -- Towards NMF-Inspired Audio Mosaicing
In Proceedings of the International Conference on Music Information
Retrieval (ISMIR): 350-356, 2015.
Parameters
----------
W: array-like
NMF templates given in matrix/tensor form
H: array-like
NMF activations given as matrix
iter: int
Current iteration count
numIter: int
Target number of iterations
parameter: dict
KernOrd: Order of smoothing operation
initW: Initial version of the NMF templates
Returns
-------
W: array-like
Processed NMF templates
H: array-like
Processed NMF activations
"""
H = conv2(H, np.eye(parameter['KernOrd']), 'same')
return W, H | 31.935065 | 83 | 0.669784 | 307 | 2,459 | 5.364821 | 0.550489 | 0.021251 | 0.043716 | 0.051002 | 0.201579 | 0.185792 | 0.151791 | 0.099575 | 0.099575 | 0.099575 | 0 | 0.014957 | 0.238715 | 2,459 | 77 | 84 | 31.935065 | 0.86485 | 0.827572 | 0 | 0 | 0 | 0 | 0.054187 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f9f4ebe16e144092c2abcae13f838c5788d1e317 | 179 | py | Python | FictionTools/amitools/test/suite/math_fast_trans.py | polluks/Puddle-BuildTools | c1762d53a33002b62d8cffe3db129505a387bec3 | [
"BSD-2-Clause"
] | 38 | 2021-06-18T12:56:15.000Z | 2022-03-12T20:38:40.000Z | FictionTools/amitools/test/suite/math_fast_trans.py | polluks/Puddle-BuildTools | c1762d53a33002b62d8cffe3db129505a387bec3 | [
"BSD-2-Clause"
] | 2 | 2021-06-20T16:28:12.000Z | 2021-11-17T21:33:56.000Z | FictionTools/amitools/test/suite/math_fast_trans.py | polluks/Puddle-BuildTools | c1762d53a33002b62d8cffe3db129505a387bec3 | [
"BSD-2-Clause"
] | 6 | 2021-06-18T18:18:36.000Z | 2021-12-22T08:01:32.000Z | import pytest
def math_fast_trans_test(vamos):
if vamos.flavor in ("sc", "agcc"):
pytest.skip("math not supported")
vamos.run_prog_check_data("math_fast_trans")
| 22.375 | 48 | 0.703911 | 27 | 179 | 4.37037 | 0.740741 | 0.135593 | 0.220339 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173184 | 179 | 7 | 49 | 25.571429 | 0.797297 | 0 | 0 | 0 | 0 | 0 | 0.217877 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f9ff3386f772e5e7c7dae52c29284a313d239e76 | 468 | py | Python | tests/test_local_annofab.py | kurusugawa-computer/annowork-api-python-client-draft | 40ee4481f763bbff15f28a93f7e028f25a744dab | [
"MIT"
] | null | null | null | tests/test_local_annofab.py | kurusugawa-computer/annowork-api-python-client-draft | 40ee4481f763bbff15f28a93f7e028f25a744dab | [
"MIT"
] | null | null | null | tests/test_local_annofab.py | kurusugawa-computer/annowork-api-python-client-draft | 40ee4481f763bbff15f28a93f7e028f25a744dab | [
"MIT"
] | null | null | null | from annoworkapi.annofab import get_annofab_project_id_from_url
class Test_get_annofab_project_id_from_url:
def test_url(self):
actual = get_annofab_project_id_from_url("https://annofab.com/projects/bar")
excepted = "bar"
assert actual == excepted
def test_url_with_trailing_slash(self):
actual = get_annofab_project_id_from_url("https://annofab.com/projects/bar/")
excepted = "bar"
assert actual == excepted
| 33.428571 | 85 | 0.722222 | 63 | 468 | 4.952381 | 0.349206 | 0.128205 | 0.217949 | 0.24359 | 0.762821 | 0.762821 | 0.596154 | 0.596154 | 0.596154 | 0.596154 | 0 | 0 | 0.190171 | 468 | 13 | 86 | 36 | 0.823219 | 0 | 0 | 0.4 | 0 | 0 | 0.151709 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.2 | false | 0 | 0.1 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f9ff6df3c45b712692901af6b753cfb564e32993 | 1,030 | py | Python | tests/compiled_rbnf.py | thautwarm/Ruiko | cceec88c90f7ec95c160cfda01bfc532610985e0 | [
"MIT"
] | 44 | 2018-06-08T04:52:02.000Z | 2021-08-06T04:59:56.000Z | tests/compiled_rbnf.py | thautwarm/Ruiko | cceec88c90f7ec95c160cfda01bfc532610985e0 | [
"MIT"
] | 2 | 2018-06-21T14:42:27.000Z | 2018-12-10T06:15:46.000Z | tests/compiled_rbnf.py | thautwarm/Ruiko | cceec88c90f7ec95c160cfda01bfc532610985e0 | [
"MIT"
] | 2 | 2018-06-18T10:43:20.000Z | 2019-05-06T13:51:51.000Z | # File automatically generated by RBNF.
from rbnf.bootstrap import loader as ruiko
mylang = ruiko.Language('mylang')
@mylang
class Space(ruiko.Lexer):
@staticmethod
def regex():
return ['\\s']
@mylang
class Name(ruiko.Lexer):
@staticmethod
def regex():
return ['[a-zA-Z]+']
@mylang
class Num(ruiko.Lexer):
@staticmethod
def regex():
return ['\\d+']
@mylang
class Alpha(ruiko.Lexer):
@staticmethod
def constants():
return ['a', 'b', 'c']
@staticmethod
def cast():
return True
@mylang
class Z(ruiko.Parser):
@staticmethod
def bnf():
return ruiko.And([
ruiko.Seq(ruiko.N('Alpha'), 1, -1),
ruiko.Bind('n1', ruiko.N('Num')),
ruiko.Bind('n2', ruiko.N('Num'))
])
@staticmethod
def fail_if(tokens, state):
(n1, n2) = map(state.ctx.get, ('n1', 'n2'))
d1 = int(n1.value)
d2 = int(n2.value)
return (d1 > d2)
mylang.ignore('Space')
mylang.build()
| 17.457627 | 51 | 0.556311 | 125 | 1,030 | 4.576 | 0.44 | 0.183566 | 0.153846 | 0.174825 | 0.188811 | 0.188811 | 0 | 0 | 0 | 0 | 0 | 0.018843 | 0.278641 | 1,030 | 58 | 52 | 17.758621 | 0.751009 | 0.035922 | 0 | 0.357143 | 1 | 0 | 0.049445 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.02381 | 0.142857 | 0.47619 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
e602c86dab856053ee2ab22c03d9d795fb787be1 | 392 | py | Python | util/result.py | danielpine/AutoStock | 2f4df17171b132489672e451ff2ec7e24205cb09 | [
"Apache-2.0"
] | 2 | 2019-10-09T04:38:16.000Z | 2020-11-09T14:36:52.000Z | util/result.py | danielpine/AutoStock | 2f4df17171b132489672e451ff2ec7e24205cb09 | [
"Apache-2.0"
] | null | null | null | util/result.py | danielpine/AutoStock | 2f4df17171b132489672e451ff2ec7e24205cb09 | [
"Apache-2.0"
] | null | null | null | import json
def error(msg):
return message(False, 400, None, msg)
def success(data=None):
return message(True, 200, data, None)
def message(success, code, data, message):
return json.dumps({'success': success, 'code': code, 'data': data, 'message': message})
def socket_message(code, data, message):
return json.dumps({'code': code, 'data': data, 'message': message})
| 21.777778 | 91 | 0.670918 | 53 | 392 | 4.943396 | 0.320755 | 0.122137 | 0.114504 | 0.160305 | 0.458015 | 0.458015 | 0 | 0 | 0 | 0 | 0 | 0.018349 | 0.165816 | 392 | 17 | 92 | 23.058824 | 0.782875 | 0 | 0 | 0 | 0 | 0 | 0.094388 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.444444 | false | 0 | 0.111111 | 0.444444 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
e63628a4015fc1b88620bdcfab7ee4c911e72896 | 187 | py | Python | development/basicGPIO.py | ehhs-robotics-team/ChickenCoopDoor | 0b6c0d25f7c58bfb8f6b9e9850a364387354366f | [
"MIT"
] | null | null | null | development/basicGPIO.py | ehhs-robotics-team/ChickenCoopDoor | 0b6c0d25f7c58bfb8f6b9e9850a364387354366f | [
"MIT"
] | null | null | null | development/basicGPIO.py | ehhs-robotics-team/ChickenCoopDoor | 0b6c0d25f7c58bfb8f6b9e9850a364387354366f | [
"MIT"
] | null | null | null | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(32,GPIO.OUT)
try:
while 1:
GPIO.output(32,True)
except KeyboardInterrupt:
pass
finally:
GPIO.cleanup()
| 12.466667 | 28 | 0.679144 | 27 | 187 | 4.703704 | 0.703704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033784 | 0.208556 | 187 | 14 | 29 | 13.357143 | 0.824324 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.1 | 0.1 | 0 | 0.1 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
e63e51b5320d6ec85f71276b0aca91c9cb07fd2b | 3,054 | py | Python | jax_bayes/variational/families.py | jamesvuc/jax-bayes | b91432cbf39dc0faebd1879a021fb2939d6072da | [
"MIT"
] | 9 | 2020-08-14T14:25:54.000Z | 2022-03-17T13:28:32.000Z | jax_bayes/variational/families.py | jamesvuc/jax-bayes | b91432cbf39dc0faebd1879a021fb2939d6072da | [
"MIT"
] | null | null | null | jax_bayes/variational/families.py | jamesvuc/jax-bayes | b91432cbf39dc0faebd1879a021fb2939d6072da | [
"MIT"
] | null | null | null | import math
import jax
import jax.numpy as jnp
import numpy as np
from .variational_family import variational_family
def elbo_reparam(logprob, samples, var_approx, var_params):
return jnp.mean(logprob(samples) - var_approx(samples, var_params))
def gaussian_elbo_reparam(logprob, samples, var_params):
return jnp.mean(logprob(samples)) + diag_mvn_entropy(var_params)
def elbo_noscore(logprob, samples, var_approx, var_params):
var_params = jax.lax.stop_gradient(var_params)
return - jnp.mean(logprob(samples) - var_approx(samples, var_params))
def diag_mvn_logpdf(x, mean, diag_cov):
""" Returns the log_pdf of x under a MVN with diagonal covariance without
storing the full covariance for O(N) storage instead of O(N^2).
"""
n = mean.shape[-1]
y = x - mean
tmp = jnp.einsum('...i,i->...i', y, 1./diag_cov)
return (-1/2 * jnp.einsum('...i,...i->...', y, tmp)
- n/2 * np.log(2*np.pi) - jnp.log(diag_cov).sum()/2.)
def diag_mvn_entropy(logcov):
d = logcov.shape[0]
return 0.5 * d * (1.0 + np.log(2*np.pi)) + jnp.sum(logcov)
@variational_family
def diagonal_mvn_fns(base_key, mean_stddev=1.0, init_sigma=1.0, eps=1e-6):
""" Constructs functions for a VariationalFamily object using a
diagonal multivariate normal (equivalent to mean-field) variational family.
Args:
base_key: jax.random.PRNGKey used to seed the randomness for the algorithm
mean_stddev: standard deviation of mean parameter initialization
init_sigma: starting standard deviation of the mean field parameters
eps: tolerance for the log-covariance
Returns:
init, sample, evaluate, get_samples, next_key, entropy, base_key
functions for the VariationalFamily (to be tree-ified in the decorator).
Entropy can be a dummy function, the others are needed for VI.
"""
def init(x0, key):
next_key, key = jax.random.split(key)
mean = jax.random.normal(key, x0.shape) * mean_stddev
logcov = jnp.zeros_like(x0) + math.log(init_sigma)
return (mean, logcov), next_key
#TODO: Remove arg 'i'
def sample(i, num_samples, key, params):
""" sample from q( |params) """
key, next_key = jax.random.split(key)
mean, logcov = params
shape = (num_samples,) + mean.shape
Z = jax.random.normal(key, shape)
return Z * jnp.exp(logcov) + mean, next_key
def evaluate(inputs, params):
""" evaluate logq( |params) """
mean, logcov = params
mean, logcov = mean.reshape(-1), logcov.reshape(-1)
inputs = inputs.reshape(inputs.shape[0], -1)
cov = jnp.exp(logcov) + eps
return diag_mvn_logpdf(inputs, mean, cov)
def get_samples(samples):
return samples
def next_key(key):
_, new_key = jax.random.split(key)
return new_key
def entropy(params):
_, logcov = params
return diag_mvn_entropy(logcov)
return init, sample, evaluate, get_samples, next_key, entropy, base_key
| 34.314607 | 82 | 0.663065 | 442 | 3,054 | 4.438914 | 0.285068 | 0.036697 | 0.043323 | 0.046891 | 0.227829 | 0.199286 | 0.133537 | 0.115189 | 0.115189 | 0.115189 | 0 | 0.011388 | 0.223641 | 3,054 | 88 | 83 | 34.704545 | 0.816111 | 0.272757 | 0 | 0.040816 | 0 | 0 | 0.012138 | 0 | 0 | 0 | 0 | 0.011364 | 0 | 1 | 0.244898 | false | 0 | 0.102041 | 0.061224 | 0.591837 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.