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
5aae793749131e5c12149cc30b15c354c2140860
265
py
Python
kube/tools/repr.py
nearmap/kubefs
e2f6c019f04e436d031874e40c59ba0ee61d8c58
[ "MIT" ]
3
2021-05-31T06:45:37.000Z
2021-10-05T22:36:37.000Z
kube/tools/repr.py
nearmap/kubefs
e2f6c019f04e436d031874e40c59ba0ee61d8c58
[ "MIT" ]
8
2021-09-06T00:43:13.000Z
2021-10-01T00:22:53.000Z
kube/tools/repr.py
nearmap/kubefs
e2f6c019f04e436d031874e40c59ba0ee61d8c58
[ "MIT" ]
null
null
null
from typing import Optional def disp_secret_string(input: Optional[str]) -> str: return "SET" if input is not None else "UNSET" def disp_secret_blob(input: Optional[str]) -> Optional[str]: return "[%s bytes]" % len(input) if input is not None else None
26.5
67
0.709434
42
265
4.380952
0.52381
0.179348
0.141304
0.130435
0.217391
0.217391
0
0
0
0
0
0
0.177358
265
9
68
29.444444
0.844037
0
0
0
0
0
0.067925
0
0
0
0
0
0
1
0.4
false
0
0.2
0.4
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
5ac2489e789ff4fae4cc856732e30990d4a2204f
7,790
py
Python
test/programytest/config/brain/test_dynamic.py
cdoebler1/AIML2
ee692ec5ea3794cd1bc4cc8ec2a6b5e5c20a0d6a
[ "MIT" ]
345
2016-11-23T22:37:04.000Z
2022-03-30T20:44:44.000Z
test/programytest/config/brain/test_dynamic.py
MikeyBeez/program-y
00d7a0c7d50062f18f0ab6f4a041068e119ef7f0
[ "MIT" ]
275
2016-12-07T10:30:28.000Z
2022-02-08T21:28:33.000Z
test/programytest/config/brain/test_dynamic.py
VProgramMist/modified-program-y
f32efcafafd773683b3fe30054d5485fe9002b7d
[ "MIT" ]
159
2016-11-28T18:59:30.000Z
2022-03-20T18:02:44.000Z
import unittest from programy.clients.events.console.config import ConsoleConfiguration from programy.config.brain.dynamic import BrainDynamicsConfiguration from programy.config.file.yaml_file import YamlConfigurationFile class BrainDynamicsConfigurationTests(unittest.TestCase): def test_with_data(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text(""" brain: dynamic: variables: gettime: programy.dynamic.variables.datetime.GetTime sets: number: programy.dynamic.sets.numeric.IsNumeric roman: programy.dynamic.sets.roman.IsRomanNumeral maps: romantodec: programy.dynamic.maps.roman.MapRomanToDecimal dectoroman: programy.dynamic.maps.roman.MapDecimalToRoman """, ConsoleConfiguration(), ".") brain_config = yaml.get_section("brain") dynamic_config = BrainDynamicsConfiguration() dynamic_config.load_config_section(yaml, brain_config, ".") self.assertEquals({'GETTIME': 'programy.dynamic.variables.datetime.GetTime'}, dynamic_config.dynamic_vars) self.assertEquals({'NUMBER': 'programy.dynamic.sets.numeric.IsNumeric', 'ROMAN': 'programy.dynamic.sets.roman.IsRomanNumeral'}, dynamic_config.dynamic_sets) self.assertEquals({'ROMANTODEC': 'programy.dynamic.maps.roman.MapRomanToDecimal', 'DECTOROMAN': 'programy.dynamic.maps.roman.MapDecimalToRoman'}, dynamic_config.dynamic_maps) def test_with_missing_vars_sets_maps(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text(""" brain: dynamic: """, ConsoleConfiguration(), ".") brain_config = yaml.get_section("brain") dynamic_config = BrainDynamicsConfiguration() dynamic_config.load_config_section(yaml, brain_config, ".") self.assertEquals({}, dynamic_config.dynamic_vars) self.assertEquals({}, dynamic_config.dynamic_sets) self.assertEquals({}, dynamic_config.dynamic_maps) def test_with_missing_vars_sets_maps2(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text(""" brain: dynamic: something: else """, ConsoleConfiguration(), ".") brain_config = yaml.get_section("brain") dynamic_config = BrainDynamicsConfiguration() dynamic_config.load_config_section(yaml, brain_config, ".") self.assertEquals({}, dynamic_config.dynamic_vars) self.assertEquals({}, dynamic_config.dynamic_sets) self.assertEquals({}, dynamic_config.dynamic_maps) def test_without_data(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text(""" brain: dynamic: """, ConsoleConfiguration(), ".") brain_config = yaml.get_section("brain") dynamic_config = BrainDynamicsConfiguration() dynamic_config.load_config_section(yaml, brain_config, ".") self.assertEquals({}, dynamic_config.dynamic_vars) self.assertEquals({}, dynamic_config.dynamic_sets) self.assertEquals({}, dynamic_config.dynamic_maps) def test_with_no_data(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text(""" brain: """, ConsoleConfiguration(), ".") brain_config = yaml.get_section("brain") dynamic_config = BrainDynamicsConfiguration() dynamic_config.load_config_section(yaml, brain_config, ".") self.assertEquals({}, dynamic_config.dynamic_vars) self.assertEquals({}, dynamic_config.dynamic_sets) self.assertEquals({}, dynamic_config.dynamic_maps) def test_to_yaml_defaults(self): yaml = {} dynamic_config = BrainDynamicsConfiguration() dynamic_config.to_yaml(yaml, defaults=True) self.assertEquals({'GETTIME': 'programy.dynamic.variables.datetime.GetTime'}, yaml['variables']) self.assertEquals({'NUMBER': 'programy.dynamic.sets.numeric.IsNumeric', 'ROMAN': 'programy.dynamic.sets.roman.IsRomanNumeral', 'STOPWORD': 'programy.dynamic.sets.stopword.IsStopWord', 'SYNSETS': 'programy.dynamic.sets.synsets.IsSynset'}, yaml['sets']) self.assertEquals({'ROMANTODDEC': 'programy.dynamic.maps.roman.MapRomanToDecimal', 'DECTOROMAN': 'programy.dynamic.maps.roman.MapDecimalToRoman', 'LEMMATIZE': 'programy.dynamic.maps.lemmatize.LemmatizeMap', 'STEMMER': 'programy.dynamic.maps.stemmer.StemmerMap'}, yaml['maps']) def test_to_yaml_no_defaults(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text(""" brain: dynamic: variables: gettime: programy.dynamic.variables.datetime.GetTime sets: number: programy.dynamic.sets.numeric.IsNumeric roman: programy.dynamic.sets.roman.IsRomanNumeral maps: romantodec: programy.dynamic.maps.roman.MapRomanToDecimal dectoroman: programy.dynamic.maps.roman.MapDecimalToRoman """, ConsoleConfiguration(), ".") brain_config = yaml.get_section("brain") dynamic_config = BrainDynamicsConfiguration() dynamic_config.load_config_section(yaml, brain_config, ".") data = {} dynamic_config.to_yaml(data, defaults=False) self.assertEquals({'GETTIME': 'programy.dynamic.variables.datetime.GetTime'}, data['variables']) self.assertEquals({'NUMBER': 'programy.dynamic.sets.numeric.IsNumeric', 'ROMAN': 'programy.dynamic.sets.roman.IsRomanNumeral'}, data['sets']) self.assertEquals({'ROMANTODEC': 'programy.dynamic.maps.roman.MapRomanToDecimal', 'DECTOROMAN': 'programy.dynamic.maps.roman.MapDecimalToRoman'}, data['maps']) def test_to_yaml_no_defaults_no_data(self): yaml = {} dynamic_config = BrainDynamicsConfiguration() dynamic_config.to_yaml(yaml, defaults=False) self.assertEquals({}, yaml['variables']) self.assertEquals({}, yaml['sets']) self.assertEquals({}, yaml['maps']) def test_defaults(self): dynamic_config = BrainDynamicsConfiguration() data = {} dynamic_config.to_yaml(data, True) BrainDynamicsConfigurationTests.assert_defaults(self, data) @staticmethod def assert_defaults(test, data): test.assertTrue('sets' in data) test.assertEqual(data['sets']['NUMBER'], 'programy.dynamic.sets.numeric.IsNumeric') test.assertEqual(data['sets']['ROMAN'], 'programy.dynamic.sets.roman.IsRomanNumeral') test.assertEqual(data['sets']['STOPWORD'], 'programy.dynamic.sets.stopword.IsStopWord') test.assertEqual(data['sets']['SYNSETS'], 'programy.dynamic.sets.synsets.IsSynset') test.assertTrue('maps' in data) test.assertEqual(data['maps']['ROMANTODDEC'], 'programy.dynamic.maps.roman.MapRomanToDecimal') test.assertEqual(data['maps']['DECTOROMAN'], 'programy.dynamic.maps.roman.MapDecimalToRoman') test.assertEqual(data['maps']['LEMMATIZE'], 'programy.dynamic.maps.lemmatize.LemmatizeMap') test.assertEqual(data['maps']['STEMMER'], 'programy.dynamic.maps.stemmer.StemmerMap') test.assertTrue('variables' in data) test.assertEqual(data['variables']['GETTIME'], 'programy.dynamic.variables.datetime.GetTime')
43.764045
182
0.65982
724
7,790
6.921271
0.093923
0.11375
0.060667
0.057474
0.840152
0.823987
0.702055
0.671323
0.637398
0.637398
0
0.000164
0.21887
7,790
177
183
44.011299
0.823336
0
0
0.628571
0
0
0.347882
0.206675
0
0
0
0
0.314286
1
0.071429
false
0
0.028571
0
0.107143
0
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
5ad49b87e51964d8f082cd0185a9557623d86a5c
2,252
py
Python
website/tantalus/forms.py
KiOui/TOSTI
72e65889c193727dcf3e3716b10c78a9774e1136
[ "MIT" ]
1
2020-05-10T21:10:43.000Z
2020-05-10T21:10:43.000Z
website/tantalus/forms.py
KiOui/TOSTI
72e65889c193727dcf3e3716b10c78a9774e1136
[ "MIT" ]
158
2020-05-04T12:37:41.000Z
2022-03-31T20:15:07.000Z
website/tantalus/forms.py
KiOui/TOSTI
72e65889c193727dcf3e3716b10c78a9774e1136
[ "MIT" ]
null
null
null
import logging from django import forms from tantalus.services import get_tantalus_client, TantalusException class TantalusProductAdminForm(forms.ModelForm): """Tantalus Product Admin Form.""" tantalus_id = forms.ChoiceField(required=True) def __init__(self, *args, **kwargs): """Initialize Tantalus Product Admin Form by getting product data from Tantalus.""" super(TantalusProductAdminForm, self).__init__(*args, **kwargs) try: tantalus_client = get_tantalus_client() choices = [(x["id"], x["name"]) for x in tantalus_client.get_products()] self.fields["tantalus_id"].choices = choices except TantalusException as e: logging.error( "The following Exception occurred while trying to access Tantalus on the administration " "dashboard: {}".format(e) ) self.fields["tantalus_id"] = forms.IntegerField( min_value=1, help_text="Could not retrieve data from Tantalus, you are still able to enter the Tantalus id " "yourself. Check the logs for more information.", ) class TantalusOrderVenueAdminForm(forms.ModelForm): """Tantalus Order Venue Admin Form.""" endpoint_id = forms.ChoiceField(required=True) def __init__(self, *args, **kwargs): """Initialize Tantalus Product Admin Form by getting product data from Tantalus.""" super(TantalusOrderVenueAdminForm, self).__init__(*args, **kwargs) try: tantalus_client = get_tantalus_client() choices = [(x["id"], x["name"]) for x in tantalus_client.get_endpoints()] self.fields["endpoint_id"].choices = choices except TantalusException as e: logging.error( "The following Exception occurred while trying to access Tantalus on the administration " "dashboard: {}".format(e) ) self.fields["endpoint_id"] = forms.IntegerField( min_value=1, help_text="Could not retrieve data from Tantalus, you are still able to enter the endpoint id " "yourself. Check the logs for more information.", )
41.703704
111
0.632327
243
2,252
5.703704
0.320988
0.070707
0.046176
0.051948
0.721501
0.721501
0.721501
0.721501
0.663781
0.663781
0
0.001225
0.275311
2,252
53
112
42.490566
0.848039
0.096359
0
0.461538
0
0
0.255214
0
0
0
0
0
0
1
0.051282
false
0
0.076923
0
0.230769
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
5aec84ebc1bf400dd4730adf8b547bbded54e3c5
419
py
Python
Day18-The_Hirst_Painting/data.py
the-whiz84/Python_Projects
35d6c3cef9b4d90e6cb7cbf1dd88de3a7fe5dd0c
[ "MIT" ]
1
2022-01-05T10:54:06.000Z
2022-01-05T10:54:06.000Z
Day18-The_Hirst_Painting/data.py
the-whiz84/Python_Projects
35d6c3cef9b4d90e6cb7cbf1dd88de3a7fe5dd0c
[ "MIT" ]
null
null
null
Day18-The_Hirst_Painting/data.py
the-whiz84/Python_Projects
35d6c3cef9b4d90e6cb7cbf1dd88de3a7fe5dd0c
[ "MIT" ]
null
null
null
rgb_colors = [(202, 164, 110), (149, 75, 50), (222, 201, 136), (53, 93, 123), (170, 154, 41), (138, 31, 20), (134, 163, 184), (197, 92, 73), (47, 121, 86), (73, 43, 35), (145, 178, 149), (14, 98, 70), (232, 176, 165), (160, 142, 158), (54, 45, 50), (101, 75, 77), (183, 205, 171), (36, 60, 74), (19, 86, 89), (82, 148, 129), (147, 17, 19), (27, 68, 102), (12, 70, 64), (107, 127, 153), (176, 192, 208), (168, 99, 102)]
209.5
418
0.494033
80
419
2.575
0.8875
0
0
0
0
0
0
0
0
0
0
0.581121
0.190931
419
1
419
419
0.026549
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
1
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
8518f74d3611fe9bfed42079e2cabc20eddd4ee3
119
py
Python
apps/auth/models.py
dlooto/driver-vision
676256891971df1d5eee990be54fb31f485d0ae3
[ "MIT" ]
2
2020-06-16T01:52:47.000Z
2021-03-24T08:34:23.000Z
apps/auth/models.py
dlooto/driver-vision
676256891971df1d5eee990be54fb31f485d0ae3
[ "MIT" ]
2
2020-02-12T03:09:54.000Z
2020-06-05T22:47:17.000Z
apps/auth/models.py
dlooto/driver-vision
676256891971df1d5eee990be54fb31f485d0ae3
[ "MIT" ]
null
null
null
#coding=utf-8 # # Copyright (C) 2014 NianNian TECH Co., Ltd. All rights reserved. # Created on Oct 19, 2015, by Junn #
23.8
66
0.689076
20
119
4.1
1
0
0
0
0
0
0
0
0
0
0
0.113402
0.184874
119
5
67
23.8
0.731959
0.92437
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
516eea6fc771ec9d647a7a08cc20018eb05108b6
150
py
Python
app/views/__init__.py
mrakzero/FlaskCMS
03ad35610befca1f45d5705f07cfb4794f9b2d3b
[ "MulanPSL-1.0" ]
1
2022-03-31T03:57:45.000Z
2022-03-31T03:57:45.000Z
app/views/__init__.py
mrakzero/FlaskCMS
03ad35610befca1f45d5705f07cfb4794f9b2d3b
[ "MulanPSL-1.0" ]
null
null
null
app/views/__init__.py
mrakzero/FlaskCMS
03ad35610befca1f45d5705f07cfb4794f9b2d3b
[ "MulanPSL-1.0" ]
null
null
null
#! /usr/bin/env python # -*- coding: utf-8 -*- # File: __init__.py.py # Version: v1.0.0 # Description: # Author: Zhang Zhijun # Date: 2021/8/9 21:38
18.75
23
0.626667
25
150
3.6
0.88
0
0
0
0
0
0
0
0
0
0
0.112
0.166667
150
7
24
21.428571
0.608
0.906667
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
51c3632680190f269603d8fefaf2d0c902f13307
270
py
Python
algorithms/etc.py
kupns-aka-kupa/alg_p_strc
e10f7c2e6295dcda65acdf1934919fe1d4a353da
[ "MIT" ]
null
null
null
algorithms/etc.py
kupns-aka-kupa/alg_p_strc
e10f7c2e6295dcda65acdf1934919fe1d4a353da
[ "MIT" ]
null
null
null
algorithms/etc.py
kupns-aka-kupa/alg_p_strc
e10f7c2e6295dcda65acdf1934919fe1d4a353da
[ "MIT" ]
null
null
null
def xor_reverse(iterable): lenght = len(iterable) i = 0 while i < lenght // 2: iterable[i] ^= iterable[lenght - i - 1] iterable[lenght - i - 1] ^= iterable[i] iterable[i] ^= iterable[lenght - i - 1] i += 1 return iterable
27
47
0.537037
35
270
4.114286
0.342857
0.388889
0.354167
0.333333
0.513889
0.347222
0
0
0
0
0
0.032967
0.325926
270
9
48
30
0.758242
0
0
0.222222
0
0
0
0
0
0
0
0
0
1
0.111111
false
0
0
0
0.222222
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
51d0b67edc10125f1d1a43872b5f40879c483ac4
152
py
Python
syft/frameworks/torch/tensors/__init__.py
amitkarn3/PythnSyft
8eaa637e1ca54c963281e847556cb14b4a76b46b
[ "Apache-1.1" ]
1
2021-07-01T18:22:11.000Z
2021-07-01T18:22:11.000Z
syft/frameworks/torch/tensors/__init__.py
mukira/PySyft
94595008e8326d3111406ae143099b311fc3f2e6
[ "Apache-2.0" ]
1
2019-06-05T14:19:07.000Z
2019-06-05T14:19:07.000Z
syft/frameworks/torch/tensors/__init__.py
mukira/PySyft
94595008e8326d3111406ae143099b311fc3f2e6
[ "Apache-2.0" ]
1
2021-02-12T12:11:44.000Z
2021-02-12T12:11:44.000Z
# Do not change the import sequence it can cause deadlock from . import interpreters from . import decorators __all__ = ["decorators", "interpreters"]
25.333333
57
0.769737
19
152
5.947368
0.736842
0.176991
0
0
0
0
0
0
0
0
0
0
0.157895
152
5
58
30.4
0.882813
0.361842
0
0
0
0
0.231579
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
51d45cf09054c416e96c4863ddfd2d5f622336cb
114
py
Python
titan/components/customizes/test.py
DeSireFire/titans
9194950694084a7cbc6434dfec0ecb2e755f0cdf
[ "Apache-2.0" ]
17
2020-03-14T01:08:07.000Z
2020-12-26T08:20:14.000Z
titan/components/customizes/test.py
DeSireFire/titans
9194950694084a7cbc6434dfec0ecb2e755f0cdf
[ "Apache-2.0" ]
4
2020-12-05T08:50:55.000Z
2022-02-27T06:48:21.000Z
titan/components/customizes/test.py
DeSireFire/titans
9194950694084a7cbc6434dfec0ecb2e755f0cdf
[ "Apache-2.0" ]
1
2020-05-24T06:57:03.000Z
2020-05-24T06:57:03.000Z
from titan.components import Base class Test(Base): @staticmethod def default(): print("test")
12.666667
33
0.640351
13
114
5.615385
0.846154
0
0
0
0
0
0
0
0
0
0
0
0.254386
114
8
34
14.25
0.858824
0
0
0
0
0
0.035088
0
0
0
0
0
0
1
0.2
true
0
0.2
0
0.6
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
4
a405c2663ddd2f594225a8baf7e7262566708aa1
135
py
Python
debug/vis.py
arpit196/multihead-siamese-nets
328bd29abc6011fd39f6eae30313babd550aa3d5
[ "MIT" ]
2
2019-05-24T08:52:02.000Z
2022-01-10T21:38:08.000Z
debug/vis.py
arpit196/multihead-siamese-nets
328bd29abc6011fd39f6eae30313babd550aa3d5
[ "MIT" ]
10
2020-01-28T22:06:21.000Z
2022-02-10T00:16:53.000Z
debug/vis.py
warisqr007/ConvSANN
0cede14601ce1a62bd58abf92a04ad3d7cc3be99
[ "MIT" ]
null
null
null
import matplotlib.pyplot as plt import seaborn as sns def attention_visualization(att): sns.heatmap(att[0, :, :]) plt.show()
16.875
33
0.703704
19
135
4.947368
0.736842
0
0
0
0
0
0
0
0
0
0
0.009009
0.177778
135
7
34
19.285714
0.837838
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.4
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
cf9918d07c426c0c04713411e8bdb6f09a77713e
9,607
py
Python
tests/test_transfertree.py
atiqm/adapt
af9833cb7e698bdcb722941622d67c06f04822f7
[ "BSD-2-Clause" ]
null
null
null
tests/test_transfertree.py
atiqm/adapt
af9833cb7e698bdcb722941622d67c06f04822f7
[ "BSD-2-Clause" ]
null
null
null
tests/test_transfertree.py
atiqm/adapt
af9833cb7e698bdcb722941622d67c06f04822f7
[ "BSD-2-Clause" ]
null
null
null
import copy import numpy as np from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier from adapt.parameter_based import TransferTreeClassifier, TransferForestClassifier methods = [ 'relab', 'ser', 'strut', 'ser_nr', 'ser_no_ext', 'ser_nr_lambda', 'strut_nd', 'strut_lambda', 'strut_np' 'strut_lambda_np', 'strut_lambda_np2' # 'strut_hi' ] def test_transfer_tree(): np.random.seed(0) # Generate training source data ns = 200 ns_perclass = ns // 2 mean_1 = (1, 1) var_1 = np.diag([1, 1]) mean_2 = (3, 3) var_2 = np.diag([2, 2]) Xs = np.r_[np.random.multivariate_normal(mean_1, var_1, size=ns_perclass), np.random.multivariate_normal(mean_2, var_2, size=ns_perclass)] ys = np.zeros(ns) ys[ns_perclass:] = 1 # Generate training target data nt = 50 # imbalanced nt_0 = nt // 10 mean_1 = (6, 3) var_1 = np.diag([4, 1]) mean_2 = (5, 5) var_2 = np.diag([1, 3]) Xt = np.r_[np.random.multivariate_normal(mean_1, var_1, size=nt_0), np.random.multivariate_normal(mean_2, var_2, size=nt - nt_0)] yt = np.zeros(nt) yt[nt_0:] = 1 # Generate testing target data nt_test = 1000 nt_test_perclass = nt_test // 2 Xt_test = np.r_[np.random.multivariate_normal(mean_1, var_1, size=nt_test_perclass), np.random.multivariate_normal(mean_2, var_2, size=nt_test_perclass)] yt_test = np.zeros(nt_test) yt_test[nt_test_perclass:] = 1 # Source classifier RF_SIZE = 10 clf_source_dt = DecisionTreeClassifier(max_depth=None) clf_source_rf = RandomForestClassifier(n_estimators=RF_SIZE) clf_source_dt.fit(Xs, ys) clf_source_rf.fit(Xs, ys) #score_src_src = clf_source.score(Xs, ys) #score_src_trgt = clf_source.score(Xt_test, yt_test) #print('Training score Source model: {:.3f}'.format(score_src_src)) #print('Testing score Source model: {:.3f}'.format(score_src_trgt)) clfs = [] scores = [] # Transfer with SER #clf_transfer = copy.deepcopy(clf_source) #transferred_dt = TransferTreeClassifier(estimator=clf_transfer,Xt=Xt,yt=yt) for method in methods: Nkmin = sum(yt == 0 ) root_source_values = clf_source_dt.tree_.value[0].reshape(-1) props_s = root_source_values props_s = props_s / sum(props_s) props_t = np.zeros(props_s.size) for k in range(props_s.size): props_t[k] = np.sum(yt == k) / yt.size coeffs = np.divide(props_t, props_s) clf_transfer_dt = copy.deepcopy(clf_source_dt) clf_transfer_rf = copy.deepcopy(clf_source_rf) if method == 'relab': #decision tree transferred_dt = TransferTreeClassifier(estimator=clf_transfer_dt,algo="") transferred_dt.fit(Xt,yt) #random forest transferred_rf = TransferForestClassifier(estimator=clf_transfer_rf,algo="",bootstrap=True) transferred_rf.fit(Xt,yt) if method == 'ser': #decision tree transferred_dt = TransferTreeClassifier(estimator=clf_transfer_dt.set_params(max_depth=10),algo="ser") transferred_dt.fit(Xt,yt) #random forest transferred_rf = TransferForestClassifier(estimator=clf_transfer_rf,algo="ser") transferred_rf.fit(Xt,yt) if method == 'ser_nr': #decision tree transferred_dt = TransferTreeClassifier(estimator=clf_transfer_dt,algo="ser") transferred_dt._ser(Xt, yt,node=0,original_ser=False,no_red_on_cl=True,cl_no_red=[0]) #random forest transferred_rf = TransferForestClassifier(estimator=clf_transfer_rf,algo="ser") transferred_rf._ser_rf(Xt, yt,original_ser=False,no_red_on_cl=True,cl_no_red=[0]) if method == 'ser_no_ext': #decision tree transferred_dt = TransferTreeClassifier(estimator=clf_transfer_dt,algo="ser") transferred_dt._ser(Xt, yt,node=0,original_ser=False,no_ext_on_cl=True,cl_no_ext=[0],ext_cond=True) #random forest transferred_rf = TransferForestClassifier(estimator=clf_transfer_rf,algo="ser") transferred_rf._ser_rf(Xt, yt,original_ser=False,no_ext_on_cl=True,cl_no_ext=[0],ext_cond=True) if method == 'ser_nr_lambda': #decision tree transferred_dt = TransferTreeClassifier(estimator=clf_transfer_dt,algo="ser") transferred_dt._ser(Xt, yt,node=0,original_ser=False,no_red_on_cl=True,cl_no_red=[0], leaf_loss_quantify=True,leaf_loss_threshold=0.5, root_source_values=root_source_values,Nkmin=Nkmin,coeffs=coeffs) #random forest transferred_rf = TransferForestClassifier(estimator=clf_transfer_rf,algo="ser") transferred_rf._ser_rf(Xt, yt,original_ser=False,no_red_on_cl=True,cl_no_red=[0], leaf_loss_quantify=True,leaf_loss_threshold=0.5, root_source_values=root_source_values,Nkmin=Nkmin,coeffs=coeffs) if method == 'strut': #decision tree transferred_dt = TransferTreeClassifier(estimator=clf_transfer_dt,algo="strut") transferred_dt.fit(Xt,yt) #random forest transferred_rf = TransferForestClassifier(estimator=clf_transfer_rf,algo="strut") transferred_rf.fit(Xt,yt) if method == 'strut_nd': #decision tree transferred_dt = TransferTreeClassifier(estimator=clf_transfer_dt,algo="strut") transferred_dt._strut(Xt, yt,node=0,use_divergence=False) #random forest transferred_rf = TransferForestClassifier(estimator=clf_transfer_rf,algo="strut") transferred_rf._strut_rf(Xt, yt,use_divergence=False) if method == 'strut_lambda': #decision tree transferred_dt = TransferTreeClassifier(estimator=clf_transfer_dt,algo="strut") transferred_dt._strut(Xt, yt,node=0,adapt_prop=True,root_source_values=root_source_values, Nkmin=Nkmin,coeffs=coeffs) #random forest transferred_rf = TransferForestClassifier(estimator=clf_transfer_rf,algo="strut") transferred_rf._strut_rf(Xt, yt,adapt_prop=True,root_source_values=root_source_values, Nkmin=Nkmin,coeffs=coeffs) if method == 'strut_np': #decision tree transferred_dt = TransferTreeClassifier(estimator=clf_transfer_dt,algo="strut") transferred_dt._strut(Xt, yt,node=0,adapt_prop=False,no_prune_on_cl=True,cl_no_prune=[0], leaf_loss_quantify=False,leaf_loss_threshold=0.5,no_prune_with_translation=False, root_source_values=root_source_values,Nkmin=Nkmin,coeffs=coeffs) #random forest transferred_rf = TransferForestClassifier(estimator=clf_transfer_rf,algo="strut") transferred_rf._strut_rf(Xt, yt,adapt_prop=False,no_prune_on_cl=True,cl_no_prune=[0], leaf_loss_quantify=False,leaf_loss_threshold=0.5,no_prune_with_translation=False, root_source_values=root_source_values,Nkmin=Nkmin,coeffs=coeffs) if method == 'strut_lambda_np': #decision tree transferred_dt = TransferTreeClassifier(estimator=clf_transfer_dt,algo="strut") transferred_dt._strut(Xt, yt,node=0,adapt_prop=False,no_prune_on_cl=True,cl_no_prune=[0], leaf_loss_quantify=False,leaf_loss_threshold=0.5,no_prune_with_translation=False, root_source_values=root_source_values,Nkmin=Nkmin,coeffs=coeffs) #random forest transferred_rf = TransferForestClassifier(estimator=clf_transfer_rf,algo="strut") transferred_rf._strut_rf(Xt, yt,adapt_prop=True,no_prune_on_cl=True,cl_no_prune=[0], leaf_loss_quantify=True,leaf_loss_threshold=0.5,no_prune_with_translation=False, root_source_values=root_source_values,Nkmin=Nkmin,coeffs=coeffs) if method == 'strut_lambda_np2': #decision tree transferred_dt = TransferTreeClassifier(estimator=clf_transfer_dt,algo="strut") transferred_dt._strut(Xt, yt,node=0,adapt_prop=False,no_prune_on_cl=True,cl_no_prune=[0], leaf_loss_quantify=False,leaf_loss_threshold=0.5,no_prune_with_translation=False, root_source_values=root_source_values,Nkmin=Nkmin,coeffs=coeffs) #random forest transferred_rf = TransferForestClassifier(estimator=clf_transfer_rf,algo="strut") transferred_rf._strut_rf(Xt, yt,adapt_prop=True,no_prune_on_cl=True,cl_no_prune=[0], leaf_loss_quantify=True,leaf_loss_threshold=0.5,no_prune_with_translation=True, root_source_values=root_source_values,Nkmin=Nkmin,coeffs=coeffs) score = transferred_dt.estimator.score(Xt_test, yt_test) #score = clf_transfer.score(Xt_test, yt_test) print('Testing score transferred model ({}) : {:.3f}'.format(method, score)) clfs.append(transferred_dt.estimator) #clfs.append(clf_transfer) scores.append(score)
50.298429
114
0.652545
1,234
9,607
4.73825
0.104538
0.052677
0.078673
0.090303
0.734907
0.731999
0.715068
0.701556
0.693176
0.681375
0
0.014561
0.249401
9,607
191
115
50.298429
0.796283
0.087332
0
0.326241
0
0
0.037924
0
0
0
0
0
0
1
0.007092
false
0
0.035461
0
0.042553
0.007092
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
cfa5fb84a168cd5549d5b4a34b8799e8cc2a103c
60
py
Python
tests/__init__.py
vooon/hass-radiacode
c1bdc0211a5a8eac368a192377fbdf77cad95fe8
[ "MIT" ]
4
2021-12-31T23:50:40.000Z
2022-03-22T10:27:29.000Z
tests/__init__.py
vooon/hass-radiacode
c1bdc0211a5a8eac368a192377fbdf77cad95fe8
[ "MIT" ]
5
2021-12-17T02:20:31.000Z
2022-02-28T02:30:08.000Z
tests/__init__.py
vooon/hass-radiacode
c1bdc0211a5a8eac368a192377fbdf77cad95fe8
[ "MIT" ]
2
2022-01-15T02:33:46.000Z
2022-03-17T05:31:31.000Z
"""Tests for RadiaCode 101 sensor component integration."""
30
59
0.766667
7
60
6.571429
1
0
0
0
0
0
0
0
0
0
0
0.056604
0.116667
60
1
60
60
0.811321
0.883333
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
cfa9479031a99ce5275e837310711a9d4444c9a2
174
py
Python
django_doctest_tests/src/urls.py
michilu/django-doctest
b7be9e7a621216877d193eafc983ace03aa43e03
[ "BSD-3-Clause" ]
null
null
null
django_doctest_tests/src/urls.py
michilu/django-doctest
b7be9e7a621216877d193eafc983ace03aa43e03
[ "BSD-3-Clause" ]
null
null
null
django_doctest_tests/src/urls.py
michilu/django-doctest
b7be9e7a621216877d193eafc983ace03aa43e03
[ "BSD-3-Clause" ]
null
null
null
from django.conf.urls.defaults import * import views urlpatterns = patterns("", (r'^render/(.*/)?', views.render), (r'^use_template/(.*/)?', views.use_template), )
19.333333
50
0.632184
20
174
5.4
0.65
0.203704
0
0
0
0
0
0
0
0
0
0
0.137931
174
8
51
21.75
0.72
0
0
0
0
0
0.195402
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
cfb359a75fd23df18019205b11141a9fe3516090
8,979
py
Python
segeval/ml/test.py
cfournie/segmentation.evaluation
c4140b48112aac697aa7f05effe8026648ebc501
[ "BSD-3-Clause" ]
27
2015-03-22T23:06:47.000Z
2022-01-21T23:21:05.000Z
segeval/ml/test.py
cfournie/segmentation.evaluation
c4140b48112aac697aa7f05effe8026648ebc501
[ "BSD-3-Clause" ]
4
2015-03-12T18:27:08.000Z
2019-10-24T13:09:31.000Z
segeval/ml/test.py
cfournie/segmentation.evaluation
c4140b48112aac697aa7f05effe8026648ebc501
[ "BSD-3-Clause" ]
7
2015-03-12T18:29:27.000Z
2019-01-25T08:52:05.000Z
''' Tests the machine learning (ML) statistics functions, and ml package. .. moduleauthor:: Chris Fournier <chris.m.fournier@gmail.com> ''' from __future__ import absolute_import import unittest from decimal import Decimal from segeval.ml import ( __precision__, precision, __recall__, recall, __fmeasure__, fmeasure, ConfusionMatrix as cm, Average) from segeval.util import SegmentationMetricError class TestConfusionMatrix(unittest.TestCase): ''' Confusion matrix tests. ''' def test_matrix_set_add(self): ''' Test matrix. ''' matrix = cm() matrix['p']['p'] += 2 matrix['p']['n'] = 3 self.assertEqual(matrix['p']['p'], 2) self.assertEqual(matrix['p']['n'], 3) self.assertEqual(matrix['p']['f'], 0) self.assertEqual(matrix['a']['b'], 0) def test_setitem(self): ''' Ensure that __setitem__ raises an AttributeError ''' exception = False matrix = cm() try: matrix['a'] = 0 except AttributeError: exception = True self.assertTrue(exception, 'AttributeError not raised') def test_matrix_classes(self): ''' Test matrix. ''' matrix = cm() matrix['p']['p'] += 2 matrix['p']['n'] = 3 self.assertEqual(matrix['p']['p'], 2) self.assertEqual(matrix['p']['n'], 3) self.assertEqual(matrix['p']['f'], 0) self.assertEqual(matrix['a']['b'], 0) self.assertEqual(matrix.classes(), set(['p', 'n', 'a', 'b', 'f'])) class TestML(unittest.TestCase): ''' Machine-learning metric tests. ''' def test_precision(self): ''' Test precision. ''' matrix = cm() matrix['p']['p'] += 1 matrix['p']['f'] += 1 self.assertEqual(__precision__(matrix, 'p'), Decimal('0.5')) self.assertEqual(__precision__(matrix, 'f'), Decimal('0')) self.assertEqual( precision(matrix, version=Average.micro), Decimal('0.5')) self.assertEqual( precision(matrix, version=Average.macro), Decimal('0.25')) matrix = cm() matrix['p']['p'] += 1 matrix['p']['f'] += 3 matrix['f']['p'] += 1 self.assertEqual( precision(matrix, version=Average.micro), Decimal('0.2')) self.assertEqual( precision(matrix, version=Average.macro), Decimal('0.125')) self.assertEqual(__precision__(matrix, 'p'), Decimal('0.25')) self.assertEqual(__precision__(matrix, 'f'), Decimal('0')) matrix = cm() matrix['p']['p'] += 5 matrix['p']['f'] += 2 matrix['f']['p'] += 1 matrix['f']['f'] += 2 self.assertEqual( precision(matrix, version=Average.micro), Decimal('0.7')) self.assertAlmostEqual(precision(matrix, version=Average.macro), Decimal('0.69047'), 4) self.assertAlmostEqual(__precision__(matrix, 'p'), Decimal('0.71428'), 4) self.assertAlmostEqual(__precision__(matrix, 'f'), Decimal('0.66666'), 4) matrix = cm() matrix['p']['f'] += 2 self.assertEqual(precision(matrix), Decimal('0')) self.assertEqual(__precision__(matrix, 'p'), Decimal('0')) self.assertEqual(__precision__(matrix, 'f'), Decimal('0')) matrix = cm() matrix['p']['p'] += 2 self.assertEqual(precision(matrix), Decimal('1')) self.assertEqual(__precision__(matrix, 'p'), Decimal('1')) self.assertEqual(__precision__(matrix, 'f'), Decimal('0')) matrix = cm() self.assertEqual(precision(matrix), Decimal('0')) self.assertEqual(__precision__(matrix, 'p'), Decimal('0')) self.assertEqual(__precision__(matrix, 'f'), Decimal('0')) def test_recall(self): ''' Test recall. ''' matrix = cm() matrix['p']['p'] += 1 matrix['p']['f'] += 1 self.assertEqual(__recall__(matrix, 'p'), Decimal('1.0')) self.assertEqual(__recall__(matrix, 'f'), Decimal('0')) self.assertEqual(recall(matrix, version=Average.micro), Decimal('0.5')) self.assertEqual(recall(matrix, version=Average.macro), Decimal('0.5')) matrix = cm() matrix['p']['p'] += 1 matrix['p']['f'] += 3 matrix['f']['p'] += 1 self.assertEqual(recall(matrix, version=Average.micro), Decimal('0.2')) self.assertEqual( recall(matrix, version=Average.macro), Decimal('0.25')) self.assertEqual(__recall__(matrix, 'p'), Decimal('0.5')) self.assertEqual(__recall__(matrix, 'f'), Decimal('0')) matrix = cm() matrix['p']['p'] += 5 matrix['p']['f'] += 2 matrix['f']['p'] += 1 matrix['f']['f'] += 2 self.assertEqual(recall(matrix, version=Average.micro), Decimal('0.7')) self.assertAlmostEqual(recall(matrix, version=Average.macro), Decimal('0.66666'), 4) self.assertAlmostEqual(__recall__(matrix, 'p'), Decimal('0.83333'), 4) self.assertAlmostEqual(__recall__(matrix, 'f'), Decimal('0.5'), 4) matrix = cm() matrix['p']['f'] += 2 self.assertEqual(recall(matrix), Decimal('0')) self.assertEqual(__recall__(matrix, 'p'), Decimal('0')) self.assertEqual(__recall__(matrix, 'f'), Decimal('0')) matrix = cm() matrix['p']['p'] += 2 self.assertEqual(recall(matrix), Decimal('1')) self.assertEqual(__recall__(matrix, 'p'), Decimal('1')) self.assertEqual(__recall__(matrix, 'f'), Decimal('0')) matrix = cm() self.assertEqual(recall(matrix), Decimal('0')) self.assertEqual(__recall__(matrix, 'p'), Decimal('0')) self.assertEqual(__recall__(matrix, 'f'), Decimal('0')) def test_fmeasure(self): ''' Test FMeasure. ''' matrix = cm() matrix['p']['p'] += 1 matrix['p']['f'] += 1 self.assertAlmostEqual( __fmeasure__(matrix, 'p'), Decimal('0.66666'), 4) self.assertEqual(__fmeasure__(matrix, 'f'), Decimal('0')) self.assertAlmostEqual(fmeasure(matrix, version=Average.micro), Decimal('0.66666'), 4) self.assertAlmostEqual(fmeasure(matrix, version=Average.macro), Decimal('0.33333'), 4) self.assertAlmostEqual(fmeasure(matrix, classification='p'), Decimal('0.66666'), 4) matrix = cm() matrix['p']['p'] += 1 matrix['p']['f'] += 3 matrix['f']['p'] += 1 self.assertAlmostEqual(fmeasure(matrix, version=Average.micro), Decimal('0.33333'), 4) self.assertAlmostEqual(fmeasure(matrix, version=Average.macro), Decimal('0.16666'), 4) self.assertAlmostEqual(__fmeasure__(matrix, 'p'), Decimal('0.33333'), 4) self.assertAlmostEqual(fmeasure(matrix, classification='p'), Decimal('0.33333'), 4) self.assertEqual(__fmeasure__(matrix, 'f'), Decimal('0')) matrix = cm() matrix['p']['p'] += 5 matrix['p']['f'] += 2 matrix['f']['p'] += 1 matrix['f']['f'] += 2 self.assertAlmostEqual(fmeasure(matrix, version=Average.micro), Decimal('0.68421'), 4) self.assertAlmostEqual(fmeasure(matrix, version=Average.macro), Decimal('0.67032'), 4) self.assertAlmostEqual(__fmeasure__(matrix, 'p'), Decimal('0.76923'), 4) self.assertAlmostEqual(__fmeasure__(matrix, 'f'), Decimal('0.57142'), 4) matrix = cm() matrix['p']['f'] += 2 self.assertEqual(fmeasure(matrix), Decimal('0')) self.assertEqual(__fmeasure__(matrix, 'p'), Decimal('0')) self.assertEqual(__fmeasure__(matrix, 'f'), Decimal('0')) matrix = cm() matrix['p']['p'] += 2 self.assertEqual(fmeasure(matrix), Decimal('1')) self.assertEqual(__fmeasure__(matrix, 'p'), Decimal('1')) self.assertEqual(__fmeasure__(matrix, 'f'), Decimal('0')) matrix = cm() self.assertEqual(fmeasure(matrix), Decimal('0')) self.assertEqual(__fmeasure__(matrix, 'p'), Decimal('0')) self.assertEqual(__fmeasure__(matrix, 'f'), Decimal('0')) def test_exception_on_incorrect_average(self): ''' Test exception on incorrect average. ''' matrix = cm() matrix['p']['p'] += 1 matrix['p']['f'] += 1 self.assertRaises( SegmentationMetricError, fmeasure, matrix, version='incorrect')
39.03913
79
0.538145
933
8,979
4.98821
0.097535
0.099699
0.054147
0.058015
0.816502
0.761066
0.726687
0.661367
0.609583
0.413623
0
0.036737
0.284553
8,979
229
80
39.209607
0.687734
0.0382
0
0.655738
0
0
0.044329
0
0
0
0
0
0.415301
1
0.038251
false
0
0.027322
0
0.076503
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
1
0
0
0
0
0
0
0
0
0
4
cfbcb5bc2acb6279eef24720e20d7b58a8af8a90
54
py
Python
login.py
fengli5588/test01
427912a5cc4a7ef7011e6419cb5a1ec9a8ba003d
[ "MIT" ]
null
null
null
login.py
fengli5588/test01
427912a5cc4a7ef7011e6419cb5a1ec9a8ba003d
[ "MIT" ]
null
null
null
login.py
fengli5588/test01
427912a5cc4a7ef7011e6419cb5a1ec9a8ba003d
[ "MIT" ]
null
null
null
num = 1 val = 2 val2 = 333333 val2 = 333 val3 = 55555
9
13
0.62963
10
54
3.4
0.9
0
0
0
0
0
0
0
0
0
0
0.487179
0.277778
54
5
14
10.8
0.384615
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
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
cfc0232daa45b5f2cfe6bcff55c3dfe4c6d0fd64
243
py
Python
jpp_boosted_django/jpp_boosted/website/templatetags/project_overview_list.py
QualmandDriven/jpp_boosted
895e2e85a7b0dd2fcfc6f2352fc318f2555e16df
[ "MIT" ]
1
2020-07-28T19:36:51.000Z
2020-07-28T19:36:51.000Z
jpp_boosted_django/jpp_boosted/website/templatetags/project_overview_list.py
QualmandDriven/jpp_boosted
895e2e85a7b0dd2fcfc6f2352fc318f2555e16df
[ "MIT" ]
11
2020-06-05T22:37:24.000Z
2022-02-10T08:25:59.000Z
jpp_boosted_django/jpp_boosted/website/templatetags/project_overview_list.py
QualmandDriven/jpp_boosted
895e2e85a7b0dd2fcfc6f2352fc318f2555e16df
[ "MIT" ]
null
null
null
from django import template from django.template.loader import get_template register = template.Library() @register.inclusion_tag('project_overview_list.html') def project_overview_list(project_list): return {'project_list': project_list}
34.714286
53
0.82716
32
243
6
0.5
0.171875
0.197917
0
0
0
0
0
0
0
0
0
0.08642
243
7
54
34.714286
0.864865
0
0
0
0
0
0.155738
0.106557
0
0
0
0
0
1
0.166667
false
0
0.333333
0.166667
0.666667
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
1
1
0
0
0
4
cff8bbd354a25a3a52b9aff9eeab5db75ff581a6
385
py
Python
operators/keycloak-operator/python/pulumi_pulumi_kubernetes_crds_operators_keycloak_operator/keycloak/v1alpha1/__init__.py
pulumi/pulumi-kubernetes-crds
372c4c0182f6b899af82d6edaad521aa14f22150
[ "Apache-2.0" ]
null
null
null
operators/keycloak-operator/python/pulumi_pulumi_kubernetes_crds_operators_keycloak_operator/keycloak/v1alpha1/__init__.py
pulumi/pulumi-kubernetes-crds
372c4c0182f6b899af82d6edaad521aa14f22150
[ "Apache-2.0" ]
2
2020-09-18T17:12:23.000Z
2020-12-30T19:40:56.000Z
operators/keycloak-operator/python/pulumi_pulumi_kubernetes_crds_operators_keycloak_operator/keycloak/v1alpha1/__init__.py
pulumi/pulumi-kubernetes-crds
372c4c0182f6b899af82d6edaad521aa14f22150
[ "Apache-2.0" ]
null
null
null
# coding=utf-8 # *** WARNING: this file was generated by crd2pulumi. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** # Export this package's modules as members: from .Keycloak import * from .KeycloakBackup import * from .KeycloakClient import * from .KeycloakRealm import * from .KeycloakUser import * from ._inputs import * from . import outputs
29.615385
80
0.735065
53
385
5.320755
0.698113
0.212766
0
0
0
0
0
0
0
0
0
0.00625
0.168831
385
12
81
32.083333
0.875
0.490909
0
0
1
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
32009a1006b690062c5d23b1c5164be464ba2e41
196
py
Python
customize/urls.py
soma115/wikikracja
7715ca1daa4ca09888e1c7389ed5f8a2df29898b
[ "MIT" ]
7
2016-02-21T17:25:54.000Z
2021-10-09T19:36:10.000Z
customize/urls.py
soma115/wikikracja
7715ca1daa4ca09888e1c7389ed5f8a2df29898b
[ "MIT" ]
19
2020-02-11T23:55:01.000Z
2022-03-31T18:11:56.000Z
customize/urls.py
soma115/wikikracja
7715ca1daa4ca09888e1c7389ed5f8a2df29898b
[ "MIT" ]
3
2016-01-20T22:34:58.000Z
2020-09-16T07:45:42.000Z
from django.urls import path from . import views as v app_name = 'customize' # urlpatterns = ( # path('view/', v.view, name='view'), # # path('edit/<int:pk>/', v.edit, name='edit'), # )
19.6
52
0.596939
28
196
4.142857
0.571429
0
0
0
0
0
0
0
0
0
0
0
0.193878
196
9
53
21.777778
0.734177
0.545918
0
0
0
0
0.108434
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
32112170e06e9bed0804a0e97eda8789d22e6e36
164
py
Python
Codewars/HighestScoringWord.py
SelvorWhim/competitive
b9daaf21920d6f7669dc0c525e903949f4e33b62
[ "Unlicense" ]
null
null
null
Codewars/HighestScoringWord.py
SelvorWhim/competitive
b9daaf21920d6f7669dc0c525e903949f4e33b62
[ "Unlicense" ]
null
null
null
Codewars/HighestScoringWord.py
SelvorWhim/competitive
b9daaf21920d6f7669dc0c525e903949f4e33b62
[ "Unlicense" ]
null
null
null
oa = ord('a') def word_score(word): return sum((ord(letter) - oa + 1) for letter in word) def high(s): print(s) return max(s.split(), key=word_score)
18.222222
57
0.615854
29
164
3.413793
0.62069
0.181818
0
0
0
0
0
0
0
0
0
0.007752
0.213415
164
8
58
20.5
0.75969
0
0
0
0
0
0.006098
0
0
0
0
0
0
1
0.333333
false
0
0
0.166667
0.666667
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
0
1
0
0
0
1
0
0
0
4
321e00ff13e52ae86d4f403e299ca5c116ffd062
100
py
Python
doc/examples/example04.py
vinceatbluelabs/config_resolver
6de95833d037629405c649ba8dbc6a9ced064393
[ "MIT" ]
1
2015-11-05T18:31:54.000Z
2015-11-05T18:31:54.000Z
doc/examples/example04.py
vinceatbluelabs/config_resolver
6de95833d037629405c649ba8dbc6a9ced064393
[ "MIT" ]
63
2015-01-27T13:15:42.000Z
2021-06-07T06:50:59.000Z
doc/examples/example04.py
vinceatbluelabs/config_resolver
6de95833d037629405c649ba8dbc6a9ced064393
[ "MIT" ]
1
2020-05-12T18:12:03.000Z
2020-05-12T18:12:03.000Z
from config_resolver import get_config cfg = get_config("bird_feeder", "acmecorp") print(cfg.meta)
20
43
0.79
15
100
5
0.733333
0.24
0
0
0
0
0
0
0
0
0
0
0.1
100
4
44
25
0.833333
0
0
0
0
0
0.19
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
5c5559b78579f373c0dde96fd743f3cb2ca083e9
87
py
Python
src/sasctl/utils/pyml2ds/connectors/ensembles/__init__.py
jameskochubasas/python-sasctl
65107c2d4355390ca09e83eb89167c86506c9926
[ "Apache-2.0" ]
30
2019-07-12T00:18:21.000Z
2022-03-18T08:36:35.000Z
src/sasctl/utils/pyml2ds/connectors/ensembles/__init__.py
jameskochubasas/python-sasctl
65107c2d4355390ca09e83eb89167c86506c9926
[ "Apache-2.0" ]
89
2019-07-12T20:46:46.000Z
2022-03-29T16:16:46.000Z
src/sasctl/utils/pyml2ds/connectors/ensembles/__init__.py
jameskochubasas/python-sasctl
65107c2d4355390ca09e83eb89167c86506c9926
[ "Apache-2.0" ]
41
2019-07-11T15:08:55.000Z
2022-01-10T05:30:50.000Z
from .xgb import XgbParser from .lgb import LightgbmParser from .pmml import PmmlParser
29
31
0.83908
12
87
6.083333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.126437
87
3
32
29
0.960526
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
5c5c213568b43978a2a464caf11808d69aa7c3fb
50
py
Python
run.py
NeeharikaESai/NSP
6db6243cbcb58d90e649603be92f6a038cd3c279
[ "MIT" ]
null
null
null
run.py
NeeharikaESai/NSP
6db6243cbcb58d90e649603be92f6a038cd3c279
[ "MIT" ]
8
2020-06-05T18:39:09.000Z
2022-03-11T23:26:32.000Z
run.py
NSP-Community/NSP-Production
329af474892b911f2025a920fdb3ab390bb6de81
[ "MIT" ]
1
2019-10-27T20:11:58.000Z
2019-10-27T20:11:58.000Z
import os os.system("python manage.py runserver")
16.666667
39
0.78
8
50
4.875
0.875
0
0
0
0
0
0
0
0
0
0
0
0.1
50
2
40
25
0.866667
0
0
0
0
0
0.52
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
5c70200d818bbd29469723be65d620d6130bcb9a
238
py
Python
whitenoise/management/commands/runfixtures.py
vsgiri/white-noise
e0d52e3a5363c92010c74a1e3721da799ef99eba
[ "MIT" ]
4
2019-01-11T17:05:09.000Z
2022-03-05T19:57:22.000Z
whitenoise/management/commands/runfixtures.py
vsgiri/white-noise
e0d52e3a5363c92010c74a1e3721da799ef99eba
[ "MIT" ]
2
2019-07-02T23:14:46.000Z
2019-07-12T00:30:41.000Z
whitenoise/management/commands/runfixtures.py
vsgiri/white-noise
e0d52e3a5363c92010c74a1e3721da799ef99eba
[ "MIT" ]
1
2019-07-02T21:57:06.000Z
2019-07-02T21:57:06.000Z
from django.core.management.base import BaseCommand, CommandError class Command(BaseCOmmand): help = 'Run white-noise fixtures' def add_arguments(self, parser): pass def handle(self, *args, **options): pass
21.636364
65
0.684874
28
238
5.785714
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.218487
238
10
66
23.8
0.870968
0
0
0.285714
0
0
0.10084
0
0
0
0
0
0
1
0.285714
false
0.285714
0.142857
0
0.714286
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
1
0
1
0
0
1
0
0
4
5c93c59c8d447030a3719989444ac65ea16cd81a
161
py
Python
moto/events/__init__.py
gvlproject/moto
b1c51faaf5dbf79a76eca29724b7d22b87e27502
[ "Apache-2.0" ]
2
2019-07-10T14:44:12.000Z
2020-06-08T17:26:29.000Z
moto/events/__init__.py
gvlproject/moto
b1c51faaf5dbf79a76eca29724b7d22b87e27502
[ "Apache-2.0" ]
5
2018-04-25T21:04:20.000Z
2018-11-02T19:59:27.000Z
moto/events/__init__.py
gvlproject/moto
b1c51faaf5dbf79a76eca29724b7d22b87e27502
[ "Apache-2.0" ]
12
2017-09-06T22:11:15.000Z
2021-05-28T17:22:31.000Z
from __future__ import unicode_literals from .models import events_backend events_backends = {"global": events_backend} mock_events = events_backend.decorator
23
44
0.838509
20
161
6.25
0.6
0.312
0
0
0
0
0
0
0
0
0
0
0.10559
161
6
45
26.833333
0.868056
0
0
0
0
0
0.037267
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
5c9a7cd1c903bd0965a1c14130cfa8ccbe52a5ac
122
py
Python
examples/timing.py
tahmid-choyon/capslock
dde335b2ab73cbf7199e081fedb594d01f6c2021
[ "MIT" ]
8
2021-02-23T13:06:07.000Z
2021-09-14T10:24:19.000Z
examples/timing.py
tahmid-choyon/capslock
dde335b2ab73cbf7199e081fedb594d01f6c2021
[ "MIT" ]
2
2021-03-05T00:23:39.000Z
2021-03-06T07:06:32.000Z
examples/timing.py
tahmid-choyon/capslock
dde335b2ab73cbf7199e081fedb594d01f6c2021
[ "MIT" ]
4
2021-02-24T07:25:51.000Z
2021-03-06T12:22:07.000Z
from capslock import timing @timing def say_hello(): print("Hello World") if __name__ == '__main__': say_hello()
15.25
27
0.688525
16
122
4.625
0.75
0.216216
0
0
0
0
0
0
0
0
0
0
0.188525
122
8
28
15.25
0.747475
0
0
0
0
0
0.154472
0
0
0
0
0
0
1
0.166667
true
0
0.166667
0
0.333333
0.166667
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
5cb55624451b9784782908c24e2e54a8bd5238f6
818
py
Python
test/test_train.py
mikolasan/name-generator
94389f7a33f5ea72cda4ac3088add75153e6263c
[ "MIT" ]
null
null
null
test/test_train.py
mikolasan/name-generator
94389f7a33f5ea72cda4ac3088add75153e6263c
[ "MIT" ]
null
null
null
test/test_train.py
mikolasan/name-generator
94389f7a33f5ea72cda4ac3088add75153e6263c
[ "MIT" ]
null
null
null
import os import pytest from stupid_ai.markov_chain import MarkovChain @pytest.fixture def markov_chain(): m = MarkovChain() m.set_file(os.path.join('data', 'male.txt')) m.train() return m def test_p_values(markov_chain): assert markov_chain.P[0][0] == 0.004246284501061571 assert markov_chain.P[0][1] == 0.008492569002123142 assert markov_chain.P[0][2] == 0.12101910828025478 assert markov_chain.P[0][3] == 0.016985138004246284 def test_h_values(markov_chain): assert markov_chain.H[0][0] == 2 assert markov_chain.H[0][1] == 4 assert markov_chain.H[0][2] == 57 assert markov_chain.H[0][3] == 8 def test_h_total_values(markov_chain): assert markov_chain.h_totals[0] == 471 assert markov_chain.h_totals[1] == 29 assert markov_chain.h_totals[2] == 153
25.5625
55
0.699267
131
818
4.152672
0.320611
0.323529
0.34375
0.231618
0.505515
0.191176
0.128676
0
0
0
0
0.157122
0.167482
818
31
56
26.387097
0.641703
0
0
0
0
0
0.01467
0
0
0
0
0
0.478261
1
0.173913
false
0
0.130435
0
0.347826
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
5cd150956e1d5c7ebc20842b4f030935cb007f60
315
py
Python
backend/api/adminViews/adminListView.py
CMPUT404-wi21-project/CMPUT404-project-socialdistribution
b88ca3608e16a1bae72cd7c8cfc212db74d1b2c0
[ "W3C-20150513" ]
1
2021-04-08T22:02:44.000Z
2021-04-08T22:02:44.000Z
backend/api/adminViews/adminListView.py
CMPUT404-wi21-project/CMPUT404-project-socialdistribution
b88ca3608e16a1bae72cd7c8cfc212db74d1b2c0
[ "W3C-20150513" ]
79
2021-02-06T22:55:52.000Z
2021-04-15T20:24:56.000Z
backend/api/adminViews/adminListView.py
CMPUT404-wi21-project/CMPUT404-project-socialdistribution
b88ca3608e16a1bae72cd7c8cfc212db74d1b2c0
[ "W3C-20150513" ]
4
2021-02-14T15:13:15.000Z
2021-04-17T06:21:11.000Z
from django.contrib import admin from ..services.adminActions import accept_signup_request # admin list view for signup requests class signup_request_admin_list_view(admin.ModelAdmin): list_display = ['username','displayName', 'github', 'host'] ordering = ['username'] actions = [accept_signup_request]
39.375
63
0.774603
38
315
6.184211
0.605263
0.165957
0.161702
0.187234
0.221277
0
0
0
0
0
0
0
0.126984
315
8
64
39.375
0.854545
0.111111
0
0
0
0
0.132616
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
7a3f5bf4f898d53208c52e968fc76659ea97c833
333
py
Python
BlockingThreadPoolExecutor.py
etherandrius/information-networks
47e64e4fcbd2c1fd076ab69cb8254efef6c846ae
[ "MIT" ]
null
null
null
BlockingThreadPoolExecutor.py
etherandrius/information-networks
47e64e4fcbd2c1fd076ab69cb8254efef6c846ae
[ "MIT" ]
null
null
null
BlockingThreadPoolExecutor.py
etherandrius/information-networks
47e64e4fcbd2c1fd076ab69cb8254efef6c846ae
[ "MIT" ]
null
null
null
from concurrent.futures import ThreadPoolExecutor import queue class BlockingThreadPoolExecutor(ThreadPoolExecutor): def __init__(self, max_workers=None, thread_name_prefix=''): super().__init__(max_workers=max_workers, thread_name_prefix=thread_name_prefix) self._work_queue = queue.Queue(maxsize=max_workers)
37
88
0.801802
39
333
6.333333
0.512821
0.161943
0.194332
0
0
0
0
0
0
0
0
0
0.117117
333
8
89
41.625
0.840136
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.666667
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
1
0
1
0
0
4
7a633c099499f37d537aa1e6570a5359e2ba2008
117
py
Python
sloth_job/admin.py
Alexoner/sloth
ac2668d1e096de474429fc0d1a5291b107374c32
[ "Unlicense" ]
null
null
null
sloth_job/admin.py
Alexoner/sloth
ac2668d1e096de474429fc0d1a5291b107374c32
[ "Unlicense" ]
null
null
null
sloth_job/admin.py
Alexoner/sloth
ac2668d1e096de474429fc0d1a5291b107374c32
[ "Unlicense" ]
null
null
null
from django.contrib import admin from .models import Proxy # Register your models here. admin.site.register(Proxy)
16.714286
32
0.794872
17
117
5.470588
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.136752
117
6
33
19.5
0.920792
0.222222
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
7a8cd44d6b4dfe99af7fb007576bfb73aabaaa2b
93
py
Python
hive/controllers/api/users.py
evilinc-dev/hive
898691bcae6dc9733d1e239113c327a96d2e6501
[ "MIT" ]
1
2019-10-26T06:32:41.000Z
2019-10-26T06:32:41.000Z
hive/controllers/api/users.py
evilinc-dev/hive
898691bcae6dc9733d1e239113c327a96d2e6501
[ "MIT" ]
2
2020-11-06T04:24:53.000Z
2020-11-06T04:26:04.000Z
hive/controllers/api/users.py
evilinc-dev/hive
898691bcae6dc9733d1e239113c327a96d2e6501
[ "MIT" ]
null
null
null
from flask import Blueprint, jsonify route = Blueprint("users", __name__, url_prefix='/api')
31
55
0.763441
12
93
5.5
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.107527
93
3
55
31
0.795181
0
0
0
0
0
0.095745
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
1
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
1
0
4
7ab67c6ce48ef47990e3682f8981f7154e3213d5
2,545
py
Python
Pyhton-303-main/loops.py
meminds/DataScience
4671fab86d50d4fefd88732afed767a0280e3a6b
[ "MIT" ]
null
null
null
Pyhton-303-main/loops.py
meminds/DataScience
4671fab86d50d4fefd88732afed767a0280e3a6b
[ "MIT" ]
null
null
null
Pyhton-303-main/loops.py
meminds/DataScience
4671fab86d50d4fefd88732afed767a0280e3a6b
[ "MIT" ]
null
null
null
# FOR loop student = ["ali","veli","isik","berk"] for i in student: print(i) """returns ali veli isik berk """ # Example --- Code that gives 20% increase in salaries. salary = [1000,2000,3000,4000,5000] for i in salary: print(i) def new_salary(x): print(x*20/100 +x) for i in salary: new_salary(i) """ returns 1200.0 2400.0 3600.0 4800.0 6000.0 """ # Break & Continue salary = [8000,5000,2000,1000,3000,7000,1000] salary.sort() salary # returns [1000, 1000, 2000, 3000, 5000, 7000, 8000] for i in salary: if i==3000: print("stop") break print(i) """ returns 1000 1000 2000 stop """ for i in salary: if i==3000: continue print(i) """ returns 1000 1000 2000 5000 7000 8000 """ # while number = 1 while number<10: number += 1 print(number) """ returns 2 3 4 5 6 7 8 9 10 """
34.391892
96
0.203929
140
2,545
3.692857
0.378571
0.038685
0.058027
0.092843
0.170213
0.170213
0.073501
0
0
0
0
0.256966
0.746169
2,545
73
97
34.863014
0.543344
0.053438
0
0.244898
0
0
0.631014
0
0
0
0
0
0
0
null
null
0
0
null
null
0.142857
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
8faf2403996a11177a5bec9c179f33d151fb78f2
232
py
Python
todo.py
Pickwell15/to-do-list
4ab7aaa3039eceb1f30a062a454d8902838930d6
[ "CC0-1.0" ]
1
2021-08-29T20:01:56.000Z
2021-08-29T20:01:56.000Z
todo.py
Pickwell15/to-do-list
4ab7aaa3039eceb1f30a062a454d8902838930d6
[ "CC0-1.0" ]
null
null
null
todo.py
Pickwell15/to-do-list
4ab7aaa3039eceb1f30a062a454d8902838930d6
[ "CC0-1.0" ]
null
null
null
""" OBJECTS --------------- PUBLIC | ToDo MODULES --------------- EXTERNAL | dataclasses -> dataclass """ from dataclasses import dataclass @dataclass(frozen=True, order=True) class ToDo: title: str body: str
12.888889
36
0.577586
22
232
6.090909
0.727273
0
0
0
0
0
0
0
0
0
0
0
0.211207
232
17
37
13.647059
0.73224
0.422414
0
0
0
0
0
0
0
0
0
0.058824
0
1
0
true
0
0.2
0
0.8
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
1
0
0
0
1
0
0
0
1
0
0
4
8fb079ad47e78c7439a4ead56f58836497076fa6
22
py
Python
aliyun-python-sdk-cms/aliyunsdkcms/__init__.py
bricklayer-Liu/aliyun-openapi-python-sdk
20da2554de22679fc7c5462c483663e4d79512aa
[ "Apache-2.0" ]
1
2021-03-08T02:59:17.000Z
2021-03-08T02:59:17.000Z
aliyun-python-sdk-cms/aliyunsdkcms/__init__.py
bricklayer-Liu/aliyun-openapi-python-sdk
20da2554de22679fc7c5462c483663e4d79512aa
[ "Apache-2.0" ]
null
null
null
aliyun-python-sdk-cms/aliyunsdkcms/__init__.py
bricklayer-Liu/aliyun-openapi-python-sdk
20da2554de22679fc7c5462c483663e4d79512aa
[ "Apache-2.0" ]
null
null
null
__version__ = '7.0.15'
22
22
0.681818
4
22
2.75
1
0
0
0
0
0
0
0
0
0
0
0.2
0.090909
22
1
22
22
0.35
0
0
0
0
0
0.26087
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
8fd56d88e8db3f6cb979ef9a18b6b123c7acf0a4
186
py
Python
configs/flownet2/flownet2sd_8x1_slong_chairssdhom_384x448.py
hologerry/mmflow
40caf064851bd95317424e31cc137c0007a2bece
[ "Apache-2.0" ]
481
2021-11-16T07:04:23.000Z
2022-03-31T22:21:21.000Z
configs/flownet2/flownet2sd_8x1_slong_chairssdhom_384x448.py
hologerry/mmflow
40caf064851bd95317424e31cc137c0007a2bece
[ "Apache-2.0" ]
72
2021-11-16T12:25:55.000Z
2022-03-28T13:10:45.000Z
configs/flownet2/flownet2sd_8x1_slong_chairssdhom_384x448.py
hologerry/mmflow
40caf064851bd95317424e31cc137c0007a2bece
[ "Apache-2.0" ]
48
2021-11-16T06:48:46.000Z
2022-03-30T12:46:40.000Z
_base_ = [ '../_base_/models/flownet2/flownet2sd.py', '../_base_/datasets/chairssdhom_384x448.py', '../_base_/schedules/schedule_s_long.py', '../_base_/default_runtime.py' ]
31
76
0.688172
21
186
5.428571
0.666667
0.157895
0
0
0
0
0
0
0
0
0
0.048193
0.107527
186
5
77
37.2
0.638554
0
0
0
0
0
0.784946
0.784946
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
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
8fe1daba837194ffd8a01877792d1dbd0a476e76
110
py
Python
image_generation/__init__.py
shibing624/cvnet
5b9032a6d4be731cca92392a6779d56635781169
[ "Apache-2.0" ]
2
2020-10-27T01:35:32.000Z
2020-12-07T19:09:51.000Z
image_generation/__init__.py
shibing624/imagefun
5c5c688b530f07688cda85705591634286f0b848
[ "Apache-2.0" ]
1
2020-12-01T14:24:06.000Z
2020-12-01T14:24:06.000Z
image_generation/__init__.py
shibing624/imagefun
5c5c688b530f07688cda85705591634286f0b848
[ "Apache-2.0" ]
1
2021-05-19T02:41:40.000Z
2021-05-19T02:41:40.000Z
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: 包括gan图像生成、vae图像生成、艺术风格迁移、图像漫画化 """
18.333333
44
0.672727
13
110
5.692308
1
0
0
0
0
0
0
0
0
0
0
0.04
0.090909
110
5
45
22
0.7
0.909091
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
8ff4425f0956621c730b0d0f94ff66f41e12bd0a
159
py
Python
test_session.py
dkkline/pylectio
3ce31b86b6cdf315dab84642440dcc2c31365a9f
[ "MIT" ]
null
null
null
test_session.py
dkkline/pylectio
3ce31b86b6cdf315dab84642440dcc2c31365a9f
[ "MIT" ]
null
null
null
test_session.py
dkkline/pylectio
3ce31b86b6cdf315dab84642440dcc2c31365a9f
[ "MIT" ]
null
null
null
from lectio.session import Session from getpass import getpass s = Session("248") username = "jepp3467" password = getpass() r = s.auth(username, password)
15.9
34
0.742138
21
159
5.619048
0.571429
0
0
0
0
0
0
0
0
0
0
0.051852
0.150943
159
9
35
17.666667
0.822222
0
0
0
0
0
0.069182
0
0
0
0
0
0
1
0
false
0.5
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
1
1
0
0
0
0
4
8ff8a172c102fabba5e6a16cd27224c049f36e7f
170
py
Python
dashboard/apps.py
hosseinmoghimi/waiter
9f5f332b6f252a29aa14f67655b423fd9c40fba3
[ "MIT" ]
1
2021-12-02T11:16:53.000Z
2021-12-02T11:16:53.000Z
dashboard/apps.py
hosseinmoghimi/waiter
9f5f332b6f252a29aa14f67655b423fd9c40fba3
[ "MIT" ]
null
null
null
dashboard/apps.py
hosseinmoghimi/waiter
9f5f332b6f252a29aa14f67655b423fd9c40fba3
[ "MIT" ]
null
null
null
from django.apps import AppConfig APP_NAME="dashboard" class DashboardConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'dashboard'
24.285714
56
0.776471
20
170
6.45
0.8
0.20155
0
0
0
0
0
0
0
0
0
0
0.129412
170
6
57
28.333333
0.871622
0
0
0
0
0
0.276471
0.170588
0
0
0
0
0
1
0
false
0
0.2
0
0.8
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
1
0
0
4
64eacb5f9bf02d0279888ff422a48dcfab22057f
132
py
Python
tests/test_module.py
janezlapajne/python-project-template
bca24a061008e398a1d68b95df8c991d3524ad9d
[ "MIT" ]
null
null
null
tests/test_module.py
janezlapajne/python-project-template
bca24a061008e398a1d68b95df8c991d3524ad9d
[ "MIT" ]
null
null
null
tests/test_module.py
janezlapajne/python-project-template
bca24a061008e398a1d68b95df8c991d3524ad9d
[ "MIT" ]
null
null
null
import pytest import os, glob #import source.module as mod #import tests.helpers as hlp def test_module_func(): assert True
12
28
0.75
21
132
4.619048
0.761905
0
0
0
0
0
0
0
0
0
0
0
0.189394
132
10
29
13.2
0.906542
0.409091
0
0
0
0
0
0
0
0
0
0
0.25
1
0.25
true
0
0.5
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
1
0
0
0
0
4
8f0ab030bf7a8b9f475535e03e2fa7f2a453473a
183
py
Python
pymtl3/stdlib/test/__init__.py
mondO/pymtl3
9869dda28c01926cee6da94ebdeac2a210150c62
[ "BSD-3-Clause" ]
1
2022-01-03T06:22:11.000Z
2022-01-03T06:22:11.000Z
pymtl3/stdlib/test/__init__.py
mondO/pymtl3
9869dda28c01926cee6da94ebdeac2a210150c62
[ "BSD-3-Clause" ]
null
null
null
pymtl3/stdlib/test/__init__.py
mondO/pymtl3
9869dda28c01926cee6da94ebdeac2a210150c62
[ "BSD-3-Clause" ]
null
null
null
from .test_sinks import TestSinkCL from .test_srcs import TestSrcCL from .test_utils import ( TestVectorSimulator, mk_test_case_table, run_sim, run_test_vector_sim, )
20.333333
34
0.770492
25
183
5.24
0.6
0.183206
0
0
0
0
0
0
0
0
0
0
0.180328
183
8
35
22.875
0.873333
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.375
0
0.375
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
8f3161bc48499c5e3b47f9e512eb3ef3e528496a
97
py
Python
py_tdlib/constructors/set_network_type.py
Mr-TelegramBot/python-tdlib
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
[ "MIT" ]
24
2018-10-05T13:04:30.000Z
2020-05-12T08:45:34.000Z
py_tdlib/constructors/set_network_type.py
MrMahdi313/python-tdlib
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
[ "MIT" ]
3
2019-06-26T07:20:20.000Z
2021-05-24T13:06:56.000Z
py_tdlib/constructors/set_network_type.py
MrMahdi313/python-tdlib
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
[ "MIT" ]
5
2018-10-05T14:29:28.000Z
2020-08-11T15:04:10.000Z
from ..factory import Method class setNetworkType(Method): type = None # type: "NetworkType"
16.166667
35
0.731959
11
97
6.454545
0.818182
0
0
0
0
0
0
0
0
0
0
0
0.164948
97
5
36
19.4
0.876543
0.195876
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
8f43e3e6f7f121edfb38de58b78076177425cdf7
330
py
Python
APIServer/database/schema.py
gcallah/SOCNET
dd8f0894e8ed071df7f78f3b61dddc7d5cf7be61
[ "MIT" ]
1
2021-02-04T19:16:16.000Z
2021-02-04T19:16:16.000Z
APIServer/database/schema.py
gcallah/SOCNET
dd8f0894e8ed071df7f78f3b61dddc7d5cf7be61
[ "MIT" ]
null
null
null
APIServer/database/schema.py
gcallah/SOCNET
dd8f0894e8ed071df7f78f3b61dddc7d5cf7be61
[ "MIT" ]
1
2021-02-12T21:27:25.000Z
2021-02-12T21:27:25.000Z
from APIServer.database.models import Alert, Thread, Comment from marshmallow_sqlalchemy import ModelSchema class AlertSchema(ModelSchema): class Meta: model = Alert class ThreadSchema(ModelSchema): class Meta: model = Thread class CommentSchema(ModelSchema): class Meta: model = Comment
18.333333
60
0.721212
34
330
6.970588
0.5
0.270042
0.253165
0.316456
0
0
0
0
0
0
0
0
0.221212
330
17
61
19.411765
0.922179
0
0
0.272727
0
0
0
0
0
0
0
0
0
1
0
false
0
0.181818
0
0.727273
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
8f4c3111c8c10c0ec0a5b5dafc3f8b0dec13623f
105
py
Python
tiatoolbox/__main__.py
adamshephard/tiatoolbox
28c32648bc1f3e842c7b241637fd25af290386e6
[ "BSD-3-Clause" ]
null
null
null
tiatoolbox/__main__.py
adamshephard/tiatoolbox
28c32648bc1f3e842c7b241637fd25af290386e6
[ "BSD-3-Clause" ]
null
null
null
tiatoolbox/__main__.py
adamshephard/tiatoolbox
28c32648bc1f3e842c7b241637fd25af290386e6
[ "BSD-3-Clause" ]
null
null
null
"""__main__ file invoked with `python -m tiatoolbox` command""" from tiatoolbox.cli import main main()
17.5
63
0.742857
14
105
5.285714
0.785714
0
0
0
0
0
0
0
0
0
0
0
0.142857
105
5
64
21
0.822222
0.542857
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
8f68bd4cd8c7ddae1a307e6f5557f4856f4eafdd
71
py
Python
src/backend/main.py
fellowmate/docs-storage
a55929e3f94f121a8382b9bc0bd2d226646d4627
[ "MIT" ]
null
null
null
src/backend/main.py
fellowmate/docs-storage
a55929e3f94f121a8382b9bc0bd2d226646d4627
[ "MIT" ]
null
null
null
src/backend/main.py
fellowmate/docs-storage
a55929e3f94f121a8382b9bc0bd2d226646d4627
[ "MIT" ]
null
null
null
from backend.create_app import create_app application = create_app()
14.2
41
0.816901
10
71
5.5
0.6
0.490909
0
0
0
0
0
0
0
0
0
0
0.126761
71
4
42
17.75
0.887097
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
56c8eb2e6f84e1fd36221e4ea22949db09e7aa25
194
py
Python
config/context_processors.py
YaroslavChyhryn/WeatherReminder
868e2956da2a4aa294471ceb8ea5b72289522491
[ "MIT" ]
null
null
null
config/context_processors.py
YaroslavChyhryn/WeatherReminder
868e2956da2a4aa294471ceb8ea5b72289522491
[ "MIT" ]
1
2017-04-22T22:45:17.000Z
2017-08-13T14:52:01.000Z
config/context_processors.py
YaroslavChyhryn/WeatherReminder
868e2956da2a4aa294471ceb8ea5b72289522491
[ "MIT" ]
null
null
null
from django.conf import settings def from_settings(request): return { 'ENVIRONMENT_NAME': settings.ENVIRONMENT_NAME, 'ENVIRONMENT_COLOR': settings.ENVIRONMENT_COLOR, }
21.555556
56
0.716495
20
194
6.7
0.55
0.223881
0
0
0
0
0
0
0
0
0
0
0.201031
194
8
57
24.25
0.864516
0
0
0
0
0
0.170103
0
0
0
0
0
0
1
0.166667
false
0
0.166667
0.166667
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
4
56d0b90a6ea0a6697328ad22badfa9c120295154
1,206
py
Python
bspider/parser/item.py
littlebai3618/bspider
ff4d003cd0825247db4efe62db95f9245c0a303c
[ "BSD-3-Clause" ]
3
2020-06-19T03:52:29.000Z
2021-05-21T05:50:46.000Z
bspider/parser/item.py
littlebai3618/bspider
ff4d003cd0825247db4efe62db95f9245c0a303c
[ "BSD-3-Clause" ]
2
2021-03-31T19:39:03.000Z
2021-05-12T02:10:26.000Z
bspider/parser/item.py
littlebai3618/bspider
ff4d003cd0825247db4efe62db95f9245c0a303c
[ "BSD-3-Clause" ]
null
null
null
class Item(object): """ item对象, """ def __init__(self, schema=None, **kwargs): """ :param schema: 建表语句,要求有建表权限 :param kwargs: 要存储的数据 """ self.capacity = kwargs self.schema = schema # 增加元素 def __setitem__(self, key, value): self.capacity[key] = value # 取出元素 def __getitem__(self, item): return self.capacity[item] # 删除元素 def __delitem__(self, key): del self.capacity[key] # 对象可迭代 def __iter__(self): return self.capacity.items() def pop(self, key): return self.capacity.pop(key) def get(self, key, default=None): return self.capacity.get(key, default) def keys(self): return self.capacity.keys() def values(self): return self.capacity.values() def clear(self): return self.capacity.clear() def __repr__(self): return f'<Item: {len(self.capacity)} field>' __str__ = __repr__ class MySQLSaverItem(Item): def __init__(self, table: str, auto_update=True, schema=None, **kwargs): super().__init__(schema, **kwargs) self.table = table self.auto_update = auto_update
21.157895
76
0.587894
139
1,206
4.791367
0.323741
0.198198
0.189189
0.132132
0
0
0
0
0
0
0
0
0.289386
1,206
56
77
21.535714
0.77713
0.065506
0
0
0
0
0.031569
0
0
0
0
0
0
1
0.4
false
0
0
0.266667
0.766667
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
56e59eeffb52c76028117b91c4e0b0a6f2d53b94
617
py
Python
data_structures/binary_search_tree/test_breadth_first_traversal.py
zarkle/data-structures-and-algorithms
0485b95f5aabc0ee255cd7e50b48a6ccec851e00
[ "MIT" ]
1
2021-01-28T07:32:17.000Z
2021-01-28T07:32:17.000Z
data_structures/binary_search_tree/test_breadth_first_traversal.py
zarkle/data-structures-and-algorithms
0485b95f5aabc0ee255cd7e50b48a6ccec851e00
[ "MIT" ]
null
null
null
data_structures/binary_search_tree/test_breadth_first_traversal.py
zarkle/data-structures-and-algorithms
0485b95f5aabc0ee255cd7e50b48a6ccec851e00
[ "MIT" ]
1
2020-04-10T08:01:50.000Z
2020-04-10T08:01:50.000Z
from .breadth_first_traversal import breadth_first_traversal from .bst import BST def test_breadth_first_traversal(): """Test breadth-first traversal.""" tree = BST([2, 1, 3]) assert breadth_first_traversal(tree) == [2, 1, 3] def test_breadth_first_traversal_balanced(balanced_bst): """Test breadth-first traversal in balanced tree.""" assert breadth_first_traversal(balanced_bst) == [10, 7, 16, 3, 8, 12, 20] def test_breadth_first_traversal_right(right_heavy): """Test breadth-first traversal in right heavy tree.""" assert breadth_first_traversal(right_heavy) == [1, 3, 5, 7, 9]
30.85
77
0.730956
89
617
4.786517
0.280899
0.309859
0.542254
0.352113
0.469484
0
0
0
0
0
0
0.042065
0.15235
617
19
78
32.473684
0.772467
0.204214
0
0
0
0
0
0
0
0
0
0
0.333333
1
0.333333
false
0
0.222222
0
0.555556
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
854b72957d998596a5f541b0a721a124e5fae503
834
py
Python
running_modes/configurations/reinforcement_learning/reinforcement_learning_components.py
lilleswing/Reinvent-1
ac4e3e6fa6379c6f4af883478dfd1b3407933ada
[ "Apache-2.0" ]
183
2020-04-04T02:01:15.000Z
2022-03-30T21:56:56.000Z
running_modes/configurations/reinforcement_learning/reinforcement_learning_components.py
lilleswing/Reinvent-1
ac4e3e6fa6379c6f4af883478dfd1b3407933ada
[ "Apache-2.0" ]
39
2020-04-05T15:19:56.000Z
2022-03-09T12:58:21.000Z
running_modes/configurations/reinforcement_learning/reinforcement_learning_components.py
lilleswing/Reinvent-1
ac4e3e6fa6379c6f4af883478dfd1b3407933ada
[ "Apache-2.0" ]
70
2020-04-05T19:25:43.000Z
2022-02-22T12:04:39.000Z
from dataclasses import dataclass from reinvent_scoring.scoring.diversity_filters.reinvent_core.diversity_filter_parameters import \ DiversityFilterParameters from reinvent_scoring.scoring.scoring_function_parameters import ScoringFunctionParameters from running_modes.configurations.reinforcement_learning.inception_configuration import InceptionConfiguration from running_modes.configurations.reinforcement_learning.reinforcement_learning_configuration import \ ReinforcementLearningConfiguration @dataclass class ReinforcementLearningComponents: """This class holds the necessary configuration components to run RL""" reinforcement_learning: ReinforcementLearningConfiguration scoring_function: ScoringFunctionParameters diversity_filter: DiversityFilterParameters inception: InceptionConfiguration
43.894737
110
0.878897
71
834
10.070423
0.464789
0.117483
0.053147
0.072727
0.142657
0.142657
0
0
0
0
0
0
0.089928
834
18
111
46.333333
0.942029
0.077938
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.384615
0
0.769231
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
1
0
1
0
1
0
0
4
857da36d74564cf9aa71e473d4fb8329787ebfcc
59
py
Python
hoi3tools/config.py
jDan735/hoi3tools
0bf8ba6b75e03e04733eecc09fc4c1c7c69a9447
[ "MIT" ]
null
null
null
hoi3tools/config.py
jDan735/hoi3tools
0bf8ba6b75e03e04733eecc09fc4c1c7c69a9447
[ "MIT" ]
null
null
null
hoi3tools/config.py
jDan735/hoi3tools
0bf8ba6b75e03e04733eecc09fc4c1c7c69a9447
[ "MIT" ]
null
null
null
dirpath = "I:\\games\\HoI3 Remastered\\history\\provinces"
29.5
58
0.728814
7
59
6.142857
1
0
0
0
0
0
0
0
0
0
0
0.018182
0.067797
59
1
59
59
0.763636
0
0
0
0
0
0.779661
0.508475
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
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
857f466842692bbbd88553c11ec4b35e6eef61ee
82
py
Python
lor_deckcodes/__init__.py
Rafalonso/LoRDeckCodesPython
42b59090d7aa2a7818917e999a4361dff104ab92
[ "MIT" ]
16
2019-10-19T22:02:48.000Z
2022-02-24T14:07:37.000Z
lor_deckcodes/__init__.py
mfrr/LoRDeckCodesPython
3e3e4014da1be1d3e16cee431678f0042a678460
[ "MIT" ]
9
2020-04-26T14:08:08.000Z
2021-08-25T15:53:35.000Z
lor_deckcodes/__init__.py
mfrr/LoRDeckCodesPython
3e3e4014da1be1d3e16cee431678f0042a678460
[ "MIT" ]
9
2019-10-30T21:16:03.000Z
2021-08-25T15:41:14.000Z
name = "lor_deckcodes" from lor_deckcodes.models import LoRDeck, CardCodeAndCount
27.333333
58
0.841463
10
82
6.7
0.8
0.358209
0
0
0
0
0
0
0
0
0
0
0.097561
82
2
59
41
0.905405
0
0
0
0
0
0.158537
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
85c49c913427b26d9207926ed407065125bfe9c0
50,825
py
Python
sdk/cwl/tests/test_submit.py
tomclegg/arvados
138eedbea2658ef397c7a58ce48d6f06077ba140
[ "Apache-2.0" ]
null
null
null
sdk/cwl/tests/test_submit.py
tomclegg/arvados
138eedbea2658ef397c7a58ce48d6f06077ba140
[ "Apache-2.0" ]
null
null
null
sdk/cwl/tests/test_submit.py
tomclegg/arvados
138eedbea2658ef397c7a58ce48d6f06077ba140
[ "Apache-2.0" ]
null
null
null
import copy import cStringIO import functools import hashlib import json import logging import mock import sys import unittest import arvados import arvados.collection import arvados_cwl import arvados_cwl.runner import arvados.keep from .matcher import JsonDiffMatcher from .mock_discovery import get_rootDesc import ruamel.yaml as yaml _rootDesc = None def stubs(func): @functools.wraps(func) @mock.patch("arvados.commands.keepdocker.list_images_in_arv") @mock.patch("arvados.collection.KeepClient") @mock.patch("arvados.keep.KeepClient") @mock.patch("arvados.events.subscribe") def wrapped(self, events, keep_client1, keep_client2, keepdocker, *args, **kwargs): class Stubs: pass stubs = Stubs() stubs.events = events stubs.keepdocker = keepdocker def putstub(p, **kwargs): return "%s+%i" % (hashlib.md5(p).hexdigest(), len(p)) keep_client1().put.side_effect = putstub keep_client1.put.side_effect = putstub keep_client2().put.side_effect = putstub keep_client2.put.side_effect = putstub stubs.keep_client = keep_client2 stubs.keepdocker.return_value = [("zzzzz-4zz18-zzzzzzzzzzzzzz3", "")] stubs.fake_user_uuid = "zzzzz-tpzed-zzzzzzzzzzzzzzz" stubs.api = mock.MagicMock() stubs.api._rootDesc = get_rootDesc() stubs.api.users().current().execute.return_value = { "uuid": stubs.fake_user_uuid, } stubs.api.collections().list().execute.return_value = {"items": []} stubs.api.collections().create().execute.side_effect = ({ "uuid": "zzzzz-4zz18-zzzzzzzzzzzzzz1", "portable_data_hash": "99999999999999999999999999999991+99", "manifest_text": "" }, { "uuid": "zzzzz-4zz18-zzzzzzzzzzzzzz2", "portable_data_hash": "99999999999999999999999999999992+99", "manifest_text": "./tool 00000000000000000000000000000000+0 0:0:submit_tool.cwl 0:0:blub.txt" }, { "uuid": "zzzzz-4zz18-zzzzzzzzzzzzzz4", "portable_data_hash": "99999999999999999999999999999994+99", "manifest_text": "" }, { "uuid": "zzzzz-4zz18-zzzzzzzzzzzzzz5", "portable_data_hash": "99999999999999999999999999999995+99", "manifest_text": "" }, { "uuid": "zzzzz-4zz18-zzzzzzzzzzzzzz6", "portable_data_hash": "99999999999999999999999999999996+99", "manifest_text": "" } ) stubs.api.collections().get().execute.return_value = { "portable_data_hash": "99999999999999999999999999999993+99", "manifest_text": "./tool 00000000000000000000000000000000+0 0:0:submit_tool.cwl 0:0:blub.txt"} stubs.expect_job_uuid = "zzzzz-8i9sb-zzzzzzzzzzzzzzz" stubs.api.jobs().create().execute.return_value = { "uuid": stubs.expect_job_uuid, "state": "Queued", } stubs.expect_container_request_uuid = "zzzzz-xvhdp-zzzzzzzzzzzzzzz" stubs.api.container_requests().create().execute.return_value = { "uuid": stubs.expect_container_request_uuid, "container_uuid": "zzzzz-dz642-zzzzzzzzzzzzzzz", "state": "Queued" } stubs.expect_pipeline_template_uuid = "zzzzz-d1hrv-zzzzzzzzzzzzzzz" stubs.api.pipeline_templates().create().execute.return_value = { "uuid": stubs.expect_pipeline_template_uuid, } stubs.expect_job_spec = { 'runtime_constraints': { 'docker_image': 'arvados/jobs:'+arvados_cwl.__version__, 'min_ram_mb_per_node': 1024 }, 'script_parameters': { 'x': { 'basename': 'blorp.txt', 'location': 'keep:99999999999999999999999999999992+99/blorp.txt', 'class': 'File' }, 'y': { 'basename': '99999999999999999999999999999998+99', 'location': 'keep:99999999999999999999999999999998+99', 'class': 'Directory' }, 'z': { 'basename': 'anonymous', "listing": [{ "basename": "renamed.txt", "class": "File", "location": "keep:99999999999999999999999999999998+99/file1.txt" }], 'class': 'Directory' }, 'cwl:tool': '99999999999999999999999999999994+99/workflow.cwl#main' }, 'repository': 'arvados', 'script_version': 'master', 'minimum_script_version': '570509ab4d2ef93d870fd2b1f2eab178afb1bad9', 'script': 'cwl-runner' } stubs.pipeline_component = stubs.expect_job_spec.copy() stubs.expect_pipeline_instance = { 'name': 'submit_wf.cwl', 'state': 'RunningOnServer', 'owner_uuid': None, "components": { "cwl-runner": { 'runtime_constraints': {'docker_image': 'arvados/jobs:'+arvados_cwl.__version__, 'min_ram_mb_per_node': 1024}, 'script_parameters': { 'y': {"value": {'basename': '99999999999999999999999999999998+99', 'location': 'keep:99999999999999999999999999999998+99', 'class': 'Directory'}}, 'x': {"value": {'basename': 'blorp.txt', 'class': 'File', 'location': 'keep:99999999999999999999999999999992+99/blorp.txt'}}, 'z': {"value": {'basename': 'anonymous', 'class': 'Directory', 'listing': [ {'basename': 'renamed.txt', 'class': 'File', 'location': 'keep:99999999999999999999999999999998+99/file1.txt'} ]}}, 'cwl:tool': '99999999999999999999999999999994+99/workflow.cwl#main', 'arv:enable_reuse': True, 'arv:on_error': 'continue' }, 'repository': 'arvados', 'script_version': 'master', 'minimum_script_version': '570509ab4d2ef93d870fd2b1f2eab178afb1bad9', 'script': 'cwl-runner', 'job': {'state': 'Queued', 'uuid': 'zzzzz-8i9sb-zzzzzzzzzzzzzzz'} } } } stubs.pipeline_create = copy.deepcopy(stubs.expect_pipeline_instance) stubs.expect_pipeline_uuid = "zzzzz-d1hrv-zzzzzzzzzzzzzzz" stubs.pipeline_create["uuid"] = stubs.expect_pipeline_uuid stubs.pipeline_with_job = copy.deepcopy(stubs.pipeline_create) stubs.pipeline_with_job["components"]["cwl-runner"]["job"] = { "uuid": "zzzzz-8i9sb-zzzzzzzzzzzzzzz", "state": "Queued" } stubs.api.pipeline_instances().create().execute.return_value = stubs.pipeline_create stubs.api.pipeline_instances().get().execute.return_value = stubs.pipeline_with_job with open("tests/wf/submit_wf_packed.cwl") as f: expect_packed_workflow = yaml.round_trip_load(f) stubs.expect_container_spec = { 'priority': 1, 'mounts': { '/var/spool/cwl': { 'writable': True, 'kind': 'collection' }, '/var/lib/cwl/workflow.json': { 'content': expect_packed_workflow, 'kind': 'json' }, 'stdout': { 'path': '/var/spool/cwl/cwl.output.json', 'kind': 'file' }, '/var/lib/cwl/cwl.input.json': { 'kind': 'json', 'content': { 'y': {'basename': '99999999999999999999999999999998+99', 'location': 'keep:99999999999999999999999999999998+99', 'class': 'Directory'}, 'x': {'basename': u'blorp.txt', 'class': 'File', 'location': u'keep:99999999999999999999999999999992+99/blorp.txt'}, 'z': {'basename': 'anonymous', 'class': 'Directory', 'listing': [ {'basename': 'renamed.txt', 'class': 'File', 'location': 'keep:99999999999999999999999999999998+99/file1.txt'} ]} }, 'kind': 'json' } }, 'state': 'Committed', 'owner_uuid': None, 'command': ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', '--enable-reuse', '--on-error=continue', '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'], 'name': 'submit_wf.cwl', 'container_image': 'arvados/jobs:'+arvados_cwl.__version__, 'output_path': '/var/spool/cwl', 'cwd': '/var/spool/cwl', 'runtime_constraints': { 'API': True, 'vcpus': 1, 'ram': 1024*1024*1024 }, "properties": {} } stubs.expect_workflow_uuid = "zzzzz-7fd4e-zzzzzzzzzzzzzzz" stubs.api.workflows().create().execute.return_value = { "uuid": stubs.expect_workflow_uuid, } def update_mock(**kwargs): stubs.updated_uuid = kwargs.get('uuid') return mock.DEFAULT stubs.api.workflows().update.side_effect = update_mock stubs.api.workflows().update().execute.side_effect = lambda **kwargs: { "uuid": stubs.updated_uuid, } return func(self, stubs, *args, **kwargs) return wrapped class TestSubmit(unittest.TestCase): @mock.patch("arvados_cwl.runner.arv_docker_get_image") @mock.patch("time.sleep") @stubs def test_submit(self, stubs, tm, arvdock): capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=jobs", "--debug", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) stubs.api.collections().create.assert_has_calls([ mock.call(), mock.call(body=JsonDiffMatcher({ 'manifest_text': '. 5bcc9fe8f8d5992e6cf418dc7ce4dbb3+16 0:16:blub.txt\n', 'replication_desired': None, 'name': 'submit_tool.cwl dependencies', }), ensure_unique_name=True), mock.call().execute(num_retries=4), mock.call(body=JsonDiffMatcher({ 'manifest_text': '. 979af1245a12a1fed634d4222473bfdc+16 0:16:blorp.txt\n', 'replication_desired': None, 'name': 'submit_wf.cwl input', }), ensure_unique_name=True), mock.call().execute(num_retries=4)]) arvdock.assert_has_calls([ mock.call(stubs.api, {"class": "DockerRequirement", "dockerPull": "debian:8"}, True, None), mock.call(stubs.api, {'dockerPull': 'arvados/jobs:'+arvados_cwl.__version__}, True, None) ]) expect_pipeline = copy.deepcopy(stubs.expect_pipeline_instance) stubs.api.pipeline_instances().create.assert_called_with( body=JsonDiffMatcher(expect_pipeline)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_pipeline_uuid + '\n') @mock.patch("time.sleep") @stubs def test_submit_no_reuse(self, stubs, tm): capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=jobs", "--debug", "--disable-reuse", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) expect_pipeline = copy.deepcopy(stubs.expect_pipeline_instance) expect_pipeline["components"]["cwl-runner"]["script_parameters"]["arv:enable_reuse"] = {"value": False} stubs.api.pipeline_instances().create.assert_called_with( body=JsonDiffMatcher(expect_pipeline)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_pipeline_uuid + '\n') @mock.patch("time.sleep") @stubs def test_submit_on_error(self, stubs, tm): capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=jobs", "--debug", "--on-error=stop", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) expect_pipeline = copy.deepcopy(stubs.expect_pipeline_instance) expect_pipeline["components"]["cwl-runner"]["script_parameters"]["arv:on_error"] = "stop" stubs.api.pipeline_instances().create.assert_called_with( body=JsonDiffMatcher(expect_pipeline)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_pipeline_uuid + '\n') @mock.patch("time.sleep") @stubs def test_submit_runner_ram(self, stubs, tm): capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--submit", "--no-wait", "--debug", "--submit-runner-ram=2048", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) expect_pipeline = copy.deepcopy(stubs.expect_pipeline_instance) expect_pipeline["components"]["cwl-runner"]["runtime_constraints"]["min_ram_mb_per_node"] = 2048 stubs.api.pipeline_instances().create.assert_called_with( body=JsonDiffMatcher(expect_pipeline)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_pipeline_uuid + '\n') @mock.patch("time.sleep") @stubs def test_submit_invalid_runner_ram(self, stubs, tm): capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--submit", "--no-wait", "--debug", "--submit-runner-ram=-2048", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 1) @mock.patch("time.sleep") @stubs def test_submit_output_name(self, stubs, tm): output_name = "test_output_name" capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--submit", "--no-wait", "--debug", "--output-name", output_name, "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) expect_pipeline = copy.deepcopy(stubs.expect_pipeline_instance) expect_pipeline["components"]["cwl-runner"]["script_parameters"]["arv:output_name"] = output_name stubs.api.pipeline_instances().create.assert_called_with( body=JsonDiffMatcher(expect_pipeline)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_pipeline_uuid + '\n') @mock.patch("time.sleep") @stubs def test_submit_pipeline_name(self, stubs, tm): capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--submit", "--no-wait", "--debug", "--name=hello job 123", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) expect_pipeline = copy.deepcopy(stubs.expect_pipeline_instance) expect_pipeline["name"] = "hello job 123" stubs.api.pipeline_instances().create.assert_called_with( body=JsonDiffMatcher(expect_pipeline)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_pipeline_uuid + '\n') @mock.patch("time.sleep") @stubs def test_submit_output_tags(self, stubs, tm): output_tags = "tag0,tag1,tag2" capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--submit", "--no-wait", "--debug", "--output-tags", output_tags, "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) expect_pipeline = copy.deepcopy(stubs.expect_pipeline_instance) expect_pipeline["components"]["cwl-runner"]["script_parameters"]["arv:output_tags"] = output_tags stubs.api.pipeline_instances().create.assert_called_with( body=JsonDiffMatcher(expect_pipeline)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_pipeline_uuid + '\n') @mock.patch("time.sleep") @stubs def test_submit_with_project_uuid(self, stubs, tm): project_uuid = 'zzzzz-j7d0g-zzzzzzzzzzzzzzz' exited = arvados_cwl.main( ["--submit", "--no-wait", "--project-uuid", project_uuid, "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], sys.stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) expect_pipeline = copy.deepcopy(stubs.expect_pipeline_instance) expect_pipeline["owner_uuid"] = project_uuid stubs.api.pipeline_instances().create.assert_called_with( body=JsonDiffMatcher(expect_pipeline)) @stubs def test_submit_container(self, stubs): capture_stdout = cStringIO.StringIO() try: exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=containers", "--debug", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api, keep_client=stubs.keep_client) self.assertEqual(exited, 0) except: logging.exception("") stubs.api.collections().create.assert_has_calls([ mock.call(), mock.call(body=JsonDiffMatcher({ 'manifest_text': '. 5bcc9fe8f8d5992e6cf418dc7ce4dbb3+16 0:16:blub.txt\n', 'replication_desired': None, 'name': 'submit_tool.cwl dependencies', }), ensure_unique_name=True), mock.call().execute(num_retries=4), mock.call(body=JsonDiffMatcher({ 'manifest_text': '. 979af1245a12a1fed634d4222473bfdc+16 0:16:blorp.txt\n', 'replication_desired': None, 'name': 'submit_wf.cwl input', }), ensure_unique_name=True), mock.call().execute(num_retries=4)]) expect_container = copy.deepcopy(stubs.expect_container_spec) stubs.api.container_requests().create.assert_called_with( body=JsonDiffMatcher(expect_container)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_container_request_uuid + '\n') @stubs def test_submit_container_no_reuse(self, stubs): capture_stdout = cStringIO.StringIO() try: exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=containers", "--debug", "--disable-reuse", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api, keep_client=stubs.keep_client) self.assertEqual(exited, 0) except: logging.exception("") expect_container = copy.deepcopy(stubs.expect_container_spec) expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', '--disable-reuse', '--on-error=continue', '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] stubs.api.container_requests().create.assert_called_with( body=JsonDiffMatcher(expect_container)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_container_request_uuid + '\n') @stubs def test_submit_container_on_error(self, stubs): capture_stdout = cStringIO.StringIO() try: exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=containers", "--debug", "--on-error=stop", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api, keep_client=stubs.keep_client) self.assertEqual(exited, 0) except: logging.exception("") expect_container = copy.deepcopy(stubs.expect_container_spec) expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', '--enable-reuse', '--on-error=stop', '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] stubs.api.container_requests().create.assert_called_with( body=JsonDiffMatcher(expect_container)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_container_request_uuid + '\n') @stubs def test_submit_container_output_name(self, stubs): output_name = "test_output_name" capture_stdout = cStringIO.StringIO() try: exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=containers", "--debug", "--output-name", output_name, "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api, keep_client=stubs.keep_client) self.assertEqual(exited, 0) except: logging.exception("") expect_container = copy.deepcopy(stubs.expect_container_spec) expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', "--output-name="+output_name, '--enable-reuse', '--on-error=continue', '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] expect_container["output_name"] = output_name stubs.api.container_requests().create.assert_called_with( body=JsonDiffMatcher(expect_container)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_container_request_uuid + '\n') @stubs def test_submit_container_output_tags(self, stubs): output_tags = "tag0,tag1,tag2" capture_stdout = cStringIO.StringIO() try: exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=containers", "--debug", "--output-tags", output_tags, "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api, keep_client=stubs.keep_client) self.assertEqual(exited, 0) except: logging.exception("") expect_container = copy.deepcopy(stubs.expect_container_spec) expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', "--output-tags="+output_tags, '--enable-reuse', '--on-error=continue', '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] stubs.api.container_requests().create.assert_called_with( body=JsonDiffMatcher(expect_container)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_container_request_uuid + '\n') @stubs def test_submit_container_runner_ram(self, stubs): capture_stdout = cStringIO.StringIO() try: exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=containers", "--debug", "--submit-runner-ram=2048", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api, keep_client=stubs.keep_client) self.assertEqual(exited, 0) except: logging.exception("") expect_container = copy.deepcopy(stubs.expect_container_spec) expect_container["runtime_constraints"]["ram"] = 2048*1024*1024 stubs.api.container_requests().create.assert_called_with( body=JsonDiffMatcher(expect_container)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_container_request_uuid + '\n') @mock.patch("arvados.collection.CollectionReader") @mock.patch("time.sleep") @stubs def test_submit_file_keepref(self, stubs, tm, collectionReader): capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=containers", "--debug", "tests/wf/submit_keepref_wf.cwl"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) @mock.patch("arvados.collection.CollectionReader") @mock.patch("time.sleep") @stubs def test_submit_keepref(self, stubs, tm, reader): capture_stdout = cStringIO.StringIO() with open("tests/wf/expect_arvworkflow.cwl") as f: reader().open().__enter__().read.return_value = f.read() exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=containers", "--debug", "keep:99999999999999999999999999999994+99/expect_arvworkflow.cwl#main", "-x", "XxX"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) expect_container = { 'priority': 1, 'mounts': { '/var/spool/cwl': { 'writable': True, 'kind': 'collection' }, 'stdout': { 'path': '/var/spool/cwl/cwl.output.json', 'kind': 'file' }, '/var/lib/cwl/workflow': { 'portable_data_hash': '99999999999999999999999999999994+99', 'kind': 'collection' }, '/var/lib/cwl/cwl.input.json': { 'content': { 'x': 'XxX' }, 'kind': 'json' } }, 'state': 'Committed', 'owner_uuid': None, 'output_path': '/var/spool/cwl', 'name': 'expect_arvworkflow.cwl#main', 'container_image': 'arvados/jobs:'+arvados_cwl.__version__, 'command': ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', '--enable-reuse', '--on-error=continue', '/var/lib/cwl/workflow/expect_arvworkflow.cwl#main', '/var/lib/cwl/cwl.input.json'], 'cwd': '/var/spool/cwl', 'runtime_constraints': { 'API': True, 'vcpus': 1, 'ram': 1073741824 }, "properties": {} } stubs.api.container_requests().create.assert_called_with( body=JsonDiffMatcher(expect_container)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_container_request_uuid + '\n') @mock.patch("arvados.collection.CollectionReader") @mock.patch("time.sleep") @stubs def test_submit_jobs_keepref(self, stubs, tm, reader): capture_stdout = cStringIO.StringIO() with open("tests/wf/expect_arvworkflow.cwl") as f: reader().open().__enter__().read.return_value = f.read() exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=jobs", "--debug", "keep:99999999999999999999999999999994+99/expect_arvworkflow.cwl#main", "-x", "XxX"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) expect_pipeline = copy.deepcopy(stubs.expect_pipeline_instance) expect_pipeline["components"]["cwl-runner"]["script_parameters"]["x"] = "XxX" del expect_pipeline["components"]["cwl-runner"]["script_parameters"]["y"] del expect_pipeline["components"]["cwl-runner"]["script_parameters"]["z"] expect_pipeline["components"]["cwl-runner"]["script_parameters"]["cwl:tool"] = "99999999999999999999999999999994+99/expect_arvworkflow.cwl#main" expect_pipeline["name"] = "expect_arvworkflow.cwl#main" stubs.api.pipeline_instances().create.assert_called_with( body=JsonDiffMatcher(expect_pipeline)) @mock.patch("time.sleep") @stubs def test_submit_arvworkflow(self, stubs, tm): capture_stdout = cStringIO.StringIO() with open("tests/wf/expect_arvworkflow.cwl") as f: stubs.api.workflows().get().execute.return_value = {"definition": f.read(), "name": "a test workflow"} exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=containers", "--debug", "962eh-7fd4e-gkbzl62qqtfig37", "-x", "XxX"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) expect_container = { 'priority': 1, 'mounts': { '/var/spool/cwl': { 'writable': True, 'kind': 'collection' }, 'stdout': { 'path': '/var/spool/cwl/cwl.output.json', 'kind': 'file' }, '/var/lib/cwl/workflow.json': { 'kind': 'json', 'content': { 'cwlVersion': 'v1.0', '$graph': [ { 'id': '#main', 'inputs': [ {'type': 'string', 'id': '#main/x'} ], 'steps': [ {'in': [{'source': '#main/x', 'id': '#main/step1/x'}], 'run': '#submit_tool.cwl', 'id': '#main/step1', 'out': []} ], 'class': 'Workflow', 'outputs': [] }, { 'inputs': [ { 'inputBinding': {'position': 1}, 'type': 'string', 'id': '#submit_tool.cwl/x'} ], 'requirements': [ {'dockerPull': 'debian:8', 'class': 'DockerRequirement'} ], 'id': '#submit_tool.cwl', 'outputs': [], 'baseCommand': 'cat', 'class': 'CommandLineTool' } ] } }, '/var/lib/cwl/cwl.input.json': { 'content': { 'x': 'XxX' }, 'kind': 'json' } }, 'state': 'Committed', 'owner_uuid': None, 'output_path': '/var/spool/cwl', 'name': 'a test workflow', 'container_image': 'arvados/jobs:'+arvados_cwl.__version__, 'command': ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', '--enable-reuse', '--on-error=continue', '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'], 'cwd': '/var/spool/cwl', 'runtime_constraints': { 'API': True, 'vcpus': 1, 'ram': 1073741824 }, "properties": { "template_uuid": "962eh-7fd4e-gkbzl62qqtfig37" } } stubs.api.container_requests().create.assert_called_with( body=JsonDiffMatcher(expect_container)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_container_request_uuid + '\n') @stubs def test_submit_container_name(self, stubs): capture_stdout = cStringIO.StringIO() try: exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=containers", "--debug", "--name=hello container 123", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api, keep_client=stubs.keep_client) self.assertEqual(exited, 0) except: logging.exception("") expect_container = copy.deepcopy(stubs.expect_container_spec) expect_container["name"] = "hello container 123" stubs.api.container_requests().create.assert_called_with( body=JsonDiffMatcher(expect_container)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_container_request_uuid + '\n') @stubs def test_submit_job_runner_image(self, stubs): capture_stdout = cStringIO.StringIO() try: exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=jobs", "--debug", "--submit-runner-image=arvados/jobs:123", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api, keep_client=stubs.keep_client) self.assertEqual(exited, 0) except: logging.exception("") stubs.expect_pipeline_instance["components"]["cwl-runner"]["runtime_constraints"]["docker_image"] = "arvados/jobs:123" expect_pipeline = copy.deepcopy(stubs.expect_pipeline_instance) stubs.api.pipeline_instances().create.assert_called_with( body=JsonDiffMatcher(expect_pipeline)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_pipeline_uuid + '\n') @stubs def test_submit_container_runner_image(self, stubs): capture_stdout = cStringIO.StringIO() try: exited = arvados_cwl.main( ["--submit", "--no-wait", "--api=containers", "--debug", "--submit-runner-image=arvados/jobs:123", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api, keep_client=stubs.keep_client) self.assertEqual(exited, 0) except: logging.exception("") stubs.expect_container_spec["container_image"] = "arvados/jobs:123" expect_container = copy.deepcopy(stubs.expect_container_spec) stubs.api.container_requests().create.assert_called_with( body=JsonDiffMatcher(expect_container)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_container_request_uuid + '\n') @mock.patch("arvados.commands.keepdocker.find_one_image_hash") @mock.patch("cwltool.docker.get_image") @mock.patch("arvados.api") def test_arvados_jobs_image(self, api, get_image, find_one_image_hash): arvrunner = mock.MagicMock() arvrunner.project_uuid = "" api.return_value = mock.MagicMock() arvrunner.api = api.return_value arvrunner.api.links().list().execute.side_effect = ({"items": [{"created_at": "", "head_uuid": "zzzzz-4zz18-zzzzzzzzzzzzzzb", "link_class": "docker_image_repo+tag", "name": "arvados/jobs:"+arvados_cwl.__version__, "owner_uuid": "", "properties": {"image_timestamp": ""}}], "items_available": 1, "offset": 0}, {"items": [{"created_at": "", "head_uuid": "", "link_class": "docker_image_hash", "name": "123456", "owner_uuid": "", "properties": {"image_timestamp": ""}}], "items_available": 1, "offset": 0} ) find_one_image_hash.return_value = "123456" arvrunner.api.collections().list().execute.side_effect = ({"items": [{"uuid": "zzzzz-4zz18-zzzzzzzzzzzzzzb", "owner_uuid": "", "manifest_text": "", "properties": "" }], "items_available": 1, "offset": 0},) arvrunner.api.collections().create().execute.return_value = {"uuid": ""} self.assertEqual("arvados/jobs:"+arvados_cwl.__version__, arvados_cwl.runner.arvados_jobs_image(arvrunner, "arvados/jobs:"+arvados_cwl.__version__)) class TestCreateTemplate(unittest.TestCase): existing_template_uuid = "zzzzz-d1hrv-validworkfloyml" def _adjust_script_params(self, expect_component): expect_component['script_parameters']['x'] = { 'dataclass': 'File', 'required': True, 'type': 'File', 'value': '99999999999999999999999999999992+99/blorp.txt', } expect_component['script_parameters']['y'] = { 'dataclass': 'Collection', 'required': True, 'type': 'Directory', 'value': '99999999999999999999999999999998+99', } expect_component['script_parameters']['z'] = { 'dataclass': 'Collection', 'required': True, 'type': 'Directory', } @stubs def test_create(self, stubs): project_uuid = 'zzzzz-j7d0g-zzzzzzzzzzzzzzz' capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--create-workflow", "--debug", "--api=jobs", "--project-uuid", project_uuid, "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) stubs.api.pipeline_instances().create.refute_called() stubs.api.jobs().create.refute_called() expect_component = copy.deepcopy(stubs.expect_job_spec) self._adjust_script_params(expect_component) expect_template = { "components": { "submit_wf.cwl": expect_component, }, "name": "submit_wf.cwl", "owner_uuid": project_uuid, } stubs.api.pipeline_templates().create.assert_called_with( body=JsonDiffMatcher(expect_template), ensure_unique_name=True) self.assertEqual(capture_stdout.getvalue(), stubs.expect_pipeline_template_uuid + '\n') @stubs def test_create_name(self, stubs): project_uuid = 'zzzzz-j7d0g-zzzzzzzzzzzzzzz' capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--create-workflow", "--debug", "--project-uuid", project_uuid, "--api=jobs", "--name", "testing 123", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) stubs.api.pipeline_instances().create.refute_called() stubs.api.jobs().create.refute_called() expect_component = copy.deepcopy(stubs.expect_job_spec) self._adjust_script_params(expect_component) expect_template = { "components": { "testing 123": expect_component, }, "name": "testing 123", "owner_uuid": project_uuid, } stubs.api.pipeline_templates().create.assert_called_with( body=JsonDiffMatcher(expect_template), ensure_unique_name=True) self.assertEqual(capture_stdout.getvalue(), stubs.expect_pipeline_template_uuid + '\n') @stubs def test_update_name(self, stubs): project_uuid = 'zzzzz-j7d0g-zzzzzzzzzzzzzzz' capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--update-workflow", self.existing_template_uuid, "--debug", "--project-uuid", project_uuid, "--api=jobs", "--name", "testing 123", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) stubs.api.pipeline_instances().create.refute_called() stubs.api.jobs().create.refute_called() expect_component = copy.deepcopy(stubs.expect_job_spec) self._adjust_script_params(expect_component) expect_template = { "components": { "testing 123": expect_component, }, "name": "testing 123", "owner_uuid": project_uuid, } stubs.api.pipeline_templates().create.refute_called() stubs.api.pipeline_templates().update.assert_called_with( body=JsonDiffMatcher(expect_template), uuid=self.existing_template_uuid) self.assertEqual(capture_stdout.getvalue(), self.existing_template_uuid + '\n') class TestCreateWorkflow(unittest.TestCase): existing_workflow_uuid = "zzzzz-7fd4e-validworkfloyml" expect_workflow = open("tests/wf/expect_packed.cwl").read() @stubs def test_create(self, stubs): project_uuid = 'zzzzz-j7d0g-zzzzzzzzzzzzzzz' capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--create-workflow", "--debug", "--api=containers", "--project-uuid", project_uuid, "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) stubs.api.pipeline_templates().create.refute_called() stubs.api.container_requests().create.refute_called() body = { "workflow": { "owner_uuid": project_uuid, "name": "submit_wf.cwl", "description": "", "definition": self.expect_workflow, } } stubs.api.workflows().create.assert_called_with( body=JsonDiffMatcher(body)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_workflow_uuid + '\n') @stubs def test_create_name(self, stubs): project_uuid = 'zzzzz-j7d0g-zzzzzzzzzzzzzzz' capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--create-workflow", "--debug", "--api=containers", "--project-uuid", project_uuid, "--name", "testing 123", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) stubs.api.pipeline_templates().create.refute_called() stubs.api.container_requests().create.refute_called() body = { "workflow": { "owner_uuid": project_uuid, "name": "testing 123", "description": "", "definition": self.expect_workflow, } } stubs.api.workflows().create.assert_called_with( body=JsonDiffMatcher(body)) self.assertEqual(capture_stdout.getvalue(), stubs.expect_workflow_uuid + '\n') @stubs def test_incompatible_api(self, stubs): capture_stderr = cStringIO.StringIO() logging.getLogger('arvados.cwl-runner').addHandler( logging.StreamHandler(capture_stderr)) exited = arvados_cwl.main( ["--update-workflow", self.existing_workflow_uuid, "--api=jobs", "--debug", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], sys.stderr, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 1) self.assertRegexpMatches( capture_stderr.getvalue(), "--update-workflow arg '{}' uses 'containers' API, but --api='jobs' specified".format(self.existing_workflow_uuid)) @stubs def test_update(self, stubs): capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--update-workflow", self.existing_workflow_uuid, "--debug", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) body = { "workflow": { "name": "submit_wf.cwl", "description": "", "definition": self.expect_workflow, } } stubs.api.workflows().update.assert_called_with( uuid=self.existing_workflow_uuid, body=JsonDiffMatcher(body)) self.assertEqual(capture_stdout.getvalue(), self.existing_workflow_uuid + '\n') @stubs def test_update_name(self, stubs): capture_stdout = cStringIO.StringIO() exited = arvados_cwl.main( ["--update-workflow", self.existing_workflow_uuid, "--debug", "--name", "testing 123", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], capture_stdout, sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) body = { "workflow": { "name": "testing 123", "description": "", "definition": self.expect_workflow, } } stubs.api.workflows().update.assert_called_with( uuid=self.existing_workflow_uuid, body=JsonDiffMatcher(body)) self.assertEqual(capture_stdout.getvalue(), self.existing_workflow_uuid + '\n') class TestTemplateInputs(unittest.TestCase): expect_template = { "components": { "inputs_test.cwl": { 'runtime_constraints': { 'docker_image': 'arvados/jobs:'+arvados_cwl.__version__, 'min_ram_mb_per_node': 1024 }, 'script_parameters': { 'cwl:tool': '99999999999999999999999999999992+99/workflow.cwl#main', 'optionalFloatInput': None, 'fileInput': { 'type': 'File', 'dataclass': 'File', 'required': True, 'title': "It's a file; we expect to find some characters in it.", 'description': 'If there were anything further to say, it would be said here,\nor here.' }, 'floatInput': { 'type': 'float', 'dataclass': 'number', 'required': True, 'title': 'Floats like a duck', 'default': 0.1, 'value': 0.1, }, 'optionalFloatInput': { 'type': ['null', 'float'], 'dataclass': 'number', 'required': False, }, 'boolInput': { 'type': 'boolean', 'dataclass': 'boolean', 'required': True, 'title': 'True or false?', }, }, 'repository': 'arvados', 'script_version': 'master', 'minimum_script_version': '570509ab4d2ef93d870fd2b1f2eab178afb1bad9', 'script': 'cwl-runner', }, }, "name": "inputs_test.cwl", } @stubs def test_inputs_empty(self, stubs): exited = arvados_cwl.main( ["--create-template", "tests/wf/inputs_test.cwl", "tests/order/empty_order.json"], cStringIO.StringIO(), sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) stubs.api.pipeline_templates().create.assert_called_with( body=JsonDiffMatcher(self.expect_template), ensure_unique_name=True) @stubs def test_inputs(self, stubs): exited = arvados_cwl.main( ["--create-template", "tests/wf/inputs_test.cwl", "tests/order/inputs_test_order.json"], cStringIO.StringIO(), sys.stderr, api_client=stubs.api) self.assertEqual(exited, 0) expect_template = copy.deepcopy(self.expect_template) params = expect_template[ "components"]["inputs_test.cwl"]["script_parameters"] params["fileInput"]["value"] = '99999999999999999999999999999992+99/blorp.txt' params["cwl:tool"] = '99999999999999999999999999999994+99/workflow.cwl#main' params["floatInput"]["value"] = 1.234 params["boolInput"]["value"] = True stubs.api.pipeline_templates().create.assert_called_with( body=JsonDiffMatcher(expect_template), ensure_unique_name=True)
42.854132
170
0.548411
4,744
50,825
5.649452
0.074831
0.027163
0.013955
0.02388
0.795157
0.748069
0.727921
0.701802
0.694004
0.684079
0
0.04354
0.318997
50,825
1,185
171
42.890295
0.730787
0
0
0.619417
0
0
0.245903
0.102194
0
0
0
0
0.08835
1
0.036893
false
0.000971
0.016505
0.000971
0.066019
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a43013b7968759fcfdbb2461db7345083080107c
355
py
Python
gquant/cuindicator/__init__.py
miguelangel/gQuant
0bb5e392ce703d58baaf60668006e9a1f71d64ce
[ "Apache-2.0" ]
2
2021-08-13T03:02:22.000Z
2022-03-13T15:00:01.000Z
gquant/cuindicator/__init__.py
miguelangel/gQuant
0bb5e392ce703d58baaf60668006e9a1f71d64ce
[ "Apache-2.0" ]
3
2020-10-06T16:07:34.000Z
2021-04-28T20:30:14.000Z
gquant/cuindicator/__init__.py
miguelangel/gQuant
0bb5e392ce703d58baaf60668006e9a1f71d64ce
[ "Apache-2.0" ]
null
null
null
from .ewm import Ewm from .indicator import * # noqa: F403 from .pewm import PEwm from .rolling import Rolling from .util import (shift, diff, substract, summation, multiply, division, scale, cumsum) __all__ = ["Ewm", "PEwm", "Rolling", "shift", "diff", "substract", "summation", "multiply", "division", "scale", "cumsum"]
35.5
66
0.642254
40
355
5.6
0.45
0.080357
0.160714
0.241071
0.482143
0.482143
0.482143
0.482143
0
0
0
0.010714
0.211268
355
9
67
39.444444
0.789286
0.028169
0
0
0
0
0.198251
0
0
0
0
0
0
1
0
false
0
0.625
0
0.625
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
a4469c6f07cac8a79a9455db3229c5a1f7adc714
298
py
Python
commercia/offers/config.py
commoncode/economica
3de2415d7f0e0e81cc6ac7a054839daeb1ba6748
[ "IJG" ]
2
2015-09-14T10:13:39.000Z
2015-09-14T12:53:45.000Z
commercia/offers/config.py
commoncode/economica
3de2415d7f0e0e81cc6ac7a054839daeb1ba6748
[ "IJG" ]
null
null
null
commercia/offers/config.py
commoncode/economica
3de2415d7f0e0e81cc6ac7a054839daeb1ba6748
[ "IJG" ]
null
null
null
from django.apps import AppConfig from django.utils.importlib import import_module class OffersConfig(AppConfig): name = 'commercia.offers' verbose_name = "Offers" def ready(self): import_module('commercia.offers.collections') import_module('commercia.offers.signals')
29.8
53
0.741611
34
298
6.382353
0.558824
0.165899
0.193548
0.248848
0
0
0
0
0
0
0
0
0.16443
298
10
54
29.8
0.871486
0
0
0
0
0
0.247492
0.173913
0
0
0
0
0
1
0.125
false
0
0.5
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
a44b6adc9aad47b1e7a576d3052c852674c75f05
1,194
py
Python
backend/core/service/column_generator/faker_generator/person.py
pecimuth/synthia
a54265ca6f772959d395de789bfe16bf054d97ad
[ "MIT" ]
null
null
null
backend/core/service/column_generator/faker_generator/person.py
pecimuth/synthia
a54265ca6f772959d395de789bfe16bf054d97ad
[ "MIT" ]
null
null
null
backend/core/service/column_generator/faker_generator/person.py
pecimuth/synthia
a54265ca6f772959d395de789bfe16bf054d97ad
[ "MIT" ]
null
null
null
from typing import Optional from core.service.column_generator.base import GeneratorCategory, RegisteredGenerator from core.service.column_generator.faker_generator.base import FakerGenerator from core.service.types import Types class FakerPersonGenerator(FakerGenerator[str]): category = GeneratorCategory.PERSON @classmethod def only_for_type(cls) -> Optional[Types]: return Types.STRING class FirstNameGenerator(RegisteredGenerator, FakerPersonGenerator): """Generate human first names.""" provider = 'first_name' class LastNameGenerator(RegisteredGenerator, FakerPersonGenerator): """Generate human last names.""" provider = 'last_name' class PhoneNumberGenerator(RegisteredGenerator, FakerPersonGenerator): """Generate phone numbers in various formats.""" provider = 'phone_number' class EmailGenerator(RegisteredGenerator, FakerPersonGenerator): provider = 'email' class UserNameGenerator(RegisteredGenerator, FakerPersonGenerator): """Generate realistic user names.""" provider = 'user_name' class NameGenerator(RegisteredGenerator, FakerPersonGenerator): """Generate human names.""" provider = 'name'
24.875
85
0.770519
108
1,194
8.435185
0.453704
0.256861
0.257958
0.17124
0.065862
0
0
0
0
0
0
0
0.143216
1,194
47
86
25.404255
0.890518
0.125628
0
0
0
0
0.048134
0
0
0
0
0
0
1
0.047619
false
0
0.190476
0.047619
0.952381
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
a45fe0bfc676cd6c402ac0c0888147ca834c13e5
267
py
Python
pelican_events/signals/__init__.py
rackerlabs/pelican-events
cde148d095b7cf6fa1b4ba33ea750a8636ea9090
[ "Apache-2.0" ]
null
null
null
pelican_events/signals/__init__.py
rackerlabs/pelican-events
cde148d095b7cf6fa1b4ba33ea750a8636ea9090
[ "Apache-2.0" ]
null
null
null
pelican_events/signals/__init__.py
rackerlabs/pelican-events
cde148d095b7cf6fa1b4ba33ea750a8636ea9090
[ "Apache-2.0" ]
null
null
null
from blinker import signal event_generator_init = signal('event_generator_init') event_generator_finalized = signal('event_generator_finalized') event_generator_preread = signal('event_generator_preread') event_generator_context = signal('event_generator_context')
33.375
63
0.857678
32
267
6.65625
0.3125
0.525822
0.469484
0.225352
0
0
0
0
0
0
0
0
0.067416
267
7
64
38.142857
0.855422
0
0
0
0
0
0.343396
0.267925
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a46141210cf1b5c50a5a3f99d060f6c9921406ef
534
py
Python
generator.py
ashishrao7/motion_contrast_3D
1914dc6df8555f6720f445e9476aa759e423cc8c
[ "MIT" ]
null
null
null
generator.py
ashishrao7/motion_contrast_3D
1914dc6df8555f6720f445e9476aa759e423cc8c
[ "MIT" ]
1
2020-03-06T16:40:47.000Z
2020-03-06T18:33:47.000Z
generator.py
ashishrao7/motion_contrast_3D
1914dc6df8555f6720f445e9476aa759e423cc8c
[ "MIT" ]
1
2022-02-26T21:34:34.000Z
2022-02-26T21:34:34.000Z
import pattern def main(): #line = pattern.Line(260, 346, 60, 1) #line.generate_moving_line('vertical') #line.generate_moving_line('horizontal') #line.generate_moving_line('tl_diag') #line.generate_moving_line('bl_diag') wave_image = pattern.wave_2d(260, 346, 30, 10, 1) wave_image.generate_moving_wave('vertical', 'square') wave_image.generate_moving_wave('vertical', 'sine') #sine_image.generate_moving_sine('horizontal') print('generation done') if __name__=='__main__': main()
28.105263
57
0.700375
70
534
4.928571
0.4
0.284058
0.208696
0.255072
0.202899
0.202899
0
0
0
0
0
0.046667
0.157303
534
19
58
28.105263
0.72
0.428839
0
0
1
0
0.163333
0
0
0
0
0
0
1
0.125
false
0
0.125
0
0.25
0.125
0
0
0
null
1
1
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
0
0
0
4
a49b9a3bf89e8e52c235f972667f207df7eaa41d
333
py
Python
pyslab/core/locations.py
benhorsburgh/pyslab
d495ca87110f1ac0fb1b49df49024f590bbb6c5c
[ "MIT" ]
null
null
null
pyslab/core/locations.py
benhorsburgh/pyslab
d495ca87110f1ac0fb1b49df49024f590bbb6c5c
[ "MIT" ]
null
null
null
pyslab/core/locations.py
benhorsburgh/pyslab
d495ca87110f1ac0fb1b49df49024f590bbb6c5c
[ "MIT" ]
null
null
null
from typing import List from .types import Cell def box_id(cell: Cell) -> int: return (cell.row // 3) * 3 + (cell.column // 3) def row_house_ids() -> List[int]: return list(range(9)) def column_house_ids() -> List[int]: return list(range(10, 18)) def box_house_ids() -> List[int]: return list(range(19, 27))
16.65
51
0.633634
54
333
3.777778
0.407407
0.176471
0.176471
0.220588
0.441176
0.441176
0.441176
0
0
0
0
0.045283
0.204204
333
19
52
17.526316
0.724528
0
0
0
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0.2
0.4
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
f10129be0e71ad8c5f65e28b28ca3e29eeb39bb1
94
py
Python
client/console/task_cs.py
eonuallain/dcomp
49e65b8576ef663b8566566000b24f634ddf33aa
[ "MIT" ]
null
null
null
client/console/task_cs.py
eonuallain/dcomp
49e65b8576ef663b8566566000b24f634ddf33aa
[ "MIT" ]
null
null
null
client/console/task_cs.py
eonuallain/dcomp
49e65b8576ef663b8566566000b24f634ddf33aa
[ "MIT" ]
null
null
null
from task_base import TaskBase class TaskCS(TaskBase): def run(self): print(self)
13.428571
30
0.691489
13
94
4.923077
0.846154
0
0
0
0
0
0
0
0
0
0
0
0.223404
94
6
31
15.666667
0.876712
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
f10d7af7d4bebbf857ae84697ac625165c495280
1,349
py
Python
livia/input/FrameInputDecorator.py
sing-group/livia-core
5f0db6ea0e1791703719c49f0cbd0f3e559d42a6
[ "MIT" ]
null
null
null
livia/input/FrameInputDecorator.py
sing-group/livia-core
5f0db6ea0e1791703719c49f0cbd0f3e559d42a6
[ "MIT" ]
null
null
null
livia/input/FrameInputDecorator.py
sing-group/livia-core
5f0db6ea0e1791703719c49f0cbd0f3e559d42a6
[ "MIT" ]
null
null
null
from abc import ABC, abstractmethod from typing import Tuple, Optional from numpy import ndarray from livia.input.FrameInput import FrameInput class FrameInputDecorator(FrameInput, ABC): def __init__(self, decorated_input: FrameInput): super().__init__() self._decorated_input: FrameInput = decorated_input @property def decorated_input(self) -> FrameInput: return self._decorated_input def play(self) -> None: self._decorated_input.play() def get_current_frame(self) -> Optional[ndarray]: return self._decorated_input.get_current_frame() def get_current_frame_index(self) -> Optional[int]: return self._decorated_input.get_current_frame_index() def next_frame(self) -> Tuple[Optional[int], Optional[ndarray]]: next_frame = self._decorated_input.next_frame() return self._manipulate_frame(next_frame) def get_fps(self) -> int: return self._decorated_input.get_fps() def get_frame_size(self) -> Tuple[int, int]: return self._decorated_input.get_frame_size() @abstractmethod def _manipulate_frame(self, frame: Tuple[Optional[int], Optional[ndarray]]) -> \ Tuple[Optional[int], Optional[ndarray]]: raise NotImplementedError() def close(self) -> None: self._decorated_input.close()
29.326087
84
0.704225
160
1,349
5.60625
0.21875
0.187291
0.200669
0.133779
0.39019
0.157191
0.086957
0
0
0
0
0
0.196442
1,349
45
85
29.977778
0.827491
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.133333
0.166667
0.7
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
f1176eb07a1e4cf0bcd5287f3a762e2084246342
126
py
Python
WebMirror/management/rss_parser_funcs/feed_parse_extractExpandablefemaleBlogspotCom.py
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
[ "BSD-3-Clause" ]
193
2016-08-02T22:04:35.000Z
2022-03-09T20:45:41.000Z
WebMirror/management/rss_parser_funcs/feed_parse_extractExpandablefemaleBlogspotCom.py
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
[ "BSD-3-Clause" ]
533
2016-08-23T20:48:23.000Z
2022-03-28T15:55:13.000Z
WebMirror/management/rss_parser_funcs/feed_parse_extractExpandablefemaleBlogspotCom.py
rrosajp/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
[ "BSD-3-Clause" ]
19
2015-08-13T18:01:08.000Z
2021-07-12T17:13:09.000Z
def extractExpandablefemaleBlogspotCom(item): ''' DISABLED Parser for 'expandablefemale.blogspot.com' ''' return None
15.75
45
0.753968
11
126
8.636364
1
0
0
0
0
0
0
0
0
0
0
0
0.142857
126
8
46
15.75
0.87963
0.420635
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
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
1
0
0
0
0
1
0
0
4
f125b78a417e8406008b5e709431f7cbdc42edc8
719
py
Python
src/app/user/models.py
jamshidyerzakov/fastapi-blog
26828556482b1b5824781b321558776b5cd882ea
[ "MIT" ]
null
null
null
src/app/user/models.py
jamshidyerzakov/fastapi-blog
26828556482b1b5824781b321558776b5cd882ea
[ "MIT" ]
null
null
null
src/app/user/models.py
jamshidyerzakov/fastapi-blog
26828556482b1b5824781b321558776b5cd882ea
[ "MIT" ]
null
null
null
from tortoise import fields, models class User(models.Model): """ Model user """ username = fields.CharField(max_length=100, unique=True) password = fields.CharField(max_length=100) email = fields.CharField(max_length=100, unique=True) first_name = fields.CharField(max_length=100) last_name = fields.CharField(max_length=100, null=True) image = fields.CharField(max_length=100, null=True) bio = fields.TextField(null=True) date_join = fields.DatetimeField(auto_now_add=True) last_login = fields.DatetimeField(null=True) is_active = fields.BooleanField(default=False) is_staff = fields.BooleanField(default=False) is_superuser = fields.BooleanField(default=False)
37.842105
60
0.742698
94
719
5.521277
0.404255
0.17341
0.208092
0.277457
0.520231
0.344894
0.277457
0
0
0
0
0.029364
0.147427
719
18
61
39.944444
0.817292
0.013908
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.071429
0.071429
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
4
f14302a761653c284ef0e574997e05e61cb21611
610
py
Python
nanoblocks/base/nanoblocks_class.py
ipazc/nanoblocks
d7433b60029e4bcda4c2c802c3ff05c53d7b220a
[ "MIT" ]
3
2021-03-16T23:59:37.000Z
2021-12-11T13:52:46.000Z
nanoblocks/base/nanoblocks_class.py
ipazc/nanoblocks
d7433b60029e4bcda4c2c802c3ff05c53d7b220a
[ "MIT" ]
1
2021-04-02T14:11:02.000Z
2021-06-16T00:03:33.000Z
nanoblocks/base/nanoblocks_class.py
ipazc/nanoblocks
d7433b60029e4bcda4c2c802c3ff05c53d7b220a
[ "MIT" ]
null
null
null
class NanoblocksClass: """ Global class that should be inherited by any Nanoblocks class that requires access to the network. """ def __init__(self, nano_network): self._nano_network = nano_network @property def network(self): return self._nano_network @property def node_backend(self): return self.network.node_backend @property def work_server(self): return self.network.work_server @property def accounts(self): return self.network.accounts @property def blocks(self): return self.network.blocks
21.034483
102
0.663934
72
610
5.430556
0.375
0.140665
0.179028
0.214834
0
0
0
0
0
0
0
0
0.265574
610
28
103
21.785714
0.872768
0.160656
0
0.277778
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.277778
0.666667
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
f15869078cd0dd7a1fe8a9ab38ea4519aefe6a92
195
py
Python
pypcl/__init__.py
r9y9/pypcl
0528aacb8cfa1ceea2cbb3c7e3f20a1f066f23bf
[ "MIT" ]
null
null
null
pypcl/__init__.py
r9y9/pypcl
0528aacb8cfa1ceea2cbb3c7e3f20a1f066f23bf
[ "MIT" ]
null
null
null
pypcl/__init__.py
r9y9/pypcl
0528aacb8cfa1ceea2cbb3c7e3f20a1f066f23bf
[ "MIT" ]
null
null
null
# coding: utf-8 from __future__ import division, print_function, absolute_import import pkg_resources __version__ = pkg_resources.get_distribution('pypcl').version from pypcl.common import *
19.5
64
0.815385
25
195
5.84
0.68
0.164384
0
0
0
0
0
0
0
0
0
0.00578
0.112821
195
9
65
21.666667
0.83815
0.066667
0
0
0
0
0.027778
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
f15fe7f3ec30388e1673de1ba753c2248eade0f8
225
py
Python
loggers.py
IanVzs/WindWhisper
742bc3e08d3edbd3ad9112c3149c0ad291b5e762
[ "MIT" ]
2
2020-11-18T11:01:24.000Z
2020-11-19T16:10:59.000Z
loggers.py
IanVzs/WindWhisper
742bc3e08d3edbd3ad9112c3149c0ad291b5e762
[ "MIT" ]
2
2020-09-10T06:20:28.000Z
2020-11-18T10:45:19.000Z
loggers.py
IanVzs/WindWhisper
742bc3e08d3edbd3ad9112c3149c0ad291b5e762
[ "MIT" ]
null
null
null
import logging import logging.config logging.config.fileConfig('logging.ini') # create wea logger weatherLog = logging.getLogger('weatherLog') debugLog = logging.getLogger('debugLog') scheLog = logging.getLogger('scheLog')
22.5
44
0.791111
25
225
7.12
0.48
0.269663
0
0
0
0
0
0
0
0
0
0
0.088889
225
9
45
25
0.868293
0.075556
0
0
0
0
0.174757
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
f1853efb3d6e89cce0865bf2ee1ca56c64894ddc
141
py
Python
Chapter_8/regexFileSearch.py
TravisLeeWolf/ATBS
9075eabaa0a788f58435eff9e0df488806a0770b
[ "Apache-2.0" ]
null
null
null
Chapter_8/regexFileSearch.py
TravisLeeWolf/ATBS
9075eabaa0a788f58435eff9e0df488806a0770b
[ "Apache-2.0" ]
null
null
null
Chapter_8/regexFileSearch.py
TravisLeeWolf/ATBS
9075eabaa0a788f58435eff9e0df488806a0770b
[ "Apache-2.0" ]
null
null
null
#! python3 # regexFileSearch.py - Opens all .txt files in a folder and searches for any matching line # The results are printed to the screen
47
90
0.77305
23
141
4.73913
0.956522
0
0
0
0
0
0
0
0
0
0
0.008621
0.177305
141
3
91
47
0.931034
0.964539
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
74c22070f55c72054e96386544f10505ca9f792a
14,052
py
Python
solver.py
mahaitongdae/Approximate-dynamic-Programming
f03f9469f5018c55f06cf8fea2d5f629abc4078b
[ "Apache-2.0" ]
7
2021-05-29T13:09:19.000Z
2022-03-27T03:40:08.000Z
solver.py
molumitu/Approximate-Dynamic-Programming
02dcc56ef7c20cbd4211f4eec6eb9acd86208f16
[ "Apache-2.0" ]
2
2021-05-25T03:58:52.000Z
2021-12-14T18:58:01.000Z
solver.py
molumitu/Approximate-Dynamic-Programming
02dcc56ef7c20cbd4211f4eec6eb9acd86208f16
[ "Apache-2.0" ]
5
2021-04-23T19:25:41.000Z
2021-12-06T12:52:36.000Z
""" <Reinforcement Learning and Control>(Year 2020) by Shengbo Eben Li @ Intelligent Driving Lab, Tsinghua University OCP example for lane keeping problem in a circle road [Method] Model predictive control """ from casadi import * from config import DynamicsConfig import math from dynamics import VehicleDynamics import matplotlib.pyplot as plt class Solver(DynamicsConfig): """ NLP solver for nonlinear model predictive control with Casadi. """ def __init__(self): self._sol_dic = {'ipopt.print_level': 0, 'ipopt.sb': 'yes', 'print_time': 0} if self.tire_model == 'Fiala': self.X_init = [0.0, 0.0, self.psi_init, 0.0, self.u, 0.0] self.zero = [0., 0., 0., 0., 0., 0.] self.U_LOWER = [- math.pi / 9, -10] self.U_UPPER = [math.pi / 9, 10] else: self.X_init = [0.0, 0.0, 0.1, 0.0, 0.0] self.zero = [0., 0., 0., 0., 0.] self.U_LOWER = [- math.pi / 9] self.U_UPPER = [math.pi / 9] self.x_last = 0 self.dynamics = VehicleDynamics() super(Solver, self).__init__() def dynamics(self,x, u): x1 = [0.0, 0.0, 0.0, 0.0, 0.0] x1[0] = x[0] + self.Ts * (self.u * sin(x[2]) + x[1] * cos(x[2])), x1[1] = x[1] + self.Ts * (-self.D * self.F_z1 * sin( self.C * arctan(self.B * (-u[0] + (x[1] + self.a * x[3]) / self.u))) * cos(u[0]) - self.D * self.F_z2 * sin( self.C * arctan(self.B * ((x[1] - self.b * x[3]) / self.u))) / self.m - self.u * x[3]), x1[2] = x[2] + self.Ts * (x[3]), x1[3] = x[3] + self.Ts * (self.a * (-self.D * self.F_z1 * sin( self.C * arctan(self.B * (-u[0] + (x[1] + self.a * x[3]) / self.u)))) * cos(u[0]) - self.b * (-self.D * self.F_z2 * sin( self.C * arctan(self.B * ((x[1] - self.b * x[3]) / self.u)))) / self.I_zz), x1[4] = x[4] + self.Ts * (self.u * cos(x[2]) - x[1] * sin(x[2])) return x1 def openLoopMpcSolver(self, x_init, predict_steps): """ Solver of nonlinear MPC Parameters ---------- x_init: list input state for MPC. predict_steps: int steps of predict horizon. Returns ---------- state: np.array shape: [predict_steps+1, state_dimension] state trajectory of MPC in the whole predict horizon. control: np.array shape: [predict_steps, control_dimension] control signal of MPC in the whole predict horizon. """ x = SX.sym('x', self.DYNAMICS_DIM) u = SX.sym('u', self.ACTION_DIM) # discrete dynamic model self.f = vertcat( x[0] + self.Ts * (self.u * sin(x[2]) + x[1] * cos(x[2])), x[1] + self.Ts * ((-self.D * self.F_z1 * sin( self.C * arctan(self.B * (-u[0] + (x[1] + self.a * x[3]) / self.u))) * cos(u[0]) - self.D * self.F_z2 * sin( self.C * arctan(self.B * ((x[1] - self.b * x[3]) / self.u)))) / self.m - self.u * x[3]), x[2] + self.Ts * (x[3]), x[3] + self.Ts * ((self.a * (-self.D * self.F_z1 * sin( self.C * arctan(self.B * (-u[0] + (x[1] + self.a * x[3]) / self.u)))) * cos(u[0]) - self.b * (-self.D * self.F_z2 * sin( self.C * arctan(self.B * ((x[1] - self.b * x[3]) / self.u))))) / self.I_zz), x[4] + self.Ts * (self.u * cos(x[2]) - x[1] * sin(x[2])) ) # Create solver instance self.F = Function("F", [x, u], [self.f]) # Create empty NLP w = [] lbw = [] ubw = [] lbg = [] ubg = [] G = [] J = 0 # Initial conditions Xk = MX.sym('X0', self.DYNAMICS_DIM) w += [Xk] lbw += x_init ubw += x_init for k in range(1, predict_steps + 1): # Local control Uname = 'U' + str(k - 1) Uk = MX.sym(Uname, self.ACTION_DIM) w += [Uk] lbw += self.U_LOWER ubw += self.U_UPPER Fk = self.F(Xk, Uk) Xname = 'X' + str(k) Xk = MX.sym(Xname, self.DYNAMICS_DIM) # Dynamic Constriants G += [Fk - Xk] lbg += self.zero ubg += self.zero w += [Xk] if self.tire_model == 'Fiala': lbw += [-inf, -20, -pi, -20, 50, -inf] ubw += [inf, 20, pi, 20, 0, inf] else: lbw += [-inf, -20, -pi, -20, -inf] ubw += [inf, 20, pi, 20, inf] F_cost = Function('F_cost', [x, u], [0.1 * (x[0] - self.a_curve * sin(self.k_curve * x[4])) ** 2 + 0.1 * (x[2] - arctan( self.a_curve * self.k_curve * cos(self.k_curve * x[4]))) ** 2 + 0.001 * u[0] ** 2]) J += F_cost(w[k * 2], w[k * 2 - 1]) # Create NLP solver nlp = dict(f=J, g=vertcat(*G), x=vertcat(*w)) S = nlpsol('S', 'ipopt', nlp, self._sol_dic) # Solve NLP r = S(lbx=lbw, ubx=ubw, x0=0, lbg=lbg, ubg=ubg) # print(r['x']) state_all = np.array(r['x']) state = np.zeros([predict_steps, self.DYNAMICS_DIM]) control = np.zeros([predict_steps, self.ACTION_DIM]) nt = self.DYNAMICS_DIM + self.ACTION_DIM # total variable per step # save trajectories for i in range(predict_steps): state[i] = state_all[nt * i: nt * i + nt - 1].reshape(-1) control[i] = state_all[nt * i + nt - 1] return state, control def mpcSolver(self, x_init, predict_steps): """ Solver of nonlinear MPC Parameters ---------- x_init: list input state for MPC. predict_steps: int steps of predict horizon. Returns ---------- state: np.array shape: [predict_steps+1, state_dimension] state trajectory of MPC in the whole predict horizon. control: np.array shape: [predict_steps, control_dimension] control signal of MPC in the whole predict horizon. """ tire_model = self.tire_model if tire_model == 'Fiala': DYNAMICS_DIM = 6 ACTION_DIM = 2 else: DYNAMICS_DIM = 5 ACTION_DIM = 1 x = SX.sym('x', DYNAMICS_DIM) u = SX.sym('u', ACTION_DIM) # Create solver instance if self.tire_model == 'Fiala': self.f_d = vertcat( x[0] + self.Ts * (x[4] * sin(x[2]) + x[1] * cos(x[2])), # y : lateral position x[1] + self.Ts * (((- self.k1 * tan(- u[0] + arctan((x[1] + self.a * x[3]) / x[4])) * ( pow(self.k1 * tan(- u[0] + arctan((x[1] + self.a * x[3]) / x[4])), 2) / ( 27 * pow(self.D * self.F_z1, 2)) - self.k1 * fabs( tan(- u[0] + arctan((x[1] + self.a * x[3]) / x[4]))) / ( 3 * self.D * self.F_z1) + 1)) * cos(u[0]) - self.k2 * tan( arctan((x[1] - self.b * x[3]) / x[4])) * ( pow(self.k2 * tan(arctan((x[1] - self.b * x[3]) / x[4])), 2) / ( 27 * pow(self.D * self.F_z2, 2)) - self.k2 * fabs(tan( arctan((x[1] - self.b * x[3]) / x[4]))) / ( 3 * self.D * self.F_z2) + 1)) / self.m - x[4] * x[3]), # v_y : lateral speed x[2] + self.Ts * (x[3]), # psi : heading angle x[3] + self.Ts * ((self.a * (- self.k1 * tan(- u[0] + arctan((x[1] + self.a * x[3]) / x[4])) * ( pow(self.k1 * tan(- u[0] + arctan((x[1] + self.a * x[3]) / x[4])), 2) / ( 27 * pow(self.D * self.F_z1, 2)) - self.k1 * fabs( tan(- u[0] + arctan((x[1] + self.a * x[3]) / x[4]))) / ( 3 * self.D * self.F_z1) + 1)) * cos(u[0]) - self.b * ( - self.k2 * tan(arctan((x[1] - self.b * x[3]) / x[4])) * ( pow(self.k2 * tan(arctan((x[1] - self.b * x[3]) / x[4])), 2) / ( 27 * pow(self.D * self.F_z2, 2)) - self.k2 * fabs(tan( arctan((x[1] - self.b * x[3]) / x[4]))) / ( 3 * self.D * self.F_z2) + 1))) / self.I_zz), # r : yaw rate x[4] + self.Ts * ( u[1] + x[2] * x[4] - (- self.k1 * tan(- u[0] + arctan((x[1] + self.a * x[3]) / x[4])) * ( pow(self.k1 * tan(- u[0] + arctan((x[1] + self.a * x[3]) / x[4])), 2) / ( 27 * pow(self.D * self.F_z1, 2)) - self.k1 * fabs( tan(- u[0] + arctan((x[1] + self.a * x[3]) / x[4]))) / ( 3 * self.D * self.F_z1) + 1)) * sin(u[0]) / self.m), # v_x : longitudinal speed x[5] + self.Ts * (x[4]) # x : longitudinal position ) self.F = Function("F", [x, u], [self.f_d]) elif self.tire_model == 'Pacejka': # discrete dynamic model self.f = vertcat( x[0] + self.Ts * (self.u * sin(x[2]) + x[1] * cos(x[2])), x[1] + self.Ts * ((-self.D * self.F_z1 * sin( self.C * arctan(self.B * (-u[0] + (x[1] + self.a * x[3]) / self.u))) * cos(u[0]) - self.D * self.F_z2 * sin( self.C * arctan(self.B * ((x[1] - self.b * x[3]) / self.u)))) / self.m - self.u * x[3]), x[2] + self.Ts * (x[3]), x[3] + self.Ts * ((self.a * (-self.D * self.F_z1 * sin( self.C * arctan(self.B * (-u[0] + (x[1] + self.a * x[3]) / self.u)))) * cos(u[0]) - self.b * (-self.D * self.F_z2 * sin( self.C * arctan(self.B * ((x[1] - self.b * x[3]) / self.u))))) / self.I_zz), x[4] + self.Ts * (self.u * cos(x[2]) - x[1] * sin(x[2])) ) # todo:retreve self.F = Function("F", [x, u], [self.f]) elif self.tire_model == 'Linear': # linear model self.f = vertcat( x[0] + self.Ts * (self.u * sin(x[2]) + x[1] * cos(x[2])), x[1] + self.Ts * ((-self.k1*(-u[0] + (x[1] + self.a * x[3]) / self.u) * cos(u[0]) + -self.k2*((x[1] - self.b * x[3]) / self.u)) / self.m - self.u * x[3]), x[2] + self.Ts * (x[3]), x[3] + self.Ts * (self.a * (-self.D * self.F_z1 * sin( self.C * arctan(self.B * (-u[0] + (x[1] + self.a * x[3]) / self.u)))) * cos(u[0]) - self.b * (-self.D * self.F_z2 * sin( self.C * arctan(self.B * ((x[1] - self.b * x[3]) / self.u)))) / self.I_zz), x[4] + self.Ts * (self.u * cos(x[2]) - x[1] * sin(x[2])) ) self.F = Function("F", [x, u], [self.f]) # Create empty NLP w = [] lbw = [] ubw = [] lbg = [] ubg = [] G = [] J = 0 # Initial conditions Xk = MX.sym('X0', DYNAMICS_DIM) w += [Xk] lbw += x_init ubw += x_init for k in range(1, predict_steps + 1): # Local control Uname = 'U' + str(k - 1) Uk = MX.sym(Uname, ACTION_DIM) w += [Uk] lbw += self.U_LOWER ubw += self.U_UPPER # Gk = self.G_f(Xk,Uk) Fk = self.F(Xk, Uk) Xname = 'X' + str(k) Xk = MX.sym(Xname, DYNAMICS_DIM) # Dynamic Constriants G += [Fk - Xk] lbg += self.zero ubg += self.zero w += [Xk] if self.tire_model == 'Fiala': lbw += [-inf, -20, -pi, -20, 0, -inf] ubw += [inf, 20, pi, 20, 50, inf] else: lbw += [-inf, -20, -pi, -20, -inf] ubw += [inf, 20, pi, 20, inf] # Cost function if tire_model == 'Fiala': F_cost = Function('F_cost', [x, u], [6 * (x[0]) ** 2 + 0.2 * (x[4] - self.u) ** 2 + 80 * u[0] ** 2 + 0.3 * u[1] ** 2]) else: F_cost = Function('F_cost', [x, u], [1 * (x[0]) ** 2 + 1 * (x[2]) ** 2 + 1 * u[0] ** 2]) J += F_cost(w[k * 2], w[k * 2 - 1]) # J += F_cost(w[k * 3 - 1], w[k * 3 - 2]) # Create NLP solver nlp = dict(f=J, g=vertcat(*G), x=vertcat(*w)) S = nlpsol('S', 'ipopt', nlp, self._sol_dic) # Solve NLP r = S(lbx=lbw, ubx=ubw, x0=0, lbg=lbg, ubg=ubg) # print(r['x']) state_all = np.array(r['x']) state = np.zeros([predict_steps, DYNAMICS_DIM]) control = np.zeros([predict_steps, ACTION_DIM]) nt = DYNAMICS_DIM + ACTION_DIM # total variable per step # save trajectories for i in range(predict_steps): state[i] = state_all[nt * i: nt * i + DYNAMICS_DIM].reshape(-1) control[i] = state_all[nt * i + DYNAMICS_DIM: nt * (i + 1)].reshape(-1) return state, control
42.841463
117
0.401651
1,939
14,052
2.836514
0.09902
0.016727
0.039273
0.043636
0.779818
0.772545
0.739273
0.702727
0.683091
0.677455
0
0.052083
0.4193
14,052
327
118
42.972477
0.621936
0.119627
0
0.572727
0
0
0.010703
0
0
0
0
0.003058
0
1
0.018182
false
0
0.022727
0
0.059091
0.004545
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
74c8161d264242d98d46d2da4f36997f20676662
221
py
Python
forumdemo/comment/admin.py
lamdba0602/forumdemo
82c6223d6b6d7fb3bac049e342d3048a5117a2b7
[ "Apache-2.0" ]
null
null
null
forumdemo/comment/admin.py
lamdba0602/forumdemo
82c6223d6b6d7fb3bac049e342d3048a5117a2b7
[ "Apache-2.0" ]
null
null
null
forumdemo/comment/admin.py
lamdba0602/forumdemo
82c6223d6b6d7fb3bac049e342d3048a5117a2b7
[ "Apache-2.0" ]
null
null
null
from django.contrib import admin from .models import Comment class CommentAdmin(admin.ModelAdmin): list_display = ("article", "to_comment", "status", "owner", "content") admin.site.register(Comment, CommentAdmin)
22.1
74
0.751131
26
221
6.307692
0.730769
0
0
0
0
0
0
0
0
0
0
0
0.122172
221
9
75
24.555556
0.845361
0
0
0
0
0
0.158371
0
0
0
0
0
0
1
0
false
0
0.4
0
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
74f429bdcef0e346f018f9944dbfda03ff4cdefe
46
py
Python
pyexcel_xlsbr/_version.py
chfw/pyexcel-xlsbr
647ff05890ec4430750e5670309a407bb1b0f113
[ "BSD-3-Clause" ]
null
null
null
pyexcel_xlsbr/_version.py
chfw/pyexcel-xlsbr
647ff05890ec4430750e5670309a407bb1b0f113
[ "BSD-3-Clause" ]
2
2018-08-03T16:58:14.000Z
2019-03-18T01:17:54.000Z
pyexcel_xlsbr/_version.py
chfw/pyexcel-xlsbr
647ff05890ec4430750e5670309a407bb1b0f113
[ "BSD-3-Clause" ]
1
2021-10-31T01:49:17.000Z
2021-10-31T01:49:17.000Z
__version__ = "0.5.0-rc1" __author__ = "C.W."
15.333333
25
0.630435
8
46
2.625
0.875
0
0
0
0
0
0
0
0
0
0
0.1
0.130435
46
2
26
23
0.425
0
0
0
0
0
0.282609
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
2d01e05dc6e480caa3d5fc12d39cf0eb0ea2ab3d
227
py
Python
discordbot/src/commands/url.py
matrix2113/discord-masz
1aeeefde61fc9828e31290330208fc8254f6daf4
[ "MIT" ]
null
null
null
discordbot/src/commands/url.py
matrix2113/discord-masz
1aeeefde61fc9828e31290330208fc8254f6daf4
[ "MIT" ]
null
null
null
discordbot/src/commands/url.py
matrix2113/discord-masz
1aeeefde61fc9828e31290330208fc8254f6daf4
[ "MIT" ]
null
null
null
import os from discord.ext import commands @commands.command(help="Displays the URL MASZ is deployed on.") async def url(ctx): await ctx.send(f"MASZ is deployed on: {os.getenv('META_SERVICE_BASE_URL', 'URL not set.')}")
25.222222
96
0.731278
38
227
4.289474
0.710526
0.07362
0.171779
0.196319
0
0
0
0
0
0
0
0
0.140969
227
8
97
28.375
0.835897
0
0
0
0
0
0.484582
0.154185
0
0
0
0
0
1
0
true
0
0.4
0
0.4
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
1
0
1
0
0
0
0
4
2d044fb1a3dfdc1b6f94ddb3bf895f789b7701bb
101
py
Python
nunaserver/nunaserver/wsgi.py
UAVCAN/nunaweb
3dc59d5385716a2ad8581807a80d52489ffae8e8
[ "MIT" ]
3
2021-02-10T22:56:35.000Z
2021-09-11T12:43:27.000Z
nunaserver/nunaserver/wsgi.py
UAVCAN/nunaweb
3dc59d5385716a2ad8581807a80d52489ffae8e8
[ "MIT" ]
33
2021-02-03T20:01:19.000Z
2021-10-05T10:24:08.000Z
nunaserver/nunaserver/wsgi.py
bbworld1/nunaweb
3dc59d5385716a2ad8581807a80d52489ffae8e8
[ "MIT" ]
1
2021-02-20T08:29:08.000Z
2021-02-20T08:29:08.000Z
""" WSGI entrypoint. """ from nunaserver.server import app if __name__ == "__main__": app.run()
12.625
33
0.663366
12
101
4.916667
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.178218
101
7
34
14.428571
0.710843
0.158416
0
0
0
0
0.103896
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
2d3e7531cb32703d410fe2028a3adbe23d3c323b
46
py
Python
Config/config.py
Sijiu/Xbill
b4f18d3e7db3b17ed4ccddc6a8971c25931428eb
[ "MIT" ]
14
2020-03-15T13:40:02.000Z
2021-06-15T18:04:08.000Z
Config/config.py
Sijiu/Xbill
b4f18d3e7db3b17ed4ccddc6a8971c25931428eb
[ "MIT" ]
1
2020-05-24T13:14:46.000Z
2020-05-24T13:14:46.000Z
Config/config.py
Sijiu/Xbill
b4f18d3e7db3b17ed4ccddc6a8971c25931428eb
[ "MIT" ]
3
2020-05-05T00:23:36.000Z
2021-06-10T01:18:16.000Z
START_DAY_OF_MONTH = 1 BUDGET_OF_MONTH = 7000
15.333333
22
0.826087
9
46
3.666667
0.777778
0.424242
0
0
0
0
0
0
0
0
0
0.125
0.130435
46
2
23
23
0.7
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
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
4
74206bf2f636404d8c89a5457b75486928776b53
196
py
Python
crawler/driver/__init__.py
bmwant/wcbot
c6dd30c593f2a4c37ac02394c46c513062e2ee3f
[ "MIT" ]
null
null
null
crawler/driver/__init__.py
bmwant/wcbot
c6dd30c593f2a4c37ac02394c46c513062e2ee3f
[ "MIT" ]
1
2020-04-29T23:35:21.000Z
2020-04-29T23:35:21.000Z
crawler/driver/__init__.py
bmwant/wcbot
c6dd30c593f2a4c37ac02394c46c513062e2ee3f
[ "MIT" ]
null
null
null
class BaseDriver(object): EXECUTABLE_PATH = None BINARY_PATH = None def __init__(self): self._driver = None @property def driver(self): return self._driver
15.076923
27
0.627551
22
196
5.227273
0.590909
0.13913
0
0
0
0
0
0
0
0
0
0
0.295918
196
12
28
16.333333
0.833333
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0.125
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
7428fb5c49423f5ded79cbc1edb63e3f2d8f66b4
995
py
Python
statement_renamer/readers/filename_reader.py
mkazin/StatementRenamer
ef03c71f0e627a15a4bba08e45bfa90ecacd28fc
[ "Apache-2.0" ]
null
null
null
statement_renamer/readers/filename_reader.py
mkazin/StatementRenamer
ef03c71f0e627a15a4bba08e45bfa90ecacd28fc
[ "Apache-2.0" ]
15
2018-05-01T12:48:30.000Z
2021-05-14T02:52:48.000Z
statement_renamer/readers/filename_reader.py
mkazin/StatementRenamer
ef03c71f0e627a15a4bba08e45bfa90ecacd28fc
[ "Apache-2.0" ]
1
2019-07-09T22:59:50.000Z
2019-07-09T22:59:50.000Z
from .reader import Reader class FilenameReader(Reader): def parse(self, fname): return fname # This is the contents of my old AmEx statement renamer, which # used the filename as the data source. # import os # import re # month_names = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', # 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] # path = './' # listing = os.listdir(path) # for infile in listing: # # print "current file is: " + infile # result = re.match("Statement_(\w+) (\d+).pdf", infile); # if (result): # month_number = month_names.index(result.group(1)) + 1 # new_name = 'AmExBlue_' + result.group(2) + '_' + str(month_number).zfill(2) + '.pdf' # if os.path.isfile(new_name): # print 'File [' + new_name + '] already exists. Ignoring [ ' + infile + ']' # continue # os.rename(infile, new_name) # print 'Renamed [' + infile + '] to : [' + new_name + ']' # # else: # # print ' (skipped ' + infile + ')'
27.638889
92
0.568844
124
995
4.467742
0.620968
0.063177
0.043321
0
0
0
0
0
0
0
0
0.005348
0.248241
995
35
93
28.428571
0.735294
0.837186
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
7436d343dd53757025641ec1f8b0deae1089f72e
645
py
Python
guiModule.py
xianc78/guiModule
5d2dc1e5a50db1b3c7adb40edacefe40496e29b8
[ "0BSD" ]
null
null
null
guiModule.py
xianc78/guiModule
5d2dc1e5a50db1b3c7adb40edacefe40496e29b8
[ "0BSD" ]
null
null
null
guiModule.py
xianc78/guiModule
5d2dc1e5a50db1b3c7adb40edacefe40496e29b8
[ "0BSD" ]
null
null
null
# Module for simple GUI functions. ONLY WORKS IN WINDOWS import ctypes def MessageBox(message, title): ctypes.windll.user32.MessageBoxA(0, message, title, 0) def YesNo(message, title): if ctypes.windll.user32.MessageBoxA(0, message, title, 4) == 6: return True else: return False def OkCancel(message, title): if ctypes.windll.user32.MessageBoxA(0, message, title, 1) == 1: return True else: return False def YesNoCancel(message, title): if ctypes.windll.user32.MessageBoxA(0, message, title, 3) == 6: return "Yes" elif ctypes.windll.user32.MessageBoxA(0, message, title, 3) == 7: return "No" else: return "Cancel"
25.8
66
0.717829
92
645
5.032609
0.391304
0.233261
0.194384
0.313175
0.669546
0.669546
0.548596
0.457883
0.362851
0.362851
0
0.04428
0.15969
645
25
67
25.8
0.809963
0.083721
0
0.35
0
0
0.018644
0
0
0
0
0
0
1
0.2
false
0
0.05
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
1
0
0
4
7494903f2fd57cdd2385fa8bf9f733b728d7cb92
30
py
Python
snakeplane/version.py
cpitts1/snakeplane
1b69a6b5695049f91272a1dd3389a6bcf0496b73
[ "Apache-2.0" ]
null
null
null
snakeplane/version.py
cpitts1/snakeplane
1b69a6b5695049f91272a1dd3389a6bcf0496b73
[ "Apache-2.0" ]
null
null
null
snakeplane/version.py
cpitts1/snakeplane
1b69a6b5695049f91272a1dd3389a6bcf0496b73
[ "Apache-2.0" ]
null
null
null
__version__ = "1.0.0-alpha20"
15
29
0.7
5
30
3.4
0.8
0
0
0
0
0
0
0
0
0
0
0.185185
0.1
30
1
30
30
0.444444
0
0
0
0
0
0.433333
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
749884d6ae7b51f08befe077d95461bec0522bb8
186
py
Python
md_cms/forms.py
tinpan-io/django-md-cms
f1488650891069cc5f3b41f509dcb8681a65cda3
[ "BSD-3-Clause" ]
12
2015-05-24T14:54:15.000Z
2022-02-09T03:17:37.000Z
md_cms/forms.py
tinpan-io/django-md-cms
f1488650891069cc5f3b41f509dcb8681a65cda3
[ "BSD-3-Clause" ]
1
2015-07-24T17:54:31.000Z
2015-07-24T21:08:53.000Z
md_cms/forms.py
tinpan-io/django-md-cms
f1488650891069cc5f3b41f509dcb8681a65cda3
[ "BSD-3-Clause" ]
1
2021-08-22T11:40:32.000Z
2021-08-22T11:40:32.000Z
from django import forms from pagedown.widgets import PagedownWidget class MdCMSForm(forms.Form): md_cms_textarea = forms.CharField( widget=PagedownWidget(), )
20.666667
44
0.709677
20
186
6.5
0.75
0
0
0
0
0
0
0
0
0
0
0
0.22043
186
8
45
23.25
0.896552
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
7775eb3b22f7a03ffbdb6818fd5396a6158c2f78
28
py
Python
Conceptos/variables.py
MiGueAJM9724/Python
436975a3ccef5a922afa7e3f14747322f2979e06
[ "Apache-2.0" ]
null
null
null
Conceptos/variables.py
MiGueAJM9724/Python
436975a3ccef5a922afa7e3f14747322f2979e06
[ "Apache-2.0" ]
null
null
null
Conceptos/variables.py
MiGueAJM9724/Python
436975a3ccef5a922afa7e3f14747322f2979e06
[ "Apache-2.0" ]
null
null
null
tutor = "codi" print(tutor)
9.333333
14
0.678571
4
28
4.75
0.75
0
0
0
0
0
0
0
0
0
0
0
0.142857
28
2
15
14
0.791667
0
0
0
0
0
0.142857
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
1
0
4
779c18c2b516a68d46093b76fcd67c1fb65a3cd2
89
py
Python
mentorprise/backend_dev/__init__.py
CS261-Group-17/Mentoring-Site
b0425ec967c3241561ab8eb65cce75a35f3e5814
[ "MIT" ]
null
null
null
mentorprise/backend_dev/__init__.py
CS261-Group-17/Mentoring-Site
b0425ec967c3241561ab8eb65cce75a35f3e5814
[ "MIT" ]
null
null
null
mentorprise/backend_dev/__init__.py
CS261-Group-17/Mentoring-Site
b0425ec967c3241561ab8eb65cce75a35f3e5814
[ "MIT" ]
null
null
null
"""Needed for pylint to run correctly - GitHub actions will fail if you delete this"""
29.666667
79
0.730337
14
89
4.642857
1
0
0
0
0
0
0
0
0
0
0
0
0.191011
89
2
80
44.5
0.902778
0.898876
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
779ddd9588fb1634cac7f9efb6fe015b9494fabb
97
py
Python
server/config.py
cryptSky/hlsa_task8
ed0d8d9d69b5e8f3bdfa5964c66ce6dcf27f07c1
[ "MIT" ]
null
null
null
server/config.py
cryptSky/hlsa_task8
ed0d8d9d69b5e8f3bdfa5964c66ce6dcf27f07c1
[ "MIT" ]
null
null
null
server/config.py
cryptSky/hlsa_task8
ed0d8d9d69b5e8f3bdfa5964c66ce6dcf27f07c1
[ "MIT" ]
null
null
null
import os class BaseConfig(object): SECRET_KEY = os.environ['SECRET_KEY'] DEBUG = False
16.166667
41
0.701031
13
97
5.076923
0.769231
0.272727
0
0
0
0
0
0
0
0
0
0
0.195876
97
5
42
19.4
0.846154
0
0
0
0
0
0.103093
0
0
0
0
0
0
1
0
false
0
0.25
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
1
0
0
4
77e72d5f61a1f1a31c32a5a1b3e2b8bcf59e6c93
2,203
py
Python
returns/pointfree/__init__.py
internetimagery/returns
8f4f23bae6861fb3969a8d0c8979f96c5589fc61
[ "BSD-2-Clause" ]
null
null
null
returns/pointfree/__init__.py
internetimagery/returns
8f4f23bae6861fb3969a8d0c8979f96c5589fc61
[ "BSD-2-Clause" ]
null
null
null
returns/pointfree/__init__.py
internetimagery/returns
8f4f23bae6861fb3969a8d0c8979f96c5589fc61
[ "BSD-2-Clause" ]
null
null
null
from __future__ import absolute_import from returns.pointfree.alt import alt as alt from returns.pointfree.apply import apply as apply from returns.pointfree.bimap import bimap as bimap from returns.pointfree.bind import bind as bind from returns.pointfree.bind_async import bind_async as bind_async from returns.pointfree.bind_async_context_future_result import ( bind_async_context_future_result as bind_async_context_future_result, ) from returns.pointfree.bind_async_future import ( bind_async_future as bind_async_future, ) from returns.pointfree.bind_async_future_result import ( bind_async_future_result as bind_async_future_result, ) from returns.pointfree.bind_awaitable import bind_awaitable as bind_awaitable from returns.pointfree.bind_context import bind_context as bind_context from returns.pointfree.bind_context import bind_context2 as bind_context2 from returns.pointfree.bind_context import bind_context3 as bind_context3 from returns.pointfree.bind_context_future_result import ( bind_context_future_result as bind_context_future_result, ) from returns.pointfree.bind_context_ioresult import ( bind_context_ioresult as bind_context_ioresult, ) from returns.pointfree.bind_context_result import ( bind_context_result as bind_context_result, ) from returns.pointfree.bind_future import bind_future as bind_future from returns.pointfree.bind_future_result import ( bind_future_result as bind_future_result, ) from returns.pointfree.bind_io import bind_io as bind_io from returns.pointfree.bind_ioresult import bind_ioresult as bind_ioresult from returns.pointfree.bind_optional import bind_optional as bind_optional from returns.pointfree.bind_result import bind_result as bind_result from returns.pointfree.compose_result import compose_result as compose_result from returns.pointfree.cond import cond as cond from returns.pointfree.lash import lash as lash from returns.pointfree.map import map_ as map_ from returns.pointfree.modify_env import modify_env as modify_env from returns.pointfree.modify_env import modify_env2 as modify_env2 from returns.pointfree.modify_env import modify_env3 as modify_env3 from returns.pointfree.unify import unify as unify
48.955556
77
0.864276
333
2,203
5.408408
0.087087
0.177124
0.322043
0.239867
0.47196
0.249861
0.184342
0
0
0
0
0.004034
0.099864
2,203
44
78
50.068182
0.904186
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.681818
0
0.681818
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
77f34f3e60a19e14304311a24cf1b6426d5ea4fd
421
py
Python
kernel/examples/handler/__init__.py
rinceyuan/WeFe
8482cb737cb7ba37b2856d184cd42c1bd35a6318
[ "Apache-2.0" ]
39
2021-10-12T01:43:27.000Z
2022-03-28T04:46:35.000Z
kernel/examples/handler/__init__.py
rinceyuan/WeFe
8482cb737cb7ba37b2856d184cd42c1bd35a6318
[ "Apache-2.0" ]
6
2021-10-14T02:11:47.000Z
2022-03-23T02:41:50.000Z
kernel/examples/handler/__init__.py
rinceyuan/WeFe
8482cb737cb7ba37b2856d184cd42c1bd35a6318
[ "Apache-2.0" ]
10
2021-10-14T09:36:03.000Z
2022-02-10T11:05:12.000Z
from pathlib import Path from ruamel import yaml with Path(__file__).parent.parent.joinpath("config.yaml").resolve().open("r") as fin: __DEFAULT_CONFIG: dict = yaml.safe_load(fin) def set_default_config(ip: str, port: int, log_directory: str): global __DEFAULT_CONFIG __DEFAULT_CONFIG.update(dict(ip=ip, port=port, log_directory=log_directory)) def get_default_config(): return __DEFAULT_CONFIG
21.05
85
0.755344
61
421
4.819672
0.52459
0.265306
0
0
0
0
0
0
0
0
0
0
0.137767
421
19
86
22.157895
0.809917
0
0
0
0
0
0.028777
0
0
0
0
0
0
1
0.222222
false
0
0.222222
0.111111
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
1
1
0
0
4
7aeeeef62aa01b729262c5390d03e0480b6ae142
2,292
py
Python
rotkehlchen/tests/unit/uniswap/test_calculate_events_balances.py
rotkehlchenio/rotkehlchen
98f49cd3ed26c641fec03b78eff9fe1872385fbf
[ "BSD-3-Clause" ]
137
2018-03-05T11:53:29.000Z
2019-11-03T16:38:42.000Z
rotkehlchen/tests/unit/uniswap/test_calculate_events_balances.py
rotkehlchenio/rotkehlchen
98f49cd3ed26c641fec03b78eff9fe1872385fbf
[ "BSD-3-Clause" ]
385
2018-03-08T12:43:41.000Z
2019-11-10T09:15:36.000Z
rotkehlchen/tests/unit/uniswap/test_calculate_events_balances.py
rotkehlchenio/rotkehlchen
98f49cd3ed26c641fec03b78eff9fe1872385fbf
[ "BSD-3-Clause" ]
59
2018-03-08T10:08:27.000Z
2019-10-26T11:30:44.000Z
from typing import List import pytest from rotkehlchen.chain.ethereum.interfaces.ammswap.types import LiquidityPool, LiquidityPoolEvent from .utils import ( LP_1_EVENTS, LP_1_EVENTS_BALANCE, LP_2_EVENTS, LP_2_EVENTS_BALANCE, LP_3_BALANCE, LP_3_EVENTS, LP_3_EVENTS_BALANCE, TEST_ADDRESS_1, ) @pytest.mark.parametrize('ethereum_modules', [['uniswap']]) def test_no_events_no_balances(rotkehlchen_api_server): rotki = rotkehlchen_api_server.rest_api.rotkehlchen events: List[LiquidityPoolEvent] = [] balances: List[LiquidityPool] = [] events_balances = rotki.chain_manager.get_module('uniswap')._calculate_events_balances( address=TEST_ADDRESS_1, events=events, balances=balances, ) assert events_balances == [] @pytest.mark.parametrize('ethereum_modules', [['uniswap']]) def test_single_pool_without_balances(rotkehlchen_api_server): rotki = rotkehlchen_api_server.rest_api.rotkehlchen balances: List[LiquidityPool] = [] events_balances = rotki.chain_manager.get_module('uniswap')._calculate_events_balances( address=TEST_ADDRESS_1, events=LP_1_EVENTS, balances=balances, ) assert events_balances == [LP_1_EVENTS_BALANCE] @pytest.mark.parametrize('ethereum_modules', [['uniswap']]) def test_multiple_pools_without_balances(rotkehlchen_api_server): rotki = rotkehlchen_api_server.rest_api.rotkehlchen events = list(LP_1_EVENTS) events.extend(LP_2_EVENTS) balances: List[LiquidityPool] = [] events_balances = rotki.chain_manager.get_module('uniswap')._calculate_events_balances( address=TEST_ADDRESS_1, events=events, balances=balances, ) assert events_balances == [LP_1_EVENTS_BALANCE, LP_2_EVENTS_BALANCE] @pytest.mark.parametrize('ethereum_modules', [['uniswap']]) def test_single_pool_with_balances(rotkehlchen_api_server): """Test LP current balances are factorized in the pool events balance """ rotki = rotkehlchen_api_server.rest_api.rotkehlchen events_balances = rotki.chain_manager.get_module('uniswap')._calculate_events_balances( address=TEST_ADDRESS_1, events=LP_3_EVENTS, balances=[LP_3_BALANCE], ) assert events_balances == [LP_3_EVENTS_BALANCE]
33.217391
97
0.746946
277
2,292
5.758123
0.180505
0.149216
0.100313
0.072727
0.737304
0.732288
0.732288
0.714734
0.656426
0.656426
0
0.010892
0.158813
2,292
68
98
33.705882
0.81639
0.028796
0
0.436364
0
0
0.054176
0
0
0
0
0
0.072727
1
0.072727
false
0
0.072727
0
0.145455
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
bb4a1d807e1313ea7404bae917bc86516df32ec4
33
py
Python
instance/config.py
adriankiprono/pitches_project
a3102a7b1d618ad35b981414049c3ead0b5ecc3c
[ "MIT" ]
null
null
null
instance/config.py
adriankiprono/pitches_project
a3102a7b1d618ad35b981414049c3ead0b5ecc3c
[ "MIT" ]
null
null
null
instance/config.py
adriankiprono/pitches_project
a3102a7b1d618ad35b981414049c3ead0b5ecc3c
[ "MIT" ]
null
null
null
SECRET_KEY='qweasdzxc1234567890'
16.5
32
0.878788
3
33
9.333333
1
0
0
0
0
0
0
0
0
0
0
0.3125
0.030303
33
2
32
16.5
0.5625
0
0
0
0
0
0.575758
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
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
4
700b79c99c5a7d6039181ad3627f0fe4a5023d42
79
py
Python
src/nti/mailer/tests/templates/__init__.py
NextThought/nti.mailer
9a696dcd150a9370c5d5afd7cf0b1e8ec772a621
[ "Apache-2.0" ]
null
null
null
src/nti/mailer/tests/templates/__init__.py
NextThought/nti.mailer
9a696dcd150a9370c5d5afd7cf0b1e8ec772a621
[ "Apache-2.0" ]
4
2021-08-11T12:24:05.000Z
2021-09-07T16:02:58.000Z
src/nti/mailer/tests/templates/__init__.py
NextThought/nti.mailer
9a696dcd150a9370c5d5afd7cf0b1e8ec772a621
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- # Make this directory a package.
19.75
32
0.632911
12
79
4.166667
1
0
0
0
0
0
0
0
0
0
0
0.015152
0.164557
79
3
33
26.333333
0.742424
0.924051
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
7016e3c9fc99e0a5ae6849f6a74a87ca2b588aac
561
py
Python
Python/1-Fundamentals/cc_nestedif.py
armirh/Nucamp-SQL-Devops-Training
6c2dc5793c732bfb4c4d365acbb346a95fbf4bf2
[ "MIT" ]
2
2022-01-19T02:33:11.000Z
2022-01-19T02:33:13.000Z
Python/1-Fundamentals/cc_nestedif.py
armirh/Nucamp-SQL-Devops-Training
6c2dc5793c732bfb4c4d365acbb346a95fbf4bf2
[ "MIT" ]
null
null
null
Python/1-Fundamentals/cc_nestedif.py
armirh/Nucamp-SQL-Devops-Training
6c2dc5793c732bfb4c4d365acbb346a95fbf4bf2
[ "MIT" ]
null
null
null
''' priceIsRight = 15 if priceIsRight: print("Price is too low!") if priceIsRight: print("Price is almost there!") if priceIsRight: print("Price is exactly that!") if priceIsRight: print("Price is too high!") ''' priceIsRight = int(input("Enter your number: ")) if priceIsRight < 5: print("Price is almost there!") elif priceIsRight >= 5 and priceIsRight <= 9: print("Price is almost there!") elif priceIsRight == 10: print("Price is exactly that!") else: print("Price is too high!")
21.576923
48
0.616756
69
561
5.014493
0.347826
0.231214
0.277457
0.277457
0.739884
0.393064
0.225434
0
0
0
0
0.016827
0.258467
561
25
49
22.44
0.814904
0.465241
0
0.222222
0
0
0.355172
0
0
0
0
0
0
1
0
false
0
0
0
0
0.444444
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
70382ba6c8a70c367c6fcdd7091ab0658b52622e
96
py
Python
project/search_info/apps.py
Kaiser-Zheng/Lawsuit_Searching_Platform
68a51141a4b3230471df16b89fe5762099a5c052
[ "MIT" ]
null
null
null
project/search_info/apps.py
Kaiser-Zheng/Lawsuit_Searching_Platform
68a51141a4b3230471df16b89fe5762099a5c052
[ "MIT" ]
null
null
null
project/search_info/apps.py
Kaiser-Zheng/Lawsuit_Searching_Platform
68a51141a4b3230471df16b89fe5762099a5c052
[ "MIT" ]
null
null
null
from django.apps import AppConfig class SearchInfoConfig(AppConfig): name = 'search_info'
16
34
0.770833
11
96
6.636364
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.15625
96
5
35
19.2
0.901235
0
0
0
0
0
0.114583
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
7049080fe6f9363a6dc30511fae5d03bdb374568
33
py
Python
config.py
jahosp/telegram-bot-startkit
1d786a1162671b83d16d9b4f643e3d12698b1215
[ "MIT" ]
null
null
null
config.py
jahosp/telegram-bot-startkit
1d786a1162671b83d16d9b4f643e3d12698b1215
[ "MIT" ]
null
null
null
config.py
jahosp/telegram-bot-startkit
1d786a1162671b83d16d9b4f643e3d12698b1215
[ "MIT" ]
null
null
null
BOT_TOKEN='write here your token'
33
33
0.818182
6
33
4.333333
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.090909
33
1
33
33
0.866667
0
0
0
0
0
0.617647
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
7049a5622940d03f7b60f4459b7d5d09a8e992b4
327
py
Python
adversarial_music_generator/tune_finder_interface.py
hq9000/adversarial-music-generator
2a47db96d2659d66dca14c075b185819a875dcfe
[ "MIT" ]
null
null
null
adversarial_music_generator/tune_finder_interface.py
hq9000/adversarial-music-generator
2a47db96d2659d66dca14c075b185819a875dcfe
[ "MIT" ]
9
2020-12-14T08:25:12.000Z
2021-02-23T07:33:44.000Z
adversarial_music_generator/tune_finder_interface.py
hq9000/adversarial-music-generator
2a47db96d2659d66dca14c075b185819a875dcfe
[ "MIT" ]
null
null
null
from abc import abstractmethod, ABC from typing import List from adversarial_music_generator.find_tunes_task import FindTunesTask from adversarial_music_generator.models.tune import Tune class TuneFinderInterface(ABC): @abstractmethod def find_tunes(self, find_tunes_task: FindTunesTask) -> List[Tune]: pass
27.25
71
0.807339
41
327
6.219512
0.487805
0.105882
0.156863
0.227451
0
0
0
0
0
0
0
0
0.140673
327
11
72
29.727273
0.907473
0
0
0
0
0
0
0
0
0
0
0
0
1
0.125
false
0.125
0.5
0
0.75
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
4
704f02f9e22e2c5f1ec53cdab281afc673828cb1
32
py
Python
TOPSIS-ARNAV-101803005/__init__.py
arnav2236/xtff-topsis
c1d17c80834eb308755b267c72559c1003636bfa
[ "MIT" ]
null
null
null
TOPSIS-ARNAV-101803005/__init__.py
arnav2236/xtff-topsis
c1d17c80834eb308755b267c72559c1003636bfa
[ "MIT" ]
null
null
null
TOPSIS-ARNAV-101803005/__init__.py
arnav2236/xtff-topsis
c1d17c80834eb308755b267c72559c1003636bfa
[ "MIT" ]
null
null
null
#version no. __version__ =1.0.0
10.666667
18
0.71875
6
32
3.166667
0.666667
0
0
0
0
0
0
0
0
0
0
0.107143
0.125
32
3
18
10.666667
0.571429
0.34375
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
5606197edd767533789e31c54935c3de42f2b6bf
22
py
Python
canvas_course_site_wizard/tests/test_view_canvas_course_site_create.py
Harvard-University-iCommons/django-canvas-course-site-wizard
0210849e959407e5a850188f50756eb69b9a4dc2
[ "MIT" ]
null
null
null
canvas_course_site_wizard/tests/test_view_canvas_course_site_create.py
Harvard-University-iCommons/django-canvas-course-site-wizard
0210849e959407e5a850188f50756eb69b9a4dc2
[ "MIT" ]
5
2018-05-10T19:49:43.000Z
2021-01-29T19:39:34.000Z
canvas_course_site_wizard/tests/test_view_canvas_course_site_create.py
Harvard-University-iCommons/django-canvas-course-site-wizard
0210849e959407e5a850188f50756eb69b9a4dc2
[ "MIT" ]
null
null
null
__author__ = 'ely817'
11
21
0.727273
2
22
6
1
0
0
0
0
0
0
0
0
0
0
0.157895
0.136364
22
1
22
22
0.473684
0
0
0
0
0
0.272727
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
5610e3895d6609e599ef466f957f214f5c918fe6
591
py
Python
0077_Combinations/python/solution.py
jeffvswanson/LeetCode
6bc7d6cad3c2b1bd6ccb2616ec081fb5eb51ccc8
[ "MIT" ]
null
null
null
0077_Combinations/python/solution.py
jeffvswanson/LeetCode
6bc7d6cad3c2b1bd6ccb2616ec081fb5eb51ccc8
[ "MIT" ]
null
null
null
0077_Combinations/python/solution.py
jeffvswanson/LeetCode
6bc7d6cad3c2b1bd6ccb2616ec081fb5eb51ccc8
[ "MIT" ]
null
null
null
""" 77. Combinations Given two integers n and k, return all possible combinations of k numbers out of the range [1, n]. You may return the answer in any order. Examples -------- Example 1: Input: n = 4, k = 2 Output: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] Example 2: Input: n = 1, k = 1 Output: [[1]] Constraints ----------- * 1 <= n <= 20 * 1 <= k <= n """ def initial_pass(n: int, k: int) -> list[list[int]]: from itertools import combinations return list(combinations(range(1, n+1), k))
16.885714
98
0.509306
88
591
3.409091
0.454545
0.02
0.046667
0
0
0
0
0
0
0
0
0.068966
0.313029
591
34
99
17.382353
0.669951
0.746193
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0.333333
0.333333
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
1
0
1
0
0
4
56140b60dd6aeb1e4d1e548d41d34c527425c7fd
2,335
py
Python
appengine_config.py
mjd119/Habit-Tracker
f37c4f8ff08109f2c3a048bd595d145036e92c2d
[ "MIT" ]
null
null
null
appengine_config.py
mjd119/Habit-Tracker
f37c4f8ff08109f2c3a048bd595d145036e92c2d
[ "MIT" ]
2
2019-09-20T19:08:16.000Z
2021-04-02T13:28:29.000Z
appengine_config.py
mjd119/Habit-Tracker
f37c4f8ff08109f2c3a048bd595d145036e92c2d
[ "MIT" ]
null
null
null
from gaesessions import SessionMiddleware # suggestion: generate your own random key using os.urandom(64) # WARNING: Make sure you run os.urandom(64) OFFLINE and copy/paste the output to # this file. If you use os.urandom() to *dynamically* generate your key at # runtime then any existing sessions will become junk every time you start, # deploy, or update your app! import os # https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27 # appengine_config.py from google.appengine.ext import vendor # Add any libraries install in the "lib" folder. # vendor.add('lib') vendor.add(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib')) # def add_vendor_packages(vendor_folder): # """ # Adds our vendor packages folder to sys.path so that third-party # packages can be imported. # """ # import site # import os.path # import sys # # # Use site.addsitedir() because it appropriately reads .pth # # files for namespaced packages. Unfortunately, there's not an # # option to choose where addsitedir() puts its paths in sys.path # # so we have to do a little bit of magic to make it play along. # # # We're going to grab the current sys.path and split it up into # # the first entry and then the rest. Essentially turning # # ['.', '/site-packages/x', 'site-packages/y'] # # into # # ['.'] and ['/site-packages/x', 'site-packages/y'] # # The reason for this is we want '.' to remain at the top of the # # list but we want our vendor files to override everything else. # sys.path, remainder = sys.path[:1], sys.path[1:] # # # Now we call addsitedir which will append our vendor directories # # to sys.path (which was truncated by the last step.) # site.addsitedir(os.path.join(os.path.dirname(__file__), vendor_folder)) # # # Finally, we'll add the paths we removed back. # sys.path.extend(remainder) # # # Change 'lib' to whichever directory you use for your vendored packages. # add_vendor_packages('lib') COOKIE_KEY = "" # TODO: Generate new COOKIE_KEY using os.urandom(64) See above def webapp_add_wsgi_middleware(app): from google.appengine.ext.appstats import recording app = SessionMiddleware(app, cookie_key=COOKIE_KEY) app = recording.appstats_wsgi_middleware(app) return app
39.576271
89
0.707495
350
2,335
4.651429
0.485714
0.034398
0.02027
0.020885
0.083538
0.060197
0
0
0
0
0
0.005269
0.187152
2,335
58
90
40.258621
0.852476
0.786724
0
0
1
0
0.006818
0
0
0
0
0.017241
0
1
0.1
false
0
0.4
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
1
0
0
0
null
0
0
1
0
0
0
0
0
1
0
1
0
0
4
56194c8f56bddc7ad38951592f9bc25caecd84bd
75
py
Python
python/testData/resolve/DocStringModule.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/resolve/DocStringModule.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/resolve/DocStringModule.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
"Docstring of our own module" import DocStringModule as m m._<ref>_doc__
12.5
29
0.773333
12
75
4.5
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.16
75
5
30
15
0.857143
0.36
0
0
0
0
0.36
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
561aa27498c3c54e4f1ac4ee9376a815233101a3
201
py
Python
apps/notice/serializers.py
slyslyme/CTF_AWD_Platform
6e9eec0a23a316aaf1927d4ec5be923ac26ff21e
[ "MIT" ]
85
2019-04-21T01:38:18.000Z
2022-03-22T08:06:21.000Z
apps/notice/serializers.py
xuchaoa/CTF_AWD_Platform
b2201f18677939442002e16e64280acd44f72bfe
[ "MIT" ]
12
2019-05-10T14:09:12.000Z
2022-03-11T23:45:35.000Z
apps/notice/serializers.py
slyslyme/CTF_AWD_Platform
6e9eec0a23a316aaf1927d4ec5be923ac26ff21e
[ "MIT" ]
21
2019-04-14T16:12:15.000Z
2022-03-22T08:06:22.000Z
from rest_framework import serializers from .models import NoticeProfile class NoticeSerializer(serializers.ModelSerializer): class Meta: model = NoticeProfile fields = "__all__"
22.333333
52
0.751244
19
201
7.684211
0.736842
0
0
0
0
0
0
0
0
0
0
0
0.199005
201
9
53
22.333333
0.906832
0
0
0
0
0
0.034653
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
561ee309084f16093848c36643b7f716599f6557
89
py
Python
Virtualenv/Env/src/GoTravel/Booking/apps.py
Anoop01234/Go-Travel
aa91f1a4ce7e7ed78de8eadc55e6a25d1a73bdd8
[ "MIT" ]
null
null
null
Virtualenv/Env/src/GoTravel/Booking/apps.py
Anoop01234/Go-Travel
aa91f1a4ce7e7ed78de8eadc55e6a25d1a73bdd8
[ "MIT" ]
null
null
null
Virtualenv/Env/src/GoTravel/Booking/apps.py
Anoop01234/Go-Travel
aa91f1a4ce7e7ed78de8eadc55e6a25d1a73bdd8
[ "MIT" ]
1
2021-12-21T17:27:34.000Z
2021-12-21T17:27:34.000Z
from django.apps import AppConfig class BookingConfig(AppConfig): name = 'Booking'
14.833333
33
0.752809
10
89
6.7
0.9
0
0
0
0
0
0
0
0
0
0
0
0.168539
89
5
34
17.8
0.905405
0
0
0
0
0
0.078652
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
56390f75138128855007e115d42af136f69b1740
30
py
Python
tests/assets/sample_tasks/sample.py
MarcoJHB/ploomber
4849ef6915572f7934392443b4faf138172b9596
[ "Apache-2.0" ]
2,141
2020-02-14T02:34:34.000Z
2022-03-31T22:43:20.000Z
tests/assets/sample_tasks/sample.py
MarcoJHB/ploomber
4849ef6915572f7934392443b4faf138172b9596
[ "Apache-2.0" ]
660
2020-02-06T16:15:57.000Z
2022-03-31T22:55:01.000Z
tests/assets/sample_tasks/sample.py
MarcoJHB/ploomber
4849ef6915572f7934392443b4faf138172b9596
[ "Apache-2.0" ]
122
2020-02-14T18:53:05.000Z
2022-03-27T22:33:24.000Z
# + tags=["parameters"] 1 + 1
10
23
0.533333
4
30
4
0.75
0
0
0
0
0
0
0
0
0
0
0.083333
0.2
30
2
24
15
0.583333
0.7
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
5653a2f0dbfc504f7d3081780efaecc1f60b9ed6
100
py
Python
django_basics/apps.py
pinehq/django_basics
fae7f66ece3f8b4c3e6f24ca461622a2dd44d586
[ "MIT" ]
null
null
null
django_basics/apps.py
pinehq/django_basics
fae7f66ece3f8b4c3e6f24ca461622a2dd44d586
[ "MIT" ]
null
null
null
django_basics/apps.py
pinehq/django_basics
fae7f66ece3f8b4c3e6f24ca461622a2dd44d586
[ "MIT" ]
null
null
null
from django.apps import AppConfig class DjangoBasicsConfig(AppConfig): name = 'django_basics'
16.666667
36
0.78
11
100
7
0.818182
0
0
0
0
0
0
0
0
0
0
0
0.15
100
5
37
20
0.905882
0
0
0
0
0
0.13
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
5655c4d68c05c384af2ae00b3b33213584082485
2,208
py
Python
pytpp/attributes/adaptable_workflow.py
Venafi/pytpp
42af655b2403b8c9447c86962abd4aaa0201f646
[ "MIT" ]
4
2022-02-04T23:58:55.000Z
2022-02-15T18:53:08.000Z
pytpp/attributes/adaptable_workflow.py
Venafi/pytpp
42af655b2403b8c9447c86962abd4aaa0201f646
[ "MIT" ]
null
null
null
pytpp/attributes/adaptable_workflow.py
Venafi/pytpp
42af655b2403b8c9447c86962abd4aaa0201f646
[ "MIT" ]
null
null
null
from pytpp.attributes._helper import IterableMeta, Attribute from pytpp.attributes.workflow import WorkflowAttributes class AdaptableWorkflowAttributes(WorkflowAttributes, metaclass=IterableMeta): __config_class__ = "Adaptable Workflow" adaptable_workflow_text_field_1 = Attribute('Adaptable Workflow Text Field 1', min_version='18.3') adaptable_workflow_text_field_10 = Attribute('Adaptable Workflow Text Field 10', min_version='18.3') adaptable_workflow_text_field_11 = Attribute('Adaptable Workflow Text Field 11', min_version='18.3') adaptable_workflow_text_field_12 = Attribute('Adaptable Workflow Text Field 12', min_version='18.3') adaptable_workflow_text_field_2 = Attribute('Adaptable Workflow Text Field 2', min_version='18.3') adaptable_workflow_text_field_3 = Attribute('Adaptable Workflow Text Field 3', min_version='18.3') adaptable_workflow_text_field_4 = Attribute('Adaptable Workflow Text Field 4', min_version='18.3') adaptable_workflow_text_field_5 = Attribute('Adaptable Workflow Text Field 5', min_version='18.3') adaptable_workflow_text_field_6 = Attribute('Adaptable Workflow Text Field 6', min_version='18.3') adaptable_workflow_text_field_7 = Attribute('Adaptable Workflow Text Field 7', min_version='18.3') adaptable_workflow_text_field_8 = Attribute('Adaptable Workflow Text Field 8', min_version='18.3') adaptable_workflow_text_field_9 = Attribute('Adaptable Workflow Text Field 9', min_version='18.3') credential = Attribute('Credential', min_version='18.3') log_debug = Attribute('Log Debug', min_version='19.3') oauth_token_application_id = Attribute('OAuth Token Application Id', min_version='21.3') oauth_token_credential = Attribute('OAuth Token Credential', min_version='21.3') oauth_token_scope = Attribute('OAuth Token Scope', min_version='21.3') powershell_script = Attribute('PowerShell Script', min_version='18.3') powershell_script_hash_vault_id = Attribute('PowerShell Script Hash Vault Id', min_version='19.1') script_execution_timeout = Attribute('Script Execution Timeout', min_version='20.2') secondary_credential = Attribute('Secondary Credential', min_version='18.3') service_address = Attribute('Service Address', min_version='18.3')
76.137931
101
0.806612
306
2,208
5.51634
0.166667
0.251777
0.298578
0.369668
0.62263
0.281398
0.254147
0.254147
0
0
0
0.047666
0.087862
2,208
28
102
78.857143
0.790467
0
0
0
0
0
0.304348
0
0
0
0
0
0
1
0
false
0
0.076923
0
1
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
565ae1f8b7e982db0f90201b80b9c8e1a4418619
101
py
Python
codesamples/apps.py
Manny27nyc/pythondotorg
257c96d3a94755451a5a5cdcd2abad1e27ea299b
[ "Apache-2.0" ]
911
2015-01-03T22:16:06.000Z
2022-03-31T23:56:22.000Z
codesamples/apps.py
Manny27nyc/pythondotorg
257c96d3a94755451a5a5cdcd2abad1e27ea299b
[ "Apache-2.0" ]
1,342
2015-01-02T16:14:45.000Z
2022-03-28T08:01:20.000Z
codesamples/apps.py
Manny27nyc/pythondotorg
257c96d3a94755451a5a5cdcd2abad1e27ea299b
[ "Apache-2.0" ]
551
2015-01-04T02:17:31.000Z
2022-03-23T11:59:25.000Z
from django.apps import AppConfig class CodesamplesAppConfig(AppConfig): name = 'codesamples'
14.428571
38
0.772277
10
101
7.8
0.9
0
0
0
0
0
0
0
0
0
0
0
0.158416
101
6
39
16.833333
0.917647
0
0
0
0
0
0.108911
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
567518c0fb9c154ac5935c2be231aa9edbadb63e
46
py
Python
stade/tracker/models/__init__.py
ImageMarkup/stade
d930e8c7487754b2babd6a3be69f2c614cd7f609
[ "Apache-2.0" ]
4
2019-09-25T22:57:32.000Z
2021-03-03T16:49:30.000Z
stade/tracker/models/__init__.py
ImageMarkup/stade
d930e8c7487754b2babd6a3be69f2c614cd7f609
[ "Apache-2.0" ]
55
2019-10-30T16:58:43.000Z
2021-10-09T23:26:03.000Z
stade/tracker/models/__init__.py
ImageMarkup/stade
d930e8c7487754b2babd6a3be69f2c614cd7f609
[ "Apache-2.0" ]
1
2020-02-03T17:14:32.000Z
2020-02-03T17:14:32.000Z
from .email import Email __all__ = ['Email']
11.5
24
0.695652
6
46
4.666667
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.173913
46
3
25
15.333333
0.736842
0
0
0
0
0
0.108696
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
568571c41663dd009844bdc623dd3cbb483f94fa
125
py
Python
closeness_server/wsgi.py
wligtenberg/closeness-server
b9d7fba57264fb87e6a5be94dcf9f9a97f1156ca
[ "MIT" ]
null
null
null
closeness_server/wsgi.py
wligtenberg/closeness-server
b9d7fba57264fb87e6a5be94dcf9f9a97f1156ca
[ "MIT" ]
null
null
null
closeness_server/wsgi.py
wligtenberg/closeness-server
b9d7fba57264fb87e6a5be94dcf9f9a97f1156ca
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # closeness-server (c) Willem Ligtenberg from closeness_server import create_app app = create_app()
20.833333
40
0.728
17
125
5.176471
0.705882
0.340909
0
0
0
0
0
0
0
0
0
0.009346
0.144
125
5
41
25
0.813084
0.48
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4