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
2b7dfc3bf105ce8280ab057fa8b274010d100822
248
py
Python
__init__.py
ShuvoMondal/flask_todo_app
26f6bb73f93b7e6c9ee5611a1712bb0cab8d5a53
[ "MIT" ]
2
2021-12-17T09:02:43.000Z
2021-12-18T11:08:53.000Z
__init__.py
Tatsumi251/flask_todo_app
26f6bb73f93b7e6c9ee5611a1712bb0cab8d5a53
[ "MIT" ]
null
null
null
__init__.py
Tatsumi251/flask_todo_app
26f6bb73f93b7e6c9ee5611a1712bb0cab8d5a53
[ "MIT" ]
1
2021-06-23T17:19:23.000Z
2021-06-23T17:19:23.000Z
from flask import Flask from .main.routes import main from .extensions import mongo def create_app(): app = Flask(__name__) app.config['MONGO_URI'] = '' app.register_blueprint(main) mongo.init_app(app) return app
19.076923
33
0.669355
33
248
4.787879
0.515152
0.075949
0
0
0
0
0
0
0
0
0
0
0.237903
248
12
34
20.666667
0.835979
0
0
0
0
0
0.038136
0
0
0
0
0
0
1
0.111111
false
0
0.333333
0
0.555556
0.111111
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
2b879b2bd21dc4ed79358777ea7e39a26cd74ca1
805
py
Python
test/persistence/test_EntitiesFilePersistence.py
pip-templates-services/pip-service-data-python
74149496a4e02c6e7c14d5f4c9453bf196577a3c
[ "MIT" ]
null
null
null
test/persistence/test_EntitiesFilePersistence.py
pip-templates-services/pip-service-data-python
74149496a4e02c6e7c14d5f4c9453bf196577a3c
[ "MIT" ]
null
null
null
test/persistence/test_EntitiesFilePersistence.py
pip-templates-services/pip-service-data-python
74149496a4e02c6e7c14d5f4c9453bf196577a3c
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from pip_service_data_python.persistence.EntitiesFilePersistence import EntitiesFilePersistence from test.persistence.EntitiesPersistenceFixture import EntitiesPersistenceFixture class TestEntitiesFilePersistence: persistence: EntitiesFilePersistence fixture: EntitiesPersistenceFixture def setup_method(self): self.persistence = EntitiesFilePersistence('data/entities.test.json') self.fixture = EntitiesPersistenceFixture(self.persistence) self.persistence.open(None) self.persistence.clear(None) def teardown_method(self): self.persistence.close(None) def test_crud_operations(self): self.fixture.test_crud_operations() def test_get_with_filters(self): self.fixture.test_get_with_filters()
29.814815
95
0.765217
78
805
7.705128
0.410256
0.124792
0.046589
0.083195
0
0
0
0
0
0
0
0.001475
0.157764
805
26
96
30.961538
0.884956
0.026087
0
0
0
0
0.029412
0.029412
0
0
0
0
0
1
0.25
false
0
0.125
0
0.5625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
2b8dac4ce214d8b313daea28f2622e403873e5ff
237
py
Python
src/assets/features.py
popcornell/SLOCount
62d52c9141ba8def92408d54ba6a644b9df7f910
[ "MIT" ]
null
null
null
src/assets/features.py
popcornell/SLOCount
62d52c9141ba8def92408d54ba6a644b9df7f910
[ "MIT" ]
null
null
null
src/assets/features.py
popcornell/SLOCount
62d52c9141ba8def92408d54ba6a644b9df7f910
[ "MIT" ]
null
null
null
import torch # compute features in pytorch def compute_features(audio, hp): # compute spectrogram from first channel stft = torch.stft(audio, hp.features.n_fft, hp.features.hop, hp.features.win_len, center=False) return
19.75
99
0.738397
34
237
5.058824
0.647059
0.174419
0
0
0
0
0
0
0
0
0
0
0.172996
237
12
100
19.75
0.877551
0.278481
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
2b9079e7bbe174d6414dd250531b40bc92a05cf0
93
py
Python
HackerRank/Problem Solving/Algorithms/Strings/CamelCase.py
anubhab-code/Competitive-Programming
de28cb7d44044b9e7d8bdb475da61e37c018ac35
[ "MIT" ]
null
null
null
HackerRank/Problem Solving/Algorithms/Strings/CamelCase.py
anubhab-code/Competitive-Programming
de28cb7d44044b9e7d8bdb475da61e37c018ac35
[ "MIT" ]
null
null
null
HackerRank/Problem Solving/Algorithms/Strings/CamelCase.py
anubhab-code/Competitive-Programming
de28cb7d44044b9e7d8bdb475da61e37c018ac35
[ "MIT" ]
null
null
null
import sys s = input().strip() count=1 for i in s: count+=i.isupper() print(count)
10.333333
22
0.602151
16
93
3.5
0.75
0
0
0
0
0
0
0
0
0
0
0.014085
0.236559
93
9
23
10.333333
0.774648
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
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
0
0
0
0
0
0
0
0
2
2b9282c38e9ebb4823af5443b2d838b47a968971
1,172
py
Python
TimeWrapper_JE/venv/Lib/site-packages/requests_toolbelt/exceptions.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
TimeWrapper_JE/venv/Lib/site-packages/requests_toolbelt/exceptions.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
TimeWrapper_JE/venv/Lib/site-packages/requests_toolbelt/exceptions.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Collection of exceptions raised by requests-toolbelt.""" class StreamingError(Exception): """Used in :mod:`requests_toolbelt.downloadutils.stream`.""" pass class VersionMismatchError(Exception): """Used to indicate a version mismatch in the version of requests required. The feature in use requires a newer version of Requests to function appropriately but the version installed is not sufficient. """ pass class RequestsVersionTooOld(Warning): """Used to indicate that the Requests version is too old. If the version of Requests is too old to support a feature, we will issue this warning to the user. """ pass class IgnoringGAECertificateValidation(Warning): """Used to indicate that given GAE validation behavior will be ignored. If the user has tried to specify certificate validation when using the insecure AppEngine adapter, it will be ignored (certificate validation will remain off), so we will issue this warning to the user. In :class:`requests_toolbelt.adapters.appengine.InsecureAppEngineAdapter`. """ pass
30.842105
80
0.709044
146
1,172
5.678082
0.493151
0.057901
0.050663
0.048251
0.135103
0.074789
0.074789
0.074789
0
0
0
0.001099
0.223549
1,172
37
81
31.675676
0.90989
0.714164
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
2
2b94d939378947027f12c9cf1292d639e0f6b4da
4,727
py
Python
atomphys/laser.py
mgrau/atomphys
8624748eb61a2c6e1f70a5784a9d3fc242ff50b1
[ "MIT" ]
3
2021-10-07T11:33:43.000Z
2022-03-16T13:27:17.000Z
atomphys/laser.py
mgrau/atomphys
8624748eb61a2c6e1f70a5784a9d3fc242ff50b1
[ "MIT" ]
2
2021-10-07T14:49:36.000Z
2021-10-21T20:36:36.000Z
atomphys/laser.py
mgrau/atomphys
8624748eb61a2c6e1f70a5784a9d3fc242ff50b1
[ "MIT" ]
null
null
null
from math import inf from math import pi as π import pint from . import _ureg from .util import default_units class Laser: _ureg: pint.UnitRegistry __omega = pint.Quantity __linewidth = pint.Quantity __electric_field = pint.Quantity __A = 0 __theta_k = 0 __theta_p = π / 2 def __init__(self, ureg=None, laser=None, **new_laser): if ureg is not None: self._ureg = ureg else: self._ureg = _ureg self.omega = 0 self.__linewidth = 0 self.__electric_field = 0 if laser is not None: self._ureg = laser._ureg self.__omega = laser.__omega self.__linewidth = laser.__linewidth self.__electric_field = laser.__electric_field self.__A = laser.__A self.__theta_k = laser.__theta_k self.__theta_p = laser.__theta_p for attr in new_laser: if attr in dir(self): self.__setattr__(attr, new_laser[attr]) def __repr__(self): fmt = "0.4g~P" return f"Laser(λ={self.λ:{fmt}})" # --------- # Frequency # --------- @property def omega(self): return self.__omega @omega.setter @default_units("THz") def omega(self, ω): self.__omega = ω @property def angular_frequency(self): return self.omega @angular_frequency.setter def angular_frequency(self, ω): self.omega = ω @property def ω(self): return self.omega @ω.setter def ω(self, ω): self.omega = ω @property def ν(self): return self.omega / (2 * π) @ν.setter def ν(self, ν): self.omega = 2 * π * ν @property def nu(self): return self.ν @nu.setter def nu(self, ν): self.ν = ν @property def frequency(self): return self.ν @frequency.setter def frequency(self, ν): self.ν = ν # ---------- # Wavelength # ---------- @property def wavelength(self): c = self._ureg.c try: return (2 * π * c / self.omega).to("nm") except ZeroDivisionError: return inf * self._ureg("nm") @wavelength.setter @default_units("nm") def wavelength(self, λ): c = self._ureg.c self.omega = 2 * π * c / λ @property def λ(self): return self.wavelength @λ.setter def λ(self, λ): self.wavelength = λ # --------- # Linewidth # --------- @property def linewidth(self): return self.__linewidth @linewidth.setter @default_units("Hz") def linewidth(self, linewidth): self.__linewidth = linewidth # -------------- # Electric Field # -------------- @property def electric_field(self): return self.__electric_field @electric_field.setter @default_units("V/m") def electric_field(self, E): self.__electric_field = E @property def E(self): return self.electric_field @E.setter def E(self, E): self.electric_field = E @property def intensity(self): c = self._ureg.c ε_0 = self._ureg.ε_0 return self.electric_field ** 2 * (c * ε_0 / 2) @intensity.setter @default_units("W/m^2") def intensity(self, I): c = self._ureg.c ε_0 = self._ureg.ε_0 self.electric_field = (2 * I / (c * ε_0)) ** (1 / 2) @property def I(self): return self.intensity @I.setter def I(self, I): self.intensity = I # ------------ # Polarization # ------------ @property def A(self): return self.__A @A.setter def A(self, A): self.__A = A @property def theta_k(self): return self.__theta_k @theta_k.setter def theta_k(self, theta_k): self.__theta_k = theta_k @property def theta_p(self): return self.__theta_p @theta_p.setter def theta_p(self, theta_p): self.__theta_p = theta_p # --------------------- # high level properties # --------------------- def Rabi_frequency(self, transition): # this is not quite right, as d is reduced dipole matrix element. # also transition is not necessarily dipole ħ = self._ureg.ħ return (transition.d * self.E / ħ).to("MHz") @property def Ω(self): return self.Rabi_frequency @default_units("MHz") def set_Rabi_frequency(self, Rabi_frequency, transition): ħ = self._ureg.ħ self.E = ħ * Rabi_frequency / transition.d @property def set_Ω(self): return self.set_Rabi_frequency
20.375
73
0.545589
587
4,727
4.132879
0.151618
0.081616
0.092333
0.031327
0.197444
0.095218
0.078318
0.046167
0.018137
0.018137
0
0.007535
0.326211
4,727
231
74
20.463203
0.75416
0.07362
0
0.21519
0
0
0.012391
0.005278
0
0
0
0
0
1
0.240506
false
0
0.031646
0.101266
0.455696
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
2b966cc3356ea1fa502eafb7ab1fcf909b63f4b6
955
py
Python
Training/list_comprehension.py
Orleanslindsay/Python_Programming
dacc08090e9ebf9eb43aec127ee3e2e3cdcb4f55
[ "MIT" ]
1
2021-08-16T10:25:01.000Z
2021-08-16T10:25:01.000Z
Training/list_comprehension.py
Orleanslindsay/Python_Programming
dacc08090e9ebf9eb43aec127ee3e2e3cdcb4f55
[ "MIT" ]
null
null
null
Training/list_comprehension.py
Orleanslindsay/Python_Programming
dacc08090e9ebf9eb43aec127ee3e2e3cdcb4f55
[ "MIT" ]
null
null
null
my_list = [] for list in range(450,500,2): lindsay = my_list.append(list) print(my_list) print(my_list[::]) print(my_list[-2:1]) #list comprehension cubes = [i**3 for i in range(5)] lindsay = [i**3 for i in range(5) if i**3 % 2 == 0] print(cubes) print(lindsay) sto = ["{b},{b},{c}".format(a =5, b=4, c = 8)] print(sto) nums = [33,44,54,43,67,67] if all([i > 5 for i in nums]): print("All is greater than five") if any([i % 2 == 0 for i in nums]): print("At least a number is even") for i in enumerate(nums): print(nums) def count_char(text, char): count = 0 for c in text: if c == char: count += 1 return count filename = input("Enter a filename: ") with open(filename) as f: text = f.read() pass print(count_char(text, "r")) #forpercentage of characters each text contain for char in "abcdefghijklmnopqrstuvwxyz": perc = 100 * count_char(text, char) / len(text) print("{0} - {1}%".format(char, round(perc, 2))) pass
23.875
51
0.636649
173
955
3.468208
0.393064
0.05
0.05
0.075
0.158333
0.108333
0.108333
0
0
0
0
0.054124
0.187435
955
40
52
23.875
0.719072
0
0
0.058824
0
0
0.129068
0.029181
0
0
0
0
0
0
null
null
0.058824
0
null
null
0.323529
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
1
0
0
1
0
0
0
0
0
2
2ba19e075751353ac9ba47bbbd4542cffd9821f3
3,120
py
Python
loops/loops.py
DeVatos-Lokos/PythonBasics
b9daca43cd0ddfc5a835212194bf934c904b45aa
[ "Apache-2.0" ]
null
null
null
loops/loops.py
DeVatos-Lokos/PythonBasics
b9daca43cd0ddfc5a835212194bf934c904b45aa
[ "Apache-2.0" ]
null
null
null
loops/loops.py
DeVatos-Lokos/PythonBasics
b9daca43cd0ddfc5a835212194bf934c904b45aa
[ "Apache-2.0" ]
1
2021-07-07T06:55:20.000Z
2021-07-07T06:55:20.000Z
class NaturalNumbers: def __init__(self): pass def get_first_n_for(self, n): # Ejemplo """ Obtener los primeros n naturales en una lista con for """ first_n = [] # Se declara una lista donde almacenaremos los numeros for i in range(n): # Se itera sobre range que genera un rango de 0 a n first_n.append(i) # Almacenamos la variable del ciclo en la lista con append print("FIRST n (n={}) FOR: {}".format(n, first_n)) return first_n # Regresamos la lista def get_first_n_while(self, n): # Ejemplo """ Obtener los primeros n naturales en una lista con while """ first_n = [] # Se declara una lista donde almacenaremos los numeros n_count = 0 # Inicializamos un contador para saber en que iteracion vamos dentro del ciclo while n_count < n: # Condición de terminación del ciclo first_n.append(n_count) # ALmacenamos el contador (contablizador del ciclo) en la lista n_count += 1 # Sumamos uno al contador puesto que termina ek ciclo, si no nunca n_count será mayor o igual que n y tendremos un loop infinito print(f"FIRST n (n={n}) WHILE: {first_n}") return first_n def get_first_n_pair_for(self, n): # Ejercicio """ Obtener los primeros n pares en una lista con for """ return [] def get_first_n_pair_while(self, n): # Ejercicio """ Obtener los primeros n pares en una lista con while """ return [] def get_factorial_for(self, n): # Ejercicio """ Obtener el factorial de n con for, regresa un int """ return 0 def get_factorial_while(self, n): # Ejercicio """ Obtener el factorial de n con while, regresa un int """ return 0 def get_factorial_recursive(self, n): #Ejemplo """ Obtener el factorial de n recursivamente, regresa un int """ if n <= 1: return 1 return n * self.get_factorial_recursive(n-1) def get_n_pow_2_for(self, n): # Ejemplo """ Obtener el cuadrado de los primeros n con for, regresa una lista """ n_pow_2 = [] for i in range(n): n_pow_2.append( i ** 2 ) print(f"FIRST n (n={n}) POW 2: {n_pow_2}") return n_pow_2 def get_n_pow_2_while(self, n): # Ejercicio """ Obtener el cuadrado de los primeros n con while, regresa una lista """ return [] def get_n_sum_recursive(self, n): #Ejemplo """ Obtener la suma de los primeros n recursivamente, regresa un int """ if n <= 0: return 0 return n + self.get_n_sum_recursive(n-1) def get_n_sum_for(self, n): # Ejercicio """ Obtener la suma de los primeros n con for, regresa un int """ return 0 def get_n_sum_while(self, n): # Ejercicio """ Obtener la suma de los primeros n con while, regresa un int """ return 0
32.842105
153
0.580769
442
3,120
3.947964
0.208145
0.051576
0.061891
0.084241
0.64298
0.496275
0.445845
0.383954
0.303725
0.262464
0
0.010189
0.339423
3,120
95
154
32.842105
0.836487
0.426282
0
0.297872
0
0
0.057564
0
0
0
0
0
0
1
0.276596
false
0.021277
0
0
0.595745
0.06383
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
2bb54433df4a33be1c15828033b92db97d255dc1
185
py
Python
coding/learn_numpy/np_array.py
yatao91/learning_road
e88dc43de98e35922bfc71c222ec71766851e618
[ "MIT" ]
3
2021-05-25T16:58:52.000Z
2022-02-05T09:37:17.000Z
coding/learn_numpy/np_array.py
yataosu/learning_road
e88dc43de98e35922bfc71c222ec71766851e618
[ "MIT" ]
null
null
null
coding/learn_numpy/np_array.py
yataosu/learning_road
e88dc43de98e35922bfc71c222ec71766851e618
[ "MIT" ]
null
null
null
# -*- coding: UTF-8 -*- import numpy as np a = np.array([1, 2, 3]) b = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) b[1, 1] = 10 print(a.shape) print(b.shape) print(a.dtype) print(b)
14.230769
47
0.524324
40
185
2.425
0.55
0.14433
0.164948
0.185567
0.206186
0
0
0
0
0
0
0.114094
0.194595
185
12
48
15.416667
0.536913
0.113514
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.125
0
0.125
0.5
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
2
2bb6b8dc9d6efeb962c91afa86582cc1b0e45838
5,549
py
Python
musket/gs_ballistic.py
vashu1/data_snippets
b0ae5230d60c2054c7b9278093533b7f71f3758b
[ "MIT" ]
1
2021-02-10T20:33:43.000Z
2021-02-10T20:33:43.000Z
musket/gs_ballistic.py
vashu1/data_snippets
b0ae5230d60c2054c7b9278093533b7f71f3758b
[ "MIT" ]
null
null
null
musket/gs_ballistic.py
vashu1/data_snippets
b0ae5230d60c2054c7b9278093533b7f71f3758b
[ "MIT" ]
null
null
null
from array import array from math import * feetToMeter = 0.3048 poundToKg = 0.453592 #DIAMETER=125 DIAMETER = 55#18 # mm 1000 = 1 m DENSITY = 5.5 #11.3 # kg/l 5.5 = density of iron 11.3 - lead SPEED = 450 # m/s 320 - speed of sound ELEVATION_D = 0 # degrees ELEVATION_Y = 2 # meters DISTANCE_STEP = 20 # meters # ALGORITM SOURCE # http://www.frfrogspad.com/coefdrag.gif # http://arc.id.au/CannonBallistics.html # http://arc.id.au/CannonballDrag.html # DRAG TABLE SOURCE # http://www.snipercountry.com/ballistics/software/mctraj4.zip # GS ballistics raw - even indexes are speed in thousands of ft per sec, odd are ballistic coeff. # TEST # http://www.frfrogspad.com/extbal2.htm#Shotgun # A 75 yd "zero" is assumed # 00 buckshot: 3.48 gr, with a diameter of about 8.4 mm (.33 inch). # SETTINGS: # DIAMETER = 8.4 # mm 1000 = 1 m # DENSITY = 11.3 # kg/l 11.3 - lead # SPEED = 1290*feetToMeter # m/s 320 - speed of sound # ELEVATION_D = 0.1 # degrees # ELEVATION_Y = 10 # meters # DISTANCE_STEP = 22.5 # meters # Calculated: Weight(kg) = 0.00350683170222 # Data # Range(ya) V(ya/s) Calculated # 0 1290 1290 # 25 1050 1068 # 50 930 909 # 75 840 790 # 100 770 697 # 125 710 621 # 150 610 558 # relative error less that 10%(partially explained by different GS for small projectiles) gsTable = array('d', [0.00 , 0.4662, 0.05 , 0.4689, 0.10 , 0.4717, 0.15 , 0.4745, 0.20 , 0.4772, 0.25 , 0.4800, 0.30 , 0.4827, 0.35 , 0.4852, 0.40 , 0.4882, 0.45 , 0.4920, 0.50 , 0.4970, 0.55 , 0.5080, 0.60 , 0.5260, 0.65 , 0.5590, 0.70 , 0.5920, 0.75 , 0.6258, 0.80 , 0.6610, 0.85 , 0.6985, 0.90 , 0.7370, 0.95 , 0.7757, 1.0 , 0.8140, 1.05 , 0.8512, 1.10 , 0.8870, 1.15 , 0.9210, 1.20 , 0.9510, 1.25 , 0.9740, 1.30 , 0.9910, 1.35 , 0.9990, 1.40 , 1.0030, 1.45 , 1.0060, 1.50 , 1.0080, 1.55 , 1.0090, 1.60 , 1.0090, 1.65 , 1.0090, 1.70 , 1.0090, 1.75 , 1.0080, 1.80 , 1.0070, 1.85 , 1.0060, 1.90 , 1.0040, 1.95 , 1.0025, 2.00 , 1.0010, 2.05 , 0.9990, 2.10 , 0.9970, 2.15 , 0.9956, 2.20 , 0.9940, 2.25 , 0.9916, 2.30 , 0.9890, 2.35 , 0.9869, 2.40 , 0.9850, 2.45 , 0.9830, 2.50 , 0.9810, 2.55 , 0.9790, 2.60 , 0.9770, 2.65 , 0.9750, 2.70 , 0.9730, 2.75 , 0.9710, 2.80 , 0.9690, 2.85 , 0.9670, 2.90 , 0.9650, 2.95 , 0.9630, 3.00 , 0.9610, 3.05 , 0.9589, 3.10 , 0.9570, 3.15 , 0.9555, 3.20 , 0.9540, 3.25 , 0.9520, 3.30 , 0.9500, 3.35 , 0.9485, 3.40 , 0.9470, 3.45 , 0.9450, 3.50 , 0.9430, 3.55 , 0.9414, 3.60 , 0.9400, 3.65 , 0.9385, 3.70 , 0.9370, 3.75 , 0.9355, 3.80 , 0.9340, 3.85 , 0.9325, 3.90 , 0.9310, 3.95 , 0.9295, 4.00 , 0.9280]); gsTableLength = gsTable.buffer_info()[1]; # drag coefficien for any shrapnel shape # FRAGMENTATION AND LETHALITY ANALISYS # Ballistics 2013: 27th International Symposium on Ballistics, p. 665 # http://books.google.ru/books?id=7cdm9VOpB1oC&pg=PA668&lpg=PA668&dq=shrapnel+drag-function&source=bl&ots=fUdAkYPbx2&sig=X8qSKXfnX4XgzEAY9sYsV4d7eOg&hl=en&sa=X&ei=MwdtUp-ADqvU4wS2q4HYDw&ved=0CCUQ6AEwAA#v=onepage&q=shrapnel%20drag-function&f=false # on subsonic speed it slightly worse than sphere # on supersonic less than 10% better(sharp eges I'd guess) def GSapprox(feetPerSecond): tableSpeed = feetPerSecond*feetToMeter / 320.0 # ratio to sound speed if(tableSpeed<0): raise Exception('GSapprox: negative speed'); if(tableSpeed>=gsTable[gsTableLength-2]): raise Exception('GSapprox: too big speed'); for i in range(0, gsTableLength-1, 2): if( (gsTable[i] <= tableSpeed) and (tableSpeed < gsTable[i+2]) ): return gsTable[i+1] + (tableSpeed-gsTable[i])/(gsTable[i+2]-gsTable[i])*(gsTable[i+3]-gsTable[i+1]); def plotShrapnel(d, m, u, theta, y0): g = 0#32.2; # acceleration due to gravity (9.8 m/s) rho = 0.074; # density of air (1.225 kg/m^3) phi = 3.158E-5; # atm density scale factor (9.626E-6 /m) #Cd, decel, H; # drag coeff, deceleration, altitude factor x = 0.0; # range y = y0; # height V = u; # magnitude of velocity vector vx = V*cos(pi*theta/180.0); # x vel component vy = V*sin(pi*theta/180.0); #ax, ay; # acceleration components dt = 0.0001; # time step size distanceMark = 0; while (y>0): # stop track when bullet hits ground Cd = GSapprox(V); H = exp(-phi*y); decel = Cd*rho*H*pi*d*d/(m*8.0); ax = -decel*V*vx; ay = -g -decel*V*vy; vx = vx + ax*dt; vy = vy + ay*dt; V = sqrt(vx*vx+vy*vy); x = x + vx*dt + ax*dt*dt/2.0; y = y + vy*dt + ay*dt*dt/2.0; if((x*feetToMeter)>(distanceMark)): distanceMark += DISTANCE_STEP; print("Distance: " + str(round(x*feetToMeter)) + "(" + str(round(x/3.0)) + " ya) Speed: " + str(round(V*feetToMeter)) + "(" + str(round(V)) + \ " ft/s) Energy: " + str(round((V*feetToMeter)*(V*feetToMeter)*(m*poundToKg)/2.0)) + \ " Height=" + str(round(y*feetToMeter))) print(" Range = "+str(round(x*feetToMeter))+" m") def printShrapnel(speed, diam, density): volume = (4.0/3.0)*pi*diam*diam*diam/8.0; # m^3 weight = density*volume*1000.0; print("Volume(lt) = " + str(volume*1000.0)) print("Speed(m/s) = " + str(speed)) print("Weight(kg) = " + str(weight)) plotShrapnel(diam/feetToMeter, weight/poundToKg, speed / feetToMeter, ELEVATION_D, ELEVATION_Y / feetToMeter); printShrapnel(SPEED, DIAMETER/1000.0, DENSITY)
51.37963
1,401
0.599207
963
5,549
3.442368
0.36864
0.019306
0.00724
0.004827
0.025943
0.016893
0.016893
0.016893
0.016893
0
0
0.21848
0.229591
5,549
107
1,402
51.859813
0.556959
0.346549
0
0
0
0
0.042596
0
0
0
0
0
0
1
0.052632
false
0
0.035088
0
0.105263
0.122807
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2bc8ad0211378fff6dd5d1b4b61d11fb61dac432
34,391
py
Python
lab9/tests.py
artuchavez/ArtificialIntelligence
474af06898bd2b0bb78e916358d442b0f1f24168
[ "MIT" ]
null
null
null
lab9/tests.py
artuchavez/ArtificialIntelligence
474af06898bd2b0bb78e916358d442b0f1f24168
[ "MIT" ]
5
2018-08-01T14:06:01.000Z
2021-06-25T15:16:57.000Z
lab9/tests.py
y1ngyang/ailab
f96b88e69448b7cd49cd6f6a31094893933de3ce
[ "Unlicense" ]
null
null
null
# MIT 6.034 Lab 9: Boosting (Adaboost) from tester import make_test, get_tests from utils import * lab_number = 9 #for tester.py F = Fraction #lazy alias def initialize_2_getargs() : #TEST 1 return [["PointA"]] initialize_2_expected = {"PointA":1} def initialize_2_testanswer(val, original_val = None) : return val == initialize_2_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = initialize_2_getargs, testanswer = initialize_2_testanswer, expected_val = str(initialize_2_expected), name = 'initialize_weights') def initialize_3_getargs() : #TEST 2 return [["-6","-5","-4","-3","-2","-1","0","1","2","3","4","5"]] initialize_3_expected = {"-6":F(1,12),"-5":F(1,12),"-4":F(1,12), "-3":F(1,12),"-2":F(1,12),"-1":F(1,12), "0":F(1,12),"1":F(1,12),"2":F(1,12), "3":F(1,12),"4":F(1,12),"5":F(1,12)} def initialize_3_testanswer(val, original_val = None) : return val == initialize_3_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = initialize_3_getargs, testanswer = initialize_3_testanswer, expected_val = str(initialize_3_expected), name = 'initialize_weights') # TEST 0 FOR CALCULATE_ERROR_RATE - ALL POINTS CORRECTLY CLASSIFIED # only one classifier def calculate_error_rates_0_getargs() : #TEST 3 return [{"0" : F(1,4), "1": F(1,4), "2": F(1,4), "3": F(1,4)}, {"classifier_0":[]}] calculate_error_rates_0_expected = {"classifier_0" : 0} def calculate_error_rates_0_testanswer(val, original_val = None) : return val == calculate_error_rates_0_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = calculate_error_rates_0_getargs, testanswer = calculate_error_rates_0_testanswer, expected_val = str(calculate_error_rates_0_expected), name = 'calculate_error_rates') # TEST 2 FOR CALCULATE_ERROR_RATE - SOME POINTS MISCLASSIFIED def calculate_error_rates_2_getargs() : #TEST 4 return [{"0" : F(1,8), "1": F(1,8), "2": F(1,8), "3": F(1,8), "4": F(1,2)}, {"classifier_0":["0", "1", "4"], "classifier_1":["0", "1", "2", "3"]}] calculate_error_rates_2_expected = {"classifier_0" : F(3,4), "classifier_1": F(1,2)} def calculate_error_rates_2_testanswer(val, original_val = None) : return val == calculate_error_rates_2_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = calculate_error_rates_2_getargs, testanswer = calculate_error_rates_2_testanswer, expected_val = str(calculate_error_rates_2_expected), name = 'calculate_error_rates') def pick_best_classifier_0_getargs() : #TEST 5 #have a perfect test! classifier_to_error_rate = {} classifier_to_error_rate["classifier_0"] = 0 classifier_to_error_rate["classifier_1/10"] = F(1,10) classifier_to_error_rate["classifier_1/2"] = F(1,2) classifier_to_error_rate["classifier_9/10"] = F(9,10) return [classifier_to_error_rate] pick_best_classifier_0_expected = "classifier_0" def pick_best_classifier_0_testanswer(val, original_val = None) : return val == pick_best_classifier_0_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = pick_best_classifier_0_getargs, testanswer = pick_best_classifier_0_testanswer, expected_val = str(pick_best_classifier_0_expected), name = 'pick_best_classifier') def pick_best_classifier_1_getargs() : #TEST 6 #have a pretty good test classifier_to_error_rate = {} classifier_to_error_rate["classifier_1/10"] = F(1,10) classifier_to_error_rate["classifier_1/2"] = F(1,2) classifier_to_error_rate["classifier_9/10"] = F(9,10) return [classifier_to_error_rate] pick_best_classifier_1_expected = "classifier_1/10" def pick_best_classifier_1_testanswer(val, original_val = None) : return val == pick_best_classifier_1_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = pick_best_classifier_1_getargs, testanswer = pick_best_classifier_1_testanswer, expected_val = str(pick_best_classifier_1_expected), name = 'pick_best_classifier') def pick_best_classifier_2_getargs() : #TEST 7 #no good tests; raise error classifier_to_error_rate = {} classifier_to_error_rate["classifier_1/2"] = F(1,2) classifier_to_error_rate["classifier_6/10"] = F(6,10) classifier_to_error_rate["classifier_9/10"] = F(9,10) return [classifier_to_error_rate] pick_best_classifier_2_expected = NoGoodClassifiersError def pick_best_classifier_2_testanswer(val, original_val = None) : return val == pick_best_classifier_2_expected make_test(type = 'FUNCTION_EXPECTING_EXCEPTION', getargs = pick_best_classifier_2_getargs, testanswer = pick_best_classifier_2_testanswer, expected_val = str(pick_best_classifier_2_expected), name = 'pick_best_classifier') def pick_best_classifier_2a_getargs() : #TEST 8 #no good tests; raise error return [dict(cl1=F(1,2), cl2=F(1,2)), False] pick_best_classifier_2a_expected = NoGoodClassifiersError def pick_best_classifier_2a_testanswer(val, original_val = None) : return val == pick_best_classifier_2a_expected make_test(type = 'FUNCTION_EXPECTING_EXCEPTION', getargs = pick_best_classifier_2a_getargs, testanswer = pick_best_classifier_2a_testanswer, expected_val = str(pick_best_classifier_2a_expected), name = 'pick_best_classifier') def pick_best_classifier_2b_getargs() : #TEST 9 #lowest error rate is 1/2, but best test is 9/10 classifier_to_error_rate = {} classifier_to_error_rate["classifier_1/2"] = F(1,2) classifier_to_error_rate["classifier_6/10"] = F(6,10) classifier_to_error_rate["classifier_9/10"] = F(9,10) return [classifier_to_error_rate, False] pick_best_classifier_2b_expected = "classifier_9/10" def pick_best_classifier_2b_testanswer(val, original_val = None) : return val == pick_best_classifier_2b_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = pick_best_classifier_2b_getargs, testanswer = pick_best_classifier_2b_testanswer, expected_val = str(pick_best_classifier_2b_expected), name = 'pick_best_classifier') def pick_best_classifier_4_getargs() : #TEST 10 #have perfectly wrong test classifier_to_error_rate = {} classifier_to_error_rate["classifier_1/10"] = F(1,10) classifier_to_error_rate["classifier_6/10"] = F(6,10) classifier_to_error_rate["classifier_9/10"] = F(9,10) classifier_to_error_rate["classifier_1"] = 1 return [classifier_to_error_rate, False] pick_best_classifier_4_expected = "classifier_1" def pick_best_classifier_4_testanswer(val, original_val = None) : return val == pick_best_classifier_4_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = pick_best_classifier_4_getargs, testanswer = pick_best_classifier_4_testanswer, expected_val = str(pick_best_classifier_4_expected), name = 'pick_best_classifier') #check tie-breaking def pick_best_classifier_5_getargs() : #TEST 11 return [dict(B=F(3,10), A=F(4,10), C=F(3,10))] pick_best_classifier_5_expected = "B" def pick_best_classifier_5_testanswer(val, original_val = None) : return val == pick_best_classifier_5_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = pick_best_classifier_5_getargs, testanswer = pick_best_classifier_5_testanswer, expected_val = str(pick_best_classifier_5_expected) \ +' (Hint: This test checks tie-breaking.)', name = 'pick_best_classifier') #check not comparing floats def pick_best_classifier_6_getargs() : #TEST 12 return [dict(cl_1=F(2,3), cl_2=F(1,3)), False] pick_best_classifier_6_expected = "cl_1" def pick_best_classifier_6_testanswer(val, original_val = None) : return val == pick_best_classifier_6_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = pick_best_classifier_6_getargs, testanswer = pick_best_classifier_6_testanswer, expected_val = str(pick_best_classifier_6_expected) \ +" (Hint: Make sure you're using Fractions, and not comparing floats!)", name = 'pick_best_classifier') def calculate_voting_power_0_getargs() : #TEST 13 return [.001] calculate_voting_power_0_expected = 3.453377389324277 def calculate_voting_power_0_testanswer(val, original_val = None) : return approx_equal(val, calculate_voting_power_0_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = calculate_voting_power_0_getargs, testanswer = calculate_voting_power_0_testanswer, expected_val = str(calculate_voting_power_0_expected), name = 'calculate_voting_power') def calculate_voting_power_3_getargs() : #TEST 14 return [.3] calculate_voting_power_3_expected = 0.42364893019360184 def calculate_voting_power_3_testanswer(val, original_val = None) : return approx_equal(val, calculate_voting_power_3_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = calculate_voting_power_3_getargs, testanswer = calculate_voting_power_3_testanswer, expected_val = str(calculate_voting_power_3_expected), name = 'calculate_voting_power') def calculate_voting_power_4_getargs() : #TEST 15 return [.7] calculate_voting_power_4_expected = -0.4236489301936017 def calculate_voting_power_4_testanswer(val, original_val = None) : return approx_equal(val, calculate_voting_power_4_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = calculate_voting_power_4_getargs, testanswer = calculate_voting_power_4_testanswer, expected_val = str(calculate_voting_power_4_expected), name = 'calculate_voting_power') #perfect classifier -> INF def calculate_voting_power_5_getargs() : #TEST 16 return [0] calculate_voting_power_5_expected = INF def calculate_voting_power_5_testanswer(val, original_val = None) : return val == calculate_voting_power_5_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = calculate_voting_power_5_getargs, testanswer = calculate_voting_power_5_testanswer, expected_val = str(calculate_voting_power_5_expected), name = 'calculate_voting_power') #perfectly wrong classifier -> -INF def calculate_voting_power_6_getargs() : #TEST 17 return [1] calculate_voting_power_6_expected = -INF def calculate_voting_power_6_testanswer(val, original_val = None) : return val == calculate_voting_power_6_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = calculate_voting_power_6_getargs, testanswer = calculate_voting_power_6_testanswer, expected_val = str(calculate_voting_power_6_expected), name = 'calculate_voting_power') def get_overall_misclassifications_0_getargs() : #TEST 18 return [[("h1", 1)], ['ptA','ptB'], {'h1':['ptA','ptB'],'h2':['ptA']}] get_overall_misclassifications_0_expected = set(['ptA', 'ptB']) def get_overall_misclassifications_0_testanswer(val, original_val = None) : return val == get_overall_misclassifications_0_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = get_overall_misclassifications_0_getargs, testanswer = get_overall_misclassifications_0_testanswer, expected_val = str(get_overall_misclassifications_0_expected), name = 'get_overall_misclassifications') #All classifiers included in H #h with voting power of 0 #H misclassifies A def get_overall_misclassifications_1_getargs() : #TEST 19 return [[("h1", 1),("h2", 0)], ['A','B'], {'h1': ['A'], 'h2': ['B']}] get_overall_misclassifications_1_expected = set('A') def get_overall_misclassifications_1_testanswer(val, original_val = None) : return val == get_overall_misclassifications_1_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = get_overall_misclassifications_1_getargs, testanswer = get_overall_misclassifications_1_testanswer, expected_val = str(get_overall_misclassifications_1_expected), name = 'get_overall_misclassifications') # Not all points misclassified by any classifier # H misclassifies A & B def get_overall_misclassifications_2_getargs() : #TEST 20 return [[("h1", .5),("h2", .3),("h3", .76)], ['A','B','C','D'], {'h1': ['A'], 'h2': ['A','B'], 'h3': ['B','C']}] get_overall_misclassifications_2_expected = set('AB') def get_overall_misclassifications_2_testanswer(val, original_val = None) : return val == get_overall_misclassifications_2_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = get_overall_misclassifications_2_getargs, testanswer = get_overall_misclassifications_2_testanswer, expected_val = str(get_overall_misclassifications_2_expected), name = 'get_overall_misclassifications') #No points misclassified by h3 #H misclassifies C def get_overall_misclassifications_3_getargs() : #TEST 21 return [[("h1", .5),("h2", -.3),("h3", .76)], ['A','B','C'], {'h1': ['A','C'], 'h2': ['A','B'], 'h3': []}] get_overall_misclassifications_3_expected = set('C') def get_overall_misclassifications_3_testanswer(val, original_val = None) : return val == get_overall_misclassifications_3_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = get_overall_misclassifications_3_getargs, testanswer = get_overall_misclassifications_3_testanswer, expected_val = str(get_overall_misclassifications_3_expected), name = 'get_overall_misclassifications') #All negative voting powers #H misclassifies A,B,D def get_overall_misclassifications_4_getargs() : #TEST 22 return [[("h1", -.5),("h2", -.3),("h3", -.45)], ['A','B','C','D'], {'h1': ['A','C'], 'h2': ['B','C'], 'h3': ['D']}] get_overall_misclassifications_4_expected = set('ABD') def get_overall_misclassifications_4_testanswer(val, original_val = None) : return val == get_overall_misclassifications_4_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = get_overall_misclassifications_4_getargs, testanswer = get_overall_misclassifications_4_testanswer, expected_val = str(get_overall_misclassifications_4_expected), name = 'get_overall_misclassifications') #misclassified training point is not listed in misclassifications #same classifier used multiple times def get_overall_misclassifications_5_getargs() : #TEST 23 return [[("h1", -0.549),("h2", 0.347),("h1", -0.255)], list('ABCD'), dict(h1=list('ABC'), h2=list('AC'), h3=list('BC'))] get_overall_misclassifications_5_expected = set('D') def get_overall_misclassifications_5_testanswer(val, original_val = None) : return val == get_overall_misclassifications_5_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = get_overall_misclassifications_5_getargs, testanswer = get_overall_misclassifications_5_testanswer, expected_val = str(get_overall_misclassifications_5_expected) \ +' (Hint: What happens if a training point is misclassified by ' \ +'H, but not misclassified by any weak classifier?)', name = 'get_overall_misclassifications') #one point misclassified, vote is a tie # (No, this particular situation would not happen in Adaboost.) def get_overall_misclassifications_6_getargs() : #TEST 24 return [[("h1", 0.5), ("h2", 0.5)], ['A','B'], {'h1': ['A'], 'h2': []}] get_overall_misclassifications_6_expected = set('A') def get_overall_misclassifications_6_testanswer(val, original_val = None) : return val == get_overall_misclassifications_6_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = get_overall_misclassifications_6_getargs, testanswer = get_overall_misclassifications_6_testanswer, expected_val = str(get_overall_misclassifications_6_expected) \ +' (Hint: This test checks what happens when the vote is a tie.)', name = 'get_overall_misclassifications') #violates triangle sum property def get_overall_misclassifications_7_getargs() : #TEST 25 return [[("h1", 0.5), ("h2", 0.2), ("h3", 0.2)], list('ABCD'), {'h1': ['A'], 'h2': ['B'], 'h3': ['C']}] get_overall_misclassifications_7_expected = set('A') def get_overall_misclassifications_7_testanswer(val, original_val = None) : return val == get_overall_misclassifications_7_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = get_overall_misclassifications_7_getargs, testanswer = get_overall_misclassifications_7_testanswer, expected_val = str(get_overall_misclassifications_7_expected) \ +" (Hint: Make sure you're summing voting powers, not just " +'counting classifiers.)', name = 'get_overall_misclassifications') # recitation problem from 2012 Q4; all points correctly classified def get_overall_misclassifications_8_getargs() : #TEST 26 H = [('<6', 0.693), ('<2', 0.549), ('>4', 0.805)] classifier_to_misclassified = {'<6': ['C'], '<4': ['C', 'B', 'E'], '<2': ['B', 'E'], '>2': ['A', 'C', 'D'], '>4': ['A', 'D'], '>6': ['A', 'B', 'D', 'E']} return [H, list('ABCDE'), classifier_to_misclassified] get_overall_misclassifications_8_expected = set() def get_overall_misclassifications_8_testanswer(val, original_val = None) : return val == get_overall_misclassifications_8_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = get_overall_misclassifications_8_getargs, testanswer = get_overall_misclassifications_8_testanswer, expected_val = str(get_overall_misclassifications_8_expected), name = 'get_overall_misclassifications') #same classifier used multiple times def get_overall_misclassifications_9_getargs() : #TEST 27 H = [('good_h', 0.1), ('bad_h1', 0.14), ('good_h', 0.1), ('bad_h2', 0.14), ('good_h', 0.1), ('bad_h3', 0.04)] classifier_to_misclassified = {'good_h': ['A'], 'bad_h1': ['B', 'C'], 'bad_h2': ['C', 'D'], 'bad_h3': ['B', 'D']} return [H, list('ABCD'), classifier_to_misclassified] get_overall_misclassifications_9_expected = set() def get_overall_misclassifications_9_testanswer(val, original_val = None) : return val == get_overall_misclassifications_9_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = get_overall_misclassifications_9_getargs, testanswer = get_overall_misclassifications_9_testanswer, expected_val = str(get_overall_misclassifications_9_expected), name = 'get_overall_misclassifications') def is_good_enough_0_getargs() : #TEST 28 return [[("h1", 1)], ['A','B'], {'h1':['A','B'],'h2':['A']}, 1] is_good_enough_0_expected = False def is_good_enough_0_testanswer(val, original_val = None) : return val == is_good_enough_0_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = is_good_enough_0_getargs, testanswer = is_good_enough_0_testanswer, expected_val = str(is_good_enough_0_expected), name = 'is_good_enough') #All classifiers included in H #h with voting power of 0 #H misclassifies A = mistake_tolerance def is_good_enough_1_getargs() : #TEST 29 return [[("h1", 1),("h2", 0)], ['A','B'], {'h1': ['A'], 'h2': ['B']}, 1] is_good_enough_1_expected = True def is_good_enough_1_testanswer(val, original_val = None) : return val == is_good_enough_1_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = is_good_enough_1_getargs, testanswer = is_good_enough_1_testanswer, expected_val = str(is_good_enough_1_expected) + \ ' (Hint: What should happen when H misclassifies exactly' \ + ' mistake_tolerance points?)', name = 'is_good_enough') # Not all points misclassified by any classifier # H misclassifies A & B > mistake tolerance def is_good_enough_2_getargs() : #TEST 30 return [[("h1", .5),("h2", .3),("h3", .76)], ['A','B','C','D'], {'h1': ['A'], 'h2': ['A','B'], 'h3': ['B','C']}, 1] is_good_enough_2_expected = False def is_good_enough_2_testanswer(val, original_val = None) : return val == is_good_enough_2_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = is_good_enough_2_getargs, testanswer = is_good_enough_2_testanswer, expected_val = str(is_good_enough_2_expected), name = 'is_good_enough') #No points misclassified by h3 #H misclassifies C = mistake_tolerance def is_good_enough_3_getargs() : #TEST 31 return [[("h1", .5),("h2", -.3),("h3", .76)], ['A','B','C'], {'h1': ['A','C'], 'h2': ['A','B'], 'h3': []}, 1] is_good_enough_3_expected = True def is_good_enough_3_testanswer(val, original_val = None) : return val == is_good_enough_3_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = is_good_enough_3_getargs, testanswer = is_good_enough_3_testanswer, expected_val = str(is_good_enough_3_expected) + \ ' (Hint: What should happen when H misclassifies exactly' \ + ' mistake_tolerance points?)', name = 'is_good_enough') #All negative voting powers #H misclassifies A,B,D > mistake_tolerance def is_good_enough_4_getargs() : #TEST 32 return [[("h1", -.5),("h2", -.3),("h3", -.45)], ['A','B','C','D'], {'h1': ['A','C'], 'h2': ['B','C'], 'h3': ['D']}, 2] is_good_enough_4_expected = False def is_good_enough_4_testanswer(val, original_val = None) : return val == is_good_enough_4_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = is_good_enough_4_getargs, testanswer = is_good_enough_4_testanswer, expected_val = str(is_good_enough_4_expected), name = 'is_good_enough') #misclassified training point is not listed in misclassifications def is_good_enough_5_getargs() : #TEST 33 return [[("h1", -0.549),("h2", 0.347)], list('ABCD'), dict(h1=list('ABC'), h2=list('AC'), h3=list('BC')), 0] is_good_enough_5_expected = False def is_good_enough_5_testanswer(val, original_val = None) : return val == is_good_enough_5_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = is_good_enough_5_getargs, testanswer = is_good_enough_5_testanswer, expected_val = str(is_good_enough_5_expected) \ +' (Hint: What happens if a training point is misclassified by ' \ +'H, but not misclassified by any weak classifier?)', name = 'is_good_enough') #one point misclassified, vote is a tie # (No, this particular situation would not happen in Adaboost.) def is_good_enough_6_getargs() : #TEST 34 return [[("h1", 0.5), ("h2", 0.5)], ['A','B'], {'h1': ['A'], 'h2': []}, 0] is_good_enough_6_expected = False def is_good_enough_6_testanswer(val, original_val = None) : return val == is_good_enough_6_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = is_good_enough_6_getargs, testanswer = is_good_enough_6_testanswer, expected_val = str(is_good_enough_6_expected) \ +' (Hint: This test checks what happens when the vote is a tie.)', name = 'is_good_enough') #violates triangle sum property def is_good_enough_7_getargs() : #TEST 35 return [[("h1", 0.5), ("h2", 0.2), ("h3", 0.2)], list('ABCD'), {'h1': ['A'], 'h2': ['B'], 'h3': ['C']}, 0] is_good_enough_7_expected = False def is_good_enough_7_testanswer(val, original_val = None) : return val == is_good_enough_7_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = is_good_enough_7_getargs, testanswer = is_good_enough_7_testanswer, expected_val = str(is_good_enough_7_expected) \ +" (Hint: Make sure you're summing voting powers, not just " +'counting classifiers.)', name = 'is_good_enough') # recitation problem from 2012 Q4 def is_good_enough_8_getargs() : #TEST 36 H = [('<6', 0.693), ('<2', 0.549), ('>4', 0.805)] classifier_to_misclassified = {'<6': ['C'], '<4': ['C', 'B', 'E'], '<2': ['B', 'E'], '>2': ['A', 'C', 'D'], '>4': ['A', 'D'], '>6': ['A', 'B', 'D', 'E']} return [H, list('ABCDE'), classifier_to_misclassified, 0] is_good_enough_8_expected = True def is_good_enough_8_testanswer(val, original_val = None) : return val == is_good_enough_8_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = is_good_enough_8_getargs, testanswer = is_good_enough_8_testanswer, expected_val = str(is_good_enough_8_expected), name = 'is_good_enough') #same classifier used multiple times def is_good_enough_9_getargs() : #TEST 37 H = [('good_h', 0.1), ('bad_h1', 0.14), ('good_h', 0.1), ('bad_h2', 0.14), ('good_h', 0.1), ('bad_h3', 0.04)] classifier_to_misclassified = {'good_h': ['A'], 'bad_h1': ['B', 'C'], 'bad_h2': ['C', 'D'], 'bad_h3': ['B', 'D']} return [H, list('ABCD'), classifier_to_misclassified, 0] is_good_enough_9_expected = True def is_good_enough_9_testanswer(val, original_val = None) : return val == is_good_enough_9_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = is_good_enough_9_getargs, testanswer = is_good_enough_9_testanswer, expected_val = str(is_good_enough_9_expected), name = 'is_good_enough') def update_weights_0_getargs() : #TEST 38 return [{'A':F(1,6), 'B':F(1,6), 'C':F(1,6), 'D':F(1,6), 'E':F(1,6), 'F': F(1,6)}, ['A', 'B'], F(2,6)] update_weights_0_expected = {'A':F(1,4), 'B':F(1,4), 'C':F(1,8), 'D':F(1,8), 'E':F(1,8), 'F':F(1,8)} def update_weights_0_testanswer(val, original_val = None) : return val == update_weights_0_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = update_weights_0_getargs, testanswer = update_weights_0_testanswer, expected_val = str(update_weights_0_expected), name = 'update_weights') def update_weights_2_getargs() : #TEST 39 return [{'A':F(1,2), 'B':F(1,2)}, [], 0] update_weights_2_expected = {'A':F(1,4), 'B':F(1,4)} def update_weights_2_testanswer(val, original_val = None) : return val == update_weights_2_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = update_weights_2_getargs, testanswer = update_weights_2_testanswer, expected_val = str(update_weights_2_expected), name = 'update_weights') def update_weights_3_getargs() : #TEST 40 return [{'A':F(1,2), 'B':F(1,2)}, ['A', 'B'], 1] update_weights_3_expected = {'A':F(1,4), 'B':F(1,4)} def update_weights_3_testanswer(val, original_val = None) : return val == update_weights_3_expected make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = update_weights_3_getargs, testanswer = update_weights_3_testanswer, expected_val = str(update_weights_3_expected), name = 'update_weights') #recitation problem, from 2012 Quiz 4 boost_2012_tr_pts = ["A","B","C","D","E"] boost_2012_cl_to_miscl = {"<2":["B","E"], "<4":["C","B","E"], "<6":["C"], ">2":["A","C","D"], ">4":["A","D"], ">6":["A","B","D","E"]} #1 round def adaboost_0_getargs() : #TEST 41 return [boost_2012_tr_pts, boost_2012_cl_to_miscl, True, 0, 1] adaboost_0_expected = [("<6",.5*ln(4))] def adaboost_0_testanswer(val, original_val = None) : return classifier_approx_equal(val, adaboost_0_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = adaboost_0_getargs, testanswer = adaboost_0_testanswer, expected_val = str(adaboost_0_expected), name = 'adaboost') #2 rounds def adaboost_1_getargs() : #TEST 42 return [boost_2012_tr_pts, boost_2012_cl_to_miscl, True, 0, 2] adaboost_1_expected = [("<6",.5*ln(4)), ("<2", .5*ln(3))] def adaboost_1_testanswer(val, original_val = None) : return classifier_approx_equal(val, adaboost_1_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = adaboost_1_getargs, testanswer = adaboost_1_testanswer, expected_val = str(adaboost_1_expected), name = 'adaboost') #3 rounds def adaboost_2_getargs() : #TEST 43 return [boost_2012_tr_pts, boost_2012_cl_to_miscl, True, 0, 3] adaboost_2_expected = [("<6",.5*ln(4)), ("<2", .5*ln(3)), (">4",.5*ln(5))] def adaboost_2_testanswer(val, original_val = None) : return classifier_approx_equal(val, adaboost_2_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = adaboost_2_getargs, testanswer = adaboost_2_testanswer, expected_val = str(adaboost_2_expected), name = 'adaboost') #4 rounds (stops after 3) def adaboost_3_getargs() : #TEST 44 return [boost_2012_tr_pts, boost_2012_cl_to_miscl, True, 0, 4] adaboost_3_expected = [("<6",.5*ln(4)), ("<2", .5*ln(3)), (">4",.5*ln(5))] def adaboost_3_testanswer(val, original_val = None) : return classifier_approx_equal(val, adaboost_3_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = adaboost_3_getargs, testanswer = adaboost_3_testanswer, expected_val = str(adaboost_3_expected), name = 'adaboost') #INF rounds (stops after 3) def adaboost_4_getargs() : #TEST 45 return [boost_2012_tr_pts, boost_2012_cl_to_miscl, True, 0, INF] adaboost_4_expected = [("<6",.5*ln(4)), ("<2", .5*ln(3)), (">4",.5*ln(5))] def adaboost_4_testanswer(val, original_val = None) : return classifier_approx_equal(val, adaboost_4_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = adaboost_4_getargs, testanswer = adaboost_4_testanswer, expected_val = str(adaboost_4_expected), name = 'adaboost') #4 rounds (stops after 3); use error furthest from 1/2 def adaboost_5_getargs() : #TEST 46 return [boost_2012_tr_pts, boost_2012_cl_to_miscl, False, 0, 4] adaboost_5_expected = [("<6",.5*ln(4)), ("<2", .5*ln(3)), ("<4",-.5*ln(5))] def adaboost_5_testanswer(val, original_val = None) : return classifier_approx_equal(val, adaboost_5_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = adaboost_5_getargs, testanswer = adaboost_5_testanswer, expected_val = str(adaboost_5_expected), name = 'adaboost') #allow 1 misclassification; stops after 1 round def adaboost_6_getargs() : #TEST 47 return [boost_2012_tr_pts, boost_2012_cl_to_miscl, True, 1, 4] adaboost_6_expected = [("<6",.5*ln(4))] def adaboost_6_testanswer(val, original_val = None) : return classifier_approx_equal(val, adaboost_6_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = adaboost_6_getargs, testanswer = adaboost_6_testanswer, expected_val = str(adaboost_6_expected), name = 'adaboost') #toy problem: exits after 1 round with all error rates = 1/2 def adaboost_7_getargs() : #TEST 48 return [list('XYZ'), {'cl_1':['Z'], 'cl_2':['X','Y']}, True, 0, 3] adaboost_7_expected = [('cl_1', 0.5*ln(2))] def adaboost_7_testanswer(val, original_val = None) : return classifier_approx_equal(val, adaboost_7_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = adaboost_7_getargs, testanswer = adaboost_7_testanswer, expected_val = str(adaboost_7_expected) \ + ' (Hint: What should happen when the best error rate is 1/2?)', name = 'adaboost') boost_toy1_tr_pts = list('ABCD') boost_toy1_cl_to_miscl = {'h1':['A'], 'h2':list('BCD'), 'h3':list('ABC')} #toy problem: exits after 1 round with smallest error rate = 1/2 def adaboost_8_getargs() : #TEST 49 return [boost_toy1_tr_pts, boost_toy1_cl_to_miscl, True, 0, 4] adaboost_8_expected = [('h1', 0.5*ln(3))] def adaboost_8_testanswer(val, original_val = None) : return classifier_approx_equal(val, adaboost_8_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = adaboost_8_getargs, testanswer = adaboost_8_testanswer, expected_val = str(adaboost_8_expected), name = 'adaboost') #toy problem: has smallest error rate = 1/2 after 1 round, but continues def adaboost_9_getargs() : #TEST 50 return [boost_toy1_tr_pts, boost_toy1_cl_to_miscl, False, 0, 2] adaboost_9_expected = [('h1', 0.5*ln(3)), ('h3', -0.5*ln(5))] def adaboost_9_testanswer(val, original_val = None) : return classifier_approx_equal(val, adaboost_9_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = adaboost_9_getargs, testanswer = adaboost_9_testanswer, expected_val = str(adaboost_9_expected), name = 'adaboost') #picks same classifier multiple times def adaboost_91_getargs() : #TEST 51 return [boost_toy1_tr_pts, boost_toy1_cl_to_miscl, False, 0, 4] adaboost_91_expected = [('h1', 0.5*ln(3)), ('h3', -0.5*ln(5)), ('h1', 0.5*ln(F(7,3))), ('h3', -0.5*ln(F(9,5)))] def adaboost_91_testanswer(val, original_val = None) : return classifier_approx_equal(val, adaboost_91_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = adaboost_91_getargs, testanswer = adaboost_91_testanswer, expected_val = str(adaboost_91_expected), name = 'adaboost') #tolerance > 1 but continues multiple rounds; exits with error_rate=0.5 def adaboost_92_getargs() : #TEST 52 return [list('ABCDEFG'), dict(h1=list('ABC'), h2=list('ABD'), h3=list('ABE')), True, 2, 5] adaboost_92_expected = [('h1', 0.1438410362258895), ('h2', 0.08352704233158378), ('h3', 0.041982690058667164)] def adaboost_92_testanswer(val, original_val = None) : return classifier_approx_equal(val, adaboost_92_expected) make_test(type = 'FUNCTION_ENCODED_ARGS', getargs = adaboost_92_getargs, testanswer = adaboost_92_testanswer, expected_val = str(adaboost_92_expected), name = 'adaboost')
46.411606
106
0.68579
4,728
34,391
4.597504
0.054992
0.036804
0.10305
0.057414
0.857478
0.652206
0.593642
0.499057
0.481529
0.410912
0
0.048236
0.187404
34,391
740
107
46.474324
0.729586
0.07185
0
0.279339
0
0
0.124752
0.048983
0
0
0
0
0
1
0.171901
false
0
0.003306
0.157025
0.347107
0
0
0
0
null
0
0
0
1
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
1
0
0
0
2
2bcf0befbf511c74112319421a44b006ea574e12
15,442
py
Python
automol/tests/test_rings.py
sjklipp/automol
ba87f4443ebe2ceb5929d4269c4be93fd28f68ca
[ "Apache-2.0" ]
null
null
null
automol/tests/test_rings.py
sjklipp/automol
ba87f4443ebe2ceb5929d4269c4be93fd28f68ca
[ "Apache-2.0" ]
null
null
null
automol/tests/test_rings.py
sjklipp/automol
ba87f4443ebe2ceb5929d4269c4be93fd28f68ca
[ "Apache-2.0" ]
7
2019-12-18T20:11:06.000Z
2020-10-14T08:54:16.000Z
""" test ring functionality in graph """ from automol import graph from automol import smiles from automol import inchi from automol import geom from automol import zmat import numpy # cyclohexane ICH1 = 'InChI=1S/C6H12/c1-2-4-6-5-3-1/h1-6H2' # benzene ICH2 = 'InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H' # cyclic-ether ICH3 = 'InChI=1S/C7H14O/c1-2-4-6-8-7-5-3-1/h1-7H2' # 1-propylcyclopentane ICH4 = 'InChI=1S/C8H16/c1-2-5-8-6-3-4-7-8/h8H,2-7H2,1H3' # polycycle: cyclohexane+cyclopentane ICH5 = 'InChI=1S/C9H16/c1-2-5-9-7-3-6-8(9)4-1/h8-9H,1-7H2/t8-,9-/m1/s1' GEO1 = inchi.geometry(ICH1) GEO2 = inchi.geometry(ICH2) GEO3 = inchi.geometry(ICH3) GEO4 = inchi.geometry(ICH4) GEO5 = inchi.geometry(ICH5) ZMA1 = geom.zmatrix(GEO1) ZMA2 = geom.zmatrix(GEO2) ZMA3 = geom.zmatrix(GEO3) ZMA4 = geom.zmatrix(GEO4) ZMA5 = geom.zmatrix(GEO5) def test__rings(): """ test graph.rings """ c5h5n5o_cgr = ( {0: ('C', 1, None), 1: ('C', 0, None), 2: ('C', 0, None), 3: ('C', 0, None), 4: ('C', 0, None), 5: ('N', 2, None), 6: ('N', 0, None), 7: ('N', 0, None), 8: ('N', 0, None), 9: ('N', 1, None), 10: ('O', 1, None)}, {frozenset({10, 4}): (1, None), frozenset({8, 2}): (1, None), frozenset({0, 6}): (1, None), frozenset({9, 3}): (1, None), frozenset({1, 2}): (1, None), frozenset({3, 7}): (1, None), frozenset({2, 5}): (1, None), frozenset({1, 6}): (1, None), frozenset({0, 7}): (1, None), frozenset({9, 4}): (1, None), frozenset({1, 3}): (1, None), frozenset({8, 4}): (1, None)}) assert graph.rings(c5h5n5o_cgr) == ( ({0: ('C', 1, None), 1: ('C', 0, None), 3: ('C', 0, None), 6: ('N', 0, None), 7: ('N', 0, None)}, {frozenset({0, 6}): (1, None), frozenset({3, 7}): (1, None), frozenset({0, 7}): (1, None), frozenset({1, 6}): (1, None), frozenset({1, 3}): (1, None)}), ({1: ('C', 0, None), 2: ('C', 0, None), 3: ('C', 0, None), 4: ('C', 0, None), 8: ('N', 0, None), 9: ('N', 1, None)}, {frozenset({8, 2}): (1, None), frozenset({9, 3}): (1, None), frozenset({1, 2}): (1, None), frozenset({9, 4}): (1, None), frozenset({1, 3}): (1, None), frozenset({8, 4}): (1, None)}) ) def test__ring_systems(): """ test graph.ring_systems """ # molecule: # InChI=1S/C19H30/c1-2-4-14-10-12(9-13(14)3-1)5-7-17-16-8-6-15-11- # 18(16)19(15)17/h12-19H,1-11H2/ gra = ({0: ('C', 1, None), 1: ('C', 1, None), 2: ('C', 2, None), 3: ('C', 1, None), 4: ('C', 1, None), 5: ('C', 1, None), 6: ('C', 2, None), 7: ('C', 2, None), 8: ('C', 1, None), 9: ('C', 2, None), 10: ('C', 2, None), 11: ('C', 2, None), 12: ('C', 1, None), 13: ('C', 1, None), 14: ('C', 2, None), 15: ('C', 2, None), 16: ('C', 2, None), 17: ('C', 2, None), 18: ('C', 2, None)}, {frozenset({9, 13}): (1, None), frozenset({3, 6}): (1, None), frozenset({0, 5}): (1, None), frozenset({11, 12}): (1, None), frozenset({13, 14}): (1, None), frozenset({3, 5}): (1, None), frozenset({0, 2}): (1, None), frozenset({1, 4}): (1, None), frozenset({12, 13}): (1, None), frozenset({0, 1}): (1, None), frozenset({1, 7}): (1, None), frozenset({12, 15}): (1, None), frozenset({6, 7}): (1, None), frozenset({8, 9}): (1, None), frozenset({16, 15}): (1, None), frozenset({4, 5}): (1, None), frozenset({16, 17}): (1, None), frozenset({2, 3}): (1, None), frozenset({18, 4}): (1, None), frozenset({17, 14}): (1, None), frozenset({8, 10}): (1, None), frozenset({18, 10}): (1, None), frozenset({8, 11}): (1, None)}) rsys = graph.ring_systems(gra) assert len(rsys) == 2 rsy_rngs = list(map(graph.rings, rsys)) assert tuple(map(len, rsy_rngs)) == (3, 2) def test__ring_systems_decomposed_atom_keys(): """ test graph.ring_systems_decomposed_atom_keys """ # molecule: # InChI=1S/C19H30/c1-2-4-14-10-12(9-13(14)3-1)5-7-17-16-8-6-15-11- # 18(16)19(15)17/h12-19H,1-11H2/ gra = ({0: ('C', 1, None), 1: ('C', 1, None), 2: ('C', 2, None), 3: ('C', 1, None), 4: ('C', 1, None), 5: ('C', 1, None), 6: ('C', 2, None), 7: ('C', 2, None), 8: ('C', 1, None), 9: ('C', 2, None), 10: ('C', 2, None), 11: ('C', 2, None), 12: ('C', 1, None), 13: ('C', 1, None), 14: ('C', 2, None), 15: ('C', 2, None), 16: ('C', 2, None), 17: ('C', 2, None), 18: ('C', 2, None)}, {frozenset({9, 13}): (1, None), frozenset({3, 6}): (1, None), frozenset({0, 5}): (1, None), frozenset({11, 12}): (1, None), frozenset({13, 14}): (1, None), frozenset({3, 5}): (1, None), frozenset({0, 2}): (1, None), frozenset({1, 4}): (1, None), frozenset({12, 13}): (1, None), frozenset({0, 1}): (1, None), frozenset({1, 7}): (1, None), frozenset({12, 15}): (1, None), frozenset({6, 7}): (1, None), frozenset({8, 9}): (1, None), frozenset({16, 15}): (1, None), frozenset({4, 5}): (1, None), frozenset({16, 17}): (1, None), frozenset({2, 3}): (1, None), frozenset({18, 4}): (1, None), frozenset({17, 14}): (1, None), frozenset({8, 10}): (1, None), frozenset({18, 10}): (1, None), frozenset({8, 11}): (1, None)}) decomps = graph.ring_systems_decomposed_atom_keys(gra) assert decomps == (((0, 1, 4, 5), (0, 2, 3, 5), (1, 7, 6, 3)), ((8, 9, 13, 12, 11), (13, 14, 17, 16, 15, 12))) # a1 = +/-q # a2 = +/-a1 def test__ring_puckering(): """ ring pucker """ smi = 'CC1CCCCC1' ich = smiles.inchi(smi) geo = inchi.geometry(ich) zma = geom.zmatrix(geo) gra = zmat.graph(zma) rings_atoms = graph.rings_atom_keys(gra) val_dct = zmat.value_dictionary(zma) coos = zmat.coordinates(zma) geo = zmat.geometry(zma) da_names = zmat.dihedral_angle_names(zma) for ring_atoms in rings_atoms: rotate_hyds = [] ngbs = graph.atom_sorted_neighbor_atom_keys(gra, ring_atoms[0]) symbs = geom.symbols(geo) for ngb in ngbs: if symbs[ngb] == 'H': rotate_hyds.append(ngb) ring_value_dct = {} for da_name in da_names: da_idxs = list(coos[da_name])[0] if len(list(set(da_idxs) & set(ring_atoms))) == 4: print(da_name, da_idxs) ring_value_dct[da_name] = val_dct[da_name] dist_value_dct = {} for i, _ in enumerate(ring_atoms): dist_value_dct[i] = zmat.distance( zma, ring_atoms[i-1], ring_atoms[i]) samp_range_dct = {} for key, value in ring_value_dct.items(): samp_range_dct[key] = (value - numpy.pi/4, value + numpy.pi/4) print(zmat.samples(zma, 5, samp_range_dct)) def __zmat_ring(): """ test (add TS) """ def _chk_ring_dct(ring_dct, ref_ring_dct): """ Ring dictionaries by checking the keys and subkeys and tha the floats match in the arrays. """ for key, rkey in zip(ring_dct.keys(), ref_ring_dct.keys()): assert key == rkey rdct, ref_dct = ring_dct[key], ref_ring_dct[rkey] for key2, rkey2 in zip(rdct.keys(), ref_dct.keys()): assert key2 == rkey2 assert numpy.allclose(rdct[key2], ref_dct[rkey2], atol=0.0001, rtol=0.0) ref_rng_dct1 = { '1-2-5-8-11-14': {'D7': [0.16168073524433701, 1.7324770620392336], 'D10': [4.550708773750596, 6.121505100545493], 'D13': [0.16167968490856266, 1.7324760117034592]} } ref_rng_dct2 = { '1-2-4-6-8-10': {'D5': [5.497778966967656, 7.068575293762552], 'D7': [-0.7853916433944105, 0.7854046834004861], 'D9': [-0.7853965979951805, 0.7853997287997161]} } ref_rng_dct3 = { '1-2-5-8-11-14-15-18': {'D7': [4.107068942834604, 5.677865269629501], 'D10': [0.2823332978102957, 1.853129624605192], 'D13': [3.7747759383709774, 5.345572265165874], 'D14': [1.3922420091755172, 2.963038335970413], 'D17': [4.0726811920433565, 5.643477518838253]} } ref_rng_dct4 = { '1-2-5-8-11': {'D7': [4.965369609998152, 6.536165936793049], 'D10': [-0.06067570281684087, 1.5101206239780556]} } ref_rng_dct5 = { '1-2-5-8-11': {'D7': [4.877800020154778, 6.4485963469496745], 'D10': [-0.012877983213259836, 1.5579183435816368]}, '5-8-21-18-15-9': {'D17': [-0.33350277464453076, 1.2372935521503658], 'D20': [4.488064445840583, 6.058860772635479]} } # Get lists of atoms in the ring rng_atoms1 = zmat.all_rings_atoms(ZMA1, zrxn=None) rng_atoms2 = zmat.all_rings_atoms(ZMA2, zrxn=None) rng_atoms3 = zmat.all_rings_atoms(ZMA3, zrxn=None) rng_atoms4 = zmat.all_rings_atoms(ZMA4, zrxn=None) rng_atoms5 = zmat.all_rings_atoms(ZMA5, zrxn=None) # Sampling ranges (includes dihedral calls) rng_dct1 = zmat.all_rings_dct(ZMA1, rng_atoms1) rng_dct2 = zmat.all_rings_dct(ZMA2, rng_atoms2) rng_dct3 = zmat.all_rings_dct(ZMA3, rng_atoms3) rng_dct4 = zmat.all_rings_dct(ZMA4, rng_atoms4) rng_dct5 = zmat.all_rings_dct(ZMA5, rng_atoms5) _chk_ring_dct(rng_dct1, ref_rng_dct1) _chk_ring_dct(rng_dct2, ref_rng_dct2) _chk_ring_dct(rng_dct3, ref_rng_dct3) _chk_ring_dct(rng_dct4, ref_rng_dct4) _chk_ring_dct(rng_dct5, ref_rng_dct5) # Check distances (includes distance calc) # still need a dist check failure for testing assert zmat.all_rings_distances_reasonable(ZMA1, rng_atoms1) assert zmat.all_rings_distances_reasonable(ZMA2, rng_atoms2) assert zmat.all_rings_distances_reasonable(ZMA3, rng_atoms3) assert zmat.all_rings_distances_reasonable(ZMA4, rng_atoms4) assert zmat.all_rings_distances_reasonable(ZMA5, rng_atoms5) def __geom_ring(): """ test """ # Check fragments ref_frag1 = ( ('C', (-4.678309211005585, 0.9507582225493368, 1.3283943630808774)), ('C', (-5.121751782500965, -0.938130104907219, -0.8105253645907926)), ('C', (-1.8183184542355333, 1.124802798603796, 1.679473859905406)), ('H', (-5.596045421215773, 0.3417726406642164, 3.080387789063853)), ('H', (-5.472315138734762, 2.795412023268741, 0.8240154865962166)), ('C', (-2.5431899261233295, -2.0739380012437003, -1.3930195681295054)), ('H', (-5.852499087712589, 0.05531532655919256, -2.475545119599078)), ('H', (-6.503039672160678, -2.388190468828352, -0.2948252443802334)), ('C', (-0.7061241675458045, 0.061496234243248286, -0.764480412567453)), ('H', (-2.394903577788051, -2.688224956361526, -3.3620755359797467)), ('H', (-2.2076515854285743, -3.721079537831081, -0.17992394099843007)), ('C', (2.0244139428425885, -0.8586191572573748, -0.5328743916778614)), ('H', (-0.8215175624787503, 1.5073535945698067, -2.249882522830806)), ('H', (-1.2484554395000416, -0.024690004182670054, 3.307711745513383)), ('H', (-1.213466703672248, 3.0695743548570653, 2.0397346958319655))) ref_frag2 = ( ('C', (-4.75275159254756, -0.8859368224809074, 0.05204272094591431)), ('C', (-2.6316145805140074, -2.781457031057775, 0.617675595973341)), ('C', (-3.469373724017983, 1.644203318184678, -0.5508463526763928)), ('H', (-6.020017911796573, -0.6793342485754604, 1.6757584497553977)), ('H', (-5.894535909176483, -1.541597262442682, -1.545311764072632)), ('C', (-0.2860088109004335, -1.148940006016929, 0.961220215463222)), ('H', (-3.0413520136248446, -3.922314862417004, 2.293255681709448)), ('H', (-2.4141209511227446, -4.0740160313602765, -0.9873049704822309)), ('C', (2.2490731922647558, -2.457979419683331, 0.5439361499900985)), ('C', (-0.7009866699077159, 0.9649583926305777, -0.9504147216562486)), ('H', (-0.3133961766730456, -0.3543813002328926, 2.882320427181015)), ('C', (1.200527146395269, 3.101000420082161, -0.5817249641001333)), ('H', (-0.4809624718722801, 0.2063149270378129, -2.873628003146178)), ('H', (-4.297962624106833, 2.5542573283204937, -2.212847874618906)), ('H', (-3.6981964276399215, 2.9346249752146134, 1.054281230413613)), ('C', (4.277907565282426, -0.6204973771653151, -0.42814819707015134)), ('C', (3.775171063722607, 2.1216311210353376, 0.3399582461004284)), ('H', (4.349010775297676, -0.7282474510540757, -2.4981877728699335)), ('H', (6.139118315609488, -1.2222378958530145, 0.25232279110138667)), ('H', (3.8464710144147634, 2.255925498026601, 2.408439361912304)), ('H', (5.279790586767728, 3.3507823389200784, -0.3773631616284865)), ('H', (1.4381199118411645, 4.1005566214301385, -2.3820194923439555)), ('H', (0.5015487139955048, 4.508608348000816, 0.7687730045421981)), ('H', (2.075693517927493, -4.028187328133698, -0.7970212520506802)), ('H', (2.8688480603817905, -3.297736252410089, 2.3348346516273333))) frag1 = geom.ring_fragments_geometry(GEO4) frag2 = geom.ring_fragments_geometry(GEO5) assert geom.almost_equal_dist_matrix(frag1, ref_frag1) assert geom.almost_equal_dist_matrix(frag2, ref_frag2) # Check angles passing # rng_atoms1 = zmat.all_rings_atoms(ZMA1, zrxn=None) # rng_atoms2 = zmat.all_rings_atoms(ZMA2, zrxn=None) # rng_atoms3 = zmat.all_rings_atoms(ZMA3, zrxn=None) # rng_atoms4 = zmat.all_rings_atoms(ZMA4, zrxn=None) # rng_atoms5 = zmat.all_rings_atoms(ZMA5, zrxn=None) # assert geom.all_rings_angles_reasonable(GEO1, rng_atoms1) # assert geom.all_rings_angles_reasonable(GEO2, rng_atoms2) # assert geom.all_rings_angles_reasonable(GEO3, rng_atoms3) # assert geom.all_rings_angles_reasonable(GEO4, rng_atoms4) # assert geom.all_rings_angles_reasonable(GEO5, rng_atoms5) # # Make fake ring with a bad angle # bad_geo = ( # ('C', (-5.5877937580, -0.9968691886, -0.4989724332)), # ('C', (-2.7396917422, -0.5869879179, -0.3495489041)), # ('H', (-6.2131071344, -2.2170574292, 1.0990444734)), # ('H', (-6.2375188836, -1.8516712887, -2.3026059381)), # ('C', (-5.5653523999, 1.1009499352, 0.6068939227)), # ('H', (-1.6185907638, -2.3610282320, -0.3017615543)), # ('C', (-2.5439758909, 0.9534327614, 2.0676109788)), # ('H', (-2.1053962916, 0.5765661495, -1.9857880223)), # ('C', (-4.8046407570, 2.7722969017, 1.9610434891)), # ('H', (-7.3189290824, 1.5474187146, 1.4538721624)), # ('H', (-5.6843643376, 2.5317510457, -1.5414484200)), # ('H', (-0.6915593935, 1.8574930579, 2.4592560449)), # ('H', (-2.9167136073, -0.4107171297, 3.6299854071)), # ('H', (-5.7060177389, 2.8094515351, 3.8587924532)), # ('H', (-4.2677394999, 4.7261055569, 1.4049815516))) # rng_atoms = ((0, 1, 4, 6, 8),) # assert not geom.all_rings_angles_reasonable(bad_geo, rng_atoms)
47.513846
79
0.572335
2,049
15,442
4.192289
0.206442
0.052387
0.107567
0.019208
0.316997
0.310361
0.252037
0.247846
0.227939
0.224331
0
0.327905
0.232548
15,442
324
80
47.660494
0.396929
0.1516
0
0.176211
0
0.022026
0.03482
0.016948
0
0
0
0
0.061674
1
0.030837
false
0
0.026432
0
0.057269
0.008811
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2bd7c88b64df6d01ccfe2f56819d07d42a12960f
573
py
Python
ews/migrations/0017_auto_20210121_1749.py
mrustl/plattform
7c9fce2a697b7c9d3de0bd08382571ed89469281
[ "MIT" ]
null
null
null
ews/migrations/0017_auto_20210121_1749.py
mrustl/plattform
7c9fce2a697b7c9d3de0bd08382571ed89469281
[ "MIT" ]
3
2021-06-07T10:30:55.000Z
2021-06-07T14:00:32.000Z
ews/migrations/0017_auto_20210121_1749.py
mrustl/plattform
7c9fce2a697b7c9d3de0bd08382571ed89469281
[ "MIT" ]
null
null
null
# Generated by Django 3.1.5 on 2021-01-21 16:49 from django.db import migrations, models import djgeojson.fields class Migration(migrations.Migration): dependencies = [ ('ews', '0016_auto_20210121_1327'), ] operations = [ migrations.AddField( model_name='site', name='location', field=djgeojson.fields.PointField(null=True), ), migrations.AddField( model_name='site', name='ref_name', field=models.CharField(max_length=64, null=True), ), ]
22.92
61
0.586387
61
573
5.393443
0.688525
0.091185
0.139818
0.164134
0.212766
0.212766
0
0
0
0
0
0.08209
0.298429
573
24
62
23.875
0.736318
0.078534
0
0.333333
1
0
0.095057
0.043726
0
0
0
0
0
1
0
false
0
0.111111
0
0.277778
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2bda8a0559ef784a0cf57e5e5dfb3da7f383c7c9
441
py
Python
rov/hardware/motor_control/__init__.py
jiena76/X11-Core
95aec844822ab4e53c09accc48ef25d70e9b4f08
[ "MIT" ]
9
2017-09-21T22:00:46.000Z
2018-12-26T15:46:40.000Z
rov/hardware/motor_control/__init__.py
jiena76/X11-Core
95aec844822ab4e53c09accc48ef25d70e9b4f08
[ "MIT" ]
25
2017-10-06T17:25:51.000Z
2018-04-19T00:51:50.000Z
rov/hardware/motor_control/__init__.py
jiena76/X11-Core
95aec844822ab4e53c09accc48ef25d70e9b4f08
[ "MIT" ]
2
2017-10-19T22:41:37.000Z
2018-05-10T20:33:45.000Z
def MotorControl(*args, **kwargs): try: from MotorControl import MotorControl as MotorControl return MotorControl(*args, **kwargs) except Exception as e: print "Failed to Initialize Hardware Motor Control (I2C PWM Device)" print "Error: %s" % e.message print "Using Mock Motor Control" from MotorControl_Mock import MotorControl as MotorControl_Mock return MotorControl_Mock()
40.090909
76
0.687075
50
441
6
0.54
0.16
0.146667
0.213333
0
0
0
0
0
0
0
0.003012
0.247166
441
10
77
44.1
0.900602
0
0
0
0
0
0.210884
0
0
0
0
0
0
0
null
null
0
0.2
null
null
0.3
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
2bf2969cf9b63edc0bb8cc3251a1e5e9b440d46f
831
py
Python
learning_curve.py
zenmood/IndoorFarmWiz
0f5075007cbd1d15c83ed3aef820ec3d72048a90
[ "MIT" ]
11
2020-06-28T04:30:26.000Z
2022-03-26T08:40:47.000Z
learning_curve.py
zenmood/IndoorFarmWiz
0f5075007cbd1d15c83ed3aef820ec3d72048a90
[ "MIT" ]
4
2020-07-27T19:45:27.000Z
2020-07-28T13:58:41.000Z
learning_curve.py
zenmood/IndoorFarmWiz
0f5075007cbd1d15c83ed3aef820ec3d72048a90
[ "MIT" ]
null
null
null
import pandas as pd waste_rates = pd.DataFrame({'High': [0, 0.1254, 0.1129, 0.1016, 0.0934, 0.0860, 0.0791, 0.0728, 0.0684, 0.0643, 0.0604, 0.0568, 0.0534, 0.0502, 0.0472, 0.0444, 0.0444, 0.0444, 0.0444, 0.0444, 0.0444], 'Medium': [0, 0.1777, 0.1599, 0.1439, 0.1324, 0.1218, 0.1121, 0.1031, 0.0969, 0.0911, 0.0856, 0.0805, 0.0757, 0.0711, 0.0668, 0.0628, 0.0628, 0.0628, 0.0628, 0.0628, 0.0628], 'Low': [0, 0.2404, 0.2163, 0.1947, 0.1791, 0.1648, 0.1516, 0.1395, 0.1311, 0.1232, 0.1158, 0.1089, 0.1024, 0.0962, 0.0904, 0.0850, 0.0850, 0.0850, 0.0850, 0.0850, 0.0850]}) waste_rates.index = range(0, 21) print(waste_rates)
59.357143
119
0.474128
143
831
2.734266
0.41958
0.076726
0.076726
0.127877
0.230179
0.230179
0.230179
0.230179
0.230179
0.230179
0
0.5625
0.345367
831
13
120
63.923077
0.15625
0
0
0
0
0
0.015644
0
0
0
0
0
0
1
0
false
0
0.1
0
0.1
0.1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
920361755ac6c33be8f40196ffa5844f403eb8a2
2,262
py
Python
api/settings/base.py
uk-gov-mirror/ministryofjustice.manchester_traffic_offences_pleas
4c625b13fa2826bdde083a0270dcea1791f6dc18
[ "MIT" ]
3
2015-12-22T16:37:14.000Z
2018-01-22T18:44:38.000Z
api/settings/base.py
uk-gov-mirror/ministryofjustice.manchester_traffic_offences_pleas
4c625b13fa2826bdde083a0270dcea1791f6dc18
[ "MIT" ]
145
2015-03-04T11:17:50.000Z
2022-03-21T12:10:13.000Z
api/settings/base.py
uk-gov-mirror/ministryofjustice.manchester_traffic_offences_pleas
4c625b13fa2826bdde083a0270dcea1791f6dc18
[ "MIT" ]
3
2015-12-29T14:59:12.000Z
2021-04-11T06:24:11.000Z
from make_a_plea.settings.base import * ROOT_URLCONF = 'api.urls' INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.messages', 'django.contrib.postgres', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.staticfiles', 'django_extensions', 'rest_framework', ] MIDDLEWARE_CLASSES = ( 'django.middleware.cache.UpdateCacheMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'make_a_plea.middleware.AdminLocaleURLMiddleware', 'make_a_plea.middleware.TimeoutRedirectMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware' ) PROJECT_APPS = [ 'apps.forms', 'apps.plea', 'apps.result', 'api', 'api.v0', ] # Django-rest-framework throttling config REST_FRAMEWORK = { 'DEFAULT_THROTTLE_CLASSES': ( 'rest_framework.throttling.AnonRateThrottle', ), 'DEFAULT_THROTTLE_RATES': { 'anon': '100/day', }, 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.BasicAuthentication', ), 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticated', ), 'DEFAULT_RENDERER_CLASSES': ( 'rest_framework.renderers.JSONRenderer', ) } INSTALLED_APPS = INSTALLED_APPS + PROJECT_APPS TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'APP_DIRS': True, } ] # Options for Premailer, which inlines the CSS on the fly in email templates and # makes all URLs absolute PREMAILER_OPTIONS = {"base_url": os.environ.get("PREMAILER_BASE_URL", "https://www.makeaplea.service.gov.uk"), "remove_classes": False, "keep_style_tags": True, "cssutils_logging_level": logging.ERROR} # .local.py overrides all the common settings. try: from .local import * except ImportError: pass
28.275
110
0.69496
217
2,262
7.059908
0.520737
0.084856
0.052219
0.024804
0
0
0
0
0
0
0
0.00217
0.185234
2,262
79
111
28.632911
0.829083
0.08267
0
0.046154
0
0
0.601449
0.488406
0
0
0
0
0
1
0
false
0.015385
0.046154
0
0.046154
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
920a4417a77ca2b968b9be1cb0e88026aa6a0c96
72
py
Python
ForLoopPractice2.py
anayakoti/FirstSample
8ef05772991644e63a4fd6759458f449cd2b00c0
[ "bzip2-1.0.6" ]
null
null
null
ForLoopPractice2.py
anayakoti/FirstSample
8ef05772991644e63a4fd6759458f449cd2b00c0
[ "bzip2-1.0.6" ]
null
null
null
ForLoopPractice2.py
anayakoti/FirstSample
8ef05772991644e63a4fd6759458f449cd2b00c0
[ "bzip2-1.0.6" ]
null
null
null
letter="Sai Teja"; for i in letter: print(i);
12
18
0.430556
9
72
3.444444
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.458333
72
5
19
14.4
0.794872
0
0
0
0
0
0.111111
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
9219081094f353a1e33b78b38402aefce0b7dbaf
214
py
Python
plugins/constants.py
PalashTanejaPro/cvbot
429514bf235e410f6cea436a1846ab9880e0615c
[ "MIT" ]
null
null
null
plugins/constants.py
PalashTanejaPro/cvbot
429514bf235e410f6cea436a1846ab9880e0615c
[ "MIT" ]
null
null
null
plugins/constants.py
PalashTanejaPro/cvbot
429514bf235e410f6cea436a1846ab9880e0615c
[ "MIT" ]
null
null
null
import os API_DOCS = 'http://api.cloudcv.io/en/latest' USER_DOCS = 'http://docs.cloudcv.io/en/latest' GH_ORG_NAME = os.environ.get('GH_ORG_NAME', 'cloudcv') GL_ORG_NAME = os.environ.get('GL_ORG_NAME', 'cloudcv')
26.75
54
0.728972
38
214
3.842105
0.421053
0.191781
0.150685
0.232877
0.260274
0
0
0
0
0
0
0
0.084112
214
7
55
30.571429
0.744898
0
0
0
0
0
0.462617
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
9219dccb57b9c99be64219ed05e1d50a0ed1dbb6
549
py
Python
arca/backend/current_environment.py
encukou/arca
edc3e81d27a5c194da10d54402923c27085e0e96
[ "MIT" ]
6
2017-09-25T00:43:01.000Z
2018-09-05T07:59:08.000Z
arca/backend/current_environment.py
encukou/arca
edc3e81d27a5c194da10d54402923c27085e0e96
[ "MIT" ]
41
2017-10-05T21:10:11.000Z
2019-09-10T16:48:22.000Z
arca/backend/current_environment.py
encukou/arca
edc3e81d27a5c194da10d54402923c27085e0e96
[ "MIT" ]
2
2019-12-09T15:12:17.000Z
2019-12-09T20:00:53.000Z
import sys from pathlib import Path from git import Repo from .base import BaseRunInSubprocessBackend class CurrentEnvironmentBackend(BaseRunInSubprocessBackend): """ Uses the current Python to run the tasks, however they're launched in a :mod:`subprocess`. The requirements of the repository are completely ignored. """ def get_or_create_environment(self, repo: str, branch: str, git_repo: Repo, repo_path: Path) -> str: """ Returns the path to the current Python executable. """ return sys.executable
28.894737
104
0.728597
69
549
5.724638
0.623188
0.050633
0.081013
0
0
0
0
0
0
0
0
0
0.200364
549
18
105
30.5
0.899772
0.36612
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.571429
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
ecf858203bb6398c53b5dd66e250e316b72b0da4
928
py
Python
services/datastream/models/vrf.py
sbworth/getnoc
a9a5647df31822062db3db7afe7ae1c005d166f7
[ "BSD-3-Clause" ]
null
null
null
services/datastream/models/vrf.py
sbworth/getnoc
a9a5647df31822062db3db7afe7ae1c005d166f7
[ "BSD-3-Clause" ]
null
null
null
services/datastream/models/vrf.py
sbworth/getnoc
a9a5647df31822062db3db7afe7ae1c005d166f7
[ "BSD-3-Clause" ]
null
null
null
# ---------------------------------------------------------------------- # vrf datastream model # ---------------------------------------------------------------------- # Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- # Python modules from typing import Optional, List # Third-party modules from pydantic import BaseModel # NOC modules from .utils import StateItem, ProjectItem class AFIItem(BaseModel): ipv4: bool ipv6: bool class VRFProfileItem(BaseModel): id: str name: str class VRFGroupDataStreamItem(BaseModel): id: str name: str change_id: str vpn_id: str afi: AFIItem source: str state: StateItem profile: VRFProfileItem description: Optional[str] rd: Optional[str] labels: Optional[List[str]] tags: Optional[List[str]] project: Optional[ProjectItem]
22.095238
72
0.538793
87
928
5.724138
0.551724
0.040161
0.056225
0.072289
0.084337
0
0
0
0
0
0
0.013055
0.174569
928
41
73
22.634146
0.637076
0.37069
0
0.173913
0
0
0
0
0
0
0
0
0
1
0
true
0
0.130435
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
2
ecfa9d9011d45dd6d2957f6da2c1fb04dd9212c9
147
py
Python
scripts/scheduler/__main__.py
OCHA-DAP/hdx-scraper-unosat-flood-portal
80b0bcd404993e4bd1dae442f794c9f86b6d5328
[ "MIT" ]
1
2016-07-22T13:32:54.000Z
2016-07-22T13:32:54.000Z
scripts/scheduler/__main__.py
OCHA-DAP/hdx-scraper-unosat-flood-portal
80b0bcd404993e4bd1dae442f794c9f86b6d5328
[ "MIT" ]
21
2015-07-08T21:30:32.000Z
2015-08-27T17:52:24.000Z
scripts/scheduler/__main__.py
OCHA-DAP/hdxscraper-unosat-flood-portal
80b0bcd404993e4bd1dae442f794c9f86b6d5328
[ "MIT" ]
null
null
null
#!/usr/bin/python # -*- coding: utf-8 -*- import scheduler def Main(): '''Wrapper.''' scheduler.Main() if __name__ == '__main__': Main()
11.307692
26
0.585034
17
147
4.588235
0.764706
0
0
0
0
0
0
0
0
0
0
0.008333
0.183673
147
12
27
12.25
0.641667
0.319728
0
0
0
0
0.086022
0
0
0
0
0
0
1
0.2
true
0
0.2
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
ecfb879fb4d3dfcebde0a0e730e7e31faaf03f7b
1,016
py
Python
pavo/helpers/_context.py
getpavo/pavo
8b751a296d4acf4dc3fdb7290c096f5ac23e8451
[ "MIT" ]
1
2021-08-07T15:08:51.000Z
2021-08-07T15:08:51.000Z
pavo/helpers/_context.py
jackmanapp/core
1150bdcaa4700d8dc1ee04f843058ab072193f3a
[ "MIT" ]
1
2021-07-13T09:09:37.000Z
2021-07-13T09:09:38.000Z
pavo/helpers/_context.py
jackmanapp/core
1150bdcaa4700d8dc1ee04f843058ab072193f3a
[ "MIT" ]
null
null
null
from typing import Optional, Type from types import TracebackType class Expects: """Context manager when we are expecting that an error could occur, and we accept this. Args: expected_errors (list): A list of expected errors to skip. Raises: ValueError: The provided argument is not a list. Attributes: expected_errors (list): A list of expected errors to skip. """ def __init__(self, expected_errors: list[Type[BaseException]]) -> None: if not isinstance(expected_errors, list): raise ValueError('Expected list as list of expected errors') self.expected_errors: list[Type[BaseException]] = expected_errors def __enter__(self) -> None: pass def __exit__(self, err: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]) -> bool: if not err: return True if err in self.expected_errors: return True raise err
30.787879
93
0.658465
123
1,016
5.284553
0.471545
0.215385
0.138462
0.092308
0.258462
0.258462
0.138462
0.138462
0.138462
0.138462
0
0
0.266732
1,016
32
94
31.75
0.872483
0.287402
0
0.125
0
0
0.058055
0
0
0
0
0
0
1
0.1875
false
0.0625
0.125
0
0.5
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
ecfe37263f6bddba6a60517d6da35a437a83ae63
214
py
Python
display/display/handlers/ui/timeline.py
owlsn/h_crawl
c0431ee6484e61d9339553c3350962ea517749d6
[ "MIT" ]
null
null
null
display/display/handlers/ui/timeline.py
owlsn/h_crawl
c0431ee6484e61d9339553c3350962ea517749d6
[ "MIT" ]
8
2021-03-18T20:33:29.000Z
2022-03-11T23:21:04.000Z
display/display/handlers/ui/timeline.py
owlsn/h_crawl
c0431ee6484e61d9339553c3350962ea517749d6
[ "MIT" ]
null
null
null
from display.handlers.base import BaseHandler class UiTimelineHandler(BaseHandler): def get(self): title = 'UiTimelineHandler' self.render('ui/timeline.html', title = title, **self.render_dict)
35.666667
74
0.719626
24
214
6.375
0.708333
0.130719
0
0
0
0
0
0
0
0
0
0
0.168224
214
6
74
35.666667
0.859551
0
0
0
0
0
0.153488
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a6183d8545be0265a966996b691125bbc13e4d42
1,093
py
Python
scripts/geodata/statistics/tf_idf.py
Fillr/libpostal
bce153188aff9fbe65aef12c3c639d8069e707fc
[ "MIT" ]
3,489
2015-03-03T00:21:38.000Z
2022-03-29T09:03:05.000Z
scripts/geodata/statistics/tf_idf.py
StephenHildebrand/libpostal
d8c9847c5686a1b66056e65128e1774f060ff36f
[ "MIT" ]
488
2015-05-29T23:04:28.000Z
2022-03-29T11:20:24.000Z
scripts/geodata/statistics/tf_idf.py
StephenHildebrand/libpostal
d8c9847c5686a1b66056e65128e1774f060ff36f
[ "MIT" ]
419
2015-11-24T16:53:07.000Z
2022-03-27T06:51:28.000Z
import math from collections import defaultdict class IDFIndex(object): finalized = False def __init__(self): self.idf_counts = defaultdict(int) self.N = 0 def update(self, doc): if self.finalized or not doc: return for feature, count in doc.iteritems(): self.idf_counts[feature] += 1 self.N += 1 def prune(self, min_count): self.idf_counts = {k: count for k, count in self.idf_counts.iteritems() if count >= min_count} def corpus_frequency(self, key): return self.idf_counts.get(key, 0) def tfidf_score(self, key, count=1): if count < 0: return 0.0 idf_count = self.idf_counts.get(key, None) if idf_count is None: return 0.0 return (math.log(count + 1.0) * (math.log(float(self.N) / idf_count))) def tfidf_vector(self, token_counts): tf_idf = [self.tfidf_score(t, count=c) for t, c in token_counts.iteritems()] norm = math.sqrt(sum((t ** 2 for t in tf_idf))) return [t / norm for t in tf_idf]
27.325
102
0.600183
163
1,093
3.877301
0.319018
0.066456
0.123418
0.056962
0.094937
0
0
0
0
0
0
0.016753
0.290027
1,093
39
103
28.025641
0.79768
0
0
0.071429
0
0
0
0
0
0
0
0
0
1
0.214286
false
0
0.071429
0.035714
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
a61b35b043b4cd5196fd336c4ae9d6477dbfbcf3
3,890
py
Python
pythonProject1/venv/Lib/site-packages/jsonfile.py
mjtomlinson/CNE330_Python_1_Final_Project
05020806860937ef37b9a0ad2e27de4897a606de
[ "CC0-1.0" ]
null
null
null
pythonProject1/venv/Lib/site-packages/jsonfile.py
mjtomlinson/CNE330_Python_1_Final_Project
05020806860937ef37b9a0ad2e27de4897a606de
[ "CC0-1.0" ]
null
null
null
pythonProject1/venv/Lib/site-packages/jsonfile.py
mjtomlinson/CNE330_Python_1_Final_Project
05020806860937ef37b9a0ad2e27de4897a606de
[ "CC0-1.0" ]
null
null
null
""" jsonfile - incrementally write files in JSON format. """ import json import enum from functools import partial, update_wrapper __version__ = "1.0.1" @enum.unique class State(enum.Enum): List = ('', ',', 'List', ']') ListStart = ('[', '', 'List', ']') DictBeforeKey = ('', ',', 'DictBeforeValue', '}') DictBeforeValue = ('', ':', 'DictBeforeKey', NotImplemented) DictStart = ('{', '', 'DictBeforeValue', '}') TopLevel = ('', '', 'ExtraTopLevel', '') ExtraTopLevel = ('', NotImplemented, 'ExtraTopLevel', '') def __init__(self, on_enter, before_item, state_on_item_str, on_exit): self.on_enter = on_enter self.before_item = before_item self.state_on_item_str = state_on_item_str self.on_exit = on_exit @property def state_on_item(self): return type(self)[self.state_on_item_str] class JsonProto: """ Incrementally generate a file in JSON format. """ def __init__(self): """ """ self.context = [State.TopLevel] def _before_item(self): old = self.swap_state(self.top_state.state_on_item) return old.before_item def _start_container(self, state): self.push_state(state) return state.on_enter def start_list(self): return ( self._before_item() + self._start_container(State.ListStart) ) def toplevel_item(self, item): """ If your file only contains one item, why are using this library? But in any case, you can write one item using this. """ assert self.top_state == State.TopLevel return self._any_item(item) def _any_item(self, item): return ( self._before_item() + json.dumps(item) ) def list_item(self, item): assert self.top_state in (State.List, State.ListStart) return self._any_item(item) def _end_container(self): return self.context.pop().on_exit def end_list(self): assert self.top_state in (State.List, State.ListStart) return self._end_container() def start_dict(self): return ( self._before_item() + self._start_container(State.DictStart) ) def dict_item(self, key, value): assert self.top_state in (State.DictStart, State.DictBeforeKey) return (self.dict_key(key) + self.dict_value(value)) def dict_key(self, key): assert self.top_state in (State.DictStart, State.DictBeforeKey) return self._any_item(key) def dict_value(self, value): assert self.top_state == State.DictBeforeValue return self._any_item(value) def end_dict(self): assert self.top_state in (State.DictBeforeKey, State.DictStart) return self._end_container() @property def top_state(self): return self.context[-1] def swap_state(self, new_state): old = self.top_state self.context[-1] = new_state return old def push_state(self, new_state): self.context.append(new_state) @property def done(self): return len(self.context) == 1 def finish_all(self): parts = [] while not self.done: parts.append(self._end_container()) return ''.join(parts) class JsonWriter: def __init__(self, out): self.protocol = JsonProto() self.out = out def _write_proto_result(self, method, *args, **kwargs): result = method(*args, **kwargs) assert type(result) is str self.out.write(result) def __getattr__(self, name): value = getattr(self.protocol, name) if callable(value): writer = partial(self._write_proto_result, value) update_wrapper(writer, value) return writer else: return value
26.107383
74
0.609512
464
3,890
4.855603
0.209052
0.053262
0.047936
0.055925
0.216156
0.175322
0.158455
0.143808
0.143808
0.102086
0
0.002131
0.276093
3,890
148
75
26.283784
0.79794
0.057841
0
0.168317
0
0
0.025243
0
0
0
0
0
0.079208
1
0.237624
false
0
0.029703
0.069307
0.564356
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
a622e5490289c9e8968304e5f3c03fb5590e99d3
167
py
Python
mooc/037.py
hiyouga/PY-Learning
296f08e7964845c314874906039f244010d5422a
[ "MIT" ]
2
2017-12-09T14:41:29.000Z
2017-12-27T11:12:16.000Z
mooc/037.py
hiyouga/PY-Learning
296f08e7964845c314874906039f244010d5422a
[ "MIT" ]
null
null
null
mooc/037.py
hiyouga/PY-Learning
296f08e7964845c314874906039f244010d5422a
[ "MIT" ]
null
null
null
#encode.py #ASCII print(ord('A')) print(ord('a')) print(chr(65)) #UTF-8 s = "世界,你好!" bs = s.encode("utf-8") print(bs) print(bs.decode("utf-8")) print(bs.encode("gbk"))
15.181818
25
0.616766
33
167
3.121212
0.484848
0.116505
0.174757
0.271845
0
0
0
0
0
0
0
0.03268
0.083832
167
11
26
15.181818
0.640523
0.113772
0
0
0
0
0.143836
0
0
0
0
0
0
1
0
false
0
0
0
0
0.75
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
2
a62bbb63d79ddf9760e4d67c29d117a424bcc7b3
408
py
Python
flas/decorators.py
hectorbenitez/flask-heroku
f0b147d79875f0d28945aa51b37bdb8ea435617b
[ "MIT" ]
2
2019-04-03T12:31:53.000Z
2020-03-22T17:49:00.000Z
flas/decorators.py
hectorbenitez/flask-heroku
f0b147d79875f0d28945aa51b37bdb8ea435617b
[ "MIT" ]
null
null
null
flas/decorators.py
hectorbenitez/flask-heroku
f0b147d79875f0d28945aa51b37bdb8ea435617b
[ "MIT" ]
null
null
null
from functools import wraps import os from flask import request from werkzeug.utils import redirect ssl_required_flag = os.environ.get('SSL_REQUIRED', False) == 'True' def ssl_required(fn): @wraps(fn) def decorated_view(*args, **kwargs): if ssl_required_flag and not request.is_secure: return redirect(request.url.replace("http://", "https://")) return fn(*args, **kwargs) return decorated_view
25.5
67
0.747549
59
408
5.016949
0.559322
0.148649
0.101351
0
0
0
0
0
0
0
0
0
0.127451
408
15
68
27.2
0.831461
0
0
0
0
0
0.07598
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
a63a19c54726987f9442e2c7cd49b4fb9b77f7d9
170
py
Python
stream_app.py
jmillerbrooks/kc_stream
1b0a7d3a7039d6f200cd4ba4fbbe419adfe7215c
[ "CC0-1.0" ]
null
null
null
stream_app.py
jmillerbrooks/kc_stream
1b0a7d3a7039d6f200cd4ba4fbbe419adfe7215c
[ "CC0-1.0" ]
null
null
null
stream_app.py
jmillerbrooks/kc_stream
1b0a7d3a7039d6f200cd4ba4fbbe419adfe7215c
[ "CC0-1.0" ]
null
null
null
import streamlit as st import pandas as pd st.title('Streamlit Demo with KC Housing Data') map_data = pd.read_pickle('./data/forest_pred_map_df.pkl') st.map(map_data)
18.888889
58
0.770588
31
170
4.032258
0.612903
0.112
0
0
0
0
0
0
0
0
0
0
0.123529
170
9
59
18.888889
0.838926
0
0
0
0
0
0.374269
0.169591
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
a648be03f4cf7081e283eefd4f15fd7ae0f64206
1,136
py
Python
verify_conn.py
CodingDuckmx/Sauti-Africa-Market-Monitoring-DS
57117c54eec75c568944b1a9819f87664c376bf3
[ "MIT" ]
null
null
null
verify_conn.py
CodingDuckmx/Sauti-Africa-Market-Monitoring-DS
57117c54eec75c568944b1a9819f87664c376bf3
[ "MIT" ]
null
null
null
verify_conn.py
CodingDuckmx/Sauti-Africa-Market-Monitoring-DS
57117c54eec75c568944b1a9819f87664c376bf3
[ "MIT" ]
5
2020-06-20T21:52:57.000Z
2020-07-30T16:04:20.000Z
import os import psycopg2 from dotenv import load_dotenv, find_dotenv from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT from psycopg2 import sql load_dotenv() ############################################################################################################ '''Verify the credentials before running deployment. ''' ############################################################################################################ connection = psycopg2.connect(user=os.environ.get('aws_db_user'), password=os.environ.get('aws_db_password'), host=os.environ.get('aws_db_host'), port=os.environ.get('aws_db_port'))#, #database=os.environ.get('db_name')) connection.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) # Create the cursor. cursor = connection.cursor() print(connection) #Q_create_DB = """ # CREATE DATABASE sautidb; # """ #cursor.execute(sql.SQL("CREATE DATABASE sautidb")) #cursor.execute(Q_create_DB) #connection.commit() cursor.close() connection.close()
22.27451
108
0.52993
106
1,136
5.471698
0.367925
0.077586
0.103448
0.103448
0.234483
0
0
0
0
0
0
0.004348
0.190141
1,136
50
109
22.72
0.626087
0.191021
0
0
0
0
0.075353
0
0
0
0
0
0
1
0
false
0.066667
0.333333
0
0.333333
0.066667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
2
a6750164341a6a81a43df8546daa14432ce3c4f1
6,107
py
Python
tests/mapping_to_schema_test.py
rtkwlf/esfdw
09bd0929bd2c55c996d9dccd7e2b7506817284a7
[ "MIT" ]
18
2016-02-08T01:53:38.000Z
2020-01-08T02:55:48.000Z
tests/mapping_to_schema_test.py
rtkwlf/esfdw
09bd0929bd2c55c996d9dccd7e2b7506817284a7
[ "MIT" ]
3
2016-07-25T11:17:33.000Z
2019-08-13T15:15:03.000Z
tests/mapping_to_schema_test.py
rtkwlf/esfdw
09bd0929bd2c55c996d9dccd7e2b7506817284a7
[ "MIT" ]
12
2016-04-12T14:57:00.000Z
2019-08-16T10:08:20.000Z
from mock import patch import unittest from esfdw.mapping_to_schema import generate_table_spec, generate_schema, TableSpec, ColumnSpec class TestMappingToSchema(unittest.TestCase): def test_generate_table_spec(self): mapping = { 'index1': { 'mappings': { '_default_': { 'dynamic_templates': {} }, 'doc1': { 'properties': { 'a': { 'index': 'not_analyzed', 'type': 'string', 'doc_values': True }, 'b': { 'properties': { 'c': { 'properties': { 'd': { 'type': 'date', 'format': 'dateOptionalTime' } } }, 'e': { 'type': 'boolean' } } }, 'f-f': { 'type': 'double' }, 'g': { 'type': 'long' }, 'h': { 'type': 'short' } } }, 'doc2': { 'properties': { 'a': { 'type': 'string' } } }, 'doc-3': { 'properties': { 'z': { 'type': 'boolean' } } } } }, 'index2': { 'mappings': { 'doc1': { 'properties': { 'aa': { 'type': 'date' } } } } } } spec = sorted(list(generate_table_spec(mapping, ['index1'], [ 'doc1', 'doc-3'])), key=lambda x: (x.index, x.name)) self.assertEqual( spec, [ TableSpec( 'doc1', [ ColumnSpec( 'a', 'text'), ColumnSpec( 'f_f', 'double precision'), ColumnSpec( 'b__c__d', 'timestamp'), ColumnSpec( 'b__e', 'boolean'), ColumnSpec( 'g', 'bigint'), ColumnSpec( 'h', 'smallint')], 'doc1', 'index1'), TableSpec( 'doc_3', [ ColumnSpec( 'z', 'boolean')], 'doc-3', 'index1')]) spec = sorted(list(generate_table_spec(mapping, ['index1'], None)), key=lambda x: (x.index, x.name)) self.assertEqual(spec, [TableSpec('doc1', [ColumnSpec('a', 'text'), ColumnSpec('f_f', 'double precision'), ColumnSpec('b__c__d', 'timestamp'), ColumnSpec('b__e', 'boolean'), ColumnSpec('g', 'bigint'), ColumnSpec('h', 'smallint')], 'doc1', 'index1'), TableSpec('doc2', [ColumnSpec('a', 'text')], 'doc2', 'index1'), TableSpec('doc_3', [ColumnSpec('z', 'boolean')], 'doc-3', 'index1')] ) spec = sorted(list(generate_table_spec( mapping, [], ['doc1', 'doc-3'])), key=lambda x: (x.index, x.name)) self.assertEqual(spec, [TableSpec('doc1', [ColumnSpec('a', 'text'), ColumnSpec('f_f', 'double precision'), ColumnSpec('b__c__d', 'timestamp'), ColumnSpec('b__e', 'boolean'), ColumnSpec('g', 'bigint'), ColumnSpec('h', 'smallint')], 'doc1', 'index1'), TableSpec('doc_3', [ColumnSpec('z', 'boolean')], 'doc-3', 'index1'), TableSpec('doc1', [ColumnSpec('aa', 'timestamp')], 'doc1', 'index2')], ) @patch('esfdw.mapping_to_schema.generate_table_spec') def test_generate_schema(self, generate_table_spec_mock): generate_table_spec_mock.return_value = [ TableSpec( 'table1', [ ColumnSpec( 'a', 'text'), ColumnSpec( 'b', 'integer')], 'table1', 'myindex')] expected_schema = [ """DROP FOREIGN TABLE IF EXISTS table1; CREATE FOREIGN TABLE table1 ( a text, b integer ) SERVER es_srv OPTIONS ( doc_type 'table1', index 'myindex', column_name_translation 'true' ); """] schema = list(generate_schema(None, None, None, 'es_srv')) self.assertEqual(expected_schema, schema) if __name__ == '__main__': unittest.main()
40.986577
99
0.304732
349
6,107
5.126075
0.246418
0.020123
0.07602
0.055897
0.46171
0.46171
0.46171
0.46171
0.433762
0.433762
0
0.016047
0.581628
6,107
148
100
41.263514
0.684149
0
0
0.3
1
0
0.128305
0.007288
0
0
0
0
0.030769
1
0.015385
false
0
0.023077
0
0.046154
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
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
2
a681b3027488ffc36dc467d8b2de9c530b5de3ee
9,243
py
Python
docusign_esign/models/display_appliance_page.py
joekohlsdorf/docusign-esign-python-client
40407544f79c88716d36fabf36f65c3ef1a5c3ba
[ "MIT" ]
58
2017-10-18T23:06:57.000Z
2021-04-15T23:14:58.000Z
docusign_esign/models/display_appliance_page.py
joekohlsdorf/docusign-esign-python-client
40407544f79c88716d36fabf36f65c3ef1a5c3ba
[ "MIT" ]
49
2017-10-27T05:54:09.000Z
2021-04-29T22:06:17.000Z
docusign_esign/models/display_appliance_page.py
joekohlsdorf/docusign-esign-python-client
40407544f79c88716d36fabf36f65c3ef1a5c3ba
[ "MIT" ]
49
2017-09-16T07:23:41.000Z
2021-05-07T20:21:20.000Z
# coding: utf-8 """ DocuSign REST API The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. OpenAPI spec version: v2.1 Contact: devcenter@docusign.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re class DisplayAppliancePage(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ def __init__(self, doc_name=None, document_id=None, external_document_id=None, height=None, is_first_page=None, page_id=None, page_no=None, page_status=None, page_type=None, width=None): """ DisplayAppliancePage - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition. """ self.swagger_types = { 'doc_name': 'str', 'document_id': 'str', 'external_document_id': 'str', 'height': 'int', 'is_first_page': 'bool', 'page_id': 'str', 'page_no': 'int', 'page_status': 'str', 'page_type': 'str', 'width': 'int' } self.attribute_map = { 'doc_name': 'docName', 'document_id': 'documentId', 'external_document_id': 'externalDocumentId', 'height': 'height', 'is_first_page': 'isFirstPage', 'page_id': 'pageId', 'page_no': 'pageNo', 'page_status': 'pageStatus', 'page_type': 'pageType', 'width': 'width' } self._doc_name = doc_name self._document_id = document_id self._external_document_id = external_document_id self._height = height self._is_first_page = is_first_page self._page_id = page_id self._page_no = page_no self._page_status = page_status self._page_type = page_type self._width = width @property def doc_name(self): """ Gets the doc_name of this DisplayAppliancePage. :return: The doc_name of this DisplayAppliancePage. :rtype: str """ return self._doc_name @doc_name.setter def doc_name(self, doc_name): """ Sets the doc_name of this DisplayAppliancePage. :param doc_name: The doc_name of this DisplayAppliancePage. :type: str """ self._doc_name = doc_name @property def document_id(self): """ Gets the document_id of this DisplayAppliancePage. Specifies the document ID number that the tab is placed on. This must refer to an existing Document's ID attribute. :return: The document_id of this DisplayAppliancePage. :rtype: str """ return self._document_id @document_id.setter def document_id(self, document_id): """ Sets the document_id of this DisplayAppliancePage. Specifies the document ID number that the tab is placed on. This must refer to an existing Document's ID attribute. :param document_id: The document_id of this DisplayAppliancePage. :type: str """ self._document_id = document_id @property def external_document_id(self): """ Gets the external_document_id of this DisplayAppliancePage. :return: The external_document_id of this DisplayAppliancePage. :rtype: str """ return self._external_document_id @external_document_id.setter def external_document_id(self, external_document_id): """ Sets the external_document_id of this DisplayAppliancePage. :param external_document_id: The external_document_id of this DisplayAppliancePage. :type: str """ self._external_document_id = external_document_id @property def height(self): """ Gets the height of this DisplayAppliancePage. Height of the tab in pixels. :return: The height of this DisplayAppliancePage. :rtype: int """ return self._height @height.setter def height(self, height): """ Sets the height of this DisplayAppliancePage. Height of the tab in pixels. :param height: The height of this DisplayAppliancePage. :type: int """ self._height = height @property def is_first_page(self): """ Gets the is_first_page of this DisplayAppliancePage. :return: The is_first_page of this DisplayAppliancePage. :rtype: bool """ return self._is_first_page @is_first_page.setter def is_first_page(self, is_first_page): """ Sets the is_first_page of this DisplayAppliancePage. :param is_first_page: The is_first_page of this DisplayAppliancePage. :type: bool """ self._is_first_page = is_first_page @property def page_id(self): """ Gets the page_id of this DisplayAppliancePage. :return: The page_id of this DisplayAppliancePage. :rtype: str """ return self._page_id @page_id.setter def page_id(self, page_id): """ Sets the page_id of this DisplayAppliancePage. :param page_id: The page_id of this DisplayAppliancePage. :type: str """ self._page_id = page_id @property def page_no(self): """ Gets the page_no of this DisplayAppliancePage. :return: The page_no of this DisplayAppliancePage. :rtype: int """ return self._page_no @page_no.setter def page_no(self, page_no): """ Sets the page_no of this DisplayAppliancePage. :param page_no: The page_no of this DisplayAppliancePage. :type: int """ self._page_no = page_no @property def page_status(self): """ Gets the page_status of this DisplayAppliancePage. :return: The page_status of this DisplayAppliancePage. :rtype: str """ return self._page_status @page_status.setter def page_status(self, page_status): """ Sets the page_status of this DisplayAppliancePage. :param page_status: The page_status of this DisplayAppliancePage. :type: str """ self._page_status = page_status @property def page_type(self): """ Gets the page_type of this DisplayAppliancePage. :return: The page_type of this DisplayAppliancePage. :rtype: str """ return self._page_type @page_type.setter def page_type(self, page_type): """ Sets the page_type of this DisplayAppliancePage. :param page_type: The page_type of this DisplayAppliancePage. :type: str """ self._page_type = page_type @property def width(self): """ Gets the width of this DisplayAppliancePage. Width of the tab in pixels. :return: The width of this DisplayAppliancePage. :rtype: int """ return self._width @width.setter def width(self, width): """ Sets the width of this DisplayAppliancePage. Width of the tab in pixels. :param width: The width of this DisplayAppliancePage. :type: int """ self._width = width def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
26.484241
190
0.578384
1,041
9,243
4.90682
0.139289
0.046985
0.203602
0.065779
0.569303
0.481793
0.344753
0.191073
0.129992
0.095536
0
0.000985
0.34069
9,243
348
191
26.560345
0.837217
0.393595
0
0.251969
0
0
0.074865
0
0
0
0
0
0
1
0.204724
false
0
0.023622
0
0.354331
0.007874
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
0
0
0
0
2
a69dd8c71325c3eedd89f1d5eaff535905421065
407
py
Python
tests/test_conf.py
johnfraney/django-ner-trainer
38a02a858412eab2d4721659ee33a6e8721199ea
[ "MIT" ]
6
2018-07-26T12:11:21.000Z
2021-07-14T07:08:55.000Z
tests/test_conf.py
johnfraney/django-ner-trainer
38a02a858412eab2d4721659ee33a6e8721199ea
[ "MIT" ]
null
null
null
tests/test_conf.py
johnfraney/django-ner-trainer
38a02a858412eab2d4721659ee33a6e8721199ea
[ "MIT" ]
4
2019-03-31T06:29:53.000Z
2022-03-18T17:27:33.000Z
from django.test import TestCase from ner_trainer.conf import settings, DEFAULTS class SettingsTests(TestCase): def test_default_settings(self): for setting_name, default_value in DEFAULTS.items(): self.assertEqual(getattr(settings, setting_name), default_value) def test_nonexistant_setting(self): with self.assertRaises(AttributeError): settings.BANANA
29.071429
76
0.737101
47
407
6.191489
0.595745
0.04811
0.123711
0.158076
0
0
0
0
0
0
0
0
0.191646
407
13
77
31.307692
0.884498
0
0
0
0
0
0
0
0
0
0
0
0.222222
1
0.222222
false
0
0.222222
0
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
a6a512a3f69cae226b737f9acf859287826be0c7
1,042
py
Python
common/helper.py
Acheng-dot/tele-vdo-rider
ad58fab90691425093eac7fb4c8627bf8d706f37
[ "MIT" ]
18
2020-07-11T15:23:06.000Z
2021-12-05T17:33:20.000Z
common/helper.py
Acheng-dot/tele-vdo-rider
ad58fab90691425093eac7fb4c8627bf8d706f37
[ "MIT" ]
1
2021-01-06T13:49:09.000Z
2021-01-06T13:49:09.000Z
common/helper.py
Acheng-dot/tele-vdo-rider
ad58fab90691425093eac7fb4c8627bf8d706f37
[ "MIT" ]
5
2020-11-10T05:16:07.000Z
2022-01-30T02:47:20.000Z
import json import os import time from datetime import datetime def datetime_from_timestamp(unix_timestamp): return datetime.fromtimestamp(int(unix_timestamp)).strftime("%Y-%m-%d %H:%M:%S") def datetime_now(): return datetime_from_timestamp(time.time()) def load_json(file_name): with open(file_name, "r") as json_file: return json.loads(json_file.read()) def save_json(file_name, data): with open(file_name, "w") as json_file: return json_file.write(json.dumps(data)) def format_size(size): units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"] size = float(size) i = 0 while size >= 1024.0 and i < len(units): i += 1 size /= 1024.0 return "%.2f %s" % (size, units[i]) def rename_file(old_filename, new_filename): full_path, filename = os.path.split(old_filename) filename, extension = os.path.splitext(filename) temp_filename = os.path.join(full_path, new_filename + extension) os.rename(old_filename, temp_filename) return temp_filename
25.414634
84
0.675624
154
1,042
4.383117
0.409091
0.071111
0.062222
0.047407
0.059259
0
0
0
0
0
0
0.015366
0.1881
1,042
40
85
26.05
0.782506
0
0
0
0
0
0.043186
0
0
0
0
0
0
1
0.214286
false
0
0.142857
0.071429
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
a6b5eedae0f789b4e35986f3d7c3b2ac5641d294
260
py
Python
hc-sr501/python/pir_gpiozero.py
holsteiner/raspberry-examples
f6f0620aa0b49a304d393953002d2e42062d572f
[ "Unlicense" ]
3
2019-12-09T12:03:24.000Z
2022-01-10T10:24:48.000Z
hc-sr501/python/pir_gpiozero.py
holsteiner/raspberry-examples
f6f0620aa0b49a304d393953002d2e42062d572f
[ "Unlicense" ]
null
null
null
hc-sr501/python/pir_gpiozero.py
holsteiner/raspberry-examples
f6f0620aa0b49a304d393953002d2e42062d572f
[ "Unlicense" ]
null
null
null
from gpiozero import MotionSensor PIN_PIR = 23 pir = MotionSensor(PIN_PIR) try: while(True): if(pir.motion_detected): print("Motion detected.") else: print("No motion.") except KeyboardInterrupt: print("END")
17.333333
37
0.615385
29
260
5.413793
0.655172
0.191083
0.229299
0
0
0
0
0
0
0
0
0.010638
0.276923
260
14
38
18.571429
0.824468
0
0
0
0
0
0.111538
0
0
0
0
0
0
1
0
false
0
0.090909
0
0.090909
0.272727
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a6b82ea6bd5bfbb174918e09f8a5800ce1a247d0
1,004
py
Python
CentralBlockML/code/modelBranch.py
DistributedML/Biscotti
dfba71b3924e1bafd2ab2545881fb741193f224e
[ "BSD-2-Clause" ]
61
2019-01-13T22:07:00.000Z
2022-02-16T16:53:13.000Z
CentralBlockML/code/modelBranch.py
cm20210602/Biscotti
dfba71b3924e1bafd2ab2545881fb741193f224e
[ "BSD-2-Clause" ]
null
null
null
CentralBlockML/code/modelBranch.py
cm20210602/Biscotti
dfba71b3924e1bafd2ab2545881fb741193f224e
[ "BSD-2-Clause" ]
14
2019-05-26T15:11:39.000Z
2022-03-02T16:10:24.000Z
import numpy as np import pdb class ModelBranch: def __init__(self, initialW, initialGrad): print("initializing model") self.chain = [[initialW, initialGrad]] self.pendingGradients = [] self.gradientHistory = [] def updateModel(self): ### TODO:: Refactor out ### acc = np.zeros(self.chain[0][0].size) numPending = len(self.pendingGradients) for grad in self.pendingGradients: acc += grad newGrad = acc / numPending ### newW = self.chain[-1][0] + newGrad self.chain.append([newW, newGrad]) ### Testing to see if gradients can be linked ### self.gradientHistory.append(self.pendingGradients[:]) ### self.pendingGradients = [] def getWeights(self): return self.chain[-1][0] def getPreviousGrad(self): return self.chain[-1][1] def submitGradient(self, grad): self.pendingGradients.append(grad)
28.685714
61
0.582669
102
1,004
5.696078
0.460784
0.092943
0.051635
0.037866
0.068847
0
0
0
0
0
0
0.011331
0.296813
1,004
35
62
28.685714
0.811615
0.061753
0
0.083333
0
0
0.019651
0
0
0
0
0.028571
0
1
0.208333
false
0
0.083333
0.083333
0.416667
0.041667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
0
0
0
0
2
a6c2b3e1a16d386e50068125ca75e7e4023faee0
383
py
Python
spax/types.py
jackd/spax
bc55a2660d468838aa1c080d6152d0be73eab118
[ "Apache-2.0" ]
1
2021-08-11T23:25:15.000Z
2021-08-11T23:25:15.000Z
spax/types.py
jackd/spax
bc55a2660d468838aa1c080d6152d0be73eab118
[ "Apache-2.0" ]
null
null
null
spax/types.py
jackd/spax
bc55a2660d468838aa1c080d6152d0be73eab118
[ "Apache-2.0" ]
null
null
null
import typing as tp import jax.numpy as jnp from jax.experimental.sparse.ops import JAXSparse ArrayFun = tp.Callable[[jnp.ndarray], jnp.ndarray] ArrayOrFun = tp.Union[ArrayFun, jnp.ndarray, JAXSparse] class EigenPair(tp.NamedTuple): """Result of eigendecomposition, or a single eigenpair.""" w: jnp.ndarray # [...] eigenvalue v: jnp.ndarray # [N, ...] eigenvector
25.533333
62
0.715405
50
383
5.48
0.62
0.182482
0
0
0
0
0
0
0
0
0
0
0.156658
383
14
63
27.357143
0.848297
0.237598
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.375
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
a6e755b40f5f2aad0fa2c095df98cd20cd9ab848
923
py
Python
lioght/light_controller/milight_controller.py
Ketouem/lioght
ae016a314653cf547b992b06e5d77e13d8f62afc
[ "MIT" ]
null
null
null
lioght/light_controller/milight_controller.py
Ketouem/lioght
ae016a314653cf547b992b06e5d77e13d8f62afc
[ "MIT" ]
null
null
null
lioght/light_controller/milight_controller.py
Ketouem/lioght
ae016a314653cf547b992b06e5d77e13d8f62afc
[ "MIT" ]
null
null
null
from milight import MiLight, LightBulb, color_from_hex from . import LightController class MiLightController(LightController): VENDOR = "milight" def __init__(self, host, port, bulbs, *args, **kwargs): super(MiLightController, self).__init__(*args, **kwargs) self._milight = MiLight({'host': host, 'port': int(port)}, wait_duration=0) self._bulbs = LightBulb(bulbs) def switch_on(self, light_id): self._milight.send(self._bulbs.on(light_id)) def switch_all_on(self): self._milight.send(self._bulbs.all_on()) def switch_off(self, light_id): self._milight.send(self._bulbs.off(light_id)) def switch_all_off(self): self._milight.send(self._bulbs.all_off()) def change_color(self, light_id, color_code): self._milight.send( self._bulbs.color(color_from_hex(color_code), light_id))
29.774194
68
0.658722
118
923
4.79661
0.271186
0.116608
0.132509
0.167845
0.342756
0.233216
0.233216
0.123675
0
0
0
0.001387
0.218852
923
30
69
30.766667
0.783634
0
0
0
0
0
0.016251
0
0
0
0
0
0
1
0.3
false
0
0.1
0
0.5
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
a6f63185f940c893daa75531356070515622979e
2,942
py
Python
api/service/plugins/azure/servicebus/workspaceDelete.py
KAIYO-OSS/titan
0a4e296ded466785334279f7106d390c1dd4c30b
[ "Apache-2.0" ]
55
2021-01-27T18:39:39.000Z
2022-03-16T10:56:46.000Z
api/service/plugins/azure/servicebus/workspaceDelete.py
KAIYO-OSS/titan
0a4e296ded466785334279f7106d390c1dd4c30b
[ "Apache-2.0" ]
17
2021-06-05T12:28:35.000Z
2022-02-14T13:11:26.000Z
api/service/plugins/azure/servicebus/workspaceDelete.py
KAIYO-OSS/titan
0a4e296ded466785334279f7106d390c1dd4c30b
[ "Apache-2.0" ]
null
null
null
# from util.azure import Azure # import util.mongoUtil as mu # from util.utilityHelpers import Utils # from models.enums.workflows import DeleteWorkspace # from azure.servicebus import Message # import util.serviceBusUtil as ServiceBusUtil # import time # import logging # logger = logging.getLogger("ODIN") # class WorkspaceDelete: # # success-deleteWorkspace # @staticmethod # def startSuccessWorkflow(message: Message): # logger.info(".....success workflow path.....") # workspaceId = (message.properties.message_id).decode('utf-8') # workspaceDB = mu.find_by_id("workspace", workspaceId) # rg = workspaceDB["resourceGroupName"] # cluster = workspaceDB["clusterName"] # if (workspaceDB["status"] == str(DeleteWorkspace.Deleted.name)): # message.complete() # try: # if (workspaceDB["status"] == str(DeleteWorkspace.DeleteWorkspaceAccepted.name)): # mu.updateStatus("workspace", workspaceId, str(DeleteWorkspace.DeletingCluster.name)) # # Azure # Azure.deleteAKSCluster(rg, cluster) # mu.updateStatus("workspace", workspaceId, str(DeleteWorkspace.DeletedCluster.name)) # except Exception as ex: # mu.updateStatus("workspace", workspaceId, str(DeleteWorkspace.ClusterDeleteFailed.name), str(ex), True) # logger.exception(ex) # message.complete() # workspaceDB = mu.find_by_id("workspace", workspaceId) # try: # if (workspaceDB["status"] == str(DeleteWorkspace.DeletedCluster.name)): # mu.updateStatus("workspace", workspaceId, str(DeleteWorkspace.DeletingRG.name)) # # Azure # Azure.deleteResourceGroup(rg) # mu.updateStatus("workspace", workspaceId, str(DeleteWorkspace.Deleted.name)) # message.complete() # except Exception as ex: # mu.updateStatus("workspace", workspaceId, str(DeleteWorkspace.RGDeleteFailed.name), str(ex), True) # logger.exception(ex) # message.complete() # # api-deleteWorkspace # @staticmethod # def startWorkflow(message: Message): # try: # logger.info(".....start workflow path.....") # ServiceBusUtil.azureLogin() # messageString = str(message.message) # workspaceId = (message.properties.message_id).decode('utf-8') # mu.updateStatus("workspace", workspaceId, str(DeleteWorkspace.DeleteWorkspaceAccepted.name)) # message.complete() # ServiceBusUtil.sendQueueMessage("success-deleteWorkspace", messageString, workspaceId, "str", # str(DeleteWorkspace.DeletingCluster.name)) # except Exception as ex: # mu.save("FailedWorkflows", str(message.message)) # logger.exception(ex)
43.910448
117
0.625085
250
2,942
7.332
0.288
0.10802
0.087834
0.129842
0.476814
0.466448
0.283688
0.177851
0.126568
0.077469
0
0.000911
0.253909
2,942
66
118
44.575758
0.834169
0.956492
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
a6f800761ebf034a378006dfaf9eee9cb5cc9564
116
py
Python
datacatalog/views/challenge_problem_view/__init__.py
SD2E/python-datacatalog
51ab366639505fb6e8a14cd6b446de37080cd20d
[ "CNRI-Python" ]
null
null
null
datacatalog/views/challenge_problem_view/__init__.py
SD2E/python-datacatalog
51ab366639505fb6e8a14cd6b446de37080cd20d
[ "CNRI-Python" ]
2
2019-07-25T15:39:04.000Z
2019-10-21T15:31:46.000Z
datacatalog/views/challenge_problem_view/__init__.py
SD2E/python-datacatalog
51ab366639505fb6e8a14cd6b446de37080cd20d
[ "CNRI-Python" ]
1
2019-10-15T14:33:44.000Z
2019-10-15T14:33:44.000Z
AUTHOR = 'vaughn@tacc.utexas.edu' DESCRIPTION = 'Challenge problems' # MONGODB_VIEW_NAME = 'challenge_problem_view'
29
46
0.793103
14
116
6.285714
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.094828
116
3
47
38.666667
0.838095
0.37931
0
0
0
0
0.571429
0.314286
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
4709e851af012d56bb0a970db15a60b6f203c2b8
362
py
Python
stubs/micropython-esp32-1_13-103/uasyncio/event.py
RonaldHiemstra/micropython-stubs
d97f879b01f6687baaebef1c7e26a80909c3cff3
[ "MIT" ]
38
2020-10-18T21:59:44.000Z
2022-03-17T03:03:28.000Z
stubs/micropython-esp32-1_13-103/uasyncio/event.py
RonaldHiemstra/micropython-stubs
d97f879b01f6687baaebef1c7e26a80909c3cff3
[ "MIT" ]
176
2020-10-18T14:31:03.000Z
2022-03-30T23:22:39.000Z
stubs/micropython-esp32-1_13-103/uasyncio/event.py
RonaldHiemstra/micropython-stubs
d97f879b01f6687baaebef1c7e26a80909c3cff3
[ "MIT" ]
6
2020-12-28T21:11:12.000Z
2022-02-06T04:07:50.000Z
""" Module: 'uasyncio.event' on esp32 1.13.0-103 """ # MCU: (sysname='esp32', nodename='esp32', release='1.13.0', version='v1.13-103-gb137d064e on 2020-10-09', machine='ESP32 module (spiram) with ESP32') # Stubber: 1.3.4 class Event: '' def clear(): pass def is_set(): pass def set(): pass wait = None core = None
18.1
150
0.58011
53
362
3.943396
0.641509
0.028708
0.038278
0
0
0
0
0
0
0
0
0.161172
0.245856
362
19
151
19.052632
0.604396
0.577348
0
0.3
0
0
0
0
0
0
0
0
0
1
0.3
false
0.3
0
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
47148bc55fabddc91775039ed711d312eb351276
332
py
Python
backend/sponsor/views.py
AroraShreshth/officialWebsite
927fec11bbc4c0d64619c597afca6448075ab430
[ "MIT" ]
null
null
null
backend/sponsor/views.py
AroraShreshth/officialWebsite
927fec11bbc4c0d64619c597afca6448075ab430
[ "MIT" ]
null
null
null
backend/sponsor/views.py
AroraShreshth/officialWebsite
927fec11bbc4c0d64619c597afca6448075ab430
[ "MIT" ]
null
null
null
from django.shortcuts import render from . import models from . import serializers from rest_framework import viewsets, status, mixins, generics class SponsorViewSet(viewsets.ModelViewSet): """Manage sponsors in the database""" serializer_class = serializers.SponsorSerializer queryset = models.Sponsor.objects.all()
27.666667
61
0.786145
37
332
7
0.72973
0.07722
0
0
0
0
0
0
0
0
0
0
0.141566
332
11
62
30.181818
0.908772
0.093373
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.571429
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
47283eb0184e0f7348532493403a71ee00f415d8
4,326
py
Python
test/test_physics.py
aandergr/kspalculator
b9fbe946f297b56ddf681c59480212a522c745b4
[ "MIT" ]
25
2016-05-25T12:53:03.000Z
2022-01-30T10:04:52.000Z
test/test_physics.py
aandergr/kspalculator
b9fbe946f297b56ddf681c59480212a522c745b4
[ "MIT" ]
17
2016-07-21T15:38:58.000Z
2017-11-13T01:29:03.000Z
test/test_physics.py
aandergr/kspalculator
b9fbe946f297b56ddf681c59480212a522c745b4
[ "MIT" ]
11
2016-05-28T16:33:18.000Z
2021-05-06T02:47:21.000Z
# Note that these unit tests are expected to work on both python2 and python3. # Python 2.7 support. from __future__ import division import unittest import kspalculator.physics as physics class TestPhysics(unittest.TestCase): def assertListAlmostEqual(self, first, second): if len(first) != len(second): raise self.failureException("List length mismatch") for i in range(len(first)): self.assertAlmostEqual(first[i], second[i], places=1) def test_lf_needed_fuel(self): m_c = physics.lf_needed_fuel([1750, 580, 310, 792], 4*[345], 1500, 1/8) self.assertAlmostEqual(m_c, 3378.94, places=1) m_c = physics.lf_needed_fuel([1750, 580, 310, 792], 3*[345]+[300], 1500, 1/8) self.assertAlmostEqual(m_c, 3625.64, places=1) def test_lf_performance(self): r_dv, r_p, r_a_s, r_a_t, r_m_s, r_m_t, r_solid, r_op = \ physics.lf_performance([1750,580,310,792], 4*[345], 4*[60000], 4*[0], 2005, 5000, 1/8) self.assertListAlmostEqual(r_dv, [1750, 580, 310, 792, 171.56]) self.assertListEqual(r_p, 5*[0]) self.assertListEqual(r_solid, 5*[False]) self.assertListEqual(r_op, list(range(4))+[3]) self.assertListAlmostEqual(r_a_s, [7.86, 13.19, 15.65, 17.15, 21.68]) self.assertListAlmostEqual(r_a_t, [13.19, 15.65, 17.15, 21.68, 22.81]) self.assertListAlmostEqual(r_m_s, [7630.0, 4548.69, 3832.08, 3496.57, 2766.80]) self.assertListAlmostEqual(r_m_t, [4548.69, 3832.08, 3496.57, 2766.80, 2630.0]) def test_sflf_needed_fuel(self): m_c = physics.sflf_needed_fuel([2500, 2000], [250, 320], [195,220], 15000, 50, 24000, 4500) self.assertAlmostEqual(m_c, 104716.64, places=1) # tests which once failed m_c = physics.sflf_needed_fuel([2000], [250], [150], 10000, 200, 10000, 2000) self.assertAlmostEqual(m_c, 10106.61, places=1) m_c = physics.sflf_needed_fuel([150, 2000], [240, 250], [130, 150], 10000, 200, 10000, 2000) self.assertAlmostEqual(m_c, 12298.56, places=1) m_ca = physics.sflf_needed_fuel([2150], [250], [150], 10000, 200, 10000, 2000) m_cb = physics.sflf_needed_fuel([150, 2000], 2*[250], 2*[150], 10000, 200, 10000, 2000) self.assertAlmostEqual(m_ca, 11990.20, places=1) self.assertAlmostEqual(m_cb, 11990.20, places=1) m_c = physics.sflf_needed_fuel([905, 3650], [260, 284.6], [195, 215.5], 10040, 50, 24000, 4500) self.assertAlmostEqual(m_c, 63162.60, places=1) def test_sflf_performance(self): # pylint:disable=unused-variable r_dv, r_p, r_a_s, r_a_t, r_m_s, r_m_t, r_solid, r_op = \ physics.sflf_performance([1000, 500], [250, 260], [150, 170], [0,0], [0,0], [0,0], 10000, 7000, 100, 5000, 1000) self.assertListAlmostEqual(r_dv, [281.37, 718.62, 500.0, 19.68]) self.assertListAlmostEqual(r_m_s, [22975.0, 17875.0, 13333.60, 10959.29]) self.assertListAlmostEqual(r_m_t, [18975.0, 13333.60, 10959.29, 10875.0]) self.assertListEqual(r_solid, [True, False, False, False]) self.assertListEqual(r_op, [0, 0, 1, 1]) r_dv, r_p, r_a_s, r_a_t, r_m_s, r_m_t, r_solid, r_op = \ physics.sflf_performance([2000], [250], [150], [0], [0], [0], 10000, 11000, 200, 10000, 2000) self.assertListAlmostEqual(r_dv, [414.54, 1585.45, 73.16]) self.assertListAlmostEqual(r_m_s, [32575.0, 22375.0, 11719.57]) self.assertListAlmostEqual(r_m_t, [24575.0, 11719.57, 11375.0]) self.assertListEqual(r_solid, [True, False, False]) self.assertListEqual(r_op, [0, 0, 0]) r_dv, r_p, r_a_s, r_a_t, r_m_s, r_m_t, r_solid, r_op = \ physics.sflf_performance([100, 900, 500], [250, 250, 260], [150, 150, 170], [0,0,0], [0,0,0], [0,0,0], 10000, 7000, 100, 5000, 1000) self.assertListAlmostEqual(r_dv, [100.0, 181.37, 718.62, 500.0, 19.68]) self.assertListAlmostEqual(r_m_s, [22975.0, 21465.04, 17875.0, 13333.60, 10959.29]) self.assertListAlmostEqual(r_m_t, [21465.04, 18975.0, 13333.60, 10959.29, 10875.0]) self.assertListEqual(r_solid, [True, True, False, False, False]) self.assertListEqual(r_op, [0, 1, 1, 2, 2])
60.083333
103
0.627832
689
4,326
3.751814
0.261248
0.013927
0.140812
0.013927
0.607737
0.52882
0.468472
0.419729
0.318375
0.254159
0
0.243227
0.214979
4,326
72
104
60.083333
0.517962
0.034905
0
0.063492
0
0
0.004795
0
0
0
0
0
0.52381
1
0.079365
false
0
0.047619
0
0.142857
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
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
2
47292cdadf69360e454f3b4e583993532cf2b6ef
252
py
Python
toxpipenv/setup.py
cassiobotaro/Rivendell
dcdb2543e42dea26dc07c9134d65b48f2c99bcc7
[ "Apache-2.0" ]
31
2018-01-07T21:25:07.000Z
2021-06-18T13:30:43.000Z
toxpipenv/setup.py
cassiobotaro/Rivendell
dcdb2543e42dea26dc07c9134d65b48f2c99bcc7
[ "Apache-2.0" ]
3
2018-01-10T12:08:42.000Z
2020-03-31T01:12:46.000Z
toxpipenv/setup.py
cassiobotaro/Rivendell
dcdb2543e42dea26dc07c9134d65b48f2c99bcc7
[ "Apache-2.0" ]
4
2018-01-10T02:27:04.000Z
2019-08-15T19:38:03.000Z
#!/usr/bin/env python from distutils.core import setup setup(name='toxpipenv', version='1.0', description='Just some tests', author='Cássio Botaro', author_email='cassiobotaro@gmail.com', packages=['toxpipenv'], )
21
44
0.638889
29
252
5.517241
0.896552
0
0
0
0
0
0
0
0
0
0
0.010101
0.214286
252
11
45
22.909091
0.79798
0.079365
0
0
0
0
0.307359
0.095238
0
0
0
0
0
1
0
true
0
0.125
0
0.125
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
5b269a12cf1da5c1475db6d524ff1814e1723b8b
527
py
Python
georiviere/watershed/tests/test_models.py
georiviere/Georiviere-admin
4ac532f84a7a8fef3e01384fad63e8e288d397c0
[ "BSD-2-Clause" ]
7
2021-11-05T14:52:25.000Z
2022-03-24T21:18:02.000Z
georiviere/watershed/tests/test_models.py
georiviere/Georiviere-admin
4ac532f84a7a8fef3e01384fad63e8e288d397c0
[ "BSD-2-Clause" ]
57
2021-11-02T10:27:34.000Z
2022-03-31T14:08:32.000Z
georiviere/watershed/tests/test_models.py
georiviere/Georiviere-admin
4ac532f84a7a8fef3e01384fad63e8e288d397c0
[ "BSD-2-Clause" ]
1
2021-12-05T14:55:42.000Z
2021-12-05T14:55:42.000Z
from django.test import TestCase from georiviere.watershed.tests import factories class StationTest(TestCase): @classmethod def setUpTestData(cls): cls.watershed_type = factories.WatershedTypeFactory(name="Toto") cls.watershed = factories.WatershedFactory(name="Tata", watershed_type=cls.watershed_type) def test_watershed_str(self): self.assertEqual(str(self.watershed), 'Toto - Tata') def test_watershed_type_str(self): self.assertEqual(str(self.watershed_type), 'Toto')
29.277778
98
0.73814
61
527
6.229508
0.393443
0.171053
0.084211
0.115789
0.2
0.2
0.2
0
0
0
0
0
0.159393
527
17
99
31
0.857788
0
0
0
0
0
0.043643
0
0
0
0
0
0.181818
1
0.272727
false
0
0.181818
0
0.545455
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
5b2a83b40e1493899cd575a16c2096c565c8f0d9
1,129
py
Python
restapi/modules/errors.py
haukurk/flask-restapi-recipe
2bacf0f502fc751f4dbbeddc5bf964f4320fcfe7
[ "MIT" ]
63
2015-01-01T00:36:11.000Z
2022-02-17T08:38:29.000Z
restapi/modules/errors.py
haukurk/flask-restapi-recipe
2bacf0f502fc751f4dbbeddc5bf964f4320fcfe7
[ "MIT" ]
4
2015-12-10T13:07:45.000Z
2022-02-02T03:19:43.000Z
restapi/modules/errors.py
haukurk/flask-restapi-recipe
2bacf0f502fc751f4dbbeddc5bf964f4320fcfe7
[ "MIT" ]
17
2015-02-02T10:38:19.000Z
2021-07-31T12:35:36.000Z
__author__ = 'haukurk' def log_exception(sender, exception, **extra): """ Log an exception to our logging framework. @param sender: sender @param exception: exception triggered @**extra: other params. @return: void """ sender.logger.debug('Got exception during processing: %s', exception) def error_incorrect_version(version): """ Return a response when the client is using incorrect API version. @param version: version in use. @return: dict """ return {"status": "error", "message": "incorrect API version "+str(version)+" used."} def error_object_not_found(): """ Return an error response when something is not found, like a object in a database. @return: dict """ return {"status": "error", "message": "object not found"} def error_commit_error(ex): """ Return an error response when database commit fails somehow. Like when inserting into a database and you get a unique constraint violated. @return: dict """ return {"status": "error", "message": "error when committing object to database", "exception": ex.message}
29.710526
110
0.673162
140
1,129
5.342857
0.435714
0.032086
0.064171
0.088235
0.203209
0.136364
0
0
0
0
0
0
0.212578
1,129
38
110
29.710526
0.841395
0.444641
0
0
0
0
0.355932
0
0
0
0
0
0
1
0.444444
false
0
0
0
0.777778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
5b2c58a438f51931144d7ccc0e9d6335f58b2f35
1,715
py
Python
control.py
rogerwim/pi_globe
5165f5113c8bd7bc722011b4bf1325f9d39dabc7
[ "Unlicense" ]
1
2021-08-28T10:19:28.000Z
2021-08-28T10:19:28.000Z
control.py
rogerwim/pi_globe
5165f5113c8bd7bc722011b4bf1325f9d39dabc7
[ "Unlicense" ]
3
2020-07-10T19:42:21.000Z
2021-03-27T15:52:37.000Z
control.py
rogerwim/pi_globe
5165f5113c8bd7bc722011b4bf1325f9d39dabc7
[ "Unlicense" ]
1
2021-03-27T15:46:17.000Z
2021-03-27T15:46:17.000Z
import serial steps_per_rev = 1540 arduino = serial.Serial('/dev/ttyUSB1',9600) def bits_to_byte(bits): byte = 0 if type(bits) != list: raise TypeError("type must be list") if len(bits) != 8: raise ValueError("you must input 8 bits, no more or less") for i in range(0,8): if bits[i] != 1 and bits[i] != 0: raise TypeError("bits can only be 0 or 1") byte += bits[i] << i return bytes([byte]) def send_command(command, data1,data2,data3,data4,data5,data6): # example command [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] command1 = 0 command2 = 0 print(command) command1 = bits_to_byte(command[0:8]) command2 = bits_to_byte(command[8:]) print(command1,command2) data_and_command = command1 + command2 + bytes([data1]) + bytes([data2]) + bytes([data3]) + bytes([data4]) + bytes([data5]) + bytes([data6]) print(data_and_command) arduino.write(data_and_command) print(arduino.read()) def step_with_home(ang): steps = (ang/360)*steps_per_rev print(steps) steps = int(steps) print(steps) data1 = (steps & 65280) >> 8 data2 = (steps & 255) >> 0 print(data1,data2) send_command([1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],data1,data2,0,0,0,0) def step_without_home(ang): steps = 1+((ang/360)*steps_per_rev) print(steps) steps = int(steps) print(steps) data1 = (steps & 65280) >> 8 data2 = (steps & 255) >> 0 print(data1,data2) send_command([0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],data1,data2,0,0,0,0) def home(): send_command([0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0],0,0,0,0,0,0) def servo_goto(ang): ang = ang + 90 send_command([0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0],0,ang,0,0,0,0)
35
144
0.611079
317
1,715
3.217666
0.214511
0.162745
0.214706
0.25098
0.335294
0.332353
0.332353
0.332353
0.332353
0.332353
0
0.13387
0.202915
1,715
48
145
35.729167
0.61229
0.028571
0
0.25
0
0
0.054087
0
0
0
0
0
0
1
0.125
false
0
0.020833
0
0.166667
0.208333
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5b40cdda39cd66398599ac679f80e1811d7f3475
2,059
py
Python
assignment/if_elif_else/get_next_date.py
arc-arnob/256131
645437d7607f186967e0f84c80e6ca976f266622
[ "Apache-2.0" ]
null
null
null
assignment/if_elif_else/get_next_date.py
arc-arnob/256131
645437d7607f186967e0f84c80e6ca976f266622
[ "Apache-2.0" ]
1
2021-04-17T02:47:03.000Z
2021-04-17T02:47:03.000Z
assignment/if_elif_else/get_next_date.py
arc-arnob/256131
645437d7607f186967e0f84c80e6ca976f266622
[ "Apache-2.0" ]
null
null
null
import sys def check_leap_year(year): if (year % 4) == 0: if (year % 100) == 0: if (year % 400) == 0: return 1 else: return 0 else: return 1 else: return 0 def get_next_date(dd, mm, yy): if check_leap_year(yy): if mm == 2: if dd == 29: dd = 1 mm += 1 else : dd += 1 if mm == 12: mm = 1 yy += 1 print("{0}/{1}/{2}".format(dd,mm,yy)) else: if dd == 31 or dd == 30: dd = 1 mm += 1 else: dd += 1 if mm == 12: mm = 1 yy += 1 print("{0}/{1}/{2}".format(dd,mm,yy)) else: if mm == 2: if dd == 28: dd = 1 mm += 1 else: dd += 1 if mm == 12: mm = 1 yy += 1 print("{0}/{1}/{2}".format(dd,mm,yy)) else: if dd == 31 or dd == 30: dd = 1 mm += 1 else: dd += 1 if mm == 12: mm = 1 yy += 1 print("{0}/{1}/{2}".format(dd,mm,yy)) def validate_input(dd,mm,yy): if check_leap_year(yy): if dd > 29: print("Invalid day") sys.exit(0) else: if dd > 28: print("Invalid Date") sys.exit(0) if mm > 12: print("Invalid date") sys.exit(0) if mm % 2 == 0 and mm > 30: print("Invalid Date") sys.exit(0) if mm % 2 != 0 and mm > 31: print("Invalid Date") sys.exit(0) dd = int(input("Enter date")) mm = int(input("Enter month")) yy = int(input("Enter year")) validate_input(dd,mm,yy) get_next_date(dd,mm,yy)
22.380435
49
0.3322
248
2,059
2.709677
0.153226
0.053571
0.071429
0.035714
0.744048
0.622024
0.544643
0.544643
0.502976
0.428571
0
0.091966
0.540554
2,059
91
50
22.626374
0.618393
0
0
0.730769
0
0
0.065112
0
0
0
0
0
0
1
0.038462
false
0
0.012821
0
0.102564
0.115385
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5b494537057de91abdbb4eae43e795439b9c3fbc
254
py
Python
SunScanWeather/urls.py
dominiceggerman/SunScan
0e72ee7e4435fcff25ebbc392b5a5e03b3b2a730
[ "MIT" ]
null
null
null
SunScanWeather/urls.py
dominiceggerman/SunScan
0e72ee7e4435fcff25ebbc392b5a5e03b3b2a730
[ "MIT" ]
null
null
null
SunScanWeather/urls.py
dominiceggerman/SunScan
0e72ee7e4435fcff25ebbc392b5a5e03b3b2a730
[ "MIT" ]
null
null
null
from django.urls import path, include from . import views urlpatterns = [ path("", views.index, name="index"), path("removecity", views.removeCity, name="removecity"), path("removeallcities", views.removeAllCities, name="removeallcities") ]
28.222222
74
0.712598
27
254
6.703704
0.444444
0
0
0
0
0
0
0
0
0
0
0
0.137795
254
8
75
31.75
0.826484
0
0
0
0
0
0.216535
0
0
0
0
0
0
1
0
false
0
0.285714
0
0.285714
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5b57436a8e4ed48c0229614b152d036c4f4613ff
2,929
py
Python
assignment1/q2_neural.py
bogatyy/cs224d
cfa36b582f681d425ae373baf61a6a1940170c9a
[ "MIT" ]
254
2016-10-11T03:25:04.000Z
2022-03-20T09:13:38.000Z
assignment1/q2_neural.py
bogatyy/cs224d
cfa36b582f681d425ae373baf61a6a1940170c9a
[ "MIT" ]
5
2017-03-27T09:54:17.000Z
2020-06-11T10:40:52.000Z
assignment1/q2_neural.py
bogatyy/cs224d
cfa36b582f681d425ae373baf61a6a1940170c9a
[ "MIT" ]
115
2016-10-11T06:41:09.000Z
2021-10-01T06:16:53.000Z
import numpy as np import random from q1_softmax import softmax from q2_sigmoid import sigmoid, sigmoid_grad from q2_gradcheck import gradcheck_naive def forward_backward_prop(data, labels, params, dimensions): """ Forward and backward propagation for a two-layer sigmoidal network Compute the forward propagation and for the cross entropy cost, and backward propagation for the gradients for all parameters. """ ### Unpack network parameters (do not modify) ofs = 0 Dx, H, Dy = (dimensions[0], dimensions[1], dimensions[2]) W1 = np.reshape(params[ofs:ofs+ Dx * H], (Dx, H)) ofs += Dx * H b1 = np.reshape(params[ofs:ofs + H], (1, H)) ofs += H W2 = np.reshape(params[ofs:ofs + H * Dy], (H, Dy)) ofs += H * Dy b2 = np.reshape(params[ofs:ofs + Dy], (1, Dy)) ### YOUR CODE HERE: forward propagation h_per_item = sigmoid(np.dot(data, W1) + b1) yhat_per_item = softmax(np.dot(h_per_item, W2) + b2) cost = -np.sum(labels * np.log(yhat_per_item)) ### END YOUR CODE ### YOUR CODE HERE: backward propagation grad_softmax_per_item = yhat_per_item - labels grad_b2 = np.sum(grad_softmax_per_item, axis=0, keepdims=True) grad_W2 = np.dot(h_per_item.T, grad_softmax_per_item) grad_sigmoid_per_item = sigmoid_grad(h_per_item) grad_b1_per_item = np.dot(grad_softmax_per_item, W2.T) * grad_sigmoid_per_item grad_b1 = np.sum(grad_b1_per_item, axis=0, keepdims=True) grad_W1 = np.dot(data.T, grad_b1_per_item) ### END YOUR CODE assert grad_b2.shape == b2.shape assert grad_W2.shape == W2.shape assert grad_b1.shape == b1.shape assert grad_W1.shape == W1.shape ### Stack gradients (do not modify) grad = np.concatenate((grad_W1.flatten(), grad_b1.flatten(), grad_W2.flatten(), grad_b2.flatten())) return cost, grad def sanity_check(): """ Set up fake data and parameters for the neural network, and test using gradcheck. """ print "Running sanity check..." N = 20 dimensions = [10, 5, 10] data = np.random.randn(N, dimensions[0]) # each row will be a datum labels = np.zeros((N, dimensions[2])) for i in xrange(N): labels[i,random.randint(0,dimensions[2]-1)] = 1 params = np.random.randn((dimensions[0] + 1) * dimensions[1] + ( dimensions[1] + 1) * dimensions[2], ) gradcheck_naive(lambda params: forward_backward_prop(data, labels, params, dimensions), params) def your_sanity_checks(): """ Use this space add any additional sanity checks by running: python q2_neural.py This function will not be called by the autograder, nor will your additional tests be graded. """ print "Running your sanity checks..." ### YOUR CODE HERE raise NotImplementedError ### END YOUR CODE if __name__ == "__main__": sanity_check() your_sanity_checks()
32.910112
82
0.661659
436
2,929
4.263761
0.275229
0.060247
0.032275
0.038731
0.15815
0.102205
0.078537
0
0
0
0
0.025968
0.224309
2,929
88
83
33.284091
0.792254
0.077842
0
0
0
0
0.027998
0
0
0
0
0.022727
0.08
0
null
null
0
0.1
null
null
0.04
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
2
5b67dff16f4978cd4568cbd1db24a78e7109ac5e
902
py
Python
proteus/tests/unit/test_views.py
jrenato7/PROTEuS-Django
ceb776d3a87af8798adf981b380764c79846c0ff
[ "Apache-2.0" ]
null
null
null
proteus/tests/unit/test_views.py
jrenato7/PROTEuS-Django
ceb776d3a87af8798adf981b380764c79846c0ff
[ "Apache-2.0" ]
2
2020-02-12T00:45:11.000Z
2020-06-05T18:21:49.000Z
proteus/tests/unit/test_views.py
jrenato7/PROTEuS-Django
ceb776d3a87af8798adf981b380764c79846c0ff
[ "Apache-2.0" ]
null
null
null
# coding=utf-8 from django.test import TestCase from django.urls import reverse from django.http import HttpResponseNotAllowed class IndexViewTestCase(TestCase): def setUp(self): self.response = self.client.get(reverse("index")) def test_status_code(self): self.assertEquals(self.response.status_code, 200) def test_template_used(self): self.assertTemplateUsed(self.response, 'index.html') # def test_form(self): class ResultViewTestCase(TestCase): pass class ProcessViewTestCase(TestCase): def test_request_wrong_method(self): response = self.client.post(reverse('process')) self.assertEquals(response.status_code, 405) self.assertIsInstance(response, HttpResponseNotAllowed) def test_right_method(self): response = self.client.get(reverse('process')) self.assertEquals(response.status_code, 200)
25.771429
63
0.726164
104
902
6.173077
0.394231
0.093458
0.074766
0.102804
0.291277
0.238318
0.149533
0
0
0
0
0.013423
0.174058
902
35
64
25.771429
0.848322
0.036585
0
0
0
0
0.033449
0
0
0
0
0
0.25
1
0.25
false
0.05
0.15
0
0.55
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
5b6b1e2137c411be720db97909446f02e399e8f0
2,863
py
Python
admin/admin.py
N-Harish/multilingual_sentiment_analysis_and_visualization
cc0d506efd1859e58be1e1082884eca0714eb085
[ "BSD-3-Clause" ]
1
2021-08-08T03:13:06.000Z
2021-08-08T03:13:06.000Z
admin/admin.py
N-Harish/sentiment_analysis_with_visualization
cc0d506efd1859e58be1e1082884eca0714eb085
[ "BSD-3-Clause" ]
null
null
null
admin/admin.py
N-Harish/sentiment_analysis_with_visualization
cc0d506efd1859e58be1e1082884eca0714eb085
[ "BSD-3-Clause" ]
null
null
null
import pyrebase import re from validate_email import validate_email from werkzeug.security import check_password_hash config = { "apiKey": <your API key>, "authDomain": <your auth domain>, "databaseURL": <your db url>, "projectId": <your project id>, "storageBucket": <your storage bucket>, "messagingSenderId": <your sender id>, "appId": <your app id>, "measurementId": <your measurement id> } def store(value): firebase = pyrebase.initialize_app(config) db = firebase.database() db.child("Details").push({"Details": value}) def store_feedback(value): firebase = pyrebase.initialize_app(config) db = firebase.database() db.child("Feedback").push({"Details": value}) def ret_feedback(): b = [] c = [] firebase = pyrebase.initialize_app(config) db = firebase.database() Details = db.child("Details").get().val() for key, value in Details.items(): b.append(value) for i in b: for x in i.values(): c.append(x) return c def ret(): b = [] c = [] firebase = pyrebase.initialize_app(config) db = firebase.database() Details = db.child("Details").get().val() for key, value in Details.items(): b.append(value) for i in b: for x in i.values(): c.append(x) return c def check(em, pw, c): count = 0 for i in c: if i["email"] == em and i["password"] == pw: count = count + 1 if count >= 1: return True else: return False # a = ret() def email_check(em, c1): c = 0 for i in c1: if i["email"] == em: c = c + 1 if c > 0: return False else: return True # b = ret() # a = unique("dereckjos12@gmail.com", b) def email_valid(text): # s = text # match = re.search(r'\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b', s, re.I) is_valid = validate_email(email_address=text, check_regex=True, check_mx=True, smtp_timeout=10, dns_timeout=10, use_blacklist=True, debug=False) return is_valid def pass_check(t1, t2): if t1 == t2: return True else: return False def ret_pass(email): b = [] c = [] firebase = pyrebase.initialize_app(config) db = firebase.database() Details = db.child("Details").get().val() for key, value in Details.items(): b.append(value) for i in b: for x in i.values(): c.append(x) for i in c: if i["email"]==email: return i["password"] def email_pass(email,pas): passs = ret_pass(email) def check2(em, pw, c): count = 0 for i in c: if i["email"] == em and check_password_hash(i["password"],pw): count = count + 1 if count >= 1: return True else: return False
21.365672
95
0.565491
392
2,863
4.056122
0.255102
0.01761
0.026415
0.091195
0.505031
0.489308
0.489308
0.479874
0.479874
0.479874
0
0.013327
0.292351
2,863
133
96
21.526316
0.771471
0.0489
0
0.581633
0
0
0.065538
0
0
0
0
0
0
0
null
null
0.081633
0.040816
null
null
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
1
0
0
1
0
0
0
0
0
2
5b6cd5023f64491731ef3cac021e9dc1aefc1ad9
259
py
Python
Find Number +ve,-ve,zero.py
Ratheshprabakar/Python-Programs
fca9d4f0b5f5f5693b3d7e25c6d890f4973dc19e
[ "MIT" ]
2
2019-07-10T06:32:05.000Z
2019-11-13T07:52:53.000Z
Find Number +ve,-ve,zero.py
Ratheshprabakar/Python-Programs
fca9d4f0b5f5f5693b3d7e25c6d890f4973dc19e
[ "MIT" ]
null
null
null
Find Number +ve,-ve,zero.py
Ratheshprabakar/Python-Programs
fca9d4f0b5f5f5693b3d7e25c6d890f4973dc19e
[ "MIT" ]
1
2019-10-12T06:56:13.000Z
2019-10-12T06:56:13.000Z
#To find whether the number is +ve,-ve or 0 x=int(input("Enter a number")) def check_num(x): if x>0: print("The",x,"is positive") elif x<0: print("The",x,"is negative") else: print("The",x,"is zero") check_num(x)
23.545455
44
0.548263
45
259
3.111111
0.533333
0.171429
0.192857
0.235714
0.185714
0.185714
0
0
0
0
0
0.016043
0.277992
259
10
45
25.9
0.73262
0.162162
0
0
0
0
0.252427
0
0
0
0
0
0
1
0.111111
false
0
0
0
0.111111
0.333333
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5b75948cb4045c37ba19fd674f1c8316adf94c33
281
py
Python
propensity_matching/config.py
Bhaskers-Blu-Org2/pyspark_propensity_matching
d2f4344dc41132d919e92562f39c2c9bcf1e4288
[ "MIT" ]
6
2019-12-26T18:39:07.000Z
2021-04-20T16:16:21.000Z
propensity_matching/config.py
microsoft/pyspark_propensity_matching
d2f4344dc41132d919e92562f39c2c9bcf1e4288
[ "MIT" ]
null
null
null
propensity_matching/config.py
microsoft/pyspark_propensity_matching
d2f4344dc41132d919e92562f39c2c9bcf1e4288
[ "MIT" ]
7
2019-11-03T14:53:48.000Z
2021-09-13T12:51:43.000Z
"""Constants for propensity_matching library.""" MINIMUM_DF_COUNT = 4000 MINIMUM_POS_COUNT = 1000 UTIL_BOOST_THRESH_1 = MINIMUM_POS_COUNT UTIL_BOOST_THRESH_2 = MINIMUM_DF_COUNT UTIL_BOOST_THRESH_3 = 50000 SAMPLES_PER_FEATURE = 100 SMALL_MATCH_THRESHOLD = 3000**3
20.071429
49
0.790036
41
281
4.878049
0.634146
0.135
0.225
0.2
0
0
0
0
0
0
0
0.10084
0.153025
281
13
50
21.615385
0.739496
0.149466
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
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
2
5b75d9adbd56ad7350aa6ee1d4498688a1b4b652
242
py
Python
workflow/scripts/make_conference_schedule.py
euronion/snakemake-demo
69b3f764249c09c7028c9545ceb2900b6ee56754
[ "MIT" ]
null
null
null
workflow/scripts/make_conference_schedule.py
euronion/snakemake-demo
69b3f764249c09c7028c9545ceb2900b6ee56754
[ "MIT" ]
null
null
null
workflow/scripts/make_conference_schedule.py
euronion/snakemake-demo
69b3f764249c09c7028c9545ceb2900b6ee56754
[ "MIT" ]
null
null
null
import pandas as pd tickets = pd.read_csv(snakemake.input["tickets"]) conferences = pd.read_csv(snakemake.input["conferences"]) schedule = conferences[conferences["City"].isin(tickets["city"])] schedule.to_csv(snakemake.output["schedule"])
30.25
65
0.768595
31
242
5.903226
0.483871
0.196721
0.098361
0.196721
0.251366
0
0
0
0
0
0
0
0.066116
242
8
66
30.25
0.809735
0
0
0
0
0
0.139918
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5b7abef1904b9dc318b62b0507bed4d169716ad1
1,587
py
Python
brawlstats/errors.py
bananaboy21/brawlstats
2c56bb40ba054ee5000bc7a21d1ed1a1779d1ad1
[ "MIT" ]
null
null
null
brawlstats/errors.py
bananaboy21/brawlstats
2c56bb40ba054ee5000bc7a21d1ed1a1779d1ad1
[ "MIT" ]
null
null
null
brawlstats/errors.py
bananaboy21/brawlstats
2c56bb40ba054ee5000bc7a21d1ed1a1779d1ad1
[ "MIT" ]
null
null
null
class RequestError(Exception): """The base class for all errors.""" def __init__(self, code, error, retry_after=None): pass class Unauthorized(RequestError): """Raised if your API Key is invalid or blocked.""" def __init__(self, url, code): self.code = code self.error = 'Your API Key is invalid or blocked.\nURL: ' + url super().__init__(self.code, self.error) class NotFoundError(RequestError): """Raised if an invalid player tag or club tag has been passed.""" def __init__(self, url, code): self.code = code self.error = 'An incorrect tag has been passed.\nURL: ' + url super().__init__(self.code, self.error) class RateLimitError(RequestError): """Raised when the rate limit is reached.""" def __init__(self, url, code, retry_after): self.code = code self.retry_after = retry_after self.error = 'The rate limit has been reached.\nURL: ' + url super().__init__(self.code, self.error, retry_after=self.retry_after) class UnexpectedError(RequestError): """Raised if an unknown error has occured.""" def __init__(self, url, code): self.code = code self.error = 'An unexpected error has occured.\nURL: ' + url super().__init__(self.code, self.error) class ServerError(RequestError): """Raised if the API is down.""" def __init__(self, url, code): self.code = code self.error = 'The API is down. Please be patient and try again later.\nURL: ' + url super().__init__(self.code, self.error)
31.117647
91
0.645243
211
1,587
4.616114
0.270142
0.11499
0.120123
0.071869
0.425051
0.406571
0.406571
0.349076
0.281314
0.164271
0
0
0.235665
1,587
50
92
31.74
0.802968
0.153119
0
0.448276
0
0
0.169078
0
0
0
0
0
0
1
0.206897
false
0.068966
0
0
0.413793
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
5b88360c7f8fc0c85130b58c84ad5979e666c05d
2,412
py
Python
src/testoob/reporting/color_support.py
sshyran/testoob
729fa6a17660d0bd8c75907a89ed6998180b5765
[ "Apache-2.0" ]
null
null
null
src/testoob/reporting/color_support.py
sshyran/testoob
729fa6a17660d0bd8c75907a89ed6998180b5765
[ "Apache-2.0" ]
null
null
null
src/testoob/reporting/color_support.py
sshyran/testoob
729fa6a17660d0bd8c75907a89ed6998180b5765
[ "Apache-2.0" ]
null
null
null
# Testoob, Python Testing Out Of (The) Box # Copyright (C) 2005-2009 The Testoob Team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import sys, os DISABLE_COLOR_SUPPORT_ENV_VAR_NAME = "TESTOOB_DISABLE_COLOR_SUPPORT" def can_autodetect_color_support(): # On Windows, we can only autodetect if ctypes is available if sys.platform.startswith("win"): try: import ctypes return True except ImportError: return False # On POSIX, autodetection is strong enough to consider it always working return True def auto_color_support(stream): if sys.platform.startswith("win"): try: import ctypes return _win_ctypes_color_support() except ImportError: pass # TODO: use win32console if available, and add support to setcolor.exe # as a final fallback # Check if explicitly disabled via environment if DISABLE_COLOR_SUPPORT_ENV_VAR_NAME in os.environ: return False # 'True' by default on Windows, because we can currently only # autodetect if ctypes is available return True return _curses_color_support(stream) def _win_ctypes_color_support(): import ctypes STD_OUTPUT_HANDLE = -11 out_handle = ctypes.windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE) csbi = ctypes.create_string_buffer(22) res = ctypes.windll.kernel32.GetConsoleScreenBufferInfo(out_handle, csbi) return res != 0 def _curses_color_support(stream): if not hasattr(stream, "isatty"): return False if not stream.isatty(): return False # auto color only on TTYs try: import curses curses.setupterm() return curses.tigetnum("colors") > 2 except: # guess false in case of error return False
32.594595
79
0.671227
310
2,412
5.093548
0.470968
0.068398
0.036099
0.020266
0.138062
0.138062
0.059531
0.059531
0.059531
0
0
0.013621
0.269486
2,412
73
80
33.041096
0.88252
0.419983
0
0.461538
0
0
0.036126
0.022291
0
0
0
0.013699
0
1
0.102564
false
0.025641
0.179487
0
0.589744
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
1
0
0
2
5b9fe345789a2a5ba67330f61126fed2eb766621
270
py
Python
tests/units/config/stubs/database.py
LaravelPython/framework
35bb64816731b360e2296dccbbb8523352190d23
[ "MIT" ]
1
2019-10-18T05:31:40.000Z
2019-10-18T05:31:40.000Z
tests/units/config/stubs/database.py
LaravelPython/framework
35bb64816731b360e2296dccbbb8523352190d23
[ "MIT" ]
null
null
null
tests/units/config/stubs/database.py
LaravelPython/framework
35bb64816731b360e2296dccbbb8523352190d23
[ "MIT" ]
null
null
null
database = { 'default': 'mysql', 'connections': { 'mysql': { 'name': 'mytodo', 'username': 'root', 'password': '', 'connection': 'mysql:host=127.0.0.1', }, }, 'migrations': 'migrations', }
19.285714
49
0.411111
19
270
5.842105
0.789474
0
0
0
0
0
0
0
0
0
0
0.035928
0.381481
270
13
50
20.769231
0.628743
0
0
0
0
0
0.4
0
0
0
0
0
0
1
0
false
0.083333
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
5ba6b920112aebe515f725bea8be51da82e74de3
88
py
Python
sanic-user/__init__.py
monobot/sanic-user
33c45cf47c6cbb1743e56df9ea421800a8318daa
[ "MIT" ]
null
null
null
sanic-user/__init__.py
monobot/sanic-user
33c45cf47c6cbb1743e56df9ea421800a8318daa
[ "MIT" ]
null
null
null
sanic-user/__init__.py
monobot/sanic-user
33c45cf47c6cbb1743e56df9ea421800a8318daa
[ "MIT" ]
null
null
null
__author__ = 'Héctor Alvarez' __email__ = 'monobot.soft@gmail.com' __version__ = '0.0.1'
29.333333
36
0.738636
12
88
4.416667
0.916667
0
0
0
0
0
0
0
0
0
0
0.037975
0.102273
88
3
37
29.333333
0.632911
0
0
0
0
0
0.460674
0.247191
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5ba7560f6e15138ca0bad58798bbc2aeae27b265
8,711
py
Python
examples/conv_gru_skip_connection.py
KingMV/ConvGRU
c458024d5c379ef990f72b6f6b738301e1895cff
[ "MIT" ]
18
2018-07-24T16:45:10.000Z
2022-02-11T01:50:34.000Z
examples/conv_gru_skip_connection.py
coderclear/ConvGRU
c458024d5c379ef990f72b6f6b738301e1895cff
[ "MIT" ]
null
null
null
examples/conv_gru_skip_connection.py
coderclear/ConvGRU
c458024d5c379ef990f72b6f6b738301e1895cff
[ "MIT" ]
4
2018-05-26T07:15:22.000Z
2019-07-18T10:03:40.000Z
""" This script demonstrates the use of a convolutional GRU network. This network is used to predict the next frame of an artificially generated movie which contains moving squares. """ import os import h5py from keras.models import Model, Sequential, load_model from keras import backend as K import keras.layers as layers from keras.layers import Input from keras.layers import Bidirectional from keras.layers.convolutional import Conv3D from keras.layers.convolutional_recurrent import ConvGRU2D from keras.layers.normalization import BatchNormalization from keras.utils import plot_model import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt #import pylab as plt def identity_block(input_tensor, kernel_size, filters, stage, block): """The identity block is the block that has no ConvGRU layer at shortcut. # Arguments input_tensor: input tensor kernel_size: default 3, the kernel size of middle conv layer at main path filters: list of integers, the filters of 3 ConvGRU layer at main path stage: integer, current stage label, used for generating layer names block: 'a','b'..., current block label, used for generating layer names # Returns Output tensor for the block. """ filters1, filters2, filters3 = filters if K.image_data_format() == 'channels_last': bn_axis = 3 else: bn_axis = 1 conv_name_base = 'res' + str(stage) + block + '_branch' bn_name_base = 'bn' + str(stage) + block + '_branch' x = ConvGRU2D(filters1, (1, 1), padding='same', return_sequences=True, name=conv_name_base + '2a')(input_tensor) x = BatchNormalization(axis=bn_axis, name=bn_name_base + '2a')(x) #x = Activation('relu')(x) x = ConvGRU2D(filters2, kernel_size, padding='same', return_sequences=True, name=conv_name_base + '2b')(x) x = BatchNormalization(axis=bn_axis, name=bn_name_base + '2b')(x) #x = Activation('relu')(x) x = ConvGRU2D(filters2,(1, 1), padding='same', return_sequences=True, name=conv_name_base + '2c')(x) x = BatchNormalization(axis=bn_axis, name=bn_name_base + '2c')(x) x = layers.add([x, input_tensor]) #x = Activation('relu')(x) return x def conv_block(input_tensor, kernel_size, filters, stage, block, strides=(2, 2)): """A block that has a conv layer at shortcut. # Arguments input_tensor: input tensor kernel_size: default 3, the kernel size of middle conv layer at main path filters: list of integers, the filters of 3 conv layer at main path stage: integer, current stage label, used for generating layer names block: 'a','b'..., current block label, used for generating layer names # Returns Output tensor for the block. Note that from stage 3, the first conv layer at main path is with strides=(2,2) And the shortcut should have strides=(2,2) as well """ filters1, filters2, filters3 = filters if K.image_data_format() == 'channels_last': bn_axis = 3 else: bn_axis = 1 conv_name_base = 'res' + str(stage) + block + '_branch' bn_name_base = 'bn' + str(stage) + block + '_branch' x = ConvGRU2D(filters1, (1, 1), strides=strides, padding='same', return_sequences=True, name=conv_name_base + '2a')(input_tensor) x = BatchNormalization(axis=bn_axis, name=bn_name_base + '2a')(x) #x = Activation('relu')(x) x = ConvGRU2D(filters2, kernel_size, padding='same', return_sequences=True, name=conv_name_base + '2b')(x) x = BatchNormalization(axis=bn_axis, name=bn_name_base + '2b')(x) #x = Activation('relu')(x) x = ConvGRU2D(filters3, (1, 1), padding='same', return_sequences=True, name=conv_name_base + '2c')(x) x = BatchNormalization(axis=bn_axis, name=bn_name_base + '2c')(x) shortcut = ConvGRU2D(filters3, (1, 1), strides=strides, padding='same', return_sequences=True, name=conv_name_base + '1')(input_tensor) shortcut = BatchNormalization(axis=bn_axis, name=bn_name_base + '1')(shortcut) x = layers.add([x, shortcut]) #x = Activation('relu')(x) return x # Generate movies with 3 to 7 moving squares inside. # The squares are of shape 1x1 or 2x2 pixels, # which move linearly over time. # For convenience we first create movies with bigger width and height (80x80) # and at the end we select a 40x40 window. def generate_movies(n_samples=1200, n_frames=15): row = 80 col = 80 noisy_movies = np.zeros((n_samples, n_frames, row, col, 1), dtype=np.float) shifted_movies = np.zeros((n_samples, n_frames, row, col, 1), dtype=np.float) np.random.seed(0) for i in range(n_samples): # Add 3 to 7 moving squares n = np.random.randint(3, 8) for j in range(n): # Initial position xstart = np.random.randint(20, 60) ystart = np.random.randint(20, 60) # Direction of motion directionx = np.random.randint(0, 3) - 1 directiony = np.random.randint(0, 3) - 1 # Size of the square w = np.random.randint(2, 4) for t in range(n_frames): x_shift = xstart + directionx * t y_shift = ystart + directiony * t noisy_movies[i, t, x_shift - w: x_shift + w, y_shift - w: y_shift + w, 0] += 1 # Make it more robust by adding noise. # The idea is that if during inference, # the value of the pixel is not exactly one, # we need to train the network to be robust and still # consider it as a pixel belonging to a square. if np.random.randint(0, 2): noise_f = (-1)**np.random.randint(0, 2) noisy_movies[i, t, x_shift - w - 1: x_shift + w + 1, y_shift - w - 1: y_shift + w + 1, 0] += noise_f * 0.1 # Shift the ground truth by 1 x_shift = xstart + directionx * (t + 1) y_shift = ystart + directiony * (t + 1) shifted_movies[i, t, x_shift - w: x_shift + w, y_shift - w: y_shift + w, 0] += 1 # Cut to a 40x40 window noisy_movies = noisy_movies[::, ::, 20:60, 20:60, ::] shifted_movies = shifted_movies[::, ::, 20:60, 20:60, ::] noisy_movies[noisy_movies >= 1] = 1 shifted_movies[shifted_movies >= 1] = 1 return noisy_movies, shifted_movies # Create a data set noisy_movies, shifted_movies = generate_movies(n_samples=1200) # Load a trained model if exists or train a model otherwise modelPath = os.getcwd() + '/conv_gru_model_skip_connection.h5' if os.path.isfile(modelPath): print "Loading Model located at: " + modelPath model = load_model(modelPath) model.summary() else: # We create a layer which take as input movies of shape # (n_frames, width, height, channels) and returns a movie # of identical shape. inputs = Input(shape=(None, 40, 40, 1)) x = identity_block(inputs, 3, [40, 40, 40], stage=1, block='a') x = identity_block(x, 3, [40, 40, 40], stage=1, block='b') x = Conv3D(filters=1, kernel_size=(3, 3, 3), activation='sigmoid', padding='same', data_format='channels_last')(x) model = Model(inputs, x, name='ConvGRU_skip_connection') model.compile(loss='binary_crossentropy', optimizer='adadelta') # Train the network model.fit(noisy_movies[:1000], shifted_movies[:1000], batch_size=10, epochs=300, validation_split=0.05) #Save the model model.save(modelPath) # Testing the network on one movie # feed it with the first 7 positions and then # predict the new positions which = 1017 track = noisy_movies[which][:7, ::, ::, ::] for j in range(16): new_pos = model.predict(track[np.newaxis, ::, ::, ::, ::]) new = new_pos[::, -1, ::, ::, ::] track = np.concatenate((track, new), axis=0) # And then compare the predictions # to the ground truth track2 = noisy_movies[which][::, ::, ::, ::] for i in range(15): fig = plt.figure(figsize=(10, 5)) ax = fig.add_subplot(121) if i >= 7: ax.text(1, 3, 'Predictions !', fontsize=20, color='w') else: ax.text(1, 3, 'Initial trajectory', fontsize=20) toplot = track[i, ::, ::, 0] plt.imshow(toplot) ax = fig.add_subplot(122) plt.text(1, 3, 'Ground truth', fontsize=20) toplot = track2[i, ::, ::, 0] if i >= 2: toplot = shifted_movies[which][i - 1, ::, ::, 0] plt.imshow(toplot) plt.savefig('%s/%i_animate.png' % (os.getcwd(), (i + 1)))
37.873913
139
0.63173
1,250
8,711
4.2784
0.2256
0.026926
0.020194
0.034031
0.465969
0.409499
0.394166
0.378459
0.353029
0.353029
0
0.036845
0.24911
8,711
229
140
38.039301
0.780767
0.132476
0
0.245902
1
0
0.051117
0.009163
0
0
0
0
0
0
null
null
0
0.114754
null
null
0.008197
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
5ba851427ee34f21ace977a62d19131fba86a196
322
py
Python
src/utils/creds.py
Ritacheta/CryptoTradingBot
5c3292f9a11e4fe81f7f5efba0192b6a18ebe8b3
[ "MIT" ]
2
2021-06-16T06:56:22.000Z
2021-06-17T12:47:55.000Z
src/utils/creds.py
Ritacheta/CryptoTradingBot
5c3292f9a11e4fe81f7f5efba0192b6a18ebe8b3
[ "MIT" ]
null
null
null
src/utils/creds.py
Ritacheta/CryptoTradingBot
5c3292f9a11e4fe81f7f5efba0192b6a18ebe8b3
[ "MIT" ]
null
null
null
import json import os from . import _dirpath def get_credentials() -> dict: """ Get the credentials from Data/credentials.json Returns: dict -> key, secret """ with open(os.path.join(_dirpath, "..", "..", "Data", "credentials.json")) as jsonf: creds = json.load(jsonf) return creds
18.941176
87
0.618012
39
322
5.025641
0.589744
0.153061
0.193878
0
0
0
0
0
0
0
0
0
0.23913
322
16
88
20.125
0.8
0.236025
0
0
0
0
0.108108
0
0
0
0
0
0
1
0.142857
false
0
0.428571
0
0.714286
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
0
0
0
1
0
0
0
0
2
5bc651982d3151997349d1f1940b747f351d2eff
510
py
Python
tfmap.py
markliou/TF_EVO_Opt
1ae3c1a57b540d245fa04d34f925878ddfd232f5
[ "MIT" ]
1
2021-08-24T16:11:17.000Z
2021-08-24T16:11:17.000Z
tfmap.py
markliou/TF_EVO_Opt
1ae3c1a57b540d245fa04d34f925878ddfd232f5
[ "MIT" ]
null
null
null
tfmap.py
markliou/TF_EVO_Opt
1ae3c1a57b540d245fa04d34f925878ddfd232f5
[ "MIT" ]
null
null
null
import tensorflow as tf import numpy as np def sample_nn(): Input = tf.keras.Input([3]) fc1 = tf.keras.layers.Dense(3)(Input) fc2 = tf.keras.layers.Dense(2)(fc1) out = tf.keras.layers.Dense(1)(fc2) return tf.keras.Model(inputs=Input, outputs=out) def assignWeights(nn, wights): pass nn = sample_nn() print(nn(np.random.random([2,3]))) flated_weights = tf.Variable(tf.concat([tf.reshape(weights, [-1]) for weights in nn], axis=-1)) pop['weights'] = print(nn.trainable_weights)
21.25
95
0.676471
82
510
4.158537
0.463415
0.102639
0.11437
0.158358
0
0
0
0
0
0
0
0.027842
0.154902
510
23
96
22.173913
0.763341
0
0
0
0
0
0.013725
0
0
0
0
0
0
0
null
null
0.066667
0.133333
null
null
0.133333
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
1
0
0
1
0
0
0
0
0
2
5bcf60f80103df51d66c3bbb77a4d18ca7d99cd3
375
py
Python
h2o-py/tests/testdir_misc/pyunit_hist.py
kyoren/https-github.com-h2oai-h2o-3
77b27109c84c4739f9f1b7a3078f8992beefc813
[ "Apache-2.0" ]
1
2016-09-30T05:58:18.000Z
2016-09-30T05:58:18.000Z
h2o-py/tests/testdir_misc/pyunit_hist.py
kyoren/https-github.com-h2oai-h2o-3
77b27109c84c4739f9f1b7a3078f8992beefc813
[ "Apache-2.0" ]
null
null
null
h2o-py/tests/testdir_misc/pyunit_hist.py
kyoren/https-github.com-h2oai-h2o-3
77b27109c84c4739f9f1b7a3078f8992beefc813
[ "Apache-2.0" ]
null
null
null
import sys sys.path.insert(1, "../../") import h2o, tests def hist_test(): kwargs = {} kwargs['server'] = True print "Import small prostate dataset" hex = h2o.import_file(tests.locate("smalldata/logreg/prostate.csv")) hex["AGE"].hist(**kwargs) hex["VOL"].hist(**kwargs) if __name__ == "__main__": tests.run_test(sys.argv, hist_test)
19.736842
72
0.626667
49
375
4.55102
0.612245
0.071749
0
0
0
0
0
0
0
0
0
0.009934
0.194667
375
18
73
20.833333
0.728477
0
0
0
0
0
0.224
0.077333
0
0
0
0
0
0
null
null
0
0.333333
null
null
0.083333
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
1
0
0
0
1
0
0
0
0
2
5bcf71d66ca3ff94d6f4bd04fb470429a03dc482
412
py
Python
external/anomaly/ote_anomalib/exportable_code/__init__.py
bes-dev/training_extensions
7b016e3bd02ae7c74d60fd5a0ae0912a42ef87cb
[ "Apache-2.0" ]
775
2019-03-01T02:13:33.000Z
2020-09-07T22:49:15.000Z
external/anomaly/ote_anomalib/exportable_code/__init__.py
bes-dev/training_extensions
7b016e3bd02ae7c74d60fd5a0ae0912a42ef87cb
[ "Apache-2.0" ]
229
2019-02-28T21:37:08.000Z
2020-09-07T15:11:49.000Z
external/anomaly/ote_anomalib/exportable_code/__init__.py
bes-dev/training_extensions
7b016e3bd02ae7c74d60fd5a0ae0912a42ef87cb
[ "Apache-2.0" ]
290
2019-02-28T20:32:11.000Z
2020-09-07T05:51:41.000Z
"""Exportable code for Anomaly tasks.""" # Copyright (C) 2021-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # from .anomaly_classification import AnomalyClassification from .anomaly_detection import AnomalyDetection from .anomaly_segmentation import AnomalySegmentation from .base import AnomalyBase __all__ = ["AnomalyBase", "AnomalyClassification", "AnomalyDetection", "AnomalySegmentation"]
31.692308
93
0.815534
41
412
8.02439
0.682927
0.100304
0
0
0
0
0
0
0
0
0
0.026882
0.097087
412
12
94
34.333333
0.857527
0.274272
0
0
0
0
0.230241
0.072165
0
0
0
0
0
1
0
false
0
0.8
0
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
750f86b184af6304e920d8f7a0a3878a57a60ab3
872
py
Python
annotation/management/commands/annotate_unannotated_variants.py
SACGF/variantgrid
515195e2f03a0da3a3e5f2919d8e0431babfd9c9
[ "RSA-MD" ]
5
2021-01-14T03:34:42.000Z
2022-03-07T15:34:18.000Z
annotation/management/commands/annotate_unannotated_variants.py
SACGF/variantgrid
515195e2f03a0da3a3e5f2919d8e0431babfd9c9
[ "RSA-MD" ]
551
2020-10-19T00:02:38.000Z
2022-03-30T02:18:22.000Z
annotation/management/commands/annotate_unannotated_variants.py
SACGF/variantgrid
515195e2f03a0da3a3e5f2919d8e0431babfd9c9
[ "RSA-MD" ]
null
null
null
#!/usr/bin/env python3 import logging from django.core.management.base import BaseCommand from django.db.utils import DatabaseError from annotation.annotation_versions import get_variant_annotation_version from annotation.tasks.annotation_scheduler_task import annotation_scheduler from snpdb.models.models_genome import GenomeBuild class Command(BaseCommand): def handle(self, *args, **options): logging.info("Checking/Creating VariantAnnotationVersion...") for genome_build in GenomeBuild.builds_with_annotation(): vav = get_variant_annotation_version(genome_build) try: # Some upgrade migrations caused partitions to be deleted vav.create_partition() except DatabaseError: pass logging.info("Scheduling annotation...") annotation_scheduler()
32.296296
75
0.723624
93
872
6.602151
0.623656
0.092834
0.065147
0.087948
0
0
0
0
0
0
0
0.001451
0.209862
872
26
76
33.538462
0.889695
0.088303
0
0
0
0
0.087011
0.034048
0
0
0
0
0
1
0.058824
false
0.058824
0.352941
0
0.470588
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
2
751048a053e0f5f9123e31d97a317aa13be09dcf
406
py
Python
models/registry.py
justincosentino/robust-sparse-networks
2445b1c7e562031ce6ee8787ff1505d574a4e7bd
[ "MIT" ]
12
2019-11-14T07:41:20.000Z
2022-02-02T02:51:16.000Z
models/registry.py
justincosentino/robust-sparse-networks
2445b1c7e562031ce6ee8787ff1505d574a4e7bd
[ "MIT" ]
5
2020-01-28T23:13:33.000Z
2022-02-10T02:00:24.000Z
models/registry.py
justincosentino/robust-sparse-networks
2445b1c7e562031ce6ee8787ff1505d574a4e7bd
[ "MIT" ]
2
2019-12-07T06:18:45.000Z
2020-11-23T16:22:35.000Z
"""Basic registry for model builders.""" BUILDERS = dict() def register(name): """Registers a new model builder function under the given model name.""" def add_to_dict(func): BUILDERS[name] = func return func return add_to_dict def get_builder(model_name): """Fetches the model builder function associated with the given model name""" return BUILDERS[model_name]
21.368421
81
0.692118
55
406
4.981818
0.454545
0.131387
0.145985
0.124088
0
0
0
0
0
0
0
0
0.216749
406
18
82
22.555556
0.861635
0.426108
0
0
0
0
0
0
0
0
0
0
0
1
0.375
false
0
0
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
7510b2c66316d2165caef1e918de647e425f8fe5
428
py
Python
userprofile/utils.py
praekelt/django-userprofile
09e2e08982ffa9fb7e96c715138a0e5537759cd9
[ "BSD-3-Clause" ]
null
null
null
userprofile/utils.py
praekelt/django-userprofile
09e2e08982ffa9fb7e96c715138a0e5537759cd9
[ "BSD-3-Clause" ]
null
null
null
userprofile/utils.py
praekelt/django-userprofile
09e2e08982ffa9fb7e96c715138a0e5537759cd9
[ "BSD-3-Clause" ]
1
2020-05-30T07:13:51.000Z
2020-05-30T07:13:51.000Z
from django.conf import settings from django.db.models.loading import get_model def get_profile_model(): """ Returns configured user profile model or None if not found """ user_profile_module = getattr(settings, 'USER_PROFILE_MODULE', None) if user_profile_module: app_label, model_name = user_profile_module.split('.') return get_model(app_label, model_name) else: return None
28.533333
72
0.714953
58
428
5
0.482759
0.189655
0.234483
0.117241
0
0
0
0
0
0
0
0
0.207944
428
14
73
30.571429
0.855457
0.135514
0
0
0
0
0.056497
0
0
0
0
0
0
1
0.111111
false
0
0.222222
0
0.555556
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
0
0
0
0
0
1
0
0
2
751f8c881006d1c51fcc09c055f6c3e2a5143741
942
py
Python
ai/get_cannabis_data/get_data_ma_draft.py
cannlytics/cannlytics-ai
c9d94e6fe9961129d1e29cd70c11ad6d267f3d48
[ "MIT" ]
2
2021-11-14T00:57:23.000Z
2022-02-05T23:31:05.000Z
ai/get_cannabis_data/get_data_ma_draft.py
cannlytics/cannlytics-ai
c9d94e6fe9961129d1e29cd70c11ad6d267f3d48
[ "MIT" ]
null
null
null
ai/get_cannabis_data/get_data_ma_draft.py
cannlytics/cannlytics-ai
c9d94e6fe9961129d1e29cd70c11ad6d267f3d48
[ "MIT" ]
1
2021-11-14T09:07:00.000Z
2021-11-14T09:07:00.000Z
""" Title | Project Author: Keegan Skeate Contact: <keegan@cannlytics.com> Created: Updated: License: MIT License <https://github.com/cannlytics/cannlytics-ai/blob/main/LICENSE> """ # Initialize a Socrata client. # app_token = os.environ.get('APP_TOKEN', None) # client = Socrata('opendata.mass-cannabis-control.com', app_token) # # Get sales by product type. # products = client.get('xwf2-j7g9', limit=2000) # products_data = pd.DataFrame.from_records(products) # # Get licensees. # licensees = client.get("hmwt-yiqy", limit=2000) # licensees_data = pd.DataFrame.from_records(licensees) # # Get the monthly average price per ounce. # avg_price = client.get("rqtv-uenj", limit=2000) # avg_price_data = pd.DataFrame.from_records(avg_price) # # Get production stats (total employees, total plants, etc.) # production = client.get("j3q7-3usu", limit=2000, order='saledate DESC') # production_data = pd.DataFrame.from_records(production)
31.4
84
0.744161
128
942
5.367188
0.53125
0.052402
0.087336
0.110626
0.151383
0
0
0
0
0
0
0.026347
0.113588
942
30
85
31.4
0.796407
0.950106
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
753751cd37b96f97ab8377718f2f2a0a05035834
120
py
Python
src/randomizer/randomizer/models/enums/enemizer.py
neomatamune/IoGR
4fea85523c1e9a436b66bc78552864616d304aac
[ "Unlicense" ]
12
2019-05-06T12:31:06.000Z
2020-07-21T19:24:44.000Z
src/randomizer/randomizer/models/enums/enemizer.py
neomatamune/IoGR
4fea85523c1e9a436b66bc78552864616d304aac
[ "Unlicense" ]
2
2020-06-11T22:12:15.000Z
2021-10-20T22:53:42.000Z
src/randomizer/randomizer/models/enums/enemizer.py
neomatamune/IoGR
4fea85523c1e9a436b66bc78552864616d304aac
[ "Unlicense" ]
7
2019-08-11T00:06:03.000Z
2021-06-13T04:19:19.000Z
from enum import Enum class Enemizer(Enum): NONE = 0 LIMITED = 1 BALANCED = 2 FULL = 3 INSANE = 4
12
21
0.575
17
120
4.058824
0.882353
0
0
0
0
0
0
0
0
0
0
0.064935
0.358333
120
9
22
13.333333
0.831169
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.142857
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
75388431cbba0d66fc44f19e0b0296fa52e70fc8
459
py
Python
skelm/__init__.py
GrumpySapiens/scikit-elm
799ecbddc3a4feffac52be0f71b441705cd445a1
[ "MIT" ]
13
2019-08-15T11:14:55.000Z
2022-02-17T06:32:16.000Z
skelm/__init__.py
EspinosaLeal/scikit-elm
7fa426476b515826c16fc33ec491e9f2fb0f9d42
[ "MIT" ]
1
2021-09-30T20:05:28.000Z
2021-09-30T20:05:41.000Z
skelm/__init__.py
EspinosaLeal/scikit-elm
7fa426476b515826c16fc33ec491e9f2fb0f9d42
[ "MIT" ]
6
2021-01-29T04:42:51.000Z
2021-12-22T08:16:57.000Z
from .elm import ELMRegressor from .elm import ELMClassifier from .elm_large import LargeELMRegressor from .elm_lanczos import LanczosELM from .hidden_layer import HiddenLayer from .solver_batch import BatchCholeskySolver from .utils import PairwiseRandomProjection from ._version import __version__ __all__ = ['ELMRegressor', 'ELMClassifier', 'HiddenLayer', 'LargeELMRegressor', 'BatchCholeskySolver', 'PairwiseRandomProjection', '__version__']
35.307692
97
0.814815
44
459
8.113636
0.431818
0.078431
0.072829
0
0
0
0
0
0
0
0
0
0.117647
459
12
98
38.25
0.881481
0
0
0
0
0
0.233115
0.052288
0
0
0
0
0
1
0
false
0
0.8
0
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
75513bcf461bcb5f109be15a7e58336b4fba54b6
4,356
py
Python
MudAction.py
fhaynes/slithermud
f14da3d65cdc5187678e8e7cc05e56643a663c56
[ "Artistic-1.0" ]
null
null
null
MudAction.py
fhaynes/slithermud
f14da3d65cdc5187678e8e7cc05e56643a663c56
[ "Artistic-1.0" ]
null
null
null
MudAction.py
fhaynes/slithermud
f14da3d65cdc5187678e8e7cc05e56643a663c56
[ "Artistic-1.0" ]
null
null
null
class MudAction: """ Contains all of the information about attempted physical actions within the world. Whenever a Mob, Item, Character, etc tries to do anything in the game world, an instance is created and sent around to all the other chars, items, room, etc. """ def __init__(self, actionType, playerRef, data1='', \ data2='', data3='', string=''): self.info = {} self.info['actionType'] = actionType self.info['playerRef'] = playerRef self.info['data1'] = data1 self.info['data2'] = data2 self.info['data3'] = data3 self.info['string'] = string def setType(self, type): """Sets the action type to the provided string.""" self.info['actionType'] = type def setData1(self, data): """Sets the Data1 field of the action.""" self.info['data1'] = data def setData2(self, data): """Sets the Data2 field of the action.""" self.info['data2'] = data def setData3(self, data): """Sets the Data3 field of the action.""" self.info['data3'] = data def setString(self, data): """Sets the string field of the action.""" # TODO: Probably not neccessary to call this string. Holdover from # the translated C++ code. self.string = data def getType(self): """Returns the type of action.""" return self.info['actionType'] def getPlayerRef(self): """Returns a reference to the player who generated the action.""" return self.info['playerRef'] def getString(self): """Returns the String value of the action.""" return self.info['string'] def getData1(self): """Returns the data1 field.""" return self.info['data1'] def getData2(self): """Returns the data2 field.""" return self.info['data2'] def getData3(self): """Returns the data3 field.""" return self.info['data3'] class TimedAction(MudAction): def __init__(self, actionType, playerRef, data1='', \ data2='', data3='', string=''): MudAction.__init__(self, actionType, playerRef, data1='', \ data2='', data3='', string='') self.executionTime = None self.actionEvent = None self.valid = True def getExecutionTime(self): """ Returns the time (in miliseconds after start of MUD) that the action should be executed. """ return self.executionTime def setExecutionTime(self, time): """ Sets the time (in milliseconds after the MUD has started) that the action should be executed. """ self.executionTime = time def hook(self): """ This hooks a timed action to all it's references. """ # TODO: Some error checking code in case the instance/hook no longer # exists? Same for unhook... if type(self.getPlayerRef()) == 'instance': self.getPlayerRef().addHook(self) if type(self.getData1()) == 'instance': self.getData1().addHook(self) if type(self.getData2()) == 'instance': self.getData1().addHook(self) if type(self.getData3()) == 'instance': self.getData1().addHook(self) def unhook(self): """ This removes a timed action from all it's references. """ if type(self.getPlayerRef()) == 'instance': self.getPlayerRef().removeHook(self) if type(self.getData1()) == 'instance': self.getData1().removeHook(self) if type(self.getData2()) == 'instance': self.getData1().removeHook(self) if type(self.getData3()) == 'instance': self.getData1().removeHook(self) def setValid(self, value): """ Sets the validity of the action. """ if value == True: self.valid = True elif value == False: self.valid = False else: #TODO: Code to notify that it is an invalid value? return
32.507463
76
0.541322
465
4,356
5.045161
0.275269
0.057971
0.034101
0.035806
0.321398
0.283887
0.228474
0.189258
0.067349
0
0
0.015636
0.339302
4,356
134
77
32.507463
0.799514
0.273186
0
0.289855
0
0
0.057308
0
0
0
0
0.022388
0
1
0.26087
false
0
0
0
0.405797
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
0
0
0
0
2
f3383c7f8d8f6eaf1a71e3a6716683c0fd0e224f
4,611
py
Python
release/stubs.min/System/Linq/Dynamic.py
tranconbv/ironpython-stubs
a601759e6c6819beff8e6b639d18a24b7e351851
[ "MIT" ]
null
null
null
release/stubs.min/System/Linq/Dynamic.py
tranconbv/ironpython-stubs
a601759e6c6819beff8e6b639d18a24b7e351851
[ "MIT" ]
null
null
null
release/stubs.min/System/Linq/Dynamic.py
tranconbv/ironpython-stubs
a601759e6c6819beff8e6b639d18a24b7e351851
[ "MIT" ]
null
null
null
# encoding: utf-8 # module System.Linq.Dynamic calls itself Dynamic # from Wms.RemotingImplementation,Version=1.23.1.0,Culture=neutral,PublicKeyToken=null # by generator 1.145 # no doc # no important # no functions # classes class DynamicClass(object): # no doc def ZZZ(self): """hardcoded/mock instance of the class""" return DynamicClass() instance=ZZZ() """hardcoded/returns an instance of the class""" def ToString(self): """ ToString(self: DynamicClass) -> str """ pass class DynamicExpression(object): # no doc def ZZZ(self): """hardcoded/mock instance of the class""" return DynamicExpression() instance=ZZZ() """hardcoded/returns an instance of the class""" @staticmethod def CreateClass(properties): """ CreateClass(*properties: Array[DynamicProperty]) -> Type CreateClass(properties: IEnumerable[DynamicProperty]) -> Type """ pass @staticmethod def Parse(resultType,expression,values): """ Parse(resultType: Type,expression: str,*values: Array[object]) -> Expression """ pass @staticmethod def ParseLambda(*__args): """ ParseLambda(itType: Type,resultType: Type,expression: str,*values: Array[object]) -> LambdaExpression ParseLambda(parameters: Array[ParameterExpression],resultType: Type,expression: str,*values: Array[object]) -> LambdaExpression ParseLambda[(T,S)](expression: str,*values: Array[object]) -> Expression[Func[T,S]] """ pass __all__=[ 'CreateClass', 'Parse', 'ParseLambda', ] class DynamicProperty(object): """ DynamicProperty(name: str,type: Type) """ def ZZZ(self): """hardcoded/mock instance of the class""" return DynamicProperty() instance=ZZZ() """hardcoded/returns an instance of the class""" @staticmethod def __new__(self,name,type): """ __new__(cls: type,name: str,type: Type) """ pass Name=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get: Name(self: DynamicProperty) -> str """ Type=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get: Type(self: DynamicProperty) -> Type """ class DynamicQueryable(object): # no doc def ZZZ(self): """hardcoded/mock instance of the class""" return DynamicQueryable() instance=ZZZ() """hardcoded/returns an instance of the class""" @staticmethod def Any(source): """ Any(source: IQueryable) -> bool """ pass @staticmethod def Count(source): """ Count(source: IQueryable) -> int """ pass @staticmethod def GroupBy(source,keySelector,elementSelector,values): """ GroupBy(source: IQueryable,keySelector: str,elementSelector: str,*values: Array[object]) -> IQueryable """ pass @staticmethod def OrderBy(source,ordering,values): """ OrderBy[T](source: IQueryable[T],ordering: str,*values: Array[object]) -> IQueryable[T] OrderBy(source: IQueryable,ordering: str,*values: Array[object]) -> IQueryable """ pass @staticmethod def Select(source,selector,values): """ Select(source: IQueryable,selector: str,*values: Array[object]) -> IQueryable """ pass @staticmethod def Skip(source,count): """ Skip(source: IQueryable,count: int) -> IQueryable """ pass @staticmethod def Take(source,count): """ Take(source: IQueryable,count: int) -> IQueryable """ pass @staticmethod def Where(source,predicate,values): """ Where[T](source: IQueryable[T],predicate: str,*values: Array[object]) -> IQueryable[T] Where(source: IQueryable,predicate: str,*values: Array[object]) -> IQueryable """ pass __all__=[ 'Any', 'Count', 'GroupBy', 'OrderBy', 'Select', 'Skip', 'Take', 'Where', ] class ParseException(Exception): """ ParseException(message: str,position: int) """ def ZZZ(self): """hardcoded/mock instance of the class""" return ParseException() instance=ZZZ() """hardcoded/returns an instance of the class""" def ToString(self): """ ToString(self: ParseException) -> str """ pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self,message,position): """ __new__(cls: type,message: str,position: int) """ pass def __str__(self,*args): pass Position=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get: Position(self: ParseException) -> int """ SerializeObjectState=None
28.288344
215
0.675125
516
4,611
5.897287
0.203488
0.064082
0.042721
0.059152
0.493592
0.493592
0.43444
0.41998
0.336839
0.290174
0
0.002621
0.172631
4,611
162
216
28.462963
0.79502
0.448493
0
0.511628
0
0
0.037486
0
0
0
0
0
0
1
0.255814
false
0.197674
0
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
f3480bac7fc16744be3efa670469652f640ddcf8
1,615
py
Python
setup.py
Animenosekai/googlesearch
346bcaf7b344c6cf7c8fdd63d9493648dad9a163
[ "MIT" ]
7
2021-07-01T22:45:36.000Z
2022-02-20T23:59:00.000Z
apis/stackoverflow/googlesearch/setup.py
lannguyen0910/SAB
12c787cf592cb26c2a91829038ad1c2f9bac1f16
[ "MIT" ]
null
null
null
apis/stackoverflow/googlesearch/setup.py
lannguyen0910/SAB
12c787cf592cb26c2a91829038ad1c2f9bac1f16
[ "MIT" ]
1
2022-02-21T12:52:29.000Z
2022-02-21T12:52:29.000Z
from setuptools import setup from os import path with open(path.join(path.abspath(path.dirname(__file__)), 'README.md'), encoding='utf-8') as f: readme_description = f.read() setup( name ="python-googlesearch", packages = ["googlesearch"], version = "1.1.1", license = "MIT License", description = "This module lets you use Google Searching capabilities right from your Python code", author = "Anime no Sekai", author_email = "niichannomail@gmail.com", url = "https://github.com/Animenosekai/googlesearch", download_url = "https://github.com/Animenosekai/googlesearch/archive/v1.1.1.tar.gz", keywords = ['python', 'Anime no Sekai', "animenosekai", "googlesearch"], install_requires = ['beautifulsoup4', 'requests', 'pyuseragents', 'inquirer'], classifiers = ['Development Status :: 5 - Production/Stable', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9'], long_description = readme_description, long_description_content_type = "text/markdown", include_package_data=True, python_requires='>=3.2, <4', entry_points={ 'console_scripts': [ 'googlesearch = googlesearch.__main__:main' ] }, package_data={ 'googlesearch': ['LICENSE'], }, )
50.46875
475
0.668731
182
1,615
5.807692
0.516484
0.161779
0.212867
0.221381
0.128666
0.077578
0
0
0
0
0
0.021805
0.176471
1,615
32
476
50.46875
0.772932
0
0
0
0
0.033333
0.547649
0.030322
0
0
0
0
0
1
0
false
0
0.066667
0
0.066667
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
f35198d7deb40389a7b65e10c1801aaaa490a68d
599
py
Python
dltb/types.py
Petr-By/qtpyvis
0b9a151ee6b9a56b486c2bece9c1f03414629efc
[ "MIT" ]
3
2017-10-04T14:51:26.000Z
2017-10-22T09:35:50.000Z
dltb/types.py
Petr-By/qtpyvis
0b9a151ee6b9a56b486c2bece9c1f03414629efc
[ "MIT" ]
13
2017-09-05T12:56:11.000Z
2017-11-22T10:38:27.000Z
dltb/types.py
krumnack/qtpyvis
0b9a151ee6b9a56b486c2bece9c1f03414629efc
[ "MIT" ]
2
2017-09-24T21:39:42.000Z
2017-10-04T15:29:54.000Z
"""General types an utility functions used in the deep learning toolbox. """ from typing import Union from pathlib import Path Pathlike = Union[str, Path] def as_path(pathlike: Pathlike) -> Path: """Create a `Path` from a `Pathlike` object. If `path` is an object itself, it will be returned, otherwise a new `Path` is constructed. Arguments --------- pathlike: The `Pathlike` object from which the path is to be created. Result ------ path The resulting `Path`. """ return pathlike if isinstance(pathlike, Path) else Path(pathlike)
23.96
72
0.652755
79
599
4.936709
0.544304
0.092308
0
0
0
0
0
0
0
0
0
0
0.24374
599
24
73
24.958333
0.860927
0.57429
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.4
0
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
f35df5e0b3342c8ed69418410afc7eb614c1c75c
982
py
Python
pysnow/utils/requestor.py
patrotom/pysnow
dfe8a535fad4510dbc13f07092c3eb1273b171ef
[ "MIT" ]
null
null
null
pysnow/utils/requestor.py
patrotom/pysnow
dfe8a535fad4510dbc13f07092c3eb1273b171ef
[ "MIT" ]
null
null
null
pysnow/utils/requestor.py
patrotom/pysnow
dfe8a535fad4510dbc13f07092c3eb1273b171ef
[ "MIT" ]
null
null
null
import requests class Requestor: def __init__(self, opts): self.__opts = opts self.__headers = {} self.__authenticate() # TODO: Handle expired token # TODO: Handle HTTP and Connection errors def send(self, data, endpoint, method): url = f"{self.__opts['api_url']}{endpoint}" response = requests.request(method, url, headers=self.__headers, json=data).json() return response def __authenticate(self): data = { "client_id": self.__opts["client_id"], "username": self.__opts["username"], "password": self.__opts["password"], "connection": "Username-Password-Authentication", "grant_type": "password", "scope": "openid" } response = requests.post(self.__opts['auth_url'], json=data).json() self.__headers["Authorization"] = f"Bearer {response['id_token']}"
29.757576
75
0.566191
96
982
5.458333
0.4375
0.10687
0.045802
0
0
0
0
0
0
0
0
0
0.302444
982
32
76
30.6875
0.764964
0.06721
0
0
0
0
0.224535
0.096386
0
0
0
0.03125
0
1
0.136364
false
0.136364
0.045455
0
0.272727
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
1
0
0
0
0
0
2
f37b5807404ee6c1cc0ccc5f26fc18aca285bc88
117
py
Python
google.py
vrishabh22/Some-Python-Programs
ea53aeed3eb5939cdf44f5567c204928d7de1901
[ "MIT" ]
null
null
null
google.py
vrishabh22/Some-Python-Programs
ea53aeed3eb5939cdf44f5567c204928d7de1901
[ "MIT" ]
null
null
null
google.py
vrishabh22/Some-Python-Programs
ea53aeed3eb5939cdf44f5567c204928d7de1901
[ "MIT" ]
null
null
null
import sys,re,webbrowser i=0 while i <= 100: webbrowser.open_new_tab('www.google.com') i=i+1 print (i)
16.714286
46
0.641026
21
117
3.47619
0.761905
0
0
0
0
0
0
0
0
0
0
0.054348
0.213675
117
6
47
19.5
0.73913
0
0
0
0
0
0.126126
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
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
0
0
0
0
0
0
0
0
2
f38e602e7abbdf4a0aa4cc72d5718432c4f65cb7
224
wsgi
Python
flasky.wsgi
BioWar/Flask-Social-Blogging-Web-App
b5f4f88d95dc870e651ac24ecd4f0a737a36380a
[ "MIT" ]
null
null
null
flasky.wsgi
BioWar/Flask-Social-Blogging-Web-App
b5f4f88d95dc870e651ac24ecd4f0a737a36380a
[ "MIT" ]
null
null
null
flasky.wsgi
BioWar/Flask-Social-Blogging-Web-App
b5f4f88d95dc870e651ac24ecd4f0a737a36380a
[ "MIT" ]
null
null
null
activate_this = " /home/admin/Flask-Social-Blogging-Web-App/flask-venv/bin/activate" with open(activate_this) as file_: exec(file_.read(), dict(__file__=activate_this)) from flasky import create_app app = create_app()
28
84
0.767857
34
224
4.735294
0.647059
0.223602
0
0
0
0
0
0
0
0
0
0
0.102679
224
7
85
32
0.800995
0
0
0
0
0.2
0.294643
0.290179
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
f390d536cea1da150d04e3224ebc7b96ff1d900d
8,369
py
Python
pysnmp/ATM-TC-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
11
2021-02-02T16:27:16.000Z
2021-08-31T06:22:49.000Z
pysnmp/ATM-TC-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
75
2021-02-24T17:30:31.000Z
2021-12-08T00:01:18.000Z
pysnmp/ATM-TC-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module ATM-TC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ATM-TC-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:04:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") ObjectIdentity, NotificationType, Integer32, ModuleIdentity, TimeTicks, Gauge32, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, iso, MibIdentifier, IpAddress, Counter32, Unsigned32, mib_2 = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "NotificationType", "Integer32", "ModuleIdentity", "TimeTicks", "Gauge32", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "iso", "MibIdentifier", "IpAddress", "Counter32", "Unsigned32", "mib-2") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") atmTCMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 37, 3)) if mibBuilder.loadTexts: atmTCMIB.setLastUpdated('9810190200Z') if mibBuilder.loadTexts: atmTCMIB.setOrganization('IETF AToMMIB Working Group') class AtmAddr(TextualConvention, OctetString): status = 'current' displayHint = '1x' subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 40) class AtmConnCastType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("p2p", 1), ("p2mpRoot", 2), ("p2mpLeaf", 3)) class AtmConnKind(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5)) namedValues = NamedValues(("pvc", 1), ("svcIncoming", 2), ("svcOutgoing", 3), ("spvcInitiator", 4), ("spvcTarget", 5)) class AtmIlmiNetworkPrefix(TextualConvention, OctetString): reference = 'ATM Forum, Integrated Local Management Interface (ILMI) Specification, Version 4.0, af-ilmi-0065.000, September 1996, Section 9 ATM Forum, ATM User-Network Interface Signalling Specification, Version 4.0 (UNI 4.0), af-sig-0061.000, June 1996, Section 3' status = 'current' subtypeSpec = OctetString.subtypeSpec + ConstraintsUnion(ValueSizeConstraint(8, 8), ValueSizeConstraint(13, 13), ) class AtmInterfaceType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)) namedValues = NamedValues(("other", 1), ("autoConfig", 2), ("ituDss2", 3), ("atmfUni3Dot0", 4), ("atmfUni3Dot1", 5), ("atmfUni4Dot0", 6), ("atmfIispUni3Dot0", 7), ("atmfIispUni3Dot1", 8), ("atmfIispUni4Dot0", 9), ("atmfPnni1Dot0", 10), ("atmfBici2Dot0", 11), ("atmfUniPvcOnly", 12), ("atmfNniPvcOnly", 13)) class AtmServiceCategory(TextualConvention, Integer32): reference = 'ATM Forum Traffic Management Specification, Version 4.0, af-tm-0056.000, June 1996.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6)) namedValues = NamedValues(("other", 1), ("cbr", 2), ("rtVbr", 3), ("nrtVbr", 4), ("abr", 5), ("ubr", 6)) class AtmSigDescrParamIndex(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 2147483647) class AtmTrafficDescrParamIndex(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 2147483647) class AtmVcIdentifier(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 65535) class AtmVpIdentifier(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 4095) class AtmVorXAdminStatus(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("up", 1), ("down", 2)) class AtmVorXLastChange(TextualConvention, TimeTicks): status = 'current' class AtmVorXOperStatus(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("up", 1), ("down", 2), ("unknown", 3)) atmTrafficDescriptorTypes = MibIdentifier((1, 3, 6, 1, 2, 1, 37, 1, 1)) atmObjectIdentities = MibIdentifier((1, 3, 6, 1, 2, 1, 37, 3, 1)) atmNoTrafficDescriptor = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 1)) if mibBuilder.loadTexts: atmNoTrafficDescriptor.setStatus('deprecated') atmNoClpNoScr = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 2)) if mibBuilder.loadTexts: atmNoClpNoScr.setStatus('current') atmClpNoTaggingNoScr = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 3)) if mibBuilder.loadTexts: atmClpNoTaggingNoScr.setStatus('deprecated') atmClpTaggingNoScr = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 4)) if mibBuilder.loadTexts: atmClpTaggingNoScr.setStatus('deprecated') atmNoClpScr = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 5)) if mibBuilder.loadTexts: atmNoClpScr.setStatus('current') atmClpNoTaggingScr = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 6)) if mibBuilder.loadTexts: atmClpNoTaggingScr.setStatus('current') atmClpTaggingScr = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 7)) if mibBuilder.loadTexts: atmClpTaggingScr.setStatus('current') atmClpNoTaggingMcr = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 8)) if mibBuilder.loadTexts: atmClpNoTaggingMcr.setStatus('current') atmClpTransparentNoScr = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 9)) if mibBuilder.loadTexts: atmClpTransparentNoScr.setStatus('current') atmClpTransparentScr = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 10)) if mibBuilder.loadTexts: atmClpTransparentScr.setStatus('current') atmNoClpTaggingNoScr = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 11)) if mibBuilder.loadTexts: atmNoClpTaggingNoScr.setStatus('current') atmNoClpNoScrCdvt = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 12)) if mibBuilder.loadTexts: atmNoClpNoScrCdvt.setStatus('current') atmNoClpScrCdvt = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 13)) if mibBuilder.loadTexts: atmNoClpScrCdvt.setStatus('current') atmClpNoTaggingScrCdvt = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 14)) if mibBuilder.loadTexts: atmClpNoTaggingScrCdvt.setStatus('current') atmClpTaggingScrCdvt = ObjectIdentity((1, 3, 6, 1, 2, 1, 37, 1, 1, 15)) if mibBuilder.loadTexts: atmClpTaggingScrCdvt.setStatus('current') mibBuilder.exportSymbols("ATM-TC-MIB", atmNoTrafficDescriptor=atmNoTrafficDescriptor, PYSNMP_MODULE_ID=atmTCMIB, AtmInterfaceType=AtmInterfaceType, AtmVcIdentifier=AtmVcIdentifier, atmClpTaggingScr=atmClpTaggingScr, AtmVpIdentifier=AtmVpIdentifier, atmObjectIdentities=atmObjectIdentities, atmNoClpNoScrCdvt=atmNoClpNoScrCdvt, AtmIlmiNetworkPrefix=AtmIlmiNetworkPrefix, atmClpNoTaggingMcr=atmClpNoTaggingMcr, AtmServiceCategory=AtmServiceCategory, atmNoClpScrCdvt=atmNoClpScrCdvt, AtmVorXAdminStatus=AtmVorXAdminStatus, AtmVorXLastChange=AtmVorXLastChange, AtmSigDescrParamIndex=AtmSigDescrParamIndex, AtmAddr=AtmAddr, atmNoClpScr=atmNoClpScr, atmTrafficDescriptorTypes=atmTrafficDescriptorTypes, AtmVorXOperStatus=AtmVorXOperStatus, atmClpTaggingScrCdvt=atmClpTaggingScrCdvt, AtmTrafficDescrParamIndex=AtmTrafficDescrParamIndex, AtmConnKind=AtmConnKind, atmClpTaggingNoScr=atmClpTaggingNoScr, AtmConnCastType=AtmConnCastType, atmClpNoTaggingScr=atmClpNoTaggingScr, atmNoClpTaggingNoScr=atmNoClpTaggingNoScr, atmClpNoTaggingScrCdvt=atmClpNoTaggingScrCdvt, atmNoClpNoScr=atmNoClpNoScr, atmClpNoTaggingNoScr=atmClpNoTaggingNoScr, atmTCMIB=atmTCMIB, atmClpTransparentScr=atmClpTransparentScr, atmClpTransparentNoScr=atmClpTransparentNoScr)
76.779817
1,236
0.7664
855
8,369
7.498246
0.237427
0.007799
0.008423
0.011231
0.330838
0.292466
0.286539
0.286539
0.279676
0.249727
0
0.066471
0.102999
8,369
108
1,237
77.490741
0.787532
0.037519
0
0.191011
0
0.022472
0.162192
0.005469
0
0
0
0
0
1
0
false
0
0.067416
0
0.595506
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
f3aa7ff491d297ccc114a1192de680a67a869e7e
774
py
Python
python/array_string/two_sum/solution_test.py
Lumexralph/solving-algorithm-questions
0791c174cdd7bb6804dd33405dd2d9b441e0e166
[ "MIT" ]
null
null
null
python/array_string/two_sum/solution_test.py
Lumexralph/solving-algorithm-questions
0791c174cdd7bb6804dd33405dd2d9b441e0e166
[ "MIT" ]
null
null
null
python/array_string/two_sum/solution_test.py
Lumexralph/solving-algorithm-questions
0791c174cdd7bb6804dd33405dd2d9b441e0e166
[ "MIT" ]
null
null
null
from unittest import TestCase from .solution import Solution class TestTwoSum(TestCase): def test_list_with_element_that_have_sum(self): nums = [0, 2, 4, 6, 7] result = Solution().twoSum(nums, 13) self.assertListEqual(result, [3, 4]) def test_list_with_element_that_have_no_sum(self): nums = [0, 2, 4, 6, 7] result = Solution().twoSum(nums, 20) self.assertListEqual(result, []) def test_with_invalid_input(self): nums = "abcdefgt" result = Solution().twoSum(nums, "ball") self.assertListEqual(result, []) def test_with_list_of_alphanumeric(self): nums = [1, 2, 3, 'b', '='] result = Solution().twoSum(nums, 2) self.assertListEqual(result, [])
28.666667
54
0.614987
96
774
4.75
0.385417
0.061404
0.175439
0.210526
0.464912
0.464912
0.307018
0.175439
0.175439
0.175439
0
0.034722
0.255814
774
26
55
29.769231
0.756944
0
0
0.263158
0
0
0.018111
0
0
0
0
0
0.210526
1
0.210526
false
0
0.105263
0
0.368421
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
f3b2835f8868a54083bc85c2dee977c828288549
306
py
Python
Code/Basic/get_frequency.py
JoelBuenrostro/micropython-for-esp32
d4ba9777ec4459b09089762be9287985d19bbe28
[ "MIT" ]
1
2019-10-12T00:06:05.000Z
2019-10-12T00:06:05.000Z
Code/Basic/get_frequency.py
JoelBuenrostro/micropython-for-esp32
d4ba9777ec4459b09089762be9287985d19bbe28
[ "MIT" ]
null
null
null
Code/Basic/get_frequency.py
JoelBuenrostro/micropython-for-esp32
d4ba9777ec4459b09089762be9287985d19bbe28
[ "MIT" ]
1
2019-09-20T12:54:53.000Z
2019-09-20T12:54:53.000Z
# Chip: ESP32-WROOM-32 (ESP32-D0WDQ6) # Microprocessor: Dual-Core Xtensa® 32-bit LX6 # Clock: 80MHz to 240Mhz # Crystal: 40MHz # SPÍ flash: 4 MB # Operating voltage: 3.0V-3.6V # Operating current: 80mA # Purpose: Get and set CPU frequency to 240MHz import machine machine.freq() machine.freq(240000000)
20.4
46
0.738562
48
306
4.729167
0.8125
0.070485
0
0
0
0
0
0
0
0
0
0.142857
0.153595
306
14
47
21.857143
0.72973
0.75817
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
2
45e826003999e82bebefe73a6d43d833d1591487
774
py
Python
Tutorials/43virtEnv/guide.py
Aaryan-R-S/Python-Tutorials
89e5ec69e529511137263231d735410e92f0a65d
[ "MIT" ]
null
null
null
Tutorials/43virtEnv/guide.py
Aaryan-R-S/Python-Tutorials
89e5ec69e529511137263231d735410e92f0a65d
[ "MIT" ]
null
null
null
Tutorials/43virtEnv/guide.py
Aaryan-R-S/Python-Tutorials
89e5ec69e529511137263231d735410e92f0a65d
[ "MIT" ]
null
null
null
''' -- Make required Folder & open Integrated CMD in it ! In CMD type : [To make exact copy of system base python but no modules included!] -- pip install virtualenv -- virtualenv [nameOfSubFolderInRequiredFolder] // Here I used VirtualEnvironment --OR-- To make exact copy of system base python[with Modules] : -- virtualenv --system-site-packages [nameOfSubFolderInRequiredFolder] // Here I used VirtualEnvironment To activate : -- .\[nameOfSubFolderInRequiredFolder]\Scripts\activate // Here I used VirtualEnvironment To deactivate : -- deactivate To get guide in Virtual Environment : -- pip freeze > requirements.txt To install modules mentioned in requirements.txt : -- pip install -r .\requirements.txt '''
26.689655
106
0.70801
86
774
6.372093
0.511628
0.027372
0.04927
0.14781
0.388686
0.120438
0.120438
0.120438
0
0
0
0
0.206718
774
29
107
26.689655
0.892508
0.963824
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
45f2b38f940353a872ea74751fdd0ea71eabc7b9
449
py
Python
src/setup.py
hvod2000/a9a
6b5cddbac885e2aff56e32936b966f4ce05afbba
[ "MIT" ]
null
null
null
src/setup.py
hvod2000/a9a
6b5cddbac885e2aff56e32936b966f4ce05afbba
[ "MIT" ]
null
null
null
src/setup.py
hvod2000/a9a
6b5cddbac885e2aff56e32936b966f4ce05afbba
[ "MIT" ]
null
null
null
import setuptools with open("../readme.md", "r") as f: long_description = f.read() setuptools.setup( name="a9a", version="0.0.2", author="Uladzislau Khamkou", description="a9a archivator", long_description=long_description, long_description_content_type="text/markdown", packages=setuptools.find_packages(), python_requires=">=3.6", py_modules=["a9a"], package_dir={"": "."}, install_requires=[], )
23.631579
50
0.66147
52
449
5.5
0.711538
0.20979
0.132867
0.20979
0
0
0
0
0
0
0
0.021448
0.169265
449
18
51
24.944444
0.745308
0
0
0
0
0
0.167038
0
0
0
0
0
0
1
0
false
0
0.0625
0
0.0625
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
45f52e63858fe180dbc02a78b9066f700a437e60
157
py
Python
funds/src/playground/tinyDB.py
biztudio/richlab
8378671575150e13b9361a1e208959b8acd93e81
[ "MIT" ]
null
null
null
funds/src/playground/tinyDB.py
biztudio/richlab
8378671575150e13b9361a1e208959b8acd93e81
[ "MIT" ]
4
2017-10-17T11:04:57.000Z
2017-12-26T09:35:01.000Z
funds/src/playground/tinyDB.py
biztudio/richlab
8378671575150e13b9361a1e208959b8acd93e81
[ "MIT" ]
null
null
null
from tinydb import TinyDB, Query db = TinyDB('./fundlist_db.json') fund_table = db.table('fund') idr = Query() print(fund_table.count(idr.code > '000000'))
22.428571
44
0.713376
24
157
4.541667
0.583333
0.165138
0
0
0
0
0
0
0
0
0
0.043165
0.11465
157
7
44
22.428571
0.741007
0
0
0
0
0
0.177215
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
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
0
0
0
0
0
0
0
2
45fba89e0f6b8b9474e6578d79f4f4049cd84f8e
252
py
Python
project/apps/analyses/urls.py
edcarlosneves/api-calibration-ciurve
2922b89252545e1fd250b6a52b169ddee42784eb
[ "MIT" ]
null
null
null
project/apps/analyses/urls.py
edcarlosneves/api-calibration-ciurve
2922b89252545e1fd250b6a52b169ddee42784eb
[ "MIT" ]
null
null
null
project/apps/analyses/urls.py
edcarlosneves/api-calibration-ciurve
2922b89252545e1fd250b6a52b169ddee42784eb
[ "MIT" ]
1
2022-03-13T20:00:51.000Z
2022-03-13T20:00:51.000Z
from django.urls import include, path from rest_framework import routers from . import views router = routers.DefaultRouter() router.register(r"", views.AnalysisViewSet, basename="Analysis") urlpatterns = [path("v1/analysis/", include(router.urls))]
28
64
0.777778
31
252
6.290323
0.612903
0
0
0
0
0
0
0
0
0
0
0.004405
0.099206
252
8
65
31.5
0.854626
0
0
0
0
0
0.079365
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
3439a5f5a5981f3652ad56c4a81044f0f2a9b4e5
2,126
py
Python
tutorials/Jupyter/inputs/parameter.py
Oltanis/undergrad_MC_course
64c24c2598a5581956b9774257ce3dcf851aedaa
[ "CC-BY-4.0" ]
2
2018-09-21T08:39:03.000Z
2020-06-01T06:31:34.000Z
tutorials/Jupyter/inputs/parameter.py
Oltanis/undergrad_MC_course
64c24c2598a5581956b9774257ce3dcf851aedaa
[ "CC-BY-4.0" ]
7
2017-11-30T08:25:40.000Z
2017-11-30T10:13:44.000Z
tutorials/Jupyter/inputs/parameter.py
Oltanis/undergrad_MC_course
64c24c2598a5581956b9774257ce3dcf851aedaa
[ "CC-BY-4.0" ]
2
2018-06-20T12:08:48.000Z
2020-06-01T06:53:19.000Z
"""Utility to store int or float parameters with a label The label is added merely for information: there is no extra functionality associated with it. The module has a factory class Parameter(value, label) which returns either ParameterInt ot ParameterFloat depending on type(value). """ class ParameterInt(int): """Integer parameter with a label""" def __new__(cls, *args): """Arguements: args[0] is the value """ return super(ParameterInt, cls).__new__(cls, args[0]) def __init__(self, value, label): """Arguments value (integer): the value label (string, Label, ...): associated label """ super(ParameterInt, self).__init__() self.label = label def __repr__(self): """Return string including the label""" parameter = "value= {!s}, label= {!r}".format(self, self.label) return "ParameterInt({!s})".format(parameter) class ParameterFloat(float): """Real parameter with label""" def __new__(cls, *args): """Arguments: args[0] is the value """ return super(ParameterFloat, cls).__new__(cls, args[0]) def __init__(self, value, label): """Arguments value (float): the value label (string, Label, ...): a description """ super(ParameterFloat, self).__init__() self.label = label def __repr__(self): """Return a string including the label""" parameter = "value= {!s}, label= {!r}".format(self, self.label) return "ParameterFloat({!s})".format(parameter) class Parameter(object): """A factory to return a Parameter of the correct type""" def __new__(cls, value, label): """Arguments: value (int or float) label (string or Label) """ if isinstance(value, int): return ParameterInt(value, label) elif isinstance(value, float): return ParameterFloat(value, label) else: raise TypeError("A Parameter is either int or float")
22.617021
71
0.591722
237
2,126
5.122363
0.278481
0.065898
0.032949
0.059308
0.370675
0.301483
0.301483
0.258649
0.258649
0.194399
0
0.002646
0.288805
2,126
93
72
22.860215
0.800265
0.364534
0
0.384615
0
0
0.101266
0
0
0
0
0
0
1
0.269231
false
0
0
0
0.615385
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
3442e6d6fa4d024eee78b04cbc420aec1f7bd752
2,235
py
Python
views/__init__.py
CloudCIX/membership
a7a62918c7d7c65dd1bf2068431dbf2ec2573e4b
[ "Apache-2.0" ]
null
null
null
views/__init__.py
CloudCIX/membership
a7a62918c7d7c65dd1bf2068431dbf2ec2573e4b
[ "Apache-2.0" ]
null
null
null
views/__init__.py
CloudCIX/membership
a7a62918c7d7c65dd1bf2068431dbf2ec2573e4b
[ "Apache-2.0" ]
null
null
null
from .address import AddressCollection, AddressResource, VerboseAddressCollection from .address_link import AddressLinkResource from .app_settings import AppSettingsCollection, AppSettingsResource from .auth import AuthResource from .country import CountryCollection, CountryResource from .currency import CurrencyCollection, CurrencyResource from .department import DepartmentCollection, DepartmentResource from .email_confirmation import EmailConfirmationResource from .language import LanguageCollection, LanguageResource from .member import MemberCollection, MemberResource from .member_link import MemberLinkCollection, MemberLinkResource from .notification import NotificationCollection from .subdivision import SubdivisionCollection, SubdivisionResource from .profile import ProfileCollection, ProfileResource from .team import TeamCollection, TeamResource from .territory import TerritoryCollection, TerritoryResource from .transaction_type import TransactionTypeCollection, TransactionTypeResource from .user import UserCollection, UserResource __all__ = [ # Address 'AddressCollection', 'AddressResource', 'VerboseAddressCollection', # AddressLink 'AddressLinkResource', # App Settings 'AppSettingsCollection', 'AppSettingsResource', # Auth 'AuthResource', # Country 'CountryCollection', 'CountryResource', # Currency 'CurrencyCollection', 'CurrencyResource', # Department 'DepartmentCollection', 'DepartmentResource', # EmailConfirmationResource 'EmailConfirmationResource', # Language 'LanguageCollection', 'LanguageResource', # Member 'MemberCollection', 'MemberResource', # MemberLink 'MemberLinkCollection', 'MemberLinkResource', # Notification 'NotificationCollection', # Profile 'ProfileCollection', 'ProfileResource', # Subdivision 'SubdivisionCollection', 'SubdivisionResource', # Team 'TeamCollection', 'TeamResource', # Territory 'TerritoryCollection', 'TerritoryResource', # TransactionType 'TransactionTypeCollection', 'TransactionTypeResource', # User 'UserCollection', 'UserResource', ]
24.56044
81
0.759732
145
2,235
11.648276
0.406897
0.013025
0.066311
0
0
0
0
0
0
0
0
0
0.171812
2,235
90
82
24.833333
0.91248
0.083669
0
0
0
0
0.289798
0.079349
0
0
0
0
0
1
0
false
0
0.339623
0
0.339623
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
3451ace8d9aaacc619452018e4e429db8cb4c0b5
1,571
py
Python
DataHelper.py
dukeNashor/ChessMaster
0b1f7b75a76e5c9129e73e0722af9e5b3b76f033
[ "MIT" ]
null
null
null
DataHelper.py
dukeNashor/ChessMaster
0b1f7b75a76e5c9129e73e0722af9e5b3b76f033
[ "MIT" ]
null
null
null
DataHelper.py
dukeNashor/ChessMaster
0b1f7b75a76e5c9129e73e0722af9e5b3b76f033
[ "MIT" ]
null
null
null
import os import cv2 from skimage import io import numpy as np import glob import h5py # get clean name by a path, where in our case this gets the FEN conviniently def GetCleanNameByPath(file_name): return os.path.splitext(os.path.basename(file_name))[0] # get full paths to the files in a directory. def GetFileNamesInDir(path_name, extension="*", num_return = 0): if num_return == 0: return glob.glob(path_name + "/*." + extension) else: return glob.glob(path_name + "/*." + extension)[:num_return] # get name list def GetCleanNamesInDir(path_name, extension = "*", num_return = 0): names = GetFileNamesInDir(path_name, extension) offset = len(extension) + 1 clean_names = [os.path.basename(x)[:-offset] for x in names] if num_return == 0: return clean_names else: return clean_names[:num_return] # read dataset def ReadImages(file_names, path = "", format = cv2.IMREAD_COLOR): if path == "": return [cv2.imread(f, format) for f in file_names] else: return [cv2.imread(path + "/" + f, format) for f in file_names] # read image by name def ReadImage(file_name, gray = False): return io.imread(file_name, as_gray = gray) # h5py functions # read h5py file # we assume the labels and def ReadH5pyFile(file_name, data_name): h5_buffer = h5py.File(file_name) return h5_buffer[data_name].copy() # write h5py file def WriteH5pyFile(file_name, mat, data_name = "dataset"): with h5py.File(file_name, 'w') as f: f.create_dataset(data_name, data = mat)
28.563636
76
0.684278
232
1,571
4.487069
0.336207
0.061479
0.081652
0.057637
0.191162
0.153698
0.042267
0
0
0
0
0.016026
0.205602
1,571
54
77
29.092593
0.818109
0.150223
0
0.147059
0
0
0.01283
0
0
0
0
0
0
1
0.205882
false
0
0.176471
0.058824
0.647059
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
34566db3eaf80f98bceb62ed7f6449b685c04288
179
py
Python
ex015.py
Roninho514/Treinamento-Python
fc6ad0b64fb3dc3cfa5381f8fc53b5b3243a7ff6
[ "MIT" ]
null
null
null
ex015.py
Roninho514/Treinamento-Python
fc6ad0b64fb3dc3cfa5381f8fc53b5b3243a7ff6
[ "MIT" ]
null
null
null
ex015.py
Roninho514/Treinamento-Python
fc6ad0b64fb3dc3cfa5381f8fc53b5b3243a7ff6
[ "MIT" ]
null
null
null
diasAlugados = int(input('Quantos dias foi alugado:')) km = float(input('Quantos kilometros foram rodados:')) print('Você precisa pagar {}'.format((60.0*diasAlugados)+(0.15*km)))
44.75
68
0.72067
25
179
5.16
0.8
0.186047
0
0
0
0
0
0
0
0
0
0.03681
0.089385
179
3
69
59.666667
0.754601
0
0
0
0
0
0.441341
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
345f91f27be969733a56ac8cb7a928ee5056ca0c
2,083
py
Python
fellowcrm/upgrade/forms.py
Fellow-Consulting-AG/fellowcrm
5cdee0289482b4de4a7d0c47181dfc12d95ac279
[ "MIT" ]
null
null
null
fellowcrm/upgrade/forms.py
Fellow-Consulting-AG/fellowcrm
5cdee0289482b4de4a7d0c47181dfc12d95ac279
[ "MIT" ]
null
null
null
fellowcrm/upgrade/forms.py
Fellow-Consulting-AG/fellowcrm
5cdee0289482b4de4a7d0c47181dfc12d95ac279
[ "MIT" ]
null
null
null
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, SubmitField, BooleanField from wtforms.validators import DataRequired, Length, Email, EqualTo from wtforms_sqlalchemy.fields import QuerySelectField from fellowcrm.settings.models import Currency, TimeZone class NewSystemUser(FlaskForm): first_name = StringField('First Name', validators=[DataRequired(message='Please enter your first name')]) last_name = StringField('Last Name', validators=[DataRequired(message='Please enter your last name'), Length(min=2, max=20)]) email = StringField('Email', validators=[DataRequired( message='Email address is mandatory'), Email(message='Please enter a valid email address e.g. abc@yourcompany.com')]) password = PasswordField('Password', validators=[DataRequired(message='Password is mandatory')]) confirm_password = PasswordField('Confirm Password', validators=[DataRequired( message='Confirm Password is mandatory'), EqualTo('password', 'Passwords do not match')]) submit = SubmitField('Next: Setup Company Details') class CurrencyTz(FlaskForm): currency = QuerySelectField('Default Currency', query_factory=Currency.get_list_query, get_pk=lambda a: a.id, get_label='name', validators=[DataRequired(message='Please select default currency')]) time_zone = QuerySelectField('Your Time Zone', query_factory=TimeZone.get_list_query, get_pk=lambda a: a.id, get_label='name', validators=[DataRequired(message='Please select your timezone')]) submit = SubmitField('Next: Finish Installation') class FinishInstall(FlaskForm): import_sample_data = BooleanField('Install Sample Data') submit = SubmitField('Complete Installation')
52.075
116
0.635142
199
2,083
6.557789
0.386935
0.118008
0.155556
0.101149
0.196169
0.196169
0.196169
0.122605
0.122605
0.122605
0
0.001988
0.275564
2,083
39
117
53.410256
0.862823
0
0
0.129032
0
0
0.21854
0
0
0
0
0
0
1
0
false
0.193548
0.193548
0
0.645161
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
346648ce30caa0980d272f224f4e750b978e02dc
1,352
py
Python
embeddings/utils.py
joni115/neuralFrame
23f249e01c915856919c7e87247b3678f5d1a887
[ "MIT" ]
null
null
null
embeddings/utils.py
joni115/neuralFrame
23f249e01c915856919c7e87247b3678f5d1a887
[ "MIT" ]
null
null
null
embeddings/utils.py
joni115/neuralFrame
23f249e01c915856919c7e87247b3678f5d1a887
[ "MIT" ]
null
null
null
import numpy as np from sklearn.decomposition import TruncatedSVD def compute_pc(X, npc=1): """ Compute the principal components. DO NOT MAKE THE DATA ZERO MEAN! :param X: X[i,:] is a data point :param npc: number of principal components to remove :return: component_[i,:] is the i-th pc """ svd = TruncatedSVD(n_components=npc, n_iter=7, random_state=0) svd.fit(X) return svd.components_ def remove_pc(X, npc=1): """ Remove the projection on the principal components :param X: X[i,:] is a data point for a sentences :param npc: number of principal components to remove :return: XX[i, :] is the data point after removing its projection """ pc = compute_pc(X, npc) if npc==1: XX = X - X.dot(pc.transpose()) * pc else: XX = X - X.dot(pc.transpose()).dot(pc) return XX def save_word_embeddings(embeddings, file_to_dump): """ dump the embeddings into a .txt file. :embeddings: the embeddings has to be an numpy type. """ np.save(file_to_dump, embedding_deco, allow_pickle=False) def load_word_embedding(file_to_load): """ load word embeddings from a txt file. :file_to_load: a path to a file with the embeddings (.npy) return the embeddings with a numpy type """ return np.load(file_to_load, allow_pickle=False)
28.765957
69
0.667899
212
1,352
4.141509
0.353774
0.034169
0.020501
0.029613
0.198178
0.198178
0.157175
0.157175
0.111617
0
0
0.004817
0.232249
1,352
46
70
29.391304
0.84104
0.471154
0
0
0
0
0
0
0
0
0
0
0
1
0.235294
false
0
0.117647
0
0.529412
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
347e39aad25dcb14118b0584e340d89bdf122f3c
553
py
Python
lists_iteration/sum_of_lengths.py
magicalcarpet/the_complete_python_course
0ac0c5015a93607d7d29258ac0a3fc38dda81bd2
[ "MIT" ]
null
null
null
lists_iteration/sum_of_lengths.py
magicalcarpet/the_complete_python_course
0ac0c5015a93607d7d29258ac0a3fc38dda81bd2
[ "MIT" ]
null
null
null
lists_iteration/sum_of_lengths.py
magicalcarpet/the_complete_python_course
0ac0c5015a93607d7d29258ac0a3fc38dda81bd2
[ "MIT" ]
null
null
null
# Define a sum_of_lengths function that accepts a list of strings. # The function should return the sum of the string lengths. # # EXAMPLES # sum_of_lengths(["Hello", "Bob"]) => 8 # sum_of_lengths(["Nonsense"]) => 8 # sum_of_lengths(["Nonsense", "or", "confidence"]) => 20 def sum_of_lengths(array): sum = 0 for element in array: sum += len(element) return sum print(sum_of_lengths(['Hello', 'Bob'])) print(sum_of_lengths(['Nonsense'])) print(sum_of_lengths(['Nonsense', 'or', 'confidence']))
32.529412
66
0.631103
75
553
4.44
0.4
0.135135
0.288288
0.24024
0.468468
0.192192
0
0
0
0
0
0.011547
0.216998
553
17
67
32.529412
0.757506
0.537071
0
0
0
0
0.144578
0
0
0
0
0
0
1
0.125
false
0
0
0
0.25
0.375
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ca9f8527ae0970f084f276d7c7ca8bfc422611a6
790
py
Python
src/school_college/models.py
paceite/Seelife---An-NGO-Website
02e6b5ec94d9a76079eccde54b3cd40b9e979def
[ "MIT" ]
null
null
null
src/school_college/models.py
paceite/Seelife---An-NGO-Website
02e6b5ec94d9a76079eccde54b3cd40b9e979def
[ "MIT" ]
null
null
null
src/school_college/models.py
paceite/Seelife---An-NGO-Website
02e6b5ec94d9a76079eccde54b3cd40b9e979def
[ "MIT" ]
null
null
null
from django.db import models from django.contrib.auth import get_user_model, authenticate, login, logout User = get_user_model() # Create your models here. class Teacher(models.Model): name = models.CharField(max_length=100) email = models.EmailField(max_length=255, unique=True, verbose_name='email address') class Parents(models.Model): name = models.CharField(max_length=100) email = models.EmailField(max_length=255, unique=True, verbose_name='email address') class Student(models.Model): name = models.CharField(max_length=100) school = models.CharField(max_length=100) is_present = models.BooleanField(default=False) teacher = models.ForeignKey(Teacher, on_delete=models.CASCADE) parents = models.ForeignKey(Parents, on_delete=models.CASCADE)
35.909091
88
0.765823
106
790
5.566038
0.396226
0.091525
0.122034
0.162712
0.5
0.454237
0.454237
0.454237
0.383051
0.383051
0
0.026125
0.127848
790
21
89
37.619048
0.830189
0.03038
0
0.333333
0
0
0.034031
0
0
0
0
0
0
1
0
false
0
0.133333
0
0.933333
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
cab5b34af7ca312cb5dcc48e803b2376e7b76a40
379
py
Python
trainer/da/source_only.py
weigq/UDA-1
4f97980980cafd0a2d02a77211ac7dbaf3e331f6
[ "MIT" ]
32
2021-11-08T15:45:30.000Z
2022-03-30T09:08:57.000Z
trainer/da/source_only.py
weigq/UDA-1
4f97980980cafd0a2d02a77211ac7dbaf3e331f6
[ "MIT" ]
3
2021-11-16T02:38:51.000Z
2022-02-21T13:29:58.000Z
trainer/da/source_only.py
weigq/UDA-1
4f97980980cafd0a2d02a77211ac7dbaf3e331f6
[ "MIT" ]
4
2021-11-09T02:53:18.000Z
2021-12-21T22:11:35.000Z
# -------------------------------------------------------- # Copyright (c) 2021 Microsoft # Licensed under The MIT License # -------------------------------------------------------- from trainer.base_trainer import BaseTrainer __all__ = ['SourceOnly'] class SourceOnly(BaseTrainer): def __init__(self, cfg): super(SourceOnly, self).__init__(cfg)
23.6875
59
0.474934
29
379
5.758621
0.758621
0
0
0
0
0
0
0
0
0
0
0.012618
0.163588
379
15
60
25.266667
0.514196
0.456464
0
0
0
0
0.054054
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
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
2
cad833eb69111a4438b70094d39c1838a00c569e
1,526
py
Python
server/apps/user/views.py
taras1k/flask_auth_service
72ee75ecd556fa553aad091063391de495555dce
[ "MIT" ]
null
null
null
server/apps/user/views.py
taras1k/flask_auth_service
72ee75ecd556fa553aad091063391de495555dce
[ "MIT" ]
null
null
null
server/apps/user/views.py
taras1k/flask_auth_service
72ee75ecd556fa553aad091063391de495555dce
[ "MIT" ]
null
null
null
from flask import Blueprint, request, jsonify from flask.ext.login import login_user, login_required from flask.ext.login import logout_user from extensions import login_manager, db from app_exceptions import UserInputError from .models import User user_app = Blueprint('user_app', __name__) @login_manager.user_loader def load_user(userid): return User.query.filter_by(id=userid).first() @user_app.route('/logout') @login_required def logout(): logout_user() return jsonify({'status': True}) @user_app.route('/login', methods=['POST']) def login(): email = request.form.get('email', '') password = request.form.get('pasword', '') user = User.query.filter_by(email=email).first() if user and user.check_password(password): login_user(user) else: raise UserInputError('login error') return jsonify({'status': True}) @user_app.route('/register', methods=['POST']) def reqister(): email = request.form.get('email') password = request.form.get('password') #! TODO add password required and email validation password_confirm = request.form.get('password_confirm') if password != password_confirm: raise UserInputError('password_missmatch', payload={'password': 'mismatch'}) user = User.query.filter_by(email=email).first() if user: raise UserInputError('email_exists ', payload={'email': 'email_exists'}) user = User(email, password) db.session.add(user) db.session.commit() return jsonify({'status': True})
29.346154
84
0.704456
194
1,526
5.386598
0.293814
0.038278
0.066986
0.048804
0.279426
0.235407
0.235407
0.168421
0.168421
0.080383
0
0
0.15924
1,526
51
85
29.921569
0.814497
0.03211
0
0.128205
0
0
0.116531
0
0
0
0
0.019608
0
1
0.102564
false
0.179487
0.153846
0.025641
0.358974
0.051282
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
1
0
0
0
0
0
2
cadf70102c08db368d8af4a7d8830679371cc279
11,754
py
Python
visualize.py
jainabhishek/UNOVOST
a6e804e82e40f8789cde4f5b2a6aa808d02440a7
[ "MIT" ]
42
2020-04-05T19:52:46.000Z
2022-03-22T07:01:01.000Z
visualize.py
jainabhishek/UNOVOST
a6e804e82e40f8789cde4f5b2a6aa808d02440a7
[ "MIT" ]
5
2020-04-25T17:11:31.000Z
2021-08-11T20:53:44.000Z
visualize.py
jainabhishek/UNOVOST
a6e804e82e40f8789cde4f5b2a6aa808d02440a7
[ "MIT" ]
9
2020-04-27T02:57:46.000Z
2021-03-25T21:26:40.000Z
#!/usr/bin/env python3 import numpy as np import os import shutil from PIL import Image import cv2 from scipy.misc import imread pascal_colormap = [ 0, 0, 0, 0.5020, 0, 0, 0, 0.5020, 0, 0.5020, 0.5020, 0, 0, 0, 0.5020, 0.5020, 0, 0.5020, 0, 0.5020, 0.5020, 0.5020, 0.5020, 0.5020, 0.2510, 0, 0, 0.7529, 0, 0, 0.2510, 0.5020, 0, 0.7529, 0.5020, 0, 0.2510, 0, 0.5020, 0.7529, 0, 0.5020, 0.2510, 0.5020, 0.5020, 0.7529, 0.5020, 0.5020, 0, 0.2510, 0, 0.5020, 0.2510, 0, 0, 0.7529, 0, 0.5020, 0.7529, 0, 0, 0.2510, 0.5020, 0.5020, 0.2510, 0.5020, 0, 0.7529, 0.5020, 0.5020, 0.7529, 0.5020, 0.2510, 0.2510, 0, 0.7529, 0.2510, 0, 0.2510, 0.7529, 0, 0.7529, 0.7529, 0, 0.2510, 0.2510, 0.5020, 0.7529, 0.2510, 0.5020, 0.2510, 0.7529, 0.5020, 0.7529, 0.7529, 0.5020, 0, 0, 0.2510, 0.5020, 0, 0.2510, 0, 0.5020, 0.2510, 0.5020, 0.5020, 0.2510, 0, 0, 0.7529, 0.5020, 0, 0.7529, 0, 0.5020, 0.7529, 0.5020, 0.5020, 0.7529, 0.2510, 0, 0.2510, 0.7529, 0, 0.2510, 0.2510, 0.5020, 0.2510, 0.7529, 0.5020, 0.2510, 0.2510, 0, 0.7529, 0.7529, 0, 0.7529, 0.2510, 0.5020, 0.7529, 0.7529, 0.5020, 0.7529, 0, 0.2510, 0.2510, 0.5020, 0.2510, 0.2510, 0, 0.7529, 0.2510, 0.5020, 0.7529, 0.2510, 0, 0.2510, 0.7529, 0.5020, 0.2510, 0.7529, 0, 0.7529, 0.7529, 0.5020, 0.7529, 0.7529, 0.2510, 0.2510, 0.2510, 0.7529, 0.2510, 0.2510, 0.2510, 0.7529, 0.2510, 0.7529, 0.7529, 0.2510, 0.2510, 0.2510, 0.7529, 0.7529, 0.2510, 0.7529, 0.2510, 0.7529, 0.7529, 0.7529, 0.7529, 0.7529, 0.1255, 0, 0, 0.6275, 0, 0, 0.1255, 0.5020, 0, 0.6275, 0.5020, 0, 0.1255, 0, 0.5020, 0.6275, 0, 0.5020, 0.1255, 0.5020, 0.5020, 0.6275, 0.5020, 0.5020, 0.3765, 0, 0, 0.8784, 0, 0, 0.3765, 0.5020, 0, 0.8784, 0.5020, 0, 0.3765, 0, 0.5020, 0.8784, 0, 0.5020, 0.3765, 0.5020, 0.5020, 0.8784, 0.5020, 0.5020, 0.1255, 0.2510, 0, 0.6275, 0.2510, 0, 0.1255, 0.7529, 0, 0.6275, 0.7529, 0, 0.1255, 0.2510, 0.5020, 0.6275, 0.2510, 0.5020, 0.1255, 0.7529, 0.5020, 0.6275, 0.7529, 0.5020, 0.3765, 0.2510, 0, 0.8784, 0.2510, 0, 0.3765, 0.7529, 0, 0.8784, 0.7529, 0, 0.3765, 0.2510, 0.5020, 0.8784, 0.2510, 0.5020, 0.3765, 0.7529, 0.5020, 0.8784, 0.7529, 0.5020, 0.1255, 0, 0.2510, 0.6275, 0, 0.2510, 0.1255, 0.5020, 0.2510, 0.6275, 0.5020, 0.2510, 0.1255, 0, 0.7529, 0.6275, 0, 0.7529, 0.1255, 0.5020, 0.7529, 0.6275, 0.5020, 0.7529, 0.3765, 0, 0.2510, 0.8784, 0, 0.2510, 0.3765, 0.5020, 0.2510, 0.8784, 0.5020, 0.2510, 0.3765, 0, 0.7529, 0.8784, 0, 0.7529, 0.3765, 0.5020, 0.7529, 0.8784, 0.5020, 0.7529, 0.1255, 0.2510, 0.2510, 0.6275, 0.2510, 0.2510, 0.1255, 0.7529, 0.2510, 0.6275, 0.7529, 0.2510, 0.1255, 0.2510, 0.7529, 0.6275, 0.2510, 0.7529, 0.1255, 0.7529, 0.7529, 0.6275, 0.7529, 0.7529, 0.3765, 0.2510, 0.2510, 0.8784, 0.2510, 0.2510, 0.3765, 0.7529, 0.2510, 0.8784, 0.7529, 0.2510, 0.3765, 0.2510, 0.7529, 0.8784, 0.2510, 0.7529, 0.3765, 0.7529, 0.7529, 0.8784, 0.7529, 0.7529, 0, 0.1255, 0, 0.5020, 0.1255, 0, 0, 0.6275, 0, 0.5020, 0.6275, 0, 0, 0.1255, 0.5020, 0.5020, 0.1255, 0.5020, 0, 0.6275, 0.5020, 0.5020, 0.6275, 0.5020, 0.2510, 0.1255, 0, 0.7529, 0.1255, 0, 0.2510, 0.6275, 0, 0.7529, 0.6275, 0, 0.2510, 0.1255, 0.5020, 0.7529, 0.1255, 0.5020, 0.2510, 0.6275, 0.5020, 0.7529, 0.6275, 0.5020, 0, 0.3765, 0, 0.5020, 0.3765, 0, 0, 0.8784, 0, 0.5020, 0.8784, 0, 0, 0.3765, 0.5020, 0.5020, 0.3765, 0.5020, 0, 0.8784, 0.5020, 0.5020, 0.8784, 0.5020, 0.2510, 0.3765, 0, 0.7529, 0.3765, 0, 0.2510, 0.8784, 0, 0.7529, 0.8784, 0, 0.2510, 0.3765, 0.5020, 0.7529, 0.3765, 0.5020, 0.2510, 0.8784, 0.5020, 0.7529, 0.8784, 0.5020, 0, 0.1255, 0.2510, 0.5020, 0.1255, 0.2510, 0, 0.6275, 0.2510, 0.5020, 0.6275, 0.2510, 0, 0.1255, 0.7529, 0.5020, 0.1255, 0.7529, 0, 0.6275, 0.7529, 0.5020, 0.6275, 0.7529, 0.2510, 0.1255, 0.2510, 0.7529, 0.1255, 0.2510, 0.2510, 0.6275, 0.2510, 0.7529, 0.6275, 0.2510, 0.2510, 0.1255, 0.7529, 0.7529, 0.1255, 0.7529, 0.2510, 0.6275, 0.7529, 0.7529, 0.6275, 0.7529, 0, 0.3765, 0.2510, 0.5020, 0.3765, 0.2510, 0, 0.8784, 0.2510, 0.5020, 0.8784, 0.2510, 0, 0.3765, 0.7529, 0.5020, 0.3765, 0.7529, 0, 0.8784, 0.7529, 0.5020, 0.8784, 0.7529, 0.2510, 0.3765, 0.2510, 0.7529, 0.3765, 0.2510, 0.2510, 0.8784, 0.2510, 0.7529, 0.8784, 0.2510, 0.2510, 0.3765, 0.7529, 0.7529, 0.3765, 0.7529, 0.2510, 0.8784, 0.7529, 0.7529, 0.8784, 0.7529, 0.1255, 0.1255, 0, 0.6275, 0.1255, 0, 0.1255, 0.6275, 0, 0.6275, 0.6275, 0, 0.1255, 0.1255, 0.5020, 0.6275, 0.1255, 0.5020, 0.1255, 0.6275, 0.5020, 0.6275, 0.6275, 0.5020, 0.3765, 0.1255, 0, 0.8784, 0.1255, 0, 0.3765, 0.6275, 0, 0.8784, 0.6275, 0, 0.3765, 0.1255, 0.5020, 0.8784, 0.1255, 0.5020, 0.3765, 0.6275, 0.5020, 0.8784, 0.6275, 0.5020, 0.1255, 0.3765, 0, 0.6275, 0.3765, 0, 0.1255, 0.8784, 0, 0.6275, 0.8784, 0, 0.1255, 0.3765, 0.5020, 0.6275, 0.3765, 0.5020, 0.1255, 0.8784, 0.5020, 0.6275, 0.8784, 0.5020, 0.3765, 0.3765, 0, 0.8784, 0.3765, 0, 0.3765, 0.8784, 0, 0.8784, 0.8784, 0, 0.3765, 0.3765, 0.5020, 0.8784, 0.3765, 0.5020, 0.3765, 0.8784, 0.5020, 0.8784, 0.8784, 0.5020, 0.1255, 0.1255, 0.2510, 0.6275, 0.1255, 0.2510, 0.1255, 0.6275, 0.2510, 0.6275, 0.6275, 0.2510, 0.1255, 0.1255, 0.7529, 0.6275, 0.1255, 0.7529, 0.1255, 0.6275, 0.7529, 0.6275, 0.6275, 0.7529, 0.3765, 0.1255, 0.2510, 0.8784, 0.1255, 0.2510, 0.3765, 0.6275, 0.2510, 0.8784, 0.6275, 0.2510, 0.3765, 0.1255, 0.7529, 0.8784, 0.1255, 0.7529, 0.3765, 0.6275, 0.7529, 0.8784, 0.6275, 0.7529, 0.1255, 0.3765, 0.2510, 0.6275, 0.3765, 0.2510, 0.1255, 0.8784, 0.2510, 0.6275, 0.8784, 0.2510, 0.1255, 0.3765, 0.7529, 0.6275, 0.3765, 0.7529, 0.1255, 0.8784, 0.7529, 0.6275, 0.8784, 0.7529, 0.3765, 0.3765, 0.2510, 0.8784, 0.3765, 0.2510, 0.3765, 0.8784, 0.2510, 0.8784, 0.8784, 0.2510, 0.3765, 0.3765, 0.7529, 0.8784, 0.3765, 0.7529, 0.3765, 0.8784, 0.7529, 0.8784, 0.8784, 0.7529] detectron_colormap = [ 0.000, 0.447, 0.741, 0.850, 0.325, 0.098, 0.929, 0.694, 0.125, 0.494, 0.184, 0.556, 0.466, 0.674, 0.188, 0.301, 0.745, 0.933, 0.635, 0.078, 0.184, 0.300, 0.300, 0.300, 0.600, 0.600, 0.600, 1.000, 0.000, 0.000, 1.000, 0.500, 0.000, 0.749, 0.749, 0.000, 0.000, 1.000, 0.000, 0.000, 0.000, 1.000, 0.667, 0.000, 1.000, 0.333, 0.333, 0.000, 0.333, 0.667, 0.000, 0.333, 1.000, 0.000, 0.667, 0.333, 0.000, 0.667, 0.667, 0.000, 0.667, 1.000, 0.000, 1.000, 0.333, 0.000, 1.000, 0.667, 0.000, 1.000, 1.000, 0.000, 0.000, 0.333, 0.500, 0.000, 0.667, 0.500, 0.000, 1.000, 0.500, 0.333, 0.000, 0.500, 0.333, 0.333, 0.500, 0.333, 0.667, 0.500, 0.333, 1.000, 0.500, 0.667, 0.000, 0.500, 0.667, 0.333, 0.500, 0.667, 0.667, 0.500, 0.667, 1.000, 0.500, 1.000, 0.000, 0.500, 1.000, 0.333, 0.500, 1.000, 0.667, 0.500, 1.000, 1.000, 0.500, 0.000, 0.333, 1.000, 0.000, 0.667, 1.000, 0.000, 1.000, 1.000, 0.333, 0.000, 1.000, 0.333, 0.333, 1.000, 0.333, 0.667, 1.000, 0.333, 1.000, 1.000, 0.667, 0.000, 1.000, 0.667, 0.333, 1.000, 0.667, 0.667, 1.000, 0.667, 1.000, 1.000, 1.000, 0.000, 1.000, 1.000, 0.333, 1.000, 1.000, 0.667, 1.000, 0.167, 0.000, 0.000, 0.333, 0.000, 0.000, 0.500, 0.000, 0.000, 0.667, 0.000, 0.000, 0.833, 0.000, 0.000, 1.000, 0.000, 0.000, 0.000, 0.167, 0.000, 0.000, 0.333, 0.000, 0.000, 0.500, 0.000, 0.000, 0.667, 0.000, 0.000, 0.833, 0.000, 0.000, 1.000, 0.000, 0.000, 0.000, 0.167, 0.000, 0.000, 0.333, 0.000, 0.000, 0.500, 0.000, 0.000, 0.667, 0.000, 0.000, 0.833, 0.000, 0.000, 1.000, 0.000, 0.000, 0.000, 0.143, 0.143, 0.143, 0.286, 0.286, 0.286, 0.429, 0.429, 0.429, 0.571, 0.571, 0.571, 0.714, 0.714, 0.714, 0.857, 0.857, 0.857, 1.000, 1.000, 1.000 ] def draw_mask(im, mask, alpha=0.5, color=None): colmap = (np.array(pascal_colormap) * 255).round().astype("uint8").reshape(256, 3) if color is None: color = detectron_colormap[np.random.choice(len(detectron_colormap))][::-1] else: while color >= 255: color = color - 254 color = colmap[color] im = np.where(np.repeat((mask > 0)[:, :, None], 3, axis=2), im * (1 - alpha) + color * alpha, im) im = im.astype('uint8') return im def save_jpg(masks, t, image_dir, viz_dir, mask_ids, name=None): if name is not None: viz_dir = viz_dir % name if not os.path.exists(viz_dir): os.makedirs(viz_dir) img = imread(image_dir) img = img[:, :, :3] for i, (idx, mask) in enumerate(zip(mask_ids, masks)): img = draw_mask(img, mask, color=idx) cv2.imwrite(viz_dir + '/' + str(t + 1).zfill(5) + '.jpg', cv2.cvtColor(img, cv2.COLOR_RGB2BGR)) def save_with_pascal_colormap(img_dir, img): colmap = (np.array(pascal_colormap) * 255).round().astype("uint8") palimage = Image.new('P', (16, 16)) palimage.putpalette(colmap) im = Image.fromarray(np.squeeze(img.astype("uint8"))) im2 = im.quantize(palette=palimage) im2.save(img_dir) def visualize_tracklets(tracklets, all_props, image_size, output_directory, name=None): if name is not None: output_directory = output_directory % name if os.path.exists(output_directory): # os.path.exists(output_directory % name): shutil.rmtree(output_directory) png = np.zeros(image_size, dtype=int) if len(tracklets) > 0: for t, props in enumerate(all_props): if len(props) > 0: props_to_use = tracklets[:, t] props_to_use_ind = np.where(tracklets[:, t] != -1)[0].tolist() for j, i in enumerate(props_to_use_ind): png[props["mask"][props_to_use[i]].astype("bool")] = 2 tracklet_directory = output_directory + 'tracklet_' + str(i) + '/' if not os.path.exists(tracklet_directory): os.makedirs(tracklet_directory) save_with_pascal_colormap(tracklet_directory + str(t + 1).zfill(5) + '.png', png) png = np.zeros(image_size) def visualize_proposals(proposals, image_size, output_directory, name=None): png = np.zeros(image_size, dtype=int) if name is not None: output_directory = output_directory % name for t, props in enumerate(proposals): directory = output_directory + 'time_' + str(t) + '/' if not os.path.exists(directory): os.makedirs(directory) if len(props['seg']) > 0: for i in range(len(props['mask'])): png[props["mask"][i].astype("bool")] = 2 save_with_pascal_colormap(directory + str(i).zfill(5) + '.png', png) png = np.zeros_like(props["mask"][0]) else: save_with_pascal_colormap(directory + str(i).zfill(5) + '.png', png)
27.145497
101
0.531138
2,323
11,754
2.656909
0.065433
0.041478
0.124433
0.037589
0.775762
0.569832
0.5465
0.500162
0.47197
0.36698
0
0.505133
0.270716
11,754
432
102
27.208333
0.214886
0.005275
0
0.046798
0
0
0.006929
0
0
0
0
0
0
1
0.012315
false
0
0.014778
0
0.029557
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
cae29d2f23973e2dcd1d3e930c9773167dd222d4
2,354
py
Python
multimedia_chat/urls.py
faizans-cuelogic/django-multimedia-basic-chat
8a5f19cee5d7a9e9dd52ebeb57483667850bd633
[ "MIT" ]
null
null
null
multimedia_chat/urls.py
faizans-cuelogic/django-multimedia-basic-chat
8a5f19cee5d7a9e9dd52ebeb57483667850bd633
[ "MIT" ]
null
null
null
multimedia_chat/urls.py
faizans-cuelogic/django-multimedia-basic-chat
8a5f19cee5d7a9e9dd52ebeb57483667850bd633
[ "MIT" ]
null
null
null
#/******************************************************************************** #* AUDETEMI INC. ("COMPANY") CONFIDENTIAL #*_______________________________________ #* #* Unpublished Copyright (c) 2015-2017 [AUDETEMI INC]. #* http://www.audetemi.com. #* All Rights Reserved. #* #* NOTICE: All information contained herein is, and remains the property of COMPANY. * The intellectual and #technical concepts contained herein are proprietary to COMPANY * and may be covered by U.S. and Foreign Patents, #patents in process, and are #* protected by trade secret or copyright law. #* Dissemination of this information or reproduction of this material is strictly #* forbidden unless prior written permission is obtained from COMPANY. #* Access to the source code contained herein is hereby forbidden to anyone except #* current COMPANY employees, managers or contractors who have executed #* Confidentiality and Non-disclosure agreements explicitly covering such access. #* #* The copyright notice above does not evidence any actual or intended publication or * disclosure of this source #code, which includes information that is confidential #* and/or proprietary, and is a trade secret, of the COMPANY. #* #* ANY SUB-LICENSING, REPRODUCTION, REVERSE ENGINEERING, DECOMPILATION, MODIFICATION, * DISTRIBUTION, PUBLIC #PERFORMANCE, OR PUBLIC DISPLAY OF OR THROUGH USE OF THIS #* SOURCE CODE WITHOUT THE EXPRESS WRITTEN CONSENT OF COMPANY IS STRICTLY PROHIBITED, #* AND IN VIOLATION OF APPLICABLE LAWS AND INTERNATIONAL TREATIES. THE RECEIPT OR #* POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION DOES NOT CONVEY OR IMPLY * ANY RIGHTS TO REPRODUCE, #DISCLOSE OR DISTRIBUTE ITS CONTENTS, OR TO MANUFACTURE, #* USE, OR SELL ANYTHING THAT IT MAY DESCRIBE, IN WHOLE OR IN PART. #*/ from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns from multimedia_chat import views urlpatterns = [ url(r'^chat/$', views.MessageList.as_view(), name='chat'), # url(r'^chat/feeds/$', views.RetrieveLatestFeed.as_view(), # name='chat_feeds'), # url(r'^update/chat/$', views.MessageActivity.as_view(), # name='update_chat'), # url(r'^message/(?P<id>[0-9]+)/$', views.MessageDetailAPI.as_view(), # name='message_detail'), ] # urlpatterns = format_suffix_patterns(urlpatterns)
52.311111
251
0.730246
302
2,354
5.519868
0.523179
0.017996
0.023995
0.028794
0
0
0
0
0
0
0
0.00498
0.146984
2,354
44
252
53.5
0.825199
0.86576
0
0
0
0
0.039427
0
0
0
0
0
0
1
0
false
0
0.428571
0
0.428571
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
caebb177a6d5c87f8b09e0507f76b02ac300af12
185
py
Python
init/CreateParam.py
Berni1557/MDDoc
06dd3cae302e6f125ebfbb2fc513bb754d72f07d
[ "BSD-3-Clause" ]
null
null
null
init/CreateParam.py
Berni1557/MDDoc
06dd3cae302e6f125ebfbb2fc513bb754d72f07d
[ "BSD-3-Clause" ]
null
null
null
init/CreateParam.py
Berni1557/MDDoc
06dd3cae302e6f125ebfbb2fc513bb754d72f07d
[ "BSD-3-Clause" ]
null
null
null
# Import Param import Param xmlpath = 'H:/cloud/cloud_data/Projects/MDDoc/init/init.xml' Param.param.init(xmlpath) Param.param.create() Param.param.write() Param.param.printParams()
16.818182
60
0.767568
27
185
5.222222
0.481481
0.283688
0
0
0
0
0
0
0
0
0
0
0.081081
185
10
61
18.5
0.829412
0.064865
0
0
0
0
0.284024
0.284024
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0.166667
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
caf3a8ed680d12e8ae901e5d8e093a8011145f69
726
py
Python
VBYO-2017/kodlar/YuksekBasarimliHesaplama/Theano/multi_16.py
metinuslu/VeriBilimiYazOkullari
474c4481a779532fb667874a44bcb03f8852e8e0
[ "MIT" ]
3
2020-02-17T19:17:56.000Z
2021-09-03T10:38:32.000Z
VBYO-2017/kodlar/YuksekBasarimliHesaplama/Theano/multi_16.py
gokhangemici/VeriBilimiYazOkullari
474c4481a779532fb667874a44bcb03f8852e8e0
[ "MIT" ]
null
null
null
VBYO-2017/kodlar/YuksekBasarimliHesaplama/Theano/multi_16.py
gokhangemici/VeriBilimiYazOkullari
474c4481a779532fb667874a44bcb03f8852e8e0
[ "MIT" ]
3
2019-12-07T01:11:03.000Z
2021-09-03T10:38:35.000Z
#export THEANO_FLAGS="contexts=dev0->cuda0;dev1->cuda1"; python multi_16.py import numpy import theano import time N = 16 * 1024; v01 = theano.shared(numpy.random.random((N, N)).astype('float32'), target='dev0') v02 = theano.shared(numpy.random.random((N, N)).astype('float32'), target='dev0') v11 = theano.shared(numpy.random.random((N, N)).astype('float32'), target='dev1') v12 = theano.shared(numpy.random.random((N, N)).astype('float32'), target='dev1') f = theano.function([], [theano.tensor.dot(v01, v02), theano.tensor.dot(v11, v12)]) t = time.time() f(); print "completed in %f seconds" %(time.time() - t)
30.25
76
0.589532
94
726
4.531915
0.37234
0.112676
0.159624
0.215962
0.507042
0.507042
0.507042
0.507042
0.507042
0.507042
0
0.071429
0.22865
726
23
77
31.565217
0.689286
0.101928
0
0.235294
0
0
0.103077
0
0
0
0
0
0
0
null
null
0
0.176471
null
null
0.058824
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
caff2b9bad013d3fb4a40ad33053fa02101f777c
1,450
py
Python
tests/AllTests.py
Mohammed-El-Nabulsi/single-electron-transistor
db1abd3627312403be83197c27d06ac4e3a61746
[ "BSD-2-Clause" ]
null
null
null
tests/AllTests.py
Mohammed-El-Nabulsi/single-electron-transistor
db1abd3627312403be83197c27d06ac4e3a61746
[ "BSD-2-Clause" ]
null
null
null
tests/AllTests.py
Mohammed-El-Nabulsi/single-electron-transistor
db1abd3627312403be83197c27d06ac4e3a61746
[ "BSD-2-Clause" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import HaPPPy import unittest from tests.HaPPPyTest import HappyBasicTestSuite from tests.OneBodyTest import OneBodyTestSuite from tests.TwoBodyTest import TwoBodyTestSuite from tests.TransmissionTest import TransmissionTestSuite from tests.RatesTest import RatesTestSuite from tests.MasterEquationTest import MasterEquationTestSuite from tests.ParameterHandlerTest import ParameterHandlerTestSuite if __name__ == '__main__': happy_suite = unittest.TestLoader().loadTestsFromTestCase(HappyBasicTestSuite) one_body_suite = unittest.TestLoader().loadTestsFromTestCase(OneBodyTestSuite) two_body_suite = unittest.TestLoader().loadTestsFromTestCase(TwoBodyTestSuite) transmission_suite = unittest.TestLoader().loadTestsFromTestCase(TransmissionTestSuite) rates_suite = unittest.TestLoader().loadTestsFromTestCase(RatesTestSuite) master_equation_suite = unittest.TestLoader().loadTestsFromTestCase(MasterEquationTestSuite) # unittest.TextTestRunner(verbosity=2, buffer=True).run(happy_suite) unittest.TextTestRunner(verbosity=2, buffer=True).run(one_body_suite) unittest.TextTestRunner(verbosity=2, buffer=True).run(two_body_suite) unittest.TextTestRunner(verbosity=2, buffer=True).run(transmission_suite) unittest.TextTestRunner(verbosity=2, buffer=True).run(rates_suite) unittest.TextTestRunner(verbosity=2, buffer=True).run(master_equation_suite)
53.703704
96
0.824138
145
1,450
8.062069
0.317241
0.122327
0.11805
0.225834
0.341317
0.259196
0.259196
0.220701
0.092387
0
0
0.00607
0.091034
1,450
26
97
55.769231
0.88088
0.075862
0
0
0
0
0.005984
0
0
0
0
0
0
1
0
false
0
0.428571
0
0.428571
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
1b0313842cc2c2d12ce0412511b39fe3cee2452b
1,147
py
Python
rx/core/operators/materialize.py
mmpio/RxPY
4ed60bb5c04aa85de5210e5537a6adfe1b667d50
[ "MIT" ]
4,342
2015-01-06T09:00:23.000Z
2022-03-28T15:05:50.000Z
rx/core/operators/materialize.py
mmpio/RxPY
4ed60bb5c04aa85de5210e5537a6adfe1b667d50
[ "MIT" ]
613
2015-01-07T20:44:56.000Z
2022-03-20T06:14:20.000Z
rx/core/operators/materialize.py
mmpio/RxPY
4ed60bb5c04aa85de5210e5537a6adfe1b667d50
[ "MIT" ]
420
2015-01-07T14:30:30.000Z
2022-03-11T22:47:46.000Z
from typing import Callable from rx.core import Observable from rx.core.notification import OnNext, OnError, OnCompleted def _materialize() -> Callable[[Observable], Observable]: def materialize(source: Observable) -> Observable: """Partially applied materialize operator. Materializes the implicit notifications of an observable sequence as explicit notification values. Args: source: Source observable to materialize. Returns: An observable sequence containing the materialized notification values from the source sequence. """ def subscribe(observer, scheduler=None): def on_next(value): observer.on_next(OnNext(value)) def on_error(exception): observer.on_next(OnError(exception)) observer.on_completed() def on_completed(): observer.on_next(OnCompleted()) observer.on_completed() return source.subscribe_(on_next, on_error, on_completed, scheduler) return Observable(subscribe) return materialize
31.861111
80
0.646905
113
1,147
6.451327
0.380531
0.041152
0.057613
0
0
0
0
0
0
0
0
0
0.285963
1,147
35
81
32.771429
0.89011
0.267655
0
0.117647
0
0
0
0
0
0
0
0
0
1
0.352941
false
0
0.176471
0
0.705882
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
1b06a4290f76358ccdc23172913bf940363abed4
2,690
py
Python
caso/loading.py
alexcos78/caso
364d669115419a19af88292d700d3ca7a6f55ee9
[ "Apache-2.0" ]
4
2018-04-27T10:32:07.000Z
2021-11-25T02:52:31.000Z
caso/loading.py
alexcos78/caso
364d669115419a19af88292d700d3ca7a6f55ee9
[ "Apache-2.0" ]
69
2015-01-15T11:16:50.000Z
2021-11-15T15:33:22.000Z
caso/loading.py
enolfc/caso
d1bd16b496d441d5eccfbb7780978135d416c21e
[ "Apache-2.0" ]
22
2015-01-20T00:01:52.000Z
2022-03-31T11:13:20.000Z
# -*- coding: utf-8 -*- # Copyright 2019 Spanish National Research Council (CSIC) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import stevedore from caso import exception EXTRACTOR_NAMESPACE = "caso.extractors" MESSENGER_NAMESPACE = "caso.messenger" def _get_names(what): mgr = stevedore.ExtensionManager(namespace=what) return frozenset(mgr.names()) def _get(what): mgr = stevedore.ExtensionManager(namespace=what, propagate_map_exceptions=True) return dict(mgr.map(lambda ext: (ext.entry_point.name, ext.plugin))) def get_available_extractor_names(): """Get the names of all the extractors that are available on the system. :returns: A list of names. :rtype: frozenset """ return _get_names(EXTRACTOR_NAMESPACE) def get_available_extractors(): """Retrieve all the extractors available on the system. :returns: A dict with the entrypoint name as the key and the extractor as the value. :rtype: dict """ return _get(EXTRACTOR_NAMESPACE) def get_available_messenger_names(): """Get the names of all the messengers that are available on the system. :returns: A list of names. :rtype: frozenset """ return _get_names(MESSENGER_NAMESPACE) def get_available_messengers(): """Retrieve all the messengers available on the system. :returns: A dict with the entrypoint name as the key and the messenger as the value. :rtype: dict """ return _get(MESSENGER_NAMESPACE) def get_enabled_messengers(names): """Retrieve all the enabled messengers on the system. :returns: An extension manager. """ def cb(names): raise exception.MessengerNotFound(names=",".join(list(names))) mgr = stevedore.NamedExtensionManager(namespace=MESSENGER_NAMESPACE, names=names, name_order=True, on_missing_entrypoints_callback=cb, invoke_on_load=True, propagate_map_exceptions=True) return mgr
29.56044
77
0.66171
328
2,690
5.307927
0.378049
0.024124
0.031591
0.051694
0.348076
0.273406
0.221712
0.161976
0.161976
0.161976
0
0.004541
0.263197
2,690
90
78
29.888889
0.873865
0.461338
0
0.068966
0
0
0.022371
0
0
0
0
0
0
1
0.275862
false
0
0.068966
0
0.586207
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2