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
ad2bb9635b374860754e1f42983d7553823320ae
287
py
Python
src/data/vcf_config.py
kforti/variant_calling
5b6899115b1c5b1f958d8d8f33b484ccd0a8a787
[ "MIT" ]
null
null
null
src/data/vcf_config.py
kforti/variant_calling
5b6899115b1c5b1f958d8d8f33b484ccd0a8a787
[ "MIT" ]
null
null
null
src/data/vcf_config.py
kforti/variant_calling
5b6899115b1c5b1f958d8d8f33b484ccd0a8a787
[ "MIT" ]
null
null
null
VCF_CONFIG = { "load_modules": ["samtools/1.4.1", "bcftools/1.4.1"], "ref_genome": "/external/malaria_SciRep2018/ref_genomes/Plasmodium_falciparum_3D7.fasta", "data_directory": "/external/malaria_SciRep2018/R7.3_fastq", "save_directory": "/processed/variant_call_v1/", }
41
93
0.724739
37
287
5.27027
0.756757
0.020513
0.030769
0
0
0
0
0
0
0
0
0.073643
0.101045
287
7
94
41
0.682171
0
0
0
0
0
0.75
0.479167
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
ad2bba74ec79e5531cf431a6f21d8d2e0e5393c1
59
py
Python
namedtensor/text/__init__.py
larslorch/namedtensor
8689fdfb8190fe0f31f05a982778c21a85c713b1
[ "MIT" ]
410
2019-01-03T19:52:26.000Z
2022-03-05T17:40:42.000Z
namedtensor/text/__init__.py
larslorch/namedtensor
8689fdfb8190fe0f31f05a982778c21a85c713b1
[ "MIT" ]
59
2019-01-04T21:55:17.000Z
2019-07-10T09:43:30.000Z
namedtensor/text/__init__.py
larslorch/namedtensor
8689fdfb8190fe0f31f05a982778c21a85c713b1
[ "MIT" ]
42
2019-01-03T20:21:05.000Z
2021-03-04T03:41:59.000Z
from .torch_text import NamedField __all__ = [NamedField]
14.75
34
0.79661
7
59
6
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.135593
59
3
35
19.666667
0.823529
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ad3a425e44df0c7f954ac5bbcd886b9854d1821f
55
py
Python
models/settings.py
ankandrew/pytorch-cifar
6ff4ff2a7f41ec68bf597578df83bb77ff41c6db
[ "MIT" ]
null
null
null
models/settings.py
ankandrew/pytorch-cifar
6ff4ff2a7f41ec68bf597578df83bb77ff41c6db
[ "MIT" ]
null
null
null
models/settings.py
ankandrew/pytorch-cifar
6ff4ff2a7f41ec68bf597578df83bb77ff41c6db
[ "MIT" ]
null
null
null
class CFG: NUM_CLASSES = 10 INPUT_CHANNELS = 3
13.75
22
0.654545
8
55
4.25
1
0
0
0
0
0
0
0
0
0
0
0.076923
0.290909
55
3
23
18.333333
0.794872
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
ad3b080b55506d15b0beaa397f5efb3b0a42c8a3
16
py
Python
WSServer/games/Management/config.py
pufit/online-games
e2477974e10b6e48142ebec10589bdb0e30258f4
[ "MIT" ]
null
null
null
WSServer/games/Management/config.py
pufit/online-games
e2477974e10b6e48142ebec10589bdb0e30258f4
[ "MIT" ]
null
null
null
WSServer/games/Management/config.py
pufit/online-games
e2477974e10b6e48142ebec10589bdb0e30258f4
[ "MIT" ]
null
null
null
MAX_PLAYERS = 5
8
15
0.75
3
16
3.666667
1
0
0
0
0
0
0
0
0
0
0
0.076923
0.1875
16
1
16
16
0.769231
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
ad463fbb6aaf6c1c84265618418591649fe02938
151
py
Python
azblr-crawler/config-sample.py
truper12/azeriteblender
e69c9823d97fbffcbc92b8456b69ecc75fb0ec53
[ "MIT" ]
null
null
null
azblr-crawler/config-sample.py
truper12/azeriteblender
e69c9823d97fbffcbc92b8456b69ecc75fb0ec53
[ "MIT" ]
null
null
null
azblr-crawler/config-sample.py
truper12/azeriteblender
e69c9823d97fbffcbc92b8456b69ecc75fb0ec53
[ "MIT" ]
null
null
null
class Config: DATABASE_USER = '' DATABASE_PASSWORD = '' DATABASE_DB = '' DATABASE_HOST = '' DATABASE_PORT = 3306 LOG_FILE = ''
18.875
26
0.596026
15
151
5.6
0.733333
0
0
0
0
0
0
0
0
0
0
0.037383
0.291391
151
8
27
18.875
0.747664
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.142857
0
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
ad4bd28580e78d1053717ad86fe86d3beeb9eb8a
196
py
Python
tests/test_utils.py
hustzxd/MobulaOP
49e4062f6578b31918ddcc613e38e0fbb92bb015
[ "MIT" ]
null
null
null
tests/test_utils.py
hustzxd/MobulaOP
49e4062f6578b31918ddcc613e38e0fbb92bb015
[ "MIT" ]
null
null
null
tests/test_utils.py
hustzxd/MobulaOP
49e4062f6578b31918ddcc613e38e0fbb92bb015
[ "MIT" ]
null
null
null
from mobula.utils import get_git_hash def test_get_git_hash(): git_hash = get_git_hash() assert type(git_hash) == str, (git_hash, type(git_hash)) assert len(git_hash) == 7, git_hash
24.5
60
0.714286
34
196
3.735294
0.411765
0.496063
0.23622
0
0
0
0
0
0
0
0
0.006173
0.173469
196
7
61
28
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.4
1
0.2
false
0
0.2
0
0.4
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
ad543d265d5d38581daed1df68d4673588e526bb
50
py
Python
test/integration/ConstructorStart/public no parameters base one parameter.py
HighSchoolHacking/GLS-Draft
9e418b6290e7c8e3f2da87668784bdba1cde5a76
[ "MIT" ]
30
2019-10-29T12:47:50.000Z
2022-02-12T06:41:39.000Z
test/integration/ConstructorStart/public no parameters base one parameter.py
HighSchoolHacking/GLS-Draft
9e418b6290e7c8e3f2da87668784bdba1cde5a76
[ "MIT" ]
247
2017-09-21T17:11:18.000Z
2019-10-08T12:59:07.000Z
test/integration/ConstructorStart/public no parameters base one parameter.py
HighSchoolHacking/GLS-Draft
9e418b6290e7c8e3f2da87668784bdba1cde5a76
[ "MIT" ]
17
2017-10-01T16:53:20.000Z
2018-11-28T07:20:35.000Z
# def __init__(self): super().__init__(abc) #
10
25
0.62
6
50
3.833333
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.18
50
4
26
12.5
0.560976
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
ad54add38075687b9b949f4edb6d5c32b439eadf
18,646
py
Python
cross_edge_offloading/parameter.py
cnetboy/Cross-edge-Computation-Offloading
64b7d9fe6b94e6e6f5fe934d97304549d21868b9
[ "MIT" ]
43
2019-05-17T01:08:23.000Z
2022-03-29T02:41:32.000Z
cross_edge_offloading/parameter.py
AlerfaRomeoo/Cross-edge-Computation-Offloading
64b7d9fe6b94e6e6f5fe934d97304549d21868b9
[ "MIT" ]
null
null
null
cross_edge_offloading/parameter.py
AlerfaRomeoo/Cross-edge-Computation-Offloading
64b7d9fe6b94e6e6f5fe934d97304549d21868b9
[ "MIT" ]
14
2019-09-11T09:58:21.000Z
2022-03-23T07:06:50.000Z
""" This module contains the class Parameter, which includes all parameters used for the computation offloading problem at the edge. Author: Hailiang Zhao, Cheng Zhang """ import pandas as pd import numpy as np from cross_edge_offloading.utils.tool_function import ToolFunction import random class Parameter(object): """ This class contains all parameters used in computation offloading problem at the edge. """ def __init__(self, time_slot_length=2e-3, time_horizon=50, ddl=2e-3, drop_penalty=2e-3, coordinate_cost=2e-5, task_request_prob=0.7, unit_cpu_num=737.5, local_input_size=50, local_cpu_freq=1.5e9, switched_cap=1e-28, max_transient_discharge=0.04, edge_input_size=3000, max_assign=3, edge_cpu_freq=4.5e9, bandwidth=1e6, noise=1e-13, transmit_power=1, path_loss_const=1e-4, min_distance=150, max_distance=400, max_channel_power_gain=1.02e-13, max_harvest_energy=4.8e-4, v=1e-6): """ Initialization. Without loss of generality, we set properties of every mobile device and every edge site the same, respectively. :param time_slot_length: the length of time slot in second :param time_horizon: the length of time horizon, i.e., the number of time slots :param ddl: the deadline of computation task (unit: second) :param drop_penalty: the penalty for dropping the computation task (unit: second) :param coordinate_cost: the cost for coordination/collaboration of edge sites (unit: second) [--tunable--] :param task_request_prob: the task request probability of all users under Bernoulli process :param unit_cpu_num: number of CPU-cycles required to process one bit computation task (num/bit) :param local_input_size: the input data size of the computation task for local execution (in bits) :param local_cpu_freq: the CPU-cycle frequency of all mobile devices :param switched_cap: the effective switched capacitance of all mobile devices :param max_transient_discharge: the maximum allowable transient discharge of mobile devices [--danger--] :param edge_input_size: the input data size of the computation task for edge/remote execution (in bits) :param max_assign: maximum number of assignments (acceptable mobile devices) of all edge sites [--tunable--] :param edge_cpu_freq: the CPU-cycle frequency of all edge servers :param bandwidth: the bandwidth of all edge sites (unit: Hz) :param noise: the background noise power of edge sites (unit: W) :param transmit_power: the transmitting power of mobile devices (unit: W) :param path_loss_const: the pass-loss constant for transmission :param min_distance: the minimum distance from mobile device to edge site under wireless signal coverage :param max_distance: the maximum distance from mobile device to edge site under wireless signal coverage :param max_channel_power_gain: the 'empirical' maximum channel power gain under exponential distribution with 4e8 trials :param max_harvest_energy: the maximum harvestable energy at each time slot (unit: J) :param v: the tuning parameter of Lyapunov Optimization (unit: J^2/sec) [--tunable--] """ # =============================== basic parameters =============================== # parameters for scenario construction self.__time_slot_length = time_slot_length self.__time_horizon = time_horizon self.__ddl = ddl self.__drop_penalty = drop_penalty self.__coordinate_cost = coordinate_cost self.__task_request_prob = task_request_prob self.__unit_cpu_num = unit_cpu_num # parameters for local execution self.__local_input_size = local_input_size self.__local_cpu_freq = local_cpu_freq self.__switched_cap = switched_cap self.__max_transient_discharge = max_transient_discharge # parameter for edge execution self.__edge_input_size = edge_input_size self.__max_assign = max_assign self.__edge_cpu_freq = edge_cpu_freq # parameter for communication, energy harvesting and V self.__bandwidth = bandwidth self.__noise = noise self.__transmit_power = transmit_power self.__path_loss_const = path_loss_const self.__min_distance = min_distance self.__max_distance = max_distance self.__max_channel_power_gain = max_channel_power_gain self.__max_harvest_energy = max_harvest_energy self.__v = v # =============================== position information =============================== # read scenario data from dataset: initial users and servers' position self.__user_info, self.__edge_info = self.import_scenario() # get number of edge servers and users self.__user_num = len(self.__user_info) self.__server_num = len(self.__edge_info) # user position information self.__connectable_servers, self.__connectable_users, self.__connectable_distances, self.__connectable_gains, \ self.__global_distances = self.obtain_wireless_signal_coverage() # mobility management self.__latitude_drv, self.__longitude_drv = self.obtain_derivation() # =============================== random events =============================== self.__harvestable_energys = ToolFunction.generate_harvestable_energys(self.__max_harvest_energy, self.__user_num) self.__task_requests = self.generate_task_request() # =============================== execution & cost information =============================== # calculate local execution time self.__local_exe_time = self.__local_input_size * self.__unit_cpu_num / self.__local_cpu_freq # calculate local execution energy consumption self.__local_exe_energy = self.__switched_cap * self.__local_input_size * self.__unit_cpu_num * \ (self.__local_cpu_freq ** 2) # calculate the lower bound of perturbation parameter self.__perturbation_para = self.obtain_perturbation_para() # calculate the dimension size self.__dim_size = self.calculate_dim_size() def get_time_slot_length(self): return self.__time_slot_length def set_time_slot_length(self, time_slot_length): self.__time_slot_length = time_slot_length def get_time_horizon(self): return self.__time_horizon def set_time_horizon(self, time_horizon): self.__time_horizon = time_horizon def get_ddl(self): return self.__ddl def set_ddl(self, ddl): self.__ddl = ddl def get_drop_penalty(self): return self.__drop_penalty def set_drop_penalty(self, drop_penalty): self.__drop_penalty = drop_penalty def get_coordinate_cost(self): return self.__coordinate_cost def set_coordinate_cost(self, coordinate_cost): self.__coordinate_cost = coordinate_cost def get_task_request_prob(self): return self.__task_request_prob def set_task_request_prob(self, task_request_prob): self.__task_request_prob = task_request_prob def get_unit_cpu_num(self): return self.__unit_cpu_num def set_unit_cpu_num(self, unit_cpu_num): self.__unit_cpu_num = unit_cpu_num def get_local_input_size(self): return self.__local_input_size def set_local_input_size(self, local_input_size): self.__local_input_size = local_input_size def get_local_cpu_freq(self): return self.__local_cpu_freq def set_local_cpu_freq(self, local_cpu_freq): self.__local_cpu_freq = local_cpu_freq def get_switched_cap(self): return self.__switched_cap def set_switched_cap(self, switched_cap): self.__switched_cap = switched_cap def get_max_transient_discharge(self): return self.__max_transient_discharge def set_max_transient_discharge(self, max_transient_discharge): self.__max_transient_discharge = max_transient_discharge def get_edge_input_size(self): return self.__edge_input_size def set_edge_input_size(self, edge_input_size): self.__edge_input_size = edge_input_size def get_max_assign(self): return self.__max_assign def set_max_assign(self, max_assign): self.__max_assign = max_assign def get_edge_cpu_freq(self): return self.__edge_cpu_freq def set_edge_cpu_freq(self, edge_cpu_freq): self.__edge_cpu_freq = edge_cpu_freq def get_bandwidth(self): return self.__bandwidth def set_bandwidth(self, bandwidth): self.__bandwidth = bandwidth def get_noise(self): return self.__noise def set_noise(self, noise): self.__noise = noise def get_transmit_power(self): return self.__transmit_power def set_transmit_power(self, transmit_power): self.__transmit_power = transmit_power def get_path_loss_const(self): return self.__path_loss_const def set_path_loss_const(self, path_loss_const): self.__path_loss_const = path_loss_const def get_min_distance(self): return self.__min_distance def set_min_distance(self, min_distance): self.__min_distance = min_distance def get_max_distance(self): return self.__max_distance def set_max_distance(self, max_distance): self.__max_distance = max_distance def get_max_channel_power_gain(self): return self.__max_channel_power_gain def set_max_channel_power_gain(self, max_channel_power_gain): self.__max_channel_power_gain = max_channel_power_gain def get_max_harvest_energy(self): return self.__max_harvest_energy def set_max_harvest_energy(self, max_harvest_energy): self.__max_harvest_energy = max_harvest_energy def get_v(self): return self.__v def set_v(self, v): self.__v = v def import_scenario(self, user_data_dir='../dataset/users/users-melbcbd-generated.csv', edge_data_dir='../dataset/edge-servers/site-optus-melbCBD.csv'): """ Construct scenario (information of users/mobile devices and base stations) from imported dataset. 'Melbourne CBD' in default. :param user_data_dir: csv file directory of user data :param edge_data_dir: csv file directory of edge site data :return: user information (latitude and longitude) and base station information (latitude, longitude and wireless signal coverage), presented in numpy array """ user_info = pd.read_csv(user_data_dir).values # randomly choose a certain amount of users, 80 in default user_info = np.array([user_info[i] for i in random.sample(range(len(user_info)), 80)]) edge_info = pd.read_csv(edge_data_dir, usecols=[1, 2]).values # edge_info = np.array([edge_info[j] for j in random.sample(range(len(edge_info)), 80)]) # generate signal coverage (randomly chosen from minimum acceptable distance to maximum acceptable distance) signal_cov = np.array(np.random.randint(self.__min_distance, self.__max_distance, size=(len(edge_info), 1))) edge_info = np.c_[edge_info, signal_cov] return user_info, edge_info def obtain_perturbation_para(self): """ Calculate the lower bound of perturbation parameter used in Lyapunov Optimization. :return: the lower bound of perturbation parameter """ max_achievable_rate = ToolFunction.obtain_achieve_rate(self.__bandwidth, self.__max_channel_power_gain, self.__transmit_power, self.__noise) part1 = self.__v * max_achievable_rate / (self.__transmit_power * self.__edge_input_size) part2 = self.__server_num * self.__drop_penalty - self.__edge_input_size / max_achievable_rate - \ self.__edge_input_size * self.__unit_cpu_num / self.__edge_cpu_freq max_energy_all = self.__local_exe_energy + self.__server_num * \ self.__transmit_power * (self.__ddl - self.__local_exe_time) return part1 * part2 + min(max_energy_all, self.__max_transient_discharge) def obtain_wireless_signal_coverage(self): """ According to the position of mobile devices and edge sites, judge whether mobile devices are covered by edge sites' wireless signal. :return: lists stored indices of connectable edge sites, power gains, and mobile devices, respectively, and distances from mobile devices to connectable edge sites """ connectable_servers, connectable_distances, connectable_gains = [], [], [] global_distances = [] # a 'N * M' matrix stored distances between each user and each edge site for i in range(len(self.__user_info)): tmp_s, tmp_d, tmp_g = [], [], [] tmp_gains = [] for j in range(len(self.__edge_info)): distance = ToolFunction.obtain_geo_distance(self.__user_info[i], self.__edge_info[j]) if distance <= self.__edge_info[j][2]: # under signal coverage tmp_s.append(j) tmp_d.append(distance) tmp_gains.append(ToolFunction.obtain_channel_power_gain(self.__path_loss_const, distance)) tmp_g.append(distance) connectable_servers.append(tmp_s) connectable_distances.append(tmp_d) connectable_gains.append(tmp_gains) global_distances.append(tmp_g) connectable_users = [] for j in range(len(self.__edge_info)): tmp_u = [] for i in range(len(self.__user_info)): if global_distances[i][j] <= self.__edge_info[j][2]: tmp_u.append(i) connectable_users.append(tmp_u) return connectable_servers, connectable_users, connectable_distances, connectable_gains, global_distances # properties below do not have setter methods def get_user_info(self): return self.__user_info def get_edge_info(self): return self.__edge_info def get_user_num(self): return self.__user_num def get_server_num(self): return self.__server_num def get_connectable_servers(self): return self.__connectable_servers def get_connectable_users(self): return self.__connectable_users def get_connectable_distances(self): return self.__connectable_distances def get_connectable_gains(self): return self.__connectable_gains def get_global_distances(self): return self.__global_distances def get_latitude_drv(self): return self.__latitude_drv def get_longitude_drv(self): return self.__longitude_drv # getter and setter for random events def get_harvestable_energys(self): return self.__harvestable_energys def set_harvestable_energys(self, harvestable_energys): self.__harvestable_energys = harvestable_energys def get_task_requests(self): return self.__task_requests def set_task_requests(self, task_requests): self.__task_requests = task_requests # properties below do not have setter methods def get_local_exe_time(self): return self.__local_exe_time def get_local_exe_energy(self): return self.__local_exe_energy def get_perturbation_para(self): return self.__perturbation_para def get_dim_size(self): return self.__dim_size # Below two methods are defined for user mobility. # In future, user mobility will be implemented by 'Random Walk Model'. def obtain_derivation(self): """ Generate maximum derivation on user positions. [--This function will be deprecated in future. User mobility will be implemented by 'Random Walk Model'.--] :return: maximum derivation on latitude and longitude """ positions = self.__user_info.T chosen_users = random.sample([i for i in range(self.__user_num)], int(self.__user_num / 2)) non_chosen_users = [i for i in range(self.__user_num) if i not in chosen_users] latitudes_1 = [positions[0][i] for i in chosen_users] latitudes_2 = [positions[0][i] for i in non_chosen_users] latitude_drv = (np.mean(latitudes_1) - np.mean(latitudes_2)) / 20 longitude_1 = [positions[1][i] for i in chosen_users] longitude_2 = [positions[1][i] for i in non_chosen_users] longitude_drv = (np.mean(longitude_1) - np.mean(longitude_2)) / 20 return latitude_drv, longitude_drv def go_next_slot(self): """ Generate users' position with random policy, and then update user_info. Finally, update connection information and dimension size. !! [--bugs--] Cannot confine users within this specific area. Therefore, bugs may arise. !! [--This function will be deprecated in future. User mobility will be implemented by 'Random Walk Model'.--] :return: no return """ positions = self.__user_info.T positions[0] += np.random.uniform(-self.__latitude_drv, self.__latitude_drv, size=self.__user_num) positions[1] += np.random.uniform(-self.__longitude_drv, self.__longitude_drv, size=self.__user_num) self.__user_info = positions.T # update information who changes with user_info self.__connectable_servers, self.__connectable_users, self.__connectable_distances, self.__connectable_gains, \ self.__global_distances = self.obtain_wireless_signal_coverage() self.__dim_size = self.calculate_dim_size() def generate_task_request(self): """ Generate task request from Bernoulli Distribution. :return: a numpy array denoted task request, presented in [0, 1, ..., 1] """ return ToolFunction.sample_from_bernoulli(self.__user_num, self.__task_request_prob) def calculate_dim_size(self): """ Calculate dimension size from shape of 'edge_selections' for SAC (racos) algorithm. :return: no return """ dim_size = 0 for i in range(self.__user_num): if self.__task_requests[i] == 1: dim_size += len(self.__connectable_servers[i]) return dim_size
41.435556
120
0.68449
2,422
18,646
4.855491
0.133361
0.020408
0.047619
0.017772
0.36369
0.246599
0.209779
0.115136
0.088946
0.070918
0
0.007137
0.233509
18,646
449
121
41.52784
0.815701
0.290196
0
0.234818
0
0
0.007106
0.007106
0
0
0
0
0
1
0.295547
false
0
0.024292
0.161943
0.510121
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
ad6a6ec319970afe0d7bce37aefd7a15eeab45e7
2,440
py
Python
intersight/__init__.py
CiscoDevNet/intersight-python
04b721f37c3044646a91c185c7259edfb991557a
[ "Apache-2.0" ]
5
2021-12-16T15:13:32.000Z
2022-03-29T16:09:54.000Z
intersight/__init__.py
CiscoDevNet/intersight-python
04b721f37c3044646a91c185c7259edfb991557a
[ "Apache-2.0" ]
4
2022-01-25T19:05:51.000Z
2022-03-29T20:18:37.000Z
intersight/__init__.py
CiscoDevNet/intersight-python
04b721f37c3044646a91c185c7259edfb991557a
[ "Apache-2.0" ]
2
2020-07-07T15:01:08.000Z
2022-01-31T04:27:35.000Z
# flake8: noqa """ Cisco Intersight Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advanced ways than the prior generations of tools. Cisco Intersight provides an integrated and intuitive management experience for resources in the traditional data center as well as at the edge. With flexible deployment options to address complex security needs, getting started with Intersight is quick and easy. Cisco Intersight has deep integration with Cisco UCS and HyperFlex systems allowing for remote deployment, configuration, and ongoing maintenance. The model-based deployment works for a single system in a remote location or hundreds of systems in a data center and enables rapid, standardized configuration and deployment. It also streamlines maintaining those systems whether you are working with small or very large configurations. The Intersight OpenAPI document defines the complete set of properties that are returned in the HTTP response. From that perspective, a client can expect that no additional properties are returned, unless these properties are explicitly defined in the OpenAPI document. However, when a client uses an older version of the Intersight OpenAPI document, the server may send additional properties because the software is more recent than the client. In that case, the client may receive properties that it does not know about. Some generated SDKs perform a strict validation of the HTTP response body against the OpenAPI document. # noqa: E501 The version of the OpenAPI document: 1.0.9-4950 Contact: intersight@cisco.com Generated by: https://openapi-generator.tech """ __version__ = "1.0.9.4950" # import ApiClient from intersight.api_client import ApiClient # import Configuration from intersight.configuration import Configuration from intersight.signing import HttpSigningConfiguration # import exceptions from intersight.exceptions import OpenApiException from intersight.exceptions import ApiAttributeError from intersight.exceptions import ApiTypeError from intersight.exceptions import ApiValueError from intersight.exceptions import ApiKeyError from intersight.exceptions import ApiException __import__('sys').setrecursionlimit(1200)
76.25
1,678
0.827049
337
2,440
5.961424
0.507418
0.062718
0.071677
0.089597
0
0
0
0
0
0
0
0.011005
0.143443
2,440
31
1,679
78.709677
0.950239
0.772951
0
0
0
0
0.024857
0
0
0
0
0
0
1
0
false
0
0.909091
0
0.909091
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
1
0
1
0
0
3
ad76ff48fe0721d6e3e1d487999446b99ddf3754
193
py
Python
448.py
RafaelHuang87/Leet-Code-Practice
7754dcee38ffda18a5759113ef06d7becf4fe728
[ "MIT" ]
null
null
null
448.py
RafaelHuang87/Leet-Code-Practice
7754dcee38ffda18a5759113ef06d7becf4fe728
[ "MIT" ]
null
null
null
448.py
RafaelHuang87/Leet-Code-Practice
7754dcee38ffda18a5759113ef06d7becf4fe728
[ "MIT" ]
null
null
null
class Solution: def findDisappearedNumbers(self, nums: [int]) -> [int]: return list(set(range(1, len(nums) + 1)) - set(nums)) s = Solution() print(s.findDisappearedNumbers([1, 1]))
32.166667
61
0.647668
25
193
5
0.6
0
0
0
0
0
0
0
0
0
0
0.024845
0.165803
193
6
62
32.166667
0.751553
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0.2
0.6
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
3
ad7f7375de03706490b7e76c453d69ef1217cf5d
292
py
Python
pitop/labs/__init__.py
pi-top/pi-top-Python-SDK
6c83cc5f612d77f86f8d391c7f2924a28f7b1232
[ "Apache-2.0" ]
28
2020-11-24T08:02:58.000Z
2022-02-27T18:37:33.000Z
pitop/labs/__init__.py
pi-top/pi-top-Python-SDK
6c83cc5f612d77f86f8d391c7f2924a28f7b1232
[ "Apache-2.0" ]
263
2020-11-10T14:35:10.000Z
2022-03-31T12:35:13.000Z
pitop/labs/__init__.py
pi-top/pi-top-Python-SDK
6c83cc5f612d77f86f8d391c7f2924a28f7b1232
[ "Apache-2.0" ]
1
2022-01-31T22:48:35.000Z
2022-01-31T22:48:35.000Z
from .web.blueprints import ( BaseBlueprint, ControllerBlueprint, MessagingBlueprint, RoverControllerBlueprint, VideoBlueprint, WebComponentsBlueprint, ) from .web.webcontroller import RoverWebController, WebController from .web.webserver import WebServer, create_app
26.545455
64
0.791096
23
292
10
0.652174
0.091304
0
0
0
0
0
0
0
0
0
0
0.15411
292
10
65
29.2
0.931174
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.3
0
0.3
0.7
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
1
0
3
ad7ffd3e2006053a8f3d8350f1d508776a111e7b
550
py
Python
codenames/handlers/help.py
timmsimpson/codenames-duet-bot
b049098db6706b83a9eab7c47ae63209e94a0f41
[ "MIT" ]
null
null
null
codenames/handlers/help.py
timmsimpson/codenames-duet-bot
b049098db6706b83a9eab7c47ae63209e94a0f41
[ "MIT" ]
null
null
null
codenames/handlers/help.py
timmsimpson/codenames-duet-bot
b049098db6706b83a9eab7c47ae63209e94a0f41
[ "MIT" ]
null
null
null
from telegram import Update from telegram.ext import CallbackContext from codenames.handlers.special_types import LocalizedCommandHandler def show_help(update: Update, context: CallbackContext) -> None: update.effective_chat.send_message(context.language.t.HELP_MESSAGE) def show_welcome(update: Update, context: CallbackContext) -> None: update.effective_chat.send_message(context.language.t.WELCOME_MESSAGE) help_handler = LocalizedCommandHandler("help", show_help) start_handler = LocalizedCommandHandler("start", show_welcome)
32.352941
74
0.818182
64
550
6.828125
0.390625
0.05492
0.086957
0.155606
0.384439
0.384439
0.384439
0.384439
0.384439
0.384439
0
0
0.1
550
16
75
34.375
0.882828
0
0
0
0
0
0.016364
0
0
0
0
0
0
1
0.222222
false
0
0.333333
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
1
0
1
0
0
3
ad8aeca5ed0fdac2f7e1a3d68f6a017dc97d2f93
122
py
Python
06/00/5.py
pylangstudy/201712
f18f1251074729c4a3865b113edc89ec06b54130
[ "CC0-1.0" ]
null
null
null
06/00/5.py
pylangstudy/201712
f18f1251074729c4a3865b113edc89ec06b54130
[ "CC0-1.0" ]
null
null
null
06/00/5.py
pylangstudy/201712
f18f1251074729c4a3865b113edc89ec06b54130
[ "CC0-1.0" ]
null
null
null
from multiprocessing.managers import BaseManager m = BaseManager(address=('127.0.0.1', 5000), authkey=b'abc') m.connect()
30.5
60
0.754098
18
122
5.111111
0.833333
0
0
0
0
0
0
0
0
0
0
0.089286
0.081967
122
3
61
40.666667
0.732143
0
0
0
0
0
0.098361
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
a8f875f90e5afe1869d5b8338a7eaec5b3b5a487
18
py
Python
community_hub/libs/com_hub/__init__.py
ModoCommunityHub/Modo_Community_Hub
86ff4218b6d8d9f900fd90a1a4d8e3b5807a02db
[ "MIT" ]
null
null
null
community_hub/libs/com_hub/__init__.py
ModoCommunityHub/Modo_Community_Hub
86ff4218b6d8d9f900fd90a1a4d8e3b5807a02db
[ "MIT" ]
null
null
null
community_hub/libs/com_hub/__init__.py
ModoCommunityHub/Modo_Community_Hub
86ff4218b6d8d9f900fd90a1a4d8e3b5807a02db
[ "MIT" ]
null
null
null
hub_window = None
9
17
0.777778
3
18
4.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.166667
18
2
17
9
0.866667
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d1032f1dd9e173d49d96722538679b2ae0e98ae8
1,640
py
Python
python/test/unbounded_knapsack_tests.py
CarnaViire/training
5a01a022167a88a9c90bc6db4e14347ad60ee9e4
[ "Unlicense" ]
3
2017-07-08T05:18:33.000Z
2021-06-11T13:49:37.000Z
python/test/unbounded_knapsack_tests.py
kondratyev-nv/training
ed28507694bc2026867b67c26dc9c4a955b24fb4
[ "Unlicense" ]
44
2017-10-05T20:23:03.000Z
2022-02-10T19:50:21.000Z
python/test/unbounded_knapsack_tests.py
CarnaViire/training
5a01a022167a88a9c90bc6db4e14347ad60ee9e4
[ "Unlicense" ]
4
2017-10-06T19:29:55.000Z
2022-01-04T23:25:18.000Z
import unittest from src.unbounded_knapsack import knapsack, Item class unbounded_knapsack_tests(unittest.TestCase): def test_returns_zero_for_empty_array(self): v, w = knapsack([], 5) self.assertEqual(0, v) self.assertEqual(0, w) def test_returns_zero_for_zero_maximum(self): v, w = knapsack([Item(1, 1), Item(1, 2), Item(1, 2)], 0) self.assertEqual(0, v) self.assertEqual(0, w) def test_returns_zero_for_single_element_exceeding_maximum(self): v, w = knapsack([Item(1, 7)], 5) self.assertEqual(0, v) self.assertEqual(0, w) def test_returns_single_element_value_not_exceeding_maximum(self): v, w = knapsack([Item(1, 3)], 5) self.assertEqual(1, v) self.assertEqual(3, w) def test_returns_sum_of_single_element_values_not_exceeding_maximum(self): v, w = knapsack([Item(1, 2)], 7) self.assertEqual(3, v) self.assertEqual(6, w) def test_returns_sum_of_multiple_element_values_equal_maximum(self): v, w = knapsack([Item(1, 2), Item(2, 5)], 7) self.assertEqual(3, v) self.assertTrue(w in set([6, 7])) def test_returns_sum_of_multiple_element_values_not_exceeding_maximum(self): v, w = knapsack([Item(1, 4), Item(2, 5)], 11) self.assertEqual(4, v) self.assertEqual(10, w) def test_returns_maximum_value_for_items_not_exceeding_maximum(self): v, w = knapsack([Item(10, 1), Item(40, 3), Item(50, 4), Item(70, 5)], 8) self.assertEqual(110, v) self.assertEqual(8, w) if __name__ == '__main__': unittest.main()
32.8
80
0.64878
243
1,640
4.09465
0.222222
0.226131
0.112563
0.112563
0.58191
0.560804
0.495477
0.469347
0.301508
0.263317
0
0.047843
0.222561
1,640
49
81
33.469388
0.732549
0
0
0.216216
0
0
0.004878
0
0
0
0
0
0.432432
1
0.216216
false
0
0.054054
0
0.297297
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
1
0
1
0
0
0
0
0
0
0
3
d106541dbb302eb99aaceac1992f67b6bd081b1c
310
py
Python
algorithms/reverse_bits_test.py
kainonly/leetcode
83a84ad48d517eb7f1377cb2a3aa3fe763da6627
[ "MIT" ]
null
null
null
algorithms/reverse_bits_test.py
kainonly/leetcode
83a84ad48d517eb7f1377cb2a3aa3fe763da6627
[ "MIT" ]
null
null
null
algorithms/reverse_bits_test.py
kainonly/leetcode
83a84ad48d517eb7f1377cb2a3aa3fe763da6627
[ "MIT" ]
null
null
null
import unittest from .reverse_bits import Solution class Test(unittest.TestCase): @classmethod def setUpClass(cls) -> None: cls.sol = Solution() def test_example1(self): self.assertEqual(self.sol.reverseBits(0b0000010100101000001111010011100), 0b0111001011110000010100101000000)
25.833333
116
0.751613
30
310
7.7
0.7
0
0
0
0
0
0
0
0
0
0
0.250965
0.164516
310
11
117
28.181818
0.640927
0
0
0
0
0
0
0
0
0
0
0
0.125
1
0.25
false
0
0.25
0
0.625
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
0
0
1
0
0
0
0
1
0
0
3
d132c1962ed4004613185c72a2a9e1e994cdd947
3,417
py
Python
ResNet/residual_nn.py
ikhlo/ResNet_Architecture
9d0bac5bf769e1d6e5c1970fc3bb81ccb124b23f
[ "MIT" ]
4
2021-06-11T09:14:58.000Z
2021-07-05T07:44:36.000Z
ResNet/residual_nn.py
ikhlo/ResNet_Architecture
9d0bac5bf769e1d6e5c1970fc3bb81ccb124b23f
[ "MIT" ]
null
null
null
ResNet/residual_nn.py
ikhlo/ResNet_Architecture
9d0bac5bf769e1d6e5c1970fc3bb81ccb124b23f
[ "MIT" ]
null
null
null
from keras import backend as K from tensorflow.keras.models import Model from tensorflow.keras.layers import Input, Dense, Conv2D, Flatten, MaxPooling2D, BatchNormalization, Activation, ZeroPadding2D, Add, AveragePooling2D CHANNEL_AXIS = 1 if K.image_data_format() == "channels_first" else -1 def res_identity_block(x, no_filters_list, n_strides=1): x_init = x f1, f2 = no_filters_list x = Conv2D(filters = f1, kernel_size=1, strides=n_strides, kernel_initializer='he_normal', use_bias=False)(x) x = BatchNormalization(axis=CHANNEL_AXIS)(x) x = Activation('relu')(x) x = Conv2D(filters = f1, kernel_size=3, padding="same", strides=n_strides, kernel_initializer='he_normal', use_bias=False)(x) x = BatchNormalization(axis=CHANNEL_AXIS)(x) x = Activation('relu')(x) x = Conv2D(filters = f2, kernel_size=1, strides=n_strides, kernel_initializer='he_normal', use_bias=False)(x) x = BatchNormalization(axis=CHANNEL_AXIS)(x) x = Add()([x, x_init]) x = Activation('relu')(x) return x def res_conv_block(x, no_filters_list, n_strides): x_init = x f1, f2 = no_filters_list x = Conv2D(filters = f1, kernel_size=1, strides=n_strides, kernel_initializer='he_normal', use_bias=False)(x) x = BatchNormalization(axis=CHANNEL_AXIS)(x) x = Activation('relu')(x) x = Conv2D(filters = f1, kernel_size=3, padding="same", strides=1, kernel_initializer='he_normal', use_bias=False)(x) x = BatchNormalization(axis=CHANNEL_AXIS)(x) x = Activation('relu')(x) x = Conv2D(filters = f2, kernel_size=1, strides=1, kernel_initializer='he_normal', use_bias=False)(x) x = BatchNormalization(axis=CHANNEL_AXIS)(x) x_init = Conv2D(filters = f2, kernel_size=1, strides=n_strides, kernel_initializer='he_normal', use_bias=False)(x_init) x_init = BatchNormalization(axis=CHANNEL_AXIS)(x_init) x = Add()([x, x_init]) x = Activation('relu')(x) return x def resnet_model(input_shape:tuple, nb_of_classes:int): model_input = Input(shape=input_shape) x = ZeroPadding2D(padding=(3, 3))(model_input) x = Conv2D(64, kernel_size=(7, 7), strides=(2, 2), kernel_initializer='he_normal', use_bias=False)(x) x = BatchNormalization()(x) x = Activation("relu")(x) x = MaxPooling2D((3, 3), strides=(2, 2))(x) x = res_conv_block(x, no_filters_list=(64, 256), n_strides= 1) x = res_identity_block(x, no_filters_list=(64, 256)) x = res_identity_block(x, no_filters_list=(64, 256)) x = res_conv_block(x, no_filters_list=(128, 512), n_strides= 2) x = res_identity_block(x, no_filters_list=(128, 512)) x = res_identity_block(x, no_filters_list=(128, 512)) x = res_identity_block(x, no_filters_list=(128, 512)) x = res_conv_block(x, no_filters_list=(256, 1024), n_strides= 2) x = res_identity_block(x, no_filters_list=(256, 1024)) x = res_identity_block(x, no_filters_list=(256, 1024)) x = res_identity_block(x, no_filters_list=(256, 1024)) x = res_identity_block(x, no_filters_list=(256, 1024)) x = res_identity_block(x, no_filters_list=(256, 1024)) x = res_conv_block(x, no_filters_list=(512, 2048), n_strides= 2) x = res_identity_block(x, no_filters_list=(512, 2048)) x = res_identity_block(x, no_filters_list=(512, 2048)) x = AveragePooling2D(pool_size=(2,2))(x) x = Flatten()(x) x = Dense(nb_of_classes, activation="softmax")(x) print("Residual Neural Network created.") return Model(inputs=model_input, outputs = x, name="MyResNet")
37.549451
149
0.723734
548
3,417
4.240876
0.15146
0.020654
0.111876
0.116179
0.753442
0.738812
0.731067
0.689329
0.648021
0.648021
0
0.053199
0.130817
3,417
90
150
37.966667
0.729293
0
0
0.548387
0
0
0.049459
0
0
0
0
0
0
1
0.048387
false
0
0.048387
0
0.145161
0.016129
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d1576e7997c7e6e59e4a753e7f4c2b22ef898c87
1,917
py
Python
src/fffs/basic/lorentzian.py
awacha/fffs
6a3ce47c5381ae33fe02909754750ff7f0cf2b8c
[ "BSD-3-Clause" ]
null
null
null
src/fffs/basic/lorentzian.py
awacha/fffs
6a3ce47c5381ae33fe02909754750ff7f0cf2b8c
[ "BSD-3-Clause" ]
null
null
null
src/fffs/basic/lorentzian.py
awacha/fffs
6a3ce47c5381ae33fe02909754750ff7f0cf2b8c
[ "BSD-3-Clause" ]
null
null
null
from ..core import ModelFunction, ParameterDefinition from typing import Union import numpy as np class Lorentzian1(ModelFunction): category = 'basic' subcategory = 'peak' name = 'lorentzian_1' description = 'Lorentzian peak' parameters = [ParameterDefinition('a', 'amplitude', 1), ParameterDefinition('c', 'constant baseline', 0), ParameterDefinition('sigma', 'half width at half maximum', 1, lbound=0), ParameterDefinition('x0', 'position', 1)] siblings = ['lorentzian_2'] def fitfunction(self, x: Union[np.ndarray, float], *args, **kwargs): a, c, gamma, x0 = args return a*(0.5*gamma)**2/((x-x0)**2+(0.5*gamma)**2)+c def parameters_from_sibling(self, sibling: str, *args, **kwargs): if sibling == 'lorentzian_2': i, c, gamma, x0 = args return (2* i / (np.pi*gamma), c, gamma, x0) else: raise ValueError('Unknown sibling "{}"'.format(sibling)) class Lorentzian2(ModelFunction): category = 'basic' subcategory = 'peak' name = 'lorentzian_2' description = 'Lorentzian peak' parameters = [ParameterDefinition('i', 'integral', 1), ParameterDefinition('c', 'constant baseline', 0), ParameterDefinition('gamma', 'full width at half maximum', 1, lbound=0), ParameterDefinition('x0', 'position', 1)] siblings = ['lorentzian_1'] def fitfunction(self, x: Union[np.ndarray, float], *args, **kwargs): i, c, gamma, x0 = args return i * 0.5 * gamma /np.pi / ((x-x0)**2+(0.5*gamma)**2) + c def parameters_from_sibling(self, sibling: str, *args, **kwargs): if sibling == 'lorentzian_1': a, c, gamma, x0 = args return (a*np.pi*gamma*0.5, c, gamma, x0) else: raise ValueError('Unknown sibling "{}"'.format(sibling))
37.588235
90
0.589984
221
1,917
5.072398
0.276018
0.032114
0.042819
0.042819
0.82248
0.726137
0.692239
0.456735
0.456735
0.456735
0
0.031052
0.260824
1,917
50
91
38.34
0.760056
0
0
0.536585
0
0
0.15501
0
0
0
0
0
0
1
0.097561
false
0
0.073171
0
0.609756
0
0
0
0
null
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
d16f80ed6e82ae6f052cae2c2a8d07bc9709bb7b
105
py
Python
src/wxyz_dvcs/src/wxyz/dvcs/tools/utils.py
deathbeds/wxyz
9d46375ffa1b5dfe8ed8231d20f7951c0e6172bc
[ "BSD-3-Clause" ]
23
2019-02-25T18:55:17.000Z
2021-11-14T21:56:40.000Z
src/wxyz_dvcs/src/wxyz/dvcs/tools/utils.py
deathbeds/wxyz
9d46375ffa1b5dfe8ed8231d20f7951c0e6172bc
[ "BSD-3-Clause" ]
33
2019-02-23T08:37:41.000Z
2022-03-18T23:17:02.000Z
src/wxyz_dvcs/src/wxyz/dvcs/tools/utils.py
deathbeds/wxyz
9d46375ffa1b5dfe8ed8231d20f7951c0e6172bc
[ "BSD-3-Clause" ]
3
2020-03-20T20:32:24.000Z
2020-09-17T17:56:30.000Z
""" default styles for tools """ BTN_ICON_DEFAULTS = dict(layout=dict(max_width="3em", min_width="3em"))
26.25
71
0.72381
16
105
4.5
0.8125
0.222222
0
0
0
0
0
0
0
0
0
0.021053
0.095238
105
3
72
35
0.736842
0.228571
0
0
0
0
0.082192
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0f03ed8309ae8d5a3562ad14fc2af7f51ca8415d
113
py
Python
test/test_variable.py
DEMCON/python-ads
d8d5ae43135bdb74b8e63a6451a06d11a6d87377
[ "BSD-3-Clause" ]
1
2019-12-15T21:29:24.000Z
2019-12-15T21:29:24.000Z
test/test_variable.py
DEMCON/python-ads
d8d5ae43135bdb74b8e63a6451a06d11a6d87377
[ "BSD-3-Clause" ]
4
2018-12-13T15:41:38.000Z
2019-08-08T07:59:49.000Z
test/test_variable.py
DEMCON/python-ads
d8d5ae43135bdb74b8e63a6451a06d11a6d87377
[ "BSD-3-Clause" ]
6
2018-07-26T13:14:03.000Z
2021-06-11T12:22:55.000Z
from ads import adssymbols def test_plc_string(): s = adssymbols.PLCString.create(25) print(s)
14.125
40
0.663717
15
113
4.866667
0.866667
0
0
0
0
0
0
0
0
0
0
0.023529
0.247788
113
7
41
16.142857
0.835294
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.5
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
0f27332c5e118b66d3743c07462806c3b512166d
884
py
Python
h/accounts/subscribers.py
noscripter/h
a7a4095a46683ea08dae62335bbcd53f7ab313e2
[ "MIT" ]
null
null
null
h/accounts/subscribers.py
noscripter/h
a7a4095a46683ea08dae62335bbcd53f7ab313e2
[ "MIT" ]
null
null
null
h/accounts/subscribers.py
noscripter/h
a7a4095a46683ea08dae62335bbcd53f7ab313e2
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from __future__ import unicode_literals from pyramid.events import subscriber from h.accounts import events from h.stats import get_client as stats @subscriber(events.LoginEvent) def login(event): stats(event.request).get_counter('auth.local.login').increment() @subscriber(events.LogoutEvent) def logout(event): stats(event.request).get_counter('auth.local.logout').increment() @subscriber(events.RegistrationEvent) def registration(event): stats(event.request).get_counter('auth.local.register').increment() @subscriber(events.PasswordResetEvent) def password_reset(event): stats(event.request).get_counter('auth.local.reset_password').increment() @subscriber(events.ActivationEvent) def activation(event): stats(event.request).get_counter('auth.local.activate').increment() def includeme(config): config.scan(__name__)
23.891892
77
0.771493
109
884
6.100917
0.376147
0.120301
0.112782
0.165414
0.308271
0.308271
0.308271
0.308271
0
0
0
0.00125
0.095023
884
36
78
24.555556
0.83
0.023756
0
0
0
0
0.111498
0.029036
0
0
0
0
0
1
0.285714
false
0.142857
0.190476
0
0.47619
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
3
0f41801b7d54f1134533e3493023db71e070acb1
37
py
Python
video.py
SanjoSolutions/street_fighter_5_ai
9c39089cdfe33468c0cb79f09a51602d8aa45bec
[ "Unlicense" ]
null
null
null
video.py
SanjoSolutions/street_fighter_5_ai
9c39089cdfe33468c0cb79f09a51602d8aa45bec
[ "Unlicense" ]
null
null
null
video.py
SanjoSolutions/street_fighter_5_ai
9c39089cdfe33468c0cb79f09a51602d8aa45bec
[ "Unlicense" ]
null
null
null
VIDEO_WIDTH = 224 VIDEO_HEIGHT = 126
12.333333
18
0.783784
6
37
4.5
0.833333
0
0
0
0
0
0
0
0
0
0
0.193548
0.162162
37
2
19
18.5
0.677419
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0f46acafe84668a5fe7af60c7c3841dd9b2e491a
476
py
Python
testers/monoid_law_tester.py
przemyslawjanpietrzak/pyMonet
94610ee4f1c71aa5f50e0813539bf1a2ea279d70
[ "MIT" ]
33
2017-07-05T07:04:52.000Z
2022-03-03T07:54:18.000Z
testers/monoid_law_tester.py
przemyslawjanpietrzak/pyMonet
94610ee4f1c71aa5f50e0813539bf1a2ea279d70
[ "MIT" ]
46
2017-06-28T20:48:31.000Z
2020-04-21T21:46:12.000Z
testers/monoid_law_tester.py
przemyslawjanpietrzak/MonetPy
94610ee4f1c71aa5f50e0813539bf1a2ea279d70
[ "MIT" ]
null
null
null
class MonoidLawTester: def __init__(self, monoid, value): self.monoid = monoid self.value = value def left_identity_test(self): monoid = self.monoid(self.value) assert monoid.concat(monoid.neutral()) == monoid def right_identity_test(self): monoid = self.monoid(self.value) assert monoid.neutral().concat(monoid) == monoid def test(self): self.left_identity_test() self.right_identity_test()
26.444444
56
0.644958
56
476
5.267857
0.25
0.20339
0.189831
0.135593
0.359322
0.359322
0.359322
0.359322
0.359322
0.359322
0
0
0.247899
476
17
57
28
0.824022
0
0
0.153846
0
0
0
0
0
0
0
0
0.153846
1
0.307692
false
0
0
0
0.384615
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
0f5b4797d155c8ce7f74d9938317e1a11dda36b3
682
py
Python
vedro/core/_event.py
iri6e4k0/vedro
dd51c16400993d0fe1fd34bba57edff710ac2638
[ "Apache-2.0" ]
2
2021-08-24T12:49:30.000Z
2022-01-23T07:21:25.000Z
vedro/core/_event.py
iri6e4k0/vedro
dd51c16400993d0fe1fd34bba57edff710ac2638
[ "Apache-2.0" ]
20
2015-12-09T11:04:23.000Z
2022-03-20T09:18:17.000Z
vedro/core/_event.py
iri6e4k0/vedro
dd51c16400993d0fe1fd34bba57edff710ac2638
[ "Apache-2.0" ]
3
2015-12-09T07:31:23.000Z
2022-01-28T11:03:24.000Z
from typing import Any, Set, Type __all__ = ("Event",) class EventRegistry: events: Set[str] = set() @classmethod def register(cls, event: Type["Event"]) -> None: cls.events.add(event.__name__) @classmethod def is_registered(cls, event: Type["Event"]) -> bool: return event.__name__ in cls.events class Event: def __init_subclass__(cls, **kwargs: Any) -> None: if EventRegistry.is_registered(cls): raise Exception(f"Event {cls} already registered") EventRegistry.register(cls) def __eq__(self, other: Any) -> bool: return isinstance(other, self.__class__) and (self.__dict__ == other.__dict__)
26.230769
86
0.652493
82
682
5
0.463415
0.068293
0.058537
0.082927
0
0
0
0
0
0
0
0
0.221408
682
25
87
27.28
0.772128
0
0
0.117647
0
0
0.065982
0
0
0
0
0
0
1
0.235294
false
0
0.058824
0.117647
0.588235
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
0f6a0d4f461eba8a35ebd8443e73033b117f1c37
170
py
Python
kirppuauth/urls.py
Glowieh/kirppu
95f3e98c594ca7f02ed4ec311da3e558d76ea5b3
[ "MIT" ]
null
null
null
kirppuauth/urls.py
Glowieh/kirppu
95f3e98c594ca7f02ed4ec311da3e558d76ea5b3
[ "MIT" ]
null
null
null
kirppuauth/urls.py
Glowieh/kirppu
95f3e98c594ca7f02ed4ec311da3e558d76ea5b3
[ "MIT" ]
null
null
null
from django.conf.urls import patterns, include, url urlpatterns = patterns('kirppuauth.views', url(r'^addclerk$', 'register_clerk', name='kirppu_register_clerk'), )
28.333333
71
0.747059
21
170
5.904762
0.809524
0.209677
0
0
0
0
0
0
0
0
0
0
0.105882
170
5
72
34
0.815789
0
0
0
0
0
0.358824
0.123529
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0f764fd38910826ad2d1951946d49ec7113506c4
18,315
py
Python
cloudshell/snmp/mibs/IANA-MAU-MIB.py
QualiSystems/cloudshell-snmp
9f8c4a927997d69cf85cac2a9bb1c36952d62d99
[ "Apache-2.0" ]
null
null
null
cloudshell/snmp/mibs/IANA-MAU-MIB.py
QualiSystems/cloudshell-snmp
9f8c4a927997d69cf85cac2a9bb1c36952d62d99
[ "Apache-2.0" ]
36
2016-05-13T08:42:13.000Z
2021-07-07T13:53:23.000Z
cloudshell/snmp/mibs/IANA-MAU-MIB.py
QualiSystems/cloudshell-snmp
9f8c4a927997d69cf85cac2a9bb1c36952d62d99
[ "Apache-2.0" ]
5
2016-08-05T17:49:21.000Z
2019-05-28T03:27:22.000Z
# PySNMP SMI module. Autogenerated from smidump -f python IANA-MAU-MIB # by libsmi2pysnmp-0.1.3 at Thu May 22 11:57:41 2014, # Python version sys.version_info(major=2, minor=7, micro=2, releaselevel='final', serial=0) # Imports ( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") ( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ( ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint") ( Bits, Integer32, ModuleIdentity, MibIdentifier, ObjectIdentity, TimeTicks, mib_2, ) = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Integer32", "ModuleIdentity", "MibIdentifier", "ObjectIdentity", "TimeTicks", "mib-2") ( TextualConvention, ) = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention") # Types class IANAifJackType(Integer): subtypeSpec = Integer.subtypeSpec+SingleValueConstraint(9,15,11,3,7,8,12,4,2,1,13,6,5,10,14,) namedValues = NamedValues(("other", 1), ("fiberST", 10), ("telco", 11), ("mtrj", 12), ("hssdc", 13), ("fiberLC", 14), ("cx4", 15), ("rj45", 2), ("rj45S", 3), ("db9", 4), ("bnc", 5), ("fAUI", 6), ("mAUI", 7), ("fiberSC", 8), ("fiberMIC", 9), ) class IANAifMauAutoNegCapBits(Bits): namedValues = NamedValues(("bOther", 0), ("b10baseT", 1), ("bFdxSPause", 10), ("bFdxBPause", 11), ("b1000baseX", 12), ("b1000baseXFD", 13), ("b1000baseT", 14), ("b1000baseTFD", 15), ("b10baseTFD", 2), ("b100baseT4", 3), ("b100baseTX", 4), ("b100baseTXFD", 5), ("b100baseT2", 6), ("b100baseT2FD", 7), ("bFdxPause", 8), ("bFdxAPause", 9), ) class IANAifMauMediaAvailable(Integer): subtypeSpec = Integer.subtypeSpec+SingleValueConstraint(9,3,12,13,20,6,2,17,1,14,10,7,5,4,16,11,15,8,18,19,) namedValues = NamedValues(("other", 1), ("offline", 10), ("autoNegError", 11), ("pmdLinkFault", 12), ("wisFrameLoss", 13), ("wisSignalLoss", 14), ("pcsLinkFault", 15), ("excessiveBER", 16), ("dxsLinkFault", 17), ("pxsLinkFault", 18), ("availableReduced", 19), ("unknown", 2), ("ready", 20), ("available", 3), ("notAvailable", 4), ("remoteFault", 5), ("invalidSignal", 6), ("remoteJabber", 7), ("remoteLinkLoss", 8), ("remoteTest", 9), ) class IANAifMauTypeListBits(Bits): namedValues = NamedValues(("bOther", 0), ("bAUI", 1), ("b10baseTHD", 10), ("b10baseTFD", 11), ("b10baseFLHD", 12), ("b10baseFLFD", 13), ("b100baseT4", 14), ("b100baseTXHD", 15), ("b100baseTXFD", 16), ("b100baseFXHD", 17), ("b100baseFXFD", 18), ("b100baseT2HD", 19), ("b10base5", 2), ("b100baseT2FD", 20), ("b1000baseXHD", 21), ("b1000baseXFD", 22), ("b1000baseLXHD", 23), ("b1000baseLXFD", 24), ("b1000baseSXHD", 25), ("b1000baseSXFD", 26), ("b1000baseCXHD", 27), ("b1000baseCXFD", 28), ("b1000baseTHD", 29), ("bFoirl", 3), ("b1000baseTFD", 30), ("b10GbaseX", 31), ("b10GbaseLX4", 32), ("b10GbaseR", 33), ("b10GbaseER", 34), ("b10GbaseLR", 35), ("b10GbaseSR", 36), ("b10GbaseW", 37), ("b10GbaseEW", 38), ("b10GbaseLW", 39), ("b10base2", 4), ("b10GbaseSW", 40), ("b10GbaseCX4", 41), ("b2BaseTL", 42), ("b10PassTS", 43), ("b100BaseBX10D", 44), ("b100BaseBX10U", 45), ("b100BaseLX10", 46), ("b1000BaseBX10D", 47), ("b1000BaseBX10U", 48), ("b1000BaseLX10", 49), ("b10baseT", 5), ("b1000BasePX10D", 50), ("b1000BasePX10U", 51), ("b1000BasePX20D", 52), ("b1000BasePX20U", 53), ("b10baseFP", 6), ("b10baseFB", 7), ("b10baseFL", 8), ("b10broad36", 9), ) # Objects dot3MauType = MibIdentifier((1, 3, 6, 1, 2, 1, 26, 4)) dot3MauTypeAUI = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 1)) if mibBuilder.loadTexts: dot3MauTypeAUI.setDescription("no internal MAU, view from AUI") dot3MauType10Base5 = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 2)) if mibBuilder.loadTexts: dot3MauType10Base5.setDescription("thick coax MAU") dot3MauTypeFoirl = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 3)) if mibBuilder.loadTexts: dot3MauTypeFoirl.setDescription("FOIRL MAU") dot3MauType10Base2 = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 4)) if mibBuilder.loadTexts: dot3MauType10Base2.setDescription("thin coax MAU") dot3MauType10BaseT = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 5)) if mibBuilder.loadTexts: dot3MauType10BaseT.setDescription("UTP MAU.\nNote that it is strongly recommended that\nagents return either dot3MauType10BaseTHD or\ndot3MauType10BaseTFD if the duplex mode is\nknown. However, management applications should\nbe prepared to receive this MAU type value from\nolder agent implementations.") dot3MauType10BaseFP = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 6)) if mibBuilder.loadTexts: dot3MauType10BaseFP.setDescription("passive fiber MAU") dot3MauType10BaseFB = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 7)) if mibBuilder.loadTexts: dot3MauType10BaseFB.setDescription("sync fiber MAU") dot3MauType10BaseFL = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 8)) if mibBuilder.loadTexts: dot3MauType10BaseFL.setDescription("async fiber MAU.\nNote that it is strongly recommended that\nagents return either dot3MauType10BaseFLHD or\ndot3MauType10BaseFLFD if the duplex mode is\nknown. However, management applications should\nbe prepared to receive this MAU type value from\nolder agent implementations.") dot3MauType10Broad36 = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 9)) if mibBuilder.loadTexts: dot3MauType10Broad36.setDescription("broadband DTE MAU.\nNote that 10BROAD36 MAUs can be attached to\ninterfaces but not to repeaters.") dot3MauType10BaseTHD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 10)) if mibBuilder.loadTexts: dot3MauType10BaseTHD.setDescription("UTP MAU, half duplex mode") dot3MauType10BaseTFD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 11)) if mibBuilder.loadTexts: dot3MauType10BaseTFD.setDescription("UTP MAU, full duplex mode") dot3MauType10BaseFLHD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 12)) if mibBuilder.loadTexts: dot3MauType10BaseFLHD.setDescription("async fiber MAU, half duplex mode") dot3MauType10BaseFLFD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 13)) if mibBuilder.loadTexts: dot3MauType10BaseFLFD.setDescription("async fiber MAU, full duplex mode") dot3MauType100BaseT4 = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 14)) if mibBuilder.loadTexts: dot3MauType100BaseT4.setDescription("4 pair category 3 UTP") dot3MauType100BaseTXHD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 15)) if mibBuilder.loadTexts: dot3MauType100BaseTXHD.setDescription("2 pair category 5 UTP, half duplex mode") dot3MauType100BaseTXFD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 16)) if mibBuilder.loadTexts: dot3MauType100BaseTXFD.setDescription("2 pair category 5 UTP, full duplex mode") dot3MauType100BaseFXHD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 17)) if mibBuilder.loadTexts: dot3MauType100BaseFXHD.setDescription("X fiber over PMT, half duplex mode") dot3MauType100BaseFXFD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 18)) if mibBuilder.loadTexts: dot3MauType100BaseFXFD.setDescription("X fiber over PMT, full duplex mode") dot3MauType100BaseT2HD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 19)) if mibBuilder.loadTexts: dot3MauType100BaseT2HD.setDescription("2 pair category 3 UTP, half duplex mode") dot3MauType100BaseT2FD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 20)) if mibBuilder.loadTexts: dot3MauType100BaseT2FD.setDescription("2 pair category 3 UTP, full duplex mode") dot3MauType1000BaseXHD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 21)) if mibBuilder.loadTexts: dot3MauType1000BaseXHD.setDescription("PCS/PMA, unknown PMD, half duplex mode") dot3MauType1000BaseXFD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 22)) if mibBuilder.loadTexts: dot3MauType1000BaseXFD.setDescription("PCS/PMA, unknown PMD, full duplex mode") dot3MauType1000BaseLXHD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 23)) if mibBuilder.loadTexts: dot3MauType1000BaseLXHD.setDescription("Fiber over long-wavelength laser, half duplex\nmode") dot3MauType1000BaseLXFD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 24)) if mibBuilder.loadTexts: dot3MauType1000BaseLXFD.setDescription("Fiber over long-wavelength laser, full duplex\nmode") dot3MauType1000BaseSXHD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 25)) if mibBuilder.loadTexts: dot3MauType1000BaseSXHD.setDescription("Fiber over short-wavelength laser, half\nduplex mode") dot3MauType1000BaseSXFD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 26)) if mibBuilder.loadTexts: dot3MauType1000BaseSXFD.setDescription("Fiber over short-wavelength laser, full\nduplex mode") dot3MauType1000BaseCXHD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 27)) if mibBuilder.loadTexts: dot3MauType1000BaseCXHD.setDescription("Copper over 150-Ohm balanced cable, half\nduplex mode") dot3MauType1000BaseCXFD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 28)) if mibBuilder.loadTexts: dot3MauType1000BaseCXFD.setDescription("Copper over 150-Ohm balanced cable, full\n\nduplex mode") dot3MauType1000BaseTHD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 29)) if mibBuilder.loadTexts: dot3MauType1000BaseTHD.setDescription("Four-pair Category 5 UTP, half duplex mode") dot3MauType1000BaseTFD = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 30)) if mibBuilder.loadTexts: dot3MauType1000BaseTFD.setDescription("Four-pair Category 5 UTP, full duplex mode") dot3MauType10GigBaseX = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 31)) if mibBuilder.loadTexts: dot3MauType10GigBaseX.setDescription("X PCS/PMA, unknown PMD.") dot3MauType10GigBaseLX4 = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 32)) if mibBuilder.loadTexts: dot3MauType10GigBaseLX4.setDescription("X fiber over WWDM optics") dot3MauType10GigBaseR = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 33)) if mibBuilder.loadTexts: dot3MauType10GigBaseR.setDescription("R PCS/PMA, unknown PMD.") dot3MauType10GigBaseER = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 34)) if mibBuilder.loadTexts: dot3MauType10GigBaseER.setDescription("R fiber over 1550 nm optics") dot3MauType10GigBaseLR = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 35)) if mibBuilder.loadTexts: dot3MauType10GigBaseLR.setDescription("R fiber over 1310 nm optics") dot3MauType10GigBaseSR = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 36)) if mibBuilder.loadTexts: dot3MauType10GigBaseSR.setDescription("R fiber over 850 nm optics") dot3MauType10GigBaseW = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 37)) if mibBuilder.loadTexts: dot3MauType10GigBaseW.setDescription("W PCS/PMA, unknown PMD.") dot3MauType10GigBaseEW = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 38)) if mibBuilder.loadTexts: dot3MauType10GigBaseEW.setDescription("W fiber over 1550 nm optics") dot3MauType10GigBaseLW = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 39)) if mibBuilder.loadTexts: dot3MauType10GigBaseLW.setDescription("W fiber over 1310 nm optics") dot3MauType10GigBaseSW = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 40)) if mibBuilder.loadTexts: dot3MauType10GigBaseSW.setDescription("W fiber over 850 nm optics") dot3MauType10GigBaseCX4 = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 41)) if mibBuilder.loadTexts: dot3MauType10GigBaseCX4.setDescription("X copper over 8 pair 100-Ohm balanced cable") dot3MauType2BaseTL = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 42)) if mibBuilder.loadTexts: dot3MauType2BaseTL.setDescription("Voice grade UTP copper, up to 2700m, optional PAF") dot3MauType10PassTS = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 43)) if mibBuilder.loadTexts: dot3MauType10PassTS.setDescription("Voice grade UTP copper, up to 750m, optional PAF") dot3MauType100BaseBX10D = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 44)) if mibBuilder.loadTexts: dot3MauType100BaseBX10D.setDescription("One single-mode fiber OLT, long wavelength, 10km") dot3MauType100BaseBX10U = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 45)) if mibBuilder.loadTexts: dot3MauType100BaseBX10U.setDescription("One single-mode fiber ONU, long wavelength, 10km") dot3MauType100BaseLX10 = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 46)) if mibBuilder.loadTexts: dot3MauType100BaseLX10.setDescription("Two single-mode fibers, long wavelength, 10km") dot3MauType1000BaseBX10D = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 47)) if mibBuilder.loadTexts: dot3MauType1000BaseBX10D.setDescription("One single-mode fiber OLT, long wavelength, 10km") dot3MauType1000BaseBX10U = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 48)) if mibBuilder.loadTexts: dot3MauType1000BaseBX10U.setDescription("One single-mode fiber ONU, long wavelength, 10km") dot3MauType1000BaseLX10 = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 49)) if mibBuilder.loadTexts: dot3MauType1000BaseLX10.setDescription("Two sigle-mode fiber, long wavelength, 10km") dot3MauType1000BasePX10D = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 50)) if mibBuilder.loadTexts: dot3MauType1000BasePX10D.setDescription("One single-mode fiber EPON OLT, 10km") dot3MauType1000BasePX10U = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 51)) if mibBuilder.loadTexts: dot3MauType1000BasePX10U.setDescription("One single-mode fiber EPON ONU, 10km") dot3MauType1000BasePX20D = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 52)) if mibBuilder.loadTexts: dot3MauType1000BasePX20D.setDescription("One single-mode fiber EPON OLT, 20km") dot3MauType1000BasePX20U = ObjectIdentity((1, 3, 6, 1, 2, 1, 26, 4, 53)) if mibBuilder.loadTexts: dot3MauType1000BasePX20U.setDescription("One single-mode fiber EPON ONU, 20km") ianaMauMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 154)).setRevisions(("2007-04-21 00:00",)) if mibBuilder.loadTexts: ianaMauMIB.setOrganization("IANA") if mibBuilder.loadTexts: ianaMauMIB.setContactInfo(" Internet Assigned Numbers Authority\n\nPostal: ICANN\n 4676 Admiralty Way, Suite 330\n Marina del Rey, CA 90292\n\n Tel: +1-310-823-9358\n EMail: iana&iana.org") if mibBuilder.loadTexts: ianaMauMIB.setDescription("This MIB module defines dot3MauType OBJECT-IDENTITIES and\nIANAifMauListBits, IANAifMauMediaAvailable,\nIANAifMauAutoNegCapBits, and IANAifJackType\n\nTEXTUAL-CONVENTIONs, specifying enumerated values of the\nifMauTypeListBits, ifMauMediaAvailable / rpMauMediaAvailable,\nifMauAutoNegCapabilityBits / ifMauAutoNegCapAdvertisedBits /\nifMauAutoNegCapReceivedBits and ifJackType / rpJackType objects\nrespectively, defined in the MAU-MIB.\n\nIt is intended that each new MAU type, Media Availability\nstate, Auto Negotiation capability and/or Jack type defined by\nthe IEEE 802.3 working group and approved for publication in a\nrevision of IEEE Std 802.3 will be added to this MIB module,\nprovided that it is suitable for being managed by the base\nobjects in the MAU-MIB. An Expert Review, as defined in\nRFC 2434 [RFC2434], is REQUIRED for such additions.\n\nThe following reference is used throughout this MIB module:\n\n[IEEE802.3] refers to:\n IEEE Std 802.3, 2005 Edition: 'IEEE Standard for\n Information technology - Telecommunications and information\n exchange between systems - Local and metropolitan area\n networks - Specific requirements -\n Part 3: Carrier sense multiple access with collision\n detection (CSMA/CD) access method and physical layer\n specifications'.\n\nThis reference should be updated as appropriate when new\nMAU types, Media Availability states, Auto Negotiation\ncapabilities, and/or Jack types are added to this MIB module.\n\nCopyright (C) The IETF Trust (2007).\nThe initial version of this MIB module was published in\nRFC 4836; for full legal notices see the RFC itself.\nSupplementary information may be available at:\nhttp://www.ietf.org/copyrights/ianamib.html") # Augmentions # Exports # Module identity mibBuilder.exportSymbols("IANA-MAU-MIB", PYSNMP_MODULE_ID=ianaMauMIB) # Types mibBuilder.exportSymbols("IANA-MAU-MIB", IANAifJackType=IANAifJackType, IANAifMauAutoNegCapBits=IANAifMauAutoNegCapBits, IANAifMauMediaAvailable=IANAifMauMediaAvailable, IANAifMauTypeListBits=IANAifMauTypeListBits) # Objects mibBuilder.exportSymbols("IANA-MAU-MIB", dot3MauType=dot3MauType, dot3MauTypeAUI=dot3MauTypeAUI, dot3MauType10Base5=dot3MauType10Base5, dot3MauTypeFoirl=dot3MauTypeFoirl, dot3MauType10Base2=dot3MauType10Base2, dot3MauType10BaseT=dot3MauType10BaseT, dot3MauType10BaseFP=dot3MauType10BaseFP, dot3MauType10BaseFB=dot3MauType10BaseFB, dot3MauType10BaseFL=dot3MauType10BaseFL, dot3MauType10Broad36=dot3MauType10Broad36, dot3MauType10BaseTHD=dot3MauType10BaseTHD, dot3MauType10BaseTFD=dot3MauType10BaseTFD, dot3MauType10BaseFLHD=dot3MauType10BaseFLHD, dot3MauType10BaseFLFD=dot3MauType10BaseFLFD, dot3MauType100BaseT4=dot3MauType100BaseT4, dot3MauType100BaseTXHD=dot3MauType100BaseTXHD, dot3MauType100BaseTXFD=dot3MauType100BaseTXFD, dot3MauType100BaseFXHD=dot3MauType100BaseFXHD, dot3MauType100BaseFXFD=dot3MauType100BaseFXFD, dot3MauType100BaseT2HD=dot3MauType100BaseT2HD, dot3MauType100BaseT2FD=dot3MauType100BaseT2FD, dot3MauType1000BaseXHD=dot3MauType1000BaseXHD, dot3MauType1000BaseXFD=dot3MauType1000BaseXFD, dot3MauType1000BaseLXHD=dot3MauType1000BaseLXHD, dot3MauType1000BaseLXFD=dot3MauType1000BaseLXFD, dot3MauType1000BaseSXHD=dot3MauType1000BaseSXHD, dot3MauType1000BaseSXFD=dot3MauType1000BaseSXFD, dot3MauType1000BaseCXHD=dot3MauType1000BaseCXHD, dot3MauType1000BaseCXFD=dot3MauType1000BaseCXFD, dot3MauType1000BaseTHD=dot3MauType1000BaseTHD, dot3MauType1000BaseTFD=dot3MauType1000BaseTFD, dot3MauType10GigBaseX=dot3MauType10GigBaseX, dot3MauType10GigBaseLX4=dot3MauType10GigBaseLX4, dot3MauType10GigBaseR=dot3MauType10GigBaseR, dot3MauType10GigBaseER=dot3MauType10GigBaseER, dot3MauType10GigBaseLR=dot3MauType10GigBaseLR, dot3MauType10GigBaseSR=dot3MauType10GigBaseSR, dot3MauType10GigBaseW=dot3MauType10GigBaseW, dot3MauType10GigBaseEW=dot3MauType10GigBaseEW, dot3MauType10GigBaseLW=dot3MauType10GigBaseLW, dot3MauType10GigBaseSW=dot3MauType10GigBaseSW, dot3MauType10GigBaseCX4=dot3MauType10GigBaseCX4, dot3MauType2BaseTL=dot3MauType2BaseTL, dot3MauType10PassTS=dot3MauType10PassTS, dot3MauType100BaseBX10D=dot3MauType100BaseBX10D, dot3MauType100BaseBX10U=dot3MauType100BaseBX10U, dot3MauType100BaseLX10=dot3MauType100BaseLX10, dot3MauType1000BaseBX10D=dot3MauType1000BaseBX10D, dot3MauType1000BaseBX10U=dot3MauType1000BaseBX10U, dot3MauType1000BaseLX10=dot3MauType1000BaseLX10, dot3MauType1000BasePX10D=dot3MauType1000BasePX10D, dot3MauType1000BasePX10U=dot3MauType1000BasePX10U, dot3MauType1000BasePX20D=dot3MauType1000BasePX20D, dot3MauType1000BasePX20U=dot3MauType1000BasePX20U, ianaMauMIB=ianaMauMIB)
116.656051
2,515
0.774283
2,100
18,315
6.750952
0.251905
0.0079
0.082951
0.015518
0.242294
0.19708
0.167454
0.1367
0.126614
0.025675
0
0.129368
0.098499
18,315
156
2,516
117.403846
0.729271
0.015452
0
0
1
0.031008
0.315056
0.026139
0
0
0
0
0
1
0
false
0.03876
0.03876
0
0.116279
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
7e2994306973bc09df0618e5e78905429b95aba0
2,276
py
Python
tests/layer_test.py
esben/xd-tool
cb08adf128665de9c3f493c7dfaef1ebe61af91a
[ "MIT" ]
null
null
null
tests/layer_test.py
esben/xd-tool
cb08adf128665de9c3f493c7dfaef1ebe61af91a
[ "MIT" ]
null
null
null
tests/layer_test.py
esben/xd-tool
cb08adf128665de9c3f493c7dfaef1ebe61af91a
[ "MIT" ]
null
null
null
from xd.tool.layer import * from case import * import os import configparser class ManifestStub(object): def __init__(self, topdir, priority=None): self.topdir = topdir if priority is None: self.priority = {} else: self.priority = priority def get_priority(self, layer): return self.priority.get(layer) class tests(TestCase): def test_init_no_priority(self): os.mkdir('layer') config = configparser.ConfigParser() config.add_section('layer') with open(os.path.join('layer', '.xd'), 'w') as f: config.write(f) manifest = ManifestStub(self.testdir) layer = Layer(manifest, 'layer') def test_init_not_a_layer_1(self): os.mkdir('layer') config = configparser.ConfigParser() with open(os.path.join('layer', '.xd'), 'w') as f: config.write(f) manifest = ManifestStub(self.testdir) with self.assertRaises(NotALayer): layer = Layer(manifest, 'layer') def test_init_not_a_layer_2(self): os.mkdir('layer') manifest = ManifestStub(self.testdir) with self.assertRaises(NotALayer): layer = Layer(manifest, 'layer') def test_init_manifest_layer(self): config = configparser.ConfigParser() config.add_section('layer') with open('.xd', 'w') as f: config.write(f) manifest = ManifestStub(self.testdir) layer = Layer(manifest, '.') def test_priority(self): os.mkdir('layer') config = configparser.ConfigParser() config.add_section('layer') config['layer']['priority'] = '10' with open(os.path.join('layer', '.xd'), 'w') as f: config.write(f) manifest = ManifestStub(self.testdir) layer = Layer(manifest, 'layer') self.assertEqual(layer.priority(), 10) def test_no_priority(self): os.mkdir('layer') config = configparser.ConfigParser() config.add_section('layer') with open(os.path.join('layer', '.xd'), 'w') as f: config.write(f) manifest = ManifestStub(self.testdir) layer = Layer(manifest, 'layer') self.assertIsNone(layer.priority())
30.346667
58
0.59754
259
2,276
5.142857
0.189189
0.068318
0.108108
0.13964
0.714715
0.714715
0.714715
0.68018
0.68018
0.635886
0
0.003619
0.271529
2,276
74
59
30.756757
0.799759
0
0
0.590164
0
0
0.05536
0
0
0
0
0
0.065574
1
0.131148
false
0
0.065574
0.016393
0.245902
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
7e5a7eb8323c80ee4b6f88ffd98e6b0cef318857
940
py
Python
tensorblock/layers/layer_conv1d.py
bermeom/quadruped-robot
5570c720a27b26f94236ebc2ff41f0a1549f10b8
[ "MIT" ]
8
2018-12-19T17:30:10.000Z
2021-05-09T17:53:03.000Z
tensorblock/layers/layer_conv1d.py
bermeom/quadruped-robot
5570c720a27b26f94236ebc2ff41f0a1549f10b8
[ "MIT" ]
null
null
null
tensorblock/layers/layer_conv1d.py
bermeom/quadruped-robot
5570c720a27b26f94236ebc2ff41f0a1549f10b8
[ "MIT" ]
2
2020-10-06T01:56:30.000Z
2021-04-28T18:31:39.000Z
import numpy as np import tensorflow as tf import tensorblock as tb class layer_conv1d: ####### Data def name(): return 'Conv1D' def shapeMult(): return 1 def dims(): return 1 def allowPooling(): return True ####### Function def function( x , W , b , recipe , pars ): strides = pars['strides'] layer = tf.nn.conv1d( x , W , name = 'Conv1D' , stride = strides[0] , padding = pars['padding'] ) layer = tb.extras.bias( layer , b ) return [ layer ] , pars , None ####### Shapes def shapes( input_shape , pars ): in_channels = pars['in_channels'] out_channels = pars['out_channels'] ksize = pars['ksize'] weight_shape = [ ksize[0] , in_channels , out_channels ] bias_shape = [ out_channels ] return weight_shape , bias_shape
24.736842
65
0.525532
103
940
4.669903
0.407767
0.091476
0.04158
0.087318
0
0
0
0
0
0
0
0.013289
0.359574
940
37
66
25.405405
0.785714
0.021277
0
0
0
0
0.060201
0
0
0
0
0
0
1
0.272727
false
0
0.136364
0.181818
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
1
1
0
0
3
7e6897db8acb750502e28e0d0061e2f6f1e0fce9
2,247
py
Python
examples/patterns/saga/messages.py
acolley/protoactor-python
94bb4220bbef7a7cee50f6829fcf4d4362e487c6
[ "Apache-2.0" ]
76
2017-02-03T16:09:14.000Z
2021-08-05T03:27:42.000Z
examples/patterns/saga/messages.py
acolley/protoactor-python
94bb4220bbef7a7cee50f6829fcf4d4362e487c6
[ "Apache-2.0" ]
27
2017-02-14T13:38:47.000Z
2021-08-20T15:11:01.000Z
examples/patterns/saga/messages.py
acolley/protoactor-python
94bb4220bbef7a7cee50f6829fcf4d4362e487c6
[ "Apache-2.0" ]
12
2017-02-07T02:10:26.000Z
2020-09-26T10:50:03.000Z
import decimal from protoactor.actor import PID class AccountCredited: pass class AccountDebited: pass class ChangeBalance: def __init__(self, amount: decimal, reply_to: PID): self.amount = amount self.reply_to = reply_to class Credit(ChangeBalance): def __init__(self, amount: decimal, reply_to: PID): super().__init__(amount, reply_to) class CreditRefused: pass class Debit(ChangeBalance): def __init__(self, amount: decimal, reply_to: PID): super().__init__(amount, reply_to) class DebitRolledBack: pass class EscalateTransfer: def __init__(self, message: str): self._message = message @property def message(self): return self._message def __str__(self): return f'{self.__class__.__module__}.{self.__class__.__name__}: {self._message}' class Result(): def __init__(self, pid: PID): self.pid = pid class FailedAndInconsistent(Result): def __init__(self, pid: PID): super().__init__(pid) class FailedButConsistentResult(Result): def __init__(self, pid: PID): super().__init__(pid) class GetBalance: pass class InsufficientFunds: pass class InternalServerError: pass class OK: pass class Refused: pass class ServiceUnavailable: pass class StatusUnknown: pass class SuccessResult(Result): def __init__(self, pid: PID): super().__init__(pid) class TransferCompleted: def __init__(self, from_id: PID, from_balance: decimal, to: PID, to_balance: decimal): self.from_id = from_id self.from_balance = from_balance self.to = to self.to_balance = to_balance def __str__(self): return f'{self.__class__.__module__}.{self.__class__.__name__}: {self.from_id.id} balance is ' \ f'{self.from_balance}, {self.to.id} balance is {self.to_balance}' class TransferFailed(): def __init__(self, reason: str): self.reason = reason def __str__(self): return f'{self.__class__.__module__}.{self.__class__.__name__}: {self.reason}' class TransferStarted: pass class UnknownResult(Result): def __init__(self, pid: PID): super().__init__(pid)
17.976
104
0.668447
263
2,247
5.140684
0.186312
0.079882
0.089497
0.06287
0.384615
0.384615
0.367604
0.367604
0.367604
0.306953
0
0
0.228749
2,247
124
105
18.120968
0.78015
0
0
0.39726
0
0.013699
0.126391
0.072096
0
0
0
0
0
1
0.205479
false
0.164384
0.027397
0.054795
0.60274
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
7e71caf9b30f07fecb9464d89ccfca207a860f77
1,394
py
Python
test/test_zip_archive_api.py
Cloudmersive/Cloudmersive.APIClient.Python.Convert
dba2fe7257229ebdacd266531b3724552c651009
[ "Apache-2.0" ]
3
2018-07-25T23:04:34.000Z
2021-08-10T16:43:10.000Z
test/test_zip_archive_api.py
Cloudmersive/Cloudmersive.APIClient.Python.Convert
dba2fe7257229ebdacd266531b3724552c651009
[ "Apache-2.0" ]
3
2020-11-23T10:46:48.000Z
2021-12-30T14:09:34.000Z
test/test_zip_archive_api.py
Cloudmersive/Cloudmersive.APIClient.Python.Convert
dba2fe7257229ebdacd266531b3724552c651009
[ "Apache-2.0" ]
2
2020-01-07T09:48:01.000Z
2020-11-23T10:47:00.000Z
# coding: utf-8 """ convertapi Convert API lets you effortlessly convert file formats and types. # noqa: E501 OpenAPI spec version: v1 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import cloudmersive_convert_api_client from cloudmersive_convert_api_client.api.zip_archive_api import ZipArchiveApi # noqa: E501 from cloudmersive_convert_api_client.rest import ApiException class TestZipArchiveApi(unittest.TestCase): """ZipArchiveApi unit test stubs""" def setUp(self): self.api = cloudmersive_convert_api_client.api.zip_archive_api.ZipArchiveApi() # noqa: E501 def tearDown(self): pass def test_zip_archive_zip_create(self): """Test case for zip_archive_zip_create Compress files to create a new zip archive # noqa: E501 """ pass def test_zip_archive_zip_create_advanced(self): """Test case for zip_archive_zip_create_advanced Compress files and folders to create a new zip archive with advanced options # noqa: E501 """ pass def test_zip_archive_zip_extract(self): """Test case for zip_archive_zip_extract Extract, decompress files and folders from a zip archive # noqa: E501 """ pass if __name__ == '__main__': unittest.main()
24.892857
100
0.705165
179
1,394
5.201117
0.374302
0.118153
0.083781
0.120301
0.431794
0.352309
0.305048
0.236305
0
0
0
0.018553
0.226686
1,394
55
101
25.345455
0.845083
0.425395
0
0.222222
1
0
0.011429
0
0
0
0
0
0
1
0.277778
false
0.222222
0.277778
0
0.611111
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
3
7e76fd8fb7283a50d7fbce219308ac300d8adde1
389
py
Python
validator_api/bork_api/middleware.py
ging/fiware-validator
d9e58318817bdbb690ce960930a8d204f42b0fce
[ "Apache-2.0" ]
null
null
null
validator_api/bork_api/middleware.py
ging/fiware-validator
d9e58318817bdbb690ce960930a8d204f42b0fce
[ "Apache-2.0" ]
null
null
null
validator_api/bork_api/middleware.py
ging/fiware-validator
d9e58318817bdbb690ce960930a8d204f42b0fce
[ "Apache-2.0" ]
null
null
null
# coding=utf-8 from django.http import HttpResponse from idm_auth.exceptions import KeystoneAuthException class KeystoneAuthExceptionMiddleware(KeystoneAuthException): def process_exception(self, request, exception): if isinstance(exception, KeystoneAuthException) and exception.message == u"Invalid credentials.": return HttpResponse('Unauthorized', status=401)
38.9
105
0.789203
38
389
8.026316
0.789474
0
0
0
0
0
0
0
0
0
0
0.011905
0.136247
389
9
106
43.222222
0.895833
0.030848
0
0
0
0
0.085333
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.833333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
7ea515cb11c4be5614ba070ecda204eeb431718f
199
py
Python
3.py
en0/euler
3bbb857454dad09bc3caf996cef5717dab555d61
[ "Beerware" ]
null
null
null
3.py
en0/euler
3bbb857454dad09bc3caf996cef5717dab555d61
[ "Beerware" ]
null
null
null
3.py
en0/euler
3bbb857454dad09bc3caf996cef5717dab555d61
[ "Beerware" ]
null
null
null
from euler import elapsed_time, prime_factors from math import sqrt @elapsed_time() def solve(): return max(prime_factors(600851475143)) if __name__ == "__main__": print("ans:", solve())
16.583333
45
0.718593
26
199
5.038462
0.730769
0.167939
0
0
0
0
0
0
0
0
0
0.071856
0.160804
199
11
46
18.090909
0.712575
0
0
0
0
0
0.060302
0
0
0
0
0
0
1
0.142857
true
0
0.285714
0.142857
0.571429
0.142857
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
1
0
0
0
3
7eb1123d565b5fcd3c9fcd54b8f7161e41d3f406
12
py
Python
kpc/9.py
Lockdef/kyopro-code
2d943a87987af05122c556e173e5108a0c1c77c8
[ "MIT" ]
null
null
null
kpc/9.py
Lockdef/kyopro-code
2d943a87987af05122c556e173e5108a0c1c77c8
[ "MIT" ]
null
null
null
kpc/9.py
Lockdef/kyopro-code
2d943a87987af05122c556e173e5108a0c1c77c8
[ "MIT" ]
null
null
null
s = input()
6
11
0.5
2
12
3
1
0
0
0
0
0
0
0
0
0
0
0
0.25
12
1
12
12
0.666667
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0e2097aa09dd72abcbfcdf97d4854683deb1de3d
1,029
py
Python
tapioca_zendesk/tapioca_zendesk.py
nossas/bonde-zendesk
0b3b1e7d3c9a88b5d836f22496c630e719248eaa
[ "MIT" ]
null
null
null
tapioca_zendesk/tapioca_zendesk.py
nossas/bonde-zendesk
0b3b1e7d3c9a88b5d836f22496c630e719248eaa
[ "MIT" ]
5
2019-07-23T18:20:52.000Z
2019-11-26T18:39:42.000Z
tapioca_zendesk/tapioca_zendesk.py
nossas/bonde-zendesk
0b3b1e7d3c9a88b5d836f22496c630e719248eaa
[ "MIT" ]
null
null
null
# coding: utf-8 from tapioca import ( TapiocaAdapter, generate_wrapper_from_adapter, JSONAdapterMixin) from .resource_mapping import RESOURCE_MAPPING import os ZENDESK_API_ROOT = os.getenv('ZENDESK_API_ROOT') assert ZENDESK_API_ROOT is not None, 'ZENDESK_API_ROOT not environment.' class ZendeskClientAdapter(JSONAdapterMixin, TapiocaAdapter): api_root = ZENDESK_API_ROOT resource_mapping = RESOURCE_MAPPING def get_request_kwargs(self, api_params, *args, **kwargs): params = super(ZendeskClientAdapter, self).get_request_kwargs( api_params, *args, **kwargs) auth = (api_params.get('user') + '/token', api_params.get('password')) params['auth'] = auth return params def get_iterator_list(self, response_data): return response_data def get_iterator_next_request_kwargs(self, iterator_request_kwargs, response_data, response): pass Zendesk = generate_wrapper_from_adapter(ZendeskClientAdapter)
29.4
78
0.717201
118
1,029
5.915254
0.372881
0.060172
0.100287
0.074499
0
0
0
0
0
0
0
0.001221
0.204082
1,029
34
79
30.264706
0.851038
0.012634
0
0
1
0
0.07002
0
0
0
0
0
0.047619
1
0.142857
false
0.095238
0.142857
0.047619
0.52381
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
3
0e2ae8e4aa113c3eafb3edb510e45d53419b82b0
734
py
Python
daemons/prefab/eventletd.py
alexdelorenzo/daemons
1fe2c9886f76f51e1e459fe97f2ac360869deb19
[ "Apache-2.0" ]
50
2015-06-18T18:25:27.000Z
2022-02-08T22:29:09.000Z
daemons/prefab/eventletd.py
alexdelorenzo/daemons
1fe2c9886f76f51e1e459fe97f2ac360869deb19
[ "Apache-2.0" ]
9
2015-11-27T14:39:58.000Z
2021-05-21T19:18:16.000Z
daemons/prefab/eventletd.py
alexdelorenzo/daemons
1fe2c9886f76f51e1e459fe97f2ac360869deb19
[ "Apache-2.0" ]
16
2015-10-17T19:10:55.000Z
2021-05-20T05:48:51.000Z
"""Eventlet message daemon missing get_message and handle_message.""" from __future__ import division from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from ..daemonize import simple as simple_daemonize from ..pid import simple as simple_pid from ..signal import simple as simple_signal from ..startstop import simple as simple_startstop from ..message import eventlet as eventletd class EventletDaemon( simple_pid.SimplePidManager, simple_signal.SimpleSignalManager, simple_daemonize.SimpleDaemonizeManager, simple_startstop.SimpleStartStopStepManager, eventletd.EventletMessageManager, ): """Message daemon which leverages eventlet."""
30.583333
69
0.820163
83
734
6.903614
0.385542
0.069808
0.111693
0.139616
0
0
0
0
0
0
0
0
0.129428
734
23
70
31.913043
0.896714
0.141689
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5625
0
0.625
0.0625
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
0e4b38e264110169c8cdfea25d5ef269b12cfa6d
107
py
Python
tempfile.py
hodges1311/cs3240-labdemo
a7c2ca0303e60ebc1555a2dd030b48796a4e0064
[ "MIT" ]
null
null
null
tempfile.py
hodges1311/cs3240-labdemo
a7c2ca0303e60ebc1555a2dd030b48796a4e0064
[ "MIT" ]
null
null
null
tempfile.py
hodges1311/cs3240-labdemo
a7c2ca0303e60ebc1555a2dd030b48796a4e0064
[ "MIT" ]
null
null
null
import helper if __name__ == '__main__': greeting("hey") greeting("what up") greeting("AYYY")
15.285714
26
0.626168
12
107
4.916667
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.214953
107
6
27
17.833333
0.702381
0
0
0
0
0
0.205607
0
0
0
0
0
0
1
0
true
0
0.2
0
0.2
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
0e4d161791cafa6177484dc5ea9280a0669bd137
847
py
Python
src/core/entity.py
seadavis/StoryNode
e863e68e4b95b92a074554c2399492dbfb54cbab
[ "Apache-2.0" ]
null
null
null
src/core/entity.py
seadavis/StoryNode
e863e68e4b95b92a074554c2399492dbfb54cbab
[ "Apache-2.0" ]
null
null
null
src/core/entity.py
seadavis/StoryNode
e863e68e4b95b92a074554c2399492dbfb54cbab
[ "Apache-2.0" ]
null
null
null
""" Class for holding and accessing a "Named Entity" for a relation """ class NamedEntity: def __init__(self, entity, doc): self.entity = entity """ Gets the type of entity this object represents. "PERSON", "ORG", etc. """ @property def entity_type(self): return None """ Gets the text span of this entity, referring to the original document """ @property def text(self): return None """ Holds a set of entities, not necessarily from the same collection This is an immutable collection """ class NamedEntityCollection: def __init__(self, entities): self.entities = self.entities def join(self, other): return [] def get_entity(self, span): return None def get_entityies_by_type(self, type): return None
17.645833
65
0.624557
104
847
4.961538
0.480769
0.077519
0.042636
0.093023
0
0
0
0
0
0
0
0
0.288076
847
47
66
18.021277
0.855721
0.07438
0
0.333333
0
0
0
0
0
0
0
0
0
1
0.388889
false
0
0
0.277778
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
1
1
0
0
3
0e550f47080631ee026f4c79cf607f78235d16b0
1,172
py
Python
evidently/profile_sections/cat_target_drift_profile_section.py
QAtestinc/evidently
2b3a753c6eb22a4c66dad11756d4ca361b2f58dd
[ "Apache-2.0" ]
1
2021-09-08T15:05:48.000Z
2021-09-08T15:05:48.000Z
evidently/profile_sections/cat_target_drift_profile_section.py
QAtestinc/evidently
2b3a753c6eb22a4c66dad11756d4ca361b2f58dd
[ "Apache-2.0" ]
null
null
null
evidently/profile_sections/cat_target_drift_profile_section.py
QAtestinc/evidently
2b3a753c6eb22a4c66dad11756d4ca361b2f58dd
[ "Apache-2.0" ]
null
null
null
from datetime import datetime import json from evidently.analyzers.cat_target_drift_analyzer import CatTargetDriftAnalyzer from evidently.profile_sections.base_profile_section import ProfileSection class CatTargetDriftProfileSection(ProfileSection): def part_id(self) -> str: return 'cat_target_drift' def __init__(self): super().__init__() self.analyzers_types = [CatTargetDriftAnalyzer] def analyzers(self): return self.analyzers_types def calculate(self, analyzers_results): result = analyzers_results[CatTargetDriftAnalyzer] profile = {} profile['name'] = self.part_id() profile['datetime'] = str(datetime.now()) profile['data'] = result #if target_p_value: #profile['data']['target_drift'] = { # 'target': target_name, # 'target_type':'cat', # 'p_value':target_p_value #} #if prediction_p_value: #profile['data']['prediction_drift'] = { # 'prediction': prediction_name, # 'prediction_type':'cat', # 'p_value':prediction_p_value #} return profile
27.255814
80
0.638225
115
1,172
6.173913
0.330435
0.050704
0.039437
0.047887
0
0
0
0
0
0
0
0
0.255119
1,172
42
81
27.904762
0.813288
0.245734
0
0
0
0
0.036697
0
0
0
0
0
0
1
0.210526
false
0
0.210526
0.105263
0.631579
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
0e583159c04496364dadc30368cb31b9649c5aa1
227
py
Python
RuleBasedABSA/ABSA/sentiment_predict.py
xiaobuguilaile/target-social-ABSA-system
529df1a56d49e630e69c1fb5e602f07ca4476f9b
[ "MIT" ]
null
null
null
RuleBasedABSA/ABSA/sentiment_predict.py
xiaobuguilaile/target-social-ABSA-system
529df1a56d49e630e69c1fb5e602f07ca4476f9b
[ "MIT" ]
null
null
null
RuleBasedABSA/ABSA/sentiment_predict.py
xiaobuguilaile/target-social-ABSA-system
529df1a56d49e630e69c1fb5e602f07ca4476f9b
[ "MIT" ]
null
null
null
#!/anaconda3/envs/nlp python3.8 # -*- coding: utf-8 -*- # --- # @File: sentiment_predict.py # @Author: HW Shen # @Time: 9月 15, 2020 # --- class SentimentModel(object): def __init__(self): self.gloveEmbedding = 0
16.214286
31
0.61674
28
227
4.821429
0.928571
0
0
0
0
0
0
0
0
0
0
0.065934
0.198238
227
14
32
16.214286
0.675824
0.546256
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
0e7a1c54e16571a4de84577edd2b3d6788bf29a5
223
py
Python
test.py
yaogdu/xiaozu_spider
0cc069ee0926faf5fb53e9b36c76729e85b47cf1
[ "MIT" ]
null
null
null
test.py
yaogdu/xiaozu_spider
0cc069ee0926faf5fb53e9b36c76729e85b47cf1
[ "MIT" ]
null
null
null
test.py
yaogdu/xiaozu_spider
0cc069ee0926faf5fb53e9b36c76729e85b47cf1
[ "MIT" ]
null
null
null
DB={'address':'127.0.0.1:27017','db':'douban','col':'posts','replicaSet':'dmmongo'} skip = [',','.',':',';','<','>','/','&','#'] url = 'https://www.douban.com/group/fangzi/discussion?start=100' print url.split('=').pop(0)
37.166667
83
0.55157
29
223
4.241379
0.827586
0
0
0
0
0
0
0
0
0
0
0.070423
0.044843
223
6
84
37.166667
0.507042
0
0
0
0
0
0.540179
0
0
0
0
0
0
0
null
null
0
0
null
null
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
7ebd0c4fa826e82b57ddd8109eadcf67629779f4
146
py
Python
matlab_ext/measurement/mc-assistant/projects/py_conv_apps/test_Usm.py
zaqwes8811/coordinator-tasks
7f63fdf613eff5d441a3c2c7b52d2a3d02d9736a
[ "MIT" ]
null
null
null
matlab_ext/measurement/mc-assistant/projects/py_conv_apps/test_Usm.py
zaqwes8811/coordinator-tasks
7f63fdf613eff5d441a3c2c7b52d2a3d02d9736a
[ "MIT" ]
15
2015-03-07T12:46:41.000Z
2015-04-11T09:08:36.000Z
matlab_ext/measurement/mc-assistant/projects/py_conv_apps/test_Usm.py
zaqwes8811/micro-apps
7f63fdf613eff5d441a3c2c7b52d2a3d02d9736a
[ "MIT" ]
null
null
null
#!/usr/bin/python #-*- coding: utf-8 -*- T = 15 maxVal = 4000 valWORD = 4045 noCorr = 4.6*valWORD/maxVal Corr = noCorr-(4.9*5*1e-3)*T print Corr
16.222222
28
0.636986
28
146
3.357143
0.785714
0.148936
0
0
0
0
0
0
0
0
0
0.145161
0.150685
146
8
29
18.25
0.604839
0.253425
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0.166667
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
7d47cfb69f08a23e7fb661473340cefcc7a249cc
377
py
Python
experiments/0.8/crosscompute/symmetries.py
kashfifahim/crosscompute
9ac6218265348e337a0e50554d861211c42dc46a
[ "MIT" ]
11
2016-05-23T08:44:22.000Z
2022-03-01T21:11:11.000Z
experiments/0.8/crosscompute/symmetries.py
kashfifahim/crosscompute
9ac6218265348e337a0e50554d861211c42dc46a
[ "MIT" ]
40
2016-03-19T14:11:55.000Z
2022-03-18T00:26:53.000Z
experiments/0.8/crosscompute/symmetries.py
kashfifahim/crosscompute
9ac6218265348e337a0e50554d861211c42dc46a
[ "MIT" ]
6
2016-04-02T16:44:06.000Z
2022-01-23T01:26:58.000Z
try: from functools import cache except ImportError: from functools import lru_cache def cache(f): return lru_cache(maxsize=None)(f) import shlex try: join_command_terms = shlex.join except AttributeError: def join_command_terms(terms): return ' '.join(shlex.quote(_) for _ in terms) from urllib.request import urlretrieve as download
18.85
54
0.718833
50
377
5.26
0.52
0.098859
0.144487
0
0
0
0
0
0
0
0
0
0.212202
377
19
55
19.842105
0.885522
0
0
0.153846
0
0
0.002653
0
0
0
0
0
0
1
0.153846
false
0
0.384615
0.153846
0.692308
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
3
7d4ab0471bb02b2085a064a0dc7cd8ae7e3f598b
1,170
gyp
Python
ios/net/ios_net_unittests.gyp
Wzzzx/chromium-crosswalk
768dde8efa71169f1c1113ca6ef322f1e8c9e7de
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
2
2019-01-28T08:09:58.000Z
2021-11-15T15:32:10.000Z
ios/net/ios_net_unittests.gyp
maidiHaitai/haitaibrowser
a232a56bcfb177913a14210e7733e0ea83a6b18d
[ "BSD-3-Clause" ]
null
null
null
ios/net/ios_net_unittests.gyp
maidiHaitai/haitaibrowser
a232a56bcfb177913a14210e7733e0ea83a6b18d
[ "BSD-3-Clause" ]
6
2020-09-23T08:56:12.000Z
2021-11-18T03:40:49.000Z
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'targets': [ { # GN version: //ios/net:ios_net_unittests 'target_name': 'ios_net_unittests', 'type': '<(gtest_target_type)', 'dependencies': [ '../../base/base.gyp:base', '../../base/base.gyp:run_all_unittests', '../../net/net.gyp:net_test_support', '../../testing/gtest.gyp:gtest', '../../url/url.gyp:url_lib', 'ios_net.gyp:ios_net', ], 'include_dirs': [ '../..', ], 'sources': [ 'clients/crn_forwarding_network_client_factory_unittest.mm', 'cookies/cookie_cache_unittest.cc', 'cookies/cookie_creation_time_manager_unittest.mm', 'cookies/cookie_store_ios_unittest.mm', 'cookies/system_cookie_util_unittest.mm', 'http_response_headers_util_unittest.mm', 'nsurlrequest_util_unittest.mm', 'protocol_handler_util_unittest.mm', 'url_scheme_util_unittest.mm', ], }, ], }
30.789474
72
0.608547
135
1,170
4.940741
0.555556
0.11994
0.104948
0.068966
0
0
0
0
0
0
0
0.005599
0.236752
1,170
37
73
31.621622
0.741321
0.166667
0
0.121212
0
0
0.642268
0.502062
0
0
0
0
0
1
0
true
0
0
0
0
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
1
0
0
0
0
0
0
3
ada3712fe7e29c2e1dd27fa724b718282baeb2fb
233
py
Python
tests/drf_project/drf_users/urls.py
unistra/djangorestframework-spore
cf9c4d3372a5d3ef53dc7f443fea3d04d931126d
[ "BSD-2-Clause" ]
1
2021-01-13T02:37:19.000Z
2021-01-13T02:37:19.000Z
tests/drf_project/drf_users/urls.py
unistra/djangorestframework-spore
cf9c4d3372a5d3ef53dc7f443fea3d04d931126d
[ "BSD-2-Clause" ]
null
null
null
tests/drf_project/drf_users/urls.py
unistra/djangorestframework-spore
cf9c4d3372a5d3ef53dc7f443fea3d04d931126d
[ "BSD-2-Clause" ]
1
2020-09-16T00:52:36.000Z
2020-09-16T00:52:36.000Z
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.ListCreateUsers.as_view(), name='list_create_users'), url(r'^$', views.ListCreateSuperUsers.as_view(), name='list_create_super_users') ]
25.888889
84
0.72103
31
233
5.193548
0.580645
0.049689
0.111801
0.173913
0.248447
0
0
0
0
0
0
0
0.120172
233
8
85
29.125
0.785366
0
0
0
0
0
0.188841
0.098712
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ada819eb83d936c2b9da121429ab8ed76029845f
685
py
Python
scripts/crimson_mutator/modules/url_encoding.py
upenderadepu/crimson
00916e4adf63f870b85af00ba40541fef0631204
[ "Apache-2.0" ]
108
2021-03-16T00:22:59.000Z
2022-03-28T08:22:14.000Z
scripts/crimson_mutator/modules/url_encoding.py
FDlucifer/crimson
78762c1f471711e500683cbe69a70eb6a483bf42
[ "Apache-2.0" ]
2
2021-09-03T09:24:59.000Z
2022-01-14T05:45:24.000Z
scripts/crimson_mutator/modules/url_encoding.py
FDlucifer/crimson
78762c1f471711e500683cbe69a70eb6a483bf42
[ "Apache-2.0" ]
38
2021-03-16T05:22:32.000Z
2022-02-24T16:52:31.000Z
# from url_encoding import make_url # full url encoding import urllib try: # Python2 and python3 comatible code from urllib.parse import urlparse except ImportError: from urlparse import urlparse def make_url(string): '''Encode every char in percentage format''' return "".join("%{0:0>2}".format(format(ord(char), "x")) for char in string) def make_plus(string): new_string = "" for letter in string: if letter == " ": new_string+="+" else: new_string+=letter return new_string def make_plus_encoded(string): return urllib.quote_plus(string) def make_key_url(string): return urllib.quote(string)
19.571429
80
0.667153
92
685
4.826087
0.434783
0.063063
0.087838
0.076577
0
0
0
0
0
0
0
0.009506
0.232117
685
34
81
20.147059
0.834601
0.183942
0
0
0
0
0.020036
0
0
0
0
0
0
1
0.210526
false
0
0.210526
0.105263
0.631579
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
adc1e40381484c21b05d70f17cdd1b44580145ac
485
py
Python
plugins/wx/__init__.py
bruceravel/xraylarch
a8179208872d43bd23453fa0c64680e11bc2b5ed
[ "BSD-3-Clause" ]
null
null
null
plugins/wx/__init__.py
bruceravel/xraylarch
a8179208872d43bd23453fa0c64680e11bc2b5ed
[ "BSD-3-Clause" ]
null
null
null
plugins/wx/__init__.py
bruceravel/xraylarch
a8179208872d43bd23453fa0c64680e11bc2b5ed
[ "BSD-3-Clause" ]
null
null
null
from . import gui_utils from .parameter import ParameterPanel from .plotter import _newplot, _plot from .periodictable import PeriodicTablePanel from .xrfdisplay import XRFDisplayFrame, XRFApp, FILE_WILDCARDS from .xrfdisplay_utils import XRFCalibrationFrame from .xrddisplay import XRD1D_DisplayFrame, XRDApp, XRD2D_DisplayFrame from .gse_dtcorrect import DTViewer from .xyfit import XYFitViewer from .scanviewer import ScanViewer # backward compat! from .mapviewer import MapViewer
40.416667
70
0.853608
56
485
7.25
0.553571
0.068966
0
0
0
0
0
0
0
0
0
0.00463
0.109278
485
11
71
44.090909
0.935185
0.03299
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
bc2678e8e096ce440c1d894e9b01cab3c1b78314
322
py
Python
python/src/main/python/pyalink/alink/tests/examples/from_docs/test_randomvectorsourcestreamop.py
wenwei8268/Alink
c00702538c95a32403985ebd344eb6aeb81749a7
[ "Apache-2.0" ]
null
null
null
python/src/main/python/pyalink/alink/tests/examples/from_docs/test_randomvectorsourcestreamop.py
wenwei8268/Alink
c00702538c95a32403985ebd344eb6aeb81749a7
[ "Apache-2.0" ]
null
null
null
python/src/main/python/pyalink/alink/tests/examples/from_docs/test_randomvectorsourcestreamop.py
wenwei8268/Alink
c00702538c95a32403985ebd344eb6aeb81749a7
[ "Apache-2.0" ]
null
null
null
import unittest from pyalink.alink import * import numpy as np import pandas as pd class TestRandomVectorSourceStreamOp(unittest.TestCase): def test_randomvectorsourcestreamop(self): RandomVectorSourceStreamOp().setMaxRows(5).setSize([2]).setSparsity(1.0).print() StreamOperator.execute() pass
32.2
88
0.757764
34
322
7.147059
0.823529
0
0
0
0
0
0
0
0
0
0
0.014652
0.152174
322
10
89
32.2
0.875458
0
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
false
0.111111
0.444444
0
0.666667
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
1
1
0
1
0
0
3
bc2c7091c3b66ba61ae034820e013f1cfdbdfb81
646
py
Python
modules/math-codes/modules/statistics-and-probability/src/most_common-v2.py
drigols/Studies
9c293156935b491ded24be6b511daac67fd43538
[ "MIT" ]
1
2020-09-06T22:17:19.000Z
2020-09-06T22:17:19.000Z
modules/math-codes/modules/statistics-and-probability/src/most_common-v2.py
drigols/Studies
9c293156935b491ded24be6b511daac67fd43538
[ "MIT" ]
null
null
null
modules/math-codes/modules/statistics-and-probability/src/most_common-v2.py
drigols/Studies
9c293156935b491ded24be6b511daac67fd43538
[ "MIT" ]
null
null
null
######################################################## # Rodrigo Leite - drigols # # Last update: 17/12/2021 # ######################################################## from collections import Counter simplelist = [7, 8, 9, 2, 10, 9, 9, 9, 9, 4, 5, 6, 1, 5, 6, 7, 8, 6, 1, 10] c = Counter(simplelist) print(c.most_common()) # Retorna a lista com todos os mais comuns. print(c.most_common(1)) # Retorna o primeiro elemento mais comum. print(c.most_common(2)) # Retorna os dois primeiros elementos mais comuns print(c.most_common(3)) # Retorna os três primeiros elementos mais comuns.
40.375
75
0.517028
83
646
3.975904
0.518072
0.072727
0.121212
0.193939
0.157576
0.157576
0
0
0
0
0
0.065217
0.216718
646
15
76
43.066667
0.586957
0.442724
0
0
0
0
0
0
0
0
0
0.066667
0
1
0
false
0
0.142857
0
0.142857
0.571429
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
1
0
0
0
0
0
0
0
0
1
0
3
bc35fdacd26dd2e80e03d6fb53a893e2d82def7b
550
py
Python
xmltv/xmltvchannel.py
crdavis12/script.module.sd4tvh
4ad9539900a58befc017c07b8fcaf7bc1d4e3141
[ "MIT" ]
null
null
null
xmltv/xmltvchannel.py
crdavis12/script.module.sd4tvh
4ad9539900a58befc017c07b8fcaf7bc1d4e3141
[ "MIT" ]
null
null
null
xmltv/xmltvchannel.py
crdavis12/script.module.sd4tvh
4ad9539900a58befc017c07b8fcaf7bc1d4e3141
[ "MIT" ]
null
null
null
import logging import xml.etree.ElementTree as ET from xml.etree.ElementTree import Element, SubElement from . import indent class XmltvChannel(object): def __init__(self, channel_id): self._logger = logging.getLogger(__name__) self.root = Element(u"channel", {u"id": channel_id}) def add_display_name(self, display_name): SubElement(self.root, u"display-name").text = display_name def save(self, fp, encoding=u"utf-8"): indent(self.root) ET.ElementTree(self.root).write(fp, encoding=encoding)
30.555556
66
0.705455
75
550
4.973333
0.44
0.085791
0.101877
0
0
0
0
0
0
0
0
0.002212
0.178182
550
17
67
32.352941
0.823009
0
0
0
0
0
0.047273
0
0
0
0
0
0
1
0.230769
false
0
0.307692
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
1
0
1
0
0
3
bc3a4b950b950c9a96e9b4fc76a3a8473e48afb9
75
py
Python
dkr-py310/docker-student-portal-310/course_files/data_sci_mini/test.py
pbarton666/virtual_classroom
a9d0dc2eb16ebc4d2fd451c3a3e6f96e37c87675
[ "MIT" ]
null
null
null
dkr-py310/docker-student-portal-310/course_files/data_sci_mini/test.py
pbarton666/virtual_classroom
a9d0dc2eb16ebc4d2fd451c3a3e6f96e37c87675
[ "MIT" ]
null
null
null
dkr-py310/docker-student-portal-310/course_files/data_sci_mini/test.py
pbarton666/virtual_classroom
a9d0dc2eb16ebc4d2fd451c3a3e6f96e37c87675
[ "MIT" ]
null
null
null
import numpy as np a=np.fromstring('1, 2, 3, 4, 5', dtype=int, sep=',') x=1
25
52
0.613333
17
75
2.705882
0.882353
0
0
0
0
0
0
0
0
0
0
0.09375
0.146667
75
3
53
25
0.625
0
0
0
0
0
0.184211
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
70d341a08f5857d9b870a0459d7e95dd0cb73ad5
3,093
py
Python
electrum_client/requests.py
tylerchambers/electrum-client
58a6d973b7f2e27c72c37d1bc8e1c4d0efac14f5
[ "MIT" ]
null
null
null
electrum_client/requests.py
tylerchambers/electrum-client
58a6d973b7f2e27c72c37d1bc8e1c4d0efac14f5
[ "MIT" ]
null
null
null
electrum_client/requests.py
tylerchambers/electrum-client
58a6d973b7f2e27c72c37d1bc8e1c4d0efac14f5
[ "MIT" ]
null
null
null
import json class Request: jsonrpc = "2.0" def __init__(self, method: str, params: list): self.method = method self.params = params def set_id(self, id: int): self.id = id def to_json(self) -> str: return json.dumps(self.__dict__) class BlockHeaderRequest(Request): def __init__(self, height: int) -> None: super().__init__("blockchain.block.header", [height]) class BlockHeadersRequest(Request): def __init__(self, start_height: int, count: int) -> None: super().__init__("blockchain.block.headers", [start_height, count]) class FeeEstimateRequest(Request): def __init__(self, nblocks: int) -> None: super().__init__("blockchain.estimatefee", [nblocks]) class HeadersSubscribeRequest(Request): def __init__(self): super().__init__("blockchain.headers.subscribe", []) class RelayFeeRequest(Request): def __init__(self): super().__init__("blockchain.relayfee", []) class GetScriptHashBalanceRequest(Request): def __init__(self, script_hash: str) -> None: super().__init__("blockchain.scripthash.get_balance", [script_hash]) class GetScriptHashHistoryRequest(Request): def __init__(self, script_hash: str) -> None: super().__init__("blockchain.scripthash.get_history", [script_hash]) class ListUnspentRequest(Request): def __init__(self, script_hash: str) -> None: super().__init__("blockchain.scripthash.listunspent", [script_hash]) class ScriptHashSubscriptionRequest(Request): def __init__(self, script_hash: str): super().__init__("blockchain.scripthash.subscribe", [script_hash]) class TransactionBroadcastRequest(Request): def __init__(self, tx_hex: str) -> None: super().__init__("blockchain.transaction.broadcast", [tx_hex]) class TransactionGetRequest(Request): def __init__(self, txid: str, verbose: bool) -> None: super().__init__("blockchain.transaction.get", [txid, verbose]) class TransactionMerkleRequest(Request): def __init__(self, txid: str, height: int) -> None: super().__init__("blockchain.transaction.get_merkle", [txid, height]) class MempoolFeeHistogramRequest(Request): def __init__(self) -> None: super().__init__("mempool.get_fee_histogram", []) class ServerBannerRequest(Request): def __init__(self) -> None: super().__init__("server.banner", []) class ServerDonationAddressRequest(Request): def __init__(self) -> None: super().__init__("server.donation_address", []) class ServerFeaturesRequest(Request): def __init__(self) -> None: super().__init__("server.features", []) class ServerPeersRequest(Request): def __init__(self) -> None: super().__init__("server.peers.subscribe", []) class ServerPingRequest(Request): def __init__(self) -> None: super().__init__("server.ping", []) class ServerVersionRequest(Request): def __init__(self, client_id: str, client_version: str) -> None: super().__init__("server.version", [client_id, client_version])
27.864865
77
0.688652
323
3,093
6.024768
0.247678
0.071942
0.113052
0.175745
0.402364
0.36999
0.266701
0.196814
0.101747
0.101747
0
0.000781
0.171678
3,093
110
78
28.118182
0.758782
0
0
0.164179
0
0
0.149693
0.125445
0
0
0
0
0
1
0.328358
false
0
0.014925
0.014925
0.671642
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
70f0abd244434dd63628924cfb5326280ee8c2c0
314
py
Python
techreviewproj/pythonclub/clubapp/forms.py
yonny23/techreviewproject
3a58c08c194eacedaa9b3bf3942149b24f3e2b28
[ "Apache-2.0" ]
null
null
null
techreviewproj/pythonclub/clubapp/forms.py
yonny23/techreviewproject
3a58c08c194eacedaa9b3bf3942149b24f3e2b28
[ "Apache-2.0" ]
null
null
null
techreviewproj/pythonclub/clubapp/forms.py
yonny23/techreviewproject
3a58c08c194eacedaa9b3bf3942149b24f3e2b28
[ "Apache-2.0" ]
null
null
null
from django import forms from .models import MeetingType, Greet, MeetingMinute, Resource, Event class ResourceForm(forms.ModelForm): class Meta: model=Resource fields='__all__' class GreetForm(forms.ModelForm): class Meta: model=Greet fields='__all__'
18.470588
71
0.652866
32
314
6.15625
0.5625
0.142132
0.192893
0.233503
0.284264
0
0
0
0
0
0
0
0.273885
314
16
72
19.625
0.864035
0
0
0.4
0
0
0.047619
0
0
0
0
0
0
1
0
false
0
0.2
0
0.6
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
70f53fd475d7b31e00fbc6e55fd332b8339c1fd0
777
py
Python
nekbot/core/signals.py
Nekmo/nekbot-mirai
a7a9934fb828f6a9ca11d627f46cf9568df6b917
[ "MIT" ]
null
null
null
nekbot/core/signals.py
Nekmo/nekbot-mirai
a7a9934fb828f6a9ca11d627f46cf9568df6b917
[ "MIT" ]
null
null
null
nekbot/core/signals.py
Nekmo/nekbot-mirai
a7a9934fb828f6a9ca11d627f46cf9568df6b917
[ "MIT" ]
null
null
null
# coding=utf-8 from collections import defaultdict import threading __author__ = 'nekmo' class Events(defaultdict): def __init__(self): super(Events, self).__init__(list) def propagate(self, event, *args, **kwargs): if not event in self: return for function in self[event]: # TODO: Es necesario limitar el tiempo, hacer workers... l = threading.Thread(target=function, args=args, kwargs=kwargs) l.start() events = Events() def event(event_name): """Decorador para que se ejecute una función con un determinado evento. Uso: @event('mievento') def function(): pass """ def decorator(f): events[event_name].append(f) return f return decorator
25.064516
75
0.624196
93
777
5.064516
0.612903
0.038217
0
0
0
0
0
0
0
0
0
0.001773
0.274131
777
31
76
25.064516
0.833333
0.256113
0
0
0
0
0.009074
0
0
0
0
0.032258
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
1
0
0
1
0
0
0
0
1
0
0
3
cb095c1da7a9a0e3b8a256fd02d9f61b5371a77c
5,260
py
Python
workspace/git.py
markovandooren/conan-workspace
17ada9a8a40b5bc3d42546416d29cb3524f791e8
[ "MIT" ]
null
null
null
workspace/git.py
markovandooren/conan-workspace
17ada9a8a40b5bc3d42546416d29cb3524f791e8
[ "MIT" ]
null
null
null
workspace/git.py
markovandooren/conan-workspace
17ada9a8a40b5bc3d42546416d29cb3524f791e8
[ "MIT" ]
null
null
null
import subprocess class Git: def __init__(self, directory): self.directory = directory def git_run(self, args): return subprocess.run(['git'] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=self.directory) def decode_stdout(self, completed_process): return completed_process.stdout.rstrip().decode('utf-8') def git(self, args): return self.decode_stdout(self.git_run(args)) def add(self, file): return self.git(['add', file]) def commit(self, message): self.git(['commit', '-m', message]) def revision(self): return self.revision_of('HEAD') def is_ancestor(self, potential_ancestor, commit): completed_process = self.git_run(['merge-base', '--is-ancestor', potential_ancestor, commit]) return completed_process.returncode == 0 def contains(self, revision): return self.is_ancestor(revision, self.revision()) def is_dirty(self): completed_process = self.git_run(['diff', '--quiet', 'HEAD']) return completed_process.returncode != 0 def revision_of(self, branch_name): return self.git(['rev-parse', branch_name]) def branch(self): branch = self.git(['rev-parse', '--symbolic-full-name', '--abbrev-ref', 'HEAD']) if branch == 'HEAD': return None else: return branch def sequence_in_branch(self): """ Return the sequence number in the branch. Note that this number is unique only within a certain branch. :return: The number of commits from HEAD until the first commit of the repository. """ sequence_in_branch_string = self.git(['rev-list', '--count', '--first-parent', 'HEAD']) return int(sequence_in_branch_string) def current_branches(self): return self.local_branches_of(self.revision()) def local_branches_of(self, hash): branches = self.git(['branch', '--format="%(refname)"', '--points-at', hash]).split('\n') result = [branch[12:-1] for branch in branches if branch.startswith('"refs/heads/')] return result def upstream_branch(self): completed_process = self.git_run(['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}']) if completed_process.returncode == 0: return self.decode_stdout(completed_process) else: return None def local_branches(self): local_branches = self.git(['branch', '--list', '--format="%(refname)"']).split('\n') result = [branch[12:-1] for branch in local_branches if branch.startswith('"refs/heads/')] return result def full_remote_branches(self): remote_branches = self.git(['branch', '--list', '--remotes', '--format="%(refname)"']).split('\n') result = [branch for branch in remote_branches if branch != 'refs/remotes/origin/HEAD'] return result def full_remote_branch_of(self, branch_name): return 'refs/remotes/origin/' + branch_name def remote_branches(self): result = [branch[21:-1] for branch in self.full_remote_branches()] return result def remote_branches_containing(self, commit): dictionary = {branch:self.revision_of(self.full_remote_branch_of(branch)) for branch in self.remote_branches()} return {branch: revision for branch, revision in dictionary if self.is_ancestor(commit, revision)} def most_stable_remote_branch_containing(self, commit): """ Return the short name of the most stable branch that contains the given commit and its revision. """ dictionary = self.remote_branches_containing(commit) most_stable_branch = None most_stable_revision = None for branch, revision in dictionary: if not most_stable_revision or self.is_ancestor(most_stable_revision, revision): most_stable_revision = revision most_stable_branch = branch return most_stable_branch, most_stable_revision def remotes(self): """ Return the remotes. """ remotes = self.git(['remote']).split('\n') result = [remote for remote in remotes if remote and len(remote) > 0] return result def has_remote(self): return len(self.remotes()) > 0 def create_branch(self, name): self.git(['checkout', '-b', name]) def checkout_branch(self, name): self.git(['checkout', name]) def force_create_branch(self, name, revision): """ Force create a branch with the given name at the given revision. Set the upstream if there is a matching branch. """ self.get(['branch', '-f', '-b', name, revision]) self.checkout_branch(name) if name in self.remote_branches(): self.set_upstream() def push(self): if self.upstream_branch(): self.git(['push']) else: self.set_upstream() self.git(['push']) def set_upstream(self): self.git(['branch', '--set-upstream', 'origin', self.branch()]) def checkout(self, revision): self.git(['checkout', revision]) def fetch(self): self.git(['fetch'])
35.302013
119
0.627376
644
5,260
4.967391
0.186335
0.043764
0.017193
0.021569
0.211629
0.163176
0.051266
0.051266
0.051266
0
0
0.00377
0.243536
5,260
148
120
35.540541
0.800201
0.079087
0
0.141414
0
0
0.098983
0.01844
0
0
0
0
0
1
0.313131
false
0
0.010101
0.10101
0.575758
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
cb11e5c47330865d7c69d9b844f6a710d2452467
70
py
Python
lib/pylsdj/bitstring/__init__.py
iLambda/lsdj-wave-cruncher
b49f2f3943d396ee01263f25c8d7a38a65f63ff4
[ "MIT" ]
15
2016-10-11T16:48:58.000Z
2022-02-19T01:39:00.000Z
lib/pylsdj/bread/bitstring/__init__.py
urbster1/lsdj-wave-cruncher
8da1f384f83c79a87cbd311c5dbbf3fe93fb5054
[ "MIT" ]
2
2016-10-11T11:55:30.000Z
2021-01-31T12:11:16.000Z
lib/pylsdj/bread/bitstring/__init__.py
iLambda/lsdj-wave-cruncher
b49f2f3943d396ee01263f25c8d7a38a65f63ff4
[ "MIT" ]
5
2016-10-11T11:42:47.000Z
2021-07-10T12:23:25.000Z
__title__ = 'bitstring' __license__ = 'MIT' from .bitstring import *
14
24
0.728571
7
70
6.142857
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.157143
70
4
25
17.5
0.728814
0
0
0
0
0
0.171429
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
cb33faecd8495d548288d8a0e1342cae956b2d24
1,976
py
Python
prodsim/exception.py
FuchsTom/ProdSim
1cd868de7f8f31139487eb3da4bd23800abac0e4
[ "MIT" ]
2
2021-12-28T19:34:37.000Z
2022-02-23T20:35:25.000Z
prodsim/exception.py
FuchsTom/ProdSim
1cd868de7f8f31139487eb3da4bd23800abac0e4
[ "MIT" ]
null
null
null
prodsim/exception.py
FuchsTom/ProdSim
1cd868de7f8f31139487eb3da4bd23800abac0e4
[ "MIT" ]
1
2021-11-23T14:01:34.000Z
2021-11-23T14:01:34.000Z
"""Bundles all exceptions and warnings used in the package prodsim""" class InvalidValue(Exception): """ Raises when a value is not within the permissible range """ pass class InvalidType(Exception): """ Raises when a value has the wrong type """ pass class MissingParameter(Exception): """ Raised when a required parameter is missing """ pass class MissingAttribute(Exception): """ Raises when a not defined attribute is used """ pass class NotSupportedParameter(Exception): """ Raised when a not defined parameter is passed """ pass class FileNotFound(Exception): """ Raised when a file couldn't be found """ pass class InvalidFormat(Exception): """ Raises when a parameter has the wrong format """ class UndefinedFunction(Exception): """ Raises when a function isn't defined """ pass class UndefinedObject(Exception): """ Raises if an referenced object is not defined """ pass class InvalidFunction(Exception): """ Raises when a function is not valid """ pass class InvalidYield(Exception): """ Raises when a generator function doesn't yield the correct types """ class InvalidSignature(Exception): """ Raises when a signature """ class ToManyArguments(Exception): """ Raises, when to many arguments are passed """ pass class MissingData(Exception): """ Raises, when required data is missing """ pass class BlockedIdentifier(Exception): """ Raises, when an identifier is already blocked """ pass class InfiniteLoop(Exception): """ Raises, when a function contains an infinite loop """ class BadType(Warning): """ when a parameter has a bad type """ pass class BadSignature(Warning): """ when a argument has not the expected name """ pass class BadYield(Warning): """ when a yield is possible but can lead to problems """ pass class NotDefined(Warning): """ when a non pre defined identifier is used """ pass
25.333333
76
0.688259
241
1,976
5.643154
0.390041
0.058824
0.167647
0.132353
0.098529
0
0
0
0
0
0
0
0.214069
1,976
77
77
25.662338
0.875724
0.478239
0
0.444444
0
0
0
0
0
0
0
0
0
1
0
true
0.444444
0
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
0
1
1
0
0
1
0
0
3
cb34e867b9b4de47818562d93c213abfdf2e9fa6
157
py
Python
path.py
Kyle628/westernchase
d6591934db26f7ec2b9724a2b923b546893416c8
[ "MIT" ]
null
null
null
path.py
Kyle628/westernchase
d6591934db26f7ec2b9724a2b923b546893416c8
[ "MIT" ]
null
null
null
path.py
Kyle628/westernchase
d6591934db26f7ec2b9724a2b923b546893416c8
[ "MIT" ]
null
null
null
import os try: user_paths = os.environ['PYTHONPATH'].split(os.pathsep) print(user_paths) except KeyError: user_paths = [] print('key error')
19.625
59
0.675159
21
157
4.904762
0.666667
0.262136
0
0
0
0
0
0
0
0
0
0
0.191083
157
7
60
22.428571
0.811024
0
0
0
0
0
0.121019
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
0.285714
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
cb49f9c43bdd0b07477135aafdc6155f72a77d09
202
py
Python
PythonServer/database/scripts/view_db.py
watfordxp/Hologram
903d81713a609b7529074c0fed5add39ec2c491f
[ "Apache-2.0" ]
null
null
null
PythonServer/database/scripts/view_db.py
watfordxp/Hologram
903d81713a609b7529074c0fed5add39ec2c491f
[ "Apache-2.0" ]
null
null
null
PythonServer/database/scripts/view_db.py
watfordxp/Hologram
903d81713a609b7529074c0fed5add39ec2c491f
[ "Apache-2.0" ]
null
null
null
import pymongo from database.karma_leveled import KarmaLeveled if __name__ == '__main__': mongoClient = pymongo.MongoClient("localhost", 27017) db = KarmaLeveled(mongoClient) db.listItems()
28.857143
57
0.757426
21
202
6.857143
0.714286
0
0
0
0
0
0
0
0
0
0
0.02907
0.148515
202
7
58
28.857143
0.80814
0
0
0
0
0
0.083744
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
cb5480e4c4eae8ece02f84a9f7b3ff7e30d50add
798
py
Python
recipe_scrapers/jamieoliver.py
huskywhale/recipe-scraper
d5570d1d5203cfd8dca29f4f6e5f81e10997fdd2
[ "MIT" ]
14
2017-04-06T18:30:04.000Z
2021-09-04T16:10:34.000Z
recipe_scrapers/jamieoliver.py
huskywhale/recipe-scraper
d5570d1d5203cfd8dca29f4f6e5f81e10997fdd2
[ "MIT" ]
null
null
null
recipe_scrapers/jamieoliver.py
huskywhale/recipe-scraper
d5570d1d5203cfd8dca29f4f6e5f81e10997fdd2
[ "MIT" ]
12
2018-02-21T00:53:31.000Z
2021-07-20T02:44:50.000Z
from ._abstract import AbstractScraper from ._utils import get_minutes, normalize_string class JamieOliver(AbstractScraper): @classmethod def host(self): return 'jamieoliver.com' def title(self): return self.soup.find('h1').get_text() def total_time(self): return get_minutes(self.soup.find('div', {'class': 'time'})) def ingredients(self): ul = self.soup.find('ul', {'class', 'ingred-list'}) ingredients_html = ul.findAll('li') return [ normalize_string(ingredient.get_text()) for ingredient in ingredients_html ] def instructions(self): instructions_html = self.soup.find('div', {'class': 'instructions-wrapper'}) return normalize_string(instructions_html.get_text())
27.517241
84
0.64787
90
798
5.577778
0.411111
0.063745
0.095618
0.059761
0.079681
0
0
0
0
0
0
0.001621
0.226817
798
28
85
28.5
0.811994
0
0
0
0
0
0.096491
0
0
0
0
0
0
1
0.25
false
0
0.1
0.15
0.65
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
cb5d49df277797b734cd3d4f99fecab81ab28afb
13,177
py
Python
peg/calendarGrammar.py
gpoole/mycroft-nextcloud-calendar
32909f8da87bb81a94008ef715586ea7902dab1e
[ "Apache-2.0" ]
null
null
null
peg/calendarGrammar.py
gpoole/mycroft-nextcloud-calendar
32909f8da87bb81a94008ef715586ea7902dab1e
[ "Apache-2.0" ]
null
null
null
peg/calendarGrammar.py
gpoole/mycroft-nextcloud-calendar
32909f8da87bb81a94008ef715586ea7902dab1e
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- # CAVEAT UTILITOR # # This file was automatically generated by TatSu. # # https://pypi.python.org/pypi/tatsu/ # # Any changes you make to it will be overwritten the next time # the file is generated. from __future__ import print_function, division, absolute_import, unicode_literals import sys from tatsu.buffering import Buffer from tatsu.parsing import Parser from tatsu.parsing import tatsumasu, leftrec, nomemo from tatsu.parsing import leftrec, nomemo # noqa from tatsu.util import re, generic_main # noqa KEYWORDS = {} # type: ignore class CalendarGrammarBuffer(Buffer): def __init__( self, text, whitespace=None, nameguard=None, comments_re=None, eol_comments_re=None, ignorecase=None, namechars='', **kwargs ): super(CalendarGrammarBuffer, self).__init__( text, whitespace=whitespace, nameguard=nameguard, comments_re=comments_re, eol_comments_re=eol_comments_re, ignorecase=ignorecase, namechars=namechars, **kwargs ) class CalendarGrammarParser(Parser): def __init__( self, whitespace=None, nameguard=None, comments_re=None, eol_comments_re=None, ignorecase=None, left_recursion=True, parseinfo=True, keywords=None, namechars='', buffer_class=CalendarGrammarBuffer, **kwargs ): if keywords is None: keywords = KEYWORDS super(CalendarGrammarParser, self).__init__( whitespace=whitespace, nameguard=nameguard, comments_re=comments_re, eol_comments_re=eol_comments_re, ignorecase=ignorecase, left_recursion=left_recursion, parseinfo=parseinfo, keywords=keywords, namechars=namechars, buffer_class=buffer_class, **kwargs ) @tatsumasu() def _start_(self): # noqa self._expr_() @tatsumasu() def _expr_(self): # noqa with self._choice(): with self._option(): self._init_() self._ownership_() self.name_last_node('calendar_owner') self._calendar_() with self._optional(): with self._choice(): with self._option(): self._token('on') with self._option(): self._token('for') self._error('no available options') self._timeframe_() self.name_last_node('time_frame') with self._option(): self._init_() self._ownership_() self.name_last_node('calendar_owner') self._timeframe_() self.name_last_node('time_frame') self._error('no available options') self.ast._define( ['calendar_owner', 'time_frame'], [] ) @tatsumasu() def _init_(self): # noqa with self._choice(): with self._option(): self._token('what') with self._group(): with self._choice(): with self._option(): self._token('is') with self._option(): self._token('am') with self._option(): self._token('does') with self._option(): self._token('do') with self._option(): self._token('are') self._error('no available options') with self._optional(): self._token('on') with self._option(): self._token('how') self._token('busy') with self._group(): with self._choice(): with self._option(): self._token('is') with self._option(): self._token('am') self._error('no available options') with self._option(): self._token('tell') self._token('me') with self._optional(): self._token('about') with self._option(): with self._group(): with self._choice(): with self._option(): self._token('add') with self._option(): self._token('put') with self._option(): self._token('create') with self._option(): self._token('schedule') self._error('no available options') with self._optional(): with self._choice(): with self._option(): self._token('a') with self._option(): self._token('an') self._error('no available options') with self._group(): with self._choice(): with self._option(): self._token('event') with self._option(): self._token('appointment') with self._option(): self._token('meeting') self._error('no available options') with self._group(): with self._choice(): with self._option(): self._token('to') with self._option(): self._token('on') self._error('no available options') with self._option(): with self._group(): with self._choice(): with self._option(): self._token('add') with self._option(): self._token('put') with self._option(): self._token('create') with self._option(): self._token('schedule') self._error('no available options') self._token('something') with self._group(): with self._choice(): with self._option(): self._token('to') with self._option(): self._token('on') self._error('no available options') self._error('no available options') @tatsumasu() def _ownership_(self): # noqa with self._choice(): with self._option(): self._token('me') with self._option(): self._token('i') with self._option(): self._token('my') self._error('no available options') @tatsumasu() def _day_of_week_(self): # noqa with self._choice(): with self._option(): self._token('sunday') with self._option(): self._token('monday') with self._option(): self._token('tuesday') with self._option(): self._token('wednesday') with self._option(): self._token('thursday') with self._option(): self._token('friday') with self._option(): self._token('saturday') self._error('no available options') @tatsumasu() def _month_(self): # noqa with self._choice(): with self._option(): self._token('january') with self._option(): self._token('february') with self._option(): self._token('march') with self._option(): self._token('april') with self._option(): self._token('may') with self._option(): self._token('june') with self._option(): self._token('july') with self._option(): self._token('august') with self._option(): self._token('september') with self._option(): self._token('october') with self._option(): self._token('november') with self._option(): self._token('december') self._error('no available options') @tatsumasu() def _number_(self): # noqa self._pattern('\\d+') @tatsumasu() def _date_(self): # noqa self._number_() with self._optional(): with self._choice(): with self._option(): self._token('st') with self._option(): self._token('nd') with self._option(): self._token('rd') with self._option(): self._token('th') self._error('no available options') @tatsumasu() def _time_(self): # noqa with self._choice(): with self._option(): self._token('day') with self._option(): self._token('weekend') with self._option(): self._token('week') with self._option(): self._token('afternoon') with self._option(): self._token('evening') with self._option(): self._token('morning') with self._option(): self._token('tomorrow') with self._option(): self._token('today') with self._option(): self._day_of_week_() with self._option(): self._month_() with self._optional(): self._date_() self._error('no available options') @tatsumasu() def _calendar_(self): # noqa with self._choice(): with self._option(): self._token('calendar') with self._option(): self._token('agenda') with self._option(): self._token('schedule') with self._option(): self._token('planner') with self._option(): self._token('events') with self._option(): self._token('up') self._token('to') with self._option(): self._token('doing') with self._option(): self._token('have') self._token('going') with self._option(): self._time_() self._error('no available options') @tatsumasu() def _relative_modifier_(self): # noqa with self._choice(): with self._option(): self._token('next') with self._option(): self._token('this') self._error('no available options') @tatsumasu() def _timeframe_(self): # noqa with self._optional(): self._relative_modifier_() self._time_() class CalendarGrammarSemantics(object): def start(self, ast): # noqa return ast def expr(self, ast): # noqa return ast def init(self, ast): # noqa return ast def ownership(self, ast): # noqa return ast def day_of_week(self, ast): # noqa return ast def month(self, ast): # noqa return ast def number(self, ast): # noqa return ast def date(self, ast): # noqa return ast def time(self, ast): # noqa return ast def calendar(self, ast): # noqa return ast def relative_modifier(self, ast): # noqa return ast def timeframe(self, ast): # noqa return ast def main(filename, start=None, **kwargs): if start is None: start = 'start' if not filename or filename == '-': text = sys.stdin.read() else: with open(filename) as f: text = f.read() parser = CalendarGrammarParser() return parser.parse(text, rule_name=start, filename=filename, **kwargs) if __name__ == '__main__': import json from tatsu.util import asjson ast = generic_main(main, CalendarGrammarParser, name='CalendarGrammar') print('AST:') print(ast) print() print('JSON:') print(json.dumps(asjson(ast), indent=2)) print()
31.751807
82
0.465888
1,163
13,177
4.980224
0.163371
0.154696
0.19337
0.242403
0.651588
0.473066
0.409358
0.35549
0.3125
0.308702
0
0.000265
0.426956
13,177
414
83
31.828502
0.766786
0.028231
0
0.62259
1
0
0.066651
0
0
0
0
0
0
1
0.07438
false
0
0.024793
0.033058
0.143251
0.019284
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
cb6b7271323505eb69e5c6417ebc3a8bddf3204c
120
py
Python
umccrise/_version.py
umccr/post_bcbio
6ffc568e4c75eaca0b7f4c824c1c5f7373ba6ce1
[ "MIT" ]
1
2017-12-07T00:00:15.000Z
2017-12-07T00:00:15.000Z
umccrise/_version.py
umccr/umccrize
9157ee50fbda3d4376d9597604be8d36c4277e61
[ "MIT" ]
null
null
null
umccrise/_version.py
umccr/umccrize
9157ee50fbda3d4376d9597604be8d36c4277e61
[ "MIT" ]
null
null
null
# Do not edit this file, pipeline versioning is governed by git tags __version__ = '2.0.2' __git_revision__ = 'fa00823'
30
68
0.758333
19
120
4.315789
0.894737
0
0
0
0
0
0
0
0
0
0
0.079208
0.158333
120
3
69
40
0.732673
0.55
0
0
1
0
0.230769
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
cb6d3c160bf141eb6c0c0250149310dfb06351d0
2,884
py
Python
tests/parser/file/encoder/test_filename.py
orenyodfat/CWR-DataApi
f3b6ba8308c901b6ab87073c155c08e30692333c
[ "MIT" ]
37
2015-04-21T15:33:53.000Z
2022-02-07T00:02:29.000Z
tests/parser/file/encoder/test_filename.py
orenyodfat/CWR-DataApi
f3b6ba8308c901b6ab87073c155c08e30692333c
[ "MIT" ]
86
2015-02-01T22:26:02.000Z
2021-07-09T08:49:36.000Z
tests/parser/file/encoder/test_filename.py
orenyodfat/CWR-DataApi
f3b6ba8308c901b6ab87073c155c08e30692333c
[ "MIT" ]
27
2015-01-26T16:01:09.000Z
2021-11-08T23:53:55.000Z
# -*- coding: utf-8 -*- import unittest from cwr.parser.encoder.file import default_filename_encoder, \ old_filename_encoder from cwr.file import FileTag """ CWR file name encoder tests. The following cases are tested: """ __author__ = 'Bernardo Martínez Garrido' __license__ = 'MIT' __status__ = 'Development' class TestFileNameCWREncodeValid(unittest.TestCase): """ Tests that CWRFileNameEncoder encodes valid FileTags (using the new format) """ def setUp(self): self._parser = default_filename_encoder() def test_s2_r2(self): # Sender with 2 digits and receiver with 2 digits data = self._parser.encode(FileTag(2012, 123, '11', '22', 2.1)) self.assertEqual("CW12012311_22.V21", data) def test_s3_r2(self): # Sender with 3 digits and receiver with 2 digits data = self._parser.encode(FileTag(2013, 123, 'ABC', '23', 2.2)) self.assertEqual("CW130123ABC_23.V22", data) def test_s2_r3(self): # Sender with 2 digits and receiver with 3 digits data = self._parser.encode(FileTag(2099, 0, '22', 'DEC', 0)) self.assertEqual("CW99000022_DEC.V00", data) def test_s3_r3(self): # Sender with 3 digits and receiver with 3 digits data = self._parser.encode(FileTag(2000, 12, 'AB2', '234', 0.2)) self.assertEqual("CW000012AB2_234.V02", data) def test_s3_r3_old_year(self): # Sender with 3 digits and receiver with 3 digits data = self._parser.encode(FileTag(1960, 12, 'AB2', '234', 0.2)) self.assertEqual("CW600012AB2_234.V02", data) def test_s3_r3_short_year(self): # Sender with 3 digits and receiver with 3 digits data = self._parser.encode(FileTag(60, 12, 'AB2', '234', 0.2)) self.assertEqual("CW600012AB2_234.V02", data) class TestFileNameCWREncodeValidOld(unittest.TestCase): """ Tests that CWRFileNameEncoder encodes valid FileTags (using the old format) """ def setUp(self): self._parser = old_filename_encoder() def test_s2_r2(self): # Sender with 2 digits and receiver with 2 digits data = self._parser.encode(FileTag(2012, 23, '11', '22', 2.1)) self.assertEqual("CW122311_22.V21", data) def test_s3_r2(self): # Sender with 3 digits and receiver with 2 digits data = self._parser.encode(FileTag(2013, 1, 'ABC', '23', 2.2)) self.assertEqual("CW1301ABC_23.V22", data) def test_s2_r3(self): # Sender with 2 digits and receiver with 3 digits data = self._parser.encode(FileTag(2099, 0, '22', 'DEC', 0)) self.assertEqual("CW990022_DEC.V00", data) def test_s3_r3(self): # Sender with 3 digits and receiver with 3 digits data = self._parser.encode(FileTag(2000, 12, 'AB2', '234', 0.2)) self.assertEqual("CW0012AB2_234.V02", data)
30.041667
79
0.657074
396
2,884
4.618687
0.229798
0.06561
0.072171
0.114817
0.774194
0.774194
0.696555
0.67906
0.67906
0.67906
0
0.112853
0.225728
2,884
95
80
30.357895
0.706225
0.226768
0
0.372093
0
0
0.125
0
0
0
0
0
0.232558
1
0.27907
false
0
0.069767
0
0.395349
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
cb7ac1e01e13adf25f3902fefdc0a8468950238a
842
py
Python
socialregistration/contrib/google/views.py
nypublicradio/legacy-publisher-django-socialregistration
181f75d152f553f77fa899dac895c4276108204f
[ "MIT" ]
63
2015-01-27T16:52:03.000Z
2021-08-29T04:23:51.000Z
socialregistration/contrib/google/views.py
nypublicradio/legacy-publisher-django-socialregistration
181f75d152f553f77fa899dac895c4276108204f
[ "MIT" ]
3
2016-05-26T07:46:53.000Z
2022-02-16T15:25:16.000Z
socialregistration/contrib/google/views.py
nypublicradio/legacy-publisher-django-socialregistration
181f75d152f553f77fa899dac895c4276108204f
[ "MIT" ]
23
2015-02-02T13:33:46.000Z
2020-10-25T20:02:53.000Z
from django.core.urlresolvers import reverse from socialregistration.contrib.google.client import Google from socialregistration.contrib.google.models import GoogleProfile from socialregistration.views import OAuthRedirect, OAuthCallback, SetupCallback class GoogleRedirect(OAuthRedirect): client = Google template_name = 'socialregistration/google/google.html' class GoogleCallback(OAuthCallback): client = Google template_name = 'socialregistration/google/google.html' def get_redirect(self): return reverse('socialregistration:google:setup') class GoogleSetup(SetupCallback): client = Google profile = GoogleProfile template_name = 'socialregistration/google/google.html' def get_lookup_kwargs(self, request, client): return {'google_id': client.get_user_info()['id']}
33.68
80
0.769596
86
842
7.430233
0.418605
0.150235
0.140845
0.169014
0.2723
0.2723
0.2723
0.2723
0
0
0
0
0.149644
842
24
81
35.083333
0.892458
0
0
0.333333
0
0
0.18171
0.168646
0
0
0
0
0
1
0.111111
false
0
0.222222
0.111111
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
3
cb88fba1820f3aada59cc87c1329b0b2e230b959
2,450
py
Python
algorithms/python/equal_sequence.py
rik0/rk-exempla
811f859a0980b0636bbafa2656893d988c4d0e32
[ "MIT" ]
1
2017-02-20T21:04:47.000Z
2017-02-20T21:04:47.000Z
algorithms/python/equal_sequence.py
rik0/rk-exempla
811f859a0980b0636bbafa2656893d988c4d0e32
[ "MIT" ]
null
null
null
algorithms/python/equal_sequence.py
rik0/rk-exempla
811f859a0980b0636bbafa2656893d988c4d0e32
[ "MIT" ]
2
2017-02-20T21:04:49.000Z
2021-05-18T11:29:16.000Z
import itertools as it def sequence_equals(cmpf, l_seq, r_seq): ''' >>> import operator as op >>> sequence_equals(op.eq, range(3), range(3)) True >>> sequence_equals(op.eq, range(3), range(4)) False >>> sequence_equals(op.eq, [], []) True >>> sequence_equals(op.eq, range(3), []) False >>> sequence_equals(op.eq, [0, 1, 2, 3, None], range(4)) False ''' for l_element, r_element in it.izip_longest(l_seq, r_seq): if not cmpf(l_element, r_element): return False else: return True def sequence_equals_f(cmpf, l_seq, r_seq): ''' >>> import operator as op >>> sequence_equals_f(op.eq, range(3), range(3)) True >>> sequence_equals_f(op.eq, range(3), range(4)) False >>> sequence_equals_f(op.eq, [], []) True >>> sequence_equals_f(op.eq, range(3), []) False >>> sequence_equals_f(op.eq, [0, 1, 2, 3, None], range(4)) False ''' return all(cmpf(x, y) for x, y in it.izip_longest(l_seq, r_seq)) def sequence_equals_m(cmpf, l_seq, r_seq): ''' >>> import operator as op >>> sequence_equals_m(op.eq, range(3), range(3)) True >>> sequence_equals_m(op.eq, range(3), range(4)) False >>> sequence_equals_m(op.eq, [], []) True >>> sequence_equals_m(op.eq, range(3), []) False >>> sequence_equals_m(op.eq, [0, 1, 2, 3, None], range(4)) False >>> sequence_equals_m(op.eq, it.count(), range(4)) False ''' lit = iter(l_seq) for el in r_seq: try: if not cmpf(el, lit.next()): return False except StopIteration: return False else: try: lit.next() return False except StopIteration: return True def sequence_equals_s(cmpf, l_seq, r_seq): ''' >>> import operator as op >>> sequence_equals_s(op.eq, range(3), range(3)) True >>> sequence_equals_s(op.eq, range(3), range(4)) False >>> sequence_equals_s(op.eq, [], []) True >>> sequence_equals_s(op.eq, range(3), []) False >>> sequence_equals_s(op.eq, [0, 1, 2, 3, None], range(4)) False ''' class NullObject(object): pass return all(cmpf(x, y) for x, y in it.izip_longest(l_seq, r_seq, fillvalue=NullObject)) if __name__ == '__main__': import doctest doctest.testmod()
26.630435
76
0.555918
350
2,450
3.677143
0.157143
0.27195
0.083916
0.09324
0.796426
0.756022
0.745921
0.598291
0.48951
0.275058
0
0.023429
0.285714
2,450
92
77
26.630435
0.712
0.493878
0
0.387097
0
0
0.007905
0
0
0
0
0
0
1
0.129032
false
0.032258
0.064516
0
0.483871
0
0
0
0
null
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
cb944caa5ca2a1d6e9562d5015f88af17824be99
504
py
Python
RQ2_ros_implementation/mission-runner/common/modules/sensors/ram/controllers/RAMSensor.py
S2-group/msr-2021-robotics-green-architectural-tactics-replication-package
fc4a205b00abb0b096c472856002e440e73f2c5d
[ "MIT" ]
2
2021-03-26T17:29:27.000Z
2021-03-27T20:06:21.000Z
RQ2_ros_implementation/mission-runner/common/modules/sensors/ram/controllers/RAMSensor.py
S2-group/msr-2021-robotics-green-architectural-tactics-replication-package
fc4a205b00abb0b096c472856002e440e73f2c5d
[ "MIT" ]
null
null
null
RQ2_ros_implementation/mission-runner/common/modules/sensors/ram/controllers/RAMSensor.py
S2-group/msr-2021-robotics-green-architectural-tactics-replication-package
fc4a205b00abb0b096c472856002e440e73f2c5d
[ "MIT" ]
null
null
null
import rospy from std_msgs.msg import Float64 from rospy import Subscriber from common.architectural.Singleton import Singleton class RAMSensor(metaclass=Singleton): __ram_sub: Subscriber __ram_percentage: float = 0.0 def __init__(self): self.__ram_sub = rospy.Subscriber('/ram_usage', Float64, self.__ram_usage_clbk) def __ram_usage_clbk(self, msg: Float64): self.__ram_percentage = msg.data def get_percentage(self) -> float: return self.__ram_percentage
29.647059
87
0.746032
66
504
5.242424
0.409091
0.080925
0.080925
0
0
0
0
0
0
0
0
0.019277
0.176587
504
17
88
29.647059
0.814458
0
0
0
0
0
0.019802
0
0
0
0
0
0
1
0.230769
false
0
0.307692
0.076923
0.846154
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
3
cbb7f5a305f0ca208d98fa3c978b290990d2ca37
341
py
Python
misc/snark-p.py
77ph/mcl
419ea779acc2107c07ca4fbab552d218d77e2b79
[ "BSD-3-Clause" ]
325
2016-05-02T13:16:38.000Z
2022-03-30T08:39:05.000Z
misc/snark-p.py
77ph/mcl
419ea779acc2107c07ca4fbab552d218d77e2b79
[ "BSD-3-Clause" ]
129
2017-02-13T00:30:58.000Z
2022-03-28T07:20:42.000Z
misc/snark-p.py
77ph/mcl
419ea779acc2107c07ca4fbab552d218d77e2b79
[ "BSD-3-Clause" ]
127
2016-11-24T04:48:48.000Z
2022-03-28T17:07:53.000Z
p=21888242871839275222246405745257275088696311157297823662689037894645226208583 print("over 253 bit") for i in range (10): print(i, (p * i) >> 253) def maxarg(x): return x // p print("maxarg") for i in range(16): print(i, maxarg(i << 253)) x=0x2c130429c1d4802eb8703197d038ebd5109f96aee333bd027963094f5bb33ad y = x * 9 print(hex(y))
17.947368
79
0.741935
42
341
6.02381
0.47619
0.031621
0.047431
0.086957
0
0
0
0
0
0
0
0.457627
0.134897
341
18
80
18.944444
0.4
0
0
0
0
0
0.052786
0
0
0
0.190616
0
0
1
0.083333
false
0
0
0.083333
0.166667
0.416667
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
1
0
3
cbc173d3d98fb3b534a84b7d82fc7c06e4034c82
16,365
py
Python
ShotgunORM/SgScriptFields.py
TheThirdFloor/python-shotgunorm
a3b5ed5a5afa9e86aafc1ea86d67241317c8b1ad
[ "BSD-3-Clause" ]
19
2015-07-12T21:08:58.000Z
2021-08-31T08:50:05.000Z
ShotgunORM/SgScriptFields.py
TheThirdFloor/python-shotgunorm
a3b5ed5a5afa9e86aafc1ea86d67241317c8b1ad
[ "BSD-3-Clause" ]
7
2015-01-01T17:23:03.000Z
2017-06-27T13:58:11.000Z
ShotgunORM/SgScriptFields.py
TheThirdFloor/python-shotgunorm
a3b5ed5a5afa9e86aafc1ea86d67241317c8b1ad
[ "BSD-3-Clause" ]
13
2015-07-10T18:01:39.000Z
2020-07-12T14:46:19.000Z
# Copyright (c) 2013, Nathan Dunsworth - NFXPlugins # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the NFXPlugins nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL NFXPLUGINS BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # __all__ = [ 'SgScriptFieldCheckbox', 'SgScriptFieldColor', 'SgScriptFieldColor2', 'SgScriptFieldDate', 'SgScriptFieldDateTime', 'SgScriptFieldEntity', 'SgScriptFieldEntityMulti', 'SgScriptFieldFloat', 'SgScriptFieldInt', 'SgScriptFieldSelectionList', 'SgScriptFieldTagList', 'SgScriptFieldText' ] # Python imports import types # This module imports import ShotgunORM class SgScriptFieldCheckbox(ShotgunORM.SgScriptField): ''' Script engine checkbox field class. ''' def __eq__(self, value): if value != None: try: value = bool(value) except: raise TypeError('expected a bool, got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if value != None: try: value = bool(value) except: raise TypeError('expected a bool, got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } class SgScriptFieldColor(ShotgunORM.SgScriptField): ''' Script engine color field class. ''' def __eq__(self, value): if value != None: if isinstance(value, str): pass elif isinstance(value, (list, tuple)): if len(value) != 3: raise ValueError('list requires exactly 3 elements') value = '%s,%s,%s' % tuple(value) else: raise TypeError('expected a str or list of ints, got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if not isinstance(value, types.NoneType): if isinstance(value, str): pass elif isinstance(value, (list, tuple)): if len(value) != 3: raise ValueError('list requires exactly 3 elements') value = '%s,%s,%s' % tuple(value) else: raise TypeError('expected a str or list of ints, got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } class SgScriptFieldColor2(SgScriptFieldColor): ''' Script engine color2 field class. ''' pass class SgScriptFieldDate(ShotgunORM.SgScriptField): ''' Script engine date field class. ''' def __eq__(self, value): if not isinstance(value, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if not isinstance(value, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } def __lt__(self, value): if not isinstance(value, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'less_than', 'neop': None } def __gt__(self, value): if not isinstance(value, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'greater_than', 'neop': None } def _in(self, value): if isinstance(value, (list, tuple)): if not all(isinstance(x, (datetime.datetime, str)) for x in value): raise TypeError('expected (datetime, str, None) in list') elif not isinstance(value, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'in', 'neop': 'not_in' } def between(self, a, b): if not isinstance(a, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) if not isinstance(b, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) return { 'value': [a, b], 'op': 'between', 'neop': 'not_between' } def in_day(self, value): try: value = int(n) except: raise TypeError('expected an int, got %s' % type(value).__name__) return { 'value': value, 'op': 'in_calendar_day', 'neop': None } def in_last(self, n, t): if not t in ['HOUR','DAY', 'WEEK', 'MONTH', 'YEAR']: raise ValueError('invalid time spec "%s", valid %s' % (t, ['HOUR','DAY', 'WEEK', 'MONTH', 'YEAR'])) try: n = int(n) except: raise TypeError('expected an int, got %s' % type(n).__name__) return { 'value': [n, t], 'op': 'in_last', 'neop': 'not_in_last' } def in_month(self, value): try: value = int(n) except: raise TypeError('expected an int, got %s' % type(value).__name__) return { 'value': value, 'op': 'in_calendar_month', 'neop': None } def in_next(self, n, t): if not t in ['HOUR','DAY', 'WEEK', 'MONTH', 'YEAR']: raise ValueError('invalid time spec "%s", valid %s' % (t, ['HOUR','DAY', 'WEEK', 'MONTH', 'YEAR'])) try: n = int(n) except: raise TypeError('expected an int, got %s' % type(n).__name__) return { 'value': [n, t], 'op': 'in_next', 'neop': 'not_in_next' } def in_week(self, value): try: value = int(n) except: raise TypeError('expected an int, got %s' % type(value).__name__) return { 'value': value, 'op': 'in_calendar_week', 'neop': None } def in_year(self, value): try: value = int(n) except: raise TypeError('expected an int, got %s' % type(value).__name__) return { 'value': value, 'op': 'in_calendar_year', 'neop': None } class SgScriptFieldDateTime(SgScriptFieldDate): ''' Script engine datetime field class. ''' pass class SgScriptFieldEntity(ShotgunORM.SgScriptField): ''' Script engine entity field class. ''' def _in(self, value): if isinstance(value, (list, tuple)): if not all(isinstance(x, (ShotgunORM.SgEntity, dict)) for x in value): raise TypeError('expected (ShotgunORM.SgEntity, dict, list in list') tmp = [] for i in value: try: tmp.append(i.toEntityFieldData()) except AttributeError: tmp.append(i) value = tmp elif isinstance(value, ShotgunORM.SgEntity): value = [value.toEntityFieldData()] elif isinstance(value, dict): value = [value] else: raise TypeError('expected (ShotgunORM.SgEntity, dict, list), got %s' % type(value).__name__) return { 'value': value, 'op': 'in', 'neop': 'not_in' } def __eq__(self, value): if isinstance(value, (dict, types.NoneType)): pass elif isinstance(value, ShotgunORM.SgEntity): value = value.toEntityFieldData() else: raise TypeError('expected a (ShotgunORM.SgEntity, dict, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if isinstance(value, (dict, types.NoneType)): pass elif isinstance(value, ShotgunORM.SgEntity): value = value.toEntityFieldData() else: raise TypeError('expected a (ShotgunORM.SgEntity, dict, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } def name_contains(self, value): if not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'name_contains', 'neop': 'name_not_contains' } def name_is(self, value): if not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'name_is', 'neop': None } def type(self, value): if value != None: if isinstance(value, ShotgunORM.SgEntity): value = value.type elif not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'type_is', 'neop': 'type_is_not' } class SgScriptFieldEntityMulti(SgScriptFieldEntity): ''' Script engine entity-multi field class. ''' def name_is(self, value): raise RuntimeError('function not supported') class SgScriptFieldFloat(ShotgunORM.SgScriptField): ''' Script engine float field class. ''' def __eq__(self, value): if value != None: try: value = float(value) except: raise TypeError('expected a float, got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if value != None: try: value = float(value) except: raise TypeError('expected a float, got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } def __lt__(self, value): try: value = float(value) except: raise TypeError('expected a float, got %s' % type(value).__name__) return { 'value': value, 'op': 'less_than', 'neop': None } def __gt__(self, value): try: value = float(value) except: raise TypeError('expected a float, got %s' % type(value).__name__) return { 'value': value, 'op': 'greater_than', 'neop': None } def _in(self, value): if isinstance(value, (list, tuple)): tmp = [] try: for i in value: tmp.append(float(i)) except: raise TypeError('expected a list of floats, %s' % value) value = tmp else: try: value = float(value) except: raise TypeError('expected a float, got %s' % type(value).__name__) return { 'value': value, 'op': 'in', 'neop': 'not_in' } def between(self, a, b): try: a = float(a) except: raise TypeError('expected a float, got %s' % type(a).__name__) try: b = float(b) except: raise TypeError('expected a float, got %s' % type(b).__name__) return { 'value': [a, b], 'op': 'between', 'neop': 'not_between' } class SgScriptFieldInt(ShotgunORM.SgScriptField): ''' Script engine int field class. ''' def __eq__(self, value): if value != None: try: value = int(value) except: raise TypeError('expected a int, got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if value != None: try: value = int(value) except: raise TypeError('expected a int, got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } def __lt__(self, value): try: value = int(value) except: raise TypeError('expected an int, got %s' % type(value).__name__) return { 'value': value, 'op': 'less_than', 'neop': None } def __gt__(self, value): try: value = int(value) except: raise TypeError('expected an int, got %s' % type(value).__name__) return { 'value': value, 'op': 'greater_than', 'neop': None } def _in(self, value): if isinstance(value, (list, tuple)): tmp = [] try: for i in value: tmp.append(int(i)) except: raise TypeError('expected a list of int, %s' % value) value = tmp else: try: value = int(value) except: raise TypeError('expected a int, got %s' % type(value).__name__) return { 'value': value, 'op': 'in', 'neop': 'not_in' } def between(self, a, b): try: a = int(a) except: raise TypeError('expected a int, got %s' % type(a).__name__) try: b = int(b) except: raise TypeError('expected a int, got %s' % type(b).__name__) return { 'value': [a, b], 'op': 'between', 'neop': 'not_between' } class SgScriptFieldText(ShotgunORM.SgScriptField): ''' Script engine text field class. ''' def __eq__(self, value): if not isinstance(value, (str, types.NoneType)): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if not isinstance(value, (str, types.NoneType)): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } def _in(self, value): if isinstance(value, (list, tuple)): if not all(isinstance(x, str) for x in value): raise TypeError('expected a list of strings') return { 'value': value, 'op': 'in', 'neop': 'not_in' } def contains(self, value): if not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'contains', 'neop': 'not_contains' } def endswith(self, value): if not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'ends_with', 'neop': None } def startswith(self, value): if not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'starts_with', 'neop': None } class SgScriptFieldSelectionList(SgScriptFieldText): ''' Script engine selection list field class. ''' pass class SgScriptFieldTagList(ShotgunORM.SgScriptField): ''' Script engine tag list field class. ''' def __eq__(self, value): if not isinstance(value, (str, types.NoneType)): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if not isinstance(value, (str, types.NoneType)): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } def name_contains(self, value): if not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'name_contains', 'neop': 'name_not_contains' }
24.030837
105
0.591384
1,943
16,365
4.808029
0.118374
0.07493
0.117748
0.054271
0.71398
0.704774
0.698994
0.68176
0.655534
0.63252
0
0.000924
0.272533
16,365
680
106
24.066176
0.783788
0.119523
0
0.740964
0
0
0.197544
0.012351
0
0
0
0
0
1
0.088353
false
0.014056
0.004016
0
0.202811
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
cbe0cee50967d3061a75b1d82d5c678ca7e194a4
971
py
Python
QuickDemos/ModulesExample/Shapes.py
owenbres01/CMPT-120L-910-20F
c9840f5316688f023b7cca555ffc97ccb429aae8
[ "MIT" ]
1
2020-08-25T23:50:45.000Z
2020-08-25T23:50:45.000Z
QuickDemos/ModulesExample/Shapes.py
owenbres01/CMPT-120L-910-20F
c9840f5316688f023b7cca555ffc97ccb429aae8
[ "MIT" ]
1
2020-09-18T01:20:58.000Z
2020-09-18T01:20:58.000Z
QuickDemos/ModulesExample/Shapes.py
owenbres01/CMPT-120L-910-20F
c9840f5316688f023b7cca555ffc97ccb429aae8
[ "MIT" ]
21
2020-08-25T03:52:56.000Z
2020-09-09T01:32:45.000Z
# Python program showing # abstract base class work from abc import ABC, abstractmethod class Polygon(ABC): # abstract method def num_sides(self): pass class Triangle(Polygon): # overriding abstract method def num_sides(self): print("I have 3 sides") class Pentagon(Polygon): # overriding abstract method def num_sides(self): print("I have 5 sides") class Hexagon(Polygon): # overriding abstract method def num_sides(self): print("I have 6 sides") class Quadrilateral(Polygon): # overriding abstract method def num_sides(self): print("I have 4 sides") class Septagon(Polygon): # overriding abstract method def num_sides(self): print("I have 7 sides") class Octagon(Polygon): # overriding abstract method def num_sides(self): print("I have 8 sides") def favoriteShape(shape_name): print("Wow your favorite shape is a {shape_name}! That's my favorite shape too!".format(shape_name = shape_name))
19.816327
117
0.712667
136
971
5.007353
0.345588
0.143906
0.174743
0.20558
0.535977
0.535977
0.493392
0.493392
0.493392
0.493392
0
0.007653
0.192585
971
49
117
19.816327
0.860969
0.239959
0
0.291667
0
0
0.214286
0
0
0
0
0
0
1
0.333333
false
0.041667
0.041667
0
0.666667
0.291667
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
1dbe5d7a76e1834b3c5d0a67f1e0a1ec15df7856
430
py
Python
product/views/classy_views.py
bootandy/flask-sample
788d635cc6f569856b5ce04a8537bda0c3a0a10c
[ "MIT" ]
2
2015-01-05T09:28:16.000Z
2015-01-10T07:03:34.000Z
product/views/classy_views.py
bootandy/flask-sample
788d635cc6f569856b5ce04a8537bda0c3a0a10c
[ "MIT" ]
null
null
null
product/views/classy_views.py
bootandy/flask-sample
788d635cc6f569856b5ce04a8537bda0c3a0a10c
[ "MIT" ]
null
null
null
from flask import Flask, render_template from flask.ext.classy import FlaskView from product import app from product.models import * class UserView(FlaskView): def index(self): users = User.objects() return render_template('users/index.html', users=users) def get(self, id): user = User.objects.get(id=id) return render_template('users/single.html', user=user) UserView.register(app)
22.631579
63
0.704651
58
430
5.172414
0.431034
0.14
0.133333
0.166667
0
0
0
0
0
0
0
0
0.193023
430
18
64
23.888889
0.864553
0
0
0
0
0
0.076744
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.75
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
1dc95634eec25dca1a45276c7fd1f0b4bd2bcc7b
200
py
Python
meizitu_scrapy_spider/meizitu_scrapy_spider/spiders/recommend_spider.py
albert-lii/py3-sample-market
12f812a347d7623ad3ee615c40bba78908e19b05
[ "MIT" ]
null
null
null
meizitu_scrapy_spider/meizitu_scrapy_spider/spiders/recommend_spider.py
albert-lii/py3-sample-market
12f812a347d7623ad3ee615c40bba78908e19b05
[ "MIT" ]
null
null
null
meizitu_scrapy_spider/meizitu_scrapy_spider/spiders/recommend_spider.py
albert-lii/py3-sample-market
12f812a347d7623ad3ee615c40bba78908e19b05
[ "MIT" ]
null
null
null
import scrapy class RecommendSpider(scrapy.Spider): # 定义蜘蛛的名字 name = 'recommend' urls = ['https://www.mzitu.com/'] # 提取 response 中所包含的信息 def parse(self, response): pass
16.666667
37
0.625
22
200
5.681818
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.255
200
11
38
18.181818
0.838926
0.135
0
0
0
0
0.182353
0
0
0
0
0
0
1
0.166667
false
0.166667
0.166667
0
0.833333
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
1
0
0
3
1dd44e995345c9f8f2e30fcc920a4e4659364312
196
py
Python
tests/urls.py
OmenApps/django-calendardate
bdaef5c17d6e5c97f4062f2b95ced331ef20083c
[ "MIT" ]
9
2021-02-27T17:39:58.000Z
2022-01-08T09:16:04.000Z
tests/urls.py
diek/django-calendardate
bdaef5c17d6e5c97f4062f2b95ced331ef20083c
[ "MIT" ]
null
null
null
tests/urls.py
diek/django-calendardate
bdaef5c17d6e5c97f4062f2b95ced331ef20083c
[ "MIT" ]
1
2021-12-14T01:05:44.000Z
2021-12-14T01:05:44.000Z
from django.conf import settings from django.contrib import admin from django.urls import path app_name = "django_calendardate" urlpatterns = [ path(settings.ADMIN_URL, admin.site.urls), ]
17.818182
46
0.77551
27
196
5.518519
0.555556
0.201342
0
0
0
0
0
0
0
0
0
0
0.142857
196
10
47
19.6
0.886905
0
0
0
0
0
0.096939
0
0
0
0
0
0
1
0
false
0
0.428571
0
0.428571
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
1ddc7f1ba6b50a6e8a6e076057a336e1cad5db28
359
py
Python
startleft/api/api_config.py
iriusrisk/startleft
2833a09ca3c39636b34116bb0f8db0756643f05b
[ "Apache-2.0" ]
9
2021-08-25T16:08:25.000Z
2022-03-22T14:12:05.000Z
startleft/api/api_config.py
iriusrisk/startleft
2833a09ca3c39636b34116bb0f8db0756643f05b
[ "Apache-2.0" ]
4
2021-08-17T13:30:43.000Z
2022-03-15T07:53:13.000Z
startleft/api/api_config.py
iriusrisk/startleft
2833a09ca3c39636b34116bb0f8db0756643f05b
[ "Apache-2.0" ]
null
null
null
import os class ApiConfig: iriusrisk_server: str @classmethod def set_iriusrisk_server(cls, server: str): cls.iriusrisk_server = server @classmethod def get_iriusrisk_server(cls): if not hasattr(cls, 'iriusrisk_server'): cls.iriusrisk_server = os.environ['IRIUS_SERVER'] return cls.iriusrisk_server
22.4375
61
0.682451
42
359
5.595238
0.428571
0.446809
0.306383
0
0
0
0
0
0
0
0
0
0.239554
359
15
62
23.933333
0.860806
0
0
0.181818
0
0
0.077994
0
0
0
0
0
0
1
0.181818
false
0
0.090909
0
0.545455
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
1df8cf35f6f3ee8e659d6fd6beba5534fd1d0fad
181
py
Python
saleor/core/db/schema.py
seegno-labs/saleor
806b5efbb8805d69545634187e80a68042d2e42a
[ "CC-BY-4.0" ]
null
null
null
saleor/core/db/schema.py
seegno-labs/saleor
806b5efbb8805d69545634187e80a68042d2e42a
[ "CC-BY-4.0" ]
1
2020-04-14T18:35:00.000Z
2020-04-14T18:35:00.000Z
saleor/core/db/schema.py
seegno-labs/saleor
806b5efbb8805d69545634187e80a68042d2e42a
[ "CC-BY-4.0" ]
null
null
null
def set_search_path(sender, **kwargs): conn = kwargs.get('connection') if conn is not None: cursor = conn.cursor() cursor.execute("SET search_path=saleor")
25.857143
48
0.646409
24
181
4.75
0.666667
0.157895
0.22807
0
0
0
0
0
0
0
0
0
0.226519
181
6
49
30.166667
0.814286
0
0
0
0
0
0.176796
0
0
0
0
0
0
1
0.2
false
0
0
0
0.2
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
1dff701467cb0dcd73210417fb5c0bda63eb2d2d
179
bzl
Python
ocaml/_debug/utils.bzl
layus/rules_ocaml
bbcc7bfe3787038b2207e07a1e795fcab32dc676
[ "Apache-2.0" ]
14
2020-12-05T15:00:37.000Z
2022-01-03T23:41:51.000Z
ocaml/_debug/utils.bzl
layus/rules_ocaml
bbcc7bfe3787038b2207e07a1e795fcab32dc676
[ "Apache-2.0" ]
43
2021-01-04T13:17:14.000Z
2021-11-22T14:26:50.000Z
ocaml/_debug/utils.bzl
layus/rules_ocaml
bbcc7bfe3787038b2207e07a1e795fcab32dc676
[ "Apache-2.0" ]
4
2021-05-31T14:28:13.000Z
2021-11-19T09:13:55.000Z
def debug_report_progress(repo_ctx, msg): if repo_ctx.attr.debug: print(msg) repo_ctx.report_progress(msg) for i in range(25000000): x = 1
25.571429
41
0.608939
26
179
3.961538
0.653846
0.203884
0
0
0
0
0
0
0
0
0
0.072
0.301676
179
6
42
29.833333
0.752
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.166667
0.166667
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3801c1872591baab8b75d5f4e5b9323e32dcdb01
202
py
Python
setup.py
wiskinator/reddit-wallpaper-scraper
1dc5e0488aafd4c4f3e6993566e83cf831b0efa4
[ "MIT" ]
null
null
null
setup.py
wiskinator/reddit-wallpaper-scraper
1dc5e0488aafd4c4f3e6993566e83cf831b0efa4
[ "MIT" ]
null
null
null
setup.py
wiskinator/reddit-wallpaper-scraper
1dc5e0488aafd4c4f3e6993566e83cf831b0efa4
[ "MIT" ]
null
null
null
from distutils.core import setup setup(name = 'RedditWallpaperScraper', version = '0.0.1dev', packages = 'reddit-wallpaper-scraper', long_description=open('README.md').read() )
25.25
47
0.663366
22
202
6.045455
0.909091
0
0
0
0
0
0
0
0
0
0
0.018519
0.19802
202
7
48
28.857143
0.802469
0
0
0
0
0
0.311881
0.227723
0
0
0
0
0
1
0
true
0
0.166667
0
0.166667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
383131c8d8d7986c582eefb9d1df73080a8f1338
627
py
Python
src/airfly/_vendor/airflow/providers/http/operators/http.py
ryanchao2012/airfly
230ddd88885defc67485fa0c51f66c4a67ae98a9
[ "MIT" ]
7
2021-09-27T11:38:48.000Z
2022-02-01T06:06:24.000Z
src/airfly/_vendor/airflow/providers/http/operators/http.py
ryanchao2012/airfly
230ddd88885defc67485fa0c51f66c4a67ae98a9
[ "MIT" ]
null
null
null
src/airfly/_vendor/airflow/providers/http/operators/http.py
ryanchao2012/airfly
230ddd88885defc67485fa0c51f66c4a67ae98a9
[ "MIT" ]
null
null
null
# Auto generated by 'inv collect-airflow' from airfly._vendor.airflow.models.baseoperator import BaseOperator class SimpleHttpOperator(BaseOperator): endpoint: "typing.Union[str, NoneType]" method: "str" data: "typing.Any" headers: "typing.Union[typing.Dict[str, str], NoneType]" response_check: "typing.Union[typing.Callable[..., bool], NoneType]" response_filter: "typing.Union[typing.Callable[..., typing.Any], NoneType]" extra_options: "typing.Union[typing.Dict[str, typing.Any], NoneType]" http_conn_id: "str" log_response: "bool" auth_type: "typing.Type[requests.auth.AuthBase]"
39.1875
79
0.722488
76
627
5.855263
0.513158
0.123596
0.152809
0.094382
0.107865
0
0
0
0
0
0
0
0.132376
627
15
80
41.8
0.818015
0.062201
0
0
1
0
0.486348
0.271331
0
0
0
0
0
1
0
true
0
0.083333
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
3
384cf03a9bd6916474504503748546e610a0fa96
185
py
Python
backend/products/urls.py
NiteshRamola/YesAvail_Assignment
6bae1d4804bfce124f1ef0d97d4f874550939e6e
[ "MIT" ]
null
null
null
backend/products/urls.py
NiteshRamola/YesAvail_Assignment
6bae1d4804bfce124f1ef0d97d4f874550939e6e
[ "MIT" ]
null
null
null
backend/products/urls.py
NiteshRamola/YesAvail_Assignment
6bae1d4804bfce124f1ef0d97d4f874550939e6e
[ "MIT" ]
null
null
null
from django.urls import path from .views import getProducts, getProduct urlpatterns = [ path('', getProducts, name='products'), path('<str:pk>/', getProduct, name='product'), ]
26.428571
50
0.691892
21
185
6.095238
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.145946
185
7
51
26.428571
0.810127
0
0
0
0
0
0.129032
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
698a6dd12a6b87f498df318dc9baa9953cb39719
244
py
Python
tests/test_plugin_xjson.py
mikegribov/filedjson
ee9f8408edcf8a72b8ed415237789a602ee6b579
[ "MIT" ]
null
null
null
tests/test_plugin_xjson.py
mikegribov/filedjson
ee9f8408edcf8a72b8ed415237789a602ee6b579
[ "MIT" ]
null
null
null
tests/test_plugin_xjson.py
mikegribov/filedjson
ee9f8408edcf8a72b8ed415237789a602ee6b579
[ "MIT" ]
null
null
null
import os from ..xjson import XJson def test_json_eq_xjson(): json = XJson(os.path.join("examples", "single_file.json")) xjson = XJson(os.path.join("examples", "single_file.xjson")) assert json.structure == xjson.structure
30.5
66
0.688525
34
244
4.794118
0.441176
0.110429
0.134969
0.184049
0.404908
0.404908
0.404908
0
0
0
0
0
0.168033
244
8
67
30.5
0.802956
0
0
0
0
0
0.205882
0
0
0
0
0
0.166667
1
0.166667
false
0
0.333333
0
0.5
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
6994fb43f4f789a8273df5201619dede1b4eb5f3
212
py
Python
api/resources/v1/responses.py
thegrowthapp/backend
37f90822cef9fecb2f0912200fbb2416cd75946c
[ "MIT" ]
1
2018-08-04T07:45:04.000Z
2018-08-04T07:45:04.000Z
api/resources/v1/responses.py
jonhue/the_growth_app
37f90822cef9fecb2f0912200fbb2416cd75946c
[ "MIT" ]
23
2018-07-25T19:06:02.000Z
2018-09-05T13:15:50.000Z
api/resources/v1/responses.py
thegrowthapp/backend
37f90822cef9fecb2f0912200fbb2416cd75946c
[ "MIT" ]
1
2018-08-04T07:45:07.000Z
2018-08-04T07:45:07.000Z
def respond(code=200, payload={}, messages=[]): return { 'status': 'ok' if int(code/100) == 2 else 'error', 'code': code, 'messages': messages, 'payload': payload, }, code
26.5
58
0.518868
23
212
4.782609
0.652174
0
0
0
0
0
0
0
0
0
0
0.046667
0.292453
212
7
59
30.285714
0.686667
0
0
0
0
0
0.150943
0
0
0
0
0
0
1
0.142857
false
0
0
0.142857
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
1
0
0
0
3
69980e127b6b7f26f1e4333601f097ff2e897a67
332
py
Python
business/staff_accounts/__init__.py
daniel-waruo/e-commerse-api
6b080039398fb4099a34335317d649dd67783f63
[ "Apache-2.0" ]
6
2019-11-21T10:09:49.000Z
2021-06-19T09:52:59.000Z
business/staff_accounts/__init__.py
daniel-waruo/e-commerse-api
6b080039398fb4099a34335317d649dd67783f63
[ "Apache-2.0" ]
null
null
null
business/staff_accounts/__init__.py
daniel-waruo/e-commerse-api
6b080039398fb4099a34335317d649dd67783f63
[ "Apache-2.0" ]
null
null
null
default_app_config = 'business.staff_accounts.apps.UserManagementConfig' """ This APP is for management of users Functions:- Adding staff Users and giving them initial details -Department -Staff Type -Departmental,General Managers have predefined roles depending on the departments they can access """
33.2
105
0.746988
40
332
6.125
0.9
0
0
0
0
0
0
0
0
0
0
0
0.198795
332
9
106
36.888889
0.921053
0
0
0
0
0
0.662162
0.662162
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
69a79c27df3974e588d8a6e6a17263d2f4aa64c3
180
py
Python
students/k3343/practical_works/Tsybaeva_Arina/simple_django_web_project/django_project_tsybaeva/project_first_app/urls.py
TonikX/ITMO_ICT_-WebProgramming_2020
ba566c1b3ab04585665c69860b713741906935a0
[ "MIT" ]
10
2020-03-20T09:06:12.000Z
2021-07-27T13:06:02.000Z
students/k3343/practical_works/Tsybaeva_Arina/simple_django_web_project/django_project_tsybaeva/project_first_app/urls.py
TonikX/ITMO_ICT_-WebProgramming_2020
ba566c1b3ab04585665c69860b713741906935a0
[ "MIT" ]
134
2020-03-23T09:47:48.000Z
2022-03-12T01:05:19.000Z
students/k3343/practical_works/Tsybaeva_Arina/simple_django_web_project/django_project_tsybaeva/project_first_app/urls.py
TonikX/ITMO_ICT_-WebProgramming_2020
ba566c1b3ab04585665c69860b713741906935a0
[ "MIT" ]
71
2020-03-20T12:45:56.000Z
2021-10-31T19:22:25.000Z
from django.urls import path from . import views from .views import AutoCreate urlpatterns = [ path('owner/<int:owner_id>/', views.detail), path('', AutoCreate.as_view()) ]
25.714286
48
0.705556
24
180
5.208333
0.583333
0
0
0
0
0
0
0
0
0
0
0
0.15
180
7
49
25.714286
0.816993
0
0
0
0
0
0.116022
0.116022
0
0
0
0
0
1
0
false
0
0.428571
0
0.428571
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
69b3d84b19834ef44b6f53ac71c16f69481e41da
661
py
Python
board.py
MarcusRainbow/TwoPlayerGame
a10c0a5f949bcb6e03bdf8197c513511b3c29f98
[ "MIT" ]
null
null
null
board.py
MarcusRainbow/TwoPlayerGame
a10c0a5f949bcb6e03bdf8197c513511b3c29f98
[ "MIT" ]
null
null
null
board.py
MarcusRainbow/TwoPlayerGame
a10c0a5f949bcb6e03bdf8197c513511b3c29f98
[ "MIT" ]
null
null
null
from typing import List import numpy as np class Board: """ Represents the state of the game, and says which moves are available. """ def __init__(self, grid: np.ndarray, available): self.grid = np.copy(grid) self.available = available def clone(self): return Board(self.grid, self.available) def available_moves(self) -> List[int]: return self.available(self.grid) def apply_move(self, pos: int, token: int): """ Apply a players move. """ self.grid.flat[pos] = token def __str__(self) -> str: return f"{self.grid}"
25.423077
59
0.571861
82
661
4.487805
0.463415
0.130435
0.054348
0
0
0
0
0
0
0
0
0
0.320726
661
26
60
25.423077
0.819599
0.13767
0
0
0
0
0.021869
0
0
0
0
0
0
1
0.357143
false
0
0.142857
0.214286
0.785714
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
69b59a67a01786bbf72ef307f0e89fd7e30a9b40
802
py
Python
api/core/cors.py
sourcery-ai-bot/twitter-clone-server-fastapi
5ba34303da6b12b61ecb8c1a712bd1a1c318c4bf
[ "MIT" ]
10
2021-06-08T18:35:58.000Z
2022-03-26T15:56:26.000Z
api/core/cors.py
sourcery-ai-bot/twitter-clone-server-fastapi
5ba34303da6b12b61ecb8c1a712bd1a1c318c4bf
[ "MIT" ]
10
2021-05-04T04:41:01.000Z
2021-07-01T03:37:53.000Z
api/core/cors.py
sourcery-ai-bot/twitter-clone-server-fastapi
5ba34303da6b12b61ecb8c1a712bd1a1c318c4bf
[ "MIT" ]
5
2021-06-14T18:47:56.000Z
2022-03-26T15:56:30.000Z
# C.O.R.S. cors_origins = [ "http://localhost", "http://localhost:8080", "http://localhost:3000", # Production Client on Vercel "https://twitter-clone.programmertutor.com", "https://www.twitter-clone.programmertutor.com", "https://twitter.dericfagnan.com", "https://www.twitter.dericfagnan.com", # Websocket Origins "ws://localhost", "wss://localhost", "ws://localhost:8080", "wss://localhost:8080", "ws://twitter-clone.programmertutor.com", "ws://www.twitter-clone.programmertutor.com", "wss://twitter-clone.programmertutor.com", "wss://www.twitter-clone.programmertutor.com", "ws://twitter.dericfagnan.com", "ws://www.twitter.dericfagnan.com", "wss://twitter.dericfagnan.com", "wss://www.twitter.dericfagnan.com", ]
32.08
52
0.649626
90
802
5.777778
0.266667
0.138462
0.311538
0.346154
0.401923
0
0
0
0
0
0
0.023358
0.145885
802
24
53
33.416667
0.735766
0.067332
0
0
0
0
0.755376
0.38172
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
69c181d1f1ad4884073aaa23c7a483c300b788be
26,940
py
Python
nbgrader/tests/api/test_gradebook.py
lgpage/nbgrader
609a88b6237611a0cf293415ee25eeee51f19eda
[ "BSD-3-Clause-Clear" ]
1
2018-06-18T14:47:01.000Z
2018-06-18T14:47:01.000Z
nbgrader/tests/api/test_gradebook.py
lgpage/nbgrader
609a88b6237611a0cf293415ee25eeee51f19eda
[ "BSD-3-Clause-Clear" ]
1
2018-10-31T15:54:37.000Z
2018-10-31T15:54:37.000Z
nbgrader/tests/api/test_gradebook.py
lgpage/nbgrader
609a88b6237611a0cf293415ee25eeee51f19eda
[ "BSD-3-Clause-Clear" ]
null
null
null
import pytest from datetime import datetime from ... import api from ... import utils from ...api import InvalidEntry, MissingEntry @pytest.fixture def gradebook(request): gb = api.Gradebook("sqlite:///:memory:") def fin(): gb.close() request.addfinalizer(fin) return gb @pytest.fixture def assignment(gradebook): gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') gradebook.add_grade_cell('test1', 'p1', 'foo', max_score=1, cell_type='code') gradebook.add_grade_cell('test2', 'p1', 'foo', max_score=2, cell_type='markdown') gradebook.add_solution_cell('solution1', 'p1', 'foo') gradebook.add_solution_cell('test2', 'p1', 'foo') gradebook.add_source_cell('test1', 'p1', 'foo', cell_type='code') gradebook.add_source_cell('test2', 'p1', 'foo', cell_type='markdown') gradebook.add_source_cell('solution1', 'p1', 'foo', cell_type='code') return gradebook def test_init(gradebook): assert gradebook.students == [] assert gradebook.assignments == [] #### Test students def test_add_student(gradebook): s = gradebook.add_student('12345') assert s.id == '12345' assert gradebook.students == [s] # try adding a duplicate student with pytest.raises(InvalidEntry): gradebook.add_student('12345') # try adding a student with arguments s = gradebook.add_student('6789', last_name="Bar", first_name="Foo", email="foo@bar.com") assert s.id == '6789' assert s.last_name == "Bar" assert s.first_name == "Foo" assert s.email == "foo@bar.com" def test_add_duplicate_student(gradebook): # we also need this test because this will cause an IntegrityError # under the hood rather than a FlushError gradebook.add_student('12345') with pytest.raises(InvalidEntry): gradebook.add_student('12345') def test_find_student(gradebook): s1 = gradebook.add_student('12345') assert gradebook.find_student('12345') == s1 s2 = gradebook.add_student('abcd') assert gradebook.find_student('12345') == s1 assert gradebook.find_student('abcd') == s2 def test_find_nonexistant_student(gradebook): with pytest.raises(MissingEntry): gradebook.find_student('12345') def test_remove_student(assignment): assignment.add_student('hacker123') assignment.add_submission('foo', 'hacker123') assignment.remove_student('hacker123') with pytest.raises(MissingEntry): assignment.find_submission('foo', 'hacker123') with pytest.raises(MissingEntry): assignment.find_student('hacker123') def test_update_or_create_student(gradebook): # first test creating it s1 = gradebook.update_or_create_student('hacker123') assert gradebook.find_student('hacker123') == s1 assert s1.first_name is None # now test finding/updating it s2 = gradebook.update_or_create_student('hacker123', first_name='Alyssa') assert s1 == s2 assert s2.first_name == 'Alyssa' #### Test assignments def test_add_assignment(gradebook): a = gradebook.add_assignment('foo') assert a.name == 'foo' assert gradebook.assignments == [a] # try adding a duplicate assignment with pytest.raises(InvalidEntry): gradebook.add_assignment('foo') # try adding an assignment with arguments now = datetime.utcnow() a = gradebook.add_assignment('bar', duedate=now) assert a.name == 'bar' assert a.duedate == now # try adding with a string timestamp a = gradebook.add_assignment('baz', duedate=now.isoformat()) assert a.name == 'baz' assert a.duedate == now def test_add_duplicate_assignment(gradebook): gradebook.add_assignment('foo') with pytest.raises(InvalidEntry): gradebook.add_assignment('foo') def test_find_assignment(gradebook): a1 = gradebook.add_assignment('foo') assert gradebook.find_assignment('foo') == a1 a2 = gradebook.add_assignment('bar') assert gradebook.find_assignment('foo') == a1 assert gradebook.find_assignment('bar') == a2 def test_find_nonexistant_assignment(gradebook): with pytest.raises(MissingEntry): gradebook.find_assignment('foo') def test_remove_assignment(assignment): assignment.add_student('hacker123') assignment.add_submission('foo', 'hacker123') notebooks = assignment.find_assignment('foo').notebooks grade_cells = [x for nb in notebooks for x in nb.grade_cells] solution_cells = [x for nb in notebooks for x in nb.solution_cells] source_cells = [x for nb in notebooks for x in nb.source_cells] assignment.remove_assignment('foo') for nb in notebooks: assert assignment.db.query(api.SubmittedNotebook).filter(api.SubmittedNotebook.id == nb.id).all() == [] for grade_cell in grade_cells: assert assignment.db.query(api.GradeCell).filter(api.GradeCell.id == grade_cell.id).all() == [] for solution_cell in solution_cells: assert assignment.db.query(api.SolutionCell).filter(api.SolutionCell.id == solution_cell.id).all() == [] for source_cell in source_cells: assert assignment.db.query(api.SourceCell).filter(api.SourceCell.id == source_cell.id).all() == [] with pytest.raises(MissingEntry): assignment.find_assignment('foo') assert assignment.find_student('hacker123').submissions == [] def test_update_or_create_assignment(gradebook): # first test creating it a1 = gradebook.update_or_create_assignment('foo') assert gradebook.find_assignment('foo') == a1 assert a1.duedate is None # now test finding/updating it a2 = gradebook.update_or_create_assignment('foo', duedate="2015-02-02 14:58:23.948203 PST") assert a1 == a2 assert a2.duedate == utils.parse_utc("2015-02-02 14:58:23.948203 PST") #### Test notebooks def test_add_notebook(gradebook): a = gradebook.add_assignment('foo') n = gradebook.add_notebook('p1', 'foo') assert n.name == 'p1' assert n.assignment == a assert a.notebooks == [n] # try adding a duplicate assignment with pytest.raises(InvalidEntry): gradebook.add_notebook('p1', 'foo') def test_add_duplicate_notebook(gradebook): # it should be ok to add a notebook with the same name, as long as # it's for different assignments gradebook.add_assignment('foo') gradebook.add_assignment('bar') n1 = gradebook.add_notebook('p1', 'foo') n2 = gradebook.add_notebook('p1', 'bar') assert n1.id != n2.id # but not ok to add a notebook with the same name for the same assignment with pytest.raises(InvalidEntry): gradebook.add_notebook('p1', 'foo') def test_find_notebook(gradebook): gradebook.add_assignment('foo') n1 = gradebook.add_notebook('p1', 'foo') assert gradebook.find_notebook('p1', 'foo') == n1 n2 = gradebook.add_notebook('p2', 'foo') assert gradebook.find_notebook('p1', 'foo') == n1 assert gradebook.find_notebook('p2', 'foo') == n2 def test_find_nonexistant_notebook(gradebook): # check that it doesn't find it when there is nothing in the db with pytest.raises(MissingEntry): gradebook.find_notebook('p1', 'foo') # check that it doesn't find it even if the assignment exists gradebook.add_assignment('foo') with pytest.raises(MissingEntry): gradebook.find_notebook('p1', 'foo') def test_update_or_create_notebook(gradebook): # first test creating it gradebook.add_assignment('foo') n1 = gradebook.update_or_create_notebook('p1', 'foo') assert gradebook.find_notebook('p1', 'foo') == n1 # now test finding/updating it n2 = gradebook.update_or_create_notebook('p1', 'foo') assert n1 == n2 def test_remove_notebook(assignment): assignment.add_student('hacker123') assignment.add_submission('foo', 'hacker123') notebooks = assignment.find_assignment('foo').notebooks for nb in notebooks: grade_cells = [x for x in nb.grade_cells] solution_cells = [x for x in nb.solution_cells] source_cells = [x for x in nb.source_cells] assignment.remove_notebook(nb.name, 'foo') assert assignment.db.query(api.SubmittedNotebook).filter(api.SubmittedNotebook.id == nb.id).all() == [] for grade_cell in grade_cells: assert assignment.db.query(api.GradeCell).filter(api.GradeCell.id == grade_cell.id).all() == [] for solution_cell in solution_cells: assert assignment.db.query(api.SolutionCell).filter(api.SolutionCell.id == solution_cell.id).all() == [] for source_cell in source_cells: assert assignment.db.query(api.SourceCell).filter(api.SourceCell.id == source_cell.id).all() == [] with pytest.raises(MissingEntry): assignment.find_notebook(nb.name, 'foo') #### Test grade cells def test_add_grade_cell(gradebook): gradebook.add_assignment('foo') n = gradebook.add_notebook('p1', 'foo') gc = gradebook.add_grade_cell('test1', 'p1', 'foo', max_score=2, cell_type='markdown') assert gc.name == 'test1' assert gc.max_score == 2 assert gc.cell_type == 'markdown' assert n.grade_cells == [gc] assert gc.notebook == n def test_add_grade_cell_with_args(gradebook): gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') gc = gradebook.add_grade_cell( 'test1', 'p1', 'foo', max_score=3, cell_type="code") assert gc.name == 'test1' assert gc.max_score == 3 assert gc.cell_type == "code" def test_create_invalid_grade_cell(gradebook): gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') with pytest.raises(InvalidEntry): gradebook.add_grade_cell( 'test1', 'p1', 'foo', max_score=3, cell_type="something") def test_add_duplicate_grade_cell(gradebook): gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') gradebook.add_grade_cell('test1', 'p1', 'foo', max_score=1, cell_type='code') with pytest.raises(InvalidEntry): gradebook.add_grade_cell('test1', 'p1', 'foo', max_score=2, cell_type='markdown') def test_find_grade_cell(gradebook): gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') gc1 = gradebook.add_grade_cell('test1', 'p1', 'foo', max_score=1, cell_type='code') assert gradebook.find_grade_cell('test1', 'p1', 'foo') == gc1 gc2 = gradebook.add_grade_cell('test2', 'p1', 'foo', max_score=2, cell_type='code') assert gradebook.find_grade_cell('test1', 'p1', 'foo') == gc1 assert gradebook.find_grade_cell('test2', 'p1', 'foo') == gc2 def test_find_nonexistant_grade_cell(gradebook): with pytest.raises(MissingEntry): gradebook.find_grade_cell('test1', 'p1', 'foo') gradebook.add_assignment('foo') with pytest.raises(MissingEntry): gradebook.find_grade_cell('test1', 'p1', 'foo') gradebook.add_notebook('p1', 'foo') with pytest.raises(MissingEntry): gradebook.find_grade_cell('test1', 'p1', 'foo') def test_update_or_create_grade_cell(gradebook): # first test creating it gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') gc1 = gradebook.update_or_create_grade_cell('test1', 'p1', 'foo', max_score=2, cell_type='code') assert gc1.max_score == 2 assert gc1.cell_type == 'code' assert gradebook.find_grade_cell('test1', 'p1', 'foo') == gc1 # now test finding/updating it gc2 = gradebook.update_or_create_grade_cell('test1', 'p1', 'foo', max_score=3) assert gc1 == gc2 assert gc1.max_score == 3 assert gc1.cell_type == 'code' #### Test solution cells def test_add_solution_cell(gradebook): gradebook.add_assignment('foo') n = gradebook.add_notebook('p1', 'foo') sc = gradebook.add_solution_cell('test1', 'p1', 'foo') assert sc.name == 'test1' assert n.solution_cells == [sc] assert sc.notebook == n def test_add_duplicate_solution_cell(gradebook): gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') gradebook.add_solution_cell('test1', 'p1', 'foo') with pytest.raises(InvalidEntry): gradebook.add_solution_cell('test1', 'p1', 'foo') def test_find_solution_cell(gradebook): gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') sc1 = gradebook.add_solution_cell('test1', 'p1', 'foo') assert gradebook.find_solution_cell('test1', 'p1', 'foo') == sc1 sc2 = gradebook.add_solution_cell('test2', 'p1', 'foo') assert gradebook.find_solution_cell('test1', 'p1', 'foo') == sc1 assert gradebook.find_solution_cell('test2', 'p1', 'foo') == sc2 def test_find_nonexistant_solution_cell(gradebook): with pytest.raises(MissingEntry): gradebook.find_solution_cell('test1', 'p1', 'foo') gradebook.add_assignment('foo') with pytest.raises(MissingEntry): gradebook.find_solution_cell('test1', 'p1', 'foo') gradebook.add_notebook('p1', 'foo') with pytest.raises(MissingEntry): gradebook.find_solution_cell('test1', 'p1', 'foo') def test_update_or_create_solution_cell(gradebook): # first test creating it gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') sc1 = gradebook.update_or_create_solution_cell('test1', 'p1', 'foo') assert gradebook.find_solution_cell('test1', 'p1', 'foo') == sc1 # now test finding/updating it sc2 = gradebook.update_or_create_solution_cell('test1', 'p1', 'foo') assert sc1 == sc2 #### Test source cells def test_add_source_cell(gradebook): gradebook.add_assignment('foo') n = gradebook.add_notebook('p1', 'foo') sc = gradebook.add_source_cell('test1', 'p1', 'foo', cell_type="code") assert sc.name == 'test1' assert sc.cell_type == 'code' assert n.source_cells == [sc] assert sc.notebook == n def test_add_source_cell_with_args(gradebook): gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') sc = gradebook.add_source_cell( 'test1', 'p1', 'foo', source="blah blah blah", cell_type="code", checksum="abcde") assert sc.name == 'test1' assert sc.source == "blah blah blah" assert sc.cell_type == "code" assert sc.checksum == "abcde" def test_create_invalid_source_cell(gradebook): gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') with pytest.raises(InvalidEntry): gradebook.add_source_cell( 'test1', 'p1', 'foo', source="blah blah blah", cell_type="something", checksum="abcde") def test_add_duplicate_source_cell(gradebook): gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') gradebook.add_source_cell('test1', 'p1', 'foo', cell_type="code") with pytest.raises(InvalidEntry): gradebook.add_source_cell('test1', 'p1', 'foo', cell_type="code") def test_find_source_cell(gradebook): gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') sc1 = gradebook.add_source_cell('test1', 'p1', 'foo', cell_type="code") assert gradebook.find_source_cell('test1', 'p1', 'foo') == sc1 sc2 = gradebook.add_source_cell('test2', 'p1', 'foo', cell_type="code") assert gradebook.find_source_cell('test1', 'p1', 'foo') == sc1 assert gradebook.find_source_cell('test2', 'p1', 'foo') == sc2 def test_find_nonexistant_source_cell(gradebook): with pytest.raises(MissingEntry): gradebook.find_source_cell('test1', 'p1', 'foo') gradebook.add_assignment('foo') with pytest.raises(MissingEntry): gradebook.find_source_cell('test1', 'p1', 'foo') gradebook.add_notebook('p1', 'foo') with pytest.raises(MissingEntry): gradebook.find_source_cell('test1', 'p1', 'foo') def test_update_or_create_source_cell(gradebook): # first test creating it gradebook.add_assignment('foo') gradebook.add_notebook('p1', 'foo') sc1 = gradebook.update_or_create_source_cell('test1', 'p1', 'foo', cell_type='code') assert sc1.cell_type == 'code' assert gradebook.find_source_cell('test1', 'p1', 'foo') == sc1 # now test finding/updating it assert sc1.checksum == None sc2 = gradebook.update_or_create_source_cell('test1', 'p1', 'foo', checksum="123456") assert sc1 == sc2 assert sc1.cell_type == 'code' assert sc1.checksum == "123456" #### Test submissions def test_add_submission(assignment): assignment.add_student('hacker123') assignment.add_student('bitdiddle') s1 = assignment.add_submission('foo', 'hacker123') s2 = assignment.add_submission('foo', 'bitdiddle') assert assignment.assignment_submissions('foo') == [s2, s1] assert assignment.student_submissions('hacker123') == [s1] assert assignment.student_submissions('bitdiddle') == [s2] assert assignment.find_submission('foo', 'hacker123') == s1 assert assignment.find_submission('foo', 'bitdiddle') == s2 def test_add_duplicate_submission(assignment): assignment.add_student('hacker123') assignment.add_submission('foo', 'hacker123') with pytest.raises(InvalidEntry): assignment.add_submission('foo', 'hacker123') def test_remove_submission(assignment): assignment.add_student('hacker123') assignment.add_submission('foo', 'hacker123') submission = assignment.find_submission('foo', 'hacker123') notebooks = submission.notebooks grades = [x for nb in notebooks for x in nb.grades] comments = [x for nb in notebooks for x in nb.comments] assignment.remove_submission('foo', 'hacker123') for nb in notebooks: assert assignment.db.query(api.SubmittedNotebook).filter(api.SubmittedNotebook.id == nb.id).all() == [] for grade in grades: assert assignment.db.query(api.Grade).filter(api.Grade.id == grade.id).all() == [] for comment in comments: assert assignment.db.query(api.Comment).filter(api.Comment.id == comment.id).all() == [] with pytest.raises(MissingEntry): assignment.find_submission('foo', 'hacker123') def test_update_or_create_submission(assignment): assignment.add_student('hacker123') s1 = assignment.update_or_create_submission('foo', 'hacker123') assert s1.timestamp is None s2 = assignment.update_or_create_submission('foo', 'hacker123', timestamp="2015-02-02 14:58:23.948203 PST") assert s1 == s2 assert s2.timestamp == utils.parse_utc("2015-02-02 14:58:23.948203 PST") def test_find_submission_notebook(assignment): assignment.add_student('hacker123') s = assignment.add_submission('foo', 'hacker123') n1, = s.notebooks with pytest.raises(MissingEntry): assignment.find_submission_notebook('p2', 'foo', 'hacker123') n2 = assignment.find_submission_notebook('p1', 'foo', 'hacker123') assert n1 == n2 def test_find_submission_notebook_by_id(assignment): assignment.add_student('hacker123') s = assignment.add_submission('foo', 'hacker123') n1, = s.notebooks with pytest.raises(MissingEntry): assignment.find_submission_notebook_by_id('12345') n2 = assignment.find_submission_notebook_by_id(n1.id) assert n1 == n2 def test_remove_submission_notebook(assignment): assignment.add_student('hacker123') assignment.add_submission('foo', 'hacker123') submission = assignment.find_submission('foo', 'hacker123') notebooks = submission.notebooks for nb in notebooks: grades = [x for x in nb.grades] comments = [x for x in nb.comments] assignment.remove_submission_notebook(nb.name, 'foo', 'hacker123') assert assignment.db.query(api.SubmittedNotebook).filter(api.SubmittedNotebook.id == nb.id).all() == [] for grade in grades: assert assignment.db.query(api.Grade).filter(api.Grade.id == grade.id).all() == [] for comment in comments: assert assignment.db.query(api.Comment).filter(api.Comment.id == comment.id).all() == [] with pytest.raises(MissingEntry): assignment.find_submission_notebook(nb.name, 'foo', 'hacker123') def test_find_grade(assignment): assignment.add_student('hacker123') s = assignment.add_submission('foo', 'hacker123') n1, = s.notebooks grades = n1.grades for g1 in grades: g2 = assignment.find_grade(g1.name, 'p1', 'foo', 'hacker123') assert g1 == g2 with pytest.raises(MissingEntry): assignment.find_grade('asdf', 'p1', 'foo', 'hacker123') def test_find_grade_by_id(assignment): assignment.add_student('hacker123') s = assignment.add_submission('foo', 'hacker123') n1, = s.notebooks grades = n1.grades for g1 in grades: g2 = assignment.find_grade_by_id(g1.id) assert g1 == g2 with pytest.raises(MissingEntry): assignment.find_grade_by_id('12345') def test_find_comment(assignment): assignment.add_student('hacker123') s = assignment.add_submission('foo', 'hacker123') n1, = s.notebooks comments = n1.comments for c1 in comments: c2 = assignment.find_comment(c1.name, 'p1', 'foo', 'hacker123') assert c1 == c2 with pytest.raises(MissingEntry): assignment.find_comment('asdf', 'p1', 'foo', 'hacker123') def test_find_comment_by_id(assignment): assignment.add_student('hacker123') s = assignment.add_submission('foo', 'hacker123') n1, = s.notebooks comments = n1.comments for c1 in comments: c2 = assignment.find_comment_by_id(c1.id) assert c1 == c2 with pytest.raises(MissingEntry): assignment.find_comment_by_id('12345') ### Test average scores def test_average_assignment_score(assignment): assert assignment.average_assignment_score('foo') == 0.0 assert assignment.average_assignment_code_score('foo') == 0.0 assert assignment.average_assignment_written_score('foo') == 0.0 assignment.add_student('hacker123') assignment.add_student('bitdiddle') assignment.add_submission('foo', 'hacker123') assignment.add_submission('foo', 'bitdiddle') assert assignment.average_assignment_score('foo') == 0.0 assert assignment.average_assignment_code_score('foo') == 0.0 assert assignment.average_assignment_written_score('foo') == 0.0 g1 = assignment.find_grade("test1", "p1", "foo", "hacker123") g2 = assignment.find_grade("test2", "p1", "foo", "hacker123") g3 = assignment.find_grade("test1", "p1", "foo", "bitdiddle") g4 = assignment.find_grade("test2", "p1", "foo", "bitdiddle") g1.manual_score = 0.5 g2.manual_score = 2 g3.manual_score = 1 g4.manual_score = 1 assignment.db.commit() assert assignment.average_assignment_score('foo') == 2.25 assert assignment.average_assignment_code_score('foo') == 0.75 assert assignment.average_assignment_written_score('foo') == 1.5 def test_average_notebook_score(assignment): assert assignment.average_notebook_score('p1', 'foo') == 0 assert assignment.average_notebook_code_score('p1', 'foo') == 0 assert assignment.average_notebook_written_score('p1', 'foo') == 0 assignment.add_student('hacker123') assignment.add_student('bitdiddle') assignment.add_submission('foo', 'hacker123') assignment.add_submission('foo', 'bitdiddle') assert assignment.average_notebook_score('p1', 'foo') == 0.0 assert assignment.average_notebook_code_score('p1', 'foo') == 0.0 assert assignment.average_notebook_written_score('p1', 'foo') == 0.0 g1 = assignment.find_grade("test1", "p1", "foo", "hacker123") g2 = assignment.find_grade("test2", "p1", "foo", "hacker123") g3 = assignment.find_grade("test1", "p1", "foo", "bitdiddle") g4 = assignment.find_grade("test2", "p1", "foo", "bitdiddle") g1.manual_score = 0.5 g2.manual_score = 2 g3.manual_score = 1 g4.manual_score = 1 assignment.db.commit() assert assignment.average_notebook_score('p1', 'foo') == 2.25 assert assignment.average_notebook_code_score('p1', 'foo') == 0.75 assert assignment.average_notebook_written_score('p1', 'foo') == 1.5 ## Test mass dictionary queries def test_student_dicts(assignment): assignment.add_student('hacker123') assignment.add_student('bitdiddle') assignment.add_student('louisreasoner') assignment.add_submission('foo', 'hacker123') assignment.add_submission('foo', 'bitdiddle') g1 = assignment.find_grade("test1", "p1", "foo", "hacker123") g2 = assignment.find_grade("test2", "p1", "foo", "hacker123") g3 = assignment.find_grade("test1", "p1", "foo", "bitdiddle") g4 = assignment.find_grade("test2", "p1", "foo", "bitdiddle") g1.manual_score = 0.5 g2.manual_score = 2 g3.manual_score = 1 g4.manual_score = 1 assignment.db.commit() students = assignment.student_dicts() a = sorted(students, key=lambda x: x["id"]) b = sorted([x.to_dict() for x in assignment.students], key=lambda x: x["id"]) assert a == b def test_student_dicts_zero_points(gradebook): gradebook.add_assignment("ps1") s = gradebook.add_student("1234") assert gradebook.student_dicts() == [s.to_dict()] def test_notebook_submission_dicts(assignment): assignment.add_student('hacker123') assignment.add_student('bitdiddle') s1 = assignment.add_submission('foo', 'hacker123') s2 = assignment.add_submission('foo', 'bitdiddle') s1.flagged = True s2.flagged = False g1 = assignment.find_grade("test1", "p1", "foo", "hacker123") g2 = assignment.find_grade("test2", "p1", "foo", "hacker123") g3 = assignment.find_grade("test1", "p1", "foo", "bitdiddle") g4 = assignment.find_grade("test2", "p1", "foo", "bitdiddle") g1.manual_score = 0.5 g2.manual_score = 2 g3.manual_score = 1 g4.manual_score = 1 assignment.db.commit() notebook = assignment.find_notebook("p1", "foo") submissions = assignment.notebook_submission_dicts("p1", "foo") a = sorted(submissions, key=lambda x: x["id"]) b = sorted([x.to_dict() for x in notebook.submissions], key=lambda x: x["id"]) assert a == b def test_submission_dicts(assignment): assignment.add_student('hacker123') assignment.add_student('bitdiddle') s1 = assignment.add_submission('foo', 'hacker123') s2 = assignment.add_submission('foo', 'bitdiddle') s1.flagged = True s2.flagged = False g1 = assignment.find_grade("test1", "p1", "foo", "hacker123") g2 = assignment.find_grade("test2", "p1", "foo", "hacker123") g3 = assignment.find_grade("test1", "p1", "foo", "bitdiddle") g4 = assignment.find_grade("test2", "p1", "foo", "bitdiddle") g1.manual_score = 0.5 g2.manual_score = 2 g3.manual_score = 1 g4.manual_score = 1 assignment.db.commit() a = sorted(assignment.submission_dicts("foo"), key=lambda x: x["id"]) b = sorted([x.to_dict() for x in assignment.find_assignment("foo").submissions], key=lambda x: x["id"]) assert a == b
34.318471
116
0.687045
3,468
26,940
5.13812
0.058535
0.033953
0.029182
0.032998
0.821314
0.769909
0.722599
0.682193
0.629328
0.58258
0
0.037436
0.173051
26,940
784
117
34.362245
0.762411
0.0402
0
0.581353
0
0
0.104233
0
0
0
0
0
0.23766
1
0.106033
false
0
0.009141
0
0.11883
0
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
69e05cf43fe1c4ef8cdf21723ebb64fb07640591
80
py
Python
examples/reservation/createReservationsJinja2/globalconfig.py
torchedplatypi/vra7-rest-wrapper
11553fbba8037f7131a50247d9478a75265b42f9
[ "MIT" ]
18
2015-07-07T19:18:38.000Z
2019-07-19T07:39:17.000Z
examples/reservation/createReservationsJinja2/globalconfig.py
torchedplatypi/vra7-rest-wrapper
11553fbba8037f7131a50247d9478a75265b42f9
[ "MIT" ]
5
2015-08-14T17:02:26.000Z
2017-05-23T08:43:36.000Z
examples/reservation/createReservationsJinja2/globalconfig.py
torchedplatypi/vra7-rest-wrapper
11553fbba8037f7131a50247d9478a75265b42f9
[ "MIT" ]
24
2015-08-14T09:12:44.000Z
2021-05-04T16:30:08.000Z
#!/usr/bin/python import getpass url = '' usr = '' passwd = getpass.getpass()
10
26
0.6375
10
80
5.1
0.7
0
0
0
0
0
0
0
0
0
0
0
0.175
80
7
27
11.428571
0.772727
0.2
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.5
0.25
0
0.25
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
0e0362ba50bccdc7462665d55cb9879a169ffb00
199
py
Python
alignmentrs/aln/mixins/tests/mocks.py
yamasampo/alignmentrs
5f963d13ac2db72f4ef23b462de0836526f590b7
[ "MIT" ]
null
null
null
alignmentrs/aln/mixins/tests/mocks.py
yamasampo/alignmentrs
5f963d13ac2db72f4ef23b462de0836526f590b7
[ "MIT" ]
null
null
null
alignmentrs/aln/mixins/tests/mocks.py
yamasampo/alignmentrs
5f963d13ac2db72f4ef23b462de0836526f590b7
[ "MIT" ]
null
null
null
class MockData: def __init__(self): self.data = [ 'ATGCAT', 'ATGGGT', 'ATGAAT', ] def get_row(self, i): return self.sequences[i]
16.583333
32
0.447236
19
199
4.421053
0.736842
0
0
0
0
0
0
0
0
0
0
0
0.432161
199
12
32
16.583333
0.743363
0
0
0
0
0
0.090909
0
0
0
0
0
0
1
0.222222
false
0
0
0.111111
0.444444
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
3
386690a4485f7b14374cd354c2e41ff3d4ebac68
241
py
Python
amocrm_api_client/models/__init__.py
iqtek/amocrm_api_client
910ea42482698f5eb47d6b6e12d52ec09af77a3e
[ "MIT" ]
null
null
null
amocrm_api_client/models/__init__.py
iqtek/amocrm_api_client
910ea42482698f5eb47d6b6e12d52ec09af77a3e
[ "MIT" ]
null
null
null
amocrm_api_client/models/__init__.py
iqtek/amocrm_api_client
910ea42482698f5eb47d6b6e12d52ec09af77a3e
[ "MIT" ]
null
null
null
from .pipeline import * from .call import * from .Company import Company from .Contact import Contact from .lead import * from .Task import Task from .Tag import Tag from .user import User from .Account import Account from .Page import Page
21.909091
28
0.780083
37
241
5.081081
0.324324
0.159574
0
0
0
0
0
0
0
0
0
0
0.165975
241
10
29
24.1
0.935323
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
386e5475b983d626808f084ac2193231c6467a86
247
py
Python
apps/jobs/models/jobs.py
rainydaygit/testtcloudserver
8037603efe4502726a4d794fb1fc0a3f3cc80137
[ "MIT" ]
349
2020-08-04T10:21:01.000Z
2022-03-23T08:31:29.000Z
apps/jobs/models/jobs.py
rainydaygit/testtcloudserver
8037603efe4502726a4d794fb1fc0a3f3cc80137
[ "MIT" ]
2
2021-01-07T06:17:05.000Z
2021-04-01T06:01:30.000Z
apps/jobs/models/jobs.py
rainydaygit/testtcloudserver
8037603efe4502726a4d794fb1fc0a3f3cc80137
[ "MIT" ]
70
2020-08-24T06:46:14.000Z
2022-03-25T13:23:27.000Z
from library.api.db import EntityModel, db class JobsRecord(EntityModel): ACTIVE = 0 DISABLE = 1 job_id = db.Column(db.String(100)) # Job id result = db.Column(db.String(1000)) # Job 结果 log = db.Column(db.Text) # Job log
22.454545
49
0.647773
38
247
4.184211
0.578947
0.150943
0.188679
0.201258
0
0
0
0
0
0
0
0.047368
0.230769
247
10
50
24.7
0.789474
0.08502
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.142857
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
388a1a896a59d296e3800ddb5dc7690fd9711761
746
py
Python
tests/test_rms.py
lynnehansen/kallisto
d7be52e8b7fc9f28e78e5805ae4f4923bd7e60c2
[ "Apache-2.0" ]
34
2021-02-05T08:35:20.000Z
2022-03-17T08:14:30.000Z
tests/test_rms.py
albernsrya/kallisto
edc686257a4c8a98a7ec0ca78a38948634bb8523
[ "Apache-2.0" ]
38
2021-02-05T08:25:47.000Z
2021-09-13T09:24:37.000Z
tests/test_rms.py
albernsrya/kallisto
edc686257a4c8a98a7ec0ca78a38948634bb8523
[ "Apache-2.0" ]
19
2021-02-05T07:43:35.000Z
2022-02-25T07:09:20.000Z
# tests/test_rms.py import numpy as np from kallisto.rmsd import rmsd from tests.store import propanolIntermediate, propanolLowest def test_rms(): mol1 = propanolLowest() nat1 = mol1.get_number_of_atoms() coord1 = mol1.get_positions() mol2 = propanolIntermediate() coord2 = mol2.get_positions() _, u = rmsd(nat1, coord1, coord2) assert np.isclose(u[0, 0], 0.98139458) assert np.isclose(u[0, 1], -0.04965545) assert np.isclose(u[0, 2], -0.18546973) assert np.isclose(u[1, 0], 0.06170977) assert np.isclose(u[1, 1], 0.9963015) assert np.isclose(u[1, 2], 0.05979323) assert np.isclose(u[2, 0], 0.18181471) assert np.isclose(u[2, 1], -0.07012604) assert np.isclose(u[2, 2], 0.98082911)
29.84
60
0.670241
117
746
4.205128
0.34188
0.146341
0.27439
0.292683
0.310976
0
0
0
0
0
0
0.179276
0.184987
746
24
61
31.083333
0.629934
0.022788
0
0
0
0
0
0
0
0
0
0
0.473684
1
0.052632
false
0
0.157895
0
0.210526
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
3
388fa00e313997127581f565fdca61f05400fbd3
2,455
py
Python
tb_api_client/test/test_plugin_controller_api.py
MOSAIC-LoPoW/oss7-thingsboard-backend-example
9b289dd7fdbb6e932ca338ad497a7bb1fc84d010
[ "Apache-2.0" ]
5
2017-11-27T15:48:16.000Z
2020-09-21T04:18:47.000Z
tb_api_client/test/test_plugin_controller_api.py
MOSAIC-LoPoW/oss7-thingsboard-backend-example
9b289dd7fdbb6e932ca338ad497a7bb1fc84d010
[ "Apache-2.0" ]
null
null
null
tb_api_client/test/test_plugin_controller_api.py
MOSAIC-LoPoW/oss7-thingsboard-backend-example
9b289dd7fdbb6e932ca338ad497a7bb1fc84d010
[ "Apache-2.0" ]
6
2018-01-14T17:23:46.000Z
2019-06-24T13:38:54.000Z
# coding: utf-8 """ Thingsboard REST API For instructions how to authorize requests please visit <a href='http://thingsboard.io/docs/reference/rest-api/'>REST API documentation page</a>. OpenAPI spec version: 2.0 Contact: info@thingsboard.io Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys import unittest import swagger_client from swagger_client.rest import ApiException from swagger_client.apis.plugin_controller_api import PluginControllerApi class TestPluginControllerApi(unittest.TestCase): """ PluginControllerApi unit test stubs """ def setUp(self): self.api = swagger_client.apis.plugin_controller_api.PluginControllerApi() def tearDown(self): pass def test_activate_plugin_by_id_using_post(self): """ Test case for activate_plugin_by_id_using_post activatePluginById """ pass def test_delete_plugin_using_delete(self): """ Test case for delete_plugin_using_delete deletePlugin """ pass def test_get_plugin_by_id_using_get(self): """ Test case for get_plugin_by_id_using_get getPluginById """ pass def test_get_plugin_by_token_using_get(self): """ Test case for get_plugin_by_token_using_get getPluginByToken """ pass def test_get_plugins_using_get(self): """ Test case for get_plugins_using_get getPlugins """ pass def test_get_system_plugins_using_get(self): """ Test case for get_system_plugins_using_get getSystemPlugins """ pass def test_get_tenant_plugins_using_get(self): """ Test case for get_tenant_plugins_using_get getTenantPlugins """ pass def test_get_tenant_plugins_using_get1(self): """ Test case for get_tenant_plugins_using_get1 getTenantPlugins """ pass def test_save_plugin_using_post(self): """ Test case for save_plugin_using_post savePlugin """ pass def test_suspend_plugin_by_id_using_post(self): """ Test case for suspend_plugin_by_id_using_post suspendPluginById """ pass if __name__ == '__main__': unittest.main()
20.982906
149
0.64888
287
2,455
5.156794
0.303136
0.047297
0.074324
0.101351
0.418919
0.391216
0.230405
0.19527
0.091892
0
0
0.002843
0.283503
2,455
116
150
21.163793
0.838545
0.377189
0
0.323529
0
0
0.006751
0
0
0
0
0
0
1
0.352941
false
0.323529
0.205882
0
0.588235
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
3898ae25af69f34b44b51213da6456928210e4c9
13,729
py
Python
tracker/migrations/0001_initial.py
AB-informatica-service/swat4stats.com
c3a7e83953373b8d876a4ca7055b59168f345442
[ "MIT" ]
14
2015-04-02T06:50:10.000Z
2021-02-18T13:26:46.000Z
tracker/migrations/0001_initial.py
AB-informatica-service/swat4stats.com
c3a7e83953373b8d876a4ca7055b59168f345442
[ "MIT" ]
4
2016-09-09T19:27:44.000Z
2020-05-08T17:59:31.000Z
tracker/migrations/0001_initial.py
AB-informatica-service/swat4stats.com
c3a7e83953373b8d876a4ca7055b59168f345442
[ "MIT" ]
8
2015-01-03T02:44:04.000Z
2022-03-23T19:52:00.000Z
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import tracker.models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Alias', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('name', models.CharField(max_length=64)), ], options={ }, bases=(models.Model,), ), migrations.CreateModel( name='Article', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('title', models.CharField(max_length=64)), ('text', models.TextField()), ('signature', models.CharField(max_length=128, blank=True)), ('is_published', models.BooleanField(default=False)), ('date_published', models.DateTimeField()), ('date_created', models.DateTimeField(auto_now_add=True)), ('date_updated', models.DateTimeField(auto_now=True)), ], options={ }, bases=(models.Model,), ), migrations.CreateModel( name='Game', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('tag', models.CharField(unique=True, max_length=8, null=True)), ('time', models.SmallIntegerField(default=0)), ('outcome', models.SmallIntegerField(default=0)), ('gametype', models.SmallIntegerField(null=True)), ('mapname', models.SmallIntegerField(null=True)), ('player_num', models.SmallIntegerField(default=0)), ('score_swat', models.SmallIntegerField(default=0)), ('score_sus', models.SmallIntegerField(default=0)), ('vict_swat', models.SmallIntegerField(default=0)), ('vict_sus', models.SmallIntegerField(default=0)), ('rd_bombs_defused', models.SmallIntegerField(default=0)), ('rd_bombs_total', models.SmallIntegerField(default=0)), ('coop_score', models.SmallIntegerField(default=0)), ('date_finished', models.DateTimeField(auto_now_add=True)), ], options={ }, bases=(models.Model, tracker.models.GameMixin), ), migrations.CreateModel( name='IP', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('range_from', models.BigIntegerField()), ('range_to', models.BigIntegerField()), ('date_created', models.DateTimeField(auto_now_add=True)), ], options={ }, bases=(models.Model,), ), migrations.CreateModel( name='ISP', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('name', models.CharField(max_length=255, null=True)), ('country', models.CharField(max_length=2, null=True)), ], options={ }, bases=(models.Model,), ), migrations.CreateModel( name='Loadout', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('primary', models.SmallIntegerField(default=0)), ('primary_ammo', models.SmallIntegerField(default=0)), ('secondary', models.SmallIntegerField(default=0)), ('secondary_ammo', models.SmallIntegerField(default=0)), ('equip_one', models.SmallIntegerField(default=0)), ('equip_two', models.SmallIntegerField(default=0)), ('equip_three', models.SmallIntegerField(default=0)), ('equip_four', models.SmallIntegerField(default=0)), ('equip_five', models.SmallIntegerField(default=0)), ('breacher', models.SmallIntegerField(default=0)), ('head', models.SmallIntegerField(default=0)), ('body', models.SmallIntegerField(default=0)), ], options={ }, bases=(models.Model,), ), migrations.CreateModel( name='Objective', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('name', models.SmallIntegerField()), ('status', models.SmallIntegerField(default=0)), ('game', models.ForeignKey(to='tracker.Game')), ], options={ }, bases=(models.Model,), ), migrations.CreateModel( name='Player', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('ip', models.GenericIPAddressField(protocol='IPv4')), ('team', models.SmallIntegerField(null=True)), ('vip', models.BooleanField(default=False)), ('admin', models.BooleanField(default=False)), ('dropped', models.BooleanField(default=False)), ('coop_status', models.SmallIntegerField(default=0)), ('score', models.SmallIntegerField(default=0)), ('time', models.SmallIntegerField(default=0)), ('kills', models.SmallIntegerField(default=0)), ('teamkills', models.SmallIntegerField(default=0)), ('deaths', models.SmallIntegerField(default=0)), ('suicides', models.SmallIntegerField(default=0)), ('arrests', models.SmallIntegerField(default=0)), ('arrested', models.SmallIntegerField(default=0)), ('kill_streak', models.SmallIntegerField(default=0)), ('arrest_streak', models.SmallIntegerField(default=0)), ('death_streak', models.SmallIntegerField(default=0)), ('vip_captures', models.SmallIntegerField(default=0)), ('vip_rescues', models.SmallIntegerField(default=0)), ('vip_escapes', models.SmallIntegerField(default=0)), ('vip_kills_valid', models.SmallIntegerField(default=0)), ('vip_kills_invalid', models.SmallIntegerField(default=0)), ('rd_bombs_defused', models.SmallIntegerField(default=0)), ('sg_escapes', models.SmallIntegerField(default=0)), ('sg_kills', models.SmallIntegerField(default=0)), ('coop_hostage_arrests', models.SmallIntegerField(default=0)), ('coop_hostage_hits', models.SmallIntegerField(default=0)), ('coop_hostage_incaps', models.SmallIntegerField(default=0)), ('coop_hostage_kills', models.SmallIntegerField(default=0)), ('coop_enemy_arrests', models.SmallIntegerField(default=0)), ('coop_enemy_incaps', models.SmallIntegerField(default=0)), ('coop_enemy_kills', models.SmallIntegerField(default=0)), ('coop_enemy_incaps_invalid', models.SmallIntegerField(default=0)), ('coop_enemy_kills_invalid', models.SmallIntegerField(default=0)), ('coop_toc_reports', models.SmallIntegerField(default=0)), ('alias', models.ForeignKey(to='tracker.Alias')), ('game', models.ForeignKey(to='tracker.Game')), ('loadout', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to='tracker.Loadout', null=True)), ], options={ }, bases=(models.Model,), ), migrations.CreateModel( name='Procedure', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('name', models.SmallIntegerField()), ('status', models.CharField(max_length=7)), ('score', models.SmallIntegerField(default=0)), ('game', models.ForeignKey(to='tracker.Game')), ], options={ }, bases=(models.Model,), ), migrations.CreateModel( name='Profile', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('name', models.CharField(max_length=64, null=True)), ('team', models.SmallIntegerField(null=True)), ('country', models.CharField(max_length=2, null=True)), ('game_first', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='tracker.Game', null=True)), ('game_last', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='tracker.Game', null=True)), ('loadout', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to='tracker.Loadout', null=True)), ], options={ }, bases=(models.Model,), ), migrations.CreateModel( name='Rank', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('category', models.SmallIntegerField()), ('year', models.SmallIntegerField()), ('points', models.FloatField(default=0)), ('position', models.PositiveIntegerField(db_index=True, null=True)), ('profile', models.ForeignKey(to='tracker.Profile')), ], options={ }, bases=(models.Model,), ), migrations.CreateModel( name='Server', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('ip', models.GenericIPAddressField(protocol='IPv4')), ('port', models.PositiveIntegerField()), ('enabled', models.BooleanField(default=False)), ('streamed', models.BooleanField(default=False)), ('listed', models.BooleanField(default=False)), ('port_gs1', models.PositiveIntegerField(null=True, blank=True)), ('port_gs2', models.PositiveIntegerField(null=True, blank=True)), ('country', models.CharField(max_length=2, null=True, blank=True)), ('hostname', models.CharField(max_length=256, null=True, blank=True)), ], options={ }, bases=(models.Model,), ), migrations.CreateModel( name='Weapon', fields=[ ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('name', models.SmallIntegerField()), ('time', models.SmallIntegerField(default=0)), ('shots', models.SmallIntegerField(default=0)), ('hits', models.SmallIntegerField(default=0)), ('teamhits', models.SmallIntegerField(default=0)), ('kills', models.SmallIntegerField(default=0)), ('teamkills', models.SmallIntegerField(default=0)), ('distance', models.FloatField(default=0)), ('player', models.ForeignKey(to='tracker.Player')), ], options={ }, bases=(models.Model,), ), migrations.AlterUniqueTogether( name='server', unique_together=set([('ip', 'port')]), ), migrations.AlterUniqueTogether( name='rank', unique_together=set([('year', 'category', 'profile')]), ), migrations.AlterIndexTogether( name='player', index_together=set([('alias', 'score'), ('alias', 'arrests'), ('alias', 'kill_streak'), ('alias', 'arrest_streak'), ('alias', 'kills')]), ), migrations.AddField( model_name='ip', name='isp', field=models.ForeignKey(to='tracker.ISP', null=True), preserve_default=True, ), migrations.AlterUniqueTogether( name='ip', unique_together=set([('range_from', 'range_to')]), ), migrations.AddField( model_name='game', name='server', field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to='tracker.Server', null=True), preserve_default=True, ), migrations.AddField( model_name='alias', name='isp', field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='tracker.ISP', null=True), preserve_default=True, ), migrations.AddField( model_name='alias', name='profile', field=models.ForeignKey(to='tracker.Profile'), preserve_default=True, ), migrations.AlterIndexTogether( name='alias', index_together=set([('name', 'isp')]), ), ]
47.341379
149
0.550222
1,188
13,729
6.223064
0.139731
0.214663
0.243474
0.251589
0.692953
0.533883
0.47315
0.422968
0.398079
0.378601
0
0.009081
0.302207
13,729
289
150
47.50519
0.76263
0.00153
0
0.512367
0
0
0.108493
0.003575
0
0
0
0
0
1
0
false
0
0.014134
0
0.024735
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
38d9a94f3dc44e66356d4ec35ec6a8cb44a38a72
1,325
py
Python
applications/tenant/views/tenant/classic.py
dev-easyshares/mighty
a6cf473fb8cfbf5b92db68c7b068fc8ae2911b8b
[ "MIT" ]
null
null
null
applications/tenant/views/tenant/classic.py
dev-easyshares/mighty
a6cf473fb8cfbf5b92db68c7b068fc8ae2911b8b
[ "MIT" ]
1
2022-03-12T00:57:37.000Z
2022-03-12T00:57:37.000Z
applications/tenant/views/tenant/classic.py
dev-easyshares/mighty
a6cf473fb8cfbf5b92db68c7b068fc8ae2911b8b
[ "MIT" ]
null
null
null
from django.http import JsonResponse from django.utils.decorators import method_decorator from django.contrib.auth.decorators import login_required from mighty.views import DetailView, ListView from mighty.applications.tenant.views.tenant.base import TenantBase @method_decorator(login_required, name='dispatch') class TenantList(TenantBase, ListView): def get_context_data(self, **kwargs): return self.get_tenants() def render_to_response(self, context, **response_kwargs): return JsonResponse(context, safe=False, **response_kwargs) @method_decorator(login_required, name='dispatch') class TenantDetail(TenantBase, DetailView): def get_context_data(self, **kwargs): return self.get_fields(self.get_object()) def render_to_response(self, context, **response_kwargs): return JsonResponse(context, safe=False, **response_kwargs) @method_decorator(login_required, name='dispatch') class CurrentTenant(TenantBase, DetailView): def get_context_data(self, **kwargs): tenant = self.get_object() if tenant: self.request.user.tenant = tenant self.request.user.save() return self.get_fields(tenant) def render_to_response(self, context, **response_kwargs): return JsonResponse(context, safe=False, **response_kwargs)
40.151515
67
0.748679
159
1,325
6.044025
0.289308
0.087409
0.062435
0.087409
0.580645
0.580645
0.580645
0.533819
0.4641
0.380853
0
0
0.151698
1,325
33
68
40.151515
0.854982
0
0
0.444444
0
0
0.0181
0
0
0
0
0
0
1
0.222222
false
0
0.185185
0.185185
0.740741
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
38e161a6f66c89dbf6513a514e8161fba1038484
1,956
py
Python
bot_player.py
BasKnuppe/Scriptie-Snowdrift-Toernooi
f3a74306d05950496ce851b10c99738f0be0b91b
[ "MIT" ]
28
2015-01-03T15:07:52.000Z
2021-08-13T11:30:23.000Z
bot_player.py
BasKnuppe/Scriptie-Snowdrift-Toernooi
f3a74306d05950496ce851b10c99738f0be0b91b
[ "MIT" ]
null
null
null
bot_player.py
BasKnuppe/Scriptie-Snowdrift-Toernooi
f3a74306d05950496ce851b10c99738f0be0b91b
[ "MIT" ]
3
2016-03-05T22:49:41.000Z
2020-12-28T16:04:45.000Z
######## ## ## Class to represent a bot in an IPD tournament ## ######## class BotPlayer(object): """ This class should be inherited from by bots who define their own getNextMove method. That is how bots have their own strategy. self.name is the name of the strategy employed self.description is an explanation of the strategy self.tournament_id can be assigned upon beginning each tournament """ def __init__(self, name, description=None): self.name = name self.description = description if not self.description: self.description = self.name self.tournament_id = None def __str__(self): return self.name def getNextMove(self, pastMoves, payoffs, w): """ Given the history of interactions with another bot, output the next move, either cooperate or defect This method is to be overridden by bots and should use only static initialization variables, randomness, and past moves in order to make a decision. No other state should be updated/saved/taken into account. TODO: Is that 'no other state' thing valid? What if a bot wants to do some behavior only once, but when exactly it does so is randomly determined? I believe this could require some saved information besides the history of moves, but this seems like a valid strategy. ARGS: pastMoves: array of tuples, where each tuple is the pair of choices made that turn by this bot and its partner [(myMove1, hisMove1), (myMove2, hisMove2), ...] and the moves are represented by 'C' for "Cooperate" or 'D' for "Defect". For example, [('C', 'D'), ('D', 'D'), ...] RETURNS: nextMove: 'C' for "Cooperate" or 'D' for "Defect" """ ## this method should be overridden, so this return value ## doesn't matter return 'D'
36.222222
79
0.640082
264
1,956
4.704545
0.518939
0.032206
0.020934
0.024155
0.040258
0.040258
0.040258
0
0
0
0
0.002853
0.283231
1,956
53
80
36.90566
0.883024
0.687117
0
0
0
0
0.002475
0
0
0
0
0.018868
0
1
0.272727
false
0
0
0.090909
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
1
0
0
1
0
0
0
0
1
0
0
3
38e629730707ffebe55e7464d5108ed5458d8a2a
1,513
py
Python
sitepackages/djangosecure/conf.py
bitcpf/djangoage
f116860cbfa799eb6c47306a72d742b63c970dce
[ "Apache-2.0" ]
167
2015-01-08T07:23:46.000Z
2022-02-14T06:59:01.000Z
djangosecure/conf.py
amit2014/django-secure
bc40cb16747c8edb7bae637ae7ba5b3510de1195
[ "BSD-3-Clause" ]
51
2019-10-08T01:53:02.000Z
2021-06-04T22:02:21.000Z
djangosecure/conf.py
amit2014/django-secure
bc40cb16747c8edb7bae637ae7ba5b3510de1195
[ "BSD-3-Clause" ]
13
2015-02-08T16:41:41.000Z
2020-07-13T16:27:36.000Z
from django.conf import settings from django.core.exceptions import ImproperlyConfigured class Configuration(object): def __init__(self, **kwargs): self.defaults = kwargs def __getattr__(self, k): try: return getattr(settings, k) except AttributeError: if k in self.defaults: return self.defaults[k] raise ImproperlyConfigured("django-secure requires %s setting." % k) conf = Configuration( SECURE_HSTS_SECONDS=0, SECURE_HSTS_INCLUDE_SUBDOMAINS=False, SECURE_FRAME_DENY=False, SECURE_CONTENT_TYPE_NOSNIFF=False, SECURE_BROWSER_XSS_FILTER=False, SECURE_SSL_REDIRECT=False, SECURE_SSL_HOST=None, SECURE_REDIRECT_EXEMPT=[], SECURE_PROXY_SSL_HEADER=None, SECURE_CHECKS=[ "djangosecure.check.csrf.check_csrf_middleware", "djangosecure.check.sessions.check_session_cookie_secure", "djangosecure.check.sessions.check_session_cookie_httponly", "djangosecure.check.djangosecure.check_security_middleware", "djangosecure.check.djangosecure.check_sts", "djangosecure.check.djangosecure.check_sts_include_subdomains", "djangosecure.check.djangosecure.check_frame_deny", "djangosecure.check.djangosecure.check_content_type_nosniff", "djangosecure.check.djangosecure.check_xss_filter", "djangosecure.check.djangosecure.check_ssl_redirect", "djangosecure.check.djangosecure.check_secret_key", ] )
34.386364
80
0.720423
161
1,513
6.42236
0.391304
0.312379
0.224371
0.263056
0.154739
0.083172
0
0
0
0
0
0.000821
0.194977
1,513
43
81
35.186047
0.848112
0
0
0
0
0
0.397224
0.374752
0
0
0
0
0
1
0.055556
false
0
0.055556
0
0.194444
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
38e8c36cd7d0e6bc4d33150b7126631572a016bd
150
py
Python
python/0258. addDigits.py
whtahy/leetcode
a2955123d203b155455ceefe38514fd0077d6db9
[ "CC0-1.0" ]
1
2017-12-09T05:37:51.000Z
2017-12-09T05:37:51.000Z
python/0258. addDigits.py
whtahy/leetcode
a2955123d203b155455ceefe38514fd0077d6db9
[ "CC0-1.0" ]
null
null
null
python/0258. addDigits.py
whtahy/leetcode
a2955123d203b155455ceefe38514fd0077d6db9
[ "CC0-1.0" ]
null
null
null
class Solution: def addDigits(self, num: int) -> int: while num > 9: num = sum(int(ch) for ch in str(num)) return num
25
49
0.533333
22
150
3.636364
0.681818
0
0
0
0
0
0
0
0
0
0
0.010309
0.353333
150
5
50
30
0.814433
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
2a116e09a3bede4baa8774c91f8747f9cb06f1b6
1,953
py
Python
synthesis/ops/candidate_element.py
jajajaqlt/nsg
1873f2b5e10441110c3c69940ceb4650f9684ac0
[ "Apache-2.0" ]
10
2021-11-02T18:30:38.000Z
2022-03-21T06:31:33.000Z
synthesis/ops/candidate_element.py
rohanmukh/nag
f2c4b8e60a97c58a6a1c549cc8b4753ebfe8a5e3
[ "Apache-2.0" ]
2
2021-11-05T18:40:42.000Z
2022-03-30T04:33:08.000Z
synthesis/ops/candidate_element.py
rohanmukh/nag
f2c4b8e60a97c58a6a1c549cc8b4753ebfe8a5e3
[ "Apache-2.0" ]
2
2021-11-03T19:14:06.000Z
2021-11-03T23:47:09.000Z
# Copyright 2017 Rice University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from data_extraction.data_reader.data_reader import MAX_VARIABLES from program_helper.ast.ops import DSubTree, CHILD_EDGE import numpy as np class CandidateElement: def __init__(self, curr_node=None, edge_path=None, curr_node_type=None, curr_node_val=None, next_node_type=None, var_decl_id_val=None, fixed_node_val=None, return_reached=None ): self.curr_node = curr_node self.edge_path = edge_path self.curr_node_val = curr_node_val self.curr_node_type = curr_node_type self.next_node_type = next_node_type self.var_decl_id_val = var_decl_id_val self.fixed_node_val = fixed_node_val self.return_reached = return_reached def get_current_node(self): return self.curr_node def get_edge_path(self): return self.edge_path def get_curr_node_type(self): return self.curr_node_type def get_curr_node_val(self): return self.curr_node_val def get_next_node_type(self): return self.next_node_type def get_next_var_decl_id_val(self): return self.var_decl_id_val def get_fixed_node_val(self): return self.fixed_node_val def get_return_reached(self): return self.return_reached
31.5
74
0.692268
285
1,953
4.431579
0.347368
0.088678
0.088678
0.047506
0.17023
0
0
0
0
0
0
0.005472
0.251408
1,953
61
75
32.016393
0.858413
0.28213
0
0
0
0
0
0
0
0
0
0
0
1
0.243243
false
0
0.081081
0.216216
0.567568
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
2a2bb9e2cb615e24b90fe3f1c35d5c7a38d3ff08
58
py
Python
util/py.py
ryuichi1208/scraping-py
43036dff75cc47d3169e012096f0de70dea0296b
[ "MIT" ]
2
2018-12-19T22:40:19.000Z
2019-06-19T06:38:18.000Z
util/py.py
ryuichi1208/scraping_py
43036dff75cc47d3169e012096f0de70dea0296b
[ "MIT" ]
null
null
null
util/py.py
ryuichi1208/scraping_py
43036dff75cc47d3169e012096f0de70dea0296b
[ "MIT" ]
null
null
null
class Test(): pass test = Test() print(test.__new__)
9.666667
19
0.637931
8
58
4.125
0.625
0
0
0
0
0
0
0
0
0
0
0
0.206897
58
5
20
11.6
0.717391
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.25
0
0
0.25
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
2a3ab723f16481b2de53d2fd5970ff8ebebd25d7
1,077
py
Python
tests/test_assert_version.py
mblnk/pyeventio
072dbd698f3bcd8e60eff0eeddcf828615b28db8
[ "MIT" ]
5
2018-12-18T14:30:21.000Z
2021-02-24T09:41:37.000Z
tests/test_assert_version.py
mblnk/pyeventio
072dbd698f3bcd8e60eff0eeddcf828615b28db8
[ "MIT" ]
69
2018-12-12T16:17:09.000Z
2022-03-21T10:44:40.000Z
tests/test_assert_version.py
mblnk/pyeventio
072dbd698f3bcd8e60eff0eeddcf828615b28db8
[ "MIT" ]
11
2018-12-12T17:45:57.000Z
2022-02-09T12:41:08.000Z
import pytest class Dummy: pass def test_assert_max_version(): from eventio.version_handling import assert_max_version fake_object = Dummy() fake_object.header = Dummy() for i in range(3): fake_object.header.version = i assert_max_version(fake_object, 2) with pytest.raises(NotImplementedError): assert_max_version(fake_object, 1) def test_assert_exact_version(): from eventio.version_handling import assert_exact_version fake_object = Dummy() fake_object.header = Dummy() fake_object.header.version = 1 with pytest.raises(NotImplementedError): assert_exact_version(fake_object, 0) # But this works assert_exact_version(fake_object, 1) def test_assert_version_in(): from eventio.version_handling import assert_version_in fake_object = Dummy() fake_object.header = Dummy() fake_object.header.version = 1 with pytest.raises(NotImplementedError): assert_version_in(fake_object, [0, 2]) # But this works assert_version_in(fake_object, [1, 2])
21.979592
61
0.717734
141
1,077
5.163121
0.219858
0.206044
0.14011
0.144231
0.832418
0.607143
0.554945
0.346154
0.277473
0.277473
0
0.012835
0.204271
1,077
48
62
22.4375
0.836639
0.026927
0
0.392857
0
0
0
0
0
0
0
0
0.428571
1
0.107143
false
0.035714
0.142857
0
0.285714
0
0
0
0
null
1
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
1
0
0
0
0
0
0
0
0
0
3
2a43c9e9961906a5ea1a9cc1595ad69ecd50c82f
84
py
Python
Exercicios/ex_010.py
antoniosereno95/Python_Curso_em_Video
d706cba9ca7e5670881e5e06bceb5538971e99c0
[ "MIT" ]
null
null
null
Exercicios/ex_010.py
antoniosereno95/Python_Curso_em_Video
d706cba9ca7e5670881e5e06bceb5538971e99c0
[ "MIT" ]
null
null
null
Exercicios/ex_010.py
antoniosereno95/Python_Curso_em_Video
d706cba9ca7e5670881e5e06bceb5538971e99c0
[ "MIT" ]
null
null
null
i = input('carteira em reais: ') d = float(i)/3.27 print('carteira em dollar: ',d)
16.8
32
0.630952
15
84
3.533333
0.733333
0.377358
0
0
0
0
0
0
0
0
0
0.042857
0.166667
84
5
33
16.8
0.714286
0
0
0
0
0
0.458824
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
2a5b3c690ff5e60e008a73e71722613fc08e95d9
21,264
py
Python
src/lib/gettext.py
williamstein/jpython
31175f97f42381f612b0b9661beb6b5e5c356d5c
[ "BSD-2-Clause" ]
null
null
null
src/lib/gettext.py
williamstein/jpython
31175f97f42381f612b0b9661beb6b5e5c356d5c
[ "BSD-2-Clause" ]
null
null
null
src/lib/gettext.py
williamstein/jpython
31175f97f42381f612b0b9661beb6b5e5c356d5c
[ "BSD-2-Clause" ]
null
null
null
# vim:fileencoding=utf-8 # License: BSD Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net> # noqa: eol-semicolon # The Plural-Forms parser {{{ # From: https://github.com/SlexAxton/Jed/blob/master/jed.js licensed under the WTFPL Jed = {} vr''' Jed.PF = {}; Jed.PF.parse = function ( p ) { var plural_str = Jed.PF.extractPluralExpr( p ); return Jed.PF.parser.parse.call(Jed.PF.parser, plural_str); }; Jed.PF.compile = function ( p ) { // Handle trues and falses as 0 and 1 function imply( val ) { return (val === true ? 1 : val ? val : 0); } var ast = Jed.PF.parse( p ); return function ( n ) { return imply( Jed.PF.interpreter( ast )( n ) ); }; }; Jed.PF.interpreter = function ( ast ) { return function ( n ) { var res; switch ( ast.type ) { case 'GROUP': return Jed.PF.interpreter( ast.expr )( n ); case 'TERNARY': if ( Jed.PF.interpreter( ast.expr )( n ) ) { return Jed.PF.interpreter( ast.truthy )( n ); } return Jed.PF.interpreter( ast.falsey )( n ); case 'OR': return Jed.PF.interpreter( ast.left )( n ) || Jed.PF.interpreter( ast.right )( n ); case 'AND': return Jed.PF.interpreter( ast.left )( n ) && Jed.PF.interpreter( ast.right )( n ); case 'LT': return Jed.PF.interpreter( ast.left )( n ) < Jed.PF.interpreter( ast.right )( n ); case 'GT': return Jed.PF.interpreter( ast.left )( n ) > Jed.PF.interpreter( ast.right )( n ); case 'LTE': return Jed.PF.interpreter( ast.left )( n ) <= Jed.PF.interpreter( ast.right )( n ); case 'GTE': return Jed.PF.interpreter( ast.left )( n ) >= Jed.PF.interpreter( ast.right )( n ); case 'EQ': return Jed.PF.interpreter( ast.left )( n ) == Jed.PF.interpreter( ast.right )( n ); case 'NEQ': return Jed.PF.interpreter( ast.left )( n ) != Jed.PF.interpreter( ast.right )( n ); case 'MOD': return Jed.PF.interpreter( ast.left )( n ) % Jed.PF.interpreter( ast.right )( n ); case 'VAR': return n; case 'NUM': return ast.val; default: throw new Error("Invalid Token found."); } }; }; Jed.PF.extractPluralExpr = function ( p ) { // trim first p = p.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); if (! /;\s*$/.test(p)) { p = p.concat(';'); } var nplurals_re = /nplurals\=(\d+);/, plural_re = /plural\=(.*);/, nplurals_matches = p.match( nplurals_re ), res = {}, plural_matches; // Find the nplurals number if ( nplurals_matches.length > 1 ) { res.nplurals = nplurals_matches[1]; } else { throw new Error('nplurals not found in plural_forms string: ' + p ); } // remove that data to get to the formula p = p.replace( nplurals_re, "" ); plural_matches = p.match( plural_re ); if (!( plural_matches && plural_matches.length > 1 ) ) { throw new Error('`plural` expression not found: ' + p); } return plural_matches[ 1 ]; }; /* Jison generated parser */ Jed.PF.parser = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"expressions":3,"e":4,"EOF":5,"?":6,":":7,"||":8,"&&":9,"<":10,"<=":11,">":12,">=":13,"!=":14,"==":15,"%":16,"(":17,")":18,"n":19,"NUMBER":20,"$accept":0,"$end":1}, terminals_: {2:"error",5:"EOF",6:"?",7:":",8:"||",9:"&&",10:"<",11:"<=",12:">",13:">=",14:"!=",15:"==",16:"%",17:"(",18:")",19:"n",20:"NUMBER"}, productions_: [0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]], performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { var $0 = $$.length - 1; switch (yystate) { case 1: return { type : 'GROUP', expr: $$[$0-1] }; case 2:this.$ = { type: 'TERNARY', expr: $$[$0-4], truthy : $$[$0-2], falsey: $$[$0] }; break; case 3:this.$ = { type: "OR", left: $$[$0-2], right: $$[$0] }; break; case 4:this.$ = { type: "AND", left: $$[$0-2], right: $$[$0] }; break; case 5:this.$ = { type: 'LT', left: $$[$0-2], right: $$[$0] }; break; case 6:this.$ = { type: 'LTE', left: $$[$0-2], right: $$[$0] }; break; case 7:this.$ = { type: 'GT', left: $$[$0-2], right: $$[$0] }; break; case 8:this.$ = { type: 'GTE', left: $$[$0-2], right: $$[$0] }; break; case 9:this.$ = { type: 'NEQ', left: $$[$0-2], right: $$[$0] }; break; case 10:this.$ = { type: 'EQ', left: $$[$0-2], right: $$[$0] }; break; case 11:this.$ = { type: 'MOD', left: $$[$0-2], right: $$[$0] }; break; case 12:this.$ = { type: 'GROUP', expr: $$[$0-1] }; break; case 13:this.$ = { type: 'VAR' }; break; case 14:this.$ = { type: 'NUM', val: Number(yytext) }; break; } }, table: [{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}], defaultActions: {6:[2,1]}, parseError: function parseError(str, hash) { throw new Error(str); }, parse: function parse(input) { var self = this, stack = [0], vstack = [null], // semantic value stack lstack = [], // location stack table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; //this.reductionCount = this.shiftCount = 0; this.lexer.setInput(input); this.lexer.yy = this.yy; this.yy.lexer = this.lexer; if (typeof this.lexer.yylloc == 'undefined') this.lexer.yylloc = {}; var yyloc = this.lexer.yylloc; lstack.push(yyloc); if (typeof this.yy.parseError === 'function') this.parseError = this.yy.parseError; function popStack (n) { stack.length = stack.length - 2*n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = self.lexer.lex() || 1; // $end = 1 // if token isn't its numeric value, convert if (typeof token !== 'number') { token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected, errStr; while (true) { // retreive state number from top of stack state = stack[stack.length-1]; // use default actions if available if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || symbol === undefined) symbol = lex(); // read action for current state and first input action = table[state] && table[state][symbol]; } // handle parse error _handle_error: if (typeof action === 'undefined' || !action.length || !action[0]) { if (!recovering) { // Report error expected = []; for (p in table[state]) if (this.terminals_[p] && p > 2) { expected.push("'"+this.terminals_[p]+"'"); } errStr = ''; if (this.lexer.showPosition) { errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'"; } else { errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " + (symbol == 1 /*EOF*/ ? "end of input" : ("'"+(this.terminals_[symbol] || symbol)+"'")); } this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); } // just recovered from another error if (recovering == 3) { if (symbol == EOF) { throw new Error(errStr || 'Parsing halted.'); } // discard current lookahead and grab another yyleng = this.lexer.yyleng; yytext = this.lexer.yytext; yylineno = this.lexer.yylineno; yyloc = this.lexer.yylloc; symbol = lex(); } // try to recover from error while (1) { // check for error recovery rule in this state if ((TERROR.toString()) in table[state]) { break; } if (state === 0) { throw new Error(errStr || 'Parsing halted.'); } popStack(1); state = stack[stack.length-1]; } preErrorSymbol = symbol; // save the lookahead token symbol = TERROR; // insert generic error symbol as new lookahead state = stack[stack.length-1]; action = table[state] && table[state][TERROR]; recovering = 3; // allow 3 real symbols to be shifted before reporting a new error } // this shouldn't happen, unless resolve defaults are off if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol); } switch (action[0]) { case 1: // shift //this.shiftCount++; stack.push(symbol); vstack.push(this.lexer.yytext); lstack.push(this.lexer.yylloc); stack.push(action[1]); // push state symbol = null; if (!preErrorSymbol) { // normal execution/no error yyleng = this.lexer.yyleng; yytext = this.lexer.yytext; yylineno = this.lexer.yylineno; yyloc = this.lexer.yylloc; if (recovering > 0) recovering--; } else { // error just occurred, resume old lookahead f/ before error symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: // reduce //this.reductionCount++; len = this.productions_[action[1]][1]; // perform semantic action yyval.$ = vstack[vstack.length-len]; // default to $$ = $1 // default location, uses first token for firsts, last for lasts yyval._$ = { first_line: lstack[lstack.length-(len||1)].first_line, last_line: lstack[lstack.length-1].last_line, first_column: lstack[lstack.length-(len||1)].first_column, last_column: lstack[lstack.length-1].last_column }; r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); if (typeof r !== 'undefined') { return r; } // pop off stack if (len) { stack = stack.slice(0,-1*len*2); vstack = vstack.slice(0, -1*len); lstack = lstack.slice(0, -1*len); } stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) vstack.push(yyval.$); lstack.push(yyval._$); // goto new state = table[STATE][NONTERMINAL] newState = table[stack[stack.length-2]][stack[stack.length-1]]; stack.push(newState); break; case 3: // accept return true; } } return true; }};/* Jison generated lexer */ var lexer = (function(){ var lexer = ({EOF:1, parseError:function parseError(str, hash) { if (this.yy.parseError) { this.yy.parseError(str, hash); } else { throw new Error(str); } }, setInput:function (input) { this._input = input; this._more = this._less = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; return this; }, input:function () { var ch = this._input[0]; this.yytext+=ch; this.yyleng++; this.match+=ch; this.matched+=ch; var lines = ch.match(/\n/); if (lines) this.yylineno++; this._input = this._input.slice(1); return ch; }, unput:function (ch) { this._input = ch + this._input; return this; }, more:function () { this._more = true; return this; }, pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); }, showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c+"^"; }, next:function () { if (this.done) { return this.EOF; } if (!this._input) this.done = true; var token, match, col, lines; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i=0;i < rules.length; i++) { match = this._input.match(this.rules[rules[i]]); if (match) { lines = match[0].match(/\n.*/g); if (lines) this.yylineno += lines.length; this.yylloc = {first_line: this.yylloc.last_line, last_line: this.yylineno+1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; this._more = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]); if (token) return token; else return; } } if (this._input === "") { return this.EOF; } else { this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), {text: "", token: null, line: this.yylineno}); } }, lex:function lex() { var r = this.next(); if (typeof r !== 'undefined') { return r; } else { return this.lex(); } }, begin:function begin(condition) { this.conditionStack.push(condition); }, popState:function popState() { return this.conditionStack.pop(); }, _currentRules:function _currentRules() { return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; }, topState:function () { return this.conditionStack[this.conditionStack.length-2]; }, pushState:function begin(condition) { this.begin(condition); }}); lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0:/* skip whitespace */ break; case 1:return 20 break; case 2:return 19 break; case 3:return 8 break; case 4:return 9 break; case 5:return 6 break; case 6:return 7 break; case 7:return 11 break; case 8:return 13 break; case 9:return 10 break; case 10:return 12 break; case 11:return 14 break; case 12:return 15 break; case 13:return 16 break; case 14:return 17 break; case 15:return 18 break; case 16:return 5 break; case 17:return 'INVALID' break; } }; lexer.rules = [/^\s+/,/^[0-9]+(\.[0-9]+)?\b/,/^n\b/,/^\|\|/,/^&&/,/^\?/,/^:/,/^<=/,/^>=/,/^</,/^>/,/^!=/,/^==/,/^%/,/^\(/,/^\)/,/^$/,/^./]; lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],"inclusive":true}};return lexer;})() parser.lexer = lexer; return parser; })(); ''' plural_forms_parser = Jed.PF # }}} def _get_plural_forms_function(plural_forms_string): return plural_forms_parser.compile(plural_forms_string or "nplurals=2; plural=(n != 1);") _gettext = def(text): return text _ngettext = def(text, plural, n): return text if n is 1 else plural def gettext(text): return _gettext(text) def ngettext(text, plural, n): return _ngettext(text, plural, n) def install(translation_data): t = new Translations(translation_data) t.install() for func in register_callback.install_callbacks: try: func(t) except: pass return t has_prop = Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty) def register_callback(func): # Register callbacks that will be called when new translation data is # installed register_callback.install_callbacks.push(func) register_callback.install_callbacks = v'[]' empty_translation_data = {'entries': {}} class Translations: def __init__(self, translation_data): translation_data = translation_data or empty_translation_data func = _get_plural_forms_function(translation_data.plural_forms) self.translations = [[translation_data, func]] self.language = translation_data['language'] def add_fallback(self, fallback): fallback = fallback or empty_translation_data func = _get_plural_forms_function(fallback.plural_forms) self.translations.push([fallback, func]) def gettext(self, text): for t in self.translations: m = t[0].entries if has_prop(m, text): return m[text][0] return text def ngettext(self, text, plural, n): for t in self.translations: m = t[0].entries if has_prop(m, text): idx = t[1](n) return m[text][idx] or (text if n is 1 else plural) return text if n is 1 else plural def install(self): nonlocal _gettext, _ngettext _gettext = def (): return self.gettext.apply(self, arguments) _ngettext = def (): return self.ngettext.apply(self, arguments)
37.305263
2,360
0.51914
2,940
21,264
3.708163
0.117687
0.015593
0.035223
0.040084
0.235828
0.197854
0.15887
0.134012
0.134012
0.117685
0
0.090318
0.276242
21,264
569
2,361
37.370826
0.618064
0.014249
0
0.17
0
0.076
0.900725
0.246134
0
0
0
0
0
0
null
null
0.002
0
null
null
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
1
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3