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
ea853d9df1b2c8f928dab0557944513a962791eb
968
py
Python
cmdb/hosts/models.py
fox0014/cmdb
ef14411b6d637bb73a532f48409eb0f853367c34
[ "Apache-2.0" ]
null
null
null
cmdb/hosts/models.py
fox0014/cmdb
ef14411b6d637bb73a532f48409eb0f853367c34
[ "Apache-2.0" ]
null
null
null
cmdb/hosts/models.py
fox0014/cmdb
ef14411b6d637bb73a532f48409eb0f853367c34
[ "Apache-2.0" ]
null
null
null
# This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models' order # * Make sure each model has one field with primary_key=True # * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior # * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table # Feel free to rename the models, but don't rename db_table values or field names. from django.db import models class Asset(models.Model): id = models.CharField(max_length=32, primary_key=True) dc_id = models.CharField(max_length=32) hard_type = models.IntegerField() hard_name = models.CharField(max_length=100, blank=True, null=True) hard_info = models.CharField(max_length=255, blank=True, null=True) asset_tag = models.CharField(max_length=100, blank=True, null=True) class Meta: managed = False db_table = 'asset'
44
104
0.731405
150
968
4.62
0.533333
0.108225
0.12987
0.17316
0.207792
0.207792
0.126984
0.126984
0.126984
0
0
0.016497
0.18595
968
21
105
46.095238
0.862944
0.485537
0
0
1
0
0.010204
0
0
0
0
0
0
1
0
false
0
0.090909
0
0.818182
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
0
1
0
0
3
ea9d23fb0727c65213a97bc6781c11cd341d5ff6
290
py
Python
utils/utils.py
miltonbd/mcs_2018_adversarial_attack
01af584fdf1149ee5a661f340aff7e57cb7683a8
[ "MIT" ]
14
2018-06-07T02:51:37.000Z
2021-08-05T15:04:57.000Z
utils/utils.py
Sunshine352/mcs_2018_adversarial_attack
01af584fdf1149ee5a661f340aff7e57cb7683a8
[ "MIT" ]
null
null
null
utils/utils.py
Sunshine352/mcs_2018_adversarial_attack
01af584fdf1149ee5a661f340aff7e57cb7683a8
[ "MIT" ]
6
2018-10-29T08:52:48.000Z
2021-08-20T07:28:52.000Z
from skimage.measure import compare_ssim import numpy as np def get_ssim(original_img,changed_img): ssim = compare_ssim(np.array(original_img, dtype=np.float32), np.array(changed_img, dtype=np.float32), multichannel=True) return ssim
36.25
65
0.662069
38
290
4.868421
0.526316
0.118919
0.108108
0.183784
0
0
0
0
0
0
0
0.018605
0.258621
290
8
66
36.25
0.84186
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.285714
0
0.571429
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
0
0
1
0
0
3
ea9d828ea401d23a1e6f09a77e26233068f7c808
401
py
Python
paderbox/visualization/__init__.py
JanekEbb/paderbox
7cd3bf92380e05ec856936d21a64d0a8a3ff0fca
[ "MIT" ]
25
2019-12-21T21:10:08.000Z
2022-02-04T10:40:19.000Z
paderbox/visualization/__init__.py
JanekEbb/paderbox
7cd3bf92380e05ec856936d21a64d0a8a3ff0fca
[ "MIT" ]
32
2019-12-21T21:48:24.000Z
2022-03-31T08:20:39.000Z
paderbox/visualization/__init__.py
JanekEbb/paderbox
7cd3bf92380e05ec856936d21a64d0a8a3ff0fca
[ "MIT" ]
254
2019-12-16T08:15:08.000Z
2021-11-26T12:41:12.000Z
from . import matplotlib_fix from . import ipynb from . import colormap from . import plot from .context_manager import LatexContextManager from .context_manager import figure_context from .context_manager import axes_context from .module_facet_grid import facet_grid from .module_facet_grid import facet_grid_zero_space_time_frequency_plot from .plot import time_series from .display_pdf import PDF
30.846154
72
0.860349
59
401
5.525424
0.372881
0.122699
0.165644
0.220859
0.208589
0.208589
0.208589
0
0
0
0
0
0.112219
401
12
73
33.416667
0.91573
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
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
3
576f120e7e23c80435f37e9dbd6835143645731a
135
py
Python
algorithms/build_max_heap.py
jlovoi/DS-and-Algorithms
c832e730cb343ff31c084d1bd474060cd55c29fd
[ "MIT" ]
null
null
null
algorithms/build_max_heap.py
jlovoi/DS-and-Algorithms
c832e730cb343ff31c084d1bd474060cd55c29fd
[ "MIT" ]
null
null
null
algorithms/build_max_heap.py
jlovoi/DS-and-Algorithms
c832e730cb343ff31c084d1bd474060cd55c29fd
[ "MIT" ]
null
null
null
from . import max_heapify as heapify def build(arr): for i in range(int(len(arr)/2), -1, -1): heapify.heapify(arr, i) return arr
16.875
41
0.674074
25
135
3.6
0.68
0
0
0
0
0
0
0
0
0
0
0.027027
0.177778
135
7
42
19.285714
0.783784
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
5789ceecf6078ad26940ac74089e86e3e6cad0c0
946
py
Python
uwb/map/noise_map.py
freiberg-roman/uwb-proto
effda911b5571d2abd29ff0e8a696e279d482e8d
[ "MIT" ]
null
null
null
uwb/map/noise_map.py
freiberg-roman/uwb-proto
effda911b5571d2abd29ff0e8a696e279d482e8d
[ "MIT" ]
null
null
null
uwb/map/noise_map.py
freiberg-roman/uwb-proto
effda911b5571d2abd29ff0e8a696e279d482e8d
[ "MIT" ]
null
null
null
import numpy as np from uwb.generator import BaseGenerator class NoiseMap: """Base class for noise maps Attributes: generator: measurement that can be accessed by an iterator. """ def __init__(self, generator: BaseGenerator): """Initializes the estimation of the parameters.""" self.generator = generator def get_params(self, coordinates: np.array): """Returns list of lists with parameter estimates for the given coordinates. The return value is dependent on the underlying model for the noise map. """ pass def conditioned_probability(self, z, particles): """Computes conditioned probabilities p(z|x) Computes conditioned probabilities where x is given from the map for each particle. """ pass def sample_from(self, coordinates): """Samples from distributions of the map for given coordinates.""" pass
27.823529
91
0.67019
113
946
5.548673
0.575221
0.041467
0.102073
0
0
0
0
0
0
0
0
0
0.261099
946
33
92
28.666667
0.896996
0.511628
0
0.272727
0
0
0
0
0
0
0
0
0
1
0.363636
false
0.272727
0.181818
0
0.636364
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
5799d1acc17c6639ba67112f8559728e2595ee27
143
py
Python
example/paywall/apps.py
prog32/django-getpaid
f834bfefe7fc9387e173edf0b2be91b134dfa47d
[ "MIT" ]
220
2018-07-25T10:56:29.000Z
2022-03-18T13:56:11.000Z
example/paywall/apps.py
prog32/django-getpaid
f834bfefe7fc9387e173edf0b2be91b134dfa47d
[ "MIT" ]
29
2018-07-24T15:46:24.000Z
2021-07-01T08:38:59.000Z
example/paywall/apps.py
prog32/django-getpaid
f834bfefe7fc9387e173edf0b2be91b134dfa47d
[ "MIT" ]
52
2018-07-28T19:01:18.000Z
2022-03-12T14:50:33.000Z
from django.apps import AppConfig class Config(AppConfig): name = "paywall" verbose_name = "paywall simulator" label = "paywall"
17.875
38
0.699301
16
143
6.1875
0.75
0.222222
0
0
0
0
0
0
0
0
0
0
0.20979
143
7
39
20.428571
0.876106
0
0
0
0
0
0.216783
0
0
0
0
0
0
1
0
false
0
0.2
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
57a20a04cb77e8bf984162f33b7d270935aa02d4
45
py
Python
bot_tokens.py
vetu11/QuienVienebot
865ee647c5a4ea4399a4e4a044874603a994acb3
[ "MIT" ]
2
2019-06-14T11:57:11.000Z
2019-10-20T16:12:00.000Z
bot_tokens.py
vetu11/TelegramBotTemplate
c101cdaf18a472ed0c9fc7d53ad86c3e1ba2ec03
[ "MIT" ]
null
null
null
bot_tokens.py
vetu11/TelegramBotTemplate
c101cdaf18a472ed0c9fc7d53ad86c3e1ba2ec03
[ "MIT" ]
null
null
null
BOT_TOKEN = "" PAYMENT_PROVIDER_TOKEN = None
15
29
0.777778
6
45
5.333333
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.133333
45
2
30
22.5
0.820513
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
57c0f542701e3d2dbbc80bab90a66090e1da0e2a
641
py
Python
server/configuration/__init__.py
kostas-vl/audiohub
af465f400ed46185cb35eaf26691ab87fbab76f3
[ "MIT" ]
null
null
null
server/configuration/__init__.py
kostas-vl/audiohub
af465f400ed46185cb35eaf26691ab87fbab76f3
[ "MIT" ]
1
2022-03-02T07:46:56.000Z
2022-03-02T07:46:56.000Z
server/configuration/__init__.py
kostas-vl/audiohub
af465f400ed46185cb35eaf26691ab87fbab76f3
[ "MIT" ]
null
null
null
""" Initialization module. """ __all__ = [ 'BaseSettings', 'BackendSettings', 'DatabaseSettings', 'ServerSettings', 'YoutubeSettings', 'ApplicationSettings', 'APP_SETTINGS_INSTANCE' ] from configuration.base_settings import BaseSettings from configuration.backend_settings import BackendSettings from configuration.database_settings import DatabaseSettings from configuration.server_settings import ServerSettings from configuration.youtube_settings import YoutubeSettings from configuration.application_settings import ApplicationSettings, \ APP_SETTINGS_INSTANCE
30.52381
69
0.75819
51
641
9.254902
0.411765
0.216102
0.127119
0.161017
0
0
0
0
0
0
0
0
0.182527
641
20
70
32.05
0.900763
0.034321
0
0
0
0
0.183306
0.03437
0
0
0
0
0
1
0
false
0
0.375
0
0.375
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
0
1
0
0
0
0
3
57e5995bca265bef305e6e8119fea8500dffd092
3,600
py
Python
test/test_parse_dunder_version.py
matthewdeanmartin/jiggle_version
7bb82b75321e007f9e9e6d52a7bc569a5fe41052
[ "MIT" ]
1
2019-02-23T16:13:56.000Z
2019-02-23T16:13:56.000Z
test/test_parse_dunder_version.py
matthewdeanmartin/jiggle_version
7bb82b75321e007f9e9e6d52a7bc569a5fe41052
[ "MIT" ]
17
2018-07-14T17:04:49.000Z
2022-03-24T15:59:11.000Z
test/test_parse_dunder_version.py
matthewdeanmartin/jiggle_version
7bb82b75321e007f9e9e6d52a7bc569a5fe41052
[ "MIT" ]
1
2019-12-01T02:18:36.000Z
2019-12-01T02:18:36.000Z
""" Is that a version string, a tuple or a int or float? 'Cause in the wild people use all of those. """ from jiggle_version.parse_dunder_version import find_in_line, simplify_line def test_comments(): value = 'version="7.8.6.16.dev0",#JiggleVersionWasHere' result = simplify_line(value, keep_comma=True) assert result == 'version="7.8.6.16.dev0",', result def test_post_comma(): value = 'version = "1.3.2", # Jiggle Version Was Here' result = simplify_line(value, keep_comma=True) assert "," in result, result def test_simplify_pre_comma(): value = ',version = "1.3.2" # Jiggle Version Was Here' result = simplify_line(value, keep_comma=True) assert "," in result, result def test_simplify_both_comma(): value = ',version = "1.3.2", # Jiggle Version Was Here' result = simplify_line(value, keep_comma=True) assert "," in result, result def test_regression_scenarios_current(): value = "__version__ = '''0.0.0'''" result, _ = find_in_line(value) assert result == "0.0.0", result value = '__version__ = """0.0.0"""' result, _ = find_in_line(value) assert result == "0.0.0", result def test_regression_scenarios_old(): value = "__version__ = '%(version)s%(tag)s%(build)s' % {" result, _ = find_in_line(value) assert result is None, result result, _ = find_in_line( '__version__ = ".".join(map(str, version_info[:3])) + ("-"+version_info[3] if' ) assert result is None, result result, _ = find_in_line("VERSION = (1, 1, 0, 'rc1')") assert result == "1.1.0.rc1", result # passing result, _ = find_in_line("VERSION = (1, 0, 1)") assert result == "1.0.1", result result, _ = find_in_line( " version = re.search(r'^__version__\s*=\s*['\"]([^'\"]*)['\"]'," ) assert result is None, result result, _ = find_in_line("version = re.search(r'^__version__\s*=\s*[") assert result is None, result def test_common_scenarios(): # single quotes result, _ = find_in_line("__version__ = '1.2.3'") assert result == "1.2.3", result # double quotes result, _ = find_in_line('__version__ = "1.2.3"') assert result == "1.2.3", result # whitespace result, _ = find_in_line(' __version__ = "1.2.3" ') assert result == "1.2.3", result # tabs result, _ = find_in_line(' \t __version__ \t = "1.2.3" \t ') assert result == "1.2.3", result # no whitespace result, _ = find_in_line('__version__="1.2.3"') assert result == "1.2.3", result # comments result, _ = find_in_line('__version__="1.2.3" # this is my version') assert result == "1.2.3", result def test_that_is_a_tuple(): # single quotes result, _ = find_in_line("__version__ = (1, 2, 3)") assert result == "1.2.3", result result, _ = find_in_line("__version__ = (1, 2,)") assert result == "1.2", result result, _ = find_in_line("__version__=(1, 2,)") assert result == "1.2", result result, _ = find_in_line("__version__=(1, 2,) # comments") assert result == "1.2", result def test_that_is_a_int_or_float_b(): # single quotes result, _ = find_in_line("__version__ = 1.2") assert result == "1.2", result result, _ = find_in_line("__version__ = 1") assert result == "1", result result, _ = find_in_line("__version__=2") assert result == "2", result result, _ = find_in_line("__version__=2 # comments") assert result == "2", result result, _ = find_in_line("__version__=2 # __version__ = 3") assert result == "2", result
29.268293
96
0.622222
506
3,600
4.029644
0.156126
0.070623
0.117705
0.180481
0.759686
0.73075
0.666013
0.639529
0.60618
0.600294
0
0.041208
0.218056
3,600
122
97
29.508197
0.683126
0.055556
0
0.493333
0
0
0.284279
0.048463
0
0
0
0
0.36
1
0.12
false
0
0.013333
0
0.133333
0
0
0
0
null
0
0
1
0
1
0
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
57f7173aa98cee4b5690355f6593fc2cdccd7e29
990
py
Python
nnabla_rl/builders/__init__.py
sony/nnabla-rl
6a9a91ac5363b8611e0c9f736590729952a8d460
[ "Apache-2.0" ]
75
2021-06-14T02:35:19.000Z
2022-03-23T04:30:24.000Z
nnabla_rl/builders/__init__.py
sony/nnabla-rl
6a9a91ac5363b8611e0c9f736590729952a8d460
[ "Apache-2.0" ]
2
2021-12-17T08:46:54.000Z
2022-03-15T02:04:53.000Z
nnabla_rl/builders/__init__.py
sony/nnabla-rl
6a9a91ac5363b8611e0c9f736590729952a8d460
[ "Apache-2.0" ]
3
2021-06-15T13:32:57.000Z
2022-03-25T16:53:14.000Z
# Copyright 2021 Sony Corporation. # Copyright 2021 Sony Group Corporation. # # 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. from nnabla_rl.builders.explorer_builder import ExplorerBuilder # noqa from nnabla_rl.builders.model_builder import ModelBuilder # noqa from nnabla_rl.builders.preprocessor_builder import PreprocessorBuilder # noqa from nnabla_rl.builders.replay_buffer_builder import ReplayBufferBuilder # noqa from nnabla_rl.builders.solver_builder import SolverBuilder # noqa
47.142857
80
0.80202
141
990
5.553191
0.58156
0.076628
0.076628
0.127714
0.122605
0
0
0
0
0
0
0.014134
0.142424
990
20
81
49.5
0.908127
0.624242
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
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
17a8f96153f9fcd464be515d85fe8bcf5507b75c
2,071
py
Python
acos_client/v21/slb/virtual_server.py
alonbg/acos-client
027370e47862ea64d289a6f55378fe45fb28140d
[ "Apache-2.0" ]
null
null
null
acos_client/v21/slb/virtual_server.py
alonbg/acos-client
027370e47862ea64d289a6f55378fe45fb28140d
[ "Apache-2.0" ]
null
null
null
acos_client/v21/slb/virtual_server.py
alonbg/acos-client
027370e47862ea64d289a6f55378fe45fb28140d
[ "Apache-2.0" ]
null
null
null
# Copyright 2014, Doug Wiegley, A10 Networks. # # 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 acos_client.v21.base as base from virtual_port import VirtualPort class VirtualServer(base.BaseV21): @property def vport(self): return VirtualPort(self.client) def all(self, **kwargs): return self._get("slb.virtual_server.getAll", **kwargs) def get(self, name, **kwargs): return self._post("slb.virtual_server.search", {'name': name}, **kwargs) def _set(self, action, name, ip_address=None, status=1, **kwargs): params = { "virtual_server": self.minimal_dict({ "name": name, "address": ip_address, "status": status, }), } self._post(action, params, **kwargs) def create(self, name, ip_address, status=1, **kwargs): self._set("slb.virtual_server.create", name, ip_address, status, **kwargs) def update(self, name, ip_address=None, status=1, **kwargs): self._set("slb.virtual_server.update", name, ip_address, status, **kwargs) def delete(self, name, **kwargs): self._post("slb.virtual_server.delete", {"name": name}, **kwargs) def stats(self, name, **kwargs): return self._post("slb.virtual_server.fetchStatistics", {"name": name}, **kwargs) def all_stats(self, **kwargs): return self._get("slb.virtual_server.fetchAllStatistics", **kwargs)
33.95082
79
0.625785
255
2,071
4.976471
0.419608
0.081954
0.088258
0.042553
0.287628
0.268716
0.224586
0.187549
0.069346
0
0
0.011039
0.256398
2,071
60
80
34.516667
0.812987
0.287301
0
0.121212
0
0
0.163475
0.134063
0
0
0
0
0
1
0.272727
false
0
0.060606
0.151515
0.515152
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
17d657a5ebd7f0218060b62152f6c96efe946e61
68
py
Python
service/constants.py
iLtc/shopcarts
0a19815fa4012e730ea7b5b58f0d6f25aa55dd7e
[ "Apache-2.0" ]
1
2020-09-29T23:01:56.000Z
2020-09-29T23:01:56.000Z
service/constants.py
iLtc/shopcarts
0a19815fa4012e730ea7b5b58f0d6f25aa55dd7e
[ "Apache-2.0" ]
132
2020-10-02T15:44:23.000Z
2020-12-09T15:45:20.000Z
service/constants.py
iLtc/shopcarts
0a19815fa4012e730ea7b5b58f0d6f25aa55dd7e
[ "Apache-2.0" ]
3
2020-09-30T00:57:04.000Z
2020-11-01T20:29:57.000Z
""" Constants for the Shopcart Service """ NOT_FOUND = "Not Found"
11.333333
34
0.691176
9
68
5.111111
0.777778
0.347826
0
0
0
0
0
0
0
0
0
0
0.176471
68
5
35
13.6
0.821429
0.5
0
0
0
0
0.346154
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
17f3af03b9cb8ae4acb578d68f89b4d99e52237b
227
py
Python
nsd1903/python01/day04/seq.py
MrWangwf/nsd2019
5e859b4b1926dc098d236be3720779c50d0a55fc
[ "Apache-2.0" ]
1
2019-09-19T04:53:22.000Z
2019-09-19T04:53:22.000Z
nsd1903/python01/day04/seq.py
MrWangwf/nsd2019
5e859b4b1926dc098d236be3720779c50d0a55fc
[ "Apache-2.0" ]
null
null
null
nsd1903/python01/day04/seq.py
MrWangwf/nsd2019
5e859b4b1926dc098d236be3720779c50d0a55fc
[ "Apache-2.0" ]
1
2021-12-28T04:26:02.000Z
2021-12-28T04:26:02.000Z
alist = ['bob', 'alice', 'tom', 'jerry'] # for i in range(len(alist)): # print(i, alist[i]) print(list(enumerate(alist))) for data in enumerate(alist): print(data) for i, name in enumerate(alist): print(i, name)
18.916667
40
0.621145
35
227
4.028571
0.428571
0.212766
0.156028
0.297872
0
0
0
0
0
0
0
0
0.185022
227
11
41
20.636364
0.762162
0.220264
0
0
0
0
0.091954
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
0
0
0
0
1
0
3
aa15e3cfade1dc2395ba700a51eee47e03f7413a
712
py
Python
app/tests/test_comment.py
lwairore/python-ginger-pitch
41cad0b822a39e54f868564edb7b0e4091864917
[ "MIT" ]
null
null
null
app/tests/test_comment.py
lwairore/python-ginger-pitch
41cad0b822a39e54f868564edb7b0e4091864917
[ "MIT" ]
null
null
null
app/tests/test_comment.py
lwairore/python-ginger-pitch
41cad0b822a39e54f868564edb7b0e4091864917
[ "MIT" ]
null
null
null
import unittest from app.models import User, Comment from flask_login import current_user from app import db class TestComments(unittest.TestCase): def setUp(self): self.new_comment = Comment(pitch_id=12, title='Awesome', comment="Nice presentation...", postedAt="2019-05-27 14:15:43.587649", user_id=1) def tearDown(self): Comment.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_comment.pitch_id, 12) self.assertEquals(self.new_comment.title, 'Awesome') self.assertEquals(self.new_comment.comment, 'Nice presentation...') self.assertEquals(self.new_comment.postedAt, '2019-05-27 14:15:43.587649')
39.555556
146
0.710674
96
712
5.135417
0.4375
0.070994
0.141988
0.186613
0.356998
0.11359
0.11359
0.11359
0
0
0
0.076271
0.171348
712
18
147
39.555556
0.759322
0
0
0
0
0
0.148668
0
0
0
0
0
0.285714
1
0.214286
false
0
0.285714
0
0.571429
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
0
1
0
0
3
aa2e43346796f9885498bdf6674c5247dd9d02bc
604
py
Python
plugin.video.youtube/resources/lib/youtube_plugin/kodion/register_provider_path.py
akuala/REPO.KUALA
ea9a157025530d2ce8fa0d88431c46c5352e89d4
[ "Apache-2.0" ]
2
2018-11-02T19:55:30.000Z
2020-08-14T02:22:20.000Z
plugin.video.youtube/resources/lib/youtube_plugin/kodion/register_provider_path.py
akuala/REPO.KUALA
ea9a157025530d2ce8fa0d88431c46c5352e89d4
[ "Apache-2.0" ]
null
null
null
plugin.video.youtube/resources/lib/youtube_plugin/kodion/register_provider_path.py
akuala/REPO.KUALA
ea9a157025530d2ce8fa0d88431c46c5352e89d4
[ "Apache-2.0" ]
3
2019-12-17T20:47:00.000Z
2021-02-11T19:03:59.000Z
# -*- coding: utf-8 -*- """ Copyright (C) 2014-2016 bromix (plugin.video.youtube) Copyright (C) 2016-2018 plugin.video.youtube SPDX-License-Identifier: GPL-2.0-only See LICENSES/GPL-2.0-only for more information. """ class RegisterProviderPath(object): def __init__(self, re_path): self._kodion_re_path = re_path def __call__(self, func): def wrapper(*args, **kwargs): # only use a wrapper if you need extra code to be run here return func(*args, **kwargs) wrapper.kodion_re_path = self._kodion_re_path return wrapper
26.26087
70
0.647351
83
604
4.493976
0.60241
0.080429
0.096515
0.048257
0.117962
0.117962
0
0
0
0
0
0.045752
0.240066
604
22
71
27.454545
0.766885
0.438742
0
0
0
0
0
0
0
0
0
0
0
1
0.375
false
0
0
0.125
0.75
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
aa3cfad7fc1e02df61c51eca3499f3ede60bac64
2,644
py
Python
src/network-manager/azext_network_manager/_client_factory.py
haroonf/azure-cli-extensions
61c044d34c224372f186934fa7c9313f1cd3a525
[ "MIT" ]
1
2022-01-25T07:33:18.000Z
2022-01-25T07:33:18.000Z
src/network-manager/azext_network_manager/_client_factory.py
haroonf/azure-cli-extensions
61c044d34c224372f186934fa7c9313f1cd3a525
[ "MIT" ]
9
2022-03-25T19:35:49.000Z
2022-03-31T06:09:47.000Z
src/network-manager/azext_network_manager/_client_factory.py
haroonf/azure-cli-extensions
61c044d34c224372f186934fa7c9313f1cd3a525
[ "MIT" ]
1
2022-02-14T21:43:29.000Z
2022-02-14T21:43:29.000Z
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- def cf_network_cl(cli_ctx, *_): from azure.cli.core.commands.client_factory import get_mgmt_service_client from azext_network_manager.vendored_sdks import NetworkManagementClient return get_mgmt_service_client(cli_ctx, NetworkManagementClient) def cf_activesecurityuserrule(cli_ctx, *_): return cf_network_cl(cli_ctx).active_security_user_rules def cf_adminrulecollection(cli_ctx, *_): return cf_network_cl(cli_ctx).admin_rule_collections def cf_adminrule(cli_ctx, *_): return cf_network_cl(cli_ctx).admin_rules def cf_connectivityconfiguration(cli_ctx, *_): return cf_network_cl(cli_ctx).connectivity_configurations def cf_listeffectivevirtualnetwork(cli_ctx, *_): return cf_network_cl(cli_ctx).list_effective_virtual_networks def cf_effectivevirtualnetwork(cli_ctx, *_): return cf_network_cl(cli_ctx).effective_virtual_networks def cf_networkmanagementclient(cli_ctx, *_): return cf_network_cl(cli_ctx) def cf_networkgroup(cli_ctx, *_): return cf_network_cl(cli_ctx).network_groups def cf_networkmanagercommit(cli_ctx, *_): return cf_network_cl(cli_ctx).network_manager_commits def cf_networkmanagerdeploymentstatus(cli_ctx, *_): return cf_network_cl(cli_ctx).network_manager_deployment_status def cf_networkmanager(cli_ctx, *_): return cf_network_cl(cli_ctx).network_managers def cf_securityadminconfiguration(cli_ctx, *_): return cf_network_cl(cli_ctx).security_admin_configurations def cf_securityuserconfiguration(cli_ctx, *_): return cf_network_cl(cli_ctx).security_user_configurations def cf_userrulecollection(cli_ctx, *_): return cf_network_cl(cli_ctx).user_rule_collections def cf_userrule(cli_ctx, *_): return cf_network_cl(cli_ctx).user_rules def cf_scopeconnection(cli_ctx, *_): return cf_network_cl(cli_ctx).scope_connections def cf_staticmembers(cli_ctx, *_): return cf_network_cl(cli_ctx).static_members def cf_subscriptionconnection(cli_ctx, *_): return cf_network_cl(cli_ctx).subscription_network_manager_connections def cf_managementgroupconnection(cli_ctx, *_): return cf_network_cl(cli_ctx).management_group_network_manager_connections
28.73913
78
0.764372
340
2,644
5.461765
0.3
0.129241
0.118471
0.150781
0.378029
0.337641
0.337641
0.337641
0.197092
0.046311
0
0
0.110061
2,644
91
79
29.054945
0.789205
0.166036
0
0
0
0
0
0
0
0
0
0
0
1
0.47619
false
0
0.047619
0.452381
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
1
0
0
0
1
1
0
0
3
a4d1f66aa774cde33521e84635646015f0844994
93
py
Python
mysite/Objective/apps.py
avinsit123/Tweet-o-Pedia
d36970f1426643da295f6f98e8c5fce9fcd7109c
[ "BSD-3-Clause" ]
1
2019-01-15T17:15:26.000Z
2019-01-15T17:15:26.000Z
mysite/Objective/apps.py
avinsit123/Tweet-o-Pedia
d36970f1426643da295f6f98e8c5fce9fcd7109c
[ "BSD-3-Clause" ]
18
2020-01-28T22:31:06.000Z
2022-03-11T23:37:23.000Z
mysite/Objective/apps.py
avinsit123/Tweet-o-Pedia
d36970f1426643da295f6f98e8c5fce9fcd7109c
[ "BSD-3-Clause" ]
1
2019-01-05T08:41:11.000Z
2019-01-05T08:41:11.000Z
from django.apps import AppConfig class ObjectiveConfig(AppConfig): name = 'Objective'
15.5
33
0.763441
10
93
7.1
0.9
0
0
0
0
0
0
0
0
0
0
0
0.16129
93
5
34
18.6
0.910256
0
0
0
0
0
0.096774
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
a4e94c915b5c2fd0f318e8231a2eff91803bddc6
406
py
Python
example_project/yawdtrans_demo/admin.py
Varun11940/yawd-translations
3b4bd84cfe451ce43beb94507dfcdbf61bd1686f
[ "BSD-3-Clause" ]
2
2017-02-21T16:21:45.000Z
2019-04-02T05:42:12.000Z
example_project/yawdtrans_demo/admin.py
Varun11940/yawd-translations
3b4bd84cfe451ce43beb94507dfcdbf61bd1686f
[ "BSD-3-Clause" ]
4
2020-09-30T20:15:51.000Z
2020-10-17T05:24:34.000Z
example_project/yawdtrans_demo/admin.py
Varun11940/yawd-translations
3b4bd84cfe451ce43beb94507dfcdbf61bd1686f
[ "BSD-3-Clause" ]
80
2020-09-30T12:40:07.000Z
2020-10-02T09:52:51.000Z
from django.contrib import admin from translations.admin import TranslationInline from models import MultilingualPage, MultilingualPageTranslation class MultilingualPageTranslationAdmin(TranslationInline): model = MultilingualPageTranslation class MultilingualPageAdmin(admin.ModelAdmin): inlines = [MultilingualPageTranslationAdmin] admin.site.register(MultilingualPage, MultilingualPageAdmin)
36.909091
64
0.864532
31
406
11.322581
0.580645
0.182336
0
0
0
0
0
0
0
0
0
0
0.08867
406
11
65
36.909091
0.948649
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.375
0
0.875
0
0
0
1
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
0
1
0
0
3
a4ee8848b7564f2db66c8aa9dbc2cd5de69225b6
184
py
Python
functions_advanced/exercise/recursion_power.py
PetkoAndreev/Python-advanced
94fd0fa69b366b978921ee8d4e214d3d3b4335d6
[ "MIT" ]
null
null
null
functions_advanced/exercise/recursion_power.py
PetkoAndreev/Python-advanced
94fd0fa69b366b978921ee8d4e214d3d3b4335d6
[ "MIT" ]
null
null
null
functions_advanced/exercise/recursion_power.py
PetkoAndreev/Python-advanced
94fd0fa69b366b978921ee8d4e214d3d3b4335d6
[ "MIT" ]
null
null
null
def recursive_power(x, y): if y == 0: return 1 if y >= 1: return x * recursive_power(x, y - 1) print(recursive_power(2, 10)) print(recursive_power(10, 100))
16.727273
44
0.586957
30
184
3.466667
0.433333
0.538462
0.288462
0.307692
0
0
0
0
0
0
0
0.090226
0.277174
184
10
45
18.4
0.691729
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0
0
0.428571
0.285714
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
a4fab7ea783cc7e797093f95f5d2d34846ffc90a
126
py
Python
starsim/__init__.py
dbarochlopez/starsim
add1c930e6506958dc57d2c815069462797a9dcb
[ "MIT" ]
null
null
null
starsim/__init__.py
dbarochlopez/starsim
add1c930e6506958dc57d2c815069462797a9dcb
[ "MIT" ]
null
null
null
starsim/__init__.py
dbarochlopez/starsim
add1c930e6506958dc57d2c815069462797a9dcb
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- __version__ = "3.0.1" __all__ = ['starsim','spectra','nbspectra','SA'] from .starsim import StarSim
18
48
0.634921
16
126
4.5
0.875
0
0
0
0
0
0
0
0
0
0
0.036697
0.134921
126
7
49
18
0.623853
0.166667
0
0
0
0
0.288462
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
3517e46678c8333edace6d66dcd4d264f8146a05
804
py
Python
migrations/versions/049_RedcapProject_Add_participant_import_strategy_id.py
LCBRU/identity
e8bec964aca9595091bf891bbe41632ce54afd3f
[ "MIT" ]
null
null
null
migrations/versions/049_RedcapProject_Add_participant_import_strategy_id.py
LCBRU/identity
e8bec964aca9595091bf891bbe41632ce54afd3f
[ "MIT" ]
null
null
null
migrations/versions/049_RedcapProject_Add_participant_import_strategy_id.py
LCBRU/identity
e8bec964aca9595091bf891bbe41632ce54afd3f
[ "MIT" ]
null
null
null
from sqlalchemy import ( MetaData, Table, Column, Integer, NVARCHAR, ForeignKey, ) from sqlalchemy.schema import ForeignKeyConstraint meta = MetaData() def upgrade(migrate_engine): meta.bind = migrate_engine pis = Table("participant_import_strategy", meta, autoload=True) t = Table("redcap_project", meta, autoload=True) participant_import_strategy_id = Column("participant_import_strategy_id", Integer, index=True) participant_import_strategy_id.create(t, index_name='idx__redcap_project__pis_id') t.append_constraint(ForeignKeyConstraint([participant_import_strategy_id], [pis.c.id])) def downgrade(migrate_engine): meta.bind = migrate_engine t = Table("redcap_project", meta, autoload=True) t.c.participant_import_strategy_id.drop()
26.8
98
0.752488
97
804
5.917526
0.360825
0.1777
0.261324
0.235192
0.341463
0.240418
0.121951
0
0
0
0
0
0.150498
804
29
99
27.724138
0.84041
0
0
0.190476
0
0
0.139303
0.104478
0
0
0
0
0
1
0.095238
false
0
0.333333
0
0.428571
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
351b2b05827d0f2cc720db005aaf4d5b38cf4353
251
py
Python
photutils/detection/__init__.py
astrofrog/photutils
19aa574367cb384e0fe0bdc4179b68429fe2dc89
[ "BSD-3-Clause" ]
null
null
null
photutils/detection/__init__.py
astrofrog/photutils
19aa574367cb384e0fe0bdc4179b68429fe2dc89
[ "BSD-3-Clause" ]
1
2016-02-19T14:00:04.000Z
2016-02-19T14:00:04.000Z
photutils/detection/__init__.py
astrofrog/photutils
19aa574367cb384e0fe0bdc4179b68429fe2dc89
[ "BSD-3-Clause" ]
null
null
null
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains modules and packages for identifying sources in an astronomical image and estimating their morphological parameters (e.g. centroid and shape parameters). """
35.857143
72
0.796813
35
251
5.714286
0.885714
0
0
0
0
0
0
0
0
0
0
0.004651
0.143426
251
6
73
41.833333
0.925581
0.960159
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
35378e9b83ccabf07f8ef33eeab502732d8ac52c
1,610
py
Python
accelbyte_py_sdk/api/iam/operations/clients/__init__.py
AccelByte/accelbyte-python-sdk
dcd311fad111c59da828278975340fb92e0f26f7
[ "MIT" ]
null
null
null
accelbyte_py_sdk/api/iam/operations/clients/__init__.py
AccelByte/accelbyte-python-sdk
dcd311fad111c59da828278975340fb92e0f26f7
[ "MIT" ]
1
2021-10-13T03:46:58.000Z
2021-10-13T03:46:58.000Z
accelbyte_py_sdk/api/iam/operations/clients/__init__.py
AccelByte/accelbyte-python-sdk
dcd311fad111c59da828278975340fb92e0f26f7
[ "MIT" ]
null
null
null
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # # Code generated. DO NOT EDIT! # template file: justice_py_sdk_codegen/__main__.py """Auto-generated package that contains models used by the justice-iam-service.""" __version__ = "5.10.1" __author__ = "AccelByte" __email__ = "dev@accelbyte.net" # pylint: disable=line-too-long from .add_client_permission import AddClientPermission from .admin_add_client_permis_b56057 import AdminAddClientPermissionsV3 from .admin_create_client_v3 import AdminCreateClientV3 from .admin_delete_client_per_ccba4f import AdminDeleteClientPermissionV3 from .admin_delete_client_v3 import AdminDeleteClientV3 from .admin_get_clients_by_na_e85014 import AdminGetClientsByNamespaceV3 from .admin_get_clientsby_nam_ac2fda import AdminGetClientsbyNamespacebyIDV3 from .admin_update_client_per_4db324 import AdminUpdateClientPermissionV3 from .admin_update_client_v3 import AdminUpdateClientV3 from .create_client import CreateClient from .create_client_by_namespace import CreateClientByNamespace from .delete_client import DeleteClient from .delete_client_by_namespace import DeleteClientByNamespace from .delete_client_permission import DeleteClientPermission from .get_client import GetClient from .get_clients import GetClients from .get_clientsby_namespace import GetClientsbyNamespace from .update_client import UpdateClient from .update_client_permission import UpdateClientPermission from .update_client_secret import UpdateClientSecret
43.513514
82
0.869565
195
1,610
6.820513
0.512821
0.054135
0.049624
0.031579
0
0
0
0
0
0
0
0.023891
0.090062
1,610
36
83
44.722222
0.883959
0.223602
0
0
1
0
0.025848
0
0
0
0
0
0
1
0
false
0
0.869565
0
0.869565
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
353a9f87129693eb06b88d2f95fd93af3bd292d9
1,618
py
Python
sdk/python/pulumi_kubernetes/core/v1/__init__.py
Carlangueitor/pulumi-kubernetes
859ccaaeb8291de49128dbc202fbac1358b2a25a
[ "Apache-2.0" ]
null
null
null
sdk/python/pulumi_kubernetes/core/v1/__init__.py
Carlangueitor/pulumi-kubernetes
859ccaaeb8291de49128dbc202fbac1358b2a25a
[ "Apache-2.0" ]
null
null
null
sdk/python/pulumi_kubernetes/core/v1/__init__.py
Carlangueitor/pulumi-kubernetes
859ccaaeb8291de49128dbc202fbac1358b2a25a
[ "Apache-2.0" ]
null
null
null
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** # Export this package's modules as members: from .Binding import (Binding) from .ComponentStatus import (ComponentStatus) from .ComponentStatusList import (ComponentStatusList) from .ConfigMap import (ConfigMap) from .ConfigMapList import (ConfigMapList) from .Endpoints import (Endpoints) from .EndpointsList import (EndpointsList) from .Event import (Event) from .EventList import (EventList) from .LimitRange import (LimitRange) from .LimitRangeList import (LimitRangeList) from .Namespace import (Namespace) from .NamespaceList import (NamespaceList) from .Node import (Node) from .NodeList import (NodeList) from .PersistentVolume import (PersistentVolume) from .PersistentVolumeClaim import (PersistentVolumeClaim) from .PersistentVolumeClaimList import (PersistentVolumeClaimList) from .PersistentVolumeList import (PersistentVolumeList) from .Pod import (Pod) from .PodList import (PodList) from .PodTemplate import (PodTemplate) from .PodTemplateList import (PodTemplateList) from .ReplicationController import (ReplicationController) from .ReplicationControllerList import (ReplicationControllerList) from .ResourceQuota import (ResourceQuota) from .ResourceQuotaList import (ResourceQuotaList) from .Secret import (Secret) from .SecretList import (SecretList) from .Service import (Service) from .ServiceAccount import (ServiceAccount) from .ServiceAccountList import (ServiceAccountList) from .ServiceList import (ServiceList)
41.487179
81
0.817058
168
1,618
7.869048
0.39881
0
0
0
0
0
0
0
0
0
0
0.000692
0.106922
1,618
38
82
42.578947
0.914187
0.131644
0
0
1
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
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
3
10325dd64b2170b09baf7f13cd204c61706d63ae
1,197
py
Python
PaddleCV/tracking/pytracking/libs/tensordict.py
suytingwan/models
ccdbfe77d071cc19b55fb9f4b738912e35d982ef
[ "Apache-2.0" ]
5
2021-09-28T13:28:01.000Z
2021-12-21T07:25:44.000Z
PaddleCV/tracking/pytracking/libs/tensordict.py
suytingwan/models
ccdbfe77d071cc19b55fb9f4b738912e35d982ef
[ "Apache-2.0" ]
1
2019-11-18T03:03:37.000Z
2019-11-18T03:03:37.000Z
PaddleCV/tracking/pytracking/libs/tensordict.py
suytingwan/models
ccdbfe77d071cc19b55fb9f4b738912e35d982ef
[ "Apache-2.0" ]
4
2021-08-11T08:25:10.000Z
2021-10-16T07:41:59.000Z
from collections import OrderedDict class TensorDict(OrderedDict): """Container mainly used for dicts of Variable.""" def concat(self, other): """Concatenates two dicts without copying internal data.""" return TensorDict(self, **other) def copy(self): return TensorDict(super(TensorDict, self).copy()) def __getattr__(self, name): for n, e in self.items(): if not hasattr(e, name): raise AttributeError('\'{}\' object has not attribute \'{}\''. format(type(e), name)) def apply_attr(*args, **kwargs): return TensorDict({ n: getattr(e, name)(*args, **kwargs) if hasattr(e, name) else e for n, e in self.items() }) return apply_attr def attribute(self, attr: str, *args): return TensorDict({n: getattr(e, attr, *args) for n, e in self.items()}) def apply(self, fn, *args, **kwargs): return TensorDict({n: fn(e, *args, **kwargs) for n, e in self.items()}) @staticmethod def _iterable(a): return isinstance(a, (TensorDict, list))
32.351351
81
0.550543
138
1,197
4.724638
0.391304
0.122699
0.030675
0.042945
0.231595
0.09816
0
0
0
0
0
0
0.319131
1,197
36
82
33.25
0.8
0.081871
0
0
0
0
0.026616
0
0
0
0
0
0
1
0.291667
false
0
0.041667
0.208333
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
1
0
0
0
1
1
0
0
3
103657d8606eaed15b1c626a7ee7b19c52865ffb
328
py
Python
dgp/genera/load/analyzers/structure/structure_dgp.py
dataspot/dgp
553a255a4884b935cf2efecdc761050232f0f066
[ "MIT" ]
1
2019-07-17T11:34:27.000Z
2019-07-17T11:34:27.000Z
dgp/genera/load/analyzers/structure/structure_dgp.py
datahq/dgp
f39592ce20ba67b73b08188f14585b6eb3d43f96
[ "MIT" ]
2
2019-04-30T12:32:32.000Z
2019-04-30T12:35:26.000Z
dgp/genera/load/analyzers/structure/structure_dgp.py
dataspot/dgp
553a255a4884b935cf2efecdc761050232f0f066
[ "MIT" ]
null
null
null
from .....core import BaseDataGenusProcessor from .skip_rows_cols import SkipRowsColsAnalyzer from .header_fields import HeaderFieldsAnalyzer class StructureDGP(BaseDataGenusProcessor): def init(self): self.steps = self.init_classes([ SkipRowsColsAnalyzer, HeaderFieldsAnalyzer ])
25.230769
48
0.72561
28
328
8.357143
0.642857
0
0
0
0
0
0
0
0
0
0
0
0.210366
328
12
49
27.333333
0.903475
0
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
false
0
0.333333
0
0.555556
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
0
0
1
0
1
0
0
3
103f9622faa5552d3f22903128320e6f6e21853e
402
py
Python
core/Functions/loss/loss.py
davidliyutong/Flint
4e2552dac8d781c21e8998ad68bbf1b986b09258
[ "MIT" ]
null
null
null
core/Functions/loss/loss.py
davidliyutong/Flint
4e2552dac8d781c21e8998ad68bbf1b986b09258
[ "MIT" ]
1
2020-07-08T02:57:50.000Z
2020-07-08T02:57:50.000Z
core/Functions/loss/loss.py
davidliyutong/Flint
4e2552dac8d781c21e8998ad68bbf1b986b09258
[ "MIT" ]
null
null
null
class loss(object): def __init__(self): self.last_input = None self.grads = {} self.grads_cuda = {} def loss(self, x, labels): raise NotImplementedError def grad(self, x, labels): raise NotImplementedError def loss_cuda(self, x, labels): raise NotImplementedError def grad_cuda(self, x, labels): raise NotImplementedError
22.333333
35
0.619403
45
402
5.355556
0.355556
0.082988
0.182573
0.26556
0.684647
0.684647
0.348548
0
0
0
0
0
0.291045
402
17
36
23.647059
0.845614
0
0
0.307692
0
0
0
0
0
0
0
0
0
1
0.384615
false
0
0
0
0.461538
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
1046637dc3e5e9f988aca37a93792eab50ea3e93
108
py
Python
admin/apps.py
vah-ini/crispy-ai
f1f743012cac508dd4ad13c886eab6352c9c5053
[ "MIT" ]
7
2019-05-07T17:31:57.000Z
2021-07-06T15:08:14.000Z
admin/apps.py
vah-ini/crispy-ai
f1f743012cac508dd4ad13c886eab6352c9c5053
[ "MIT" ]
60
2019-05-04T08:52:37.000Z
2022-03-11T23:53:25.000Z
admin/apps.py
vah-ini/crispy-ai
f1f743012cac508dd4ad13c886eab6352c9c5053
[ "MIT" ]
21
2019-04-12T14:31:54.000Z
2019-09-29T09:51:20.000Z
from django.apps import AppConfig class AdminConfig(AppConfig): name = 'admin' label = 'ai_admin'
15.428571
33
0.703704
13
108
5.769231
0.846154
0
0
0
0
0
0
0
0
0
0
0
0.203704
108
6
34
18
0.872093
0
0
0
0
0
0.12037
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
1047cad497cbd76c1c6c8c81d58f380420936ca0
658
py
Python
aws_api_mock/Factory_Simple.py
danilocgsilva/aws-data-mock
07e0013f04bccb8c756a8911acd047813cf176f9
[ "MIT" ]
null
null
null
aws_api_mock/Factory_Simple.py
danilocgsilva/aws-data-mock
07e0013f04bccb8c756a8911acd047813cf176f9
[ "MIT" ]
null
null
null
aws_api_mock/Factory_Simple.py
danilocgsilva/aws-data-mock
07e0013f04bccb8c756a8911acd047813cf176f9
[ "MIT" ]
null
null
null
from random import random import math class Factory_Simple: def __init__(self): self.possibles = [] def set_possibles(self, possible): self.possibles.append(possible) return self def get_possibles(self) -> list: return self.possibles def get_extracting(self): possibles_length = len(self.possibles) if possibles_length == 0: raise Exception('There are no more elements to extract') choice_position = math.floor(random() * possibles_length) choice_result = self.possibles[choice_position] del self.possibles[choice_position] return choice_result
27.416667
68
0.670213
76
658
5.592105
0.473684
0.214118
0.075294
0.127059
0
0
0
0
0
0
0
0.002037
0.253799
658
23
69
28.608696
0.863544
0
0
0
0
0
0.056231
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0.055556
0.555556
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
1068e92e11dcf71f4fc7c3d076b9e6d84ae02f0b
15,551
py
Python
tests/test_effects_inference.py
audreyseo/tisane
1a73fbbe81a3890b712d4a92765b38259b24c7b3
[ "Apache-2.0" ]
8
2021-08-31T19:03:08.000Z
2022-03-30T05:49:23.000Z
tests/test_effects_inference.py
audreyseo/tisane
1a73fbbe81a3890b712d4a92765b38259b24c7b3
[ "Apache-2.0" ]
7
2021-08-30T02:00:34.000Z
2022-01-19T05:44:52.000Z
tests/test_effects_inference.py
audreyseo/tisane
1a73fbbe81a3890b712d4a92765b38259b24c7b3
[ "Apache-2.0" ]
2
2021-12-27T22:28:15.000Z
2022-01-19T00:42:47.000Z
""" Tests how model effects structures are inferred NOTE: The tests are only to test, not to make any statements about how these variables relate in the real world """ import tisane as ts from tisane import graph_inference from tisane.graph_inference import ( infer_main_effects_with_explanations, infer_interaction_effects_with_explanations, infer_random_effects_with_explanations, ) from tisane.variable import ( AbstractVariable, Associates, Has, Causes, Moderates, Nests, NumberValue, Exactly, # Subclass of NumberValue AtMost, # Subclass of NumberValue Repeats, ) from tisane.random_effects import RandomIntercept, RandomSlope import unittest class EffectsInferenceTest(unittest.TestCase): def test_main_included_causes(self): u0 = ts.Unit("Unit") m0 = u0.numeric("Measure_0") m1 = u0.numeric("Measure_1") dv = u0.numeric("Dependent_variable") m0.causes(dv) m1.causes(dv) design = ts.Design(dv=dv, ivs=[m0, m1]) gr = design.graph (main_effects, main_explanations) = infer_main_effects_with_explanations( gr, design ) self.assertEqual(len(main_effects), 2) self.assertIn(m0, main_effects) self.assertIn(m1, main_effects) def test_main_included_associates(self): u0 = ts.Unit("Unit") m0 = u0.numeric("Measure_0") m1 = u0.numeric("Measure_1") dv = u0.numeric("Dependent_variable") m0.associates_with(dv) m1.associates_with(dv) design = ts.Design(dv=dv, ivs=[m0, m1]) gr = design.graph (main_effects, main_explanations) = infer_main_effects_with_explanations( gr, design ) self.assertEqual(len(main_effects), 2) self.assertIn(m0, main_effects) self.assertIn(m1, main_effects) def test_main_excluded_causes(self): u0 = ts.Unit("Unit") m0 = u0.numeric("Measure_0") m1 = u0.numeric("Measure_1") m2 = u0.numeric("Measure_2") dv = u0.numeric("Dependent_variable") m0.causes(dv) m1.causes(dv) design = ts.Design(dv=dv, ivs=[m0, m1]) gr = design.graph (main_effects, main_explanations) = infer_main_effects_with_explanations( gr, design ) self.assertEqual(len(main_effects), 2) self.assertIn(m0, main_effects) self.assertIn(m1, main_effects) self.assertNotIn(m2, main_effects) def test_main_excluded_associates(self): u0 = ts.Unit("Unit") m0 = u0.numeric("Measure_0") m1 = u0.numeric("Measure_1") m2 = u0.numeric("Measure_2") dv = u0.numeric("Dependent_variable") m0.associates_with(dv) m1.associates_with(dv) design = ts.Design(dv=dv, ivs=[m0, m1]) gr = design.graph (main_effects, main_explanations) = infer_main_effects_with_explanations( gr, design ) self.assertEqual(len(main_effects), 2) self.assertIn(m0, main_effects) self.assertIn(m1, main_effects) self.assertNotIn(m2, main_effects) def test_main_conceptual_parent_causes(self): u0 = ts.Unit("Unit") m0 = u0.numeric("Measure_0") m1 = u0.numeric("Measure_1") m2 = u0.numeric("Measure_2") dv = u0.numeric("Dependent_variable") m0.causes(dv) m1.causes(dv) m2.causes(m0) # conceptual parent design = ts.Design(dv=dv, ivs=[m0, m1]) gr = design.graph (main_effects, main_explanations) = infer_main_effects_with_explanations( gr, design ) self.assertEqual(len(main_effects), 3) self.assertIn(m0, main_effects) self.assertIn(m1, main_effects) self.assertIn(m2, main_effects) def test_main_shared_ancestor_causes(self): u0 = ts.Unit("Unit") m0 = u0.numeric("Measure_0") m1 = u0.numeric("Measure_1") m2 = u0.numeric("Measure_2") dv = u0.numeric("Dependent_variable") m0.causes(dv) m1.causes(dv) m2.causes(m0) # shared ancestor m2.causes(m1) # shared ancestor design = ts.Design(dv=dv, ivs=[m0, m1]) gr = design.graph (main_effects, main_explanations) = infer_main_effects_with_explanations( gr, design ) self.assertEqual(len(main_effects), 3) self.assertIn(m0, main_effects) self.assertIn(m1, main_effects) self.assertIn(m2, main_effects) def test_main_ivs_associated_and_causes_dv(self): u0 = ts.Unit("Unit") m0 = u0.numeric("Measure_0") m1 = u0.numeric("Measure_1") dv = u0.numeric("Dependent_variable") m0.causes(dv) m1.causes(dv) m1.associates_with(m0) design = ts.Design(dv=dv, ivs=[m0]) gr = design.graph (main_effects, main_explanations) = infer_main_effects_with_explanations( gr, design ) self.assertEqual(len(main_effects), 2) self.assertIn(m0, main_effects) self.assertIn(m1, main_effects) def test_main_ivs_associated_and_associates_with_dv(self): u0 = ts.Unit("Unit") m0 = u0.numeric("Measure_0") m1 = u0.numeric("Measure_1") dv = u0.numeric("Dependent_variable") m0.associates_with(dv) m1.associates_with(dv) m1.associates_with(m0) design = ts.Design(dv=dv, ivs=[m0]) gr = design.graph (main_effects, main_explanations) = infer_main_effects_with_explanations( gr, design ) self.assertEqual(len(main_effects), 2) self.assertIn(m0, main_effects) self.assertIn(m1, main_effects) def test_main_ivs_cause(self): u0 = ts.Unit("Unit") m0 = u0.numeric("Measure_0") m1 = u0.numeric("Measure_1") dv = u0.numeric("Dependent_variable") m0.causes(dv) m1.causes(dv) m1.causes(m0) design = ts.Design(dv=dv, ivs=[m0]) gr = design.graph (main_effects, main_explanations) = infer_main_effects_with_explanations( gr, design ) self.assertEqual(len(main_effects), 2) self.assertIn(m0, main_effects) self.assertIn(m1, main_effects) def test_interaction_moderates_one_variable(self): u0 = ts.Unit("Unit") m0 = u0.numeric("Measure_0") m1 = u0.numeric("Measure_1") m2 = u0.numeric("Measure_2") dv = u0.numeric("Dependent_variable") m0.causes(dv) m1.causes(dv) m2.moderates(moderator=m1, on=dv) design = ts.Design(dv=dv, ivs=[m0, m1]) # omit m2 gr = design.graph main_effects = [m0, m1] ( interaction_effects, interaction_explanations, ) = infer_interaction_effects_with_explanations(gr, design, main_effects) self.assertEqual(len(interaction_effects), 0) self.assertEqual(len(m2.relationships), 2) ixn = None for r in m2.relationships: if isinstance(r, Moderates): ixn = r self.assertIsNotNone(ixn) def test_interaction_moderates_two_variables(self): u0 = ts.Unit("Unit") m0 = u0.numeric("Measure_0") m1 = u0.numeric("Measure_1") m2 = u0.numeric("Measure_2") dv = u0.numeric("Dependent_variable") m0.causes(dv) m1.causes(dv) m2.moderates(moderator=m1, on=dv) design = ts.Design(dv=dv, ivs=[m0, m1, m2]) gr = design.graph main_effects = [m0, m1, m2] ( interaction_effects, interaction_explanations, ) = infer_interaction_effects_with_explanations(gr, design, main_effects) self.assertEqual(len(interaction_effects), 1) var = interaction_effects.pop() self.assertEqual(len(m2.relationships), 2) ixn = None for r in m2.relationships: if isinstance(r, Moderates): ixn = r self.assertIsNotNone(ixn) for x in ixn.moderator: self.assertIn(x.name, var.name) def test_random_repeats(self): u0 = ts.Unit("Unit") s0 = ts.SetUp("Time", order=[1, 2, 3, 4, 5]) dv = u0.numeric("Dependent_variable", number_of_instances=s0) design = ts.Design(dv=dv, ivs=[s0]) # main effect of Time gr = design.graph main_effects = [s0] (random_effects, random_explanations) = infer_random_effects_with_explanations( gr=gr, query=design, main_effects=main_effects ) self.assertEqual(len(random_effects), 2) has_unit_ri = False has_time_ri = False for ri in random_effects: self.assertIsInstance(ri, RandomIntercept) if isinstance(ri.groups, ts.Unit): self.assertIs(ri.groups, u0) has_unit_ri = True elif isinstance(ri.groups, ts.SetUp): self.assertIs(ri.groups, s0) has_time_ri = True self.assertTrue(has_unit_ri) self.assertTrue(has_time_ri) def test_random_nested(self): u0 = ts.Unit("Unit 0") m0 = u0.numeric("Measure_0") u1 = ts.Unit("Unit 1") dv = u0.numeric("Dependent_variable") u0.nests_within(u1) design = ts.Design(dv=dv, ivs=[m0]) gr = design.graph main_effects = design.ivs (random_effects, random_explanations) = infer_random_effects_with_explanations( gr=gr, query=design, main_effects=main_effects ) self.assertEqual(len(random_effects), 1) ri = random_effects.pop() self.assertIsInstance(ri, RandomIntercept) self.assertIs(ri.groups, u1) # Barr et al. 2013 example def test_composed_measures_with_repeats(self): subject = ts.Unit("Subject", cardinality=12) # Each subject has a two values for condition, which is nominal. # Verbose: Each instance of subject has two instances of a nominal variable condition. # Informally: Each subjects sees two (both) conditions. condition = subject.nominal("Word_type", cardinality=2, number_of_instances=2) # Repeated measures # Each subject has a measure reaction time, which is numeric, for each instance of a word # Verbose: Each instance of subject has one instance of a numeric variable weight for each value of word. # Informally: Each subject has a reaction time for each word. # Implies: Each condition has/is comprised of two words. word = subject.nominal( "Word", cardinality=4, number_of_instances=Exactly(2).per(number_of_instances=condition), ) reaction_time = subject.numeric("Time", number_of_instances=word) # ALTERNATIVELY, we could do something like the below (not implemented). It is a bit more complicated to calculate the number of instances, but still doable I think. # Each word has one value for condition (already defined above as a measure of subject) # word.has(condition, number_of_instances=1) # Condition has two units design = ts.Design(dv=reaction_time, ivs=[condition]) gr = design.graph main_effects = design.ivs (random_effects, random_explanations) = infer_random_effects_with_explanations( gr=gr, query=design, main_effects=main_effects ) self.assertEqual( len(random_effects), 3 ) # two random intercepts, 1 random slope for re in random_effects: if isinstance(re, RandomSlope): self.assertIs(re.iv, condition) self.assertIs(re.groups, subject) else: self.assertIsInstance(re, RandomIntercept) if re.groups != subject: self.assertIs(re.groups, word) # Barr 2013 time * group interaction example: # "For example, consider a design with two independent groups of subjects, # where there are observations at multiple time points for each subject. # When testing the time-by-group interaction, the model should include a # random slope for the continuous variable of time..." def test_random_effects_for_two_way_time_group_interaction(self): subject = ts.Unit("Unit") time = ts.SetUp("Time") condition = subject.nominal( "Condition", cardinality=2, number_of_instances=1 ) # "two independent groups of subjects" dv = subject.numeric( "Dependent_variable", number_of_instances=time ) # within-subject time.associates_with(dv) condition.causes(dv) time.moderates(moderator=[condition], on=dv) design = ts.Design(dv=dv, ivs=[time, condition]) gr = design.graph main_effects = design.ivs ( interaction_effects, interaction_explanations, ) = infer_interaction_effects_with_explanations( gr=gr, query=design, main_effects=main_effects ) (random_effects, random_explanations) = infer_random_effects_with_explanations( gr=gr, query=design, main_effects=main_effects, interaction_effects=interaction_effects, ) # gr=gr, query=design, main_effects # interactions=list(interaction_effects) # ) self.assertEqual(len(random_effects), 1) rs = random_effects.pop() self.assertIsInstance(rs, RandomSlope) self.assertEqual(rs.iv.name, time.name) self.assertIs(rs.groups, subject) # def test_composed_measures_no_repeats(self): # subject = ts.Unit("Subject") # word = ts.Unit("Word") # # Each subject has a two values for condition, which is nominal. # # Verbose: Each instance of subject has two instances of a nominal variable condition. # # Informally: Each subjects sees two (both) conditions. # condition = subject.nominal("Word_type", cardinality=2, number_of_instances=2) # # Repeated measures # # Each subject has a measure reaction time, which is numeric, for each instance of a word # # Verbose: Each instance of subject has one instance of a numeric variable weight for each value of word. # # Informally: Each subject has a reaction time for each word. # reaction_time = subject.numeric("Time", number_of_instances=1) # TODO: DOES THIS EVEN MAKE SENSE!? # # Each condition has/is comprised of two words. # condition.has(word, number_of_instances=2) # # ALTERNATIVELY, we could do something like the below (not implemented). It is a bit more complicated to calculate the number of instances, but still doable I think. # # Each word has one value for condition (already defined above as a measure of subject) # # word.has(condition, number_of_instances=1) # Condition has two units # design = ts.Design(dv=reaction_time, ivs=[condition]) # gr = design.graph # main_effects = design.ivs # (random_effects, random_explanations) = infer_random_effects_with_explanations(gr=gr, query=design, main_effects=main_effects) # self.assertEqual(len(random_effects), 3) # two random intercepts, 1 random slope # # TODO: How to ask if slope and intercept are correlated?
34.404867
175
0.627612
1,915
15,551
4.916971
0.111227
0.084112
0.049278
0.045136
0.765081
0.737468
0.703377
0.699129
0.66472
0.66472
0
0.023353
0.275802
15,551
451
176
34.481153
0.812733
0.209311
0
0.602524
0
0
0.050573
0
0
0
0
0.002217
0.176656
1
0.047319
false
0
0.018927
0
0.069401
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
106a133641a7eb9a0686dcea8a2199087735acbf
243
py
Python
leehao/learn82.py
pilihaotian/pythonlearning
e84b7766cc9ea8131e9720fb1f06761c9581d0da
[ "Apache-2.0" ]
1
2020-02-26T14:52:17.000Z
2020-02-26T14:52:17.000Z
leehao/learn82.py
pilihaotian/pythonlearning
e84b7766cc9ea8131e9720fb1f06761c9581d0da
[ "Apache-2.0" ]
null
null
null
leehao/learn82.py
pilihaotian/pythonlearning
e84b7766cc9ea8131e9720fb1f06761c9581d0da
[ "Apache-2.0" ]
null
null
null
# 字节数组 bytearray 可变的 print(bytearray()) print(bytearray(1)) # 整数 print(bytearray([1, 2, 3, 4])) # 可迭代 print(bytearray("hello,world", encoding='utf-8')) # 字符串 encod ba = bytearray([1, 2, 3, 4]) print("更改前:", ba) ba[0] = 2 print("更改后:", ba)
22.090909
62
0.621399
40
243
3.775
0.525
0.370861
0.198676
0.15894
0.172185
0
0
0
0
0
0
0.057971
0.148148
243
10
63
24.3
0.671498
0.144033
0
0
0
0
0.118227
0
0
0
0
0
0
1
0
false
0
0
0
0
0.75
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
106fc2d64a259ba2cbc36555caa83ca60f0f5de4
748
py
Python
emwiki/symbol/models.py
seigodev/emwiki
4b41d2d74c4937cc3ef2093e6478cfb73e943b7f
[ "MIT" ]
2
2021-12-20T16:37:24.000Z
2021-12-21T00:43:17.000Z
emwiki/symbol/models.py
seigodev/emwiki
4b41d2d74c4937cc3ef2093e6478cfb73e943b7f
[ "MIT" ]
101
2019-07-29T07:44:56.000Z
2022-03-31T04:11:04.000Z
emwiki/symbol/models.py
seigodev/emwiki
4b41d2d74c4937cc3ef2093e6478cfb73e943b7f
[ "MIT" ]
11
2019-07-24T02:37:35.000Z
2021-12-09T05:24:31.000Z
import os from django.db import models from django.urls import reverse from django.conf import settings class Symbol(models.Model): name = models.CharField(primary_key=True, max_length=50) filename = models.CharField(max_length=20) type = models.CharField(max_length=10) def __str__(self): return f'{self.name}:{self.filename}' @classmethod def get_htmlfile_dir(cls): return settings.PRODUCT_SYMBOLHTML_DIR @property def template_path(self): return f"symbol/symbol_html/{self.filename}" def get_htmlfile_path(self): return os.path.join(self.file_dir, f'{self.filename}') def get_absolute_url(self): return reverse("symbol:index", kwargs=dict(name=self.name))
24.933333
67
0.707219
103
748
4.951456
0.466019
0.078431
0.070588
0.094118
0
0
0
0
0
0
0
0.009852
0.185829
748
29
68
25.793103
0.827586
0
0
0
0
0
0.117647
0.081551
0
0
0
0
0
1
0.25
false
0
0.2
0.25
0.9
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
107f9a93bc71693abd756605ac3fc9d733bac1c1
3,407
py
Python
urlshortener/settings.py
clownkill/url_shortener_django
729a7e129a099f33314200be332537a12f9087d7
[ "MIT" ]
null
null
null
urlshortener/settings.py
clownkill/url_shortener_django
729a7e129a099f33314200be332537a12f9087d7
[ "MIT" ]
null
null
null
urlshortener/settings.py
clownkill/url_shortener_django
729a7e129a099f33314200be332537a12f9087d7
[ "MIT" ]
null
null
null
""" Django settings for urlshortener project. Generated by 'django-admin startproject' using Django 4.0.3. For more information on this file, see https://docs.djangoproject.com/en/4.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.0/ref/settings/ """ import os import dj_database_url from environs import Env from pathlib import Path env = Env() env.read_env() # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = env.str('SECRET_KEY', 'REPLACE_ME') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.bool('DEBUG', True) ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', []) # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'shortenersite', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'urlshortener.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'urlshortener.wsgi.application' # Database # https://docs.djangoproject.com/en/4.0/ref/settings/#databases DATABASES = { 'default': dj_database_url.parse( os.getenv('DATABASE', 'sqlite:///db.sqlite3') ), } # Password validation # https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/4.0/topics/i18n/ LANGUAGE_CODE = 'ru' TIME_ZONE = 'Europe/Moscow' USE_I18N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.0/howto/static-files/ STATIC_URL = 'static/' # Default primary key field type # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' SITE_URL = env.str('SITE_URL', 'http://localhost:8000')
26.007634
91
0.707661
386
3,407
6.142487
0.411917
0.082244
0.07423
0.084353
0.195276
0.195276
0.129481
0.129481
0.067482
0
0
0.009787
0.160258
3,407
131
92
26.007634
0.818944
0.318756
0
0
1
0
0.537456
0.427265
0
0
0
0
0
1
0
false
0.070423
0.056338
0
0.056338
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
1
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
10af1d4aa4053ec2dec9c77c646928c33b7134a8
236
py
Python
shorty/common/exceptions/validation_exception.py
iliasmentz/url-shortener
3da7a254cead89f36d303fbd63a1659896774300
[ "MIT" ]
2
2020-10-19T21:32:25.000Z
2020-12-02T19:55:22.000Z
shorty/common/exceptions/validation_exception.py
iliasmentz/url-shortener
3da7a254cead89f36d303fbd63a1659896774300
[ "MIT" ]
null
null
null
shorty/common/exceptions/validation_exception.py
iliasmentz/url-shortener
3da7a254cead89f36d303fbd63a1659896774300
[ "MIT" ]
3
2021-03-11T18:51:33.000Z
2022-01-04T17:41:54.000Z
from shorty.common.exceptions.shorty_exception import ShortyException HTTP_STATUS = 422 class ValidationException(ShortyException): def __init__(self, code: str, detail: str): super().__init__(HTTP_STATUS, code, detail)
23.6
69
0.766949
27
236
6.296296
0.703704
0.117647
0
0
0
0
0
0
0
0
0
0.014851
0.144068
236
9
70
26.222222
0.826733
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
52a448e687cda524405d27442cf3139dec2bd0c1
212
py
Python
Docs/Examples/objects/RKerning_00.py
Vectro-Type-Foundry/robofab
cd65d78292d24358c98dce53d283314cdc85878e
[ "BSD-3-Clause" ]
61
2015-01-17T10:15:45.000Z
2018-12-02T13:53:02.000Z
Docs/Examples/objects/RKerning_00.py
Vectro-Type-Foundry/robofab
cd65d78292d24358c98dce53d283314cdc85878e
[ "BSD-3-Clause" ]
37
2015-01-05T23:44:56.000Z
2018-03-16T19:05:28.000Z
Docs/Examples/objects/RKerning_00.py
Vectro-Type-Foundry/robofab
cd65d78292d24358c98dce53d283314cdc85878e
[ "BSD-3-Clause" ]
25
2015-01-08T19:49:36.000Z
2018-10-29T00:36:46.000Z
# robofab manual # Kerning object # usage examples f = CurrentFont() print f.kerning # getting a value from the kerning dictionary print f.kerning[('V', 'A')] print f.kerning[('T', 'X')] print f.kerning.keys()
17.666667
45
0.698113
32
212
4.625
0.59375
0.162162
0.351351
0
0
0
0
0
0
0
0
0
0.150943
212
11
46
19.272727
0.822222
0.415094
0
0
0
0
0.033613
0
0
0
0
0
0
0
null
null
0
0
null
null
0.8
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
1
0
0
0
0
0
0
1
0
3
52aca03df959ddd9b9550b2fcc97cda5eb7a1a24
58
py
Python
ibug/au_detection/__init__.py
ibug-group/au_detection
7145e86a792f191229d7753329ed6d04eb07531a
[ "MIT" ]
1
2022-02-07T11:58:13.000Z
2022-02-07T11:58:13.000Z
ibug/au_detection/__init__.py
ibug-group/au_detection
7145e86a792f191229d7753329ed6d04eb07531a
[ "MIT" ]
null
null
null
ibug/au_detection/__init__.py
ibug-group/au_detection
7145e86a792f191229d7753329ed6d04eb07531a
[ "MIT" ]
1
2021-12-01T11:03:01.000Z
2021-12-01T11:03:01.000Z
from .aunet import AUNetPredictor __version__ = '0.1.0'
11.6
33
0.741379
8
58
4.875
0.875
0
0
0
0
0
0
0
0
0
0
0.061224
0.155172
58
4
34
14.5
0.734694
0
0
0
0
0
0.086207
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
52b6a5728170f15c66007180c679a33ab70b9f01
106
py
Python
mocpy/moc/__init__.py
hirnimeshrampuresoftware/mocpy
4ed42b7f07ca3931379b884c49fd26eed1ec812b
[ "BSD-3-Clause" ]
34
2017-07-24T10:11:20.000Z
2022-02-23T06:22:59.000Z
mocpy/moc/__init__.py
tboch/pymoc
fbbde759f18ebeb656ec2b2150225e453c3b4550
[ "BSD-3-Clause" ]
55
2017-10-17T12:05:04.000Z
2022-03-30T21:31:06.000Z
mocpy/moc/__init__.py
tboch/pymoc
fbbde759f18ebeb656ec2b2150225e453c3b4550
[ "BSD-3-Clause" ]
19
2017-10-17T09:51:04.000Z
2022-01-07T21:09:23.000Z
from .moc import MOC from .plot.wcs import World2ScreenMPL __all__ = [ 'MOC', 'World2ScreenMPL' ]
15.142857
37
0.688679
12
106
5.75
0.583333
0
0
0
0
0
0
0
0
0
0
0.02381
0.207547
106
7
38
15.142857
0.797619
0
0
0
0
0
0.168224
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
52ddb6b647d3ddc5683427100e5907ef6d99cd30
270
py
Python
pyEpiabm/pyEpiabm/output/__init__.py
Saketkr21/epiabm
3ec0dcbc78d3fd4114ed3c6bdd78ef39f0013d2f
[ "BSD-3-Clause" ]
11
2021-12-02T15:24:02.000Z
2022-03-10T14:02:13.000Z
pyEpiabm/pyEpiabm/output/__init__.py
Saketkr21/epiabm
3ec0dcbc78d3fd4114ed3c6bdd78ef39f0013d2f
[ "BSD-3-Clause" ]
119
2021-11-24T13:56:48.000Z
2022-03-30T11:52:07.000Z
pyEpiabm/pyEpiabm/output/__init__.py
SABS-R3-Epidemiology/epiabm
8eb83fd2de84104f6f77929e3771095f7b033ddc
[ "BSD-3-Clause" ]
3
2022-01-13T03:05:19.000Z
2022-03-11T22:00:17.000Z
# # Output subpackage of the pyEpiabm module. # """ pyEpiabm.output provides various methods to record the outputs of any simulation. """ from .abstract_reporter import AbstractReporter from ._csv_dict_writer import _CsvDictWriter from ._csv_writer import _CsvWriter
20.769231
73
0.807407
34
270
6.176471
0.705882
0.066667
0
0
0
0
0
0
0
0
0
0
0.137037
270
12
74
22.5
0.901288
0.459259
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
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
52f5823f13977d4ba524b56940af9f17351a964f
173
py
Python
demo/view_test/fetview_test.py
aliddell/spiketag
f5600126c2c6c9be319e8b808d51ea33be843909
[ "BSD-3-Clause" ]
4
2018-04-23T18:08:39.000Z
2020-03-10T19:06:28.000Z
demo/view_test/fetview_test.py
aliddell/spiketag
f5600126c2c6c9be319e8b808d51ea33be843909
[ "BSD-3-Clause" ]
69
2017-02-17T19:27:52.000Z
2022-03-30T04:06:53.000Z
demo/view_test/fetview_test.py
aliddell/spiketag
f5600126c2c6c9be319e8b808d51ea33be843909
[ "BSD-3-Clause" ]
5
2017-02-01T16:11:32.000Z
2021-02-05T20:10:43.000Z
from spiketag.view import scatter_3d_view import numpy as np x = np.random.randn(20,4) fet_view = scatter_3d_view() fet_view.set_data(x) fet_view.show() fet_view.app.run()
19.222222
41
0.780347
34
173
3.705882
0.588235
0.222222
0.206349
0
0
0
0
0
0
0
0
0.032258
0.104046
173
8
42
21.625
0.780645
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.285714
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
5e0cdf5792f3da1e686ba3ea5ee77ca81084fae7
4,967
py
Python
omas/tests/test_omas_examples.py
gafusion/omas
8e9b725483655db0ccbf9a4f7aa9eba7c6c04864
[ "MIT" ]
20
2017-11-07T14:36:21.000Z
2021-03-27T19:14:17.000Z
omas/tests/test_omas_examples.py
Reksoatr/omas
6740fd040d6af59e0aec54f977637b221733bd07
[ "MIT" ]
170
2017-11-09T06:40:11.000Z
2022-03-29T17:33:26.000Z
omas/tests/test_omas_examples.py
Reksoatr/omas
6740fd040d6af59e0aec54f977637b221733bd07
[ "MIT" ]
6
2017-11-22T14:44:54.000Z
2022-01-10T19:52:47.000Z
#!/usr/bin/env python # # -*- coding: utf-8 -*- """ Test script for omas/examples/... .. code-block:: none python3 -m unittest omas/tests/test_omas_examples ------- """ # Basic imports import os # Use Agg backend to avoid opening up figures import matplotlib matplotlib.use('Agg') from matplotlib import pyplot # OMAS imports from omas import * from omas.omas_utils import * from omas.tests.failed_imports import * class TestOmasExamples(UnittestCaseOmas): """ Test suite for examples files """ def tearDown(self): pyplot.close() def test_omas_units(self): from omas.examples import omas_units def test_omas_time(self): from omas.examples import omas_time def test_ods_sample(self): from omas.examples import ods_sample def test_omas_coordinates(self): from omas.examples import omas_coordinates def test_plot_quantity(self): from omas.examples import plot_quantity def test_parse_codeparameters(self): from omas.examples import parse_codeparameters @unittest.skipIf(failed_IMAS, str(failed_IMAS)) @unittest.skipIf(not_running_on_iter_cluster, str(not_running_on_iter_cluster)) def test_solps_imas(self): from omas.examples import solps_imas @unittest.skipIf((failed_IMAS or failed_OMFIT), str(failed_IMAS) + str(failed_OMFIT)) def test_geqdsk_to_from_imas(self): from omas.examples import geqdsk_to_from_imas def test_showcase_paths(self): from omas.examples import showcase_paths def test_ods_process_input_data(self): from omas.examples import ods_process_input_data @unittest.skipIf(failed_MONGO, str(failed_MONGO)) def test_omas_mongo_example(self): from omas.examples import omas_mongo_example @unittest.skipIf(failed_S3, str(failed_S3)) def test_save_load_through(self): from omas.examples import save_load_through def test_connect_gkdb(self): from omas.examples import connect_gkdb @unittest.skipIf(failed_UDA, str(failed_UDA)) def test_omas_uda_example(self): from omas.examples import omas_uda_example def test_save_load_all(self): from omas.examples import save_load_all @unittest.skipIf(failed_S3, str(failed_S3)) def test_plot_omas(self): from omas.examples import plot_omas def test_omas_resample(self): from omas.examples import omas_resample def test_uncertain(self): from omas.examples import uncertain @unittest.skipIf(failed_OMFIT, str(failed_OMFIT)) def test_plot_g_s_2_ip(self): from omas.examples import plot_g_s_2_ip def test_plot_saveload_scaling(self): from omas.examples import plot_saveload_scaling def test_across_ODSs(self): from omas.examples import across_ODSs def test_omas_cocos(self): from omas.examples import omas_cocos @unittest.skipIf(failed_IMAS, str(failed_IMAS)) @unittest.skipIf(not_running_on_iter_cluster, str(not_running_on_iter_cluster)) def test_iter_scenario(self): from omas.examples import iter_scenario @unittest.skipIf(failed_IMAS, str(failed_IMAS)) def test_simple_imas(self): from omas.examples import simple_imas def test_consistency_check(self): from omas.examples import consistency_check @unittest.skipIf(failed_OMFIT, str(failed_OMFIT)) def test_plot_omas_omfit(self): from omas.examples import plot_omas_omfit @unittest.skipIf(failed_S3, str(failed_S3)) def test_plot_omas_overlays(self): from omas.examples import plot_omas_overlays def test_omas_info(self): from omas.examples import omas_info def test_omas_dynamic_nc(self): from omas.examples import omas_dynamic_nc @unittest.skipIf(failed_IMAS, str(failed_IMAS)) def test_omas_dynamic_imas(self): from omas.examples import omas_dynamic_imas @unittest.skipIf(failed_D3D_MDS, str(failed_D3D_MDS)) def test_omas_dynamic_machine(self): from omas.examples import omas_dynamic_machine def test_omas_collection(self): from omas.examples import omas_collection def test_extra_structures(self): from omas.examples import extra_structures @unittest.skipIf(failed_IMAS, str(failed_IMAS)) @unittest.skipIf(not_running_on_cea_cluster, str(not_running_on_cea_cluster)) def test_west_geqdsk(self): from omas.examples import west_geqdsk # for filename in glob.glob(os.path.abspath(omas_dir + 'examples/*.py')): # if '__init__' in filename: # continue # name = os.path.splitext(os.path.split(filename)[1])[0] # execstring = ''' def test_{name}(self): # from omas.examples import {name} # '''.format(name=name) # print(execstring) if __name__ == '__main__': suite = unittest.TestLoader().loadTestsFromTestCase(TestOmasExamples) unittest.TextTestRunner(verbosity=2).run(suite)
29.390533
89
0.7272
680
4,967
5.005882
0.194118
0.089307
0.123384
0.20564
0.509401
0.413631
0.280846
0.176557
0.176557
0.138954
0
0.003731
0.190658
4,967
168
90
29.565476
0.843035
0.115563
0
0.122449
0
0
0.002525
0
0
0
0
0
0
1
0.357143
false
0
0.408163
0
0.77551
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
0
0
0
3
5e0fdb117a989e8340d8e460d0dc97be8588eade
172
py
Python
Exercicios do curso em video/pythonProject/pythonteste/aula18.py
HiCosta/Exercicios-de-Python
1dabbe8764f6742aba1d62a9ea14705534aaf6f7
[ "MIT" ]
null
null
null
Exercicios do curso em video/pythonProject/pythonteste/aula18.py
HiCosta/Exercicios-de-Python
1dabbe8764f6742aba1d62a9ea14705534aaf6f7
[ "MIT" ]
null
null
null
Exercicios do curso em video/pythonProject/pythonteste/aula18.py
HiCosta/Exercicios-de-Python
1dabbe8764f6742aba1d62a9ea14705534aaf6f7
[ "MIT" ]
null
null
null
galera = [['João', 19], ['Ana', 33], ['Joaquim', 13], ['Maria', 45]] # listas compostas print(galera[2][1]) # será exibido o número 13 por estas na lista 2 posição 1
43
90
0.610465
27
172
3.888889
0.851852
0
0
0
0
0
0
0
0
0
0
0.100719
0.19186
172
3
91
57.333333
0.654676
0.418605
0
0
0
0
0.197917
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
5e344ec9a8761cc211659a34c4b28d25e5abc84a
806
py
Python
vrepdemo/__init__.py
Nara0731/DRL_VREP
62dc2950f1111a2c4e311a64819562e9e9f4f6e1
[ "MIT" ]
3
2020-02-13T02:55:16.000Z
2020-05-17T01:49:49.000Z
vrepdemo/__init__.py
Nara0731/DRL_VREP
62dc2950f1111a2c4e311a64819562e9e9f4f6e1
[ "MIT" ]
null
null
null
vrepdemo/__init__.py
Nara0731/DRL_VREP
62dc2950f1111a2c4e311a64819562e9e9f4f6e1
[ "MIT" ]
1
2020-05-24T12:44:30.000Z
2020-05-24T12:44:30.000Z
from gym.envs.registration import register register( id='vrep-hopper-v0', entry_point='vrepdemo.envs:HopperVrepEnv', ) register( id='vrep-twolink-v0', entry_point='vrepdemo.envs:TwoLinkVrepEnv', ) register( id='vrep-twolink1-v0', entry_point='vrepdemo.envs:TwoLink1VrepEnv', ) register( id='vrep-twolink2-v0', entry_point='vrepdemo.envs:TwoLink2VrepEnv', ) register( id='vrep-sixlink1-v0', entry_point='vrepdemo.envs:SixLink1VrepEnv', ) register( id='vrep-sixlink2-v0', entry_point='vrepdemo.envs:SixLink2VrepEnv', ) register( id='vrep-twolinkball-v0', entry_point='vrepdemo.envs:TwoLinkBallVrepEnv', ) register( id='vrep-twolinkball2-v0', entry_point='vrepdemo.envs:TwoLinkBall2VrepEnv', )
18.744186
53
0.671216
86
806
6.197674
0.325581
0.150094
0.210131
0.300188
0.360225
0
0
0
0
0
0
0.027481
0.187345
806
42
54
19.190476
0.78626
0
0
0.242424
0
0
0.482307
0.309305
0
0
0
0
0
1
0
true
0
0.030303
0
0.030303
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
eab260627da6908e607d66dc7ed4ff149e1e3b0d
328
py
Python
tests/factories.py
wagtail/wagtail-algolia-search
aac62c402ba21068e3fc2f09282b5c3d9ec6024a
[ "BSD-3-Clause" ]
null
null
null
tests/factories.py
wagtail/wagtail-algolia-search
aac62c402ba21068e3fc2f09282b5c3d9ec6024a
[ "BSD-3-Clause" ]
null
null
null
tests/factories.py
wagtail/wagtail-algolia-search
aac62c402ba21068e3fc2f09282b5c3d9ec6024a
[ "BSD-3-Clause" ]
1
2021-10-19T03:17:31.000Z
2021-10-19T03:17:31.000Z
import wagtail_factories import factory from tests.models import BlogIndex, BlogPage class BlogIndexFactory(wagtail_factories.PageFactory): class Meta: model = BlogIndex class BlogPageFactory(wagtail_factories.PageFactory): class Meta: model = BlogPage introduction = factory.Faker("sentence")
19.294118
54
0.756098
33
328
7.424242
0.545455
0.195918
0.220408
0.261224
0.334694
0.334694
0
0
0
0
0
0
0.182927
328
16
55
20.5
0.914179
0
0
0.2
0
0
0.02439
0
0
0
0
0
0
1
0
false
0
0.3
0
0.8
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
eac6328d8fd0783bd802321d92079feb2186cbd6
1,110
py
Python
mannaggia/santi/api/client.py
veeso/mannaggia-py
283fcb2e7fa23856673f7041e1185af446c28315
[ "WTFPL" ]
4
2022-01-25T13:30:32.000Z
2022-01-26T08:14:17.000Z
mannaggia/santi/api/client.py
veeso/mannaggia-py
283fcb2e7fa23856673f7041e1185af446c28315
[ "WTFPL" ]
null
null
null
mannaggia/santi/api/client.py
veeso/mannaggia-py
283fcb2e7fa23856673f7041e1185af446c28315
[ "WTFPL" ]
null
null
null
""" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2022 Christian "veeso" Visintin Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. """ from ..santo import Santo from abc import ABCMeta, abstractmethod from typing import List class ClientError(Exception): """ Client Error """ def __init__(self, message: str): self.message = message def __str__(self): return repr(self.message) def __repr__(self): return str(self.message) class Client(object): """API client to collect santi""" __metaclass__ = ABCMeta @abstractmethod def query_santi(self, amount: int) -> List[Santo]: """Query santi on remote server. Raises ClientError in case of failure""" raise NotImplementedError
25.813953
81
0.678378
145
1,110
5.075862
0.57931
0.059783
0.036685
0.052989
0.125
0.125
0.125
0.095109
0.095109
0
0
0.012092
0.254955
1,110
42
82
26.428571
0.877872
0.518018
0
0
0
0
0
0
0
0
0
0
0
1
0.266667
false
0
0.2
0.133333
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
ead099d080b82a7393e2b89683f657465da605bb
275
py
Python
backends/admin.py
synqs/qlue
421fcbdf8b8309340d3360d3efe0debe315b9891
[ "Apache-2.0" ]
4
2022-01-14T16:53:10.000Z
2022-02-02T12:59:06.000Z
backends/admin.py
synqs/qlue
421fcbdf8b8309340d3360d3efe0debe315b9891
[ "Apache-2.0" ]
4
2022-01-17T14:44:58.000Z
2022-02-18T08:01:02.000Z
backends/admin.py
synqs/qlue
421fcbdf8b8309340d3360d3efe0debe315b9891
[ "Apache-2.0" ]
null
null
null
""" Module that defines some basic properties of the app. """ from django.contrib import admin from django.contrib.auth.admin import UserAdmin from .models import User, Backend # Register your models here. admin.site.register(User, UserAdmin) admin.site.register(Backend)
21.153846
53
0.785455
39
275
5.538462
0.589744
0.092593
0.157407
0
0
0
0
0
0
0
0
0
0.127273
275
12
54
22.916667
0.9
0.294545
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.6
0
0.6
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
eae7976a01a16a9ff35b84f53176d21013e320b3
3,116
py
Python
backend/src/webApp/userManager.py
NRizzoInc/email_messages
d15826efb4e19d6c97738df582fc767d4db9ba3e
[ "MIT" ]
1
2020-03-22T03:48:41.000Z
2020-03-22T03:48:41.000Z
backend/src/webApp/userManager.py
NRizzoInc/email_messages
d15826efb4e19d6c97738df582fc767d4db9ba3e
[ "MIT" ]
31
2020-07-15T01:38:27.000Z
2020-07-20T20:55:41.000Z
backend/src/webApp/userManager.py
NRizzoInc/email_messages
d15826efb4e19d6c97738df582fc767d4db9ba3e
[ "MIT" ]
null
null
null
""" @file Responsible for handling & keeping track of multiple users to keeping their data safe and seperate """ #------------------------------STANDARD DEPENDENCIES-----------------------------# import base64 from datetime import datetime, timedelta import os #-----------------------------3RD PARTY DEPENDENCIES-----------------------------# # from werkzeug.contrib.securecookie import SecureCookie from flask import Flask, redirect, flash from flask_login import LoginManager #--------------------------------OUR DEPENDENCIES--------------------------------# from backend.src import utils from backend.src.webApp import webAppConsts from backend.src.database.databaseManager import DatabaseManager from backend.src.webApp.user import User class UserManager(LoginManager, DatabaseManager): def __init__(self, app:Flask): self.flaskApp = app # create login manager object LoginManager.__init__(self, self.flaskApp) self.createLoginManager() # Create Database Manager DatabaseManager.__init__(self) def createLoginManager(self): """ \n@Brief: Helper function that creates all the necessary login manager attributes (callbacks) \n@Note: Wrapper to provide closure for `self` """ @self.user_loader def loadUser(userToken): """ \n@Brief: When Flask app is asked for "current_user", this decorator gets the current user's User object \n@Note: Refence current user with `current_user` (from flask_login import current_user) \n@Param: userToken - The user's unique token id \n@Return: Reference to the User class related to this userToken """ return self.findUserById(userToken, User) @self.unauthorized_handler def onNeedToLogIn(): """ \n@Brief: VERY important callback that redirects the user to log in if needed -- gets triggered by "@login_required" if page is accessed without logging in """ # if user is forced to login, display this message # loginMsg = "Please log in to access this page" # flash(loginMsg) return redirect(webAppConsts.formSites["webAppLogin"]) def addUser(self, webAppUsername, webAppPassword): """ \n@Brief: Add a user \n@Param: webAppUsername - The user's username on the site \n@Param: webAppPassword - The user's password on the site \n@Note: Username has already been checked to not be a repeat """ userToken = self.createSafeCookieId() # create new email agent for each user newUserObj = User(userToken) self._addUserToColl(userToken, webAppUsername, webAppPassword, newUserObj) def removeUser(self, userToken): """ \n@Brief: Remove a user \n@Param: userToken - The user's unique token """ UserManager.userDatabase[userToken].logoutClient() del UserManager.userDatabase[userToken]
39.443038
120
0.616496
332
3,116
5.722892
0.430723
0.022105
0.029474
0.021053
0.04
0.04
0.04
0.04
0.04
0
0
0.001296
0.257381
3,116
78
121
39.948718
0.819793
0.544608
0
0
0
0
0.008215
0
0
0
0
0
0
1
0.206897
false
0.068966
0.310345
0
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
1
1
0
0
0
0
3
d8016d0a62d04b5d52eb25d7124f8fe9a03cf8ff
168
py
Python
src/test/TestAffichage.py
Franckyi/Simulation-Telecom
e856b78bd1da487d52676fc97750be73858f3f30
[ "MIT" ]
null
null
null
src/test/TestAffichage.py
Franckyi/Simulation-Telecom
e856b78bd1da487d52676fc97750be73858f3f30
[ "MIT" ]
null
null
null
src/test/TestAffichage.py
Franckyi/Simulation-Telecom
e856b78bd1da487d52676fc97750be73858f3f30
[ "MIT" ]
null
null
null
#!/usr/bin/env python # coding: utf-8 import affichage import sequence seq = sequence.sequence_aleatoire(32) affichage.figure_sequence(seq, 0, 3) affichage.afficher()
18.666667
37
0.779762
24
168
5.375
0.708333
0.170543
0
0
0
0
0
0
0
0
0
0.033113
0.10119
168
8
38
21
0.821192
0.202381
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
d81130232c05152a7ca2c88a8e9391290fec57da
118
py
Python
morsecodetoolkit/data/__init__.py
1-800-BAD-CODE/MorseCodeToolkit
349a397a01bcc3d8896676f9250194dc770e010c
[ "Apache-2.0" ]
2
2021-12-31T09:19:12.000Z
2021-12-31T19:40:12.000Z
morsecodetoolkit/data/__init__.py
1-800-BAD-CODE/MorseCodeToolkit
349a397a01bcc3d8896676f9250194dc770e010c
[ "Apache-2.0" ]
null
null
null
morsecodetoolkit/data/__init__.py
1-800-BAD-CODE/MorseCodeToolkit
349a397a01bcc3d8896676f9250194dc770e010c
[ "Apache-2.0" ]
null
null
null
from morsecodetoolkit.data.synthetic_dataset import SyntheticMorseDataset __all__ = [ "SyntheticMorseDataset" ]
16.857143
73
0.813559
9
118
10.111111
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.127119
118
6
74
19.666667
0.883495
0
0
0
0
0
0.179487
0.179487
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d813704ba97dfeae49d94d4621fe18a5a3dc140a
291
py
Python
jsontab/__init__.py
anthony-aylward/jsontab
fdc739489ec047a23713e9c01a4d0bfe93682973
[ "MIT" ]
null
null
null
jsontab/__init__.py
anthony-aylward/jsontab
fdc739489ec047a23713e9c01a4d0bfe93682973
[ "MIT" ]
null
null
null
jsontab/__init__.py
anthony-aylward/jsontab
fdc739489ec047a23713e9c01a4d0bfe93682973
[ "MIT" ]
null
null
null
"""Agnostically load JSON or tabular data Functions --------- from_json load a pandas DatFrame from data in JSON format from_json_or_tab load a pandas DataFrame from data that may be in either JSON or tabular format """ from jsontab.jsontab import from_json, from_json_or_tab
20.785714
75
0.752577
47
291
4.489362
0.446809
0.113744
0.123223
0.123223
0
0
0
0
0
0
0
0
0.189003
291
13
76
22.384615
0.894068
0.776632
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
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
d8257f1d861cb0175ac43911199f4f84786c28d0
559
py
Python
algorithms_comparisons/analysis/tests.py
eryktrzeciakiewicz/algorithms-comparisons
101cbb4ccf13c3dc607b0e6c192ab2237c78b13e
[ "MIT" ]
null
null
null
algorithms_comparisons/analysis/tests.py
eryktrzeciakiewicz/algorithms-comparisons
101cbb4ccf13c3dc607b0e6c192ab2237c78b13e
[ "MIT" ]
null
null
null
algorithms_comparisons/analysis/tests.py
eryktrzeciakiewicz/algorithms-comparisons
101cbb4ccf13c3dc607b0e6c192ab2237c78b13e
[ "MIT" ]
null
null
null
import unittest from .benchmark import benchmark class BenchmarkTest(unittest.TestCase): @classmethod def setUpClass(cls): def fun1(x): return x*x def fun2(x): return x*x*x def fun3(x): return x*x*x*x cls.functions = [fun1,fun2,fun3] cls.arguments = [i for i in range(200)] def test_benchmark_works(self): res = benchmark(self.functions, self.arguments) self.assertEqual(len(res), 2) for key in res[1]: self.assertGreater(key, 0)
27.95
55
0.581395
73
559
4.424658
0.465753
0.037152
0.074303
0.083591
0.06192
0
0
0
0
0
0
0.031332
0.314848
559
20
56
27.95
0.81201
0
0
0
0
0
0
0
0
0
0
0
0.111111
1
0.277778
false
0
0.111111
0.166667
0.611111
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
dc1f7911486add90e6661da427febcb676f193bc
125
py
Python
src/openhab_utils/staticconfig.py
vincentdm/openhab-utils
03e840ec2f178e3810baa41207618423b624f490
[ "BSD-3-Clause" ]
null
null
null
src/openhab_utils/staticconfig.py
vincentdm/openhab-utils
03e840ec2f178e3810baa41207618423b624f490
[ "BSD-3-Clause" ]
null
null
null
src/openhab_utils/staticconfig.py
vincentdm/openhab-utils
03e840ec2f178e3810baa41207618423b624f490
[ "BSD-3-Clause" ]
null
null
null
''' Created on 28-mei-2016 @author: vincent Static configuration, updated and generated by autoconf ''' VERSION = "0.1.0"
12.5
55
0.712
18
125
4.944444
0.944444
0
0
0
0
0
0
0
0
0
0
0.085714
0.16
125
9
56
13.888889
0.761905
0.776
0
0
1
0
0.25
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
dc3c46c9e31e2e9378743dd3e17be65ad72cd21f
136
py
Python
package/setup.py
mondas-mania/cipher-py
e1dd287311ab487fd54a8becee444b3d7561b63c
[ "MIT" ]
null
null
null
package/setup.py
mondas-mania/cipher-py
e1dd287311ab487fd54a8becee444b3d7561b63c
[ "MIT" ]
null
null
null
package/setup.py
mondas-mania/cipher-py
e1dd287311ab487fd54a8becee444b3d7561b63c
[ "MIT" ]
null
null
null
from setuptools import setup setup( name='cipherpy', author='David Sampson', install_requires=[ 'numpy' ] )
15.111111
28
0.595588
13
136
6.153846
0.923077
0
0
0
0
0
0
0
0
0
0
0
0.294118
136
9
29
15.111111
0.833333
0
0
0
0
0
0.189781
0
0
0
0
0
0
1
0
true
0
0.125
0
0.125
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
dc422fa9444ad48759cc11b5a20419cced641f05
633
py
Python
models/base_model.py
itaigat/pytorch-template
ac43b126c7a1515a004211a3e28b870f374df618
[ "MIT" ]
13
2020-09-08T18:39:56.000Z
2022-02-02T10:00:22.000Z
models/base_model.py
itaigat/pytorch-template
ac43b126c7a1515a004211a3e28b870f374df618
[ "MIT" ]
1
2021-04-21T14:32:26.000Z
2021-04-21T17:14:09.000Z
models/base_model.py
itaigat/pytorch-template
ac43b126c7a1515a004211a3e28b870f374df618
[ "MIT" ]
7
2020-12-10T07:14:22.000Z
2021-09-07T04:16:22.000Z
""" Example for a simple model """ from abc import ABCMeta from nets.fc import FCNet from torch import nn, Tensor class MyModel(nn.Module, metaclass=ABCMeta): """ Example for a simple model """ def __init__(self, input_dim: int = 50, num_hid: int = 256, output_dim: int = 2, dropout: float = 0.2): super(MyModel, self).__init__() self.classifier = FCNet([input_dim, num_hid, num_hid, output_dim], 'ReLU', dropout=dropout) def forward(self, x: Tensor) -> Tensor: """ Forward x through MyModel :param x: :return: """ return self.classifier(x)
25.32
107
0.616114
84
633
4.464286
0.5
0.048
0.058667
0.090667
0.117333
0
0
0
0
0
0
0.017167
0.263823
633
24
108
26.375
0.787554
0.154818
0
0
0
0
0.008529
0
0
0
0
0
0
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
dc44a33b75b83f4220e71937697ae109b126758b
173
py
Python
old/test2.py
archu2020/python-2
19c626ca9fd37168db8a7ac075fd80c8e2971313
[ "Apache-2.0" ]
48
2017-12-24T12:19:55.000Z
2022-02-26T13:14:27.000Z
old/test2.py
17610178081/python
3975c678d985c468deecd03560d882e9d316bb63
[ "Apache-2.0" ]
3
2018-12-05T08:48:14.000Z
2020-07-29T01:56:16.000Z
old/test2.py
17610178081/python
3975c678d985c468deecd03560d882e9d316bb63
[ "Apache-2.0" ]
113
2017-08-09T03:10:04.000Z
2022-03-26T16:05:01.000Z
import time print("start") start_time = time.time() temp = 0 for i in range(10000000): temp += i print(temp) end_time = time.time() print(end_time - start_time)
15.727273
29
0.66474
28
173
3.964286
0.428571
0.288288
0.216216
0
0
0
0
0
0
0
0
0.065217
0.202312
173
10
30
17.3
0.73913
0
0
0
0
0
0.030675
0
0
0
0
0
0
1
0
false
0
0.111111
0
0.111111
0.333333
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
dc4ab332c14c615c7d313f0e07788b6f23d8828c
13,701
py
Python
config.py
lstappen/SCORE
e46a0410995ea8e8eefe91065498c34a9357c11e
[ "Apache-2.0" ]
null
null
null
config.py
lstappen/SCORE
e46a0410995ea8e8eefe91065498c34a9357c11e
[ "Apache-2.0" ]
null
null
null
config.py
lstappen/SCORE
e46a0410995ea8e8eefe91065498c34a9357c11e
[ "Apache-2.0" ]
null
null
null
import os # data processing def get_basic_config(feature_type, label_type, SPLITS, HOLDOUT): config = {} config['feature_type'] = feature_type #input_type to feature_type config['label_type'] = label_type config['SPLITS'] = SPLITS config['HOLDOUT'] = HOLDOUT config['DATA_PATH'] = '.' + os.sep + 'data' config['FEATURE_PATH'] = '.' + os.sep + 'features' config['FEATURE_PATH_COMPARE'] = config['FEATURE_PATH'] + os.sep + 'compare/' config['FEATURE_PATH_LLD'] = config['FEATURE_PATH'] + os.sep + 'lld' + os.sep config['FEATURE_PATH_Spectro'] = config['FEATURE_PATH'] + os.sep + 'spectrogram' + os.sep config['FEATURE_PATH_BoAW'] = config['FEATURE_PATH'] + os.sep + 'boaw' + os.sep config['FEATURE_PATH_eGemaps'] = config['FEATURE_PATH'] + os.sep + 'egemaps' + os.sep config['FEATURE_PATH_PKLS'] = config['FEATURE_PATH'] + os.sep + 'pkls' + os.sep + config['feature_type'] + os.sep config['FEATURE_PATH_DS'] = config['FEATURE_PATH'] + os.sep + 'deepspectrum' + os.sep config['GENDER'] = ['women', 'men'] # Modify openSMILE paths here: config['SMILEexe'] = '~/opensmile-2.3.0/bin/linux_x64_standalone_static/SMILExtract' config['SMILEconf'] = '~/opensmile-2.3.0/config/ComParE_2016.conf' config['egemapsconf'] = '~/opensmile-2.3.0/config/gemaps/eGeMAPSv01a.conf' config['openXBOW'] = './tools/openXBOW.jar' #Deep Spectrum configuration config['ds'] = 'deepspectrum features' config['dsconf'] = ' -nm 256 -nl -en vgg16 -fl fc2 -m mel ' if config['feature_type'] == 'mfcc': config = get_mfcc_config(config) if config['feature_type'] == 'lld': config = get_lld_config(config) if 'boaw' in config['feature_type']: # modify BoAW settings here config = get_lld_config(config) config = get_bow_config(config) if config['feature_type'] == 'raw': config = get_raw_audio_config(config) return config def get_mfcc_config(config): # modify MFCC settings here config['num_components'] = 40 # number of MFCCs to return config['num_timesteps_mfcc'] = 44 # frames config['mfcc_max_pad_len'] = config['num_timesteps_mfcc'] config['num_channels'] = 1 return config def get_lld_config(config): # modify LDDs settings here config['num_timesteps_lld'] = 100 # frames config['lld_max_pad_len'] = config['num_timesteps_lld'] return config def get_lld_config(config): # modify LDDs settings here config['num_timesteps_lld'] = 224 # frames config['lld_max_pad_len'] = config['num_timesteps_lld'] return config def get_bow_config(config): # modify LDDs settings here config['csize'] = int(config['feature_type'].split('_')[-1]) # frames if config['csize'] not in [125, 250, 500, 1000, 2000]: print("csize not in [125, 250, 500, 1000, 2000] ") exit() #config['lld_max_pad_len'] = config['num_timesteps_lld'] return config def get_raw_audio_config(config): config['frame_rate'] = 40 # 40 ms 1 sec config['audio_length'] = 1000 config['sample_rate'] = 16000 return config # experiments # overall config def get_basic_evaluation(model_type, experiment_name, feature_type): config = {} config['feature_type'] = feature_type #input_type to feature_type config['model_type'] = model_type config['experiment_name'] = experiment_name #input_type to feature_type config['FEATURE_PATH'] = '.' + os.sep + 'features' config['FEATURE_PATH_PKLS'] = config['FEATURE_PATH'] + os.sep + 'pkls' + os.sep + config['feature_type'] + os.sep config['EXPERIMENT_PATH'] = '.' + os.sep + 'experiments' + os.sep + experiment_name + os.sep config['PLOT_PATH'] = config['EXPERIMENT_PATH'] + 'plots' + os.sep config['MODEL_PATH'] = config['EXPERIMENT_PATH'] + 'model' + os.sep config['RESULT_PATH'] = config['EXPERIMENT_PATH'] + 'results' + os.sep config['num_labels'] = 2 return config def get_lstm_config(model_type, experiment_name, feature_type): config = get_basic_evaluation(model_type, experiment_name, feature_type) config = get_mfcc_config(config) if config['feature_type'] == 'mfcc': config['lstm1_n'] = 40 config['lstm2_n'] = 40//2 config['parameter_list'] = [{ 'num_epochs': 200, 'num_batch_size': 32, 'learning_rate' : 0.0001 }, ] elif config['feature_type'] == 'lld': config['lstm1_n'] = 50 config['lstm2_n'] = 30 config['parameter_list'] = [{ 'num_epochs': 200, 'num_batch_size': 32, 'learning_rate' : 0.0001 }, ] elif config['feature_type'] == 'raw': config['lstm1_n'] = 50 config['lstm2_n'] = 30 config['parameter_list'] = [{ 'num_epochs': 200, 'num_batch_size': 32, 'learning_rate' : 0.0001 }, ] else: config['lstm1_n'] = 50 config['lstm2_n'] = 30 config['parameter_list'] = [{ 'num_epochs': 200, 'num_batch_size': 32, 'learning_rate' : 0.0001 }, ] # experiment parameter identified as best working parameters: return config # cnn specific config def get_cnn_config(model_type, experiment_name, feature_type): config = get_basic_evaluation(model_type, experiment_name, feature_type) config = get_mfcc_config(config) # experiment parameter identified as best working parameters: config['parameter_list'] = [{ 'num_epochs': 100, 'num_batch_size': 10, 'learning_rate' : 0.0001 }, { 'num_epochs': 100, 'num_batch_size': 64, 'learning_rate' : 0.00001 }] return config # cnn specific config def get_crnn_config(model_type, experiment_name, feature_type): config = get_basic_evaluation(model_type, experiment_name, feature_type) config = get_mfcc_config(config) if config['feature_type'] == 'mfcc': config['Conv1_filters'] = 10 config['Conv1_kernel_size'] = 6 config['Conv2_filters'] = 20 config['Conv2_kernel_size'] = 8 config['Conv3_filters'] = 40 config['Conv3_kernel_size'] = 10 config['lstm1_n'] = 40 config['lstm2_n'] = 40//2 config['parameter_list'] = get_parameter_optimisation() # [{ # 'num_epochs': 500, # 'num_batch_size': 32, # 'learning_rate' : 0.005 # },] elif config['feature_type'] == 'lld': config['Conv1_filters'] = 30 config['Conv1_kernel_size'] = 10 config['Conv2_filters'] = 30 config['Conv2_kernel_size'] = 8 config['Conv3_filters'] = 40 config['Conv3_kernel_size'] = 10 config['lstm1_n'] = 50 config['lstm2_n'] = 30 config['parameter_list'] = get_parameter_optimisation() # [{ # 'num_epochs': 500, # 'num_batch_size': 32, # 'learning_rate' : 0.0001 # },] if config['feature_type'] == 'raw': config['Conv1_filters'] = 40 config['Conv1_kernel_size'] = 2 config['Conv2_filters'] = 50 config['Conv2_kernel_size'] = 4 config['Conv3_filters'] = 0 config['Conv3_kernel_size'] = 8 config['lstm1_n'] = 50 config['lstm2_n'] = 40//2 config['parameter_list'] = get_parameter_optimisation() # [{ # 'num_epochs': 500, # 'num_batch_size': 50, # 'learning_rate' : 0.0001 # },] else: config['Conv1_filters'] = 10 config['Conv1_kernel_size'] = 6 config['Conv2_filters'] = 20 config['Conv2_kernel_size'] = 8 config['Conv3_filters'] = 40 config['Conv3_kernel_size'] = 10 config['lstm1_n'] = 40 config['lstm2_n'] = 40//2 config['parameter_list'] = get_parameter_optimisation() # [{ # 'num_epochs': 500, # 'num_batch_size': 32, # 'learning_rate' : 0.005 # },] # experiment parameter identified as best working parameters: return config def get_parameter_optimisation(): # test [{'num_epochs': 1, # 'num_batch_size': 16, # 'learning_rate' : 0.01}] return [ {'num_epochs': 3000, 'num_batch_size': 64, 'learning_rate' : 1e-05}] [{'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 0.001}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 0.0001}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 5e-05}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 1e-05}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 0.001}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 0.0001}] [{'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 0.01}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 0.01}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 0.01}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 0.001}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 0.001}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 0.001}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 0.0001}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 0.0001}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 0.0001}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 5e-05}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 5e-05}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 5e-05}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 1e-05}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 1e-05}, {'num_epochs': 500, 'num_batch_size': 16, 'learning_rate' : 1e-05}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 0.01}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 0.01}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 0.01}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 0.001}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 0.001}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 0.001}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 0.0001}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 0.0001}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 0.0001}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 5e-05}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 5e-05}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 5e-05}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 1e-05}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 1e-05}, {'num_epochs': 500, 'num_batch_size': 32, 'learning_rate' : 1e-05}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 0.01}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 0.01}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 0.01}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 0.001}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 0.001}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 0.001}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 0.0001}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 0.0001}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 0.0001}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 5e-05}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 5e-05}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 5e-05}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 1e-05}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 1e-05}, {'num_epochs': 500, 'num_batch_size': 64, 'learning_rate' : 1e-05},] # svm specific config def get_svm_config(model_type, experiment_name, feature_type): config = get_basic_evaluation(model_type, experiment_name, feature_type) config['svm_seq_agg'] = 'middle' # mean or middle # experiment parameter identified as best working parameters: config['parameter_list'] = [ { 'C': 1e-6, 'max_iter': 10000 }, { 'C': 1e-5, 'max_iter': 10000 }, { 'C': 1e-4, 'max_iter': 10000 }, { 'C': 1e-3, 'max_iter': 10000 }, { 'C': 1e-2, 'max_iter': 10000 }, { 'C': 1e-1, 'max_iter': 10000 }, { 'C': 1e0, 'max_iter': 10000 }, { 'C': 10, 'max_iter': 10000 } ] return config
29.275641
117
0.574338
1,665
13,701
4.418619
0.106907
0.077069
0.102759
0.112138
0.785374
0.728014
0.693897
0.675003
0.663722
0.629876
0
0.081596
0.275454
13,701
468
118
29.275641
0.659514
0.083862
0
0.706849
0
0
0.330694
0.012079
0
0
0
0
0
1
0.032877
false
0
0.00274
0
0.068493
0.00274
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
dc6624ff8eca0ead6a5c32e3a2fa65a5f94b6bf2
93
py
Python
try.py
HyeseonLee/FromNode_Project
fbe8d4ce83eadfd9c6609cbc42860f798cc42941
[ "Apache-2.0" ]
1
2020-12-26T07:57:07.000Z
2020-12-26T07:57:07.000Z
try.py
HyeseonLee/FromNode_Project
fbe8d4ce83eadfd9c6609cbc42860f798cc42941
[ "Apache-2.0" ]
98
2020-11-10T10:00:24.000Z
2021-06-28T23:25:31.000Z
try.py
HyeseonLee/FromNode_Project
fbe8d4ce83eadfd9c6609cbc42860f798cc42941
[ "Apache-2.0" ]
5
2020-12-26T07:57:08.000Z
2021-08-18T09:00:52.000Z
def test(a,b,c): a =1 b =2 c =3 return [1,2,3] a = test(1,2,3) print(a,test)
11.625
18
0.462366
23
93
1.869565
0.434783
0.093023
0.139535
0
0
0
0
0
0
0
0
0.142857
0.322581
93
8
19
11.625
0.539683
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0
0
0.285714
0.142857
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
dc68f7569bccdc15fdccbecf594e50e575d526f8
572
py
Python
data/base.py
enomotokenji/hat-search-ps-cvpr2020
6f7abd8def9da929fc7eb3143b07654e0e5ae70e
[ "MIT" ]
4
2020-09-06T02:12:01.000Z
2022-02-19T11:53:32.000Z
data/base.py
enomotokenji/hat-search-ps-cvpr2020
6f7abd8def9da929fc7eb3143b07654e0e5ae70e
[ "MIT" ]
null
null
null
data/base.py
enomotokenji/hat-search-ps-cvpr2020
6f7abd8def9da929fc7eb3143b07654e0e5ae70e
[ "MIT" ]
null
null
null
class BaseData: def __init__(self): self.root_dir = None self.gray = None self.div_Lint = None self.filenames = None self.L = None self.Lint = None self.mask = None self.M = None self.N = None def _load_mask(self): raise NotImplementedError def _load_M(self): raise NotImplementedError def _load_N(self): raise NotImplementedError def _to_gray(self): raise NotImplementedError def _div_Lint(self): raise NotImplementedError
22
33
0.587413
64
572
5
0.3125
0.2
0.4375
0.3875
0.21875
0
0
0
0
0
0
0
0.347902
572
26
34
22
0.857909
0
0
0.238095
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0
0
0.333333
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
dc7766669b4cd999903c5a3f1766f7b31eac0d62
888
py
Python
src/fiwtools/fiwdb/__init__.py
duynht/FIW_KRT
0869a0e2ca7335548e0a066b651011158315b14b
[ "MIT" ]
26
2018-01-23T02:11:29.000Z
2021-08-05T12:50:39.000Z
src/fiwtools/fiwdb/__init__.py
huskyjo/FIW_KRT
bc07ba242ccaf762a55c80204d7da05d55847ec5
[ "MIT" ]
2
2018-04-13T08:19:03.000Z
2020-04-19T10:59:51.000Z
src/fiwtools/fiwdb/__init__.py
huskyjo/FIW_KRT
bc07ba242ccaf762a55c80204d7da05d55847ec5
[ "MIT" ]
7
2019-07-14T01:19:46.000Z
2020-09-25T03:27:41.000Z
# from os import path, remove # import logging # import logging.config # # from .fiw import tri_subjects # # # If applicable, delete the existing log file to generate a fresh log file during each execution # # if path.isfile("python_logging.log"): # # remove("python_logging.log") # # # Create the Logger # logger = logging.getLogger(__name__) # logger.setLevel(logging.DEBUG) # # # Create the Handler for logging data to a file # logger_handler = logging.FileHandler('fiw_1.log') # # logger_handler.setLevel(logging.WARNING) # # # Create a Formatter for formatting the log messages # logger_formatter = logging.Formatter('%(asctime)s:%(name)s - %(levelname)s - %(message)s') # # # Add the Formatter to the Handler # logger_handler.setFormatter(logger_formatter) # # # Add the Handler to the Logger # logger.addHandler(logger_handler) # logger.info('Completed configuring logger()!')
31.714286
98
0.740991
119
888
5.411765
0.428571
0.080745
0.049689
0
0
0
0
0
0
0
0
0.001309
0.13964
888
27
99
32.888889
0.841623
0.927928
0
null
1
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
0
1
0
0
1
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
dc8ea7f76cd20d0b5e24a8c006b4352964678ec2
405
py
Python
investing_algorithm_framework/core/mixins/__init__.py
coding-kitties/investing-algorithm-framework
1156acf903345ec5e6787ee8767c68e24c4daffd
[ "Apache-2.0" ]
9
2020-09-14T13:46:32.000Z
2022-02-01T15:40:12.000Z
investing_algorithm_framework/core/mixins/__init__.py
coding-kitties/investing-algorithm-framework
1156acf903345ec5e6787ee8767c68e24c4daffd
[ "Apache-2.0" ]
44
2020-12-28T16:22:20.000Z
2022-03-23T22:11:26.000Z
investing_algorithm_framework/core/mixins/__init__.py
coding-kitties/investing-algorithm-framework
1156acf903345ec5e6787ee8767c68e24c4daffd
[ "Apache-2.0" ]
2
2020-12-25T06:14:39.000Z
2022-01-19T19:00:20.000Z
from .binance_api_secret_key_specifier import BinanceApiSecretKeySpecifierMixin from .order_executors import BinanceOrderExecutorMixin from .portfolio_managers import BinancePortfolioManagerMixin from .data_providers import BinanceDataProviderMixin __all__ = [ "BinanceOrderExecutorMixin", "BinancePortfolioManagerMixin", "BinanceApiSecretKeySpecifierMixin", "BinanceDataProviderMixin" ]
33.75
79
0.854321
28
405
11.964286
0.642857
0
0
0
0
0
0
0
0
0
0
0
0.101235
405
11
80
36.818182
0.92033
0
0
0
0
0
0.271605
0.271605
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
1
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
0
0
0
0
3
dc9e6fb57f9df73852dcf78993d204275059271f
127
py
Python
app/urls.py
akiracadet/django-blog
989bbaeaf86870ff28aff36a4e91c9979c238b20
[ "MIT" ]
null
null
null
app/urls.py
akiracadet/django-blog
989bbaeaf86870ff28aff36a4e91c9979c238b20
[ "MIT" ]
null
null
null
app/urls.py
akiracadet/django-blog
989bbaeaf86870ff28aff36a4e91c9979c238b20
[ "MIT" ]
null
null
null
from django.urls import path from app.views import HomeView urlpatterns = [ path('', HomeView.as_view(), name='home'), ]
15.875
46
0.692913
17
127
5.117647
0.764706
0
0
0
0
0
0
0
0
0
0
0
0.165354
127
7
47
18.142857
0.820755
0
0
0
0
0
0.031496
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
dca7f6d6e4443aa45c9ef448efdfab664323c83c
232
py
Python
pinterest/board/apps.py
platzi-pinterest/backend
6a6cb4f8cbc4c8ad01e184264486ae466f403059
[ "MIT" ]
null
null
null
pinterest/board/apps.py
platzi-pinterest/backend
6a6cb4f8cbc4c8ad01e184264486ae466f403059
[ "MIT" ]
null
null
null
pinterest/board/apps.py
platzi-pinterest/backend
6a6cb4f8cbc4c8ad01e184264486ae466f403059
[ "MIT" ]
null
null
null
""" Board App. """ from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class BoardAppConfig(AppConfig): """ Board app config.""" name = "pinterest.board" verbose_name = _("board")
21.090909
54
0.698276
27
232
5.851852
0.666667
0.101266
0
0
0
0
0
0
0
0
0
0
0.176724
232
10
55
23.2
0.827225
0.12069
0
0
0
0
0.105263
0
0
0
0
0
0
1
0
false
0
0.4
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
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
dcb64ccfdd92b64833628f41f0346c98cad56faf
1,123
py
Python
auto_struct/data_types/string/char.py
Valmarelox/auto_struct
ec06fc426d468d4d01f300add3081df9eda87f41
[ "MIT" ]
7
2020-09-03T20:54:13.000Z
2022-03-09T01:21:07.000Z
auto_struct/data_types/string/char.py
Valmarelox/auto_struct
ec06fc426d468d4d01f300add3081df9eda87f41
[ "MIT" ]
null
null
null
auto_struct/data_types/string/char.py
Valmarelox/auto_struct
ec06fc426d468d4d01f300add3081df9eda87f41
[ "MIT" ]
null
null
null
from typing import Union from ..int.integer import Integer from ..int import uint8_t from ...exceptions.type import ElementCountException class Char(uint8_t): """ 8-bit ASCII character """ FORMAT = 'c' def __init__(self, value: Union[bytes,Integer,int]): if isinstance(value, (Integer, int)): value = int(value) else: value = bytes(value) if len(value) != 1: raise ElementCountException(f'value has invalid length: {len(value)}, expected: 1') value = ord(value) super(Char, self).__init__(value) def __repr__(self): return repr(bytes(self.value)) def __str__(self): return chr(self.value) def __bytes__(self): return bytes(chr(self.value), 'ascii') def __int__(self): return self.value def __index__(self): return int(self) def __eq__(self, other): if isinstance(other, bytes): other = ord(other) return super(Char, self).__eq__(other) def __hash__(self): return super(Char, self).__hash__()
24.413043
99
0.593054
133
1,123
4.661654
0.338346
0.096774
0.062903
0.06129
0
0
0
0
0
0
0
0.006281
0.291184
1,123
45
100
24.955556
0.772613
0.0187
0
0
0
0
0.05268
0
0
0
0
0
0
1
0.258065
false
0
0.129032
0.193548
0.677419
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
f4acddcbe66f5264384f0c688e761d24dbc055ff
225
py
Python
Participants/Whos_Rem/vlc-dependancy check.py
python-discord/game-jam-2020
cdcb1c2c9246825518a29b05cc39a679b36d666e
[ "MIT" ]
15
2020-04-17T12:02:14.000Z
2022-03-16T03:01:34.000Z
Participants/Whos_Rem/vlc-dependancy check.py
python-discord/game-jam-2020
cdcb1c2c9246825518a29b05cc39a679b36d666e
[ "MIT" ]
9
2020-04-25T01:57:16.000Z
2020-04-29T11:42:34.000Z
Participants/Whos_Rem/vlc-dependancy check.py
python-discord/game-jam-2020
cdcb1c2c9246825518a29b05cc39a679b36d666e
[ "MIT" ]
55
2020-04-17T12:01:11.000Z
2021-12-28T10:14:02.000Z
import vlc import time vlc_instance = vlc.Instance('--input-repeat=-1') player = vlc_instance.media_player_new() media = vlc_instance.media_new(r"main\tracks\TRACK_1.mp3") player.set_media(media) player.play() time.sleep(10)
25
58
0.782222
37
225
4.540541
0.513514
0.261905
0.190476
0
0
0
0
0
0
0
0
0.023923
0.071111
225
9
59
25
0.779904
0
0
0
0
0
0.176991
0.10177
0
0
0
0
0
1
0
false
0
0.25
0
0.25
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
f4c03bcf76b691df2a4935c4fb696b9dd8390d18
81
py
Python
parking_lot/constants/parking_lot.py
shenbakeshk/parking-lot
b98d4848a790150ea34678734ace64d69925068d
[ "MIT" ]
null
null
null
parking_lot/constants/parking_lot.py
shenbakeshk/parking-lot
b98d4848a790150ea34678734ace64d69925068d
[ "MIT" ]
null
null
null
parking_lot/constants/parking_lot.py
shenbakeshk/parking-lot
b98d4848a790150ea34678734ace64d69925068d
[ "MIT" ]
null
null
null
from enum import Enum class ParkingLotEvent(Enum): PARK = 1 UNPARK = 2
11.571429
28
0.666667
11
81
4.909091
0.818182
0
0
0
0
0
0
0
0
0
0
0.033898
0.271605
81
6
29
13.5
0.881356
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
f4d08f5a7351dc114f5da7230909785a03b60904
86
py
Python
Python/Numpy/np-arrays.py
kamleshmugdiya/Hackerrank
2dfb3689dd6cc7848e8b3d91f8674384652e5a56
[ "MIT" ]
2
2020-05-18T14:59:34.000Z
2020-05-23T15:22:55.000Z
Python/Numpy/np-arrays.py
kamleshmugdiya/Hackerrank
2dfb3689dd6cc7848e8b3d91f8674384652e5a56
[ "MIT" ]
null
null
null
Python/Numpy/np-arrays.py
kamleshmugdiya/Hackerrank
2dfb3689dd6cc7848e8b3d91f8674384652e5a56
[ "MIT" ]
1
2018-10-09T11:43:17.000Z
2018-10-09T11:43:17.000Z
import numpy as np a = input().split(' ') print (np.array(list(reversed(a)), float))
17.2
42
0.651163
14
86
4
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.139535
86
4
43
21.5
0.756757
0
0
0
0
0
0.011765
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
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
f4d0d611a6464befb44dff7e930b4d24248e4c63
202
py
Python
frontend/docs/build_docs.py
FoamyGuy/circuitpython_designio_server
117699f4ea155d2853cf3d8f407c9e89fa2ae4a0
[ "MIT" ]
null
null
null
frontend/docs/build_docs.py
FoamyGuy/circuitpython_designio_server
117699f4ea155d2853cf3d8f407c9e89fa2ae4a0
[ "MIT" ]
null
null
null
frontend/docs/build_docs.py
FoamyGuy/circuitpython_designio_server
117699f4ea155d2853cf3d8f407c9e89fa2ae4a0
[ "MIT" ]
null
null
null
import os import shutil os.system("mkdocs build") try: shutil.rmtree("../../static/docs/") except FileNotFoundError: pass shutil.copytree("./site/", "../../static/docs/", dirs_exist_ok=True)
16.833333
68
0.673267
25
202
5.36
0.76
0.149254
0
0
0
0
0
0
0
0
0
0
0.123762
202
11
69
18.363636
0.757062
0
0
0
0
0
0.272277
0
0
0
0
0
0
1
0
true
0.125
0.25
0
0.25
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
f4f128fcbea35b0628048785f980fe0a123834b7
572
py
Python
player.py
sharifahblessing/Engineering-design-quiz
340cd652e4eea52ef5a6b14ef57a8c71cc860d03
[ "MIT" ]
null
null
null
player.py
sharifahblessing/Engineering-design-quiz
340cd652e4eea52ef5a6b14ef57a8c71cc860d03
[ "MIT" ]
null
null
null
player.py
sharifahblessing/Engineering-design-quiz
340cd652e4eea52ef5a6b14ef57a8c71cc860d03
[ "MIT" ]
null
null
null
class Player: def __init__(self, player_name, examined_step_list): self.user_name = player_name self.player_score = {} self.step_list = examined_step_list self.generate_score_dict() def generate_score_dict(self): for key in self.step_list: self.player_score[key] = 0 def update_student_score(self, engineering_step, score): self.player_score[engineering_step] = score def get_player_name(self): return self.user_name def get_player_score(self): return self.player_score
26
60
0.676573
76
572
4.697368
0.289474
0.140056
0.168067
0.112045
0
0
0
0
0
0
0
0.002326
0.248252
572
21
61
27.238095
0.827907
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.133333
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
f4f413a65134654766595d29b8027879df464466
292
py
Python
rocketchat/calls/auth/get_me.py
09labs/rocket
10b6b09c690f89e8a6f04405703708a8b32a750a
[ "MIT" ]
26
2016-08-04T07:50:06.000Z
2018-09-25T16:31:44.000Z
rocketchat/calls/auth/get_me.py
09labs/rocket
10b6b09c690f89e8a6f04405703708a8b32a750a
[ "MIT" ]
30
2019-01-03T11:40:41.000Z
2022-03-08T10:09:37.000Z
rocketchat/calls/auth/get_me.py
09labs/rocket
10b6b09c690f89e8a6f04405703708a8b32a750a
[ "MIT" ]
18
2016-11-27T00:43:18.000Z
2018-09-23T18:30:51.000Z
import logging from rocketchat.calls.base import RocketChatBase logger = logging.getLogger(__name__) class GetMe(RocketChatBase): endpoint = '/api/v1/me' def build_endpoint(self, **kwargs): return self.endpoint def post_response(self, result): return result
18.25
48
0.712329
34
292
5.941176
0.705882
0
0
0
0
0
0
0
0
0
0
0.004274
0.19863
292
15
49
19.466667
0.858974
0
0
0
0
0
0.034247
0
0
0
0
0
0
1
0.222222
false
0
0.222222
0.222222
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
0
0
0
1
0
0
0
1
1
0
0
3
f4fe45c453ea1fc245e11a952ea7596d37dbed81
173
py
Python
core/reports/urls.py
henrryyanez/test2
7f49391160ad6797afe83f9dae9346d320484b52
[ "MIT" ]
null
null
null
core/reports/urls.py
henrryyanez/test2
7f49391160ad6797afe83f9dae9346d320484b52
[ "MIT" ]
null
null
null
core/reports/urls.py
henrryyanez/test2
7f49391160ad6797afe83f9dae9346d320484b52
[ "MIT" ]
1
2021-02-25T00:57:35.000Z
2021-02-25T00:57:35.000Z
from django.urls import path from core.reports.views import ReportSaleView urlpatterns = [ # reports path('sale/', ReportSaleView.as_view(), name='sale_report'), ]
21.625
64
0.728324
21
173
5.904762
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.150289
173
8
65
21.625
0.843537
0.040462
0
0
0
0
0.09697
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
76105a55bfddba496d8dbb61edee457ca1b8bf86
1,934
py
Python
omnipresence/test/unit/web/test_html.py
kxz/omnipresence
ffb3dbc30d36331a68e8dea3a85db6a4d2928cd7
[ "BSD-3-Clause" ]
null
null
null
omnipresence/test/unit/web/test_html.py
kxz/omnipresence
ffb3dbc30d36331a68e8dea3a85db6a4d2928cd7
[ "BSD-3-Clause" ]
10
2016-04-05T04:36:15.000Z
2018-03-25T00:15:47.000Z
omnipresence/test/unit/web/test_html.py
kxz/omnipresence
ffb3dbc30d36331a68e8dea3a85db6a4d2928cd7
[ "BSD-3-Clause" ]
null
null
null
"""Unit tests for HTML conversions.""" # pylint: disable=missing-docstring,too-few-public-methods from __future__ import unicode_literals from twisted.trial import unittest from ....web.html import parse, textify class HTMLTestCase(unittest.TestCase): def assert_textify(self, a, b, format_output=True): self.assertEqual(textify(a, format_output), b) # str and BeautifulSoup should yield the same results. self.assertEqual(textify(parse(a), format_output), b) def test_simple(self): self.assert_textify('hello', 'hello') def test_bold_italic(self): self.assert_textify('<b>hello</b>', '\x02hello\x02') self.assert_textify('<b>hello</b>', 'hello', False) self.assert_textify('<b>he<i>llo</b>', '\x02he\x16llo\x16\x02') def test_sup_sub(self): self.assert_textify('<em>10<sup>16</sup></em>', '\x1610^16\x16') self.assert_textify('<h1>lorem <sub>ipsum</sub></h1>', 'lorem _ipsum') def test_whitespace(self): self.assert_textify('<b>he<i> l l o </b>', '\x02he\x16 l l o \x16\x02') self.assert_textify('<b>he<i> l l o </b>', 'he l l o', False) self.assert_textify('5.66<b> (22)</b>', '5.66\x02 (22)\x02') self.assert_textify('5.66<b> (22)</b>', '5.66 (22)', False) self.assert_textify('<em>lorem <cite>ipsum dolor</cite></em>', '\x16lorem \x16ipsum dolor\x16\x16') def test_trailing_content(self): self.assert_textify('lorem <i><b>ipsum</b> dolor </i>sit amet', 'lorem \x16\x02ipsum\x02 dolor \x16sit amet') self.assert_textify('lorem <i><b>ipsum</b> dolor </i>sit amet', 'lorem ipsum dolor sit amet', False) def test_textify_tag(self): soup = parse('<a><b>hello</b></a>') self.assertEqual(textify(soup.a, format_output=False), 'hello')
40.291667
78
0.605481
274
1,934
4.149635
0.310219
0.16007
0.194371
0.092348
0.248901
0.236588
0.175902
0.175902
0.175902
0.175902
0
0.049333
0.224405
1,934
47
79
41.148936
0.708667
0.07394
0
0.0625
0
0
0.306614
0.036996
0
0
0
0
0.53125
1
0.21875
false
0
0.09375
0
0.34375
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
1
0
1
0
0
0
0
0
0
0
3
7618b65bfee1cfb246230905b0da19b3924110ab
645
py
Python
release/stubs.min/System/Windows/Forms/__init___parts/InvalidateEventArgs.py
tranconbv/ironpython-stubs
a601759e6c6819beff8e6b639d18a24b7e351851
[ "MIT" ]
null
null
null
release/stubs.min/System/Windows/Forms/__init___parts/InvalidateEventArgs.py
tranconbv/ironpython-stubs
a601759e6c6819beff8e6b639d18a24b7e351851
[ "MIT" ]
null
null
null
release/stubs.min/System/Windows/Forms/__init___parts/InvalidateEventArgs.py
tranconbv/ironpython-stubs
a601759e6c6819beff8e6b639d18a24b7e351851
[ "MIT" ]
null
null
null
class InvalidateEventArgs(EventArgs): """ Provides data for the System.Windows.Forms.Control.Invalidated event. InvalidateEventArgs(invalidRect: Rectangle) """ def Instance(self): """ This function has been arbitrarily put into the stubs""" return InvalidateEventArgs() @staticmethod def __new__(self,invalidRect): """ __new__(cls: type,invalidRect: Rectangle) """ pass InvalidRect=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the System.Drawing.Rectangle that contains the invalidated window area. Get: InvalidRect(self: InvalidateEventArgs) -> Rectangle """
28.043478
83
0.722481
69
645
6.637681
0.637681
0.065502
0
0
0
0
0
0
0
0
0
0
0.168992
645
22
84
29.318182
0.854478
0.328682
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0.142857
0
0
0.714286
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
761d664a1b387a9f82cd1a66f22e592ef95218fa
74
py
Python
python/ex001.py
ITrivinho/MyExercises
23ba9f653fe20dbddb29fa3ec29d3a7a4e6e0a87
[ "MIT" ]
null
null
null
python/ex001.py
ITrivinho/MyExercises
23ba9f653fe20dbddb29fa3ec29d3a7a4e6e0a87
[ "MIT" ]
null
null
null
python/ex001.py
ITrivinho/MyExercises
23ba9f653fe20dbddb29fa3ec29d3a7a4e6e0a87
[ "MIT" ]
null
null
null
nome=input('Qual o seu nome?') print('Seja Bem-Vindo,',nome)
14.8
30
0.567568
11
74
3.818182
0.818182
0
0
0
0
0
0
0
0
0
0
0
0.256757
74
4
31
18.5
0.763636
0
0
0
0
0
0.418919
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
762f94f70190379a40204719e87020217326aadd
330
py
Python
python/base.py
c-okelly/advent_of_code_2017
3985f790daf8c6b296fd29a508c27b3ae5b7fb7c
[ "MIT" ]
null
null
null
python/base.py
c-okelly/advent_of_code_2017
3985f790daf8c6b296fd29a508c27b3ae5b7fb7c
[ "MIT" ]
null
null
null
python/base.py
c-okelly/advent_of_code_2017
3985f790daf8c6b296fd29a508c27b3ae5b7fb7c
[ "MIT" ]
null
null
null
def main(): puzzleInput = open("python/day01.txt", "r").read() # Part 1 assert(part1("") == 0) print(part1(puzzleInput)) # Part 2 assert(part2("") == 0) print(part2(puzzleInput)) def part1(puzzleInput): return 0 def part2(puzzleInput): return 0 if __name__ == "__main__": main()
15
54
0.578788
39
330
4.692308
0.512821
0.065574
0.196721
0
0
0
0
0
0
0
0
0.056911
0.254545
330
22
55
15
0.686992
0.039394
0
0.166667
0
0
0.079365
0
0
0
0
0
0.166667
1
0.25
false
0
0
0.166667
0.416667
0.166667
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
0
0
0
1
0
0
0
3
52113d117b6b14b402eb8a4d7f6f665d25d780a3
654
py
Python
src/data_prep/generate_data.py
Minyus/pipelinex_causallift
6cadf2eb25a2b678cff466cd86223d5cfcfac722
[ "Apache-2.0" ]
4
2020-04-29T05:27:07.000Z
2021-07-28T06:25:05.000Z
src/data_prep/generate_data.py
Minyus/pipelinex_causallift
6cadf2eb25a2b678cff466cd86223d5cfcfac722
[ "Apache-2.0" ]
1
2021-01-14T11:20:52.000Z
2021-01-14T11:20:52.000Z
src/data_prep/generate_data.py
Minyus/pipelinex_causallift
6cadf2eb25a2b678cff466cd86223d5cfcfac722
[ "Apache-2.0" ]
null
null
null
from causallift import generate_data def generate_data_(params): """ # Generate simulated data # "Sleeping dogs" (a.k.a. "do-not-disturb"; people who will "buy" if not treated but will not "buy" if treated) can be simulated by negative values in tau parameter. # Observational data which includes confounding can be simulated by non-zero values in propensity_coef parameter. # A/B Test (RCT) with a 50:50 split can be simulated by all-zeros values in propensity_coef parameter (default). # The first element in each list parameter specifies the intercept. """ df = generate_data(**params) return df
34.421053
78
0.70948
95
654
4.821053
0.589474
0.078603
0.091703
0.104803
0.135371
0
0
0
0
0
0
0.007828
0.218654
654
18
79
36.333333
0.888454
0.743119
0
0
1
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
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
5223d1bda247bbd107d8ac535a9b7dd3b6498d7f
108
py
Python
test/test.py
m-star18/AutoHealthBot
70b4a1ce1a67812078345a76090731243f0caf6c
[ "MIT" ]
null
null
null
test/test.py
m-star18/AutoHealthBot
70b4a1ce1a67812078345a76090731243f0caf6c
[ "MIT" ]
2
2021-04-26T08:49:00.000Z
2021-05-03T04:04:58.000Z
test/test.py
m-star18/AutoHealthBot
70b4a1ce1a67812078345a76090731243f0caf6c
[ "MIT" ]
null
null
null
from src.job import AutoHealthJob def main(): AutoHealthJob() if __name__ == '__main__': main()
10.8
33
0.657407
12
108
5.25
0.75
0
0
0
0
0
0
0
0
0
0
0
0.222222
108
9
34
12
0.75
0
0
0
0
0
0.074074
0
0
0
0
0
0
1
0.2
true
0
0.2
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
1
0
0
0
0
0
0
3
5225075129ae1870badd38ee54ec81af5b9c42f8
574
py
Python
mojeapi/szybkistart/serializers.py
angelm1974/Bydgoszcz_2_spotkanie
377eab44cd7d39aa23c83762c2dc2514d8a1edd8
[ "MIT" ]
null
null
null
mojeapi/szybkistart/serializers.py
angelm1974/Bydgoszcz_2_spotkanie
377eab44cd7d39aa23c83762c2dc2514d8a1edd8
[ "MIT" ]
null
null
null
mojeapi/szybkistart/serializers.py
angelm1974/Bydgoszcz_2_spotkanie
377eab44cd7d39aa23c83762c2dc2514d8a1edd8
[ "MIT" ]
null
null
null
from django.contrib.auth.models import User, Group from .models import Pytanie,Odpowiedz from rest_framework import serializers class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model=User fields=['username','email','groups','url'] class GroupSerializer(serializers.HyperlinkedModelSerializer): class Meta: model=Group fields=['name','url'] class PytanieSerializer(serializers.HyperlinkedModelSerializer): class Meta: model=Pytanie fields=['tekst_pytania','data_pub','obraz']
27.333333
64
0.71777
56
574
7.303571
0.553571
0.271394
0.308068
0.337408
0.374083
0
0
0
0
0
0
0
0.182927
574
21
65
27.333333
0.872068
0
0
0.2
0
0
0.095652
0
0
0
0
0
0
1
0
false
0
0.2
0
0.6
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
523e062cf54f8cceae57b88446cdffe09a594cd6
1,178
py
Python
pokerscores/api/serializers.py
nmaludy/django-pokerscores
1b854cde0bacfa3230be5b5e9bb812ca5c5f066f
[ "Apache-2.0" ]
null
null
null
pokerscores/api/serializers.py
nmaludy/django-pokerscores
1b854cde0bacfa3230be5b5e9bb812ca5c5f066f
[ "Apache-2.0" ]
6
2018-11-14T00:20:26.000Z
2018-11-14T02:17:08.000Z
pokerscores/api/serializers.py
nmaludy/django-pokerscores
1b854cde0bacfa3230be5b5e9bb812ca5c5f066f
[ "Apache-2.0" ]
1
2019-10-23T22:30:14.000Z
2019-10-23T22:30:14.000Z
from django.contrib.auth.models import User, Group from rest_framework import serializers from .models import League, Profile class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User fields = ('id', 'url', 'username', 'email', 'groups') class GroupSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Group fields = ('id', 'url', 'name') class ProfileSingleSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Profile fields = ('id',) class LeagueSingleSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = League fields = ('id', 'name') class LeagueSerializer(serializers.HyperlinkedModelSerializer): profile_set = ProfileSingleSerializer(many=True, read_only=True) class Meta: model = League fields = ('id', 'name', 'profile_set') class ProfileSerializer(serializers.HyperlinkedModelSerializer): leagues = LeagueSingleSerializer(many=True, read_only=True) user = UserSerializer() class Meta: model = Profile fields = ('id', 'user', 'leagues')
25.608696
70
0.691002
107
1,178
7.560748
0.336449
0.274413
0.103832
0.227441
0.4178
0.150803
0.07911
0
0
0
0
0
0.206282
1,178
45
71
26.177778
0.865241
0
0
0.333333
0
0
0.060272
0
0
0
0
0
0
1
0
false
0
0.1
0
0.6
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
0
0
0
1
0
0
3
524758cdd3b394582730711ab61ae286665829da
601
py
Python
src/day_3.py
charlesbourget/AOC2020Py
eaed9c01ea03d865dd10ec2dab1ac68628c46c8c
[ "MIT" ]
null
null
null
src/day_3.py
charlesbourget/AOC2020Py
eaed9c01ea03d865dd10ec2dab1ac68628c46c8c
[ "MIT" ]
null
null
null
src/day_3.py
charlesbourget/AOC2020Py
eaed9c01ea03d865dd10ec2dab1ac68628c46c8c
[ "MIT" ]
null
null
null
from input_reader import * lines = read_input('day3') def traverse_terrain(terrain, hor, vert): tree = 0 x = 0 y = 0 while y < len(terrain): if x >= len(terrain[y]): x = x - len(terrain[y]) if terrain[y][x] == '#': tree += 1 x += hor y += vert return tree result = traverse_terrain(lines, 3, 1) print("Part 1 : %d" % result) result *= traverse_terrain(lines, 1, 1) result *= traverse_terrain(lines, 5, 1) result *= traverse_terrain(lines, 7, 1) result *= traverse_terrain(lines, 1, 2) print("Part 2 : %d" % result)
18.78125
41
0.565724
86
601
3.860465
0.337209
0.271084
0.316265
0.391566
0.328313
0
0
0
0
0
0
0.039535
0.284526
601
31
42
19.387097
0.732558
0
0
0
0
0
0.045075
0
0
0
0
0
0
1
0.047619
false
0
0.047619
0
0.142857
0.095238
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
5264af891beb32863ce4a79f0467423a9a4d26cf
161
py
Python
async_fastapi_jwt_auth/__init__.py
jsenecal/async-fastapi-jwt-auth
dd825f51a2e93192d4128c85b0d4a73df1a9c418
[ "MIT" ]
4
2022-02-04T08:06:32.000Z
2022-03-25T23:22:07.000Z
async_fastapi_jwt_auth/__init__.py
jsenecal/async-fastapi-jwt-auth
dd825f51a2e93192d4128c85b0d4a73df1a9c418
[ "MIT" ]
null
null
null
async_fastapi_jwt_auth/__init__.py
jsenecal/async-fastapi-jwt-auth
dd825f51a2e93192d4128c85b0d4a73df1a9c418
[ "MIT" ]
1
2022-02-16T16:26:27.000Z
2022-02-16T16:26:27.000Z
"""Async fork of FastAPI extension that provides JWT Auth support (secure, easy to use and lightweight)""" __version__ = "0.5.1" from .auth_jwt import AuthJWT
26.833333
106
0.751553
25
161
4.64
0.92
0
0
0
0
0
0
0
0
0
0
0.022059
0.15528
161
5
107
32.2
0.830882
0.621118
0
0
0
0
0.090909
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
5265d80fe58e02810200f41edd06a188972cdd6a
91
py
Python
tools/azure-sdk-tools/devtools_testutils/aio/__init__.py
rsdoherty/azure-sdk-for-python
6bba5326677468e6660845a703686327178bb7b1
[ "MIT" ]
1
2021-09-16T02:33:52.000Z
2021-09-16T02:33:52.000Z
tools/azure-sdk-tools/devtools_testutils/aio/__init__.py
rsdoherty/azure-sdk-for-python
6bba5326677468e6660845a703686327178bb7b1
[ "MIT" ]
1
2019-08-05T19:14:28.000Z
2019-08-05T19:30:05.000Z
tools/azure-sdk-tools/devtools_testutils/aio/__init__.py
rsdoherty/azure-sdk-for-python
6bba5326677468e6660845a703686327178bb7b1
[ "MIT" ]
1
2016-04-19T22:15:47.000Z
2016-04-19T22:15:47.000Z
from .proxy_testcase_async import RecordedByProxyAsync __all__ = ["RecordedByProxyAsync"]
22.75
54
0.846154
8
91
8.875
0.875
0
0
0
0
0
0
0
0
0
0
0
0.087912
91
3
55
30.333333
0.855422
0
0
0
0
0
0.21978
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
5292f4663c1d068a169f53a17109cee81b3a9ba3
365
py
Python
tests/test_decompose_query.py
ezag/trackbelt
965be4cd04a78681fcc8e8b9647f837a011510af
[ "MIT" ]
null
null
null
tests/test_decompose_query.py
ezag/trackbelt
965be4cd04a78681fcc8e8b9647f837a011510af
[ "MIT" ]
3
2021-02-08T20:24:10.000Z
2021-06-01T21:50:53.000Z
tests/test_decompose_query.py
ezag/trackbelt
965be4cd04a78681fcc8e8b9647f837a011510af
[ "MIT" ]
null
null
null
from trackbelt import decompose_query def test_basic_query(): query = decompose_query('tricky - forget') assert query['artist'] == 'tricky' assert query['title'] == 'forget' def test_remix_query(): query = decompose_query('Evvy - Collide (Keljet Remix)') assert query['artist'] == 'Evvy' assert query['title'] == 'Collide (Keljet Remix)'
28.076923
60
0.673973
43
365
5.55814
0.395349
0.1841
0.158996
0.200837
0
0
0
0
0
0
0
0
0.178082
365
12
61
30.416667
0.796667
0
0
0
0
0
0.284932
0
0
0
0
0
0.444444
1
0.222222
false
0
0.111111
0
0.333333
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
1
0
0
0
0
0
0
0
3
5297c1b6c71c6a7a0e3e677222de4308456b009e
1,073
py
Python
slicer/bin/Python/slicer/modulelogic/__init__.py
pabloduque0/WMH_AttGatedUnet_CustomLoss
3503b40c031494ca866dced1421d95f7b2e311fe
[ "MIT" ]
null
null
null
slicer/bin/Python/slicer/modulelogic/__init__.py
pabloduque0/WMH_AttGatedUnet_CustomLoss
3503b40c031494ca866dced1421d95f7b2e311fe
[ "MIT" ]
null
null
null
slicer/bin/Python/slicer/modulelogic/__init__.py
pabloduque0/WMH_AttGatedUnet_CustomLoss
3503b40c031494ca866dced1421d95f7b2e311fe
[ "MIT" ]
null
null
null
""" This module loads the Slicer Module Logic vtk classes into its namespace.""" # Import the CLI logic # HACK Ideally constant from vtkSlicerConfigure should be wrapped, # that way the following try/except could be avoided. try: from qSlicerBaseQTCLIPython import vtkSlicerCLIModuleLogic except: pass from __main__ import _qSlicerCoreApplicationInstance as app from slicer.util import importVTKClassesFromDirectory from os import path # HACK Ideally constant from vtkSlicerConfigure and vtkSlicerVersionConfigure should # be wrapped. slicer_qt_loadable_modules_lib_subdir = path.join("lib", "Slicer-%d.%d", "qt-loadable-modules") % (app.majorVersion, app.minorVersion) directory = path.join(app.slicerHome, slicer_qt_loadable_modules_lib_subdir, "Python") if not app.commandOptions().disableBuiltInLoadableModules: importVTKClassesFromDirectory(directory, __name__, filematch = "vtkSlicer*ModuleLogic.py") # Removing things the user shouldn't have to see. del app, importVTKClassesFromDirectory, directory, slicer_qt_loadable_modules_lib_subdir, path
46.652174
135
0.814539
128
1,073
6.640625
0.554688
0.047059
0.08
0.081176
0.218824
0.122353
0.084706
0
0
0
0
0
0.117428
1,073
22
136
48.772727
0.897571
0.340168
0
0
0
0
0.091954
0.034483
0
0
0
0
0
1
0
false
0.090909
0.545455
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
0
1
1
0
1
0
0
3
bff37bb93e87ba7a49829d9d729c9f9d4effaf14
826
py
Python
edd/settings/__init__.py
TeselaGen/jbei-edd
92792fb30bbd504143b2f75bf08d05b141a7ef6f
[ "BSD-3-Clause-LBNL" ]
null
null
null
edd/settings/__init__.py
TeselaGen/jbei-edd
92792fb30bbd504143b2f75bf08d05b141a7ef6f
[ "BSD-3-Clause-LBNL" ]
null
null
null
edd/settings/__init__.py
TeselaGen/jbei-edd
92792fb30bbd504143b2f75bf08d05b141a7ef6f
[ "BSD-3-Clause-LBNL" ]
null
null
null
# -*- coding: utf-8 -*- """ Settings for the Experiment Data Depot. """ # import baseline settings included in EDD's git repo from .base import * # noqa from .auth import * # noqa from .celery import * # noqa # try to load overridden settings from local.py, if present try: from .local import * # noqa except ImportError as e: print("Did not find local settings; did you rename settings/local.py-example?") # After all settings are imported, do any necessary registration of values try: from jbei.rest.auth import HmacAuth HmacAuth.register_key(ICE_KEY_ID, ICE_SECRET_HMAC_KEY) # noqa except ImportError as e: print("Failed to import REST authenticators; some features may not work.") except Exception as e: print("Failed to register ICE authenticator; connection to ICE may not work: %s" % e)
35.913043
89
0.727603
124
826
4.798387
0.556452
0.067227
0.040336
0.077311
0.137815
0.097479
0
0
0
0
0
0.00149
0.187651
826
22
90
37.545455
0.885246
0.328087
0
0.285714
0
0
0.383333
0.048148
0
0
0
0
0
1
0
true
0
0.571429
0
0.571429
0.214286
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
87222837e6666bb2ae072081dfe6761b86219fd7
103
py
Python
extra/android/src/bugengine/3rdparty/android/libklcompat/mak/build.py
bugengine/BugEngine
1b3831d494ee06b0bd74a8227c939dd774b91226
[ "BSD-3-Clause" ]
4
2015-05-13T16:28:36.000Z
2017-05-24T15:34:14.000Z
extra/android/src/bugengine/3rdparty/android/libklcompat/mak/build.py
bugengine/BugEngine
1b3831d494ee06b0bd74a8227c939dd774b91226
[ "BSD-3-Clause" ]
null
null
null
extra/android/src/bugengine/3rdparty/android/libklcompat/mak/build.py
bugengine/BugEngine
1b3831d494ee06b0bd74a8227c939dd774b91226
[ "BSD-3-Clause" ]
1
2017-03-21T08:28:07.000Z
2017-03-21T08:28:07.000Z
def build(bld): bld.static_library('bugengine.3rdparty.android.libklcompat', path=bld.path.parent)
34.333333
86
0.776699
14
103
5.642857
0.785714
0
0
0
0
0
0
0
0
0
0
0.010526
0.07767
103
2
87
51.5
0.821053
0
0
0
0
0
0.368932
0.368932
0
0
0
0
0
1
0.5
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
87271c2c2e496a05f2a7653b0816ba163b8651d4
129
py
Python
webui/__init__.py
BjornFJohansson/webpcr
4d4917c94e6560389903cb9363c2b819b51cd8c8
[ "BSD-3-Clause" ]
null
null
null
webui/__init__.py
BjornFJohansson/webpcr
4d4917c94e6560389903cb9363c2b819b51cd8c8
[ "BSD-3-Clause" ]
null
null
null
webui/__init__.py
BjornFJohansson/webpcr
4d4917c94e6560389903cb9363c2b819b51cd8c8
[ "BSD-3-Clause" ]
null
null
null
"""WebUI lets you create first class desktop applications in Python with HTML/CSS""" from .webui import * __version__ = "0.2.1"
25.8
84
0.736434
20
129
4.55
0.95
0
0
0
0
0
0
0
0
0
0
0.027523
0.155039
129
4
85
32.25
0.807339
0.604651
0
0
0
0
0.111111
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
873fec28c2dadd25bde8b6f132d841b2d3c52a3e
550
py
Python
test_gitpathlib/test_utils.py
encukou/gitpathlib
887a59920aa445209a5d699db47c6051a669a26d
[ "MIT" ]
4
2017-06-21T14:56:06.000Z
2021-01-23T18:30:09.000Z
test_gitpathlib/test_utils.py
encukou/gitpathlib
887a59920aa445209a5d699db47c6051a669a26d
[ "MIT" ]
3
2017-04-29T21:31:21.000Z
2021-05-05T08:57:02.000Z
test_gitpathlib/test_utils.py
encukou/gitpathlib
887a59920aa445209a5d699db47c6051a669a26d
[ "MIT" ]
3
2017-06-21T14:59:21.000Z
2021-04-01T22:19:52.000Z
import pytest from gitpathlib import util def test_reify(): memo = [] class C: @util.reify def reified(self): memo.append('called') return 123 c = C() assert memo == [] assert c.reified == 123 assert memo == ['called'] assert c.reified == 123 assert memo == ['called'] del c.reified assert memo == ['called'] assert c.reified == 123 assert memo == ['called', 'called'] c.reified = 321 assert c.reified == 321 assert memo == ['called', 'called']
19.642857
39
0.547273
65
550
4.615385
0.307692
0.2
0.266667
0.17
0.383333
0.383333
0.383333
0.326667
0.326667
0.326667
0
0.047872
0.316364
550
27
40
20.37037
0.75
0
0
0.363636
0
0
0.087273
0
0
0
0
0
0.454545
1
0.090909
false
0
0.090909
0
0.272727
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
8764c87eadfad3f1e881a33b70e0e2a42b5730a7
102
py
Python
python/iteration.py
math-solutions/math-fibonacci-sequence
e3b8dc5d54a69ff43d94e927065ffa328c1baab1
[ "Ruby", "MIT" ]
1
2019-07-27T13:10:37.000Z
2019-07-27T13:10:37.000Z
python/iteration.py
math-solutions/math-fibonacci-sequence
e3b8dc5d54a69ff43d94e927065ffa328c1baab1
[ "Ruby", "MIT" ]
null
null
null
python/iteration.py
math-solutions/math-fibonacci-sequence
e3b8dc5d54a69ff43d94e927065ffa328c1baab1
[ "Ruby", "MIT" ]
null
null
null
def fib(n): a, b = 0, 1 for i in range(n): a, b = b, a + b return a #execute print fib(10)
11.333333
20
0.509804
23
102
2.26087
0.652174
0.115385
0.115385
0
0
0
0
0
0
0
0
0.058824
0.333333
102
8
21
12.75
0.705882
0.068627
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0.166667
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
8777fd592c469e6e5d00c7e76708fd21dc585825
680
py
Python
skfem/mesh/__init__.py
carlosal1015/scikit-fem
1e73a417e9b43fe0a36e29807792c41fa289b77d
[ "BSD-3-Clause" ]
null
null
null
skfem/mesh/__init__.py
carlosal1015/scikit-fem
1e73a417e9b43fe0a36e29807792c41fa289b77d
[ "BSD-3-Clause" ]
null
null
null
skfem/mesh/__init__.py
carlosal1015/scikit-fem
1e73a417e9b43fe0a36e29807792c41fa289b77d
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- """This module contains different types of finite element meshes. Meshes are created using various built-in constructors or loaded from external formats using `meshio <https://github.com/nschloe/meshio>`_. See the following implementations: - :class:`~skfem.mesh.MeshTri`, triangular mesh - :class:`~skfem.mesh.MeshQuad`, quadrilateral mesh - :class:`~skfem.mesh.MeshTet`, tetrahedral mesh - :class:`~skfem.mesh.MeshHex`, hexahedral mesh - :class:`~skfem.mesh.MeshLine`, one-dimensional mesh """ from .mesh import Mesh, MeshType from .mesh_line import MeshLine from .mesh2d import Mesh2D, MeshTri, MeshQuad from .mesh3d import Mesh3D, MeshTet, MeshHex
34
78
0.760294
89
680
5.786517
0.58427
0.097087
0.135922
0.139806
0
0
0
0
0
0
0
0.008319
0.116176
680
19
79
35.789474
0.848586
0.754412
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
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
5e5f861d8ffe4a50f01cf7309ea75b881bca061b
63
py
Python
Python/Tests/TestData/DebuggerProject/InfiniteRun.py
techkey/PTVS
8355e67eedd8e915ca49bd38a2f36172696fd903
[ "Apache-2.0" ]
404
2019-05-07T02:21:57.000Z
2022-03-31T17:03:04.000Z
Python/Tests/TestData/DebuggerProject/InfiniteRun.py
techkey/PTVS
8355e67eedd8e915ca49bd38a2f36172696fd903
[ "Apache-2.0" ]
1,672
2019-05-06T21:09:38.000Z
2022-03-31T23:16:04.000Z
Python/Tests/TestData/DebuggerProject/InfiniteRun.py
techkey/PTVS
8355e67eedd8e915ca49bd38a2f36172696fd903
[ "Apache-2.0" ]
186
2019-05-13T03:17:37.000Z
2022-03-31T16:24:05.000Z
x = 1000000 while True: y = x z = x + 1 x = z + 1
9
13
0.396825
12
63
2.083333
0.583333
0.16
0
0
0
0
0
0
0
0
0
0.28125
0.492063
63
6
14
10.5
0.5
0
0
0
0
0
0
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
1
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
5e6026263c3f03188d84b6a23310236265aab989
418
py
Python
kaggle/otto-group-product-classification-challenge/script_20.py
josepablocam/janus-public
4713092b27d02386bdb408213d8edc0dc5859eec
[ "MIT" ]
null
null
null
kaggle/otto-group-product-classification-challenge/script_20.py
josepablocam/janus-public
4713092b27d02386bdb408213d8edc0dc5859eec
[ "MIT" ]
null
null
null
kaggle/otto-group-product-classification-challenge/script_20.py
josepablocam/janus-public
4713092b27d02386bdb408213d8edc0dc5859eec
[ "MIT" ]
null
null
null
import pandas as pd import sklearn from sklearn.preprocessing import LabelEncoder from sklearn.cross_validation import train_test_split from sklearn.ensemble import RandomForestClassifier, BaggingClassifier from sklearn.metrics import log_loss # Checking to make sure this updated correctly print('The scikit-learn version is {}.'.format(sklearn.__version__)) from sklearn.calibration import CalibratedClassifierCV
34.833333
71
0.851675
52
418
6.692308
0.673077
0.158046
0
0
0
0
0
0
0
0
0
0
0.102871
418
11
72
38
0.928
0.105263
0
0
0
0
0.083333
0
0
0
0
0
0
1
0
true
0
0.875
0
0.875
0.125
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
5e6a39479fb5946a93bb88da1c844457e51e1121
5,600
py
Python
tests/integration/factories/syndic/test_syndic.py
cmcmarrow/pytest-salt-factories
12515411ea0fa11d7058a9deb61584a56c5f5108
[ "Apache-2.0" ]
null
null
null
tests/integration/factories/syndic/test_syndic.py
cmcmarrow/pytest-salt-factories
12515411ea0fa11d7058a9deb61584a56c5f5108
[ "Apache-2.0" ]
null
null
null
tests/integration/factories/syndic/test_syndic.py
cmcmarrow/pytest-salt-factories
12515411ea0fa11d7058a9deb61584a56c5f5108
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- import pytest @pytest.fixture(scope="module") def master_of_masters(request, salt_factories): """ This is the master of all masters, top of the chain """ return salt_factories.spawn_master(request, "master-of-masters", order_masters=True) @pytest.fixture(scope="module") def minion_1(request, salt_factories, master_of_masters): """ This minion connects to the master-of-masters directly """ assert master_of_masters.is_alive() return salt_factories.spawn_minion(request, "minion-1", master_id="master-of-masters") @pytest.fixture(scope="module") def configure_syndic(request, salt_factories, master_of_masters, minion_1): """ This syndic will run in tandem with a master and minion which share the same ID, connected to the upstream master-of-masters master. """ return salt_factories.configure_syndic( request, "syndic-1", master_of_masters_id=master_of_masters.config["id"], ) @pytest.fixture(scope="module") def syndic_master(request, salt_factories, master_of_masters, configure_syndic): """ This is a second master, which will connect to master-of-masters through the syndic. We depend on the minion_1 fixture just so we get both the master-of-masters and minion-1 fixtures running when this master starts. """ return salt_factories.spawn_master( request, "syndic-1", master_of_masters_id=master_of_masters.config["id"], ) @pytest.fixture(scope="module") def syndic_minion(request, salt_factories, syndic_master): """ This is a second master, which will connect to master-of-masters through the syndic. We depend on the minion_1 fixture just so we get both the master-of-masters and minion-1 fixtures running when this master starts. """ assert syndic_master.is_alive() return salt_factories.spawn_minion(request, "syndic-1", master_id=syndic_master.config["id"]) @pytest.fixture(scope="module") def minion_2(request, salt_factories, syndic_master): """ This minion will connect to the syndic-1 master """ assert syndic_master.is_alive() return salt_factories.spawn_minion(request, "minion-2", master_id=syndic_master.config["id"]) @pytest.fixture(scope="module") def master_of_masters_salt_cli(salt_factories, master_of_masters, minion_1): """ This is the 'salt' CLI tool, connected to master-of-masters. Should be able to ping minion-1 directly connected to it and minion-2 through the syndic """ assert master_of_masters.is_alive() assert minion_1.is_alive() return salt_factories.get_salt_cli(master_of_masters.config["id"]) @pytest.fixture(scope="module") def syndic_master_salt_cli(salt_factories, syndic_master, syndic_minion, minion_2): """ This is the 'salt' CLI tool, connected to master-of-masters. Should be able to ping minion-1 directly connected to it and minion-2 through the syndic """ assert syndic_master.is_alive() assert syndic_minion.is_alive() assert minion_2.is_alive() return salt_factories.get_salt_cli(syndic_master.config["id"]) @pytest.fixture(scope="module") def syndic( request, salt_factories, master_of_masters, minion_1, syndic_master, syndic_minion, minion_2 ): """ This syndic will run in tandem with master-2, connected to the upstream master-of-masters master. """ assert master_of_masters.is_alive() assert minion_1.is_alive() assert syndic_master.is_alive() assert syndic_minion.is_alive() assert minion_2.is_alive() return salt_factories.spawn_syndic( request, syndic_master.config["id"], master_of_masters_id=master_of_masters.config["id"] ) @pytest.fixture(scope="module") def salt_cli(master_of_masters_salt_cli, syndic_master_salt_cli, syndic): return master_of_masters_salt_cli def test_minion_1(master_of_masters_salt_cli): """ Just test that we can ping minion-1 """ ret = master_of_masters_salt_cli.run("test.ping", minion_tgt="minion-1", _timeout=60) assert ret.exitcode == 0, ret assert ret.json is True, ret def test_minion_syndic_1(syndic_master_salt_cli): """ Just test that we can ping minion-1 """ ret = syndic_master_salt_cli.run("test.ping", minion_tgt="syndic-1", _timeout=60) assert ret.exitcode == 0, ret assert ret.json is True, ret def test_minion_2(syndic_master_salt_cli): """ Just test that we can ping minion-2 """ ret = syndic_master_salt_cli.run("test.ping", minion_tgt="minion-2", _timeout=60) assert ret.exitcode == 0, ret assert ret.json is True, ret @pytest.mark.skip("Syndics are still broken. Moving on for now") def test_syndic(syndic, salt_cli): assert syndic.is_alive() # Are we able to ping the minion connected to the master-of-masters ret = salt_cli.run("test.ping", minion_tgt="minion-1", _timeout=60) assert ret.exitcode == 0, ret assert ret.json is True, ret # Are we able to ping the minions connected to the syndic-master ret = salt_cli.run("test.ping", minion_tgt="syndic-1", _timeout=60) assert ret.exitcode == 0, ret assert ret.json is True, ret ret = salt_cli.run("test.ping", minion_tgt="minion-2", _timeout=60) assert ret.exitcode == 0, ret assert ret.json is True, ret # Are we able to ping all of them? ret = salt_cli.run("test.ping", minion_tgt="*", _timeout=60) assert ret.exitcode == 0, ret assert "minion-1" in ret.json assert ret.json["minion-1"] is True assert "minion-2" in ret.json assert ret.json["minion-2"] is True
34.782609
110
0.72
851
5,600
4.525264
0.106933
0.070631
0.128538
0.062321
0.842638
0.802389
0.726824
0.68216
0.606855
0.553622
0
0.013829
0.173571
5,600
160
111
35
0.81828
0.252143
0
0.463415
0
0
0.084844
0
0
0
0
0
0.378049
1
0.170732
false
0
0.012195
0.012195
0.304878
0
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
5e71ac50bbd2d84ad7a360a68e1c1ba8c1fb7e92
159
py
Python
lino_book/projects/lydia/tests/dumps/18.12.0/cal_subscription.py
lino-framework/lino_book
4eab916832cd8f48ff1b9fc8c2789f0b437da0f8
[ "BSD-2-Clause" ]
3
2016-08-25T05:58:09.000Z
2019-12-05T11:13:45.000Z
lino_book/projects/lydia/tests/dumps/18.12.0/cal_subscription.py
lino-framework/lino_book
4eab916832cd8f48ff1b9fc8c2789f0b437da0f8
[ "BSD-2-Clause" ]
18
2016-11-12T21:38:58.000Z
2019-12-03T17:54:38.000Z
lino_book/projects/lydia/tests/dumps/18.12.0/cal_subscription.py
lino-framework/lino_book
4eab916832cd8f48ff1b9fc8c2789f0b437da0f8
[ "BSD-2-Clause" ]
9
2016-10-15T11:12:33.000Z
2021-09-22T04:37:37.000Z
# -*- coding: UTF-8 -*- logger.info("Loading 0 objects to table cal_subscription...") # fields: id, user, calendar, is_hidden loader.flush_deferred_objects()
26.5
61
0.72327
22
159
5.045455
0.954545
0
0
0
0
0
0
0
0
0
0
0.014286
0.119497
159
5
62
31.8
0.778571
0.371069
0
0
0
0
0.474227
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
5e91ac41cafdd2318d4b204fa814109bed2cb214
235
py
Python
Allswap_djangoREST/backend/allswap/products/api/urls.py
yds05238/AllSwap_Backend
95429fe6c709feef6b9e4b2349921e1cc4dd4c18
[ "MIT" ]
2
2020-02-19T05:06:49.000Z
2020-02-20T17:34:41.000Z
Allswap_djangoREST/backend/allswap/products/api/urls.py
yds05238/AllSwap_Backend
95429fe6c709feef6b9e4b2349921e1cc4dd4c18
[ "MIT" ]
28
2020-06-05T20:52:59.000Z
2022-03-12T00:15:17.000Z
Allswap_djangoREST/backend/allswap/products/api/urls.py
yds05238/AllSwap
95429fe6c709feef6b9e4b2349921e1cc4dd4c18
[ "MIT" ]
null
null
null
from django.urls import path from products.api.views import ProductViewSet from rest_framework.routers import DefaultRouter router = DefaultRouter() router.register(r'', ProductViewSet, basename='products') urlpatterns = router.urls
26.111111
57
0.821277
28
235
6.857143
0.642857
0.197917
0
0
0
0
0
0
0
0
0
0
0.097872
235
9
58
26.111111
0.90566
0
0
0
0
0
0.033898
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
5ea94661e51a087c23ef2fe43cdfed120cd83cf4
104
py
Python
constants.py
AspirantPy/quizbot
361d2685ba9106cf3b4e5d20c4533a39e39249ec
[ "Unlicense" ]
null
null
null
constants.py
AspirantPy/quizbot
361d2685ba9106cf3b4e5d20c4533a39e39249ec
[ "Unlicense" ]
null
null
null
constants.py
AspirantPy/quizbot
361d2685ba9106cf3b4e5d20c4533a39e39249ec
[ "Unlicense" ]
1
2022-01-21T14:25:35.000Z
2022-01-21T14:25:35.000Z
# Str! API_TOKEN = 'YOUR TOKEN GOES HERE' # Int! ADMIN_ID = 'USER_ID OF PERSON(s) DESIGNATED AS ADMINS'
20.8
54
0.711538
18
104
3.944444
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.173077
104
5
54
20.8
0.825581
0.086538
0
0
0
0
0.655914
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
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
5eb1493f4f5b2737e31f4d927d371240987a46fa
770
py
Python
Python/Code/Thermal_Models/models/__init__.py
mhasoba/TPCFitting
29b5e32c2e830ab0a909034aa439fc4424617401
[ "MIT" ]
null
null
null
Python/Code/Thermal_Models/models/__init__.py
mhasoba/TPCFitting
29b5e32c2e830ab0a909034aa439fc4424617401
[ "MIT" ]
null
null
null
Python/Code/Thermal_Models/models/__init__.py
mhasoba/TPCFitting
29b5e32c2e830ab0a909034aa439fc4424617401
[ "MIT" ]
1
2019-03-14T11:46:08.000Z
2019-03-14T11:46:08.000Z
#!/usr/bin/env python3 """ This directory contains classes representing each growth model. """ from .linear_models import boltzmann_arrhenius, \ lm from .schoolfield_models import schoolfield_two_factor, \ schoolfield_two_factor_tpk, \ schoolfield_full, \ schoolfield_full_tpk from .weighted_models import boltzmann_arrhenius_two_weights_linear, \ boltzmann_arrhenius_two_weights_non_linear, \ boltzmann_arrhenius_two_weights_normalise_only, \ boltzmann_arrhenius_one_weight_linear, \ boltzmann_arrhenius_one_weight_non_linear
40.526316
78
0.592208
68
770
6.205882
0.470588
0.255924
0.149289
0.199052
0.161137
0
0
0
0
0
0
0.002049
0.366234
770
19
79
40.526316
0.860656
0.027273
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.272727
null
null
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
1
0
0
0
0
0
0
0
0
3
5ec20165dc81f6f3b0903a35a11cb6fe8b4b8c70
290
py
Python
tests/filter_request_test.py
MONICA-Project/GOST-tools
08f0b5bc47e5ab683c6dffe90e8cfdff4305eab4
[ "BSD-2-Clause" ]
null
null
null
tests/filter_request_test.py
MONICA-Project/GOST-tools
08f0b5bc47e5ab683c6dffe90e8cfdff4305eab4
[ "BSD-2-Clause" ]
null
null
null
tests/filter_request_test.py
MONICA-Project/GOST-tools
08f0b5bc47e5ab683c6dffe90e8cfdff4305eab4
[ "BSD-2-Clause" ]
null
null
null
import requests import checking_functions #res = requests.get("http://localhost:8080/v1.0/Datastreams?$filter=name eq 'test-6'") #obj = res.json() #print(obj["value"]) res = checking_functions.get_item_by_name("http://localhost:8080/v1.0/Datastreams?$filter=name eq 'test-6'") print(res)
29
108
0.744828
45
290
4.688889
0.511111
0.161137
0.161137
0.180095
0.454976
0.454976
0.454976
0.454976
0.454976
0.454976
0
0.052045
0.072414
290
10
109
29
0.732342
0.413793
0
0
0
0.25
0.375
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0.25
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
1
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
0d6c80d9faeb015b83d1a4e111fb4a9d4d95169d
243
py
Python
test/tests/test_open_usb_camera.py
computerboy0555/GBVision
79fc9ba09865bfd9c7a39abaa3980c46ce090b07
[ "Apache-2.0" ]
16
2019-04-15T18:52:58.000Z
2022-02-13T23:00:46.000Z
test/tests/test_open_usb_camera.py
computerboy0555/GBVision
79fc9ba09865bfd9c7a39abaa3980c46ce090b07
[ "Apache-2.0" ]
2
2019-04-15T19:00:05.000Z
2019-04-19T15:47:21.000Z
test/tests/test_open_usb_camera.py
computerboy0555/GBVision
79fc9ba09865bfd9c7a39abaa3980c46ce090b07
[ "Apache-2.0" ]
3
2019-05-03T13:48:25.000Z
2019-09-22T14:03:49.000Z
import unittest import gbvision as gbv class TestOpenUSBCamera(unittest.TestCase): def test_connect_to_camera(self): camera = gbv.USBCamera(0) self.assertTrue(camera.is_opened()) self.assertTrue(camera.read()[0])
24.3
43
0.711934
30
243
5.633333
0.666667
0.16568
0.236686
0
0
0
0
0
0
0
0
0.010101
0.185185
243
9
44
27
0.843434
0
0
0
0
0
0
0
0
0
0
0
0.285714
1
0.142857
false
0
0.285714
0
0.571429
0
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
0
0
1
0
0
3
0d77569a3580b4c55dfed97aa76bba36804b7503
851
py
Python
movie_douban/sql_conn.py
saberbin/small_spider
d3c14681a5bb2b068fe5afb23d637d21b8fa76aa
[ "Apache-2.0" ]
null
null
null
movie_douban/sql_conn.py
saberbin/small_spider
d3c14681a5bb2b068fe5afb23d637d21b8fa76aa
[ "Apache-2.0" ]
null
null
null
movie_douban/sql_conn.py
saberbin/small_spider
d3c14681a5bb2b068fe5afb23d637d21b8fa76aa
[ "Apache-2.0" ]
null
null
null
import pymysql class sql_conn(object): def __init__(self, host='localhost', port=3306, user='root', password='mysql', database, charset='utf8'): self.conn = pymysql.connect(host=host, port=port, user=user, password=password, database=database, charset='utf8') self.cursor = self.conn.cursor() def exit_sql(self): try: self.cursor.close() except Exception as e: pass try: self.conn.close() except Exception as e: pass print('SQL connect had closed.') def close_corsor(self): try: self.cursor.close() except Exception as e: pass def create_cursor(self): try: self.conn.cursor() except Exception as e: pass
24.314286
123
0.53584
94
851
4.765957
0.37234
0.071429
0.151786
0.160714
0.305804
0.256696
0.196429
0.196429
0.196429
0.196429
0
0.01105
0.361927
851
34
124
25.029412
0.813996
0
0
0.56
0
0
0.060123
0
0
0
0
0
0
0
null
null
0.24
0.04
null
null
0.04
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
1
0
0
1
0
0
0
0
0
3
0d7ff7b1bec7f69eca478377542c1ae6dd1af0d0
7,089
py
Python
example.py
kaplanbr/Adversarial-Predictor
7649cffb2fac9aa81ccf18751e96f952563a0e0f
[ "MIT" ]
null
null
null
example.py
kaplanbr/Adversarial-Predictor
7649cffb2fac9aa81ccf18751e96f952563a0e0f
[ "MIT" ]
null
null
null
example.py
kaplanbr/Adversarial-Predictor
7649cffb2fac9aa81ccf18751e96f952563a0e0f
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from AdversarialPredictor import AdversarialPredictionClassifier #dependencies %matplotlib inline import matplotlib.pyplot as plt import numpy as np from sklearn import datasets from sklearn.linear_model import LogisticRegression from sklearn.gaussian_process import GaussianProcessClassifier from sklearn.gaussian_process.kernels import RBF #download dataset iris_dataset = datasets.load_iris() #limit features to sepal and petal lenght X = iris_dataset["data"][:,[0,2]] y = iris_dataset["target"] #limited sample with virginica and versicolor species Xt = X[y<>0] yt = y[y<>0] Xs = X[y==0] #setosa sample #2 class model fit m_logr = LogisticRegression() m_logr.fit(Xt,yt) #3 class plot plt.title('3-class plot') plt.scatter(X[:,0][y==0],X[:,1][y==0], label="setosa",color="green",edgecolors=(0, 0, 0)) plt.scatter(X[:,0][y==1],X[:,1][y==1], label="versicolor",color="red",edgecolors=(0, 0, 0)) plt.scatter(X[:,0][y==2],X[:,1][y==2], label="virginica",color="blue",edgecolors=(0, 0, 0)) plt.xlabel("Sepal Length") plt.ylabel("Petal Length") plt.xlim(4,8) plt.ylim(0.5,7.5) plt.legend() plt.savefig("3-class.pdf") #2 class plot plt.title('2-class plot') plt.scatter(X[:,0][y==1],X[:,1][y==1], label="versicolor",color="red",edgecolors=(0, 0, 0)) plt.scatter(X[:,0][y==2],X[:,1][y==2], label="virginica",color="blue",edgecolors=(0, 0, 0)) plt.xlabel("Sepal Length") plt.ylabel("Petal Length") plt.xlim(4,8) plt.ylim(0.5,7.5) plt.legend() plt.savefig("2-class.pdf") #2 class logistic regression decision boundary xx, yy = np.mgrid[4:8:.01, 0.5:7.5:.01] grid = np.c_[xx.ravel(), yy.ravel()] probs = m_logr.predict_proba(grid)[:, 1].reshape(xx.shape) plt.title('2-class Logistic Regression Decision Boundary') plt.scatter(X[:,0][y==1],X[:,1][y==1], label="versicolor",color="red",edgecolors=(0, 0, 0)) plt.scatter(X[:,0][y==2],X[:,1][y==2], label="virginica",color="blue",edgecolors=(0, 0, 0)) plt.xlabel("Sepal Length") plt.ylabel("Petal Length") plt.xlim(4,8) plt.ylim(0.5,7.5) plt.legend() plt.contour(xx, yy, probs, levels=[.5], colors="black") plt.savefig("2-class-logr.pdf") #3 class logistic regression probabilistic decision boundary xx, yy = np.mgrid[4:8:0.01, 0.5:7.5:0.01] Z = m_logr.predict_proba(np.vstack((xx.ravel(), yy.ravel())).T)[:, 1] Z = Z.reshape(xx.shape) image = plt.imshow(Z.T, interpolation='nearest', extent=(4, 8, 0.5, 7.5), aspect='auto', origin='lower', cmap=plt.cm.RdBu) plt.colorbar(image) plt.title('2-class Logistic Regression\n Probabilistic Decision Boundary') plt.scatter(X[:,0][y==1],X[:,1][y==1], label="versicolor",color="red",edgecolors=(0, 0, 0)) plt.scatter(X[:,0][y==2],X[:,1][y==2], label="virginica",color="blue",edgecolors=(0, 0, 0)) plt.scatter(X[:,0][y==0],X[:,1][y==0], label="setosa",color="green",edgecolors=(0, 0, 0)) plt.xlabel("Sepal Length") plt.ylabel("Petal Length") plt.xlim(4,8) plt.ylim(0.5,7.5) plt.legend() plt.savefig("2-class-logr-prob.pdf") #gaussian process decision map xx, yy = np.mgrid[4:8:0.05, 0.5:7.5:0.05] kernel = 1.0 * RBF([1.0, 1.0])#rbf_anisotropic m_gpc = GaussianProcessClassifier(kernel=kernel).fit(Xt, yt) Z = m_gpc.predict_proba(np.vstack((xx.ravel(), yy.ravel())).T)[:, 1] Z = Z.reshape(xx.shape) image = plt.imshow(Z.T, interpolation='nearest', extent=(4, 8, 0.5, 7.5), aspect='auto', origin='lower', cmap=plt.cm.RdBu) plt.scatter(X[:,0][y==1],X[:,1][y==1], label="versicolor",color="red",edgecolors=(0, 0, 0)) plt.scatter(X[:,0][y==2],X[:,1][y==2], label="virginica",color="blue",edgecolors=(0, 0, 0)) plt.scatter(X[:,0][y==0],X[:,1][y==0], label="setosa",color="green",edgecolors=(0, 0, 0)) plt.colorbar(image) plt.title("2-class RBF Gaussian Process Classifier\n Decision Map") plt.xlabel("Sepal Length") plt.ylabel("Petal Length") plt.xlim(4,8) plt.ylim(0.5,7.5) plt.legend() plt.savefig("2-class-gpc-prob.pdf") #adversarial predictor classifier m_apc = AdversarialPredictionClassifier() m_apc.fit(Xt,yt) xx, yy = np.mgrid[4:8:0.05, 0.5:7.5:0.05] Z = m_apc.predict_conf(np.vstack((xx.ravel(), yy.ravel())).T) Z_a = [] for i in Z: if i[0][0]>i[0][1]: Z_a.append(0.5-i[1]/2.) else: Z_a.append(0.5+i[1]/2.) Z_a = np.array(Z_a) Z_a = Z_a.reshape(xx.shape) image = plt.imshow(Z_a.T, interpolation='nearest', extent=(4, 8,0.5, 7.5), aspect='auto', origin='lower', cmap=plt.cm.RdBu) plt.scatter(X[:,0][y==1],X[:,1][y==1], label="versicolor",color="red",edgecolors=(0, 0, 0)) plt.scatter(X[:,0][y==2],X[:,1][y==2], label="virginica",color="blue",edgecolors=(0, 0, 0)) plt.scatter(X[:,0][y==0],X[:,1][y==0], label="setosa",color="green",edgecolors=(0, 0, 0)) plt.colorbar(image) plt.title("2-class Adversarial Predictor Classifier\n Confidence Map") plt.xlabel("Sepal Length") plt.ylabel("Petal Length") plt.xlim(4,8) plt.ylim(0.5,7.5) plt.legend() plt.savefig("2-class-apc-prob4.pdf") #visual description of apc pred = m_apc.predict_conf(Xs[1].reshape(1,2)) X_cand = np.array(m_apc.X_cand) plt.title('Predicting new sample x') plt.scatter(X[:,0][y==1],X[:,1][y==1], label="versicolor",color="red",edgecolors=(0, 0, 0)) plt.scatter(X[:,0][y==2],X[:,1][y==2], label="virginica",color="blue",edgecolors=(0, 0, 0)) plt.scatter(Xs[1][0],Xs[1][1], label="new sample to be predicted",color="grey",edgecolors=(0, 0, 0),marker="x") plt.xlabel("Sepal Length") plt.ylabel("Petal Length") plt.xlim(4,8) plt.ylim(0.5,7.5) plt.legend() plt.savefig("new-sample.pdf") plt.title('Base classifier prediction: versicolor') plt.scatter(X[:,0][y==1],X[:,1][y==1], label="versicolor",color="red",edgecolors=(0, 0, 0)) plt.scatter(Xs[1][0],Xs[1][1], label="new sample to be predicted",color="grey",edgecolors=(0, 0, 0),marker="x") plt.xlabel("Sepal Length") plt.ylabel("Petal Length") plt.xlim(4,8) plt.ylim(0.5,7.5) plt.legend() plt.savefig("versicolor-predicted.pdf") plt.title('Adversarial sample is generated') plt.scatter(X[:,0][y==1],X[:,1][y==1], label="versicolor",color="red",edgecolors=(0, 0, 0)) plt.scatter(X_cand[:,0],X_cand[:,1], label="adversarial sample",color="grey",edgecolors=(0, 0, 0),marker="x") plt.xlabel("Sepal Length") plt.ylabel("Petal Length") plt.xlim(4,8) plt.ylim(0.5,7.5) plt.legend() plt.savefig("adversarial-sample.pdf") xx, yy = np.mgrid[4:8:.01, 0.5:7.5:.01] grid = np.c_[xx.ravel(), yy.ravel()] probs = m_apc.m_adv.predict_proba(grid)[:, 1].reshape(xx.shape) plt.title('High accuracy means low confidence') plt.scatter(X[:,0][y==1],X[:,1][y==1], label="versicolor",color="red",edgecolors=(0, 0, 0)) plt.scatter(X_cand[:,0],X_cand[:,1], label="adversarial sample",color="grey",edgecolors=(0, 0, 0),marker="x") plt.xlabel("Sepal Length") plt.ylabel("Petal Length") plt.xlim(4,8) plt.ylim(0.5,7.5) plt.contour(xx, yy, probs, levels=[.5], colors="black") plt.legend() plt.savefig("confidence-classifier.pdf")
36.73057
112
0.643391
1,251
7,089
3.611511
0.1255
0.022576
0.066401
0.071934
0.709163
0.702966
0.688358
0.666667
0.650952
0.633687
0
0.057152
0.121315
7,089
192
113
36.921875
0.668165
0.056425
0
0.627451
0
0
0.190278
0.017438
0
0
0
0
0
0
null
null
0
0.045752
null
null
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
0d847fd190a809d461b7897cd1efeb594a9afa5f
13,556
py
Python
bitfield/tests/tests.py
mattcaldwell/django-bitfield
c7fbbfa79a61e68a7bce246a62b65ca5a4edf27f
[ "Apache-2.0" ]
1
2015-11-04T16:24:57.000Z
2015-11-04T16:24:57.000Z
bitfield/tests/tests.py
mattcaldwell/django-bitfield
c7fbbfa79a61e68a7bce246a62b65ca5a4edf27f
[ "Apache-2.0" ]
null
null
null
bitfield/tests/tests.py
mattcaldwell/django-bitfield
c7fbbfa79a61e68a7bce246a62b65ca5a4edf27f
[ "Apache-2.0" ]
null
null
null
from django.db import connection from django.db.models import F from django.test import TestCase from bitfield import BitHandler, Bit from bitfield.tests import BitFieldTestModel, CompositeBitFieldTestModel class BitHandlerTest(TestCase): def test_defaults(self): bithandler = BitHandler(0, ('FLAG_0', 'FLAG_1', 'FLAG_2', 'FLAG_3')) # Default value of 0. self.assertEquals(int(bithandler), 0) # Test bit numbers. self.assertEquals(int(bithandler.FLAG_0.number), 0) self.assertEquals(int(bithandler.FLAG_1.number), 1) self.assertEquals(int(bithandler.FLAG_2.number), 2) self.assertEquals(int(bithandler.FLAG_3.number), 3) # Negative test non-existant key. self.assertRaises(AttributeError, lambda: bithandler.FLAG_4) # Test bool(). self.assertEquals(bool(bithandler.FLAG_0), False) self.assertEquals(bool(bithandler.FLAG_1), False) self.assertEquals(bool(bithandler.FLAG_2), False) self.assertEquals(bool(bithandler.FLAG_3), False) def test_nonzero_default(self): bithandler = BitHandler(1, ('FLAG_0', 'FLAG_1', 'FLAG_2', 'FLAG_3')) self.assertEquals(bool(bithandler.FLAG_0), True) self.assertEquals(bool(bithandler.FLAG_1), False) self.assertEquals(bool(bithandler.FLAG_2), False) self.assertEquals(bool(bithandler.FLAG_3), False) bithandler = BitHandler(2, ('FLAG_0', 'FLAG_1', 'FLAG_2', 'FLAG_3')) self.assertEquals(bool(bithandler.FLAG_0), False) self.assertEquals(bool(bithandler.FLAG_1), True) self.assertEquals(bool(bithandler.FLAG_2), False) self.assertEquals(bool(bithandler.FLAG_3), False) bithandler = BitHandler(3, ('FLAG_0', 'FLAG_1', 'FLAG_2', 'FLAG_3')) self.assertEquals(bool(bithandler.FLAG_0), True) self.assertEquals(bool(bithandler.FLAG_1), True) self.assertEquals(bool(bithandler.FLAG_2), False) self.assertEquals(bool(bithandler.FLAG_3), False) bithandler = BitHandler(4, ('FLAG_0', 'FLAG_1', 'FLAG_2', 'FLAG_3')) self.assertEquals(bool(bithandler.FLAG_0), False) self.assertEquals(bool(bithandler.FLAG_1), False) self.assertEquals(bool(bithandler.FLAG_2), True) self.assertEquals(bool(bithandler.FLAG_3), False) def test_mutation(self): bithandler = BitHandler(0, ('FLAG_0', 'FLAG_1', 'FLAG_2', 'FLAG_3')) self.assertEquals(bool(bithandler.FLAG_0), False) self.assertEquals(bool(bithandler.FLAG_1), False) self.assertEquals(bool(bithandler.FLAG_2), False) self.assertEquals(bool(bithandler.FLAG_3), False) bithandler = BitHandler(bithandler | 1, bithandler._keys) self.assertEquals(bool(bithandler.FLAG_0), True) self.assertEquals(bool(bithandler.FLAG_1), False) self.assertEquals(bool(bithandler.FLAG_2), False) self.assertEquals(bool(bithandler.FLAG_3), False) bithandler ^= 3 self.assertEquals(int(bithandler), 2) self.assertEquals(bool(bithandler & 1), False) bithandler.FLAG_0 = False self.assertEquals(bithandler.FLAG_0, False) bithandler.FLAG_1 = True self.assertEquals(bithandler.FLAG_0, False) self.assertEquals(bithandler.FLAG_1, True) bithandler.FLAG_2 = False self.assertEquals(bithandler.FLAG_0, False) self.assertEquals(bithandler.FLAG_1, True) self.assertEquals(bithandler.FLAG_2, False) class BitTest(TestCase): def test_int(self): bit = Bit(0) self.assertEquals(int(bit), 1) self.assertEquals(bool(bit), True) self.assertFalse(not bit) def test_comparison(self): self.assertEquals(Bit(0), Bit(0)) self.assertNotEquals(Bit(1), Bit(0)) self.assertNotEquals(Bit(0, 0), Bit(0, 1)) self.assertEquals(Bit(0, 1), Bit(0, 1)) self.assertEquals(Bit(0), 1) def test_and(self): self.assertEquals(1 & Bit(2), 0) self.assertEquals(1 & Bit(0), 1) self.assertEquals(1 & ~Bit(0), 0) self.assertEquals(Bit(0) & Bit(2), 0) self.assertEquals(Bit(0) & Bit(0), 1) self.assertEquals(Bit(0) & ~Bit(0), 0) def test_or(self): self.assertEquals(1 | Bit(2), 5) self.assertEquals(1 | Bit(5), 33) self.assertEquals(1 | ~Bit(2), -5) self.assertEquals(Bit(0) | Bit(2), 5) self.assertEquals(Bit(0) | Bit(5), 33) self.assertEquals(Bit(0) | ~Bit(2), -5) def test_xor(self): self.assertEquals(1 ^ Bit(2), 5) self.assertEquals(1 ^ Bit(0), 0) self.assertEquals(1 ^ Bit(1), 3) self.assertEquals(1 ^ Bit(5), 33) self.assertEquals(1 ^ ~Bit(2), -6) self.assertEquals(Bit(0) ^ Bit(2), 5) self.assertEquals(Bit(0) ^ Bit(0), 0) self.assertEquals(Bit(0) ^ Bit(1), 3) self.assertEquals(Bit(0) ^ Bit(5), 33) self.assertEquals(Bit(0) ^ ~Bit(2), -6) class BitFieldTest(TestCase): def test_basic(self): # Create instance and make sure flags are working properly. instance = BitFieldTestModel.objects.create(flags=1) self.assertTrue(instance.flags.FLAG_0) self.assertFalse(instance.flags.FLAG_1) self.assertFalse(instance.flags.FLAG_2) self.assertFalse(instance.flags.FLAG_3) def test_regression_1425(self): # Creating new instances shouldn't allow negative values. instance = BitFieldTestModel.objects.create(flags=-1) self.assertEqual(instance.flags._value, 15) self.assertTrue(instance.flags.FLAG_0) self.assertTrue(instance.flags.FLAG_1) self.assertTrue(instance.flags.FLAG_2) self.assertTrue(instance.flags.FLAG_3) cursor = connection.cursor() flags_field = BitFieldTestModel._meta.get_field_by_name('flags')[0] flags_db_column = flags_field.db_column or flags_field.name cursor.execute("INSERT INTO %s (%s) VALUES (-1)" % (BitFieldTestModel._meta.db_table, flags_db_column)); # There should only be the one row we inserted through the cursor. instance = BitFieldTestModel.objects.get(flags=-1) self.assertTrue(instance.flags.FLAG_0) self.assertTrue(instance.flags.FLAG_1) self.assertTrue(instance.flags.FLAG_2) self.assertTrue(instance.flags.FLAG_3) instance.save() self.assertEqual(BitFieldTestModel.objects.filter(flags=15).count(), 2) self.assertEqual(BitFieldTestModel.objects.filter(flags__lt=0).count(), 0) def test_select(self): BitFieldTestModel.objects.create(flags=3) self.assertTrue(BitFieldTestModel.objects.filter(flags=BitFieldTestModel.flags.FLAG_1).exists()) self.assertTrue(BitFieldTestModel.objects.filter(flags=BitFieldTestModel.flags.FLAG_0).exists()) self.assertFalse(BitFieldTestModel.objects.exclude(flags=BitFieldTestModel.flags.FLAG_0).exists()) self.assertFalse(BitFieldTestModel.objects.exclude(flags=BitFieldTestModel.flags.FLAG_1).exists()) def test_update(self): instance = BitFieldTestModel.objects.create(flags=0) self.assertFalse(instance.flags.FLAG_0) BitFieldTestModel.objects.filter(pk=instance.pk).update(flags=F('flags') | BitFieldTestModel.flags.FLAG_1) instance = BitFieldTestModel.objects.get(pk=instance.pk) self.assertTrue(instance.flags.FLAG_1) BitFieldTestModel.objects.filter(pk=instance.pk).update(flags=F('flags') | ((~BitFieldTestModel.flags.FLAG_0 | BitFieldTestModel.flags.FLAG_3))) instance = BitFieldTestModel.objects.get(pk=instance.pk) self.assertFalse(instance.flags.FLAG_0) self.assertTrue(instance.flags.FLAG_1) self.assertTrue(instance.flags.FLAG_3) self.assertFalse(BitFieldTestModel.objects.filter(flags=BitFieldTestModel.flags.FLAG_0).exists()) BitFieldTestModel.objects.filter(pk=instance.pk).update(flags=F('flags') & ~BitFieldTestModel.flags.FLAG_3) instance = BitFieldTestModel.objects.get(pk=instance.pk) self.assertFalse(instance.flags.FLAG_0) self.assertTrue(instance.flags.FLAG_1) self.assertFalse(instance.flags.FLAG_3) def test_update_with_handler(self): instance = BitFieldTestModel.objects.create(flags=0) self.assertFalse(instance.flags.FLAG_0) instance.flags.FLAG_1 = True BitFieldTestModel.objects.filter(pk=instance.pk).update(flags=F('flags') | instance.flags) instance = BitFieldTestModel.objects.get(pk=instance.pk) self.assertTrue(instance.flags.FLAG_1) # BitFieldTestModel.objects.filter(pk=instance.pk).update(flags=F('flags') | ((~BitFieldTestModel.flags.FLAG_0 | BitFieldTestModel.flags.FLAG_3))) # instance = BitFieldTestModel.objects.get(pk=instance.pk) # self.assertFalse(instance.flags.FLAG_0) # self.assertTrue(instance.flags.FLAG_1) # self.assertTrue(instance.flags.FLAG_3) # self.assertFalse(BitFieldTestModel.objects.filter(flags=BitFieldTestModel.flags.FLAG_0).exists()) # BitFieldTestModel.objects.filter(pk=instance.pk).update(flags=F('flags') & ~BitFieldTestModel.flags.FLAG_3) # instance = BitFieldTestModel.objects.get(pk=instance.pk) # self.assertFalse(instance.flags.FLAG_0) # self.assertTrue(instance.flags.FLAG_1) # self.assertFalse(instance.flags.FLAG_3) # def test_save(self): # instance = BitFieldTestModel.objects.create(flags=BitFieldTestModel.flags.FLAG_0) # self.assertTrue(instance.flags.FLAG_0) # self.assertTrue(BitFieldTestModel.objects.filter(flags=1).exists()) # self.assertTrue(BitFieldTestModel.objects.filter(flags=BitFieldTestModel.flags.FLAG_0).exists()) # instance.delete() # # instance = BitFieldTestModel.objects.create(flags=(BitFieldTestModel.flags.FLAG_0 | BitFieldTestModel.flags.FLAG_1)) # self.assertTrue(instance.flags.FLAG_0) # self.assertTrue(instance.flags.FLAG_1) # self.assertTrue(BitFieldTestModel.objects.filter(flags=3).exists()) # self.assertTrue(BitFieldTestModel.objects.filter(flags=BitFieldTestModel.flags.FLAG_0).exists()) # self.assertTrue(BitFieldTestModel.objects.filter(flags=BitFieldTestModel.flags.FLAG_1).exists()) # self.assertTrue(BitFieldTestModel.objects.filter(flags=(BitFieldTestModel.flags.FLAG_0 | BitFieldTestModel.flags.FLAG_1)).exists()) # instance.delete() # # instance = BitFieldTestModel.objects.create(flags=BitFieldTestModel.flags.FLAG_3) # self.assertTrue(instance.flags.FLAG_3) # self.assertTrue(BitFieldTestModel.objects.filter(flags=8).exists()) # self.assertTrue(BitFieldTestModel.objects.filter(flags=BitFieldTestModel.flags.FLAG_3).exists()) def test_negate(self): BitFieldTestModel.objects.create(flags=BitFieldTestModel.flags.FLAG_0 | BitFieldTestModel.flags.FLAG_1) BitFieldTestModel.objects.create(flags=BitFieldTestModel.flags.FLAG_1) self.assertEqual(BitFieldTestModel.objects.filter(flags=~BitFieldTestModel.flags.FLAG_0).count(), 1) self.assertEqual(BitFieldTestModel.objects.filter(flags=~BitFieldTestModel.flags.FLAG_1).count(), 0) self.assertEqual(BitFieldTestModel.objects.filter(flags=~BitFieldTestModel.flags.FLAG_2).count(), 2) def test_default_value(self): instance = BitFieldTestModel.objects.create() self.assertTrue(instance.flags.FLAG_0) self.assertTrue(instance.flags.FLAG_1) self.assertFalse(instance.flags.FLAG_2) self.assertFalse(instance.flags.FLAG_3) class BitFieldSerializationTest(TestCase): def test_adding_flags(self): import pickle inst = BitFieldTestModel.objects.create(flags=0) data = pickle.dumps(inst) # ensure the flag is actually working self.assertFalse(inst.flags.FLAG_0) forum = pickle.loads(data) forum.flags.FLAG_0 self.assertFalse(inst.flags.FLAG_0) class CompositeBitFieldTest(TestCase): def test_get_flag(self): inst = CompositeBitFieldTestModel() self.assertEqual(inst.flags.FLAG_0, inst.flags_1.FLAG_0) self.assertEqual(inst.flags.FLAG_4, inst.flags_2.FLAG_4) self.assertRaises(AttributeError, lambda: inst.flags.flag_NA) def test_set_flag(self): inst = CompositeBitFieldTestModel() flag_0_original = bool(inst.flags.FLAG_0) self.assertEqual(bool(inst.flags_1.FLAG_0), flag_0_original) flag_4_original = bool(inst.flags.FLAG_4) self.assertEqual(bool(inst.flags_2.FLAG_4), flag_4_original) # flip flags' bits inst.flags.FLAG_0 = not flag_0_original inst.flags.FLAG_4 = not flag_4_original # check to make sure the bit flips took effect self.assertNotEqual(bool(inst.flags.FLAG_0), flag_0_original) self.assertNotEqual(bool(inst.flags_1.FLAG_0), flag_0_original) self.assertNotEqual(bool(inst.flags.FLAG_4), flag_4_original) self.assertNotEqual(bool(inst.flags_2.FLAG_4), flag_4_original) def set_flag(): inst.flags.flag_NA = False self.assertRaises(AttributeError, set_flag) def test_hasattr(self): inst = CompositeBitFieldTestModel() self.assertEqual(hasattr(inst.flags, 'flag_0'), hasattr(inst.flags_1, 'flag_0')) self.assertEqual(hasattr(inst.flags, 'flag_4'), hasattr(inst.flags_2, 'flag_4'))
46.424658
154
0.691354
1,658
13,556
5.513269
0.084439
0.079751
0.068811
0.095176
0.800022
0.734712
0.68428
0.650804
0.615578
0.574992
0
0.027064
0.18501
13,556
291
155
46.584192
0.800326
0.173134
0
0.344828
0
0
0.020061
0
0
0
0
0
0.605911
1
0.098522
false
0
0.029557
0
0.152709
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
1
0
0
0
0
0
0
0
0
0
3