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
8b005666f48a057038ece823912c6a7d400f17c6
79
py
Python
features_python/ImFEATbox/config/__init__.py
annikaliebgott/ImFEATbox
e7361303f11390cfe880b9db23472903f69ee3f2
[ "Apache-2.0" ]
22
2016-11-13T15:23:45.000Z
2022-03-02T06:40:51.000Z
features_python/ImFEATbox/config/__init__.py
alps1122/ImFEATbox
9bad2e47b363df8a55e97dc512cf77cbbac793f1
[ "Apache-2.0" ]
1
2017-03-20T11:49:06.000Z
2017-05-23T09:49:25.000Z
features_python/ImFEATbox/config/__init__.py
alps1122/ImFEATbox
9bad2e47b363df8a55e97dc512cf77cbbac793f1
[ "Apache-2.0" ]
16
2016-11-15T13:14:50.000Z
2022-03-05T01:51:04.000Z
# -*- coding: utf-8 -*- from ImFEATbox.config import parameters_ImFEATBox_def
19.75
53
0.746835
10
79
5.7
0.9
0
0
0
0
0
0
0
0
0
0
0.014493
0.126582
79
3
54
26.333333
0.811594
0.265823
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
8b2bd04e27158131e726033edb25368e306d1e16
75
py
Python
Python/CursoEmVideo/exOlaMundo.py
araujobtc/my-progress
3583e1e12f22a4547e4b4167490e7c26914d4780
[ "MIT" ]
null
null
null
Python/CursoEmVideo/exOlaMundo.py
araujobtc/my-progress
3583e1e12f22a4547e4b4167490e7c26914d4780
[ "MIT" ]
null
null
null
Python/CursoEmVideo/exOlaMundo.py
araujobtc/my-progress
3583e1e12f22a4547e4b4167490e7c26914d4780
[ "MIT" ]
null
null
null
#Crie um programa que escreva "Olá, Mundo!" na tela. print('Olá, Mundo!')
18.75
52
0.68
12
75
4.25
0.833333
0.313725
0
0
0
0
0
0
0
0
0
0
0.16
75
3
53
25
0.809524
0.68
0
0
0
0
0.478261
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
8c8bf67416ff963e786149afa4de9d8049e0f760
835
py
Python
services/controller/src/plz/controller/images/local.py
neomatrix369/plz
12f05a8d071e9c1976c444d34161530ffa73eeae
[ "MIT" ]
1
2020-09-06T16:35:27.000Z
2020-09-06T16:35:27.000Z
services/controller/src/plz/controller/images/local.py
neomatrix369/plz
12f05a8d071e9c1976c444d34161530ffa73eeae
[ "MIT" ]
null
null
null
services/controller/src/plz/controller/images/local.py
neomatrix369/plz
12f05a8d071e9c1976c444d34161530ffa73eeae
[ "MIT" ]
null
null
null
from typing import BinaryIO, Callable, Iterator import docker from plz.controller.images.images_base import Images class LocalImages(Images): def __init__(self, docker_api_client_creator: Callable[[], docker.APIClient], repository: str): super().__init__(docker_api_client_creator, repository) def build(self, fileobj: BinaryIO, tag: str) -> Iterator[bytes]: return self._build(fileobj, tag) def for_host(self, docker_url: str) -> 'LocalImages': def new_docker_api_client_creator(): return docker.APIClient(base_url=docker_url) return LocalImages(new_docker_api_client_creator, self.repository) def push(self, tag: str): pass def pull(self, tag: str): pass def can_pull(self, _) -> bool: return True
27.833333
75
0.668263
101
835
5.227723
0.376238
0.068182
0.113636
0.166667
0.159091
0
0
0
0
0
0
0
0.238323
835
29
76
28.793103
0.830189
0
0
0.1
0
0
0.013174
0
0
0
0
0
0
1
0.35
false
0.1
0.15
0.15
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
1
0
1
0
1
1
0
0
5
8cebfe6fc371b234e5079ab747c83e82d7033803
224
py
Python
agents/__init__.py
JacobChen258/AI-Markov-Probability
909696597850e746e1cd7eef06df4aee0ce67ef2
[ "MIT" ]
null
null
null
agents/__init__.py
JacobChen258/AI-Markov-Probability
909696597850e746e1cd7eef06df4aee0ce67ef2
[ "MIT" ]
null
null
null
agents/__init__.py
JacobChen258/AI-Markov-Probability
909696597850e746e1cd7eef06df4aee0ce67ef2
[ "MIT" ]
null
null
null
from .ai_agent import AIAgent from .random_agent import RandomAgent from .generic_agent import GenericAgent from .chase_agent import ChaseAgent from .markov_agent import MarkovAgent from .particle_agent import ParticleAgent
32
41
0.866071
30
224
6.266667
0.5
0.351064
0
0
0
0
0
0
0
0
0
0
0.107143
224
6
42
37.333333
0.94
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
506ca2cc1edc54af07224a52e7d8483b012156a5
1,128
py
Python
tests/conftest.py
floGik/RaceControl
55ecfd46e9e3bdfbfb73c373cf5578257689f5fc
[ "Apache-2.0" ]
2
2020-04-28T21:21:13.000Z
2021-04-24T18:10:54.000Z
tests/conftest.py
floGik/RaceControl
55ecfd46e9e3bdfbfb73c373cf5578257689f5fc
[ "Apache-2.0" ]
1
2021-04-25T10:32:50.000Z
2021-04-26T12:49:42.000Z
tests/conftest.py
cdbrkfxrpt/RaceControl
55ecfd46e9e3bdfbfb73c373cf5578257689f5fc
[ "Apache-2.0" ]
null
null
null
import pytest from connectedrace.globals import * from connectedrace.antenna import * from connectedrace.cannon import * from connectedrace.bucket import * from connectedrace.cable import * from connectedrace.logger import * @pytest.fixture(scope="session") def message(): return can.Message(data=[1,2,3,4,5,6,7,8]) @pytest.fixture(scope="session") def node(message): return Node('127.0.0.1', message) @pytest.fixture(scope="session") def listener(): return can.BufferedReader() @pytest.fixture(scope="session") def antenna(listener): return AntennaDaemon(listeners=[listener], node_ips=[]) @pytest.fixture(scope="session") def cannon(antenna): return Cannon(antenna) @pytest.fixture(scope="session") def bucket_handler(): return BucketHandler() @pytest.fixture(scope="session") def bucket(antenna): return Bucket(('', D_PORT), BucketHandler, antenna) @pytest.fixture(scope="session") def cable(): return CableDaemon() @pytest.fixture(scope="session") def logger(): return LoggingDaemon() @pytest.fixture(scope="session") def csv_logger(): return CSVLogger(FILEFORMAT + '.csv')
23.5
59
0.733156
139
1,128
5.920863
0.309353
0.157959
0.218712
0.303767
0.37181
0.133657
0
0
0
0
0
0.01407
0.117908
1,128
47
60
24
0.813065
0
0
0.27027
0
0
0.073582
0
0
0
0
0
0
1
0.27027
false
0
0.189189
0.27027
0.72973
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
507133f459cd9a470d196ba64027899602eaf1c8
131
py
Python
odufrn_downloader/mixins/filters/__init__.py
Physsix27/odufrn-downloader
7ab1d9afb9f93ba620ee540d8e691c6ce3558271
[ "MIT" ]
33
2019-08-02T17:18:46.000Z
2021-02-20T03:41:15.000Z
odufrn_downloader/mixins/filters/__init__.py
Physsix27/odufrn-downloader
7ab1d9afb9f93ba620ee540d8e691c6ce3558271
[ "MIT" ]
62
2019-07-24T19:10:08.000Z
2019-11-01T18:21:21.000Z
odufrn_downloader/mixins/filters/__init__.py
Physsix27/odufrn-downloader
7ab1d9afb9f93ba620ee540d8e691c6ce3558271
[ "MIT" ]
2
2019-09-30T22:05:12.000Z
2019-10-05T19:03:39.000Z
from .LevenshteinMixin import LevenshteinMixin from .SimpleSearchMixin import SimpleSearchMixin from .YearsMixin import YearsMixin
32.75
48
0.885496
12
131
9.666667
0.416667
0
0
0
0
0
0
0
0
0
0
0
0.091603
131
3
49
43.666667
0.97479
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
507302a039eb96966feb56e6f2907723f0513ef4
238
py
Python
problemsets/Codeforces/Python/A1345.py
juarezpaulino/coderemite
a4649d3f3a89d234457032d14a6646b3af339ac1
[ "Apache-2.0" ]
null
null
null
problemsets/Codeforces/Python/A1345.py
juarezpaulino/coderemite
a4649d3f3a89d234457032d14a6646b3af339ac1
[ "Apache-2.0" ]
null
null
null
problemsets/Codeforces/Python/A1345.py
juarezpaulino/coderemite
a4649d3f3a89d234457032d14a6646b3af339ac1
[ "Apache-2.0" ]
null
null
null
""" * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * """ for s in[*open(0)][1:]:a,b=map(int,s.split())print('YNEOS'[a+b<a*b::2]) exec(int(input())*"n,m=map(int,input().split());print('YNEOS'[n+m<n*m::2]);")
29.75
77
0.592437
44
238
3.204545
0.568182
0.042553
0.212766
0
0
0
0
0
0
0
0
0.018349
0.084034
238
8
77
29.75
0.62844
0
0
0
0
0.5
0.403974
0.370861
0
0
0
0
0
0
null
null
0
0
null
null
1
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
5
50e683e3dbe371ed752413755c51d5c5f848a0a6
188
py
Python
service/test_common.py
bentondrew/demo_common
c0031c439c39c384cf8aa1f9452eb32c8033aee4
[ "Apache-2.0" ]
null
null
null
service/test_common.py
bentondrew/demo_common
c0031c439c39c384cf8aa1f9452eb32c8033aee4
[ "Apache-2.0" ]
null
null
null
service/test_common.py
bentondrew/demo_common
c0031c439c39c384cf8aa1f9452eb32c8033aee4
[ "Apache-2.0" ]
null
null
null
from flask import Flask app = Flask(__name__) @app.route('/') def index(): import demo_common return ('demo_common version installed: {}' .format(demo_common.__version__))
18.8
45
0.691489
23
188
5.173913
0.608696
0.252101
0.285714
0
0
0
0
0
0
0
0
0
0.180851
188
9
46
20.888889
0.772727
0
0
0
0
0
0.180851
0
0
0
0
0
0
1
0.142857
false
0
0.285714
0
0.571429
0
1
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
1
0
0
5
50fcea02ae0bba785ac485b517d8b89522d53b25
37
py
Python
flappening/__init__.py
kawu/flappening
e4bd5bb94a1d2f6acca75b3eab32a4d2b30c4171
[ "MIT" ]
null
null
null
flappening/__init__.py
kawu/flappening
e4bd5bb94a1d2f6acca75b3eab32a4d2b30c4171
[ "MIT" ]
null
null
null
flappening/__init__.py
kawu/flappening
e4bd5bb94a1d2f6acca75b3eab32a4d2b30c4171
[ "MIT" ]
1
2020-07-17T09:27:42.000Z
2020-07-17T09:27:42.000Z
# __init__.py from .game import Game
12.333333
22
0.756757
6
37
4
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.162162
37
2
23
18.5
0.774194
0.297297
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
0feaba82a1e926214725d24559c54c6530663c6b
11,207
py
Python
display_lidar_packets.py
NizarTarabay/Extract_packets_os16
94ca8b58f035582b78c15ed105a57140a1eb82b2
[ "MIT" ]
1
2020-01-21T06:45:58.000Z
2020-01-21T06:45:58.000Z
display_lidar_packets.py
NizarTarabay/Extract_packets_os16
94ca8b58f035582b78c15ed105a57140a1eb82b2
[ "MIT" ]
1
2020-02-11T15:31:55.000Z
2020-02-12T16:30:47.000Z
display_lidar_packets.py
NizarTarabay/Extract_packets_os16
94ca8b58f035582b78c15ed105a57140a1eb82b2
[ "MIT" ]
null
null
null
import numpy as np from helpers import get_signal, number_of_frames, first_last_frame_number import os import cv2 import seaborn as sns; sns.set() mode = 1024 fps = 20 signal_list = ['range', 'reflectivity', 'signal', 'ambient'] signal_name = input("Signal to display:") for idx, val in enumerate(signal_list): if signal_name == val: break # =============== Build the array of images =============== # os.chdir('/media/nizar/Transcend/test in the lab/Data/myFormat/Lidar') file_name_t = input("Time and date:") file_name = 'Lidar_myFormat_packet_' + str(file_name_t) + '.txt' img_array = get_signal(file_name, mode, signal_list[idx]) ######################################################################################################################## # # file_name = 'Lidar_myFormat_packet_' + str(file_name_t) # img_array_depth, list = number_of_frames(file_name , mode) # img_array = np.zeros((img_array_depth+1, int(mode/4)+17, 16)).astype(np.int) # this is the array the contains all the pixels acquired by the sensor # m, i, j, k, l = 0, 0, 0, 0, 0 # enc_list = [] # #find the smallest encoder number # for m in range(0, len(list)): # if m % 18 == 0: # encoder_count = ['0'] # s = 0 # for c in list[m]: # if s == 5 and (c != ' ' or c != '\n'): # s=5 for encoder count # encoder_count.append(c) # if c == ' ': # s += 1 # if s == 6: # s=6 for encoder count # break # enc = '' # enc = (int(enc.join(encoder_count))) # print(enc) # enc_list.append(enc) # # enc_min = min(enc_list) # framelist = frame_list(list)[0] # # ######################################### for: fill the array! ############################################## # for k in range(0, img_array_depth+1): # # # print(l) # for j in range(0, int(mode/4)+17): # for i in range(0, 18): # if l % 18 == 0: # encoder_count = ['0'] # s = 0 # for c in list[l]: # if s == 5 and (c != ' ' or c != '\n'): # s=3 encoder don't touch! # encoder_count.append(c) # if c == ' ': # s += 1 # if s == 6: # s=4 encoder don't touch! # break # enc = '' # enc = (int(enc.join(encoder_count))-enc_min)/(44*(2048/mode)) # real_frame = first_last_frame_number(list[l]) # else: # if (l+1)%18 == 0: # print (list[l]) # else: # signal = ['0'] # s = 0 # for c in list[l]: # if s == 2 and (c != ' ' or c != '\n'): # s=1 or 0 1 for reflectivity 0 for range # signal.append(c) # if c == ' ': # s += 1 # if s == 3: # s=1 or 2; 2 for reflectivity 1 for range # break # # print (l) # sig = '' # sig = int(sig.join(signal)) # img_array[real_frame - framelist][int(enc)][i-1] = sig # # # l += 1 # # print(l) # if l >= len(list): # break # if l >= len(list): # break # if l >= len(list): # break # # print (l) # # print (j) # # print (k) # print(enc) ######################################################################################################################## import matplotlib.pyplot as plt # ax = sns.heatmap(img_array[222][0:256], square=True, linewidth=0) # plt.show() k = number_of_frames(file_name, mode)[0] b = np.zeros((k, int(mode/4), 64)) for frame in range(0, k): for i in range(0, 16): for j in range(0, 4): b[frame][0:int(mode/4), i*4+j] = img_array[frame][0:int(mode / 4), i] # im = plt.imshow(b[1][0:int(mode/4)]) # for i in range(0, k): # # im.set_data(b[i][0:int(mode/4)]) # im = plt.imshow(np.flip(np.rot90(b[i][0:int(mode/4)], 3), 1)) # plt.axis('off') # plt.pause(0.01) # initialize water image height = 64 width = int(mode / 4) water_depth = np.zeros((height, width), dtype=float) # initialize video writer fourcc = cv2.VideoWriter_fourcc('M','J','P','G') video_filename = 'Lidar_myFormat_packet_' + str(file_name_t) + '_' + signal_list[idx] + '.avi' out = cv2.VideoWriter(video_filename, fourcc, fps, (width, height)) # new frame after each addition of water for i in range(k): #add this array to the video gray = cv2.normalize(np.flip(np.rot90(b[i], 1), 1), None, 255, 0, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_8U) gray_3c = cv2.merge([gray, gray, gray]) out.write(gray_3c) # close out the video writer out.release() # import numpy as np # import os # mode = 2048 # fps = 10 # # def number_of_frames(file, mode): # ''' # :arg: string; Name of the file with a specific format (like the one returned by the function "extract_data_txt_file") # :return: int; This function return the total number of frames in the txt file # ''' # # mode = 2048 # depend on the scanning mode of the lidar, it can take the following values: 512, 1024, 2048 # fn = 65536 # 2^16 max frame number (max reached) # # =============== open the file =============== # # file1 = open(file, 'r') # lineList = file1.readlines() # save all the lines in a list # file1.close() # # =============== close the file =============== # # # # =============== get the first frame number =============== # # for line in lineList: # if 'F' in line: # print(line) # i = 0 # l = [] # for c in line: # if i == 3 and c != ' ': # l.append(c) # if c == ' ': # i += 1 # if i == 4: # break # f1 = '' # f1 = int(f1.join(l)) # break # # =============== get the last frame number =============== # # for line in lineList[::-1]: # if 'F' in line: # # print(line) # i = 0 # l = [] # for c in line: # if i == 3 and c != ' ': # l.append(c) # if c == ' ': # i += 1 # if i == 4: # break # f2 = '' # f2 = int(f2.join(l)) # break # # =============== check if the max has been reached =============== # # max_frame_reach = 0 # i = 0 # for line in lineList: # if i % 18 == 0: # if 'F 65535' in line: # # print(line) # max_frame_reach += 1 # i += 1 # # # i = int(max_frame_reach/(mode/4)) # # print (i) # number_frames = int(f2 - f1 + i * fn) # # return number_frames, lineList # # # # =============== Build the array of images =============== # # os.chdir('/media/nizar/Transcend/test in the lab/Data/myFormat/Lidar') # file_name_t = input("Time and date:") # file_name = 'Lidar_myFormat_packet_' + str(file_name_t) # img_array_depth, list = number_of_frames(file_name + '.txt', mode) # img_array = np.zeros((img_array_depth, int(mode/4)+17, 16)).astype(np.int) # this is the array the contains all the pixels acquired by the sensor # m, i, j, k, l = 0 , 0 ,0 , 0, 0 # enc_list = [] # #find the smallest encoder number # for m in range(0, len(list)): # if m % 18 == 0: # encoder_count = ['0'] # s = 0 # for c in list[m]: # if s == 5 and (c != ' ' or c != '\n'): # s=5 for encoder count # encoder_count.append(c) # if c == ' ': # s += 1 # if s == 6: # s=6 for encoder count # break # enc = '' # enc = (int(enc.join(encoder_count))) # print(enc) # enc_list.append(enc) # # enc_min = min(enc_list) # ######################################### for: fill the array! ############################################## # for k in range(0, img_array_depth): # # print(l) # for j in range(0, int(mode/4)+17): # for i in range(0, 18): # if l % 18 == 0: # encoder_count = ['0'] # s = 0 # for c in list[l]: # if s == 5 and (c != ' ' or c != '\n'): # s=3 encoder don't touch! # encoder_count.append(c) # if c == ' ': # s += 1 # if s == 6: # s=4 encoder don't touch! # break # enc = '' # enc = (int(enc.join(encoder_count))-enc_min)/(44*(2048/mode)) # else: # if (l+1)%18 == 0: # print (list[l]) # else: # signal = ['0'] # s = 0 # for c in list[l]: # if s == 3 and (c != ' ' or c != '\n'): # s=1 or 0 1 for reflectivity 0 for range # signal.append(c) # if c == ' ': # s += 1 # if s == 4: # s=1 or 2; 2 for reflectivity 1 for range # break # # print (l) # sig = '' # sig = int(sig.join(signal)) # img_array[k][int(enc)][i-1] = sig # # # l += 1 # # print(l) # if l >= len(list): # break # if l >= len(list): # break # if l >= len(list): # break # # print (l) # # print (j) # # print (k) # print(enc) # import matplotlib.pyplot as plt # import seaborn as sns; sns.set() # # # ax = sns.heatmap(img_array[222][0:256], square=True, linewidth=0) # # plt.show() # # # b = np.zeros((k, int(mode/4), 64)) # for frame in range(0, k): # for i in range(0, 16): # for j in range(0, 4): # b[frame][0:int(mode/4), i*4+j] = img_array[frame][0:int(mode / 4), i] # # # # im = plt.imshow(b[1][0:int(mode/4)]) # for i in range(0, k): # # im.set_data(b[i][0:int(mode/4)]) # im = plt.imshow(np.flip(np.rot90(b[i][0:int(mode/4)], 3), 1)) # plt.axis('off') # plt.pause(0.01) # # import cv2 # # initialize water image # height = 64 # width = int(mode / 4) # water_depth = np.zeros((height, width), dtype=float) # # initialize video writer # fourcc = cv2.VideoWriter_fourcc('M','J','P','G') # video_filename = file_name + '_ambient.avi' # out = cv2.VideoWriter(video_filename, fourcc, fps, (width, height)) # # new frame after each addition of water # for i in range(k): # #add this array to the video # gray = cv2.normalize(np.flip(np.rot90(b[i], 1), 1), None, 255, 0, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_8U) # gray_3c = cv2.merge([gray, gray, gray]) # out.write(gray_3c) # # close out the video writer # out.release() #
35.021875
149
0.44615
1,471
11,207
3.307274
0.14276
0.019527
0.029599
0.022199
0.787873
0.783967
0.757246
0.750874
0.737718
0.737718
0
0.043743
0.355403
11,207
319
150
35.131661
0.629707
0.78558
0
0
0
0
0.106691
0.056661
0
0
0
0
0
1
0
false
0
0.176471
0
0.176471
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
0ff45f614c83301daad5c7b49ea0ef5c7bf38047
126
py
Python
bin/diff.py
eddo888/McUnix
612babfe8f3a127e5f904dceb08d89e11923c053
[ "MIT" ]
null
null
null
bin/diff.py
eddo888/McUnix
612babfe8f3a127e5f904dceb08d89e11923c053
[ "MIT" ]
null
null
null
bin/diff.py
eddo888/McUnix
612babfe8f3a127e5f904dceb08d89e11923c053
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 from McUnix.diff import argue, diff args = argue() diff(args.lhs.rstrip('/'), args.rhs.rstrip('/'))
15.75
48
0.666667
19
126
4.421053
0.684211
0.214286
0.309524
0
0
0
0
0
0
0
0
0.009009
0.119048
126
7
49
18
0.747748
0.166667
0
0
0
0
0.019417
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
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
1
0
0
0
0
5
ba00babf797e7f03bd763a2d4918bf0968336fc7
214
py
Python
paths.py
fin10/NeuralColorPainter
6add68cdc58dec6362596071edb6836c2c9b907a
[ "Apache-2.0" ]
null
null
null
paths.py
fin10/NeuralColorPainter
6add68cdc58dec6362596071edb6836c2c9b907a
[ "Apache-2.0" ]
null
null
null
paths.py
fin10/NeuralColorPainter
6add68cdc58dec6362596071edb6836c2c9b907a
[ "Apache-2.0" ]
1
2021-01-09T13:20:59.000Z
2021-01-09T13:20:59.000Z
import os class Paths: ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__))) MODEL = os.path.join(ROOT, 'model') IMAGES = os.path.join(ROOT, 'images') OUTPUT = os.path.join(ROOT, 'out')
23.777778
67
0.649533
33
214
4.090909
0.424242
0.266667
0.296296
0.311111
0
0
0
0
0
0
0
0
0.172897
214
8
68
26.75
0.762712
0
0
0
0
0
0.065421
0
0
0
0
0
0
1
0
false
0
0.166667
0
1
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
5
ba156c7e9aae852604bf2f09aee33054b7030c07
198
py
Python
tests/testConverters.py
ttm/musicLegacy
106c0d55657c703a7afa42e230c645fb9a2874fe
[ "MIT" ]
2
2017-08-22T15:39:24.000Z
2019-12-23T10:48:28.000Z
tests/testConverters.py
ttm/musicLegacy
106c0d55657c703a7afa42e230c645fb9a2874fe
[ "MIT" ]
null
null
null
tests/testConverters.py
ttm/musicLegacy
106c0d55657c703a7afa42e230c645fb9a2874fe
[ "MIT" ]
null
null
null
import musicLegacy as m import importlib #from IPython.lib.deepreload import reload as dreload importlib.reload(m.converters) importlib.reload(m) #dreload(m,exclude="pytz") co=m.BasicConverter()
19.8
53
0.79798
28
198
5.642857
0.571429
0.189873
0.202532
0
0
0
0
0
0
0
0
0
0.09596
198
9
54
22
0.882682
0.388889
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.8
0
0.8
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
1
0
1
0
0
5
e841fe361824c4baf8aa600e7e5401ee6ce0849d
588
py
Python
webdev/users/tests/test_users_post.py
h-zanetti/jewelry-manager
74166b89f492303b8ebf5ff8af058f394eb2a28b
[ "MIT" ]
null
null
null
webdev/users/tests/test_users_post.py
h-zanetti/jewelry-manager
74166b89f492303b8ebf5ff8af058f394eb2a28b
[ "MIT" ]
103
2021-04-25T21:28:11.000Z
2022-03-15T01:36:31.000Z
webdev/users/tests/test_users_post.py
h-zanetti/jewelry-manager
74166b89f492303b8ebf5ff8af058f394eb2a28b
[ "MIT" ]
null
null
null
import pytest from django.urls import reverse from django.contrib.auth.models import User from pytest_django.asserts import assertRedirects @pytest.fixture def resposta(client, db): usr = User.objects.create_user(username='UserTest', password='minhaSenha123') resp = client.post(reverse('login'), data={'username': 'UserTest', 'password': 'minhaSenha123'}) return resp def test_user_autenticado(resposta): assert resposta.wsgi_request.user.is_authenticated == True def test_redirecionamento(resposta): assertRedirects(resposta, reverse('produtos:estoque_produtos'))
36.75
100
0.782313
70
588
6.457143
0.571429
0.044248
0.106195
0.163717
0
0
0
0
0
0
0
0.011429
0.107143
588
16
101
36.75
0.849524
0
0
0
0
0
0.149406
0.042445
0
0
0
0
0.230769
1
0.230769
false
0.153846
0.307692
0
0.615385
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
1
0
1
0
0
5
e859cbcacca3b5175723c0305fc040239fe5e91b
158
py
Python
xmmdet/__init__.py
www516717402/edgeai-mmdetection
c5563434728da227678ba3588621b4b426cda43d
[ "BSD-3-Clause" ]
null
null
null
xmmdet/__init__.py
www516717402/edgeai-mmdetection
c5563434728da227678ba3588621b4b426cda43d
[ "BSD-3-Clause" ]
null
null
null
xmmdet/__init__.py
www516717402/edgeai-mmdetection
c5563434728da227678ba3588621b4b426cda43d
[ "BSD-3-Clause" ]
null
null
null
import mmcv from mmdet import * from .ops import * from .core import * from .datasets import * from .models import * from .utils import * from .apis import *
17.555556
23
0.727848
23
158
5
0.434783
0.521739
0
0
0
0
0
0
0
0
0
0
0.189873
158
8
24
19.75
0.898438
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
e876f40d3dfde66c53da91352c0fb2eed37f19fb
93
py
Python
HelloWorld.py
mvtuong/Yelp-Challenge
b9df3d4296e05bd33eeeda816191cf68a327a36d
[ "Apache-2.0", "BSD-3-Clause" ]
1
2019-09-14T07:06:13.000Z
2019-09-14T07:06:13.000Z
HelloWorld.py
mvtuong/Yelp-Challenge
b9df3d4296e05bd33eeeda816191cf68a327a36d
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
HelloWorld.py
mvtuong/Yelp-Challenge
b9df3d4296e05bd33eeeda816191cf68a327a36d
[ "Apache-2.0", "BSD-3-Clause" ]
1
2019-01-24T10:34:16.000Z
2019-01-24T10:34:16.000Z
print "Hello World" a = 5 b = 8 c = a + b print("c=%d, c+1=%d" %(c, c+1)) print("hello")
15.5
32
0.483871
21
93
2.142857
0.47619
0.444444
0
0
0
0
0
0
0
0
0
0.057143
0.247312
93
6
33
15.5
0.585714
0
0
0
0
0
0.314607
0
0
0
0
0
0
0
null
null
0
0
null
null
0.5
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
1
0
0
0
0
0
0
1
0
5
e89072dc4e079913d4e3eceaa6f4fb3c616813a0
18,757
py
Python
tests/conductor.py
wooga/karajan
b0952f156d69206fdcb1d71bd42c227077da6fd2
[ "MIT" ]
null
null
null
tests/conductor.py
wooga/karajan
b0952f156d69206fdcb1d71bd42c227077da6fd2
[ "MIT" ]
null
null
null
tests/conductor.py
wooga/karajan
b0952f156d69206fdcb1d71bd42c227077da6fd2
[ "MIT" ]
2
2018-02-01T14:00:07.000Z
2022-03-26T18:09:14.000Z
# # Copyright 2017 Wooga GmbH # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies # of the Software, and to permit persons to whom the Software is furnished to do # so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. from datetime import datetime from unittest import TestCase from airflow.models import DagRun from mock import MagicMock from karajan.conductor import Conductor from tests.helpers import defaults from tests.helpers.config import ConfigHelper class TestConductor(TestCase): def setUp(self): self.engine = MagicMock() self.conf = ConfigHelper() self.dags = {} def build_dags(self): Conductor(self.conf).build('test_dag', engine=self.engine, output=self.dags) return self def dag_run(self, dag_id, external_trigger=False): return DagRun( dag_id=dag_id, run_id="karajan_run_%s" % datetime.now(), external_trigger=external_trigger, conf={'start_date': defaults.EXTERNAL_START_DATE, 'end_date': defaults.EXTERNAL_END_DATE} if external_trigger else None, execution_date=defaults.EXTERNAL_EXECUTION_DATE if external_trigger else datetime.now(), state='running' ) def context(self, dag_id, item=None, ds=defaults.EXECUTION_DATE, external_trigger=False): return { 'dag_run': self.dag_run(dag_id, external_trigger), 'ds': ds.strftime("%Y-%m-%d"), 'ds_nodash': ds.strftime("%Y%m%d"), 'dag': self.dags["%s_%s" % (dag_id, item) if item else dag_id] } def get_dag(self, dag_id, item=None): dag_id = "%s_%s" % (dag_id, item) if item else dag_id self.assertIn(dag_id, self.dags) return self.dags[dag_id] def get_operator(self, task_id, item=None, dag_id='test_dag'): dag = self.get_dag(dag_id, item) self.assertIn(task_id, dag.task_dict) return dag.get_task(task_id) def execute(self, task_id, item=None, dag_id='test_dag', external_trigger=False): op = self.get_operator(task_id, item) op.execute(self.context(dag_id, item, external_trigger=external_trigger)) return self def test_cleanup_operator(self): self.build_dags().execute('cleanup_test_aggregation') self.engine.cleanup.assert_called_with( defaults.TMP_TABLE_NAME, ) def test_cleanup_operator_with_parametrization(self): self.conf.parameterize_context() self.build_dags().execute('cleanup_test_aggregation', 'item') self.engine.cleanup.assert_called_with( defaults.TMP_ITEM_TABLE_NAME, ) def test_cleanup_operator_with_external_trigger(self): self.build_dags().execute('cleanup_test_aggregation', external_trigger=True) self.engine.cleanup.assert_called_with( defaults.EXTERNAL_TMP_TABLE_NAME, ) def test_aggregation_operator_without_parameterization(self): self.build_dags().execute('aggregate_test_aggregation') self.engine.aggregate.assert_called_with( defaults.TMP_TABLE_NAME, {'test_time_key', 'another_table_test_src_column', 'test_src_column', 'key_column', 'another_test_src_column'}, u"SELECT * FROM DUAL WHERE dt BETWEEN '2017-08-01' AND '2017-08-01'", None, ) def test_aggregation_operator_with_timeseries(self): self.conf.with_timeseries() self.build_dags().execute('aggregate_test_aggregation') self.engine.aggregate.assert_called_with( defaults.TMP_TABLE_NAME, {'test_time_key', 'another_table_test_src_column', 'test_src_column', 'key_column', 'another_test_src_column'}, u"SELECT * FROM DUAL WHERE dt BETWEEN '2017-08-01' AND '2017-08-01'", None, ) def test_aggregation_operator_with_other_timeseries(self): self.conf.with_timeseries(target_id='another_table') self.build_dags().execute('aggregate_another_aggregation') self.engine.aggregate.assert_called_with( 'test_dag_agg_another_aggregation_20170801', {'another_aggregation_test_src_column', 'key_column', 'another_test_time_key'}, u"SELECT everything FROM here", None, ) def test_aggregation_operator_with_parameterized_context(self): self.conf.parameterize_context() self.build_dags().execute('aggregate_test_aggregation', 'item') self.engine.aggregate.assert_called_with( defaults.TMP_ITEM_TABLE_NAME, {'another_table_test_src_column', 'item_column', 'test_time_key', 'test_src_column', 'key_column', 'another_test_src_column'}, u"SELECT * FROM DUAL WHERE dt BETWEEN '2017-08-01' AND '2017-08-01'", {'item_column': 'item'}, ) def test_aggregation_operator_with_parameterized_context_and_aggregation(self): self.conf.parameterize_context().parameterize_aggregation() self.build_dags().execute('aggregate_test_aggregation', 'item') self.engine.aggregate.assert_called_with( defaults.TMP_ITEM_TABLE_NAME, {'another_table_test_src_column', "'item' as item_column", 'test_time_key', 'test_src_column', 'key_column', 'another_test_src_column'}, u"SELECT * FROM item WHERE dt BETWEEN '2017-08-01' AND '2017-08-01'", None, ) def test_aggregation_operator_with_offset(self): self.conf.with_offset() self.build_dags().execute('aggregate_test_aggregation') self.engine.aggregate.assert_called_with( defaults.TMP_TABLE_NAME, {'test_time_key', 'another_table_test_src_column', 'test_src_column', 'key_column', 'another_test_src_column'}, u"SELECT * FROM DUAL WHERE dt BETWEEN '2017-07-31' AND '2017-07-31'", None, ) def test_aggregation_operator_with_reruns(self): self.conf.with_reruns() self.build_dags().execute('aggregate_test_aggregation') self.engine.aggregate.assert_called_with( defaults.TMP_TABLE_NAME, {'test_time_key', 'another_table_test_src_column', 'test_src_column', 'key_column', 'another_test_src_column'}, u"SELECT * FROM DUAL WHERE dt BETWEEN '2017-07-29' AND '2017-08-01'", None, ) def test_aggregation_operator_with_offset_and_reruns(self): self.conf.with_offset().with_reruns() self.build_dags().execute('aggregate_test_aggregation') self.engine.aggregate.assert_called_with( defaults.TMP_TABLE_NAME, {'test_time_key', 'another_table_test_src_column', 'test_src_column', 'key_column', 'another_test_src_column'}, u"SELECT * FROM DUAL WHERE dt BETWEEN '2017-07-28' AND '2017-07-31'", None, ) def test_aggregation_operator_with_external_trigger(self): self.build_dags().execute('aggregate_test_aggregation', external_trigger=True) self.engine.aggregate.assert_called_with( defaults.EXTERNAL_TMP_TABLE_NAME, {'test_time_key', 'another_table_test_src_column', 'test_src_column', 'key_column', 'another_test_src_column'}, u"SELECT * FROM DUAL WHERE dt BETWEEN '2016-08-01' AND '2016-09-01'", None, ) def test_aggregation_operator_with_external_trigger_reruns_and_offset(self): self.conf.with_offset().with_reruns() self.build_dags().execute('aggregate_test_aggregation', external_trigger=True) self.engine.aggregate.assert_called_with( defaults.EXTERNAL_TMP_TABLE_NAME, {'test_time_key', 'another_table_test_src_column', 'test_src_column', 'key_column', 'another_test_src_column'}, u"SELECT * FROM DUAL WHERE dt BETWEEN '2016-07-28' AND '2016-08-31'", None, ) def test_merge_operator_bootstrap(self): self.conf.parameterize_context() self.engine.describe.return_value = defaults.DESCRIBE_SRC_COLUMNS self.build_dags().execute('merge_test_aggregation_test_table', 'item') self.engine.describe.assert_called_with(defaults.TMP_ITEM_TABLE_NAME) self.engine.bootstrap.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.DESCRIBE_TARGET_COLUMNS_WITH_META) def test_merge_operator_bootstrap_with_timeseries(self): self.conf.parameterize_context().with_timeseries() self.engine.describe.return_value = defaults.DESCRIBE_SRC_COLUMNS self.build_dags().execute('merge_test_aggregation_test_table', 'item') self.engine.describe.assert_called_with(defaults.TMP_ITEM_TABLE_NAME) self.engine.bootstrap.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.DESCRIBE_TARGET_COLUMNS) def test_merge_operator_delete_existing_data_without_timeseries(self): self.build_dags().execute('merge_test_aggregation_test_table') self.engine.delete_timeseries.assert_not_called() def test_merge_operator_delete_existing_data_with_timeseries(self): self.conf.with_timeseries() self.build_dags().execute('merge_test_aggregation_test_table') self.engine.delete_timeseries.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.TARGET_VALUE_COLUMNS, {defaults.TIMESERIES_KEY: defaults.DATE_RANGE}) def test_merge_operator_delete_existing_data_with_timeseries_parameterization(self): self.conf.with_timeseries().parameterize_context() self.build_dags().execute('merge_test_aggregation_test_table', 'item') self.engine.delete_timeseries.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.TARGET_VALUE_COLUMNS, {defaults.TIMESERIES_KEY: defaults.DATE_RANGE, 'item_column': 'item'}) def test_merge_operator_delete_existing_data_with_timeseries_offsets_and_reruns(self): self.conf.with_timeseries().with_reruns().with_offset() self.build_dags().execute('merge_test_aggregation_test_table') self.engine.delete_timeseries.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.TARGET_VALUE_COLUMNS, {defaults.TIMESERIES_KEY: ('2017-07-28', '2017-07-31')}) def test_merge_operator_delete_existing_data_with_timeseries_and_external_trigger(self): self.conf.with_timeseries() self.build_dags().execute('merge_test_aggregation_test_table', external_trigger=True) self.engine.delete_timeseries.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.TARGET_VALUE_COLUMNS, {defaults.TIMESERIES_KEY: defaults.EXTERNAL_DATE_RANGE}) def test_merge_operator_delete_existing_data_with_timeseries_offsets_reruns_and_external_trigger(self): self.conf.with_timeseries().with_reruns().with_offset() self.build_dags().execute('merge_test_aggregation_test_table', external_trigger=True) self.engine.delete_timeseries.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.TARGET_VALUE_COLUMNS, {defaults.TIMESERIES_KEY: ('2016-07-28', '2016-08-31')}) def test_merge_operator_merge(self): self.build_dags().execute('merge_test_aggregation_test_table') self.engine.merge.assert_called_with(defaults.TMP_TABLE_NAME, defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, {'key_column': 'key_column'}, defaults.MERGE_VALUE_COLUMNS, defaults.MERGE_UPDATE_TYPES, 'test_time_key') def test_merge_operator_merge_with_parametrization(self): self.conf.parameterize_context() self.build_dags().execute('merge_test_aggregation_test_table', 'item') self.engine.merge.assert_called_with(defaults.TMP_ITEM_TABLE_NAME, defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, {'key_column': 'key_column', 'item_column': 'item_column'}, defaults.MERGE_VALUE_COLUMNS, defaults.MERGE_UPDATE_TYPES, 'test_time_key') def test_merge_operator_merge_with_timeseries(self): self.conf.with_timeseries() self.build_dags().execute('merge_test_aggregation_test_table') self.engine.merge.assert_called_with(defaults.TMP_TABLE_NAME, defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, {'key_column': 'key_column', 'timeseries_column': 'test_time_key'}, defaults.MERGE_VALUE_COLUMNS, None, None) def test_merge_operator_merge_with_timeseries_and_parametrization(self): self.conf.parameterize_context().with_timeseries() self.build_dags().execute('merge_test_aggregation_test_table', 'item') self.engine.merge.assert_called_with(defaults.TMP_ITEM_TABLE_NAME, defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, {'key_column': 'key_column', 'timeseries_column': 'test_time_key', 'item_column': 'item_column'}, defaults.MERGE_VALUE_COLUMNS, None, None) def test_merge_operator_merge_with_external_trigger(self): self.build_dags().execute('merge_test_aggregation_test_table', external_trigger=True) self.engine.merge.assert_called_with(defaults.EXTERNAL_TMP_TABLE_NAME, defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, {'key_column': 'key_column'}, defaults.MERGE_VALUE_COLUMNS, defaults.MERGE_UPDATE_TYPES, 'test_time_key') def test_finish_operator_purge_without_timeseries(self): self.build_dags().execute('finish_test_table') self.engine.purge.assert_not_called() def test_finish_operator_purge_with_timeseries(self): self.conf.with_timeseries() self.build_dags().execute('finish_test_table') self.engine.purge.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.TARGET_ALL_VALUE_COLUMNS, {defaults.TIMESERIES_KEY: defaults.DATE_RANGE}) def test_finish_operator_purge_with_timeseries_and_parametetrization(self): self.conf.with_timeseries().parameterize_context() self.build_dags().execute('finish_test_table', 'item') self.engine.purge.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.TARGET_ALL_VALUE_COLUMNS, {defaults.TIMESERIES_KEY: defaults.DATE_RANGE, 'item_column': 'item'}) def test_finish_operator_purge_with_timeseries_reruns_and_offsets(self): self.conf.with_timeseries().with_offset().with_reruns() self.build_dags().execute('finish_test_table') self.engine.purge.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.TARGET_ALL_VALUE_COLUMNS, {defaults.TIMESERIES_KEY: ('2017-07-28', '2017-08-01')}) def test_finish_operator_purge_with_timeseries_and_external_trigger(self): self.conf.with_timeseries() self.build_dags().execute('finish_test_table', external_trigger=True) self.engine.purge.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.TARGET_ALL_VALUE_COLUMNS, {defaults.TIMESERIES_KEY: defaults.EXTERNAL_DATE_RANGE}) def test_finish_operator_purge_with_timeseries_reruns_offsets_and_external_trigger(self): self.conf.with_timeseries().with_offset().with_reruns() self.build_dags().execute('finish_test_table', external_trigger=True) self.engine.purge.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.TARGET_ALL_VALUE_COLUMNS, {defaults.TIMESERIES_KEY: ('2016-07-28', '2016-09-01')}) def test_finish_operator_parameters_without_parameter_columns(self): self.build_dags().execute('finish_test_table') self.engine.parameters.assert_not_called() def test_finish_operator_parameters(self): self.conf.with_parameter_columns() self.build_dags().execute('finish_test_table') self.engine.parameters.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.PARAMETER_COLUMNS, None) def test_finish_operator_parameters_with_parametrization(self): self.conf.with_parameter_columns().parameterize_context() self.build_dags().execute('finish_test_table', 'item') self.engine.parameters.assert_called_with(defaults.TARGET_SCHEMA_NAME, defaults.TARGET_NAME, defaults.PARAMETER_COLUMNS, {'item_column': 'item'})
54.526163
150
0.669883
2,210
18,757
5.293665
0.095928
0.057441
0.038892
0.059834
0.808616
0.770493
0.75374
0.716471
0.673989
0.640909
0
0.015435
0.240124
18,757
343
151
54.685131
0.805374
0.055766
0
0.519856
0
0.032491
0.170831
0.075127
0
0
0
0
0.140794
1
0.151625
false
0
0.025271
0.00722
0.202166
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
2cdb9c555e7a91232cc3bd457abdd8b917abed0a
120
py
Python
sharing/admin.py
ssoumyajit/imgapi2
b2129f1d35d55e093a3d96272686ac25ea2cf7bb
[ "MIT" ]
null
null
null
sharing/admin.py
ssoumyajit/imgapi2
b2129f1d35d55e093a3d96272686ac25ea2cf7bb
[ "MIT" ]
null
null
null
sharing/admin.py
ssoumyajit/imgapi2
b2129f1d35d55e093a3d96272686ac25ea2cf7bb
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Sharing # Register your models here. admin.site.register(Sharing)
20
32
0.808333
17
120
5.705882
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.125
120
5
33
24
0.92381
0.216667
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
2ce45b5a361499e8da2a16a49979a10abade1498
61
py
Python
modelscript/scripts/metamodels/all.py
ScribesZone/ModelScribes
a36be1047283f2e470dc2dd4353f2a714377bb7d
[ "MIT" ]
1
2019-02-22T14:27:06.000Z
2019-02-22T14:27:06.000Z
modelscript/scripts/metamodels/all.py
ScribesZone/ModelScribes
a36be1047283f2e470dc2dd4353f2a714377bb7d
[ "MIT" ]
4
2019-02-12T07:49:15.000Z
2019-02-12T07:50:12.000Z
modelscript/scripts/metamodels/all.py
ScribesZone/ModelScribes
a36be1047283f2e470dc2dd4353f2a714377bb7d
[ "MIT" ]
null
null
null
# coding=utf-8 import modelscript.scripts.metamodels.parser
15.25
44
0.819672
8
61
6.25
1
0
0
0
0
0
0
0
0
0
0
0.017857
0.081967
61
3
45
20.333333
0.875
0.196721
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
fa0046dd2b7c6d5042e3c68e2632112e264d2aad
125
py
Python
w01/e03.py
Luccifer/PythonCoruseraHSE
653d6a24325789342f0d033717ba548dc6e90483
[ "Unlicense" ]
1
2020-01-12T12:55:07.000Z
2020-01-12T12:55:07.000Z
w01/e03.py
Luccifer/PythonCourseraHSE
653d6a24325789342f0d033717ba548dc6e90483
[ "Unlicense" ]
null
null
null
w01/e03.py
Luccifer/PythonCourseraHSE
653d6a24325789342f0d033717ba548dc6e90483
[ "Unlicense" ]
null
null
null
# Дележ яблок-1 def apple_sharing(n, k): return print(k // n) n = int(input()) k = int(input()) apple_sharing(n, k)
10.416667
24
0.6
22
125
3.318182
0.545455
0.328767
0.356164
0.383562
0
0
0
0
0
0
0
0.010204
0.216
125
11
25
11.363636
0.734694
0.104
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0.2
0.4
0.2
1
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
1
0
0
0
5
fa0aed6428adaad385ea09454ceece28d3c47786
189
py
Python
device.py
peter0512lee/pytorch-YOLOv4
deaf4c054133fee8a556d76fdb1fe91aa06cea09
[ "Apache-2.0" ]
null
null
null
device.py
peter0512lee/pytorch-YOLOv4
deaf4c054133fee8a556d76fdb1fe91aa06cea09
[ "Apache-2.0" ]
null
null
null
device.py
peter0512lee/pytorch-YOLOv4
deaf4c054133fee8a556d76fdb1fe91aa06cea09
[ "Apache-2.0" ]
null
null
null
import torch import torch.nn as nn print(torch.cuda.get_device_name(0)) print(torch.cuda.is_available()) device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') print(device)
31.5
69
0.772487
32
189
4.4375
0.46875
0.190141
0.197183
0.28169
0
0
0
0
0
0
0
0.00578
0.084656
189
6
70
31.5
0.815029
0
0
0
0
0
0.036842
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.5
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
1
0
5
fa28544c9990211c22cff979a74ac0a93b50cdee
229
py
Python
solutions/001/solution.py
jwmcgettigan/project-euler-solutions
f06b6551e713619d5fd1359ee2f96fcff61c425b
[ "FTL" ]
1
2020-08-21T00:30:17.000Z
2020-08-21T00:30:17.000Z
solutions/001/solution.py
jwmcgettigan/project-euler-solutions
f06b6551e713619d5fd1359ee2f96fcff61c425b
[ "FTL" ]
2
2020-09-18T00:40:01.000Z
2020-09-21T04:13:05.000Z
solutions/001/solution.py
jwmcgettigan/project-euler-solutions
f06b6551e713619d5fd1359ee2f96fcff61c425b
[ "FTL" ]
null
null
null
def multiple_of(num, multiple): return num % multiple == 0 def sum_of_multiples(limit): return sum(x for x in range(limit) if multiple_of(x, 3) or multiple_of(x, 5)) if __name__ == "__main__": print(sum_of_multiples(1000))
28.625
79
0.724891
40
229
3.775
0.525
0.198676
0.18543
0
0
0
0
0
0
0
0
0.035897
0.148472
229
8
80
28.625
0.738462
0
0
0
0
0
0.034783
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
0.666667
0.166667
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
fa2ab6580e90d1b64e579f40be9f53bcce93840b
130
py
Python
python-sdk/nuscenes/eval/tracking/data_classes.py
tanjiangyuan/Classification_nuScence
b94c4b0b6257fc1c048a676e3fd9e71183108d53
[ "Apache-2.0" ]
null
null
null
python-sdk/nuscenes/eval/tracking/data_classes.py
tanjiangyuan/Classification_nuScence
b94c4b0b6257fc1c048a676e3fd9e71183108d53
[ "Apache-2.0" ]
null
null
null
python-sdk/nuscenes/eval/tracking/data_classes.py
tanjiangyuan/Classification_nuScence
b94c4b0b6257fc1c048a676e3fd9e71183108d53
[ "Apache-2.0" ]
null
null
null
version https://git-lfs.github.com/spec/v1 oid sha256:5eca636366997d0ff94fe840e0f0c554bc845333a7adab625f67a63506b5617c size 13879
32.5
75
0.884615
13
130
8.846154
1
0
0
0
0
0
0
0
0
0
0
0.41129
0.046154
130
3
76
43.333333
0.516129
0
0
0
0
0
0
0
0
1
0
0
0
0
null
null
0
0
null
null
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
null
1
0
0
0
1
0
0
0
0
0
0
0
0
5
d71262e83d6196977ebf4f2086c7a160e553ac64
75
py
Python
dynamo2relion/__init__.py
EuanPyle/import_2_relion4_sta
d755be7f83c8f3837bac740429203929b1e8175a
[ "BSD-3-Clause" ]
3
2021-10-18T21:49:07.000Z
2022-01-17T11:10:14.000Z
dynamo2relion/__init__.py
EuanPyle/dynamo2relion
d755be7f83c8f3837bac740429203929b1e8175a
[ "BSD-3-Clause" ]
null
null
null
dynamo2relion/__init__.py
EuanPyle/dynamo2relion
d755be7f83c8f3837bac740429203929b1e8175a
[ "BSD-3-Clause" ]
null
null
null
from .dynamo2relion import dynamo2relion from .version import __version__
18.75
40
0.853333
8
75
7.5
0.5
0
0
0
0
0
0
0
0
0
0
0.030303
0.12
75
3
41
25
0.878788
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
d72f53a26af6a73f2006f40005d475fa06100d90
109
py
Python
src/rios/__init__.py
prometheusresearch/rios.converter
59f46a6c88389285d42d8a060edf58df1bc0b386
[ "Apache-2.0" ]
null
null
null
src/rios/__init__.py
prometheusresearch/rios.converter
59f46a6c88389285d42d8a060edf58df1bc0b386
[ "Apache-2.0" ]
3
2021-09-08T01:37:59.000Z
2022-03-12T00:13:51.000Z
src/rios/__init__.py
prometheusresearch/rios.converter
59f46a6c88389285d42d8a060edf58df1bc0b386
[ "Apache-2.0" ]
null
null
null
# # Copyright (c) 2016, Prometheus Research, LLC # __import__('pkg_resources').declare_namespace(__name__)
15.571429
55
0.761468
12
109
6.083333
1
0
0
0
0
0
0
0
0
0
0
0.041237
0.110092
109
6
56
18.166667
0.71134
0.40367
0
0
0
0
0.213115
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
d768d9c76a81da604593951269849eb396f6348d
79
py
Python
strategery/exceptions.py
rcgale/strategery
d1608ea59587d7e49db0bdf788e3243d4d42081a
[ "MIT" ]
null
null
null
strategery/exceptions.py
rcgale/strategery
d1608ea59587d7e49db0bdf788e3243d4d42081a
[ "MIT" ]
null
null
null
strategery/exceptions.py
rcgale/strategery
d1608ea59587d7e49db0bdf788e3243d4d42081a
[ "MIT" ]
null
null
null
class TaskError(Exception): pass class StrategyError(Exception): pass
13.166667
31
0.734177
8
79
7.25
0.625
0.448276
0
0
0
0
0
0
0
0
0
0
0.189873
79
5
32
15.8
0.90625
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
d794b4f6c38f5737d8771b16e1f782859e864577
50
py
Python
verifai/simulators/__init__.py
shromonag/VerifAI
ace214d1c3282ed5ea63ee3f52457e35f54ebb62
[ "BSD-3-Clause" ]
1
2020-07-27T13:32:01.000Z
2020-07-27T13:32:01.000Z
verifai/simulators/__init__.py
shromonag/VerifAI
ace214d1c3282ed5ea63ee3f52457e35f54ebb62
[ "BSD-3-Clause" ]
null
null
null
verifai/simulators/__init__.py
shromonag/VerifAI
ace214d1c3282ed5ea63ee3f52457e35f54ebb62
[ "BSD-3-Clause" ]
null
null
null
from .openai_gym import * from .webots import *
16.666667
26
0.72
7
50
5
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.2
50
2
27
25
0.875
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
d14b2a834f35cfedd90cbf959ae71435837f6dc6
434
py
Python
freeldep/templates/__init__.py
MatthieuBlais/freeldep
092de3c603a28b9d12e9ad93d6c0cca773469c9f
[ "Apache-2.0" ]
null
null
null
freeldep/templates/__init__.py
MatthieuBlais/freeldep
092de3c603a28b9d12e9ad93d6c0cca773469c9f
[ "Apache-2.0" ]
null
null
null
freeldep/templates/__init__.py
MatthieuBlais/freeldep
092de3c603a28b9d12e9ad93d6c0cca773469c9f
[ "Apache-2.0" ]
null
null
null
from freeldep.templates.core import CoreDeployerTemplate # noqa from freeldep.templates.initialize import InitializeDeployerTemplate # noqa from freeldep.templates.project import ProjectTemplate # noqa from freeldep.templates.repository import DeployerRepositoryTemplate # noqa from freeldep.templates.service import ServiceDeployerTemplate # noqa from freeldep.templates.subscription import SubscriptionDeployerTemplate # noqa
62
80
0.861751
42
434
8.904762
0.404762
0.192513
0.336898
0.334225
0
0
0
0
0
0
0
0
0.096774
434
6
81
72.333333
0.954082
0.06682
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
0f1abcfe4f3c072e0de6f55f980b6e9eceea9760
259
py
Python
evaluation/__init__.py
aliyun/Self-Evolving-Keypoint-Demo
52a8bb312040bfbf5c2be02ac5d40ce3f0142026
[ "MIT" ]
25
2020-07-16T02:55:25.000Z
2021-12-25T03:37:09.000Z
evaluation/__init__.py
aliyun/Self-Evolving-Keypoint-Demo
52a8bb312040bfbf5c2be02ac5d40ce3f0142026
[ "MIT" ]
8
2020-08-20T04:36:51.000Z
2021-03-24T12:31:37.000Z
evaluation/__init__.py
aliyun/Self-Evolving-Keypoint-Demo
52a8bb312040bfbf5c2be02ac5d40ce3f0142026
[ "MIT" ]
2
2020-08-07T13:45:12.000Z
2021-03-09T01:54:59.000Z
# __init__.py from .extract_sekd import extract_sekd, extract_sekd_desc from .extract_opencv_features import extract_opencv_features, extract_opencv_desc __all__ = ['extract_sekd', 'extract_sekd_desc', 'extract_opencv_features', 'extract_opencv_desc']
28.777778
81
0.826255
34
259
5.558824
0.294118
0.291005
0.333333
0.232804
0.677249
0.402116
0
0
0
0
0
0
0.096525
259
8
82
32.375
0.807692
0.042471
0
0
0
0
0.289796
0.093878
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
0f37ed023a0ad28010f81eaf36391b94cfa83ec7
64
py
Python
jadepunk/engine/__init__.py
HarkonenBade/jadepunk-chargen
198590946b7192e78967de0788da4009f8454dd5
[ "MIT" ]
1
2020-05-28T13:06:43.000Z
2020-05-28T13:06:43.000Z
jadepunk/engine/__init__.py
HarkonenBade/jadepunk-chargen
198590946b7192e78967de0788da4009f8454dd5
[ "MIT" ]
null
null
null
jadepunk/engine/__init__.py
HarkonenBade/jadepunk-chargen
198590946b7192e78967de0788da4009f8454dd5
[ "MIT" ]
null
null
null
from .base import EngineLoader from . import markdown, moinmoin
21.333333
32
0.8125
8
64
6.5
0.75
0
0
0
0
0
0
0
0
0
0
0
0.140625
64
2
33
32
0.945455
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
0f6622ae20d04be8567fefa92478b2fbe05f89ab
103
py
Python
notifications/admin.py
briansok/derpi
0e111a84b17ce8caeb60d2899957a0a24cab47b3
[ "MIT" ]
null
null
null
notifications/admin.py
briansok/derpi
0e111a84b17ce8caeb60d2899957a0a24cab47b3
[ "MIT" ]
null
null
null
notifications/admin.py
briansok/derpi
0e111a84b17ce8caeb60d2899957a0a24cab47b3
[ "MIT" ]
1
2019-03-07T04:30:36.000Z
2019-03-07T04:30:36.000Z
from django.contrib import admin from .models import Notifications admin.site.register(Notifications)
20.6
34
0.84466
13
103
6.692308
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.097087
103
4
35
25.75
0.935484
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
7e1495b5dfd5ab4623ce77d00788647d9fc5e413
136
py
Python
restaurants/admin.py
WorkShoft/python-developer-delectatech
f6ef284b156141289a8f141e90628b835bd186f5
[ "Apache-2.0" ]
null
null
null
restaurants/admin.py
WorkShoft/python-developer-delectatech
f6ef284b156141289a8f141e90628b835bd186f5
[ "Apache-2.0" ]
null
null
null
restaurants/admin.py
WorkShoft/python-developer-delectatech
f6ef284b156141289a8f141e90628b835bd186f5
[ "Apache-2.0" ]
null
null
null
from django.contrib import admin from .models import Segment, Restaurant admin.site.register(Segment) admin.site.register(Restaurant)
19.428571
39
0.823529
18
136
6.222222
0.555556
0.160714
0.303571
0
0
0
0
0
0
0
0
0
0.095588
136
6
40
22.666667
0.910569
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
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
1
0
1
0
0
0
0
5
7e21724402db16b29ba18070b85eb144985bab27
257
py
Python
Biopyutils/Protein.py
jingxinfu/Biopyutils
a04f86e3b12bcbb44bf317f3bb9c65ef5a6ab862
[ "BSD-3-Clause" ]
1
2022-03-15T03:45:28.000Z
2022-03-15T03:45:28.000Z
Biopyutils/Protein.py
jingxinfu/Biopyutils
a04f86e3b12bcbb44bf317f3bb9c65ef5a6ab862
[ "BSD-3-Clause" ]
1
2020-09-05T18:10:41.000Z
2020-09-05T18:10:41.000Z
Biopyutils/Protein.py
jingxinfu/Biopyutils
a04f86e3b12bcbb44bf317f3bb9c65ef5a6ab862
[ "BSD-3-Clause" ]
3
2020-09-04T17:05:46.000Z
2020-09-10T14:39:20.000Z
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # License : GPL3 # Author : Jingxin Fu <jingxinfu.tj@gmail.com> # Date : 11/02/2020 # Last Modified Date: 11/02/2020 # Last Modified By : Jingxin Fu <jingxinfu.tj@gmail.com>
28.555556
57
0.579767
35
257
4.257143
0.657143
0.120805
0.241611
0.268456
0.697987
0.697987
0
0
0
0
0
0.101604
0.272374
257
8
58
32.125
0.695187
0.941634
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
7e2da13e8a9dfeb10d2df5ac05bc7be77119789b
49
py
Python
gdcdatamodel/models/notifications.py
NCI-GDC/gdcdatamodel
924fc8ab695b1cbb0131636ffcb6d3881db2e200
[ "Apache-2.0" ]
27
2016-06-24T20:32:44.000Z
2022-01-17T07:53:48.000Z
gdcdatamodel/models/notifications.py
NCI-GDC/gdcdatamodel
924fc8ab695b1cbb0131636ffcb6d3881db2e200
[ "Apache-2.0" ]
63
2016-07-20T21:40:11.000Z
2021-08-12T18:39:21.000Z
gdcdatamodel/models/notifications.py
NCI-GDC/gdcdatamodel
924fc8ab695b1cbb0131636ffcb6d3881db2e200
[ "Apache-2.0" ]
5
2016-10-20T20:00:09.000Z
2020-08-14T08:55:40.000Z
from gdc_ng_models.models.notifications import *
24.5
48
0.857143
7
49
5.714286
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.081633
49
1
49
49
0.888889
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
7e73266449b97ed3f492eab9b67f93b8fe263496
232
py
Python
code4/Item.py
weijie88/spider_files
9039f7ff0f4c76bc5aa80ca8b87b8280880392cc
[ "Apache-2.0" ]
null
null
null
code4/Item.py
weijie88/spider_files
9039f7ff0f4c76bc5aa80ca8b87b8280880392cc
[ "Apache-2.0" ]
null
null
null
code4/Item.py
weijie88/spider_files
9039f7ff0f4c76bc5aa80ca8b87b8280880392cc
[ "Apache-2.0" ]
null
null
null
class Stock(): def __init__(self,code,name,price): self.code = code self.name = name self.price = price def __str__(self): return 'code{},name{},price{}'.format(self.code,self.name,self.price)
33.142857
77
0.603448
31
232
4.258065
0.354839
0.181818
0.19697
0
0
0
0
0
0
0
0
0
0.241379
232
7
77
33.142857
0.75
0
0
0
0
0
0.090129
0.090129
0
0
0
0
0
1
0.285714
false
0
0
0.142857
0.571429
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
7e74048a7f77be243e4286bf8cd8a428ea6ef557
80
py
Python
django/wsgi.py
a-rey/aaronmreyes_heroku
f397741ec33a35c318b6e4d51837b352183085f9
[ "MIT" ]
1
2022-03-12T22:23:44.000Z
2022-03-12T22:23:44.000Z
django/wsgi.py
a-rey/docker_website
f397741ec33a35c318b6e4d51837b352183085f9
[ "MIT" ]
2
2020-04-07T22:09:50.000Z
2020-04-07T22:09:50.000Z
django/wsgi.py
a-rey/docker_website
f397741ec33a35c318b6e4d51837b352183085f9
[ "MIT" ]
null
null
null
import django.core.wsgi application = django.core.wsgi.get_wsgi_application()
16
53
0.8125
11
80
5.727273
0.545455
0.31746
0.444444
0
0
0
0
0
0
0
0
0
0.0875
80
4
54
20
0.863014
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
0e575d418b654db5dc6507d8be41d83f56c240b6
4,321
py
Python
mfi_customization/mfi/doctype/communication.py
parimal-bizmap/mfi_customization
ddd2361898d5d873b06356c28990bf81e4e2745e
[ "MIT" ]
null
null
null
mfi_customization/mfi/doctype/communication.py
parimal-bizmap/mfi_customization
ddd2361898d5d873b06356c28990bf81e4e2745e
[ "MIT" ]
null
null
null
mfi_customization/mfi/doctype/communication.py
parimal-bizmap/mfi_customization
ddd2361898d5d873b06356c28990bf81e4e2745e
[ "MIT" ]
null
null
null
import frappe def after_insert_file(doc,method): if doc.attached_to_doctype=="Communication": if len(frappe.get_all('Issue',{'communication':doc.attached_to_name}))==0: cmm_doc=frappe.get_doc("Communication",doc.attached_to_name) domain_rule=email_rules_true_for_domain(cmm_doc.sender) email_rule=email_rules_true_for_emails_table(cmm_doc.sender) if (domain_rule.get('is_true') or email_rule.get('is_true')) and cmm_doc.sent_or_received=='Received': if "Re:" not in doc.subject: issue=frappe.new_doc("Issue") issue.subject=cmm_doc.subject issue.description=cmm_doc.content issue.raised_by=cmm_doc.sender issue.communication=doc.attached_to_name issue.customer=domain_rule.get('customer') if domain_rule.get('is_true') else email_rule.get('customer') issue.flags.ignore_mandatory=True issue.company=domain_rule.get('company') if domain_rule.get('is_true') else email_rule.get('company') issue.save() file_doc = frappe.new_doc("File") file_doc.file_name = doc.file_name file_doc.file_size = doc.file_size file_doc.folder = doc.folder file_doc.is_private = doc.is_private file_doc.file_url = doc.file_url file_doc.attached_to_doctype = "Issue" file_doc.attached_to_name=issue.get('name') file_doc.save() else: for d in frappe.get_all('Issue',{'communication':doc.attached_to_name},['name']): file_doc = frappe.new_doc("File") file_doc.file_name = doc.file_name file_doc.file_size = doc.file_size file_doc.folder = doc.folder file_doc.is_private = doc.is_private file_doc.file_url = doc.file_url file_doc.attached_to_doctype = "Issue" file_doc.attached_to_name=d.get('name') file_doc.save() def email_rules_true_for_domain(sender): resp={'is_ture':False,'customer':'','company':''} for d in frappe.get_all('Email Rules for Issue',{'group_by':'Domain'},['name','domain_name','customer']): if '@' in sender and d.get('domain_name').lower() in sender.split('@')[1]: customer=frappe.get_doc('Customer',d.customer) resp.update({'is_true':True,'customer':d.customer}) for cu in customer.get('accounts'): resp.update({'company':cu.company}) return resp return resp def email_rules_true_for_emails_table(sender): resp={'is_ture':False,'customer':'','company':''} for d in frappe.get_all('Email Rules for Issue',{'group_by':'Emails'},['name','customer']): rules=frappe.get_doc('Email Rules for Issue',d.name) emails=[] for tb in rules.get('email_list_for_issue'): emails.append(tb.get('email')) if sender in emails: customer=frappe.get_doc('Customer',d.customer) resp.update({'is_true':True,'customer':d.customer}) for cu in customer.get('accounts'): resp.update({'company':cu.company}) return resp return resp def after_insert(doc,method): if len(frappe.get_all('Issue',{'communication':doc.name}))==0: domain_rule=email_rules_true_for_domain(doc.sender) email_rule=email_rules_true_for_emails_table(doc.sender) if (domain_rule.get('is_true') or email_rule.get('is_true')) and doc.sent_or_received=='Received': if "Re:" not in doc.subject: issue=frappe.new_doc("Issue") issue.subject=doc.subject issue.description=doc.content issue.raised_by=doc.sender issue.communication=doc.name issue.customer=domain_rule.get('customer') if domain_rule.get('is_true') else email_rule.get('customer') issue.flags.ignore_mandatory=True issue.company=domain_rule.get('company') if domain_rule.get('is_true') else email_rule.get('company') issue.save()
52.060241
125
0.603101
558
4,321
4.403226
0.123656
0.054131
0.05291
0.042328
0.835165
0.761091
0.734636
0.707774
0.690273
0.652015
0
0.000957
0.274242
4,321
82
126
52.695122
0.782526
0
0
0.545455
0
0
0.125463
0
0
0
0
0
0
1
0.051948
false
0
0.012987
0
0.116883
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
0e89b4f21a80f76fa1a6670a5f964bed58f712b6
321
py
Python
src/chemcalculator/__init__.py
UBC-MDS/chemcalculator
383b2d23fc7400ac62b98b5c06ff8ff28b8672e7
[ "MIT" ]
null
null
null
src/chemcalculator/__init__.py
UBC-MDS/chemcalculator
383b2d23fc7400ac62b98b5c06ff8ff28b8672e7
[ "MIT" ]
27
2022-01-13T21:35:12.000Z
2022-02-05T07:15:00.000Z
src/chemcalculator/__init__.py
UBC-MDS/chemcalculator
383b2d23fc7400ac62b98b5c06ff8ff28b8672e7
[ "MIT" ]
null
null
null
# read version from installed package from importlib.metadata import version __version__ = version("chemcalculator") # populate package namespace from chemcalculator.chemcalculator import compute_mass from chemcalculator.chemcalculator import moles_grams_converter from chemcalculator.chemcalculator import percent_mass
35.666667
63
0.872274
35
321
7.771429
0.485714
0.198529
0.352941
0.419118
0
0
0
0
0
0
0
0
0.093458
321
8
64
40.125
0.934708
0.193146
0
0
0
0
0.054688
0
0
0
0
0
0
1
0
false
0
0.8
0
0.8
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
0ea4367a9b5ff317f5e82b2b7cbbd5493cf68a29
74
py
Python
cmdline/reportcachestatus.py
williamscraigm/arcrest
5a381988fe0035678dc94703d857c6ecb4194738
[ "Apache-2.0" ]
11
2015-02-06T23:35:49.000Z
2021-11-28T21:26:46.000Z
cmdline/reportcachestatus.py
williamscraigm/arcrest
5a381988fe0035678dc94703d857c6ecb4194738
[ "Apache-2.0" ]
1
2015-06-24T13:46:44.000Z
2015-07-01T07:46:28.000Z
cmdline/reportcachestatus.py
williamscraigm/arcrest
5a381988fe0035678dc94703d857c6ecb4194738
[ "Apache-2.0" ]
6
2015-02-23T22:51:53.000Z
2021-01-17T05:57:24.000Z
#! python import arcrest.admin arcrest.admin.cmdline.reportcachestatus()
14.8
41
0.810811
8
74
7.5
0.75
0.4
0
0
0
0
0
0
0
0
0
0
0.081081
74
4
42
18.5
0.882353
0.108108
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
7ed31f4f28e0dd77411d34b11ae6847ec4d91131
2,433
py
Python
tests/routes/test_api_searchLeases.py
Biosystems-Analytics-Lab/shellcast
8d578bfa3d66d75502f1a133fe6263d376694247
[ "CC-BY-4.0" ]
5
2021-03-24T19:19:48.000Z
2022-01-11T09:27:13.000Z
tests/routes/test_api_searchLeases.py
Biosystems-Analytics-Lab/shellcast
8d578bfa3d66d75502f1a133fe6263d376694247
[ "CC-BY-4.0" ]
1
2022-01-13T15:11:09.000Z
2022-01-13T21:16:10.000Z
tests/routes/test_api_searchLeases.py
Biosystems-Analytics-Lab/shellcast
8d578bfa3d66d75502f1a133fe6263d376694247
[ "CC-BY-4.0" ]
null
null
null
import pytest from models.User import User from models.UserLease import UserLease from models.NCDMFLease import NCDMFLease from firebase_admin import auth def test_search_leases(client, dbSession, addMockFbUser): # add a mock Firebase user addMockFbUser(dict(uid='3sH9so5Y3DP72QA1XqbWw9J6I8o1', email='blah@gmail.com'), 'validUser1') # add some NCDMF leases ncdmfLeases = [ NCDMFLease(ncdmf_lease_id='819401', grow_area_name='D11', cmu_name='U001', rainfall_thresh_in=2.5, geometry=(34.404497, -77.567573)), NCDMFLease(ncdmf_lease_id='123456', grow_area_name='B05', cmu_name='U002', rainfall_thresh_in=3.5, geometry=(35.923741, -76.239482)), NCDMFLease(ncdmf_lease_id='4-C-89', grow_area_name='A01', cmu_name='U003', rainfall_thresh_in=1.5, geometry=(36.303915, -75.864693)) ] dbSession.add_all(ncdmfLeases) dbSession.commit() res = client.post('/searchLeases', headers={'Authorization': 'validUser1'}, json={'search': '1'}) assert res.status_code == 200 json = res.get_json() assert len(json) == 2 assert json[0] == '819401' assert json[1] == '123456' def test_search_leases_with_existing_user_lease(client, dbSession, addMockFbUser): # add a mock Firebase user addMockFbUser(dict(uid='3sH9so5Y3DP72QA1XqbWw9J6I8o1', email='blah@gmail.com'), 'validUser1') # add the user to the db user = User(firebase_uid='3sH9so5Y3DP72QA1XqbWw9J6I8o1', email='blah@gmail.com') dbSession.add(user) dbSession.commit() # add some NCDMF leases ncdmfLeases = [ NCDMFLease(ncdmf_lease_id='819401', grow_area_name='D11', cmu_name='U001', rainfall_thresh_in=2.5, geometry=(34.404497, -77.567573)), NCDMFLease(ncdmf_lease_id='123456', grow_area_name='B05', cmu_name='U002', rainfall_thresh_in=3.5, geometry=(35.923741, -76.239482)), NCDMFLease(ncdmf_lease_id='4-C-89', grow_area_name='A01', cmu_name='U003', rainfall_thresh_in=1.5, geometry=(36.303915, -75.864693)) ] dbSession.add_all(ncdmfLeases) dbSession.commit() # add one existing lease for the user lease = UserLease(user_id=user.id, ncdmf_lease_id='123456', grow_area_name='B05', cmu_name='U002', rainfall_thresh_in=3.5, geometry=(35.923741, -76.239482)) dbSession.add(lease) dbSession.commit() res = client.post('/searchLeases', headers={'Authorization': 'validUser1'}, json={'search': '1'}) assert res.status_code == 200 json = res.get_json() assert len(json) == 1 assert json[0] == '819401'
39.885246
158
0.733251
343
2,433
5.008746
0.262391
0.040745
0.048894
0.076834
0.779977
0.779977
0.752037
0.752037
0.752037
0.752037
0
0.123428
0.11755
2,433
60
159
40.55
0.676758
0.062474
0
0.6
0
0
0.149956
0.036939
0
0
0
0
0.175
1
0.05
false
0
0.125
0
0.175
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
7ed8484936ccba5c069b5f29988d450e86b02e83
43
py
Python
hello.py
natesb3/HelloRobot
f13ac0d3db15d3ff7c75224961dc700452845d0a
[ "MIT" ]
null
null
null
hello.py
natesb3/HelloRobot
f13ac0d3db15d3ff7c75224961dc700452845d0a
[ "MIT" ]
null
null
null
hello.py
natesb3/HelloRobot
f13ac0d3db15d3ff7c75224961dc700452845d0a
[ "MIT" ]
null
null
null
from gopigo import * enc_tgt(1,1,72) fwd()
10.75
20
0.697674
9
43
3.222222
0.888889
0
0
0
0
0
0
0
0
0
0
0.108108
0.139535
43
4
21
10.75
0.675676
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
7ef10faa58db14cc68a83e0af0463f453b58cadc
3,717
py
Python
python-cli/tests/test_cli.py
treebeardtech/pytest-deepcov
972d13d36555d47afdf00a326cbf4d9534761c28
[ "Apache-2.0" ]
15
2021-03-31T11:17:03.000Z
2022-01-18T18:23:11.000Z
python-cli/tests/test_cli.py
treebeardtech/pytest-deepcov
972d13d36555d47afdf00a326cbf4d9534761c28
[ "Apache-2.0" ]
null
null
null
python-cli/tests/test_cli.py
treebeardtech/pytest-deepcov
972d13d36555d47afdf00a326cbf4d9534761c28
[ "Apache-2.0" ]
null
null
null
import json import os import shutil import sys from subprocess import CalledProcessError, check_output import pytest from click.testing import CliRunner from deepcov.cli import File from snapshottest.pytest import PyTestSnapshotTest from tests.util import RESOURCES from deepcov import cli # isort:skip pytest_plugins = "pytester" @pytest.fixture def tested_dir(): try: check_output(f"{sys.executable} -m pytest", cwd="tests/resources", shell=True) except CalledProcessError as err: assert err.returncode == 1 os.chdir(RESOURCES / ".deepcov") class TestCli: def test_when_test_file_then_success( self, tested_dir: object, snapshot: PyTestSnapshotTest ): runner = CliRunner() source = RESOURCES / "src" / "test_lib.py" assert source.exists() print(f"Running {source}") result = runner.invoke(cli.run, source.as_posix(), catch_exceptions=False) print(result.stdout) f = File(**json.loads(result.stdout)) [snapshot.assert_match({line: f.lines[line]}) for line in sorted(f.lines)] def test_when_src_file_then_success( self, tested_dir: object, snapshot: PyTestSnapshotTest ): runner = CliRunner() source = RESOURCES / "src" / "lib.py" assert source.exists() print(f"Running {source}") result = runner.invoke(cli.run, source.as_posix(), catch_exceptions=False) print(result.stdout) f = File(**json.loads(result.stdout)) [snapshot.assert_match({line: f.lines[line]}) for line in sorted(f.lines)] def test_when_no_junit_then_error( self, tested_dir: object, testdir: pytest.Testdir, ): shutil.copyfile(RESOURCES / ".deepcov" / ".coverage", ".coverage") runner = CliRunner() source = RESOURCES / "src" / "lib.py" assert source.exists() print(f"Running {source}") result = runner.invoke(cli.run, source.as_posix(), catch_exceptions=False) assert "error" in json.loads(result.stdout) def test_when_no_cov_then_error(self, tested_dir: object, testdir: pytest.Testdir): shutil.copyfile(RESOURCES / ".deepcov" / "junit.xml", "junit.xml") runner = CliRunner() source = RESOURCES / "src" / "lib.py" assert source.exists() print(f"Running {source}") result = runner.invoke(cli.run, source.as_posix(), catch_exceptions=False) assert "error" in json.loads(result.stdout) def test_when_unknown_file_then_error(self, tested_dir: object): runner = CliRunner() source = RESOURCES / "src" / "asdf.py" assert not source.exists() print(f"Running {source}") result = runner.invoke(cli.run, source.as_posix(), catch_exceptions=False) assert json.loads(result.stdout)["error"].startswith("No cov") def test_when_out_of_cov_scope_then_error(self, tested_dir: object): runner = CliRunner() source = RESOURCES / "out_of_cov_scope.py" assert source.exists() print(f"Running {source}") result = runner.invoke(cli.run, source.as_posix(), catch_exceptions=False) assert json.loads(result.stdout)["error"].startswith("No cov") def test_when_status_then_time_given(self, tested_dir: object): runner = CliRunner() result = runner.invoke(cli.run, catch_exceptions=False) assert json.loads(result.stdout)["time_since_run"] == "just now" def test_when_status_no_data_then_null(self, testdir: pytest.Testdir): runner = CliRunner() result = runner.invoke(cli.run, catch_exceptions=False) assert json.loads(result.stdout)["time_since_run"] == None
36.80198
87
0.665591
461
3,717
5.197397
0.21692
0.050083
0.036728
0.070117
0.72788
0.726628
0.718698
0.718698
0.718698
0.718698
0
0.000343
0.216034
3,717
100
88
37.17
0.821894
0.00269
0
0.535714
0
0
0.092578
0
0
0
0
0
0.178571
1
0.107143
false
0
0.130952
0
0.25
0.095238
0
0
0
null
0
0
0
0
1
1
1
1
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
5
7ef9b5994c90ce96bcd77bec426b2fc0d31fe8a2
9,454
py
Python
tests/test_core.py
JEFuller/dataclasses-configobj
d8623713c81debe2d957f4776b3d3dac8f83abe2
[ "MIT" ]
null
null
null
tests/test_core.py
JEFuller/dataclasses-configobj
d8623713c81debe2d957f4776b3d3dac8f83abe2
[ "MIT" ]
2
2021-09-10T16:55:18.000Z
2021-10-15T18:49:52.000Z
tests/test_core.py
JEFuller/dataclasses-configobj
d8623713c81debe2d957f4776b3d3dac8f83abe2
[ "MIT" ]
null
null
null
import unittest from dataclasses import dataclass from typing import List, Optional, Type, TypeVar import configobj import validate from dataclasses_configobj import core class CoreTestCase(unittest.TestCase): def test_config(self): spec = list(map(str.strip, """\ [foo] bar = string pip = integer\ """.split('\n'))) infile = list(map(str.strip, """\ [foo] bar = one pip = 1\ """.split('\n'))) root = configobj.ConfigObj(infile=infile, configspec=spec) vtor = validate.Validator() res = root.validate(vtor, preserve_errors=True) self.assertEqual(res, True) foo = root['foo'] self.assertIsNotNone(foo) self.assertEqual(foo['bar'], 'one') self.assertEqual(foo['pip'], 1) def test_to_spec_1(self): @dataclass class Foo: bar: str pip: int @dataclass class Config: foo: Foo expectedSpec = list(map(str.strip, """\ [foo] bar = string pip = integer\ """.split('\n'))) root = configobj.ConfigObj() foo = configobj.Section(root, 1, root) root['foo'] = foo foo.__setitem__('bar', 'string') foo.__setitem__('pip', 'integer') self.assertEqual(expectedSpec, root.write()) spec = core.to_spec(Config) self.assertEqual(expectedSpec, spec.write()) def test_to_spec_2(self): @dataclass class Foo: a: str @dataclass class Bar: b: int @dataclass class Config: pip: str foo: Foo bar: Bar baz: str expectedSpec = list(map(str.strip, """\ pip = string baz = string [foo] a = string [bar] b = integer\ """.split('\n'))) root = configobj.ConfigObj() root['pip'] = 'string' root['baz'] = 'string' foo = configobj.Section(root, 1, root) root['foo'] = foo foo.__setitem__('a', 'string') bar = configobj.Section(root, 1, root) root['bar'] = bar bar.__setitem__('b', 'integer') self.assertEqual(expectedSpec, root.write()) spec = core.to_spec(Config) self.assertEqual(expectedSpec, spec.write()) def test_to_spec_3(self): @dataclass class Single: other: str @dataclass class OneOfMany: _name: str val: str @dataclass class Config: single: Single _many: List[OneOfMany] expectedSpec = list(map(str.strip, """\ [single] other = string [__many__] val = string\ """.split('\n'))) spec = core.to_spec(Config) self.assertEqual(expectedSpec, spec.write()) def test_to_spec_4(self): @dataclass class OneOfMany: _name: str val: str @dataclass class Wrapper: _many: List[OneOfMany] @dataclass class Config: wrapper: Wrapper expectedSpec = list(map(str.strip, """\ [wrapper] [[__many__]] val = string\ """.split('\n'))) spec = core.to_spec(Config) self.assertEqual(expectedSpec, spec.write()) def test_type(self): T = TypeVar('T') def doit(klass: Type[T]) -> T: vars = {'other': 'test'} return klass(**vars) @dataclass class Parent: other: str self.assertEqual(doit(Parent).other, 'test') def test_lift_1(self): @dataclass class Single: other: str @dataclass class OneOfMany: _name: str val: str @dataclass class Config: single: Single _many: List[OneOfMany] infile = list(map(str.strip, """\ [single] other = hello [one] val = apple [two] val = banana\ """.split('\n'))) expectedConfig = Config( single=Single(other = 'hello'), _many=[ OneOfMany(_name = 'one', val = 'apple'), OneOfMany(_name = 'two', val = 'banana') ] ) spec = core.to_spec(Config) root = configobj.ConfigObj(infile=infile, configspec=spec) config = core.lift(Config, root) self.assertEqual(expectedConfig, config) def test_lift_2(self): @dataclass class OneOfMany: _name: str val: str @dataclass class Wrapper: _many: List[OneOfMany] @dataclass class Config: wrapper: Wrapper infile = list(map(str.strip, """\ [wrapper] [[one]] val = apple [[two]] val = banana\ """.split('\n'))) expectedConfig = Config( wrapper=Wrapper( _many=[ OneOfMany(_name = 'one', val = 'apple'), OneOfMany(_name = 'two', val = 'banana') ] ) ) spec = core.to_spec(Config) root = configobj.ConfigObj(infile=infile, configspec=spec) config = core.lift(Config, root) self.assertEqual(expectedConfig, config) def test_lift_3(self): @dataclass class Foo: bar: str pip: int @dataclass class OneOfMany: _name: str val: str @dataclass class Wrapper: test: str foo: Foo _many: List[OneOfMany] @dataclass class Config: wrapper: Wrapper infile = list(map(str.strip, """\ [wrapper] test = yes [[foo]] bar = testing pip = 123 [[one]] val = apple [[two]] val = banana\ """.split('\n'))) expectedConfig = Config( wrapper=Wrapper( test='yes', foo=Foo('testing', 123), _many=[ OneOfMany(_name = 'one', val = 'apple'), OneOfMany(_name = 'two', val = 'banana') ] ) ) spec = core.to_spec(Config) root = configobj.ConfigObj(infile=infile, configspec=spec) vtor = validate.Validator() root.validate(vtor) config = core.lift(Config, root) self.assertEqual(expectedConfig, config) def test_optional_root(self): @dataclass class Config: required: str optional: Optional[str] = None expectedSpec = list(map(str.strip, """\ required = string optional = string(default=None)\ """.split('\n'))) spec = core.to_spec(Config) self.assertEqual(expectedSpec, spec.write()) here = configobj.ConfigObj(infile= ["required = yes", "optional = here"], configspec=spec) vtor = validate.Validator() here.validate(vtor) self.assertEqual(Config('yes', 'here'), core.lift(Config, here)) empty = configobj.ConfigObj(infile= ["required = yes"], configspec=spec) vtor = validate.Validator() empty.validate(vtor) self.assertEqual(Config('yes', None), core.lift(Config, empty)) def test_default_root(self): @dataclass class Config: required: str optional: str = 'defaultvalue' expectedSpec = list(map(str.strip, """\ required = string optional = string(default='defaultvalue')\ """.split('\n'))) spec = core.to_spec(Config) self.assertEqual(expectedSpec, spec.write()) here = configobj.ConfigObj(infile= ["required = yes", "optional = here"], configspec=spec) vtor = validate.Validator() here.validate(vtor) self.assertEqual(Config('yes', 'here'), core.lift(Config, here)) empty = configobj.ConfigObj(infile= ["required = yes"], configspec=spec) vtor = validate.Validator() empty.validate(vtor) self.assertEqual(Config('yes', 'defaultvalue'), core.lift(Config, empty)) def test_readme_example(self): @dataclass class Single: other: str @dataclass class OneOfMany: _name: str val: str @dataclass class Config: single: Single _many: List[OneOfMany] optional: Optional[str] = None withdefault: str = 'test123' infile = list(map(str.strip, """\ [single] other = hello [one] val = apple [two] val = banana\ """.split('\n'))) spec = core.to_spec(Config) root = configobj.ConfigObj(infile=infile, configspec=spec) validator = validate.Validator() root.validate(validator) expectedConfig = Config( single=Single(other='hello'), optional=None, withdefault='test123', _many=[ OneOfMany(_name='one', val='apple'), OneOfMany(_name='two', val='banana') ] ) config: Config = core.lift(Config, root) self.assertEqual(expectedConfig, config)
24.303342
98
0.51026
895
9,454
5.293855
0.098324
0.079781
0.025327
0.037991
0.78683
0.766357
0.713803
0.713803
0.693964
0.681511
0
0.004027
0.369579
9,454
388
99
24.365979
0.79094
0
0
0.723127
0
0
0.158769
0.0055
0
0
0
0
0.068404
1
0.042345
false
0
0.019544
0
0.156352
0
0
0
0
null
0
0
0
0
1
1
1
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
5
7d1bb21b4f6b96eb330b25dacd7db8dfe9819ea1
19
py
Python
lib/python3.6/site-packages/stripe/version.py
jdmueller/ArmoniaSaleor
1d7c1e9bb697325cee3d007b3ea811f25c4086d9
[ "BSD-3-Clause" ]
1
2019-07-18T13:16:09.000Z
2019-07-18T13:16:09.000Z
lib/python3.6/site-packages/stripe/version.py
jdmueller/ArmoniaSaleor
1d7c1e9bb697325cee3d007b3ea811f25c4086d9
[ "BSD-3-Clause" ]
null
null
null
lib/python3.6/site-packages/stripe/version.py
jdmueller/ArmoniaSaleor
1d7c1e9bb697325cee3d007b3ea811f25c4086d9
[ "BSD-3-Clause" ]
null
null
null
VERSION = "2.32.0"
9.5
18
0.578947
4
19
2.75
1
0
0
0
0
0
0
0
0
0
0
0.25
0.157895
19
1
19
19
0.4375
0
0
0
0
0
0.315789
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
7d4233bc97376d7ca10c02219f43c1578b3fd177
27
py
Python
docs/source/exercises/week7_trees/trees/__init__.py
Heroes-Academy/DataStructures_Winter2017
2dab3537af2810399b2dd1aa6a570d2b185e3661
[ "MIT" ]
null
null
null
docs/source/exercises/week7_trees/trees/__init__.py
Heroes-Academy/DataStructures_Winter2017
2dab3537af2810399b2dd1aa6a570d2b185e3661
[ "MIT" ]
null
null
null
docs/source/exercises/week7_trees/trees/__init__.py
Heroes-Academy/DataStructures_Winter2017
2dab3537af2810399b2dd1aa6a570d2b185e3661
[ "MIT" ]
null
null
null
from .binarytrees import *
13.5
26
0.777778
3
27
7
1
0
0
0
0
0
0
0
0
0
0
0
0.148148
27
1
27
27
0.913043
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
ade733fdb3d6634efa2ebeb807462e445b2cff0b
148
py
Python
test_bots.py
alviproject/birdstorm
439ff97ee40c3dd93b8fa8bfca557bdee9c036e1
[ "MIT" ]
null
null
null
test_bots.py
alviproject/birdstorm
439ff97ee40c3dd93b8fa8bfca557bdee9c036e1
[ "MIT" ]
null
null
null
test_bots.py
alviproject/birdstorm
439ff97ee40c3dd93b8fa8bfca557bdee9c036e1
[ "MIT" ]
null
null
null
import bots bots.move( token='56f879426ad79431b15bbcc3300180a28c9d4fd2', ship=4, systems=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], )
21.142857
56
0.621622
22
148
4.181818
0.909091
0
0
0
0
0
0
0
0
0
0
0.384615
0.209459
148
7
57
21.142857
0.401709
0
0
0
0
0
0.268456
0.268456
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
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
adfc9f6b8e342150dc30849441ef5c2507b9f384
3,595
py
Python
tests/test_health_contrib.py
RogerEMO/srd
40eb8bb02cfd3b1f60ed9eb3e361877fea744cb5
[ "MIT" ]
1
2021-11-22T18:15:09.000Z
2021-11-22T18:15:09.000Z
tests/test_health_contrib.py
RogerEMO/srd
40eb8bb02cfd3b1f60ed9eb3e361877fea744cb5
[ "MIT" ]
3
2021-05-10T18:46:16.000Z
2021-06-01T16:51:48.000Z
tests/test_health_contrib.py
RogerEMO/srd
40eb8bb02cfd3b1f60ed9eb3e361877fea744cb5
[ "MIT" ]
1
2021-05-05T17:20:06.000Z
2021-05-05T17:20:06.000Z
import pytest from math import isclose import sys sys.path.append('/Users/pyann/Dropbox (CEDIA)/srd/Model') import srd from srd import quebec qc_form = quebec.form(2016) @pytest.mark.parametrize('nkids, net_inc', [(0, 18500), (1, 23800), (2, 27000)]) def test_cond_true_10_12_14(nkids, net_inc): p = srd.Person(age=45) hh = srd.Hhold(p, prov='qc') for _ in range(nkids): k = srd.Dependent(age=12) hh.add_dependent(k) qc_form.file(hh) p.prov_return['net_income'] = net_inc assert qc_form.health_contrib(p, hh) == 0 @pytest.mark.parametrize('nkids, net_inc', [(0, 19000), (1, 24000), (2, 28000)]) def test_cond_false_10_12_14(nkids, net_inc): p = srd.Person(age=45) hh = srd.Hhold(p, prov='qc') for _ in range(nkids): k = srd.Dependent(age=12) hh.add_dependent(k) qc_form.file(hh) p.prov_return['net_income'] = net_inc assert qc_form.health_contrib(p, hh) > 0 @pytest.mark.parametrize('nkids, net_inc', [(0, 23800), (1, 27000), (2, 29900)]) def test_cond_true_16_18_20(nkids, net_inc): p0 = srd.Person(age=45) p1 = srd.Person(age=45) hh = srd.Hhold(p0, p1, prov='qc') for _ in range(nkids): k = srd.Dependent(age=12) hh.add_dependent(k) qc_form.file(hh) p0.prov_return['net_income'] = net_inc assert qc_form.health_contrib(p0, hh) == 0 @pytest.mark.parametrize('nkids, net_inc', [(0, 24000), (1, 28000), (2, 30000)]) def test_cond_true_16_18_20(nkids, net_inc): p0 = srd.Person(age=45) p1 = srd.Person(age=45) hh = srd.Hhold(p0, p1, prov='qc') for _ in range(nkids): k = srd.Dependent(age=12) hh.add_dependent(k) qc_form.file(hh) p0.prov_return['net_income'] = net_inc assert qc_form.health_contrib(p0, hh) > 0 @pytest.mark.parametrize('inc_gis, amount', [(9300, 0), (9200, 50)]) def test_cond27(inc_gis, amount): p = srd.Person(age=78) hh = srd.Hhold(p, prov='qc') qc_form.file(hh) p.inc_gis = inc_gis p.prov_return['net_income'] = 41e3 assert qc_form.health_contrib(p, hh) == amount @pytest.mark.parametrize('inc_gis, amount', [(5850, 0), (5800, 50)]) def test_cond28(inc_gis, amount): p0 = srd.Person(age=78) p1 = srd.Person(age=78) hh = srd.Hhold(p0, p1, prov='qc') qc_form.file(hh) p0.inc_gis = inc_gis p0.prov_return['net_income'] = 41e3 assert qc_form.health_contrib(p0, hh) == amount @pytest.mark.parametrize('inc_gis, amount', [(5400, 0), (5300, 50)]) def test_cond29(inc_gis, amount): p0 = srd.Person(age=78) p1 = srd.Person(age=62) hh = srd.Hhold(p0, p1, prov='qc') qc_form.file(hh) p0.inc_gis = inc_gis p0.prov_return['net_income'] = 41e3 assert qc_form.health_contrib(p0, hh) == amount @pytest.mark.parametrize('inc_gis, amount', [(8700, 0), (8600, 50)]) def test_cond31(inc_gis, amount): p0 = srd.Person(age=78) p1 = srd.Person(age=59) hh = srd.Hhold(p0, p1, prov='qc') qc_form.file(hh) p0.inc_gis = inc_gis p0.prov_return['net_income'] = 41e3 assert qc_form.health_contrib(p0, hh) == amount @pytest.mark.parametrize('net_income, amount', [(18570, 0), (41e3, 50), (41265, 50), (134e3, 175), (200e3, 1000)]) def test_amount(net_income, amount): p = srd.Person(age=70, earn=50e3) hh = srd.Hhold(p, prov='qc') qc_form.file(hh) p.prov_return['net_income'] = net_income assert qc_form.health_contrib(p, hh) == amount
29.467213
81
0.618637
572
3,595
3.695804
0.164336
0.053926
0.07947
0.051088
0.792337
0.779565
0.773888
0.75071
0.714759
0.709082
0
0.097465
0.220862
3,595
121
82
29.710744
0.657265
0
0
0.608696
0
0
0.080599
0
0
0
0
0
0.097826
1
0.097826
false
0
0.054348
0
0.152174
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
bc035b4b70d0a3429c3ff33bf4cc7dc17a4cdf3b
71
py
Python
django_src/dashboard/services/__init__.py
jup014/Walk-Data-Processing
5951df6e467702ab0bc3c2721cb5457b0a074aa4
[ "MIT" ]
null
null
null
django_src/dashboard/services/__init__.py
jup014/Walk-Data-Processing
5951df6e467702ab0bc3c2721cb5457b0a074aa4
[ "MIT" ]
null
null
null
django_src/dashboard/services/__init__.py
jup014/Walk-Data-Processing
5951df6e467702ab0bc3c2721cb5457b0a074aa4
[ "MIT" ]
null
null
null
from .CSVFileUploadService import * from .TaskExecutionService import *
35.5
35
0.84507
6
71
10
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.098592
71
2
36
35.5
0.9375
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
bc0936deee1aa189e858d5bcfc6c0b04b05f6fe3
60
py
Python
hello.py
Irene17/Python
9054771d7d388d4cfb03f7063ff60ad03cac708c
[ "MIT" ]
null
null
null
hello.py
Irene17/Python
9054771d7d388d4cfb03f7063ff60ad03cac708c
[ "MIT" ]
1
2020-05-14T08:40:19.000Z
2020-05-14T08:40:58.000Z
hello.py
Irene17/Python
9054771d7d388d4cfb03f7063ff60ad03cac708c
[ "MIT" ]
null
null
null
print("This line will be printed.") print("Goodbye, World!")
30
35
0.716667
9
60
4.777778
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.1
60
2
36
30
0.796296
0
0
0
0
0
0.672131
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
70b9dfa2a333b9acfe7102b45a5b201511641b5f
323
py
Python
run.py
llzgsh/mykit-db-sync
09f4d512fbbb865cddc7357cb1a5f40929865237
[ "Apache-2.0" ]
null
null
null
run.py
llzgsh/mykit-db-sync
09f4d512fbbb865cddc7357cb1a5f40929865237
[ "Apache-2.0" ]
null
null
null
run.py
llzgsh/mykit-db-sync
09f4d512fbbb865cddc7357cb1a5f40929865237
[ "Apache-2.0" ]
null
null
null
import os jar="./mykit-db-transfer/target/mykit-db-transfer-1.0.0.jar;./mykit-db-common/target/mykit-db-common-1.0.0.jar;./lib/ojdbc8-full/ojdbc8.jar;" for f in os.listdir("./target/lib"): jar+='./target/lib/'+f+";" os.system("java -DisDelete=true -cp %s io.mykit.db.transfer.Main oracle_to_oracle_jobs.xml "%(jar,))
40.375
141
0.69969
59
323
3.779661
0.491525
0.156951
0.201794
0.053812
0
0
0
0
0
0
0
0.02649
0.065015
323
8
142
40.375
0.711921
0
0
0
0
0.4
0.743827
0.570988
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
70d6d46c966e79d1ca76edff7f3ebf7dd152d477
71
py
Python
day3/exercise/p4.py
AkshayManchanda/Python_Training
5a50472d118ac6d40145bf1dd60f26864bf9fb6c
[ "MIT" ]
null
null
null
day3/exercise/p4.py
AkshayManchanda/Python_Training
5a50472d118ac6d40145bf1dd60f26864bf9fb6c
[ "MIT" ]
null
null
null
day3/exercise/p4.py
AkshayManchanda/Python_Training
5a50472d118ac6d40145bf1dd60f26864bf9fb6c
[ "MIT" ]
null
null
null
mylist = [1,1,1,1,1,2,2,2,2,3,3,3,3] new_set=set(mylist) print(new_set)
23.666667
36
0.661972
21
71
2.142857
0.333333
0.177778
0.2
0.177778
0
0
0
0
0
0
0
0.19403
0.056338
71
3
37
23.666667
0.477612
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
70dc7273578e8bd38aa24ff7fc7f3ea580052e0b
66
py
Python
src/optimizer/__init__.py
Enchan1207/NeuralNetwork_Learning
e224c3a6cf109ae319f4248841dbb57f65bdfd4b
[ "MIT" ]
null
null
null
src/optimizer/__init__.py
Enchan1207/NeuralNetwork_Learning
e224c3a6cf109ae319f4248841dbb57f65bdfd4b
[ "MIT" ]
2
2022-02-13T07:41:29.000Z
2022-02-21T10:31:28.000Z
src/optimizer/__init__.py
Enchan1207/NeuralNetwork_Learning
e224c3a6cf109ae319f4248841dbb57f65bdfd4b
[ "MIT" ]
null
null
null
# # 学習オプティマイザ # from .base import Optimizer from .sgd import SGD
9.428571
27
0.727273
9
66
5.333333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.19697
66
6
28
11
0.90566
0.136364
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
70e410491c616db7892b61c8af78b0d65c7eed98
5,100
py
Python
customics/encoders/encoders.py
HakimBenkirane/customics
7c9c9df7a571fd0b6e54d9e17b05285f52269300
[ "MIT" ]
null
null
null
customics/encoders/encoders.py
HakimBenkirane/customics
7c9c9df7a571fd0b6e54d9e17b05285f52269300
[ "MIT" ]
null
null
null
customics/encoders/encoders.py
HakimBenkirane/customics
7c9c9df7a571fd0b6e54d9e17b05285f52269300
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Wed 01 Sept 2021 @author: Hakim Benkirane CentraleSupelec MICS laboratory 9 rue Juliot Curie, Gif-Sur-Yvette, 91190 France Build the Standard Encoder module. """ import torch.nn as nn from collections import OrderedDict from customics.tools import FullyConnectedLayer class Encoder(nn.Module): """ Standard Encoder Network. """ def __init__(self, input_dim, hidden_dim, latent_dim, norm_layer=nn.BatchNorm1d, leaky_slope=0.2, dropout=0, debug=False): """ Constructs the Standard Encoder network Parameters ---------- input_dim: int Dimension of the input tensor. hidden_dim: list List of dimensions for the multiple intermediate layers. latent_dim: int Dimension of the resulting latent representation. norm_layer: pytorch.nn Normalization Layer. leaky_slope: float Coefficient for the Leaky ReLU (must be between 0 and 1). dropout: float Dropout rate (must be between 0 and 1). debug: bool Debug parameter, prints the intermediate tensors during training. """ super(Encoder, self).__init__() self.dt_layers = OrderedDict() self.dt_layers['InputLayer'] = FullyConnectedLayer(input_dim, hidden_dim[0], norm_layer=norm_layer, leaky_slope=leaky_slope, dropout=dropout, activation=True) block_layer_num = len(hidden_dim) dropout_flag = True for num in range(1, block_layer_num): self.dt_layers['Layer{}'.format(num)] = FullyConnectedLayer(hidden_dim[num - 1], hidden_dim[num], norm_layer=norm_layer, leaky_slope=leaky_slope, dropout=dropout_flag*dropout, activation=True) # dropout for every other layer dropout_flag = not dropout_flag # the output fully-connected layer of the classifier self.dt_layers['OutputLayer']= FullyConnectedLayer(hidden_dim[-1], latent_dim, norm_layer=norm_layer, leaky_slope=leaky_slope, dropout=0, activation=False, normalization=False) self.net = nn.Sequential(self.dt_layers) def forward(self, x): h = self.net(x) return h def get_outputs(self, x): lt_output = [] for layer in self.net: lt_output.append(layer(x)) class ProbabilisticEncoder(nn.Module): """ Module that performs the inference step for the variational autoencoder """ def __init__(self, input_dim, hidden_dim, latent_dim, norm_layer=nn.BatchNorm1d, leaky_slope=0.2, dropout=0, debug=False): """ Constructs the inference network for the VAE architecture Parameters ---------- input_dim: int Dimension of the input tensor. hidden_dim: list List of dimensions for the multiple intermediate layers. latent_dim: int Dimension of the resulting latent representation. norm_layer: pytorch.nn Normalization Layer. leaky_slope: float Coefficient for the Leaky ReLU (must be between 0 and 1) dropout: float Dropout rate (must be between 0 and 1) debug: bool Debug parameter, prints the intermediate tensors during training """ super(ProbabilisticEncoder, self).__init__() self.dt_layers = OrderedDict() self.dt_layers['InputLayer'] = FullyConnectedLayer(input_dim, hidden_dim[0], norm_layer=norm_layer, leaky_slope=leaky_slope, dropout=dropout, activation=True) block_layer_num = len(hidden_dim) dropout_flag = True for num in range(1, block_layer_num): self.dt_layers['Layer{}'.format(num)] = FullyConnectedLayer(hidden_dim[num - 1], hidden_dim[num], norm_layer=norm_layer, leaky_slope=leaky_slope, dropout=dropout_flag*dropout, activation=True) # dropout for every other layer dropout_flag = not dropout_flag # the output fully-connected layer of the classifier self.net = nn.Sequential(self.dt_layers) self.mean_layer = FullyConnectedLayer(hidden_dim[-1], latent_dim, norm_layer=norm_layer, leaky_slope=leaky_slope, dropout=0, activation=False, normalization=False) self.log_var_layer = FullyConnectedLayer(hidden_dim[-1], latent_dim, norm_layer=norm_layer, leaky_slope=leaky_slope, dropout=0, activation=False, normalization=False) def forward(self, x): h = self.net(x) mean = self.mean_layer(h) log_var = self.log_var_layer(h) return mean, log_var
36.170213
157
0.60451
579
5,100
5.124352
0.226252
0.054601
0.045501
0.042467
0.790361
0.790361
0.790361
0.77216
0.755982
0.755982
0
0.011795
0.318431
5,100
140
158
36.428571
0.841772
0.302157
0
0.617021
0
0
0.014014
0
0
0
0
0
0
1
0.106383
false
0
0.06383
0
0.255319
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
70f5fbdfad920909d244fc8df3bcff6048a44c68
2,918
py
Python
Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/python/estimator/estimator_lib.py
JustinACoder/H22-GR3-UnrealAI
361eb9ef1147f8a2991e5f98c4118cd823184adf
[ "MIT" ]
6
2022-02-04T18:12:24.000Z
2022-03-21T23:57:12.000Z
Lib/site-packages/tensorflow/python/estimator/estimator_lib.py
shfkdroal/Robot-Learning-in-Mixed-Adversarial-and-Collaborative-Settings
1fa4cd6a566c8745f455fc3d2273208f21f88ced
[ "bzip2-1.0.6" ]
null
null
null
Lib/site-packages/tensorflow/python/estimator/estimator_lib.py
shfkdroal/Robot-Learning-in-Mixed-Adversarial-and-Collaborative-Settings
1fa4cd6a566c8745f455fc3d2273208f21f88ced
[ "bzip2-1.0.6" ]
1
2022-02-08T03:53:23.000Z
2022-02-08T03:53:23.000Z
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # 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. # ============================================================================== """Estimator: High level tools for working with models.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function # pylint: disable=unused-import,line-too-long,wildcard-import from tensorflow.python.estimator.canned.baseline import BaselineClassifier from tensorflow.python.estimator.canned.baseline import BaselineRegressor from tensorflow.python.estimator.canned.boosted_trees import BoostedTreesClassifier from tensorflow.python.estimator.canned.boosted_trees import BoostedTreesRegressor from tensorflow.python.estimator.canned.dnn import DNNClassifier from tensorflow.python.estimator.canned.dnn import DNNRegressor from tensorflow.python.estimator.canned.dnn_linear_combined import DNNLinearCombinedClassifier from tensorflow.python.estimator.canned.dnn_linear_combined import DNNLinearCombinedRegressor from tensorflow.python.estimator.canned.linear import LinearClassifier from tensorflow.python.estimator.canned.linear import LinearRegressor from tensorflow.python.estimator.canned.parsing_utils import classifier_parse_example_spec from tensorflow.python.estimator.canned.parsing_utils import regressor_parse_example_spec from tensorflow.python.estimator.estimator import Estimator from tensorflow.python.estimator.estimator import VocabInfo from tensorflow.python.estimator.estimator import WarmStartSettings from tensorflow.python.estimator.export import export_lib as export from tensorflow.python.estimator.exporter import Exporter from tensorflow.python.estimator.exporter import FinalExporter from tensorflow.python.estimator.exporter import LatestExporter from tensorflow.python.estimator.inputs import inputs from tensorflow.python.estimator.keras import model_to_estimator from tensorflow.python.estimator.model_fn import EstimatorSpec from tensorflow.python.estimator.model_fn import ModeKeys from tensorflow.python.estimator.run_config import RunConfig from tensorflow.python.estimator.training import EvalSpec from tensorflow.python.estimator.training import train_and_evaluate from tensorflow.python.estimator.training import TrainSpec # pylint: enable=unused-import,line-too-long,wildcard-import
56.115385
95
0.817341
359
2,918
6.543175
0.370474
0.16092
0.229885
0.333333
0.51341
0.505747
0.352065
0.139634
0.049383
0
0
0.003051
0.101439
2,918
51
96
57.215686
0.89283
0.28547
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0.033333
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
cb037fd7b075dc46ceead68e0ebc9e3c6eb20d88
69
py
Python
crawlit/utils.py
ihor-nahuliak/crawlit
138d02968e88c14da6b441852d8e09ebb0c29140
[ "MIT" ]
null
null
null
crawlit/utils.py
ihor-nahuliak/crawlit
138d02968e88c14da6b441852d8e09ebb0c29140
[ "MIT" ]
null
null
null
crawlit/utils.py
ihor-nahuliak/crawlit
138d02968e88c14da6b441852d8e09ebb0c29140
[ "MIT" ]
null
null
null
def is_xpath_selector(selector): return selector.startswith('/')
23
35
0.753623
8
69
6.25
0.75
0
0
0
0
0
0
0
0
0
0
0
0.115942
69
2
36
34.5
0.819672
0
0
0
0
0
0.014493
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
cb3425f636bc3f9f02d6bbd712a32c7d54f8701f
3,276
py
Python
CircuitAnalysis/BuildTimes/binomial-15.py
isislovecruft/torflow
666689ad18d358d764a35d041a7b16adb8d3287c
[ "BSD-3-Clause" ]
null
null
null
CircuitAnalysis/BuildTimes/binomial-15.py
isislovecruft/torflow
666689ad18d358d764a35d041a7b16adb8d3287c
[ "BSD-3-Clause" ]
1
2018-12-18T15:58:40.000Z
2018-12-26T16:52:51.000Z
CircuitAnalysis/BuildTimes/binomial-15.py
isislovecruft/torflow
666689ad18d358d764a35d041a7b16adb8d3287c
[ "BSD-3-Clause" ]
null
null
null
#!/usr/bin/python # # Uses the binomial distribution to estimate the expected number of # circuit 15-circ groups before a false positive that discards all of our # 15-circ groups for a few different parameters. import math def fact(n): if n==1: return 1 return n*fact(n-1) def choose(n, k): return fact(n)/(fact(k)*fact(n-k)) def binomial(p, n, k): return choose(n,k)*math.pow(p,k)*math.pow(1-p,n-k) def BinomialF(p, n, k): F = 0.0 for i in xrange(k,n): F+=binomial(p,n,i) return F twenty_pct = BinomialF(.2, 15, 12) thirty_pct = BinomialF(.3, 15, 12) fourty_pct = BinomialF(.4, 15, 12) fifty_pct = BinomialF(.5, 15, 12) sixty_pct = BinomialF(.6, 15, 12) seventy_pct = BinomialF(.7, 15, 12) eighty_pct = BinomialF(.8, 15, 12) ninety_pct = BinomialF(.9, 15, 12) print "12 out of 15:" print "20% circ timeout rate expects "+str(1.0/twenty_pct)+" 15-circ groups" print "30% circ timeout rate expects "+str(1.0/thirty_pct) +" 15-circ groups" print "40% circ timeout rate expects "+str(1.0/fourty_pct) +" 15-circ groups" print "50% circ timeout rate expects "+str(1.0/fifty_pct)+" 15-circ groups" print "60% circ timeout rate expects "+str(1.0/sixty_pct)+" 15-circ groups" print "70% circ timeout rate expects "+str(1.0/seventy_pct)+" 15-circ groups" print "80% circ timeout rate expects "+str(1.0/eighty_pct)+" 20-circ groups" print "90% circ timeout rate expects "+str(1.0/ninety_pct)+" 20-circ groups" print twenty_pct = BinomialF(.2, 15, 13) thirty_pct = BinomialF(.3, 15, 13) fourty_pct = BinomialF(.4, 15, 13) fifty_pct = BinomialF(.5, 15, 13) sixty_pct = BinomialF(.6, 15, 13) seventy_pct = BinomialF(.7, 15, 13) eighty_pct = BinomialF(.8, 15, 13) ninety_pct = BinomialF(.9, 15, 13) print "13 out of 15:" print "20% circ timeout rate expects "+str(1.0/twenty_pct) +" 15-circ groups" print "30% circ timeout rate expects "+str(1.0/thirty_pct) +" 15-circ groups" print "40% circ timeout rate expects "+str(1.0/fourty_pct) +" 15-circ groups" print "50% circ timeout rate expects "+str(1.0/fifty_pct)+" 15-circ groups" print "60% circ timeout rate expects "+str(1.0/sixty_pct)+" 15-circ groups" print "70% circ timeout rate expects "+str(1.0/seventy_pct)+" 15-circ groups" print "80% circ timeout rate expects "+str(1.0/eighty_pct)+" 20-circ groups" print "90% circ timeout rate expects "+str(1.0/ninety_pct)+" 20-circ groups" print twenty_pct = BinomialF(.2, 15, 14) thirty_pct = BinomialF(.3, 15, 14) fourty_pct = BinomialF(.4, 15, 14) fifty_pct = BinomialF(.5, 15, 14) sixty_pct = BinomialF(.6, 15, 14) seventy_pct = BinomialF(.7, 15, 14) eighty_pct = BinomialF(.8, 15, 14) ninety_pct = BinomialF(.9, 15, 14) print "14 out of 15:" print "20% circ timeout rate expects "+str(1.0/twenty_pct)+" 15-circ groups" print "30% circ timeout rate expects "+str(1.0/thirty_pct) +" 15-circ groups" print "40% circ timeout rate expects "+str(1.0/fourty_pct) +" 15-circ groups" print "50% circ timeout rate expects "+str(1.0/fifty_pct)+" 15-circ groups" print "60% circ timeout rate expects "+str(1.0/sixty_pct)+" 15-circ groups" print "70% circ timeout rate expects "+str(1.0/seventy_pct)+" 15-circ groups" print "80% circ timeout rate expects "+str(1.0/eighty_pct)+" 20-circ groups" print "90% circ timeout rate expects "+str(1.0/ninety_pct)+" 20-circ groups" print
40.444444
77
0.705128
599
3,276
3.776294
0.133556
0.114943
0.159151
0.233422
0.819629
0.616711
0.616711
0.616711
0.616711
0.616711
0
0.101239
0.137668
3,276
80
78
40.95
0.699469
0.061355
0
0.421875
0
0
0.364495
0
0
0
0
0
0
0
null
null
0
0.015625
null
null
0.46875
0
0
0
null
0
0
1
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
5
cb39ba9e29508f7383d385a01d0233ddc36e37ab
73
py
Python
data_visualization.py
liangtrevor/wkw-visualization
22541699ec74596b9e8916c18d12e1425fc1873c
[ "MIT" ]
null
null
null
data_visualization.py
liangtrevor/wkw-visualization
22541699ec74596b9e8916c18d12e1425fc1873c
[ "MIT" ]
null
null
null
data_visualization.py
liangtrevor/wkw-visualization
22541699ec74596b9e8916c18d12e1425fc1873c
[ "MIT" ]
null
null
null
import matplotlib as pl import numpy as np import pandas as pd import csv
18.25
23
0.821918
14
73
4.285714
0.642857
0
0
0
0
0
0
0
0
0
0
0
0.178082
73
4
24
18.25
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
cb5a72227fab3d6927474efd9722ef9f7cee8017
123
py
Python
backend/properties/admin.py
crowdbotics-apps/confer-32440
8d631d4899c45ce6bac3ff355f7b87cd02a0271c
[ "FTL", "AML", "RSA-MD" ]
null
null
null
backend/properties/admin.py
crowdbotics-apps/confer-32440
8d631d4899c45ce6bac3ff355f7b87cd02a0271c
[ "FTL", "AML", "RSA-MD" ]
null
null
null
backend/properties/admin.py
crowdbotics-apps/confer-32440
8d631d4899c45ce6bac3ff355f7b87cd02a0271c
[ "FTL", "AML", "RSA-MD" ]
null
null
null
from django.contrib import admin from .models import Property admin.site.register(Property) # Register your models here.
17.571429
32
0.804878
17
123
5.823529
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.130081
123
6
33
20.5
0.925234
0.211382
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
cb7afc3ff3404b11f1e610d50ce75a80f502d049
52
py
Python
configs/__init__.py
light1726/VAENAR-TTS
5ca9661cf3835e0f3f3e9bbab85fb95e6a9c7c7a
[ "MIT" ]
125
2021-07-01T20:08:42.000Z
2022-03-31T08:03:07.000Z
configs/__init__.py
light1726/VAENAR-TTS
5ca9661cf3835e0f3f3e9bbab85fb95e6a9c7c7a
[ "MIT" ]
10
2021-06-29T09:25:52.000Z
2022-03-31T07:45:38.000Z
configs/__init__.py
light1726/VAENAR-TTS
5ca9661cf3835e0f3f3e9bbab85fb95e6a9c7c7a
[ "MIT" ]
16
2021-06-29T02:49:41.000Z
2022-03-25T07:43:52.000Z
from .hparams import * from .logger import Logger
17.333333
27
0.75
7
52
5.571429
0.571429
0
0
0
0
0
0
0
0
0
0
0
0.192308
52
2
28
26
0.928571
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
cba7e5f983f177049d28507c7e8ecba193ca4683
313
py
Python
should_dsl/__init__.py
hugobr/should-dsl
f01210f0becc23173802061dc6652922d3e1845a
[ "MIT" ]
5
2015-01-28T19:17:22.000Z
2019-07-12T22:30:21.000Z
should_dsl/__init__.py
rodrigomanhaes/should-dsl
f01210f0becc23173802061dc6652922d3e1845a
[ "MIT" ]
2
2020-04-26T22:23:24.000Z
2021-04-20T13:43:53.000Z
should_dsl/__init__.py
rodrigomanhaes/should-dsl
f01210f0becc23173802061dc6652922d3e1845a
[ "MIT" ]
4
2015-08-24T18:15:48.000Z
2020-03-27T14:13:52.000Z
from should_dsl.dsl import (should, should_not, matcher, add_predicate_regex, matcher_configuration, aliases, ShouldNotSatisfied) from should_dsl import matchers
31.3
47
0.444089
21
313
6.333333
0.619048
0.150376
0.195489
0
0
0
0
0
0
0
0
0
0.527157
313
9
48
34.777778
0.898649
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
1
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
5
cbc5aad0186f66de637a4c5ebd16946b2222d91c
226
py
Python
integrationTest/src/main/resources/jsMacros/Macros/runTests.py
LeonXu98/multiconnect
650d4c071b63696e66c14674fc6390cf8d9f6b07
[ "MIT" ]
null
null
null
integrationTest/src/main/resources/jsMacros/Macros/runTests.py
LeonXu98/multiconnect
650d4c071b63696e66c14674fc6390cf8d9f6b07
[ "MIT" ]
null
null
null
integrationTest/src/main/resources/jsMacros/Macros/runTests.py
LeonXu98/multiconnect
650d4c071b63696e66c14674fc6390cf8d9f6b07
[ "MIT" ]
null
null
null
from net.earthcomputer.multiconnect.api import Protocols from net.earthcomputer.multiconnect.integrationtest import IntegrationTest ip = IntegrationTest.setupServer(Protocols.V1_16_5) Client.connect(ip) Client.waitTick(100)
28.25
74
0.858407
27
226
7.111111
0.62963
0.072917
0.208333
0.333333
0
0
0
0
0
0
0
0.033175
0.066372
226
7
75
32.285714
0.876777
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
1db972c3f02f97bfb04074d0630bae5025beba81
95
py
Python
Django_rest_project/books/books_api/admin.py
Beshkov/Python-web-fundamentals
6b0e9cc9725ea80a33c2ebde6e29f2ab585ab8d9
[ "MIT" ]
null
null
null
Django_rest_project/books/books_api/admin.py
Beshkov/Python-web-fundamentals
6b0e9cc9725ea80a33c2ebde6e29f2ab585ab8d9
[ "MIT" ]
null
null
null
Django_rest_project/books/books_api/admin.py
Beshkov/Python-web-fundamentals
6b0e9cc9725ea80a33c2ebde6e29f2ab585ab8d9
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import BookModel admin.site.register(BookModel)
19
32
0.831579
13
95
6.076923
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.105263
95
5
33
19
0.929412
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
1dd702aa81b7eeb809ec883551284dfd6af1e42b
26
py
Python
share/python/tools/python/Core/__init__.py
lucas-bremond/spacer-core
08966016dc5d870a80a289a453396b038f61cc1b
[ "MIT" ]
null
null
null
share/python/tools/python/Core/__init__.py
lucas-bremond/spacer-core
08966016dc5d870a80a289a453396b038f61cc1b
[ "MIT" ]
1
2018-03-05T05:13:50.000Z
2018-03-05T05:13:50.000Z
share/python/tools/python/Core/__init__.py
lucas-bremond/spacer-core
08966016dc5d870a80a289a453396b038f61cc1b
[ "MIT" ]
null
null
null
from SpacerCorePy import *
26
26
0.846154
3
26
7.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.115385
26
1
26
26
0.956522
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
1de49377e792a2616a72a8e5fb58fdf0cd0f4af7
2,622
py
Python
utils/api_helper.py
MohammedWaasim/api-lite
f69367f3733a6db90df1ffe3e3a5e3f0d04ee6e0
[ "MIT" ]
null
null
null
utils/api_helper.py
MohammedWaasim/api-lite
f69367f3733a6db90df1ffe3e3a5e3f0d04ee6e0
[ "MIT" ]
null
null
null
utils/api_helper.py
MohammedWaasim/api-lite
f69367f3733a6db90df1ffe3e3a5e3f0d04ee6e0
[ "MIT" ]
null
null
null
import logging import pdb import json import requests import utils.custom_logger as cl class ApiHelper(): log=cl.customLogger(logging.DEBUG) def __init__(self,apikey): self.apikey=apikey def get(self,uri,params=None,header=None): try: if not header: header={} header["Content-Type"]="application/json" header["Authorization"]=self.apikey response=requests.get(url=uri,params=params,headers=header) if(response.status_code==200): return response.json() else: self.log.info("the requested url is not successful please check the url and params " + uri + " " + str(params)) self.log.info("response received is " + response.json()) except: self.log.error("unable to perform get call for url " + uri + " params " + str(params)) def post(self,uri,payload=None,header=None): try: if not header: header = {} header["Content-Type"] = "application/json" header["Authorization"] = self.apikey header['Accept']= 'text/plain' res = requests.post(url=uri,json=payload,headers=header) #here ideally it should be 201 status code if(res.status_code==200): self.log.info("the requested url is successful") return res.json() else: self.log.info("the requested url is not successful please check the url and params " + uri + " " + str(payload)) self.log.info("response received is "+res.json()) except Exception as e: self.log.error("unable to perform post call bcoz of "+e) def put(self,uri,payload=None,header=None): try: if not header: header = {} header["Content-Type"] = "application/json" header["Authorization"] = self.apikey header['Accept']= 'text/plain' res = requests.put(url=uri,json=payload,headers=header) #here ideally it should be 201 status code if(res.status_code==200): self.log.info("the requested url is successful") return res.json() else: self.log.info("the requested url is not successful please check the url and params " + uri + " " + str(payload)) self.log.info("response received is " + res.json()) except Exception as e: self.log.error("unable to perform post call bcoz of "+e)
42.290323
128
0.563692
311
2,622
4.726688
0.234727
0.052381
0.059864
0.047619
0.77551
0.77551
0.737415
0.737415
0.737415
0.737415
0
0.008508
0.327613
2,622
61
129
42.983607
0.825298
0.031274
0
0.618182
0
0
0.237288
0
0
0
0
0
0
1
0.072727
false
0
0.090909
0
0.254545
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
380dc32d46bd05fc0df91a53b601bffc6fbf113a
126
py
Python
06. Python Essentials/06. Functions/05. Calculate Rectangle Area.py
tdrv90/softuni-courses
ebf48083211f499050c04a237627c3a9c5367de7
[ "MIT" ]
null
null
null
06. Python Essentials/06. Functions/05. Calculate Rectangle Area.py
tdrv90/softuni-courses
ebf48083211f499050c04a237627c3a9c5367de7
[ "MIT" ]
2
2021-05-08T08:50:10.000Z
2021-05-08T08:50:53.000Z
06. Python Essentials/06. Functions/05. Calculate Rectangle Area.py
tdrv90/softuni-courses
ebf48083211f499050c04a237627c3a9c5367de7
[ "MIT" ]
null
null
null
a = int(input()) b = int(input()) def rectangle_area(a, b): return '{:.0f}'.format(a * b) print(rectangle_area(a, b))
12.6
33
0.587302
21
126
3.428571
0.52381
0.083333
0.388889
0.416667
0
0
0
0
0
0
0
0.009709
0.18254
126
9
34
14
0.68932
0
0
0
0
0
0.047619
0
0
0
0
0
0
1
0.2
false
0
0
0.2
0.4
0.2
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
5
69c99444146b57d4ce1f0083083a91171275c99e
49
py
Python
script.py
Funathon-Duvel/Chimay
c71a942627deb7ae42eb22607fbd97a75b447c9f
[ "MIT" ]
null
null
null
script.py
Funathon-Duvel/Chimay
c71a942627deb7ae42eb22607fbd97a75b447c9f
[ "MIT" ]
null
null
null
script.py
Funathon-Duvel/Chimay
c71a942627deb7ae42eb22607fbd97a75b447c9f
[ "MIT" ]
null
null
null
print("Hello world !") print("Who wants a beer?")
24.5
26
0.673469
8
49
4.125
0.875
0
0
0
0
0
0
0
0
0
0
0
0.122449
49
2
26
24.5
0.767442
0
0
0
0
0
0.6
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
38b6acebd31058341e6a6d8b075c43487cf7adaf
51
py
Python
common/exceptions.py
shapeshift-legacy/watchtower
c9cd5150f8549145f7de9b1ea820d548959350fe
[ "MIT" ]
null
null
null
common/exceptions.py
shapeshift-legacy/watchtower
c9cd5150f8549145f7de9b1ea820d548959350fe
[ "MIT" ]
null
null
null
common/exceptions.py
shapeshift-legacy/watchtower
c9cd5150f8549145f7de9b1ea820d548959350fe
[ "MIT" ]
null
null
null
class XPubNotRegisteredError(ValueError): pass
17
41
0.803922
4
51
10.25
1
0
0
0
0
0
0
0
0
0
0
0
0.137255
51
2
42
25.5
0.931818
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
38c95db70bfb0d9bb5886b6c8980e4bfe5129ea0
185
py
Python
dataset/research/__init__.py
mikhailkin/dataset
7417483fdbe2e3743af4d614cb9036fd5b1375c0
[ "Apache-2.0" ]
null
null
null
dataset/research/__init__.py
mikhailkin/dataset
7417483fdbe2e3743af4d614cb9036fd5b1375c0
[ "Apache-2.0" ]
null
null
null
dataset/research/__init__.py
mikhailkin/dataset
7417483fdbe2e3743af4d614cb9036fd5b1375c0
[ "Apache-2.0" ]
null
null
null
""" Research module. """ from .grid import KV, Grid, Option, ConfigAlias from .distributor import Worker, Distributor from .workers import PipelineWorker from .research import Research
30.833333
47
0.789189
22
185
6.636364
0.545455
0
0
0
0
0
0
0
0
0
0
0
0.12973
185
5
48
37
0.906832
0.086486
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
38d3cffa899476fed96ed352a9bccd51cd4dc909
142
py
Python
functions.py
BONK1/Python
0690539ad33bf9d626b4fd005e2207ac5bba4ec1
[ "MIT" ]
null
null
null
functions.py
BONK1/Python
0690539ad33bf9d626b4fd005e2207ac5bba4ec1
[ "MIT" ]
null
null
null
functions.py
BONK1/Python
0690539ad33bf9d626b4fd005e2207ac5bba4ec1
[ "MIT" ]
null
null
null
#Functions def userFunction(): #Putting Function print("Hello, User :)") print("Have a nice day!") #Calling Function userFunction()
15.777778
37
0.683099
16
142
6.0625
0.8125
0
0
0
0
0
0
0
0
0
0
0
0.176056
142
8
38
17.75
0.82906
0.288732
0
0
0
0
0.306122
0
0
0
0
0
0
1
0.25
true
0
0
0
0.25
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
0
1
0
5
2a2c5f397c00032f7691b851a8768c8149381338
233
py
Python
account.py
victorlomi/Password-Locker
2bba04e3afa3e70304db8fcdb27557d87bf5a50b
[ "Unlicense" ]
null
null
null
account.py
victorlomi/Password-Locker
2bba04e3afa3e70304db8fcdb27557d87bf5a50b
[ "Unlicense" ]
null
null
null
account.py
victorlomi/Password-Locker
2bba04e3afa3e70304db8fcdb27557d87bf5a50b
[ "Unlicense" ]
null
null
null
class Account: """Store login information(username and password).""" def __init__(self, username='', password=''): """Store username and password.""" self.username = username self.password = password
29.125
57
0.630901
23
233
6.217391
0.478261
0.153846
0.265734
0
0
0
0
0
0
0
0
0
0.23176
233
7
58
33.285714
0.798883
0.32618
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0.5
0
0
0.5
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
1
0
1
0
0
0
0
0
5
2a2cc900cfef92f424a3a71d1499d90fa438e6c7
116
py
Python
mitm/__init__.py
zentooo/mitm
d023955d359f9f9b7cbaf6fb84f9517d6ec285dd
[ "MIT" ]
null
null
null
mitm/__init__.py
zentooo/mitm
d023955d359f9f9b7cbaf6fb84f9517d6ec285dd
[ "MIT" ]
null
null
null
mitm/__init__.py
zentooo/mitm
d023955d359f9f9b7cbaf6fb84f9517d6ec285dd
[ "MIT" ]
null
null
null
from .gen_keys import create_self_signed_cert from .server import ManInTheMiddle from .stream import EmulatedClient
29
45
0.87069
16
116
6.0625
0.75
0
0
0
0
0
0
0
0
0
0
0
0.103448
116
3
46
38.666667
0.932692
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
aa495973d8bfe962f48d76b21dad01dc5ab3e5ed
87
py
Python
SignalLib/tests/test_instantiation.py
mchiuminatto/MVA_Crossover
9ad581231a8339229a48a65c1dc9030f87eeefd2
[ "MIT" ]
null
null
null
SignalLib/tests/test_instantiation.py
mchiuminatto/MVA_Crossover
9ad581231a8339229a48a65c1dc9030f87eeefd2
[ "MIT" ]
null
null
null
SignalLib/tests/test_instantiation.py
mchiuminatto/MVA_Crossover
9ad581231a8339229a48a65c1dc9030f87eeefd2
[ "MIT" ]
null
null
null
from SignalLib.Signal import Signal def test_instantiation(): _sig = Signal()
9.666667
35
0.712644
10
87
6
0.8
0
0
0
0
0
0
0
0
0
0
0
0.206897
87
8
36
10.875
0.869565
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
5
aa724d05deef21258010c21ab87421b159c908c2
434
py
Python
indexcreator.py
madeso/prettygood
ba09141bc61664253230d68f03b5a2de1f27ab75
[ "MIT" ]
null
null
null
indexcreator.py
madeso/prettygood
ba09141bc61664253230d68f03b5a2de1f27ab75
[ "MIT" ]
null
null
null
indexcreator.py
madeso/prettygood
ba09141bc61664253230d68f03b5a2de1f27ab75
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 class IndexCreator: def __init__(self): self._index = 0 def generate(self): r = self._index self._index += 1 return r def clear(self): self._index = 0 if __name__ == "__main__": i = IndexCreator() print(i.generate(), i.generate(), i.generate(), i.generate()) i.clear() print(i.generate(), i.generate(), i.generate(), i.generate())
21.7
65
0.564516
54
434
4.240741
0.388889
0.31441
0.305677
0.471616
0.362445
0.362445
0.362445
0.358079
0.358079
0
0
0.012739
0.276498
434
19
66
22.842105
0.716561
0.048387
0
0.285714
1
0
0.019417
0
0
0
0
0
0
1
0.214286
false
0
0
0
0.357143
0.142857
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
5
aa7a7ae1fd0734b3d565d268cff0f4337db5cb23
18
py
Python
problog/version.py
HEmile/problog
576b6fd305f72b12125111c8d4d62cf8a7bbda0f
[ "Apache-2.0" ]
189
2019-05-27T08:20:10.000Z
2022-03-28T09:29:22.000Z
problog/version.py
HEmile/problog
576b6fd305f72b12125111c8d4d62cf8a7bbda0f
[ "Apache-2.0" ]
60
2019-06-11T15:07:48.000Z
2022-03-25T02:31:23.000Z
problog/version.py
HEmile/problog
576b6fd305f72b12125111c8d4d62cf8a7bbda0f
[ "Apache-2.0" ]
33
2019-07-03T13:14:24.000Z
2022-02-20T01:07:15.000Z
version = '2.2.2'
9
17
0.555556
4
18
2.5
0.5
0.4
0
0
0
0
0
0
0
0
0
0.2
0.166667
18
1
18
18
0.466667
0
0
0
0
0
0.277778
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
aaaa9af5044444936c8f5d8b4e083ab7bb69b67c
497
py
Python
toontown/cogdominium/DistributedCogdoBattleBldg.py
TheFamiliarScoot/open-toontown
678313033174ea7d08e5c2823bd7b473701ff547
[ "BSD-3-Clause" ]
99
2019-11-02T22:25:00.000Z
2022-02-03T03:48:00.000Z
toontown/cogdominium/DistributedCogdoBattleBldg.py
TheFamiliarScoot/open-toontown
678313033174ea7d08e5c2823bd7b473701ff547
[ "BSD-3-Clause" ]
42
2019-11-03T05:31:08.000Z
2022-03-16T22:50:32.000Z
toontown/cogdominium/DistributedCogdoBattleBldg.py
TheFamiliarScoot/open-toontown
678313033174ea7d08e5c2823bd7b473701ff547
[ "BSD-3-Clause" ]
57
2019-11-03T07:47:37.000Z
2022-03-22T00:41:49.000Z
from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import TTLocalizer from toontown.battle import DistributedBattleBldg class DistributedCogdoBattleBldg(DistributedBattleBldg.DistributedBattleBldg): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCogdoBattleBldg') def __init__(self, cr): DistributedBattleBldg.DistributedBattleBldg.__init__(self, cr) def getBossBattleTaunt(self): return TTLocalizer.CogdoBattleBldgBossTaunt
38.230769
86
0.830986
39
497
10.384615
0.538462
0.059259
0.049383
0
0
0
0
0
0
0
0
0
0.114688
497
12
87
41.416667
0.920455
0
0
0
0
0
0.052314
0.052314
0
0
0
0
0
1
0.222222
false
0
0.333333
0.111111
0.888889
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
1
1
0
0
5
aab1d1591921bb31fae6fbdeecf63f2664a1844a
138
py
Python
application/notifications/__init__.py
QualiChain/qualichain_backend
cc6dbf1ae5d09e8d01cccde94326563b25d28b58
[ "MIT" ]
null
null
null
application/notifications/__init__.py
QualiChain/qualichain_backend
cc6dbf1ae5d09e8d01cccde94326563b25d28b58
[ "MIT" ]
null
null
null
application/notifications/__init__.py
QualiChain/qualichain_backend
cc6dbf1ae5d09e8d01cccde94326563b25d28b58
[ "MIT" ]
null
null
null
from flask import Blueprint notification_blueprint = Blueprint('notifications', __name__) from application.notifications import routes
19.714286
61
0.84058
14
138
7.928571
0.642857
0
0
0
0
0
0
0
0
0
0
0
0.108696
138
7
62
19.714286
0.902439
0
0
0
0
0
0.093525
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0.666667
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
1
0
5
aad9a583d2df81489b7fc65c87cf7e0f2e84249c
84
py
Python
enthought/chaco/data_view.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
3
2016-12-09T06:05:18.000Z
2018-03-01T13:00:29.000Z
enthought/chaco/data_view.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
1
2020-12-02T00:51:32.000Z
2020-12-02T08:48:55.000Z
enthought/chaco/data_view.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
null
null
null
# proxy module from __future__ import absolute_import from chaco.data_view import *
21
38
0.833333
12
84
5.333333
0.75
0
0
0
0
0
0
0
0
0
0
0
0.130952
84
3
39
28
0.876712
0.142857
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
2aa319ada38bc4e282bd19fa953baf7c041c905e
114
py
Python
pygromos/files/gromos_system/ff/serenityff/serenityff_data/__init__.py
SalomeRonja/PyGromosTools
5a17740a0ec634b8b591ef74d8a420e3fd3e38ba
[ "MIT" ]
13
2021-03-17T09:29:37.000Z
2022-01-14T20:42:16.000Z
pygromos/files/gromos_system/ff/serenityff/seremityff_data/__init__.py
SchroederB/PyGromosTools
c31c38455a849c864241a962efee9e6575f27b06
[ "MIT" ]
185
2021-03-03T14:24:55.000Z
2022-03-31T18:39:29.000Z
pygromos/files/gromos_system/ff/serenityff/seremityff_data/__init__.py
SchroederB/PyGromosTools
c31c38455a849c864241a962efee9e6575f27b06
[ "MIT" ]
13
2021-03-03T14:18:06.000Z
2022-02-17T09:48:55.000Z
import os serenityff_C6 = os.path.dirname(__file__) + "/C6/" serenityff_C12 = os.path.dirname(__file__) + "/C12/"
28.5
52
0.719298
16
114
4.5
0.5
0.166667
0.361111
0.472222
0
0
0
0
0
0
0
0.058824
0.105263
114
3
53
38
0.647059
0
0
0
0
0
0.078947
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
2ad6455f3a6a4304ffcd1d1a23ee3f48e854af19
77
py
Python
t/data/foo/path/to/dupe.py
tek/vim-pymport
ea918179d11a78a4e946afec1e8052e50ddd2ef7
[ "MIT" ]
null
null
null
t/data/foo/path/to/dupe.py
tek/vim-pymport
ea918179d11a78a4e946afec1e8052e50ddd2ef7
[ "MIT" ]
null
null
null
t/data/foo/path/to/dupe.py
tek/vim-pymport
ea918179d11a78a4e946afec1e8052e50ddd2ef7
[ "MIT" ]
null
null
null
1 == 2 segfault() class Dupe(object): pass class Dupe(Dupe): pass
7.7
19
0.597403
11
77
4.181818
0.636364
0.391304
0
0
0
0
0
0
0
0
0
0.035714
0.272727
77
9
20
8.555556
0.785714
0
0
0.333333
0
0
0
0
0
0
0
0
0
1
0
true
0.333333
0
0
0.333333
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
2d4ca8995fa535c7e788e1b224647ac4d1537d68
254
py
Python
integration-tests/fake_spineroutelookup/fake_spineroutelookup/request_matcher_wrappers.py
tomzo/integration-adaptors
d4f296d3e44475df6f69a78a27fac6ed5b67513b
[ "Apache-2.0" ]
15
2019-08-06T16:08:12.000Z
2021-05-24T13:14:39.000Z
integration-tests/fake_spineroutelookup/fake_spineroutelookup/request_matcher_wrappers.py
tomzo/integration-adaptors
d4f296d3e44475df6f69a78a27fac6ed5b67513b
[ "Apache-2.0" ]
75
2019-04-25T13:59:02.000Z
2021-09-15T06:05:36.000Z
integration-tests/fake_spineroutelookup/fake_spineroutelookup/request_matcher_wrappers.py
tomzo/integration-adaptors
d4f296d3e44475df6f69a78a27fac6ed5b67513b
[ "Apache-2.0" ]
7
2019-11-12T15:26:34.000Z
2021-04-11T07:23:56.000Z
from tornado.httputil import HTTPServerRequest def query_argument_contains_string(request: HTTPServerRequest, query_argument_name: str, containing_value: str) -> bool: return containing_value in str(request.query_arguments[query_argument_name][0])
42.333333
120
0.838583
32
254
6.34375
0.625
0.192118
0.167488
0
0
0
0
0
0
0
0
0.004329
0.090551
254
5
121
50.8
0.874459
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0.333333
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
1
1
0
0
5
2d54b28d3adfbf872b6cc0da05ef3d66511f2f1e
114
py
Python
enthought/block_canvas/canvas/selectable_component_mixin.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
3
2016-12-09T06:05:18.000Z
2018-03-01T13:00:29.000Z
enthought/block_canvas/canvas/selectable_component_mixin.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
1
2020-12-02T00:51:32.000Z
2020-12-02T08:48:55.000Z
enthought/block_canvas/canvas/selectable_component_mixin.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
null
null
null
# proxy module from __future__ import absolute_import from blockcanvas.canvas.selectable_component_mixin import *
28.5
59
0.868421
14
114
6.571429
0.785714
0
0
0
0
0
0
0
0
0
0
0
0.096491
114
3
60
38
0.893204
0.105263
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
2d82696e62628acf0f9cb283afc8b8cbd3772896
57
py
Python
src/LASER/utils/__init__.py
BigBird01/LASER
57143200814583410acdd0c5ac0a0f8bab8a1f7e
[ "MIT" ]
7
2021-02-04T01:26:55.000Z
2021-11-23T00:38:47.000Z
src/LASER/utils/__init__.py
BigBird01/LASER
57143200814583410acdd0c5ac0a0f8bab8a1f7e
[ "MIT" ]
1
2021-03-18T00:23:17.000Z
2022-01-05T15:36:48.000Z
src/LASER/utils/__init__.py
BigBird01/LASER
57143200814583410acdd0c5ac0a0f8bab8a1f7e
[ "MIT" ]
null
null
null
from .logger_util import * from .argument_types import *
19
29
0.789474
8
57
5.375
0.75
0
0
0
0
0
0
0
0
0
0
0
0.140351
57
2
30
28.5
0.877551
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
2d8a6a9732756565c7d5d7731e78660b0c754292
1,006
py
Python
Misc/070_ClimbingStairs.py
PsiPhiTheta/LeetCode
b4473d3fdf317012b6224b363306d66a33b07932
[ "Unlicense" ]
1
2018-12-09T21:09:36.000Z
2018-12-09T21:09:36.000Z
Misc/070_ClimbingStairs.py
PsiPhiTheta/LeetCode
b4473d3fdf317012b6224b363306d66a33b07932
[ "Unlicense" ]
null
null
null
Misc/070_ClimbingStairs.py
PsiPhiTheta/LeetCode
b4473d3fdf317012b6224b363306d66a33b07932
[ "Unlicense" ]
1
2018-12-09T21:09:40.000Z
2018-12-09T21:09:40.000Z
class Solution: def climbStairs(self, n): """ :type n: int :rtype: int """ if (n < 3): # Special cases # 0 = 0: # 1 = 1: 1 # 2 = 2: 2, 1 1 return n else: # Fibonaci from here onward # 3 = 3: 1 1 1, 2 1, 1 2 # 4 = 5: 1 1 1 1, 2 1 1, 1 2 1, 1 1 2, 2 2 # 5 = 8: 1 1 1 1 1, 2 1 1 1, 1 2 1 1 , 1 1 2 1, 1 1 1 2, 2 2 1, 1 2 2, 2 1 2 # 6 = 13: 1 1 1 1 1 1, 2 1 1 1 1, 1 2 1 1 1, 1 1 2 1 1, 1 1 1 2 1, 1 1 1 1 2, # Fibonaci pattern spotted as shown above... preprev = 1 # Resume from special cases prev = 2 # Resume from special cases for i in range(n-2): # omit the first two steps temp = preprev preprev = prev # update preprev for next iter prev = prev + temp # update prev for next iter return prev
33.533333
90
0.409543
172
1,006
2.395349
0.27907
0.23301
0.225728
0.165049
0.216019
0.213592
0.184466
0.184466
0.123786
0.123786
0
0.214575
0.508946
1,006
29
91
34.689655
0.619433
0.486084
0
0
0
0
0
0
0
0
0
0
0
1
0.083333
false
0
0
0
0.333333
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
1
1
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
5
2d968d094921ea943b5fe4bbace2c89232c234cc
166
py
Python
lib/datasets/__init__.py
Bhaskers-Blu-Org2/metric-transfer.pytorch
b0ae8ed6e6f62357100d799defbb61a78c831a87
[ "MIT" ]
51
2019-07-23T23:47:12.000Z
2022-03-04T13:03:25.000Z
lib/datasets/__init__.py
Bhaskers-Blu-Org2/metric-transfer.pytorch
b0ae8ed6e6f62357100d799defbb61a78c831a87
[ "MIT" ]
2
2021-01-25T08:08:17.000Z
2021-01-28T03:36:01.000Z
lib/datasets/__init__.py
chingisooinar/metric-transfer.pytorch
b0ae8ed6e6f62357100d799defbb61a78c831a87
[ "MIT" ]
19
2019-07-25T02:46:26.000Z
2021-03-07T17:35:37.000Z
from .cifar import CIFAR10Instance, PseudoCIFAR10 from .folder import ImageFolderInstance, PseudoDatasetFolder __all__ = ('CIFAR10Instance', 'PseudoDatasetFolder')
27.666667
60
0.831325
13
166
10.307692
0.692308
0
0
0
0
0
0
0
0
0
0
0.04
0.096386
166
5
61
33.2
0.853333
0
0
0
0
0
0.206061
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
2d9ccc7dcb06cccd843a7fd874715dd45ffe4119
190
py
Python
examples/example.py
PrestonStringham/DATA515-MusicGeneration
7df2ac49a0fbbaf0dd20ddcf3ae1c59e39797fc7
[ "MIT" ]
3
2021-03-01T08:10:26.000Z
2021-03-19T23:27:40.000Z
examples/example.py
PrestonStringham/DATA515-MusicGeneration
7df2ac49a0fbbaf0dd20ddcf3ae1c59e39797fc7
[ "MIT" ]
7
2021-03-11T04:54:03.000Z
2021-03-17T04:17:50.000Z
examples/example.py
PrestonStringham/DATA515-MusicGeneration
7df2ac49a0fbbaf0dd20ddcf3ae1c59e39797fc7
[ "MIT" ]
null
null
null
from easy_music_generator import easy_music_generator as emg import sys sys.path.append('../') emg_obj = emg.EasyMusicGenerator() emg_obj.analyze('music/') emg_obj.generate(10, 'output/')
21.111111
60
0.773684
28
190
5
0.571429
0.128571
0.257143
0
0
0
0
0
0
0
0
0.011561
0.089474
190
8
61
23.75
0.797688
0
0
0
1
0
0.084211
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
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
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
2dd60b7b286d9f871b38dfd08a65b205c03fa9c2
93
py
Python
app/comments/__init__.py
goalong/flask-demo
33fc1b8a72e6c67581ac949a55773ffad9ee7af7
[ "MIT" ]
45
2016-02-20T15:20:49.000Z
2022-03-03T18:07:51.000Z
app/comments/__init__.py
goalong/flask-demo
33fc1b8a72e6c67581ac949a55773ffad9ee7af7
[ "MIT" ]
null
null
null
app/comments/__init__.py
goalong/flask-demo
33fc1b8a72e6c67581ac949a55773ffad9ee7af7
[ "MIT" ]
13
2017-02-04T13:45:55.000Z
2020-07-15T07:07:56.000Z
from flask import Blueprint comment = Blueprint('comment', __name__) from . import routes
13.285714
40
0.763441
11
93
6.090909
0.636364
0.477612
0
0
0
0
0
0
0
0
0
0
0.16129
93
6
41
15.5
0.858974
0
0
0
0
0
0.076087
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0.666667
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
1
0
5
2deb6b84109b5eed26877a7aefdd86b28722b33b
56
py
Python
src/finmag/tests/bugs/segfault-paraview/nobug-2.py
davidcortesortuno/finmag
9ac0268d2c0e45faf1284cee52a73525aa589e2b
[ "BSL-1.0" ]
10
2018-03-24T07:43:17.000Z
2022-03-26T10:42:27.000Z
src/finmag/tests/bugs/segfault-paraview/nobug-2.py
davidcortesortuno/finmag
9ac0268d2c0e45faf1284cee52a73525aa589e2b
[ "BSL-1.0" ]
21
2018-03-26T15:08:53.000Z
2021-07-10T16:11:14.000Z
src/finmag/tests/bugs/segfault-paraview/nobug-2.py
davidcortesortuno/finmag
9ac0268d2c0e45faf1284cee52a73525aa589e2b
[ "BSL-1.0" ]
7
2018-04-09T11:50:48.000Z
2021-06-10T09:23:25.000Z
from paraview import servermanager import dolfin as df
14
34
0.839286
8
56
5.875
0.875
0
0
0
0
0
0
0
0
0
0
0
0.160714
56
3
35
18.666667
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
9310b0df4d6f1fe091410ca81ba2f09a4a0d53d3
25,437
py
Python
Lib/test/test_asyncio/test_locks.py
sireliah/polish-python
605df4944c2d3bc25f8bf6964b274c0a0d297cc3
[ "PSF-2.0" ]
1
2018-06-21T18:21:24.000Z
2018-06-21T18:21:24.000Z
Lib/test/test_asyncio/test_locks.py
sireliah/polish-python
605df4944c2d3bc25f8bf6964b274c0a0d297cc3
[ "PSF-2.0" ]
null
null
null
Lib/test/test_asyncio/test_locks.py
sireliah/polish-python
605df4944c2d3bc25f8bf6964b274c0a0d297cc3
[ "PSF-2.0" ]
null
null
null
"""Tests dla lock.py""" zaimportuj unittest z unittest zaimportuj mock zaimportuj re zaimportuj asyncio z asyncio zaimportuj test_utils STR_RGX_REPR = ( r'^<(?P<class>.*?) object at (?P<address>.*?)' r'\[(?P<extras>' r'(set|unset|locked|unlocked)(,value:\d)?(,waiters:\d+)?' r')\]>\Z' ) RGX_REPR = re.compile(STR_RGX_REPR) klasa LockTests(test_utils.TestCase): def setUp(self): self.loop = self.new_test_loop() def test_ctor_loop(self): loop = mock.Mock() lock = asyncio.Lock(loop=loop) self.assertIs(lock._loop, loop) lock = asyncio.Lock(loop=self.loop) self.assertIs(lock._loop, self.loop) def test_ctor_noloop(self): asyncio.set_event_loop(self.loop) lock = asyncio.Lock() self.assertIs(lock._loop, self.loop) def test_repr(self): lock = asyncio.Lock(loop=self.loop) self.assertPrawda(repr(lock).endswith('[unlocked]>')) self.assertPrawda(RGX_REPR.match(repr(lock))) @asyncio.coroutine def acquire_lock(): uzyskaj z lock self.loop.run_until_complete(acquire_lock()) self.assertPrawda(repr(lock).endswith('[locked]>')) self.assertPrawda(RGX_REPR.match(repr(lock))) def test_lock(self): lock = asyncio.Lock(loop=self.loop) @asyncio.coroutine def acquire_lock(): zwróć (uzyskaj z lock) res = self.loop.run_until_complete(acquire_lock()) self.assertPrawda(res) self.assertPrawda(lock.locked()) lock.release() self.assertNieprawda(lock.locked()) def test_acquire(self): lock = asyncio.Lock(loop=self.loop) result = [] self.assertPrawda(self.loop.run_until_complete(lock.acquire())) @asyncio.coroutine def c1(result): jeżeli (uzyskaj z lock.acquire()): result.append(1) zwróć Prawda @asyncio.coroutine def c2(result): jeżeli (uzyskaj z lock.acquire()): result.append(2) zwróć Prawda @asyncio.coroutine def c3(result): jeżeli (uzyskaj z lock.acquire()): result.append(3) zwróć Prawda t1 = asyncio.Task(c1(result), loop=self.loop) t2 = asyncio.Task(c2(result), loop=self.loop) test_utils.run_briefly(self.loop) self.assertEqual([], result) lock.release() test_utils.run_briefly(self.loop) self.assertEqual([1], result) test_utils.run_briefly(self.loop) self.assertEqual([1], result) t3 = asyncio.Task(c3(result), loop=self.loop) lock.release() test_utils.run_briefly(self.loop) self.assertEqual([1, 2], result) lock.release() test_utils.run_briefly(self.loop) self.assertEqual([1, 2, 3], result) self.assertPrawda(t1.done()) self.assertPrawda(t1.result()) self.assertPrawda(t2.done()) self.assertPrawda(t2.result()) self.assertPrawda(t3.done()) self.assertPrawda(t3.result()) def test_acquire_cancel(self): lock = asyncio.Lock(loop=self.loop) self.assertPrawda(self.loop.run_until_complete(lock.acquire())) task = asyncio.Task(lock.acquire(), loop=self.loop) self.loop.call_soon(task.cancel) self.assertRaises( asyncio.CancelledError, self.loop.run_until_complete, task) self.assertNieprawda(lock._waiters) def test_cancel_race(self): # Several tasks: # - A acquires the lock # - B jest blocked w aqcuire() # - C jest blocked w aqcuire() # # Now, concurrently: # - B jest cancelled # - A releases the lock # # If B's waiter jest marked cancelled but nie yet removed from # _waiters, A's release() call will crash when trying to set # B's waiter; instead, it should move on to C's waiter. # Setup: A has the lock, b oraz c are waiting. lock = asyncio.Lock(loop=self.loop) @asyncio.coroutine def lockit(name, blocker): uzyskaj z lock.acquire() spróbuj: jeżeli blocker jest nie Nic: uzyskaj z blocker w_końcu: lock.release() fa = asyncio.Future(loop=self.loop) ta = asyncio.Task(lockit('A', fa), loop=self.loop) test_utils.run_briefly(self.loop) self.assertPrawda(lock.locked()) tb = asyncio.Task(lockit('B', Nic), loop=self.loop) test_utils.run_briefly(self.loop) self.assertEqual(len(lock._waiters), 1) tc = asyncio.Task(lockit('C', Nic), loop=self.loop) test_utils.run_briefly(self.loop) self.assertEqual(len(lock._waiters), 2) # Create the race oraz check. # Without the fix this failed at the last assert. fa.set_result(Nic) tb.cancel() self.assertPrawda(lock._waiters[0].cancelled()) test_utils.run_briefly(self.loop) self.assertNieprawda(lock.locked()) self.assertPrawda(ta.done()) self.assertPrawda(tb.cancelled()) self.assertPrawda(tc.done()) def test_release_not_acquired(self): lock = asyncio.Lock(loop=self.loop) self.assertRaises(RuntimeError, lock.release) def test_release_no_waiters(self): lock = asyncio.Lock(loop=self.loop) self.loop.run_until_complete(lock.acquire()) self.assertPrawda(lock.locked()) lock.release() self.assertNieprawda(lock.locked()) def test_context_manager(self): lock = asyncio.Lock(loop=self.loop) @asyncio.coroutine def acquire_lock(): zwróć (uzyskaj z lock) przy self.loop.run_until_complete(acquire_lock()): self.assertPrawda(lock.locked()) self.assertNieprawda(lock.locked()) def test_context_manager_cant_reuse(self): lock = asyncio.Lock(loop=self.loop) @asyncio.coroutine def acquire_lock(): zwróć (uzyskaj z lock) # This spells "uzyskaj z lock" outside a generator. cm = self.loop.run_until_complete(acquire_lock()) przy cm: self.assertPrawda(lock.locked()) self.assertNieprawda(lock.locked()) przy self.assertRaises(AttributeError): przy cm: dalej def test_context_manager_no_uzyskaj(self): lock = asyncio.Lock(loop=self.loop) spróbuj: przy lock: self.fail('RuntimeError jest nie podnieśd w przy expression') wyjąwszy RuntimeError jako err: self.assertEqual( str(err), '"uzyskaj from" should be used jako context manager expression') self.assertNieprawda(lock.locked()) klasa EventTests(test_utils.TestCase): def setUp(self): self.loop = self.new_test_loop() def test_ctor_loop(self): loop = mock.Mock() ev = asyncio.Event(loop=loop) self.assertIs(ev._loop, loop) ev = asyncio.Event(loop=self.loop) self.assertIs(ev._loop, self.loop) def test_ctor_noloop(self): asyncio.set_event_loop(self.loop) ev = asyncio.Event() self.assertIs(ev._loop, self.loop) def test_repr(self): ev = asyncio.Event(loop=self.loop) self.assertPrawda(repr(ev).endswith('[unset]>')) match = RGX_REPR.match(repr(ev)) self.assertEqual(match.group('extras'), 'unset') ev.set() self.assertPrawda(repr(ev).endswith('[set]>')) self.assertPrawda(RGX_REPR.match(repr(ev))) ev._waiters.append(mock.Mock()) self.assertPrawda('waiters:1' w repr(ev)) self.assertPrawda(RGX_REPR.match(repr(ev))) def test_wait(self): ev = asyncio.Event(loop=self.loop) self.assertNieprawda(ev.is_set()) result = [] @asyncio.coroutine def c1(result): jeżeli (uzyskaj z ev.wait()): result.append(1) @asyncio.coroutine def c2(result): jeżeli (uzyskaj z ev.wait()): result.append(2) @asyncio.coroutine def c3(result): jeżeli (uzyskaj z ev.wait()): result.append(3) t1 = asyncio.Task(c1(result), loop=self.loop) t2 = asyncio.Task(c2(result), loop=self.loop) test_utils.run_briefly(self.loop) self.assertEqual([], result) t3 = asyncio.Task(c3(result), loop=self.loop) ev.set() test_utils.run_briefly(self.loop) self.assertEqual([3, 1, 2], result) self.assertPrawda(t1.done()) self.assertIsNic(t1.result()) self.assertPrawda(t2.done()) self.assertIsNic(t2.result()) self.assertPrawda(t3.done()) self.assertIsNic(t3.result()) def test_wait_on_set(self): ev = asyncio.Event(loop=self.loop) ev.set() res = self.loop.run_until_complete(ev.wait()) self.assertPrawda(res) def test_wait_cancel(self): ev = asyncio.Event(loop=self.loop) wait = asyncio.Task(ev.wait(), loop=self.loop) self.loop.call_soon(wait.cancel) self.assertRaises( asyncio.CancelledError, self.loop.run_until_complete, wait) self.assertNieprawda(ev._waiters) def test_clear(self): ev = asyncio.Event(loop=self.loop) self.assertNieprawda(ev.is_set()) ev.set() self.assertPrawda(ev.is_set()) ev.clear() self.assertNieprawda(ev.is_set()) def test_clear_with_waiters(self): ev = asyncio.Event(loop=self.loop) result = [] @asyncio.coroutine def c1(result): jeżeli (uzyskaj z ev.wait()): result.append(1) zwróć Prawda t = asyncio.Task(c1(result), loop=self.loop) test_utils.run_briefly(self.loop) self.assertEqual([], result) ev.set() ev.clear() self.assertNieprawda(ev.is_set()) ev.set() ev.set() self.assertEqual(1, len(ev._waiters)) test_utils.run_briefly(self.loop) self.assertEqual([1], result) self.assertEqual(0, len(ev._waiters)) self.assertPrawda(t.done()) self.assertPrawda(t.result()) klasa ConditionTests(test_utils.TestCase): def setUp(self): self.loop = self.new_test_loop() def test_ctor_loop(self): loop = mock.Mock() cond = asyncio.Condition(loop=loop) self.assertIs(cond._loop, loop) cond = asyncio.Condition(loop=self.loop) self.assertIs(cond._loop, self.loop) def test_ctor_noloop(self): asyncio.set_event_loop(self.loop) cond = asyncio.Condition() self.assertIs(cond._loop, self.loop) def test_wait(self): cond = asyncio.Condition(loop=self.loop) result = [] @asyncio.coroutine def c1(result): uzyskaj z cond.acquire() jeżeli (uzyskaj z cond.wait()): result.append(1) zwróć Prawda @asyncio.coroutine def c2(result): uzyskaj z cond.acquire() jeżeli (uzyskaj z cond.wait()): result.append(2) zwróć Prawda @asyncio.coroutine def c3(result): uzyskaj z cond.acquire() jeżeli (uzyskaj z cond.wait()): result.append(3) zwróć Prawda t1 = asyncio.Task(c1(result), loop=self.loop) t2 = asyncio.Task(c2(result), loop=self.loop) t3 = asyncio.Task(c3(result), loop=self.loop) test_utils.run_briefly(self.loop) self.assertEqual([], result) self.assertNieprawda(cond.locked()) self.assertPrawda(self.loop.run_until_complete(cond.acquire())) cond.notify() test_utils.run_briefly(self.loop) self.assertEqual([], result) self.assertPrawda(cond.locked()) cond.release() test_utils.run_briefly(self.loop) self.assertEqual([1], result) self.assertPrawda(cond.locked()) cond.notify(2) test_utils.run_briefly(self.loop) self.assertEqual([1], result) self.assertPrawda(cond.locked()) cond.release() test_utils.run_briefly(self.loop) self.assertEqual([1, 2], result) self.assertPrawda(cond.locked()) cond.release() test_utils.run_briefly(self.loop) self.assertEqual([1, 2, 3], result) self.assertPrawda(cond.locked()) self.assertPrawda(t1.done()) self.assertPrawda(t1.result()) self.assertPrawda(t2.done()) self.assertPrawda(t2.result()) self.assertPrawda(t3.done()) self.assertPrawda(t3.result()) def test_wait_cancel(self): cond = asyncio.Condition(loop=self.loop) self.loop.run_until_complete(cond.acquire()) wait = asyncio.Task(cond.wait(), loop=self.loop) self.loop.call_soon(wait.cancel) self.assertRaises( asyncio.CancelledError, self.loop.run_until_complete, wait) self.assertNieprawda(cond._waiters) self.assertPrawda(cond.locked()) def test_wait_unacquired(self): cond = asyncio.Condition(loop=self.loop) self.assertRaises( RuntimeError, self.loop.run_until_complete, cond.wait()) def test_wait_for(self): cond = asyncio.Condition(loop=self.loop) presult = Nieprawda def predicate(): zwróć presult result = [] @asyncio.coroutine def c1(result): uzyskaj z cond.acquire() jeżeli (uzyskaj z cond.wait_for(predicate)): result.append(1) cond.release() zwróć Prawda t = asyncio.Task(c1(result), loop=self.loop) test_utils.run_briefly(self.loop) self.assertEqual([], result) self.loop.run_until_complete(cond.acquire()) cond.notify() cond.release() test_utils.run_briefly(self.loop) self.assertEqual([], result) presult = Prawda self.loop.run_until_complete(cond.acquire()) cond.notify() cond.release() test_utils.run_briefly(self.loop) self.assertEqual([1], result) self.assertPrawda(t.done()) self.assertPrawda(t.result()) def test_wait_for_unacquired(self): cond = asyncio.Condition(loop=self.loop) # predicate can zwróć true immediately res = self.loop.run_until_complete(cond.wait_for(lambda: [1, 2, 3])) self.assertEqual([1, 2, 3], res) self.assertRaises( RuntimeError, self.loop.run_until_complete, cond.wait_for(lambda: Nieprawda)) def test_notify(self): cond = asyncio.Condition(loop=self.loop) result = [] @asyncio.coroutine def c1(result): uzyskaj z cond.acquire() jeżeli (uzyskaj z cond.wait()): result.append(1) cond.release() zwróć Prawda @asyncio.coroutine def c2(result): uzyskaj z cond.acquire() jeżeli (uzyskaj z cond.wait()): result.append(2) cond.release() zwróć Prawda @asyncio.coroutine def c3(result): uzyskaj z cond.acquire() jeżeli (uzyskaj z cond.wait()): result.append(3) cond.release() zwróć Prawda t1 = asyncio.Task(c1(result), loop=self.loop) t2 = asyncio.Task(c2(result), loop=self.loop) t3 = asyncio.Task(c3(result), loop=self.loop) test_utils.run_briefly(self.loop) self.assertEqual([], result) self.loop.run_until_complete(cond.acquire()) cond.notify(1) cond.release() test_utils.run_briefly(self.loop) self.assertEqual([1], result) self.loop.run_until_complete(cond.acquire()) cond.notify(1) cond.notify(2048) cond.release() test_utils.run_briefly(self.loop) self.assertEqual([1, 2, 3], result) self.assertPrawda(t1.done()) self.assertPrawda(t1.result()) self.assertPrawda(t2.done()) self.assertPrawda(t2.result()) self.assertPrawda(t3.done()) self.assertPrawda(t3.result()) def test_notify_all(self): cond = asyncio.Condition(loop=self.loop) result = [] @asyncio.coroutine def c1(result): uzyskaj z cond.acquire() jeżeli (uzyskaj z cond.wait()): result.append(1) cond.release() zwróć Prawda @asyncio.coroutine def c2(result): uzyskaj z cond.acquire() jeżeli (uzyskaj z cond.wait()): result.append(2) cond.release() zwróć Prawda t1 = asyncio.Task(c1(result), loop=self.loop) t2 = asyncio.Task(c2(result), loop=self.loop) test_utils.run_briefly(self.loop) self.assertEqual([], result) self.loop.run_until_complete(cond.acquire()) cond.notify_all() cond.release() test_utils.run_briefly(self.loop) self.assertEqual([1, 2], result) self.assertPrawda(t1.done()) self.assertPrawda(t1.result()) self.assertPrawda(t2.done()) self.assertPrawda(t2.result()) def test_notify_unacquired(self): cond = asyncio.Condition(loop=self.loop) self.assertRaises(RuntimeError, cond.notify) def test_notify_all_unacquired(self): cond = asyncio.Condition(loop=self.loop) self.assertRaises(RuntimeError, cond.notify_all) def test_repr(self): cond = asyncio.Condition(loop=self.loop) self.assertPrawda('unlocked' w repr(cond)) self.assertPrawda(RGX_REPR.match(repr(cond))) self.loop.run_until_complete(cond.acquire()) self.assertPrawda('locked' w repr(cond)) cond._waiters.append(mock.Mock()) self.assertPrawda('waiters:1' w repr(cond)) self.assertPrawda(RGX_REPR.match(repr(cond))) cond._waiters.append(mock.Mock()) self.assertPrawda('waiters:2' w repr(cond)) self.assertPrawda(RGX_REPR.match(repr(cond))) def test_context_manager(self): cond = asyncio.Condition(loop=self.loop) @asyncio.coroutine def acquire_cond(): zwróć (uzyskaj z cond) przy self.loop.run_until_complete(acquire_cond()): self.assertPrawda(cond.locked()) self.assertNieprawda(cond.locked()) def test_context_manager_no_uzyskaj(self): cond = asyncio.Condition(loop=self.loop) spróbuj: przy cond: self.fail('RuntimeError jest nie podnieśd w przy expression') wyjąwszy RuntimeError jako err: self.assertEqual( str(err), '"uzyskaj from" should be used jako context manager expression') self.assertNieprawda(cond.locked()) def test_explicit_lock(self): lock = asyncio.Lock(loop=self.loop) cond = asyncio.Condition(lock, loop=self.loop) self.assertIs(cond._lock, lock) self.assertIs(cond._loop, lock._loop) def test_ambiguous_loops(self): loop = self.new_test_loop() self.addCleanup(loop.close) lock = asyncio.Lock(loop=self.loop) przy self.assertRaises(ValueError): asyncio.Condition(lock, loop=loop) klasa SemaphoreTests(test_utils.TestCase): def setUp(self): self.loop = self.new_test_loop() def test_ctor_loop(self): loop = mock.Mock() sem = asyncio.Semaphore(loop=loop) self.assertIs(sem._loop, loop) sem = asyncio.Semaphore(loop=self.loop) self.assertIs(sem._loop, self.loop) def test_ctor_noloop(self): asyncio.set_event_loop(self.loop) sem = asyncio.Semaphore() self.assertIs(sem._loop, self.loop) def test_initial_value_zero(self): sem = asyncio.Semaphore(0, loop=self.loop) self.assertPrawda(sem.locked()) def test_repr(self): sem = asyncio.Semaphore(loop=self.loop) self.assertPrawda(repr(sem).endswith('[unlocked,value:1]>')) self.assertPrawda(RGX_REPR.match(repr(sem))) self.loop.run_until_complete(sem.acquire()) self.assertPrawda(repr(sem).endswith('[locked]>')) self.assertPrawda('waiters' nie w repr(sem)) self.assertPrawda(RGX_REPR.match(repr(sem))) sem._waiters.append(mock.Mock()) self.assertPrawda('waiters:1' w repr(sem)) self.assertPrawda(RGX_REPR.match(repr(sem))) sem._waiters.append(mock.Mock()) self.assertPrawda('waiters:2' w repr(sem)) self.assertPrawda(RGX_REPR.match(repr(sem))) def test_semaphore(self): sem = asyncio.Semaphore(loop=self.loop) self.assertEqual(1, sem._value) @asyncio.coroutine def acquire_lock(): zwróć (uzyskaj z sem) res = self.loop.run_until_complete(acquire_lock()) self.assertPrawda(res) self.assertPrawda(sem.locked()) self.assertEqual(0, sem._value) sem.release() self.assertNieprawda(sem.locked()) self.assertEqual(1, sem._value) def test_semaphore_value(self): self.assertRaises(ValueError, asyncio.Semaphore, -1) def test_acquire(self): sem = asyncio.Semaphore(3, loop=self.loop) result = [] self.assertPrawda(self.loop.run_until_complete(sem.acquire())) self.assertPrawda(self.loop.run_until_complete(sem.acquire())) self.assertNieprawda(sem.locked()) @asyncio.coroutine def c1(result): uzyskaj z sem.acquire() result.append(1) zwróć Prawda @asyncio.coroutine def c2(result): uzyskaj z sem.acquire() result.append(2) zwróć Prawda @asyncio.coroutine def c3(result): uzyskaj z sem.acquire() result.append(3) zwróć Prawda @asyncio.coroutine def c4(result): uzyskaj z sem.acquire() result.append(4) zwróć Prawda t1 = asyncio.Task(c1(result), loop=self.loop) t2 = asyncio.Task(c2(result), loop=self.loop) t3 = asyncio.Task(c3(result), loop=self.loop) test_utils.run_briefly(self.loop) self.assertEqual([1], result) self.assertPrawda(sem.locked()) self.assertEqual(2, len(sem._waiters)) self.assertEqual(0, sem._value) t4 = asyncio.Task(c4(result), loop=self.loop) sem.release() sem.release() self.assertEqual(2, sem._value) test_utils.run_briefly(self.loop) self.assertEqual(0, sem._value) self.assertEqual([1, 2, 3], result) self.assertPrawda(sem.locked()) self.assertEqual(1, len(sem._waiters)) self.assertEqual(0, sem._value) self.assertPrawda(t1.done()) self.assertPrawda(t1.result()) self.assertPrawda(t2.done()) self.assertPrawda(t2.result()) self.assertPrawda(t3.done()) self.assertPrawda(t3.result()) self.assertNieprawda(t4.done()) # cleanup locked semaphore sem.release() self.loop.run_until_complete(t4) def test_acquire_cancel(self): sem = asyncio.Semaphore(loop=self.loop) self.loop.run_until_complete(sem.acquire()) acquire = asyncio.Task(sem.acquire(), loop=self.loop) self.loop.call_soon(acquire.cancel) self.assertRaises( asyncio.CancelledError, self.loop.run_until_complete, acquire) self.assertNieprawda(sem._waiters) def test_release_not_acquired(self): sem = asyncio.BoundedSemaphore(loop=self.loop) self.assertRaises(ValueError, sem.release) def test_release_no_waiters(self): sem = asyncio.Semaphore(loop=self.loop) self.loop.run_until_complete(sem.acquire()) self.assertPrawda(sem.locked()) sem.release() self.assertNieprawda(sem.locked()) def test_context_manager(self): sem = asyncio.Semaphore(2, loop=self.loop) @asyncio.coroutine def acquire_lock(): zwróć (uzyskaj z sem) przy self.loop.run_until_complete(acquire_lock()): self.assertNieprawda(sem.locked()) self.assertEqual(1, sem._value) przy self.loop.run_until_complete(acquire_lock()): self.assertPrawda(sem.locked()) self.assertEqual(2, sem._value) def test_context_manager_no_uzyskaj(self): sem = asyncio.Semaphore(2, loop=self.loop) spróbuj: przy sem: self.fail('RuntimeError jest nie podnieśd w przy expression') wyjąwszy RuntimeError jako err: self.assertEqual( str(err), '"uzyskaj from" should be used jako context manager expression') self.assertEqual(2, sem._value) jeżeli __name__ == '__main__': unittest.main()
29.61234
80
0.598144
2,983
25,437
4.984579
0.067382
0.085547
0.077477
0.03551
0.82023
0.778062
0.748941
0.670926
0.575022
0.529693
0
0.010071
0.281716
25,437
858
81
29.646853
0.803733
0.022054
0
0.765258
0
0
0.023879
0.002174
0
0
0
0
0.295775
0
null
null
0
0.007825
null
null
0
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
5
93123e69b288f86f7308743793733a125212b780
10,933
py
Python
experiments/models/topics_torch_models.py
nibydlo/modAL
c0fe0200001c8c34e3fabb099fb70cf1e4bfb680
[ "MIT" ]
2
2020-01-22T14:34:01.000Z
2020-01-22T14:51:18.000Z
experiments/models/topics_torch_models.py
nibydlo/modAL
c0fe0200001c8c34e3fabb099fb70cf1e4bfb680
[ "MIT" ]
null
null
null
experiments/models/topics_torch_models.py
nibydlo/modAL
c0fe0200001c8c34e3fabb099fb70cf1e4bfb680
[ "MIT" ]
null
null
null
import torch import torch.nn as nn import torch.nn.functional as F IMG_LEN = 1024 TXT_LEN = 300 N_CLASSES = 50 class NormModel(nn.Module): def __init__(self, drop=0.25, d=128): super().__init__() self.fc_img_1 = nn.Linear(IMG_LEN, 4 * d) self.fc_img_2 = nn.Linear(4 * d, 2 * d) self.fc_txt_1 = nn.Linear(TXT_LEN, 2 * d) self.fc_txt_2 = nn.Linear(2 * d, 2 * d) self.fc1 = nn.Linear(4 * d, d) self.fc2 = nn.Linear(d, d) self.out = nn.Linear(d, N_CLASSES) self.dropout = nn.modules.Dropout(p=drop) def forward(self, inp_img, inp_txt): x_img = F.relu(self.fc_img_1(inp_img)) x_img = self.dropout(x_img) x_img = F.relu(self.fc_img_2(x_img)) x_img = self.dropout(x_img) x_txt = F.relu(self.fc_txt_1(inp_txt)) x_txt = self.dropout(x_txt) x_txt = F.relu(self.fc_txt_2(x_txt)) x_txt = self.dropout(x_txt) x = torch.cat((x_img, x_txt), 1) x = F.relu(self.fc1(x)) x = self.dropout(x) x = F.relu(self.fc2(x)) x = F.log_softmax(self.out(x), dim=1) return x class NormModelBN(nn.Module): def __init__(self, drop=0.5, d=128): super().__init__() self.fc_img_1 = nn.Linear(IMG_LEN, 4 * d) self.bn_img_1 = nn.BatchNorm1d(num_features=4 * d) self.fc_img_2 = nn.Linear(4 * d, 2 * d) self.bn_img_2 = nn.BatchNorm1d(num_features=2 * d) self.fc_txt_1 = nn.Linear(TXT_LEN, 2 * d) self.bn_txt_1 = nn.BatchNorm1d(num_features=2 * d) self.fc_txt_2 = nn.Linear(2 * d, 2 * d) self.bn_txt_2 = nn.BatchNorm1d(num_features=2 * d) self.fc_1 = nn.Linear(4 * d, d) self.bn_1 = nn.BatchNorm1d(num_features=d) self.fc_2 = nn.Linear(d, d) self.bn_2 = nn.BatchNorm1d(num_features=d) self.out = nn.Linear(d, N_CLASSES) self.dropout = nn.modules.Dropout(p=drop) def forward(self, inp_img, inp_txt): x_img = self.dropout(self.bn_img_1(F.relu(self.fc_img_1(inp_img)))) x_img = self.dropout(self.bn_img_2(F.relu(self.fc_img_2(x_img)))) x_txt = self.dropout(self.bn_txt_1(F.relu(self.fc_txt_1(inp_txt)))) x_txt = self.dropout(self.bn_txt_2(F.relu(self.fc_txt_2(x_txt)))) x = torch.cat((x_img, x_txt), 1) x = self.dropout(self.bn_1(F.relu(self.fc_1(x)))) x = self.bn_2(F.relu(self.fc_2(x))) x = F.log_softmax(self.out(x), dim=1) return x class NormModelTrident(nn.Module): def __init__(self, d=128, drop=0.25, residual=False): super().__init__() self.residual = residual self.fc_img_1 = nn.Linear(IMG_LEN, d * 4) self.fc_img_2 = nn.Linear(d * 4, d * 2) self.fc_txt_1 = nn.Linear(TXT_LEN, d * 2) self.fc_txt_2 = nn.Linear(d * 2, d * 2) self.fc1 = nn.Linear(d * 4, d if not residual else d * 2) self.fc2 = nn.Linear(d if not residual else d * 6, d) self.out = nn.Linear(d, N_CLASSES) self.out_img = nn.Linear(d * 2, N_CLASSES) self.out_txt = nn.Linear(d * 2, N_CLASSES) self.dropout = nn.modules.Dropout(p=drop) def forward(self, inp_img, inp_txt): x_img = F.relu(self.fc_img_1(inp_img)) x_img = self.dropout(x_img) x_img = F.relu(self.fc_img_2(x_img)) x_img = self.dropout(x_img) x_txt = F.relu(self.fc_txt_1(inp_txt)) x_txt = self.dropout(x_txt) x_txt = F.relu(self.fc_txt_2(x_txt)) x_txt = self.dropout(x_txt) x = torch.cat((x_img, x_txt), 1) x = F.relu(self.fc1(x)) x = self.dropout(x) x = F.relu(self.fc2(x if not self.residual else torch.cat((x_img, x_txt, x), 1))) out = F.log_softmax(self.out(x), dim=1) out_img = F.log_softmax(self.out_img(x_img), dim=1) out_txt = F.log_softmax(self.out_txt(x_txt), dim=1) return out, out_img, out_txt class NormModelTridentBN(nn.Module): def __init__(self, d=128, drop=0.25): super().__init__() self.fc_img_1 = nn.Linear(IMG_LEN, d * 4) self.bn_img_1 = nn.BatchNorm1d(num_features=d * 4) self.fc_img_2 = nn.Linear(d * 4, d * 2) self.bn_img_2 = nn.BatchNorm1d(num_features=d * 2) self.fc_txt_1 = nn.Linear(TXT_LEN, d * 2) self.bn_txt_1 = nn.BatchNorm1d(num_features=d * 2) self.fc_txt_2 = nn.Linear(d * 2, d * 2) self.bn_txt_2 = nn.BatchNorm1d(num_features=d * 2) self.fc1 = nn.Linear(d * 4, d) self.bn1 = nn.BatchNorm1d(num_features=d) self.fc2 = nn.Linear(d, d) self.bn2 = nn.BatchNorm1d(num_features=d) self.out = nn.Linear(d, N_CLASSES) self.out_img = nn.Linear(d * 2, N_CLASSES) self.out_txt = nn.Linear(d * 2, N_CLASSES) self.dropout = nn.modules.Dropout(p=drop) def forward(self, inp_img, inp_txt): x_img = self.dropout(self.bn_img_1(F.relu(self.fc_img_1(inp_img)))) x_img = self.dropout(self.bn_img_2(F.relu(self.fc_img_2(x_img)))) x_txt = self.dropout(self.bn_txt_1(F.relu(self.fc_txt_1(inp_txt)))) x_txt = self.dropout(self.bn_txt_2(F.relu(self.fc_txt_2(x_txt)))) x = torch.cat((x_img, x_txt), 1) x = self.dropout(self.bn1(F.relu(self.fc1(x)))) x = self.bn2(F.relu(self.fc2(x))) out = F.log_softmax(self.out(x), dim=1) out_img = F.log_softmax(self.out_img(x_img), dim=1) out_txt = F.log_softmax(self.out_txt(x_txt), dim=1) return out, out_img, out_txt class SelfAttentionModel1(nn.Module): def __init__(self): super().__init__() self.d = 256 self.fc_img = nn.Linear(IMG_LEN, 128) self.fc_txt = nn.Linear(TXT_LEN, 128) self.fc_v = nn.Linear(self.d, self.d) self.fc_k = nn.Linear(self.d, self.d) self.fc_q = nn.Linear(self.d, self.d) self.fc_1 = nn.Linear(self.d, self.d) self.fc_2 = nn.Linear(self.d, self.d) self.out = nn.Linear(256, N_CLASSES) self.dropout = nn.modules.Dropout(p=0.25) def forward(self, inp_img, inp_txt): m = inp_img.shape[0] x_img = F.relu(self.fc_img(inp_img)) x_img = self.dropout(x_img) x_txt = F.relu(self.fc_txt(inp_txt)) x_txt = self.dropout(x_txt) x = torch.cat((x_img, x_txt), dim=1) v = self.fc_v(x) k = self.fc_k(x) q = self.fc_q(x) x_qk = torch.mm(q, torch.t(k)) / self.d ** (1./2) a = torch.nn.Softmax(dim=0)(torch.flatten(x_qk)).view(m, m) f = torch.mm(a, v) x = F.relu(self.fc_1(f)) x = self.dropout(x) x = F.relu(self.fc_2(f)) x = F.log_softmax(self.out(x), dim=1) return x class GSAHelper(nn.Module): def __init__(self, d): super().__init__() self.d = d self.fc_k = nn.Linear(self.d, self.d) self.fc_q = nn.Linear(self.d, self.d) self.fc_kq = nn.Linear(self.d, self.d) def forward(self, k, q): m = k.shape[0] k_1 = self.fc_k(k) q_1 = self.fc_q(q) kq = nn.Sigmoid()(self.fc_kq(torch.mul(k_1, q_1))) k_2 = torch.mul(k, kq) q_2 = torch.mul(q, kq) mul = torch.mm(k_2, torch.t(q_2)) / self.d ** (1. / 2) a = nn.Softmax()(torch.flatten(mul)).view(m, m) return a class GSA(nn.Module): def __init__(self, d): super().__init__() self.d = d self.fc_v = nn.Linear(self.d, self.d) self.fc_k = nn.Linear(self.d, self.d) self.fc_q = nn.Linear(self.d, self.d) self.gsa_helper = GSAHelper(self.d) def forward(self, x): m = x.shape[0] v = self.fc_v(x) k = self.fc_k(x) q = self.fc_q(x) a = self.gsa_helper(k, q) f = torch.mm(a, v) return f class FFN(nn.Module): def __init__(self, d): super().__init__() self.fc_1 = nn.Linear(2 * d, 4 * d) self.drop = nn.Dropout(0.1) self.fc_2 = nn.Linear(4 * d, d) def forward(self, x_1, x_2): x = self.fc_1(torch.cat((x_1, x_2), 1)) x = F.relu(x) x = self.drop(x) x = self.fc_2(x) return x class UAModel1(nn.Module): def __init__(self, d=256): super().__init__() self.fc_img = nn.Linear(IMG_LEN, d // 2) self.fc_txt = nn.Linear(TXT_LEN, d // 2) self.d = d self.gsa_1 = GSA(d) self.ffn_1 = FFN(d) self.fc_out = nn.Linear(d, N_CLASSES) def forward(self, inp_img, inp_txt): x_img = self.fc_img(inp_img) x_txt = self.fc_txt(inp_txt) z = torch.cat((x_img, x_txt), 1) x = self.ffn_1(z, self.gsa_1(z)) out = F.log_softmax(self.fc_out(x)) return out class UAModel2(nn.Module): def __init__(self, d=32): super().__init__() self.fc_img = nn.Linear(IMG_LEN, d // 2) self.fc_txt = nn.Linear(TXT_LEN, d // 2) self.d = d self.gsa_1 = GSA(d) self.ffn_1 = FFN(d) self.gsa_2 = GSA(d) self.ffn_2 = FFN(d) self.fc_out = nn.Linear(d, N_CLASSES) def forward(self, inp_img, inp_txt): x_img = self.fc_img(inp_img) x_txt = self.fc_txt(inp_txt) z = torch.cat((x_img, x_txt), 1) x = self.ffn_1(z, self.gsa_1(z)) x = self.ffn_2(x, self.gsa_2(x)) out = F.log_softmax(self.fc_out(x)) return out class TrivialModel(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(IMG_LEN + TXT_LEN, 64) self.dropout = nn.modules.Dropout(p=0.25) self.fc2 = nn.Linear(64, N_CLASSES) def forward(self, inp_img, inp_txt): x = torch.cat((inp_img, inp_txt), 1) x = F.relu(self.fc1(x)) x = self.dropout(x) x = F.log_softmax(self.fc2(x), dim=1) return x class Encoder(nn.Module): def __init__(self, d): super().__init__() self.fc_img = nn.Linear(IMG_LEN, d) self.fc_txt = nn.Linear(TXT_LEN, d) self.fc = nn.Linear(2 * d, 2 * d) def forward(self, inp_img, inp_txt): x_img = self.fc_img(inp_img) x_txt = self.fc_txt(inp_txt) x = torch.cat((x_img, x_txt), 1) x = F.relu(self.fc(x)) return x class Decoder(nn.Module): def __init__(self, d): super().__init__() self.fc_img = nn.Linear(2 * d, IMG_LEN) self.fc_txt = nn.Linear(2 * d, TXT_LEN) def forward(self, x): x_img = self.fc_img(x) x_txt = self.fc_txt(x) return x_img, x_txt class Autoencoder(nn.Module): def __init__(self, d): super().__init__() self.encoder = Encoder(d) self.decoder = Decoder(d) def forward(self, inp_img, inp_txt): x = self.encoder(inp_img, inp_txt) x_img, x_txt = self.decoder(x) return x_img, x_txt
28.177835
89
0.569286
1,930
10,933
2.969948
0.04715
0.092114
0.047104
0.044138
0.841068
0.795883
0.744417
0.713364
0.650209
0.609735
0
0.033799
0.280161
10,933
387
90
28.250646
0.694536
0
0
0.609489
0
0
0
0
0
0
0
0
0
1
0.10219
false
0
0.010949
0
0.215328
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
9340bce75a7f4107a245a51d561e85d1f0a4de59
50
py
Python
custom_model_runner/datarobot_drum/__init__.py
andreakropp/datarobot-user-models
423ab8c703a545491ad6013a0b7efa3119e2c0fc
[ "Apache-2.0" ]
null
null
null
custom_model_runner/datarobot_drum/__init__.py
andreakropp/datarobot-user-models
423ab8c703a545491ad6013a0b7efa3119e2c0fc
[ "Apache-2.0" ]
9
2021-11-10T20:16:41.000Z
2022-03-12T00:59:05.000Z
custom_model_runner/datarobot_drum/__init__.py
andreakropp/datarobot-user-models
423ab8c703a545491ad6013a0b7efa3119e2c0fc
[ "Apache-2.0" ]
1
2021-06-17T22:05:33.000Z
2021-06-17T22:05:33.000Z
from .drum.custom_fit_wrapper import drum_autofit
25
49
0.88
8
50
5.125
0.875
0
0
0
0
0
0
0
0
0
0
0
0.08
50
1
50
50
0.891304
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
937f1b097cc1a7f239fff12e2a5199c53217239c
5,478
py
Python
repro_eval/measure/document_order.py
irgroup/repro_eval
35a4cf083dbb5f4b29d6ef602a604f0686a537c9
[ "MIT" ]
8
2020-10-27T02:11:53.000Z
2022-03-02T11:00:10.000Z
repro_eval/measure/document_order.py
irgroup/repro_eval
35a4cf083dbb5f4b29d6ef602a604f0686a537c9
[ "MIT" ]
2
2021-01-25T19:59:39.000Z
2021-12-07T09:29:01.000Z
repro_eval/measure/document_order.py
irgroup/repro_eval
35a4cf083dbb5f4b29d6ef602a604f0686a537c9
[ "MIT" ]
1
2021-04-16T16:21:16.000Z
2021-04-16T16:21:16.000Z
"""Evaluation measures at the level of document orderings.""" from repro_eval.config import TRIM_THRESH, PHI from scipy.stats.stats import kendalltau from tqdm import tqdm from repro_eval.measure.external.rbo import rbo from repro_eval.util import break_ties def _rbo(run, ideal, p, depth): # Implementation taken from the TREC Health Misinformation Track with modifications # see also: https://github.com/claclark/Compatibility run_set = set() ideal_set = set() score = 0.0 normalizer = 0.0 weight = 1.0 for i in range(depth): if i < len(run): run_set.add(run[i]) if i < len(ideal): ideal_set.add(ideal[i]) score += weight*len(ideal_set.intersection(run_set))/(i + 1) normalizer += weight weight *= p return score/normalizer def _ktau_union(orig_run, rep_run, trim_thresh=TRIM_THRESH, pbar=False): """ Helping function returning a generator to determine Kendall's tau Union (KTU) for all topics. @param orig_run: The original run. @param rep_run: The reproduced/replicated run. @param trim_thresh: Threshold values for the number of documents to be compared. @param pbar: Boolean value indicating if progress bar should be printed. @return: Generator with KTU values. """ generator = tqdm(rep_run.items()) if pbar else rep_run.items() for topic, docs in generator: orig_docs = list(orig_run.get(topic).keys())[:trim_thresh] rep_docs = list(rep_run.get(topic).keys())[:trim_thresh] union = list(sorted(set(orig_docs + rep_docs))) orig_idx = [union.index(doc) for doc in orig_docs] rep_idx = [union.index(doc) for doc in rep_docs] yield topic, round(kendalltau(orig_idx, rep_idx).correlation, 14) def ktau_union(orig_run, rep_run, trim_thresh=TRIM_THRESH, pbar=False): """ Determines the Kendall's tau Union (KTU) between the original and reproduced document orderings according to the following paper: Timo Breuer, Nicola Ferro, Norbert Fuhr, Maria Maistro, Tetsuya Sakai, Philipp Schaer, Ian Soboroff. How to Measure the Reproducibility of System-oriented IR Experiments. Proceedings of SIGIR, pages 349-358, 2020. @param orig_run: The original run. @param rep_run: The reproduced/replicated run. @param trim_thresh: Threshold values for the number of documents to be compared. @param pbar: Boolean value indicating if progress bar should be printed. @return: Dictionary with KTU values that compare the document orderings of the original and reproduced runs. """ # Safety check for runs that are not added via pytrec_eval orig_run = break_ties(orig_run) rep_run = break_ties(rep_run) return dict(_ktau_union(orig_run, rep_run, trim_thresh=trim_thresh, pbar=pbar)) def _RBO(orig_run, rep_run, phi, trim_thresh=TRIM_THRESH, pbar=False, misinfo=True): """ Helping function returning a generator to determine the Rank-Biased Overlap (RBO) for all topics. @param orig_run: The original run. @param rep_run: The reproduced/replicated run. @param phi: Parameter for top-heaviness of the RBO. @param trim_thresh: Threshold values for the number of documents to be compared. @param pbar: Boolean value indicating if progress bar should be printed. @param misinfo: Use the RBO implementation that is also used in the TREC Health Misinformation Track. See also: https://github.com/claclark/Compatibility @return: Generator with RBO values. """ generator = tqdm(rep_run.items()) if pbar else rep_run.items() if misinfo: for topic, docs in generator: yield topic, _rbo(list(rep_run.get(topic).keys())[:trim_thresh], list(orig_run.get(topic).keys())[:trim_thresh], p=phi, depth=trim_thresh) else: for topic, docs in generator: yield topic, rbo(list(rep_run.get(topic).keys())[:trim_thresh], list(orig_run.get(topic).keys())[:trim_thresh], p=phi).ext def RBO(orig_run, rep_run, phi=PHI, trim_thresh=TRIM_THRESH, pbar=False, misinfo=True): """ Determines the Rank-Biased Overlap (RBO) between the original and reproduced document orderings according to the following paper: Timo Breuer, Nicola Ferro, Norbert Fuhr, Maria Maistro, Tetsuya Sakai, Philipp Schaer, Ian Soboroff. How to Measure the Reproducibility of System-oriented IR Experiments. Proceedings of SIGIR, pages 349-358, 2020. @param orig_run: The original run. @param rep_run: The reproduced/replicated run. @param phi: Parameter for top-heaviness of the RBO. @param trim_thresh: Threshold values for the number of documents to be compared. @param pbar: Boolean value indicating if progress bar should be printed. @param misinfo: Use the RBO implementation that is also used in the TREC Health Misinformation Track. See also: https://github.com/claclark/Compatibility @return: Dictionary with RBO values that compare the document orderings of the original and reproduced runs. """ # Safety check for runs that are not added via pytrec_eval orig_run = break_ties(orig_run) rep_run = break_ties(rep_run) return dict(_RBO(orig_run, rep_run, phi=phi, trim_thresh=trim_thresh, pbar=pbar, misinfo=misinfo))
43.133858
112
0.695144
780
5,478
4.757692
0.215385
0.064673
0.021558
0.028025
0.804904
0.767448
0.765292
0.71086
0.693344
0.677445
0
0.006811
0.222709
5,478
126
113
43.47619
0.864725
0.523184
0
0.22
0
0
0
0
0
0
0
0
0
1
0.1
false
0
0.1
0
0.26
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
93837ba8d143561b9570c3070b9643294d992cee
28
py
Python
bin/intensity_normalization/plot/__init__.py
nibill/MIALab-1
e3550c962b21d5f0b9cb705e423d3016d294bd8d
[ "Apache-2.0" ]
null
null
null
bin/intensity_normalization/plot/__init__.py
nibill/MIALab-1
e3550c962b21d5f0b9cb705e423d3016d294bd8d
[ "Apache-2.0" ]
null
null
null
bin/intensity_normalization/plot/__init__.py
nibill/MIALab-1
e3550c962b21d5f0b9cb705e423d3016d294bd8d
[ "Apache-2.0" ]
1
2022-01-31T02:48:02.000Z
2022-01-31T02:48:02.000Z
from . import hist, quality
14
27
0.75
4
28
5.25
1
0
0
0
0
0
0
0
0
0
0
0
0.178571
28
1
28
28
0.913043
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
8786c480bc04d2053e566200ddf46857d2d7c491
21
py
Python
pymapf/__init__.py
APLA-Toolbox/pymapf
255df006925401e5ccdf82afc7dac339221574ba
[ "MIT" ]
25
2021-01-17T01:02:25.000Z
2022-02-13T09:20:59.000Z
pymapf/__init__.py
APLA-Toolbox/pymapf
255df006925401e5ccdf82afc7dac339221574ba
[ "MIT" ]
37
2021-01-16T22:36:32.000Z
2021-11-15T11:51:59.000Z
pymapf/__init__.py
APLA-Toolbox/pymapf
255df006925401e5ccdf82afc7dac339221574ba
[ "MIT" ]
5
2021-04-02T08:27:52.000Z
2021-11-17T12:43:52.000Z
# pymapf root module
10.5
20
0.761905
3
21
5.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.190476
21
1
21
21
0.941176
0.857143
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
878adf8f0713849567d3e68808f6939e343357ec
303
py
Python
pdf_bot/commands/__init__.py
arlessweschler/telegram-pdf-bot
d1f8b733701c986889a2ca40ce48e94a1223be0a
[ "MIT" ]
4
2020-11-15T12:03:37.000Z
2021-12-15T00:53:33.000Z
pdf_bot/commands/__init__.py
slimsevernake/telegram-pdf-bot
4592c7232f6f351755e7114280b32577d02421c8
[ "MIT" ]
46
2021-01-01T11:35:26.000Z
2021-07-28T10:30:13.000Z
pdf_bot/commands/__init__.py
slimsevernake/telegram-pdf-bot
4592c7232f6f351755e7114280b32577d02421c8
[ "MIT" ]
4
2021-01-22T17:09:54.000Z
2021-09-26T13:28:13.000Z
from pdf_bot.commands.compare import compare_cov_handler from pdf_bot.commands.merge import merge_cov_handler from pdf_bot.commands.watermark import watermark_cov_handler from pdf_bot.commands.photo import photo_cov_handler, process_photo from pdf_bot.commands.text import text_cov_handler, text_to_pdf
50.5
67
0.887789
50
303
5.02
0.28
0.139442
0.199203
0.358566
0.334661
0.334661
0
0
0
0
0
0
0.072607
303
5
68
60.6
0.893238
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
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
879f96e378cb2fa28fc2d202995d7d76bcec1274
268
py
Python
slackertpy/__init__.py
braze-inc/braze-growth-shares-slackertpy
02dc302a9af8ae09bdedcf59b5f1ba008ef79011
[ "MIT" ]
null
null
null
slackertpy/__init__.py
braze-inc/braze-growth-shares-slackertpy
02dc302a9af8ae09bdedcf59b5f1ba008ef79011
[ "MIT" ]
null
null
null
slackertpy/__init__.py
braze-inc/braze-growth-shares-slackertpy
02dc302a9af8ae09bdedcf59b5f1ba008ef79011
[ "MIT" ]
null
null
null
from slackertpy.alerter import Alerter from slackertpy.builder import MessageBuilder from slackertpy.level import Level from slackertpy import templates from slackertpy import blocks __version__ = "0.1.1" __all__ = [Alerter, Level, MessageBuilder, templates, blocks]
29.777778
61
0.828358
33
268
6.484848
0.393939
0.327103
0.186916
0
0
0
0
0
0
0
0
0.012658
0.115672
268
8
62
33.5
0.890295
0
0
0
0
0
0.018657
0
0
0
0
0
0
1
0
false
0
0.714286
0
0.714286
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
1
0
1
0
0
5
87a065e8cad259bdade386f5ca0d69b3d5469350
145
py
Python
legacy/artie/apps/octopod/priv/test/test_save_file_synchronously.py
MaxStrange/ArtieInfant
1edbb171a5405d2971227f2d2d83acb523c70034
[ "MIT" ]
1
2018-04-28T16:55:05.000Z
2018-04-28T16:55:05.000Z
legacy/artie/apps/octopod/priv/test/test_save_file_synchronously.py
MaxStrange/ArtieInfant
1edbb171a5405d2971227f2d2d83acb523c70034
[ "MIT" ]
null
null
null
legacy/artie/apps/octopod/priv/test/test_save_file_synchronously.py
MaxStrange/ArtieInfant
1edbb171a5405d2971227f2d2d83acb523c70034
[ "MIT" ]
null
null
null
def save_file(contents): with open("path_to_save_the_file.wav", 'wb') as f: f.write(contents) return "path_to_save_the_file.wav"
29
54
0.696552
25
145
3.68
0.6
0.130435
0.217391
0.282609
0.434783
0.434783
0
0
0
0
0
0
0.17931
145
4
55
36.25
0.773109
0
0
0
0
0
0.358621
0.344828
0
0
0
0
0
1
0.25
false
0
0
0
0.5
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
5
87a9060dd0c82a888974721115c245a9d32e4553
179
py
Python
general-practice/Exercises solved/w3resource/basic/Exercise11.py
lugabrielbueno/Projeto
f012c5bb9ce6f6d7c9e8196cc7986127dba3eba0
[ "MIT" ]
null
null
null
general-practice/Exercises solved/w3resource/basic/Exercise11.py
lugabrielbueno/Projeto
f012c5bb9ce6f6d7c9e8196cc7986127dba3eba0
[ "MIT" ]
null
null
null
general-practice/Exercises solved/w3resource/basic/Exercise11.py
lugabrielbueno/Projeto
f012c5bb9ce6f6d7c9e8196cc7986127dba3eba0
[ "MIT" ]
null
null
null
#Write a Python program to print the documents (syntax, description etc.) of Python built-in function(s) # abs can be substitued for another built-in functions print(abs.__doc__)
44.75
104
0.787709
29
179
4.724138
0.827586
0.10219
0
0
0
0
0
0
0
0
0
0
0.139665
179
4
105
44.75
0.88961
0.871508
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
87e1a321e80452914cf9ad100c08fafeeb21ad2e
44
py
Python
python/testData/refactoring/changeSignature/keywordOnlyParameter.before.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/refactoring/changeSignature/keywordOnlyParameter.before.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/refactoring/changeSignature/keywordOnlyParameter.before.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
def f1(x, *args): pass f1(42, 'spam')
7.333333
17
0.5
8
44
2.75
0.875
0
0
0
0
0
0
0
0
0
0
0.125
0.272727
44
5
18
8.8
0.5625
0
0
0
0
0
0.090909
0
0
0
0
0
0
1
0.333333
false
0.333333
0
0
0.333333
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
1
0
1
0
0
0
0
0
5
e21467d0e16a4890c751ee849e4c2dd11d285aa6
72
py
Python
pretorched/data/transforms/__init__.py
schwettmann/pretorched-x
ce8c3712434b3cd5d85dcbe8582ff51ddfa7d4ed
[ "MIT" ]
5
2022-02-22T21:58:10.000Z
2022-03-22T16:19:14.000Z
pretorched/data/transforms/__init__.py
schwettmann/pretorched-x
ce8c3712434b3cd5d85dcbe8582ff51ddfa7d4ed
[ "MIT" ]
3
2022-02-27T06:43:34.000Z
2022-03-18T08:30:30.000Z
pretorched/data/transforms/__init__.py
schwettmann/pretorched-x
ce8c3712434b3cd5d85dcbe8582ff51ddfa7d4ed
[ "MIT" ]
1
2022-02-27T05:18:30.000Z
2022-02-27T05:18:30.000Z
from torchvision.transforms import * from torchvideo.transforms import *
36
36
0.847222
8
72
7.625
0.625
0.52459
0
0
0
0
0
0
0
0
0
0
0.097222
72
2
37
36
0.938462
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
3554b1cf6438dfabc309dbe7c57c908735b6c993
199
py
Python
src/resources/__init__.py
smart-coffee/web-api
006ad4a07afb35a1931c66de25b974e83d249560
[ "MIT" ]
1
2020-02-01T05:59:09.000Z
2020-02-01T05:59:09.000Z
src/resources/__init__.py
smart-coffee/web-api
006ad4a07afb35a1931c66de25b974e83d249560
[ "MIT" ]
7
2019-02-05T21:57:34.000Z
2019-04-29T21:12:57.000Z
src/resources/__init__.py
smart-coffee/web-api
006ad4a07afb35a1931c66de25b974e83d249560
[ "MIT" ]
null
null
null
from resources.users import USER_BP from resources.authentication import AUTHENTICATION_BP from resources.roles import ROLE_BP from resources.coffee import COFFEE_BP from resources.jobs import JOB_BP
39.8
54
0.879397
30
199
5.666667
0.4
0.382353
0.352941
0
0
0
0
0
0
0
0
0
0.095477
199
5
55
39.8
0.944444
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
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
1
0
1
0
0
0
0
5