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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3a6fe42e30bacd42644e94608a0b68b5909b1f52
| 176
|
py
|
Python
|
RemoveDuplicate/remove_duplicate_char_from_string.py
|
Akash671/Algorithms
|
f71be624bc49e686087c8dd22a09b9cf343b0634
|
[
"MIT"
] | 1
|
2021-03-25T18:29:07.000Z
|
2021-03-25T18:29:07.000Z
|
RemoveDuplicate/remove_duplicate_char_from_string.py
|
Akash671/Algorithms
|
f71be624bc49e686087c8dd22a09b9cf343b0634
|
[
"MIT"
] | null | null | null |
RemoveDuplicate/remove_duplicate_char_from_string.py
|
Akash671/Algorithms
|
f71be624bc49e686087c8dd22a09b9cf343b0634
|
[
"MIT"
] | null | null | null |
#author : @akash kumar
from collections import OrderedDict
def remove_duplicate(str1):
return "".join(OrderedDict.fromkeys(str1))
s=str(input())
print(remove_duplicate(s))
| 19.555556
| 44
| 0.767045
| 23
| 176
| 5.782609
| 0.782609
| 0.225564
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012658
| 0.102273
| 176
| 8
| 45
| 22
| 0.829114
| 0.119318
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.2
| 0.2
| 0.6
| 0.2
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
3a7a1165ca56d7ca983ef071373ea494c7681d5c
| 267
|
py
|
Python
|
static/downloads/1000GP/rename.py
|
raqsilva/VCFDataExporter
|
b5eaabd82ade95a837fd98dff5e1600046eeb029
|
[
"Apache-2.0"
] | null | null | null |
static/downloads/1000GP/rename.py
|
raqsilva/VCFDataExporter
|
b5eaabd82ade95a837fd98dff5e1600046eeb029
|
[
"Apache-2.0"
] | null | null | null |
static/downloads/1000GP/rename.py
|
raqsilva/VCFDataExporter
|
b5eaabd82ade95a837fd98dff5e1600046eeb029
|
[
"Apache-2.0"
] | null | null | null |
import os
names = os.listdir('.')
for old_name in names:
if old_name.endswith('.vcf.gz'):
os.rename(old_name, old_name.split('.')[1]+'.vcf.gz')
elif old_name.endswith('.vcf.gz.tbi'):
os.rename(old_name, old_name.split('.')[1]+'.vcf.gz.tbi')
| 26.7
| 65
| 0.614232
| 44
| 267
| 3.568182
| 0.386364
| 0.312102
| 0.191083
| 0.229299
| 0.675159
| 0.420382
| 0.420382
| 0.420382
| 0.420382
| 0.420382
| 0
| 0.008929
| 0.161049
| 267
| 9
| 66
| 29.666667
| 0.691964
| 0
| 0
| 0
| 0
| 0
| 0.146067
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.142857
| 0
| 0.142857
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3a858bdcf1bd8ea86fa98d712434b57d22465c35
| 257
|
py
|
Python
|
waab/assets.py
|
clld/waab
|
9693da8887cf8498a47bc41250a2a048595f89f3
|
[
"Apache-2.0"
] | 2
|
2015-05-11T13:29:04.000Z
|
2017-12-23T04:15:02.000Z
|
waab/assets.py
|
clld/waab
|
9693da8887cf8498a47bc41250a2a048595f89f3
|
[
"Apache-2.0"
] | null | null | null |
waab/assets.py
|
clld/waab
|
9693da8887cf8498a47bc41250a2a048595f89f3
|
[
"Apache-2.0"
] | 1
|
2015-12-06T22:03:18.000Z
|
2015-12-06T22:03:18.000Z
|
from clld.web.assets import environment
from clldutils.path import Path
import waab
environment.append_path(
Path(waab.__file__).parent.joinpath('static').as_posix(), url='/waab:static/')
environment.load_path = list(reversed(environment.load_path))
| 25.7
| 82
| 0.785992
| 35
| 257
| 5.542857
| 0.571429
| 0.103093
| 0.195876
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.089494
| 257
| 9
| 83
| 28.555556
| 0.82906
| 0
| 0
| 0
| 0
| 0
| 0.07393
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
3a94069899bc67972275a4949c911d6dbf78b698
| 250
|
py
|
Python
|
neodroid/__init__.py
|
cnHeider/neo
|
30c03bb142bbe25f6d7b61f22f66747076f08aa6
|
[
"Apache-2.0"
] | null | null | null |
neodroid/__init__.py
|
cnHeider/neo
|
30c03bb142bbe25f6d7b61f22f66747076f08aa6
|
[
"Apache-2.0"
] | null | null | null |
neodroid/__init__.py
|
cnHeider/neo
|
30c03bb142bbe25f6d7b61f22f66747076f08aa6
|
[
"Apache-2.0"
] | 1
|
2018-09-27T14:31:20.000Z
|
2018-09-27T14:31:20.000Z
|
"""
.. module:: neodroid
:platform: Unix, Windows
:synopsis: An API for communicating with a Unity Game process.
.. moduleauthor:: Christian Heider Nielsen <chrini13@student.aau.dk>
"""
from .neodroid_environment import NeodroidEnvironment
| 20.833333
| 68
| 0.744
| 28
| 250
| 6.607143
| 0.964286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009434
| 0.152
| 250
| 11
| 69
| 22.727273
| 0.863208
| 0.736
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
3a998479c05de0b92de6ecc40860da340e40016a
| 228
|
py
|
Python
|
nec_calendar/urls.py
|
lindychi/mnec
|
3d18f257ed3b0bc327340de988e7552e035dbec1
|
[
"MIT"
] | 1
|
2018-02-20T13:46:41.000Z
|
2018-02-20T13:46:41.000Z
|
nec_calendar/urls.py
|
lindychi/mnec
|
3d18f257ed3b0bc327340de988e7552e035dbec1
|
[
"MIT"
] | 53
|
2017-10-10T02:43:22.000Z
|
2022-03-11T23:15:05.000Z
|
nec_calendar/urls.py
|
lindychi/mnec
|
3d18f257ed3b0bc327340de988e7552e035dbec1
|
[
"MIT"
] | null | null | null |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='calendar_today'),
url(r'^$monthly/(?P<year>[^/]+)/(?P<month>[^/]+)/$',
views.index, name='calendar_monthly'),
]
| 25.333333
| 56
| 0.600877
| 29
| 228
| 4.655172
| 0.586207
| 0.059259
| 0.207407
| 0.325926
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.153509
| 228
| 8
| 57
| 28.5
| 0.699482
| 0
| 0
| 0
| 0
| 0
| 0.333333
| 0.192982
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.285714
| 0
| 0.285714
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3a9d2d064cdbfc102e4a3ab658861ad8dd940d50
| 128
|
py
|
Python
|
pythonCode/sum.py
|
eatmore/python_practice
|
c6a773c8d24182b23a86fd9b66b27b5ff948b258
|
[
"MIT"
] | null | null | null |
pythonCode/sum.py
|
eatmore/python_practice
|
c6a773c8d24182b23a86fd9b66b27b5ff948b258
|
[
"MIT"
] | null | null | null |
pythonCode/sum.py
|
eatmore/python_practice
|
c6a773c8d24182b23a86fd9b66b27b5ff948b258
|
[
"MIT"
] | 1
|
2020-03-12T06:05:38.000Z
|
2020-03-12T06:05:38.000Z
|
s = 0
for i in range(2,100):
for j in range(2,i):
if i % j == 0:
break
else:
s += i
print(s)
| 16
| 24
| 0.40625
| 24
| 128
| 2.166667
| 0.541667
| 0.269231
| 0.307692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 0.453125
| 128
| 8
| 25
| 16
| 0.642857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.125
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3aaced5bd1f08ac5f98a404166a66e4fe488c592
| 91
|
py
|
Python
|
lesson09/lixuebin/devops/adminlte/apps.py
|
herrywen-nanj/51reboot
|
1130c79a360e1b548a6eaad176eb60f8bed22f40
|
[
"Apache-2.0"
] | 1
|
2017-07-25T01:31:31.000Z
|
2017-07-25T01:31:31.000Z
|
lesson09/lixuebin/devops/adminlte/apps.py
|
herrywen-nanj/51reboot
|
1130c79a360e1b548a6eaad176eb60f8bed22f40
|
[
"Apache-2.0"
] | 2
|
2021-03-09T01:22:11.000Z
|
2021-03-09T01:23:11.000Z
|
lesson09/lixuebin/devops/adminlte/apps.py
|
herrywen-nanj/51reboot
|
1130c79a360e1b548a6eaad176eb60f8bed22f40
|
[
"Apache-2.0"
] | 5
|
2017-10-17T06:05:21.000Z
|
2020-12-10T03:04:28.000Z
|
from django.apps import AppConfig
class AdminlteConfig(AppConfig):
name = 'adminlte'
| 15.166667
| 33
| 0.758242
| 10
| 91
| 6.9
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.164835
| 91
| 5
| 34
| 18.2
| 0.907895
| 0
| 0
| 0
| 0
| 0
| 0.087912
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
3ac1311d6c592bacca0ff5b7b7847336b19cc237
| 219
|
py
|
Python
|
application/role/views.py
|
roklem314/PotilasArkisto
|
b005dcad4442820a265b62156ddfe61abb5b9707
|
[
"MIT"
] | 2
|
2018-03-23T08:45:10.000Z
|
2021-01-22T11:17:14.000Z
|
application/role/views.py
|
roklem314/PotilasArkisto
|
b005dcad4442820a265b62156ddfe61abb5b9707
|
[
"MIT"
] | 1
|
2018-05-07T18:56:00.000Z
|
2019-02-11T21:10:44.000Z
|
application/role/views.py
|
roklem314/Laakari-palvelu
|
b005dcad4442820a265b62156ddfe61abb5b9707
|
[
"MIT"
] | null | null | null |
from flask import Flask, render_template, request, redirect, url_for, flash
from flask_login import login_user, logout_user, current_user
from application import app
from application.registration.models import Accounts
| 43.8
| 75
| 0.853881
| 31
| 219
| 5.83871
| 0.612903
| 0.099448
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105023
| 219
| 4
| 76
| 54.75
| 0.923469
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
3af1bd828764c3b64e7e4a0e8cc05b69c64931d5
| 1,832
|
py
|
Python
|
problem011/solution.py
|
andysnell/project-euler
|
43d92e59d247dfc319c6fe4c22ecc7962e2283ca
|
[
"FTL"
] | null | null | null |
problem011/solution.py
|
andysnell/project-euler
|
43d92e59d247dfc319c6fe4c22ecc7962e2283ca
|
[
"FTL"
] | null | null | null |
problem011/solution.py
|
andysnell/project-euler
|
43d92e59d247dfc319c6fe4c22ecc7962e2283ca
|
[
"FTL"
] | null | null | null |
import numpy
s = '''
8 2 22 97 38 15 0 40 0 75 4 5 7 78 52 12 50 77 91 8;
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 4 56 62 0;
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 3 49 13 36 65;
52 70 95 23 4 60 11 42 69 24 68 56 1 32 56 71 37 2 36 91;
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80;
24 47 32 60 99 3 45 2 44 75 33 53 78 36 84 20 35 17 12 50;
32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70;
67 26 20 68 2 62 12 20 95 63 94 39 63 8 40 91 66 49 94 21;
24 55 58 5 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72;
21 36 23 8 75 0 76 44 20 45 35 14 0 61 33 97 34 31 33 95;
78 17 53 28 22 75 31 67 15 94 3 80 4 62 16 14 8 53 56 92;
16 39 5 42 96 35 31 47 55 58 88 24 0 17 54 24 36 29 85 57;
86 56 0 48 35 71 89 7 5 44 44 37 44 60 21 58 51 54 17 58;
19 80 81 68 5 94 47 69 28 73 92 13 86 52 17 77 4 89 55 40;
4 52 8 83 97 35 99 16 7 97 57 32 16 26 26 79 33 27 98 66;
88 36 68 87 57 62 20 72 3 46 33 67 46 55 12 32 63 93 53 69;
4 42 16 73 38 25 39 11 24 94 72 18 8 46 29 32 40 62 76 36;
20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 4 36 16;
20 73 35 29 78 31 90 1 74 31 49 71 48 86 81 16 23 57 5 54;
1 70 54 71 83 51 54 69 16 92 33 48 61 43 52 1 89 19 67 48
'''
matrix = numpy.matrix(s)
print(matrix[1, 0])
for i in matrix:
print(i)
def getHorizontalProduct(matrix, row, col):
return matrix[row, col] \
* matrix[row, col + 1] \
* matrix[row, col + 2] \
* matrix[row, col + 3]
def getVerticalProduct(matrix, row, col):
return matrix[row, col] \
* matrix[row + 1, col] \
* matrix[row + 2, col] \
* matrix[row + 3, col]
def getDiagonalProduct(matrix, row, col):
return matrix[row, col] \
* matrix[row + 1, col + 1] \
* matrix[row + 2, col + 2] \
* matrix[row + 3, col + 3]
| 35.921569
| 60
| 0.596616
| 483
| 1,832
| 2.26294
| 0.233954
| 0.123513
| 0.098811
| 0.049405
| 0.114364
| 0.114364
| 0.114364
| 0.114364
| 0.114364
| 0.078683
| 0
| 0.636139
| 0.338428
| 1,832
| 50
| 61
| 36.64
| 0.265677
| 0
| 0
| 0.071429
| 0
| 0.452381
| 0.642818
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.071429
| false
| 0
| 0.02381
| 0.071429
| 0.166667
| 0.047619
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c90fe7a851365feafe7dccd2eb41b4f8853f6e33
| 152
|
py
|
Python
|
test/pytest/profiler_utils/resnet_custom.py
|
dumpmemory/serve
|
a21e28fc6e775612b2eab2f74333a606e71692fd
|
[
"Apache-2.0"
] | null | null | null |
test/pytest/profiler_utils/resnet_custom.py
|
dumpmemory/serve
|
a21e28fc6e775612b2eab2f74333a606e71692fd
|
[
"Apache-2.0"
] | 3
|
2022-03-12T01:08:09.000Z
|
2022-03-15T10:56:14.000Z
|
test/pytest/profiler_utils/resnet_custom.py
|
dumpmemory/serve
|
a21e28fc6e775612b2eab2f74333a606e71692fd
|
[
"Apache-2.0"
] | null | null | null |
from ts.torch_handler.image_classifier import ImageClassifier
class ResnetHandler(ImageClassifier):
def __init__(self):
super().__init__()
| 25.333333
| 61
| 0.769737
| 16
| 152
| 6.6875
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.144737
| 152
| 6
| 62
| 25.333333
| 0.823077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
c910d4078f561abf1ed8694f33875d45e8e67a5c
| 927
|
py
|
Python
|
api/light_processing.py
|
RogerTangos/aurum_debug
|
fa3afd96c795e9b674a5951430635d43aa3f5c78
|
[
"MIT"
] | null | null | null |
api/light_processing.py
|
RogerTangos/aurum_debug
|
fa3afd96c795e9b674a5951430635d43aa3f5c78
|
[
"MIT"
] | 6
|
2020-06-05T17:52:29.000Z
|
2021-06-10T19:44:58.000Z
|
api/light_processing.py
|
RogerTangos/aurum_debug
|
fa3afd96c795e9b674a5951430635d43aa3f5c78
|
[
"MIT"
] | null | null | null |
from api.apiutils import compute_field_id as id_from
import pandas as pd
def __obtain_dataframe(path):
# TODO: analyze path format so that we can choose the appropriate read method
df = pd.read_csv(path)
return df
def head(dbname, sname, fname=False):
# TODO:
return
def tail(dbname, sname, fname=False):
# TODO:
return
def random(dbname, sname, fname=False):
# TODO:
return
def sample(dbname, sname, fname=False):
# TODO:
return
def pandas_handler(store_handler, hit):
"""
Just obtain a handler to a pandas DataFrame, without exposing the format
of the underlying data source
:param store_handler:
:param nid:
:return:
"""
nid = hit.nid
sname = hit.source_name
path = store_handler.get_path_of(nid) + sname
df = __obtain_dataframe(path)
return df
if __name__ == "__main__":
print("Lightweight processing layer here")
| 19.723404
| 81
| 0.677454
| 128
| 927
| 4.710938
| 0.46875
| 0.072968
| 0.106136
| 0.139303
| 0.225539
| 0.225539
| 0.225539
| 0
| 0
| 0
| 0
| 0
| 0.236246
| 927
| 47
| 82
| 19.723404
| 0.851695
| 0.265372
| 0
| 0.285714
| 0
| 0
| 0.063467
| 0
| 0
| 0
| 0
| 0.021277
| 0
| 1
| 0.285714
| false
| 0
| 0.095238
| 0.190476
| 0.666667
| 0.047619
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
c91abdb6ef678d5016def0a4ac81b1cd966209eb
| 88
|
py
|
Python
|
code/log_msg/apps.py
|
AlanJui/DjangoApp-DevTemplate
|
da39db79439a3e94ced5e853af4aa8b6ebf52191
|
[
"PostgreSQL"
] | null | null | null |
code/log_msg/apps.py
|
AlanJui/DjangoApp-DevTemplate
|
da39db79439a3e94ced5e853af4aa8b6ebf52191
|
[
"PostgreSQL"
] | 2
|
2021-03-30T13:48:40.000Z
|
2021-04-08T20:43:31.000Z
|
code/log_msg/apps.py
|
AlanJui/DjangoApp-DevTemplate
|
da39db79439a3e94ced5e853af4aa8b6ebf52191
|
[
"PostgreSQL"
] | null | null | null |
from django.apps import AppConfig
class LogMsgConfig(AppConfig):
name = 'log_msg'
| 14.666667
| 33
| 0.75
| 11
| 88
| 5.909091
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.170455
| 88
| 5
| 34
| 17.6
| 0.890411
| 0
| 0
| 0
| 0
| 0
| 0.079545
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
c925d7c3ccb50e26740803389ee0d9a4a7dd6941
| 296
|
py
|
Python
|
cda/dataset_info.py
|
alisoltanirad/CDA
|
b83950d89bfd7b8fef7d50640469b1772bfc45d0
|
[
"MIT"
] | null | null | null |
cda/dataset_info.py
|
alisoltanirad/CDA
|
b83950d89bfd7b8fef7d50640469b1772bfc45d0
|
[
"MIT"
] | null | null | null |
cda/dataset_info.py
|
alisoltanirad/CDA
|
b83950d89bfd7b8fef7d50640469b1772bfc45d0
|
[
"MIT"
] | null | null | null |
from .college_scorecard import MetaData
class DatasetInfo:
def __init__(self, path=None):
if path == None:
self._data = MetaData()
else:
self._data = MetaData(path)
def get_attribute_names(self):
return self._data.get_attribute_names()
| 21.142857
| 47
| 0.628378
| 34
| 296
| 5.117647
| 0.558824
| 0.137931
| 0.183908
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.283784
| 296
| 13
| 48
| 22.769231
| 0.820755
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.111111
| 0.111111
| 0.555556
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
a3a097765eceaa8161406ee5e7662afd4c669ddc
| 124
|
py
|
Python
|
locale/pot/api/utilities/_autosummary/pyvista-ParametricKlein-1.py
|
tkoyama010/pyvista-doc-translations
|
23bb813387b7f8bfe17e86c2244d5dd2243990db
|
[
"MIT"
] | 4
|
2020-08-07T08:19:19.000Z
|
2020-12-04T09:51:11.000Z
|
locale/pot/api/utilities/_autosummary/pyvista-ParametricKlein-1.py
|
tkoyama010/pyvista-doc-translations
|
23bb813387b7f8bfe17e86c2244d5dd2243990db
|
[
"MIT"
] | 19
|
2020-08-06T00:24:30.000Z
|
2022-03-30T19:22:24.000Z
|
locale/pot/api/utilities/_autosummary/pyvista-ParametricKlein-1.py
|
tkoyama010/pyvista-doc-translations
|
23bb813387b7f8bfe17e86c2244d5dd2243990db
|
[
"MIT"
] | 1
|
2021-03-09T07:50:40.000Z
|
2021-03-09T07:50:40.000Z
|
# Create a ParametricKlein mesh
#
import pyvista
mesh = pyvista.ParametricKlein()
mesh.plot(color='w', smooth_shading=True)
| 20.666667
| 41
| 0.782258
| 16
| 124
| 6
| 0.75
| 0.395833
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.104839
| 124
| 5
| 42
| 24.8
| 0.864865
| 0.233871
| 0
| 0
| 0
| 0
| 0.01087
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
6e6b27b19f0bfd7ff008433799009a02c0602987
| 29
|
py
|
Python
|
test1.py
|
nesquik91/TCCG
|
fca08d99227bd39746d0a0e47cae4126f2761e0e
|
[
"MIT"
] | null | null | null |
test1.py
|
nesquik91/TCCG
|
fca08d99227bd39746d0a0e47cae4126f2761e0e
|
[
"MIT"
] | null | null | null |
test1.py
|
nesquik91/TCCG
|
fca08d99227bd39746d0a0e47cae4126f2761e0e
|
[
"MIT"
] | null | null | null |
import numpy as np
a=[3, 4]
| 7.25
| 18
| 0.62069
| 7
| 29
| 2.571429
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090909
| 0.241379
| 29
| 3
| 19
| 9.666667
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
6e75bded8ce81fb3877b7bd6bed84e92d84af3d4
| 16,036
|
py
|
Python
|
PROJ/LEVY/Swing_Options/PROJ_Swing_ConstantRecovery_Aug.py
|
mattslezak-shell/PROJ_Option_Pricing_Matlab
|
6105bd00ba3471802180c122fdf81e90833a91c4
|
[
"MIT"
] | null | null | null |
PROJ/LEVY/Swing_Options/PROJ_Swing_ConstantRecovery_Aug.py
|
mattslezak-shell/PROJ_Option_Pricing_Matlab
|
6105bd00ba3471802180c122fdf81e90833a91c4
|
[
"MIT"
] | null | null | null |
PROJ/LEVY/Swing_Options/PROJ_Swing_ConstantRecovery_Aug.py
|
mattslezak-shell/PROJ_Option_Pricing_Matlab
|
6105bd00ba3471802180c122fdf81e90833a91c4
|
[
"MIT"
] | 1
|
2022-01-07T15:31:45.000Z
|
2022-01-07T15:31:45.000Z
|
# Generated with SMOP 0.41-beta
try:
from smop.libsmop import *
except ImportError:
raise ImportError('File compiled with `smop3`, please install `smop3` to run it.') from None
# PROJ_Swing_ConstantRecovery_Aug.m
@function
def PROJ_Swing_ConstantRecovery_Aug(r=None,S_0=None,Dmax=None,T_0=None,T=None,tau1=None,Mtau=None,N=None,alpha=None,rnSYMB=None,Ks=None,*args,**kwargs):
varargin = PROJ_Swing_ConstantRecovery_Aug.varargin
nargin = PROJ_Swing_ConstantRecovery_Aug.nargin
# rnSYMB is risk-neutral Levy symbol
# Ks = [K1,K2,K3,K4]
K1=Ks(1)
# PROJ_Swing_ConstantRecovery_Aug.m:5
K2=Ks(2)
# PROJ_Swing_ConstantRecovery_Aug.m:5
K3=Ks(3)
# PROJ_Swing_ConstantRecovery_Aug.m:5
K4=Ks(4)
# PROJ_Swing_ConstantRecovery_Aug.m:5
w=log(Ks / S_0)
# PROJ_Swing_ConstantRecovery_Aug.m:6
xmin=- alpha / 2 + (w(3) + w(2)) / 2
# PROJ_Swing_ConstantRecovery_Aug.m:7
Gx=lambda x=None: G_func_swing(x,K1,K2,K3,K4,S_0)
# PROJ_Swing_ConstantRecovery_Aug.m:9
K=N / 2
# PROJ_Swing_ConstantRecovery_Aug.m:11
dt=tau1 / Mtau
# PROJ_Swing_ConstantRecovery_Aug.m:12
nrdt=dot(- r,dt)
# PROJ_Swing_ConstantRecovery_Aug.m:13
p=floor((T - T_0) / tau1)
# PROJ_Swing_ConstantRecovery_Aug.m:15
Ttil_p=T - dot(p,tau1)
# PROJ_Swing_ConstantRecovery_Aug.m:16
Mtau_pr=floor((Ttil_p - T_0) / dt)
# PROJ_Swing_ConstantRecovery_Aug.m:17
#Ttil_pp1 = Ttil_p -Mtau_pr*dt; #If a final European step is needed
M=dot(p,Mtau) + Mtau_pr
# PROJ_Swing_ConstantRecovery_Aug.m:20
dxtil=dot(2,alpha) / (N - 1)
# PROJ_Swing_ConstantRecovery_Aug.m:22
#================ Determine xGrid ========================================
nbars=floor((w - xmin) / dxtil + 1)
# PROJ_Swing_ConstantRecovery_Aug.m:25
xnbars=xmin + dot(dxtil,(nbars - 1))
# PROJ_Swing_ConstantRecovery_Aug.m:26
diffs=w - xnbars
# PROJ_Swing_ConstantRecovery_Aug.m:28
nbars[diffs < diffs(1)]=nbars(diffs < diffs(1)) - 1
# PROJ_Swing_ConstantRecovery_Aug.m:29
dx=(w(4) - w(1)) / (nbars(4) - nbars(1))
# PROJ_Swing_ConstantRecovery_Aug.m:31
a=1 / dx
# PROJ_Swing_ConstantRecovery_Aug.m:31
xmin=w(1) - dot((nbars(1) - 1),dx)
# PROJ_Swing_ConstantRecovery_Aug.m:32
nbars[arange(2,3)]=floor((w(arange(2,3)) - xmin) / dx + 1)
# PROJ_Swing_ConstantRecovery_Aug.m:34
rhos=w - xnbars
# PROJ_Swing_ConstantRecovery_Aug.m:36
zetastar=dot(a,rhos)
# PROJ_Swing_ConstantRecovery_Aug.m:37
nnot=floor(1 - dot(xmin,a))
# PROJ_Swing_ConstantRecovery_Aug.m:38
#==========================================================================
####################################################################
######## Gaussian 3-point
####################################################################
###### Gaussian Quad Constants
q_plus=(1 + sqrt(3 / 5)) / 2
# PROJ_Swing_ConstantRecovery_Aug.m:46
q_minus=(1 - sqrt(3 / 5)) / 2
# PROJ_Swing_ConstantRecovery_Aug.m:46
b3=sqrt(15)
# PROJ_Swing_ConstantRecovery_Aug.m:47
b4=b3 / 10
# PROJ_Swing_ConstantRecovery_Aug.m:47
#### PAYOFF CONSTANTS-----------------------------------
varthet_01=dot(exp(dot(0.5,dx)),(dot(5,cosh(dot(b4,dx))) - dot(b3,sinh(dot(b4,dx))) + 4)) / 18
# PROJ_Swing_ConstantRecovery_Aug.m:50
zetas2=zetastar ** 2
# PROJ_Swing_ConstantRecovery_Aug.m:51
edn=exp(- dx)
# PROJ_Swing_ConstantRecovery_Aug.m:52
###----------------------------------------
### Initialize the dstars used in psis function
rhos_plus=dot(rhos,q_plus)
# PROJ_Swing_ConstantRecovery_Aug.m:56
rhos_minus=dot(rhos,q_minus)
# PROJ_Swing_ConstantRecovery_Aug.m:56
zetas_plus=dot(a,rhos_plus)
# PROJ_Swing_ConstantRecovery_Aug.m:57
zetas_minus=dot(a,rhos_minus)
# PROJ_Swing_ConstantRecovery_Aug.m:57
eds1=exp(rhos_minus)
# PROJ_Swing_ConstantRecovery_Aug.m:58
eds2=exp(rhos / 2)
# PROJ_Swing_ConstantRecovery_Aug.m:58
eds3=exp(rhos_plus)
# PROJ_Swing_ConstantRecovery_Aug.m:58
dbars_1=zetas2 / 2
# PROJ_Swing_ConstantRecovery_Aug.m:60
dbars_0=zetastar - dbars_1
# PROJ_Swing_ConstantRecovery_Aug.m:61
ds_0=multiply(zetastar,(dot(5,(multiply((1 - zetas_minus),eds1) + multiply((1 - zetas_plus),eds3))) + multiply(dot(4,(2 - zetastar)),eds2))) / 18
# PROJ_Swing_ConstantRecovery_Aug.m:62
ds_1=multiply(dot(edn,zetastar),(dot(5,(multiply(zetas_minus,eds1) + multiply(zetas_plus,eds3))) + multiply(dot(4,zetastar),eds2))) / 18
# PROJ_Swing_ConstantRecovery_Aug.m:63
dstars=zeros(1,4)
# PROJ_Swing_ConstantRecovery_Aug.m:65
dstars[1]=dbars_0(2)
# PROJ_Swing_ConstantRecovery_Aug.m:66
dstars[2]=ds_0(2)
# PROJ_Swing_ConstantRecovery_Aug.m:66
dstars[3]=ds_1(3)
# PROJ_Swing_ConstantRecovery_Aug.m:67
dstars[4]=dbars_1(3)
# PROJ_Swing_ConstantRecovery_Aug.m:67
#==========================================================================
ThetaG=GetThetaG_swing(xmin,K,dx,K1,K2,K3,K4,S_0)
# PROJ_Swing_ConstantRecovery_Aug.m:70
THET=zeros(K,M)
# PROJ_Swing_ConstantRecovery_Aug.m:72
THET[arange(),M]=dot(Dmax,ThetaG)
# PROJ_Swing_ConstantRecovery_Aug.m:73
E=dot(S_0,exp(xmin + dot(dx,(arange(0,K - 1)))))
# PROJ_Swing_ConstantRecovery_Aug.m:74
#####################################
########### PHASE I ################
#####################################
####################################################################
###### T^dt
####################################################################
a2=a ** 2
# PROJ_Swing_ConstantRecovery_Aug.m:83
zmin=dot((1 - K),dx)
# PROJ_Swing_ConstantRecovery_Aug.m:84
dw=dot(dot(2,pi),a) / N
# PROJ_Swing_ConstantRecovery_Aug.m:86
DW=dot(dw,(arange(1,N - 1)))
# PROJ_Swing_ConstantRecovery_Aug.m:87
grand1=multiply(exp(dot(dot(- 1j,zmin),DW)),(sin(DW / (dot(2,a))) / DW) ** 2.0) / (2 + cos(DW / a))
# PROJ_Swing_ConstantRecovery_Aug.m:88
Cons1=dot(24,a2) / N
# PROJ_Swing_ConstantRecovery_Aug.m:89
###------------------------------------------------------------------
chfpoints=rnSYMB(DW)
# PROJ_Swing_ConstantRecovery_Aug.m:91
Cons2=dot(Cons1,exp(nrdt))
# PROJ_Swing_ConstantRecovery_Aug.m:93
grand=multiply(grand1,exp(dot(dt,chfpoints)))
# PROJ_Swing_ConstantRecovery_Aug.m:94
beta=dot(Cons2,real(fft(concat([1 / (dot(24,a2)),grand]))))
# PROJ_Swing_ConstantRecovery_Aug.m:95
toepM=concat([[beta(arange(K,1,- 1)).T],[0],[beta(arange(dot(2,K) - 1,K,- 1),+ 1).T]])
# PROJ_Swing_ConstantRecovery_Aug.m:97
toepM=fft(toepM)
# PROJ_Swing_ConstantRecovery_Aug.m:97
###------------------------------------------------------------------
### initialize for search
nms=zeros(1,2)
# PROJ_Swing_ConstantRecovery_Aug.m:101
nms[1]=nbars(2) + 1
# PROJ_Swing_ConstantRecovery_Aug.m:102
nms[2]=nbars(3) - 1
# PROJ_Swing_ConstantRecovery_Aug.m:103
###----------------------------------------
Cons4=1 / 12
# PROJ_Swing_ConstantRecovery_Aug.m:105
###----------------------------------------
xbars=zeros(1,2)
# PROJ_Swing_ConstantRecovery_Aug.m:108
###----------------------------------------
G=dot(Dmax,Gx(xmin + dot(dx,(arange(0,K - 1)))).T)
# PROJ_Swing_ConstantRecovery_Aug.m:111
###----------------------------------------
edn=exp(- dx)
# PROJ_Swing_ConstantRecovery_Aug.m:114
dK21=(K2 - K1)
# PROJ_Swing_ConstantRecovery_Aug.m:115
dK43=(K4 - K3)
# PROJ_Swing_ConstantRecovery_Aug.m:116
Thetbar_dt=dot(dK43,cumsum(beta(arange(dot(2,K),K + 1,- 1))).T) + dot(dK21,concat([[fliplr(cumsum(beta(arange(1,K - 1,1)))).T],[0]]))
# PROJ_Swing_ConstantRecovery_Aug.m:118
for m in arange(M - 1,M - (Mtau - 1),- 1).reshape(-1):
pp=ifft(multiply(toepM,fft(concat([[THET(arange(1,K),m + 1)],[zeros(K,1)]]))))
# PROJ_Swing_ConstantRecovery_Aug.m:121
Cont_dt=pp(arange(1,K)) + Thetbar_dt
# PROJ_Swing_ConstantRecovery_Aug.m:122
while (nms(1) > 2) and (Cont_dt(nms(1)) > G(nms(1))):
nms[1]=nms(1) - 1
# PROJ_Swing_ConstantRecovery_Aug.m:126
nms[2]=nms(2) + 1
# PROJ_Swing_ConstantRecovery_Aug.m:129
while nms(2) < K - 2 and Cont_dt(nms(2)) > G(nms(2)):
nms[2]=nms(2) + 1
# PROJ_Swing_ConstantRecovery_Aug.m:131
nms[2]=nms(2) - 1
# PROJ_Swing_ConstantRecovery_Aug.m:133
xnbars=xmin + dot(dx,(nms - 1))
# PROJ_Swing_ConstantRecovery_Aug.m:135
tmp1=Cont_dt(nms(1)) - G(nms(1))
# PROJ_Swing_ConstantRecovery_Aug.m:138
tmp2=Cont_dt(nms(1) + 1) - G(nms(1) + 1)
# PROJ_Swing_ConstantRecovery_Aug.m:138
xbars[1]=(dot((xnbars(1) + dx),tmp1) - dot(xnbars(1),tmp2)) / (tmp1 - tmp2)
# PROJ_Swing_ConstantRecovery_Aug.m:139
tmp1=Cont_dt(nms(2)) - G(nms(2))
# PROJ_Swing_ConstantRecovery_Aug.m:142
tmp2=Cont_dt(nms(2) + 1) - G(nms(2) + 1)
# PROJ_Swing_ConstantRecovery_Aug.m:142
xbars[2]=(dot((xnbars(2) + dx),tmp1) - dot(xnbars(2),tmp2)) / (tmp1 - tmp2)
# PROJ_Swing_ConstantRecovery_Aug.m:143
rhos=xbars - xnbars
# PROJ_Swing_ConstantRecovery_Aug.m:145
zetas=dot(a,rhos)
# PROJ_Swing_ConstantRecovery_Aug.m:146
psis=Get_psis_swing_VER2(rhos,zetas,q_plus,q_minus,Ks,a,varthet_01,E,nms,nbars,edn,zetastar,dstars)
# PROJ_Swing_ConstantRecovery_Aug.m:148
varths_dt=Get_Varths_swing(zetas,nms,Cont_dt)
# PROJ_Swing_ConstantRecovery_Aug.m:149
THET[arange(1,nms(1) - 1),m]=THET(arange(1,nms(1) - 1),M)
# PROJ_Swing_ConstantRecovery_Aug.m:152
THET[nms(1),m]=THET(nms(1),M) - dot(Dmax,psis(1)) + varths_dt(1)
# PROJ_Swing_ConstantRecovery_Aug.m:153
THET[nms(1) + 1,m]=dot(Dmax,psis(2)) + varths_dt(2)
# PROJ_Swing_ConstantRecovery_Aug.m:154
THET[arange(nms(1) + 2,nms(2) - 1),m]=dot(Cons4,(Cont_dt(arange(nms(1) + 1,nms(2) - 2)) + dot(10,Cont_dt(arange(nms(1) + 2,nms(2) - 1))) + Cont_dt(arange(nms(1) + 3,nms(2)))))
# PROJ_Swing_ConstantRecovery_Aug.m:156
THET[nms(2),m]=dot(Dmax,psis(3)) + varths_dt(3)
# PROJ_Swing_ConstantRecovery_Aug.m:158
THET[nms(2) + 1,m]=THET(nms(2) + 1,M) - dot(Dmax,psis(4)) + varths_dt(4)
# PROJ_Swing_ConstantRecovery_Aug.m:159
THET[arange(nms(2) + 2,K),m]=THET(arange(nms(2) + 2,K),M)
# PROJ_Swing_ConstantRecovery_Aug.m:160
#####################################
#####################################
########### PHASE II ###############
#####################################
#####################################
Cons3=dot(Cons1,exp(dot(- r,tau1)))
# PROJ_Swing_ConstantRecovery_Aug.m:171
grand=multiply(grand1,exp(dot(tau1,chfpoints)))
# PROJ_Swing_ConstantRecovery_Aug.m:172
beta=dot(Cons3,real(fft(concat([1 / (dot(24,a2)),grand]))))
# PROJ_Swing_ConstantRecovery_Aug.m:173
toepMD=concat([[beta(arange(K,1,- 1)).T],[0],[beta(arange(dot(2,K) - 1,K,- 1),+ 1).T]])
# PROJ_Swing_ConstantRecovery_Aug.m:174
toepMD=fft(toepMD)
# PROJ_Swing_ConstantRecovery_Aug.m:174
evec_D1=cumsum(beta(arange(dot(2,K),K + 1,- 1))).T
# PROJ_Swing_ConstantRecovery_Aug.m:176
evec_D2=concat([[fliplr(cumsum(beta(arange(1,K - 1,1)))).T],[0]])
# PROJ_Swing_ConstantRecovery_Aug.m:177
count=copy(Mtau)
# PROJ_Swing_ConstantRecovery_Aug.m:179
for m in arange(M - Mtau,1,- 1).reshape(-1):
pp=ifft(multiply(toepM,fft(concat([[THET(arange(1,K),m + 1)],[zeros(K,1)]]))))
# PROJ_Swing_ConstantRecovery_Aug.m:182
Cont_dt=pp(arange(1,K))
# PROJ_Swing_ConstantRecovery_Aug.m:183
pp=ifft(multiply(toepMD,fft(concat([[THET(arange(1,K),m + Mtau)],[zeros(K,1)]]))))
# PROJ_Swing_ConstantRecovery_Aug.m:185
Cont_D=pp(arange(1,K)) + dot(evec_D2,THET(1,m + Mtau)) + dot(evec_D1,THET(K,m + Mtau))
# PROJ_Swing_ConstantRecovery_Aug.m:186
PSI=G + Cont_D
# PROJ_Swing_ConstantRecovery_Aug.m:187
if rem(count,Mtau) == 0:
nms[1]=nbars(2)
# PROJ_Swing_ConstantRecovery_Aug.m:191
nms[2]=nbars(3) + 1
# PROJ_Swing_ConstantRecovery_Aug.m:191
count=count + 1
# PROJ_Swing_ConstantRecovery_Aug.m:193
while nms(1) > 2 and Cont_dt(nms(1)) > PSI(nms(1)):
nms[1]=nms(1) - 1
# PROJ_Swing_ConstantRecovery_Aug.m:196
while nms(2) < K - 2 and Cont_dt(nms(2)) > PSI(nms(2)):
nms[2]=nms(2) + 1
# PROJ_Swing_ConstantRecovery_Aug.m:200
nms[2]=nms(2) - 1
# PROJ_Swing_ConstantRecovery_Aug.m:204
xnbars=xmin + dot(dx,(nms - 1))
# PROJ_Swing_ConstantRecovery_Aug.m:206
tmp1=Cont_dt(nms(1)) - PSI(nms(1))
# PROJ_Swing_ConstantRecovery_Aug.m:209
tmp2=Cont_dt(nms(1) + 1) - PSI(nms(1) + 1)
# PROJ_Swing_ConstantRecovery_Aug.m:209
xbars[1]=xnbars(1) + max(0,dot(dx,tmp1) / (tmp1 - tmp2))
# PROJ_Swing_ConstantRecovery_Aug.m:210
tmp1=Cont_dt(nms(2)) - PSI(nms(2))
# PROJ_Swing_ConstantRecovery_Aug.m:213
tmp2=Cont_dt(nms(2) + 1) - PSI(nms(2) + 1)
# PROJ_Swing_ConstantRecovery_Aug.m:213
xbars[2]=xnbars(2) + max(0,dot(dx,tmp1) / (tmp1 - tmp2))
# PROJ_Swing_ConstantRecovery_Aug.m:214
rhos=xbars - xnbars
# PROJ_Swing_ConstantRecovery_Aug.m:217
zetas=dot(a,rhos)
# PROJ_Swing_ConstantRecovery_Aug.m:218
psis=Get_psis_swing_VER2(rhos,zetas,q_plus,q_minus,Ks,a,varthet_01,E,nms,nbars,edn,zetastar,dstars)
# PROJ_Swing_ConstantRecovery_Aug.m:220
varths_dt=Get_Varths_swing(zetas,nms,Cont_dt)
# PROJ_Swing_ConstantRecovery_Aug.m:222
varths_D=Get_VarthsDD_swing(zetas,nms,Cont_D)
# PROJ_Swing_ConstantRecovery_Aug.m:223
THET[arange(2,nms(1) - 1),m]=THET(arange(2,nms(1) - 1),M) + dot(Cons4,(Cont_D(arange(1,nms(1) - 2)) + dot(10,Cont_D(arange(2,nms(1) - 1))) + Cont_D(arange(3,nms(1)))))
# PROJ_Swing_ConstantRecovery_Aug.m:227
THET[1,m]=THET(2,m)
# PROJ_Swing_ConstantRecovery_Aug.m:228
THET[nms(1),m]=THET(nms(1),M) - dot(Dmax,psis(1)) + varths_dt(1) + varths_D(3)
# PROJ_Swing_ConstantRecovery_Aug.m:230
THET[nms(1) + 1,m]=dot(Dmax,psis(2)) + varths_dt(2) + varths_D(4)
# PROJ_Swing_ConstantRecovery_Aug.m:231
THET[arange(nms(1) + 2,nms(2) - 1),m]=dot(Cons4,(Cont_dt(arange(nms(1) + 1,nms(2) - 2)) + dot(10,Cont_dt(arange(nms(1) + 2,nms(2) - 1))) + Cont_dt(arange(nms(1) + 3,nms(2)))))
# PROJ_Swing_ConstantRecovery_Aug.m:233
THET[nms(2),m]=dot(Dmax,psis(3)) + varths_dt(3) + varths_D(1)
# PROJ_Swing_ConstantRecovery_Aug.m:235
THET[nms(2) + 1,m]=THET(nms(2) + 1,M) - dot(Dmax,psis(4)) + varths_dt(4) + varths_D(2)
# PROJ_Swing_ConstantRecovery_Aug.m:236
THET[arange(nms(2) + 2,K - 1),m]=THET(arange(nms(2) + 2,K - 1),M) + dot(Cons4,(Cont_D(arange(nms(2) + 1,K - 2)) + dot(10,Cont_D(arange(nms(2) + 2,K - 1))) + Cont_D(arange(nms(2) + 3,K))))
# PROJ_Swing_ConstantRecovery_Aug.m:238
THET[K,m]=THET(K - 1,m)
# PROJ_Swing_ConstantRecovery_Aug.m:239
###----------------------------------------
pp=ifft(multiply(toepM,fft(concat([[THET(arange(1,K),1)],[zeros(K,1)]]))))
# PROJ_Swing_ConstantRecovery_Aug.m:243
Cont_dt=pp(arange(1,K))
# PROJ_Swing_ConstantRecovery_Aug.m:244
pp=ifft(multiply(toepMD,fft(concat([[THET(arange(1,K),Mtau)],[zeros(K,1)]]))))
# PROJ_Swing_ConstantRecovery_Aug.m:246
Cont_D=pp(arange(1,K)) + dot(evec_D2,THET(1,Mtau)) + dot(evec_D1,THET(K,Mtau))
# PROJ_Swing_ConstantRecovery_Aug.m:247
PSI=G + Cont_D
# PROJ_Swing_ConstantRecovery_Aug.m:248
xnot=xmin + dot((nnot - 1),dx)
# PROJ_Swing_ConstantRecovery_Aug.m:250
xs=concat([xnot - dx,xnot,xnot + dx,xnot + dot(2,dx)])
# PROJ_Swing_ConstantRecovery_Aug.m:252
inds=concat([nnot - 1,nnot,nnot + 1,nnot + 2])
# PROJ_Swing_ConstantRecovery_Aug.m:253
ys=max(PSI(inds),Cont_dt(inds))
# PROJ_Swing_ConstantRecovery_Aug.m:254
price=spline(xs,ys,0)
# PROJ_Swing_ConstantRecovery_Aug.m:256
return price
if __name__ == '__main__':
pass
| 42.648936
| 196
| 0.62104
| 2,450
| 16,036
| 3.825306
| 0.13102
| 0.146927
| 0.408131
| 0.457106
| 0.753841
| 0.713615
| 0.512057
| 0.387644
| 0.315408
| 0.269526
| 0
| 0.06464
| 0.158768
| 16,036
| 376
| 197
| 42.648936
| 0.630096
| 0.408892
| 0
| 0.161677
| 1
| 0
| 0.008268
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.005988
| false
| 0.005988
| 0.017964
| 0
| 0.02994
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6e848cd05bc34462c5586214a8b7f206aaf1e512
| 83
|
py
|
Python
|
projectShaun.py
|
rantingdemon/project_shaun
|
28e7e538912840cfafcbdff7898405b4a7d04fe5
|
[
"MIT"
] | null | null | null |
projectShaun.py
|
rantingdemon/project_shaun
|
28e7e538912840cfafcbdff7898405b4a7d04fe5
|
[
"MIT"
] | null | null | null |
projectShaun.py
|
rantingdemon/project_shaun
|
28e7e538912840cfafcbdff7898405b4a7d04fe5
|
[
"MIT"
] | null | null | null |
from app import app
app.run(ssl_context='adhoc', host="0.0.0.0", threaded=True)
| 13.833333
| 59
| 0.698795
| 16
| 83
| 3.5625
| 0.6875
| 0.105263
| 0.105263
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.054795
| 0.120482
| 83
| 5
| 60
| 16.6
| 0.726027
| 0
| 0
| 0
| 0
| 0
| 0.144578
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
6e9199334dfc777deab08fb32b84f93f9fe2efe7
| 229
|
py
|
Python
|
08_numeric/main.py
|
jmmedel/Python-tutorial-Youtube
|
d3319a8744cc636ad6a4fb3d90889278806a6cff
|
[
"MIT"
] | null | null | null |
08_numeric/main.py
|
jmmedel/Python-tutorial-Youtube
|
d3319a8744cc636ad6a4fb3d90889278806a6cff
|
[
"MIT"
] | null | null | null |
08_numeric/main.py
|
jmmedel/Python-tutorial-Youtube
|
d3319a8744cc636ad6a4fb3d90889278806a6cff
|
[
"MIT"
] | 2
|
2020-07-16T05:10:35.000Z
|
2020-09-08T01:43:10.000Z
|
#Python number
# int
# float
# complex
x = 1
y = 13.23
z = 1j
print(x)
print(y)
print(z)
print("-----------------------------------")
print(type(x))
print(type(y))
print(type(z))
print("-----------------------------------")
| 10.904762
| 44
| 0.414847
| 29
| 229
| 3.275862
| 0.482759
| 0.284211
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030151
| 0.131004
| 229
| 21
| 45
| 10.904762
| 0.447236
| 0.135371
| 0
| 0.181818
| 0
| 0
| 0.366492
| 0.366492
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.727273
| 1
| 0
| 0
| null | 1
| 0
| 0
| 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
| 1
|
0
| 4
|
6eac2adab30624a3e98779ab04548c9280d1da65
| 423
|
py
|
Python
|
python/src/main/python/pyalink/alink/common/types/bases/model_stream_scan_params.py
|
wenwei8268/Alink
|
c00702538c95a32403985ebd344eb6aeb81749a7
|
[
"Apache-2.0"
] | null | null | null |
python/src/main/python/pyalink/alink/common/types/bases/model_stream_scan_params.py
|
wenwei8268/Alink
|
c00702538c95a32403985ebd344eb6aeb81749a7
|
[
"Apache-2.0"
] | null | null | null |
python/src/main/python/pyalink/alink/common/types/bases/model_stream_scan_params.py
|
wenwei8268/Alink
|
c00702538c95a32403985ebd344eb6aeb81749a7
|
[
"Apache-2.0"
] | null | null | null |
from abc import ABC
from .with_params import WithParams
class ModelStreamScanParams(WithParams, ABC):
def setModelStreamFilePath(self, val):
return self._add_param('modelStreamFilePath', val)
def setModelStreamScanInterval(self, val):
return self._add_param('modelStreamScanInterval', val)
def setModelStreamStartTime(self, val):
return self._add_param('modelStreamStartTime', val)
| 28.2
| 62
| 0.751773
| 43
| 423
| 7.232558
| 0.465116
| 0.067524
| 0.125402
| 0.163987
| 0.241158
| 0.241158
| 0
| 0
| 0
| 0
| 0
| 0
| 0.165485
| 423
| 14
| 63
| 30.214286
| 0.88102
| 0
| 0
| 0
| 0
| 0
| 0.146572
| 0.054374
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.222222
| 0.333333
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
6ec4439ade5365add87ec5b530a255527d6f16f4
| 270
|
py
|
Python
|
takeaway/settings/fastapi/extension.py
|
ShahinZeynalov/startapp
|
3470666114dad3563393ea976cac8daa03611c41
|
[
"MIT"
] | 1
|
2020-06-08T06:54:08.000Z
|
2020-06-08T06:54:08.000Z
|
takeaway/settings/fastapi/extension.py
|
ShahinZeynalov/startapp
|
3470666114dad3563393ea976cac8daa03611c41
|
[
"MIT"
] | null | null | null |
takeaway/settings/fastapi/extension.py
|
ShahinZeynalov/startapp
|
3470666114dad3563393ea976cac8daa03611c41
|
[
"MIT"
] | null | null | null |
extension = '''
# from sqlalchemy.ext.declarative import declarative_base
# # from core.factories import Session
from sqlalchemy import MetaData
from gino.ext.starlette import Gino
from core.factories import settings
db: MetaData = Gino(dsn=settings.DATABASE_URL)
'''
| 24.545455
| 57
| 0.796296
| 35
| 270
| 6.085714
| 0.514286
| 0.131455
| 0.159624
| 0.215962
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.122222
| 270
| 11
| 58
| 24.545455
| 0.898734
| 0
| 0
| 0
| 0
| 0
| 0.929889
| 0.210332
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.625
| 0
| 0.625
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6ec657166be770cdd48ac03618293d3bdcf15b31
| 97
|
py
|
Python
|
qsbk/start.py
|
chlbupt/scrapy_demp
|
6324cb4bdd7fc714f829c7f74c47dbf57244a0c0
|
[
"bzip2-1.0.6"
] | null | null | null |
qsbk/start.py
|
chlbupt/scrapy_demp
|
6324cb4bdd7fc714f829c7f74c47dbf57244a0c0
|
[
"bzip2-1.0.6"
] | null | null | null |
qsbk/start.py
|
chlbupt/scrapy_demp
|
6324cb4bdd7fc714f829c7f74c47dbf57244a0c0
|
[
"bzip2-1.0.6"
] | null | null | null |
# encoding:utf-8
from scrapy import cmdline
cmdline.execute('scrapy crawl qsbk_spider'.split())
| 19.4
| 51
| 0.783505
| 14
| 97
| 5.357143
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011494
| 0.103093
| 97
| 5
| 51
| 19.4
| 0.850575
| 0.14433
| 0
| 0
| 0
| 0
| 0.292683
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
6ed9f62937f9fba7af848dd48bfb315bbdcd46dd
| 27
|
py
|
Python
|
pythongui/__init__.py
|
timmo001/python-gui
|
6bac25f814a980f6ed40e49edccf302d9848e9e6
|
[
"MIT"
] | 1
|
2022-01-13T07:06:58.000Z
|
2022-01-13T07:06:58.000Z
|
pythongui/__init__.py
|
timmo001/python-gui
|
6bac25f814a980f6ed40e49edccf302d9848e9e6
|
[
"MIT"
] | 1
|
2022-03-21T14:24:23.000Z
|
2022-03-21T14:24:23.000Z
|
pythongui/__init__.py
|
timmo001/python-gui
|
6bac25f814a980f6ed40e49edccf302d9848e9e6
|
[
"MIT"
] | null | null | null |
"""Python GUI GUI: Init"""
| 13.5
| 26
| 0.592593
| 4
| 27
| 4
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.148148
| 27
| 1
| 27
| 27
| 0.695652
| 0.740741
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
42cb3eb3cefd98eb8037f9e957db43e5cbb01c58
| 140
|
py
|
Python
|
example_app.py
|
sneawo/aiohttp-apispec
|
a8a12346fa802dc40a471b2c645642a083804f3b
|
[
"MIT"
] | 198
|
2017-12-18T02:26:12.000Z
|
2022-03-19T17:49:20.000Z
|
example_app.py
|
sneawo/aiohttp-apispec
|
a8a12346fa802dc40a471b2c645642a083804f3b
|
[
"MIT"
] | 109
|
2018-03-15T14:41:56.000Z
|
2022-02-25T20:15:17.000Z
|
example_app.py
|
sneawo/aiohttp-apispec
|
a8a12346fa802dc40a471b2c645642a083804f3b
|
[
"MIT"
] | 64
|
2018-03-01T09:05:41.000Z
|
2022-02-07T10:02:56.000Z
|
from aiohttp import web
from example.app import create_app
if __name__ == "__main__":
web_app = create_app()
web.run_app(web_app)
| 17.5
| 34
| 0.728571
| 22
| 140
| 4.045455
| 0.5
| 0.202247
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.185714
| 140
| 7
| 35
| 20
| 0.780702
| 0
| 0
| 0
| 0
| 0
| 0.057143
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
42d5f4ca01f1871389b5164313f51412688612f1
| 111
|
py
|
Python
|
simpleflow/runtime/__init__.py
|
David-Wobrock/simpleflow
|
09f59105b48ae79aef37b506bbde0cd1f2c360d1
|
[
"MIT"
] | 69
|
2015-02-24T00:49:40.000Z
|
2022-02-05T02:35:04.000Z
|
simpleflow/runtime/__init__.py
|
David-Wobrock/simpleflow
|
09f59105b48ae79aef37b506bbde0cd1f2c360d1
|
[
"MIT"
] | 295
|
2015-02-06T11:02:00.000Z
|
2022-03-21T11:01:34.000Z
|
simpleflow/runtime/__init__.py
|
David-Wobrock/simpleflow
|
09f59105b48ae79aef37b506bbde0cd1f2c360d1
|
[
"MIT"
] | 27
|
2015-08-31T22:14:42.000Z
|
2022-02-08T07:25:01.000Z
|
import logging
from simpleflow.log import setup_logging
setup_logging()
logger = logging.getLogger(__name__)
| 15.857143
| 40
| 0.828829
| 14
| 111
| 6.142857
| 0.642857
| 0.27907
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108108
| 111
| 6
| 41
| 18.5
| 0.868687
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
42e49d7b0a14a89a526b8fd336a726df0e395878
| 245
|
py
|
Python
|
index_scraper/index_scraper/items.py
|
ralphqq/pse-indices-scoreboard
|
f11a01915ac5a17b663db604afe996c5ed928fb9
|
[
"MIT"
] | 1
|
2019-10-08T16:54:07.000Z
|
2019-10-08T16:54:07.000Z
|
index_scraper/index_scraper/items.py
|
ralphqq/pse-indices-scoreboard
|
f11a01915ac5a17b663db604afe996c5ed928fb9
|
[
"MIT"
] | 8
|
2020-02-12T01:17:41.000Z
|
2021-12-13T20:06:12.000Z
|
index_scraper/index_scraper/items.py
|
ralphqq/pse-indices-scoreboard
|
f11a01915ac5a17b663db604afe996c5ed928fb9
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
import scrapy
class IndexScraperItem(scrapy.Item):
name = scrapy.Field()
current_value = scrapy.Field()
points_change = scrapy.Field()
percent_change = scrapy.Field()
market_status = scrapy.Field()
| 20.416667
| 36
| 0.673469
| 28
| 245
| 5.75
| 0.607143
| 0.341615
| 0.21118
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005051
| 0.191837
| 245
| 11
| 37
| 22.272727
| 0.808081
| 0.085714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.142857
| 0
| 1
| 0
| 1
| 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
| 4
|
42e5542d36b90d3fb4cf6c4f893b6dbb88fb6706
| 330
|
py
|
Python
|
scripts/end_to_end.py
|
PatrickAlphaC/vrf_pizza
|
c39c03ea707234a814d3d57419111c8e049d87a9
|
[
"MIT"
] | 9
|
2021-03-13T03:47:12.000Z
|
2021-09-01T13:49:58.000Z
|
scripts/end_to_end.py
|
PatrickAlphaC/vrf_pizza
|
c39c03ea707234a814d3d57419111c8e049d87a9
|
[
"MIT"
] | 1
|
2021-03-07T21:32:55.000Z
|
2021-03-29T00:34:22.000Z
|
scripts/end_to_end.py
|
PatrickAlphaC/vrf_pizza
|
c39c03ea707234a814d3d57419111c8e049d87a9
|
[
"MIT"
] | 1
|
2021-09-01T13:49:58.000Z
|
2021-09-01T13:49:58.000Z
|
#!/usr/bin/python3
import os
from brownie import VRF_Pizza, VRF_Pizza_RNG, accounts, network, config, interface
from .a1_deploy import deploy_pizza_contracts
from .a2_order_random_pizza import order_pizza
def main():
end_to_end()
def end_to_end():
vrf_pizza, vrf_pizza_rng = deploy_pizza_contracts()
order_pizza()
| 22
| 82
| 0.781818
| 51
| 330
| 4.666667
| 0.470588
| 0.134454
| 0.092437
| 0.134454
| 0.159664
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010563
| 0.139394
| 330
| 14
| 83
| 23.571429
| 0.827465
| 0.051515
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| true
| 0
| 0.444444
| 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
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6e255ae0096bd993a6f773ddb30a47d4f00cd309
| 431
|
py
|
Python
|
part5/enum_4.py
|
MADTeacher/python_basics
|
06ae43d8063c1c8426a4fbb53443b6d1ee727951
|
[
"MIT"
] | null | null | null |
part5/enum_4.py
|
MADTeacher/python_basics
|
06ae43d8063c1c8426a4fbb53443b6d1ee727951
|
[
"MIT"
] | null | null | null |
part5/enum_4.py
|
MADTeacher/python_basics
|
06ae43d8063c1c8426a4fbb53443b6d1ee727951
|
[
"MIT"
] | 4
|
2020-10-04T12:24:14.000Z
|
2022-01-16T17:01:59.000Z
|
from enum import IntFlag
class TestFlag(IntFlag):
A = 1
B = 2
C = 3
D = 4
if __name__ == "__main__":
print(repr(TestFlag.A | TestFlag.B))
RW = TestFlag.A | TestFlag.D
print(repr(RW))
print(TestFlag.A in RW)
print(repr(TestFlag.D & TestFlag.C))
print(repr(TestFlag.D ^ TestFlag.C))
print(bool(TestFlag.D & TestFlag.C))
print(repr(TestFlag.D ^ 12))
print(repr(TestFlag.A | 6))
| 20.52381
| 40
| 0.610209
| 65
| 431
| 3.923077
| 0.369231
| 0.211765
| 0.333333
| 0.211765
| 0.372549
| 0.372549
| 0.372549
| 0.282353
| 0
| 0
| 0
| 0.021472
| 0.243619
| 431
| 21
| 41
| 20.52381
| 0.760736
| 0
| 0
| 0
| 0
| 0
| 0.018519
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.0625
| 0
| 0.375
| 0.5
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
6e3361eda180b866b83a533942741fa89d2fe609
| 484
|
py
|
Python
|
app/domain/commands.py
|
zmoog/concierge
|
5f77b979c34182d5933e8a3d26e97ee1e5ad8339
|
[
"MIT"
] | 1
|
2020-02-13T16:32:01.000Z
|
2020-02-13T16:32:01.000Z
|
app/domain/commands.py
|
zmoog/concierge
|
5f77b979c34182d5933e8a3d26e97ee1e5ad8339
|
[
"MIT"
] | 389
|
2019-09-06T06:02:45.000Z
|
2022-03-31T04:07:25.000Z
|
app/domain/commands.py
|
zmoog/concierge
|
5f77b979c34182d5933e8a3d26e97ee1e5ad8339
|
[
"MIT"
] | 2
|
2020-02-24T13:04:46.000Z
|
2020-02-24T13:16:43.000Z
|
# pylint: disable=too-few-public-methods
from datetime import date
from typing import List # Optional
# from dataclasses import dataclass
# from pydantic import BaseModel
# from pydantic.dataclasses import dataclass
from pydantic import BaseModel
class Command(BaseModel):
pass
# @dataclass
class Summarize(Command):
day: date
# @dataclass
class DownloadIFQ(Command):
day: date
# @dataclass
class CheckRefurbished(Command):
store: str
products: List[str]
| 17.285714
| 44
| 0.754132
| 57
| 484
| 6.403509
| 0.473684
| 0.09863
| 0.142466
| 0.164384
| 0.443836
| 0.290411
| 0.290411
| 0
| 0
| 0
| 0
| 0
| 0.173554
| 484
| 27
| 45
| 17.925926
| 0.9125
| 0.38843
| 0
| 0.166667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.083333
| 0.25
| 0
| 0.916667
| 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
| 1
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
282bf4d3cd6b812862cb76de3382da22ee4496ac
| 3,267
|
py
|
Python
|
result/result.py
|
nkeyes/result
|
47821b4d3fa3aa12a482b04ef99ca7f216be725b
|
[
"MIT"
] | null | null | null |
result/result.py
|
nkeyes/result
|
47821b4d3fa3aa12a482b04ef99ca7f216be725b
|
[
"MIT"
] | null | null | null |
result/result.py
|
nkeyes/result
|
47821b4d3fa3aa12a482b04ef99ca7f216be725b
|
[
"MIT"
] | null | null | null |
from typing import Generic, TypeVar, Union, Any, Optional, cast, overload
E = TypeVar("E")
T = TypeVar("T")
A = TypeVar("A")
class Result(Generic[E, T]):
"""
A simple `Result` type inspired by Rust.
Not all methods (https://doc.rust-lang.org/std/result/enum.Result.html)
have been implemented, only the ones that make sense in the Python context.
"""
def __init__(self, is_ok: bool, value: Union[E, T], force: bool = False) -> None:
"""Do not call this constructor, use the Ok or Err class methods instead.
There are no type guarantees on the value if this is called directly.
Args:
is_ok: If this represents an ok result
value: The value inside the result
force: Force creation of the object. This is false by default to prevent accidentally
creating instance of a Result in an unsafe way.
"""
if force is not True:
raise RuntimeError("Don't instantiate a Result directly. "
"Use the Ok(value) and Err(error) class methods instead.")
else:
self._is_ok = is_ok
self._value = value
def __eq__(self, other: Any) -> bool:
return (self.__class__ == other.__class__ and
self.is_ok() == cast(Result, other).is_ok() and
self._value == other._value)
def __ne__(self, other: Any) -> bool:
return not (self == other)
def __hash__(self) -> int:
return hash((self.is_ok(), self._value))
def __repr__(self) -> str:
if self.is_ok():
return 'Ok({})'.format(repr(self._value))
else:
return 'Err({})'.format(repr(self._value))
@classmethod
@overload
def Ok(cls) -> 'Result[E, bool]':
pass
@classmethod
@overload
def Ok(cls, value: T) -> 'Result[E, T]':
pass
@classmethod
def Ok(cls, value: Any = True) -> 'Result[E, Any]':
return cls(is_ok=True, value=value, force=True)
@classmethod
def Err(cls, error: E) -> 'Result[E, T]':
return cls(is_ok=False, value=error, force=True)
def is_ok(self) -> bool:
return self._is_ok
def is_err(self) -> bool:
return not self._is_ok
def ok(self) -> Optional[T]:
"""
Return the value if it is an `Ok` type. Return `None` if it is an `Err`.
"""
return cast(T, self._value) if self.is_ok() else None
def err(self) -> Optional[E]:
"""
Return the error if this is an `Err` type. Return `None` otherwise.
"""
return cast(E, self._value) if self.is_err() else None
@property
def value(self) -> Union[E, T]:
"""
Return the inner value. This might be either the ok or the error type.
"""
return self._value
# TODO: Implement __iter__ for destructuring
@overload
def Ok() -> Result[E, bool]:
pass
@overload
def Ok(value: T) -> Result[E, T]:
pass
def Ok(value: Any = True) -> Result[E, Any]:
"""
Shortcut function to create a new Result.
"""
return Result.Ok(value)
def Err(error: E) -> Result[E, T]:
"""
Shortcut function to create a new Result.
"""
return Result.Err(error)
| 27.453782
| 97
| 0.579431
| 452
| 3,267
| 4.05531
| 0.263274
| 0.030551
| 0.034915
| 0.014184
| 0.181124
| 0.093835
| 0.050191
| 0.050191
| 0.050191
| 0
| 0
| 0
| 0.298745
| 3,267
| 118
| 98
| 27.686441
| 0.800087
| 0.277319
| 0
| 0.233333
| 0
| 0
| 0.073989
| 0
| 0
| 0
| 0
| 0.008475
| 0
| 1
| 0.3
| false
| 0.066667
| 0.016667
| 0.116667
| 0.566667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
283069f44e96dffc65cd9e07a26ffe0240931a3f
| 128
|
py
|
Python
|
tests/test_select_vts_to_plot.py
|
burkesquires/FeaVar
|
68695bff105fbabbda18f27b0d296f7f446ca0bb
|
[
"CC0-1.0"
] | 1
|
2019-10-28T16:58:34.000Z
|
2019-10-28T16:58:34.000Z
|
tests/test_select_vts_to_plot.py
|
burkesquires/nvariant
|
68695bff105fbabbda18f27b0d296f7f446ca0bb
|
[
"CC0-1.0"
] | 1
|
2021-09-03T13:37:57.000Z
|
2021-09-03T20:40:55.000Z
|
tests/test_select_vts_to_plot.py
|
burkesquires/ombre
|
68695bff105fbabbda18f27b0d296f7f446ca0bb
|
[
"CC0-1.0"
] | null | null | null |
from unittest import TestCase
class TestSelectVtsToPlot(TestCase):
def test_select_vts_to_plot(self):
self.fail()
| 18.285714
| 38
| 0.75
| 16
| 128
| 5.75
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.179688
| 128
| 6
| 39
| 21.333333
| 0.87619
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
95401e2294bedcdc9af8c6c14610ea85b599982a
| 1,262
|
py
|
Python
|
models/layers/softmax.py
|
milesgray/ImageFunctions
|
35e4423b94149b0ba291eafb0cd98260a70d5f31
|
[
"Apache-2.0"
] | null | null | null |
models/layers/softmax.py
|
milesgray/ImageFunctions
|
35e4423b94149b0ba291eafb0cd98260a70d5f31
|
[
"Apache-2.0"
] | null | null | null |
models/layers/softmax.py
|
milesgray/ImageFunctions
|
35e4423b94149b0ba291eafb0cd98260a70d5f31
|
[
"Apache-2.0"
] | null | null | null |
import torch
import torch.nn as nn
class SpatialSoftmax2d(nn.Module):
def __init__(self, temp: float=1.0, requires_grad: bool=True):
super().__init__()
self.temp = nn.Parameter(torch.FloatTensor([temp]), requires_grad=requires_grad)
self.softmax = nn.Softmax2d()
def forward(self, x):
x = self.softmax(x)
return x * self.temp.to(x.device)
class ChannelSoftmax2d(nn.Module):
def __init__(self, temp: float=1.0, requires_grad: bool=True):
super().__init__()
self.temp = nn.Parameter(torch.FloatTensor([temp]), requires_grad=requires_grad)
self.softmax = nn.Softmax(dim=1)
def forward(self, x):
x = self.softmax(x)
return x * self.temp.to(x.device)
class ChannelGumbelMax2d(nn.Module):
def __init__(self, tau: float=1.0, hard: bool=False, dim: int=-1, requires_grad: bool=True):
super().__init__()
self.tau = tau
self.hard = hard
self.dim = dim
self.temp = nn.Parameter(torch.FloatTensor([temp]), requires_grad=requires_grad)
self.softmax = nn.Softmax(dim=1)
def forward(self, x):
x = F.gumbel_softmax(x, tau=self.tau, hard=self.hard, dim=self.dim)
return x * self.temp.to(x.device)
| 35.055556
| 96
| 0.637876
| 177
| 1,262
| 4.355932
| 0.20904
| 0.140078
| 0.062257
| 0.058366
| 0.744488
| 0.719844
| 0.719844
| 0.645914
| 0.645914
| 0.645914
| 0
| 0.013265
| 0.223455
| 1,262
| 36
| 97
| 35.055556
| 0.773469
| 0
| 0
| 0.62069
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.206897
| false
| 0
| 0.068966
| 0
| 0.482759
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
957fc749564cef728c84b25cdd57c72a4e950822
| 285
|
py
|
Python
|
main.py
|
marcelloamr/Acompanhar-site-em-python
|
4058a54d2a8e58c2f7b2a3f252fde2da98977254
|
[
"MIT"
] | null | null | null |
main.py
|
marcelloamr/Acompanhar-site-em-python
|
4058a54d2a8e58c2f7b2a3f252fde2da98977254
|
[
"MIT"
] | null | null | null |
main.py
|
marcelloamr/Acompanhar-site-em-python
|
4058a54d2a8e58c2f7b2a3f252fde2da98977254
|
[
"MIT"
] | null | null | null |
from time import sleep
from text import *
while(True):
# page("","")
page("https://www.cebraspe.org.br/concursos/SERPRO_21","Serpro_21")
page("https://www.transparencia.serpro.gov.br/acesso-a-informacao/servidores/concurso-publico/concurso-2021","Serpro_21_2")
| 35.625
| 128
| 0.698246
| 39
| 285
| 5
| 0.666667
| 0.123077
| 0.123077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.044355
| 0.129825
| 285
| 7
| 129
| 40.714286
| 0.741935
| 0.038596
| 0
| 0
| 0
| 0.2
| 0.633962
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.4
| 0
| 0.4
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
958317b3e41a2669beb96aa8b1e434b04803f943
| 243
|
py
|
Python
|
polyhymnia/utils/synonyms.py
|
luoy2/polyhymnia
|
7de33e7dd816ec2c75d395c35d5ddc46a21ce94c
|
[
"Apache-2.0"
] | 2
|
2022-03-22T12:49:21.000Z
|
2022-03-22T12:55:01.000Z
|
polyhymnia/utils/synonyms.py
|
luoy2/polyhymnia
|
7de33e7dd816ec2c75d395c35d5ddc46a21ce94c
|
[
"Apache-2.0"
] | null | null | null |
polyhymnia/utils/synonyms.py
|
luoy2/polyhymnia
|
7de33e7dd816ec2c75d395c35d5ddc46a21ce94c
|
[
"Apache-2.0"
] | null | null | null |
__all__ = ['get_synonyms']
import os
import pathlib
# os.environ["SYNONYMS_WORD2VEC_BIN_MODEL_ZH_CN"] = str(pathlib.Path(__file__).parents[1] / 'data/words.vector')
import synonyms
def get_synonyms(word):
return synonyms.nearby(word)[0]
| 24.3
| 112
| 0.761317
| 35
| 243
| 4.857143
| 0.714286
| 0.129412
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013761
| 0.102881
| 243
| 9
| 113
| 27
| 0.766055
| 0.452675
| 0
| 0
| 0
| 0
| 0.091603
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.5
| 0.166667
| 0.833333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 4
|
959aec2216fda8c6e1a6cdf6ec2c88c1c6a7e137
| 217
|
py
|
Python
|
plangclassifier/__init__.py
|
arnauorriols/plangclassifier
|
8e061e59e6a916ebb70b22ec6509daceb8c7c0a8
|
[
"BSD-3-Clause"
] | 1
|
2017-06-14T17:06:30.000Z
|
2017-06-14T17:06:30.000Z
|
plangclassifier/__init__.py
|
arnauorriols/plangclassifier
|
8e061e59e6a916ebb70b22ec6509daceb8c7c0a8
|
[
"BSD-3-Clause"
] | null | null | null |
plangclassifier/__init__.py
|
arnauorriols/plangclassifier
|
8e061e59e6a916ebb70b22ec6509daceb8c7c0a8
|
[
"BSD-3-Clause"
] | null | null | null |
from .classifier import Classifier
from .samples import DATA
def classify_langs(code, languages=None):
if languages is None:
languages = []
return Classifier.classify(DATA, code, languages=languages)
| 27.125
| 63
| 0.741935
| 26
| 217
| 6.153846
| 0.538462
| 0.1625
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.179724
| 217
| 7
| 64
| 31
| 0.898876
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
959aec7de3b24dff564b56dd06eb2d216f98f5d5
| 102
|
py
|
Python
|
hdp/store/excel.py
|
Open-Health-Data-Project/ohdp
|
9b7e339ecf09cb9319ee4d507327701619b70317
|
[
"BSD-3-Clause"
] | 10
|
2020-05-06T17:59:37.000Z
|
2021-02-15T23:11:05.000Z
|
hdp/store/excel.py
|
Open-Health-Data-Project/ohdp
|
9b7e339ecf09cb9319ee4d507327701619b70317
|
[
"BSD-3-Clause"
] | 2
|
2020-07-02T16:36:23.000Z
|
2020-07-14T21:51:07.000Z
|
hdp/store/excel.py
|
Open-Health-Data-Project/ohdp
|
9b7e339ecf09cb9319ee4d507327701619b70317
|
[
"BSD-3-Clause"
] | 11
|
2020-05-08T18:49:55.000Z
|
2020-06-29T17:33:10.000Z
|
# Team 5
def save_to_excel(datatables: list, directory=None):
pass
def open_excel():
pass
| 10.2
| 52
| 0.676471
| 15
| 102
| 4.4
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012658
| 0.22549
| 102
| 9
| 53
| 11.333333
| 0.822785
| 0.058824
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
95a0d1c7850fffaa5550fe2c318e4631fbd6a8e4
| 83
|
py
|
Python
|
moex/apps.py
|
ghostforpy/bonds-docker
|
fda77225b85264cb4ba06b15ff63bc807858425a
|
[
"MIT"
] | 2
|
2020-09-08T12:51:56.000Z
|
2021-08-18T15:27:52.000Z
|
moex/apps.py
|
nrsharip/iss-web
|
e8ca66ade3933dfac4795ba7c44e067c26a079e2
|
[
"MIT"
] | 1
|
2021-12-13T20:43:35.000Z
|
2021-12-13T20:43:35.000Z
|
moex/apps.py
|
nrsharip/iss-web
|
e8ca66ade3933dfac4795ba7c44e067c26a079e2
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class MoexConfig(AppConfig):
name = 'moex'
| 13.833333
| 33
| 0.73494
| 10
| 83
| 6.1
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.180723
| 83
| 5
| 34
| 16.6
| 0.897059
| 0
| 0
| 0
| 0
| 0
| 0.048193
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
95c3c3995f98bb54d50651de49511fe89805e569
| 198
|
py
|
Python
|
filer/apps.py
|
namanwfhsolve/tempfiler
|
dfce98f85e7313e42df74c96cb2f84d1836017c1
|
[
"MIT"
] | 1
|
2022-02-01T22:40:21.000Z
|
2022-02-01T22:40:21.000Z
|
filer/apps.py
|
namanwfhsolve/tempfiler
|
dfce98f85e7313e42df74c96cb2f84d1836017c1
|
[
"MIT"
] | 2
|
2021-07-05T14:28:59.000Z
|
2021-07-05T15:41:19.000Z
|
filer/apps.py
|
namanwfhsolve/tempfiler
|
dfce98f85e7313e42df74c96cb2f84d1836017c1
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class FilerConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'filer'
def ready(self):
from filer import signals
| 19.8
| 56
| 0.712121
| 24
| 198
| 5.791667
| 0.791667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.207071
| 198
| 9
| 57
| 22
| 0.88535
| 0
| 0
| 0
| 0
| 0
| 0.171717
| 0.146465
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
95ee4fbebcaa75c7422656a3f1fb679039e991d4
| 357
|
py
|
Python
|
budgetme/apps/transactions/renderers.py
|
poblouin/budgetme-rest-api
|
74d9237bc7b0a118255a659029637c5ed1a8b7a1
|
[
"MIT"
] | 2
|
2018-03-07T09:43:07.000Z
|
2018-03-11T04:50:41.000Z
|
budgetme/apps/transactions/renderers.py
|
poblouin/budgetme-rest-api
|
74d9237bc7b0a118255a659029637c5ed1a8b7a1
|
[
"MIT"
] | 13
|
2017-12-28T02:44:09.000Z
|
2020-06-05T21:13:13.000Z
|
budgetme/apps/transactions/renderers.py
|
poblouin/budgetme-rest-api
|
74d9237bc7b0a118255a659029637c5ed1a8b7a1
|
[
"MIT"
] | null | null | null |
from budgetme.apps.core.renderers import BudgetMeJSONRenderer
class TransactionJSONRenderer(BudgetMeJSONRenderer):
object_label = 'transaction'
pagination_object_label = 'transactions'
class ScheduledTransactionJSONRenderer(BudgetMeJSONRenderer):
object_label = 'scheduled_transaction'
pagination_object_label = 'scheduled_transactions'
| 29.75
| 61
| 0.829132
| 29
| 357
| 9.931034
| 0.551724
| 0.152778
| 0.215278
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.112045
| 357
| 11
| 62
| 32.454545
| 0.908517
| 0
| 0
| 0
| 0
| 0
| 0.184874
| 0.120448
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.142857
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
251f51905608bf1b30bb0893d30ac54b141aa68d
| 17,726
|
py
|
Python
|
experiment4_1/snn_cvx.py
|
worden1/ICTAI_snn
|
b0955c4c0bf22056f46c78a3b15438baafbd490f
|
[
"MIT"
] | null | null | null |
experiment4_1/snn_cvx.py
|
worden1/ICTAI_snn
|
b0955c4c0bf22056f46c78a3b15438baafbd490f
|
[
"MIT"
] | null | null | null |
experiment4_1/snn_cvx.py
|
worden1/ICTAI_snn
|
b0955c4c0bf22056f46c78a3b15438baafbd490f
|
[
"MIT"
] | null | null | null |
import numpy as np
import numba as nb
@nb.jit(nopython=True)
def run_snn_trial(x_sample,
F_weights,
omega,
thresholds,
dt,
leak,
mu=0.,
sigma_v=0.
):
"""
Function to simulate the spiking network for defined connectivity parameters, thresholds and time parameters.
It returns the instantaneous firing rates of neurons for the whole simulation time
Parameters
----------
x_sample: array
Input array (shape=[K, num_bins])
F_weights: array
Feed-forward weights (shape=[N, K])
omega: array
Recurrent weights (shape=[N, N])
thresholds: array
Neurons thresholds (shape=[N,])
dt: float
time step
leak: float
membrane leak time-constant
mu: float
controls spike cost
sigma_v: float
controls variance of voltage noise
Returns
-------
array
network instantaneous firing rates (shape=[N x num_bins])
"""
# initialize system
N = F_weights.shape[0] # number of neurons
num_bins = x_sample.shape[1] # number of time bins
firing_rates = np.zeros((N, num_bins))
V_membrane = np.zeros(N)
# implement the Euler method to solve the differential equations
for t in range(num_bins - 1):
# compute command signal
command_x = (x_sample[:, t + 1] -
x_sample[:, t]) / dt + leak * x_sample[:, t]
# update membrane potential
V_membrane += dt * (-leak * V_membrane +
np.dot(F_weights, command_x)
) + np.sqrt(2 * dt * leak) * sigma_v * np.random.randn(N)
# update firing rates
firing_rates[:, t + 1] = (1 - leak * dt) * firing_rates[:, t]
# Check if any neurons are past their threshold during the last time-step
diff_voltage_thresh = V_membrane - thresholds
spiking_neurons_indices = np.arange(N)[diff_voltage_thresh >= 0]
if spiking_neurons_indices.size > 0:
# Pick the neuron which likely would have spiked first, by max distance from threshold
to_pick = np.argmax(V_membrane[spiking_neurons_indices] - thresholds[spiking_neurons_indices])
s = spiking_neurons_indices[to_pick]
# Update membrane potential
V_membrane[s] -= mu
V_membrane += omega[:, s]
# Update firing rates
firing_rates[s, t + 1] += 1
else:
pass
return firing_rates
@nb.jit(nopython=True)
def update_weights(x_sample,
y_target_sample,
F_weights,
G_weights,
omega,
thresholds,
buffer_bins,
dt,
leak,
leak_thresh,
alpha_thresh,
alpha_F,
mu=0.,
sigma_v=0.,
):
"""
Train the network in one trial with one presented input-target pair (x_sample, y_target_sample)
The function returns the updated thresholds and feed-forward weights after that trial
Parameters
----------
x_sample: array
Input array (shape=[K, num_bins])
y_target_sample: array
target sample (shape=[M,])
F_weights: array
Feed-forward weights (shape=[N, K])
G_weights: array
Encoder weights (shape=[N, M])
omega: array
Recurrent weights (shape=[N, N])
thresholds: array
Neurons thresholds (shape=[N,])
buffer_bins: int
Number of bins before learning starts
dt: float
time step
leak: float
membrane leak time-constant
leak_thresh: float
controls the speed of drift in thresholds
alpha_thresh: float
learning rate of thresholds (>> leak thresh)
alpha_F: float
learning rate for forward weights
mu: float
controls spike cost
sigma_v: float
controls variance of voltage noise
Returns
-------
array
updated thresholds array
array
updated feed-forward weights array
"""
# initialize system
beta = 1 / 500
N = F_weights.shape[0]
num_bins = x_sample.shape[1]
firing_rates = np.zeros((N, num_bins))
V_membrane = np.zeros(N)
# implement the Euler method to solve the differential equations
for t in range(num_bins - 1):
# compute command signal
command_x = (x_sample[:, t + 1] -
x_sample[:, t]) / dt + leak * x_sample[:, t]
# update membrane potential
V_membrane += dt * (-leak * V_membrane +
np.dot(F_weights, command_x)
) + np.sqrt(2 * dt * leak) * sigma_v * np.random.randn(N)
# update rates
firing_rates[:, t + 1] = (1 - leak * dt) * firing_rates[:, t]
# Check if any neurons are past their threshold during the last time-step
diff_voltage_thresh = V_membrane - thresholds
spiking_neurons_indices = np.arange(N)[diff_voltage_thresh >= 0]
if spiking_neurons_indices.size > 0:
# Pick the neuron which likely would have spiked first, by max distance from threshold
to_pick = np.argmax(V_membrane[spiking_neurons_indices] - thresholds[spiking_neurons_indices])
s = spiking_neurons_indices[to_pick]
# Update membrane potential
V_membrane[s] -= mu
V_membrane += omega[:, s]
# Update rates with spikes
firing_rates[s, t + 1] += 1
# !! Update weights
if t >= buffer_bins:
proj_error_neuron = F_weights[s, :] @ x_sample[:, t] - thresholds[
s] - G_weights[s, :] @ y_target_sample - beta * (F_weights[s,
:] @ x_sample[:, t] - thresholds[s] )
dLdthresh = -proj_error_neuron
dLdf_weights = proj_error_neuron * x_sample[:, t]
thresholds[s] -= alpha_thresh * dLdthresh
F_weights[s, :] -= alpha_F * dLdf_weights
else:
pass
# drift thresholds
if t >= buffer_bins:
thresholds -= dt * leak_thresh
return thresholds, F_weights
@nb.jit(nopython=True)
def update_weights_2(x_sample,
y_target_sample,
F_weights,F_weights_2,
G_weights,G_weights_2,
omega,omega_2,
thresholds,thresholds_2,
buffer_bins,
dt,
leak,
leak_thresh,
alpha_thresh,
alpha_F,
mu=0.,
sigma_v=0.,
):
"""
Train the network in one trial with one presented input-target pair (x_sample, y_target_sample)
The function returns the updated thresholds and feed-forward weights after that trial
Parameters
----------
x_sample: array
Input array (shape=[K, num_bins])
y_target_sample: array
target sample (shape=[M,])
F_weights: array
Feed-forward weights (shape=[N, K])
G_weights: array
Encoder weights (shape=[N, M])
omega: array
Recurrent weights (shape=[N, N])
thresholds: array
Neurons thresholds (shape=[N,])
buffer_bins: int
Number of bins before learning starts
dt: float
time step
leak: float
membrane leak time-constant
leak_thresh: float
controls the speed of drift in thresholds
alpha_thresh: float
learning rate of thresholds (>> leak thresh)
alpha_F: float
learning rate for forward weights
mu: float
controls spike cost
sigma_v: float
controls variance of voltage noise
Returns
-------
array
updated thresholds array
array
updated feed-forward weights array
"""
# initialize system
beta = 1 / 500
N = F_weights.shape[0]
num_bins = x_sample.shape[1]
firing_rates = np.zeros((N, num_bins))
V_membrane = np.zeros(N)
V_membrane_2 = np.zeros(N)
firing_rates_2 = np.zeros((N, num_bins))
# implement the Euler method to solve the differential equations
for t in range(num_bins - 1):
# compute command signal
command_x = (x_sample[:, t + 1] -
x_sample[:, t]) / dt + leak * x_sample[:, t]
# update membrane potential
V_membrane += dt * (-leak * V_membrane +
np.dot(F_weights, command_x)
) + np.sqrt(2 * dt * leak) * sigma_v * np.random.randn(N)
# update rates
firing_rates[:, t + 1] = (1 - leak * dt) * firing_rates[:, t]
# Check if any neurons are past their threshold during the last time-step
diff_voltage_thresh = V_membrane - thresholds
spiking_neurons_indices = np.arange(N)[diff_voltage_thresh >= 0]
if spiking_neurons_indices.size > 0:
# Pick the neuron which likely would have spiked first, by max distance from threshold
to_pick = np.argmax(V_membrane[spiking_neurons_indices] - thresholds[spiking_neurons_indices])
s = spiking_neurons_indices[to_pick]
# Update membrane potential
V_membrane[s] -= mu
V_membrane += omega[:, s]
# Update rates with spikes
firing_rates[s, t + 1] += 1
# !! Update weights
if t >= buffer_bins:
proj_error_neuron = F_weights[s, :] @ x_sample[:, t] - thresholds[
s] - G_weights[s, :] @ y_target_sample - beta * (F_weights[s,
:] @ x_sample[:, t] - thresholds[s] )
dLdthresh = -proj_error_neuron
dLdf_weights = proj_error_neuron * x_sample[:, t]
thresholds[s] -= alpha_thresh * dLdthresh
F_weights[s, :] -= alpha_F * dLdf_weights
else:
pass
#layer 2
V_membrane_2 += dt * (-leak * V_membrane_2 +
F_weights_2 @ firing_rates[:, t]
) + np.sqrt(2 * dt * leak) * sigma_v * np.random.randn(N)
firing_rates_2[:, t + 1] = (1 - leak * dt) * firing_rates_2[:, t]
diff_voltage_thresh_2 = V_membrane_2 - thresholds_2
spiking_neurons_indices_2 = np.arange(N)[diff_voltage_thresh_2 >= 0]
if spiking_neurons_indices_2.size > 0:
# Pick the neuron which likely would have spiked first, by max distance from threshold
to_pick_2 = np.argmax(V_membrane_2[spiking_neurons_indices_2] - thresholds_2[spiking_neurons_indices_2])
s_2 = spiking_neurons_indices_2[to_pick_2]
# Update membrane potential
V_membrane_2[s_2] -= mu
V_membrane_2 += omega_2[:, s_2]
# Update rates with spikes
firing_rates_2[s_2, t + 1] += 1
# !! Update weights
if t >= buffer_bins:
proj_error_neuron_2 = F_weights_2[s_2, :] @ firing_rates[:, t] - thresholds_2[
s_2] - G_weights_2[s_2, :] @ y_target_sample - beta * (F_weights_2[s_2,
:] @ firing_rates[:, t] - thresholds_2[s_2] )
dLdthresh_2 = -proj_error_neuron_2
dLdf_weights_2 = proj_error_neuron_2 * x_sample[:, t]
thresholds_2[s_2] -= alpha_thresh * dLdthresh_2
F_weights_2[s_2, :] -= alpha_F * dLdf_weights_2
else:
pass
# drift thresholds
if t >= buffer_bins:
thresholds -= dt * leak_thresh
thresholds_2 -= dt * leak_thresh
return thresholds, F_weights, thresholds_2, F_weights_2
def run_snn(x,
F_weights,
omega,
thresholds,
dt,
leak,
mu=0.,
sigma_v=0.,
silence_T=None,
silence_prop=0,
delay=0
):
"""
Function to simulate the spiking network for defined connectivity parameters, thresholds and time parameters.
It returns the firing rates, voltages, currents, and spikes.
Parameters
----------
x: array
Input array (shape=[K, num_bins])
F_weights: array
Feed-forward weights (shape=[N, K])
omega: array
Recurrent weights (shape=[N, N])
thresholds: array
Neurons thresholds (shape=[N,])
dt: float
time step
leak: float
membrane leak time-constant
mu: float
controls spike cost
sigma_v: float
controls variance of voltage noise
silence_T: int
From which time-point to silence neurons
silence_prop: float
Which proportion of the population to silence
delay: int
Synaptic delay in recurrent connections in number of timesteps
Returns
-------
array
network instantaneous firing rates (shape=[N x num_bins])
array
network spikes (shape=[N x num_bins])
array
network voltages (shape=[N x num_bins])
array
network excitatory currents (shape=[N x num_bins])
array
network inhibitory currents (shape=[N x num_bins])
"""
# initialize system
N = F_weights.shape[0] # number of neurons
num_bins = x.shape[1] # number of time bins
firing_rates = np.zeros((N, num_bins))
spikes = np.zeros((N, num_bins))
V_membrane = np.zeros((N, num_bins))
I_E = np.zeros((N, num_bins))
I_I = np.zeros((N, num_bins))
# split connectivity into recurrent and self-connections
omega_self = np.copy(omega)
omega_rec = np.copy(omega)
omega_rec[np.eye(N) == 1] = 0
omega_self[np.eye(N) == 0] = 0
# separate recurrent weights into inhibitory and excitatory
omega_e, omega_i = omega.copy(), omega.copy()
omega_e[omega < 0] = 0
omega_i[omega > 0] = 0
omega_i[range(N), range(N)] = 0 # remove self-resets
omega_e[range(N), range(N)] = 0 # remove self-resets
# separate feed-forward weights into positive and negative
F_pos, F_neg = F_weights.copy(), F_weights.copy()
F_pos[F_weights < 0] = 0
F_neg[F_weights > 0] = 0
# if not given, set silence point at end
if silence_T is None:
silence_T = num_bins + 1
# implement the Euler method to solve the differential equations
for t in range(num_bins - 1):
# compute command signal
command_x = (x[:, t + 1] -
x[:, t]) / dt + leak * x[:, t]
# update membrane potential
V_membrane[:, t + 1] = V_membrane[:, t] + dt * (-leak * V_membrane[:, t] +
np.dot(F_weights, command_x) +
np.dot(omega_self, spikes[:, t]/dt)
) + np.sqrt(2 * dt * leak) * sigma_v * np.random.randn(N)
if t >= delay:
V_membrane[:, t + 1] = V_membrane[:, t + 1] + np.dot(omega_rec, spikes[:, t-delay])
# get positive/negative inputs
command_x_pos, command_x_neg = command_x.copy(), command_x.copy()
command_x_pos[command_x < 0] = 0
command_x_neg[command_x > 0] = 0
# update currents
dI_I = np.dot(F_neg, command_x_pos) + np.dot(F_pos, command_x_neg) # inhibitory inputs
if t >= delay:
dI_I += np.dot(omega_i, spikes[:, t-delay] / dt)
I_I[:, t+1] = I_I[:, t] + dt*(-I_I[:, t]*leak + dI_I)
dI_E = np.dot(F_pos, command_x_pos) + np.dot(F_neg, command_x_neg) # excitatory inputs
if t >= delay:
dI_E += np.dot(omega_e, spikes[:, t-delay] / dt)
I_E[:, t+1] = I_E[:, t] + dt*(-I_E[:, t]*leak + dI_E)
# update firing rates
firing_rates[:, t + 1] = (1 - leak * dt) * firing_rates[:, t]
# silence neurons
if t > silence_T:
V_membrane[int(N * (1 - silence_prop)):, t + 1] = -100
# Check if any neurons are past their threshold during the last time-step
diff_voltage_thresh = V_membrane[:, t + 1] - thresholds
spiking_neurons_indices = np.arange(N)[diff_voltage_thresh >= 0]
if spiking_neurons_indices.size > 0:
if delay == 0:
# Pick the neuron which likely would have spiked first, by max distance from threshold
to_pick = np.argmax(diff_voltage_thresh[spiking_neurons_indices])
s = spiking_neurons_indices[to_pick]
# Update membrane potential
V_membrane[s, t + 1] -= mu
spikes[s, t + 1] = 1
# Update firing rates
firing_rates[s, t + 1] += 1
else:
# Update membrane potential
V_membrane[spiking_neurons_indices, t + 1] -= mu
# V_membrane[:, t + 1] += omega[:, s]
spikes[spiking_neurons_indices, t + 1] = 1
# Update firing rates
firing_rates[spiking_neurons_indices, t + 1] += 1
else:
pass
return firing_rates, spikes, V_membrane, I_E, I_I
@nb.jit(nopython=True)
def run_maxout(x_sample, F_weights, G_weights, thresholds):
# calculate activities
neural_boundary = np.zeros((G_weights.shape[1], G_weights.shape[0] + 1))
neural_boundary[:, 1:] = F_weights @ x_sample / G_weights.ravel() - thresholds / G_weights.ravel()
y_out = neural_boundary.max()
nactive = neural_boundary.argmax()
return y_out, nactive
| 34.688845
| 116
| 0.564425
| 2,239
| 17,726
| 4.251452
| 0.088432
| 0.037819
| 0.059565
| 0.025213
| 0.825087
| 0.779178
| 0.741359
| 0.696712
| 0.681899
| 0.681899
| 0
| 0.014668
| 0.342322
| 17,726
| 510
| 117
| 34.756863
| 0.801853
| 0.335665
| 0
| 0.618644
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.021186
| false
| 0.021186
| 0.008475
| 0
| 0.050847
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
2548200962f246468bb587c966213a357f63656e
| 2,277
|
py
|
Python
|
Service/migrations/0013_auto_20191229_1254.py
|
Bixbar/Bixbar-Backend
|
f69e0e96ea4bcc0c57000fdf1e24c66ead59df3f
|
[
"MIT"
] | 1
|
2021-04-17T16:19:19.000Z
|
2021-04-17T16:19:19.000Z
|
Service/migrations/0013_auto_20191229_1254.py
|
co3oing/Bixbar-Backend
|
f69e0e96ea4bcc0c57000fdf1e24c66ead59df3f
|
[
"MIT"
] | null | null | null |
Service/migrations/0013_auto_20191229_1254.py
|
co3oing/Bixbar-Backend
|
f69e0e96ea4bcc0c57000fdf1e24c66ead59df3f
|
[
"MIT"
] | 1
|
2021-04-15T14:56:49.000Z
|
2021-04-15T14:56:49.000Z
|
# Generated by Django 2.2.4 on 2019-12-29 03:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bixbar', '0012_auto_20191229_1250'),
]
operations = [
migrations.RenameField(
model_name='cocktail',
old_name='profile',
new_name='baseSpirit',
),
migrations.RenameField(
model_name='cocktail',
old_name='Garnish',
new_name='garnish',
),
migrations.RenameField(
model_name='cocktail',
old_name='Glass',
new_name='glass',
),
migrations.RenameField(
model_name='cocktail',
old_name='riquor',
new_name='liquor',
),
migrations.RenameField(
model_name='cocktail',
old_name='riquorml',
new_name='liquorml',
),
migrations.AddField(
model_name='cocktail',
name='brands',
field=models.CharField(max_length=200, null=True),
),
migrations.AddField(
model_name='cocktail',
name='cocktailType',
field=models.CharField(max_length=200, null=True),
),
migrations.AddField(
model_name='cocktail',
name='difficulty',
field=models.CharField(max_length=200, null=True),
),
migrations.AddField(
model_name='cocktail',
name='flavor',
field=models.CharField(max_length=200, null=True),
),
migrations.AddField(
model_name='cocktail',
name='hours',
field=models.CharField(max_length=200, null=True),
),
migrations.AddField(
model_name='cocktail',
name='preparation',
field=models.CharField(max_length=200, null=True),
),
migrations.AddField(
model_name='cocktail',
name='served',
field=models.CharField(max_length=200, null=True),
),
migrations.AddField(
model_name='cocktail',
name='strength',
field=models.CharField(max_length=200, null=True),
),
]
| 28.822785
| 62
| 0.530523
| 204
| 2,277
| 5.754902
| 0.269608
| 0.099659
| 0.188245
| 0.183986
| 0.729983
| 0.729983
| 0.696763
| 0.505111
| 0.471039
| 0.471039
| 0
| 0.037313
| 0.352657
| 2,277
| 78
| 63
| 29.192308
| 0.759159
| 0.019763
| 0
| 0.652778
| 1
| 0
| 0.119283
| 0.010314
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.013889
| 0
| 0.055556
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
255025f5a8dc42f20eed8dba2ef3c7c4e14a96f4
| 31
|
py
|
Python
|
esmvaltool/cmor/_fixes/obs4mips/__init__.py
|
yifatdzigan/ESMValTool
|
83320b0e0b24ddde965599961bb80428e180a731
|
[
"Apache-2.0"
] | 26
|
2019-06-07T07:50:07.000Z
|
2022-03-22T21:04:01.000Z
|
esmvaltool/cmor/_fixes/obs4mips/__init__.py
|
yifatdzigan/ESMValTool
|
83320b0e0b24ddde965599961bb80428e180a731
|
[
"Apache-2.0"
] | 1,370
|
2019-06-06T09:03:07.000Z
|
2022-03-31T04:37:20.000Z
|
esmvaltool/cmor/_fixes/obs4mips/__init__.py
|
yifatdzigan/ESMValTool
|
83320b0e0b24ddde965599961bb80428e180a731
|
[
"Apache-2.0"
] | 26
|
2019-07-03T13:08:48.000Z
|
2022-03-02T16:08:47.000Z
|
"""Fixes for obs4mips data."""
| 15.5
| 30
| 0.645161
| 4
| 31
| 5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.037037
| 0.129032
| 31
| 1
| 31
| 31
| 0.703704
| 0.774194
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
2553fa6a7db412f77adaac7c61b075ffc291008d
| 704
|
py
|
Python
|
setup/setup.py
|
Elijah-glitch/The-TikTok-Bot
|
48a3b1b3b9df9b4f6b4cb1fb1f692fd3f2029bc9
|
[
"MIT"
] | 56
|
2020-08-13T12:10:13.000Z
|
2022-03-25T23:42:22.000Z
|
setup/setup.py
|
Elijah-glitch/The-TikTok-Bot
|
48a3b1b3b9df9b4f6b4cb1fb1f692fd3f2029bc9
|
[
"MIT"
] | 13
|
2020-08-13T14:01:52.000Z
|
2021-07-19T19:11:35.000Z
|
setup/setup.py
|
Elijah-glitch/The-TikTok-Bot
|
48a3b1b3b9df9b4f6b4cb1fb1f692fd3f2029bc9
|
[
"MIT"
] | 15
|
2020-09-22T01:43:25.000Z
|
2022-03-08T19:05:17.000Z
|
import os
def installLibraries():
print(f'Installing Libraries....')
os.system('pip install requests')
os.system('pip install threading')
os.system('pip install bs4')
os.system('pip install time')
os.system('pip install math')
os.system('pip install selenium')
os.system('pip install Keys')
os.system('pip install ActionsChains')
os.system('pip install sys')
os.system('pip install multiprocessing')
os.system('pip install logging')
os.system('pip install glob')
if __name__ == "__main__":
installLibraries()
print(f'\n'+'All Required Libraries are now installed.')
| 30.608696
| 60
| 0.605114
| 81
| 704
| 5.160494
| 0.395062
| 0.229665
| 0.315789
| 0.516746
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.001949
| 0.271307
| 704
| 22
| 61
| 32
| 0.812866
| 0
| 0
| 0
| 0
| 0
| 0.427557
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.055556
| true
| 0
| 0.055556
| 0
| 0.111111
| 0.111111
| 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
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c2631ffe6eba42cb522892ab740ab3bf0334d921
| 201
|
py
|
Python
|
gpio_test.py
|
eldon/netSignalGauge
|
11f97d09f20decab41ffd7b2bbbc33fb14b7650e
|
[
"Apache-2.0"
] | null | null | null |
gpio_test.py
|
eldon/netSignalGauge
|
11f97d09f20decab41ffd7b2bbbc33fb14b7650e
|
[
"Apache-2.0"
] | null | null | null |
gpio_test.py
|
eldon/netSignalGauge
|
11f97d09f20decab41ffd7b2bbbc33fb14b7650e
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/python
import CHIP_IO.GPIO as GPIO
try:
GPIO.setup("CSID7", GPIO.OUT)
GPIO.output("CSID7", GPIO.HIGH)
raw_input()
GPIO.output("CSID7", GPIO.LOW)
finally:
GPIO.cleanup()
| 18.272727
| 35
| 0.651741
| 30
| 201
| 4.3
| 0.633333
| 0.209302
| 0.232558
| 0.294574
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.018182
| 0.179104
| 201
| 10
| 36
| 20.1
| 0.763636
| 0.079602
| 0
| 0
| 0
| 0
| 0.081522
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.125
| 0
| 0.125
| 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
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c27dcc848d8e5b695cb2bc21dcc0266d229f6924
| 587
|
py
|
Python
|
Models/import_batches.py
|
wboughattas/UCI-CIFAR-Various-Analyses
|
e9cd6454653718cd93992c2c3803f408918f8663
|
[
"MIT"
] | null | null | null |
Models/import_batches.py
|
wboughattas/UCI-CIFAR-Various-Analyses
|
e9cd6454653718cd93992c2c3803f408918f8663
|
[
"MIT"
] | null | null | null |
Models/import_batches.py
|
wboughattas/UCI-CIFAR-Various-Analyses
|
e9cd6454653718cd93992c2c3803f408918f8663
|
[
"MIT"
] | null | null | null |
import os
import pickle
def import_batches():
dataset = [unpickle_file('batches.meta'), unpickle_file('data_batch_1'), unpickle_file('data_batch_2'),
unpickle_file('data_batch_3'), unpickle_file('data_batch_4'), unpickle_file('data_batch_5'),
unpickle_file('test_batch')]
return dataset
def unpickle_file(filename):
data_path = os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(__file__))), 'Data', 'CIFAR-10', filename)
with open(data_path, 'rb') as file:
data = pickle.load(file, encoding='bytes')
return data
| 30.894737
| 119
| 0.688245
| 81
| 587
| 4.666667
| 0.395062
| 0.253968
| 0.21164
| 0.277778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014374
| 0.170358
| 587
| 18
| 120
| 32.611111
| 0.761807
| 0
| 0
| 0
| 0
| 0
| 0.172061
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.25
| 0
| 0.583333
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
c2a9efb832770fad79d2354dbe1b90c7b55b7a4e
| 17
|
py
|
Python
|
platzi/Prueba.py
|
diegosish/Introduction-Python
|
b40dde602c0b5ca4ec4f6b13303ad6d3831fab73
|
[
"MIT"
] | null | null | null |
platzi/Prueba.py
|
diegosish/Introduction-Python
|
b40dde602c0b5ca4ec4f6b13303ad6d3831fab73
|
[
"MIT"
] | null | null | null |
platzi/Prueba.py
|
diegosish/Introduction-Python
|
b40dde602c0b5ca4ec4f6b13303ad6d3831fab73
|
[
"MIT"
] | null | null | null |
print('Hola')
x=2
| 8.5
| 13
| 0.647059
| 4
| 17
| 2.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0625
| 0.058824
| 17
| 2
| 14
| 8.5
| 0.625
| 0
| 0
| 0
| 0
| 0
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
c2ac4ba54426e3d29a2311a80b8fcfdd32ddfed5
| 96
|
py
|
Python
|
media_tools/apps.py
|
zeyneloz/django-media-tools
|
b961739541e42581729f7f2cff4b538ecb73658e
|
[
"MIT"
] | 3
|
2018-03-12T12:46:42.000Z
|
2018-03-14T12:32:36.000Z
|
media_tools/apps.py
|
zeyneloz/django-media-tools
|
b961739541e42581729f7f2cff4b538ecb73658e
|
[
"MIT"
] | null | null | null |
media_tools/apps.py
|
zeyneloz/django-media-tools
|
b961739541e42581729f7f2cff4b538ecb73658e
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class MediaToolsConfig(AppConfig):
name = 'media_tools'
| 16
| 34
| 0.770833
| 11
| 96
| 6.636364
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15625
| 96
| 5
| 35
| 19.2
| 0.901235
| 0
| 0
| 0
| 0
| 0
| 0.114583
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
c2b9e776c0b89dc171cb23d05ab33656c42abb3d
| 169
|
py
|
Python
|
dp_tornado/engine/template/example/config/server/version.py
|
donghak-shin/dp-tornado
|
095bb293661af35cce5f917d8a2228d273489496
|
[
"MIT"
] | 18
|
2015-04-07T14:28:39.000Z
|
2020-02-08T14:03:38.000Z
|
dp_tornado/engine/template/example/config/server/version.py
|
donghak-shin/dp-tornado
|
095bb293661af35cce5f917d8a2228d273489496
|
[
"MIT"
] | 7
|
2016-10-05T05:14:06.000Z
|
2021-05-20T02:07:22.000Z
|
dp_tornado/engine/template/example/config/server/version.py
|
donghak-shin/dp-tornado
|
095bb293661af35cce5f917d8a2228d273489496
|
[
"MIT"
] | 11
|
2015-12-15T09:49:39.000Z
|
2021-09-06T18:38:21.000Z
|
# -*- coding: utf-8 -*-
from dp_tornado.engine.config import Config as dpConfig
class VersionConfig(dpConfig):
def index(self):
self.conf.master = '1.0'
| 16.9
| 55
| 0.662722
| 23
| 169
| 4.826087
| 0.869565
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.022222
| 0.201183
| 169
| 9
| 56
| 18.777778
| 0.8
| 0.12426
| 0
| 0
| 0
| 0
| 0.020548
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
c2c6a4c261a5c2707c287d61583322a995660fe6
| 203
|
py
|
Python
|
API PILOT 1/test.py
|
EricChiquitoG/NegotiationEngine
|
91075f9b085d54f008b84aaa6fcc2dd20eb88e71
|
[
"MIT"
] | null | null | null |
API PILOT 1/test.py
|
EricChiquitoG/NegotiationEngine
|
91075f9b085d54f008b84aaa6fcc2dd20eb88e71
|
[
"MIT"
] | null | null | null |
API PILOT 1/test.py
|
EricChiquitoG/NegotiationEngine
|
91075f9b085d54f008b84aaa6fcc2dd20eb88e71
|
[
"MIT"
] | 1
|
2022-01-17T15:08:42.000Z
|
2022-01-17T15:08:42.000Z
|
from bson import ObjectId
dicti= {'sellersign':{'val':['ok']}}
dicti['sellersign']['val'][0]='camaron'
dict2={'sellersign':22,'camaron':2345}
print(dict2)
dict2['eric']=223
print(dict2['eric'])
| 22.555556
| 40
| 0.650246
| 26
| 203
| 5.076923
| 0.615385
| 0.227273
| 0.272727
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.076503
| 0.098522
| 203
| 9
| 41
| 22.555556
| 0.644809
| 0
| 0
| 0
| 0
| 0
| 0.306122
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.142857
| 0
| 0.142857
| 0.285714
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c2c856caec2ab046cea6589e5b85e1b86d44f95c
| 192
|
py
|
Python
|
joplin/pages/news_page/factories.py
|
cityofaustin/joplin
|
01424e46993e9b1c8e57391d6b7d9448f31d596b
|
[
"MIT"
] | 15
|
2018-09-27T07:36:30.000Z
|
2021-08-03T16:01:21.000Z
|
joplin/pages/news_page/factories.py
|
cityofaustin/joplin
|
01424e46993e9b1c8e57391d6b7d9448f31d596b
|
[
"MIT"
] | 183
|
2017-11-16T23:30:47.000Z
|
2020-12-18T21:43:36.000Z
|
joplin/pages/news_page/factories.py
|
cityofaustin/joplin
|
01424e46993e9b1c8e57391d6b7d9448f31d596b
|
[
"MIT"
] | 12
|
2017-12-12T22:48:05.000Z
|
2021-03-01T18:01:24.000Z
|
from pages.news_page.models import NewsPage
from pages.topic_page.factories import JanisBasePageFactory
class NewsPageFactory(JanisBasePageFactory):
class Meta:
model = NewsPage
| 24
| 59
| 0.802083
| 21
| 192
| 7.238095
| 0.666667
| 0.118421
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.151042
| 192
| 7
| 60
| 27.428571
| 0.932515
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6c01d583414b8e4c2c7c2942ebeb7ef09622d490
| 503
|
py
|
Python
|
code/experience.py
|
rahul-dhavalikar/dqn-predator-prey-dynamics
|
58c26d71c87bcfaaf729d1f710b9c4458ca4f473
|
[
"MIT"
] | 1
|
2021-12-15T10:58:09.000Z
|
2021-12-15T10:58:09.000Z
|
code/experience.py
|
rahul-dhavalikar/dqn-predator-prey-dynamics
|
58c26d71c87bcfaaf729d1f710b9c4458ca4f473
|
[
"MIT"
] | null | null | null |
code/experience.py
|
rahul-dhavalikar/dqn-predator-prey-dynamics
|
58c26d71c87bcfaaf729d1f710b9c4458ca4f473
|
[
"MIT"
] | 2
|
2018-10-04T02:39:23.000Z
|
2021-12-15T10:59:16.000Z
|
import numpy as np
import random
class experience_buffer():
def __init__(self, buffer_size=50000):
self.buffer = []
self.buffer_size = buffer_size
def add(self, experience):
if len(self.buffer) + len(experience) >= self.buffer_size:
self.buffer[0:(len(experience) + len(self.buffer)) - self.buffer_size] = []
self.buffer.extend(experience)
def sample(self, size):
return np.reshape(np.array(random.sample(self.buffer, size)), [size, 5])
| 33.533333
| 87
| 0.650099
| 66
| 503
| 4.80303
| 0.348485
| 0.315457
| 0.22082
| 0.126183
| 0.258675
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017722
| 0.214712
| 503
| 15
| 88
| 33.533333
| 0.78481
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.166667
| 0.083333
| 0.583333
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
6c1308acaa19db2927830360c4a884dba13f7741
| 279
|
py
|
Python
|
welleng/__init__.py
|
kwinkunks/welleng
|
d0669b9b5164671ff4861a4efd33666c3fc9758f
|
[
"Apache-2.0"
] | 1
|
2020-12-26T14:42:51.000Z
|
2020-12-26T14:42:51.000Z
|
welleng/__init__.py
|
kwinkunks/welleng
|
d0669b9b5164671ff4861a4efd33666c3fc9758f
|
[
"Apache-2.0"
] | null | null | null |
welleng/__init__.py
|
kwinkunks/welleng
|
d0669b9b5164671ff4861a4efd33666c3fc9758f
|
[
"Apache-2.0"
] | null | null | null |
import welleng.clearance
import welleng.io
import welleng.error
import welleng.survey
import welleng.utils
import welleng.mesh
import welleng.visual
import welleng.version
import welleng.errors.iscwsa_mwd
import welleng.exchange.wbp
import welleng.target
import welleng.connector
| 23.25
| 32
| 0.867384
| 39
| 279
| 6.179487
| 0.435897
| 0.647303
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.082437
| 279
| 12
| 33
| 23.25
| 0.941406
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6c1a67a5a8f9f1a3b8679d80b3dd08492a05c7de
| 99
|
py
|
Python
|
app_reRepeat/apps.py
|
bbajcetic/reRepeat
|
c5f6e2534a7baf20f9fc0345f84598877c93b869
|
[
"BSD-3-Clause"
] | null | null | null |
app_reRepeat/apps.py
|
bbajcetic/reRepeat
|
c5f6e2534a7baf20f9fc0345f84598877c93b869
|
[
"BSD-3-Clause"
] | null | null | null |
app_reRepeat/apps.py
|
bbajcetic/reRepeat
|
c5f6e2534a7baf20f9fc0345f84598877c93b869
|
[
"BSD-3-Clause"
] | null | null | null |
from django.apps import AppConfig
class app_reRepeatConfig(AppConfig):
name = 'app_reRepeat'
| 16.5
| 36
| 0.777778
| 12
| 99
| 6.25
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.151515
| 99
| 5
| 37
| 19.8
| 0.892857
| 0
| 0
| 0
| 0
| 0
| 0.121212
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6c54b53ad527b7c644c39c4602a9fdcd45aab622
| 10,303
|
py
|
Python
|
archives/model_prep.py
|
d-v-dlee/super_liga_xg
|
e3054cadf00755a347d31ce335c567db91e433a7
|
[
"MIT"
] | 3
|
2019-01-24T07:30:45.000Z
|
2019-11-28T15:52:44.000Z
|
archives/model_prep.py
|
d-v-dlee/super_liga_xg
|
e3054cadf00755a347d31ce335c567db91e433a7
|
[
"MIT"
] | null | null | null |
archives/model_prep.py
|
d-v-dlee/super_liga_xg
|
e3054cadf00755a347d31ce335c567db91e433a7
|
[
"MIT"
] | null | null | null |
import numpy as np
import pandas as pd
from sklearn.metrics import log_loss
import matplotlib.pyplot as plt
# def manual_train_split(df, train_sample_size=80):
# """input dataframe of shots, return train_test_split by game_id
# input dataframe -> get unique game ids -> take sample of 80/159 (may be some repeasts from
# np.random.choice)
# first for loop: take those game ids and then add them to games_to_train_on
# second for loop: drop those games from the master 'possible_games' list
# return dataframe of shots (in specific games) to train model on
# --------------------------------------------------------------------
# holdout_test, train = manual_train_split(shots_df)
# returns: game_ids to hold out/predict on, list to train on
# """
# possible_games = list(df['game_id'].unique())
# game_numbers = len(possible_games)
# games_to_sample = np.random.choice(game_numbers, train_sample_size)
# games_to_train_on = []
# for i in games_to_sample:
# games_to_train_on.append(possible_games[i])
# for game in games_to_train_on:
# if game in possible_games:
# possible_games.remove(game)
# return possible_games, games_to_train_on
# def manual_test_split(possible_games, test_sample_size=50):
# """input: possible_games which is game_ids minus the game_ids used for training,
# test_sample_size is 50 games to predict on, usually less due to random sample
# output: list of games_ids to predict and remaining holdout set
# first for loop: takes random sample, then corresponding game_ids in list (by position)
# second for loop: removes those sample games from the possible_games list, leaving final holdout_list"""
# games_left = len(possible_games)
# games_to_sample = np.random.choice(games_left, test_sample_size)
# games_to_predict = []
# for i in games_to_sample:
# games_to_predict.append(possible_games[i])
# for game in games_to_predict:
# if game in possible_games:
# possible_games.remove(game)
# holdout_games = possible_games.copy()
# return holdout_games, games_to_predict
# def create_training_df(df, train_sample_size=90):
# """input total shot df and return training data split into train_data (x) and train_y (y)
# train_sample_size is the number of games (will sample 90 with some possible repeats)
# ex: train_data, train_y, indices, hold_test = training_df(shots_df)
# """
# rf_columns = ['player_id', 'shot_distance', 'shot_angle', 'assisted_shot', 'is_penalty_attempt']
# hold_test, train = manual_train_split(df)
# shots_to_train_on = df[df['game_id'].isin(np.array(train))].copy()
# train_data = shots_to_train_on[rf_columns].astype(float)
# train_y = shots_to_train_on['is_goal'].astype(float)
# indices = shots_to_train_on.index.values
# return train_data, train_y, indices, hold_test
# def create_test_df(df, hold_test):
# """input df, and previous hold_test from training_df to return
# test_data and test_y to be run through rf"""
# rf_columns = ['player_id', 'shot_distance', 'shot_angle', 'assisted_shot', 'is_penalty_attempt']
# holdout, test = manual_test_split(hold_test)
# shots_to_predict = df[df['game_id'].isin(np.array(test))].copy()
# test_data = shots_to_predict[rf_columns].astype(float)
# test_y = shots_to_predict['is_goal'].astype(float)
# indices1 = shots_to_predict.index.values
# return test_data, test_y, indices1, holdout, test
# def use_holdout_df(df, holdout):
# """insert df and holdout (game_ids not yet predicted) and return df to predict on"""
# rf_columns = ['player_id', 'shot_distance', 'shot_angle', 'assisted_shot', 'is_penalty_attempt']
# shots_to_predict = df[df['game_id'].isin(np.array(holdout))].copy()
# test_data = shots_to_predict[rf_columns].astype(float)
# test_y = shots_to_predict['is_goal'].astype(float)
# indices1 = shots_to_predict.index.values
# return test_data, test_y, indices1
# def create_xG_df(test_data, test_y, model_predictions):
# """create new dataframe with predicted probas and actual goals for predicted shots"""
# df = pd.DataFrame(test_data)
# df['is_goal'] = test_y
# df['xG'] = model_predictions[:, 1]
# df['xA'] = df['assisted_shot'] * df['xG']
# return df
# def create_hypothetical_df(test_data, model_predictions):
# """create new dataframe with predicted probas and actual goals for predicted shots"""
# df = pd.DataFrame(test_data)
# df['xG'] = model_predictions[:, 1]
# return df
# def create_summed_xG_df(df):
# """input xg_df and return dataframe of summed xg and xa for each player"""
# unique_players = df['player_id'].unique()
# contributions = []
# for player in unique_players:
# xgsum = round(df[df['player_id'] == player]['xG'].sum(), 2)
# xasum = round(df[df['player_id'] == player]['xA'].sum(), 2)
# xgxasum = round(xgsum + xasum, 2)
# goals = df[df['player_id'] == player]['is_goal'].sum()
# pen_attempts = df[df['player_id'] == player]['is_penalty_attempt'].sum()
# contributions.append([player, xgsum, xasum, xgxasum, pen_attempts, goals])
# by_xG = sorted(contributions, key=lambda x: x[1], reverse=True)
# contribution_df = pd.DataFrame(by_xG, columns=['player_id', 'total_xG', 'total_xA', 'total_xG+xA', 'pen_attempts', 'goals'])
# return contribution_df
# ### moving from shots to players and minutes
# def create_test_min_df(player_df, test):
# """input player_df and the list of games that were predited on to return
# the players and minuts played in the predicted games"""
# min_df = player_df[player_df['game_id'].isin(np.array(test))].copy()
# players = min_df['player_id'].unique()
# player_minutes = []
# for player in players:
# total_minutes = min_df[min_df['player_id'] == player]['minutes_played'].sum()
# name = min_df[min_df['player_id'] == player]['name'].iloc[0]
# player_minutes.append([player, total_minutes, name])
# player_minutes_df = pd.DataFrame(player_minutes, columns=['player_id', 'total_minutes_played', 'player_name'])
# return player_minutes_df
# def merged_dataframes(player_df, contribution_df):
# columns = ['player_name', 'player_id', 'total_xG', 'total_xA', 'total_xG+xA', 'goals', 'xG+xA/90', 'total_minutes_played']
# xg_min = pd.merge(contribution_df, player_df, on='player_id', how='outer')
# xg_min['xG+xA/90'] = xg_min['total_xG+xA'].copy() / (xg_min['total_minutes_played'] / 90)
# xg_final = xg_min[columns]
# return xg_final
# def player_minutes_total(players_minutes_df):
# """input player_minutes_df from create_test_min_df so that each row is a unique player"""
# players = players_minutes_df['player_id'].unique()
# player_minutes = []
# for player in players:
# total_minutes = players_minutes_df[players_minutes_df['player_id'] == player]['minutes_played'].sum()
# name = players_minutes_df[players_minutes_df['player_id'] == player]['name'].iloc[0]
# squad_num = players_minutes_df[players_minutes_df['player_id'] == player]['squad_number'].iloc[0]
# club_brev = players_minutes_df[players_minutes_df['player_id'] == player]['club_brev'].iloc[0]
# position_id = players_minutes_df[players_minutes_df['player_id'] == player]['position_id'].iloc[0]
# player_minutes.append([player, total_minutes, name, squad_num, club_brev, position_id])
# summed_player_min = pd.DataFrame(player_minutes, columns=['player_id', 'total_minutes_played', 'player_name', 'squad_num', 'club_brev', 'position_id'])
# return summed_player_min
# def create_rf_prep(df):
# """input df, return the appropriate columns to be run through rf"""
# rf_columns = ['shot_distance', 'shot_angle', 'assisted_shot']
# return df[rf_columns].astype(float)
# #use to tune classifiers
# def stage_score_plot(estimator, X_train, y_train, X_test, y_test):
# '''
# Parameters: estimator: GradientBoostingClassifier or xgBoostClassifier
# X_train: pandas dataframe
# y_train: 1d panda dataframe
# X_test: pandas dataframe
# y_test: 1d panda dataframe
# Returns: A plot of the number of iterations vs the log loss for the model for
# both the training set and test set.
# '''
# # fit estimator
# estimator.fit(X_train, y_train)
# train_logloss_at_stages = []
# test_logloss_at_stages = []
# # iterate through all stages for test and train and record log loss lists
# for y1, y2 in zip(estimator.staged_predict_proba(X_train), estimator.staged_predict_proba(X_test)):
# train_logloss = log_loss(y_train, y1)
# train_logloss_at_stages.append(train_logloss)
# test_logloss = log_loss(y_test, y2)
# test_logloss_at_stages.append(test_logloss)
# # find the # of trees at which test error is the lowest
# lowest_test_error = np.min(test_logloss_at_stages)
# num_trees_lowest_test_error = np.argmin(test_logloss_at_stages)
# # create xs in order to plot. each x represents n_estimators.
# xs = range(0, len(test_logloss_at_stages))
# fig, ax = plt.subplots(figsize=(8, 6))
# ax.plot(xs, train_logloss_at_stages,
# label="{} Train".format(estimator.__class__.__name__))
# ax.plot(xs, test_logloss_at_stages,
# label="{} Test".format(estimator.__class__.__name__))
# ax.axvline(num_trees_lowest_test_error)
# ax.legend()
# return lowest_test_error, num_trees_lowest_test_error
# # print(f'lowest test error(log loss): {lowest_test_error}')
# # print(f'num_trees at lowest test error: {num_trees_lowest_test_error}')
# # example of how to use:
# # fig, ax = plt.subplots(figsize=(12, 8))
# # stage_score_plot(gdbr_model, X_train, y_train, X_test, y_test)
# # stage_score_plot(gdbr_model_2, X_train, y_train, X_test, y_test)
# # ax.legend()
# # plt.show()
# def add_xg_shotdf(shot_df, model_pred):
# """add predicted xG to shot_df"""
# shot_df['xG'] = model_pred[:, 1]
| 45.588496
| 157
| 0.680481
| 1,482
| 10,303
| 4.419703
| 0.162618
| 0.02687
| 0.021374
| 0.02687
| 0.403664
| 0.346107
| 0.327939
| 0.294504
| 0.251603
| 0.15542
| 0
| 0.00601
| 0.192565
| 10,303
| 226
| 158
| 45.588496
| 0.781344
| 0.943997
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6c625f538953f61bc13a2781a6d48b73d2b046ed
| 218
|
py
|
Python
|
terrascript/resource/rancher/rke.py
|
mjuenema/python-terrascript
|
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
|
[
"BSD-2-Clause"
] | 507
|
2017-07-26T02:58:38.000Z
|
2022-01-21T12:35:13.000Z
|
terrascript/resource/rancher/rke.py
|
mjuenema/python-terrascript
|
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
|
[
"BSD-2-Clause"
] | 135
|
2017-07-20T12:01:59.000Z
|
2021-10-04T22:25:40.000Z
|
terrascript/resource/rancher/rke.py
|
mjuenema/python-terrascript
|
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
|
[
"BSD-2-Clause"
] | 81
|
2018-02-20T17:55:28.000Z
|
2022-01-31T07:08:40.000Z
|
# terrascript/resource/rancher/rke.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:25:51 UTC)
import terrascript
class rke_cluster(terrascript.Resource):
pass
__all__ = [
"rke_cluster",
]
| 16.769231
| 73
| 0.743119
| 29
| 218
| 5.37931
| 0.758621
| 0.24359
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.064516
| 0.146789
| 218
| 12
| 74
| 18.166667
| 0.774194
| 0.490826
| 0
| 0
| 1
| 0
| 0.101852
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.166667
| 0.166667
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
6663d3d9b9f03b3bf53d7aa80800270386bed1a9
| 11,855
|
py
|
Python
|
tongyou/tongyou/apps/carts/views.py
|
hellowangziyi/TongYou-Web
|
82e9e89e0dcced08e921aeb15d55e7c449af30d1
|
[
"MIT"
] | null | null | null |
tongyou/tongyou/apps/carts/views.py
|
hellowangziyi/TongYou-Web
|
82e9e89e0dcced08e921aeb15d55e7c449af30d1
|
[
"MIT"
] | null | null | null |
tongyou/tongyou/apps/carts/views.py
|
hellowangziyi/TongYou-Web
|
82e9e89e0dcced08e921aeb15d55e7c449af30d1
|
[
"MIT"
] | null | null | null |
from django.shortcuts import render
from django.views import View
import json, base64, pickle
from django import http
from django_redis import get_redis_connection
from django.shortcuts import render
from goods.models import SKU
from tongyou.utils.response_code import RETCODE
# Create your views here.
class CartsView(View):
"""购物车"""
def post(self, request):
"""添加购物车"""
# 接收参数
json_dict = json.loads(request.body)
sku_id = json_dict.get('sku_id')
count = json_dict.get('count')
selected = json_dict.get('selected', True)
# 校验参数
if all([sku_id, count]) is False:
return http.HttpResponseForbidden('缺少必传参数')
try:
sku = SKU.objects.get(id=sku_id, is_launched=True)
except Exception as e:
return http.HttpResponseForbidden('sku_id不存在')
try:
count = int(count)
except Exception as e:
return http.HttpResponseForbidden('参数count有误')
if isinstance(selected, bool) is False:
return http.HttpResponseForbidden('参数selected有误')
user = request.user
# 判断用户是否登录
if user.is_authenticated:
# 登录用户,操作redis购物车
"""
hash:{sku_id:count}
map:{sku_id}
"""
redis_conn = get_redis_connection('carts')
pl = redis_conn.pipeline()
# 新增购物车数据
pl.hincrby('carts_%s' % user.id, sku_id, count)
# 新增选中的状态
if selected:
pl.sadd('selected_%s' % user.id, sku_id)
# 执行管道
pl.execute()
# 响应结果
return http.JsonResponse({'code': RETCODE.OK, 'errmsg': '添加购物车成功'})
else:
# 未登录用户,操作cookie购物车
cart_str = request.COOKIES.get('carts')
if cart_str:
# 将cart_str转成bytes,再将bytes转成base64的bytes,最后将bytes转字典
bytes_str = cart_str.encode()
bytes_un = base64.b64decode(bytes_str)
cart_dict = pickle.loads(bytes_un)
if sku_id in cart_dict:
origin_count = cart_dict[sku_id]['count']
count += origin_count
else: # 用户从没有操作过cookie购物车
cart_dict = {}
# 更新购物车
cart_dict[sku_id] = {'count': count, 'selected': selected}
# 将字典重新转字符串
bytes_un = pickle.dumps(cart_dict)
bytes_str = base64.b64encode(bytes_un)
cart_str = bytes_str.decode()
# 创建响应对象
response = http.JsonResponse({'code': RETCODE.OK, 'errmsg': '添加购物车成功'})
# 响应结果并将购物车数据写入到cookie
response.set_cookie('carts', cart_str)
return response
def get(self, request):
"""展示购物车"""
user = request.user
# 判断用户是否登录
if user.is_authenticated:
# 登录用户,操作redis购物车
redis_conn = get_redis_connection('carts')
# 获取redis.hash中的购物车数据
redis_cart = redis_conn.hgetall('carts_%s' % user.id)
# 获取redis.map中的选中状态
cart_selected = redis_conn.smembers('selected_%s' % user.id)
# 将redis中的数据包装成大字典
cart_dict = {}
for sku_id in redis_cart:
cart_dict[int(sku_id)] = {
'count': int(redis_cart[sku_id]),
'selected': sku_id in cart_selected
}
else: # 未登录用户,查询cookie购物车
cart_str = request.COOKIES.get('carts')
if cart_str:
bytes_str = cart_str.encode()
bytes_un = base64.b64decode(bytes_str)
cart_dict = pickle.loads(bytes_un)
else:
return render(request, 'cart.html')
# 查询sku模型
sku_qs = SKU.objects.filter(id__in=cart_dict.keys())
sku_list = []
for sku_model in sku_qs:
count = cart_dict[sku_model.id]['count']
sku_list.append({
'id': sku_model.id,
'name': sku_model.name,
'default_image_url': sku_model.default_image.url,
'price': str(sku_model.price),
'count': count,
'amount': str(sku_model.price * count),
'selected': str(cart_dict[sku_model.id]['selected'])
})
return render(request, 'cart.html', {'cart_skus': sku_list})
def put(self, request):
"""修改购物车"""
# 接收参数
json_dict = json.loads(request.body)
sku_id = json_dict.get('sku_id')
count = json_dict.get('count')
selected = json_dict.get('selected')
# 校验参数
if not all([sku_id, count]):
return http.HttpResponseForbidden('缺少必传参数')
try:
sku = SKU.objects.get(id=sku_id)
except Exception as e:
return http.HttpResponseForbidden('商品sku_id不存在')
try:
count = int(count)
except Exception as e:
return http.HttpResponseForbidden('参数count有误')
if isinstance(selected, bool) is False:
return http.HttpResponseForbidden('参数selected有误')
cart_sku = {
'id': sku_id,
'name': sku.name,
'count': count,
'selected': selected,
'price': sku.price,
'amount': sku.price * count,
'default_image_url': sku.default_image.url
}
# 创建响应对象
response = http.JsonResponse({'code': RETCODE.OK, 'errmsg': 'OK', 'cart_sku': cart_sku})
user = request.user
# 判断用户是否登录
if user.is_authenticated:
# 登录用户,操作redis购物车
redis_conn = get_redis_connection('carts')
pl = redis_conn.pipeline()
pl.hset('carts_%s' % user.id, sku_id, count)
if selected:
pl.sadd('selected_%s' % user.id, sku_id)
else:
pl.srem('selected_%s' % user.id, sku_id)
pl.execute()
else: # 未登录用户,修改cookie购物车
cart_str = request.COOKIES.get('carts')
if cart_str:
# 将cart_str转成bytes,再将bytes转成base64的bytes,最后将bytes转字典
bytes_str = cart_str.encode()
bytes_un = base64.b64decode(bytes_str)
cart_dict = pickle.loads(bytes_un)
if sku_id in cart_dict:
origin_count = cart_dict[sku_id]['count']
count += origin_count
else:
return http.JsonResponse({'code': RETCODE.DBERR, 'errmsg': 'cookie数据没有获取到'})
cart_dict[sku_id] = {'count': count, 'selected': selected}
# 将字典重新转字符串
bytes_un = pickle.dumps(cart_dict)
bytes_str = base64.b64encode(bytes_un)
cart_str = bytes_str.decode()
# 响应结果并将购物车数据写入到cookie
response.set_cookie('carts', cart_str)
return response
def delete(self, request):
"""删除购物车"""
# 接收和校验参数
json_dict = json.loads(request.body)
sku_id = json_dict.get('sku_id')
try:
sku = SKU.objects.get(id=sku_id)
except Exception as e:
return http.HttpResponseForbidden('sku_id不存在')
user = request.user
# 判断用户是否登录
if user.is_authenticated:
# 登录用户,删除redis购物车
redis_conn = get_redis_connection('carts')
pl = redis_conn.pipeline()
pl.hdel('carts_%s' % user.id, sku_id)
pl.srem('selected_%s' % user.id, sku_id)
pl.execute()
return http.JsonResponse({'code': RETCODE.OK, 'errmsg': "删除购物车成功"})
else:
# 未登录用户,删除cookie购物车
cart_str = request.COOKIES.get('carts')
if cart_str:
bytes_str = cart_str.encode()
bytes_un = base64.b64decode(bytes_str)
cart_dict = pickle.loads(bytes_un)
else:
return http.JsonResponse({'code': RETCODE.DBERR, 'errmsg': 'cookie数据没获取到'})
if sku_id in cart_dict:
del cart_dict[sku_id]
# 判断当前字典是为空,如果为空 将cookie删除
response = http.JsonResponse({'code': RETCODE.OK, 'errmsg': "删除购物车成功"})
if not cart_dict:
response.delete_cookie('carts')
else:
# 将字典重新转字符串
bytes_un = pickle.dumps(cart_dict)
bytes_str = base64.b64encode(bytes_un)
cart_str = bytes_str.decode()
response.set_cookie('carts', cart_str)
return response
class CartsSelectAllView(View):
"""全选购物车"""
def put(self, request):
# 接收参数
json_dict = json.loads(request.body.decode())
selected = json_dict.get('selected', True)
# 校验参数
if selected:
if not isinstance(selected, bool):
return http.HttpResponseForbidden('参数selected有误')
# 判断用户是否登录
user = request.user
if user.is_authenticated:
# 登录用户,操作redis购物车
redis_conn = get_redis_connection('carts')
sku_ids = redis_conn.hgetall('carts_%s' % user.id)
sku_id_list = sku_ids.keys()
if selected:
# 全选
for sku_id in sku_id_list:
redis_conn.sadd('selected_%s' % user.id, sku_id)
else:
# 取消全选
redis_conn.delete('selected_%s' % user.id)
return http.JsonResponse({'code': RETCODE.OK, 'errmsg': 'OK'})
else:
# 未登录用户,操作cookie购物车
cart_str = request.COOKIES.get('carts')
if not cart_str:
return http.JsonResponse({'code': RETCODE.DBERR, 'errmsg': 'cookie没有获取到'})
# 将cart_str转成bytes,再将bytes转成base64的bytes,最后将bytes转字典
bytes_str = cart_str.encode()
bytes_un = base64.b64decode(bytes_str)
cart_dict = pickle.loads(bytes_un)
# 遍历cookie购物车大字典,将内部的每一个selected修改为True 或 False
for sku_id in cart_dict:
cart_dict[sku_id]['selected'] = selected
# 将字典重新转字符串
bytes_un = pickle.dumps(cart_dict)
bytes_str = base64.b64encode(bytes_un)
cart_str = bytes_str.decode()
response = http.JsonResponse({'code': RETCODE.OK, 'errmsg': 'OK'})
response.set_cookie('carts', cart_str)
return response
class CartsSimpleView(View):
"""商品页面右上角购物车"""
def get(self, request):
"""展示商品页面简单购物车"""
user = request.user
# 判断用户是否登录
if user.is_authenticated:
# 登录用户,操作redis购物车
redis_conn = get_redis_connection('carts')
# 获取redis.hash中的购物车数据
redis_cart = redis_conn.hgetall('carts_%s' % user.id)
# 将redis中的数据包装成大字典
cart_dict = {}
for sku_id in redis_cart:
cart_dict[int(sku_id)] = {
'count': int(redis_cart[sku_id]),
}
else: # 未登录用户,查询cookie购物车
cart_str = request.COOKIES.get('carts')
if cart_str:
bytes_str = cart_str.encode()
bytes_un = base64.b64decode(bytes_str)
cart_dict = pickle.loads(bytes_un)
else:
cart_dict = {}
# 查询sku模型
sku_qs = SKU.objects.filter(id__in=cart_dict.keys())
sku_list = []
for sku_model in sku_qs:
sku_list.append({
'id': sku_model.id,
'name': sku_model.name,
'default_image_url': sku_model.default_image.url,
'count': cart_dict[sku_model.id]['count']
})
return http.JsonResponse({'code': RETCODE.OK, 'errmsg': 'OK', 'cart_skus': sku_list})
| 33.300562
| 96
| 0.540363
| 1,247
| 11,855
| 4.919808
| 0.134723
| 0.035045
| 0.02119
| 0.048411
| 0.794458
| 0.773268
| 0.755501
| 0.697311
| 0.633415
| 0.601467
| 0
| 0.006288
| 0.356137
| 11,855
| 356
| 97
| 33.300562
| 0.797458
| 0.072796
| 0
| 0.738397
| 0
| 0
| 0.072531
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.025316
| false
| 0
| 0.033755
| 0
| 0.168776
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
668289b485829df79ee76495e17996966433525e
| 102
|
py
|
Python
|
animal/admin.py
|
rankrh/soli
|
8f19945a175106064591d09a53d07fcbfa26b7da
|
[
"MIT"
] | null | null | null |
animal/admin.py
|
rankrh/soli
|
8f19945a175106064591d09a53d07fcbfa26b7da
|
[
"MIT"
] | null | null | null |
animal/admin.py
|
rankrh/soli
|
8f19945a175106064591d09a53d07fcbfa26b7da
|
[
"MIT"
] | 2
|
2019-09-07T15:10:14.000Z
|
2020-09-04T01:51:19.000Z
|
from django.contrib import admin
from animal.models.animal import Animal
admin.site.register(Animal)
| 20.4
| 39
| 0.833333
| 15
| 102
| 5.666667
| 0.6
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098039
| 102
| 4
| 40
| 25.5
| 0.923913
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
66e1ff079b6e42165164db21eb7de184b3d79c61
| 348
|
py
|
Python
|
src/IsingRegisterAllocator/get_solution_limited_unit.py
|
kumagaimasahito/IsingRegisterAllocator
|
7d20f56ee035fcaff456ab7641e51bad4b68144f
|
[
"MIT"
] | 1
|
2021-05-04T06:56:42.000Z
|
2021-05-04T06:56:42.000Z
|
src/IsingRegisterAllocator/get_solution_limited_unit.py
|
kumagaimasahito/IsingRegisterAllocator
|
7d20f56ee035fcaff456ab7641e51bad4b68144f
|
[
"MIT"
] | 1
|
2021-03-31T14:56:27.000Z
|
2021-03-31T14:56:27.000Z
|
src/IsingRegisterAllocator/get_solution_limited_unit.py
|
kumagaimasahito/IsingRegisterAllocator
|
7d20f56ee035fcaff456ab7641e51bad4b68144f
|
[
"MIT"
] | null | null | null |
from .util import split_unit, get_qubo
from .util.solve_qubo import by_amplify as solve_qubo
def get_solution_limited_unit(interference, num_registers, limitation, token):
response = get_qubo.by_amplify_limited(interference, num_registers, limitation)
solution = solve_qubo(response["qubits"], response["model"], token)
return solution
| 49.714286
| 83
| 0.801724
| 47
| 348
| 5.638298
| 0.489362
| 0.101887
| 0.181132
| 0.256604
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.114943
| 348
| 7
| 84
| 49.714286
| 0.86039
| 0
| 0
| 0
| 0
| 0
| 0.031519
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
dd00ffffca73cd739e6b37faee8d363216c81ef9
| 167
|
py
|
Python
|
main.py
|
szoz/fast-boardgames
|
76d6f6135a4d872c03535f13e547ea2deb4f338a
|
[
"MIT"
] | null | null | null |
main.py
|
szoz/fast-boardgames
|
76d6f6135a4d872c03535f13e547ea2deb4f338a
|
[
"MIT"
] | null | null | null |
main.py
|
szoz/fast-boardgames
|
76d6f6135a4d872c03535f13e547ea2deb4f338a
|
[
"MIT"
] | null | null | null |
from fastapi import FastAPI
from routers import misc, items
app = FastAPI()
app.include_router(misc.router, tags=['miscellaneous'])
app.include_router(items.router)
| 20.875
| 55
| 0.790419
| 23
| 167
| 5.652174
| 0.478261
| 0.153846
| 0.246154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.101796
| 167
| 7
| 56
| 23.857143
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0.077844
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
dd5399c33dbbbc3463d61ee55b0c03c39b727c67
| 154
|
py
|
Python
|
django_google_optimize/apps.py
|
adinhodovic/django-google-optimize
|
d6849b1563a9ba98bca40213f84b911a828df4fd
|
[
"MIT"
] | 37
|
2019-12-06T11:36:21.000Z
|
2022-03-16T14:10:17.000Z
|
django_google_optimize/apps.py
|
adinhodovic/django-google-optimize
|
d6849b1563a9ba98bca40213f84b911a828df4fd
|
[
"MIT"
] | 25
|
2020-01-08T19:58:42.000Z
|
2021-08-25T16:20:22.000Z
|
django_google_optimize/apps.py
|
adinhodovic/django-google-optimize
|
d6849b1563a9ba98bca40213f84b911a828df4fd
|
[
"MIT"
] | 5
|
2020-01-07T12:41:38.000Z
|
2021-12-23T08:05:27.000Z
|
from django.apps import AppConfig
class DjangoGoogleOptimizeConfig(AppConfig):
name = "django_google_optimize"
verbose_name = "Google Optimize"
| 22
| 44
| 0.785714
| 16
| 154
| 7.375
| 0.6875
| 0.237288
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.149351
| 154
| 6
| 45
| 25.666667
| 0.900763
| 0
| 0
| 0
| 0
| 0
| 0.24026
| 0.142857
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
dd5e56e7b972076a34512e42444079b3b32bcb0e
| 253
|
py
|
Python
|
unplugged/signals.py
|
fakegit/unplugged
|
755227a5319ea443c3d8f1356380981430c80419
|
[
"MIT"
] | 2
|
2019-07-17T15:45:25.000Z
|
2021-08-10T18:27:43.000Z
|
unplugged/signals.py
|
fakegit/unplugged
|
755227a5319ea443c3d8f1356380981430c80419
|
[
"MIT"
] | null | null | null |
unplugged/signals.py
|
fakegit/unplugged
|
755227a5319ea443c3d8f1356380981430c80419
|
[
"MIT"
] | 1
|
2019-11-23T08:30:40.000Z
|
2019-11-23T08:30:40.000Z
|
import django.dispatch
plugin_loaded = django.dispatch.Signal(providing_args=["plugin"])
plugin_unloaded = django.dispatch.Signal(providing_args=["plugin"])
wamp_realm_created = django.dispatch.Signal()
wamp_realm_discarded = django.dispatch.Signal()
| 31.625
| 67
| 0.814229
| 31
| 253
| 6.387097
| 0.419355
| 0.353535
| 0.40404
| 0.292929
| 0.393939
| 0.393939
| 0
| 0
| 0
| 0
| 0
| 0
| 0.063241
| 253
| 7
| 68
| 36.142857
| 0.835443
| 0
| 0
| 0
| 0
| 0
| 0.047431
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 0
| 0.2
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
dd9a5dd9f345c9c05b5fe74daf8a589e53e527dd
| 239
|
py
|
Python
|
icecream/serializers.py
|
sreeo/ice_cream_api
|
c9dbccb3360855145b1d48881756e786092f9a62
|
[
"MIT"
] | null | null | null |
icecream/serializers.py
|
sreeo/ice_cream_api
|
c9dbccb3360855145b1d48881756e786092f9a62
|
[
"MIT"
] | null | null | null |
icecream/serializers.py
|
sreeo/ice_cream_api
|
c9dbccb3360855145b1d48881756e786092f9a62
|
[
"MIT"
] | null | null | null |
from rest_framework import serializers
from icecream.models import IceCream
class IceCreamModelSerializer(serializers.ModelSerializer):
class Meta:
model = IceCream
fields = ("cone_wafer", "base_flavour", "toppings")
| 26.555556
| 59
| 0.748954
| 24
| 239
| 7.333333
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.175732
| 239
| 8
| 60
| 29.875
| 0.893401
| 0
| 0
| 0
| 0
| 0
| 0.125523
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
dd9f45232a8f2dc7252ed17288d7bb0159d1e148
| 575
|
py
|
Python
|
python-variables/08-type-conversion.py
|
oviniciusoliveira/python-bootcamp
|
cd08ec4ec30049822c283a656307a5dcb25b5d99
|
[
"MIT"
] | null | null | null |
python-variables/08-type-conversion.py
|
oviniciusoliveira/python-bootcamp
|
cd08ec4ec30049822c283a656307a5dcb25b5d99
|
[
"MIT"
] | null | null | null |
python-variables/08-type-conversion.py
|
oviniciusoliveira/python-bootcamp
|
cd08ec4ec30049822c283a656307a5dcb25b5d99
|
[
"MIT"
] | null | null | null |
# int()
# float()
# str()
# bool()
number_input = input("number: ")
print(type(number_input))
number_input = int(number_input)
print(type(number_input))
# Falsy Values
print(bool(0))
print(bool(0.0))
print(bool(''))
print(bool(()))
print(bool([]))
print(bool({}))
print(bool(set()))
print(bool(complex()))
print(bool(range()))
print(bool(False))
print(bool(None))
# Truthy Values
print(bool(1))
print(bool(1.0))
print(bool('a'))
print(bool((1,)))
print(bool([1]))
print(bool({1}))
print(bool(set([1])))
print(bool(complex(1)))
print(bool(range(1)))
print(bool(True))
| 15.972222
| 32
| 0.652174
| 89
| 575
| 4.157303
| 0.224719
| 0.510811
| 0.189189
| 0.194595
| 0.281081
| 0.281081
| 0.227027
| 0.227027
| 0
| 0
| 0
| 0.022945
| 0.090435
| 575
| 35
| 33
| 16.428571
| 0.684512
| 0.092174
| 0
| 0.08
| 0
| 0
| 0.017476
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.92
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
06d4360390b0a5a17a300cc5b1414dedc3667eb8
| 70
|
py
|
Python
|
enthought/pyface/workbench/workbench_window_layout.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 3
|
2016-12-09T06:05:18.000Z
|
2018-03-01T13:00:29.000Z
|
enthought/pyface/workbench/workbench_window_layout.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 1
|
2020-12-02T00:51:32.000Z
|
2020-12-02T08:48:55.000Z
|
enthought/pyface/workbench/workbench_window_layout.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | null | null | null |
# proxy module
from pyface.workbench.workbench_window_layout import *
| 23.333333
| 54
| 0.842857
| 9
| 70
| 6.333333
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 70
| 2
| 55
| 35
| 0.904762
| 0.171429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
06dd830f40ff6ffab0c6c0bc544dcf36f91bfa18
| 106
|
py
|
Python
|
icrawler/storage/__init__.py
|
DevinWangGZ/picture_crawler
|
00b49e4c7d16adb0bc520c3ce78ec016cdd778d9
|
[
"MIT"
] | 1
|
2017-08-10T12:47:25.000Z
|
2017-08-10T12:47:25.000Z
|
icrawler/storage/__init__.py
|
DevinWangGZ/picture_crawler
|
00b49e4c7d16adb0bc520c3ce78ec016cdd778d9
|
[
"MIT"
] | null | null | null |
icrawler/storage/__init__.py
|
DevinWangGZ/picture_crawler
|
00b49e4c7d16adb0bc520c3ce78ec016cdd778d9
|
[
"MIT"
] | null | null | null |
from .base import BaseStorage
from .filesystem import FileSystem
__all__ = ['BaseStorage', 'FileSystem']
| 21.2
| 39
| 0.783019
| 11
| 106
| 7.181818
| 0.545455
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.122642
| 106
| 4
| 40
| 26.5
| 0.849462
| 0
| 0
| 0
| 0
| 0
| 0.198113
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
66124d75b356ed334d18dbde44dcbad412737ff2
| 59
|
py
|
Python
|
strutil.py
|
jgurtowski/ectools
|
031eb0300c82392915d8393a5fedb4d3452b15bf
|
[
"BSD-3-Clause"
] | 33
|
2015-01-21T18:34:49.000Z
|
2020-05-21T13:06:39.000Z
|
strutil.py
|
jgurtowski/ectools
|
031eb0300c82392915d8393a5fedb4d3452b15bf
|
[
"BSD-3-Clause"
] | 7
|
2015-05-08T09:35:26.000Z
|
2019-09-27T05:35:58.000Z
|
strutil.py
|
jgurtowski/ectools
|
031eb0300c82392915d8393a5fedb4d3452b15bf
|
[
"BSD-3-Clause"
] | 11
|
2015-09-08T09:40:02.000Z
|
2021-08-17T08:02:57.000Z
|
def strAppend(suffix):
return lambda x : x + suffix
| 9.833333
| 32
| 0.644068
| 8
| 59
| 4.75
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.271186
| 59
| 5
| 33
| 11.8
| 0.883721
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
663e52160e6e09606bed54578b2e948faa7af714
| 704
|
py
|
Python
|
msghandle/spec/no_utoken.py
|
RaenonX/Jelly-Bot-API
|
c7da1e91783dce3a2b71b955b3a22b68db9056cf
|
[
"MIT"
] | 5
|
2020-08-26T20:12:00.000Z
|
2020-12-11T16:39:22.000Z
|
msghandle/spec/no_utoken.py
|
RaenonX/Jelly-Bot
|
c7da1e91783dce3a2b71b955b3a22b68db9056cf
|
[
"MIT"
] | 234
|
2019-12-14T03:45:19.000Z
|
2020-08-26T18:55:19.000Z
|
msghandle/spec/no_utoken.py
|
RaenonX/Jelly-Bot-API
|
c7da1e91783dce3a2b71b955b3a22b68db9056cf
|
[
"MIT"
] | 2
|
2019-10-23T15:21:15.000Z
|
2020-05-22T09:35:55.000Z
|
from typing import List
from ttldict import TTLOrderedDict
from JellyBot.systemconfig import System
from msghandle.models import MessageEventObject, HandledMessageEvent, HandledMessageEventText
from strres.msghandle import HandledResult
_sent_cache_ = TTLOrderedDict(System.NoUserTokenNotificationSeconds)
def handle_no_user_token(e: MessageEventObject) -> List[HandledMessageEvent]:
if e.is_test_event:
return [HandledMessageEventText(content=HandledResult.TestFailedNoToken)]
if e.channel_oid not in _sent_cache_:
_sent_cache_[e.channel_oid] = True
return [HandledMessageEventText(content=HandledResult.ErrorNoToken, bypass_multiline_check=True)]
return []
| 30.608696
| 105
| 0.81108
| 73
| 704
| 7.575342
| 0.561644
| 0.048825
| 0.130199
| 0.177215
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130682
| 704
| 22
| 106
| 32
| 0.903595
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.076923
| false
| 0.076923
| 0.384615
| 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
| 1
| 1
| 0
| 1
| 0
|
0
| 4
|
663f621d5aa29f8f188a032bf378b6d36927da21
| 153
|
py
|
Python
|
setup.py
|
bengisug/yzv_abet_src
|
b012cde7d1492d1af8cdbd25bb1c42e8362518a8
|
[
"MIT"
] | null | null | null |
setup.py
|
bengisug/yzv_abet_src
|
b012cde7d1492d1af8cdbd25bb1c42e8362518a8
|
[
"MIT"
] | null | null | null |
setup.py
|
bengisug/yzv_abet_src
|
b012cde7d1492d1af8cdbd25bb1c42e8362518a8
|
[
"MIT"
] | null | null | null |
from setuptools import setup, find_packages
setup(name='yzv_abet',
version='0.1',
author='Bengisu Guresti',
packages=find_packages())
| 21.857143
| 43
| 0.686275
| 19
| 153
| 5.368421
| 0.789474
| 0.235294
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.016129
| 0.189542
| 153
| 6
| 44
| 25.5
| 0.806452
| 0
| 0
| 0
| 0
| 0
| 0.169935
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.2
| 0
| 0.2
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b082b4b63bdb7da581876dfd7d8ebf83b838c87b
| 43
|
py
|
Python
|
src/matching/src/__init__.py
|
njounkengdaizem/UCMigrantFinder
|
ddbeee0595a60ceceb392b12641933d6d4a77711
|
[
"MIT"
] | 1
|
2021-10-10T04:56:50.000Z
|
2021-10-10T04:56:50.000Z
|
src/matching/src/__init__.py
|
njounkengdaizem/UCMigrantFinder
|
ddbeee0595a60ceceb392b12641933d6d4a77711
|
[
"MIT"
] | null | null | null |
src/matching/src/__init__.py
|
njounkengdaizem/UCMigrantFinder
|
ddbeee0595a60ceceb392b12641933d6d4a77711
|
[
"MIT"
] | 2
|
2021-10-10T07:23:38.000Z
|
2021-11-14T09:29:58.000Z
|
"""
Directory for the matching system.
"""
| 10.75
| 34
| 0.674419
| 5
| 43
| 5.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.162791
| 43
| 3
| 35
| 14.333333
| 0.805556
| 0.790698
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b088ca500b588f79f41f3331377a10839a49c62d
| 647
|
py
|
Python
|
xu/src/python/Model/XFile.py
|
sonnts996/XuCompa-Request
|
f343e7bfd1b4263eb76438c96d347c549cc75ce3
|
[
"Apache-2.0"
] | null | null | null |
xu/src/python/Model/XFile.py
|
sonnts996/XuCompa-Request
|
f343e7bfd1b4263eb76438c96d347c549cc75ce3
|
[
"Apache-2.0"
] | null | null | null |
xu/src/python/Model/XFile.py
|
sonnts996/XuCompa-Request
|
f343e7bfd1b4263eb76438c96d347c549cc75ce3
|
[
"Apache-2.0"
] | null | null | null |
import os
class XFile:
def __init__(self, path):
self.path = path
self.unsavedData = ""
def getPath(self):
return self.path
def setPath(self, path):
self.path = path
def name(self):
return os.path.splitext(os.path.basename(self.path))
def parent(self):
return os.path.basename(os.path.dirname(self.path))
def dir(self):
return os.path.dirname(self.path)
def __eq__(self, other):
if isinstance(other, XFile):
return other.path == self.path
elif isinstance(other, str):
return other == self.path
return False
| 21.566667
| 60
| 0.588872
| 82
| 647
| 4.54878
| 0.304878
| 0.214477
| 0.117962
| 0.128686
| 0.235925
| 0.128686
| 0
| 0
| 0
| 0
| 0
| 0
| 0.299845
| 647
| 29
| 61
| 22.310345
| 0.8234
| 0
| 0
| 0.095238
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.047619
| 0.190476
| 0.761905
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
b08b3c4c2e7f0002eac0aa9eff22b4ab2858afb6
| 192
|
py
|
Python
|
Day 3.py
|
Passionate-coder997/HackerRank-s
|
bc6c01d8a51ccdecf660400ac33bb9d1cd8f4a3a
|
[
"Unlicense"
] | null | null | null |
Day 3.py
|
Passionate-coder997/HackerRank-s
|
bc6c01d8a51ccdecf660400ac33bb9d1cd8f4a3a
|
[
"Unlicense"
] | null | null | null |
Day 3.py
|
Passionate-coder997/HackerRank-s
|
bc6c01d8a51ccdecf660400ac33bb9d1cd8f4a3a
|
[
"Unlicense"
] | null | null | null |
n = int(input())
if n%2!=0:
print('Weird')
elif 2<n<=5 and n%2==0:
print('Not Weird')
elif 6<n<=20 and n%2==0:
print('Weird')
elif n>20 and n%2==0:
print('Not Weird')
| 19.2
| 25
| 0.520833
| 40
| 192
| 2.5
| 0.35
| 0.08
| 0.12
| 0.32
| 0.81
| 0.81
| 0.55
| 0
| 0
| 0
| 0
| 0.104167
| 0.25
| 192
| 10
| 26
| 19.2
| 0.590278
| 0
| 0
| 0.444444
| 0
| 0
| 0.152174
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.444444
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
b0a29f7381b4409b68efd62779da30edffea5d5e
| 153
|
py
|
Python
|
exploits/staff/utils/invalid_response_exception.py
|
amreo/ructfe-2019
|
19064842acc57243f16143a85c06a5613378ebec
|
[
"MIT"
] | 23
|
2019-11-23T19:53:10.000Z
|
2021-02-19T06:13:28.000Z
|
exploits/staff/utils/invalid_response_exception.py
|
amreo/ructfe-2019
|
19064842acc57243f16143a85c06a5613378ebec
|
[
"MIT"
] | 1
|
2019-11-30T16:10:52.000Z
|
2019-12-01T15:23:39.000Z
|
exploits/staff/utils/invalid_response_exception.py
|
amreo/ructfe-2019
|
19064842acc57243f16143a85c06a5613378ebec
|
[
"MIT"
] | 3
|
2019-11-24T09:35:43.000Z
|
2021-02-19T06:13:29.000Z
|
class InvalidResponseException(Exception):
def __init__(self, message):
self.message = f'Request was not success: {message}'
super()
| 30.6
| 60
| 0.679739
| 16
| 153
| 6.25
| 0.8125
| 0.22
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.215686
| 153
| 4
| 61
| 38.25
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b0a44bb2f2325fcc510069a0535c957a649e5252
| 606
|
py
|
Python
|
connect/__init__.py
|
Adrian-IM/connect.py
|
72a9dccedbaadb5241bcfd6d46e45b26835a1dd3
|
[
"Apache-2.0"
] | null | null | null |
connect/__init__.py
|
Adrian-IM/connect.py
|
72a9dccedbaadb5241bcfd6d46e45b26835a1dd3
|
[
"Apache-2.0"
] | null | null | null |
connect/__init__.py
|
Adrian-IM/connect.py
|
72a9dccedbaadb5241bcfd6d46e45b26835a1dd3
|
[
"Apache-2.0"
] | null | null | null |
from connect.autogen import connect_Collection as Collection
from connect.autogen import connect_Config as Config
from connect.autogen import connect_Dictionary as Dictionary
from connect.autogen import connect_Env as Env
from connect.autogen import connect_Inflection as Inflection
from connect.autogen import connect_Logger as Logger
from connect.autogen import connect_LoggerWriter as LoggerWriter
from connect.autogen import connect_Processor as Processor
__all__ = [
'Collection',
'Config',
'Dictionary',
'Env',
'Inflection',
'Logger',
'LoggerWriter',
'Processor',
]
| 28.857143
| 64
| 0.787129
| 73
| 606
| 6.369863
| 0.191781
| 0.189247
| 0.309677
| 0.412903
| 0.533333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.155116
| 606
| 20
| 65
| 30.3
| 0.908203
| 0
| 0
| 0
| 1
| 0
| 0.108911
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.444444
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
9fd5ae65430e6fcdaa8d68ce906daa310aed62c1
| 76
|
py
|
Python
|
dash_worldbankapp/worldbank.py
|
santamm/worldbankapp
|
177d62cf58f83067eba30d87164101a3e6aa0c34
|
[
"MIT"
] | null | null | null |
dash_worldbankapp/worldbank.py
|
santamm/worldbankapp
|
177d62cf58f83067eba30d87164101a3e6aa0c34
|
[
"MIT"
] | null | null | null |
dash_worldbankapp/worldbank.py
|
santamm/worldbankapp
|
177d62cf58f83067eba30d87164101a3e6aa0c34
|
[
"MIT"
] | 1
|
2020-12-30T12:41:39.000Z
|
2020-12-30T12:41:39.000Z
|
from worldbankapp import app
app.run(host='0.0.0.0', port=3002, debug=True)
| 25.333333
| 46
| 0.736842
| 15
| 76
| 3.733333
| 0.733333
| 0.107143
| 0.107143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115942
| 0.092105
| 76
| 2
| 47
| 38
| 0.695652
| 0
| 0
| 0
| 0
| 0
| 0.092105
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
9fd6a1988773b152e2a8ee40967287091810c309
| 115
|
py
|
Python
|
johnnyv/tests/test_verification.py
|
lincolnreese/JohnnyV
|
bce5a9f11796090754de8dbac91a6ea080fe4236
|
[
"MIT"
] | null | null | null |
johnnyv/tests/test_verification.py
|
lincolnreese/JohnnyV
|
bce5a9f11796090754de8dbac91a6ea080fe4236
|
[
"MIT"
] | null | null | null |
johnnyv/tests/test_verification.py
|
lincolnreese/JohnnyV
|
bce5a9f11796090754de8dbac91a6ea080fe4236
|
[
"MIT"
] | null | null | null |
from unittest import TestCase
class TestVerification(TestCase):
def test_validate(self):
self.fail()
| 16.428571
| 33
| 0.721739
| 13
| 115
| 6.307692
| 0.846154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| 115
| 6
| 34
| 19.166667
| 0.891304
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
9febd49613b097f27f46131ca22f69a0533cdbf8
| 385
|
py
|
Python
|
Python-3/basic_examples/abs_examples.py
|
ghiloufibelgacem/jornaldev
|
b9b27f9f7da595892520314b4ed1d2675556310a
|
[
"MIT"
] | 1,139
|
2018-05-09T11:54:36.000Z
|
2022-03-31T06:52:50.000Z
|
Python-3/basic_examples/abs_examples.py
|
iamharshverma/journaldev
|
af24242a1ac1b7dc3e8e2404ec916b77ccf5044a
|
[
"MIT"
] | 56
|
2018-06-20T03:52:53.000Z
|
2022-02-09T22:57:41.000Z
|
Python-3/basic_examples/abs_examples.py
|
iamharshverma/journaldev
|
af24242a1ac1b7dc3e8e2404ec916b77ccf5044a
|
[
"MIT"
] | 2,058
|
2018-05-09T09:32:17.000Z
|
2022-03-29T13:19:42.000Z
|
import sys
x = 5 # int
print(abs(x))
x = sys.maxsize # long
print(abs(x))
x = 50.23434 # float
print(abs(x))
x = 10 - 4j # complex
print(abs(x))
x = complex(10, 2) # another complex example
print(abs(x))
# numbers in different formats
x = 10.23e1/2 # exponential
print(abs(x))
x = 0b1010 # binary
print(abs(x))
x = 0o15 # octal
print(abs(x))
x = 0xF # hexadecimal
print(abs(x))
| 13.75
| 44
| 0.646753
| 69
| 385
| 3.608696
| 0.434783
| 0.289157
| 0.325301
| 0.281125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.092949
| 0.18961
| 385
| 28
| 45
| 13.75
| 0.705128
| 0.290909
| 0
| 0.473684
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011407
| 0
| 0
| 1
| 0
| false
| 0
| 0.052632
| 0
| 0.052632
| 0.473684
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
9ffeb1b05b19ba323765537e554ddeec7fa6e537
| 416
|
py
|
Python
|
redbookmating/animals/managers.py
|
maximovd/redbook-mating
|
f8186f2f08c869e71856230d0250e2ca3a8e47d2
|
[
"MIT"
] | null | null | null |
redbookmating/animals/managers.py
|
maximovd/redbook-mating
|
f8186f2f08c869e71856230d0250e2ca3a8e47d2
|
[
"MIT"
] | null | null | null |
redbookmating/animals/managers.py
|
maximovd/redbook-mating
|
f8186f2f08c869e71856230d0250e2ca3a8e47d2
|
[
"MIT"
] | null | null | null |
from django.db import models
class BaseManager(models.Manager):
def get_queryset(self):
return super().get_queryset().filter(is_deleted=False)
class AllManager(models.Manager):
def get_queryset(self):
return super().get_queryset().filter()
class OrderedManager(models.Manager):
def get_queryset(self):
return super().get_queryset().exclude(is_deleted=False).order_by('-id')
| 24.470588
| 79
| 0.716346
| 53
| 416
| 5.45283
| 0.45283
| 0.228374
| 0.16609
| 0.197232
| 0.591696
| 0.591696
| 0.591696
| 0.591696
| 0.591696
| 0.591696
| 0
| 0
| 0.153846
| 416
| 16
| 80
| 26
| 0.821023
| 0
| 0
| 0.3
| 0
| 0
| 0.007212
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.3
| false
| 0
| 0.1
| 0.3
| 1
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
b007a2e33023695da540cc0617a786c67f1e83da
| 231
|
py
|
Python
|
cart/urls.py
|
AnthonyNicklin/newage-auctions
|
f829c9761e4fef0c084cf0244a4617a4bda8e0c2
|
[
"FSFAP"
] | 1
|
2021-07-29T07:47:10.000Z
|
2021-07-29T07:47:10.000Z
|
cart/urls.py
|
AnthonyNicklin/newage-auctions
|
f829c9761e4fef0c084cf0244a4617a4bda8e0c2
|
[
"FSFAP"
] | 9
|
2019-12-19T21:27:23.000Z
|
2022-01-13T01:59:10.000Z
|
cart/urls.py
|
AnthonyNicklin/newage-auctions
|
f829c9761e4fef0c084cf0244a4617a4bda8e0c2
|
[
"FSFAP"
] | 1
|
2020-02-11T19:50:45.000Z
|
2020-02-11T19:50:45.000Z
|
from django.urls import path
from .views import view_cart, remove_from_cart
urlpatterns = [
path('', view_cart, name='view_cart'),
path('remove_from_cart/<int:auction_id>/', remove_from_cart, name='remove_from_cart'),
]
| 23.1
| 90
| 0.735931
| 34
| 231
| 4.647059
| 0.411765
| 0.253165
| 0.35443
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12987
| 231
| 9
| 91
| 25.666667
| 0.78607
| 0
| 0
| 0
| 0
| 0
| 0.255411
| 0.147186
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
b00caf3c8b776d03c0bef6c71c037ac3a50f3bce
| 192
|
py
|
Python
|
Python/mysamples/workspace/myimport/main/app.py
|
KagenoMoheji/MyMiniLibraries
|
9494025b24ad18368d8f9fdf2c29fdc9c0616aa3
|
[
"MIT"
] | null | null | null |
Python/mysamples/workspace/myimport/main/app.py
|
KagenoMoheji/MyMiniLibraries
|
9494025b24ad18368d8f9fdf2c29fdc9c0616aa3
|
[
"MIT"
] | 1
|
2022-01-13T03:50:59.000Z
|
2022-01-13T03:50:59.000Z
|
Python/mysamples/workspace/myimport/main/app.py
|
KagenoMoheji/MyMiniLibraries
|
9494025b24ad18368d8f9fdf2c29fdc9c0616aa3
|
[
"MIT"
] | null | null | null |
import inspect
import os
import sys
PYPATH = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) + "/"
sys.path.append(PYPATH + ".")
from modules.md_a.a import funcA
| 32
| 89
| 0.734375
| 28
| 192
| 5
| 0.571429
| 0.085714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.114583
| 192
| 6
| 90
| 32
| 0.823529
| 0
| 0
| 0
| 0
| 0
| 0.010638
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
b0271d26e1536447c15c3f1f4a20b11dcace0b41
| 177
|
py
|
Python
|
OpenGLCffi/GL/EXT/NVX/conditional_render.py
|
cydenix/OpenGLCffi
|
c78f51ae5e6b655eb2ea98f072771cf69e2197f3
|
[
"MIT"
] | null | null | null |
OpenGLCffi/GL/EXT/NVX/conditional_render.py
|
cydenix/OpenGLCffi
|
c78f51ae5e6b655eb2ea98f072771cf69e2197f3
|
[
"MIT"
] | null | null | null |
OpenGLCffi/GL/EXT/NVX/conditional_render.py
|
cydenix/OpenGLCffi
|
c78f51ae5e6b655eb2ea98f072771cf69e2197f3
|
[
"MIT"
] | null | null | null |
from OpenGLCffi.GL import params
@params(api='gl', prms=['id'])
def glBeginConditionalRenderNVX(id):
pass
@params(api='gl', prms=[])
def glEndConditionalRenderNVX():
pass
| 14.75
| 36
| 0.723164
| 21
| 177
| 6.095238
| 0.571429
| 0.140625
| 0.171875
| 0.234375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.112994
| 177
| 11
| 37
| 16.090909
| 0.815287
| 0
| 0
| 0.285714
| 0
| 0
| 0.034286
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0.285714
| 0.142857
| 0
| 0.428571
| 0
| 1
| 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
| 4
|
b04b5766f6267d39fae724e6185cb305eb51c6ad
| 395
|
py
|
Python
|
solutions/03_04_array_indexing.py
|
PyDataMallorca/PyConES2018_Introduccion_a_data_science_en_Python
|
71d0c6f86afdc992e3b2ba1d6862eb34dead5698
|
[
"MIT"
] | 15
|
2018-09-03T16:45:42.000Z
|
2020-02-16T13:50:06.000Z
|
solutions/03_04_array_indexing.py
|
NachoAG76/PyConES2018_Introduccion_a_data_science_en_Python
|
71d0c6f86afdc992e3b2ba1d6862eb34dead5698
|
[
"MIT"
] | null | null | null |
solutions/03_04_array_indexing.py
|
NachoAG76/PyConES2018_Introduccion_a_data_science_en_Python
|
71d0c6f86afdc992e3b2ba1d6862eb34dead5698
|
[
"MIT"
] | 9
|
2018-09-08T10:06:00.000Z
|
2020-05-09T05:09:38.000Z
|
from IPython.display import HTML
HTML("""
<img src="../../images/03_05_arraygraphics_2.png" width=200px />
<img src="../../images/03_07_arraygraphics_3.png" width=200px />
<img src="../../images/03_09_arraygraphics_4.png" width=200px />
<img src="../../images/03_11_arraygraphics_5.png" width=200px />
(imágenes extraídas de [aquí](https://github.com/gertingold/euroscipy-numpy-tutorial))
""")
| 39.5
| 86
| 0.721519
| 57
| 395
| 4.789474
| 0.561404
| 0.087912
| 0.175824
| 0.205128
| 0.296703
| 0.296703
| 0.296703
| 0
| 0
| 0
| 0
| 0.086957
| 0.068354
| 395
| 10
| 87
| 39.5
| 0.654891
| 0
| 0
| 0
| 0
| 0.125
| 0.881313
| 0.444444
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.125
| 0
| 0.125
| 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
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c671e044e9ad0b0e2ec652dae147a9feaeef9b59
| 97
|
py
|
Python
|
tv_shows/admin.py
|
sks444/awesome100
|
ae9f16d4101ffc2be9140e77cec1f0b67b725af0
|
[
"MIT"
] | 2
|
2018-10-30T05:30:50.000Z
|
2020-05-22T14:42:35.000Z
|
tv_shows/admin.py
|
sks444/awesome100
|
ae9f16d4101ffc2be9140e77cec1f0b67b725af0
|
[
"MIT"
] | 34
|
2018-04-13T11:01:44.000Z
|
2018-04-18T23:06:20.000Z
|
tv_shows/admin.py
|
sks444/awesome100
|
ae9f16d4101ffc2be9140e77cec1f0b67b725af0
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from tv_shows.models import TvShow
admin.site.register(TvShow)
| 19.4
| 34
| 0.835052
| 15
| 97
| 5.333333
| 0.733333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103093
| 97
| 4
| 35
| 24.25
| 0.91954
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
c682475f71dc25f9cd5ca5d649fbc9c5749af42e
| 189
|
py
|
Python
|
Air_Quality_Index/test.py
|
kalpeshsnaik09/data_science_portfolio
|
bc55cd50060d08be2e90a504bfffc4f3cee0dcba
|
[
"Apache-2.0"
] | null | null | null |
Air_Quality_Index/test.py
|
kalpeshsnaik09/data_science_portfolio
|
bc55cd50060d08be2e90a504bfffc4f3cee0dcba
|
[
"Apache-2.0"
] | null | null | null |
Air_Quality_Index/test.py
|
kalpeshsnaik09/data_science_portfolio
|
bc55cd50060d08be2e90a504bfffc4f3cee0dcba
|
[
"Apache-2.0"
] | null | null | null |
import pandas as pd
df=pd.read_csv('Data/main_data/air_quality_index.csv')
print(df.shape)
print(df.isna().sum())
df.dropna(inplace=True)
print(df.shape)
print(df.isna().sum())
print(df)
| 18.9
| 54
| 0.73545
| 35
| 189
| 3.857143
| 0.542857
| 0.259259
| 0.177778
| 0.251852
| 0.385185
| 0.385185
| 0.385185
| 0
| 0
| 0
| 0
| 0
| 0.068783
| 189
| 9
| 55
| 21
| 0.767045
| 0
| 0
| 0.5
| 0
| 0
| 0.190476
| 0.190476
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.125
| 0
| 0.125
| 0.625
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
c6890bdfdf04bbef8203793b6d551a7b43e13d66
| 138
|
py
|
Python
|
arbitrage/public_markets/gdaxeur.py
|
fiona-pet/bitcoin-arbitrage
|
a955b5930997b2ad46d2bbfb29db4dcad5e6c3e7
|
[
"MIT"
] | 1,633
|
2015-01-05T00:47:41.000Z
|
2022-03-27T04:05:03.000Z
|
arbitrage/public_markets/gdaxeur.py
|
fiona-pet/bitcoin-arbitrage
|
a955b5930997b2ad46d2bbfb29db4dcad5e6c3e7
|
[
"MIT"
] | 22
|
2015-02-16T09:31:32.000Z
|
2020-10-14T20:14:26.000Z
|
arbitrage/public_markets/gdaxeur.py
|
fiona-pet/bitcoin-arbitrage
|
a955b5930997b2ad46d2bbfb29db4dcad5e6c3e7
|
[
"MIT"
] | 531
|
2015-01-02T10:13:01.000Z
|
2022-03-26T16:06:19.000Z
|
from arbitrage.public_markets._gdax import GDAX
class GDAXEUR(GDAX):
def __init__(self):
super().__init__("EUR", "BTC-EUR")
| 19.714286
| 47
| 0.688406
| 18
| 138
| 4.722222
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.173913
| 138
| 6
| 48
| 23
| 0.745614
| 0
| 0
| 0
| 0
| 0
| 0.072464
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
c6a5e018cd44fd349dd867f3c964d778ef54906b
| 203
|
py
|
Python
|
devel.py
|
vanjaBijalkovic/test
|
cbd853002b796359f49434754a9db3dab92d8c45
|
[
"BSD-2-Clause"
] | 1
|
2019-12-24T19:41:37.000Z
|
2019-12-24T19:41:37.000Z
|
devel.py
|
vanjaBijalkovic/test
|
cbd853002b796359f49434754a9db3dab92d8c45
|
[
"BSD-2-Clause"
] | null | null | null |
devel.py
|
vanjaBijalkovic/test
|
cbd853002b796359f49434754a9db3dab92d8c45
|
[
"BSD-2-Clause"
] | null | null | null |
from importlib import import_module
from config import configs
from name import app_name
application = import_module(f'{app_name}')
config = configs['development']
app = application.create_app(config)
| 22.555556
| 42
| 0.807882
| 28
| 203
| 5.678571
| 0.428571
| 0.150943
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1133
| 203
| 8
| 43
| 25.375
| 0.883333
| 0
| 0
| 0
| 0
| 0
| 0.103448
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
c6c1001a60ac659f3d63d133a647b31975d7f1b1
| 1,453
|
py
|
Python
|
7segment/countdown_seven_segment.py
|
leonardoandrade/embedded
|
b6b82a59bf5ff822fa497a9123a1f099f587f07e
|
[
"MIT"
] | null | null | null |
7segment/countdown_seven_segment.py
|
leonardoandrade/embedded
|
b6b82a59bf5ff822fa497a9123a1f099f587f07e
|
[
"MIT"
] | null | null | null |
7segment/countdown_seven_segment.py
|
leonardoandrade/embedded
|
b6b82a59bf5ff822fa497a9123a1f099f587f07e
|
[
"MIT"
] | null | null | null |
import RPi.GPIO as GPIO
import time
# map of pins
pin_map = [16, #0
12, #1
19, #2
13, #3
6, #4
20, #5
21] #6
segment_to_pin_map = [
[GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.LOW], #0
[GPIO.LOW, GPIO.HIGH, GPIO.HIGH, GPIO.LOW, GPIO.LOW, GPIO.LOW, GPIO.LOW], #1
[GPIO.HIGH, GPIO.HIGH, GPIO.LOW, GPIO.HIGH, GPIO.HIGH, GPIO.LOW, GPIO.HIGH], #2
[GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.LOW, GPIO.LOW, GPIO.HIGH], #3
[GPIO.LOW, GPIO.HIGH, GPIO.HIGH, GPIO.LOW, GPIO.LOW, GPIO.HIGH, GPIO.HIGH], #4
[GPIO.HIGH, GPIO.LOW, GPIO.HIGH, GPIO.HIGH, GPIO.LOW, GPIO.HIGH, GPIO.HIGH], #5
[GPIO.HIGH, GPIO.LOW, GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.HIGH], #6
[GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.LOW, GPIO.LOW, GPIO.LOW, GPIO.LOW], #7
[GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.HIGH], #8
[GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.HIGH, GPIO.LOW, GPIO.HIGH, GPIO.HIGH] #9
]
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
def countdown(interval):
for p in pin_map:
GPIO.setup(p, GPIO.OUT)
for x in reversed(range(9+1)):
print "displaying:", x
for i, s in enumerate(segment_to_pin_map[x]):
GPIO.output(pin_map[i], s)
time.sleep(interval)
for pin in pin_map:
GPIO.output(pin, GPIO.LOW)
countdown(0.5)
| 32.288889
| 87
| 0.601514
| 242
| 1,453
| 3.570248
| 0.210744
| 0.453704
| 0.583333
| 0.574074
| 0.623843
| 0.623843
| 0.614583
| 0.614583
| 0.614583
| 0.597222
| 0
| 0.030521
| 0.23331
| 1,453
| 44
| 88
| 33.022727
| 0.745063
| 0.01927
| 0
| 0
| 0
| 0
| 0.007824
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.058824
| null | null | 0.029412
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c6e8d270c5d493591c54159614d9f117a7520893
| 66
|
py
|
Python
|
src/python/track/__init__.py
|
ml-starter-packs/ml-monorepo
|
c8c9e7406faf640cd151e3ad5c715f6c2d3979a8
|
[
"MIT"
] | null | null | null |
src/python/track/__init__.py
|
ml-starter-packs/ml-monorepo
|
c8c9e7406faf640cd151e3ad5c715f6c2d3979a8
|
[
"MIT"
] | 7
|
2022-02-15T23:59:05.000Z
|
2022-03-30T19:47:14.000Z
|
src/python/track/__init__.py
|
ml-starter-packs/ml-monorepo
|
c8c9e7406faf640cd151e3ad5c715f6c2d3979a8
|
[
"MIT"
] | null | null | null |
from .core import simple_tracking
__all__ = ("simple_tracking",)
| 16.5
| 33
| 0.772727
| 8
| 66
| 5.625
| 0.75
| 0.622222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.121212
| 66
| 3
| 34
| 22
| 0.775862
| 0
| 0
| 0
| 0
| 0
| 0.227273
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
05b5ed2ffd768f46649af0b4bb8e315d7a3fa632
| 1,142
|
py
|
Python
|
p1_basic/day16_21module/day17/4.分组在re模块中的使用.py
|
dong-pro/fullStackPython
|
5ad8662f7b57f14c8529e7eaf64290eeda773557
|
[
"Apache-2.0"
] | 1
|
2020-04-03T01:32:05.000Z
|
2020-04-03T01:32:05.000Z
|
p1_basic/day16_21module/day17/4.分组在re模块中的使用.py
|
dong-pro/fullStackPython
|
5ad8662f7b57f14c8529e7eaf64290eeda773557
|
[
"Apache-2.0"
] | null | null | null |
p1_basic/day16_21module/day17/4.分组在re模块中的使用.py
|
dong-pro/fullStackPython
|
5ad8662f7b57f14c8529e7eaf64290eeda773557
|
[
"Apache-2.0"
] | null | null | null |
import re
# s = '<a>wahaha</a>' # 标签语言 html 网页
# ret = re.search('<(\w+)>(\w+)</(\w+)>',s)
# print(ret.group()) # 所有的结果
# print(ret.group(1)) # 数字参数代表的是取对应分组中的内容
# print(ret.group(2))
# print(ret.group(3))
# 为了findall也可以顺利取到分组中的内容,有一个特殊的语法,就是优先显示分组中的内容
# ret = re.findall('(\w+)',s)
# print(ret)
# ret = re.findall('>(\w+)<',s)
# print(ret)
# 取消分组优先(?:正则表达式)
# ret = re.findall('\d+(\.\d+)?','1.234*4')
# print(ret)
# 关于分组
# 对于正则表达式来说 有些时候我们需要进行分组,来整体约束某一组字符出现的次数
# (\.[\w]+)?
# 对于python语言来说 分组可以帮助你更好更精准的找到你真正需要的内容
# <(\w+)>(\w+)</(\w+)>
# split
# ret = re.split('\d+','alex83taibai40egon25')
# print(ret)
# ret = re.split('(\d+)','alex83taibai40egon25aa')
# print(ret)
# python 和 正则表达式 之间的特殊的约定
# 分组命名 (?P<这个组的名字>正则表达式)
# s = '<a>wahaha</a>'
# ret = re.search('>(?P<con>\w+)<',s)
# print(ret.group(1))
# print(ret.group('con'))
# s = '<a>wahaha</a>'
# pattern = '<(\w+)>(\w+)</(\w+)>'
# ret = re.search(pattern,s)
# print(ret.group(1) == ret.group(3))
# 使用前面的分组 要求使用这个名字的分组和前面同名分组中的内容匹配的必须一致
# pattern = '<(?P<tab>\w+)>(\w+)</(?P=tab)>'
# ret = re.search(pattern,s)
# print(ret)
# 2018-12-06
# 2018.12.6
# 2018 12 06
# 12:30:30
| 21.148148
| 50
| 0.585814
| 162
| 1,142
| 4.12963
| 0.320988
| 0.155456
| 0.136024
| 0.059791
| 0.201794
| 0.146487
| 0.146487
| 0
| 0
| 0
| 0
| 0.052156
| 0.12697
| 1,142
| 53
| 51
| 21.54717
| 0.618857
| 0.905429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
05c2771088d435783ab1800306e3c79b5f03d48a
| 281
|
py
|
Python
|
AlfaTesting Resources/DummyVnfmDriver2.py
|
ViniGarcia/EMSPlatform
|
f51e1c5ce1b75016bc7f453e125a37909ac9b566
|
[
"MIT"
] | 1
|
2021-05-31T15:44:25.000Z
|
2021-05-31T15:44:25.000Z
|
AlfaTesting Resources/DummyVnfmDriver2.py
|
ViniGarcia/HoLMES
|
f51e1c5ce1b75016bc7f453e125a37909ac9b566
|
[
"MIT"
] | null | null | null |
AlfaTesting Resources/DummyVnfmDriver2.py
|
ViniGarcia/HoLMES
|
f51e1c5ce1b75016bc7f453e125a37909ac9b566
|
[
"MIT"
] | null | null | null |
import sys
sys.path.insert(0,'Access Subsystem/Ve-Vnfm-em')
import VnfmDriverTemplate
class DummyVnfmDriver2(VnfmDriverTemplate.VnfmDriverTemplate):
def __init__(self, vnfmId, vnfmAddress, vnfmCredentials):
super().__init__(vnfmId, vnfmAddress, vnfmCredentials)
| 25.545455
| 63
| 0.779359
| 28
| 281
| 7.535714
| 0.714286
| 0.161137
| 0.303318
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.00813
| 0.124555
| 281
| 10
| 64
| 28.1
| 0.849594
| 0
| 0
| 0
| 0
| 0
| 0.099631
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.333333
| 0
| 0.666667
| 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
| 1
| 0
| 1
| 0
|
0
| 4
|
af0c4b3f99c10362d466264d0ce982cd1c842d0f
| 45
|
py
|
Python
|
v_programmer.py
|
fossabot/ava
|
e8541c43b7bc4e92f2cfb21f64f0167057d8b565
|
[
"Apache-2.0"
] | null | null | null |
v_programmer.py
|
fossabot/ava
|
e8541c43b7bc4e92f2cfb21f64f0167057d8b565
|
[
"Apache-2.0"
] | null | null | null |
v_programmer.py
|
fossabot/ava
|
e8541c43b7bc4e92f2cfb21f64f0167057d8b565
|
[
"Apache-2.0"
] | null | null | null |
"""
The verbal programmer module for AVA
"""
| 11.25
| 36
| 0.688889
| 6
| 45
| 5.166667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.177778
| 45
| 3
| 37
| 15
| 0.837838
| 0.8
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
af85636edd0258cb860df9141d88a2cc392a7826
| 10,306
|
py
|
Python
|
backend/django/test/core_utils/test_core_utils_annotate.py
|
RTIInternational/SMART
|
c95eaa088df33bac95aababdc560c10422eed6e3
|
[
"MIT"
] | 185
|
2018-10-01T16:38:35.000Z
|
2022-03-16T14:39:04.000Z
|
backend/django/test/core_utils/test_core_utils_annotate.py
|
RTIInternational/SMART
|
c95eaa088df33bac95aababdc560c10422eed6e3
|
[
"MIT"
] | 93
|
2018-12-07T15:33:44.000Z
|
2022-03-09T15:19:08.000Z
|
backend/django/test/core_utils/test_core_utils_annotate.py
|
RTIInternational/SMART
|
c95eaa088df33bac95aababdc560c10422eed6e3
|
[
"MIT"
] | 30
|
2019-03-04T05:44:44.000Z
|
2022-03-19T17:07:14.000Z
|
from test.conftest import TEST_QUEUE_LEN
from test.util import assert_obj_exists
from core.models import AssignedData, Data, DataLabel, DataQueue, Label
from core.utils.utils_annotate import (
assign_datum,
get_assignments,
label_data,
move_skipped_to_admin_queue,
unassign_datum,
)
from core.utils.utils_queue import fill_queue
def test_assign_datum_project_queue_returns_datum(
db, test_queue, test_profile, test_redis
):
"""Assign a datum from a project-wide queue (null profile ID)."""
fill_queue(test_queue, orderby="random")
datum = assign_datum(test_profile, test_queue.project)
# Make sure we got the datum
assert isinstance(datum, Data)
def test_assign_datum_project_queue_correct_assignment(
db, test_queue, test_profile, test_redis
):
fill_queue(test_queue, orderby="random")
datum = assign_datum(test_profile, test_queue.project)
# Make sure the assignment is correct
assignment = AssignedData.objects.filter(data=datum)
assert len(assignment) == 1
assert assignment[0].profile == test_profile
assert assignment[0].queue == test_queue
assert assignment[0].assigned_timestamp is not None
def test_assign_datum_project_queue_pops_queues(
db, test_queue, test_profile, test_redis
):
fill_queue(test_queue, orderby="random")
datum = assign_datum(test_profile, test_queue.project)
# Make sure the datum was removed from queues but not set
assert test_redis.llen("queue:" + str(test_queue.pk)) == test_queue.length - 1
assert test_redis.scard("set:" + str(test_queue.pk)) == test_queue.length
# but not from the db queue
assert test_queue.data.count() == test_queue.length
assert datum in test_queue.data.all()
def test_assign_datum_profile_queue_returns_correct_datum(
db, test_profile_queue, test_profile, test_profile_queue2, test_profile2, test_redis
):
fill_queue(test_profile_queue, orderby="random")
fill_queue(test_profile_queue2, orderby="random")
datum = assign_datum(test_profile, test_profile_queue.project)
assert isinstance(datum, Data)
def test_assign_datum_profile_queue_correct_assignment(
db, test_profile_queue, test_profile, test_profile_queue2, test_profile2, test_redis
):
fill_queue(test_profile_queue, orderby="random")
fill_queue(test_profile_queue2, orderby="random")
datum = assign_datum(test_profile, test_profile_queue.project)
assignment = AssignedData.objects.filter(data=datum)
assert len(assignment) == 1
assert assignment[0].profile == test_profile
assert assignment[0].queue == test_profile_queue
assert assignment[0].assigned_timestamp is not None
def test_assign_datum_profile_queue_pops_queues(
db, test_profile_queue, test_profile, test_profile_queue2, test_profile2, test_redis
):
fill_queue(test_profile_queue, orderby="random")
fill_queue(test_profile_queue2, orderby="random")
datum = assign_datum(test_profile, test_profile_queue.project)
# Make sure the datum was removed from the correct queues but not sets
assert (
test_redis.llen("queue:" + str(test_profile_queue.pk))
== test_profile_queue.length - 1
)
assert (
test_redis.scard("set:" + str(test_profile_queue.pk))
== test_profile_queue.length
)
# ...but not the other queues
assert test_profile_queue.data.count() == test_profile_queue.length
assert datum in test_profile_queue.data.all()
assert (
test_redis.llen("queue:" + str(test_profile_queue2.pk))
== test_profile_queue2.length
)
assert (
test_redis.scard("set:" + str(test_profile_queue2.pk))
== test_profile_queue2.length
)
assert test_profile_queue2.data.count() == test_profile_queue2.length
def test_label_data(db, test_profile, test_queue, test_redis):
fill_queue(test_queue, orderby="random")
datum = assign_datum(test_profile, test_queue.project)
test_label = Label.objects.create(name="test", project=test_queue.project)
label_data(test_label, datum, test_profile, 3)
# Make sure the label was properly recorded
assert datum in test_profile.labeled_data.all()
assert_obj_exists(
DataLabel,
{
"data": datum,
"profile": test_profile,
"label": test_label,
"time_to_label": 3,
},
)
# Make sure the assignment was removed
assert not AssignedData.objects.filter(
profile=test_profile, data=datum, queue=test_queue
).exists()
def test_get_assignments_no_existing_assignment_one_assignment(
db, test_profile, test_project_data, test_queue, test_redis
):
fill_queue(test_queue, orderby="random")
assert AssignedData.objects.count() == 0
data = get_assignments(test_profile, test_project_data, 1)
assert len(data) == 1
assert isinstance(data[0], Data)
assert_obj_exists(AssignedData, {"data": data[0], "profile": test_profile})
def test_get_assignments_no_existing_assignment_half_max_queue_length(
db, test_profile, test_project_data, test_queue, test_redis
):
fill_queue(test_queue, orderby="random")
assert AssignedData.objects.count() == 0
data = get_assignments(test_profile, test_project_data, TEST_QUEUE_LEN // 2)
assert len(data) == TEST_QUEUE_LEN // 2
for datum in data:
assert isinstance(datum, Data)
assert_obj_exists(AssignedData, {"data": datum, "profile": test_profile})
def test_get_assignments_no_existing_assignment_max_queue_length(
db, test_profile, test_project_data, test_queue, test_redis
):
fill_queue(test_queue, orderby="random")
assert AssignedData.objects.count() == 0
data = get_assignments(test_profile, test_project_data, TEST_QUEUE_LEN)
assert len(data) == TEST_QUEUE_LEN
for datum in data:
assert isinstance(datum, Data)
assert_obj_exists(AssignedData, {"data": datum, "profile": test_profile})
def test_get_assignments_no_existing_assignment_over_max_queue_length(
db, test_profile, test_project_data, test_queue, test_redis
):
fill_queue(test_queue, orderby="random")
assert AssignedData.objects.count() == 0
data = get_assignments(test_profile, test_project_data, TEST_QUEUE_LEN + 10)
assert len(data) == TEST_QUEUE_LEN
for datum in data:
assert isinstance(datum, Data)
assert_obj_exists(AssignedData, {"data": datum, "profile": test_profile})
def test_get_assignments_one_existing_assignment(
db, test_profile, test_project_data, test_queue, test_redis
):
fill_queue(test_queue, orderby="random")
assigned_datum = assign_datum(test_profile, test_project_data)
data = get_assignments(test_profile, test_project_data, 1)
assert isinstance(data[0], Data)
# We should just get the datum that was already assigned
assert data[0] == assigned_datum
def test_get_assignments_multiple_existing_assignments(
db, test_profile, test_project_data, test_queue, test_redis
):
fill_queue(test_queue, orderby="random")
assigned_data = []
for i in range(5):
assigned_data.append(assign_datum(test_profile, test_project_data))
data = get_assignments(test_profile, test_project_data, 5)
assert len(data) == 5
assert len(data) == len(assigned_data)
for datum, assigned_datum in zip(data, assigned_data):
assert isinstance(datum, Data)
# We should just get the data that was already assigned
assert len(data) == len(assigned_data)
def test_unassign(db, test_profile, test_project_data, test_queue, test_redis):
fill_queue(test_queue, orderby="random")
assert test_redis.llen("queue:" + str(test_queue.pk)) == test_queue.length
assert test_redis.scard("set:" + str(test_queue.pk)) == test_queue.length
datum = get_assignments(test_profile, test_project_data, 1)[0]
assert test_redis.llen("queue:" + str(test_queue.pk)) == (test_queue.length - 1)
assert test_redis.scard("set:" + str(test_queue.pk)) == test_queue.length
assert AssignedData.objects.filter(data=datum, profile=test_profile).exists()
unassign_datum(datum, test_profile)
assert test_redis.llen("queue:" + str(test_queue.pk)) == test_queue.length
assert test_redis.scard("set:" + str(test_queue.pk)) == test_queue.length
assert not AssignedData.objects.filter(data=datum, profile=test_profile).exists()
# The unassigned datum should be the next to be assigned
reassigned_datum = get_assignments(test_profile, test_project_data, 1)[0]
assert reassigned_datum == datum
def test_unassign_after_fillqueue(
db, test_profile, test_project_data, test_queue, test_labels, test_redis
):
fill_queue(test_queue, "random")
assert test_redis.llen("queue:" + str(test_queue.pk)) == test_queue.length
assert test_redis.scard("set:" + str(test_queue.pk)) == test_queue.length
data = get_assignments(test_profile, test_project_data, 10)
assert test_redis.llen("queue:" + str(test_queue.pk)) == (test_queue.length - 10)
assert test_redis.scard("set:" + str(test_queue.pk)) == test_queue.length
test_label = test_labels[0]
for i in range(5):
label_data(test_label, data[i], test_profile, 3)
assert test_redis.llen("queue:" + str(test_queue.pk)) == (test_queue.length - 10)
assert test_redis.scard("set:" + str(test_queue.pk)) == (test_queue.length - 5)
fill_queue(test_queue, "random")
assert test_redis.llen("queue:" + str(test_queue.pk)) == test_queue.length - 5
assert test_redis.scard("set:" + str(test_queue.pk)) == test_queue.length
def test_skip_data(db, test_profile, test_queue, test_admin_queue, test_redis):
fill_queue(test_queue, orderby="random")
project = test_queue.project
datum = assign_datum(test_profile, project)
move_skipped_to_admin_queue(datum, test_profile, project)
# Make sure the assignment was removed
assert not AssignedData.objects.filter(
profile=test_profile, data=datum, queue=test_queue
).exists()
# make sure the item was re-assigned to the admin queue
assert DataQueue.objects.filter(data=datum, queue=test_admin_queue).exists()
# make sure not in normal queue
assert not DataQueue.objects.filter(data=datum, queue=test_queue).exists()
| 34.700337
| 88
| 0.733553
| 1,430
| 10,306
| 4.968531
| 0.079021
| 0.123856
| 0.07178
| 0.058832
| 0.815482
| 0.770303
| 0.722308
| 0.687403
| 0.660239
| 0.615341
| 0
| 0.00711
| 0.167572
| 10,306
| 296
| 89
| 34.817568
| 0.821075
| 0.064623
| 0
| 0.555556
| 0
| 0
| 0.03087
| 0
| 0
| 0
| 0
| 0
| 0.338384
| 1
| 0.080808
| false
| 0
| 0.025253
| 0
| 0.106061
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
af860322bc240afdb8697150401b91ea06ce1956
| 330
|
py
|
Python
|
pertussis/__init__.py
|
DeanLa/israel_pertussis
|
dd1f6bb00dfac5a2f580da72e60bf32c3ce228c7
|
[
"MIT"
] | null | null | null |
pertussis/__init__.py
|
DeanLa/israel_pertussis
|
dd1f6bb00dfac5a2f580da72e60bf32c3ce228c7
|
[
"MIT"
] | null | null | null |
pertussis/__init__.py
|
DeanLa/israel_pertussis
|
dd1f6bb00dfac5a2f580da72e60bf32c3ce228c7
|
[
"MIT"
] | null | null | null |
# INITIAL
from .config import *
from .funcs import *
# MODEL
from .parameters import *
from .data import * #Requires Parameters
from .model import * # Requires Parameters
from .predict import * # Requires Parameters
from .sampling import *
# POST
from .charts import *
from .report import *
from .analysis import *
| 22
| 45
| 0.712121
| 39
| 330
| 6.025641
| 0.384615
| 0.170213
| 0.306383
| 0.357447
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.209091
| 330
| 14
| 46
| 23.571429
| 0.900383
| 0.233333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
bb7276729e9cee7815b5a8953cebd2473efcd621
| 216
|
py
|
Python
|
app/main/__init__.py
|
chen940303/Diaosier_home
|
58e0713703d7f902739c7fe3495c0d964151bcc8
|
[
"MIT"
] | 2
|
2016-09-05T15:46:23.000Z
|
2016-09-05T15:46:27.000Z
|
app/main/__init__.py
|
chen940303/Diaosier_home
|
58e0713703d7f902739c7fe3495c0d964151bcc8
|
[
"MIT"
] | null | null | null |
app/main/__init__.py
|
chen940303/Diaosier_home
|
58e0713703d7f902739c7fe3495c0d964151bcc8
|
[
"MIT"
] | null | null | null |
from flask import Blueprint
from ..models import Permission
main=Blueprint('main',__name__)
@main.app_context_processor
def inject_permissions():
return dict(Permission=Permission)
from . import views, errors
| 19.636364
| 38
| 0.796296
| 27
| 216
| 6.111111
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12037
| 216
| 10
| 39
| 21.6
| 0.868421
| 0
| 0
| 0
| 0
| 0
| 0.018519
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0.428571
| 0.142857
| 0.714286
| 0.285714
| 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
| 1
| 1
| 0
|
0
| 4
|
bbf5fc301b3493968a9c42ffc796566de809296b
| 193
|
py
|
Python
|
filter-plugin/logstash-filter-pubsub-mysql-guardium/PubSubMySQLPackage/sqlFormatter/sqlFormatter.py
|
IBM-klahn/universal-connectors
|
a68c6054dfdbd999064a02e4b0e33a174d51e731
|
[
"Apache-2.0"
] | null | null | null |
filter-plugin/logstash-filter-pubsub-mysql-guardium/PubSubMySQLPackage/sqlFormatter/sqlFormatter.py
|
IBM-klahn/universal-connectors
|
a68c6054dfdbd999064a02e4b0e33a174d51e731
|
[
"Apache-2.0"
] | null | null | null |
filter-plugin/logstash-filter-pubsub-mysql-guardium/PubSubMySQLPackage/sqlFormatter/sqlFormatter.py
|
IBM-klahn/universal-connectors
|
a68c6054dfdbd999064a02e4b0e33a174d51e731
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
def formattedQuery(q): return " ".join([s.strip() for s in q.splitlines()])
sql = sys.stdin.read().rstrip()
print(formattedQuery(sql))
| 27.571429
| 75
| 0.668394
| 29
| 193
| 4.448276
| 0.827586
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011696
| 0.11399
| 193
| 6
| 76
| 32.166667
| 0.74269
| 0.222798
| 0
| 0
| 0
| 0
| 0.006757
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 0.5
| 0.25
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
a53d34612ab6a3f9550d798d7e81e2d49240e784
| 64
|
py
|
Python
|
dynamicserialize/dstypes/com/raytheon/uf/common/auth/__init__.py
|
srcarter3/python-awips
|
d981062662968cf3fb105e8e23d955950ae2497e
|
[
"BSD-3-Clause"
] | 33
|
2016-03-17T01:21:18.000Z
|
2022-02-08T10:41:06.000Z
|
dynamicserialize/dstypes/com/raytheon/uf/common/auth/__init__.py
|
srcarter3/python-awips
|
d981062662968cf3fb105e8e23d955950ae2497e
|
[
"BSD-3-Clause"
] | 15
|
2016-04-19T16:34:08.000Z
|
2020-09-09T19:57:54.000Z
|
dynamicserialize/dstypes/com/raytheon/uf/common/auth/__init__.py
|
Unidata/python-awips
|
8459aa756816e5a45d2e5bea534d23d5b1dd1690
|
[
"BSD-3-Clause"
] | 20
|
2016-03-12T01:46:58.000Z
|
2022-02-08T06:53:22.000Z
|
__all__ = [
'resp',
'user'
]
| 10.666667
| 19
| 0.234375
| 3
| 64
| 3.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.640625
| 64
| 5
| 20
| 12.8
| 0.478261
| 0
| 0
| 0
| 0
| 0
| 0.126984
| 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
| 1
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
a5664ab1319e09a4888b9d6f66bb7ec48626a0dc
| 183
|
py
|
Python
|
examples/statemachines/sources/do_state_action.py
|
DmitryBogomolov/aws-cloudformation-sample
|
f0454b203973e07027a4cdf5f36468d137d310fd
|
[
"MIT"
] | null | null | null |
examples/statemachines/sources/do_state_action.py
|
DmitryBogomolov/aws-cloudformation-sample
|
f0454b203973e07027a4cdf5f36468d137d310fd
|
[
"MIT"
] | 36
|
2018-04-20T06:11:41.000Z
|
2018-07-07T21:55:55.000Z
|
examples/statemachines/sources/do_state_action.py
|
DmitryBogomolov/aws-cloudformation-sample
|
f0454b203973e07027a4cdf5f36468d137d310fd
|
[
"MIT"
] | null | null | null |
import os
def mix(value):
return (value * 7 + 29) % 17
def handler(event, context):
return {
'count': event['count'] - 1,
'value': mix(event['value'])
}
| 16.636364
| 36
| 0.530055
| 23
| 183
| 4.217391
| 0.608696
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.046512
| 0.295082
| 183
| 10
| 37
| 18.3
| 0.705426
| 0
| 0
| 0
| 0
| 0
| 0.10929
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.125
| 0.25
| 0.625
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
a56b89197556bc3b76e80df0a869f34a6c7e9400
| 34
|
py
|
Python
|
user_login.py
|
foozimachine/football
|
a71c6217619a3f73714b2039c6b0c8ec36919237
|
[
"Apache-2.0"
] | null | null | null |
user_login.py
|
foozimachine/football
|
a71c6217619a3f73714b2039c6b0c8ec36919237
|
[
"Apache-2.0"
] | null | null | null |
user_login.py
|
foozimachine/football
|
a71c6217619a3f73714b2039c6b0c8ec36919237
|
[
"Apache-2.0"
] | null | null | null |
Mein neuer Code...
Noch mehr Code
| 11.333333
| 18
| 0.735294
| 6
| 34
| 4.166667
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.176471
| 34
| 2
| 19
| 17
| 0.892857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
a58f671eef680d98c45dd61ef7cbd4631ee69442
| 455
|
py
|
Python
|
buzzni/ai/reco/mlserving/_state.py
|
BuzzniAILab/mlserving
|
8b8add9dbe5cdd6392e0c87ee789492de0a1c70e
|
[
"MIT"
] | 13
|
2020-08-23T17:35:53.000Z
|
2022-02-10T14:14:03.000Z
|
mlserving/_state.py
|
orlevi111/ganesha
|
137cc388806fc98f7768298da01ebeddf03f9464
|
[
"MIT"
] | 3
|
2020-08-20T21:09:01.000Z
|
2021-06-25T15:33:54.000Z
|
mlserving/_state.py
|
orlevi111/ganesha
|
137cc388806fc98f7768298da01ebeddf03f9464
|
[
"MIT"
] | 3
|
2021-04-12T01:56:22.000Z
|
2021-10-05T12:50:12.000Z
|
class Status(object):
SHUTTING_DOWN = 'Shutting Down'
RUNNING = 'Running'
class __State(object):
def __init__(self):
self._shutting_down = False
def set_to_shutting_down(self):
self._shutting_down = True
def is_shutting_down(self):
return self._shutting_down
@property
def status(self):
return Status.SHUTTING_DOWN if self.is_shutting_down() else Status.RUNNING
runtime_state = __State()
| 20.681818
| 82
| 0.687912
| 57
| 455
| 5.070175
| 0.350877
| 0.373702
| 0.16609
| 0.138408
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.228571
| 455
| 21
| 83
| 21.666667
| 0.823362
| 0
| 0
| 0
| 0
| 0
| 0.043956
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0
| 0.142857
| 0.714286
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
a590b1ba90e346cc7f0e0815716ccc1c7f42069b
| 3,526
|
py
|
Python
|
pywi/__init__.py
|
jeremiedecock/mrif
|
094b0dd81ff2be0e24bf3871caab48da1b5d138b
|
[
"MIT"
] | 1
|
2021-07-06T06:02:45.000Z
|
2021-07-06T06:02:45.000Z
|
pywi/__init__.py
|
jeremiedecock/mrif
|
094b0dd81ff2be0e24bf3871caab48da1b5d138b
|
[
"MIT"
] | null | null | null |
pywi/__init__.py
|
jeremiedecock/mrif
|
094b0dd81ff2be0e24bf3871caab48da1b5d138b
|
[
"MIT"
] | 1
|
2019-01-07T10:50:38.000Z
|
2019-01-07T10:50:38.000Z
|
"""Python Wavelet Imaging
PyWI is an image filtering library aimed at removing additive background noise
from raster graphics images.
* Input: a FITS file containing the raster graphics to clean (i.e. an image
defined as a classic rectangular lattice of square pixels).
* Output: a FITS file containing the cleaned raster graphics.
The image filter relies on multiresolution analysis methods (Wavelet
transforms) that remove some scales (frequencies) locally in space. These
methods are particularly efficient when signal and noise are located at
different scales (or frequencies). Optional features improve the SNR ratio when
the (clean) signal constitute a single cluster of pixels on the image (e.g.
electromagnetic showers produced with Imaging Atmospheric Cherenkov
Telescopes). This library is written in Python and is based on the existing
Cosmostat tools iSAp (Interactive Sparse Astronomical data analysis Packages
http://www.cosmostat.org/software/isap/).
The PyWI library also contains a dedicated package to optimize the image filter
parameters for a given set of images (i.e. to adapt the filter to a specific
problem). From a given training set of images (containing pairs of noised and
clean images) and a given performance estimator (a function that assess the
image filter parameters comparing the cleaned image to the actual clean image),
the optimizer can determine the optimal filtering level for each scale.
The PyWI library contains:
* wavelet transform and wavelet filtering functions for image multiresolution
analysis and filtering;
* additional filter to remove some image components (non-significant pixels
clusters);
* a set of generic filtering performance estimators (MSE, NRMSE, SSIM, PSNR,
image moment's difference), some relying on the scikit-image Python library
(supplementary estimators can be easily added to meet particular needs);
* a graphical user interface to visualize the filtering process in the wavelet
transformed space;
* an Evolution Strategies (ES) algorithm known in the mathematical optimization
community for its good convergence rate on generic derivative-free continuous
global optimization problems (Beyer, H. G. (2013) "The theory of evolution
strategies", Springer Science & Business Media);
* additional tools to manage and monitor the parameter optimization.
Note:
This project is in beta stage.
Viewing documentation using IPython
-----------------------------------
To see which functions are available in `pywi`, type ``pywi.<TAB>`` (where
``<TAB>`` refers to the TAB key), or use ``pywi.*transform*?<ENTER>`` (where
``<ENTER>`` refers to the ENTER key) to narrow down the list. To view the
docstring for a function, use ``pywi.transform?<ENTER>`` (to view the
docstring) and ``pywi.transform??<ENTER>`` (to view the source code).
"""
# PEP0440 compatible formatted version, see:
# https://www.python.org/dev/peps/pep-0440/
#
# Generic release markers:
# X.Y
# X.Y.Z # For bugfix releases
#
# Admissible pre-release markers:
# X.YaN # Alpha release
# X.YbN # Beta release
# X.YrcN # Release Candidate
# X.Y # Final release
#
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
__version__ = '0.3.dev12'
def get_version():
return __version__
# The following lines are temporary commented to avoid BUG#2 (c.f. BUGS.md)
#from . import benchmark
#from . import data
#from . import io
#from . import optimization
#from . import processing
#from . import ui
| 41.482353
| 79
| 0.764322
| 520
| 3,526
| 5.165385
| 0.501923
| 0.005212
| 0.015637
| 0.014147
| 0.036485
| 0.020104
| 0
| 0
| 0
| 0
| 0
| 0.00605
| 0.156268
| 3,526
| 84
| 80
| 41.97619
| 0.896807
| 0.963415
| 0
| 0
| 0
| 0
| 0.094737
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0.333333
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
a5b2b4f331896069894165c8e6677b3ceda5aea4
| 94
|
py
|
Python
|
Exporter Options/merged/DELETE THIS PLS.py
|
Kraypex/Exporter-Options
|
f75d5222762d03f090b97c72077b5712cf807b34
|
[
"MIT"
] | 3
|
2021-11-22T11:55:15.000Z
|
2022-03-25T11:52:07.000Z
|
Exporter Options/merged/DELETE THIS PLS.py
|
Kraypex/Exporter-Options
|
f75d5222762d03f090b97c72077b5712cf807b34
|
[
"MIT"
] | null | null | null |
Exporter Options/merged/DELETE THIS PLS.py
|
Kraypex/Exporter-Options
|
f75d5222762d03f090b97c72077b5712cf807b34
|
[
"MIT"
] | 3
|
2021-11-22T10:25:27.000Z
|
2021-12-27T16:37:21.000Z
|
from time import sleep
print("Hello! Please delete this, also use code Kraypex :))")
sleep(5)
| 23.5
| 61
| 0.734043
| 15
| 94
| 4.6
| 0.933333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0125
| 0.148936
| 94
| 3
| 62
| 31.333333
| 0.85
| 0
| 0
| 0
| 0
| 0
| 0.553191
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
3c0fa44c512a0aaef2780679a2b22a9664ff478e
| 7,271
|
py
|
Python
|
tests/test_pagination.py
|
MichalMilewicz/tungsten-ci-dashboard
|
67ca8e39855009ab7b4d603b691ea910ee6efbbc
|
[
"Apache-2.0"
] | null | null | null |
tests/test_pagination.py
|
MichalMilewicz/tungsten-ci-dashboard
|
67ca8e39855009ab7b4d603b691ea910ee6efbbc
|
[
"Apache-2.0"
] | null | null | null |
tests/test_pagination.py
|
MichalMilewicz/tungsten-ci-dashboard
|
67ca8e39855009ab7b4d603b691ea910ee6efbbc
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
import unittest
from dashboard.history import Paginator, pagination
class TestPagination(unittest.TestCase):
def test_zero_buildsests_should_return_empty_paginator(self):
paginator = pagination(number_of_buildsets=0,
page=1,
per_page=10,
page_links=5)
expected = Paginator(pages=[],
previous_page=None,
next_page=None,
current_page=1)
self.assertEqual(paginator, expected)
def test_negative_buildsets_should_raise_value_error(self):
with self.assertRaises(ValueError):
pagination(number_of_buildsets=-1,
page=1,
per_page=10,
page_links=5)
def test_current_page_first_should_return_no_previous_page(self):
paginator = pagination(number_of_buildsets=100,
page=1,
per_page=20,
page_links=4)
expected = Paginator(pages=[1, 2, 3, 4, 5],
previous_page=None,
next_page=2,
current_page=1)
self.assertEqual(paginator, expected)
def test_current_page_last_should_return_no_next_page(self):
paginator = pagination(number_of_buildsets=100,
page=5,
per_page=20,
page_links=4)
expected = Paginator(pages=[1, 2, 3, 4, 5],
previous_page=4,
next_page=None,
current_page=5)
self.assertEqual(paginator, expected)
def test_200_buildsets_20_per_page_should_return_10_pages(self):
paginator = pagination(number_of_buildsets=200,
page=1,
per_page=20,
page_links=20)
expected = Paginator(pages=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
previous_page=None,
next_page=2,
current_page=1)
self.assertEqual(paginator, expected)
def test_201_buildsets_20_per_page_should_return_11_pages(self):
paginator = pagination(number_of_buildsets=201,
page=1,
per_page=20,
page_links=20)
expected = Paginator(pages=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
previous_page=None,
next_page=2,
current_page=1)
self.assertEqual(paginator, expected)
def test_40_buildsets_10_per_page_should_return_4_pages(self):
paginator = pagination(number_of_buildsets=40,
page=1,
per_page=10,
page_links=10)
expected = Paginator(pages=[1, 2, 3, 4],
previous_page=None,
next_page=2,
current_page=1)
self.assertEqual(paginator, expected)
def test_45_buildsets_10_per_page_should_return_5_pages(self):
paginator = pagination(number_of_buildsets=45,
page=1,
per_page=10,
page_links=10)
expected = Paginator(pages=[1, 2, 3, 4, 5],
previous_page=None,
next_page=2,
current_page=1)
self.assertEqual(paginator, expected)
def test_current_page_5_of_10_should_return_previus_and_next_page(self):
paginator = pagination(number_of_buildsets=100,
page=5,
per_page=10,
page_links=5)
expected = Paginator(pages=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
previous_page=4,
next_page=6,
current_page=5)
self.assertEqual(paginator, expected)
def test_5_page_links_on_page_10_should_return_5_prev_and_next_pages(self):
paginator = pagination(number_of_buildsets=400,
page=10,
per_page=20,
page_links=5)
expected = Paginator(pages=[1, None, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, None, 20],
previous_page=9,
next_page=11,
current_page=10)
self.assertEqual(paginator, expected)
def test_3_pages_links_on_page_5_should_return_3_prev_and_next_pages(self):
paginator = pagination(number_of_buildsets=400,
page=5,
per_page=20,
page_links=3)
expected = Paginator(pages=[1, None, 2, 3, 4, 5, 6, 7, 8, None, 20],
previous_page=4,
next_page=6,
current_page=5)
self.assertEqual(paginator, expected)
def test_current_page_zero_should_raise_value_error(self):
with self.assertRaises(ValueError):
pagination(number_of_buildsets=200,
page=0,
per_page=20,
page_links=5)
def test_per_page_is_zero_should_raise_value_error(self):
with self.assertRaises(ValueError):
pagination(number_of_buildsets=200,
page=1,
per_page=0,
page_links=5)
def test_per_page_is_negative_should_raise_value_error(self):
with self.assertRaises(ValueError):
pagination(number_of_buildsets=200,
page=1,
per_page=-5,
page_links=5)
def test_page_is_none_should_raise_type_error(self):
with self.assertRaises(TypeError):
pagination(number_of_buildsets=200,
page=None,
per_page=10,
page_links=5)
def test_number_of_buildsets_is_none_should_raise_type_error(self):
with self.assertRaises(TypeError):
pagination(number_of_buildsets=None,
page=1,
per_page=10,
page_links=5)
def test_per_page_is_none_should_raise_type_error(self):
with self.assertRaises(TypeError):
pagination(number_of_buildsets=200,
page=1,
per_page=None,
page_links=5)
def test_page_links_is_none_should_raise_type_error(self):
with self.assertRaises(TypeError):
pagination(number_of_buildsets=200,
page=1,
per_page=10,
page_links=None)
| 39.091398
| 79
| 0.491267
| 737
| 7,271
| 4.496608
| 0.09905
| 0.052806
| 0.097465
| 0.146651
| 0.865419
| 0.843693
| 0.766747
| 0.695836
| 0.666566
| 0.595353
| 0
| 0.063574
| 0.439692
| 7,271
| 185
| 80
| 39.302703
| 0.749877
| 0.002888
| 0
| 0.703947
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.118421
| 1
| 0.118421
| false
| 0
| 0.013158
| 0
| 0.138158
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.