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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bdf14975d6521c1daf5a7ef9a7ee88fad5142051
| 538
|
py
|
Python
|
application/mod_default/forms.py
|
calitaz/logisticdemandsflask
|
a15d30ddd91a629fd23d94a42b9ec47c3b5b9755
|
[
"MIT"
] | null | null | null |
application/mod_default/forms.py
|
calitaz/logisticdemandsflask
|
a15d30ddd91a629fd23d94a42b9ec47c3b5b9755
|
[
"MIT"
] | null | null | null |
application/mod_default/forms.py
|
calitaz/logisticdemandsflask
|
a15d30ddd91a629fd23d94a42b9ec47c3b5b9755
|
[
"MIT"
] | null | null | null |
# Import forms dependences
from flask_wtf import FlaskForm
from wtforms import IntegerField, DecimalField
from wtforms.validators import DataRequired
# Define SMA / MMS form
class SMAForm(FlaskForm):
base = IntegerField('base', validators=[DataRequired("Type the base of evaluation/Digite a base de avaliação")])
period = IntegerField('period', validators=[DataRequired("Type the period /Digite o periodo")])
demand = DecimalField('demand', validators=[DataRequired("Type the demand /Digite a demanda para este periodo")])
| 41.384615
| 117
| 0.771375
| 65
| 538
| 6.369231
| 0.523077
| 0.15942
| 0.188406
| 0.210145
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.135688
| 538
| 12
| 118
| 44.833333
| 0.890323
| 0.085502
| 0
| 0
| 0
| 0
| 0.315574
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.428571
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
bdf3f6999a59426ef47dbde77b810ac60c9c1d94
| 225
|
py
|
Python
|
cbpos/uihandler.py
|
juliustip/cb
|
e57470694314f37e1ed090fd94ae438f4f7c8093
|
[
"MIT"
] | 1
|
2017-10-09T17:31:29.000Z
|
2017-10-09T17:31:29.000Z
|
cbpos/uihandler.py
|
juliustip/cb
|
e57470694314f37e1ed090fd94ae438f4f7c8093
|
[
"MIT"
] | null | null | null |
cbpos/uihandler.py
|
juliustip/cb
|
e57470694314f37e1ed090fd94ae438f4f7c8093
|
[
"MIT"
] | 3
|
2015-08-20T11:44:55.000Z
|
2021-03-17T15:37:57.000Z
|
class BaseUIHandler(object):
def handle_first_run(self):
pass
def init(self):
raise NotImplementedError('No UI handler specified!')
return False
def start(self):
return 1
| 20.454545
| 61
| 0.604444
| 25
| 225
| 5.36
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006536
| 0.32
| 225
| 10
| 62
| 22.5
| 0.869281
| 0
| 0
| 0
| 0
| 0
| 0.106667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.375
| false
| 0.125
| 0
| 0.125
| 0.75
| 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
| 1
| 0
| 1
| 0
| 0
|
0
| 4
|
da1a66b4d77b7ba51689e636096b43e52bc0b90a
| 139
|
py
|
Python
|
curso/models.py
|
latreta/dvestagio
|
d18f7c7184748c7b88e335ae9ffd2bdcc197d14f
|
[
"MIT"
] | null | null | null |
curso/models.py
|
latreta/dvestagio
|
d18f7c7184748c7b88e335ae9ffd2bdcc197d14f
|
[
"MIT"
] | null | null | null |
curso/models.py
|
latreta/dvestagio
|
d18f7c7184748c7b88e335ae9ffd2bdcc197d14f
|
[
"MIT"
] | null | null | null |
from django.db import models
# Create your models here.
class Curso(models.Model):
nome = models.CharField(max_length=100,unique=True)
| 27.8
| 55
| 0.769784
| 21
| 139
| 5.047619
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.024793
| 0.129496
| 139
| 5
| 55
| 27.8
| 0.85124
| 0.172662
| 0
| 0
| 0
| 0
| 0
| 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
|
da27510153443bf188e25bd3413d9e832423d877
| 42
|
py
|
Python
|
start/Intro to Lists/fix01/fixup2.py
|
codermoji-contrib/python
|
764bffaf0e92270be196aa5728f255aaaf5b8150
|
[
"MIT"
] | null | null | null |
start/Intro to Lists/fix01/fixup2.py
|
codermoji-contrib/python
|
764bffaf0e92270be196aa5728f255aaaf5b8150
|
[
"MIT"
] | null | null | null |
start/Intro to Lists/fix01/fixup2.py
|
codermoji-contrib/python
|
764bffaf0e92270be196aa5728f255aaaf5b8150
|
[
"MIT"
] | null | null | null |
items = ['water', 1, 'food']
print(items)
| 14
| 28
| 0.595238
| 6
| 42
| 4.166667
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.027778
| 0.142857
| 42
| 2
| 29
| 21
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0.214286
| 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
|
da45d8b62434ee193cad9d23200a7c52c558d0a8
| 115
|
py
|
Python
|
blog/urls.py
|
HyunJW/Article-writing-advice-system-based-on-GPT2-language-model
|
9abfa7ed02f2d4120883b09011bf7dafa3c3ade0
|
[
"Apache-2.0"
] | 1
|
2020-05-23T08:42:39.000Z
|
2020-05-23T08:42:39.000Z
|
blog/urls.py
|
ahnyujin/Django-proj
|
002c18c8a5c61bf6a4ae8ae7c56bc276afebf2d2
|
[
"Apache-2.0"
] | null | null | null |
blog/urls.py
|
ahnyujin/Django-proj
|
002c18c8a5c61bf6a4ae8ae7c56bc276afebf2d2
|
[
"Apache-2.0"
] | null | null | null |
from django.urls import path
from . import views
urlpatterns = [
path('', views.post_list, name='post_list'),
]
| 23
| 48
| 0.704348
| 16
| 115
| 4.9375
| 0.625
| 0.202532
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.156522
| 115
| 5
| 49
| 23
| 0.814433
| 0
| 0
| 0
| 0
| 0
| 0.077586
| 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
|
da7ec7e2ca1870196c6d605a1c4bcae9be3dea00
| 622
|
py
|
Python
|
lusee/__init__.py
|
lusee-night/luseepy
|
064a72ac1fb9635d428da1889f2e5ed429707c24
|
[
"MIT"
] | null | null | null |
lusee/__init__.py
|
lusee-night/luseepy
|
064a72ac1fb9635d428da1889f2e5ed429707c24
|
[
"MIT"
] | 5
|
2022-02-11T09:08:55.000Z
|
2022-02-17T10:17:00.000Z
|
lusee/__init__.py
|
lusee-night/luseepy
|
064a72ac1fb9635d428da1889f2e5ed429707c24
|
[
"MIT"
] | null | null | null |
# -- FIXME --
# -mxp- commented out imports since the hardcoded cache breaks
# execution on Singularity and otherwise has undesirable side
# effects. There is a separate cache in the LunarCalendar class
# now, which can be propagated to other modules. It behaves
# gracefully e.g. optionally cleaned up, has db name capability etc.
#from . import lunar_calendar as calendar
from .observation import LObservation
from .lunar_satellite import LSatellite, ObservedSatellite
from .LBeam import LBeam, grid2healpix
from .simulation import Simulator
from . import sky_models as sky
from . import mono_sky_models as monosky
| 36.588235
| 68
| 0.797428
| 87
| 622
| 5.643678
| 0.735632
| 0.0611
| 0.044807
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.001905
| 0.155949
| 622
| 16
| 69
| 38.875
| 0.933333
| 0.57717
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0625
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
da892f2f8a6bd538464c45d23066d4f398ce5b34
| 41
|
py
|
Python
|
upto7-12-2020/nameing.py
|
nikhilsamninan/python-files
|
15198459081097058a939b40b5e8ef754e578fe0
|
[
"Apache-2.0"
] | null | null | null |
upto7-12-2020/nameing.py
|
nikhilsamninan/python-files
|
15198459081097058a939b40b5e8ef754e578fe0
|
[
"Apache-2.0"
] | null | null | null |
upto7-12-2020/nameing.py
|
nikhilsamninan/python-files
|
15198459081097058a939b40b5e8ef754e578fe0
|
[
"Apache-2.0"
] | null | null | null |
p=(input("enter The word"))
print(p[-1])
| 13.666667
| 27
| 0.609756
| 8
| 41
| 3.125
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.027027
| 0.097561
| 41
| 2
| 28
| 20.5
| 0.648649
| 0
| 0
| 0
| 0
| 0
| 0.341463
| 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
|
da8f36147e9332ad7023bef5a72bc53b89bc7206
| 587
|
py
|
Python
|
server/app/settings.py
|
edwinzhng/contract-scan-dash
|
d923b0b618eba558dba70ffd0838909a657ecbe4
|
[
"MIT"
] | null | null | null |
server/app/settings.py
|
edwinzhng/contract-scan-dash
|
d923b0b618eba558dba70ffd0838909a657ecbe4
|
[
"MIT"
] | null | null | null |
server/app/settings.py
|
edwinzhng/contract-scan-dash
|
d923b0b618eba558dba70ffd0838909a657ecbe4
|
[
"MIT"
] | null | null | null |
import os
from pydantic import BaseSettings
class Settings(BaseSettings):
telegram_webhook_host = os.environ.get("TELEGRAM_WEBHOOK_HOST")
telegram_bot_token: str = os.environ.get("TELEGRAM_BOT_TOKEN")
ftmscan_api_key: str = os.environ.get("FTMSCAN_API_KEY")
scrape_sleep_sec: int = os.environ.get("SCRAPE_SLEEP_SEC")
postgres_db: str = os.environ.get("POSTGRES_DB")
postgres_user: str = os.environ.get("POSTGRES_USER")
postgres_pw: str = os.environ.get("POSTGRES_PASSWORD")
postgres_port: int = os.environ.get("POSTGRES_PORT")
settings = Settings()
| 30.894737
| 67
| 0.746167
| 82
| 587
| 5.04878
| 0.341463
| 0.173913
| 0.231884
| 0.181159
| 0.166667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.136286
| 587
| 18
| 68
| 32.611111
| 0.816568
| 0
| 0
| 0
| 0
| 0
| 0.211244
| 0.035775
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.083333
| 0.166667
| 0
| 0.916667
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
da91b1f57e265258ebca982e5d37a92a3dbb8566
| 30
|
py
|
Python
|
bin/resource.py
|
hazzashirt/obsidian-service
|
fdc617900eb9390f36c18a5c3de3f277c84feff5
|
[
"BSD-2-Clause"
] | null | null | null |
bin/resource.py
|
hazzashirt/obsidian-service
|
fdc617900eb9390f36c18a5c3de3f277c84feff5
|
[
"BSD-2-Clause"
] | null | null | null |
bin/resource.py
|
hazzashirt/obsidian-service
|
fdc617900eb9390f36c18a5c3de3f277c84feff5
|
[
"BSD-2-Clause"
] | null | null | null |
# people
# locations
# tools
| 10
| 12
| 0.666667
| 3
| 30
| 6.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.233333
| 30
| 3
| 13
| 10
| 0.869565
| 0.733333
| 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
|
16f5fb90523db1a3818adddd2872a243522378ae
| 2,068
|
py
|
Python
|
chat_wars_database/app/business_exchange/migrations/0002_statsbyday.py
|
ricardochaves/chat-wars-database
|
597f192fb6ddf290c6c7477cf8c7d0ca654925f6
|
[
"MIT"
] | 1
|
2019-12-30T19:16:52.000Z
|
2019-12-30T19:16:52.000Z
|
chat_wars_database/app/business_exchange/migrations/0002_statsbyday.py
|
ricardochaves/chat-wars-database
|
597f192fb6ddf290c6c7477cf8c7d0ca654925f6
|
[
"MIT"
] | null | null | null |
chat_wars_database/app/business_exchange/migrations/0002_statsbyday.py
|
ricardochaves/chat-wars-database
|
597f192fb6ddf290c6c7477cf8c7d0ca654925f6
|
[
"MIT"
] | null | null | null |
# Generated by Django 3.0.1 on 2019-12-30 21:15
import django.db.models.deletion
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [("business_core", "0003_auto_20191230_2115"), ("business_exchange", "0001_initial")]
operations = [
migrations.CreateModel(
name="StatsByDay",
fields=[
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("date", models.DateField()),
("units", models.IntegerField()),
("average_value", models.DecimalField(decimal_places=2, max_digits=8)),
("mean_value", models.IntegerField()),
("min_value", models.IntegerField()),
("max_value", models.IntegerField()),
("deerhorn_castle_seller", models.IntegerField(default=0)),
("dragonscale_castle_seller", models.IntegerField(default=0)),
("highnest_castle_seller", models.IntegerField(default=0)),
("moonlight_castle_seller", models.IntegerField(default=0)),
("potato_castle_seller", models.IntegerField(default=0)),
("sharkteeth_castle_seller", models.IntegerField(default=0)),
("wolfpack_castle_seller", models.IntegerField(default=0)),
("deerhorn_castle_buyer", models.IntegerField(default=0)),
("dragonscale_castle_buyer", models.IntegerField(default=0)),
("highnest_castle_buyer", models.IntegerField(default=0)),
("moonlight_castle_buyer", models.IntegerField(default=0)),
("potato_castle_buyer", models.IntegerField(default=0)),
("sharkteeth_castle_buyer", models.IntegerField(default=0)),
("wolfpack_castle_buyer", models.IntegerField(default=0)),
("item", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="business_core.Item")),
],
)
]
| 50.439024
| 114
| 0.619923
| 202
| 2,068
| 6.123762
| 0.371287
| 0.261924
| 0.282943
| 0.29426
| 0.508488
| 0.508488
| 0
| 0
| 0
| 0
| 0
| 0.03263
| 0.244197
| 2,068
| 40
| 115
| 51.7
| 0.758797
| 0.02176
| 0
| 0
| 1
| 0
| 0.22761
| 0.144978
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.088235
| 0
| 0.176471
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
16fc99d7435f927a8a4760669cdf8ed7af76c6da
| 167
|
py
|
Python
|
les-1/perkavic/2-12.py
|
AtlasDev/TICT-V1PROG-15
|
9595300fce48f18b643d60629db3821487c1a7b6
|
[
"MIT"
] | 6
|
2016-09-12T19:21:29.000Z
|
2018-09-02T18:36:37.000Z
|
les-1/perkavic/2-12.py
|
AtlasDev/TICT-V1PROG-15
|
9595300fce48f18b643d60629db3821487c1a7b6
|
[
"MIT"
] | null | null | null |
les-1/perkavic/2-12.py
|
AtlasDev/TICT-V1PROG-15
|
9595300fce48f18b643d60629db3821487c1a7b6
|
[
"MIT"
] | null | null | null |
import math;
# A
print(1 + 2 + 3 + 4 + 5 + 6 + 7);
# B
print(round((65 + 57 + 45) / 3));
# C
print(math.pow(2, 20));
# D
print(4356 // 61);
# E
print(4365 % 61);
| 9.823529
| 33
| 0.48503
| 32
| 167
| 2.53125
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.237705
| 0.269461
| 167
| 16
| 34
| 10.4375
| 0.42623
| 0.053892
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.166667
| 0
| 0.166667
| 0.833333
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
16fddbf3cc34a12774b5a92b7060c110f851bbb2
| 1,264
|
py
|
Python
|
wdim/orm/query.py
|
chrisseto/Still
|
3e4df26b824227472e5f487905779deafc76b4dd
|
[
"MIT"
] | null | null | null |
wdim/orm/query.py
|
chrisseto/Still
|
3e4df26b824227472e5f487905779deafc76b4dd
|
[
"MIT"
] | null | null | null |
wdim/orm/query.py
|
chrisseto/Still
|
3e4df26b824227472e5f487905779deafc76b4dd
|
[
"MIT"
] | null | null | null |
import abc
class BaseQuery(abc.ABC):
def __and__(self, other):
return And(self, other)
def __or__(self, other):
return Or(self, other)
def __add__(self, other):
return self & other
class JointQuery(BaseQuery, metaclass=abc.ABCMeta):
@property
def queries(self):
return self._queries
def __init__(self, *queries):
self._queries = queries
def __iter__(self):
return self.queries
def __repr__(self):
return '<{}({})>'.format(
self.__class__.__name__,
', '.join([q.__repr__() for q in self.queries])
)
def __str__(self):
return self.__repr__()
class Query(BaseQuery, metaclass=abc.ABCMeta):
@property
def name(self):
return self._name
@property
def value(self):
return self._value
def __init__(self, field, value):
self._field = field
self._name = field._name
self._value = field.parse(value)
def __repr__(self):
return '<{}({}, {!r})>'.format(self.__class__.__name__, self.name, self.value)
def __str__(self):
return self.__repr__()
class Equals(Query):
pass
class And(JointQuery):
pass
class Or(JointQuery):
pass
| 18.057143
| 86
| 0.596519
| 145
| 1,264
| 4.675862
| 0.227586
| 0.117994
| 0.123894
| 0.082596
| 0.271386
| 0.20059
| 0.085546
| 0
| 0
| 0
| 0
| 0
| 0.281646
| 1,264
| 69
| 87
| 18.318841
| 0.746696
| 0
| 0
| 0.272727
| 0
| 0
| 0.018987
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.295455
| false
| 0.068182
| 0.022727
| 0.25
| 0.704545
| 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
|
e50f8a60deb191f5c2260c4222fec78c7e51bc60
| 713
|
py
|
Python
|
test/functions/lambda3.py
|
kylebarron/MagicPython
|
da6fa0793e2c85d3bf7709ff1d4f65ccf468db11
|
[
"MIT"
] | 1,482
|
2015-10-16T21:59:32.000Z
|
2022-03-30T11:44:40.000Z
|
test/functions/lambda3.py
|
kylebarron/MagicPython
|
da6fa0793e2c85d3bf7709ff1d4f65ccf468db11
|
[
"MIT"
] | 226
|
2015-10-15T15:53:44.000Z
|
2022-03-25T03:08:27.000Z
|
test/functions/lambda3.py
|
kylebarron/MagicPython
|
da6fa0793e2c85d3bf7709ff1d4f65ccf468db11
|
[
"MIT"
] | 129
|
2015-10-20T02:41:49.000Z
|
2022-03-22T01:44:36.000Z
|
anon = lambda lambda: 42
anon : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
lambda : meta.lambda-function.python, source.python, storage.type.function.lambda.python
: meta.function.lambda.parameters.python, meta.lambda-function.python, source.python
lambda : meta.function.lambda.parameters.python, meta.lambda-function.python, source.python, storage.type.function.lambda.python
: : meta.lambda-function.python, punctuation.section.function.lambda.begin.python, source.python
: source.python
42 : constant.numeric.dec.python, source.python
| 47.533333
| 135
| 0.673212
| 78
| 713
| 6.153846
| 0.24359
| 0.25
| 0.3375
| 0.2
| 0.695833
| 0.504167
| 0.504167
| 0.504167
| 0.504167
| 0.504167
| 0
| 0.00722
| 0.223001
| 713
| 14
| 136
| 50.928571
| 0.859206
| 0
| 0
| 0.272727
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
e531d824abbcc5d33c9e24616b212ac2e1f9e390
| 208
|
py
|
Python
|
tests/model/test_direction.py
|
jonashellmann/informaticup21-team-chillow
|
f2e519af0a5d9a9368d62556703cfb1066ebb58f
|
[
"MIT"
] | 3
|
2021-01-17T23:32:07.000Z
|
2022-01-30T14:49:16.000Z
|
tests/model/test_direction.py
|
jonashellmann/informaticup21-team-chillow
|
f2e519af0a5d9a9368d62556703cfb1066ebb58f
|
[
"MIT"
] | 2
|
2021-01-17T13:37:56.000Z
|
2021-04-14T12:28:49.000Z
|
tests/model/test_direction.py
|
jonashellmann/informaticup21-team-chillow
|
f2e519af0a5d9a9368d62556703cfb1066ebb58f
|
[
"MIT"
] | 2
|
2021-04-02T14:53:38.000Z
|
2021-04-20T11:10:17.000Z
|
import unittest
from chillow.model.direction import Direction
class DirectionTest(unittest.TestCase):
def test_should_have_four_different_directions(self):
self.assertEqual(len(Direction), 4)
| 20.8
| 57
| 0.793269
| 25
| 208
| 6.4
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005556
| 0.134615
| 208
| 9
| 58
| 23.111111
| 0.883333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| 1
| 0.2
| 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
|
e55521627e9499934a37781d50c0379eeda2365a
| 172
|
py
|
Python
|
src/stagemodel/__init__.py
|
ramittal/stagemodel
|
9d8df177860ed5077a27c072ba1936c6864fad47
|
[
"BSD-2-Clause"
] | null | null | null |
src/stagemodel/__init__.py
|
ramittal/stagemodel
|
9d8df177860ed5077a27c072ba1936c6864fad47
|
[
"BSD-2-Clause"
] | 2
|
2021-01-04T18:50:00.000Z
|
2021-10-24T00:06:23.000Z
|
src/stagemodel/__init__.py
|
ramittal/stagemodel
|
9d8df177860ed5077a27c072ba1936c6864fad47
|
[
"BSD-2-Clause"
] | 1
|
2020-12-14T23:26:52.000Z
|
2020-12-14T23:26:52.000Z
|
from .node_model import OverallModel, StudyModel
from .composite_model import StagewiseModel, TwoStageModel, ReverseTwoStageModel
from .utils import solve_ls, result_to_df
| 43
| 80
| 0.866279
| 21
| 172
| 6.857143
| 0.761905
| 0.152778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.093023
| 172
| 3
| 81
| 57.333333
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
e5857c87731d4d16645528c08e9a1b7001c234ff
| 98
|
py
|
Python
|
src/api/admin.py
|
lerdem/chart
|
b152426e9a218b3d1c2acc5e0cea5cd8c52d1f8d
|
[
"Apache-2.0"
] | null | null | null |
src/api/admin.py
|
lerdem/chart
|
b152426e9a218b3d1c2acc5e0cea5cd8c52d1f8d
|
[
"Apache-2.0"
] | null | null | null |
src/api/admin.py
|
lerdem/chart
|
b152426e9a218b3d1c2acc5e0cea5cd8c52d1f8d
|
[
"Apache-2.0"
] | null | null | null |
from django.contrib import admin
from .models import RandomData
admin.site.register(RandomData)
| 16.333333
| 32
| 0.826531
| 13
| 98
| 6.230769
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.112245
| 98
| 6
| 33
| 16.333333
| 0.931034
| 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
|
e5b58971eeeef02bfcba4b3766c0055bc239ffb8
| 145
|
py
|
Python
|
logger.py
|
Kevin-Luk-Hub/twitter-test
|
63d2726d568cac866364ef4a66f293764e338bd7
|
[
"MIT"
] | null | null | null |
logger.py
|
Kevin-Luk-Hub/twitter-test
|
63d2726d568cac866364ef4a66f293764e338bd7
|
[
"MIT"
] | null | null | null |
logger.py
|
Kevin-Luk-Hub/twitter-test
|
63d2726d568cac866364ef4a66f293764e338bd7
|
[
"MIT"
] | null | null | null |
import logging
logging.basicConfig(filename='test.log', level=logging.INFO,
format='%(asctime)s:%(levelname)s:%(message)s')
| 29
| 67
| 0.648276
| 17
| 145
| 5.529412
| 0.764706
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.17931
| 145
| 4
| 68
| 36.25
| 0.789916
| 0
| 0
| 0
| 0
| 0
| 0.310345
| 0.255172
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
f913e6fd2d6dca483273e497f9bb358d685880a7
| 55
|
py
|
Python
|
Tests/Runnable1/r_pythonapi_t.py
|
jwilk/Pyrex
|
83dfbae1261788933472e3f9c501ad74c61a37c5
|
[
"Apache-2.0"
] | 5
|
2019-05-26T20:48:36.000Z
|
2021-07-09T01:38:38.000Z
|
Tests/Runnable1/r_pythonapi_t.py
|
jwilk/Pyrex
|
83dfbae1261788933472e3f9c501ad74c61a37c5
|
[
"Apache-2.0"
] | null | null | null |
Tests/Runnable1/r_pythonapi_t.py
|
jwilk/Pyrex
|
83dfbae1261788933472e3f9c501ad74c61a37c5
|
[
"Apache-2.0"
] | 1
|
2022-02-10T07:14:58.000Z
|
2022-02-10T07:14:58.000Z
|
from r_pythonapi import spam
x = spam()
print repr(x)
| 11
| 28
| 0.727273
| 10
| 55
| 3.9
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 55
| 4
| 29
| 13.75
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.333333
| null | null | 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
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
f9154e805e7e4bb2f179eabec87b6d8ee12219fc
| 133
|
py
|
Python
|
flow54/__init__.py
|
corygoates/Flow54
|
d24fe113afb932df6a910b560c6d491693b87592
|
[
"MIT"
] | null | null | null |
flow54/__init__.py
|
corygoates/Flow54
|
d24fe113afb932df6a910b560c6d491693b87592
|
[
"MIT"
] | null | null | null |
flow54/__init__.py
|
corygoates/Flow54
|
d24fe113afb932df6a910b560c6d491693b87592
|
[
"MIT"
] | null | null | null |
from flow54.diamond_airfoil import DiamondAirfoil
import flow54.compressible_tools as compressible_tools
from flow54.cone import Cone
| 44.333333
| 54
| 0.894737
| 18
| 133
| 6.444444
| 0.555556
| 0.172414
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.04918
| 0.082707
| 133
| 3
| 55
| 44.333333
| 0.901639
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
f925923e62565f3d9391d917521f4f8cc49a6ba8
| 62,255
|
py
|
Python
|
fgfa_rfcn/core/tester_online.py
|
sdroh1027/track_to_learn
|
26dc83328bd29612a80e7d2429cdfd32926d0af6
|
[
"MIT"
] | null | null | null |
fgfa_rfcn/core/tester_online.py
|
sdroh1027/track_to_learn
|
26dc83328bd29612a80e7d2429cdfd32926d0af6
|
[
"MIT"
] | null | null | null |
fgfa_rfcn/core/tester_online.py
|
sdroh1027/track_to_learn
|
26dc83328bd29612a80e7d2429cdfd32926d0af6
|
[
"MIT"
] | null | null | null |
from multiprocessing.pool import ThreadPool as Pool
import cPickle
import os
import time
import mxnet as mx
import numpy as np
import math
import dill
from module import MutableModule
from utils import image
from bbox.bbox_transform import bbox_pred, clip_boxes
from nms.nms import py_nms_wrapper, cpu_nms_wrapper, gpu_nms_wrapper
from nms.seq_nms import seq_nms
from utils.PrefetchingIter import PrefetchingIter
from collections import deque
from instance import Instance
from tester import get_resnet_output, draw_all_detection, prepare_data
import logging
logger = logging.getLogger("lgr")
def roi_crop_embed(img_height, img_width, pred_boxes, cur_embed, cfg):
# using cur_embed & bbox_pred, make new instance wise embed layer
# bbox_pred[4:8] has (x1,y1) (x2,y2) coordinates
scale_h = cur_embed.shape[2] / img_height
scale_w = cur_embed.shape[3] / img_width
zeros = np.zeros([300, 1])
pred_boxes_on_feat = np.zeros([300, 4])
pred_boxes_on_feat[:, 0] = pred_boxes[:, 0] * scale_w # x1
pred_boxes_on_feat[:, 1] = pred_boxes[:, 1] * scale_h # y1
pred_boxes_on_feat[:, 2] = pred_boxes[:, 2] * scale_w # x2
pred_boxes_on_feat[:, 3] = pred_boxes[:, 3] * scale_h # y2
pred_boxes_on_feat = clip_boxes(pred_boxes_on_feat, cur_embed.shape[-2:])
pred_boxes_on_feat = np.hstack((zeros, pred_boxes_on_feat[:, 0:]))
pred_boxes_on_feat = mx.nd.array(pred_boxes_on_feat, mx.gpu())
sym_bbox = mx.sym.Variable('bbox_with_delta')
sym_cur_embed = mx.sym.Variable('cur_embed')
#new_embed = mx.sym.ROIPooling(data=sym_cur_embed, rois=sym_bbox, pooled_size=(cfg.TEST.EMBED_SIZE, cfg.TEST.EMBED_SIZE),
# spatial_scale=1.0, name='new_embed')
new_embed = mx.sym.contrib.ROIAlign(data=sym_cur_embed, rois=sym_bbox,
pooled_size=(cfg.TEST.EMBED_SIZE, cfg.TEST.EMBED_SIZE),
spatial_scale=1.0, name='new_embed')
new_embed_normalized = mx.sym.L2Normalization(data=new_embed, mode='channel', name='new_embed_normalized')
ex = new_embed_normalized.bind(mx.gpu(), {'cur_embed': cur_embed, 'bbox_with_delta': pred_boxes_on_feat})
cropped_embed = ex.forward()
return cropped_embed[0]
def roi_crop_embed_nd(img_height, img_width, pred_boxes, cur_embed, cfg):
# using cur_embed & bbox_pred, make new instance wise embed layer
# bbox_pred[4:8] has (x1,y1) (x2,y2) coordinates
scale_h = cur_embed.shape[2] / img_height
scale_w = cur_embed.shape[3] / img_width
zeros = np.zeros([300, 1])
pred_boxes_on_feat = np.zeros([300, 4])
pred_boxes_on_feat[:, 0] = pred_boxes[:, 0] * scale_w # x1
pred_boxes_on_feat[:, 1] = pred_boxes[:, 1] * scale_h # y1
pred_boxes_on_feat[:, 2] = pred_boxes[:, 2] * scale_w # x2
pred_boxes_on_feat[:, 3] = pred_boxes[:, 3] * scale_h # y2
pred_boxes_on_feat = clip_boxes(pred_boxes_on_feat, cur_embed.shape[-2:])
pred_boxes_on_feat = np.hstack((zeros, pred_boxes_on_feat[:, 0:]))
pred_boxes_on_feat = mx.nd.array(pred_boxes_on_feat, mx.gpu())
new_embed = mx.nd.contrib.ROIAlign(data=cur_embed, rois=pred_boxes_on_feat,
pooled_size=(cfg.TEST.EMBED_SIZE, cfg.TEST.EMBED_SIZE),
spatial_scale=1.0, name='new_embed')
new_embed_normalized = mx.nd.L2Normalization(data=new_embed, mode='channel', name='new_embed_normalized')
return new_embed_normalized
def im_detect_all(predictor, data_batch, data_names, scales, cfg):
output_all = predictor.predict(data_batch)
data_dict_all = [dict(zip(data_names, data_batch.data[i])) for i in xrange(len(data_batch.data))]
scores_all = []
pred_boxes_all = []
iscores_all = [] # instance prediction
ipred_boxes_all = [] # instance prediction
rois_all = []
cropped_embeds_all = []
psroipooled_cls_rois_all = []
# for debugging
# cur_embeds_all = [] #
# new_embeds_all = [] #
# sliced_all = [] #
for output, data_dict, scale in zip(output_all, data_dict_all, scales):
if cfg.TEST.HAS_RPN:
rois = output['rois_output'].asnumpy()[:, 1:]
else:
rois = data_dict['rois'].asnumpy().reshape((-1, 5))[:, 1:]
im_shape = data_dict['data'].shape
# save output
scores = output['cls_prob_reshape_output'].asnumpy()[0]
bbox_deltas = output['bbox_pred_reshape_output'].asnumpy()[0]
iscores = output['inst_prob_reshape_output'].asnumpy()[0]
ibbox_deltas = output['ibbox_pred_reshape_output'].asnumpy()[0]
cur_embed = output['cur_embed_output']
psroipooled_cls_rois_nd = output['psroipooled_cls_rois_output']
#unnormalize_weight = output['unnormalize_weight_output']
#new_embed = output['new_embed_output'].asnumpy()[0]
#sliced = output['sliced_bbox_output'].asnumpy()[0]
# post processing
pred_boxes = bbox_pred(rois, bbox_deltas)
pred_boxes = clip_boxes(pred_boxes, im_shape[-2:]) # Clip boxes to image boundaries.
ipred_boxes = bbox_pred(rois, ibbox_deltas)
ipred_boxes = clip_boxes(ipred_boxes, im_shape[-2:])
# for cropping, scale pred boxes to size of embed feature
img_height =data_batch.data[0][1][0][0].asnumpy()
img_width =data_batch.data[0][1][0][1].asnumpy()
cropped_embed = roi_crop_embed_nd(img_height, img_width, rois, cur_embed, cfg) #nd_array is faster
cropped_embed = cropped_embed.asnumpy()
# we used scaled image & roi to train, so it is necessary to transform them back
pred_boxes = pred_boxes / scale
ipred_boxes = ipred_boxes / scale
scores_all.append(scores)
pred_boxes_all.append(pred_boxes)
iscores_all.append(iscores)
ipred_boxes_all.append(ipred_boxes)
rois_all.append(rois)
#cur_embeds_all.append(cur_embed)
#new_embeds_all.append(new_embed)
#sliced_all.append(sliced)
cropped_embeds_all.append(cropped_embed)
psroipooled_cls_rois_all.append(psroipooled_cls_rois_nd)
debug = 0
if debug is True:
cur_embed = cur_embed.asnumpy()[0]
feat_cache = output['feat_cache'].asnumpy()[0]
#plot_tensor(cur_embed, 16)
#plot_tensor(feat_cache, 16)
return zip(scores_all, pred_boxes_all, rois_all, data_dict_all, iscores_all, ipred_boxes_all, cropped_embeds_all, psroipooled_cls_rois_all)
def pred_eval_ot(gpu_id, feat_predictors, aggr_predictors, test_data, imdb, cfg, vis=False, thresh=1e-3, logger=None, ignore_cache=True):
"""
wrapper for calculating offline validation for faster data analysis
in this example, all threshold are set by hand
:param predictor: Predictor
:param test_data: data iterator, must be non-shuffle
:param imdb: image database
:param vis: controls visualization
:param thresh: valid detection threshold
:return:
"""
det_file = os.path.join(imdb.result_path, imdb.name + '_'+ str(gpu_id))
if cfg.TEST.SEQ_NMS == True:
det_file += '_raw'
print 'det_file=',det_file
if os.path.exists(det_file) and not ignore_cache:
with open(det_file, 'rb') as fid:
all_boxes, frame_ids = cPickle.load(fid)
return all_boxes, frame_ids
assert vis or not test_data.shuffle
data_names = [k[0] for k in test_data.provide_data[0]]
num_images = test_data.size
roidb_frame_ids = [x['frame_id'] for x in test_data.roidb]
if not isinstance(test_data, PrefetchingIter):
test_data = PrefetchingIter(test_data)
nms = py_nms_wrapper(cfg.TEST.NMS)
# limit detections to max_per_image over all classes
max_per_image = cfg.TEST.max_per_image
# all detections are collected into:
# all_boxes[cls][image] = N x 5 array of detections in
# (x1, y1, x2, y2, score)
all_boxes = [[[] for _ in range(num_images)]
for _ in range(imdb.num_classes)]
all_boxes_inst = [[[] for _ in range(num_images)]
for _ in range(imdb.num_classes)]
frame_ids = np.zeros(num_images, dtype=np.int)
roidb_idx = -1
roidb_offset = -1
idx = 0
all_frame_interval = cfg.TEST.KEY_FRAME_INTERVAL * 2 + 1
data_time, net_time, post_time,seq_time = 0.0, 0.0, 0.0,0.0
t = time.time()
# loop through all the test data
for im_info, key_frame_flag, data_batch in test_data:
t1 = time.time() - t
t = time.time()
#################################################
# new video #
#################################################
# empty lists and append padding images
# do not do prediction yet
if key_frame_flag == 0:
roidb_idx += 1
roidb_offset = -1
# init data_lsit and feat_list for a new video
data_list = deque(maxlen=all_frame_interval)
feat_list = deque(maxlen=all_frame_interval)
image, feat = get_resnet_output(feat_predictors, data_batch, data_names)
# append cfg.TEST.KEY_FRAME_INTERVAL+1 padding images in the front (first frame)
while len(data_list) < cfg.TEST.KEY_FRAME_INTERVAL+1:
data_list.append(image)
feat_list.append(feat)
ginst_ID = 0
ginst_mem = [] # list for instance class
sim_array_global = [] # similarity array list
logger.info('prepared for a new video')
#################################################
# main part of the loop #
#################################################
elif key_frame_flag == 2:
# keep appending data to the lists without doing prediction until the lists contain 2 * cfg.TEST.KEY_FRAME_INTERVAL objects
if len(data_list) < all_frame_interval - 1:
image, feat = get_resnet_output(feat_predictors, data_batch, data_names)
data_list.append(image)
feat_list.append(feat)
else:
scales = [iim_info[0, 2] for iim_info in im_info]
image, feat = get_resnet_output(feat_predictors, data_batch, data_names)
data_list.append(image)
feat_list.append(feat)
prepare_data(data_list, feat_list, data_batch)
pred_result = im_detect_all(aggr_predictors, data_batch, data_names, scales, cfg)
roidb_offset += 1 # frame number in this snippet
frame_ids[idx] = roidb_frame_ids[roidb_idx] + roidb_offset
t2 = time.time() - t
t = time.time()
ginst_ID_prev = ginst_ID
ginst_ID, out_im, out_im2, out_im_linst = process_link_pred_result(imdb.classes, pred_result, imdb.num_classes, thresh,
cfg, nms, all_boxes, all_boxes_inst, idx,
max_per_image, vis, data_list[cfg.TEST.KEY_FRAME_INTERVAL].asnumpy(), scales,
ginst_mem, sim_array_global, ginst_ID)
ginst_ID_now = ginst_ID
idx += test_data.batch_size
t3 = time.time() - t
t = time.time()
data_time += t1
net_time += t2
post_time += t3
print 'testing {}/{} data {:.4f}s net {:.4f}s post {:.4f}s GID:{} #GInsts:{}'.format(idx, num_images,
data_time / idx * test_data.batch_size,
net_time / idx * test_data.batch_size,
post_time / idx * test_data.batch_size, ginst_ID, len(ginst_mem))
if logger:
logger.info('testing {}/{} data {:.4f}s net {:.4f}s post {:.4f}s GID:{} #GInsts:{}'.format(idx, num_images,
data_time / idx * test_data.batch_size,
net_time / idx * test_data.batch_size,
post_time / idx * test_data.batch_size, ginst_ID, len(ginst_mem)))
#################################################
# end part of a video #
#################################################
elif key_frame_flag == 1: # last frame of a video
end_counter = 0
image, feat = get_resnet_output(feat_predictors, data_batch, data_names)
while end_counter < cfg.TEST.KEY_FRAME_INTERVAL + 1:
data_list.append(image)
feat_list.append(feat)
prepare_data(data_list, feat_list, data_batch)
pred_result = im_detect_all(aggr_predictors, data_batch, data_names, scales, cfg)
roidb_offset += 1
frame_ids[idx] = roidb_frame_ids[roidb_idx] + roidb_offset
t2 = time.time() - t
t = time.time()
ginst_ID_prev = ginst_ID
ginst_ID, out_im, out_im2, out_im_linst = process_link_pred_result(imdb.classes, pred_result, imdb.num_classes, thresh, cfg, nms,
all_boxes, all_boxes_inst, idx, max_per_image, vis,
data_list[cfg.TEST.KEY_FRAME_INTERVAL].asnumpy(),
scales, ginst_mem, sim_array_global, ginst_ID)
ginst_ID_now = ginst_ID
idx += test_data.batch_size
t3 = time.time() - t
t = time.time()
data_time += t1
net_time += t2
post_time += t3
print 'testing {}/{} data {:.4f}s net {:.4f}s post {:.4f}s GID:{} #GInsts:{}'.format(idx, num_images,
data_time / idx * test_data.batch_size,
net_time / idx * test_data.batch_size,
post_time / idx * test_data.batch_size, ginst_ID, len(ginst_mem))
if logger:
logger.info('testing {}/{} data {:.4f}s net {:.4f}s post {:.4f}s GID:{} #GInsts:{}'.format(idx, num_images,
data_time / idx * test_data.batch_size,
net_time / idx * test_data.batch_size,
post_time / idx * test_data.batch_size, ginst_ID, len(ginst_mem)))
end_counter += 1
with open(det_file, 'wb') as f:
cPickle.dump((all_boxes_inst, frame_ids), f, protocol=cPickle.HIGHEST_PROTOCOL)
return all_boxes_inst, frame_ids
def pred_eval_multiprocess_ot(gpu_num, key_predictors, cur_predictors, test_datas, imdb, cfg, vis=False, thresh=1e-3, logger=None, ignore_cache=True):
assert cfg.TEST.SEQ_NMS==False
if gpu_num == 1:
res = [pred_eval_ot(0, key_predictors[0], cur_predictors[0], test_datas[0], imdb, cfg, vis, thresh, logger,
ignore_cache), ]
else:
#multigpu not supported yet
assert gpu_num == 1
from multiprocessing.pool import ThreadPool as Pool
pool = Pool(processes=gpu_num)
multiple_results = [pool.apply_async(pred_eval_ot, args=(
i, key_predictors[i], cur_predictors[i], test_datas[i], imdb, cfg, vis, thresh, logger, ignore_cache)) for i
in range(gpu_num)]
pool.close()
pool.join()
res = [res.get() for res in multiple_results]
info_str = imdb.evaluate_detections_multiprocess_select_idx(res, -5)
info_str2 = imdb.evaluate_detections_multiprocess_select_idx(res, -4)
info_str3 = imdb.evaluate_detections_multiprocess_select_idx(res, -3)
info_str4 = imdb.evaluate_detections_multiprocess_select_idx(res, -2)
info_str5 = imdb.evaluate_detections_multiprocess_select_idx(res, -1)
if logger:
logger.info('evaluate detections: \n{}'.format(info_str))
logger.info('evaluate detections: \n{}'.format(info_str2))
logger.info('evaluate detections: \n{}'.format(info_str3))
logger.info('evaluate detections: \n{}'.format(info_str4))
logger.info('evaluate detections: \n{}'.format(info_str5))
def draw_all_ginst(im_array, inst_mem, class_names, scale, cfg, frame_now, threshold=0.1): # sidong
"""
visualize all detections in one image
:param im_array: [b=1 c h w] in rgb
:param inst_mem_now: local instance array
:param inst_mem: global instance array
:param class_names: list of names in imdb
:param scale: visualize the scaled image
:param IDs: linked global IDs of local instances. tuple.
:return:
"""
import cv2
import random
color_white = (255, 255, 255)
im = image.transform_inverse(im_array, cfg.network.PIXEL_MEANS)
# change to bgr
im = cv2.cvtColor(im, cv2.COLOR_RGB2BGR)
for j, inst in enumerate(inst_mem):
if inst.cls == 0: # '__background__':
continue
if inst.detected_idx[-1] == frame_now:
if not inst.color:
inst.color = (random.randint(0, 256), random.randint(0, 256), random.randint(0, 256)) # generate a random color
bbox = inst.bbox[:4] * scale
cls = inst.cls
score = inst.cls_score
#if score < threshold:
# continue
bbox = map(int, bbox)
cv2.rectangle(im, (bbox[0], bbox[1]), (bbox[2], bbox[3]), color=inst.color, thickness=2)
cv2.putText(im, 'LID:%d %.3s %.2f GID:%s %.3s s:%.2f' % (inst.LID, class_names[cls], score, inst.GID,
class_names[inst.cls_high], inst.sim),
(bbox[0], bbox[1] + 10), color=color_white, fontFace=cv2.FONT_HERSHEY_COMPLEX, fontScale=0.5)
return im
def draw_all_linst(im_array, inst_mem_now, inst_mem, class_names, scale, cfg, threshold=0.01): # sidong
"""
visualize all detections in one image
:param im_array: [b=1 c h w] in rgb
:param inst_mem_now: local instance array
:param inst_mem: global instance array
:param class_names: list of names in imdb
:param scale: visualize the scaled image
:param IDs: linked global IDs of local instances. tuple.
:return:
"""
import cv2
import random
color_white = (255, 255, 255)
im = image.transform_inverse(im_array, cfg.network.PIXEL_MEANS)
# change to bgr
im = cv2.cvtColor(im, cv2.COLOR_RGB2BGR)
for j, inst in enumerate(inst_mem_now):
if inst.cls == 0: # '__background__':
continue
if inst.cls_score < threshold:
continue
if inst.linked_to_gidx >= 0:
inst = inst_mem[inst.linked_to_gidx]
if not inst.color:
inst.color = (random.randint(0, 256), random.randint(0, 256), random.randint(0, 256)) # generate a random color
bbox = inst.bbox[:4] * scale
cls = inst.cls
score = inst.cls_score
bbox = map(int, bbox)
cv2.rectangle(im, (bbox[0], bbox[1]), (bbox[2], bbox[3]), color=inst.color, thickness=2)
cv2.putText(im, 'ID:%d %.3s %.2f GID:%s %.3s s:%.2f' % (inst.LID, class_names[cls], score, inst.GID,
class_names[inst.cls_high], inst.sim),
(bbox[0], bbox[1] + 10), color=color_white, fontFace=cv2.FONT_HERSHEY_COMPLEX, fontScale=0.5)
else:
color = (random.randint(0, 256), random.randint(0, 256), random.randint(0, 256)) # generate a random color
bbox = inst.bbox[:4] * scale
cls = inst.cls
score = inst.cls_score
#if score < threshold:
# continue
bbox = map(int, bbox)
cv2.rectangle(im, (bbox[0], bbox[1]), (bbox[2], bbox[3]), color=color, thickness=2)
cv2.putText(im, 'LID:%d %.3s %.2f' % (inst.LID, class_names[cls], score),
(bbox[0], bbox[1] + 10), color=color_white, fontFace=cv2.FONT_HERSHEY_COMPLEX, fontScale=0.5)
return im
def divide_L2_norm(vector): #assume that the vector is 2-demensional list (2048L, cfg.TEST.EMBED_SIZE, cfg.TEST.EMBED_SIZE)
return vector / np.linalg.norm(vector, axis=0) # vector <type 'tuple'>: (2048, 8,8)
def compare_embed(A, B):
C = A * B # C vector: <type 'tuple'>: (2048, 8,8)
sum = np.sum(C, axis=0) # return vector: <type 'tuple'>: (8,8)
return sum.sum()/sum.size
def normalize(ndarray):
return ndarray/(ndarray.square().sum().sqrt())
def compare_embed_filtered(A, B, normed_score_map_A, normed_score_map_B):
# score_map : mxnet nd array (7*7)
# output: cosine similarity
C = A * B # C vector: <type 'tuple'>: (2048, z,z) (z*z vectors, length: 2048)
cos_sim = np.sum(C, axis=0) # return vector: <type 'tuple'>: (z,z)
ggrid = normed_score_map_A * normed_score_map_B # (7, 7) grid matrix
grid1 = mx.nd.softmax(data=ggrid.reshape(-3), axis=-1, temperature=0.05).reshape((7,7)).asnumpy()
filtered_sim1 = grid1 * cos_sim
sum1 = filtered_sim1.sum()
#grid11 = mx.nd.softmax(data=ggrid.reshape(-3), axis=-1, temperature=0.1).reshape((7, 7)).asnumpy()
#soft_A = mx.nd.softmax(normed_score_map_A.reshape(-3), axis=-1, temperature=0.1)
#aa = soft_A.asnumpy().reshape((7,7))
#soft_B = mx.nd.softmax(normed_score_map_B.reshape(-3), axis=-1, temperature=0.1)
#bb = soft_B.asnumpy().reshape((7,7))
#grid2 = mx.nd.softmax((soft_A * soft_B), axis=-1, temperature=0.01).reshape(7,7).asnumpy()
#filtered_sim2 = grid2 * cos_sim
#sum2 = filtered_sim2.sum()
#AAA = score_map_A.asnumpy()
#BBB = score_map_B.asnumpy()
#DDD = ggrid.asnumpy()
return sum1
def Area(box):
return (box[2] - box[0] + 1) * (box[3] - box[1] + 1)
def compute_IOU(box_A,box_B, area_A, area_B):
xx1 = max(box_A[0],box_B[0])
yy1 = max(box_A[1],box_B[1])
xx2 = min(box_A[2],box_B[2])
yy2 = min(box_A[3],box_B[3])
w = max(0.0, xx2 - xx1 + 1)
h = max(0.0, yy2 - yy1 + 1)
inter = w * h
ovr = inter / (area_A + area_B - inter)
return ovr
def compute_IOM(box_me,box_B):
area_A = Area(box_me)
xx1 = max(box_me[0], box_B[0])
yy1 = max(box_me[1], box_B[1])
xx2 = min(box_me[2], box_B[2])
yy2 = min(box_me[3], box_B[3])
w = max(0.0, xx2 - xx1 + 1)
h = max(0.0, yy2 - yy1 + 1)
inter = w * h
ovr = inter / (area_A)
return ovr
def compute_relative_dist(inst_A, inst_B):
rad_A = math.sqrt(Area(inst_B.bbox))
rad_B = math.sqrt(Area(inst_B.bbox))
dx = inst_A.center[0] - inst_B.center[0]
dy = inst_A.center[1] - inst_B.center[1]
dis = math.sqrt(dx ** 2 + dy ** 2)
return ((rad_A + rad_B) - dis)/(rad_A + rad_B)
def compute_locality(inst_A, inst_B):
rd = compute_relative_dist(inst_A, inst_B)
return (0 if rd <= 0 else rd)
def ginst_to_box_and_score(inst):
dynamic_average = inst.cls_score_acc / len(inst.detected_idx)
box_and_score = np.hstack(
(inst.bbox, inst.cls_score, inst.cls_score_high, inst.cls_score_reliable,
dynamic_average, max(dynamic_average, inst.cls_score)
))
return box_and_score
def ginst_to_box_and_score_cls_scores(inst):
dynamic_average = inst.cls_score_acc / len(inst.detected_idx)
box_and_score = np.hstack(
(inst.bbox, inst.cls_score, inst.cls_score_high, inst.cls_score_reliable,
dynamic_average, max(dynamic_average, inst.cls_score)
))
return box_and_score
def linst_to_box_and_score(inst):
box_and_score = np.hstack(
(inst.bbox, inst.cls_score, inst.cls_score_high, inst.cls_score,
inst.cls_score, inst.cls_score))
return box_and_score
def draw_all_rois(im_array, rois, scale, cfg, threshold=0.1): # sidong
"""
visualize all detections in one image
:param im_array: [b=1 c h w] in rgb
:param detections: [ numpy.ndarray([[x1 y1 x2 y2 score]]) for j in classes ]
:param class_names: list of names in imdb
:param scale: visualize the scaled image
:return:
"""
import cv2
import random
color_white = (255, 255, 255)
im = image.transform_inverse(im_array, cfg.network.PIXEL_MEANS)
# change to bgr
im = cv2.cvtColor(im, cv2.COLOR_RGB2BGR)
color = (random.randint(0, 256), random.randint(0, 256), random.randint(0, 256)) # generate a random color
#print rois
for det in rois:
bbox = det[:4] #* scale # scaling is not needed for rois
#score = det[-1]
#if score < threshold:
# continue
bbox = map(int, bbox)
cv2.rectangle(im, (bbox[0], bbox[1]), (bbox[2], bbox[3]), color=color, thickness=2)
#cv2.putText(im, '%s %.3f' % (class_names[j], score), (bbox[0], bbox[1] + 10),
# color=color_white, fontFace=cv2.FONT_HERSHEY_COMPLEX, fontScale=0.5)
cv2.putText(im, '%s' % ('rois'), (bbox[0], bbox[1] + 10),
color=color_white, fontFace=cv2.FONT_HERSHEY_COMPLEX, fontScale=0.5)
return im
def process_link_pred_result(classes, pred_result, num_classes, thresh, cfg, nms, all_boxes, all_boxes_inst, idx,
max_per_image, vis, center_image, scales, inst_mem, sim_array_global, ginst_ID):
global logger
for delta, (scores, boxes, rois, data_dict, iscores, ipred_boxes, embed_feat, psroipooled_cls_rois) in enumerate(pred_result): #16th frame -> cat(10) -> local box(3, 4th in rois)
local_inst_ID = 0
inst_mem_now = [] # intra-frame inst memory
per_cls_box_idx_over_th = [[]]
per_cls_box_idx_nms = [[]]
all_cls_box_idx_nms = []
for j in range(1, num_classes):
#logger.debug('[%dth frame]test boxes of class: (%d, %s)' % (idx+delta, j, classes[j]))
indexes = np.where(scores[:, j] > thresh)[0]
per_cls_box_idx_over_th.append(indexes)
cls_scores = scores[indexes, j, np.newaxis]
cls_boxes = boxes[indexes, 4:8] if cfg.CLASS_AGNOSTIC else boxes[indexes, j * 4:(j + 1) * 4]
cls_dets = np.hstack((cls_boxes, cls_scores))
if cfg.TEST.SEQ_NMS:
all_boxes[j][idx + delta]=cls_dets # all_boxes[31L(class)][frame_idx + batch_size][300L(box_idx)][5L(x,y,w,h,score)]
else:
#cls_dets=np.float32(cls_dets)
keep = nms(cls_dets)
all_boxes[j][idx + delta] = cls_dets[keep, :]
per_cls_box_idx_nms.append(indexes[keep])
#all_cls_box_idx_nms.extend(indexes[keep])
#inst_mem_cls = [[] for _ in range(num_classes)] ## intra-class inst memory
#for j in range(1, num_classes):
box_indexes = per_cls_box_idx_nms[j]
for i, box_idx in enumerate(box_indexes): # for dets of class j,
box = all_boxes[j][idx + delta][i]
new_inst = Instance(LID=local_inst_ID, frame_idx=idx + delta, cls=j, cls_score=box[-1],
bbox=box[0:4], embed_feat=embed_feat[box_idx],
atten=normalize(psroipooled_cls_rois[box_idx][j])) #make instances for outputs
new_inst.cls_scores = box_idx
local_inst_ID += 1
#inst_mem_cls[j].append(new_inst)
inst_mem_now.append(new_inst)
#inst_mem_now.extend(inst_mem_cls[j])
iou_array_final = np.zeros((1,len(inst_mem_now)))
sim_array_final = np.zeros((1,len(inst_mem_now)))
sim_array_final_th = np.zeros((1,len(inst_mem_now)), int)
linked_array = np.zeros((len(inst_mem), len(inst_mem_now)))
gidx_linked = []
#logger.debug('[%dth frame] @@@ inter frame phase start @@@', idx + delta)
len_local = len(inst_mem_now)
len_global = len(inst_mem)
if len_local > 0 and len_global > 0 :
iou_array = np.zeros((len_global, len_local)) # matrix of iou
coef_array = np.zeros((len_global, len_local)) # matrix of coeff
sim_array = np.zeros((len_global, len_local)) # matrix of similarity
g_rel_array = np.zeros((len_global, len_local)) # matrix of reliability
same_cls_score_array = np.zeros((len_global, len_local)) # matrix of reliability
l_rel_array = np.zeros((len_global, len_local)) # matrix of reliability g to l
#loc_array = np.zeros((len_global, len_local)) # matrix of relative distance
area1 = np.empty(len_global)
for i, ginst in enumerate(inst_mem):
area1[i] = Area(ginst.bbox2)
area2 = np.empty(len_local)
for j, linst in enumerate(inst_mem_now):
area2[j] = Area(linst.bbox2)
# Similarity matrix generation (global <-> local inst)
for i, ginst in enumerate(inst_mem): # loop for instances in this frame
for j, linst in enumerate(inst_mem_now):
coeff = 0 #compare_embed(ginst.embed_feat, linst.embed_feat) # input embed_feat <type 'tuple'>: (2048, 8,8)
coeff_filtered = compare_embed_filtered(ginst.embed_feat, linst.embed_feat, ginst.atten, linst.atten)
iou = compute_IOU(ginst.bbox2, linst.bbox2, area1[i], area2[j]) #use virtual bbox
similar = coeff_filtered * iou
#g_reliability = similar * ginst.cls_score_reliable
same_cls_score = linst.cls_score * (ginst.cls_high == linst.cls)
l_reliability = similar * same_cls_score
#loc = compute_locality(ginst, linst)
coeff_th = (coeff > cfg.TEST.COEFF_THRESH_INTER)
iou_th = (iou > cfg.TEST.IOU_THRESH_INTRA)
similar_th = (similar > cfg.TEST.IOU_THRESH_INTRA * cfg.TEST.COEFF_THRESH_INTRA)
sim_array[i, j] = similar
iou_array[i, j] = iou
coef_array[i, j] = coeff_filtered #
#g_rel_array[i, j] = g_reliability
same_cls_score_array[i, j] = same_cls_score
l_rel_array[i, j] = l_reliability
#loc_array[i, j] = loc
logger.debug('[%dth frame] ginst[%d](GID:%d, %.5s(%.2f) lastf:%d)) VS linst[%d](LID:%d, %.5s(%.2f)): filt_coef:%.2f IOU:%.2f(%.1s) coef:%.2f(%.1s) sim:%.2f(%.1s) lrel:%.2f' % (
idx + delta, i, ginst.GID, classes[ginst.cls], ginst.cls_score, ginst.detected_idx[-1], j, linst.LID, classes[linst.cls], linst.cls_score,
coeff_filtered, iou, iou_th, coeff, coeff_th, similar, similar_th, l_reliability))
sim_array_th = (sim_array[:, :] > cfg.TEST.COEFF_THRESH_INTRA * cfg.TEST.IOU_THRESH_INTRA)
g_rel_array_th = (g_rel_array[:, :] > cfg.TEST.REL_THRESH_INTRA)
l_rel_array_th = (l_rel_array[:, :] > cfg.TEST.REL_THRESH_INTRA)
#sim_array_global.append(sim_array) #for debugging
link_array = np.zeros((len_global, len_local))
sim_array_tmp = sim_array.copy()
l_rel_array_tmp = l_rel_array.copy()
sim_array_hor = sim_array.copy()
l_rel_array_hor = l_rel_array.copy()
sim_array_ver = sim_array.copy()
l_rel_array_ver = l_rel_array.copy()
same_cls_score_array_tmp = same_cls_score_array.copy()
trial = 0
linked_num = 0
# ginst linking
while l_rel_array_tmp.max() > cfg.TEST.REL_THRESH_INTRA and linked_num < min(15, len_global):
#i = l_rel_array_tmp.argmax()
i = same_cls_score_array_tmp.argmax()
gi = i / len_local
li = i % len_local
trial += 1
if l_rel_array_tmp[gi, li] > cfg.TEST.REL_THRESH_INTRA:
link_array[gi, li] = 1
sim_array_tmp[gi, :] = -1
sim_array_tmp[:, li] = -1
l_rel_array_tmp[gi, :] = -1
l_rel_array_tmp[:, li] = -1
sim_array_hor[gi, :] = -1
sim_array_ver[:, li] = -1
l_rel_array_hor[gi, :] = -1
l_rel_array_ver[:, li] = -1
same_cls_score_array_tmp[gi, :] = -1
same_cls_score_array_tmp[:, li] = -1
gidx_linked.append(gi)
inst_mem[gi].update_inter_frame(inst_mem_now[li], sim_array[gi,li])
linked_num += 1
else:
sim_array_tmp[gi, li] = -1
l_rel_array_tmp[gi, li] = -1
sim_array_hor[gi, li] = -1
sim_array_ver[gi, li] = -1
l_rel_array_hor[gi, li] = -1
l_rel_array_ver[gi, li] = -1
same_cls_score_array_tmp[gi, li] = -1
while 0:#sim_array_tmp.max() > cfg.TEST.IOU_THRESH_INTER * cfg.TEST.COEFF_THRESH_INTER:
i = sim_array_tmp.argmax()
gi = i / len(inst_mem_now)
li = i % len(inst_mem_now)
link_array[gi, li] = 2
sim_array_tmp[gi, :] = -2
sim_array_tmp[:, li] = -2
l_rel_array_tmp[gi, :] = -2
l_rel_array_tmp[:, li] = -2
sim_array_hor[gi, :] = -2
sim_array_ver[:, li] = -2
l_rel_array_hor[gi, :] = -2
l_rel_array_ver[:, li] = -2
gidx_linked.append(gi)
inst_mem[gi].update_inter_frame(inst_mem_now[li], sim_array[gi, li])
l_rel_array_ver_th = (l_rel_array_ver[:, :] > cfg.TEST.REL_THRESH_INTRA)
l_rel_array_hor_th = (l_rel_array_hor[:, :] > cfg.TEST.REL_THRESH_INTRA)
# ginst guided linst supression (for not linked)
if cfg.TEST.LSUP:
for i, ginst in enumerate(inst_mem):
if link_array[i, :].max() > 0:
lindex_to_suppress = np.where(l_rel_array_ver_th[i, :] == True)[0]
sim_array_tmp[:, lindex_to_suppress] = -3
for k in lindex_to_suppress:
inst_mem_now[k].l_suppressed.append(idx + delta)
# linst guided ginst suppresion (for not linked)
if cfg.TEST.GSUP:
for j, linst in enumerate(inst_mem_now):
if link_array[:, j].max() > 0:
gindex_to_suppress = np.where(l_rel_array_hor_th[:, j] == True)[0]
sim_array_tmp[gindex_to_suppress, :] = -4
for k in gindex_to_suppress:
inst_mem[k].g_suppressed.append(idx + delta)
iou_array_final = iou_array.copy()
sim_array_final = sim_array.copy()
sim_array_final_th = sim_array_th.copy()
rel_array_final = l_rel_array.copy()
rel_array_final_th = l_rel_array_th.copy()
linked_array = link_array.copy()
# delete some ginsts
gidx_to_delete = []
for i, ginst in enumerate(inst_mem):
delete = 0
last_frame = ginst.detected_idx[-1]
if last_frame < (idx + delta - cfg.TEST.GINST_LIFE_FRAME):
logger.debug('[%dth frame] ginst[%d](GID:%d, %s, %.3f, frame:%d) is deleted (old frame)' % (
idx + delta, i, inst_mem[i].GID, classes[inst_mem[i].cls], inst_mem[i].cls_score,
inst_mem[i].detected_idx[-1]))
delete = 1
elif ginst.g_suppressed:
logger.debug('[%dth frame] ginst[%d](GID:%d, %s, %.3f, frame:%d) is deleted (suppressed)' % (
idx + delta, i, inst_mem[i].GID, classes[inst_mem[i].cls], inst_mem[i].cls_score,
inst_mem[i].detected_idx[-1]))
delete = 1
elif 0:#ginst.cls_score_reliable < 0.05:
logger.debug('[%dth frame] ginst[%d](GID:%d, %s, %.3f, frame:%d) is deleted (low reliability)' % (
idx + delta, i, inst_mem[i].GID, classes[inst_mem[i].cls], inst_mem[i].cls_score,
inst_mem[i].detected_idx[-1]))
delete = 1
if delete == 1:
gidx_to_delete.append(i)
if last_frame == idx + delta:
gidx_linked.remove(i)
gidx_to_delete.reverse()
for i in gidx_to_delete:
del inst_mem[i]
iou_array_final, sim_array_final, sim_array_final_th, rel_array_final, rel_array_final_th, linked_array = \
np.delete(
(iou_array_final, sim_array_final, sim_array_final_th, rel_array_final, rel_array_final_th, linked_array),
(gidx_to_delete), axis=1)
# link global insts & local insts
for i, ginst in enumerate(inst_mem):
indexes_linked = np.argwhere(linked_array[i, :] >= 1)
if len(indexes_linked) == 0:
logger.debug('[%dth frame] ginst[%d](GID:%d, %s, %.3f, frame:%d) is not linked to anyone' % (
idx + delta, i, inst_mem[i].GID, classes[inst_mem[i].cls], inst_mem[i].cls_score,
inst_mem[i].detected_idx[-1]))
elif len(indexes_linked) == 1:
index_linked = int(indexes_linked[0])
linst = inst_mem_now[index_linked]
sim = sim_array_final[i][index_linked]
logger.debug(
'[%dth frame] ginst[%d](GID:%d, %s, %.3f, frame:%d) is updated by linst[%d](LID:%d, %s, %.3f)' % (
idx + delta, i, inst_mem[i].GID, classes[inst_mem[i].cls], inst_mem[i].cls_score,
inst_mem[i].detected_idx[-1], index_linked, linst.LID, classes[linst.cls],
linst.cls_score))
#ginst.update_inter_frame(linst, sim)
else:
logger.debug('# of linked indexes %d' % (len(indexes_linked)))
raise NotImplementedError # this should not happen
#if idx == 88: # 0.6
# logger.debug('debug_point')
# make new ginst
# translate inst_mem_now into box array (for evaluation)
gidx_linked_from_lidx = [None for _ in range(len(inst_mem_now))]
list_new_ginsts = []
if len(inst_mem_now) > 0:
for j, linst in enumerate(inst_mem_now):
if linst.l_suppressed: # if suppressed
logger.debug(
'[%dth frame] linst[%d](LID:%d, %s, %.3f) is discarded because of suppression' % (
idx + delta, j, linst.LID, classes[linst.cls], linst.cls_score))
continue
gidx_linked_from_lidx[j] = np.argwhere(linked_array[:, j] >= 1)
if len(gidx_linked_from_lidx[j]): # if linked to ginst
assert len(gidx_linked_from_lidx[j]) == 1
gidx = gidx_linked_from_lidx[j][0][0]
ginst = inst_mem[gidx]
box_and_score = ginst_to_box_and_score(ginst)
linst.cls_high = ginst.cls_high
linst.linked_to_gidx = gidx
else: # if not linked
if linst.cls_score >= cfg.TEST.SCORE_THRESH:
if len(inst_mem) > 0:
iou_sum = iou_array[gidx_linked, j].sum()
#compute_IOM(box_me=, box_B=)
# exception handling
if iou_sum > 0.5: # if linst overlaps with linked ginsts of this frame
iou_max_index = np.argmax(iou_array_final[:, j])
if linst.cls == inst_mem[iou_max_index].cls and linst.cls_score < inst_mem[iou_max_index].cls_score:
logger.debug(
'[%dth frame] linst[%d](LID:%d, %s, %.3f) will be remained linst because of overlap(%.2f) with ginsts{g_linked}'.format(
g_linked=gidx_linked)
% (idx + delta, j, linst.LID, classes[linst.cls], linst.cls_score, iou_sum))
box_and_score = linst_to_box_and_score(linst)
continue
logger.debug('[%dth frame] linst[%d](LID:%d, %s, %.3f) became new ginst_memory[%d]' % (
idx + delta, j, linst.LID, classes[linst.cls], linst.cls_score, ginst_ID))
new_ginst = linst.make_global_inst(ginst_ID)
list_new_ginsts.append(new_ginst)
linst.linked_to = [ginst_ID]
linst.linked_to_gidx = len(inst_mem) + len(list_new_ginsts) - 1
ginst_ID = ginst_ID + 1
box_and_score = ginst_to_box_and_score(new_ginst)
else:
logger.debug(
'[%dth frame] linst[%d](LID:%d, %s, %.3f) will be remained linst because of low cls_score' % (
idx + delta, j, linst.LID, classes[linst.cls], linst.cls_score))
box_and_score = linst_to_box_and_score(linst)
all_boxes_inst[linst.cls_high][idx + delta].append(box_and_score)
for i in range(num_classes):
all_boxes_inst[i][idx + delta] = np.array(all_boxes_inst[i][idx + delta])
inst_mem.extend(list_new_ginsts)
out_im_ginst = 0
out_im_linst = 0
if vis:
out_im_ginst = draw_all_ginst(center_image, inst_mem, classes, scales[delta], cfg, idx+delta)
out_im_linst = draw_all_linst(center_image, inst_mem_now, inst_mem, classes, scales[delta], cfg)
#out_im2 = draw_all_rois(center_image, rois, scales[delta], cfg) # print rois from RPN
out_im = 0
if cfg.TEST.SEQ_NMS == False and max_per_image > 0 and cfg.TEST.DISPLAY[0]:
image_scores = np.hstack([all_boxes[j][idx + delta][:, -1]
for j in range(1, num_classes)])
if len(image_scores) > max_per_image:
image_thresh = np.sort(image_scores)[-max_per_image]
for j in range(1, num_classes):
keep = np.where(all_boxes[j][idx + delta][:, -1] >= image_thresh)[0]
all_boxes[j][idx + delta] = all_boxes[j][idx + delta][keep, :]
if vis:
boxes_this_image = [[]] + [all_boxes[j][idx + delta] for j in range(1, num_classes)]
out_im = draw_all_detection(center_image, boxes_this_image, classes, scales[delta], cfg)
return ginst_ID, out_im, out_im_ginst, out_im_linst
def process_link_pred_result2(classes, pred_result, num_classes, thresh, cfg, nms, all_boxes, all_boxes_inst, idx,
max_per_image, vis, center_image, scales, inst_mem, sim_array_global, ginst_ID):
global logger
for delta, (scores, boxes, rois, data_dict, iscores, ipred_boxes, embed_feat, psroipooled_cls_rois) in enumerate(pred_result): #16th frame -> cat(10) -> local box(3, 4th in rois)
local_inst_ID = 0
inst_mem_now = [] # intra-frame inst memory
per_cls_box_idx_over_th = [[]]
per_cls_box_idx_nms = [[]]
all_cls_box_idx_nms = []
for j in range(1, num_classes):
# logger.debug('[%dth frame]test boxes of class: (%d, %s)' % (idx+delta, j, classes[j]))
indexes = np.where(scores[:, j] > thresh)[0]
per_cls_box_idx_over_th.append(indexes)
cls_scores = scores[indexes, j, np.newaxis]
cls_boxes = boxes[indexes, 4:8] if cfg.CLASS_AGNOSTIC else boxes[indexes, j * 4:(j + 1) * 4]
cls_dets = np.hstack((cls_boxes, cls_scores))
if cfg.TEST.SEQ_NMS:
all_boxes[j][
idx + delta] = cls_dets # all_boxes[31L(class)][frame_idx + batch_size][300L(box_idx)][5L(x,y,w,h,score)]
else:
# cls_dets=np.float32(cls_dets)
keep = nms(cls_dets)
all_boxes[j][idx + delta] = cls_dets[keep, :]
per_cls_box_idx_nms.append(indexes[keep])
# all_cls_box_idx_nms.extend(indexes[keep])
#merging
scores_max = scores[:,1:].max(axis=1)
index_tf = (scores_max > thresh)
cls_scores = scores[index_tf]
cls_highest = scores[index_tf, 1:].argmax(axis=1) + 1
cls_boxes = boxes[index_tf, 4:8] if cfg.CLASS_AGNOSTIC else boxes[index_tf, j * 4:(j + 1) * 4]
embed_feats = embed_feat[index_tf]
psroipooled_cls_roiss = psroipooled_cls_rois[index_tf]
for i in range(len(cls_scores)):
new_inst = Instance(LID=local_inst_ID, frame_idx=idx + delta, cls=cls_highest[i], cls_score=cls_scores[i][cls_highest[i]],
bbox=cls_boxes[i], embed_feat=embed_feats[i],
atten=psroipooled_cls_roiss[i]) # make instances for outputs
new_inst.cls_scores = cls_scores[i]
new_inst.cls_scores_acc = cls_scores[i]
local_inst_ID += 1
inst_mem_now.append(new_inst)
logger.debug('[%dth frame] %d linsts created' % (idx + delta, len(inst_mem_now)))
iou_array_final = np.zeros((1,len(inst_mem_now)))
sim_array_final = np.zeros((1,len(inst_mem_now)))
sim_array_final_th = np.zeros((1,len(inst_mem_now)), int)
linked_array = np.zeros((len(inst_mem), len(inst_mem_now)))
gidx_linked = []
#logger.debug('[%dth frame] @@@ inter frame phase start @@@', idx + delta)
if len(inst_mem) > 0 and len(inst_mem_now) > 0 :
cls_sim_array = np.zeros((len(inst_mem), len(inst_mem_now)))
iou_array = np.zeros((len(inst_mem), len(inst_mem_now))) # matrix of iou
coef_array = np.zeros((len(inst_mem), len(inst_mem_now))) # matrix of coeff
sim_array = np.zeros((len(inst_mem), len(inst_mem_now))) # matrix of similarity
g_rel_array = np.zeros((len(inst_mem), len(inst_mem_now))) # matrix of reliability
l_rel_array = np.zeros((len(inst_mem), len(inst_mem_now))) # matrix of reliability g to l
loc_array = np.zeros((len(inst_mem), len(inst_mem_now))) # matrix of relative distance
area1 = np.empty(len(inst_mem))
for i, ginst in enumerate(inst_mem):
area1[i] = Area(ginst.bbox2)
area2 = np.empty(len(inst_mem_now))
for j, linst in enumerate(inst_mem_now):
area2[j] = Area(linst.bbox2)
# Similarity matrix generation (global <-> local inst)
for i, ginst in enumerate(inst_mem): # loop for instances in this frame
for j, linst in enumerate(inst_mem_now):
cls_sim = (linst.cls_scores * ginst.cls_scores).sum()
coeff = 0 #compare_embed(ginst.embed_feat, linst.embed_feat) # input embed_feat <type 'tuple'>: (2048, 8,8)
iou = compute_IOU(ginst.bbox2, linst.bbox2, area1[i], area2[j]) #use virtual bbox
similar = iou * cls_sim #original ver
g_reliability = 0 # similar * ginst.cls_score_reliable
l_reliability = 0 # similar * linst.cls_scores[ginst.cls]
loc = 0 # compute_locality(ginst, linst)
coeff_th = 0 # (coeff > cfg.TEST.COEFF_THRESH_INTER)
iou_th = (iou > cfg.TEST.IOU_THRESH_INTRA)
similar_th = (similar > cfg.TEST.IOU_THRESH_INTRA * cfg.TEST.COEFF_THRESH_INTRA)
cls_sim_array[i, j] = cls_sim
iou_array[i, j] = iou
sim_array[i, j] = similar
#coef_array[i, j] = coeff
#g_rel_array[i, j] = g_reliability
#l_rel_array[i, j] = l_reliability
#loc_array[i, j] = loc
logger.debug('[%dth frame] ginst[%d](GID:%d, %.5s(%.2f) lastf:%d)) VS linst[%d](LID:%d, %.5s(%.2f)): cls_sim:%.2f IOU:%.2f(%.1s) coef:%.2f(%.1s) sim:%.2f(%.1s) lrel:%.2f' % (
idx + delta, i, ginst.GID, classes[ginst.cls], ginst.cls_score, ginst.detected_idx[-1], j, linst.LID, classes[linst.cls], linst.cls_score,
cls_sim, iou, iou_th, coeff, coeff_th, similar, similar_th, l_reliability))
sim_array_th = (sim_array[:, :] > cfg.TEST.COEFF_THRESH_INTRA * cfg.TEST.IOU_THRESH_INTRA)
g_rel_array_th = (g_rel_array[:, :] > cfg.TEST.REL_THRESH_INTRA)
l_rel_array_th = (l_rel_array[:, :] > cfg.TEST.REL_THRESH_INTRA)
#sim_array_global.append(sim_array) #for debugging
link_array = np.zeros((len(inst_mem), len(inst_mem_now)))
sim_array_tmp = sim_array.copy()
l_rel_array_tmp = l_rel_array.copy()
sim_array_hor = sim_array.copy()
l_rel_array_hor = l_rel_array.copy()
sim_array_ver = sim_array.copy()
l_rel_array_ver = l_rel_array.copy()
# ginst linking
while 0: # l_rel_array_tmp.max() > cfg.TEST.REL_THRESH_INTRA:
i = l_rel_array_tmp.argmax()
gi = i / len(inst_mem_now)
li = i % len(inst_mem_now)
link_array[gi, li] = 1
sim_array_tmp[gi, :] = -1
sim_array_tmp[:, li] = -1
l_rel_array_tmp[gi, :] = -1
l_rel_array_tmp[:, li] = -1
sim_array_hor[gi, :] = -1
sim_array_ver[:, li] = -1
l_rel_array_hor[gi, :] = -1
l_rel_array_ver[:, li] = -1
gidx_linked.append(gi)
inst_mem[gi].update_inter_frame(inst_mem_now[li], sim_array[gi,li])
while sim_array_tmp.max() > 0: # cfg.TEST.IOU_THRESH_INTER * cfg.TEST.COEFF_THRESH_INTER:
i = sim_array_tmp.argmax()
gi = i / len(inst_mem_now)
li = i % len(inst_mem_now)
link_array[gi, li] = 2
sim_array_tmp[gi, :] = -2
sim_array_tmp[:, li] = -2
l_rel_array_tmp[gi, :] = -2
l_rel_array_tmp[:, li] = -2
sim_array_hor[gi, :] = -2
sim_array_ver[:, li] = -2
l_rel_array_hor[gi, :] = -2
l_rel_array_ver[:, li] = -2
gidx_linked.append(gi)
inst_mem[gi].update_inter_frame(inst_mem_now[li], sim_array[gi, li])
inst_mem[gi].cls_scores_acc += inst_mem_now[li].cls_scores
l_rel_array_ver_th = (l_rel_array_ver[:, :] > cfg.TEST.REL_THRESH_INTRA)
l_rel_array_hor_th = (l_rel_array_hor[:, :] > cfg.TEST.REL_THRESH_INTRA)
# ginst guided linst supression (for not linked)
if cfg.TEST.LSUP:
for i, ginst in enumerate(inst_mem):
if link_array[i, :].max() > 0:
lindex_to_suppress = np.where(l_rel_array_ver_th[i, :] == True)[0]
sim_array_tmp[:, lindex_to_suppress] = -3
for k in lindex_to_suppress:
inst_mem_now[k].l_suppressed.append(idx + delta)
# linst guided ginst suppresion (for not linked)
if cfg.TEST.GSUP:
for j, linst in enumerate(inst_mem_now):
if link_array[:, j].max() > 0:
gindex_to_suppress = np.where(l_rel_array_hor_th[:, j] == True)[0]
sim_array_tmp[gindex_to_suppress, :] = -4
for k in gindex_to_suppress:
inst_mem[k].g_suppressed.append(idx + delta)
iou_array_final = iou_array.copy()
sim_array_final = sim_array.copy()
sim_array_final_th = sim_array_th.copy()
rel_array_final = l_rel_array.copy()
rel_array_final_th = l_rel_array_th.copy()
linked_array = link_array.copy()
# delete some ginsts
gidx_to_delete = []
for i, ginst in enumerate(inst_mem):
delete = 0
last_frame = ginst.detected_idx[-1]
if last_frame < (idx + delta - cfg.TEST.GINST_LIFE_FRAME):
logger.debug('[%dth frame] ginst[%d](GID:%d, %s, %.3f, frame:%d) is deleted (old frame)' % (
idx + delta, i, inst_mem[i].GID, classes[inst_mem[i].cls], inst_mem[i].cls_score,
inst_mem[i].detected_idx[-1]))
delete = 1
elif ginst.g_suppressed:
logger.debug('[%dth frame] ginst[%d](GID:%d, %s, %.3f, frame:%d) is deleted (suppressed)' % (
idx + delta, i, inst_mem[i].GID, classes[inst_mem[i].cls], inst_mem[i].cls_score,
inst_mem[i].detected_idx[-1]))
delete = 1
elif 0:#ginst.cls_score_reliable < 0.05:
logger.debug('[%dth frame] ginst[%d](GID:%d, %s, %.3f, frame:%d) is deleted (low reliability)' % (
idx + delta, i, inst_mem[i].GID, classes[inst_mem[i].cls], inst_mem[i].cls_score,
inst_mem[i].detected_idx[-1]))
delete = 1
if delete == 1:
gidx_to_delete.append(i)
if last_frame == idx + delta:
gidx_linked.remove(i)
gidx_to_delete.reverse()
for i in gidx_to_delete:
del inst_mem[i]
iou_array_final, sim_array_final, sim_array_final_th, rel_array_final, rel_array_final_th, linked_array = \
np.delete(
(iou_array_final, sim_array_final, sim_array_final_th, rel_array_final, rel_array_final_th, linked_array),
(gidx_to_delete), axis=1)
# link global insts & local insts
for i, ginst in enumerate(inst_mem):
indexes_linked = np.argwhere(linked_array[i, :] >= 1)
if len(indexes_linked) == 0:
logger.debug('[%dth frame] ginst[%d](GID:%d, %s, %.3f, frame:%d) is not linked to anyone' % (
idx + delta, i, inst_mem[i].GID, classes[inst_mem[i].cls], inst_mem[i].cls_score,
inst_mem[i].detected_idx[-1]))
elif len(indexes_linked) == 1:
index_linked = int(indexes_linked[0])
linst = inst_mem_now[index_linked]
sim = sim_array_final[i][index_linked]
logger.debug(
'[%dth frame] ginst[%d](GID:%d, %s, %.3f, frame:%d) is updated by linst[%d](LID:%d, %s, %.3f)' % (
idx + delta, i, inst_mem[i].GID, classes[inst_mem[i].cls], inst_mem[i].cls_score,
inst_mem[i].detected_idx[-1], index_linked, linst.LID, classes[linst.cls],
linst.cls_score))
#ginst.update_inter_frame(linst, sim)
else:
logger.debug('# of linked indexes %d' % (len(indexes_linked)))
raise NotImplementedError # this should not happen
#if idx == 88: # 0.6
# logger.debug('debug_point')
# make new ginst
# translate inst_mem_now into box array (for evaluation)
gidx_linked_from_lidx = [None for _ in range(len(inst_mem_now))]
list_new_ginsts = []
if len(inst_mem_now) > 0:
for j, linst in enumerate(inst_mem_now):
if linst.l_suppressed: # if suppressed
logger.debug(
'[%dth frame] linst[%d](LID:%d, %s, %.3f) is discarded because of suppression' % (
idx + delta, j, linst.LID, classes[linst.cls], linst.cls_score))
continue
gidx_linked_from_lidx[j] = np.argwhere(linked_array[:, j] >= 1)
if len(gidx_linked_from_lidx[j]): # if linked to ginst
assert len(gidx_linked_from_lidx[j]) == 1
gidx = gidx_linked_from_lidx[j][0][0]
ginst = inst_mem[gidx]
box_and_score = ginst_to_box_and_score_cls_scores(ginst)
linst.cls_high = ginst.cls_scores_acc[1:].argmax() + 1 # this cls result is only accurate for dynamic averaging result
linst.linked_to_gidx = gidx
else: # if not linked
if linst.cls_score >= cfg.TEST.SCORE_THRESH:
if len(inst_mem) > 0:
iou_sum = iou_array[gidx_linked, j].sum()
#compute_IOM(box_me=, box_B=)
# exception handling
if iou_sum > 0.5: # if linst overlaps with linked ginsts of this frame
iou_max_index = np.argmax(iou_array_final[:, j])
if linst.cls == inst_mem[iou_max_index].cls and linst.cls_score < inst_mem[iou_max_index].cls_score:
logger.debug(
'[%dth frame] linst[%d](LID:%d, %s, %.3f) will be remained linst because of overlap(%.2f) with ginsts{g_linked}'.format(
g_linked=gidx_linked)
% (idx + delta, j, linst.LID, classes[linst.cls], linst.cls_score, iou_sum))
box_and_score = linst_to_box_and_score(linst)
continue
logger.debug('[%dth frame] linst[%d](LID:%d, %s, %.3f) became new ginst_memory[%d]' % (
idx + delta, j, linst.LID, classes[linst.cls], linst.cls_score, ginst_ID))
new_ginst = linst.make_global_inst(ginst_ID)
new_ginst.cls_scores = linst.cls_scores
new_ginst.cls_scores_acc = linst.cls_scores_acc
list_new_ginsts.append(new_ginst)
linst.linked_to = [ginst_ID]
linst.linked_to_gidx = len(inst_mem) + len(list_new_ginsts) - 1
ginst_ID = ginst_ID + 1
box_and_score = ginst_to_box_and_score_cls_scores(new_ginst)
else:
logger.debug(
'[%dth frame] linst[%d](LID:%d, %s, %.3f) will be remained linst because of low cls_score' % (
idx + delta, j, linst.LID, classes[linst.cls], linst.cls_score))
box_and_score = linst_to_box_and_score(linst)
all_boxes_inst[linst.cls_high][idx + delta].append(box_and_score)
for i in range(num_classes):
all_boxes_inst[i][idx + delta] = np.array(all_boxes_inst[i][idx + delta])
keep = nms(all_boxes_inst[i][idx + delta])
all_boxes[i][idx + delta] = all_boxes_inst[i][idx + delta][keep, :]
inst_mem.extend(list_new_ginsts)
out_im_ginst = 0
out_im_linst = 0
if vis:
out_im_ginst = draw_all_ginst(center_image, inst_mem, classes, scales[delta], cfg, idx+delta)
out_im_linst = draw_all_linst(center_image, inst_mem_now, inst_mem, classes, scales[delta], cfg)
#out_im2 = draw_all_rois(center_image, rois, scales[delta], cfg) # print rois from RPN
out_im = 0
return ginst_ID, out_im, out_im_ginst, out_im_linst
| 52.359125
| 197
| 0.549819
| 8,200
| 62,255
| 3.883902
| 0.068415
| 0.034947
| 0.018839
| 0.012246
| 0.778448
| 0.74686
| 0.720077
| 0.686919
| 0.667891
| 0.660952
| 0
| 0.019669
| 0.336873
| 62,255
| 1,188
| 198
| 52.403199
| 0.751786
| 0.112473
| 0
| 0.640678
| 0
| 0.027119
| 0.051447
| 0.002355
| 0
| 0
| 0
| 0
| 0.00565
| 0
| null | null | 0
| 0.028249
| null | null | 0.00339
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
f9274a552f7bd23d0303ea41ab7da1df9847093c
| 902
|
py
|
Python
|
cookbook/variable-number-of-products/serializer/tasks.py
|
jramirez857/projects
|
de47cf98cc6b4cc14117924b623ded989ab870d7
|
[
"Apache-2.0"
] | 44
|
2020-07-07T13:35:51.000Z
|
2022-03-25T21:45:43.000Z
|
cookbook/variable-number-of-products/serializer/tasks.py
|
jramirez857/projects
|
de47cf98cc6b4cc14117924b623ded989ab870d7
|
[
"Apache-2.0"
] | 20
|
2020-10-15T01:33:28.000Z
|
2022-03-18T14:43:16.000Z
|
cookbook/variable-number-of-products/serializer/tasks.py
|
jramirez857/projects
|
de47cf98cc6b4cc14117924b623ded989ab870d7
|
[
"Apache-2.0"
] | 4
|
2021-10-17T09:21:05.000Z
|
2022-02-06T22:38:50.000Z
|
import json
from random import randint
def variable():
"""
A task that generates a variable number of products (keys are filenames,
values are products)
"""
return {f'{x}.txt': str(x) for x in range(randint(1, 5))}
def many_products_one_variable():
"""
A task that generates a fixed-size product ('one') and a variable-size
product ('variable')
"""
return {
'one': 1,
'variable': {f'{x}.txt': str(x)
for x in range(randint(1, 5))}
}
def variable_downstream(upstream):
"""
A task that dumps to JSON the output of "variable"
"""
return json.dumps(upstream['variable'])
def many_products_one_variable_downstream(upstream):
"""
A task that dumps to JSON the output "variable" of
"many_products_one_variable"
"""
return json.dumps(upstream['many_products_one_variable']['variable'])
| 24.378378
| 76
| 0.631929
| 121
| 902
| 4.595041
| 0.330579
| 0.035971
| 0.064748
| 0.165468
| 0.580935
| 0.410072
| 0.31295
| 0.31295
| 0.31295
| 0.31295
| 0
| 0.007331
| 0.243902
| 902
| 37
| 77
| 24.378378
| 0.807918
| 0.350333
| 0
| 0
| 1
| 0
| 0.13035
| 0.050584
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0.142857
| 0
| 0.714286
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
006053e36cabd5815ea8362f0b2abbdee31ba0e6
| 172
|
py
|
Python
|
freetrade/__init__.py
|
DainisGorbunovs/freetrade
|
1f589b9bbf607dc2f1017b29b664d97dd49379b7
|
[
"MIT"
] | 32
|
2019-05-21T17:18:18.000Z
|
2022-02-01T22:14:19.000Z
|
freetrade/__init__.py
|
DainisGorbunovs/freetrade
|
1f589b9bbf607dc2f1017b29b664d97dd49379b7
|
[
"MIT"
] | 3
|
2020-05-09T14:05:31.000Z
|
2021-02-08T19:54:37.000Z
|
freetrade/__init__.py
|
DainisGorbunovs/freetrade
|
1f589b9bbf607dc2f1017b29b664d97dd49379b7
|
[
"MIT"
] | 1
|
2021-02-06T13:20:54.000Z
|
2021-02-06T13:20:54.000Z
|
from .credentials import Credentials
from .auth import Auth
from .api import API
from .index import Index
from .datastore import DataStore
from .freetrade import FreeTrade
| 24.571429
| 36
| 0.825581
| 24
| 172
| 5.916667
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139535
| 172
| 6
| 37
| 28.666667
| 0.959459
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
007e0576100f8772376edd8a3a0f458719ded107
| 262
|
py
|
Python
|
Deprecated/helper.py
|
JTermens/MacroFlexEngine
|
568ad52c5682569ee7c7331859f5ffd38a368478
|
[
"MIT"
] | null | null | null |
Deprecated/helper.py
|
JTermens/MacroFlexEngine
|
568ad52c5682569ee7c7331859f5ffd38a368478
|
[
"MIT"
] | null | null | null |
Deprecated/helper.py
|
JTermens/MacroFlexEngine
|
568ad52c5682569ee7c7331859f5ffd38a368478
|
[
"MIT"
] | 1
|
2020-07-04T12:49:16.000Z
|
2020-07-04T12:49:16.000Z
|
class BytesIntEncoder:
@staticmethod
def encode(s: str) -> int:
return int.from_bytes(s.encode(), byteorder='big')
@staticmethod
def decode(i: int) -> str:
return i.to_bytes(((i.bit_length() + 7) // 8), byteorder='big').decode()
| 29.111111
| 80
| 0.610687
| 34
| 262
| 4.617647
| 0.588235
| 0.191083
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009756
| 0.217557
| 262
| 8
| 81
| 32.75
| 0.756098
| 0
| 0
| 0.285714
| 0
| 0
| 0.022901
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0
| 0.285714
| 0.714286
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
0093401ef41fd70e9204836c286d771218ecc070
| 270
|
py
|
Python
|
conversationinsights/policies/__init__.py
|
osswangxining/conversationinsights-dialogue
|
07490b6307667b0d0ddc2c4fb8aa4f8d7b853df9
|
[
"Apache-2.0"
] | 8
|
2017-10-10T02:18:09.000Z
|
2019-12-16T15:14:13.000Z
|
conversationinsights/policies/__init__.py
|
osswangxining/conversationinsights-dialogue
|
07490b6307667b0d0ddc2c4fb8aa4f8d7b853df9
|
[
"Apache-2.0"
] | null | null | null |
conversationinsights/policies/__init__.py
|
osswangxining/conversationinsights-dialogue
|
07490b6307667b0d0ddc2c4fb8aa4f8d7b853df9
|
[
"Apache-2.0"
] | 2
|
2018-06-26T02:03:41.000Z
|
2018-08-06T10:54:46.000Z
|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from conversationinsights.policies.policy import Policy
from conversationinsights.policies.trainer import PolicyTrainer
| 33.75
| 63
| 0.892593
| 31
| 270
| 7.16129
| 0.451613
| 0.18018
| 0.288288
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.092593
| 270
| 7
| 64
| 38.571429
| 0.906122
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0.166667
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
00bf141f94a868228065f0f60baee56784b30f41
| 1,077
|
py
|
Python
|
catkin_ws/build/mobrob_util/cmake/mobrob_util-genmsg-context.py
|
KaibiaoRuan/mobile-robot-controller
|
ac931b925d42c152a214385f1c0af2fa4acfea73
|
[
"MIT"
] | null | null | null |
catkin_ws/build/mobrob_util/cmake/mobrob_util-genmsg-context.py
|
KaibiaoRuan/mobile-robot-controller
|
ac931b925d42c152a214385f1c0af2fa4acfea73
|
[
"MIT"
] | null | null | null |
catkin_ws/build/mobrob_util/cmake/mobrob_util-genmsg-context.py
|
KaibiaoRuan/mobile-robot-controller
|
ac931b925d42c152a214385f1c0af2fa4acfea73
|
[
"MIT"
] | null | null | null |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/pi/catkin_ws/src/mobrob_util/msg/ME439SensorsRaw.msg;/home/pi/catkin_ws/src/mobrob_util/msg/ME439SensorsProcessed.msg;/home/pi/catkin_ws/src/mobrob_util/msg/ME439WheelSpeeds.msg;/home/pi/catkin_ws/src/mobrob_util/msg/ME439MotorCommands.msg;/home/pi/catkin_ws/src/mobrob_util/msg/ME439WheelAngles.msg;/home/pi/catkin_ws/src/mobrob_util/msg/ME439WheelDisplacements.msg;/home/pi/catkin_ws/src/mobrob_util/msg/ME439PathSpecs.msg;/home/pi/catkin_ws/src/mobrob_util/msg/ME439WaypointXY.msg"
services_str = ""
pkg_name = "mobrob_util"
dependencies_str = "geometry_msgs;std_msgs"
langs = "gencpp;geneus;genlisp;gennodejs;genpy"
dep_include_paths_str = "mobrob_util;/home/pi/catkin_ws/src/mobrob_util/msg;geometry_msgs;/opt/ros/melodic/share/geometry_msgs/cmake/../msg;std_msgs;/opt/ros/melodic/share/std_msgs/cmake/../msg"
PYTHON_EXECUTABLE = "/usr/bin/python2"
package_has_static_sources = '' == 'TRUE'
genmsg_check_deps_script = "/opt/ros/melodic/share/genmsg/cmake/../../../lib/genmsg/genmsg_check_deps.py"
| 89.75
| 506
| 0.814299
| 168
| 1,077
| 4.970238
| 0.35119
| 0.131737
| 0.129341
| 0.150898
| 0.401198
| 0.348503
| 0.348503
| 0.348503
| 0.276647
| 0
| 0
| 0.023969
| 0.031569
| 1,077
| 11
| 507
| 97.909091
| 0.776606
| 0.045497
| 0
| 0
| 1
| 0.222222
| 0.802144
| 0.77193
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
00c82d9fb28f4e943c2d9fe797c707bc819f7ebe
| 446
|
py
|
Python
|
pyPractise/jcp007.py
|
enyaooshigaolo/MyPython
|
67dc3f6ff596545ab70e11a573a6031232128711
|
[
"Apache-2.0"
] | null | null | null |
pyPractise/jcp007.py
|
enyaooshigaolo/MyPython
|
67dc3f6ff596545ab70e11a573a6031232128711
|
[
"Apache-2.0"
] | null | null | null |
pyPractise/jcp007.py
|
enyaooshigaolo/MyPython
|
67dc3f6ff596545ab70e11a573a6031232128711
|
[
"Apache-2.0"
] | null | null | null |
'''
Created on 2017年1月6日
@author: Think
【程序7】
题目:输出特殊图案,请在c环境中运行,看一看,Very Beautiful!
1.程序分析:字符共有256个。不同字符,图形不一样。
2.程序源代码:
'''
import os
import sys
def jcp007():
a = 176
b = 219
print(chr(b),chr(a),chr(a),chr(a),chr(b))
print(chr(a),chr(b),chr(a),chr(a),chr(a))
print(chr(a),chr(a),chr(a),chr(b),chr(a))
print(chr(a),chr(b),chr(a),chr(a),chr(a))
print(chr(b),chr(a),chr(a),chr(a),chr(b))
jcp007()
| 18.583333
| 45
| 0.576233
| 85
| 446
| 3.023529
| 0.352941
| 0.280156
| 0.40856
| 0.311284
| 0.486381
| 0.486381
| 0.470817
| 0.470817
| 0.420233
| 0.420233
| 0
| 0.065574
| 0.179372
| 446
| 24
| 46
| 18.583333
| 0.636612
| 0.278027
| 0
| 0.363636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.090909
| false
| 0
| 0.181818
| 0
| 0.272727
| 0.454545
| 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
|
00cd714d767de17e1832353533e04b8196f78b65
| 1,194
|
py
|
Python
|
src/apiUtils.py
|
prakharbahuguna/PyPlyServer
|
d5b17feb288352c63283ccd1c1c107339870c89d
|
[
"MIT"
] | null | null | null |
src/apiUtils.py
|
prakharbahuguna/PyPlyServer
|
d5b17feb288352c63283ccd1c1c107339870c89d
|
[
"MIT"
] | null | null | null |
src/apiUtils.py
|
prakharbahuguna/PyPlyServer
|
d5b17feb288352c63283ccd1c1c107339870c89d
|
[
"MIT"
] | null | null | null |
__author__ = 'matt'
import json
import spotipy
import spotipy.util as util
import sys
import os
datapath = os.path.dirname(os.path.realpath(__file__)) + '/data'
sys.path.insert(0, datapath)
DATA_PATH = os.path.join(datapath, "API_info")
class APIUtils():
def __init__(self):
self.apiInfo = json.load(open(DATA_PATH))
def getAPI_JSON(self):
return self.apiInfo
def getSpotifyClientID(self):
return self.apiInfo["spotifyClientID"]
def getSpotifyClientSecret(self):
return self.apiInfo["spotifyClientSecret"]
def getSpotifyRedirectURI(self):
return self.apiInfo["spotifyRedirectURI"]
def getSpotifyTokenURL(self):
return self.apiInfo["spotifyTokenURL"]
def getFacebookID(self):
return self.apiInfo["facebookID"]
def getFacebookSecret(self):
return self.apiInfo["facebookSecret"]
def getSpotifyToken(self, user):
return util.prompt_for_user_token(username=user, scope="playlist-modify-public", client_id=self.apiInfo["spotifyClientID"],
client_secret=self.apiInfo["spotifyClientSecret"], redirect_uri=self.apiInfo["spotifyRedirectURI"])
| 29.121951
| 141
| 0.697655
| 129
| 1,194
| 6.286822
| 0.44186
| 0.149199
| 0.120838
| 0.181258
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.001038
| 0.193467
| 1,194
| 41
| 141
| 29.121951
| 0.841122
| 0
| 0
| 0
| 0
| 0
| 0.152301
| 0.01841
| 0
| 0
| 0
| 0
| 0
| 1
| 0.310345
| false
| 0
| 0.172414
| 0.275862
| 0.793103
| 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
|
00d0ae858849631bb5ae475f200a17fc53bd96d6
| 40
|
py
|
Python
|
scripts/npc/stage43npc.py
|
kleric/initiald
|
f05579c8919d6bbecce8e67da1a807cb522cde99
|
[
"MIT"
] | null | null | null |
scripts/npc/stage43npc.py
|
kleric/initiald
|
f05579c8919d6bbecce8e67da1a807cb522cde99
|
[
"MIT"
] | null | null | null |
scripts/npc/stage43npc.py
|
kleric/initiald
|
f05579c8919d6bbecce8e67da1a807cb522cde99
|
[
"MIT"
] | null | null | null |
sm.teleportToPortal(6)
chr.lapCount = 0
| 20
| 23
| 0.775
| 6
| 40
| 5.166667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.055556
| 0.1
| 40
| 2
| 24
| 20
| 0.805556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
dac3ce4d32d0bedcb6ef8737693d615e60e8a015
| 90
|
py
|
Python
|
mci/__init__.py
|
brighthive/master-client-index
|
b5aeb600d7e9e7c07a0b57deb2b4d89b3f90fd2f
|
[
"MIT"
] | 2
|
2019-05-29T14:10:56.000Z
|
2019-06-27T02:53:01.000Z
|
mci/__init__.py
|
brighthive/master-client-index
|
b5aeb600d7e9e7c07a0b57deb2b4d89b3f90fd2f
|
[
"MIT"
] | 22
|
2019-05-01T21:19:53.000Z
|
2020-07-01T23:15:21.000Z
|
mci/__init__.py
|
brighthive/master-client-index
|
b5aeb600d7e9e7c07a0b57deb2b4d89b3f90fd2f
|
[
"MIT"
] | 1
|
2020-04-29T18:18:31.000Z
|
2020-04-29T18:18:31.000Z
|
from mci.app import create_app
from mci.config.config import ConfigurationFactory, Config
| 30
| 58
| 0.855556
| 13
| 90
| 5.846154
| 0.538462
| 0.184211
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 90
| 2
| 59
| 45
| 0.938272
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
dacb85325eb3841f43baa12361e8d497e4bb9546
| 304
|
py
|
Python
|
starfish/pipeline/features/spots/decoder/iss.py
|
Xiaojieqiu/starfish
|
426480fcfeda4b8b1eb9371a818ff20275ac898d
|
[
"MIT"
] | 1
|
2018-10-07T03:53:43.000Z
|
2018-10-07T03:53:43.000Z
|
starfish/pipeline/features/spots/decoder/iss.py
|
Xiaojieqiu/starfish
|
426480fcfeda4b8b1eb9371a818ff20275ac898d
|
[
"MIT"
] | null | null | null |
starfish/pipeline/features/spots/decoder/iss.py
|
Xiaojieqiu/starfish
|
426480fcfeda4b8b1eb9371a818ff20275ac898d
|
[
"MIT"
] | null | null | null |
from ._base import DecoderAlgorithmBase
class IssDecoder(DecoderAlgorithmBase):
def __init__(self, **kwargs):
pass
@classmethod
def add_arguments(cls, group_parser):
pass
def decode(self, intensities, codebook):
return codebook.decode_per_hyb_max(intensities)
| 21.714286
| 55
| 0.710526
| 32
| 304
| 6.4375
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.213816
| 304
| 13
| 56
| 23.384615
| 0.861925
| 0
| 0
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0.222222
| 0.111111
| 0.111111
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
dad228857b28e23f9be130a53cee8b6b30d5d9bf
| 246
|
py
|
Python
|
tools/bin/pythonSrc/pychecker-0.8.18/test_input/test64.py
|
YangHao666666/hawq
|
10cff8350f1ba806c6fec64eb67e0e6f6f24786c
|
[
"Artistic-1.0-Perl",
"ISC",
"bzip2-1.0.5",
"TCL",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"PostgreSQL",
"BSD-3-Clause"
] | 450
|
2015-09-05T09:12:51.000Z
|
2018-08-30T01:45:36.000Z
|
tools/bin/pythonSrc/pychecker-0.8.18/test_input/test64.py
|
YangHao666666/hawq
|
10cff8350f1ba806c6fec64eb67e0e6f6f24786c
|
[
"Artistic-1.0-Perl",
"ISC",
"bzip2-1.0.5",
"TCL",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"PostgreSQL",
"BSD-3-Clause"
] | 1,274
|
2015-09-22T20:06:16.000Z
|
2018-08-31T22:14:00.000Z
|
tools/bin/pythonSrc/pychecker-0.8.18/test_input/test64.py
|
YangHao666666/hawq
|
10cff8350f1ba806c6fec64eb67e0e6f6f24786c
|
[
"Artistic-1.0-Perl",
"ISC",
"bzip2-1.0.5",
"TCL",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"PostgreSQL",
"BSD-3-Clause"
] | 278
|
2015-09-21T19:15:06.000Z
|
2018-08-31T00:36:51.000Z
|
'''spurious warnings reported by Andrew Dalke
'''
import sys, string, re
import array
class _Anything: pass
_anything = _Anything()
def outer():
def x():
return _anything
def y():
return dir(string.translate)
x()
| 13.666667
| 45
| 0.638211
| 30
| 246
| 5.1
| 0.7
| 0.143791
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.256098
| 246
| 17
| 46
| 14.470588
| 0.836066
| 0.170732
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.3
| false
| 0.1
| 0.2
| 0.2
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
dae6bdf1d5cc0a69559c1ae3e57e8574435f6fdb
| 174
|
py
|
Python
|
src/loading_multi_subject_data/read_mat.py
|
AlexLamson/JINS-blink
|
7a8afabca7e38176ddd15fa29e5192c9d6b7e8fe
|
[
"MIT"
] | null | null | null |
src/loading_multi_subject_data/read_mat.py
|
AlexLamson/JINS-blink
|
7a8afabca7e38176ddd15fa29e5192c9d6b7e8fe
|
[
"MIT"
] | 1
|
2018-06-22T18:27:38.000Z
|
2018-06-22T18:27:38.000Z
|
src/loading_multi_subject_data/read_mat.py
|
AlexLamson/JINS-blink
|
7a8afabca7e38176ddd15fa29e5192c9d6b7e8fe
|
[
"MIT"
] | null | null | null |
import scipy.io
# mat = scipy.io.loadmat('105_label0.mat')
# print(mat['time_stamps'].flatten())
mat = scipy.io.loadmat('categories.mat')
print(mat['categories'].flatten())
| 24.857143
| 42
| 0.712644
| 25
| 174
| 4.88
| 0.48
| 0.172131
| 0.163934
| 0.278689
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.024845
| 0.074713
| 174
| 6
| 43
| 29
| 0.732919
| 0.436782
| 0
| 0
| 0
| 0
| 0.252632
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
daedc4de58f74353afef9cde9dc5d78d00f9f1df
| 695
|
py
|
Python
|
src/errors/channel.py
|
xrenata/krema
|
9923988266d1c7c27fe793d642ea34747744d449
|
[
"MIT"
] | 2
|
2021-08-10T08:24:18.000Z
|
2022-02-02T14:21:25.000Z
|
src/errors/channel.py
|
xrenata/krema
|
9923988266d1c7c27fe793d642ea34747744d449
|
[
"MIT"
] | null | null | null |
src/errors/channel.py
|
xrenata/krema
|
9923988266d1c7c27fe793d642ea34747744d449
|
[
"MIT"
] | 1
|
2022-01-01T19:53:39.000Z
|
2022-01-01T19:53:39.000Z
|
"""
Errors about channels.
"""
class FetchChannelFailed(Exception):
"""Raises when fetching a channel is failed."""
pass
class FetchChannelMessagesFailed(Exception):
"""Raises when fetching messages from channel is failed."""
pass
class FetchChannelMessageFailed(Exception):
"""Raises when fetching A message from channel is failed."""
pass
class BulkDeleteMessagesFailed(Exception):
"""Raises when purge messages from channel is failed."""
pass
class EditChannelFailed(Exception):
"""Raises when editing the channel is failed."""
pass
class DeleteChannelFailed(Exception):
"""Raises when deleting the channel is failed."""
pass
| 17.375
| 64
| 0.709353
| 73
| 695
| 6.753425
| 0.356164
| 0.182556
| 0.231237
| 0.231237
| 0.464503
| 0.20284
| 0.146045
| 0
| 0
| 0
| 0
| 0
| 0.194245
| 695
| 39
| 65
| 17.820513
| 0.880357
| 0.447482
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 0
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
daf1f7dfb844b08e7a439ec4621db16ea9122b96
| 1,642
|
py
|
Python
|
absympla/core/types/participant.py
|
4U360/ABSympla
|
041b7b338c66228c76feac9628b2c698ae00137c
|
[
"MIT"
] | null | null | null |
absympla/core/types/participant.py
|
4U360/ABSympla
|
041b7b338c66228c76feac9628b2c698ae00137c
|
[
"MIT"
] | null | null | null |
absympla/core/types/participant.py
|
4U360/ABSympla
|
041b7b338c66228c76feac9628b2c698ae00137c
|
[
"MIT"
] | null | null | null |
from decimal import Decimal
from collections import namedtuple
from typing import Iterator
CustomForm = namedtuple('CustomForm', ["id", "name", "value"])
class Participant(object):
__data = {}
def __init__(self, **kwargs):
self.__data = {**kwargs}
@property
def data(self) -> dict:
return self.__data
@property
def id(self) -> int:
return self.data.get("id")
@property
def order_id(self) -> str:
return self.data.get("order_id")
@property
def first_name(self) -> str:
return self.data.get("first_name", "")
@property
def last_name(self) -> str:
return self.data.get("last_name", "")
@property
def email(self) -> str:
return self.data.get("email", "")
@property
def ticket_number(self) -> str:
return self.data.get("ticket_number", "")
@property
def ticket_num_qr_code(self) -> str:
return self.data.get("ticket_num_qr_code", "")
@property
def ticket_name(self) -> str:
return self.data.get("ticket_name", "")
@property
def pdv_user(self) -> str:
return self.data.get("pdv_user", "")
@property
def ticket_sale_price(self) -> float:
return self.data.get("ticket_sale_price", 0)
@property
def ticket_sale_price_decimal(self) -> Decimal:
return Decimal(self.ticket_sale_price)
@property
def checkin(self) -> dict:
return self.data.get("checkin", {})
@property
def custom_form(self) -> Iterator[CustomForm]:
for form in self.data.get("custom_form", []):
yield CustomForm(**form)
| 24.147059
| 62
| 0.611449
| 202
| 1,642
| 4.777228
| 0.227723
| 0.116062
| 0.174093
| 0.193782
| 0.353368
| 0.230052
| 0.15544
| 0
| 0
| 0
| 0
| 0.000811
| 0.249086
| 1,642
| 68
| 63
| 24.147059
| 0.781833
| 0
| 0
| 0.27451
| 0
| 0
| 0.08521
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.294118
| false
| 0
| 0.058824
| 0.254902
| 0.647059
| 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
|
9716ab34f2ae55fec3184c30dee65cce990ee577
| 189
|
py
|
Python
|
Cura/Uranium/UM/Qt/Bindings/__init__.py
|
TIAO-JI-FU/3d-printing-with-moveo-1
|
100ecfd1208fe1890f8bada946145d716b2298eb
|
[
"MIT"
] | null | null | null |
Cura/Uranium/UM/Qt/Bindings/__init__.py
|
TIAO-JI-FU/3d-printing-with-moveo-1
|
100ecfd1208fe1890f8bada946145d716b2298eb
|
[
"MIT"
] | null | null | null |
Cura/Uranium/UM/Qt/Bindings/__init__.py
|
TIAO-JI-FU/3d-printing-with-moveo-1
|
100ecfd1208fe1890f8bada946145d716b2298eb
|
[
"MIT"
] | null | null | null |
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
## \package Bindings
# Qt-based classes providing data bindings between Python and QML.
| 31.5
| 67
| 0.756614
| 29
| 189
| 4.931034
| 0.931034
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.032051
| 0.174603
| 189
| 5
| 68
| 37.8
| 0.884615
| 0.941799
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
974f778bd0ee1c12515ef2bdc490b22e9fee9ce7
| 103
|
py
|
Python
|
version_metadata/__main__.py
|
bonitalam/ihec-ecosystems
|
55c1c7248422705d07405e7dd72e13f18e092935
|
[
"Apache-2.0"
] | 7
|
2015-11-17T06:52:52.000Z
|
2021-09-28T18:45:15.000Z
|
version_metadata/__main__.py
|
bonitalam/ihec-ecosystems
|
55c1c7248422705d07405e7dd72e13f18e092935
|
[
"Apache-2.0"
] | 87
|
2015-08-31T02:21:39.000Z
|
2022-02-25T18:59:27.000Z
|
version_metadata/__main__.py
|
bonitalam/ihec-ecosystems
|
55c1c7248422705d07405e7dd72e13f18e092935
|
[
"Apache-2.0"
] | 3
|
2019-10-04T16:05:21.000Z
|
2021-08-04T21:19:16.000Z
|
from .config import Config
from .main import main
if __name__ == '__main__':
main(Config.sys())
| 10.3
| 27
| 0.68932
| 14
| 103
| 4.5
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.194175
| 103
| 9
| 28
| 11.444444
| 0.759036
| 0
| 0
| 0
| 0
| 0
| 0.079208
| 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
|
9766a854b1b36ba3838d22326da0499d2f45738c
| 100
|
py
|
Python
|
jawfish/static/script/Lib/browser/websocket.py
|
NeolithEra/jawfish
|
22fe222e607f0ad275860c75d81ab41114a18eb3
|
[
"MIT"
] | 52
|
2016-08-08T15:08:19.000Z
|
2022-03-23T09:48:53.000Z
|
jawfish/static/script/Lib/browser/websocket.py
|
NeolithEra/jawfish
|
22fe222e607f0ad275860c75d81ab41114a18eb3
|
[
"MIT"
] | 6
|
2016-10-09T19:50:49.000Z
|
2019-08-17T15:34:21.000Z
|
jawfish/static/script/Lib/browser/websocket.py
|
NeolithEra/jawfish
|
22fe222e607f0ad275860c75d81ab41114a18eb3
|
[
"MIT"
] | 15
|
2017-02-03T03:08:57.000Z
|
2021-08-04T06:11:15.000Z
|
from browser import window
import javascript
WebSocket = javascript.JSConstructor(window.WebSocket)
| 25
| 54
| 0.86
| 11
| 100
| 7.818182
| 0.636364
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.09
| 100
| 4
| 54
| 25
| 0.945055
| 0
| 0
| 0
| 0
| 0
| 0
| 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
|
978447600bd72802137eebd65fe4cd6a59e7eeac
| 39
|
py
|
Python
|
.history/ClassFiles/Control Flow/BreakStatement_20210101215307.py
|
minefarmer/Comprehensive-Python
|
f97b9b83ec328fc4e4815607e6a65de90bb8de66
|
[
"Unlicense"
] | null | null | null |
.history/ClassFiles/Control Flow/BreakStatement_20210101215307.py
|
minefarmer/Comprehensive-Python
|
f97b9b83ec328fc4e4815607e6a65de90bb8de66
|
[
"Unlicense"
] | null | null | null |
.history/ClassFiles/Control Flow/BreakStatement_20210101215307.py
|
minefarmer/Comprehensive-Python
|
f97b9b83ec328fc4e4815607e6a65de90bb8de66
|
[
"Unlicense"
] | null | null | null |
''' Break statement
'''
| 3.9
| 27
| 0.358974
| 2
| 39
| 7
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.487179
| 39
| 10
| 28
| 3.9
| 0.7
| 0.384615
| 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
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
97971067c78d2fef1d7750883fb0a158e5963307
| 287
|
py
|
Python
|
planner/urls.py
|
miichaek/Planner-react_imp0
|
64d20d4070ca759cc53e97ce4e7c828caef5c5a9
|
[
"MIT"
] | null | null | null |
planner/urls.py
|
miichaek/Planner-react_imp0
|
64d20d4070ca759cc53e97ce4e7c828caef5c5a9
|
[
"MIT"
] | null | null | null |
planner/urls.py
|
miichaek/Planner-react_imp0
|
64d20d4070ca759cc53e97ce4e7c828caef5c5a9
|
[
"MIT"
] | null | null | null |
from django.urls import path
from .views import SignUpView
from planner import views
# from django.urls import path
from django.contrib import admin
from django.urls import path
from planner import views
urlpatterns = [
# path('signup/', SignUpView.as_view(), name='signup'),
]
| 17.9375
| 59
| 0.756098
| 40
| 287
| 5.4
| 0.375
| 0.185185
| 0.194444
| 0.277778
| 0.388889
| 0.388889
| 0
| 0
| 0
| 0
| 0
| 0
| 0.160279
| 287
| 15
| 60
| 19.133333
| 0.896266
| 0.285714
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.75
| 0
| 0.75
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
97b0112f78fbbf9229c2fd7f1c367f3e0842e96d
| 214
|
py
|
Python
|
__init__.py
|
MichaelSchwabe/conv-ebnas-abgabe
|
f463d7bbd9b514597e19d25007913f7994cbbf7c
|
[
"MIT"
] | 6
|
2021-11-03T07:20:48.000Z
|
2021-11-10T08:20:44.000Z
|
__init__.py
|
MichaelSchwabe/conv-ebnas-abgabe
|
f463d7bbd9b514597e19d25007913f7994cbbf7c
|
[
"MIT"
] | 1
|
2021-11-02T21:10:51.000Z
|
2021-11-02T21:11:05.000Z
|
__init__.py
|
MichaelSchwabe/conv-ebnas-abgabe
|
f463d7bbd9b514597e19d25007913f7994cbbf7c
|
[
"MIT"
] | null | null | null |
from .evolution import Evolution
from .genome_handler import GenomeHandler
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
__all__ = ['Evolution', 'GenomeHandler']
| 42.8
| 74
| 0.794393
| 27
| 214
| 6.037037
| 0.740741
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.093458
| 214
| 5
| 75
| 42.8
| 0.840206
| 0
| 0
| 0
| 0
| 0
| 0.209302
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.6
| 0
| 0.6
| 0.2
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
97cdfcbc3ffaf27fc94cf343eb45cfae8fd97295
| 84
|
py
|
Python
|
swift/lib/utils.py
|
sun3shines/swift-1.7.4
|
980d2cd98b6cad82d3e182a26f608292ba51c37a
|
[
"Apache-2.0"
] | null | null | null |
swift/lib/utils.py
|
sun3shines/swift-1.7.4
|
980d2cd98b6cad82d3e182a26f608292ba51c37a
|
[
"Apache-2.0"
] | null | null | null |
swift/lib/utils.py
|
sun3shines/swift-1.7.4
|
980d2cd98b6cad82d3e182a26f608292ba51c37a
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
def file_decrypt(data,mode,storetype):
return data
| 9.333333
| 38
| 0.619048
| 11
| 84
| 4.636364
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015152
| 0.214286
| 84
| 8
| 39
| 10.5
| 0.757576
| 0.25
| 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
|
c105d41c0af7706ed6d8b29c3a9faace55e58306
| 582
|
py
|
Python
|
test_dir/python/good_morning.py
|
ekzemplaro/data_base_language
|
e77030367ffc595f1fac8583f03f9a3ce5eb1611
|
[
"MIT",
"Unlicense"
] | 3
|
2015-05-12T16:44:27.000Z
|
2021-02-09T00:39:24.000Z
|
test_dir/python/good_morning.py
|
ekzemplaro/data_base_language
|
e77030367ffc595f1fac8583f03f9a3ce5eb1611
|
[
"MIT",
"Unlicense"
] | null | null | null |
test_dir/python/good_morning.py
|
ekzemplaro/data_base_language
|
e77030367ffc595f1fac8583f03f9a3ce5eb1611
|
[
"MIT",
"Unlicense"
] | null | null | null |
#! /usr/bin/python
# -*- coding: utf-8 -*-
#
# Jan/06/2019
# ---------------------------------------------------------------
import socket
import os
import cgi
# ---------------------------------------------------------------
print("Content-Type: text/html")
print("")
print("Good Morning<p />")
print("Good Morning<p />")
print(socket.gethostname() + "<p />")
ip = socket.gethostbyname(socket.gethostname())
print(ip + "<p />")
print(cgi.escape(os.environ["REMOTE_ADDR"]) + "<p />")
print("Good Morning<p />")
# ---------------------------------------------------------------
| 27.714286
| 65
| 0.419244
| 53
| 582
| 4.584906
| 0.528302
| 0.098765
| 0.197531
| 0.209877
| 0.234568
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013258
| 0.092784
| 582
| 20
| 66
| 29.1
| 0.44697
| 0.424399
| 0
| 0.25
| 0
| 0
| 0.304878
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0.666667
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
c11876222bd3467e7ed5f513f12e4fd227163ed3
| 220
|
py
|
Python
|
helpers/common/visualization.py
|
BDALab/datascience_helpers
|
333752a49ad02e0ea3ba2bfefb32c6bfddf28172
|
[
"MIT"
] | 1
|
2019-07-22T14:16:23.000Z
|
2019-07-22T14:16:23.000Z
|
helpers/common/visualization.py
|
BDALab/datascience_helpers
|
333752a49ad02e0ea3ba2bfefb32c6bfddf28172
|
[
"MIT"
] | null | null | null |
helpers/common/visualization.py
|
BDALab/datascience_helpers
|
333752a49ad02e0ea3ba2bfefb32c6bfddf28172
|
[
"MIT"
] | 1
|
2019-12-03T17:34:50.000Z
|
2019-12-03T17:34:50.000Z
|
def starify_pval(pval):
if pval > 0.05:
return ""
else:
if pval <= 0.001:
return "***"
if pval <= 0.01:
return "**"
if pval <= 0.05:
return "*"
| 20
| 25
| 0.381818
| 25
| 220
| 3.32
| 0.4
| 0.289157
| 0.337349
| 0.216867
| 0.361446
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 0.468182
| 220
| 10
| 26
| 22
| 0.598291
| 0
| 0
| 0
| 0
| 0
| 0.027273
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.1
| false
| 0
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c12048d56a39d56fe5a070cdf60f8281ebd061d9
| 325
|
py
|
Python
|
breadp/__init__.py
|
tgweber/breadp
|
12b97b9d2d997b1345a8e026690d57b3286a04d0
|
[
"Apache-2.0"
] | null | null | null |
breadp/__init__.py
|
tgweber/breadp
|
12b97b9d2d997b1345a8e026690d57b3286a04d0
|
[
"Apache-2.0"
] | null | null | null |
breadp/__init__.py
|
tgweber/breadp
|
12b97b9d2d997b1345a8e026690d57b3286a04d0
|
[
"Apache-2.0"
] | null | null | null |
################################################################################
# Copyright: Tobias Weber 2020
#
# Apache 2.0 License
#
# This file contains code related to all breadp module
#
################################################################################
class ChecksNotRunException(Exception):
pass
| 27.083333
| 80
| 0.375385
| 21
| 325
| 5.809524
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.020478
| 0.098462
| 325
| 11
| 81
| 29.545455
| 0.395904
| 0.307692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 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
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
c1a964667833aea3f60cf46bd71b09eaa0be964b
| 1,116
|
py
|
Python
|
miriam/_utility.py
|
troydai/Miriam
|
2e7d51edc1efa4c5ea0bf8ea6eaf913b23246edd
|
[
"MIT"
] | 1
|
2017-06-27T22:07:20.000Z
|
2017-06-27T22:07:20.000Z
|
miriam/_utility.py
|
troydai/Miriam
|
2e7d51edc1efa4c5ea0bf8ea6eaf913b23246edd
|
[
"MIT"
] | null | null | null |
miriam/_utility.py
|
troydai/Miriam
|
2e7d51edc1efa4c5ea0bf8ea6eaf913b23246edd
|
[
"MIT"
] | null | null | null |
from argparse import Namespace
from azure.storage.blob import BlockBlobService
from azure.batch import BatchServiceClient
def config_logging(args: Namespace):
import logging
log_level = [logging.WARNING, logging.INFO, logging.DEBUG][args.verbose] if args.verbose < 3 else logging.DEBUG
logging.basicConfig(format='%(levelname)-8s %(name)-10s %(message)s', level=log_level)
def get_logger(scope: str = None):
import logging
return logging.getLogger('miriam').getChild(scope) if scope else logging.getLogger('miriam')
def get_command_string(*args):
return "/bin/bash -c 'set -e; set -o pipefail; {}; wait'".format(';'.join(args))
def create_batch_client(settings: dict) -> BatchServiceClient:
from azure.batch.batch_auth import SharedKeyCredentials
cred = SharedKeyCredentials(settings['azurebatch']['account'], settings['azurebatch']['key'])
return BatchServiceClient(cred, settings['azurebatch']['endpoint'])
def create_storage_client(settings: dict) -> BlockBlobService:
return BlockBlobService(settings['azurestorage']['account'], settings['azurestorage']['key'])
| 38.482759
| 115
| 0.749104
| 132
| 1,116
| 6.25
| 0.477273
| 0.032727
| 0.033939
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004061
| 0.117384
| 1,116
| 28
| 116
| 39.857143
| 0.833503
| 0
| 0
| 0.111111
| 0
| 0
| 0.163082
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.277778
| false
| 0
| 0.333333
| 0.111111
| 0.833333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 4
|
c1fb1e6b70a7422d316a8abd3562d9aa194cfc94
| 154
|
py
|
Python
|
code-samples/code-samples/indentation.py
|
ryan-blunden/intro-python
|
1bc5d2ac5c0d46c6bc1ff081817b5cae3b5625ee
|
[
"Apache-2.0"
] | null | null | null |
code-samples/code-samples/indentation.py
|
ryan-blunden/intro-python
|
1bc5d2ac5c0d46c6bc1ff081817b5cae3b5625ee
|
[
"Apache-2.0"
] | null | null | null |
code-samples/code-samples/indentation.py
|
ryan-blunden/intro-python
|
1bc5d2ac5c0d46c6bc1ff081817b5cae3b5625ee
|
[
"Apache-2.0"
] | null | null | null |
import os
import sys
def my_function():
a = 10
b = 20
def my_function_2():
a = 10
b = 20
def my_function_3():
a = 10
b = 20
| 8.555556
| 20
| 0.525974
| 27
| 154
| 2.814815
| 0.444444
| 0.197368
| 0.513158
| 0.236842
| 0.5
| 0.5
| 0.5
| 0
| 0
| 0
| 0
| 0.145833
| 0.376623
| 154
| 17
| 21
| 9.058824
| 0.645833
| 0
| 0
| 0.545455
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.272727
| false
| 0
| 0.181818
| 0
| 0.454545
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
a9e29d4ba6dad042a4821392dee1c2886cc100fd
| 89
|
py
|
Python
|
funtime/apps.py
|
Olliej91/funtime
|
12c173a58f2d69fb8960585aaa7f78f39a0e125e
|
[
"MIT"
] | null | null | null |
funtime/apps.py
|
Olliej91/funtime
|
12c173a58f2d69fb8960585aaa7f78f39a0e125e
|
[
"MIT"
] | 1
|
2020-10-27T19:23:40.000Z
|
2020-10-27T19:23:40.000Z
|
funtime/apps.py
|
Olliej91/funtime
|
12c173a58f2d69fb8960585aaa7f78f39a0e125e
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class FuntimeConfig(AppConfig):
name = 'funtime'
| 14.833333
| 33
| 0.752809
| 10
| 89
| 6.7
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.168539
| 89
| 5
| 34
| 17.8
| 0.905405
| 0
| 0
| 0
| 0
| 0
| 0.078652
| 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
|
e710d928dcebf33e00756d120724f518e7fd31f5
| 713
|
py
|
Python
|
configuration_py/tests/unit/test_load.py
|
Ferroman/configuration.py
|
c6fb46685a66d09bb17d76d3ce686ecef21769ac
|
[
"MIT"
] | 5
|
2017-03-29T23:16:27.000Z
|
2021-09-02T10:08:57.000Z
|
configuration_py/tests/unit/test_load.py
|
Ferroman/configuration.py
|
c6fb46685a66d09bb17d76d3ce686ecef21769ac
|
[
"MIT"
] | null | null | null |
configuration_py/tests/unit/test_load.py
|
Ferroman/configuration.py
|
c6fb46685a66d09bb17d76d3ce686ecef21769ac
|
[
"MIT"
] | 1
|
2017-04-20T08:55:21.000Z
|
2017-04-20T08:55:21.000Z
|
# from unittest import TestCase
#
# from mock import patch
#
# from configuration_py.configuration_load import load
# class TestGetAvailableConfigEnvList(TestCase):
# @patch('configuration_py.configuration_py._normalize_environment_label', return_value={'test': ''})
# @patch('configuration_py.configuration_py._get_available_config_environments_list')
# @patch('configuration_py.configuration_py._load_yaml_config_by_name')
# def test_should_call_load_yaml_config_by_name_with_correct_parameters(self, load_mock, available_mock, normalize_mock):
# config_name = 'test'
# config_folder = './config'
# load(config_name, config_name)
# load_mock.assert_called_once_with(config_name, config_folder)
| 44.5625
| 121
| 0.812062
| 89
| 713
| 6
| 0.404494
| 0.196629
| 0.209738
| 0.185393
| 0.271536
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.091164
| 713
| 15
| 122
| 47.533333
| 0.824074
| 0.957924
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
e72e1d5e2ea7c269c2f318be968b1df7419b7eea
| 69
|
py
|
Python
|
modular/Demo01/Crypt01.py
|
walkingtyphoon/Python-workspace
|
e872bce82b2bac3dd5d809f8576345ccc1c6afb7
|
[
"Apache-2.0"
] | null | null | null |
modular/Demo01/Crypt01.py
|
walkingtyphoon/Python-workspace
|
e872bce82b2bac3dd5d809f8576345ccc1c6afb7
|
[
"Apache-2.0"
] | null | null | null |
modular/Demo01/Crypt01.py
|
walkingtyphoon/Python-workspace
|
e872bce82b2bac3dd5d809f8576345ccc1c6afb7
|
[
"Apache-2.0"
] | null | null | null |
import crypt
password = crypt.crypt("610628", "hjm")
print(password)
| 17.25
| 39
| 0.73913
| 9
| 69
| 5.666667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.096774
| 0.101449
| 69
| 4
| 40
| 17.25
| 0.725806
| 0
| 0
| 0
| 0
| 0
| 0.128571
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.666667
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
|
0
| 4
|
e7307c7fd4d033bd1a474da1bfd16f19839d9cce
| 59
|
py
|
Python
|
tests/__init__.py
|
CoronaWhy/vt
|
a190be746a2d57974c1f0ed1558ae392c41113f2
|
[
"MIT"
] | null | null | null |
tests/__init__.py
|
CoronaWhy/vt
|
a190be746a2d57974c1f0ed1558ae392c41113f2
|
[
"MIT"
] | 11
|
2020-04-06T15:41:50.000Z
|
2020-07-03T21:08:26.000Z
|
tests/__init__.py
|
CoronaWhy/vt
|
a190be746a2d57974c1f0ed1558ae392c41113f2
|
[
"MIT"
] | 19
|
2020-03-29T12:29:37.000Z
|
2020-06-29T16:24:28.000Z
|
# -*- coding: utf-8 -*-
"""Tests for ``coronawhy_vt``."""
| 14.75
| 33
| 0.508475
| 7
| 59
| 4.142857
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02
| 0.152542
| 59
| 3
| 34
| 19.666667
| 0.56
| 0.847458
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
e732fda45dc41ed4de174139b441e65a3cacfc42
| 327
|
py
|
Python
|
python/ErrorMessage.py
|
chepiga1995/houserielt
|
49c5e5c3aa7ef483fc2c05e15bd64c16786b61f0
|
[
"MIT"
] | null | null | null |
python/ErrorMessage.py
|
chepiga1995/houserielt
|
49c5e5c3aa7ef483fc2c05e15bd64c16786b61f0
|
[
"MIT"
] | null | null | null |
python/ErrorMessage.py
|
chepiga1995/houserielt
|
49c5e5c3aa7ef483fc2c05e15bd64c16786b61f0
|
[
"MIT"
] | null | null | null |
fields = 'Incorrect some fields'
login = 'Incorrect password or login'
location = 'Incorrect location'
wrong = 'Something goes wrong. Maybe some fields are incorrect. Please connect with administrations'
load = 'not loaded'
change = 'Somefing change on site. Please connect with administrations'
not_found = 'Article not found'
| 46.714286
| 100
| 0.782875
| 42
| 327
| 6.071429
| 0.595238
| 0.078431
| 0.133333
| 0.25098
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.143731
| 327
| 7
| 101
| 46.714286
| 0.910714
| 0
| 0
| 0
| 0
| 0
| 0.740854
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.142857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
e77c0308c15d95d39c8d4c2e4d7df197085075f0
| 84
|
py
|
Python
|
blackjax/__init__.py
|
junpenglao/blackjax
|
4abebc51df841ee6fdfd71cffc21668aa69eb9d0
|
[
"Apache-2.0"
] | null | null | null |
blackjax/__init__.py
|
junpenglao/blackjax
|
4abebc51df841ee6fdfd71cffc21668aa69eb9d0
|
[
"Apache-2.0"
] | null | null | null |
blackjax/__init__.py
|
junpenglao/blackjax
|
4abebc51df841ee6fdfd71cffc21668aa69eb9d0
|
[
"Apache-2.0"
] | null | null | null |
from . import hmc, inference
__version__ = "0.0.1"
__all__ = ["hmc", "inference"]
| 14
| 30
| 0.654762
| 11
| 84
| 4.272727
| 0.727273
| 0.510638
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.042857
| 0.166667
| 84
| 5
| 31
| 16.8
| 0.628571
| 0
| 0
| 0
| 0
| 0
| 0.202381
| 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
|
e78572e11d6c3388a545b46a345b56a5b248baa1
| 1,852
|
py
|
Python
|
setup.py
|
uv-Ic/python-cloud-utils
|
af19992b311e39d5207a0baea7ae78683005f9b1
|
[
"Apache-2.0"
] | null | null | null |
setup.py
|
uv-Ic/python-cloud-utils
|
af19992b311e39d5207a0baea7ae78683005f9b1
|
[
"Apache-2.0"
] | null | null | null |
setup.py
|
uv-Ic/python-cloud-utils
|
af19992b311e39d5207a0baea7ae78683005f9b1
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from setuptools import setup
LICENSE = '''Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.'''
VERSION = '1.0.42'
setup(name='cloud-utils',
version=VERSION,
description='Python Cloud Utilities',
author='Arie Abramovici',
author_email='beast@google.com',
url='https://github.com/google/python-cloud-utils',
license=LICENSE,
homepage='https://github.com/google/python-cloud-utils',
packages=['cloud_utils'],
entry_points={'console_scripts': ['list_instances = cloud_utils.list_instances:main']},
install_requires=['boto', 'boto3', 'botocore', 'google-api-python-client==1.6.2', 'urllib3>=1.24.2',
'google-auth', 'texttable', 'python-dateutil', 'pytz', 'kubernetes'],
zip_safe=False)
| 42.090909
| 106
| 0.726242
| 265
| 1,852
| 5.041509
| 0.415094
| 0.08982
| 0.038922
| 0.047904
| 0.711078
| 0.711078
| 0.711078
| 0.657186
| 0.657186
| 0.657186
| 0
| 0.01888
| 0.170626
| 1,852
| 43
| 107
| 43.069767
| 0.850911
| 0.296436
| 0
| 0
| 0
| 0
| 0.695112
| 0.048099
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.04
| 0
| 0.04
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
e7d1442a41fdd48d14644af5d51cababab86cbf7
| 44
|
py
|
Python
|
qtools2/__init__.py
|
jkpr/QTools2
|
629caa0bd322cb2eeeb94d5a0a8180a2e3fddf74
|
[
"MIT"
] | 1
|
2018-03-08T06:32:58.000Z
|
2018-03-08T06:32:58.000Z
|
qtools2/__init__.py
|
jkpr/QTools2
|
629caa0bd322cb2eeeb94d5a0a8180a2e3fddf74
|
[
"MIT"
] | 16
|
2017-02-07T22:49:14.000Z
|
2019-11-25T16:50:58.000Z
|
qtools2/__init__.py
|
jkpr/QTools2
|
629caa0bd322cb2eeeb94d5a0a8180a2e3fddf74
|
[
"MIT"
] | 2
|
2016-09-22T16:04:25.000Z
|
2018-03-01T07:42:27.000Z
|
__all__ = ['convert']
__version__ = '0.2.7'
| 14.666667
| 21
| 0.636364
| 6
| 44
| 3.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.078947
| 0.136364
| 44
| 2
| 22
| 22
| 0.447368
| 0
| 0
| 0
| 0
| 0
| 0.272727
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
99ca3d0ac8e03b84f414aa48fccb3e0251831f56
| 219
|
py
|
Python
|
matrix_old/python/rgbmatrix/__init__.py
|
hammal/macapar
|
05fb84b8f5e967ed6d3edb0891ac58674e6b60bc
|
[
"MIT"
] | 3
|
2020-03-05T18:07:44.000Z
|
2020-03-06T00:59:02.000Z
|
matrix_old/python/rgbmatrix/__init__.py
|
hammal/macapar
|
05fb84b8f5e967ed6d3edb0891ac58674e6b60bc
|
[
"MIT"
] | 11
|
2020-10-12T01:35:43.000Z
|
2020-12-02T10:44:35.000Z
|
matrix_old/python/rgbmatrix/__init__.py
|
hammal/macapar
|
05fb84b8f5e967ed6d3edb0891ac58674e6b60bc
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
__version__ = "0.0.1"
__author__ = "Christoph Friedrich <christoph.friedrich@vonaffenfels.de>"
from .core import RGBMatrix, FrameCanvas, RGBMatrixOptions
| 27.375
| 72
| 0.771689
| 25
| 219
| 6.24
| 0.76
| 0.230769
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.020619
| 0.114155
| 219
| 7
| 73
| 31.285714
| 0.783505
| 0.09589
| 0
| 0
| 0
| 0
| 0.316327
| 0.188776
| 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
|
99e97a13709fb5200ff670d0edfcecd8b66de8a9
| 103
|
py
|
Python
|
tests/transformations/test_ozone_transf_difference.py
|
shaido987/pyaf
|
b9afd089557bed6b90b246d3712c481ae26a1957
|
[
"BSD-3-Clause"
] | 377
|
2016-10-13T20:52:44.000Z
|
2022-03-29T18:04:14.000Z
|
tests/transformations/test_ozone_transf_difference.py
|
ysdede/pyaf
|
b5541b8249d5a1cfdc01f27fdfd99b6580ed680b
|
[
"BSD-3-Clause"
] | 160
|
2016-10-13T16:11:53.000Z
|
2022-03-28T04:21:34.000Z
|
tests/transformations/test_ozone_transf_difference.py
|
ysdede/pyaf
|
b5541b8249d5a1cfdc01f27fdfd99b6580ed680b
|
[
"BSD-3-Clause"
] | 63
|
2017-03-09T14:51:18.000Z
|
2022-03-27T20:52:57.000Z
|
import tests.transformations.test_ozone_transf_generic as gen
gen.test_transformation('Difference');
| 20.6
| 61
| 0.854369
| 13
| 103
| 6.461538
| 0.846154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.067961
| 103
| 4
| 62
| 25.75
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0.098039
| 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
|
99f1b557075dcb4a7598225b8b89eb4b97bb20de
| 1,053
|
py
|
Python
|
flask/test/model_tests/test_beneficiary.py
|
boxwise/boxtribute
|
b87d3bf52e29cb485d98e669b4b43d1934abf310
|
[
"Apache-2.0"
] | 3
|
2020-10-17T06:37:10.000Z
|
2021-06-08T16:58:38.000Z
|
flask/test/model_tests/test_beneficiary.py
|
boxwise/boxtribute
|
b87d3bf52e29cb485d98e669b4b43d1934abf310
|
[
"Apache-2.0"
] | 166
|
2020-10-25T20:45:32.000Z
|
2022-03-28T08:18:26.000Z
|
flask/test/model_tests/test_beneficiary.py
|
boxwise/boxtribute
|
b87d3bf52e29cb485d98e669b4b43d1934abf310
|
[
"Apache-2.0"
] | 4
|
2021-01-01T18:03:57.000Z
|
2022-03-10T08:43:23.000Z
|
import pytest
from boxwise_flask.models.beneficiary import Beneficiary
from playhouse.shortcuts import model_to_dict
@pytest.mark.usefixtures("default_base")
@pytest.mark.usefixtures("default_beneficiary")
def test_beneficiary_model(default_base, default_beneficiary):
queried_beneficiary = Beneficiary.get_by_id(default_beneficiary["id"])
queried_beneficiary_dict = model_to_dict(queried_beneficiary)
assert queried_beneficiary_dict["id"] == default_beneficiary["id"]
assert queried_beneficiary_dict["comments"] == default_beneficiary["comments"]
assert queried_beneficiary_dict["created_on"] == default_beneficiary["created_on"]
assert queried_beneficiary_dict["created_by"] == default_beneficiary["created_by"]
assert queried_beneficiary_dict["deleted"] == default_beneficiary["deleted"]
assert queried_beneficiary_dict["family_id"] == default_beneficiary["family_id"]
assert queried_beneficiary_dict["seq"] == default_beneficiary["seq"]
assert queried_beneficiary_dict["base"]["id"] == default_base["id"]
| 50.142857
| 86
| 0.797721
| 122
| 1,053
| 6.491803
| 0.237705
| 0.25
| 0.25
| 0.282828
| 0.164141
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.092118
| 1,053
| 20
| 87
| 52.65
| 0.828452
| 0
| 0
| 0
| 0
| 0
| 0.132004
| 0
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0.0625
| false
| 0
| 0.1875
| 0
| 0.25
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
820f5f8329f74aa18011b8f7720f1857d292be60
| 930
|
py
|
Python
|
p1_basic/day08_15filefunction/day12/04_闭包.py
|
dong-pro/fullStackPython
|
5ad8662f7b57f14c8529e7eaf64290eeda773557
|
[
"Apache-2.0"
] | 1
|
2020-04-03T01:32:05.000Z
|
2020-04-03T01:32:05.000Z
|
p1_basic/day08_15filefunction/day12/04_闭包.py
|
dong-pro/fullStackPython
|
5ad8662f7b57f14c8529e7eaf64290eeda773557
|
[
"Apache-2.0"
] | null | null | null |
p1_basic/day08_15filefunction/day12/04_闭包.py
|
dong-pro/fullStackPython
|
5ad8662f7b57f14c8529e7eaf64290eeda773557
|
[
"Apache-2.0"
] | null | null | null |
# 闭包. 在内层函数中访问外层函数的变量
# 闭包的作用:
# 1. 可以保护你的变量不收侵害
# 2. 可以让一个变量常驻内存
# 查看函数是否是闭包
# a = 10 # 不安全的
#
# def outer():
# global a
# a = 20
#
# def outer_2():
# global a
# a = 30
#
# outer_2()
# outer()
#
# print(a)
# def outer():
# a = 10 # 常驻内存, 为了inner执行的时候有值.
# def inner():
# print(a)
# return inner
#
# fn = outer()
# print("fdsafasd")
# print("fdsafasd")
# print("fdsafasd")
#
# fn() # 调用的时机是不定的.
# 超简易爬虫
from urllib.request import urlopen
# def outer():
# # 常驻内存
# s = urlopen("http://tu.baidu.com/").read()
# def getContent(): # 闭包
# return s
# return getContent
#
# print("爬取内容.....")
# pa = outer()
#
# ret = pa()
# print(ret)
#
# ret = pa()
# print(ret)
#
# ret = pa()
# print(ret)
#
# ret = pa()
# print(ret)
# def func():
# a = 10
# def inner():
# print(a)
# print(inner.__closure__) # 如果打印的是None. 不是闭包. 如果不是None, 就是闭包
#
# func()
| 14.307692
| 65
| 0.52043
| 110
| 930
| 4.345455
| 0.418182
| 0.066946
| 0.083682
| 0.108787
| 0.108787
| 0.108787
| 0.108787
| 0.108787
| 0.108787
| 0.108787
| 0
| 0.020958
| 0.28172
| 930
| 65
| 66
| 14.307692
| 0.694611
| 0.822581
| 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
|
822c9bee21bd9dc068caa22b972747e97ad9ae13
| 133
|
py
|
Python
|
gym-projectile/gym_projectile/__init__.py
|
DerwenAI/gym_projectile
|
bb9ace323a96858660ce4345ad1a2335620a98a8
|
[
"MIT"
] | null | null | null |
gym-projectile/gym_projectile/__init__.py
|
DerwenAI/gym_projectile
|
bb9ace323a96858660ce4345ad1a2335620a98a8
|
[
"MIT"
] | 1
|
2020-04-27T15:49:10.000Z
|
2020-04-30T21:36:08.000Z
|
gym-projectile/gym_projectile/__init__.py
|
DerwenAI/gym_projectile
|
bb9ace323a96858660ce4345ad1a2335620a98a8
|
[
"MIT"
] | null | null | null |
from gym.envs.registration import register
register(
id="projectile-v0",
entry_point="gym_projectile.envs:Projectile_v0",
)
| 19
| 52
| 0.759398
| 17
| 133
| 5.764706
| 0.647059
| 0.244898
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017241
| 0.12782
| 133
| 6
| 53
| 22.166667
| 0.827586
| 0
| 0
| 0
| 0
| 0
| 0.345865
| 0.24812
| 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
|
82313795832550f8e51462fb83673a1e55705d1f
| 186
|
py
|
Python
|
core/models/service.py
|
themightychris/prevention-point
|
a92f98b25d32dd30bb33e7cb1ac7f10439f5203f
|
[
"MIT"
] | null | null | null |
core/models/service.py
|
themightychris/prevention-point
|
a92f98b25d32dd30bb33e7cb1ac7f10439f5203f
|
[
"MIT"
] | null | null | null |
core/models/service.py
|
themightychris/prevention-point
|
a92f98b25d32dd30bb33e7cb1ac7f10439f5203f
|
[
"MIT"
] | null | null | null |
from django.db import models
from core.models import Program
class Service(models.Model):
name = models.CharField(max_length=100)
available = models.BooleanField(default=False)
| 26.571429
| 50
| 0.77957
| 25
| 186
| 5.76
| 0.76
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.018634
| 0.134409
| 186
| 6
| 51
| 31
| 0.875776
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 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
|
8243bfab93b15f1f84946bd5e25f1f371b426016
| 51
|
py
|
Python
|
user_orders/filters/__init__.py
|
Vitamal/shop
|
facf04da00b8b674f2d8024aca4dae272a0c3de8
|
[
"MIT"
] | null | null | null |
user_orders/filters/__init__.py
|
Vitamal/shop
|
facf04da00b8b674f2d8024aca4dae272a0c3de8
|
[
"MIT"
] | null | null | null |
user_orders/filters/__init__.py
|
Vitamal/shop
|
facf04da00b8b674f2d8024aca4dae272a0c3de8
|
[
"MIT"
] | null | null | null |
from .filter_backends import RegistrationDateFilter
| 51
| 51
| 0.921569
| 5
| 51
| 9.2
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.058824
| 51
| 1
| 51
| 51
| 0.958333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
8247e2a14d31eabc717f22d7702dd0d3efb55084
| 3,130
|
py
|
Python
|
users/migrations/0002_auto_20200916_2135.py
|
Gagan-Shenoy/sushiksha-website
|
a41991df1a1d46336cbf019e83add5df56dde363
|
[
"Apache-2.0"
] | 1
|
2021-06-18T08:04:08.000Z
|
2021-06-18T08:04:08.000Z
|
users/migrations/0002_auto_20200916_2135.py
|
Gagan-Shenoy/sushiksha-website
|
a41991df1a1d46336cbf019e83add5df56dde363
|
[
"Apache-2.0"
] | 1
|
2021-02-10T16:12:58.000Z
|
2021-02-10T16:12:58.000Z
|
users/migrations/0002_auto_20200916_2135.py
|
Gagan-Shenoy/sushiksha-website
|
a41991df1a1d46336cbf019e83add5df56dde363
|
[
"Apache-2.0"
] | null | null | null |
# Generated by Django 3.1.1 on 2020-09-16 16:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='profile',
name='address',
field=models.TextField(blank=True, default=None, null=True),
),
migrations.AddField(
model_name='profile',
name='batch',
field=models.CharField(choices=[('2011', '2011'), ('2012', '2012'), ('2013', '2013'), ('2014', '2014'), ('2015', '2015'), ('2016', '2016'), ('2017', '2017'), ('2018', '2018'), ('2019', '2019'), ('2020', '2020'), ('2021', '2021')], default='2019', max_length=10),
),
migrations.AddField(
model_name='profile',
name='college',
field=models.CharField(blank=True, default=None, max_length=300, null=True),
),
migrations.AddField(
model_name='profile',
name='facebook',
field=models.URLField(blank=True, default=None, null=True),
),
migrations.AddField(
model_name='profile',
name='github',
field=models.URLField(blank=True, default=None, null=True),
),
migrations.AddField(
model_name='profile',
name='guidance',
field=models.TextField(blank=True, default=None, null=True),
),
migrations.AddField(
model_name='profile',
name='instagram',
field=models.URLField(blank=True, default=None, null=True),
),
migrations.AddField(
model_name='profile',
name='linkedin',
field=models.URLField(blank=True, default=None, null=True),
),
migrations.AddField(
model_name='profile',
name='name',
field=models.CharField(blank=True, default=None, max_length=100, null=True),
),
migrations.AddField(
model_name='profile',
name='okr',
field=models.URLField(blank=True, default=None, null=True),
),
migrations.AddField(
model_name='profile',
name='phone',
field=models.PositiveBigIntegerField(blank=True, default=None, null=True),
),
migrations.AddField(
model_name='profile',
name='points',
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name='profile',
name='profession',
field=models.CharField(blank=True, default=None, max_length=100, null=True),
),
migrations.AddField(
model_name='profile',
name='role',
field=models.CharField(choices=[('Mentee', 'Mentee'), ('Mentor', 'Mentor')], default='Mentee', max_length=10),
),
migrations.AddField(
model_name='profile',
name='twitter',
field=models.URLField(blank=True, default=None, null=True),
),
]
| 35.168539
| 274
| 0.542492
| 298
| 3,130
| 5.627517
| 0.234899
| 0.161002
| 0.205725
| 0.241503
| 0.700656
| 0.700656
| 0.655337
| 0.655337
| 0.627907
| 0.512224
| 0
| 0.05771
| 0.307987
| 3,130
| 88
| 275
| 35.568182
| 0.716528
| 0.014377
| 0
| 0.670732
| 1
| 0
| 0.110607
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.012195
| 0
| 0.04878
| 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
|
413524096aedb286a8643aca113d3b6baa8b40e8
| 271
|
py
|
Python
|
twint/__init__.py
|
wl-lab/twint
|
81416f59a3b1aa50797e765fb09a993b0a6a3e4e
|
[
"MIT"
] | null | null | null |
twint/__init__.py
|
wl-lab/twint
|
81416f59a3b1aa50797e765fb09a993b0a6a3e4e
|
[
"MIT"
] | null | null | null |
twint/__init__.py
|
wl-lab/twint
|
81416f59a3b1aa50797e765fb09a993b0a6a3e4e
|
[
"MIT"
] | 1
|
2020-11-05T11:36:19.000Z
|
2020-11-05T11:36:19.000Z
|
from .config import Config
from .errors import *
from .get import get_user_id, search_url, profile_feed_url
from .parser import parse_tweets
from .search import TwintSearch
from .token import TokenGetter
from .user_agents import default_user_agent, get_random_user_agent
| 33.875
| 66
| 0.845018
| 42
| 271
| 5.166667
| 0.5
| 0.082949
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.114391
| 271
| 7
| 67
| 38.714286
| 0.904167
| 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
|
415d3efebe108902df82eab9d771d7cfee088f65
| 118
|
py
|
Python
|
polyaxon/sidecar/apps.py
|
wbuchwalter/polyaxon
|
a01396ea86a74082c457bfbc2c91d283b6ff6fba
|
[
"MIT"
] | null | null | null |
polyaxon/sidecar/apps.py
|
wbuchwalter/polyaxon
|
a01396ea86a74082c457bfbc2c91d283b6ff6fba
|
[
"MIT"
] | null | null | null |
polyaxon/sidecar/apps.py
|
wbuchwalter/polyaxon
|
a01396ea86a74082c457bfbc2c91d283b6ff6fba
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class SideCarConfig(AppConfig):
name = 'sidecar'
verbose_name = 'SideCar'
| 16.857143
| 33
| 0.728814
| 13
| 118
| 6.538462
| 0.769231
| 0.258824
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.186441
| 118
| 6
| 34
| 19.666667
| 0.885417
| 0
| 0
| 0
| 0
| 0
| 0.118644
| 0
| 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
|
41710b10f1b6dc7c37feb446f0611a7ee9a5e736
| 469
|
py
|
Python
|
NiLBS/weighting/weighting_function_mlp.py
|
joemarch010/NILBS
|
c6568818ec8acdb0fe4bd8d197278f0abb361d0b
|
[
"MIT"
] | 2
|
2021-04-01T07:55:11.000Z
|
2021-12-10T02:57:59.000Z
|
NiLBS/weighting/weighting_function_mlp.py
|
joemarch010/NILBS
|
c6568818ec8acdb0fe4bd8d197278f0abb361d0b
|
[
"MIT"
] | null | null | null |
NiLBS/weighting/weighting_function_mlp.py
|
joemarch010/NILBS
|
c6568818ec8acdb0fe4bd8d197278f0abb361d0b
|
[
"MIT"
] | null | null | null |
from NiLBS.weighting.weighting_function import WeightingFunction
class WeightingFunctionMLP(WeightingFunction):
"""
Weighting function backed by an MLP
"""
def __init__(self, mlp):
self.mlp = mlp
def generate_query(self, x, pose):
return None
def generate_query_set(self, X, pose):
return None
def evaluate(self, x, pose):
return None
def evaluate_set(self, X, pose):
return None
| 14.212121
| 64
| 0.637527
| 55
| 469
| 5.272727
| 0.418182
| 0.068966
| 0.124138
| 0.206897
| 0.368966
| 0.368966
| 0.206897
| 0
| 0
| 0
| 0
| 0
| 0.283582
| 469
| 33
| 65
| 14.212121
| 0.863095
| 0.074627
| 0
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.416667
| false
| 0
| 0.083333
| 0.333333
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
41a9b2622939181ac5441a98ff8da6deab1624f7
| 1,948
|
py
|
Python
|
src/parse_XML_with_BeautifulSoup.py
|
marianoju/selectDiff
|
7210787df39cf9bf80a7e3578e8cf0b13390009d
|
[
"MIT"
] | null | null | null |
src/parse_XML_with_BeautifulSoup.py
|
marianoju/selectDiff
|
7210787df39cf9bf80a7e3578e8cf0b13390009d
|
[
"MIT"
] | null | null | null |
src/parse_XML_with_BeautifulSoup.py
|
marianoju/selectDiff
|
7210787df39cf9bf80a7e3578e8cf0b13390009d
|
[
"MIT"
] | null | null | null |
from bs4 import BeautifulSoup
import urllib.request
import re
import os
# reads XML file from online source
url = 'https://stackoverflow.com/feeds'
# parses XML document and returns a `BeautifulSoup` object (aka soup)
with urllib.request.urlopen(url) as response:
soup = BeautifulSoup(response.read(), "xml")
# functions that handle content
# replaces HTML tags with nothing
def strip_tags(description):
return re.sub('<.*?>', '', description)
def substitute_whitespaces(text):
return re.sub('\s+', ' ', text).strip()
# alternatively: return ' '.join(text.split())
def cleanse_text(ore):
return strip_tags(substitute_whitespaces(ore))
# functions that handle URL strings
# removes the protocol from the URL string
def remove_protocol(url):
return re.sub('^http://|^https://', '', url)
# substitutes all characters from the URL string
# with exception of letters, digits and underscores
def substitute_but_alnum(string):
return re.sub(r'\W+', '_', string)
# '\W == [^a-zA-Z0-9_]
def sanitize_string(var):
return substitute_but_alnum(remove_protocol(var))
# preprares directory structure for writing files
def mkdir(directory):
if not os.path.exists(directory):
os.makedirs(directory)
# finds all entries in the soup object
# and writes summary to TXT files
# in source-dedicated directories
for entry in soup.find_all('entry'):
filename = f'{sanitize_string(entry.id.string)}.txt'
url = sanitize_string(url)
directory = '/'.join(['../data', url])
path = '/'.join([directory, filename])
# TODO: add entry.published.string to filename or path
mkdir(directory)
with open(path, 'w') as file:
pure_text = ''
# .stripped_strings is a Beautiful Soup generator
# intended to remove extra whitespace
for string in entry.summary.stripped_strings:
pure_text += cleanse_text(string)
file.write(pure_text)
| 30.4375
| 69
| 0.695072
| 258
| 1,948
| 5.158915
| 0.457364
| 0.024042
| 0.033058
| 0.024042
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.001896
| 0.187885
| 1,948
| 63
| 70
| 30.920635
| 0.839444
| 0.358316
| 0
| 0
| 0
| 0
| 0.095779
| 0.030844
| 0
| 0
| 0
| 0.015873
| 0
| 1
| 0.212121
| false
| 0
| 0.121212
| 0.181818
| 0.515152
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
41ad3ff9869de80e0e72d926b5611192782f82d3
| 189
|
py
|
Python
|
blog/admin.py
|
ashutoshacharya24/miniblog
|
166283e1a82bbe8bef6e97cec4e8c3750438244d
|
[
"MIT"
] | null | null | null |
blog/admin.py
|
ashutoshacharya24/miniblog
|
166283e1a82bbe8bef6e97cec4e8c3750438244d
|
[
"MIT"
] | null | null | null |
blog/admin.py
|
ashutoshacharya24/miniblog
|
166283e1a82bbe8bef6e97cec4e8c3750438244d
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Post
# Register your models here.
@admin.register(Post)
class PostModelAdmin(admin.ModelAdmin):
list_display = ['id', 'title', 'desc']
| 27
| 39
| 0.761905
| 25
| 189
| 5.72
| 0.72
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116402
| 189
| 6
| 40
| 31.5
| 0.856287
| 0.137566
| 0
| 0
| 0
| 0
| 0.068323
| 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
|
41c8c02adec8d5ece65873a7bb3c0eeb74524ebb
| 2,322
|
py
|
Python
|
tests/test_digits.py
|
yekmolsoheil/persiantools
|
8c5ea181640408bfd31d69d8b240114e3f44d101
|
[
"MIT"
] | 66
|
2020-09-14T18:29:49.000Z
|
2022-03-22T08:36:18.000Z
|
tests/test_digits.py
|
yekmolsoheil/persiantools
|
8c5ea181640408bfd31d69d8b240114e3f44d101
|
[
"MIT"
] | 9
|
2020-09-03T22:39:14.000Z
|
2022-03-14T19:54:31.000Z
|
tests/test_digits.py
|
yekmolsoheil/persiantools
|
8c5ea181640408bfd31d69d8b240114e3f44d101
|
[
"MIT"
] | 8
|
2021-02-23T05:01:38.000Z
|
2022-01-27T22:55:10.000Z
|
from unittest import TestCase
import pytest
from persiantools import digits
class TestDigits(TestCase):
def test_en_to_fa(self):
self.assertEqual(digits.en_to_fa("0987654321"), "۰۹۸۷۶۵۴۳۲۱")
self.assertEqual(digits.en_to_fa("0987654321"), "۰۹۸۷۶۵۴۳۲۱")
self.assertEqual(digits.en_to_fa("۰۹۸۷۶۵۴۳۲۱"), "۰۹۸۷۶۵۴۳۲۱")
self.assertEqual(digits.en_to_fa("+0987654321 abcd"), "+۰۹۸۷۶۵۴۳۲۱ abcd")
with pytest.raises(TypeError):
digits.en_to_fa(12345)
def test_ar_to_fa(self):
self.assertEqual(digits.ar_to_fa("٠٩٨٧٦٥٤٣٢١"), "۰۹۸۷۶۵۴۳۲۱")
self.assertEqual(digits.ar_to_fa("٠٩٨٧٦٥٤٣٢١"), "۰۹۸۷۶۵۴۳۲۱")
orig = "0987٦٥٤٣۲۱"
converted = digits.en_to_fa(orig)
converted = digits.ar_to_fa(converted)
self.assertEqual(converted, "۰۹۸۷۶۵۴۳۲۱")
def test_fa_to_en(self):
self.assertEqual(digits.fa_to_en("۰۹۸۷۶۵۴۳۲۱"), "0987654321")
def test_fa_to_ar(self):
self.assertEqual(digits.fa_to_ar("۰۹۸۷۶۵۴۳۲۱"), "٠٩٨٧٦٥٤٣٢١")
self.assertEqual(digits.fa_to_ar(" ۰۹۸۷۶۵۴۳۲۱"), " ٠٩٨٧٦٥٤٣٢١")
def test_to_letter(self):
self.assertEqual(digits.to_word(1), "یک")
self.assertEqual(digits.to_word(12), "دوازده")
self.assertEqual(digits.to_word(49), "چهل و نه")
self.assertEqual(digits.to_word(77), "هفتاد و هفت")
self.assertEqual(digits.to_word(250), "دویست و پنجاه")
self.assertEqual(digits.to_word(809), "هشتصد و نه")
self.assertEqual(digits.to_word(1001), "یک هزار و یک")
self.assertEqual(digits.to_word(3512), "سه هزار و پانصد و دوازده")
self.assertEqual(digits.to_word(10000), "ده هزار")
self.assertEqual(digits.to_word(20010), "بیست هزار و ده")
self.assertEqual(digits.to_word(10001), "ده هزار و یک")
self.assertEqual(digits.to_word(500253), "پانصد هزار و دویست و پنجاه و سه")
self.assertEqual(digits.to_word(6000123), "شش میلیون و یکصد و بیست و سه")
self.assertEqual(digits.to_word(1000000985), "یک میلیارد و نهصد و هشتاد و پنج")
self.assertEqual(digits.to_word(100000000000004), "یکصد تریلیون و چهار")
self.assertEqual(digits.to_word(-305), "منفی سیصد و پنج")
with pytest.raises(digits.OutOfRangeException):
digits.to_word(1000000000000001)
| 41.464286
| 87
| 0.679587
| 314
| 2,322
| 4.850318
| 0.235669
| 0.256074
| 0.344714
| 0.241628
| 0.575837
| 0.45174
| 0.35719
| 0.278398
| 0.079448
| 0.079448
| 0
| 0.159018
| 0.192937
| 2,322
| 55
| 88
| 42.218182
| 0.653682
| 0
| 0
| 0.142857
| 0
| 0
| 0.196813
| 0
| 0
| 0
| 0
| 0
| 0.619048
| 1
| 0.119048
| false
| 0
| 0.071429
| 0
| 0.214286
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
68be81b47f2848218f9d9fd521faecdb17f0d06e
| 7,639
|
py
|
Python
|
src/conferences/forms.py
|
skiry/Conference-Management-System
|
0c8d6206e910787eb5c0432a5c78579752624ae5
|
[
"MIT"
] | 1
|
2020-03-24T13:14:38.000Z
|
2020-03-24T13:14:38.000Z
|
src/conferences/forms.py
|
skiry/Conference-Management-System
|
0c8d6206e910787eb5c0432a5c78579752624ae5
|
[
"MIT"
] | 8
|
2019-07-03T21:32:20.000Z
|
2022-03-11T23:50:59.000Z
|
src/conferences/forms.py
|
skiry/conference-management-system
|
0c8d6206e910787eb5c0432a5c78579752624ae5
|
[
"MIT"
] | null | null | null |
from __future__ import unicode_literals
from django import forms
from django.urls import reverse
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit, HTML, Field
from . import models
class AddConference(forms.Form):
name = forms.CharField()
website = forms.CharField()
info = forms.CharField()
start_date = forms.DateField()
abstract_date = forms.DateField()
submission_date = forms.DateField()
bidding_date = forms.DateField()
presentation_date = forms.DateField()
end_date = forms.DateField()
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Field("name", placeholder="Name"),
Field("website", placeholder="Website"),
Field("info", placeholder="Information"),
Field("start_date", placeholder="Starting Date"),
Field("abstract_date", placeholder="Abstract Deadline Date"),
Field("submission_date", placeholder="Submission Deadline Date"),
Field("bidding_date", placeholder="Bidding Deadline Date"),
Field("presentation_date", placeholder="Presentation Deadline Date"),
Field("end_date", placeholder="Ending Date"),
Submit("create_conference", "Create new conference", css_class="btn btn-lg btn-primary btn-block"),
)
class PostponeDeadlines(forms.Form):
abstract_date = forms.DateField()
submission_date = forms.DateField()
presentation_date = forms.DateField()
end_date = forms.DateField()
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Field("abstract_date", placeholder="Abstract Deadline Date"),
Field("submission_date", placeholder="Submission Deadline Date"),
Field("presentation_date", placeholder="Presentation Deadline Date"),
Field("end_date", placeholder="Ending Date"),
Submit("update_conference", "Update conference", css_class="btn btn-lg btn-primary btn-block"),
)
class SubmitProposal(forms.Form):
title = forms.CharField(max_length=128)
abstract = forms.FileField()
full_paper = forms.FileField(required=False)
meta_info = forms.CharField(max_length=10000, required=False)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Field("title", placeholder="Paper Title"),
Field("abstract", placeholder="Paper Abstract"),
Field("full_paper", placeholder="Full Paper"),
Field("meta_info", placeholder="General Information Behind the Paper"),
Submit("submit_proposal", "Submit your proposal", css_class="btn btn-lg btn-primary btn-block")
)
class CreateSection(forms.Form):
section_name = forms.CharField(max_length=128)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Field("section_name", placeholder="Category Name"),
Submit("create_section", "Create the section", css_class="btn btn-lg btn-primary btn-block")
)
class AddSectionToConference(forms.Form):
section_name = forms.CharField(max_length=128)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Field("section_name", placeholder="Add a tag for this conference"),
Submit("add_section", "Add the section to this conference", css_class="btn btn-lg btn-primary btn-block")
)
class UpdateSubmission(forms.Form):
title = forms.CharField(max_length=128)
abstract = forms.FileField()
full_paper = forms.FileField(required=False)
meta_info = forms.CharField(max_length=10000, required=False)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Field("title", placeholder="Paper Title"),
Field("abstract", placeholder="Paper Abstract"),
Field("full_paper", placeholder="Full Paper"),
Field("meta_info", placeholder="General Information Behind the Paper"),
Submit("update_submission", "Update this Submission", css_class="btn btn-lg btn-primary btn-block")
)
class EnrollPcMember(forms.Form):
description = forms.CharField(max_length=1024)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Field("description", placeholder="Why would you be a good PC Member?"),
Submit("submit_enrollment", "Submit your proposal", css_class="btn btn-lg btn-primary btn-block")
)
class BidSubmission(forms.Form):
bidding = forms.ChoiceField(choices=models.BiddingValues.CHOICES, required=True)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Field("bidding", placeholder="What's your bidding on this submission?"),
Submit("submit_bidding", "Submit your bid", css_class="btn btn-lg btn-primary btn-block")
)
class CommentSubmission(forms.Form):
remark = forms.CharField(max_length=1024)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Field("remark", placeholder="What do you have to add?"),
Submit("submit_remark", "Submit your remark", css_class="btn btn-lg btn-primary btn-block")
)
class SectionAssignment(forms.Form):
section_name = forms.CharField(max_length=128)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Field("section_name", placeholder="Add a section for this submission"),
Submit("add_section", "Add the section to this submission", css_class="btn btn-lg btn-primary btn-block")
)
class JoinPaper(forms.Form):
agreement = forms.CharField(max_length=128, disabled=True, required=False)
payment = forms.CharField(max_length=128, disabled=True, required=False)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Field("agreement",
placeholder="Do you agree with Terms and Conditions?"),
Field("payment",
placeholder="You will pay the fee at the entrance!"),
Submit("add_section", "Yes! Confirm Registration!", css_class="btn btn-lg btn-primary btn-block")
)
class SessionChairAssignment(forms.Form):
section_name = forms.CharField(max_length=128)
pc_member_name = forms.CharField(max_length=128)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Field("section_name", placeholder="Section's name"),
Field("pc_member_name", placeholder="User's name"),
Submit("add_section", "Assign PC member as session chair", css_class="btn btn-lg btn-primary btn-block")
)
| 37.446078
| 117
| 0.648383
| 855
| 7,639
| 5.582456
| 0.150877
| 0.050283
| 0.046302
| 0.062644
| 0.707102
| 0.707102
| 0.707102
| 0.707102
| 0.674419
| 0.639011
| 0
| 0.007582
| 0.223066
| 7,639
| 203
| 118
| 37.630542
| 0.79663
| 0
| 0
| 0.545455
| 0
| 0
| 0.232491
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.077922
| false
| 0
| 0.038961
| 0
| 0.396104
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
ec0f43ae20986b83c4ec355473812225f5445794
| 77
|
py
|
Python
|
histonia.py
|
intgr/histonia
|
7e79bfc3aca057bc9530015cdf79001ed6873548
|
[
"MIT"
] | 3
|
2021-06-16T22:08:41.000Z
|
2021-12-24T10:20:39.000Z
|
histonia.py
|
intgr/histonia
|
7e79bfc3aca057bc9530015cdf79001ed6873548
|
[
"MIT"
] | 2
|
2021-12-24T10:16:29.000Z
|
2022-02-28T19:04:32.000Z
|
histonia.py
|
intgr/histonia
|
7e79bfc3aca057bc9530015cdf79001ed6873548
|
[
"MIT"
] | null | null | null |
"""
the file was left blank
with much intent and purpose
Poetry needs it
"""
| 12.833333
| 28
| 0.727273
| 13
| 77
| 4.307692
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.194805
| 77
| 5
| 29
| 15.4
| 0.903226
| 0.883117
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
ec2e3cb47c10ac12451d994331ec654a7440d6e2
| 215
|
py
|
Python
|
launcher/api/python/notifier/drivers/base_driver.py
|
davidvoler/ate_meteor
|
d7ac20638a30e941e0ca8740499743bc26dd57be
|
[
"MIT"
] | null | null | null |
launcher/api/python/notifier/drivers/base_driver.py
|
davidvoler/ate_meteor
|
d7ac20638a30e941e0ca8740499743bc26dd57be
|
[
"MIT"
] | 2
|
2015-08-06T14:08:39.000Z
|
2015-09-29T09:47:26.000Z
|
launcher/api/python/notifier/drivers/base_driver.py
|
davidvoler/ate_meteor
|
d7ac20638a30e941e0ca8740499743bc26dd57be
|
[
"MIT"
] | null | null | null |
__author__ = 'davidl'
class BaseMonitorDriver(object):
def notify(self,fixture_id, info):
print (info)
def notify_blocking_request(self,fixture_id, info):
print (info)
return True
| 19.545455
| 55
| 0.665116
| 25
| 215
| 5.4
| 0.64
| 0.133333
| 0.192593
| 0.251852
| 0.385185
| 0.385185
| 0
| 0
| 0
| 0
| 0
| 0
| 0.24186
| 215
| 10
| 56
| 21.5
| 0.828221
| 0
| 0
| 0.285714
| 0
| 0
| 0.027907
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0
| 0
| 0.571429
| 0.285714
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6b5b92ccfa8bc32fbb6e2ba1cfa2cf310ae136eb
| 352
|
py
|
Python
|
enthought/plugins/__init__.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 3
|
2016-12-09T06:05:18.000Z
|
2018-03-01T13:00:29.000Z
|
enthought/plugins/__init__.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 1
|
2020-12-02T00:51:32.000Z
|
2020-12-02T08:48:55.000Z
|
enthought/plugins/__init__.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | null | null | null |
#------------------------------------------------------------------------------
# Copyright (c) 2007 by Enthought, Inc.
# All rights reserved.
#------------------------------------------------------------------------------
""" Plug-ins for the Envisage application framework.
Part of the EnvisagePlugins project of the Enthought Tool Suite.
"""
| 32
| 79
| 0.397727
| 26
| 352
| 5.384615
| 0.846154
| 0.071429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012739
| 0.107955
| 352
| 10
| 80
| 35.2
| 0.433121
| 0.934659
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6b5f147115e3fba44655c0c54e122bb84acff70c
| 257
|
py
|
Python
|
crm/forms.py
|
SorryLegacy/Django-CRM
|
42db8b6a9354fa989c3dad925c1d7fb927b8489f
|
[
"MIT"
] | null | null | null |
crm/forms.py
|
SorryLegacy/Django-CRM
|
42db8b6a9354fa989c3dad925c1d7fb927b8489f
|
[
"MIT"
] | null | null | null |
crm/forms.py
|
SorryLegacy/Django-CRM
|
42db8b6a9354fa989c3dad925c1d7fb927b8489f
|
[
"MIT"
] | null | null | null |
from django import forms
class OrderForm(forms.Form):
name = forms.CharField(max_length=200, widget=forms.TextInput(attrs={'class' : 'form-control'}))
phone = forms.CharField(max_length=15, widget=forms.TextInput(attrs={'class' : 'form-control'}))
| 42.833333
| 100
| 0.731518
| 34
| 257
| 5.470588
| 0.529412
| 0.150538
| 0.182796
| 0.247312
| 0.44086
| 0.44086
| 0.44086
| 0
| 0
| 0
| 0
| 0.021739
| 0.105058
| 257
| 6
| 101
| 42.833333
| 0.786957
| 0
| 0
| 0
| 0
| 0
| 0.131783
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
6ba83ac0842966978178b0d42d88e3386e537a1f
| 147
|
py
|
Python
|
app/core/apps.py
|
ctiagotb/recipe-app-api
|
e906de3a2de8aeecae0315bcd5ea7027c7a52abf
|
[
"MIT"
] | null | null | null |
app/core/apps.py
|
ctiagotb/recipe-app-api
|
e906de3a2de8aeecae0315bcd5ea7027c7a52abf
|
[
"MIT"
] | null | null | null |
app/core/apps.py
|
ctiagotb/recipe-app-api
|
e906de3a2de8aeecae0315bcd5ea7027c7a52abf
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
# docker-compose run app sh -c "python manage.py startapp core"
class CoreConfig(AppConfig):
name = 'core'
| 21
| 63
| 0.741497
| 21
| 147
| 5.190476
| 0.904762
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.170068
| 147
| 6
| 64
| 24.5
| 0.893443
| 0.414966
| 0
| 0
| 0
| 0
| 0.047619
| 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
|
6bad82049270acdefce3fed170dd16137501d4bd
| 94
|
py
|
Python
|
src/bee/ext/texts/builder.py
|
awenhaowenchao/bee
|
cac7522f8994aa3067c6e0a1bb3613de5c577129
|
[
"MIT"
] | 4
|
2019-11-12T05:01:42.000Z
|
2022-02-23T01:52:11.000Z
|
src/bee/ext/texts/builder.py
|
awenhaowenchao/bee
|
cac7522f8994aa3067c6e0a1bb3613de5c577129
|
[
"MIT"
] | 6
|
2021-03-19T08:13:39.000Z
|
2022-03-02T15:00:19.000Z
|
src/bee/ext/texts/builder.py
|
awenhaowenchao/bee
|
cac7522f8994aa3067c6e0a1bb3613de5c577129
|
[
"MIT"
] | null | null | null |
from bytebuffer import ByteBuffer
class Builder(ByteBuffer):
name = "ext.texts.Builder"
| 15.666667
| 33
| 0.755319
| 11
| 94
| 6.454545
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.159574
| 94
| 5
| 34
| 18.8
| 0.898734
| 0
| 0
| 0
| 0
| 0
| 0.180851
| 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
|
6bd2e05381d0b38c12589df747f4418426743cfe
| 888
|
py
|
Python
|
tests/parsers/test_nwchem_nwcpymatgen_1/__init__.py
|
nkeilbart/aiida-nwchem
|
d5199b8a94fc2ec8ed30d3370ceac3826312b757
|
[
"MIT"
] | 1
|
2019-12-12T15:54:58.000Z
|
2019-12-12T15:54:58.000Z
|
tests/parsers/test_nwchem_nwcpymatgen_1/__init__.py
|
nkeilbart/aiida-nwchem
|
d5199b8a94fc2ec8ed30d3370ceac3826312b757
|
[
"MIT"
] | 10
|
2017-11-16T15:53:39.000Z
|
2021-12-07T16:34:18.000Z
|
tests/parsers/test_nwchem_nwcpymatgen_1/__init__.py
|
nkeilbart/aiida-nwchem
|
d5199b8a94fc2ec8ed30d3370ceac3826312b757
|
[
"MIT"
] | 6
|
2018-08-14T13:26:30.000Z
|
2021-12-31T14:37:31.000Z
|
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# #
# The code is hosted on GitHub at https://github.com/aiidateam/aiida_core #
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
from distutils.version import StrictVersion
from aiida.orm.data.structure import has_pymatgen, get_pymatgen_version
def skip_condition():
return not (has_pymatgen() and
StrictVersion(get_pymatgen_version()) == StrictVersion('4.5.3'))
| 52.235294
| 80
| 0.480856
| 84
| 888
| 4.988095
| 0.666667
| 0.038186
| 0.100239
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.00624
| 0.278153
| 888
| 17
| 80
| 52.235294
| 0.647426
| 0.5
| 0
| 0
| 0
| 0
| 0.018797
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0.4
| 0.2
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 1
| 0
|
0
| 4
|
6be98df8aecb83fac87b58652fa22db13a231a77
| 1,020
|
py
|
Python
|
get_passphrase/resolvers/standard_resolvers.py
|
sammck/get-passphrase
|
ee043811cfda64481d04005245b8b7aaaf85a1ff
|
[
"MIT"
] | 2
|
2022-02-22T20:13:10.000Z
|
2022-02-22T23:30:11.000Z
|
get_passphrase/resolvers/standard_resolvers.py
|
sammck/get-passphrase
|
ee043811cfda64481d04005245b8b7aaaf85a1ff
|
[
"MIT"
] | null | null | null |
get_passphrase/resolvers/standard_resolvers.py
|
sammck/get-passphrase
|
ee043811cfda64481d04005245b8b7aaaf85a1ff
|
[
"MIT"
] | null | null | null |
from typing import List, Type
from ..resolver import PassphraseResolver
from .fixed_resolver import FixedPassphraseResolver
from .empty_resolver import EmptyPassphraseResolver
from .none_resolver import NonePassphraseResolver
from .inline_resolver import InlinePassphraseResolver
from .env_resolver import EnvPassphraseResolver
from .fd_resolver import FdPassphraseResolver
from .stdin_resolver import StdinPassphraseResolver
from .file_resolver import FilePassphraseResolver
from .getpass_resolver import GetpassPassphraseResolver
from .keyring_resolver import KeyringPassphraseResolver
from .any_resolver import AnyPassphraseResolver
standard_resolver_classes: List[Type[PassphraseResolver]] = [
FixedPassphraseResolver,
EmptyPassphraseResolver,
NonePassphraseResolver,
InlinePassphraseResolver,
EnvPassphraseResolver,
FdPassphraseResolver,
StdinPassphraseResolver,
FilePassphraseResolver,
GetpassPassphraseResolver,
KeyringPassphraseResolver,
AnyPassphraseResolver,
]
| 32.903226
| 61
| 0.851961
| 81
| 1,020
| 10.567901
| 0.382716
| 0.196262
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115686
| 1,020
| 30
| 62
| 34
| 0.949002
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.923077
| 0.5
| 0
| 0.5
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
|
0
| 4
|
d40b159a07cc5269e0652c70284fa576a84fe03c
| 278
|
py
|
Python
|
src/get_nth_even_number.py
|
nosrac77/code-katas
|
741c9e60ba5fa53b55964e324ae6d1a34c310ccd
|
[
"MIT"
] | null | null | null |
src/get_nth_even_number.py
|
nosrac77/code-katas
|
741c9e60ba5fa53b55964e324ae6d1a34c310ccd
|
[
"MIT"
] | null | null | null |
src/get_nth_even_number.py
|
nosrac77/code-katas
|
741c9e60ba5fa53b55964e324ae6d1a34c310ccd
|
[
"MIT"
] | null | null | null |
"""Kata: Get nth even number - Return the nth even number.
#1 Best Practices Solution by tedmiston, tachyonlabs, OQth, and others.
def nth_even(n):
return n * 2 - 2
"""
def nth_even(n):
"""Function I wrote that returns the nth even number."""
return (n * 2) - 2
| 21.384615
| 71
| 0.654676
| 45
| 278
| 4
| 0.555556
| 0.194444
| 0.216667
| 0.211111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.023256
| 0.226619
| 278
| 12
| 72
| 23.166667
| 0.813953
| 0.784173
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 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
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
d40c0b7847163c34bf287ae17838d3531d449964
| 86
|
py
|
Python
|
autoupdate/__init__.py
|
HelloKuki/autoupdateServer
|
4fa17a25dd3cf9916543d194e425b4d6c6a6ad07
|
[
"MIT"
] | null | null | null |
autoupdate/__init__.py
|
HelloKuki/autoupdateServer
|
4fa17a25dd3cf9916543d194e425b4d6c6a6ad07
|
[
"MIT"
] | null | null | null |
autoupdate/__init__.py
|
HelloKuki/autoupdateServer
|
4fa17a25dd3cf9916543d194e425b4d6c6a6ad07
|
[
"MIT"
] | null | null | null |
# coding=utf-8
import sqlite3
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
| 12.285714
| 31
| 0.767442
| 13
| 86
| 5.076923
| 0.615385
| 0.121212
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.038961
| 0.104651
| 86
| 6
| 32
| 14.333333
| 0.818182
| 0.139535
| 0
| 0
| 0
| 0
| 0.069444
| 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
|
d416ead5ffc3fe68d1d2fd6b322235f979541e05
| 1,750
|
py
|
Python
|
codewars/8kyu/dinamuh/FindTheSmallestIntegerInTheArray/test_bench.py
|
dinamuh/Training_one
|
d18e8fb12608ce1753162c20252ca928c4df97ab
|
[
"MIT"
] | null | null | null |
codewars/8kyu/dinamuh/FindTheSmallestIntegerInTheArray/test_bench.py
|
dinamuh/Training_one
|
d18e8fb12608ce1753162c20252ca928c4df97ab
|
[
"MIT"
] | 2
|
2019-01-22T10:53:42.000Z
|
2019-01-31T08:02:48.000Z
|
codewars/8kyu/dinamuh/FindTheSmallestIntegerInTheArray/test_bench.py
|
dinamuh/Training_one
|
d18e8fb12608ce1753162c20252ca928c4df97ab
|
[
"MIT"
] | 13
|
2019-01-22T10:37:42.000Z
|
2019-01-25T13:30:43.000Z
|
from main import findSmallestInt
from main import find_smallest_int
def test(benchmark):
assert benchmark(find_smallest_int, [78, 56, 232, 12, 11, 43]) == 11
def test2(benchmark):
assert benchmark(findSmallestInt, [78, 56, 232, 12, 11, 43]) == 11
'''''''''
---------------------------------------------------------------------------------------- benchmark: 2 tests ----------------------------------------------------------------------------------------
Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Mops/s) Rounds Iterations
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test2 289.5294 (1.0) 4,301.0000 (1.05) 310.3681 (1.0) 64.4600 (1.03) 297.8235 (1.0) 9.8235 (1.0) 5478;17077 3.2220 (1.0) 193462 17
test 308.5500 (1.07) 4,098.0500 (1.0) 329.0544 (1.06) 62.6260 (1.0) 316.7000 (1.06) 10.9000 (1.11) 3728;13181 3.0390 (0.94) 154298 20
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Legend:
Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
OPS: Operations Per Second, computed as 1 / Mean
============================================================================ 2 passed in 4.74 seconds ========
'''''''''''''''
| 67.307692
| 196
| 0.334857
| 157
| 1,750
| 3.707006
| 0.611465
| 0.024055
| 0.04811
| 0.030928
| 0.051546
| 0.051546
| 0.051546
| 0
| 0
| 0
| 0
| 0.148283
| 0.217714
| 1,750
| 25
| 197
| 70
| 0.276844
| 0
| 0
| 0.111111
| 0
| 0.222222
| 0.83945
| 0.369266
| 0
| 0
| 0
| 0
| 0.111111
| 1
| 0.111111
| false
| 0.055556
| 0.111111
| 0
| 0.222222
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
d43a4bb1306684ae6b8150699d8683448e677593
| 48
|
py
|
Python
|
Idat_Python2022/Semana_9/Ejercicio05.py
|
Kennethguerra3/Python_Ejercicio_2022
|
cf1297cf1e1585eba699e32c02993818c3d9ecbf
|
[
"MIT"
] | null | null | null |
Idat_Python2022/Semana_9/Ejercicio05.py
|
Kennethguerra3/Python_Ejercicio_2022
|
cf1297cf1e1585eba699e32c02993818c3d9ecbf
|
[
"MIT"
] | null | null | null |
Idat_Python2022/Semana_9/Ejercicio05.py
|
Kennethguerra3/Python_Ejercicio_2022
|
cf1297cf1e1585eba699e32c02993818c3d9ecbf
|
[
"MIT"
] | null | null | null |
for i in range(5):
print("Hola por ",i," vez")
| 16
| 28
| 0.583333
| 10
| 48
| 2.8
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.025641
| 0.1875
| 48
| 2
| 29
| 24
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0.270833
| 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
|
d44ba054d13bad6eec9e78065efe9ff3ae90ee88
| 814
|
py
|
Python
|
app/api/wallet/main.py
|
JimmyMow/21-wallet
|
bcd45d8f0d0c7147359051c15ab51d81f61148cb
|
[
"MIT"
] | null | null | null |
app/api/wallet/main.py
|
JimmyMow/21-wallet
|
bcd45d8f0d0c7147359051c15ab51d81f61148cb
|
[
"MIT"
] | null | null | null |
app/api/wallet/main.py
|
JimmyMow/21-wallet
|
bcd45d8f0d0c7147359051c15ab51d81f61148cb
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python3
import sys
import json
from os.path import expanduser
from two1.wallet import Two1Wallet
class Wallet():
def __init__(self):
with open('{}/.two1/wallet/default_wallet.json'.format(expanduser('~'))) as data_file:
wallet_data = json.load(data_file)
self.two1Wallet = Two1Wallet.import_from_mnemonic(mnemonic=wallet_data['master_seed'])
def address(self):
return self.two1Wallet.get_payout_address()
def confirmed(self):
return self.two1Wallet.confirmed_balance()
def unconfirmed(self):
return self.two1Wallet.unconfirmed_balance()
def history(self):
return self.two1Wallet.transaction_history()
wallet = None
wallet = wallet or Wallet()
del sys.argv[0]
for arg in sys.argv:
method = getattr(wallet, arg)
print(json.dumps({ arg: method() }))
| 23.257143
| 92
| 0.730958
| 108
| 814
| 5.351852
| 0.453704
| 0.121107
| 0.096886
| 0.16609
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015873
| 0.148649
| 814
| 34
| 93
| 23.941176
| 0.818182
| 0.020885
| 0
| 0
| 0
| 0
| 0.059194
| 0.044081
| 0
| 0
| 0
| 0
| 0
| 1
| 0.217391
| false
| 0
| 0.217391
| 0.173913
| 0.652174
| 0.043478
| 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
|
d44f4cd9f597c78d6a9248b4d5047525fdf2586b
| 14,068
|
py
|
Python
|
tests/test_criteria.py
|
lohithn4/NowTrade
|
ac04499731130297135b3526325191bd2cb36343
|
[
"MIT"
] | 87
|
2015-11-09T07:11:32.000Z
|
2021-12-16T03:13:09.000Z
|
tests/test_criteria.py
|
lohithn4/NowTrade
|
ac04499731130297135b3526325191bd2cb36343
|
[
"MIT"
] | 14
|
2015-09-28T18:24:18.000Z
|
2020-04-22T15:17:26.000Z
|
tests/test_criteria.py
|
lohithn4/NowTrade
|
ac04499731130297135b3526325191bd2cb36343
|
[
"MIT"
] | 34
|
2015-10-12T13:26:09.000Z
|
2022-01-15T20:16:23.000Z
|
import unittest
import numpy as np
import pandas as pd
from nowtrade import criteria
from testing_data import msft_data, msft_close_name
from nowtrade.symbol_list import Symbol
from nowtrade.action import Long, Short, LongExit, ShortExit
from nowtrade.strategy import LONG, SHORT, LONG_EXIT, SHORT_EXIT, NO_ACTION
class TestCriteria(unittest.TestCase):
def setUp(self):
self.data = pd.DataFrame([[0, 5, 10.0, 0, NO_ACTION, 0, 10, -0.10, 0.01],
[5, 4, 12.0, 5, LONG, 1, 20, -0.20, 0.02],
[10, 3, 8.0, 10, NO_ACTION, 1, 30, -0.30, 0.01],
[15, 2, 6.0, 15, LONG_EXIT, 0, 0, -0.20, 0.00],
[20, 1, 9.0, 20, NO_ACTION, 0, -10, -0.10, -0.01],
[25, 0, 10.0, 25, SHORT, -1, -20, 0.0, -0.02],
[30, -1, 11.0, 30, SHORT_EXIT, 0, 0, 0.10, -0.03]],
columns=['ONE', 'TWO', 'THREE', 'ONE_CLONE', 'ACTIONS_ONE', 'STATUS_ONE', 'PL_ONE', 'CHANGE_VALUE_ONE', 'CHANGE_PERCENT_ONE'],
index=pd.date_range('20100601', periods=7))
self.one = Symbol('ONE')
self.two = Symbol('TWO')
self.three = Symbol('THREE')
self.one_clone = Symbol('ONE_CLONE')
class TestBarsSinceAction(TestCriteria):
def test_bars_since_action(self):
crit = criteria.BarsSinceAction(self.one, Long(), 2)
self.assertEquals(str(crit), 'BarsSinceAction(symbol=ONE, action=1, periods=2, condition=NONE)')
crit = criteria.BarsSinceLongExit(self.one, 3)
self.assertTrue(crit.apply(self.data))
crit = criteria.BarsSinceShortExit(self.one, 2)
self.assertFalse(crit.apply(self.data))
crit = criteria.BarsSinceShortExit(self.one, 1)
self.assertFalse(crit.apply(self.data))
crit = criteria.BarsSinceShortExit(self.one, 0)
self.assertTrue(crit.apply(self.data))
crit = criteria.BarsSinceLong(self.one, 4)
self.assertFalse(crit.apply(self.data))
crit = criteria.BarsSinceLong(self.one, 5)
self.assertTrue(crit.apply(self.data))
crit = criteria.BarsSinceLong(self.one, 6)
self.assertFalse(crit.apply(self.data))
crit = criteria.BarsSinceShortExit(self.one, 0, 'under')
self.assertFalse(crit.apply(self.data))
crit = criteria.BarsSinceShortExit(self.one, 1, 'under')
self.assertTrue(crit.apply(self.data))
crit = criteria.BarsSinceShortExit(self.one, 2, 'under')
self.assertTrue(crit.apply(self.data))
crit = criteria.BarsSinceLong(self.one, 5, 'under')
self.assertFalse(crit.apply(self.data))
crit = criteria.BarsSinceLong(self.one, 6, 'under')
self.assertTrue(crit.apply(self.data))
crit = criteria.BarsSinceLong(self.one, 7, 'under')
self.assertTrue(crit.apply(self.data))
crit = criteria.BarsSinceShortExit(self.one, 1, 'over')
self.assertFalse(crit.apply(self.data))
crit = criteria.BarsSinceShortExit(self.one, 0, 'over')
self.assertFalse(crit.apply(self.data))
crit = criteria.BarsSinceShort(self.one, 0, 'over')
self.assertTrue(crit.apply(self.data))
crit = criteria.BarsSinceLong(self.one, 4, 'over')
self.assertTrue(crit.apply(self.data))
crit = criteria.BarsSinceLong(self.one, 5, 'over')
self.assertFalse(crit.apply(self.data))
crit = criteria.BarsSinceLong(self.one, 6, 'over')
self.assertFalse(crit.apply(self.data))
class TestInMarket(TestCriteria):
def test_in_market(self):
crit = criteria.InMarket(self.one)
self.assertEqual(crit.__repr__(), crit.label)
self.assertFalse(crit.apply(self.data))
self.assertTrue(crit.apply(self.data[:-1]))
self.assertTrue(crit.apply(self.data[:2]))
self.assertTrue(crit.apply(self.data[:3]))
class TestIsLong(TestCriteria):
def test_is_long(self):
crit = criteria.IsLong(self.one)
self.assertFalse(crit.apply(self.data))
self.assertFalse(crit.apply(self.data[:-1]))
self.assertTrue(crit.apply(self.data[:3]))
self.assertFalse(crit.apply(pd.DataFrame()))
class TestIsShort(TestCriteria):
def test_is_short(self):
crit = criteria.IsShort(self.one)
self.assertFalse(crit.apply(self.data))
self.assertTrue(crit.apply(self.data[:-1]))
self.assertFalse(crit.apply(self.data[:2]))
self.assertFalse(crit.apply(pd.DataFrame()))
class TestIsYear(TestCriteria):
def test_is_year(self):
crit = criteria.IsYear(2012)
self.assertEqual(crit.__repr__(), 'IsYear_2012')
self.assertFalse(crit.apply(self.data).any())
crit = criteria.IsYear(2010)
self.assertTrue(crit.apply(self.data).all())
class TestIsMonth(TestCriteria):
def test_is_month(self):
crit = criteria.IsMonth(6)
self.assertEqual(crit.__repr__(), 'IsMonth_6')
self.assertTrue(crit.apply(self.data).all())
crit = criteria.IsMonth(1)
self.assertFalse(crit.apply(self.data).any())
class TestIsDay(TestCriteria):
def test_is_day(self):
crit = criteria.IsDay(7)
self.assertEqual(crit.__repr__(), 'IsDay_7')
self.assertTrue(crit.apply(self.data)[-1])
crit = criteria.IsDay(8)
self.assertFalse(crit.apply(self.data)[-1])
class TestIsWeekDay(TestCriteria):
def test_is_week_day(self):
crit = criteria.IsWeekDay(0)
self.assertEqual(crit.__repr__(), 'IsWeekDay_0')
self.assertTrue(crit.apply(self.data)[-1])
crit = criteria.IsWeekDay(4)
self.assertTrue(crit.apply(self.data)[-4])
crit = criteria.IsWeekDay(3)
self.assertFalse(crit.apply(self.data)[-1])
class TestPositions(TestCriteria):
def test_position(self):
crit = criteria.Above('ONE', 5)
value = crit.apply(pd.DataFrame())
self.assertEqual(value, False)
value = crit.apply(self.data.head(2))
self.assertEqual(value, False)
value = crit.apply(self.data.head(3))
self.assertEqual(value, True)
crit = criteria.Above('TWO', 4, 3)
value = crit.apply(self.data.head(3))
self.assertEqual(value, True)
crit = criteria.Below('TWO', 6, 2)
value = crit.apply(pd.DataFrame())
self.assertFalse(value)
value = crit.apply(self.data)
self.assertEqual(value, True)
crit = criteria.Below('ONE', 5)
value = crit.apply(self.data.head(1))
self.assertEqual(value, True)
value = crit.apply(self.data.head(2))
self.assertEqual(value, False)
value = crit.apply(self.data.head(3))
self.assertEqual(value, False)
crit = criteria.Above('ONE', 'TWO')
value = crit.apply(self.data.head(1))
self.assertEqual(value, False)
value = crit.apply(self.data.head(2))
self.assertEqual(value, True)
crit = criteria.Below('ONE', 'TWO')
value = crit.apply(self.data.head(1))
self.assertEqual(value, True)
value = crit.apply(self.data.head(2))
self.assertEqual(value, False)
crit = criteria.Equals('ONE', 10)
value = crit.apply(pd.DataFrame())
self.assertEqual(value, False)
value = crit.apply(self.data.head(2))
self.assertEqual(value, False)
crit = criteria.Equal('ONE', 10)
value = crit.apply(self.data.head(2))
self.assertEqual(value, False)
value = crit.apply(self.data.head(3))
self.assertEqual(value, True)
value = crit.apply(self.data.head(4))
self.assertEqual(value, False)
crit = criteria.Above('ONE', 10, 1)
value = crit.apply(self.data.head(4))
self.assertEqual(value, True)
crit = criteria.Equals('ONE', 12, 3)
self.assertEqual(value, True)
crit = criteria.Equals('ONE', 'ONE_CLONE', 2)
value = crit.apply(self.data)
self.assertEqual(value, True)
class TestInRange(TestCriteria):
def test_in_range(self):
crit = criteria.InRange(str(self.one), 10, 20)
ret = crit.apply(self.data.head(2))
self.assertFalse(ret)
ret = crit.apply(self.data.head(3))
self.assertTrue(ret)
ret = crit.apply(self.data.head(4))
self.assertTrue(ret)
ret = crit.apply(self.data.head(5))
self.assertTrue(ret)
ret = crit.apply(self.data.head(6))
self.assertFalse(ret)
crit = criteria.InRange(str(self.one), str(self.two), str(self.three))
ret = crit.apply(self.data.head(1))
self.assertFalse(ret)
ret = crit.apply(self.data.head(2))
self.assertTrue(ret)
ret = crit.apply(self.data.head(3))
self.assertFalse(ret)
crit = criteria.InRange(str(self.one), -1, 1)
ret = crit.apply(self.data.head(1))
self.assertTrue(ret)
crit = criteria.InRange(str(self.two), 4, str(self.three))
ret = crit.apply(self.data.head(1))
self.assertTrue(ret)
crit = criteria.InRange(str(self.two), str(self.one), 6)
ret = crit.apply(self.data.head(1))
self.assertTrue(ret)
class TestCrossing(TestCriteria):
def test_crossing(self):
crit = criteria.CrossingAbove(str(self.one), str(self.two))
self.assertEquals(crit.__repr__(), 'CrossingAbove(param1=ONE, param2=TWO)')
self.assertTrue(crit.apply(self.data.head(2)))
crit = criteria.CrossingBelow(str(self.one), str(self.two))
self.assertEquals(crit.__repr__(), 'CrossingBelow(param1=ONE, param2=TWO)')
self.assertFalse(crit.apply(self.data.head(2)))
crit = criteria.CrossingBelow(str(self.three), str(self.one))
self.assertFalse(crit.apply(self.data.head(2)))
self.assertTrue(crit.apply(self.data.head(3)))
crit = criteria.CrossingAbove(str(self.one), 7)
self.assertFalse(crit.apply(self.data.head(2)))
crit = criteria.CrossingBelow(str(self.two), 2)
self.assertFalse(crit.apply(self.data.head(4)))
self.assertTrue(crit.apply(self.data.head(5)))
class TestNot(TestCriteria):
def test_not(self):
inRangeCriteria = criteria.InRange(str(self.one), 10, 20)
crit = criteria.Not(inRangeCriteria)
ret = crit.apply(self.data.head(2))
self.assertTrue(ret)
ret = crit.apply(self.data.head(3))
self.assertFalse(ret)
ret = crit.apply(self.data.head(4))
self.assertFalse(ret)
ret = crit.apply(self.data.head(5))
self.assertFalse(ret)
ret = crit.apply(self.data.head(6))
self.assertTrue(ret)
class TestStopLoss(TestCriteria):
def test_stop_loss(self):
crit = criteria.StopLoss(self.one, -0.2)
self.assertFalse(crit.apply(self.data))
self.assertFalse(crit.apply(self.data[:-2]))
self.assertTrue(crit.apply(self.data[:-3]))
crit = criteria.StopLoss(self.one, -0.02, percent=True)
self.assertTrue(crit.apply(self.data))
self.assertTrue(crit.apply(self.data[:-1]))
self.assertFalse(crit.apply(self.data[:-2]))
crit = criteria.StopLoss(self.one, -0.1, short=True)
self.assertTrue(crit.apply(self.data))
self.assertFalse(crit.apply(self.data[:-1]))
crit = criteria.StopLoss(self.one, -0.02, short=True, percent=True)
self.assertFalse(crit.apply(self.data))
self.assertFalse(crit.apply(self.data[:-1]))
self.assertTrue(crit.apply(self.data[:2]))
class TestTakeProfit(TestCriteria):
def test_take_profit(self):
crit = criteria.TakeProfit(self.one, 20)
self.assertEqual(crit.__repr__(), crit.label)
self.assertTrue(crit.apply(self.data[:2]))
self.assertFalse(crit.apply(self.data[:-1]))
crit_short = criteria.TakeProfit(self.one, 20, short=True)
self.assertFalse(crit_short.apply(self.data[:2]))
self.assertTrue(crit_short.apply(self.data[:-1]))
self.data['PL_ONE'] = np.nan
self.assertFalse(crit.apply(self.data))
class TestTrailingStop(TestCriteria):
def test_trailing_stop(self):
crit = criteria.TrailingStop(self.one, 0.009, short=False, percent=True)
self.assertFalse(crit.apply(self.data[:1]))
self.assertFalse(crit.apply(self.data[:2]))
self.assertTrue(crit.apply(self.data[:3]))
crit = criteria.TrailingStop(self.one, 0.019, short=False, percent=True)
self.assertFalse(crit.apply(self.data[:1]))
self.assertFalse(crit.apply(self.data[:2]))
self.assertFalse(crit.apply(self.data[:3]))
self.assertTrue(crit.apply(self.data[:4]))
crit = criteria.TrailingStop(self.one, 0.09, short=False, percent=False)
self.assertTrue(crit.apply(self.data[:1]))
crit = criteria.TrailingStop(self.one, 0.19, short=False, percent=False)
self.assertFalse(crit.apply(self.data[:1]))
self.assertTrue(crit.apply(self.data[:2]))
crit = criteria.TrailingStop(self.one, 0.009, short=True, percent=True)
self.assertTrue(crit.apply(self.data[:1]))
crit = criteria.TrailingStop(self.one, 0.019, short=True, percent=True)
self.assertFalse(crit.apply(self.data[:1]))
self.assertTrue(crit.apply(self.data[:2]))
crit = criteria.TrailingStop(self.one, 0.09, short=True, percent=False)
self.assertFalse(crit.apply(self.data[:1]))
self.assertFalse(crit.apply(self.data[:2]))
self.assertFalse(crit.apply(self.data[:3]))
self.assertTrue(crit.apply(self.data[:4]))
crit = criteria.TrailingStop(self.one, 0.19, short=True, percent=False)
self.assertFalse(crit.apply(self.data[:1]))
self.assertFalse(crit.apply(self.data[:2]))
self.assertFalse(crit.apply(self.data[:3]))
self.assertFalse(crit.apply(self.data[:4]))
self.assertTrue(crit.apply(self.data[:5]))
if __name__ == "__main__":
unittest.main()
| 45.380645
| 159
| 0.629158
| 1,822
| 14,068
| 4.801866
| 0.085071
| 0.122414
| 0.172363
| 0.221511
| 0.762487
| 0.742142
| 0.725111
| 0.65859
| 0.595611
| 0.512973
| 0
| 0.029278
| 0.218226
| 14,068
| 309
| 160
| 45.527508
| 0.76623
| 0
| 0
| 0.510274
| 0
| 0
| 0.028504
| 0.005473
| 0
| 0
| 0
| 0
| 0.44863
| 1
| 0.054795
| false
| 0
| 0.027397
| 0
| 0.136986
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d455d98950f2555d11cbe9c7b480bcab60f76269
| 328
|
py
|
Python
|
my_func.py
|
shamurti/Python_Class
|
e4da52ad0b5061e0fa127a03157be43a08ebe28b
|
[
"Apache-2.0"
] | null | null | null |
my_func.py
|
shamurti/Python_Class
|
e4da52ad0b5061e0fa127a03157be43a08ebe28b
|
[
"Apache-2.0"
] | null | null | null |
my_func.py
|
shamurti/Python_Class
|
e4da52ad0b5061e0fa127a03157be43a08ebe28b
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python
print "This is before the function"
a = 100
def my_func():
b = a + 1
print "hello there! This is from inside the function"
print (r"This is 'b = a + 1' from inside the function: {}").format(b)
print "This is text after the function"
print "This is 'a' from outside the function: {}".format(a)
| 19.294118
| 71
| 0.661585
| 57
| 328
| 3.789474
| 0.45614
| 0.138889
| 0.152778
| 0.194444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.019305
| 0.210366
| 328
| 16
| 72
| 20.5
| 0.814672
| 0.060976
| 0
| 0
| 0
| 0
| 0.638158
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.625
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
d46de1b52cd5d98da18d5aa0e8bbe43447b0fce5
| 104
|
py
|
Python
|
DIFFSUM.py
|
ankitpipalia/codechef-solutions
|
d10e7f15b74a11655b0e53953a8e2bc7efbf7377
|
[
"MIT"
] | 1
|
2022-01-23T08:13:17.000Z
|
2022-01-23T08:13:17.000Z
|
DIFFSUM.py
|
ankitpipalia/codechef-solutions
|
d10e7f15b74a11655b0e53953a8e2bc7efbf7377
|
[
"MIT"
] | null | null | null |
DIFFSUM.py
|
ankitpipalia/codechef-solutions
|
d10e7f15b74a11655b0e53953a8e2bc7efbf7377
|
[
"MIT"
] | null | null | null |
num1 = int(input())
num2 = int(input())
if num1 > num2:
print(num1-num2)
else:
print(num1+num2)
| 14.857143
| 20
| 0.615385
| 16
| 104
| 4
| 0.4375
| 0.375
| 0.40625
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.096386
| 0.201923
| 104
| 7
| 21
| 14.857143
| 0.674699
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.333333
| 1
| 0
| 0
| null | 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
|
d46de846c70479b72a53bd512bf1e75d075fbb69
| 103
|
py
|
Python
|
app/models/role.py
|
chenke91/ihaveablog
|
64000723589d3f5a074bd09f045cb5d6c3daf6dd
|
[
"MIT"
] | null | null | null |
app/models/role.py
|
chenke91/ihaveablog
|
64000723589d3f5a074bd09f045cb5d6c3daf6dd
|
[
"MIT"
] | null | null | null |
app/models/role.py
|
chenke91/ihaveablog
|
64000723589d3f5a074bd09f045cb5d6c3daf6dd
|
[
"MIT"
] | null | null | null |
from app import db
from ._base import SessionMixin
class Role:
ADMIN = 'admin'
NOMAL = 'nomal'
| 17.166667
| 31
| 0.68932
| 14
| 103
| 5
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.23301
| 103
| 6
| 32
| 17.166667
| 0.886076
| 0
| 0
| 0
| 0
| 0
| 0.096154
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 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
|
d4726d9190f425dccd950f9967d25436455cd6ec
| 161
|
py
|
Python
|
mdptools/utils/__init__.py
|
mholdg16/py-mdptools
|
ae986edc2097e97cb73331d66f0051ca9f5bd15c
|
[
"MIT"
] | 1
|
2021-12-15T13:22:48.000Z
|
2021-12-15T13:22:48.000Z
|
mdptools/utils/__init__.py
|
mholdg16/py-mdptools
|
ae986edc2097e97cb73331d66f0051ca9f5bd15c
|
[
"MIT"
] | 2
|
2021-11-09T23:43:48.000Z
|
2021-11-13T20:41:12.000Z
|
mdptools/utils/__init__.py
|
mholdg16/py-mdptools
|
ae986edc2097e97cb73331d66f0051ca9f5bd15c
|
[
"MIT"
] | null | null | null |
"""Utilities
"""
from .utils import *
from .highlight import highlight
from .format_str import format_str, format_tup, to_identifier
from .prism import to_prism
| 23
| 61
| 0.795031
| 23
| 161
| 5.347826
| 0.478261
| 0.146341
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.124224
| 161
| 6
| 62
| 26.833333
| 0.87234
| 0.055901
| 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
|
2e61568880d771fdf8caee17590b6be8b4b26831
| 57
|
py
|
Python
|
__main__.py
|
TomCreeper/goldmine
|
8407b787aeb042630b4d35083f4267cceca35078
|
[
"MIT"
] | 2
|
2017-07-10T13:05:18.000Z
|
2017-07-10T13:05:20.000Z
|
__main__.py
|
Tominous/goldmine
|
8407b787aeb042630b4d35083f4267cceca35078
|
[
"MIT"
] | null | null | null |
__main__.py
|
Tominous/goldmine
|
8407b787aeb042630b4d35083f4267cceca35078
|
[
"MIT"
] | null | null | null |
"""Module level wrapper for Goldmine."""
import goldmine
| 19
| 40
| 0.754386
| 7
| 57
| 6.142857
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.122807
| 57
| 2
| 41
| 28.5
| 0.86
| 0.596491
| 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
|
2e86f7e5657915d195f709a234cd50f11ac93d65
| 22,206
|
py
|
Python
|
cryspy/A_functions_base/flip_ratio.py
|
ikibalin/rhochi
|
1ca03f18dc72006322a101ed877cdbba33ed61e7
|
[
"MIT"
] | null | null | null |
cryspy/A_functions_base/flip_ratio.py
|
ikibalin/rhochi
|
1ca03f18dc72006322a101ed877cdbba33ed61e7
|
[
"MIT"
] | null | null | null |
cryspy/A_functions_base/flip_ratio.py
|
ikibalin/rhochi
|
1ca03f18dc72006322a101ed877cdbba33ed61e7
|
[
"MIT"
] | null | null | null |
from typing import Callable
import numpy
def calc_iint(
beam_polarization: float, flipper_efficiency: float, f_nucl, f_m_perp, matrix_u, func_extinction: Callable = None,
flag_beam_polarization: bool = False, flag_flipper_efficiency: bool = False,
flag_f_nucl: bool = False, flag_f_m_perp: bool = False,
dict_in_out: dict = None, flag_use_precalculated_data: bool = False):
"""Calculate integrated intensities.
It is supposed that crystal is not rotate during the calculations
(orientation matrix is the same for all reflections)
"""
if dict_in_out is None:
flag_dict = False
dict_in_out_keys = []
else:
flag_dict = True
dict_in_out_keys = dict_in_out.keys()
p_u = beam_polarization
p_d = beam_polarization*(2*flipper_efficiency-1)
flag_f_plus_sq = flag_f_nucl or flag_f_m_perp
flag_f_minus_sq = flag_f_nucl or flag_f_m_perp
flag_f_m_perp_xy_sq = flag_f_m_perp
f_n = numpy.atleast_1d(f_nucl)
f_m_perp = numpy.atleast_1d(f_m_perp)
f_n_sq = numpy.square(numpy.abs(f_n))
f_m_perp_x = f_m_perp[0]*matrix_u[0] + f_m_perp[1]*matrix_u[1] + f_m_perp[2]*matrix_u[2]
f_m_perp_y = f_m_perp[0]*matrix_u[3] + f_m_perp[1]*matrix_u[4] + f_m_perp[2]*matrix_u[5]
f_m_perp_z = f_m_perp[0]*matrix_u[6] + f_m_perp[1]*matrix_u[7] + f_m_perp[2]*matrix_u[8]
f_m_perp_x_sq = numpy.square(numpy.abs(f_m_perp_x))
f_m_perp_y_sq = numpy.square(numpy.abs(f_m_perp_y))
f_m_perp_z_sq = numpy.square(numpy.abs(f_m_perp_z))
f_n_f_m_perp_z = 2.*(f_n.real * f_m_perp_z.real + f_n.imag * f_m_perp_z.imag)
f_plus_sq = f_n_sq + f_m_perp_z_sq + f_n_f_m_perp_z
f_minus_sq = f_n_sq + f_m_perp_z_sq - f_n_f_m_perp_z
f_m_perp_xy_sq = f_m_perp_x_sq + f_m_perp_y_sq
if func_extinction is None:
dder_y_plus, dder_y_minus, dder_y_m_perp_xy = {}, {}, {}
y_plus = numpy.ones_like(f_plus_sq)
y_minus = numpy.ones_like(f_minus_sq)
y_m_perp_xy = numpy.ones_like(f_m_perp_xy_sq)
else:
y_plus, dder_y_plus = func_extinction(f_plus_sq, flag_f_sq=flag_f_plus_sq)
y_minus, dder_y_minus = func_extinction(f_minus_sq, flag_f_sq=flag_f_minus_sq)
y_m_perp_xy, dder_y_m_perp_xy = func_extinction(f_m_perp_xy_sq, flag_f_sq=flag_f_m_perp_xy_sq)
chiral_term = 2.*(f_m_perp_x.imag * f_m_perp_y.real - f_m_perp_x.real * f_m_perp_y.imag)
if flag_dict:
dict_in_out["chiral_term"] = chiral_term
iint_plus = 0.5*((1.+p_u)*y_plus*f_plus_sq +
(1.-p_u)*y_minus*f_minus_sq) + \
y_m_perp_xy * f_m_perp_xy_sq + \
p_u * chiral_term
iint_minus = 0.5*((1.-p_d)*y_plus*f_plus_sq +
(1.+p_d)*y_minus*f_minus_sq) + \
y_m_perp_xy * f_m_perp_xy_sq - \
p_d * chiral_term
if flag_dict:
dict_in_out["iint_plus"] = iint_plus
dict_in_out["iint_minus"] = iint_minus
dict_in_out["y_plus"] = y_plus
dict_in_out["f_plus_sq"] = f_plus_sq
dict_in_out["y_minus"] = y_minus
dict_in_out["f_minus_sq"] = f_minus_sq
dict_in_out["y_m_perp_xy"] = y_m_perp_xy
dict_in_out["f_m_perp_xy_sq"] = f_m_perp_xy_sq
dder_plus = {}
dder_minus = {}
if flag_beam_polarization:
dder_plus["beam_polarization"] = 0.5*(y_plus*f_plus_sq - y_minus*f_minus_sq + 2.*chiral_term) * \
numpy.ones_like(beam_polarization)
dder_minus["beam_polarization"] = 0.5*(-y_plus*f_plus_sq + y_minus*f_minus_sq - 2.*chiral_term) * \
numpy.ones_like(beam_polarization)*(2.*flipper_efficiency-1.)
if flag_flipper_efficiency:
dder_minus["flipper_efficiency"] = beam_polarization*(-y_plus*f_plus_sq + y_minus*f_minus_sq - 2.*chiral_term) * \
numpy.ones_like(flipper_efficiency)
if flag_f_nucl:
f_plus_sq_f_n_real = 2. * (f_n.real + f_m_perp_z.real) * numpy.ones_like(f_n.real)
f_plus_sq_f_n_imag = 2. * (f_n.imag + f_m_perp_z.imag) * numpy.ones_like(f_n.imag)
f_minus_sq_f_n_real = 2. * (f_n.real - f_m_perp_z.real)* numpy.ones_like(f_n.real)
f_minus_sq_f_n_imag = 2. * (f_n.imag - f_m_perp_z.imag) * numpy.ones_like(f_n.imag)
y_plus_f_n_real, y_minus_f_n_real = 0, 0
y_plus_f_n_imag, y_minus_f_n_imag = 0, 0
if "f_sq" in dder_y_plus.keys():
y_plus_f_n_real = dder_y_plus["f_sq"]*f_plus_sq_f_n_real
y_plus_f_n_imag = dder_y_plus["f_sq"]*f_plus_sq_f_n_imag
if "f_sq" in dder_y_minus.keys():
y_minus_f_n_real = dder_y_minus["f_sq"]*f_minus_sq_f_n_real
y_minus_f_n_imag = dder_y_minus["f_sq"]*f_minus_sq_f_n_imag
dder_plus["f_nucl_real"] = 0.5*(
(1.+p_u)*(y_plus*f_plus_sq_f_n_real+y_plus_f_n_real*f_plus_sq) +
(1.-p_u)*(y_minus*f_minus_sq_f_n_real+y_minus_f_n_real*f_minus_sq))
dder_plus["f_nucl_imag"] = 0.5*(
(1.+p_u)*(y_plus*f_plus_sq_f_n_imag+y_plus_f_n_imag*f_plus_sq) +
(1.-p_u)*(y_minus*f_minus_sq_f_n_imag+y_minus_f_n_imag*f_minus_sq))
dder_minus["f_nucl_real"] = 0.5*(
(1.-p_d)*(y_plus*f_plus_sq_f_n_real+y_plus_f_n_real*f_plus_sq) +
(1.+p_d)*(y_minus*f_minus_sq_f_n_real+y_minus_f_n_real*f_minus_sq))
dder_minus["f_nucl_imag"] = 0.5*(
(1.-p_d)*(y_plus*f_plus_sq_f_n_imag+y_plus_f_n_imag*f_plus_sq) +
(1.+p_d)*(y_minus*f_minus_sq_f_n_imag+y_minus_f_n_imag*f_minus_sq))
if flag_f_m_perp:
f_plus_sq_f_m_perp_z_real = 2. * (f_n.real + f_m_perp_z.real) * numpy.ones_like(f_m_perp_z.real)
f_plus_sq_f_m_perp_z_imag = 2. * (f_n.imag + f_m_perp_z.imag) * numpy.ones_like(f_m_perp_z.imag)
f_minus_sq_f_m_perp_z_real = -2. * (f_n.real - f_m_perp_z.real) * numpy.ones_like(f_m_perp_z.real)
f_minus_sq_f_m_perp_z_imag = -2. * (f_n.imag - f_m_perp_z.imag) * numpy.ones_like(f_m_perp_z.imag)
f_m_perp_xy_sq_f_m_perp_x_real = 2 * f_m_perp_x.real * numpy.ones_like(f_m_perp_x.real)
f_m_perp_xy_sq_f_m_perp_x_imag = 2 * f_m_perp_x.imag * numpy.ones_like(f_m_perp_x.imag)
f_m_perp_xy_sq_f_m_perp_y_real = 2 * f_m_perp_y.real * numpy.ones_like(f_m_perp_y.real)
f_m_perp_xy_sq_f_m_perp_y_imag = 2 * f_m_perp_y.imag * numpy.ones_like(f_m_perp_y.imag)
chiral_term_f_m_perp_x_real = -2 * f_m_perp_y.imag * numpy.ones_like(f_m_perp_x.real)
chiral_term_f_m_perp_x_imag = 2 * f_m_perp_y.real * numpy.ones_like(f_m_perp_x.imag)
chiral_term_f_m_perp_y_real = 2 * f_m_perp_x.imag * numpy.ones_like(f_m_perp_y.real)
chiral_term_f_m_perp_y_imag = -2 * f_m_perp_x.real * numpy.ones_like(f_m_perp_y.imag)
y_plus_f_m_perp_z_real, y_plus_f_m_perp_z_imag = 0, 0
y_minus_f_m_perp_z_real, y_minus_f_m_perp_z_imag = 0, 0
y_m_perp_xy_f_m_perp_x_real, y_m_perp_xy_f_m_perp_x_imag = 0, 0
y_m_perp_xy_f_m_perp_y_real, y_m_perp_xy_f_m_perp_y_imag = 0, 0
if "f_sq" in dder_y_plus.keys():
y_plus_f_m_perp_z_real = dder_y_plus["f_sq"]*f_plus_sq_f_m_perp_z_real
y_plus_f_m_perp_z_imag = dder_y_plus["f_sq"]*f_plus_sq_f_m_perp_z_imag
if "f_sq" in dder_y_minus.keys():
y_minus_f_m_perp_z_real = dder_y_minus["f_sq"]*f_minus_sq_f_m_perp_z_real
y_minus_f_m_perp_z_imag = dder_y_minus["f_sq"]*f_minus_sq_f_m_perp_z_imag
if "f_sq" in dder_y_m_perp_xy.keys():
y_m_perp_xy_f_m_perp_x_real = dder_y_m_perp_xy["f_sq"]*f_m_perp_xy_sq_f_m_perp_x_real
y_m_perp_xy_f_m_perp_x_imag = dder_y_m_perp_xy["f_sq"]*f_m_perp_xy_sq_f_m_perp_x_imag
y_m_perp_xy_f_m_perp_y_real = dder_y_m_perp_xy["f_sq"]*f_m_perp_xy_sq_f_m_perp_y_real
y_m_perp_xy_f_m_perp_y_imag = dder_y_m_perp_xy["f_sq"]*f_m_perp_xy_sq_f_m_perp_y_imag
dder_plus_f_m_perp_x_real = \
y_m_perp_xy_f_m_perp_x_real * f_m_perp_xy_sq + \
y_m_perp_xy * f_m_perp_xy_sq_f_m_perp_x_real +\
p_u * chiral_term_f_m_perp_x_real
dder_plus_f_m_perp_x_imag = \
y_m_perp_xy_f_m_perp_x_imag * f_m_perp_xy_sq + \
y_m_perp_xy * f_m_perp_xy_sq_f_m_perp_x_imag +\
p_u * chiral_term_f_m_perp_x_imag
dder_plus_f_m_perp_y_real = \
y_m_perp_xy_f_m_perp_y_real * f_m_perp_xy_sq + \
y_m_perp_xy * f_m_perp_xy_sq_f_m_perp_y_real +\
p_u * chiral_term_f_m_perp_y_real
dder_plus_f_m_perp_y_imag = \
y_m_perp_xy_f_m_perp_y_imag * f_m_perp_xy_sq + \
y_m_perp_xy * f_m_perp_xy_sq_f_m_perp_y_imag +\
p_u * chiral_term_f_m_perp_y_imag
dder_plus_f_m_perp_z_real = 0.5*(
(1.+p_u)*(y_plus*f_plus_sq_f_m_perp_z_real+y_plus_f_m_perp_z_real*f_plus_sq) +
(1.-p_u)*(y_minus*f_minus_sq_f_m_perp_z_real+y_minus_f_m_perp_z_real*f_minus_sq))
dder_plus_f_m_perp_z_imag = 0.5*(
(1.+p_u)*(y_plus*f_plus_sq_f_m_perp_z_imag+y_plus_f_m_perp_z_imag*f_plus_sq) +
(1.-p_u)*(y_minus*f_minus_sq_f_m_perp_z_imag+y_minus_f_m_perp_z_imag*f_minus_sq))
dder_plus_f_m_perp_1_real = \
dder_plus_f_m_perp_x_real*matrix_u[0] + \
dder_plus_f_m_perp_y_real*matrix_u[3] + \
dder_plus_f_m_perp_z_real*matrix_u[6]
dder_plus_f_m_perp_1_imag = \
dder_plus_f_m_perp_x_imag*matrix_u[0] + \
dder_plus_f_m_perp_y_imag*matrix_u[3] + \
dder_plus_f_m_perp_z_imag*matrix_u[6]
dder_plus_f_m_perp_2_real = \
dder_plus_f_m_perp_x_real*matrix_u[1] + \
dder_plus_f_m_perp_y_real*matrix_u[4] + \
dder_plus_f_m_perp_z_real*matrix_u[7]
dder_plus_f_m_perp_2_imag = \
dder_plus_f_m_perp_x_imag*matrix_u[1] + \
dder_plus_f_m_perp_y_imag*matrix_u[4] + \
dder_plus_f_m_perp_z_imag*matrix_u[7]
dder_plus_f_m_perp_3_real = \
dder_plus_f_m_perp_x_real*matrix_u[2] + \
dder_plus_f_m_perp_y_real*matrix_u[5] + \
dder_plus_f_m_perp_z_real*matrix_u[8]
dder_plus_f_m_perp_3_imag = \
dder_plus_f_m_perp_x_imag*matrix_u[2] + \
dder_plus_f_m_perp_y_imag*matrix_u[5] + \
dder_plus_f_m_perp_z_imag*matrix_u[8]
dder_plus["f_m_perp_real"] = numpy.stack([
dder_plus_f_m_perp_1_real, dder_plus_f_m_perp_2_real, dder_plus_f_m_perp_3_real],
axis=0)
dder_plus["f_m_perp_imag"] = numpy.stack([
dder_plus_f_m_perp_1_imag, dder_plus_f_m_perp_2_imag, dder_plus_f_m_perp_3_imag],
axis=0)
dder_minus_f_m_perp_x_real = \
y_m_perp_xy_f_m_perp_x_real * f_m_perp_xy_sq + \
y_m_perp_xy * f_m_perp_xy_sq_f_m_perp_x_real -\
p_d * chiral_term_f_m_perp_x_real
dder_minus_f_m_perp_x_imag = \
y_m_perp_xy_f_m_perp_x_imag * f_m_perp_xy_sq + \
y_m_perp_xy * f_m_perp_xy_sq_f_m_perp_x_imag -\
p_d * chiral_term_f_m_perp_x_imag
dder_minus_f_m_perp_y_real = \
y_m_perp_xy_f_m_perp_y_real * f_m_perp_xy_sq + \
y_m_perp_xy * f_m_perp_xy_sq_f_m_perp_y_real -\
p_d * chiral_term_f_m_perp_y_real
dder_minus_f_m_perp_y_imag = \
y_m_perp_xy_f_m_perp_y_imag * f_m_perp_xy_sq + \
y_m_perp_xy * f_m_perp_xy_sq_f_m_perp_y_imag -\
p_d * chiral_term_f_m_perp_y_imag
dder_minus_f_m_perp_z_real = 0.5*(
(1.-p_d)*(y_plus*f_plus_sq_f_m_perp_z_real+y_plus_f_m_perp_z_real*f_plus_sq) +
(1.+p_d)*(y_minus*f_minus_sq_f_m_perp_z_real+y_minus_f_m_perp_z_real*f_minus_sq))
dder_minus_f_m_perp_z_imag = 0.5*(
(1.-p_d)*(y_plus*f_plus_sq_f_m_perp_z_imag+y_plus_f_m_perp_z_imag*f_plus_sq) +
(1.+p_d)*(y_minus*f_minus_sq_f_m_perp_z_imag+y_minus_f_m_perp_z_imag*f_minus_sq))
dder_minus_f_m_perp_1_real = \
dder_minus_f_m_perp_x_real*matrix_u[0] + \
dder_minus_f_m_perp_y_real*matrix_u[3] + \
dder_minus_f_m_perp_z_real*matrix_u[6]
dder_minus_f_m_perp_1_imag = \
dder_minus_f_m_perp_x_imag*matrix_u[0] + \
dder_minus_f_m_perp_y_imag*matrix_u[3] + \
dder_minus_f_m_perp_z_imag*matrix_u[6]
dder_minus_f_m_perp_2_real = \
dder_minus_f_m_perp_x_real*matrix_u[1] + \
dder_minus_f_m_perp_y_real*matrix_u[4] + \
dder_minus_f_m_perp_z_real*matrix_u[7]
dder_minus_f_m_perp_2_imag = \
dder_minus_f_m_perp_x_imag*matrix_u[1] + \
dder_minus_f_m_perp_y_imag*matrix_u[4] + \
dder_minus_f_m_perp_z_imag*matrix_u[7]
dder_minus_f_m_perp_3_real = \
dder_minus_f_m_perp_x_real*matrix_u[2] + \
dder_minus_f_m_perp_y_real*matrix_u[5] + \
dder_minus_f_m_perp_z_real*matrix_u[8]
dder_minus_f_m_perp_3_imag = \
dder_minus_f_m_perp_x_imag*matrix_u[2] + \
dder_minus_f_m_perp_y_imag*matrix_u[5] + \
dder_minus_f_m_perp_z_imag*matrix_u[8]
dder_minus["f_m_perp_real"] = numpy.stack([
dder_minus_f_m_perp_1_real, dder_minus_f_m_perp_2_real, dder_minus_f_m_perp_3_real],
axis=0)
dder_minus["f_m_perp_imag"] = numpy.stack([
dder_minus_f_m_perp_1_imag, dder_minus_f_m_perp_2_imag, dder_minus_f_m_perp_3_imag],
axis=0)
extinction_keys = dder_y_plus.keys()
if len(extinction_keys) != 0:
for key in extinction_keys:
if key == "f_sq":
pass
else:
dder_plus[key] = \
0.5*((1.+p_u)*f_plus_sq*dder_y_plus[key] +
(1.-p_u)*f_minus_sq*dder_y_minus[key]) + \
f_m_perp_xy_sq * dder_y_m_perp_xy[key]
dder_minus[key] = \
0.5*((1.-p_d)*f_plus_sq*dder_y_plus[key] +
(1.+p_d)*f_minus_sq*dder_y_minus[key]) + \
f_m_perp_xy_sq * dder_y_m_perp_xy[key]
return iint_plus, iint_minus, dder_plus, dder_minus
def calc_flip_ratio_by_iint(
iint_plus, iint_minus, c_lambda2: float = None, iint_2hkl = None,
flag_iint_plus: bool = False, flag_iint_minus: bool = False,
flag_c_lambda2: bool = False, flag_iint_2hkl: bool = False):
"""Calculate flip ratio by given integrated intensities.
"""
dder = {}
cond = (c_lambda2 is None) or (iint_2hkl is None)
if cond:
signal_plus = iint_plus
signal_minus = iint_minus
else:
signal_plus = iint_plus + c_lambda2*iint_2hkl
signal_minus = iint_minus + c_lambda2*iint_2hkl
flip_ratio = signal_plus/signal_minus
if flag_iint_plus:
dder["iint_plus"] = numpy.ones_like(iint_plus) / signal_minus
if flag_iint_minus:
dder["iint_minus"] = -1. * flip_ratio * numpy.ones_like(iint_minus)/ signal_minus
if flag_c_lambda2:
dder["c_lambda2"] = numpy.ones_like(c_lambda2)*iint_2hkl / signal_minus - \
flip_ratio * numpy.ones_like(c_lambda2)*iint_2hkl/ signal_minus
if flag_iint_2hkl:
dder["iint_2hkl"] = numpy.ones_like(iint_2hkl)*c_lambda2 / signal_minus - \
flip_ratio * numpy.ones_like(iint_2hkl)*c_lambda2/ signal_minus
return flip_ratio, dder
def calc_asymmetry_by_iint(
iint_plus, iint_minus, c_lambda2: float = None, iint_2hkl = None,
flag_iint_plus: bool = False, flag_iint_minus: bool = False,
flag_c_lambda2: bool = False, flag_iint_2hkl: bool = False):
"""Calculate asymmetry (I^+ - I^-)/(I^+ + I^-).
"""
dder = {}
cond = (c_lambda2 is None) or (iint_2hkl is None)
if cond:
contamination = 0.
else:
contamination = 2.*c_lambda2*iint_2hkl
denom = (iint_plus + iint_minus + contamination)
asymmetry = (iint_plus - iint_minus) / denom
if flag_iint_plus:
dder["iint_plus"] = (1. / denom - (iint_plus - iint_minus) / numpy.square(denom)) * \
numpy.ones_like(iint_plus)
if flag_iint_minus:
dder["iint_minus"] = (-1. / denom - (iint_plus - iint_minus) / numpy.square(denom)) * \
numpy.ones_like(iint_minus)
if flag_c_lambda2:
dder["c_lambda2"] = 2.*iint_2hkl*( - (iint_plus - iint_minus) / numpy.square(denom)) * \
numpy.ones_like(c_lambda2)
if flag_iint_2hkl:
dder["iint_2hkl"] = 2.*c_lambda2*( - (iint_plus - iint_minus) / numpy.square(denom)) * \
numpy.ones_like(iint_2hkl)
return asymmetry, dder
def calc_intensities_by_structure_factors(
beam_polarization: float, flipper_efficiency: float, f_nucl, f_m_perp, matrix_u, func_extinction: Callable = None,
c_lambda2: float=None, f_nucl_2hkl=None, f_m_perp_2hkl=None,
flag_beam_polarization: bool = False, flag_flipper_efficiency: bool = False,
flag_f_nucl: bool = False, flag_f_m_perp: bool = False,
flag_c_lambda2: bool = False,
flag_f_nucl_2hkl: bool = False, flag_f_m_perp_2hkl: bool = False,
dict_in_out: dict = None, flag_use_precalculated_data: bool = False):
"""Calculate flip ratio by given structure factors
"""
if dict_in_out is None:
flag_dict = False
dict_in_out_keys = []
else:
flag_dict = True
dict_in_out_keys = dict_in_out.keys()
iint_plus, iint_minus, dder_plus_hkl, dder_minus_hkl = calc_iint(
beam_polarization, flipper_efficiency, f_nucl, f_m_perp, matrix_u, func_extinction=func_extinction,
flag_beam_polarization=flag_beam_polarization, flag_flipper_efficiency=flag_flipper_efficiency,
flag_f_nucl=flag_f_nucl, flag_f_m_perp=flag_f_m_perp,
dict_in_out=dict_in_out, flag_use_precalculated_data=flag_use_precalculated_data)
cond = (c_lambda2 is None) or (f_nucl_2hkl is None) or (f_m_perp_2hkl is None)
if cond:
c_lambda2 = None
iint_2hkl = None
flag_iint_2hkl = False
dder_2hkl = {}
else:
iint_plus_2hkl, iint_minus_2hkl, dder_plus_2hkl, dder_minus_2hkl = calc_iint(
0, 0, f_nucl_2hkl, f_m_perp_2hkl, matrix_u, func_extinction=func_extinction,
flag_beam_polarization=False, flag_flipper_efficiency=False,
flag_f_nucl=flag_f_nucl_2hkl, flag_f_m_perp=flag_f_m_perp_2hkl,
dict_in_out=None, flag_use_precalculated_data=False)
iint_2hkl = iint_plus_2hkl
dder_2hkl = dder_plus_2hkl
flag_iint_2hkl = len(dder_2hkl.keys()) > 0
iint_plus += c_lambda2*iint_2hkl
iint_minus += c_lambda2*iint_2hkl
if flag_f_nucl_2hkl:
dder_2hkl["f_nucl_2hkl_real"] = dder_2hkl.pop("f_nucl_real")
dder_2hkl["f_nucl_2hkl_imag"] = dder_2hkl.pop("f_nucl_imag")
if flag_f_m_perp_2hkl:
dder_2hkl["f_m_perp_2hkl_real"] = dder_2hkl.pop("f_m_perp_real")
dder_2hkl["f_m_perp_2hkl_imag"] = dder_2hkl.pop("f_m_perp_imag")
dder_plus = {}
dder_minus = {}
keys_plus = dder_plus_hkl.keys()
keys_minus = dder_minus_hkl.keys()
keys_2h = dder_2hkl.keys()
set_key = set(keys_plus) | set(keys_minus) | set(keys_2h)
for key in set_key:
flag_1 = key in keys_plus
flag_2 = key in keys_minus
flag_3 = key in keys_2h
if flag_1:
term_1 = dder_plus_hkl[key]
if flag_2:
term_2 = dder_minus_hkl[key]
if flag_3:
term_3 = dder_2hkl[key]
if flag_1 and flag_3:
dder_plus[key] = term_1 + c_lambda2 * term_3
elif flag_1:
dder_plus[key] = term_1
elif flag_3:
dder_plus[key] = c_lambda2 * term_3
if flag_2 and flag_3:
dder_minus[key] = term_2 + c_lambda2 * term_3
elif flag_2:
dder_minus[key] = term_2
elif flag_3:
dder_minus[key] = c_lambda2 * term_3
if flag_c_lambda2:
dder_plus["c_lambda2"] = iint_2hkl
dder_minus["c_lambda2"] = iint_2hkl
return iint_plus, iint_minus, dder_plus, dder_minus
def calc_flip_ratio_by_structure_factors(
beam_polarization: float, flipper_efficiency: float, f_nucl, f_m_perp, matrix_u, func_extinction: Callable = None,
c_lambda2: float=None, f_nucl_2hkl=None, f_m_perp_2hkl=None,
flag_beam_polarization: bool = False, flag_flipper_efficiency: bool = False,
flag_f_nucl: bool = False, flag_f_m_perp: bool = False,
flag_c_lambda2: bool = False,
flag_f_nucl_2hkl: bool = False, flag_f_m_perp_2hkl: bool = False,
dict_in_out: dict = None, flag_use_precalculated_data: bool = False):
"""Calculate flip ratio by given structure factors
"""
if dict_in_out is None:
flag_dict = False
dict_in_out_keys = []
else:
flag_dict = True
dict_in_out_keys = dict_in_out.keys()
iint_plus, iint_minus, dder_plus, dder_minus = calc_intensities_by_structure_factors(
beam_polarization, flipper_efficiency, f_nucl, f_m_perp, matrix_u, func_extinction=func_extinction,
c_lambda2=c_lambda2, f_nucl_2hkl=f_nucl_2hkl, f_m_perp_2hkl=f_m_perp_2hkl,
flag_beam_polarization=flag_beam_polarization, flag_flipper_efficiency=flag_flipper_efficiency,
flag_f_nucl=flag_f_nucl, flag_f_m_perp=flag_f_m_perp,
flag_c_lambda2=flag_c_lambda2,
flag_f_nucl_2hkl=flag_f_nucl_2hkl, flag_f_m_perp_2hkl=flag_f_m_perp_2hkl,
dict_in_out=dict_in_out, flag_use_precalculated_data=flag_use_precalculated_data)
flip_ration = iint_plus/iint_minus
dder = {}
keys_plus = dder_plus.keys()
keys_minus = dder_minus.keys()
set_key = set(keys_plus) | set(keys_minus)
for key in set_key:
flag_1 = key in keys_plus
flag_2 = key in keys_minus
if flag_1 and flag_2:
dder[key] = dder_plus[key]/iint_minus - flip_ration*dder_minus[key]/iint_minus
elif flag_1:
dder[key] = dder_plus[key]/iint_minus
elif flag_2:
dder[key] = - flip_ration*dder_minus[key]/iint_minus
return flip_ration, dder
| 47.04661
| 122
| 0.672476
| 4,112
| 22,206
| 3.027237
| 0.027237
| 0.128535
| 0.135443
| 0.039364
| 0.867288
| 0.816115
| 0.757873
| 0.70196
| 0.638817
| 0.547638
| 0
| 0.019492
| 0.237593
| 22,206
| 471
| 123
| 47.146497
| 0.715771
| 0.016392
| 0
| 0.273632
| 0
| 0
| 0.023628
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.012438
| false
| 0.002488
| 0.004975
| 0
| 0.029851
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
5cf39c9d7caa61ad13736a237ac01ce3af23ed24
| 27
|
py
|
Python
|
dpath/version.py
|
calebcase/dpath-python
|
52b531695c2b7a9ef49aa42ba50ed605bf3fed92
|
[
"MIT"
] | null | null | null |
dpath/version.py
|
calebcase/dpath-python
|
52b531695c2b7a9ef49aa42ba50ed605bf3fed92
|
[
"MIT"
] | null | null | null |
dpath/version.py
|
calebcase/dpath-python
|
52b531695c2b7a9ef49aa42ba50ed605bf3fed92
|
[
"MIT"
] | null | null | null |
import os
VERSION="1.4.0"
| 6.75
| 15
| 0.666667
| 6
| 27
| 3
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130435
| 0.148148
| 27
| 3
| 16
| 9
| 0.652174
| 0
| 0
| 0
| 0
| 0
| 0.185185
| 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
|
cf07362d66fd192309e46983530a86b65c76e706
| 712
|
py
|
Python
|
easyw/watermark/service/user.py
|
GooZy/Image-Watermark
|
faaba8da5b33372f2fa1d187752da4288aefeb43
|
[
"MIT"
] | 5
|
2018-12-17T08:15:08.000Z
|
2021-10-30T16:52:56.000Z
|
easyw/watermark/service/user.py
|
GooZy/Image-Watermark
|
faaba8da5b33372f2fa1d187752da4288aefeb43
|
[
"MIT"
] | 1
|
2018-12-17T08:52:48.000Z
|
2018-12-20T07:11:53.000Z
|
easyw/watermark/service/user.py
|
GooZy/Image-Watermark
|
faaba8da5b33372f2fa1d187752da4288aefeb43
|
[
"MIT"
] | 1
|
2019-06-18T07:24:02.000Z
|
2019-06-18T07:24:02.000Z
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/3/25 20:18
# @Author : GUO Ziyao
from easyw.common.db import query_db
from easyw.common.utils import hash_password
class UserService(object):
@classmethod
def get_user_by_name(cls, username):
return query_db('SELECT * FROM users WHERE username=?', [username])
@classmethod
def get_user_by_name_and_password(cls, username, password):
return query_db('SELECT * FROM users WHERE username=? AND password=?', [username, hash_password(password)])
@classmethod
def add_user(cls, username, password):
query_db("INSERT INTO users(username, password) VALUES (?, ?)", [username, hash_password(password)])
| 32.363636
| 115
| 0.696629
| 94
| 712
| 5.106383
| 0.478723
| 0.058333
| 0.0625
| 0.0875
| 0.283333
| 0.283333
| 0.170833
| 0.170833
| 0
| 0
| 0
| 0.020478
| 0.176966
| 712
| 21
| 116
| 33.904762
| 0.798635
| 0.126404
| 0
| 0.25
| 0
| 0
| 0.223301
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0.416667
| 0.166667
| 0.166667
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
cf183ac95c30b71cdf89ad3c9ba9ac247e47d17f
| 70
|
py
|
Python
|
secret_santa/controller_service/__init__.py
|
jacobboesch/secret_santa_program
|
f5b75614e716302930e5980beb1c79171e9b5451
|
[
"MIT"
] | null | null | null |
secret_santa/controller_service/__init__.py
|
jacobboesch/secret_santa_program
|
f5b75614e716302930e5980beb1c79171e9b5451
|
[
"MIT"
] | null | null | null |
secret_santa/controller_service/__init__.py
|
jacobboesch/secret_santa_program
|
f5b75614e716302930e5980beb1c79171e9b5451
|
[
"MIT"
] | null | null | null |
from secret_santa.controller_service.email_service import EmailService
| 70
| 70
| 0.928571
| 9
| 70
| 6.888889
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.042857
| 70
| 1
| 70
| 70
| 0.925373
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
cf1cc6f8d9f2322da10a18351e5414e29dbabba4
| 49
|
py
|
Python
|
config.py
|
PatrickLopesF/kucoin-trading-bot
|
b69077e5eea278d28d1fc686762dff9578b80bae
|
[
"MIT"
] | null | null | null |
config.py
|
PatrickLopesF/kucoin-trading-bot
|
b69077e5eea278d28d1fc686762dff9578b80bae
|
[
"MIT"
] | null | null | null |
config.py
|
PatrickLopesF/kucoin-trading-bot
|
b69077e5eea278d28d1fc686762dff9578b80bae
|
[
"MIT"
] | null | null | null |
api_key = ''
api_secret = ''
api_passphrase = ''
| 12.25
| 19
| 0.632653
| 6
| 49
| 4.666667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.183673
| 49
| 3
| 20
| 16.333333
| 0.7
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.333333
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
cf27a0112b4fe4ef571cb653637df903abaf5afe
| 192
|
py
|
Python
|
binreconfiguration/strategy/maxfreespace.py
|
vialette/binreconfiguration
|
57cc024fdcf9b083a830270176ade185b65a85d0
|
[
"MIT"
] | null | null | null |
binreconfiguration/strategy/maxfreespace.py
|
vialette/binreconfiguration
|
57cc024fdcf9b083a830270176ade185b65a85d0
|
[
"MIT"
] | null | null | null |
binreconfiguration/strategy/maxfreespace.py
|
vialette/binreconfiguration
|
57cc024fdcf9b083a830270176ade185b65a85d0
|
[
"MIT"
] | null | null | null |
from .descendinggaugedstrategy import DescendingGaugedStrategy
from .gauge import FreeSpace
class MaxFreeSpace(DescendingGaugedStrategy):
def _gauge(self, item):
return FreeSpace(item)
| 19.2
| 62
| 0.828125
| 18
| 192
| 8.777778
| 0.611111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.114583
| 192
| 9
| 63
| 21.333333
| 0.929412
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.4
| 0.2
| 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
| 1
| 0
| 0
|
0
| 4
|
cf5884124f24b69198865312c0c41c6f1f8e5784
| 87
|
py
|
Python
|
py_tdlib/constructors/get_file.py
|
Mr-TelegramBot/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 24
|
2018-10-05T13:04:30.000Z
|
2020-05-12T08:45:34.000Z
|
py_tdlib/constructors/get_file.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 3
|
2019-06-26T07:20:20.000Z
|
2021-05-24T13:06:56.000Z
|
py_tdlib/constructors/get_file.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 5
|
2018-10-05T14:29:28.000Z
|
2020-08-11T15:04:10.000Z
|
from ..factory import Method
class getFile(Method):
file_id = None # type: "int32"
| 14.5
| 32
| 0.701149
| 12
| 87
| 5
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.028169
| 0.183908
| 87
| 5
| 33
| 17.4
| 0.816901
| 0.149425
| 0
| 0
| 0
| 0
| 0
| 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
|
cf8899f74cabe6150ba74551918867e396ebf30d
| 203
|
py
|
Python
|
app/utils/__init__.py
|
Landers1037/pan
|
483b9fa8ad5bf30375c155d6bdf5db9d2bd063e2
|
[
"MIT"
] | null | null | null |
app/utils/__init__.py
|
Landers1037/pan
|
483b9fa8ad5bf30375c155d6bdf5db9d2bd063e2
|
[
"MIT"
] | null | null | null |
app/utils/__init__.py
|
Landers1037/pan
|
483b9fa8ad5bf30375c155d6bdf5db9d2bd063e2
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
# Time: 2020-05-26 20:45
# Author: Landers1037
# Mail: liaorenj@gmail.com
# File: __init__.py
from .secure_name import secure_name
from .auto_category import auto_category
| 25.375
| 40
| 0.714286
| 30
| 203
| 4.566667
| 0.8
| 0.145985
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 0.162562
| 203
| 8
| 40
| 25.375
| 0.705882
| 0.527094
| 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
|
d8569e28d961d9277732532778d42103783c243d
| 2,540
|
py
|
Python
|
test_day03.py
|
Yolgie/AdventOfCode2017
|
bf823b049659c6c528b354f0895cf311ad69ad5d
|
[
"MIT"
] | null | null | null |
test_day03.py
|
Yolgie/AdventOfCode2017
|
bf823b049659c6c528b354f0895cf311ad69ad5d
|
[
"MIT"
] | null | null | null |
test_day03.py
|
Yolgie/AdventOfCode2017
|
bf823b049659c6c528b354f0895cf311ad69ad5d
|
[
"MIT"
] | null | null | null |
import unittest
from day03 import SpiralMemory, Grid, calculateSpiralPosition
class part01Tests(unittest.TestCase):
spiralMemory = SpiralMemory()
def setUp(self):
super().setUp()
self.spiralMemory.test = 1
def test_sample(self):
self.assertEqual(self.spiralMemory.process(["1"]), 0)
self.assertEqual(self.spiralMemory.process(["12"]), 3)
self.assertEqual(self.spiralMemory.process(["23"]), 2)
self.assertEqual(self.spiralMemory.process(["1024"]), 31)
class part02(unittest.TestCase):
spiralMemory = SpiralMemory()
def setUp(self):
super().setUp()
self.spiralMemory.test = 2
def test_gird(self):
grid = Grid()
self.assertEqual(grid.calculateNext(), 1)
self.assertEqual(grid.calculateNext(), 2)
self.assertEqual(grid.calculateNext(), 4)
self.assertEqual(grid.calculateNext(), 5)
self.assertEqual(grid.calculateNext(), 10)
self.assertEqual(grid.calculateNext(), 11)
self.assertEqual(grid.calculateNext(), 23)
self.assertEqual(grid.calculateNext(), 25)
self.assertEqual(grid.calculateNext(), 26)
self.assertEqual(grid.calculateNext(), 54)
self.assertEqual(grid.calculateNext(), 57)
def test_calculate_spiral_position(self):
self.assertEqual(calculateSpiralPosition(1), (0, 0))
self.assertEqual(calculateSpiralPosition(2), (1, 0))
self.assertEqual(calculateSpiralPosition(3), (1, 1))
self.assertEqual(calculateSpiralPosition(4), (0, 1))
self.assertEqual(calculateSpiralPosition(5), (-1, 1))
self.assertEqual(calculateSpiralPosition(6), (-1, 0))
def test_first_greater(self):
self.assertEqual(self.spiralMemory.process(["0"]), 1)
self.assertEqual(self.spiralMemory.process(["1"]), 2)
self.assertEqual(self.spiralMemory.process(["2"]), 4)
self.assertEqual(self.spiralMemory.process(["3"]), 4)
self.assertEqual(self.spiralMemory.process(["4"]), 5)
self.assertEqual(self.spiralMemory.process(["5"]), 10)
self.assertEqual(self.spiralMemory.process(["6"]), 10)
self.assertEqual(self.spiralMemory.process(["7"]), 10)
self.assertEqual(self.spiralMemory.process(["8"]), 10)
self.assertEqual(self.spiralMemory.process(["10"]), 11)
self.assertEqual(self.spiralMemory.process(["400"]), 747)
self.assertEqual(self.spiralMemory.process(["800"]), 806)
| 40.967742
| 66
| 0.646063
| 262
| 2,540
| 6.236641
| 0.187023
| 0.302938
| 0.186047
| 0.30355
| 0.534884
| 0.369645
| 0.100367
| 0.100367
| 0.100367
| 0.100367
| 0
| 0.047548
| 0.205118
| 2,540
| 61
| 67
| 41.639344
| 0.761763
| 0
| 0
| 0.12
| 0
| 0
| 0.010488
| 0
| 0
| 0
| 0
| 0
| 0.66
| 1
| 0.12
| false
| 0
| 0.04
| 0
| 0.24
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d85a1f47291c7f09ebf88c1f0fd3daab680740e3
| 303
|
py
|
Python
|
exercicios_utfpr/ex015.py
|
MatheusTG/python
|
5ec8701ffcdc5ac5a3e6e75dcd789bdec84612ad
|
[
"MIT"
] | null | null | null |
exercicios_utfpr/ex015.py
|
MatheusTG/python
|
5ec8701ffcdc5ac5a3e6e75dcd789bdec84612ad
|
[
"MIT"
] | null | null | null |
exercicios_utfpr/ex015.py
|
MatheusTG/python
|
5ec8701ffcdc5ac5a3e6e75dcd789bdec84612ad
|
[
"MIT"
] | null | null | null |
hora_trabalho = int(input("Digite o número de horas trabalhadas: "))
salario_min = int(input("Digite o valor do salario minímo: "))
horaextra = int(input("Digite o número de horas extras trabalhadas: "))
print(f"A salario é igual a R$: {salario_min / 8 * hora_trabalho + salario_min / 4 * horaextra}")
| 50.5
| 97
| 0.726073
| 47
| 303
| 4.574468
| 0.531915
| 0.111628
| 0.195349
| 0.209302
| 0.260465
| 0.260465
| 0.260465
| 0
| 0
| 0
| 0
| 0.007782
| 0.151815
| 303
| 5
| 98
| 60.6
| 0.828794
| 0
| 0
| 0
| 0
| 0
| 0.673267
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.25
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d85bc5e8ea40ce97ce5fd1c2867322c48e514b11
| 13
|
py
|
Python
|
epa_aqs_api/output.py
|
ab7289/python-epa-aqs
|
ca60febdb9430b0b6a26be878320b29dca7d6fed
|
[
"MIT"
] | null | null | null |
epa_aqs_api/output.py
|
ab7289/python-epa-aqs
|
ca60febdb9430b0b6a26be878320b29dca7d6fed
|
[
"MIT"
] | null | null | null |
epa_aqs_api/output.py
|
ab7289/python-epa-aqs
|
ca60febdb9430b0b6a26be878320b29dca7d6fed
|
[
"MIT"
] | null | null | null |
# import csv
| 6.5
| 12
| 0.692308
| 2
| 13
| 4.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.230769
| 13
| 1
| 13
| 13
| 0.9
| 0.769231
| 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
|
d88be36131951c5ac2daef7eb577c5ef15dd00c0
| 8,098
|
py
|
Python
|
test/crypten/test_context.py
|
ribhu97/PySyft
|
ee36eb95a01f4e6736e87b8856a3e7788054ac30
|
[
"Apache-2.0"
] | 1
|
2021-04-09T10:23:06.000Z
|
2021-04-09T10:23:06.000Z
|
test/crypten/test_context.py
|
ribhu97/PySyft
|
ee36eb95a01f4e6736e87b8856a3e7788054ac30
|
[
"Apache-2.0"
] | null | null | null |
test/crypten/test_context.py
|
ribhu97/PySyft
|
ee36eb95a01f4e6736e87b8856a3e7788054ac30
|
[
"Apache-2.0"
] | null | null | null |
import pytest
import crypten
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import syft as sy
from syft.frameworks.crypten.context import run_multiworkers, run_party
from syft.frameworks.crypten.model import OnnxModel
from syft.frameworks.crypten import utils
th.set_num_threads(1)
# Define an example network
class ExampleNet(nn.Module):
def __init__(self):
super(ExampleNet, self).__init__()
self.conv1 = nn.Conv2d(1, 16, kernel_size=5, padding=0)
self.fc1 = nn.Linear(16 * 12 * 12, 100)
self.fc2 = nn.Linear(100, 2)
def forward(self, x):
out = self.conv1(x)
out = F.relu(out)
out = F.max_pool2d(out, 2)
out = out.view(-1, 16 * 12 * 12)
out = self.fc1(out)
out = F.relu(out)
out = self.fc2(out)
return out
def test_context_plan(workers):
# alice and bob
n_workers = 2
alice = workers["alice"]
bob = workers["bob"]
alice_tensor_ptr = th.tensor([42, 53, 3, 2]).tag("crypten_data").send(alice)
bob_tensor_ptr = th.tensor([101, 32, 29, 2]).tag("crypten_data").send(bob)
@run_multiworkers([alice, bob], master_addr="127.0.0.1")
@sy.func2plan()
def plan_func(model=None, crypten=crypten): # pragma: no cover
alice_tensor = crypten.load("crypten_data", 0)
bob_tensor = crypten.load("crypten_data", 1)
crypt = alice_tensor + bob_tensor
result = crypt.get_plain_text()
return result
return_values = plan_func()
expected_value = th.tensor([143, 85, 32, 4])
# A toy function is ran at each party, and they should all decrypt
# a tensor with value [143, 85]
for rank in range(n_workers):
assert th.all(
return_values[rank] == expected_value
), "Crypten party with rank {} don't match expected value {} != {}".format(
rank, return_values[rank], expected_value
)
def test_context_jail(workers):
# alice and bob
n_workers = 2
alice = workers["alice"]
bob = workers["bob"]
alice_tensor_ptr = th.tensor([42, 53, 3, 2]).tag("crypten_data").send(alice)
bob_tensor_ptr = th.tensor([101, 32, 29, 2]).tag("crypten_data").send(bob)
@run_multiworkers([alice, bob], master_addr="127.0.0.1")
def jail_func(crypten=crypten): # pragma: no cover
alice_tensor = crypten.load("crypten_data", 0)
bob_tensor = crypten.load("crypten_data", 1)
crypt = alice_tensor + bob_tensor
result = crypt.get_plain_text()
return result
return_values = jail_func()
expected_value = th.tensor([143, 85, 32, 4])
# A toy function is ran at each party, and they should all decrypt
# a tensor with value [143, 85]
for rank in range(n_workers):
assert th.all(
return_values[rank] == expected_value
), "Crypten party with rank {} don't match expected value {} != {}".format(
rank, return_values[rank], expected_value
)
def test_context_jail_with_model(workers):
dummy_input = th.empty(1, 1, 28, 28)
pytorch_model = ExampleNet()
alice = workers["alice"]
bob = workers["bob"]
alice_tensor_ptr = th.tensor(dummy_input).tag("crypten_data").send(alice)
@run_multiworkers(
[alice, bob], master_addr="127.0.0.1", model=pytorch_model, dummy_input=dummy_input
)
def run_encrypted_eval(): # pragma: no cover
rank = crypten.communicator.get().get_rank()
t = crypten.load("crypten_data", 0)
model.encrypt() # noqa: F821
out = model(t) # noqa: F821
model.decrypt() # noqa: F821
out = out.get_plain_text()
return model, out # noqa: F821
result = run_encrypted_eval()
# compare out
assert th.all(result[0][1] == result[1][1])
def test_context_jail_with_model_failures(workers):
dummy_input = th.empty(1, 1, 28, 28)
pytorch_model = ExampleNet()
alice = workers["alice"]
bob = workers["bob"]
alice_tensor_ptr = th.tensor(dummy_input).tag("crypten_data").send(alice)
@run_multiworkers([alice, bob], master_addr="127.0.0.1", model=pytorch_model)
def run_encrypted_eval(): # pragma: no cover
rank = crypten.communicator.get().get_rank()
t = crypten.load("crypten_data", 0)
model.encrypt() # noqa: F821
out = model(t) # noqa: F821
model.decrypt() # noqa: F821
out = out.get_plain_text()
return model, out # noqa: F821
with pytest.raises(ValueError):
result = run_encrypted_eval()
@run_multiworkers([alice, bob], master_addr="127.0.0.1", model=5)
def run_encrypted_eval(): # pragma: no cover
rank = crypten.communicator.get().get_rank()
t = crypten.load("crypten_data", 0)
model.encrypt() # noqa: F821
out = model(t) # noqa: F821
model.decrypt() # noqa: F821
out = out.get_plain_text()
return model, out # noqa: F821
with pytest.raises(TypeError):
result = run_encrypted_eval()
@run_multiworkers([alice, bob], master_addr="127.0.0.1", model=pytorch_model, dummy_input=73)
def run_encrypted_eval(): # pragma: no cover
rank = crypten.communicator.get().get_rank()
t = crypten.load("crypten_data", 0)
model.encrypt() # noqa: F821
out = model(t) # noqa: F821
model.decrypt() # noqa: F821
out = out.get_plain_text()
return model, out # noqa: F821
with pytest.raises(TypeError):
result = run_encrypted_eval()
def test_run_party():
expected = th.tensor(5)
def party(): # pragma: no cover
t = crypten.cryptensor(expected)
return t.get_plain_text()
t = run_party(None, party, 0, 1, "127.0.0.1", 15463, (), {})
result = utils.unpack_values(t)
assert result == expected
def test_duplicate_ids(workers):
# alice and bob
n_workers = 2
alice = workers["alice"]
alice2 = workers["alice"]
@run_multiworkers([alice, alice2], master_addr="127.0.0.1")
def jail_func(crypten=crypten): # pragma: no cover
pass
with pytest.raises(RuntimeError):
return_values = jail_func()
def test_context_plan_with_model(workers):
dummy_input = th.empty(1, 1, 28, 28)
pytorch_model = ExampleNet()
alice = workers["alice"]
bob = workers["bob"]
alice_tensor_ptr = th.tensor(dummy_input).tag("crypten_data").send(alice)
@run_multiworkers(
[alice, bob], master_addr="127.0.0.1", model=pytorch_model, dummy_input=dummy_input
)
@sy.func2plan()
def plan_func_model(model=None, crypten=crypten): # noqa: F821
t = crypten.load("crypten_data", 0)
model.encrypt()
out = model(t)
model.decrypt()
out = out.get_plain_text()
return model, out
result = plan_func_model()
assert th.all(result[0][1] == result[1][1])
def test_context_plan_with_model_private(workers):
"""
Test if we can run remote inference (using data that is not on our local
paty) using a private model (model that is not known locally)
"""
dummy_input = th.empty(1, 1, 28, 28)
pytorch_model = ExampleNet()
alice = workers["alice"]
bob = workers["bob"]
data_alice = th.tensor(dummy_input).tag("crypten_data").send(alice)
model = OnnxModel.fromModel(pytorch_model, dummy_input).tag("crypten_model")
# Model is known only by Bob and Alice and the data is at the local party
alice_model_ptr = model.send(alice)
bob_model_ptr = model.send(bob)
@run_multiworkers([alice, bob], master_addr="127.0.0.1")
@sy.func2plan()
def plan_func_model(crypten=crypten): # noqa: F821
data = crypten.load("crypten_data", 0)
# This should load the crypten model that is found at all parties
model = crypten.load_model("crypten_model")
model.encrypt()
out = model(data)
model.decrypt()
out = out.get_plain_text()
return out
result = plan_func_model()
assert th.all(result[0] == result[1])
| 29.992593
| 97
| 0.633366
| 1,126
| 8,098
| 4.376554
| 0.146536
| 0.040179
| 0.010146
| 0.012175
| 0.726664
| 0.716315
| 0.701907
| 0.701907
| 0.678977
| 0.670657
| 0
| 0.043273
| 0.240924
| 8,098
| 269
| 98
| 30.104089
| 0.758419
| 0.108051
| 0
| 0.666667
| 0
| 0
| 0.071798
| 0
| 0
| 0
| 0
| 0
| 0.032787
| 1
| 0.10929
| false
| 0.005464
| 0.04918
| 0
| 0.218579
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.