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
b157fd705dea43be298b943f4208c1336c516768
326
py
Python
pyopenproject/business/services/group_service_impl.py
webu/pyopenproject
40b2cb9fe0fa3f89bc0fe2a3be323422d9ecf966
[ "MIT" ]
5
2021-02-25T15:54:28.000Z
2021-04-22T15:43:36.000Z
pyopenproject/business/services/group_service_impl.py
webu/pyopenproject
40b2cb9fe0fa3f89bc0fe2a3be323422d9ecf966
[ "MIT" ]
7
2021-03-15T16:26:23.000Z
2022-03-16T13:45:18.000Z
pyopenproject/business/services/group_service_impl.py
webu/pyopenproject
40b2cb9fe0fa3f89bc0fe2a3be323422d9ecf966
[ "MIT" ]
6
2021-06-18T18:59:11.000Z
2022-03-27T04:58:52.000Z
from pyopenproject.business.group_service import GroupService from pyopenproject.business.services.command.group.find import Find class GroupServiceImpl(GroupService): def __init__(self, connection): super().__init__(connection) def find(self, group): return Find(self.connection, group).execute()
27.166667
67
0.760736
36
326
6.638889
0.527778
0.142259
0.209205
0
0
0
0
0
0
0
0
0
0.147239
326
11
68
29.636364
0.859712
0
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.285714
0.142857
0.857143
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
3
b15d56db0ea737aa9405931b1b8fdc74057431ef
211
py
Python
src/domain/entities/RawDataModel.py
behrad-kzm/LocationBrain
44ef5e03cc9b240bfabad5c3c14635ef812a39ae
[ "MIT" ]
null
null
null
src/domain/entities/RawDataModel.py
behrad-kzm/LocationBrain
44ef5e03cc9b240bfabad5c3c14635ef812a39ae
[ "MIT" ]
null
null
null
src/domain/entities/RawDataModel.py
behrad-kzm/LocationBrain
44ef5e03cc9b240bfabad5c3c14635ef812a39ae
[ "MIT" ]
null
null
null
from typing import Tuple class RawDataModel: location: Tuple[float, float] label: str def __init__(self, x: float, y: float, label: str): self.location = (x, y) self.label = label
19.181818
55
0.625592
28
211
4.571429
0.535714
0.15625
0.203125
0
0
0
0
0
0
0
0
0
0.270142
211
10
56
21.1
0.831169
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0
0.714286
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
b160902fbb87f53408dacbc778764205ba4ad661
162
py
Python
frontend/urls.py
syqu22/django-react-blog
6c5605e1c8ef66b17d4d6453f0807947d1adfdb4
[ "MIT" ]
null
null
null
frontend/urls.py
syqu22/django-react-blog
6c5605e1c8ef66b17d4d6453f0807947d1adfdb4
[ "MIT" ]
null
null
null
frontend/urls.py
syqu22/django-react-blog
6c5605e1c8ef66b17d4d6453f0807947d1adfdb4
[ "MIT" ]
null
null
null
from os import name from django.urls import path, re_path from frontend.views import index urlpatterns = [ path('', index), re_path(r'^.*/$', index), ]
16.2
37
0.666667
23
162
4.608696
0.565217
0.113208
0
0
0
0
0
0
0
0
0
0
0.191358
162
9
38
18
0.80916
0
0
0
0
0
0.030864
0
0
0
0
0
0
1
0
false
0
0.428571
0
0.428571
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
b187497a3887449fad19cdd54ce4ac320171e884
219
py
Python
app/input/stdin.py
pedrolp85/pycli
469d22442de2a854aebc3354cdbf9b8fe342ee16
[ "Apache-2.0" ]
null
null
null
app/input/stdin.py
pedrolp85/pycli
469d22442de2a854aebc3354cdbf9b8fe342ee16
[ "Apache-2.0" ]
null
null
null
app/input/stdin.py
pedrolp85/pycli
469d22442de2a854aebc3354cdbf9b8fe342ee16
[ "Apache-2.0" ]
null
null
null
from typing import Iterator import fileinput from .input import Input class StdinInput(Input): def get_lines(self) -> Iterator[str]: for line in fileinput.input(): yield line.rstrip("\n")
19.909091
41
0.6621
28
219
5.142857
0.678571
0
0
0
0
0
0
0
0
0
0
0
0.242009
219
11
42
19.909091
0.86747
0
0
0
0
0
0.009091
0
0
0
0
0
0
1
0.142857
false
0
0.428571
0
0.714286
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
b1a1384c55a831a6beed70e0b7bcb1ab94492a71
246
py
Python
qcloudsdkwenzhi/QuotaGetRequest.py
f3n9/qcloudcli
b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19
[ "Apache-2.0" ]
null
null
null
qcloudsdkwenzhi/QuotaGetRequest.py
f3n9/qcloudcli
b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19
[ "Apache-2.0" ]
null
null
null
qcloudsdkwenzhi/QuotaGetRequest.py
f3n9/qcloudcli
b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- from qcloudsdkcore.request import Request class QuotaGetRequest(Request): def __init__(self): super(QuotaGetRequest, self).__init__( 'wenzhi', 'qcloudcliV1', 'QuotaGet', 'wenzhi.api.qcloud.com')
24.6
73
0.666667
25
246
6.24
0.76
0
0
0
0
0
0
0
0
0
0
0.01
0.186992
246
9
74
27.333333
0.77
0.085366
0
0
0
0
0.206278
0.09417
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
b1aa3c8e652e547b64690addc139dab66c1eb98c
155
py
Python
applications/accounts/elastic/exceptions.py
iBeCo/analytics
c71c80a7cacd55078c1a9dd463cb4e66aa868764
[ "Apache-2.0" ]
null
null
null
applications/accounts/elastic/exceptions.py
iBeCo/analytics
c71c80a7cacd55078c1a9dd463cb4e66aa868764
[ "Apache-2.0" ]
null
null
null
applications/accounts/elastic/exceptions.py
iBeCo/analytics
c71c80a7cacd55078c1a9dd463cb4e66aa868764
[ "Apache-2.0" ]
null
null
null
class StoreDoesNotExist(Exception): def __init__(self): super(StoreDoesNotExist, self).__init__("Store with the given query does not exist")
25.833333
92
0.735484
18
155
5.888889
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.174194
155
5
93
31
0.828125
0
0
0
0
0
0.266234
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
4931b5a6ab85052a5dec41fee95ea58162682a18
1,170
py
Python
python/meanie3D/__init__.py
JuergenSimon/meanie3D
776890f6b63d735153566fecc5a76c68a23ef333
[ "MIT" ]
null
null
null
python/meanie3D/__init__.py
JuergenSimon/meanie3D
776890f6b63d735153566fecc5a76c68a23ef333
[ "MIT" ]
5
2016-09-17T13:46:23.000Z
2020-07-01T16:31:29.000Z
python/meanie3D/__init__.py
JuergenSimon/meanie3D
776890f6b63d735153566fecc5a76c68a23ef333
[ "MIT" ]
3
2016-04-18T13:13:28.000Z
2020-06-18T12:30:05.000Z
__author__ = 'Juergen Simon' __email__ = 'juergen.simon@uni-bonn.de' __version__ = '1.6.0' __url__ = 'http://git.meteo.uni-bonn.de/projects/meanie3d' __all__ = ['app', 'visualisation', 'resources'] import os.path import sys def getVersion(): ''' :return:meanie3D package version ''' from . import __version__ return __version__ def getHome(): ''' meanie3D package location :return: ''' return os.path.abspath(os.path.dirname(__file__)) def appendSystemPythonPath(): ''' Returns the system's python path to import outside modules. ''' system_python_path = ":/Users/simon/anaconda/lib/python35.zip:/Users/simon/anaconda/lib/python3.5:/Users/simon/anaconda/lib/python3.5/plat-darwin:/Users/simon/anaconda/lib/python3.5/lib-dynload:/Users/simon/anaconda/lib/python3.5/site-packages:/Users/simon/anaconda/lib/python3.5/site-packages/Sphinx-1.4.1-py3.5.egg:/Users/simon/anaconda/lib/python3.5/site-packages/aeosa:/Users/simon/anaconda/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg".strip() paths = system_python_path.split(':') for path in paths: if path: sys.path.append(path)
35.454545
463
0.707692
162
1,170
4.888889
0.432099
0.10101
0.181818
0.212121
0.316919
0.316919
0.207071
0.207071
0
0
0
0.032641
0.135897
1,170
32
464
36.5625
0.750742
0.108547
0
0
0
0.055556
0.546828
0.456193
0
0
0
0
0
1
0.166667
false
0
0.166667
0
0.444444
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
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
493a058b071e10afea610c82bdc7052880e29d3e
489
py
Python
coggers/register.py
restinya/Barkeep
9d6a7f47bc8e2bc3cda1ba2992a02a85d06efa7e
[ "MIT" ]
null
null
null
coggers/register.py
restinya/Barkeep
9d6a7f47bc8e2bc3cda1ba2992a02a85d06efa7e
[ "MIT" ]
null
null
null
coggers/register.py
restinya/Barkeep
9d6a7f47bc8e2bc3cda1ba2992a02a85d06efa7e
[ "MIT" ]
null
null
null
import discord import asyncio import requests import re from discord.utils import get from discord.ext import commands from math import floor from configs.settings import command_prefix from utils import accessDB, point_buy, alpha_emojis, db, VerboseMDStringifier, traceBack, checkForChar class Register(commands.Cog): def __init__ (self, bot): self.bot = bot @commands.group(aliases=['r'], case_insensitive=True) async def reward(self, ctx): pass
24.45
102
0.744376
64
489
5.5625
0.65625
0.061798
0
0
0
0
0
0
0
0
0
0
0.186094
489
20
103
24.45
0.894472
0
0
0
0
0
0.002041
0
0
0
0
0
0
1
0.066667
false
0.066667
0.6
0
0.733333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
3
4948c407586d38435e5ca768d4ac1ac6261a7430
3,561
py
Python
LOSSPhotPypeline/image/FileNames.py
xiaocong213/LOSSPhotPypeline
147630c9dbfb13005e75c661dc69ac2be58e14c9
[ "MIT" ]
null
null
null
LOSSPhotPypeline/image/FileNames.py
xiaocong213/LOSSPhotPypeline
147630c9dbfb13005e75c661dc69ac2be58e14c9
[ "MIT" ]
null
null
null
LOSSPhotPypeline/image/FileNames.py
xiaocong213/LOSSPhotPypeline
147630c9dbfb13005e75c661dc69ac2be58e14c9
[ "MIT" ]
null
null
null
class FileNames(object): '''standardize and handle all file names/types encountered by pipeline''' def __init__(self, name): '''do everything upon instantiation''' # determine root file name self.root = name self.root = self.root.replace('_c.fit','') self.root = self.root.replace('_sobj.fit','') self.root = self.root.replace('_cobj.fit','') self.root = self.root.replace('_cnew.fit','') self.root = self.root.replace('_cwcs.fit','' ) self.root = self.root.replace('_ctwp.fit','' ) self.root = self.root.replace('_cfwp.fit','' ) self.root = self.root.replace('_ctcv.fit','' ) self.root = self.root.replace('_cfcv.fit','' ) self.root = self.root.replace('_ctsb.fit','' ) self.root = self.root.replace('_cfsb.fit','' ) self.root = self.root.replace('_cph.fit','' ) self.root = self.root.replace('_ctph.fit','' ) self.root = self.root.replace('_sbph.fit','' ) self.root = self.root.replace('_cand.fit','' ) self.root = self.root.replace('_fwhm.txt','' ) self.root = self.root.replace('_obj.txt','' ) self.root = self.root.replace('_psfstar.txt','' ) self.root = self.root.replace('_apt.txt','' ) self.root = self.root.replace('_apt.dat','' ) self.root = self.root.replace('_psf.txt','' ) self.root = self.root.replace('_standrd.txt','') self.root = self.root.replace('_standxy.txt','') self.root = self.root.replace('_objectrd.txt','') self.root = self.root.replace('_objectxy.txt','') self.root = self.root.replace('_sky.txt','') self.root = self.root.replace('_apass.dat','') self.root = self.root.replace('_zero.txt','') self.root = self.root.replace('.fit','') self.root = self.root.replace('.fts','') # generate all filenames from root self.cimg = self.root + '_c.fit' self.sobj = self.root + '_sobj.fit' self.cobj = self.root + '_cobj.fit' self.cnew = self.root + '_cnew.fit' self.cwcs = self.root + '_cwcs.fit' self.ctwp = self.root + '_ctwp.fit' self.cfwp = self.root + '_cfwp.fit' self.ctcv = self.root + '_ctcv.fit' self.cfcv = self.root + '_cfcv.fit' self.ctsb = self.root + '_ctsb.fit' self.cfsb = self.root + '_cfsb.fit' self.cph = self.root + '_cph.fit' self.ctph = self.root + '_ctph.fit' self.sbph = self.root + '_sbph.fit' self.cand = self.root + '_cand.fit' self.fwhm_fl = self.root + '_fwhm.txt' self.obj = self.root + '_obj.txt' self.psfstar = self.root + '_psfstar.txt' self.apt = self.root + '_apt.txt' self.aptdat = self.root + '_apt.dat' self.psf = self.root + '_psf.txt' self.psfsub = self.root + '_psfsub.txt' self.psffitarr = self.root + '_psffitarr.fit' self.psfdat = self.root + '_psf.dat' self.psfsubdat = self.root + '_psfsub.dat' self.standrd = self.root + '_standrd.txt' self.standxy = self.root + '_standxy.txt' self.objectrd = self.root + '_objectrd.txt' self.objectxy = self.root + '_objectxy.txt' self.skytxt = self.root + '_sky.txt' self.skyfit = self.root + '_sky.fit' self.apass = self.root + '_apass.dat' self.zerotxt = self.root + '_zero.txt'
48.121622
77
0.55153
440
3,561
4.313636
0.152273
0.396207
0.189673
0.252898
0.41254
0.400422
0.030558
0
0
0
0
0
0.275765
3,561
73
78
48.780822
0.735944
0.04465
0
0
0
0
0.171681
0
0
0
0
0
0
1
0.015152
false
0.030303
0
0
0.030303
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
498bbd66948f733339d939ff2181af5fd1cfe721
376
py
Python
pkg/pkg/utils/utils.py
dlee0156/bilateral-connectome
26fe165341bb79379fecdd8bc5d7b5bfe3983fdc
[ "MIT" ]
2
2021-09-24T20:21:18.000Z
2022-02-08T18:31:29.000Z
pkg/pkg/utils/utils.py
dlee0156/bilateral-connectome
26fe165341bb79379fecdd8bc5d7b5bfe3983fdc
[ "MIT" ]
9
2021-09-29T17:23:41.000Z
2022-03-16T20:22:04.000Z
pkg/pkg/utils/utils.py
dlee0156/bilateral-connectome
26fe165341bb79379fecdd8bc5d7b5bfe3983fdc
[ "MIT" ]
2
2021-11-16T16:17:53.000Z
2022-03-26T01:25:10.000Z
import warnings from beartype.roar import BeartypeDecorHintPepDeprecatedWarning def set_warnings(): # warnings.filterwarnings("ignore", category=UserWarning, module="umap") # this is currently being thrown on import of graspologic (11/05/2021) warnings.filterwarnings( "ignore", module="beartype", category=BeartypeDecorHintPepDeprecatedWarning )
26.857143
83
0.763298
36
376
7.944444
0.694444
0.153846
0.195804
0
0
0
0
0
0
0
0
0.025078
0.151596
376
13
84
28.923077
0.871473
0.369681
0
0
0
0
0.060345
0
0
0
0
0
0
1
0.166667
true
0
0.333333
0
0.5
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
3
b8d1b22a310e462a5d62d1140764a54ac0253346
34,872
py
Python
speechbrain/nnet/CNN.py
JasonSWFu/speechbrain
cb78ba2b33fceba273b055dc471535344c3053f0
[ "Apache-2.0" ]
2
2021-11-02T10:25:18.000Z
2022-03-24T05:12:05.000Z
speechbrain/nnet/CNN.py
JasonSWFu/speechbrain
cb78ba2b33fceba273b055dc471535344c3053f0
[ "Apache-2.0" ]
null
null
null
speechbrain/nnet/CNN.py
JasonSWFu/speechbrain
cb78ba2b33fceba273b055dc471535344c3053f0
[ "Apache-2.0" ]
1
2022-02-15T07:11:40.000Z
2022-02-15T07:11:40.000Z
"""Library implementing convolutional neural networks. Authors * Mirco Ravanelli 2020 * Jianyuan Zhong 2020 * Cem Subakan 2021 * Davide Borra 2021 """ import math import torch import logging import numpy as np import torch.nn as nn import torch.nn.functional as F from typing import Tuple logger = logging.getLogger(__name__) class SincConv(nn.Module): """This function implements SincConv (SincNet). M. Ravanelli, Y. Bengio, "Speaker Recognition from raw waveform with SincNet", in Proc. of SLT 2018 (https://arxiv.org/abs/1808.00158) Arguments --------- input_shape : tuple The shape of the input. Alternatively use ``in_channels``. in_channels : int The number of input channels. Alternatively use ``input_shape``. out_channels : int It is the number of output channels. kernel_size: int Kernel size of the convolutional filters. stride : int Stride factor of the convolutional filters. When the stride factor > 1, a decimation in time is performed. dilation : int Dilation factor of the convolutional filters. padding : str (same, valid, causal). If "valid", no padding is performed. If "same" and stride is 1, output shape is the same as the input shape. "causal" results in causal (dilated) convolutions. padding_mode : str This flag specifies the type of padding. See torch.nn documentation for more information. groups : int This option specifies the convolutional groups. See torch.nn documentation for more information. bias : bool If True, the additive bias b is adopted. sample_rate : int, Sampling rate of the input signals. It is only used for sinc_conv. min_low_hz : float Lowest possible frequency (in Hz) for a filter. It is only used for sinc_conv. min_low_hz : float Lowest possible value (in Hz) for a filter bandwidth. Example ------- >>> inp_tensor = torch.rand([10, 16000]) >>> conv = SincConv(input_shape=inp_tensor.shape, out_channels=25, kernel_size=11) >>> out_tensor = conv(inp_tensor) >>> out_tensor.shape torch.Size([10, 16000, 25]) """ def __init__( self, out_channels, kernel_size, input_shape=None, in_channels=None, stride=1, dilation=1, padding="same", padding_mode="reflect", sample_rate=16000, min_low_hz=50, min_band_hz=50, ): super().__init__() self.out_channels = out_channels self.kernel_size = kernel_size self.stride = stride self.dilation = dilation self.padding = padding self.padding_mode = padding_mode self.sample_rate = sample_rate self.min_low_hz = min_low_hz self.min_band_hz = min_band_hz # input shape inference if input_shape is None and in_channels is None: raise ValueError("Must provide one of input_shape or in_channels") if in_channels is None: in_channels = self._check_input_shape(input_shape) # Initialize Sinc filters self._init_sinc_conv() def forward(self, x): """Returns the output of the convolution. Arguments --------- x : torch.Tensor (batch, time, channel) input to convolve. 2d or 4d tensors are expected. """ x = x.transpose(1, -1) self.device = x.device unsqueeze = x.ndim == 2 if unsqueeze: x = x.unsqueeze(1) if self.padding == "same": x = self._manage_padding( x, self.kernel_size, self.dilation, self.stride ) elif self.padding == "causal": num_pad = (self.kernel_size - 1) * self.dilation x = F.pad(x, (num_pad, 0)) elif self.padding == "valid": pass else: raise ValueError( "Padding must be 'same', 'valid' or 'causal'. Got %s." % (self.padding) ) sinc_filters = self._get_sinc_filters() wx = F.conv1d( x, sinc_filters, stride=self.stride, padding=0, dilation=self.dilation, ) if unsqueeze: wx = wx.squeeze(1) wx = wx.transpose(1, -1) return wx def _check_input_shape(self, shape): """Checks the input shape and returns the number of input channels. """ if len(shape) == 2: in_channels = 1 elif len(shape) == 3: in_channels = 1 else: raise ValueError( "sincconv expects 2d or 3d inputs. Got " + str(len(shape)) ) # Kernel size must be odd if self.kernel_size % 2 == 0: raise ValueError( "The field kernel size must be an odd number. Got %s." % (self.kernel_size) ) return in_channels def _get_sinc_filters(self,): """This functions creates the sinc-filters to used for sinc-conv. """ # Computing the low frequencies of the filters low = self.min_low_hz + torch.abs(self.low_hz_) # Setting minimum band and minimum freq high = torch.clamp( low + self.min_band_hz + torch.abs(self.band_hz_), self.min_low_hz, self.sample_rate / 2, ) band = (high - low)[:, 0] # Passing from n_ to the corresponding f_times_t domain self.n_ = self.n_.to(self.device) self.window_ = self.window_.to(self.device) f_times_t_low = torch.matmul(low, self.n_) f_times_t_high = torch.matmul(high, self.n_) # Left part of the filters. band_pass_left = ( (torch.sin(f_times_t_high) - torch.sin(f_times_t_low)) / (self.n_ / 2) ) * self.window_ # Central element of the filter band_pass_center = 2 * band.view(-1, 1) # Right part of the filter (sinc filters are symmetric) band_pass_right = torch.flip(band_pass_left, dims=[1]) # Combining left, central, and right part of the filter band_pass = torch.cat( [band_pass_left, band_pass_center, band_pass_right], dim=1 ) # Amplitude normalization band_pass = band_pass / (2 * band[:, None]) # Setting up the filter coefficients filters = band_pass.view(self.out_channels, 1, self.kernel_size) return filters def _init_sinc_conv(self): """Initializes the parameters of the sinc_conv layer.""" # Initialize filterbanks such that they are equally spaced in Mel scale high_hz = self.sample_rate / 2 - (self.min_low_hz + self.min_band_hz) mel = torch.linspace( self._to_mel(self.min_low_hz), self._to_mel(high_hz), self.out_channels + 1, ) hz = self._to_hz(mel) # Filter lower frequency and bands self.low_hz_ = hz[:-1].unsqueeze(1) self.band_hz_ = (hz[1:] - hz[:-1]).unsqueeze(1) # Maiking freq and bands learnable self.low_hz_ = nn.Parameter(self.low_hz_) self.band_hz_ = nn.Parameter(self.band_hz_) # Hamming window n_lin = torch.linspace( 0, (self.kernel_size / 2) - 1, steps=int((self.kernel_size / 2)) ) self.window_ = 0.54 - 0.46 * torch.cos( 2 * math.pi * n_lin / self.kernel_size ) # Time axis (only half is needed due to symmetry) n = (self.kernel_size - 1) / 2.0 self.n_ = ( 2 * math.pi * torch.arange(-n, 0).view(1, -1) / self.sample_rate ) def _to_mel(self, hz): """Converts frequency in Hz to the mel scale. """ return 2595 * np.log10(1 + hz / 700) def _to_hz(self, mel): """Converts frequency in the mel scale to Hz. """ return 700 * (10 ** (mel / 2595) - 1) def _manage_padding( self, x, kernel_size: int, dilation: int, stride: int, ): """This function performs zero-padding on the time axis such that their lengths is unchanged after the convolution. Arguments --------- x : torch.Tensor Input tensor. kernel_size : int Size of kernel. dilation : int Dilation used. stride : int Stride. """ # Detecting input shape L_in = x.shape[-1] # Time padding padding = get_padding_elem(L_in, stride, kernel_size, dilation) # Applying padding x = F.pad(x, padding, mode=self.padding_mode) return x class Conv1d(nn.Module): """This function implements 1d convolution. Arguments --------- out_channels : int It is the number of output channels. kernel_size : int Kernel size of the convolutional filters. input_shape : tuple The shape of the input. Alternatively use ``in_channels``. in_channels : int The number of input channels. Alternatively use ``input_shape``. stride : int Stride factor of the convolutional filters. When the stride factor > 1, a decimation in time is performed. dilation : int Dilation factor of the convolutional filters. padding : str (same, valid, causal). If "valid", no padding is performed. If "same" and stride is 1, output shape is the same as the input shape. "causal" results in causal (dilated) convolutions. groups: int Number of blocked connections from input channels to output channels. padding_mode : str This flag specifies the type of padding. See torch.nn documentation for more information. skip_transpose : bool If False, uses batch x time x channel convention of speechbrain. If True, uses batch x channel x time convention. Example ------- >>> inp_tensor = torch.rand([10, 40, 16]) >>> cnn_1d = Conv1d( ... input_shape=inp_tensor.shape, out_channels=8, kernel_size=5 ... ) >>> out_tensor = cnn_1d(inp_tensor) >>> out_tensor.shape torch.Size([10, 40, 8]) """ def __init__( self, out_channels, kernel_size, input_shape=None, in_channels=None, stride=1, dilation=1, padding="same", groups=1, bias=True, padding_mode="reflect", skip_transpose=False, ): super().__init__() self.kernel_size = kernel_size self.stride = stride self.dilation = dilation self.padding = padding self.padding_mode = padding_mode self.unsqueeze = False self.skip_transpose = skip_transpose if input_shape is None and in_channels is None: raise ValueError("Must provide one of input_shape or in_channels") if in_channels is None: in_channels = self._check_input_shape(input_shape) self.conv = nn.Conv1d( in_channels, out_channels, self.kernel_size, stride=self.stride, dilation=self.dilation, padding=0, groups=groups, bias=bias, ) def forward(self, x): """Returns the output of the convolution. Arguments --------- x : torch.Tensor (batch, time, channel) input to convolve. 2d or 4d tensors are expected. """ if not self.skip_transpose: x = x.transpose(1, -1) if self.unsqueeze: x = x.unsqueeze(1) if self.padding == "same": x = self._manage_padding( x, self.kernel_size, self.dilation, self.stride ) elif self.padding == "causal": num_pad = (self.kernel_size - 1) * self.dilation x = F.pad(x, (num_pad, 0)) elif self.padding == "valid": pass else: raise ValueError( "Padding must be 'same', 'valid' or 'causal'. Got " + self.padding ) wx = self.conv(x) if self.unsqueeze: wx = wx.squeeze(1) if not self.skip_transpose: wx = wx.transpose(1, -1) return wx def _manage_padding( self, x, kernel_size: int, dilation: int, stride: int, ): """This function performs zero-padding on the time axis such that their lengths is unchanged after the convolution. Arguments --------- x : torch.Tensor Input tensor. kernel_size : int Size of kernel. dilation : int Dilation used. stride : int Stride. """ # Detecting input shape L_in = x.shape[-1] # Time padding padding = get_padding_elem(L_in, stride, kernel_size, dilation) # Applying padding x = F.pad(x, padding, mode=self.padding_mode) return x def _check_input_shape(self, shape): """Checks the input shape and returns the number of input channels. """ if len(shape) == 2: self.unsqueeze = True in_channels = 1 elif self.skip_transpose: in_channels = shape[1] elif len(shape) == 3: in_channels = shape[2] else: raise ValueError( "conv1d expects 2d, 3d inputs. Got " + str(len(shape)) ) # Kernel size must be odd if self.kernel_size % 2 == 0: raise ValueError( "The field kernel size must be an odd number. Got %s." % (self.kernel_size) ) return in_channels class Conv2d(nn.Module): """This function implements 2d convolution. Arguments --------- out_channels : int It is the number of output channels. kernel_size : tuple Kernel size of the 2d convolutional filters over time and frequency axis. input_shape : tuple The shape of the input. Alternatively use ``in_channels``. in_channels : int The number of input channels. Alternatively use ``input_shape``. stride: int Stride factor of the 2d convolutional filters over time and frequency axis. dilation : int Dilation factor of the 2d convolutional filters over time and frequency axis. padding : str (same, valid). If "valid", no padding is performed. If "same" and stride is 1, output shape is same as input shape. padding_mode : str This flag specifies the type of padding. See torch.nn documentation for more information. groups : int This option specifies the convolutional groups. See torch.nn documentation for more information. bias : bool If True, the additive bias b is adopted. Example ------- >>> inp_tensor = torch.rand([10, 40, 16, 8]) >>> cnn_2d = Conv2d( ... input_shape=inp_tensor.shape, out_channels=5, kernel_size=(7, 3) ... ) >>> out_tensor = cnn_2d(inp_tensor) >>> out_tensor.shape torch.Size([10, 40, 16, 5]) """ def __init__( self, out_channels, kernel_size, input_shape=None, in_channels=None, stride=(1, 1), dilation=(1, 1), padding="same", groups=1, bias=True, padding_mode="reflect", ): super().__init__() # handle the case if some parameter is int if isinstance(kernel_size, int): kernel_size = (kernel_size, kernel_size) if isinstance(stride, int): stride = (stride, stride) if isinstance(dilation, int): dilation = (dilation, dilation) self.kernel_size = kernel_size self.stride = stride self.dilation = dilation self.padding = padding self.padding_mode = padding_mode self.unsqueeze = False if input_shape is None and in_channels is None: raise ValueError("Must provide one of input_shape or in_channels") if in_channels is None: in_channels = self._check_input(input_shape) # Weights are initialized following pytorch approach self.conv = nn.Conv2d( in_channels, out_channels, self.kernel_size, stride=self.stride, padding=0, dilation=self.dilation, groups=groups, bias=bias, ) def forward(self, x): """Returns the output of the convolution. Arguments --------- x : torch.Tensor (batch, time, channel) input to convolve. 2d or 4d tensors are expected. """ x = x.transpose(1, -1) if self.unsqueeze: x = x.unsqueeze(1) if self.padding == "same": x = self._manage_padding( x, self.kernel_size, self.dilation, self.stride ) elif self.padding == "valid": pass else: raise ValueError( "Padding must be 'same' or 'valid'. Got " + self.padding ) wx = self.conv(x) if self.unsqueeze: wx = wx.squeeze(1) wx = wx.transpose(1, -1) return wx def _manage_padding( self, x, kernel_size: Tuple[int, int], dilation: Tuple[int, int], stride: Tuple[int, int], ): """This function performs zero-padding on the time and frequency axes such that their lengths is unchanged after the convolution. Arguments --------- x : torch.Tensor kernel_size : int dilation : int stride: int """ # Detecting input shape L_in = x.shape[-1] # Time padding padding_time = get_padding_elem( L_in, stride[-1], kernel_size[-1], dilation[-1] ) padding_freq = get_padding_elem( L_in, stride[-2], kernel_size[-2], dilation[-2] ) padding = padding_time + padding_freq # Applying padding x = nn.functional.pad(x, padding, mode=self.padding_mode) return x def _check_input(self, shape): """Checks the input shape and returns the number of input channels. """ if len(shape) == 3: self.unsqueeze = True in_channels = 1 elif len(shape) == 4: in_channels = shape[3] else: raise ValueError("Expected 3d or 4d inputs. Got " + len(shape)) # Kernel size must be odd if self.kernel_size[0] % 2 == 0 or self.kernel_size[1] % 2 == 0: raise ValueError( "The field kernel size must be an odd number. Got %s." % (self.kernel_size) ) return in_channels class Conv2dWithConstraint(Conv2d): """This function implements 2d convolution with kernel max-norm constaint. This corresponds to set an upper bound for the kernel norm. Arguments --------- out_channels : int It is the number of output channels. kernel_size : tuple Kernel size of the 2d convolutional filters over time and frequency axis. input_shape : tuple The shape of the input. Alternatively use ``in_channels``. in_channels : int The number of input channels. Alternatively use ``input_shape``. stride: int Stride factor of the 2d convolutional filters over time and frequency axis. dilation : int Dilation factor of the 2d convolutional filters over time and frequency axis. padding : str (same, valid). If "valid", no padding is performed. If "same" and stride is 1, output shape is same as input shape. padding_mode : str This flag specifies the type of padding. See torch.nn documentation for more information. groups : int This option specifies the convolutional groups. See torch.nn documentation for more information. bias : bool If True, the additive bias b is adopted. max_norm : float kernel max-norm Example ------- >>> inp_tensor = torch.rand([10, 40, 16, 8]) >>> max_norm = 1 >>> cnn_2d_constrained = Conv2dWithConstraint( ... in_channels=inp_tensor.shape[-1], out_channels=5, kernel_size=(7, 3) ... ) >>> out_tensor = cnn_2d_constrained(inp_tensor) >>> torch.any(torch.norm(cnn_2d_constrained.conv.weight.data, p=2, dim=0)>max_norm) tensor(False) """ def __init__(self, *args, max_norm=1, **kwargs): self.max_norm = max_norm super(Conv2dWithConstraint, self).__init__(*args, **kwargs) def forward(self, x): """Returns the output of the convolution. Arguments --------- x : torch.Tensor (batch, time, channel) input to convolve. 2d or 4d tensors are expected. """ self.conv.weight.data = torch.renorm( self.conv.weight.data, p=2, dim=0, maxnorm=self.max_norm ) return super(Conv2dWithConstraint, self).forward(x) class ConvTranspose1d(nn.Module): """This class implements 1d transposed convolution with speechbrain. Transpose convolution is normally used to perform upsampling. Arguments --------- out_channels : int It is the number of output channels. kernel_size : int Kernel size of the convolutional filters. input_shape : tuple The shape of the input. Alternatively use ``in_channels``. in_channels : int The number of input channels. Alternatively use ``input_shape``. stride : int Stride factor of the convolutional filters. When the stride factor > 1, upsampling in time is performed. dilation : int Dilation factor of the convolutional filters. padding : str or int To have in output the target dimension, we suggest tuning the kernel size and the padding properly. We also support the following function to have some control over the padding and the corresponding ouput dimensionality. if "valid", no padding is applied if "same", padding amount is inferred so that the output size is closest to possible to input size. Note that for some kernel_size / stride combinations it is not possible to obtain the exact same size, but we return the closest possible size. if "factor", padding amount is inferred so that the output size is closest to inputsize*stride. Note that for some kernel_size / stride combinations it is not possible to obtain the exact size, but we return the closest possible size. if an integer value is entered, a custom padding is used. output_padding : int, Additional size added to one side of the output shape groups: int Number of blocked connections from input channels to output channels. Default: 1 bias: bool If True, adds a learnable bias to the output skip_transpose : bool If False, uses batch x time x channel convention of speechbrain. If True, uses batch x channel x time convention. Example ------- >>> from speechbrain.nnet.CNN import Conv1d, ConvTranspose1d >>> inp_tensor = torch.rand([10, 12, 40]) #[batch, time, fea] >>> convtranspose_1d = ConvTranspose1d( ... input_shape=inp_tensor.shape, out_channels=8, kernel_size=3, stride=2 ... ) >>> out_tensor = convtranspose_1d(inp_tensor) >>> out_tensor.shape torch.Size([10, 25, 8]) >>> # Combination of Conv1d and ConvTranspose1d >>> from speechbrain.nnet.CNN import Conv1d, ConvTranspose1d >>> signal = torch.tensor([1,100]) >>> signal = torch.rand([1,100]) #[batch, time] >>> conv1d = Conv1d(input_shape=signal.shape, out_channels=1, kernel_size=3, stride=2) >>> conv_out = conv1d(signal) >>> conv_t = ConvTranspose1d(input_shape=conv_out.shape, out_channels=1, kernel_size=3, stride=2, padding=1) >>> signal_rec = conv_t(conv_out, output_size=[100]) >>> signal_rec.shape torch.Size([1, 100]) >>> signal = torch.rand([1,115]) #[batch, time] >>> conv_t = ConvTranspose1d(input_shape=signal.shape, out_channels=1, kernel_size=3, stride=2, padding='same') >>> signal_rec = conv_t(signal) >>> signal_rec.shape torch.Size([1, 115]) >>> signal = torch.rand([1,115]) #[batch, time] >>> conv_t = ConvTranspose1d(input_shape=signal.shape, out_channels=1, kernel_size=7, stride=2, padding='valid') >>> signal_rec = conv_t(signal) >>> signal_rec.shape torch.Size([1, 235]) >>> signal = torch.rand([1,115]) #[batch, time] >>> conv_t = ConvTranspose1d(input_shape=signal.shape, out_channels=1, kernel_size=7, stride=2, padding='factor') >>> signal_rec = conv_t(signal) >>> signal_rec.shape torch.Size([1, 231]) >>> signal = torch.rand([1,115]) #[batch, time] >>> conv_t = ConvTranspose1d(input_shape=signal.shape, out_channels=1, kernel_size=3, stride=2, padding=10) >>> signal_rec = conv_t(signal) >>> signal_rec.shape torch.Size([1, 211]) """ def __init__( self, out_channels, kernel_size, input_shape=None, in_channels=None, stride=1, dilation=1, padding=0, output_padding=0, groups=1, bias=True, skip_transpose=False, ): super().__init__() self.kernel_size = kernel_size self.stride = stride self.dilation = dilation self.padding = padding self.unsqueeze = False self.skip_transpose = skip_transpose if input_shape is None and in_channels is None: raise ValueError("Must provide one of input_shape or in_channels") if in_channels is None: in_channels = self._check_input_shape(input_shape) if self.padding == "same": L_in = input_shape[-1] if skip_transpose else input_shape[1] padding_value = get_padding_elem_transposed( L_in, L_in, stride=stride, kernel_size=kernel_size, dilation=dilation, output_padding=output_padding, ) elif self.padding == "factor": L_in = input_shape[-1] if skip_transpose else input_shape[1] padding_value = get_padding_elem_transposed( L_in * stride, L_in, stride=stride, kernel_size=kernel_size, dilation=dilation, output_padding=output_padding, ) elif self.padding == "valid": padding_value = 0 elif type(self.padding) is int: padding_value = padding else: raise ValueError("Not supported padding type") self.conv = nn.ConvTranspose1d( in_channels, out_channels, self.kernel_size, stride=self.stride, dilation=self.dilation, padding=padding_value, groups=groups, bias=bias, ) def forward(self, x, output_size=None): """Returns the output of the convolution. Arguments --------- x : torch.Tensor (batch, time, channel) input to convolve. 2d or 4d tensors are expected. """ if not self.skip_transpose: x = x.transpose(1, -1) if self.unsqueeze: x = x.unsqueeze(1) wx = self.conv(x, output_size=output_size) if self.unsqueeze: wx = wx.squeeze(1) if not self.skip_transpose: wx = wx.transpose(1, -1) return wx def _check_input_shape(self, shape): """Checks the input shape and returns the number of input channels. """ if len(shape) == 2: self.unsqueeze = True in_channels = 1 elif self.skip_transpose: in_channels = shape[1] elif len(shape) == 3: in_channels = shape[2] else: raise ValueError( "conv1d expects 2d, 3d inputs. Got " + str(len(shape)) ) return in_channels class DepthwiseSeparableConv1d(nn.Module): """This class implements the depthwise separable 1d convolution. First, a channel-wise convolution is applied to the input Then, a point-wise convolution to project the input to output Arguments --------- out_channels : int It is the number of output channels. kernel_size : int Kernel size of the convolutional filters. input_shape : tuple Expected shape of the input. stride : int Stride factor of the convolutional filters. When the stride factor > 1, a decimation in time is performed. dilation : int Dilation factor of the convolutional filters. padding : str (same, valid, causal). If "valid", no padding is performed. If "same" and stride is 1, output shape is the same as the input shape. "causal" results in causal (dilated) convolutions. padding_mode : str This flag specifies the type of padding. See torch.nn documentation for more information. bias : bool If True, the additive bias b is adopted. Example ------- >>> inp = torch.randn([8, 120, 40]) >>> conv = DepthwiseSeparableConv1d(256, 3, input_shape=inp.shape) >>> out = conv(inp) >>> out.shape torch.Size([8, 120, 256]) """ def __init__( self, out_channels, kernel_size, input_shape, stride=1, dilation=1, padding="same", bias=True, ): super().__init__() assert len(input_shape) == 3, "input must be a 3d tensor" bz, time, chn = input_shape self.depthwise = Conv1d( chn, kernel_size, input_shape=input_shape, stride=stride, dilation=dilation, padding=padding, groups=chn, bias=bias, ) self.pointwise = Conv1d( out_channels, kernel_size=1, input_shape=input_shape, ) def forward(self, x): """Returns the output of the convolution. Arguments --------- x : torch.Tensor (batch, time, channel) input to convolve. 3d tensors are expected. """ return self.pointwise(self.depthwise(x)) class DepthwiseSeparableConv2d(nn.Module): """This class implements the depthwise separable 2d convolution. First, a channel-wise convolution is applied to the input Then, a point-wise convolution to project the input to output Arguments --------- ut_channels : int It is the number of output channels. kernel_size : int Kernel size of the convolutional filters. stride : int Stride factor of the convolutional filters. When the stride factor > 1, a decimation in time is performed. dilation : int Dilation factor of the convolutional filters. padding : str (same, valid, causal). If "valid", no padding is performed. If "same" and stride is 1, output shape is the same as the input shape. "causal" results in causal (dilated) convolutions. padding_mode : str This flag specifies the type of padding. See torch.nn documentation for more information. bias : bool If True, the additive bias b is adopted. Example ------- >>> inp = torch.randn([8, 120, 40, 1]) >>> conv = DepthwiseSeparableConv2d(256, (3, 3), input_shape=inp.shape) >>> out = conv(inp) >>> out.shape torch.Size([8, 120, 40, 256]) """ def __init__( self, out_channels, kernel_size, input_shape, stride=(1, 1), dilation=(1, 1), padding="same", bias=True, ): super().__init__() # handle the case if some parameter is int if isinstance(kernel_size, int): kernel_size = (kernel_size, kernel_size) if isinstance(stride, int): stride = (stride, stride) if isinstance(dilation, int): dilation = (dilation, dilation) assert len(input_shape) in {3, 4}, "input must be a 3d or 4d tensor" self.unsqueeze = len(input_shape) == 3 bz, time, chn1, chn2 = input_shape self.depthwise = Conv2d( chn2, kernel_size, input_shape=input_shape, stride=stride, dilation=dilation, padding=padding, groups=chn2, bias=bias, ) self.pointwise = Conv2d( out_channels, kernel_size=(1, 1), input_shape=input_shape, ) def forward(self, x): """Returns the output of the convolution. Arguments --------- x : torch.Tensor (batch, time, channel) input to convolve. 3d tensors are expected. """ if self.unsqueeze: x = x.unsqueeze(1) out = self.pointwise(self.depthwise(x)) if self.unsqueeze: out = out.squeeze(1) return out def get_padding_elem(L_in: int, stride: int, kernel_size: int, dilation: int): """This function computes the number of elements to add for zero-padding. Arguments --------- L_in : int stride: int kernel_size : int dilation : int """ if stride > 1: n_steps = math.ceil(((L_in - kernel_size * dilation) / stride) + 1) L_out = stride * (n_steps - 1) + kernel_size * dilation padding = [kernel_size // 2, kernel_size // 2] else: L_out = (L_in - dilation * (kernel_size - 1) - 1) // stride + 1 padding = [(L_in - L_out) // 2, (L_in - L_out) // 2] return padding def get_padding_elem_transposed( L_out: int, L_in: int, stride: int, kernel_size: int, dilation: int, output_padding: int, ): """This function computes the required padding size for transposed convolution Arguments --------- L_out : int L_in : int stride: int kernel_size : int dilation : int output_padding : int """ padding = -0.5 * ( L_out - (L_in - 1) * stride - dilation * (kernel_size - 1) - output_padding - 1 ) return int(padding)
30.192208
117
0.583993
4,304
34,872
4.586664
0.091543
0.052682
0.01702
0.018996
0.752748
0.719113
0.709133
0.689276
0.674434
0.659997
0
0.021119
0.323784
34,872
1,154
118
30.218371
0.816038
0.444741
0
0.635294
0
0
0.045711
0
0
0
0
0
0.003922
1
0.052941
false
0.019608
0.013725
0
0.117647
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
b8d977710a0aad2f67226de6775a0ab5069bfa9c
1,426
py
Python
Coursera/Week.9/Task.3.py
v1nnyb0y/Coursera.BasePython
bbfb3184dc27a4cdb16b087123890991afbc5506
[ "MIT" ]
null
null
null
Coursera/Week.9/Task.3.py
v1nnyb0y/Coursera.BasePython
bbfb3184dc27a4cdb16b087123890991afbc5506
[ "MIT" ]
null
null
null
Coursera/Week.9/Task.3.py
v1nnyb0y/Coursera.BasePython
bbfb3184dc27a4cdb16b087123890991afbc5506
[ "MIT" ]
null
null
null
''' Ошибки, транспонирование ''' from sys import stdin from copy import deepcopy class MatrixError(BaseException): def __init__(self, matrix_1, matrix_2): self.matrix1 = matrix_1 self.matrix2 = matrix_2 class Matrix: def __init__(self, a): self.matr = deepcopy(a) def __str__(self): return '\n'.join(['\t'.join(map(str, list)) for list in self.matr]) def size(self): return (len(self.matr), len(self.matr[0])) def __add__(self, add_matr): if len(self.matr) == len(add_matr.matr): lenght = len(self.matr[0]) for row in self.matr: if len(row) != lenght: raise MatrixError(self, add_matr) for row2 in add_matr.matr: if len(row2) != lenght: raise MatrixError(self, add_matr) return Matrix(list(map( lambda x, y: list(map(lambda z, w: z + w, x, y)), self.matr, add_matr.matr))) else: raise MatrixError(self, add_matr) def __mul__(self, mul_matr): return Matrix([[i * mul_matr for i in list] for list in self.matr]) def transpose(self): self.matr = list(zip(*self.matr)) return Matrix(self.matr) @staticmethod def transposed(matrix): return Matrix(list(zip(*matrix.matr))) __rmul__ = __mul__ exec(stdin.read())
26.407407
75
0.565217
186
1,426
4.112903
0.290323
0.12549
0.057516
0.090196
0.184314
0.14902
0.062745
0
0
0
0
0.010235
0.314867
1,426
53
76
26.90566
0.772774
0.01683
0
0.081081
0
0
0.002869
0
0
0
0
0
0
1
0.216216
false
0
0.054054
0.108108
0.513514
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
b8deea8012ac76a2d2f315bb5d55407d3bb13dd1
399
py
Python
openpyexcel/workbook/external_reference.py
sciris/openpyexcel
1fde667a1adc2f4988279fd73a2ac2660706b5ce
[ "MIT" ]
2
2019-07-03T06:37:42.000Z
2020-05-15T00:28:13.000Z
openpyexcel/workbook/external_reference.py
sciris/openpyexcel
1fde667a1adc2f4988279fd73a2ac2660706b5ce
[ "MIT" ]
null
null
null
openpyexcel/workbook/external_reference.py
sciris/openpyexcel
1fde667a1adc2f4988279fd73a2ac2660706b5ce
[ "MIT" ]
1
2020-01-06T10:01:42.000Z
2020-01-06T10:01:42.000Z
from __future__ import absolute_import # Copyright (c) 2010-2019 openpyexcel from openpyexcel.descriptors.serialisable import Serialisable from openpyexcel.descriptors import ( Sequence ) from openpyexcel.descriptors.excel import ( Relation, ) class ExternalReference(Serialisable): tagname = "externalReference" id = Relation() def __init__(self, id): self.id = id
19.95
61
0.746867
41
399
7.04878
0.512195
0.155709
0.269896
0
0
0
0
0
0
0
0
0.024465
0.180451
399
19
62
21
0.859327
0.087719
0
0
0
0
0.046961
0
0
0
0
0
0
1
0.076923
false
0
0.307692
0
0.615385
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
b8f537aaaa3af69181ab6e183968be0d905fb415
152
py
Python
competicao/apps.py
pedrocarvalhoaguiar/projetoOCBDMS
25182d5258affb0d93ca30266f03ab20680f6c85
[ "MIT" ]
null
null
null
competicao/apps.py
pedrocarvalhoaguiar/projetoOCBDMS
25182d5258affb0d93ca30266f03ab20680f6c85
[ "MIT" ]
null
null
null
competicao/apps.py
pedrocarvalhoaguiar/projetoOCBDMS
25182d5258affb0d93ca30266f03ab20680f6c85
[ "MIT" ]
null
null
null
from django.apps import AppConfig class CompeticaoConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'competicao'
21.714286
56
0.769737
17
152
6.764706
0.882353
0
0
0
0
0
0
0
0
0
0
0
0.144737
152
6
57
25.333333
0.884615
0
0
0
0
0
0.256579
0.190789
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
770752c5b9142fe1823fe9490d50f34218a5494a
5,042
py
Python
blazar-3.0.0/blazar/db/utils.py
scottwedge/OpenStack-Stein
7077d1f602031dace92916f14e36b124f474de15
[ "Apache-2.0" ]
null
null
null
blazar-3.0.0/blazar/db/utils.py
scottwedge/OpenStack-Stein
7077d1f602031dace92916f14e36b124f474de15
[ "Apache-2.0" ]
5
2019-08-14T06:46:03.000Z
2021-12-13T20:01:25.000Z
blazar-3.0.0/blazar/db/utils.py
scottwedge/OpenStack-Stein
7077d1f602031dace92916f14e36b124f474de15
[ "Apache-2.0" ]
2
2020-03-15T01:24:15.000Z
2020-07-22T20:34:26.000Z
# -*- coding: utf-8 -*- # # Author: François Rossigneux <francois.rossigneux@inria.fr> # # 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. """Defines interface for DB access. Functions in this module are imported into the blazar.db namespace. Call these functions from blazar.db namespace, not the blazar.db.api namespace. All functions in this module return objects that implement a dictionary-like interface. **Related Flags** :db_backend: string to lookup in the list of LazyPluggable backends. `sqlalchemy` is the only supported backend right now. :sql_connection: string specifying the sqlalchemy connection to use, like: `sqlite:///var/lib/blazar/blazar.sqlite`. """ from oslo_config import cfg from oslo_db import api as db_api from oslo_log import log as logging _BACKEND_MAPPING = { 'sqlalchemy': 'blazar.db.sqlalchemy.utils', } IMPL = db_api.DBAPI(cfg.CONF.database.backend, backend_mapping=_BACKEND_MAPPING) LOG = logging.getLogger(__name__) def setup_db(): """Set up database, create tables, etc. Return True on success, False otherwise """ return IMPL.setup_db() def drop_db(): """Drop database. Return True on success, False otherwise """ return IMPL.drop_db() # Helpers for building constraints / equality checks def constraint(**conditions): """Return a constraint object suitable for use with some updates.""" return IMPL.constraint(**conditions) def equal_any(*values): """Return an equality condition object suitable for use in a constraint. Equal_any conditions require that a model object's attribute equal any one of the given values. """ return IMPL.equal_any(*values) def not_equal(*values): """Return an inequality condition object suitable for use in a constraint. Not_equal conditions require that a model object's attribute differs from all of the given values. """ return IMPL.not_equal(*values) def to_dict(func): def decorator(*args, **kwargs): res = func(*args, **kwargs) if isinstance(res, list): return [item.to_dict() for item in res] if res: return res.to_dict() else: return None return decorator def get_reservations_by_host_id(host_id, start_date, end_date): return IMPL.get_reservations_by_host_id(host_id, start_date, end_date) def get_reservations_by_host_ids(host_ids, start_date, end_date): return IMPL.get_reservations_by_host_ids(host_ids, start_date, end_date) def get_reservation_allocations_by_host_ids(host_ids, start_date, end_date, lease_id=None, reservation_id=None): return IMPL.get_reservation_allocations_by_host_ids(host_ids, start_date, end_date, lease_id, reservation_id) def get_plugin_reservation(resource_type, resource_id): return IMPL.get_plugin_reservation(resource_type, resource_id) def get_free_periods(resource_id, start_date, end_date, duration, resource_type='host'): """Returns a list of free periods.""" return IMPL.get_free_periods(resource_id, start_date, end_date, duration, resource_type=resource_type) def get_reserved_periods(resource_id, start_date, end_date, duration, resource_type='host'): """Returns a list of reserved periods.""" return IMPL.get_reserved_periods(resource_id, start_date, end_date, duration, resource_type=resource_type) def reservation_ratio(resource_id, start_date, end_date): return IMPL.reservation_ratio(resource_id, start_date, end_date) def availability_time(resource_id, start_date, end_date): return IMPL.availability_time(resource_id, start_date, end_date) def reservation_time(resource_id, start_date, end_date): return IMPL.reservation_time(resource_id, start_date, end_date) def number_of_reservations(resource_id, start_date, end_date): return IMPL.number_of_reservations(resource_id, start_date, end_date) def longest_lease(resource_id, start_date, end_date): return IMPL.longest_lease(resource_id, start_date, end_date) def shortest_lease(resource_id, start_date, end_date): return IMPL.shortest_lease(resource_id, start_date, end_date)
30.932515
78
0.694169
676
5,042
4.939349
0.284024
0.059299
0.079066
0.105421
0.484576
0.483678
0.466307
0.438455
0.286912
0.193471
0
0.001286
0.229076
5,042
162
79
31.123457
0.857731
0.360968
0
0.032258
0
0
0.014103
0.008333
0
0
0
0
0
1
0.306452
false
0
0.048387
0.16129
0.693548
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
7720691e7db7c7dd1f9fe2f7ea22dae29f24557f
73
py
Python
by-session/ta-921/j1/turtle7.py
amiraliakbari/sharif-mabani-python
5d14a08d165267fe71c28389ddbafe29af7078c5
[ "MIT" ]
2
2015-04-29T20:59:35.000Z
2018-09-26T13:33:43.000Z
by-session/ta-921/j1/turtle7.py
amiraliakbari/sharif-mabani-python
5d14a08d165267fe71c28389ddbafe29af7078c5
[ "MIT" ]
null
null
null
by-session/ta-921/j1/turtle7.py
amiraliakbari/sharif-mabani-python
5d14a08d165267fe71c28389ddbafe29af7078c5
[ "MIT" ]
null
null
null
x = 2 print "salam!" for i in range(10): print x, x = x * 2
12.166667
20
0.465753
14
73
2.428571
0.642857
0.117647
0
0
0
0
0
0
0
0
0
0.090909
0.39726
73
5
21
14.6
0.681818
0
0
0
0
0
0.088235
0
0
0
0
0
0
0
null
null
0
0
null
null
0.4
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
773e5809b4337fbdb27cbd804bc562f277d2411a
11,738
py
Python
gewittergefahr/gg_utils/time_conversion_test.py
dopplerchase/GewitterGefahr
4415b08dd64f37eba5b1b9e8cc5aa9af24f96593
[ "MIT" ]
26
2018-10-04T01:07:35.000Z
2022-01-29T08:49:32.000Z
gewittergefahr/gg_utils/time_conversion_test.py
liuximarcus/GewitterGefahr
d819874d616f98a25187bfd3091073a2e6d5279e
[ "MIT" ]
4
2017-12-25T02:01:08.000Z
2018-12-19T01:54:21.000Z
gewittergefahr/gg_utils/time_conversion_test.py
liuximarcus/GewitterGefahr
d819874d616f98a25187bfd3091073a2e6d5279e
[ "MIT" ]
11
2017-12-10T23:05:29.000Z
2022-01-29T08:49:33.000Z
"""Unit tests for time_conversion.py.""" import unittest from gewittergefahr.gg_utils import time_conversion TIME_FORMAT_YEAR = '%Y' TIME_FORMAT_NUMERIC_MONTH = '%m' TIME_FORMAT_3LETTER_MONTH = '%b' TIME_FORMAT_YEAR_MONTH = '%Y-%m' TIME_FORMAT_DAY_OF_MONTH = '%d' TIME_FORMAT_DATE = '%Y-%m-%d' TIME_FORMAT_HOUR = '%Y-%m-%d-%H00' TIME_FORMAT_MINUTE = '%Y-%m-%d-%H%M' TIME_FORMAT_SECOND = '%Y-%m-%d-%H%M%S' TIME_STRING_YEAR = '2017' TIME_STRING_NUMERIC_MONTH = '09' TIME_STRING_3LETTER_MONTH = 'Sep' TIME_STRING_YEAR_MONTH = '2017-09' TIME_STRING_DAY_OF_MONTH = '26' TIME_STRING_DATE = '2017-09-26' TIME_STRING_HOUR = '2017-09-26-0500' TIME_STRING_MINUTE = '2017-09-26-0520' TIME_STRING_SECOND = '2017-09-26-052033' UNIX_TIME_YEAR_SEC = 1483228800 UNIX_TIME_MONTH_SEC = 1504224000 UNIX_TIME_DATE_SEC = 1506384000 UNIX_TIME_HOUR_SEC = 1506402000 UNIX_TIME_MINUTE_SEC = 1506403200 UNIX_TIME_SEC = 1506403233 START_TIME_SEP2017_UNIX_SEC = 1504224000 END_TIME_SEP2017_UNIX_SEC = 1506815999 START_TIME_2017_UNIX_SEC = 1483228800 END_TIME_2017_UNIX_SEC = 1514764799 TIME_1200UTC_SPC_DATE_UNIX_SEC = 1506340800 TIME_0000UTC_SPC_DATE_UNIX_SEC = 1506384000 TIME_115959UTC_SPC_DATE_UNIX_SEC = 1506427199 SPC_DATE_UNIX_SEC = 1506362400 SPC_DATE_STRING = '20170925' FIRST_SPC_DATE_STRING = '20170925' LAST_SPC_DATE_STRING = '20171001' ALL_SPC_DATE_STRINGS = [ '20170925', '20170926', '20170927', '20170928', '20170929', '20170930', '20171001'] TIME_115959UTC_BEFORE_DATE_UNIX_SEC = 1506340799 TIME_1200UTC_AFTER_DATE_UNIX_SEC = 1506427200 class TimeConversionTests(unittest.TestCase): """Each method is a unit test for time_conversion.py.""" def test_string_to_unix_sec_year(self): """Ensures correctness of string_to_unix_sec; string = year only.""" this_time_unix_sec = time_conversion.string_to_unix_sec( TIME_STRING_YEAR, TIME_FORMAT_YEAR) self.assertTrue(this_time_unix_sec == UNIX_TIME_YEAR_SEC) def test_string_to_unix_sec_year_month(self): """Ensures correctness of string_to_unix_sec; string = year-month.""" this_time_unix_sec = time_conversion.string_to_unix_sec( TIME_STRING_YEAR_MONTH, TIME_FORMAT_YEAR_MONTH) self.assertTrue(this_time_unix_sec == UNIX_TIME_MONTH_SEC) def test_string_to_unix_sec_date(self): """Ensures correctness of string_to_unix_sec; string = full date.""" this_time_unix_sec = time_conversion.string_to_unix_sec( TIME_STRING_DATE, TIME_FORMAT_DATE) self.assertTrue(this_time_unix_sec == UNIX_TIME_DATE_SEC) def test_string_to_unix_sec_hour(self): """Ensures correctness of string_to_unix_sec; string = full hour.""" this_time_unix_sec = time_conversion.string_to_unix_sec( TIME_STRING_HOUR, TIME_FORMAT_HOUR) self.assertTrue(this_time_unix_sec == UNIX_TIME_HOUR_SEC) def test_string_to_unix_sec_minute(self): """Ensures correctness of string_to_unix_sec; string = full minute.""" this_time_unix_sec = time_conversion.string_to_unix_sec( TIME_STRING_MINUTE, TIME_FORMAT_MINUTE) self.assertTrue(this_time_unix_sec == UNIX_TIME_MINUTE_SEC) def test_string_to_unix_sec_second(self): """Ensures correctness of string_to_unix_sec; string = full second.""" this_time_unix_sec = time_conversion.string_to_unix_sec( TIME_STRING_SECOND, TIME_FORMAT_SECOND) self.assertTrue(this_time_unix_sec == UNIX_TIME_SEC) def test_unix_sec_to_string_year(self): """Ensures correctness of unix_sec_to_string; string = year only.""" this_time_string = time_conversion.unix_sec_to_string( UNIX_TIME_SEC, TIME_FORMAT_YEAR) self.assertTrue(this_time_string == TIME_STRING_YEAR) def test_unix_sec_to_string_numeric_month(self): """Ensures correctness of unix_sec_to_string; string = numeric month.""" this_time_string = time_conversion.unix_sec_to_string( UNIX_TIME_SEC, TIME_FORMAT_NUMERIC_MONTH) self.assertTrue(this_time_string == TIME_STRING_NUMERIC_MONTH) def test_unix_sec_to_string_3letter_month(self): """Ensures correctness of unix_sec_to_string; string = 3-lttr month.""" this_time_string = time_conversion.unix_sec_to_string( UNIX_TIME_SEC, TIME_FORMAT_3LETTER_MONTH) self.assertTrue(this_time_string == TIME_STRING_3LETTER_MONTH) def test_unix_sec_to_string_year_month(self): """Ensures correctness of unix_sec_to_string; string = year-month.""" this_time_string = time_conversion.unix_sec_to_string( UNIX_TIME_SEC, TIME_FORMAT_YEAR_MONTH) self.assertTrue(this_time_string == TIME_STRING_YEAR_MONTH) def test_unix_sec_to_string_day_of_month(self): """Ensures correctness of unix_sec_to_string; string = day of month.""" this_time_string = time_conversion.unix_sec_to_string( UNIX_TIME_SEC, TIME_FORMAT_DAY_OF_MONTH) self.assertTrue(this_time_string == TIME_STRING_DAY_OF_MONTH) def test_unix_sec_to_string_date(self): """Ensures correctness of unix_sec_to_string; string = full date.""" this_time_string = time_conversion.unix_sec_to_string( UNIX_TIME_SEC, TIME_FORMAT_DATE) self.assertTrue(this_time_string == TIME_STRING_DATE) def test_unix_sec_to_string_hour(self): """Ensures correctness of unix_sec_to_string; string = full hour.""" this_time_string = time_conversion.unix_sec_to_string( UNIX_TIME_SEC, TIME_FORMAT_HOUR) self.assertTrue(this_time_string == TIME_STRING_HOUR) def test_unix_sec_to_string_minute(self): """Ensures correctness of unix_sec_to_string; string = full minute.""" this_time_string = time_conversion.unix_sec_to_string( UNIX_TIME_SEC, TIME_FORMAT_MINUTE) self.assertTrue(this_time_string == TIME_STRING_MINUTE) def test_unix_sec_to_string_second(self): """Ensures correctness of unix_sec_to_string; string = full second.""" this_time_string = time_conversion.unix_sec_to_string( UNIX_TIME_SEC, TIME_FORMAT_SECOND) self.assertTrue(this_time_string == TIME_STRING_SECOND) def test_time_to_spc_date_unix_sec_1200utc(self): """Ensures correctness of time_to_spc_date_unix_sec; time = 1200 UTC.""" this_spc_date_unix_sec = time_conversion.time_to_spc_date_unix_sec( TIME_1200UTC_SPC_DATE_UNIX_SEC) self.assertTrue(this_spc_date_unix_sec == SPC_DATE_UNIX_SEC) def test_time_to_spc_date_unix_sec_0000utc(self): """Ensures correctness of time_to_spc_date_unix_sec; time = 0000 UTC.""" this_spc_date_unix_sec = time_conversion.time_to_spc_date_unix_sec( TIME_0000UTC_SPC_DATE_UNIX_SEC) self.assertTrue(this_spc_date_unix_sec == SPC_DATE_UNIX_SEC) def test_time_to_spc_date_unix_sec_115959utc(self): """Ensures crrctness of time_to_spc_date_unix_sec; time = 115959 UTC.""" this_spc_date_unix_sec = time_conversion.time_to_spc_date_unix_sec( TIME_115959UTC_SPC_DATE_UNIX_SEC) self.assertTrue(this_spc_date_unix_sec == SPC_DATE_UNIX_SEC) def test_time_to_spc_date_string_1200utc(self): """Ensures correctness of time_to_spc_date_string; time = 1200 UTC.""" this_spc_date_string = time_conversion.time_to_spc_date_string( TIME_1200UTC_SPC_DATE_UNIX_SEC) self.assertTrue(this_spc_date_string == SPC_DATE_STRING) def test_time_to_spc_date_string_0000utc(self): """Ensures correctness of time_to_spc_date_string; time = 0000 UTC.""" this_spc_date_string = time_conversion.time_to_spc_date_string( TIME_0000UTC_SPC_DATE_UNIX_SEC) self.assertTrue(this_spc_date_string == SPC_DATE_STRING) def test_time_to_spc_date_string_115959utc(self): """Ensures correctness of time_to_spc_date_string; time = 115959 UTC.""" this_spc_date_string = time_conversion.time_to_spc_date_string( TIME_115959UTC_SPC_DATE_UNIX_SEC) self.assertTrue(this_spc_date_string == SPC_DATE_STRING) def test_spc_date_string_to_unix_sec(self): """Ensures correct output from spc_date_string_to_unix_sec.""" this_spc_date_unix_sec = time_conversion.spc_date_string_to_unix_sec( SPC_DATE_STRING) self.assertTrue(this_spc_date_unix_sec == SPC_DATE_UNIX_SEC) def test_get_spc_dates_in_range_one_date(self): """Ensures correct output from get_spc_dates_in_range. In this case, there is only one date in the range. """ these_spc_date_strings = time_conversion.get_spc_dates_in_range( first_spc_date_string=FIRST_SPC_DATE_STRING, last_spc_date_string=FIRST_SPC_DATE_STRING) self.assertTrue(these_spc_date_strings == [FIRST_SPC_DATE_STRING]) def test_get_spc_dates_in_range_many_dates(self): """Ensures correct output from get_spc_dates_in_range. In this case, there are many dates in the range. """ these_spc_date_strings = time_conversion.get_spc_dates_in_range( first_spc_date_string=FIRST_SPC_DATE_STRING, last_spc_date_string=LAST_SPC_DATE_STRING) self.assertTrue(these_spc_date_strings == ALL_SPC_DATE_STRINGS) def test_is_time_in_spc_date_beginning(self): """Ensures correct output from is_time_in_spc_date. In this case, time is at beginning of SPC date. """ self.assertTrue(time_conversion.is_time_in_spc_date( TIME_1200UTC_SPC_DATE_UNIX_SEC, SPC_DATE_STRING)) def test_is_time_in_spc_date_middle(self): """Ensures correct output from is_time_in_spc_date. In this case, time is in middle of SPC date. """ self.assertTrue(time_conversion.is_time_in_spc_date( TIME_0000UTC_SPC_DATE_UNIX_SEC, SPC_DATE_STRING)) def test_is_time_in_spc_date_end(self): """Ensures correct output from is_time_in_spc_date. In this case, time is at end of SPC date. """ self.assertTrue(time_conversion.is_time_in_spc_date( TIME_115959UTC_SPC_DATE_UNIX_SEC, SPC_DATE_STRING)) def test_is_time_in_spc_date_before(self): """Ensures correct output from is_time_in_spc_date. In this case, time is before SPC date. """ self.assertFalse(time_conversion.is_time_in_spc_date( TIME_115959UTC_BEFORE_DATE_UNIX_SEC, SPC_DATE_STRING)) def test_is_time_in_spc_date_after(self): """Ensures correct output from is_time_in_spc_date. In this case, time is after SPC date. """ self.assertFalse(time_conversion.is_time_in_spc_date( TIME_1200UTC_AFTER_DATE_UNIX_SEC, SPC_DATE_STRING)) def test_first_and_last_times_in_month(self): """Ensures correct output from first_and_last_times_in_month.""" this_start_time_unix_sec, this_end_time_unix_sec = ( time_conversion.first_and_last_times_in_month(UNIX_TIME_MONTH_SEC)) self.assertTrue(this_start_time_unix_sec == START_TIME_SEP2017_UNIX_SEC) self.assertTrue(this_end_time_unix_sec == END_TIME_SEP2017_UNIX_SEC) def test_first_and_last_times_in_year(self): """Ensures correct output from first_and_last_times_in_year.""" this_start_time_unix_sec, this_end_time_unix_sec = ( time_conversion.first_and_last_times_in_year(2017)) self.assertTrue(this_start_time_unix_sec == START_TIME_2017_UNIX_SEC) self.assertTrue(this_end_time_unix_sec == END_TIME_2017_UNIX_SEC) if __name__ == '__main__': unittest.main()
39.521886
80
0.742205
1,739
11,738
4.446233
0.06843
0.103207
0.065572
0.061562
0.836265
0.794232
0.746896
0.656881
0.586653
0.555872
0
0.049749
0.18487
11,738
296
81
39.655405
0.758361
0.195093
0
0.267857
0
0
0.024555
0
0
0
0
0
0.196429
1
0.184524
false
0
0.011905
0
0.202381
0
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
774e41a6aa266984f80ac00aa490f63c006a7c52
1,316
py
Python
toybox/toys/crystals.py
bm424/diffraction-toybox
d37b80c8282e53a007f182318257efe78931bc00
[ "MIT" ]
null
null
null
toybox/toys/crystals.py
bm424/diffraction-toybox
d37b80c8282e53a007f182318257efe78931bc00
[ "MIT" ]
null
null
null
toybox/toys/crystals.py
bm424/diffraction-toybox
d37b80c8282e53a007f182318257efe78931bc00
[ "MIT" ]
null
null
null
import collections import numpy as np from toybox.toys.core import Pattern class BiCrystal(collections.MutableSequence): def __init__(self, pattern1, pattern2, profile=np.linspace(0, 1, 11)): self.pattern_1 = pattern1 self.pattern_2 = pattern2 self.profile = profile @property def profile(self): return self._profile @profile.setter def profile(self, profile): if np.max(profile) > 1 or np.min(profile) < 0: raise ValueError("Profile must be between 0 and 1.") self._profile = profile @property def profile_i(self): return 1. - self.profile @property def patterns(self): return np.array([p * self.pattern_2 + q * self.pattern_1 for p, q in zip(self.profile, self.profile_i)]) def __len__(self): return len(self.profile) def __getitem__(self, item): return self.patterns[item].view(Pattern) def __setitem__(self, key, value): if value > 1 or value < 0: raise ValueError("Profile must be between 0 and 1.") self.profile[key] = value def __delitem__(self, key): self.profile = np.delete(self.profile, key, None) def insert(self, index, value): self.profile = np.insert(self.profile, index, value)
20.246154
112
0.629939
173
1,316
4.630058
0.32948
0.178527
0.067416
0.064919
0.205993
0.205993
0.129838
0.129838
0.129838
0.129838
0
0.021762
0.266717
1,316
64
113
20.5625
0.80829
0
0
0.147059
0
0
0.049307
0
0
0
0
0
0
1
0.294118
false
0
0.088235
0.147059
0.558824
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
91f295cbbe2ca26555f2120e3e497e0cfde5116d
685
py
Python
samples/misc/opencv_samples/mqtt_cam/helpers.py
sintefneodroid/vision
a4e66251ead99f15f4697bfe2abd00e2f388e743
[ "Apache-2.0" ]
null
null
null
samples/misc/opencv_samples/mqtt_cam/helpers.py
sintefneodroid/vision
a4e66251ead99f15f4697bfe2abd00e2f388e743
[ "Apache-2.0" ]
1
2022-03-12T01:08:08.000Z
2022-03-12T01:08:08.000Z
samples/misc/opencv_samples/mqtt_cam/helpers.py
sintefneodroid/vision
a4e66251ead99f15f4697bfe2abd00e2f388e743
[ "Apache-2.0" ]
null
null
null
""" Helper functions. Source -> https://github.com/jrosebr1/imutils/blob/master/imutils/video/webcamvideostream.py """ import datetime import io import yaml from PIL import Image DATETIME_STR_FORMAT = "%Y-%m-%d_%H:%M:%S.%f" def pil_image_to_byte_array(image): imgByteArr = io.BytesIO() image.save(imgByteArr, "PNG") return imgByteArr.getvalue() def byte_array_to_pil_image(byte_array): return Image.open(io.BytesIO(byte_array)) def get_now_string() -> str: return datetime.datetime.now().strftime(DATETIME_STR_FORMAT) def get_config(config_filepath: str) -> dict: with open(config_filepath) as f: config = yaml.safe_load(f) return config
20.757576
92
0.728467
99
685
4.828283
0.505051
0.075314
0.07113
0
0
0
0
0
0
0
0
0.001709
0.145985
685
32
93
21.40625
0.815385
0.162044
0
0
0
0
0.040636
0
0
0
0
0
0
1
0.235294
false
0
0.235294
0.117647
0.705882
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
6204f29b93c74e614de6a6106ed246b86430caa1
164
py
Python
hackerrank/4. sets/12.py
Eurydia/Xian-assignment
4a7e4bcd3d4999ea7429054fec1792064c96ff30
[ "MIT" ]
null
null
null
hackerrank/4. sets/12.py
Eurydia/Xian-assignment
4a7e4bcd3d4999ea7429054fec1792064c96ff30
[ "MIT" ]
null
null
null
hackerrank/4. sets/12.py
Eurydia/Xian-assignment
4a7e4bcd3d4999ea7429054fec1792064c96ff30
[ "MIT" ]
null
null
null
n = int(input()) for i in range(n): a = input() set1 = set(input().split()) b = input() set2 = set(input().split()) print(set1.issubset(set2))
18.222222
31
0.536585
24
164
3.666667
0.625
0.181818
0.295455
0
0
0
0
0
0
0
0
0.03252
0.25
164
8
32
20.5
0.682927
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.142857
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
6211a76f189fa8725843fac8503a99cd785e4a2f
526
py
Python
src/client/ui/widget/_widget.py
Tubular-Terriers/code-jam
be706c485110ee49727ec33d07b5d8fef7cf49e1
[ "MIT" ]
1
2021-07-20T17:01:43.000Z
2021-07-20T17:01:43.000Z
src/client/ui/widget/_widget.py
Tubular-Terriers/code-jam
be706c485110ee49727ec33d07b5d8fef7cf49e1
[ "MIT" ]
null
null
null
src/client/ui/widget/_widget.py
Tubular-Terriers/code-jam
be706c485110ee49727ec33d07b5d8fef7cf49e1
[ "MIT" ]
null
null
null
# The base class for all widgets class Widget: def __init__(self, name): self.name = name pass def press_on(self, key): """Called with the argument `key`""" pass def release_on(self, k): pass # Text related methods def start_text_on(self, k): pass def update_text_on(self, k): pass def end_text_on(self, k): pass def refresh(self): if self.window: self.window.noutrefresh()
18.137931
45
0.528517
66
526
4.030303
0.454545
0.131579
0.105263
0.165414
0.203008
0.203008
0
0
0
0
0
0
0.38403
526
28
46
18.785714
0.820988
0.157795
0
0.352941
0
0
0
0
0
0
0
0
0
1
0.411765
false
0.352941
0
0
0.470588
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
3
622f7389d233b8699cd1a870690fd663fb0ac244
362
py
Python
Functions/lambdaCalculator.py
poojavaibhavsahu/Pooja_Python
58122bfa8586883145042b11fe1cc013c803ab4f
[ "bzip2-1.0.6" ]
null
null
null
Functions/lambdaCalculator.py
poojavaibhavsahu/Pooja_Python
58122bfa8586883145042b11fe1cc013c803ab4f
[ "bzip2-1.0.6" ]
null
null
null
Functions/lambdaCalculator.py
poojavaibhavsahu/Pooja_Python
58122bfa8586883145042b11fe1cc013c803ab4f
[ "bzip2-1.0.6" ]
null
null
null
num1=int(input('Enter the first number:')) num2=int(input('Enter the second number:')) sum=lambda num1,num2:num1+num2 diff=lambda num1,num2:num1-num2 mul=lambda num1,num2:num1*num2 div=lambda num1,num2:num1//num2 print("Sum is:",sum(num1,num2)) print("Difference is:",diff(num1,num2)) print("Multiply is",mul(num1,num2)) print("Division is:",div(num1,num2))
24.133333
43
0.734807
62
362
4.290323
0.306452
0.360902
0.210526
0.270677
0.330827
0
0
0
0
0
0
0.077844
0.077348
362
14
44
25.857143
0.718563
0
0
0
0
0
0.252778
0
0
0
0
0
0
1
0
false
0
0
0
0
0.4
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
6239726a93d8621a70381897416cf3327d729c16
269
py
Python
ada/utils.py
praekeltfoundation/ndoh-hub
91d834ff8fe43b930a73d8debdaa0e6af78c5efc
[ "BSD-3-Clause" ]
null
null
null
ada/utils.py
praekeltfoundation/ndoh-hub
91d834ff8fe43b930a73d8debdaa0e6af78c5efc
[ "BSD-3-Clause" ]
126
2016-07-12T19:39:44.000Z
2022-03-24T13:39:38.000Z
ada/utils.py
praekeltfoundation/ndoh-hub
91d834ff8fe43b930a73d8debdaa0e6af78c5efc
[ "BSD-3-Clause" ]
3
2016-09-28T13:16:11.000Z
2020-11-07T15:32:37.000Z
from __future__ import absolute_import, division from django.conf import settings from temba_client.v2 import TembaClient rapidpro = None if settings.RAPIDPRO_URL and settings.RAPIDPRO_TOKEN: rapidpro = TembaClient(settings.RAPIDPRO_URL, settings.RAPIDPRO_TOKEN)
29.888889
74
0.840149
35
269
6.171429
0.514286
0.296296
0.175926
0
0
0
0
0
0
0
0
0.004184
0.111524
269
8
75
33.625
0.899582
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
625b0c70462ef0f9a76fdc51d6f21a49dc3ee432
3,256
py
Python
seed_services_client/tests/test_utils.py
praekeltfoundation/seed-services-client
bfb216b6b770f9433bd9cda573f13199c4afee9c
[ "BSD-3-Clause" ]
null
null
null
seed_services_client/tests/test_utils.py
praekeltfoundation/seed-services-client
bfb216b6b770f9433bd9cda573f13199c4afee9c
[ "BSD-3-Clause" ]
25
2016-06-24T14:37:51.000Z
2018-06-26T09:08:31.000Z
seed_services_client/tests/test_utils.py
praekeltfoundation/seed-services-client
bfb216b6b770f9433bd9cda573f13199c4afee9c
[ "BSD-3-Clause" ]
null
null
null
import responses from unittest import TestCase from seed_services_client.seed_services import SeedServicesApiClient from seed_services_client.utils import get_paginated_response class TestApiClient(SeedServicesApiClient): pass class TestUtils(TestCase): def setUp(self): self.api = TestApiClient( "NO", "http://test.example.org/api/v1") @responses.activate def test_get_paginated_response_single_page(self): """ The get_paginated_response function should return the content for the single page. """ responses.add( responses.GET, "http://test.example.org/api/v1/tests/", json={ "next": None, "previous": None, "results": [{"id": 1, "content": "content_for_1"}, {"id": 2, "content": "content_for_2"}] }, status=200, content_type='application/json', match_querystring=True ) res = get_paginated_response(self.api.session, "/tests/") self.assertEqual(list(res), [ {"id": 1, "content": "content_for_1"}, {"id": 2, "content": "content_for_2"} ]) @responses.activate def test_get_paginated_response_multiple_pages(self): """ The get_paginated_response function should return the content for all the pages. """ # First page responses.add( responses.GET, "http://test.example.org/api/v1/tests/", json={ "next": "http://test.example.org/api/v1/tests/?cursor=1", "previous": None, "results": [{"id": 1, "content": "content_for_1"}, {"id": 2, "content": "content_for_2"}] }, status=200, content_type='application/json', match_querystring=True ) # Second page responses.add( responses.GET, "http://test.example.org/api/v1/tests/?cursor=1", json={ "next": "http://test.example.org/api/v1/tests/?cursor=2", "previous": None, "results": [{"id": 3, "content": "content_for_3"}, {"id": 4, "content": "content_for_4"}] }, status=200, content_type='application/json', match_querystring=True ) # Thrid page responses.add( responses.GET, "http://test.example.org/api/v1/tests/?cursor=2", json={ "next": None, "previous": None, "results": [ {"id": 5, "content": "content_for_5"}, ] }, status=200, content_type='application/json', match_querystring=True ) res = get_paginated_response(self.api.session, "/tests/") self.assertEqual(list(res), [ {"id": 1, "content": "content_for_1"}, {"id": 2, "content": "content_for_2"}, {"id": 3, "content": "content_for_3"}, {"id": 4, "content": "content_for_4"}, {"id": 5, "content": "content_for_5"}, ])
33.22449
77
0.513206
327
3,256
4.923547
0.204893
0.099379
0.147826
0.078261
0.793789
0.793789
0.754658
0.677019
0.677019
0.640373
0
0.024023
0.347973
3,256
97
78
33.56701
0.734338
0.060811
0
0.578947
0
0
0.251253
0
0
0
0
0
0.026316
1
0.039474
false
0.013158
0.052632
0
0.118421
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
626afa8cacd56858cd402b6d197d48e732dbed0a
617
py
Python
moviepy/audio/fx/__init__.py
odidev/moviepy
b19a690fe81b17fa582622d1c0ebe73e4e6380e7
[ "MIT" ]
8,558
2015-01-03T05:14:12.000Z
2022-03-31T21:45:38.000Z
moviepy/audio/fx/__init__.py
odidev/moviepy
b19a690fe81b17fa582622d1c0ebe73e4e6380e7
[ "MIT" ]
1,592
2015-01-02T22:12:54.000Z
2022-03-30T13:10:40.000Z
moviepy/audio/fx/__init__.py
odidev/moviepy
b19a690fe81b17fa582622d1c0ebe73e4e6380e7
[ "MIT" ]
1,332
2015-01-02T18:01:53.000Z
2022-03-31T22:47:28.000Z
# import every video fx function from moviepy.audio.fx.audio_delay import audio_delay from moviepy.audio.fx.audio_fadein import audio_fadein from moviepy.audio.fx.audio_fadeout import audio_fadeout from moviepy.audio.fx.audio_loop import audio_loop from moviepy.audio.fx.audio_normalize import audio_normalize from moviepy.audio.fx.multiply_stereo_volume import multiply_stereo_volume from moviepy.audio.fx.multiply_volume import multiply_volume __all__ = ( "audio_delay", "audio_fadein", "audio_fadeout", "audio_loop", "audio_normalize", "multiply_stereo_volume", "multiply_volume", )
29.380952
74
0.802269
86
617
5.430233
0.197674
0.164882
0.239829
0.269807
0.357602
0
0
0
0
0
0
0
0.123177
617
20
75
30.85
0.863216
0.048622
0
0
0
0
0.167521
0.037607
0
0
0
0
0
1
0
false
0
0.4375
0
0.4375
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
627079ad65cb5185a29bb361e2cdd849ff8f48d5
2,638
py
Python
knowledge/urls.py
dynamicguy/treeio
4f674898cff2331711639a9b5f6812c874a2cb25
[ "MIT" ]
2
2019-02-22T16:02:19.000Z
2019-02-23T19:27:34.000Z
knowledge/urls.py
dewmal/treeio
6299fbe7826800d576f7ab68b4c1996b7194540f
[ "MIT" ]
null
null
null
knowledge/urls.py
dewmal/treeio
6299fbe7826800d576f7ab68b4c1996b7194540f
[ "MIT" ]
1
2019-02-03T03:54:06.000Z
2019-02-03T03:54:06.000Z
# encoding: utf-8 # Copyright 2011 Tree.io Limited # This file is part of Treeio. # License www.tree.io/license """ Knowledge base module URLs """ from django.conf.urls.defaults import * urlpatterns = patterns('treeio.knowledge.views', url(r'^(\.(?P<response_format>\w+))?$', 'index', name='knowledge'), url(r'^index(\.(?P<response_format>\w+))?$', 'index', name='knowledge_index'), url(r'^categories(\.(?P<response_format>\w+))?/?$', 'index_categories', name='knowledge_categories'), # Folders url(r'^folder/add(\.(?P<response_format>\w+))?/?$', 'folder_add', name='knowledge_folder_add'), url(r'^folder/add/(?P<folderPath>.(?:[a-z,0-9,-]+/)+)(\.(?P<response_format>\w+))?/?$', 'folder_add_folder', name='knowledge_folder_add_folder'), url(r'^folder/(?P<folderPath>.(?:[a-z,0-9,-]+/)+)(\.(?P<response_format>\w+))?/?$', 'folder_view', name='knowledge_folder_view'), url(r'^folder/edit/(?P<knowledgeType_id>\d+)(\.(?P<response_format>\w+))?/?$', 'folder_edit', name='knowledge_folder_edit'), url(r'^folder/delete/(?P<knowledgeType_id>\d+)(\.(?P<response_format>\w+))?/?$', 'folder_delete', name='knowledge_folder_delete'), # Knowledge Items url(r'^item/add(\.(?P<response_format>\w+))?/?$', 'item_add', name='knowledge_item_add'), url(r'^item/add/(?P<folderPath>.(?:[a-z,0-9,-]+/)+)(\.(?P<response_format>\w+))?/?$', 'item_add_folder', name='knowledge_item_add_folder'), url(r'^(?P<folderPath>.(?:[a-z,0-9,-]+/)+)(?P<itemPath>.(?:[a-z,0-9,-]+/)+)(\.(?P<response_format>\w+))?/?$', 'item_view', name='knowledge_item_view'), url(r'^item/edit/(?P<knowledgeItem_id>\d+)(\.(?P<response_format>\w+))?/?$', 'item_edit', name='knowledge_item_edit'), url(r'^item/delete/(?P<knowledgeItem_id>\d+)(\.(?P<response_format>\w+))?/?$', 'item_delete', name='knowledge_item_delete'), # Categories url(r'^category/add(\.(?P<response_format>\w+))?/?$', 'category_add', name='knowledge_category_add'), url(r'^(?P<categoryPath>.(?:[a-z,0-9,-]+/)+)(\.(?P<response_format>\w+))?/?$', 'category_view', name='knowledge_category_view'), url(r'^category/edit/(?P<knowledgeCategory_id>\d+)(\.(?P<response_format>\w+))?/?$', 'category_edit', name='knowledge_category_edit'), url(r'^category/delete/(?P<knowledgeCategory_id>\d+)(\.(?P<response_format>\w+))?/?$', 'category_delete', name='knowledge_category_delete'), )
54.958333
118
0.573541
325
2,638
4.433846
0.178462
0.047189
0.17696
0.188758
0.442054
0.374046
0.336572
0.278279
0.2644
0.07703
0
0.007731
0.166414
2,638
47
119
56.12766
0.647567
0.062926
0
0
0
0.125
0.667616
0.540277
0
0
0
0
0
1
0
false
0
0.03125
0
0.03125
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
6274964d31b044659304e43d5b84d921f0dd8a07
2,278
py
Python
200_analysis/13_standardize_master.py
cogeorg/RegulatoryComplexity_Public
c9578ce012ba1e84dbebb029e30d98eff3430fd6
[ "Apache-2.0" ]
null
null
null
200_analysis/13_standardize_master.py
cogeorg/RegulatoryComplexity_Public
c9578ce012ba1e84dbebb029e30d98eff3430fd6
[ "Apache-2.0" ]
null
null
null
200_analysis/13_standardize_master.py
cogeorg/RegulatoryComplexity_Public
c9578ce012ba1e84dbebb029e30d98eff3430fd6
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__="""Co-Pierre Georg (co-pierre.georg@uct.ac.za)""" import sys import os import re # ########################################################################### # METHODS # ########################################################################### def clean(value): value = value.replace("\n", "") value = value.replace("'", "") value = value.replace(".", "") value = value.replace(",", "") value = value.replace(";", "") value = value.replace(":", "") value = value.replace('"', '') value = value.replace("`", "") value = value.replace("$", "") value = value.replace("(", "") value = value.replace(")", "") value = value.replace("``", "") value = value.replace("--", "") value = value.upper() return value # ------------------------------------------------------------------------- # do_run(file_name) # ------------------------------------------------------------------------- def do_run(input_file_name, output_file_name): out_text = "" dict_in = {} dict_cons = {} print("<<< 13_STANDARDIZE_MASTER.PY") # # LOAD DICTIONARY # dict_file = open(input_file_name, "r") for line in dict_file.readlines(): tokens = line.strip().split(";") try: dict_in[tokens[0].strip('"')] = tokens[1].strip('"') except: pass print(" <<< READ DICTIONARY: " + input_file_name + " WITH " + str(len(dict_in)) + " ENTRIES") for key in dict_in.keys(): dict_cons[key] = clean(key) for key in dict_cons.keys(): out_text += key + ";" + dict_cons[key] + ";" + dict_in[key] + "\n" out_file = open(output_file_name, "w") out_file.write(out_text) out_file.close() print(" <<< WRITTEN DICTIONARY TO: " + output_file_name) # ------------------------------------------------------------------------- # ------------------------------------------------------------------------- # # MAIN # # ------------------------------------------------------------------------- if __name__ == '__main__': # # VARIABLES # args = sys.argv input_file_name = args[1] output_file_name = args[2] # # CODE # do_run(input_file_name, output_file_name)
25.032967
98
0.43108
214
2,278
4.331776
0.35514
0.161812
0.238403
0.28479
0.299892
0.299892
0.299892
0.299892
0.230852
0.230852
0
0.004348
0.192274
2,278
90
99
25.311111
0.499457
0.209833
0
0
0
0
0.104487
0.031346
0
0
0
0
0
1
0.043478
false
0.021739
0.065217
0
0.130435
0.065217
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
6282e7956c74bf98fee7e25fcbd2cf8e7688c77a
2,934
py
Python
test/common/test_pipe.py
mountain/planetarium
14c5a75f9ac0be36f28d059c7bf7a77635d617da
[ "MIT" ]
1
2018-03-03T18:58:01.000Z
2018-03-03T18:58:01.000Z
test/common/test_pipe.py
mountain/planetarium
14c5a75f9ac0be36f28d059c7bf7a77635d617da
[ "MIT" ]
null
null
null
test/common/test_pipe.py
mountain/planetarium
14c5a75f9ac0be36f28d059c7bf7a77635d617da
[ "MIT" ]
null
null
null
import unittest import flare.pipe as p import flare.dataset.decorators as d class TestPipe(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_roll(self): elevens = list(range(11)) self.assertListEqual([[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10]], list(p.roll(elevens, window_size=1))) self.assertListEqual([[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]], list(p.roll(elevens, window_size=2))) self.assertListEqual([[0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7, 8, 9], [8, 9, 10]], list(p.roll(elevens, window_size=3))) self.assertListEqual([[0, 1, 2, 3], [1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7], [5, 6, 7, 8], [6, 7, 8, 9], [7, 8, 9, 10]], list(p.roll(elevens, window_size=4))) self.assertListEqual([[0, 1, 2, 3, 4], [1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9], [6, 7, 8, 9, 10]], list(p.roll(elevens, window_size=5))) def test_batches(self): elevens = list(range(11)) self.assertListEqual([[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10]], list(p.batches(elevens, batch_size=1))) self.assertListEqual([[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]], list(p.batches(elevens, batch_size=2))) self.assertListEqual([[0, 1, 2], [3, 4, 5], [6, 7, 8]], list(p.batches(elevens, batch_size=3))) self.assertListEqual([[0, 1, 2, 3], [4, 5, 6, 7]], list(p.batches(elevens, batch_size=4))) self.assertListEqual([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]], list(p.batches(elevens, batch_size=5))) def test_rolled_batches(self): elevens = list(range(11)) self.assertListEqual([[[0, 1, 2], [1, 2, 3], [2, 3, 4]], [[3, 4, 5], [4, 5, 6], [5, 6, 7]], [[6, 7, 8], [7, 8, 9], [8, 9, 10]]], list(p.batches(p.roll(elevens, window_size=3), batch_size=3))) def test_batched_roll(self): elevens = list(range(11)) self.assertListEqual([[[0, 1, 2], [3, 4, 5]], [[3, 4, 5], [6, 7, 8]]], list(p.roll(p.batches(elevens, batch_size=3), window_size=2))) def test_attributes(self): @d.attributes('x1', 'x2', 'x3') def datagen(): elevens = list(range(11)) return p.batches(elevens, batch_size=3) self.assertListEqual([{'x1': 0, 'x2': 1, 'x3': 2}, {'x1': 3, 'x2': 4, 'x3': 5}, {'x1': 6, 'x2': 7, 'x3': 8}], [d for d in datagen()]) def test_feature(self): def add(x1=0, x2=0): return [x1 + x2] @d.feature(add, ['x1', 'x2'], ['a']) @d.attributes('x1', 'x2', 'x3') def datagen(): elevens = list(range(11)) return p.batches(elevens, batch_size=3) self.assertListEqual([{'x1': 0, 'x2': 1, 'x3': 2, 'a': 1}, {'x1': 3, 'x2': 4, 'x3': 5, 'a': 7}, {'x1': 6, 'x2': 7, 'x3': 8, 'a': 13}], [d for d in datagen()])
49.728814
199
0.502727
504
2,934
2.878968
0.105159
0.027567
0.031013
0.173673
0.785665
0.749139
0.638181
0.636802
0.567195
0.532047
0
0.13354
0.231766
2,934
58
200
50.586207
0.510204
0
0
0.325581
0
0
0.019087
0
0
0
0
0
0.325581
1
0.255814
false
0.046512
0.069767
0.023256
0.418605
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
6551a175d3a0bde3d5f37c157e8cefe0f33963e1
101
py
Python
src/main/python/app/context.py
kevinyu/soundsep
58f8100e101a6302533626d2f141c86748c8dc10
[ "MIT" ]
1
2020-10-03T18:35:52.000Z
2020-10-03T18:35:52.000Z
src/main/python/app/context.py
theunissenlab/soundsep
58f8100e101a6302533626d2f141c86748c8dc10
[ "MIT" ]
null
null
null
src/main/python/app/context.py
theunissenlab/soundsep
58f8100e101a6302533626d2f141c86748c8dc10
[ "MIT" ]
1
2020-08-12T17:16:15.000Z
2020-08-12T17:16:15.000Z
from fbs_runtime.application_context.PyQt5 import ApplicationContext context = ApplicationContext()
25.25
68
0.871287
10
101
8.6
0.8
0
0
0
0
0
0
0
0
0
0
0.010753
0.079208
101
3
69
33.666667
0.913978
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
655d635191b67a99943128b5758eee46d9ab37aa
73
py
Python
src/lib/markupbase.py
timmartin/skulpt
2e3a3fbbaccc12baa29094a717ceec491a8a6750
[ "MIT" ]
10
2015-11-13T17:02:40.000Z
2021-02-09T23:21:05.000Z
src/lib/markupbase.py
timmartin/skulpt
2e3a3fbbaccc12baa29094a717ceec491a8a6750
[ "MIT" ]
43
2015-06-03T17:59:23.000Z
2021-09-17T10:45:21.000Z
src/lib/markupbase.py
timmartin/skulpt
2e3a3fbbaccc12baa29094a717ceec491a8a6750
[ "MIT" ]
13
2017-07-02T03:16:46.000Z
2021-07-05T14:53:56.000Z
raise NotImplementedError("markupbase is not yet implemented in Skulpt")
36.5
72
0.835616
9
73
6.777778
1
0
0
0
0
0
0
0
0
0
0
0
0.109589
73
1
73
73
0.938462
0
0
0
0
0
0.589041
0
0
0
0
0
0
1
0
true
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
656bb7f2aa9858aa3a9d321ec8e20f9790fd2268
776
py
Python
test/test_script.py
kuroko1t/nne
764b903db38ffc29eec536d9b3704e9bfe8ca60f
[ "Apache-2.0" ]
10
2020-04-02T07:10:08.000Z
2022-03-09T03:36:27.000Z
test/test_script.py
kuroko1t/nne
764b903db38ffc29eec536d9b3704e9bfe8ca60f
[ "Apache-2.0" ]
2
2020-04-21T22:48:19.000Z
2021-07-18T09:53:59.000Z
test/test_script.py
kuroko1t/nne
764b903db38ffc29eec536d9b3704e9bfe8ca60f
[ "Apache-2.0" ]
2
2020-04-07T09:16:03.000Z
2020-04-26T05:34:06.000Z
import unittest import nne import torchvision import torch import numpy as np import subprocess class ScriptTests(unittest.TestCase): def __init__(self, *args, **kwargs): super(ScriptTests, self).__init__(*args, **kwargs) self.onnx_file = 'resnet.onnx' input_shape = (1, 3, 64, 64) model = torchvision.models.resnet34(pretrained=True) nne.cv2onnx(model, input_shape, self.onnx_file) def test_analyze(self): subprocess.check_call(["nne", self.onnx_file]) subprocess.check_call(["nne", self.onnx_file, "-a", "resnet.json"]) def test_convert(self): subprocess.check_call(["nne", self.onnx_file, "-s", "resnet_smip.onnx"]) subprocess.check_call(["nne", self.onnx_file, "-t", "resnet.tflite"])
33.73913
80
0.67268
100
776
4.99
0.43
0.096192
0.144289
0.176353
0.288577
0.288577
0.288577
0.152305
0
0
0
0.014218
0.184278
776
22
81
35.272727
0.774092
0
0
0
0
0
0.088918
0
0
0
0
0
0
1
0.157895
false
0
0.315789
0
0.526316
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
6583e8b2d976d4e0deec067da02d6ba42de4de37
349
py
Python
src/flask-crud/tables.py
krishnamaram2/webapp-1
177944f8b3279343317e54e6b4e986868a98324f
[ "Apache-2.0" ]
null
null
null
src/flask-crud/tables.py
krishnamaram2/webapp-1
177944f8b3279343317e54e6b4e986868a98324f
[ "Apache-2.0" ]
null
null
null
src/flask-crud/tables.py
krishnamaram2/webapp-1
177944f8b3279343317e54e6b4e986868a98324f
[ "Apache-2.0" ]
2
2021-11-03T13:51:29.000Z
2021-11-03T13:55:21.000Z
from flask_table import Table, Col, LinkCol class Results(Table): user_id = Col('Id', show=False) user_name = Col('Name') user_email = Col('Email') user_passowrd = Col('Password', show=False) edit=LinkCol('Edit','edit_view',url_kwargs=dict(id='user_id')) delete=LinkCol('Delete','delete_user',url_kwargs=dict(id='user_id'))
34.9
72
0.690544
52
349
4.423077
0.423077
0.078261
0.113043
0.130435
0.182609
0.182609
0
0
0
0
0
0
0.140401
349
9
73
38.777778
0.766667
0
0
0
0
0
0.181034
0
0
0
0
0
0
1
0
false
0.125
0.125
0
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
0
0
1
0
0
1
0
0
3
65936de1e04cc497ac1b50e5947c8f386ccd5b0c
246
py
Python
epicteller/web/__init__.py
KawashiroNitori/epicteller
264b11e7e6eb58beb0f67ecbbb811d268a533f7a
[ "MIT" ]
null
null
null
epicteller/web/__init__.py
KawashiroNitori/epicteller
264b11e7e6eb58beb0f67ecbbb811d268a533f7a
[ "MIT" ]
null
null
null
epicteller/web/__init__.py
KawashiroNitori/epicteller
264b11e7e6eb58beb0f67ecbbb811d268a533f7a
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- import asyncio from epicteller.core.config import Config from epicteller.core.kafka import Bus bus = Bus(bootstrap_servers=Config.KAFKA_SERVERS) def bus_init(): asyncio.create_task(bus.run())
18.923077
49
0.743902
36
246
4.972222
0.611111
0.156425
0.201117
0
0
0
0
0
0
0
0
0.004651
0.126016
246
12
50
20.5
0.827907
0.170732
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.5
0
0.666667
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
659918da7023bbae02767596b4b07f559c7197dd
1,062
py
Python
mongoframes/factory/makers/numbers.py
tylerganter/MongoFrames
458930c74c8e2382a8bc931540254a5c38e84cba
[ "MIT" ]
52
2016-06-26T23:56:56.000Z
2022-02-07T19:12:37.000Z
mongoframes/factory/makers/numbers.py
tylerganter/MongoFrames
458930c74c8e2382a8bc931540254a5c38e84cba
[ "MIT" ]
18
2016-06-27T08:31:19.000Z
2020-06-02T20:09:04.000Z
mongoframes/factory/makers/numbers.py
tylerganter/MongoFrames
458930c74c8e2382a8bc931540254a5c38e84cba
[ "MIT" ]
6
2016-06-27T00:41:01.000Z
2022-02-16T17:32:39.000Z
import random from mongoframes.factory.makers import Maker __all__ = [ 'Counter' ] class Counter(Maker): """ Generate a sequence of numbers. """ def __init__(self, start_from=1, step=1): super().__init__() self._start_from = int(start_from) self._step = step self._counter = self._start_from def reset(self): self._counter = int(self._start_from) def _assemble(self): value = self._counter self._counter += int(self._step) return value class Float(Maker): """ Generate a random float between two values. """ def __init__(self, min_value, max_value): super().__init__() self._min_value = min_value self._max_value = max_value def _assemble(self): return random.uniform(float(self._min_value), float(self._max_value)) class Int(Float): """ Generate a random integer between two values. """ def _assemble(self): return random.randint(int(self._min_value), int(self._max_value))
20.423077
77
0.627119
131
1,062
4.679389
0.274809
0.073409
0.084829
0.055465
0.088091
0
0
0
0
0
0
0.002554
0.262712
1,062
52
78
20.423077
0.780332
0.113936
0
0.185185
1
0
0.007813
0
0
0
0
0
0
1
0.222222
false
0
0.074074
0.074074
0.518519
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
65ac477be277b61561c0d945ae942253728f57d2
2,091
py
Python
rocketgram/keyboards/inline.py
rocketbots/rocketgram
e509dcfad85d47a2449caf6dd302ec8581f95bf6
[ "MIT" ]
16
2019-02-27T20:15:52.000Z
2019-08-06T10:59:41.000Z
rocketgram/keyboards/inline.py
rocketbots/rocketgram
e509dcfad85d47a2449caf6dd302ec8581f95bf6
[ "MIT" ]
1
2019-04-27T06:51:57.000Z
2019-05-31T18:09:16.000Z
rocketgram/keyboards/inline.py
rocketbots/rocketgram
e509dcfad85d47a2449caf6dd302ec8581f95bf6
[ "MIT" ]
3
2019-03-19T16:01:22.000Z
2019-04-05T15:58:12.000Z
# Copyright (C) 2015-2022 by Vd. # This file is part of Rocketgram, the modern Telegram bot framework. # Rocketgram is released under the MIT License (see LICENSE). from typing import Optional from .keyboard import Keyboard from .. import api class InlineKeyboard(Keyboard): __slots__ = () def url(self, text, url) -> 'InlineKeyboard': self.add(api.InlineKeyboardButton(text=text, url=url)) return self def login(self, text: str, url: str, forward_text: Optional[str] = None, bot_username: Optional[str] = None, request_write_access: Optional[bool] = None) -> 'InlineKeyboard': lu = api.LoginUrl(url, forward_text, bot_username, request_write_access) self.add(api.InlineKeyboardButton(text=text, login_url=lu)) return self def callback(self, text: str, callback_data: str) -> 'InlineKeyboard': self.add(api.InlineKeyboardButton(text=text, callback_data=callback_data)) return self def web(self, text: str, url: str) -> 'InlineKeyboard': self.add(api.InlineKeyboardButton(text=text, web_app=api.WebAppInfo(url=url))) return self def inline(self, text: str, switch_inline_query: str = str()) -> 'InlineKeyboard': self.add(api.InlineKeyboardButton(text=text, switch_inline_query=switch_inline_query)) return self def inline_current(self, text: str, switch_inline_query_current_chat: str = str()) -> 'InlineKeyboard': self.add(api.InlineKeyboardButton(text=text, switch_inline_query_current_chat=switch_inline_query_current_chat)) return self def game(self, text: str, callback_game: str) -> 'InlineKeyboard': self.add(api.InlineKeyboardButton(text=text, callback_game=callback_game)) return self def pay(self, text: str) -> 'InlineKeyboard': self.add(api.InlineKeyboardButton(text=text, pay=True)) return self def row(self) -> 'InlineKeyboard': return super().row() def render(self) -> 'api.InlineKeyboardMarkup': return api.InlineKeyboardMarkup(self.render_buttons())
38.722222
120
0.698231
258
2,091
5.503876
0.25969
0.04507
0.056338
0.169014
0.458451
0.374648
0.308451
0.271831
0.194366
0.105634
0
0.00472
0.189383
2,091
53
121
39.45283
0.833038
0.075562
0
0.228571
0
0
0.077761
0.012442
0
0
0
0
0
1
0.285714
false
0
0.085714
0.057143
0.714286
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
65ca31621856cc059e7e7e71dd80ab961cc51ada
187
py
Python
examples/python/simple/func_param.py
airgiser/ucb
d03e62a17f35a9183ed36662352f603f0f673194
[ "MIT" ]
1
2022-01-08T14:59:44.000Z
2022-01-08T14:59:44.000Z
examples/python/simple/func_param.py
airgiser/just-for-fun
d03e62a17f35a9183ed36662352f603f0f673194
[ "MIT" ]
null
null
null
examples/python/simple/func_param.py
airgiser/just-for-fun
d03e62a17f35a9183ed36662352f603f0f673194
[ "MIT" ]
null
null
null
#!/usr/bin/python # Filename: func_param.py def Max(a, b): if a > b: print 'The max one is', a else: print 'The max one is', b Max(3, 4) x = 5 y = 7 Max(x, y)
11.6875
33
0.513369
37
187
2.567568
0.621622
0.042105
0.231579
0.294737
0.336842
0
0
0
0
0
0
0.032
0.331551
187
15
34
12.466667
0.728
0.213904
0
0
0
0
0.194444
0
0
0
0
0
0
0
null
null
0
0
null
null
0.222222
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
1
0
0
0
0
0
0
0
0
3
02ef1c889f57779e2849ecff9ac93c0eb8998db2
206
py
Python
docs/examples/quickstart/bot.py
bkvalexey/aiogram_dialog
fb4a3a8c151d63f06b04e4b8641549cc7ae45c2c
[ "Apache-2.0" ]
198
2020-06-06T14:24:04.000Z
2022-03-29T16:01:30.000Z
docs/examples/quickstart/bot.py
bkvalexey/aiogram_dialog
fb4a3a8c151d63f06b04e4b8641549cc7ae45c2c
[ "Apache-2.0" ]
65
2020-06-07T19:02:42.000Z
2022-03-21T18:23:17.000Z
docs/examples/quickstart/bot.py
bkvalexey/aiogram_dialog
fb4a3a8c151d63f06b04e4b8641549cc7ae45c2c
[ "Apache-2.0" ]
48
2020-06-13T09:57:58.000Z
2022-03-11T17:59:21.000Z
from aiogram import Bot, Dispatcher, executor from aiogram.contrib.fsm_storage.memory import MemoryStorage storage = MemoryStorage() bot = Bot(token='BOT TOKEN HERE') dp = Dispatcher(bot, storage=storage)
29.428571
60
0.796117
27
206
6.037037
0.518519
0.134969
0
0
0
0
0
0
0
0
0
0
0.11165
206
6
61
34.333333
0.89071
0
0
0
0
0
0.067961
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
f301ea06ddbdc6924646f7f5d90c8debf96cbb54
392
py
Python
tests/auth_helper.py
K900/httpx_auth
e8fe9d4b01e84cb707fae0c3624e3e649c602afe
[ "MIT" ]
null
null
null
tests/auth_helper.py
K900/httpx_auth
e8fe9d4b01e84cb707fae0c3624e3e649c602afe
[ "MIT" ]
null
null
null
tests/auth_helper.py
K900/httpx_auth
e8fe9d4b01e84cb707fae0c3624e3e649c602afe
[ "MIT" ]
null
null
null
import httpx from pytest_httpx import HTTPXMock # TODO Remove def get_header(httpx_mock: HTTPXMock, auth: httpx.Auth) -> dict: # Mock a dummy response httpx_mock.add_response() # Send a request to this dummy URL with authentication response = httpx.get("http://authorized_only", auth=auth) # Return headers received on this dummy URL return response.request.headers
30.153846
64
0.742347
55
392
5.181818
0.563636
0.063158
0.084211
0
0
0
0
0
0
0
0
0
0.183673
392
12
65
32.666667
0.890625
0.326531
0
0
0
0
0.084942
0
0
0
0
0.083333
0
1
0.166667
false
0
0.333333
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
1
0
0
3
f30f312e47ccf8c3d2875b4b048be168aa978102
1,840
py
Python
qsbk/qsbk/pipelines.py
lixiang30/scripy_prj
c4db0458e47a8709286bbeaa3f91fdd1f84de151
[ "Apache-2.0" ]
null
null
null
qsbk/qsbk/pipelines.py
lixiang30/scripy_prj
c4db0458e47a8709286bbeaa3f91fdd1f84de151
[ "Apache-2.0" ]
null
null
null
qsbk/qsbk/pipelines.py
lixiang30/scripy_prj
c4db0458e47a8709286bbeaa3f91fdd1f84de151
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html # 存储方式一 采用python自带的json模块来存储 import json class QsbkPipeline(object): def __init__(self): self.fp = open("duanzi.json",'w',encoding='utf-8') def open_spider(self,spider): print("========爬虫开始了=======") def process_item(self, item, spider): item_json = json.dumps(dict(item),ensure_ascii=False) self.fp.write(item_json+'\n') return item def close_spider(self,spider): self.fp.close() print("====爬虫结束了====") # 方式二 采用scrapy自带的JsonItemExporter,缺陷数据量大的时候很慢 from scrapy.exporters import JsonItemExporter class QsbkPipeline(object): def __init__(self): self.fp = open("duanzi2.json",'wb') self.exporter = JsonItemExporter(self.fp,ensure_ascii=False,encoding='utf-8') self.exporter.start_exporting() def open_spider(self,spider): print("========爬虫开始了=======") def process_item(self, item, spider): self.exporter.export_item(item) return item def close_spider(self,spider): self.exporter.finish_exporting() self.fp.close() print("====爬虫结束了====") # 方式三  采用JsonLinesItemExporter方式存储 from scrapy.exporters import JsonLinesItemExporter class QsbkPipeline(object): def __init__(self): self.fp = open("duanzi3.json",'wb') self.exporter = JsonLinesItemExporter(self.fp,ensure_ascii=False,encoding='utf-8') def open_spider(self,spider): print("========爬虫开始了=======") def process_item(self, item, spider): self.exporter.export_item(item) return item def close_spider(self,spider): self.fp.close() print("====爬虫结束了====")
27.878788
90
0.645109
219
1,840
5.278539
0.324201
0.095156
0.083045
0.067474
0.532872
0.514706
0.514706
0.514706
0.466263
0.352076
0
0.004076
0.2
1,840
65
91
28.307692
0.78125
0.154891
0
0.707317
0
0
0.101036
0
0
0
0
0
0
1
0.292683
false
0
0.073171
0
0.512195
0.146341
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
b83717021e0be17e40b21f5936bab73fc9b611b7
109
py
Python
A/A 959 Mahmoud and Ehab and the even-odd game.py
zielman/Codeforces-solutions
636f11a9eb10939d09d2e50ddc5ec53327d0b7ab
[ "MIT" ]
null
null
null
A/A 959 Mahmoud and Ehab and the even-odd game.py
zielman/Codeforces-solutions
636f11a9eb10939d09d2e50ddc5ec53327d0b7ab
[ "MIT" ]
1
2021-05-05T17:05:03.000Z
2021-05-05T17:05:03.000Z
A/A 959 Mahmoud and Ehab and the even-odd game.py
zielman/Codeforces-solutions
636f11a9eb10939d09d2e50ddc5ec53327d0b7ab
[ "MIT" ]
null
null
null
# https://codeforces.com/problemset/problem/959/A n = int(input()) print('Mahmoud' if n%2 == 0 else 'Ehab')
21.8
49
0.669725
18
109
4.055556
0.944444
0
0
0
0
0
0
0
0
0
0
0.052083
0.119266
109
5
50
21.8
0.708333
0.431193
0
0
0
0
0.180328
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
b8471548cda2fa7089c2b432725294f5dc1f74fd
340
py
Python
stock deep learning/Practice/checkdevice.py
nosy0411/Deep-learning-project
b0864579ec1fef4c6224397e3c39e4fce051c93a
[ "MIT" ]
null
null
null
stock deep learning/Practice/checkdevice.py
nosy0411/Deep-learning-project
b0864579ec1fef4c6224397e3c39e4fce051c93a
[ "MIT" ]
null
null
null
stock deep learning/Practice/checkdevice.py
nosy0411/Deep-learning-project
b0864579ec1fef4c6224397e3c39e4fce051c93a
[ "MIT" ]
null
null
null
import numpy as np import pandas as pd import keras import tensorflow as tf from IPython.display import display import PIL # How to check if the code is running on GPU or CPU? from tensorflow.python.client import device_lib print(device_lib.list_local_devices()) from keras import backend as K K.tensorflow_backend._get_available_gpus()
22.666667
52
0.817647
58
340
4.655172
0.655172
0.081481
0
0
0
0
0
0
0
0
0
0
0.141176
340
15
53
22.666667
0.924658
0.147059
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.8
0
0.8
0.1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
b85118753b5540690f9157e0cb5c8fced69b1e4c
3,929
py
Python
watcher_test.py
coveritytest/website-watcher
c3f17061600c3b7ff1b2c55121ec43310965b8b0
[ "MIT" ]
29
2020-04-26T17:47:42.000Z
2022-03-24T21:52:01.000Z
watcher_test.py
coveritytest/website-watcher
c3f17061600c3b7ff1b2c55121ec43310965b8b0
[ "MIT" ]
23
2020-04-05T19:24:47.000Z
2022-02-26T14:23:41.000Z
watcher_test.py
coveritytest/website-watcher
c3f17061600c3b7ff1b2c55121ec43310965b8b0
[ "MIT" ]
8
2021-01-30T13:28:42.000Z
2022-01-31T18:00:19.000Z
import os import uuid import unittest from unittest.mock import Mock, patch import watcher from adapters import SendAdapter class NoopAdapter(SendAdapter): def __init__(self): self.calls = { 'send': [] } def send(self, data): self.calls['send'].append(data) return True @classmethod def get_parser(cls): pass @classmethod def get_name(cls): pass @classmethod def get_description(cls): pass class Args: def __init__(self, url=None, adapter='noop', user_agent='firefox', xpath='//body', tolerance=0): self.url = url if url is not None else f'https://{uuid.uuid4()}.org' self.adapter = adapter self.user_agent = user_agent self.xpath = xpath self.tolerance = tolerance doc1 = ''' <html> <body> <div id="d1">Some text including umlauts äöü.</div> <div id="d2">Not changing</div> </body> </html> ''' doc2 = ''' <html> <body> <div id="d1">Some text including umlauts äöü (changed)</div> <div id="d2">Not changing</div> </body> </html> ''' class WatcherTests(unittest.TestCase): @patch('watcher.requests.get', autospec=True) @patch('adapters.SendAdapterFactory.get', autospec=True) def test_ignore_change_in_different_xpath(self, adapter_factory_mock, request_mock): noop_adapter = NoopAdapter() # Set up mocks adapter_factory_mock.return_value = noop_adapter request_mock.return_value.status_code = 200 request_mock.return_value.text = doc1 args = Args(xpath='//div[@id="d2"]') # First call watcher.main(args, None) self.assertEqual(len(noop_adapter.calls['send']), 1) self.assertEqual(noop_adapter.calls['send'][0].diff, 12) # 'A' self.assertEqual(noop_adapter.calls['send'][0].url, args.url) request_mock.return_value.text = doc2 # Second call watcher.main(args, None) self.assertEqual(len(noop_adapter.calls['send']), 1) # same as before @patch('watcher.requests.get', autospec=True) @patch('adapters.SendAdapterFactory.get', autospec=True) def test_detect_change_in_same_xpath(self, adapter_factory_mock, request_mock): noop_adapter = NoopAdapter() # Set up mocks adapter_factory_mock.return_value = noop_adapter request_mock.return_value.status_code = 200 request_mock.return_value.text = doc1 args = Args(xpath='//div[@id="d1"]') # First call watcher.main(args, None) self.assertEqual(len(noop_adapter.calls['send']), 1) self.assertEqual(noop_adapter.calls['send'][0].diff, 32) self.assertEqual(noop_adapter.calls['send'][0].url, args.url) request_mock.return_value.text = doc2 # Second call watcher.main(args, None) self.assertEqual(len(noop_adapter.calls['send']), 2) self.assertEqual(noop_adapter.calls['send'][1].diff, 11) # 9 new chars, minus '.', plus ' ' self.assertEqual(noop_adapter.calls['send'][1].url, args.url) @patch('watcher.requests.get', autospec=True) @patch('adapters.SendAdapterFactory.get', autospec=True) def test_ignore_changes_below_tolerance(self, adapter_factory_mock, request_mock): noop_adapter = NoopAdapter() # Set up mocks adapter_factory_mock.return_value = noop_adapter request_mock.return_value.status_code = 200 request_mock.return_value.text = doc1 args = Args(xpath='/*', tolerance=12) # First call watcher.main(args, None) self.assertEqual(len(noop_adapter.calls['send']), 1) self.assertEqual(noop_adapter.calls['send'][0].url, args.url) request_mock.return_value.text = doc2 # Second call watcher.main(args, None) self.assertEqual(len(noop_adapter.calls['send']), 1)
30.223077
100
0.642912
492
3,929
4.95935
0.213415
0.085656
0.085246
0.106557
0.747951
0.728279
0.728279
0.69877
0.69877
0.672541
0
0.015506
0.228557
3,929
130
101
30.223077
0.789508
0.040468
0
0.569892
0
0
0.144492
0.024747
0
0
0
0
0.139785
1
0.096774
false
0.032258
0.064516
0
0.204301
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
b854035f0df74dfb7297d6e6114af3c4a636d039
131
py
Python
acmicpc/5596.py
juseongkr/BOJ
8f10a2bf9a7d695455493fbe7423347a8b648416
[ "Apache-2.0" ]
7
2020-02-03T10:00:19.000Z
2021-11-16T11:03:57.000Z
acmicpc/5596.py
juseongkr/Algorithm-training
8f10a2bf9a7d695455493fbe7423347a8b648416
[ "Apache-2.0" ]
1
2021-01-03T06:58:24.000Z
2021-01-03T06:58:24.000Z
acmicpc/5596.py
juseongkr/Algorithm-training
8f10a2bf9a7d695455493fbe7423347a8b648416
[ "Apache-2.0" ]
1
2020-01-22T14:34:03.000Z
2020-01-22T14:34:03.000Z
a, b, c, d = map(int, input().split()) s = a + b + c + d a, b, c, d = map(int, input().split()) t = a + b + c + d print(max(s, t))
21.833333
38
0.458015
30
131
2
0.4
0.133333
0.2
0.266667
0.666667
0.666667
0.666667
0.666667
0
0
0
0
0.259542
131
5
39
26.2
0.618557
0
0
0.4
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.2
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
0
0
0
0
0
3
b8577a63805ae444b7886eb719d04c5883b98098
3,823
py
Python
resources/test_cases/python/PyNaCl/TestRule4.py
stg-tud/licma
b899e6e682f7716d19e79d6ce7b73c28c6efd4cf
[ "MIT" ]
5
2021-09-13T11:24:13.000Z
2022-03-18T21:56:58.000Z
resources/test_cases/python/PyNaCl/TestRule4.py
stg-tud/licma
b899e6e682f7716d19e79d6ce7b73c28c6efd4cf
[ "MIT" ]
null
null
null
resources/test_cases/python/PyNaCl/TestRule4.py
stg-tud/licma
b899e6e682f7716d19e79d6ce7b73c28c6efd4cf
[ "MIT" ]
1
2021-09-13T06:02:20.000Z
2021-09-13T06:02:20.000Z
from nacl.utils import random from nacl.secret import SecretBox from nacl.pwhash.argon2i import kdf g_salt1 = b"1234567812345678" g_salt2 = bytes("1234567812345678", "utf8") nonce = b"123456781234567812345678" # 24 byte def p_example1_hard_coded1(password, data): key = kdf(32, password, b"1234567812345678") secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text def p_example2_hard_coded2(password, data): key = kdf(32, password, bytes("1234567812345678", "utf8")) secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text def p_example3_local_variable1(password, data): salt = b"1234567812345678" key = kdf(32, password, salt) secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text def p_example4_local_variable2(password, data): salt = bytes("1234567812345678", "utf8") key = kdf(32, password, salt) secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text def p_example5_nested_local_variable1(password, data): salt1 = b"1234567812345678" salt2 = salt1 salt3 = salt2 key = kdf(32, password, salt3) secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text def p_example6_nested_local_variable2(password, data): salt1 = bytes("1234567812345678", "utf8") salt2 = salt1 salt3 = salt2 key = kdf(32, password, salt3) secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text def p_example_method_call(password, salt, data): key = kdf(32, password, salt) secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text def p_example_nested_method_call(password, salt, data): return p_example_method_call(password, salt, data) def p_example7_direct_method_call1(password, data): salt = b"1234567812345678" return p_example_method_call(password, salt, data) def p_example8_direct_method_call2(password, data): salt = bytes("1234567812345678", "utf8") return p_example_method_call(password, salt, data) def p_example9_nested_method_call1(password, data): salt = b"1234567812345678" return p_example_nested_method_call(password, salt, data) def p_example10_nested_method_call2(password, data): salt = bytes("1234567812345678", "utf8") return p_example_nested_method_call(password, salt, data) def p_example11_direct_g_variable_access1(password, data): key = kdf(32, password, g_salt1) secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text def p_example12_direct_g_variable_access2(password, data): key = kdf(32, password, g_salt2) secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text def p_example13_indirect_g_variable_access1(password, data): salt = g_salt1 key = kdf(32, password, salt) secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text def p_example14_indirect_g_variable_access2(password, data): salt = g_salt2 key = kdf(32, password, salt) secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text def p_example15_warning_parameter_not_resolvable(password, salt, data): key = kdf(32, password, salt) secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text def n_example1_random_salt(password, data): salt = random(16) key = kdf(32, password, salt) secret_box = SecretBox(key) cipher_text = secret_box.encrypt(data, nonce) return cipher_text
25.657718
71
0.733194
515
3,823
5.159223
0.139806
0.088069
0.039142
0.078284
0.751976
0.704554
0.668047
0.642454
0.63041
0.63041
0
0.097522
0.176563
3,823
148
72
25.831081
0.746506
0.001831
0
0.65625
0
0
0.062926
0.006293
0
0
0
0
0
1
0.1875
false
0.375
0.03125
0.010417
0.40625
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
b8579d992a0fe67398ed86e6a7492481685d93c0
270
py
Python
typed_models/fields/float.py
lockhaty/typed-models
75005b84cf78bc58d9a760eef34d42095ca4f726
[ "MIT" ]
1
2020-09-06T13:55:58.000Z
2020-09-06T13:55:58.000Z
typed_models/fields/float.py
lockhaty/typed-models
75005b84cf78bc58d9a760eef34d42095ca4f726
[ "MIT" ]
3
2020-09-06T13:54:33.000Z
2020-10-13T10:57:15.000Z
typed_models/fields/float.py
lockhaty/typed-models
75005b84cf78bc58d9a760eef34d42095ca4f726
[ "MIT" ]
1
2020-10-05T11:29:17.000Z
2020-10-05T11:29:17.000Z
from ..base import Field class FloatField(Field): def parse(self, value): try: return float(value) except (TypeError, ValueError): self._raise_value_error(value) def default_serializer(self, value): return value
22.5
42
0.622222
30
270
5.466667
0.666667
0.109756
0
0
0
0
0
0
0
0
0
0
0.292593
270
12
43
22.5
0.858639
0
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0.111111
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
b8652a77ad6115eccd982364431e150eb06ccb2a
250
py
Python
djcalcilib.py
Dasham007/Dasham007
596cd5db00661718f33bbba0b3e0d0f16c373efc
[ "MIT" ]
null
null
null
djcalcilib.py
Dasham007/Dasham007
596cd5db00661718f33bbba0b3e0d0f16c373efc
[ "MIT" ]
null
null
null
djcalcilib.py
Dasham007/Dasham007
596cd5db00661718f33bbba0b3e0d0f16c373efc
[ "MIT" ]
null
null
null
def sum(x,y): print("sum"," =",(x+y)) def subtract(x,y): print("difference"," =",(x-y)) def divide(x,y): print("division"," =",(x/y)) def multiply(x,y): print("multiplication"," =",(x/y))
14.705882
42
0.432
32
250
3.375
0.34375
0.148148
0.259259
0
0
0
0
0
0
0
0
0
0.312
250
17
43
14.705882
0.627907
0
0
0
0
0
0.171315
0
0
0
0
0
0
1
0.5
false
0
0
0
0.5
0.5
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
1
0
3
b86c6122e79ffe56338f938187626fa6fb3e14e5
180
py
Python
solutions/python3/780.py
sm2774us/amazon_interview_prep_2021
f580080e4a6b712b0b295bb429bf676eb15668de
[ "MIT" ]
42
2020-08-02T07:03:49.000Z
2022-03-26T07:50:15.000Z
solutions/python3/780.py
ajayv13/leetcode
de02576a9503be6054816b7444ccadcc0c31c59d
[ "MIT" ]
null
null
null
solutions/python3/780.py
ajayv13/leetcode
de02576a9503be6054816b7444ccadcc0c31c59d
[ "MIT" ]
40
2020-02-08T02:50:24.000Z
2022-03-26T15:38:10.000Z
class Solution: def reachingPoints(self, sx, sy, tx, ty): while sx<tx and sy<ty: tx,ty = tx%ty,ty%tx return sx==tx and (ty-sy)%sx==0 or sy==ty and (tx-sx)%sy==0
45
67
0.588889
37
180
2.864865
0.378378
0.113208
0.132075
0
0
0
0
0
0
0
0
0.014493
0.233333
180
4
67
45
0.753623
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
b87c0ecd787dc3725a835ebd8de33f9460a75e6d
222
py
Python
spec/fixtures/issue12/backends/Bla.py
Askaholic/linter-mypy
97978c5c9455d4215ea0cd0395e34b8eb118feca
[ "MIT" ]
33
2016-12-08T14:53:50.000Z
2022-02-22T20:56:49.000Z
spec/fixtures/issue12/backends/Bla.py
Askaholic/linter-mypy
97978c5c9455d4215ea0cd0395e34b8eb118feca
[ "MIT" ]
27
2017-03-12T01:18:05.000Z
2021-01-27T14:59:54.000Z
spec/fixtures/issue12/backends/Bla.py
Askaholic/linter-mypy
97978c5c9455d4215ea0cd0395e34b8eb118feca
[ "MIT" ]
7
2017-03-12T01:56:07.000Z
2022-03-24T18:09:00.000Z
from .. import * from typing import Iterable class Bla: def __init__(self, path: str) -> None: self.path = path def method(self, options: Iterable[str]) -> str: return call_command.call(["BLA"])
20.181818
52
0.626126
29
222
4.62069
0.586207
0.119403
0
0
0
0
0
0
0
0
0
0
0.243243
222
10
53
22.2
0.797619
0
0
0
0
0
0.013575
0
0
0
0
0
0
1
0.285714
false
0
0.285714
0.142857
0.857143
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
3
b87d9dd5000109799ee73ef17f4575f815da85b3
89
py
Python
checkov/openapi/checks/registry.py
peaudecastor/checkov
a4804b61c1b1390b7abd44ab53285fcbc3e7e80b
[ "Apache-2.0" ]
null
null
null
checkov/openapi/checks/registry.py
peaudecastor/checkov
a4804b61c1b1390b7abd44ab53285fcbc3e7e80b
[ "Apache-2.0" ]
null
null
null
checkov/openapi/checks/registry.py
peaudecastor/checkov
a4804b61c1b1390b7abd44ab53285fcbc3e7e80b
[ "Apache-2.0" ]
null
null
null
from checkov.openapi.checks.base_registry import Registry openapi_registry = Registry()
22.25
57
0.842697
11
89
6.636364
0.636364
0
0
0
0
0
0
0
0
0
0
0
0.089888
89
3
58
29.666667
0.901235
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
b88f0922be73df21e36c5b7c066b667d6da6fcaf
137
py
Python
Flappybird/main.py
Yuconium/Flappy-Bird
2fe6c4e6004d85c2267577e9a548021510f41e84
[ "MIT" ]
null
null
null
Flappybird/main.py
Yuconium/Flappy-Bird
2fe6c4e6004d85c2267577e9a548021510f41e84
[ "MIT" ]
null
null
null
Flappybird/main.py
Yuconium/Flappy-Bird
2fe6c4e6004d85c2267577e9a548021510f41e84
[ "MIT" ]
null
null
null
import pygame import mainwindow if __name__ == "__main__": pygame.init() Screen = mainwindow.Screen(700, 500) Screen.mainloop()
19.571429
38
0.715328
16
137
5.625
0.6875
0
0
0
0
0
0
0
0
0
0
0.052632
0.167883
137
7
39
19.571429
0.736842
0
0
0
0
0
0.060606
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
b89df135d78183c9e3732c93c605e990693b9397
186
py
Python
Data Science With Python/06-importing-data-in-python-(part-2)/3-diving-deep-into-the-twitter-api/twitter-data-into-dataframe.py
aimanahmedmoin1997/DataCamp
c6a6c4d59b83f14854bd76ed5c0c7f2dddd6de1d
[ "MIT" ]
3
2019-05-12T04:49:24.000Z
2020-05-06T00:40:28.000Z
Data Science With Python/06-importing-data-in-python-(part-2)/3-diving-deep-into-the-twitter-api/twitter-data-into-dataframe.py
aimanahmedmoin1997/DataCamp
c6a6c4d59b83f14854bd76ed5c0c7f2dddd6de1d
[ "MIT" ]
null
null
null
Data Science With Python/06-importing-data-in-python-(part-2)/3-diving-deep-into-the-twitter-api/twitter-data-into-dataframe.py
aimanahmedmoin1997/DataCamp
c6a6c4d59b83f14854bd76ed5c0c7f2dddd6de1d
[ "MIT" ]
7
2018-11-06T17:43:31.000Z
2020-11-07T21:08:16.000Z
# Import package import pandas as pd # Build DataFrame of tweet texts and languages df = pd.DataFrame(tweets_data, columns=['text', 'lang']) # Print head of DataFrame print(df.head())
20.666667
56
0.736559
28
186
4.857143
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.150538
186
8
57
23.25
0.860759
0.446237
0
0
0
0
0.080808
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
b89f350961634c88641cc94778e605609adb9a9c
214
py
Python
Leetcode/0190. Reverse Bits.py
luckyrabbit85/Python
ed134fd70b4a7b84b183b87b85ad5190f54c9526
[ "MIT" ]
1
2021-07-15T18:40:26.000Z
2021-07-15T18:40:26.000Z
Leetcode/0190. Reverse Bits.py
luckyrabbit85/Python
ed134fd70b4a7b84b183b87b85ad5190f54c9526
[ "MIT" ]
null
null
null
Leetcode/0190. Reverse Bits.py
luckyrabbit85/Python
ed134fd70b4a7b84b183b87b85ad5190f54c9526
[ "MIT" ]
null
null
null
class Solution: def reverseBits(self, n): result = 0 for i in range(32): result <<= 1 if n & 1 > 0: result += 1 n >>= 1 return result
21.4
29
0.397196
25
214
3.4
0.64
0.164706
0
0
0
0
0
0
0
0
0
0.07619
0.509346
214
9
30
23.777778
0.733333
0
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
false
0
0
0
0.333333
0
1
0
0
null
0
0
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
0
0
0
0
0
0
0
3
b8a89c3d89dd76973c278244a6b74336b3ca2365
114
py
Python
iniciante/1156.py
samucosta13/URI-Online-Judge
d3dc0c4c3ccf260e02cb3705a11226cbddffb90b
[ "MIT" ]
2
2021-05-28T18:52:53.000Z
2021-06-04T19:30:39.000Z
iniciante/1156.py
samucosta13/URI-Online-Judge
d3dc0c4c3ccf260e02cb3705a11226cbddffb90b
[ "MIT" ]
null
null
null
iniciante/1156.py
samucosta13/URI-Online-Judge
d3dc0c4c3ccf260e02cb3705a11226cbddffb90b
[ "MIT" ]
null
null
null
i = 1 n = 1 S = int(0) while i <= 39: somar = i/n S = S + somar n = n*2 i = i + 2 print('%.2f'%S)
11.4
17
0.394737
25
114
1.8
0.48
0
0
0
0
0
0
0
0
0
0
0.117647
0.403509
114
9
18
12.666667
0.544118
0
0
0
0
0
0.035088
0
0
0
0
0
0
1
0
false
0
0
0
0
0.111111
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
b218a3c421b56d4fd39eadfd560d29222487724f
1,081
py
Python
quarkc/test/generate_docs.py
datawire/quark
df0058a148b077c0aff535eb6ee382605c556273
[ "Apache-2.0" ]
112
2015-10-02T19:51:51.000Z
2022-03-07T06:29:44.000Z
quarkc/test/generate_docs.py
datawire/quark
df0058a148b077c0aff535eb6ee382605c556273
[ "Apache-2.0" ]
181
2015-10-01T20:23:38.000Z
2016-12-07T17:21:26.000Z
quarkc/test/generate_docs.py
datawire/quark
df0058a148b077c0aff535eb6ee382605c556273
[ "Apache-2.0" ]
31
2015-10-13T22:10:00.000Z
2020-08-03T02:50:12.000Z
# Copyright 2016 datawire. 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. """ Helpers for generating documentation using Jinja2 templates. """ import jinja2 def filter_commandline(value, prompt="$ "): return prompt + value.command def filter_output(value): return "\n ".join(value.output.split("\n")) jinja2_filters = dict(commandline=filter_commandline, output=filter_output) def make_env(): env = jinja2.Environment() for key, value in jinja2_filters.items(): env.filters[key] = value return env
27.717949
74
0.721554
149
1,081
5.187919
0.604027
0.07762
0.033635
0.041397
0
0
0
0
0
0
0
0.014874
0.191489
1,081
38
75
28.447368
0.869565
0.581869
0
0
0
0
0.023148
0
0
0
0
0
0
1
0.25
false
0
0.083333
0.166667
0.583333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
b21acb0eec9f0dcaa682203204a56f7c23c5c5bb
69
py
Python
SAMPLE_config.py
declasm/binance_harvester
3aa8237a4d12eaaec6966057a191a6228a285295
[ "Apache-2.0" ]
64
2022-01-17T17:45:37.000Z
2022-03-11T22:56:08.000Z
SAMPLE_config.py
declasm/binance_harvester
3aa8237a4d12eaaec6966057a191a6228a285295
[ "Apache-2.0" ]
1
2022-01-23T13:03:34.000Z
2022-01-24T16:21:39.000Z
SAMPLE_config.py
declasm/binance_harvester
3aa8237a4d12eaaec6966057a191a6228a285295
[ "Apache-2.0" ]
11
2022-01-17T17:39:26.000Z
2022-03-23T15:49:03.000Z
API_KEY = 'YOUR API KEY HERE' API_SECRET = 'YOUR API SECRET KEY HERE'
34.5
39
0.73913
13
69
3.769231
0.384615
0.244898
0
0
0
0
0
0
0
0
0
0
0.173913
69
2
39
34.5
0.859649
0
0
0
0
0
0.585714
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
b22792c88ca23359aeb0281fb1c7e65d7afc13ef
9,630
py
Python
halla/tests/basic_tests_stats.py
bmpbos/halla
d51315a2905e282a250a6c7f5c6c7a7c4e180b6d
[ "MIT" ]
null
null
null
halla/tests/basic_tests_stats.py
bmpbos/halla
d51315a2905e282a250a6c7f5c6c7a7c4e180b6d
[ "MIT" ]
1
2022-03-20T12:02:41.000Z
2022-03-20T12:02:41.000Z
halla/tests/basic_tests_stats.py
bmpbos/halla
d51315a2905e282a250a6c7f5c6c7a7c4e180b6d
[ "MIT" ]
null
null
null
import sys import unittest from halla import stats try: from numpy import array except ImportError: sys.exit("Please install numpy") class TestHAllAStatsFunctions(unittest.TestCase): """ Test the functions found in halla.stats """ def test_discretize_tenths(self): """ Test the discretize function on four values of tenths """ expected_result=[0, 0, 1, 1] result=stats.discretize([0.1, 0.2, 0.3, 0.4]) self.assertEqual(expected_result,result) def test_discretize_squares(self): """ Test the discretize function on four values of squares """ expected_result=[0, 0, 1, 1] result=stats.discretize([0.01, 0.04, 0.09, 0.16]) self.assertEqual(expected_result,result) def test_discretize_negatives(self): """ Test the discretize function on all negative values """ expected_result=[1, 1, 0, 0] result=stats.discretize([-0.1, -0.2, -0.3, -0.4]) self.assertEqual(expected_result,result) def test_discretize_quarters(self): """ Test the discretize function on four values of quarters """ expected_result=[0, 0, 1, 1] result=stats.discretize([0.25, 0.5, 0.75, 1.00]) self.assertEqual(expected_result,result) def test_discretize_eights(self): """ Test the discretize function on four values of eigths """ expected_result=[0, 0, 1, 1] result=stats.discretize([0.015625, 0.125, 0.421875, 1]) self.assertEqual(expected_result,result) def test_discretize_zero(self): """ Test the discretize function on an array containing a single zero """ expected_result=[0] result=stats.discretize([0]) self.assertEqual(expected_result,result) def test_discretize_one(self): """ Test the discretize function on an array of [0,1] """ expected_result=[0,0] result=stats.discretize([0,1]) self.assertEqual(expected_result,result) def test_discretize_two_bins_two_values(self): """ Test the discretize function two values with two bins """ expected_result=[0,1] result=stats.discretize([0, 1], 2) self.assertEqual(expected_result,result) def test_discretize_two_bins_two_values_reverse(self): """ Test the discretize function on two values (revered order) with two bins """ expected_result=[1,0] result=stats.discretize([1, 0], 2) self.assertEqual(expected_result,result) def test_discretize_three_bins_three_values(self): """ Test the discretize function on three values with three bins """ expected_result=[1, 0, 2] result=stats.discretize([0.2, 0.1, 0.3], 3) self.assertEqual(expected_result,result) def test_discretize_one_bin_three_values(self): """ Test the discretize function on three values with one bin """ expected_result=[0, 0, 0] result=stats.discretize([0.2, 0.1, 0.3], 1) self.assertEqual(expected_result,result) def test_discretize_two_bins_three_values(self): """ Test the discretize function on three values with two bins """ expected_result=[0, 0, 1] result=stats.discretize([0.2, 0.1, 0.3], 2) self.assertEqual(expected_result,result) def test_discretize_two_bins_four_values_all_floats(self): """ Test the discretize function on four values (all floats) with two bins """ expected_result=[1, 0, 0, 1] result=stats.discretize([0.4, 0.2, 0.1, 0.3], 2) self.assertEqual(expected_result,result) def test_discretize_two_bins_four_values_one_int(self): """ Test the discretize function on four values (one int) with two bins """ expected_result=[1, 0, 0, 1] result=stats.discretize([4, 0.2, 0.1, 0.3], 2) self.assertEqual(expected_result,result) def test_discretize_five_values(self): """ Test the discretize function on five values with default bins """ expected_result=[1, 0, 0, 0, 1] result=stats.discretize([0.4, 0.2, 0.1, 0.3, 0.5]) self.assertEqual(expected_result,result) def test_discretize_three_bins_five_values(self): """ Test the discretize function on five values with three bins """ expected_result=[1, 0, 0, 1, 2] result=stats.discretize([0.4, 0.2, 0.1, 0.3, 0.5], 3) self.assertEqual(expected_result,result) def test_discretize_six_values(self): """ Test the discretize function on six values with default bins """ expected_result=[1, 0, 1, 0, 0, 1] result=stats.discretize([0.4, 0.2, 0.6, 0.1, 0.3, 0.5]) self.assertEqual(expected_result,result) def test_discretize_three_bins_six_values(self): """ Test the discretize function six values with three bins """ expected_result=[1, 0, 2, 0, 1, 2] result=stats.discretize([0.4, 0.2, 0.6, 0.1, 0.3, 0.5], 3) self.assertEqual(expected_result,result) def test_discretize_zero_bins_six_values(self): """ Test the discretize function on six values with zero bins """ expected_result=[3, 1, 5, 0, 2, 4] result=stats.discretize([0.4, 0.2, 0.6, 0.1, 0.3, 0.5], 0) self.assertEqual(expected_result,result) def test_discretize_six_bins_six_values(self): """ Test the discretize function on six values with six bins """ expected_result=[3, 1, 5, 0, 2, 4] result=stats.discretize([0.4, 0.2, 0.6, 0.1, 0.3, 0.5], 6) self.assertEqual(expected_result,result) def test_discretize_sixty_bins_six_values(self): """ Test the discretize function on six values with sixty bins """ expected_result=[3, 1, 5, 0, 2, 4] result=stats.discretize([0.4, 0.2, 0.6, 0.1, 0.3, 0.5], 60) self.assertEqual(expected_result,result) def test_discretize_two_bins_eight_values(self): """ Test the discretize function on eight values with two bins """ expected_result=[0, 0, 0, 0, 0, 0, 1, 1] result=stats.discretize([0, 0, 0, 0, 0, 0, 1, 2], 2) self.assertEqual(expected_result,result) def test_discretize_three_bins_ten_values(self): """ Test the discretize function on ten values with three bins """ expected_result=[0, 0, 0, 0, 1, 1, 1, 1, 1, 2] result=stats.discretize([0, 0, 0, 0, 1, 2, 2, 2, 2, 3], 3) self.assertEqual(expected_result,result) def test_discretize_nine_values(self): """ Test the discretize function on nine values which are mostly zero """ expected_result=[1, 0, 0, 0, 0, 0, 0, 0, 0] result=stats.discretize([0.1, 0, 0, 0, 0, 0, 0, 0, 0]) self.assertEqual(expected_result,result) def test_discretize_fifty_one_values(self): """ Test the discretize function on a large set of values """ expected_result=[3, 6, 6, 5, 5, 0, 2, 2, 3, 5, 2, 4, 4, 2, 3, 5, 0, 4, 0, 6, 0, 1, 6, 1, 5, 3, 0, 3, 2, 1, 3, 0, 6, 3, 2, 0, 6, 5, 1, 3, 6, 4, 1, 1, 4, 5, 0, 4, 2, 4, 1] input_values=[0.992299, 1, 1, 0.999696, 0.999605, 0.663081, 0.978293, 0.987621, 0.997237, 0.999915, 0.984792, 0.998338, 0.999207, 0.98051, 0.997984, 0.999219, 0.579824, 0.998983, 0.720498, 1, 0.803619, 0.970992, 1, 0.952881, 0.999866, 0.997153, 0.014053, 0.998049, 0.977727, 0.971233, 0.995309, 0.0010376, 1, 0.989373, 0.989161, 0.91637, 1, 0.99977, 0.960816, 0.998025, 1, 0.998852, 0.960849, 0.957963, 0.998733, 0.999426, 0.876182, 0.998509, 0.988527, 0.998265, 0.943673] result=stats.discretize(input_values) self.assertEqual(expected_result,result) def test_discretize_array_skip_one(self): """ Test the discretize function with a numpy array and one skip """ expected_result=array([ [ 1., 1., 0., 0.], [ 1., 1., 0., 0.], [ 0., 0., 1., 1.], [ 0., 0., 1., 1.]]) y = array([[-0.1,-0.2,-0.3,-0.4],[1,1,0,0],[0.25,0.5,0.75,1.0], [0.015625,0.125,0.421875,1.0]]) result=stats.discretize(y, aiSkip = [1]) self.assertEqual(expected_result.all(),result.all()) def test_discretize_array_skip_two(self): """ Test the discretize function with a numpy array and two skips """ expected_result=array([ [ 0., 0., 1., 1.], [ 1., 1., 1., 0.], [ 0., 0., 1., 1.], [ 0., 0., 0., 1.]]) x = array([[0.1,0.2,0.3,0.4],[1,1,1,0],[0.01,0.04,0.09,0.16],[0,0,0,1]]) result=stats.discretize(x, aiSkip = [1,3]) self.assertEqual(expected_result.all(),result.all())
34.028269
81
0.558775
1,327
9,630
3.929917
0.104748
0.023394
0.018408
0.108725
0.804794
0.781783
0.752445
0.659252
0.541898
0.435666
0
0.121777
0.315265
9,630
282
82
34.148936
0.669093
0.170717
0
0.309353
0
0
0.002721
0
0
0
0
0
0.194245
1
0.194245
false
0
0.035971
0
0.23741
0
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
b248bfb3b8553a3a84656d5a830ee64841a0dac1
336
py
Python
MathematicalChallenges/8_AmstrongNumbers/task8.py
kamil2789/TasksCollection
ed4f84b431b42a4649a7ac042c07fe7e27a71c40
[ "MIT" ]
1
2021-07-12T17:14:53.000Z
2021-07-12T17:14:53.000Z
MathematicalChallenges/8_AmstrongNumbers/task8.py
kamil2789/TasksCollection
ed4f84b431b42a4649a7ac042c07fe7e27a71c40
[ "MIT" ]
null
null
null
MathematicalChallenges/8_AmstrongNumbers/task8.py
kamil2789/TasksCollection
ed4f84b431b42a4649a7ac042c07fe7e27a71c40
[ "MIT" ]
null
null
null
def calculate_amstrong_numbers_3_digits(): result = [] for item in range(100, 1000): sum = 0 for number in str(item): sum += int(number) ** 3 if sum == item: result.append(item) return result print("3-digit Amstrong Numbers:") print(calculate_amstrong_numbers_3_digits())
21
44
0.604167
43
336
4.534884
0.534884
0.230769
0.246154
0.25641
0.317949
0
0
0
0
0
0
0.050209
0.28869
336
15
45
22.4
0.76569
0
0
0
0
0
0.074627
0
0
0
0
0
0
1
0.090909
false
0
0
0
0.181818
0.181818
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
b259e7e90f024b23f55b2459153b276bfa49b8fa
1,101
py
Python
test/test_tabs.py
volfpeter/markyp-bootstrap4
1af5a1f9dc861a14323706ace28882ef6555739a
[ "MIT" ]
21
2019-07-16T15:03:43.000Z
2021-11-16T10:51:58.000Z
test/test_tabs.py
volfpeter/markyp-bootstrap4
1af5a1f9dc861a14323706ace28882ef6555739a
[ "MIT" ]
null
null
null
test/test_tabs.py
volfpeter/markyp-bootstrap4
1af5a1f9dc861a14323706ace28882ef6555739a
[ "MIT" ]
null
null
null
from markyp_bootstrap4.tabs import * def test_tab_content(): assert tab_content().markup ==\ '<div class="tab-content"></div>' assert tab_content("First", "Second").markup ==\ '<div class="tab-content">\nFirst\nSecond\n</div>' assert tab_content("First", "Second", class_="my-tc", attr=42).markup ==\ '<div attr="42" class="tab-content my-tc">\nFirst\nSecond\n</div>' def test_tab_pane(): assert tab_pane().markup ==\ '<div role="tabpanel" class="tab-pane fade"></div>' assert tab_pane("First", "Second").markup ==\ '<div role="tabpanel" class="tab-pane fade">\nFirst\nSecond\n</div>' assert tab_pane("First", "Second", active=True).markup ==\ '<div role="tabpanel" class="tab-pane fade show active">\nFirst\nSecond\n</div>' assert tab_pane("First", "Second", fade=False).markup ==\ '<div role="tabpanel" class="tab-pane">\nFirst\nSecond\n</div>' assert tab_pane("First", "Second", class_="my-tp", attr=42).markup ==\ '<div role="tabpanel" attr="42" class="tab-pane fade my-tp">\nFirst\nSecond\n</div>'
50.045455
92
0.631244
153
1,101
4.444444
0.202614
0.113235
0.105882
0.15
0.611765
0.541176
0.392647
0.344118
0.180882
0
0
0.009698
0.15713
1,101
21
93
52.428571
0.72306
0
0
0
0
0.210526
0.504087
0.207993
0
0
0
0
0.421053
1
0.105263
true
0
0.052632
0
0.157895
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
null
0
0
0
1
0
0
1
0
0
0
0
0
0
3
b28518ddb45134ab65646282ab0f4d3a2914a8de
94
py
Python
src/apps/climsoft/schemas/__init__.py
opencdms/opencdms-api
f1ed6e1d883025a8658746fe457e0c975718c7be
[ "MIT" ]
3
2020-12-01T09:25:18.000Z
2022-02-14T23:57:34.000Z
src/common_schemas.py
opencdms/opencdms-api
f1ed6e1d883025a8658746fe457e0c975718c7be
[ "MIT" ]
11
2021-12-05T10:09:00.000Z
2022-02-17T08:11:22.000Z
src/apps/climsoft/schemas/__init__.py
opencdms/opencdms-api
f1ed6e1d883025a8658746fe457e0c975718c7be
[ "MIT" ]
2
2021-03-10T19:03:05.000Z
2021-12-11T08:36:04.000Z
from pydantic import BaseModel class Response(BaseModel): message: str status: str
11.75
30
0.723404
11
94
6.181818
0.818182
0
0
0
0
0
0
0
0
0
0
0
0.223404
94
7
31
13.428571
0.931507
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.25
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
b2969f4b0a3f60b6fbbaaddfe8aab6f5a266a908
65
py
Python
string_calculator/__init__.py
suradet/string-calculator-kata
6b87fcfad609f5c7c8e35d5392f7faceb650a5ef
[ "Apache-2.0" ]
null
null
null
string_calculator/__init__.py
suradet/string-calculator-kata
6b87fcfad609f5c7c8e35d5392f7faceb650a5ef
[ "Apache-2.0" ]
null
null
null
string_calculator/__init__.py
suradet/string-calculator-kata
6b87fcfad609f5c7c8e35d5392f7faceb650a5ef
[ "Apache-2.0" ]
null
null
null
"""The string_calculator package.""" NAME = "string_calculator"
16.25
36
0.738462
7
65
6.571429
0.714286
0.695652
0
0
0
0
0
0
0
0
0
0
0.107692
65
3
37
21.666667
0.793103
0.461538
0
0
0
0
0.586207
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
b2b0f179656973feff8b88ab10ae2e6225127d32
125
py
Python
logstash/datadog_checks/logstash/__init__.py
zparnold/integrations-extras
3558ec40cdc07230bf85cd5b77874110b33abf99
[ "BSD-3-Clause" ]
null
null
null
logstash/datadog_checks/logstash/__init__.py
zparnold/integrations-extras
3558ec40cdc07230bf85cd5b77874110b33abf99
[ "BSD-3-Clause" ]
null
null
null
logstash/datadog_checks/logstash/__init__.py
zparnold/integrations-extras
3558ec40cdc07230bf85cd5b77874110b33abf99
[ "BSD-3-Clause" ]
null
null
null
from .__about__ import __version__ from .logstash import LogstashCheck __all__ = [ '__version__', 'LogstashCheck' ]
15.625
35
0.736
11
125
6.909091
0.636364
0
0
0
0
0
0
0
0
0
0
0
0.184
125
7
36
17.857143
0.745098
0
0
0
0
0
0.192
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
a23462d942a5277ec1b78d08914770952fb018e4
1,051
py
Python
source/parse/xwset.py
ucabops/robbie
f74aefbdb9069d62188d4bb820bf91fa50f73b8c
[ "OML" ]
null
null
null
source/parse/xwset.py
ucabops/robbie
f74aefbdb9069d62188d4bb820bf91fa50f73b8c
[ "OML" ]
null
null
null
source/parse/xwset.py
ucabops/robbie
f74aefbdb9069d62188d4bb820bf91fa50f73b8c
[ "OML" ]
null
null
null
from xwentry import CrosswordEntry from xwpuzzle import Crossword class CrosswordSet: def __init__(self, crosswords): self.crosswords = crosswords self._entries = None @classmethod def from_dict(cls, data): return CrosswordSet({xw_id: Crossword(xw_dict) for xw_id, xw_dict in data.items()}) def __len__(self): return len(self.crosswords) def __iter__(self): return iter(self.crosswords.items()) def __getitem__(self, id): """The crossword with the given id. e.g. 'xw = xwset[12000]' for Guardian quick crossword no. 12000 """ return self.crosswords[id] @property def crosswords_as_list(self): """All the crosswords as one long list.""" return self.crosswords.values() @property def entries(self): """All the crossword entries as one long list.""" if self._entries is None: self._entries = [xw.entries for xw in self.crosswords] return self._entries
26.948718
71
0.623216
127
1,051
4.944882
0.362205
0.156051
0.063694
0.041401
0
0
0
0
0
0
0
0.013298
0.284491
1,051
38
72
27.657895
0.821809
0.169363
0
0.083333
0
0
0
0
0
0
0
0
0
1
0.291667
false
0
0.083333
0.125
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
a23e3a1fa898b65875a730d72038c5215e5e420f
314
py
Python
nlp/__init__.py
kirollosHossam/MachineLearningTask
3780513af04cf7bb97432436b4714c32d1c271e6
[ "MIT" ]
null
null
null
nlp/__init__.py
kirollosHossam/MachineLearningTask
3780513af04cf7bb97432436b4714c32d1c271e6
[ "MIT" ]
null
null
null
nlp/__init__.py
kirollosHossam/MachineLearningTask
3780513af04cf7bb97432436b4714c32d1c271e6
[ "MIT" ]
null
null
null
'''To tell Python that a particular directory is a package, \ we create a file named __init__.py inside it and then it is considered as a package \ and we may create other modules and sub-packages within it. This __init__.py file can be left \ blank or can be coded with the initialization code for the package.'''
78.5
95
0.773885
57
314
4.122807
0.684211
0.068085
0
0
0
0
0
0
0
0
0
0
0.178344
314
4
96
78.5
0.910853
0.961783
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
a25b4ae46be92fe5cd32e9a6df9839b7efea2f90
1,497
py
Python
tests/js2py_test.py
eniraa/python-aternos
0407e6e6e8c932265c32ef779b004bd6a6ed5af1
[ "Apache-2.0" ]
null
null
null
tests/js2py_test.py
eniraa/python-aternos
0407e6e6e8c932265c32ef779b004bd6a6ed5af1
[ "Apache-2.0" ]
null
null
null
tests/js2py_test.py
eniraa/python-aternos
0407e6e6e8c932265c32ef779b004bd6a6ed5af1
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 import re import base64 import js2py # Use tests from a file tests = [] with open('../token.txt', 'rt') as f: lines = re.split(r'[\r\n]', f.read()) del lines[len(lines)-1] # Remove empty string tests = lines arrowre = re.compile(r'(\w+?|\(\w+?(?:,\s*\w+?)*\)|\(\))\s*=>\s*({\s*[\s\S]+\s*}|[^\r\n]+?(?:;|$))') def to_ecma5_function(f): # return "(function() { " + f[f.index("{")+1 : f.index("}")] + "})();" fnstart = f.find('{')+1 fnend = f.rfind('}') f = arrow_conv(f[fnstart:fnend]) return f def atob(s): return base64.standard_b64decode(str(s)).decode('utf-8') def arrow_conv(f): m = arrowre.search(f) while m != None: print(f) params = m.group(1).strip('()') body = m.group(2) if body.startswith('{')\ and body.endswith('}'): body = body.strip('{}') else: body = f'return {body}' f = arrowre.sub(f'function({params}){{{body}}}', f) m = arrowre.search(f) print(f) #print('function(' + m.group(1).strip("()") + '){return ' + m.group(2) + ';}') return f ctx = js2py.EvalJs({'atob': atob}) for f in tests: c = to_ecma5_function(f) ctx.execute(c) print(ctx.window['AJAX_TOKEN']) # Expected output: # 2rKOA1IFdBcHhEM616cb # 2rKOA1IFdBcHhEM616cb # 2rKOA1IFdBcHhEM616cb # 2rKOA1IFdBcHhEM616cb # 2rKOA1IFdBcHhEM616cb # 2rKOA1IFdBcHhEM616cb # 2rKOA1IFdBcHhEM616cb # 2rKOA1IFdBcHhEM616cb # 2rKOA1IFdBcHhEM616cb # 2iXh5W5uEYq5fWJIazQ6 # CuUcmZ27Fb8bVBNw12Vj # YPPe8Ph7vzYaZ9PF9oQP # ... # (Note: The last four # tokens are different)
23.030769
100
0.632599
202
1,497
4.648515
0.450495
0.340788
0.447284
0.511182
0.232162
0.191693
0.191693
0.191693
0
0
0
0.060795
0.142953
1,497
64
101
23.390625
0.671083
0.351369
0
0.166667
0
0.027778
0.171579
0.108421
0
0
0
0
0
1
0.083333
false
0
0.083333
0.027778
0.25
0.083333
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
a25c8e4bf295efd799ee8e81460c6139425b5ec0
152
py
Python
Modulo-01/ex024/ex024.py
Matheus-Henrique-Burey/Curso-de-Python
448aebaab96527affa1e45897a662bb0407c11c6
[ "MIT" ]
null
null
null
Modulo-01/ex024/ex024.py
Matheus-Henrique-Burey/Curso-de-Python
448aebaab96527affa1e45897a662bb0407c11c6
[ "MIT" ]
null
null
null
Modulo-01/ex024/ex024.py
Matheus-Henrique-Burey/Curso-de-Python
448aebaab96527affa1e45897a662bb0407c11c6
[ "MIT" ]
null
null
null
nome = str(input('Dogite o nome de sua cidade: ')).lower().strip() city = nome.split() print('Sua cidade começa com santos?') print("santo" in city[0])
30.4
66
0.677632
25
152
4.12
0.76
0.174757
0
0
0
0
0
0
0
0
0
0.007576
0.131579
152
4
67
38
0.772727
0
0
0
0
0
0.414474
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
a272af6535c72273b6bbeb242f6b00fef1282fd3
21
py
Python
apps/games/__init__.py
LouisPi/PiPortableRecorder
430a4b6e1e869cbd68fd89bbf97261710fd7db6b
[ "Apache-2.0", "MIT" ]
51
2017-12-03T21:59:13.000Z
2021-01-02T17:13:34.000Z
apps/games/__init__.py
LouisPi/PiPortableRecorder
430a4b6e1e869cbd68fd89bbf97261710fd7db6b
[ "Apache-2.0", "MIT" ]
153
2017-10-27T19:59:46.000Z
2020-01-14T23:58:57.000Z
apps/games/__init__.py
LouisPi/PiPortableRecorder
430a4b6e1e869cbd68fd89bbf97261710fd7db6b
[ "Apache-2.0", "MIT" ]
26
2017-11-16T11:10:56.000Z
2022-03-29T18:44:48.000Z
_menu_name = "Games"
10.5
20
0.714286
3
21
4.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.142857
21
1
21
21
0.722222
0
0
0
0
0
0.238095
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
a280558f96d9619cfa49d379ac06204560efe06f
1,113
py
Python
template_formatter/AppContext.py
Koldar/template-formatter
bb55b0ccbe1f5a6c8f0ba187765bbd41836f7c54
[ "Apache-2.0" ]
1
2021-03-08T01:31:19.000Z
2021-03-08T01:31:19.000Z
template_formatter/AppContext.py
Koldar/template-formatter
bb55b0ccbe1f5a6c8f0ba187765bbd41836f7c54
[ "Apache-2.0" ]
null
null
null
template_formatter/AppContext.py
Koldar/template-formatter
bb55b0ccbe1f5a6c8f0ba187765bbd41836f7c54
[ "Apache-2.0" ]
1
2021-03-07T15:39:08.000Z
2021-03-07T15:39:08.000Z
from typing import Optional from template_formatter.Jinja2Model import Jinja2Model class AppContext: def __init__(self): self.model = Jinja2Model() self.input_file: Optional[str] = None self.input_directory: Optional[str] = None self.output_directory: Optional[str] = None self.trailing_string_template_file: Optional[str] = None self.output_file_format: Optional[str] = None self.log_level: Optional[str] = None self.block_start_string: Optional[str] = None self.block_end_string: Optional[str] = None self.comment_start_string: Optional[str] = None self.comment_end_string: Optional[str] = None self.expression_start_string: Optional[str] = None self.expression_end_string: Optional[str] = None self.line_statement_prefix: Optional[str] = None self.input_file_encoding: Optional[str] = None self.output_file_encoding: Optional[str] = None self.write_on_stdout: bool = False self.template_string: Optional[str] = None self.format: Optional[str] = None
39.75
64
0.690925
137
1,113
5.357664
0.277372
0.254768
0.347411
0.414169
0.649864
0.415531
0
0
0
0
0
0.003464
0.221923
1,113
27
65
41.222222
0.844111
0
0
0
0
0
0
0
0
0
0
0
0
1
0.043478
false
0
0.086957
0
0.173913
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
a28beeac7a0a0d5624b95294751aa487d171a7a2
2,403
py
Python
worker/tasks/cv_task.py
Dev-Jahn/cms
84ea115bdb865daff83d069502f6f0dd105fc4f0
[ "RSA-MD" ]
null
null
null
worker/tasks/cv_task.py
Dev-Jahn/cms
84ea115bdb865daff83d069502f6f0dd105fc4f0
[ "RSA-MD" ]
9
2021-01-05T07:48:28.000Z
2021-05-14T06:38:27.000Z
worker/tasks/cv_task.py
Dev-Jahn/cms
84ea115bdb865daff83d069502f6f0dd105fc4f0
[ "RSA-MD" ]
4
2021-01-05T06:46:09.000Z
2021-05-06T01:44:28.000Z
import os import traceback from PIL import Image from celery.utils.log import get_task_logger from celery.exceptions import TaskError import numpy as np import cv2 from app import app from cv import blur, color, detection, normalize, segmentation, threshold logger = get_task_logger(__name__) # TODO # task chaining 구현 # image caching 방법 고안 @app.task(name='cv_task.cv_color') def cv_color(path, **kwargs) -> np.ndarray: try: src = np.array(Image.open('/data/' + path)) output_path = '/data/cv/'+path if not os.path.exists('/data/cv'): os.mkdir('/data/cv') Image.fromarray(color.apply(src, **kwargs)).save(output_path) return output_path except Exception as e: logger.error(traceback.format_exc()) raise TaskError(e) @app.task(name='cv_task.cv_blur') def cv_blur(path, **kwargs) -> np.ndarray: try: src = np.array(Image.open('/data/' + path)) output_path = '/data/cv/'+path if not os.path.exists('/data/cv'): os.mkdir('/data/cv') Image.fromarray(blur.apply(src, **kwargs)).save(output_path) return output_path except Exception as e: logger.error(traceback.format_exc()) raise TaskError(e) @app.task(name='cv_task.cv_normalize') def cv_normalize(path, **kwargs) -> np.ndarray: try: src = np.array(Image.open('/data/' + path)) output_path = '/data/cv/'+path if not os.path.exists('/data/cv'): os.mkdir('/data/cv') Image.fromarray(normalize.apply(src, **kwargs)).save(output_path) return output_path except Exception as e: logger.error(traceback.format_exc()) raise TaskError(e) @app.task(name='cv_task.cv_threshold') def cv_threshold(path, **kwargs) -> np.ndarray: try: src = np.array(Image.open('/data/' + path)) output_path = '/data/cv/'+path if not os.path.exists('/data/cv'): os.mkdir('/data/cv') Image.fromarray(threshold.apply(src, **kwargs)).save(output_path) return output_path except Exception as e: logger.error(traceback.format_exc()) raise TaskError(e) @app.task(name='cv_task.cv_detection') def cv_detection(src: np.ndarray, **kwargs) -> np.ndarray: pass @app.task(name='cv_task.cv_segmentation') def cv_segmentation(src: np.ndarray, **kwargs) -> np.ndarray: pass
28.270588
73
0.641282
335
2,403
4.474627
0.176119
0.080053
0.044029
0.052035
0.717812
0.717812
0.692462
0.651101
0.651101
0.651101
0
0.000529
0.213899
2,403
84
74
28.607143
0.793012
0.017062
0
0.59375
0
0
0.100933
0.009754
0
0
0
0.011905
0
1
0.09375
false
0.03125
0.140625
0
0.296875
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
3
a29775b58402c1f6096066a15d4a7c30f11ab140
1,388
py
Python
q2_shogun/_formats.py
ChrisKeefe/q2-shogun
8d5547ce43d4915b2474fa2f7721313918af36c8
[ "BSD-3-Clause" ]
null
null
null
q2_shogun/_formats.py
ChrisKeefe/q2-shogun
8d5547ce43d4915b2474fa2f7721313918af36c8
[ "BSD-3-Clause" ]
null
null
null
q2_shogun/_formats.py
ChrisKeefe/q2-shogun
8d5547ce43d4915b2474fa2f7721313918af36c8
[ "BSD-3-Clause" ]
null
null
null
# ---------------------------------------------------------------------------- # Copyright (c) 2018, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ---------------------------------------------------------------------------- from qiime2.plugin import model class Bowtie2IndexFileFormat(model.BinaryFileFormat): def _validate_(self, level): # It's not clear if there is any way to tell if a Bowtie2 index is # correct or not. # bowtie2 does have an inspect method — this inspects at the dir level # not on the file level. # may also want to validate that all files have the same basename pass class Bowtie2IndexDirFmt(model.DirectoryFormat): idx1 = model.File('.+(?<!\.rev)\.1\.bt2', format=Bowtie2IndexFileFormat) idx2 = model.File('.+(?<!\.rev)\.2\.bt2', format=Bowtie2IndexFileFormat) ref3 = model.File('.+\.3\.bt2', format=Bowtie2IndexFileFormat) ref4 = model.File('.+\.4\.bt2', format=Bowtie2IndexFileFormat) rev1 = model.File('.+\.rev\.1\.bt2', format=Bowtie2IndexFileFormat) rev2 = model.File('.+\.rev\.2\.bt2', format=Bowtie2IndexFileFormat) def get_name(self): filename = str(self.idx1.path_maker().relative_to(self.path)) return filename.rsplit('.1.bt2')[0]
42.060606
78
0.605187
161
1,388
5.192547
0.571429
0.064593
0.222488
0.0311
0.210526
0.210526
0.210526
0
0
0
0
0.032958
0.169308
1,388
32
79
43.375
0.69124
0.407781
0
0
0
0
0.118665
0
0
0
0
0
0
1
0.142857
false
0.071429
0.071429
0
0.857143
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
3
a29a77680cc4363c3143328281e289f220011909
1,225
py
Python
tests/unit/wallet/test_dewies.py
vyaspranjal33/lbry
e03e41ad3105ccc0d8d8891b0e9fa63f9bbfce34
[ "MIT" ]
null
null
null
tests/unit/wallet/test_dewies.py
vyaspranjal33/lbry
e03e41ad3105ccc0d8d8891b0e9fa63f9bbfce34
[ "MIT" ]
null
null
null
tests/unit/wallet/test_dewies.py
vyaspranjal33/lbry
e03e41ad3105ccc0d8d8891b0e9fa63f9bbfce34
[ "MIT" ]
null
null
null
import unittest from lbrynet.wallet.dewies import lbc_to_dewies as l2d, dewies_to_lbc as d2l class TestDeweyConversion(unittest.TestCase): def test_good_output(self): self.assertEqual(d2l(1), "0.00000001") self.assertEqual(d2l(10**7), "0.1") self.assertEqual(d2l(2*10**8), "2.0") self.assertEqual(d2l(2*10**17), "2000000000.0") def test_good_input(self): self.assertEqual(l2d("0.00000001"), 1) self.assertEqual(l2d("0.1"), 10**7) self.assertEqual(l2d("1.0"), 10**8) self.assertEqual(l2d("2.00000000"), 2*10**8) self.assertEqual(l2d("2000000000.0"), 2*10**17) def test_bad_input(self): with self.assertRaises(ValueError): l2d("1") with self.assertRaises(ValueError): l2d("-1.0") with self.assertRaises(ValueError): l2d("10000000000.0") with self.assertRaises(ValueError): l2d("1.000000000") with self.assertRaises(ValueError): l2d("-0") with self.assertRaises(ValueError): l2d("1") with self.assertRaises(ValueError): l2d(".1") with self.assertRaises(ValueError): l2d("1e-7")
32.236842
76
0.594286
153
1,225
4.69281
0.248366
0.188022
0.222841
0.334262
0.495822
0.332869
0.285515
0.235376
0.235376
0.235376
0
0.147702
0.253878
1,225
37
77
33.108108
0.637856
0
0
0.322581
0
0
0.084898
0
0
0
0
0
0.548387
1
0.096774
false
0
0.064516
0
0.193548
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
3
a2da81a22ce348712a67db4cad0b4cdb6fc85be7
111
py
Python
back-end/tests/__init__.py
JAYqq/MonGo
e33c9f62c2cf494af2b2d33408853294f3aed168
[ "MIT" ]
1
2019-03-26T04:44:59.000Z
2019-03-26T04:44:59.000Z
back-end/tests/__init__.py
JAYqq/MonGo
e33c9f62c2cf494af2b2d33408853294f3aed168
[ "MIT" ]
5
2020-02-12T13:32:08.000Z
2021-06-02T00:27:16.000Z
back-end/tests/__init__.py
JAYqq/MonGo
e33c9f62c2cf494af2b2d33408853294f3aed168
[ "MIT" ]
null
null
null
from config import Config class TestConfig(Config): TESTING=True SQLALCHEMY_DATABASE_URI = 'sqlite://'
22.2
41
0.747748
13
111
6.230769
0.846154
0
0
0
0
0
0
0
0
0
0
0
0.162162
111
4
42
27.75
0.870968
0
0
0
0
0
0.081081
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
a2f57d7d746f1e55e4a6459c04ec7e10b1601869
103
py
Python
helper2.py
adamghx/cs3240-labdemo
4c722e07f027b3c7a3e06c7532e351b11ec06ce5
[ "MIT" ]
null
null
null
helper2.py
adamghx/cs3240-labdemo
4c722e07f027b3c7a3e06c7532e351b11ec06ce5
[ "MIT" ]
null
null
null
helper2.py
adamghx/cs3240-labdemo
4c722e07f027b3c7a3e06c7532e351b11ec06ce5
[ "MIT" ]
null
null
null
from helper import greeting def main(): greeting("Hi, there!") if __name__ == "__main__": main()
12.875
27
0.660194
13
103
4.615385
0.769231
0
0
0
0
0
0
0
0
0
0
0
0.184466
103
7
28
14.714286
0.714286
0
0
0
0
0
0.174757
0
0
0
0
0
0
1
0.2
true
0
0.2
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
a2fe7ff3f3f5a50621997877e7d0619e72a59577
185
py
Python
abc/abc161/abc161b.py
c-yan/atcoder
940e49d576e6a2d734288fadaf368e486480a948
[ "MIT" ]
1
2019-08-21T00:49:34.000Z
2019-08-21T00:49:34.000Z
abc/abc161/abc161b.py
c-yan/atcoder
940e49d576e6a2d734288fadaf368e486480a948
[ "MIT" ]
null
null
null
abc/abc161/abc161b.py
c-yan/atcoder
940e49d576e6a2d734288fadaf368e486480a948
[ "MIT" ]
null
null
null
N, M = map(int, input().split()) A = list(map(int, input().split())) threshold = sum(A) / (4 * M) if len([a for a in A if a >= threshold]) >= M: print('Yes') else: print('No')
20.555556
46
0.535135
33
185
3
0.575758
0.121212
0.222222
0.323232
0
0
0
0
0
0
0
0.006897
0.216216
185
8
47
23.125
0.675862
0
0
0
0
0
0.027027
0
0
0
0
0
0
1
0
false
0
0
0
0
0.285714
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
0
0
0
0
0
3
0c12171ce127330c68d4e836d71474508956428b
184
py
Python
currency_converter/converter/models.py
jbhayback/currency-converter
c7e0bf2663ee9d60a97cb9f76269691574fce0a0
[ "MIT" ]
null
null
null
currency_converter/converter/models.py
jbhayback/currency-converter
c7e0bf2663ee9d60a97cb9f76269691574fce0a0
[ "MIT" ]
null
null
null
currency_converter/converter/models.py
jbhayback/currency-converter
c7e0bf2663ee9d60a97cb9f76269691574fce0a0
[ "MIT" ]
null
null
null
from django.db import models # Create your models here. class Currencies(models.Model): id = models.AutoField(primary_key=True) currency_name = models.CharField(max_length=3)
26.285714
50
0.766304
26
184
5.307692
0.846154
0
0
0
0
0
0
0
0
0
0
0.006329
0.141304
184
6
51
30.666667
0.867089
0.130435
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
0c33ad46502ed2ff065d77b0d178ca74fc10e9b3
344
py
Python
kicker/SymbolMapper.py
KI-cker/Ki-cker
b48ae75bfeea970940ad657c73d71438531259c6
[ "Apache-2.0" ]
null
null
null
kicker/SymbolMapper.py
KI-cker/Ki-cker
b48ae75bfeea970940ad657c73d71438531259c6
[ "Apache-2.0" ]
14
2018-02-21T17:58:33.000Z
2022-03-11T23:16:09.000Z
kicker/SymbolMapper.py
KI-cker/Ki-cker
b48ae75bfeea970940ad657c73d71438531259c6
[ "Apache-2.0" ]
1
2018-02-22T09:28:26.000Z
2018-02-22T09:28:26.000Z
class SymbolMapper(object): def __init__(self): self.symbolmap = {0: '0', 1: '+', -1: '-'} @staticmethod def normalize(value): return 0 if value == 0 else value / abs(value) def inputs2symbols(self, inputs): return map( lambda value: self.symbolmap[SymbolMapper.normalize(value)], inputs)
26.461538
80
0.604651
39
344
5.230769
0.512821
0.127451
0
0
0
0
0
0
0
0
0
0.027451
0.258721
344
12
81
28.666667
0.772549
0
0
0
0
0
0.008721
0
0
0
0
0
0
1
0.333333
false
0
0
0.222222
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
0c3f2039bbc159a5bdba79a6798166e1423783aa
118
py
Python
pokedex/abilities/urls.py
ToniIvars/django-pokedex
37c8b5011658ee23f5df4db8a26db044a4fcb35f
[ "MIT" ]
null
null
null
pokedex/abilities/urls.py
ToniIvars/django-pokedex
37c8b5011658ee23f5df4db8a26db044a4fcb35f
[ "MIT" ]
null
null
null
pokedex/abilities/urls.py
ToniIvars/django-pokedex
37c8b5011658ee23f5df4db8a26db044a4fcb35f
[ "MIT" ]
null
null
null
from django.urls import path from . import views urlpatterns = [ path('<name>', views.ability, name='ability'), ]
19.666667
50
0.686441
15
118
5.4
0.6
0
0
0
0
0
0
0
0
0
0
0
0.161017
118
6
51
19.666667
0.818182
0
0
0
0
0
0.109244
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
0c3fbd64e82cc62cfa9a15428e01856cbf3f81f6
96
py
Python
accounting_integrations/fyle/apps.py
fylein/fyle-accounting-integrations
f1b4d01c815235dff9070f3f79313a3234be9b66
[ "MIT" ]
1
2019-05-22T06:17:24.000Z
2019-05-22T06:17:24.000Z
accounting_integrations/fyle/apps.py
fylein/fyle-accounting-integrations
f1b4d01c815235dff9070f3f79313a3234be9b66
[ "MIT" ]
null
null
null
accounting_integrations/fyle/apps.py
fylein/fyle-accounting-integrations
f1b4d01c815235dff9070f3f79313a3234be9b66
[ "MIT" ]
null
null
null
from django.apps import AppConfig class FyleImportConfig(AppConfig): name = 'fyle_import'
16
34
0.770833
11
96
6.636364
0.818182
0
0
0
0
0
0
0
0
0
0
0
0.15625
96
5
35
19.2
0.901235
0
0
0
0
0
0.114583
0
0
0
0
0
0
1
0
false
0
1
0
1.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
0c456d009fbfe2369189c452116cd3c667067330
219
py
Python
desafio017.py
mario-nobre/python-guanabara
2048d833f61c8545ced2163ae1b6b0d844494ada
[ "MIT" ]
null
null
null
desafio017.py
mario-nobre/python-guanabara
2048d833f61c8545ced2163ae1b6b0d844494ada
[ "MIT" ]
null
null
null
desafio017.py
mario-nobre/python-guanabara
2048d833f61c8545ced2163ae1b6b0d844494ada
[ "MIT" ]
null
null
null
co=float(input('digite a medida do cateto oposto ')) ca=float(input('digite a medida do cateto adjacente ')) from math import hypot h=hypot(co,ca) print('a hipotenusa do triângulo retângulo tem medida de {}'.format(h))
36.5
71
0.748858
37
219
4.432432
0.621622
0.121951
0.195122
0.207317
0.378049
0.378049
0.378049
0
0
0
0
0
0.127854
219
5
72
43.8
0.858639
0
0
0
0
0
0.552511
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0.2
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
0
0
0
0
0
3
0c45b31cc4a618854a9460b669d36749ed40e8e9
5,937
py
Python
storefront/boto/sqs/20070501/message.py
linkedin/indextank-service
880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e
[ "Apache-2.0" ]
26
2015-06-15T11:21:09.000Z
2020-12-27T19:42:14.000Z
storefront/boto/sqs/20070501/message.py
LinkedInAttic/indextank-service
880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e
[ "Apache-2.0" ]
1
2020-09-15T19:34:38.000Z
2020-09-15T19:34:38.000Z
storefront/boto/sqs/20070501/message.py
LinkedInAttic/indextank-service
880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e
[ "Apache-2.0" ]
12
2015-03-17T17:14:19.000Z
2019-12-21T13:26:23.000Z
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # 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, dis- # tribute, sublicense, and/or sell copies of the Software, and to permit # persons to whom the Software is furnished to do so, subject to the fol- # lowing 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 MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT # SHALL THE AUTHOR 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. """ Represents an SQS Message """ import base64 import StringIO class RawMessage: """ Base class for SQS messages. RawMessage does not encode the message in any way. Whatever you store in the body of the message is what will be written to SQS and whatever is returned from SQS is stored directly into the body of the message. """ def __init__(self, queue=None, body=''): self.queue = queue self._body = '' self.set_body(body) self.id = None def __len__(self): return len(self._body) def startElement(self, name, attrs, connection): return None def endElement(self, name, value, connection): if name == 'MessageBody': self.set_body(value) elif name == 'MessageId': self.id = value else: setattr(self, name, value) def set_body(self, body): """ Set the body of the message. You should always call this method rather than setting the attribute directly. """ self._body = body def get_body(self): """ Retrieve the body of the message. """ return self._body def get_body_encoded(self): """ This method is really a semi-private method used by the Queue.write method when writing the contents of the message to SQS. The RawMessage class does not encode the message in any way so this just calls get_body(). You probably shouldn't need to call this method in the normal course of events. """ return self.get_body() def change_visibility(self, vtimeout): """ Convenience function to allow you to directly change the invisibility timeout for an individual message that has been read from an SQS queue. This won't affect the default visibility timeout of the queue. """ return self.queue.connection.change_message_visibility(self.queue.id, self.id, vtimeout) class Message(RawMessage): """ The default Message class used for SQS queues. This class automatically encodes/decodes the message body using Base64 encoding to avoid any illegal characters in the message body. See: http://developer.amazonwebservices.com/connect/thread.jspa?messageID=49680%EC%88%90 for details on why this is a good idea. The encode/decode is meant to be transparent to the end-user. """ def endElement(self, name, value, connection): if name == 'MessageBody': # Decode the message body returned from SQS using base64 self.set_body(base64.b64decode(value)) elif name == 'MessageId': self.id = value else: setattr(self, name, value) def get_body_encoded(self): """ Because the Message class encodes the message body in base64 this private method used by queue.write needs to perform the encoding. """ return base64.b64encode(self.get_body()) class MHMessage(Message): """ The MHMessage class provides a message that provides RFC821-like headers like this: HeaderName: HeaderValue The encoding/decoding of this is handled automatically and after the message body has been read, the message instance can be treated like a mapping object, i.e. m['HeaderName'] would return 'HeaderValue'. """ def __init__(self, queue=None, body='', xml_attrs=None): self._dict = {} Message.__init__(self, queue, body) def set_body(self, body): fp = StringIO.StringIO(body) line = fp.readline() while line: delim = line.find(':') key = line[0:delim] value = line[delim+1:].strip() self._dict[key.strip()] = value.strip() line = fp.readline() def get_body(self): s = '' for key,value in self._dict.items(): s = s + '%s: %s\n' % (key, value) return s def __len__(self): return len(self.get_body()) def __getitem__(self, key): if self._dict.has_key(key): return self._dict[key] else: raise KeyError(key) def __setitem__(self, key, value): self._dict[key] = value def keys(self): return self._dict.keys() def values(self): return self._dict.values() def items(self): return self._dict.items() def has_key(self, key): return self._dict.has_key(key) def update(self, d): return self._dict.update(d) def get(self, key, default=None): return self._dict.get(key, default)
32.801105
87
0.629611
783
5,937
4.689655
0.339719
0.038126
0.026688
0.013072
0.153595
0.104031
0.078431
0.078431
0.061547
0.03268
0
0.009015
0.290045
5,937
180
88
32.983333
0.862159
0.481051
0
0.294872
0
0
0.017747
0
0
0
0
0
0
1
0.282051
false
0
0.025641
0.115385
0.538462
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
0c6080d52c807df7818b3a0e9f216e74d3c0861b
697
py
Python
17_logging_and_monitoring/start_17_blue_yellow_app_monitoring/blue_yellow_app/data/purchase.py
g2gcio/course-demo
b0d00a6ac7a6a6a17af963cee67cf13dc5941e95
[ "MIT" ]
276
2016-04-04T20:57:36.000Z
2022-03-12T02:42:46.000Z
17_logging_and_monitoring/start_17_blue_yellow_app_monitoring/blue_yellow_app/data/purchase.py
g2gcio/course-demo
b0d00a6ac7a6a6a17af963cee67cf13dc5941e95
[ "MIT" ]
37
2016-10-13T12:04:27.000Z
2020-11-22T10:36:53.000Z
17_logging_and_monitoring/start_17_blue_yellow_app_monitoring/blue_yellow_app/data/purchase.py
g2gcio/course-demo
b0d00a6ac7a6a6a17af963cee67cf13dc5941e95
[ "MIT" ]
163
2016-10-03T02:10:00.000Z
2022-03-25T03:43:01.000Z
import datetime import sqlalchemy import sqlalchemy.orm from sqlalchemy import Column from sqlalchemy import DateTime from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchemy import String from blue_yellow_app.data.modelbase import SqlAlchemyBase class AlbumPurchase(SqlAlchemyBase): __tablename__ = 'AlbumPurchase' id = Column(Integer, primary_key=True, autoincrement=True) created = Column(DateTime, default=datetime.datetime.now, index=True) description = Column(String) amount_paid = sqlalchemy.Column(sqlalchemy.Float, index=True) album_id = Column(String, ForeignKey('Album.id')) user_id = Column(String, ForeignKey('Account.id'))
26.807692
73
0.786227
82
697
6.560976
0.414634
0.178439
0.185874
0.089219
0
0
0
0
0
0
0
0
0.137733
697
25
74
27.88
0.895175
0
0
0
0
0
0.044476
0
0
0
0
0
0
1
0
false
0
0.529412
0
1
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
0c62aabb759b7d13357748f636d492ce98395509
279
py
Python
evaluation/migrations/0004_merge_20181223_1602.py
AymenQ/tarteel.io
a72150bca90b5244580daf172d5f8d738ba98c1b
[ "MIT" ]
null
null
null
evaluation/migrations/0004_merge_20181223_1602.py
AymenQ/tarteel.io
a72150bca90b5244580daf172d5f8d738ba98c1b
[ "MIT" ]
null
null
null
evaluation/migrations/0004_merge_20181223_1602.py
AymenQ/tarteel.io
a72150bca90b5244580daf172d5f8d738ba98c1b
[ "MIT" ]
null
null
null
# Generated by Django 2.1.3 on 2018-12-23 21:02 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('evaluation', '0003_auto_20181210_0816'), ('evaluation', '0003_auto_20181202_1602'), ] operations = [ ]
18.6
50
0.655914
33
279
5.363636
0.818182
0.158192
0.20339
0
0
0
0
0
0
0
0
0.217593
0.225806
279
14
51
19.928571
0.601852
0.16129
0
0
1
0
0.284483
0.198276
0
0
0
0
0
1
0
false
0
0.125
0
0.5
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
a7444113d46bf5f5d39b968eb2273ff8dd343777
218
py
Python
tests/__main__.py
Privex/python-helpers
1c976ce5b0e2c5241ea0bdf330bd6701b5e31153
[ "X11" ]
12
2019-06-18T11:17:41.000Z
2021-09-13T23:00:21.000Z
tests/__main__.py
Privex/python-coinhandlers
b24c0c3f7d81cedefd52a5837a371cfef2f83e97
[ "X11" ]
1
2019-10-13T07:34:44.000Z
2019-10-13T07:34:44.000Z
tests/__main__.py
Privex/python-coinhandlers
b24c0c3f7d81cedefd52a5837a371cfef2f83e97
[ "X11" ]
4
2019-10-10T10:15:09.000Z
2021-05-16T01:55:48.000Z
""" This file exists to allow for ``python3 -m tests`` to work, as python's module execution option attempts to load ``__main__`` from a package. """ from tests import * if __name__ == '__main__': unittest.main()
24.222222
95
0.697248
32
218
4.375
0.8125
0
0
0
0
0
0
0
0
0
0
0.005587
0.178899
218
8
96
27.25
0.776536
0.646789
0
0
0
0
0.115942
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
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
3
a769df3f78292663e6a4c642a787b894aa8d8eb9
108
py
Python
novaposhta/__init__.py
last-partizan/novaposhta-api-client
db21a1b112631ee3c4bbd66e5b88ca3ca993d976
[ "MIT" ]
1
2017-11-20T15:04:57.000Z
2017-11-20T15:04:57.000Z
novaposhta/__init__.py
last-partizan/novaposhta-api-client
db21a1b112631ee3c4bbd66e5b88ca3ca993d976
[ "MIT" ]
null
null
null
novaposhta/__init__.py
last-partizan/novaposhta-api-client
db21a1b112631ee3c4bbd66e5b88ca3ca993d976
[ "MIT" ]
1
2021-04-10T19:08:57.000Z
2021-04-10T19:08:57.000Z
from . import models # noqa from .api import NovaPoshta __author__ = 'semolex' __all__ = ['NovaPoshta']
18
27
0.712963
12
108
5.75
0.75
0
0
0
0
0
0
0
0
0
0
0
0.185185
108
5
28
21.6
0.784091
0.037037
0
0
0
0
0.166667
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
a76bb4dff1fe0879751b999f54a3655021638b4f
274
py
Python
blog/posts/urls.py
abdullah1107/Django_RestApi-New-
b4fd65d73ca95d1a373758f46093e5fe28786980
[ "MIT" ]
1
2019-12-14T06:09:01.000Z
2019-12-14T06:09:01.000Z
blog/posts/urls.py
abdullah1107/Django_RestApi-New-
b4fd65d73ca95d1a373758f46093e5fe28786980
[ "MIT" ]
null
null
null
blog/posts/urls.py
abdullah1107/Django_RestApi-New-
b4fd65d73ca95d1a373758f46093e5fe28786980
[ "MIT" ]
null
null
null
from django.urls import path from . import views from .api import views urlpatterns = [ path('', views.PostListView.as_view(), name=None), path('create/', views.PostCreateView.as_view(), name=None), path('<int:pk>/', views.PostDetailView.as_view(), name=None) ]
30.444444
64
0.69708
37
274
5.081081
0.486486
0.095745
0.159574
0.223404
0.191489
0
0
0
0
0
0
0
0.135037
274
9
65
30.444444
0.793249
0
0
0
0
0
0.058182
0
0
0
0
0
0
1
0
false
0
0.375
0
0.375
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
a76ce790b74a4c30effb8092ca591a01c2299f84
262
py
Python
registry/permissions.py
Nephilim-Jack/regUserBack
00bc28088ea9d4c681c26d1317da6a14b36e38c5
[ "MIT" ]
null
null
null
registry/permissions.py
Nephilim-Jack/regUserBack
00bc28088ea9d4c681c26d1317da6a14b36e38c5
[ "MIT" ]
null
null
null
registry/permissions.py
Nephilim-Jack/regUserBack
00bc28088ea9d4c681c26d1317da6a14b36e38c5
[ "MIT" ]
null
null
null
from rest_framework.permissions import BasePermission class BaseUserPermission(BasePermission): def has_permission(self, request, view): if view.action == 'getUserLogin': return True return super().has_permission(request, view)
29.111111
53
0.717557
27
262
6.851852
0.740741
0.140541
0
0
0
0
0
0
0
0
0
0
0.20229
262
8
54
32.75
0.885167
0
0
0
0
0
0.045802
0
0
0
0
0
0
1
0.166667
false
0
0.166667
0
0.833333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
a77246c6713e7ec7497193420e2218d7550101ac
1,914
py
Python
xero_python/accounting/models/repeating_invoices.py
sromero84/xero-python
89558c0baa8080c3f522701eb1b94f909248dbd7
[ "MIT" ]
null
null
null
xero_python/accounting/models/repeating_invoices.py
sromero84/xero-python
89558c0baa8080c3f522701eb1b94f909248dbd7
[ "MIT" ]
null
null
null
xero_python/accounting/models/repeating_invoices.py
sromero84/xero-python
89558c0baa8080c3f522701eb1b94f909248dbd7
[ "MIT" ]
null
null
null
# coding: utf-8 """ Accounting API No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 OpenAPI spec version: 2.3.4 Contact: api@xero.com Generated by: https://openapi-generator.tech """ import re # noqa: F401 from xero_python.models import BaseModel class RepeatingInvoices(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ openapi_types = {"repeating_invoices": "list[RepeatingInvoice]"} attribute_map = {"repeating_invoices": "RepeatingInvoices"} def __init__(self, repeating_invoices=None): # noqa: E501 """RepeatingInvoices - a model defined in OpenAPI""" # noqa: E501 self._repeating_invoices = None self.discriminator = None if repeating_invoices is not None: self.repeating_invoices = repeating_invoices @property def repeating_invoices(self): """Gets the repeating_invoices of this RepeatingInvoices. # noqa: E501 :return: The repeating_invoices of this RepeatingInvoices. # noqa: E501 :rtype: list[RepeatingInvoice] """ return self._repeating_invoices @repeating_invoices.setter def repeating_invoices(self, repeating_invoices): """Sets the repeating_invoices of this RepeatingInvoices. :param repeating_invoices: The repeating_invoices of this RepeatingInvoices. # noqa: E501 :type: list[RepeatingInvoice] """ self._repeating_invoices = repeating_invoices
29
124
0.671369
210
1,914
5.971429
0.37619
0.257576
0.100478
0.070175
0.307815
0.216906
0.182616
0.182616
0.060606
0.060606
0
0.017349
0.247126
1,914
65
125
29.446154
0.85288
0.421108
0
0
1
0
0.102881
0.030178
0
0
0
0
0
1
0.1875
false
0
0.125
0
0.5625
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
a7908ab8c52c1e6e3c2a925752339a22c07cce0d
130
py
Python
script/tools/ignore_file.py
evoldourden/FrackinUniverse-sChinese-Project
db33417f7693df2a8ed0055afc48dbe30c3da0c0
[ "MIT" ]
null
null
null
script/tools/ignore_file.py
evoldourden/FrackinUniverse-sChinese-Project
db33417f7693df2a8ed0055afc48dbe30c3da0c0
[ "MIT" ]
null
null
null
script/tools/ignore_file.py
evoldourden/FrackinUniverse-sChinese-Project
db33417f7693df2a8ed0055afc48dbe30c3da0c0
[ "MIT" ]
null
null
null
# Ignore file list ignore_filelist = [ 'teslagun.activeitem', 'teslagun2.activeitem', ] ignore_filelist_patch = [ ]
13
27
0.669231
12
130
7
0.666667
0.333333
0
0
0
0
0
0
0
0
0
0.009804
0.215385
130
9
28
14.444444
0.813725
0.123077
0
0
0
0
0.348214
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
a79454eb94163d981cff288c16d13accb25d3dfc
729
py
Python
aspdotnet/datadog_checks/aspdotnet/aspdotnet.py
tcpatterson/integrations-core
3692601de09f8db60f42612b0d623509415bbb53
[ "BSD-3-Clause" ]
null
null
null
aspdotnet/datadog_checks/aspdotnet/aspdotnet.py
tcpatterson/integrations-core
3692601de09f8db60f42612b0d623509415bbb53
[ "BSD-3-Clause" ]
null
null
null
aspdotnet/datadog_checks/aspdotnet/aspdotnet.py
tcpatterson/integrations-core
3692601de09f8db60f42612b0d623509415bbb53
[ "BSD-3-Clause" ]
null
null
null
# (C) Datadog, Inc. 2013-present # All rights reserved # Licensed under Simplified BSD License (see LICENSE) from six import PY3 from datadog_checks.base import PDHBaseCheck from .metrics import DEFAULT_COUNTERS EVENT_TYPE = SOURCE_TYPE_NAME = 'aspdotnet' class AspdotnetCheck(PDHBaseCheck): def __new__(cls, name, init_config, instances): if PY3: from .check import AspdotnetCheckV2 return AspdotnetCheckV2(name, init_config, instances) else: return super(AspdotnetCheck, cls).__new__(cls) def __init__(self, name, init_config, instances=None): super(AspdotnetCheck, self).__init__(name, init_config, instances=instances, counter_list=DEFAULT_COUNTERS)
30.375
115
0.731139
86
729
5.883721
0.546512
0.063241
0.110672
0.181818
0
0
0
0
0
0
0
0.013582
0.192044
729
23
116
31.695652
0.845501
0.139918
0
0
0
0
0.014446
0
0
0
0
0
0
1
0.153846
false
0
0.307692
0
0.692308
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
a79d1a25e0fd12d08cb7790e77ab5c85c084c39f
212
py
Python
dev_up/models/vk/search_audio.py
lordralinc/dev_up
e035afd386c8a16c574aaa7615c263f1c1369911
[ "MIT" ]
2
2021-01-10T15:44:41.000Z
2021-01-10T15:59:48.000Z
dev_up/models/vk/search_audio.py
lordralinc/dev_up
e035afd386c8a16c574aaa7615c263f1c1369911
[ "MIT" ]
null
null
null
dev_up/models/vk/search_audio.py
lordralinc/dev_up
e035afd386c8a16c574aaa7615c263f1c1369911
[ "MIT" ]
4
2021-01-10T15:45:19.000Z
2021-03-05T20:09:57.000Z
from pydantic import BaseModel class VkSearchAudioResponse(BaseModel): q: str count: int attachments: str msg_response: str class VkSearchAudio(BaseModel): response: VkSearchAudioResponse
16.307692
39
0.75
21
212
7.52381
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.198113
212
12
40
17.666667
0.929412
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.125
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
3
a7b9297b2d74a3a4fbac1f2e93de298645ba2b9a
304
py
Python
01-logica-de-programacao-e-algoritmos/Aula 05/5 Recursos avancados com funcoes/5.2 Funcao como parametro de funcao/ex01.py
rafaelbarretomg/Uninter
1f84b0103263177122663e991db3a8aeb106a959
[ "MIT" ]
null
null
null
01-logica-de-programacao-e-algoritmos/Aula 05/5 Recursos avancados com funcoes/5.2 Funcao como parametro de funcao/ex01.py
rafaelbarretomg/Uninter
1f84b0103263177122663e991db3a8aeb106a959
[ "MIT" ]
null
null
null
01-logica-de-programacao-e-algoritmos/Aula 05/5 Recursos avancados com funcoes/5.2 Funcao como parametro de funcao/ex01.py
rafaelbarretomg/Uninter
1f84b0103263177122663e991db3a8aeb106a959
[ "MIT" ]
null
null
null
# funcao como parametro de funcao # so imprime se o numero estiver correto def imprime_com_condicao(num, fcond): if fcond(num): print(num) def par(x): return x % 2 == 0 def impar(x): return not par(x) # Programa Principal # neste caso nao imprimira imprime_com_condicao(5, par)
16
40
0.684211
48
304
4.25
0.666667
0.098039
0.176471
0
0
0
0
0
0
0
0
0.012766
0.226974
304
18
41
16.888889
0.855319
0.375
0
0
0
0
0
0
0
0
0
0
0
1
0.375
false
0
0
0.25
0.625
0.125
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
a7be76ee5cd3a975a32123a5d2dab80b2c1c629e
417
py
Python
libp2p/stream_muxer/mplex/exceptions.py
g-r-a-n-t/py-libp2p
36a4a9150dcc53b42315b5c6868fccde5083963b
[ "Apache-2.0", "MIT" ]
315
2019-02-13T01:29:09.000Z
2022-03-28T13:44:07.000Z
libp2p/stream_muxer/mplex/exceptions.py
pipermerriam/py-libp2p
379a157d6b67e86a616b2458af519bbe5fb26a51
[ "Apache-2.0", "MIT" ]
249
2019-02-22T05:00:07.000Z
2022-03-29T16:30:46.000Z
libp2p/stream_muxer/mplex/exceptions.py
ralexstokes/py-libp2p
5144ab82894623969cb17baf0d4c64bd0a274068
[ "Apache-2.0", "MIT" ]
77
2019-02-24T19:45:17.000Z
2022-03-30T03:20:09.000Z
from libp2p.stream_muxer.exceptions import ( MuxedConnError, MuxedConnUnavailable, MuxedStreamClosed, MuxedStreamEOF, MuxedStreamReset, ) class MplexError(MuxedConnError): pass class MplexUnavailable(MuxedConnUnavailable): pass class MplexStreamReset(MuxedStreamReset): pass class MplexStreamEOF(MuxedStreamEOF): pass class MplexStreamClosed(MuxedStreamClosed): pass
14.892857
45
0.76259
31
417
10.225806
0.580645
0.113565
0
0
0
0
0
0
0
0
0
0.002924
0.179856
417
27
46
15.444444
0.923977
0
0
0.294118
0
0
0
0
0
0
0
0
0
1
0
true
0.294118
0.058824
0
0.352941
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
3
a7d1a09e420232e6175c5cd0f1e6a7faf572e4aa
126
py
Python
imagepy/menus/__init__.py
siyemuxu888/imagepy
a933526483a15da282bacac54608d44d2173beb4
[ "BSD-4-Clause" ]
null
null
null
imagepy/menus/__init__.py
siyemuxu888/imagepy
a933526483a15da282bacac54608d44d2173beb4
[ "BSD-4-Clause" ]
null
null
null
imagepy/menus/__init__.py
siyemuxu888/imagepy
a933526483a15da282bacac54608d44d2173beb4
[ "BSD-4-Clause" ]
null
null
null
catlog = ['File','Edit','Image','Process','Selection', 'Analysis','Kit3D', 'Plugins','Window','Skimage','Opencv','ITK','Help']
126
126
0.642857
14
126
5.785714
1
0
0
0
0
0
0
0
0
0
0
0.008197
0.031746
126
1
126
126
0.655738
0
0
0
0
0
0.590551
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
a7d6694743abbc2f9c473a8c591d8d24000ac031
6,960
py
Python
garden_calendar_time/equinox_solstice.py
gossrock/garden_calendar_time
1cabcbd3bd20614a2adb1110ac994b04a7f666c9
[ "MIT" ]
null
null
null
garden_calendar_time/equinox_solstice.py
gossrock/garden_calendar_time
1cabcbd3bd20614a2adb1110ac994b04a7f666c9
[ "MIT" ]
null
null
null
garden_calendar_time/equinox_solstice.py
gossrock/garden_calendar_time
1cabcbd3bd20614a2adb1110ac994b04a7f666c9
[ "MIT" ]
null
null
null
import csv from pathlib import Path from typing import NamedTuple from typing import Dict, Callable from functools import partial from garden_calendar_time.location import LatLong from garden_calendar_time.utcdatetime import UTCDateTime, Time, TimeDelta, parse_iso_date class YearEquinoxSolsticData(NamedTuple): year: int march_equinox: UTCDateTime june_solstice: UTCDateTime september_equinox: UTCDateTime december_solstice: UTCDateTime def nearest_day_at_time_to_datetime(time: Time, target_datetime: UTCDateTime) -> UTCDateTime: half_day_in_seconds = 12 * 60 * 60 target_date = target_datetime.date() choice1 = UTCDateTime.combine(target_date, time) choice1_diff = abs(target_datetime - choice1) if choice1_diff.days == 0 and choice1_diff.seconds <= half_day_in_seconds: return choice1 choice2 = choice1 + TimeDelta(1) choice2_diff = abs(target_datetime - choice2) if choice2_diff.days == 0 and choice2_diff.seconds <= half_day_in_seconds: return choice2 choice3 = choice1 - TimeDelta(1) choice3_diff = abs(target_datetime - choice3) if choice3_diff.days == 0 and choice3_diff.seconds <= half_day_in_seconds: return choice3 DATABASE: Dict[int, YearEquinoxSolsticData] = {} DEFAULT_DATA_FILE = Path(__file__).parent.joinpath('data/equinox_solstice_data.csv') # csv columns YEAR = 0 MARCH_EQUINOX = 1 JUNE_SOLSTICE = 2 SEPTEMBER_EQUINOX = 3 DECEMBER_SOLSTICE = 4 def load_data_from_csv(csv_file_name: str = DEFAULT_DATA_FILE) -> None: with open(csv_file_name) as data_file: csv_reader = csv.reader(data_file) for row in csv_reader: year = int(row[YEAR]) march_equinox = parse_iso_date(row[MARCH_EQUINOX]) june_solstice = parse_iso_date(row[JUNE_SOLSTICE]) september_equinox = parse_iso_date(row[SEPTEMBER_EQUINOX]) december_solstice = parse_iso_date(row[DECEMBER_SOLSTICE]) DATABASE[year] = YearEquinoxSolsticData(year, march_equinox, june_solstice, september_equinox, december_solstice) def year_data(year: int) -> YearEquinoxSolsticData: if DATABASE == {}: load_data_from_csv() return DATABASE[year] # specific equinoxes and solstices def march_equinox(year: int, location: LatLong = LatLong(0,0)) -> UTCDateTime: return year_data(year).march_equinox def june_solstice(year: int, location: LatLong = LatLong(0,0)) -> UTCDateTime: return year_data(year).june_solstice def september_equinox(year: int, location: LatLong = LatLong(0,0)) -> UTCDateTime: return year_data(year).september_equinox def december_solstice(year:int, location: LatLong = LatLong(0,0)) -> UTCDateTime: return year_data(year).december_solstice # seasonal equinoxes and solstices def spring_equinox(year: int, location: LatLong = LatLong(0,0)) -> UTCDateTime: if location.lat >= 0: return march_equinox(year) else: return september_equinox(year) def summer_solstice(year: int, location: LatLong = LatLong(0,0)) -> UTCDateTime: if location.lat >= 0: return june_solstice(year) else: return december_solstice(year) def fall_equinox(year: int, location: LatLong = LatLong(0,0)) -> UTCDateTime: if location.lat >= 0: return september_equinox(year) else: return march_equinox(year) def winter_solstice(year: int, location: LatLong = LatLong(0,0)) -> UTCDateTime: if location.lat >= 0: return december_solstice(year) else: return june_solstice(year) # reletive specific equnoxes and solstices def _after(datetime:UTCDateTime, event_function: Callable, location: LatLong = LatLong(0,0)) -> UTCDateTime: if (event_function(datetime.year, location) - datetime).days >= 0: return event_function(datetime.year, location) else: return event_function(datetime.year + 1, location) def _before(datetime:UTCDateTime, event_function: Callable, location: LatLong = LatLong(0,0)) -> UTCDateTime: if (event_function(datetime.year, location) - datetime).days < 0: return event_function(datetime.year, location) else: return event_function(datetime.year - 1, location) def march_equinox_after(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _after(datetime, march_equinox, location) def march_equinox_before(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _before(datetime, march_equinox, location) def june_solstice_after(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _after(datetime, june_solstice, location) def june_solstice_before(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _before(datetime, june_solstice, location) def september_equinox_after(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _after(datetime, september_equinox, location) def september_equinox_before(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _before(datetime, september_equinox, location) def december_solstice_after(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _after(datetime, december_solstice, location) def december_solstice_before(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _before(datetime, december_solstice, location) # reletive seasonal equinoxes and solstices def spring_equinox_after(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _after(datetime, spring_equinox, location) def spring_equinox_before(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _before(datetime, spring_equinox, location) def summer_solstice_after(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _after(datetime, summer_solstice, location) def summer_solstice_before(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _before(datetime, summer_solstice, location) def fall_equinox_after(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _after(datetime, fall_equinox, location) def fall_equinox_before(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _before(datetime, fall_equinox, location) def winter_solstice_after(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _after(datetime, winter_solstice, location) def winter_solstice_before(datetime: UTCDateTime, location: LatLong = LatLong(0,0)) -> UTCDateTime: return _before(datetime, winter_solstice, location)
35.151515
109
0.723276
826
6,960
5.864407
0.110169
0.080512
0.118084
0.123452
0.599298
0.521263
0.521263
0.485136
0.485136
0.485136
0
0.016931
0.185345
6,960
197
110
35.329949
0.83739
0.022989
0
0.162602
0
0
0.004417
0.004417
0
0
0
0
0
1
0.235772
false
0
0.056911
0.162602
0.634146
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
ac04e45fb7efd16eef5f170ebdb869d511eddd3d
637
py
Python
msgraph/sharepoint/abstractions/ISharepointSite.py
SWB-Dev/microsoft-graph-api
07fef0071852a697bdf0b0a28a4758214621d5b2
[ "MIT" ]
null
null
null
msgraph/sharepoint/abstractions/ISharepointSite.py
SWB-Dev/microsoft-graph-api
07fef0071852a697bdf0b0a28a4758214621d5b2
[ "MIT" ]
null
null
null
msgraph/sharepoint/abstractions/ISharepointSite.py
SWB-Dev/microsoft-graph-api
07fef0071852a697bdf0b0a28a4758214621d5b2
[ "MIT" ]
null
null
null
from typing import Protocol, Callable from ... import IGraphResponse, IGraphFilter, IGraphAction from .ISharepointDocumentLibrary import ISharepointDocumentLibrary from .ISharepointList import ISharepointList class ISharepointSite(Protocol): def lists(self, list_name:str = None) -> ISharepointList: """""" def filters(self, filter_func:Callable[...,list[IGraphFilter]]) -> IGraphAction: """""" def documents(self, library_name:str) -> ISharepointDocumentLibrary: """""" def get(self, url:str = None) -> IGraphResponse: """""" def build_url(self) -> str: """"""
27.695652
84
0.66562
57
637
7.368421
0.473684
0.114286
0
0
0
0
0
0
0
0
0
0
0.202512
637
23
85
27.695652
0.826772
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0.4
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
3
ac1c85668a9bd509748b1a53906039614d33f427
95
py
Python
modelflow/notused__init__.py
IbHansen/ModelFlow
09b1f911332f3d0af700ec65d46e8d4a53335e19
[ "X11" ]
2
2019-06-13T15:50:42.000Z
2019-06-13T15:51:05.000Z
modelflow/notused__init__.py
IbHansen/modelflow
09b1f911332f3d0af700ec65d46e8d4a53335e19
[ "X11" ]
null
null
null
modelflow/notused__init__.py
IbHansen/modelflow
09b1f911332f3d0af700ec65d46e8d4a53335e19
[ "X11" ]
1
2019-05-10T09:35:59.000Z
2019-05-10T09:35:59.000Z
# -*- coding: utf-8 -*- """ Created on Sat Feb 29 09:54:51 2020 @author: bruger """
10.555556
36
0.515789
14
95
3.5
1
0
0
0
0
0
0
0
0
0
0
0.191176
0.284211
95
8
37
11.875
0.529412
0.789474
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
ac2187369c5deea320983291a63708dfc0270f00
123
py
Python
GithubTest.py
akanchhaS/python-goof
9ec011f459c0c8a7b9b58b4fe0a65255c2a5368e
[ "MIT" ]
null
null
null
GithubTest.py
akanchhaS/python-goof
9ec011f459c0c8a7b9b58b4fe0a65255c2a5368e
[ "MIT" ]
7
2020-02-22T18:04:41.000Z
2020-09-02T12:26:19.000Z
GithubTest.py
akanchhaS/python-goof
9ec011f459c0c8a7b9b58b4fe0a65255c2a5368e
[ "MIT" ]
8
2020-10-30T18:44:03.000Z
2022-02-24T22:15:47.000Z
from github import Github g = Github( ${{Pygithub.secrets}} ) for repo in g.get_user().get_repos(): print(repo.name)
17.571429
37
0.682927
19
123
4.315789
0.736842
0
0
0
0
0
0
0
0
0
0
0
0.162602
123
6
38
20.5
0.796117
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.25
null
null
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
ac23907ddad7e1df5b3643f0643f45035b761f25
270
py
Python
datastructure/practice/c1/r_1_10.py
stoneyangxu/python-kata
979af91c74718a525dcd2a83fe53ec6342af9741
[ "MIT" ]
null
null
null
datastructure/practice/c1/r_1_10.py
stoneyangxu/python-kata
979af91c74718a525dcd2a83fe53ec6342af9741
[ "MIT" ]
null
null
null
datastructure/practice/c1/r_1_10.py
stoneyangxu/python-kata
979af91c74718a525dcd2a83fe53ec6342af9741
[ "MIT" ]
null
null
null
import unittest def range_8() -> list: return [n for n in range(8, -10, -2)] class MyTestCase(unittest.TestCase): def test_something(self): self.assertEqual(range_8(), [8, 6, 4, 2, 0, -2, -4, -6, -8]) if __name__ == '__main__': unittest.main()
18
68
0.603704
41
270
3.707317
0.609756
0.118421
0
0
0
0
0
0
0
0
0
0.07109
0.218519
270
14
69
19.285714
0.649289
0
0
0
0
0
0.02963
0
0
0
0
0
0.125
1
0.25
false
0
0.125
0.125
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
ac28126ae19b3128bf5f85a601b84c3cefe050ba
253
py
Python
src/Python/101-200/151.ReverseWordsInString.py
Peefy/PeefyLeetCode
92156e4b48ba19e3f02e4286b9f733e9769a1dee
[ "Apache-2.0" ]
2
2018-05-03T07:50:03.000Z
2018-06-17T04:32:13.000Z
src/Python/101-200/151.ReverseWordsInString.py
Peefy/PeefyLeetCode
92156e4b48ba19e3f02e4286b9f733e9769a1dee
[ "Apache-2.0" ]
null
null
null
src/Python/101-200/151.ReverseWordsInString.py
Peefy/PeefyLeetCode
92156e4b48ba19e3f02e4286b9f733e9769a1dee
[ "Apache-2.0" ]
3
2018-11-09T14:18:11.000Z
2021-11-17T15:23:52.000Z
class Solution: def reverseWords(self, set): return ' '.join(set.split()[::-1]) if __name__ == "__main__": solution = Solution() print(solution.reverseWords("the sky is blue")) print(solution.reverseWords(" hello world! "))
23
52
0.632411
28
253
5.428571
0.714286
0.171053
0.328947
0
0
0
0
0
0
0
0
0.004975
0.205534
253
10
53
25.3
0.751244
0
0
0
0
0
0.15873
0
0
0
0
0
0
1
0.142857
false
0
0
0.142857
0.428571
0.285714
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
3
ac50dc05118a4a710ef6149c65fa8ce6bba0eb20
2,845
py
Python
backend/backend/settings/__init__.py
ambikads/portunus
a9c9047757528ef5667fcfda2eb43f313281a3c9
[ "MIT" ]
null
null
null
backend/backend/settings/__init__.py
ambikads/portunus
a9c9047757528ef5667fcfda2eb43f313281a3c9
[ "MIT" ]
null
null
null
backend/backend/settings/__init__.py
ambikads/portunus
a9c9047757528ef5667fcfda2eb43f313281a3c9
[ "MIT" ]
null
null
null
from .zygoat_settings import * # noqa AUTH_USER_MODEL = "authentication.User" INSTALLED_APPS = [ *INSTALLED_APPS, "rest_framework", "authentication", "rest_framework_simplejwt.token_blacklist", ] MIDDLEWARE = [ "corsheaders.middleware.CorsMiddleware", *MIDDLEWARE, ] REST_FRAMEWORK = { "DEFAULT_AUTHENTICATION_CLASSES": ( "simplejwt_extensions.authentication.JWTAuthentication", ), } DEFAULT_SIGNING_KEY = """-----BEGIN RSA PRIVATE KEY----- MIICXQIBAAKBgQC91RWCawEvxQj+tigRvuHxouO8jKd35ukUxFBFRAGcI57firbA kFII6zPIiWAENGMqtjX57hk9EjAZ27XvQ4SQACvD5j7htsJT31bZbVUH7a3JEDpx a02VXpXdfPYSs8umZkdxMxxmiD9uH9VmLN3VS14lxQlyJdlvbLmNCAf6uwIDAQAB AoGACXFcDIy+Fl46wFDXVWqlWpu7sFleyzwVRA8v3wIvAlFTSdNgm9uR+ReaD9Ol jw/8DtfZf4E0iDEra13egvRc16byYQ4qv0l7xvn3ATomxcPwbdvkfYE4C0EZFuXx ZZwSQwWsNl/36BSyZErw8y/THMIkOKRNFuJarK4P3aYppEECQQDpvRnL2kbbXbqW uB8Pt2hMfBXW/byCcctoI+cuqYAUJ/J1tLPe+q7sAW6Fr0WpYTpjljC+UCqu/a6a YgG0L6I5AkEAz+l7QfyFKk7jl05hEUly0CNshgJ8jLPcF2ZXILrcUwGxbpdyjmCJ ExiKpfzPufYeu7qLwhyaHniR9huSZIx0kwJBALMRTFIAR4iHpgsRw7omqKDv70tl 2KWWyF5gIxx8fsLyV64VYjfRlXD5J9MDFDtPYYwp4+3pPMoTT1C3BNcmJwECQEYV Ero0b4LKYsce4XNdSblFJ5Coh+k5u2eb1KSwuBG20WNQ44mAmtP4AsxewnqRrtxi zjdZQs4goDrQInGIMscCQQCIT5jvRb197iRinBqpNy01i7GdlLtMC7Z9V/PV0YW1 GmX50gvd7aA+i2UuZj7BxapFStyEGl4Nggglnn+QqQ+L -----END RSA PRIVATE KEY-----""" DEFAULT_VERIFYING_KEY = """-----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC91RWCawEvxQj+tigRvuHxouO8 jKd35ukUxFBFRAGcI57firbAkFII6zPIiWAENGMqtjX57hk9EjAZ27XvQ4SQACvD 5j7htsJT31bZbVUH7a3JEDpxa02VXpXdfPYSs8umZkdxMxxmiD9uH9VmLN3VS14l xQlyJdlvbLmNCAf6uwIDAQAB -----END PUBLIC KEY-----""" SIMPLE_JWT = { "USER_ID_FIELD": "portunus_uuid", "NEW_USER_CALLBACK": "backend.utils.create_user", "ALGORITHM": "RS512", "SIGNING_KEY": prod_required_env("DJANGO_JWT_SIGNING_KEY", DEFAULT_SIGNING_KEY), "VERIFYING_KEY": prod_required_env("DJANGO_JWT_VEFIFYING_KEY", DEFAULT_VERIFYING_KEY), } CORS_ORIGIN_ALLOW_ALL = DEBUG CORS_ALLOW_CREDENTIALS = True BASE_URL = env("DJANGO_BASE_URL", default="http://localhost:3000/") AUTH_PASSWORD_VALIDATORS = [ { "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", "OPTIONS": {"min_length": 7,}, }, {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",}, {"NAME": "authentication.password_validators.AlphaNumericPasswordValidator",}, ] DEFAULT_REDIRECT_URL = prod_required_env( "DJANGO_DEFAULT_REDIRECT_URL", "http://localhost:3000" ) VALID_REDIRECT_HOSTNAMES = ["localhost"] GOOGLE_APP_ID = prod_required_env("DJANGO_GOOGLE_APP_ID", default=None) FACEBOOK_CLIENT_ID = prod_required_env("DJANGO_FACEBOOK_CLIENT_ID", default=None) FACEBOOK_CLIENT_SECRET = prod_required_env("DJANGO_FACEBOOK_CLIENT_SECRET", default=None) SESSION_COOKIE_SAMESITE = None
35.5625
90
0.82109
235
2,845
9.574468
0.519149
0.028
0.04
0.056
0.124889
0.089778
0
0
0
0
0
0.063028
0.085413
2,845
79
91
36.012658
0.801691
0.001406
0
0
0
0
0.669954
0.53857
0
0
0
0
0
1
0
false
0.0625
0.015625
0
0.015625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
ac5470c4220c7cd784739a9a92c687cedbf7cf9f
355
py
Python
tests/items.py
castares/scrapy-sqlitem
169e46d0e10e13270c947b96f2674c80813d46db
[ "BSD-3-Clause" ]
41
2015-08-14T23:58:48.000Z
2022-01-08T16:56:57.000Z
tests/items.py
castares/scrapy-sqlitem
169e46d0e10e13270c947b96f2674c80813d46db
[ "BSD-3-Clause" ]
2
2016-08-28T21:51:33.000Z
2017-09-23T15:48:49.000Z
tests/items.py
ryancerf/scrapy-sqlitem
0650a5fb91b56cb1fae7837bd74a159a61b51bf9
[ "BSD-3-Clause" ]
16
2015-08-14T23:52:50.000Z
2020-08-27T14:33:43.000Z
from scrapy import Field from scrapy_sqlitem import SqlItem from . models import User, Address class UserItem(SqlItem): sqlmodel = User class AddressItem(SqlItem): sqlmodel = Address class NewFieldItemUser(SqlItem): sqlmodel = User first_joined = Field() class OverrideFieldItemUser(SqlItem): sqlmodel = User id = Field()
15.434783
37
0.726761
39
355
6.564103
0.435897
0.234375
0.222656
0
0
0
0
0
0
0
0
0
0.205634
355
22
38
16.136364
0.907801
0
0
0.230769
0
0
0
0
0
0
0
0
0
1
0
false
0
0.230769
0
1
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3