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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5ffcec779987825b965bf470d77050aa43d62bf3
| 110
|
py
|
Python
|
app/helpers.py
|
aalekseevx/DFAMinimizer
|
925b38bfb0d619e2e409bdff83934132e8800bcd
|
[
"BSD-3-Clause"
] | null | null | null |
app/helpers.py
|
aalekseevx/DFAMinimizer
|
925b38bfb0d619e2e409bdff83934132e8800bcd
|
[
"BSD-3-Clause"
] | 1
|
2020-10-07T15:14:09.000Z
|
2020-10-07T18:46:02.000Z
|
app/helpers.py
|
aalekseevx/DFAMinimizer
|
925b38bfb0d619e2e409bdff83934132e8800bcd
|
[
"BSD-3-Clause"
] | null | null | null |
import json
class SimpleNamespaceEncoder(json.JSONEncoder):
def default(self, o):
return vars(o)
| 18.333333
| 47
| 0.709091
| 13
| 110
| 6
| 0.846154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| 110
| 5
| 48
| 22
| 0.886364
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
2725c23a7339535ad70d9bc61f3f149bbc8a82dc
| 1,325
|
py
|
Python
|
push_notifications/migrations/0005_applicationid.py
|
odinuge/django-push-notifications
|
03ef4318aafc5135490c12b38979307859ba97ef
|
[
"MIT"
] | null | null | null |
push_notifications/migrations/0005_applicationid.py
|
odinuge/django-push-notifications
|
03ef4318aafc5135490c12b38979307859ba97ef
|
[
"MIT"
] | 1
|
2021-06-25T15:16:55.000Z
|
2021-06-25T15:16:55.000Z
|
push_notifications/migrations/0005_applicationid.py
|
gagantrivedi/django-push-notifications
|
e51692b79be370d66a8e7b67c5c95ec27c5662ab
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('push_notifications', '0004_fcm'),
]
operations = [
migrations.AddField(
model_name='apnsdevice',
name='application_id',
field=models.CharField(help_text='Opaque application identity, should be filled in for multiple key/certificate access', max_length=64, null=True, verbose_name='Application ID', blank=True),
preserve_default=True,
),
migrations.AddField(
model_name='gcmdevice',
name='application_id',
field=models.CharField(help_text='Opaque application identity, should be filled in for multiple key/certificate access', max_length=64, null=True, verbose_name='Application ID', blank=True),
preserve_default=True,
),
migrations.AddField(
model_name='wnsdevice',
name='application_id',
field=models.CharField(help_text='Opaque application identity, should be filled in for multiple key/certificate access', max_length=64, null=True, verbose_name='Application ID', blank=True),
preserve_default=True,
),
]
| 40.151515
| 202
| 0.664151
| 146
| 1,325
| 5.856164
| 0.369863
| 0.105263
| 0.119298
| 0.094737
| 0.722807
| 0.722807
| 0.722807
| 0.722807
| 0.722807
| 0.722807
| 0
| 0.01087
| 0.236226
| 1,325
| 32
| 203
| 41.40625
| 0.833992
| 0.015849
| 0
| 0.555556
| 0
| 0
| 0.299539
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.111111
| 0
| 0.222222
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
2774cb10a62dfd6d8dee0f06166afe9daa6806db
| 204
|
py
|
Python
|
tests/test_constants.py
|
nnseva/starlette-i18n
|
8702507ae0e78616f66cb02de77cc1f4c1c65da6
|
[
"Apache-2.0"
] | 7
|
2021-05-02T00:03:33.000Z
|
2022-01-18T22:06:50.000Z
|
tests/test_constants.py
|
nnseva/starlette-i18n
|
8702507ae0e78616f66cb02de77cc1f4c1c65da6
|
[
"Apache-2.0"
] | 8
|
2021-05-10T23:29:19.000Z
|
2022-02-06T15:19:27.000Z
|
tests/test_constants.py
|
nnseva/starlette-i18n
|
8702507ae0e78616f66cb02de77cc1f4c1c65da6
|
[
"Apache-2.0"
] | 4
|
2021-05-12T06:16:12.000Z
|
2021-07-27T17:09:45.000Z
|
from starlette_i18n import constants
def test_const_default_locale():
assert constants.DEFAULT_LOCALE == "en"
def test_language_header():
assert constants.LANGUAGE_HEADER == "Accept-Language"
| 20.4
| 57
| 0.779412
| 25
| 204
| 6.04
| 0.6
| 0.092715
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011364
| 0.137255
| 204
| 9
| 58
| 22.666667
| 0.846591
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 0
| 0
| 0
| 0
| 0
| 0.4
| 1
| 0.4
| true
| 0
| 0.2
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
2780c011f5af3a43ad91623c11ff1203c791e2cb
| 137
|
py
|
Python
|
devilry/utils/__init__.py
|
aless80/devilry-django
|
416c262e75170d5662542f15e2d7fecf5ab84730
|
[
"BSD-3-Clause"
] | 29
|
2015-01-18T22:56:23.000Z
|
2020-11-10T21:28:27.000Z
|
devilry/utils/__init__.py
|
aless80/devilry-django
|
416c262e75170d5662542f15e2d7fecf5ab84730
|
[
"BSD-3-Clause"
] | 786
|
2015-01-06T16:10:18.000Z
|
2022-03-16T11:10:50.000Z
|
devilry/utils/__init__.py
|
aless80/devilry-django
|
416c262e75170d5662542f15e2d7fecf5ab84730
|
[
"BSD-3-Clause"
] | 15
|
2015-04-06T06:18:43.000Z
|
2021-02-24T12:28:30.000Z
|
try:
from collections import OrderedDict
except ImportError:
from .OrderedDictFallback import OrderedDictFallback as OrderedDict
| 27.4
| 71
| 0.824818
| 13
| 137
| 8.692308
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.153285
| 137
| 4
| 72
| 34.25
| 0.974138
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.75
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
27aafb04f84929cbf5b17fcbe7e77715fd5c1c17
| 444
|
py
|
Python
|
iqt/stochastic/__init__.py
|
yt7589/iching
|
6673da38f4c80e7fd297c86fedc5616aee8ac09b
|
[
"Apache-2.0"
] | 32
|
2020-04-14T08:32:18.000Z
|
2022-02-09T07:05:08.000Z
|
iqt/stochastic/__init__.py
|
yt7589/iching
|
6673da38f4c80e7fd297c86fedc5616aee8ac09b
|
[
"Apache-2.0"
] | 1
|
2020-04-08T10:42:15.000Z
|
2020-04-15T01:38:03.000Z
|
iqt/stochastic/__init__.py
|
yt7589/iching
|
6673da38f4c80e7fd297c86fedc5616aee8ac09b
|
[
"Apache-2.0"
] | 4
|
2020-08-25T03:56:46.000Z
|
2021-05-11T05:55:51.000Z
|
import importlib
if importlib.util.find_spec("stochastic") is not None:
from iqt.stochastic.utils import *
from iqt.stochastic.processes.cox import cox
from iqt.stochastic.processes.fbm import fbm
from iqt.stochastic.processes.gbm import gbm
from iqt.stochastic.processes.heston import heston
from iqt.stochastic.processes.merton import merton
from iqt.stochastic.processes.ornstein_uhlenbeck import ornstein
| 34.153846
| 68
| 0.779279
| 59
| 444
| 5.830508
| 0.355932
| 0.142442
| 0.34593
| 0.453488
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157658
| 444
| 12
| 69
| 37
| 0.919786
| 0
| 0
| 0
| 0
| 0
| 0.022523
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
27b869d4f36e4d7bd2953baa55fd80a3a1f254fd
| 78
|
py
|
Python
|
backend/middleware/__init__.py
|
amjith/ineedempathy
|
a90614444c9c3fe3a8a904c6bae6c39ca02d40fd
|
[
"MIT"
] | 3
|
2021-08-09T00:07:07.000Z
|
2021-11-03T22:37:59.000Z
|
backend/middleware/__init__.py
|
amjith/ineedempathy
|
a90614444c9c3fe3a8a904c6bae6c39ca02d40fd
|
[
"MIT"
] | 1
|
2021-08-30T03:48:28.000Z
|
2021-08-30T04:09:15.000Z
|
backend/middleware/__init__.py
|
itsybits-xyz/ineedempathy
|
5b6df56bcecae1e42ffe12160f507ab558a454a3
|
[
"MIT"
] | null | null | null |
from .connectionmanager import ConnectionManagerMiddleware, ConnectionManager
| 39
| 77
| 0.910256
| 5
| 78
| 14.2
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.064103
| 78
| 1
| 78
| 78
| 0.972603
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
27c8f515189f1aab2532b4f35b76d3b600e5243e
| 5,233
|
py
|
Python
|
code/testsAndTrials/groupLassoTests.py
|
turguthaspolat/CCML
|
c4be37aa1d6806bf51202edba0599c99a44fd5fb
|
[
"MIT"
] | 1
|
2021-05-10T19:11:02.000Z
|
2021-05-10T19:11:02.000Z
|
code/testsAndTrials/groupLassoTests.py
|
turguthaspolat/CCML
|
c4be37aa1d6806bf51202edba0599c99a44fd5fb
|
[
"MIT"
] | null | null | null |
code/testsAndTrials/groupLassoTests.py
|
turguthaspolat/CCML
|
c4be37aa1d6806bf51202edba0599c99a44fd5fb
|
[
"MIT"
] | null | null | null |
import numpy as np
import tensorflow as tf
from groupLasso import groupLasso, choose_noisy_classes, flip_classes
'''
TESTS
'''
def start_endT(n,alpha,beta):
noisy_y = tf.constant([[1,0,0,0,1,1,0,1,1],[1,0,0,0,1,1,0,1,1]]) # Missing class at index 2 and extra class at index 7
p = tf.constant([[0.91,0.11,0.87,0.13,0.92,0.83,0.12,0.05,0.95],[0.78,0.34,0.72,0.2,0.86,0.62,0.4,0.17,0.95]], dtype=np.float32)
losses, classes = groupLasso(noisy_y,p,alpha,beta)
print(f"losses: {losses}")
print(f"classes: {classes}")
def pot_class_assT(n,alpha,beta):
noisy_y = tf.constant([[1,0,0,0,1,1,0,1,1],[1,0,0,0,1,1,0,1,1]]) # Missing class at index 2 and extra class at index 7
p = tf.constant([[0.91,0.11,0.87,0.13,0.92,0.83,0.12,0.05,0.95],[0.91,0.11,0.92,0.13,0.92,0.83,0.12,0.05,0.95]], dtype=np.float32)
losses, classes = groupLasso(noisy_y,p,alpha,beta)
print(f"losses: {losses}")
print(f"classes: {classes}")
def sortT(n,alpha,beta):
noisy_y = tf.constant([[1,0,0,0,1,1,0,1,1],[1,0,0,0,1,1,0,1,1],[1,0,1,1,1,1,0,1,1]])
p = tf.constant([[0.91,0.11,0.87,0.13,0.92,0.83,0.12,0.05,0.95],[0.91,0.11,0.92,0.13,0.92,0.83,0.12,0.05,0.95],[0.91,0.11,0.87,0.13,0.92,0.83,0.12,0.05,0.95]], dtype=np.float32)
losses, classes= groupLasso(noisy_y,p,alpha,beta)
print(f"losses: {losses}")
print(f"classes: {classes}")
def pure_missT(n,alpha,beta):
noisy_y = tf.constant([[1,0,0,0,1,0,0,0,1]]) # Missing classes at indexes 2 and 5
p = tf.constant([[0.91,0.11,0.87,0.13,0.92,0.83,0.12,0.05,0.95]], dtype=np.float32)
losses, classes = groupLasso(noisy_y,p,alpha,beta)
print(f"losses: {losses}")
print(f"classes: {classes}")
def pure_extraT(n,alpha,beta):
noisy_y = tf.constant([[1,0,1,1,1,1,0,1,1]]) # Extra classes at indexes 3 and 7
p = tf.constant([[0.91,0.11,0.87,0.13,0.92,0.83,0.12,0.05,0.95]], dtype=np.float32)
losses, classes = groupLasso(noisy_y,p,alpha,beta)
print(f"losses: {losses}")
print(f"classes: {classes}")
def mix_miss_extraT(n,alpha,beta):
noisy_y = tf.constant([[1,0,0,0,1,1,0,1,1]]) # Missing class at index 2 and extra class at index 7
p = tf.constant([[0.91,0.11,0.87,0.13,0.92,0.83,0.12,0.05,0.95]], dtype=np.float32)
losses, classes = groupLasso(noisy_y,p,alpha,beta)
print(f"losses: {losses}")
print(f"classes: {classes}")
def no_noise_labelT(n,alpha,beta):
y = tf.constant([[1,0,1,0,1,1,0,0,1]]) # 9 CLASSES
p = tf.constant([[0.91,0.11,0.87,0.13,0.92,0.83,0.12,0.05,0.95]], dtype=np.float32)
losses, classes = groupLasso(y,p,alpha,beta)
print(f"losses: {losses}")
print(f"classes: {classes}")
def wrongResultT(n,alpha,beta):
y = tf.constant([[1,0,1,0,1,1,0,0,1]]) # 9 CLASSES
p = tf.constant([[0.53,0.47,0.58,0.39,0.51,0.54,0.49,0.46,0.61]], dtype=np.float32)
losses, classes = groupLasso(y,p,alpha,beta)
print(f"losses: {losses}")
print(f"classes: {classes}")
def margT(n,alpha,beta):
y = tf.constant([[1,0,1,0,1,1,0,0,1]]) # 9 CLASSES
p = tf.constant([[0.6,0.3,0.6,0.3,0.6,0.6,0.3,0.3,0.6]], dtype=np.float32)
losses, classes = groupLasso(y,p,alpha,beta)
print(f"losses: {losses}")
print(f"classes: {classes}")
def marginalT(n,alpha,beta):
'''
The error function expects a difference of at least 0.5 between 1 and 0 labels.
Look at 0.27 value in p.
'''
y = tf.constant([[1,0,1,0,1,1,0,0,1]]) # 9 CLASSES
p = tf.constant([[0.76,0.27,0.76,0.25,0.76,0.76,0.25,0.25,0.76]], dtype=np.float32)
losses, classes = groupLasso(y,p,alpha,beta)
print(f"losses: {losses}")
print(f"classes: {classes}")
def class_choosing(n,alpha,beta):
y = tf.constant([[1,0,1,1,1,1,0,1,1]])
p = tf.constant([[.9,.1,.8,.1,.9,.7,.1,.2,.9]], dtype=np.float32)
losses, classes = groupLasso(y,p,alpha,beta)
print(f"losses: {losses}")
print(f"classes: {classes}")
def agreedFlipT(n,alpha,beta):
noisy_y1 = tf.constant([[1,0,0,0,1,1,0,1,1],[1,0,0,0,1,1,0,1,1],[1,0,1,1,1,1,0,1,1]])
p1 = tf.constant([[0.91,0.11,0.87,0.13,0.92,0.83,0.12,0.05,0.95],[0.91,0.11,0.92,0.13,0.92,0.83,0.12,0.05,0.95],[0.91,0.11,0.87,0.13,0.92,0.83,0.12,0.05,0.95]], dtype=np.float32)
losses1, classes1 = groupLasso(noisy_y1,p1,alpha,beta)
print(f"losses1: {losses1}")
print(f"classes1: {classes1}")
noisy_y2 = tf.constant([[1,0,0,0,1,1,0,1,1],[1,0,1,0,1,0,0,0,0],[1,0,1,1,1,1,0,1,1]])
p2 = tf.constant([[0.91,0.11,0.87,0.13,0.92,0.83,0.12,0.05,0.95],[0.91,0.11,0.92,0.13,0.92,0.83,0.12,0.05,0.95],[0.91,0.11,0.87,0.13,0.92,0.83,0.12,0.05,0.95]], dtype=np.float32)
losses2, classes2 = groupLasso(noisy_y2,p2,alpha,beta)
print(f"losses2: {losses2}")
print(f"classes2: {classes2}")
noisy_sample, noisy_class = choose_noisy_classes(losses1, losses2, classes1, classes2, n)
print(f"noisy_sample: {noisy_sample}")
print(f"noisy_class: {noisy_class}")
flipped_y = flip_classes(noisy_y1, noisy_sample, noisy_class)
print(f"flipped_y: {flipped_y}")
def tests():
num_flips = 1
alpha = 1.0
beta = 1.0
agreedFlipT(num_flips,alpha,beta)
# tests()
| 45.112069
| 183
| 0.611122
| 1,109
| 5,233
| 2.8422
| 0.100992
| 0.03236
| 0.03236
| 0.030457
| 0.723668
| 0.714784
| 0.714784
| 0.711612
| 0.711612
| 0.705584
| 0
| 0.181613
| 0.154023
| 5,233
| 115
| 184
| 45.504348
| 0.530382
| 0.072043
| 0
| 0.477778
| 0
| 0
| 0.111939
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.144444
| false
| 0
| 0.033333
| 0
| 0.177778
| 0.322222
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
27cccbdb77cc464701f4c331862379d030ba3ebe
| 35
|
py
|
Python
|
pythonFiles/tests/testing_tools/adapter/.data/complex/tests/test_doctest.py
|
AlbertDeFusco/vscode-python
|
20349f2e8d5fa49df6b73b8094a4292d35ab767f
|
[
"MIT"
] | 2,461
|
2016-01-21T16:40:43.000Z
|
2022-03-31T12:01:55.000Z
|
pythonFiles/tests/testing_tools/adapter/.data/complex/tests/test_doctest.py
|
AlbertDeFusco/vscode-python
|
20349f2e8d5fa49df6b73b8094a4292d35ab767f
|
[
"MIT"
] | 12,536
|
2019-05-06T21:26:14.000Z
|
2022-03-31T23:06:48.000Z
|
pythonFiles/tests/testing_tools/adapter/.data/complex/tests/test_doctest.py
|
vasili8m/vscode-python
|
846eee870e8b7bab38172600836faedb5fb80166
|
[
"MIT"
] | 871
|
2019-05-15T13:43:55.000Z
|
2022-03-31T03:04:35.000Z
|
"""
Doctests:
>>> 1 == 1
True
"""
| 5
| 10
| 0.4
| 4
| 35
| 3.5
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.076923
| 0.257143
| 35
| 6
| 11
| 5.833333
| 0.461538
| 0.742857
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
27d3b305f7e9ca7c8ce9321a5c738dbcaddf2a68
| 1,162
|
py
|
Python
|
pytorch_lightning/accelerators/__init__.py
|
nahidgrid/pytorch-lightning
|
60bf48d3e0ee26ebafd7a98ad96c86ba304d4533
|
[
"Apache-2.0"
] | null | null | null |
pytorch_lightning/accelerators/__init__.py
|
nahidgrid/pytorch-lightning
|
60bf48d3e0ee26ebafd7a98ad96c86ba304d4533
|
[
"Apache-2.0"
] | null | null | null |
pytorch_lightning/accelerators/__init__.py
|
nahidgrid/pytorch-lightning
|
60bf48d3e0ee26ebafd7a98ad96c86ba304d4533
|
[
"Apache-2.0"
] | null | null | null |
from pytorch_lightning.accelerators.cpu_accelerator import CPUAccelerator
from pytorch_lightning.accelerators.ddp2_accelerator import DDP2Accelerator
from pytorch_lightning.accelerators.ddp_accelerator import DDPAccelerator
from pytorch_lightning.accelerators.ddp_spawn_accelerator import DDPSpawnAccelerator
from pytorch_lightning.accelerators.ddp_cpu_spawn_accelerator import DDPCPUSpawnAccelerator
from pytorch_lightning.accelerators.dp_accelerator import DataParallelAccelerator
from pytorch_lightning.accelerators.gpu_accelerator import GPUAccelerator
from pytorch_lightning.accelerators.tpu_accelerator import TPUAccelerator
from pytorch_lightning.accelerators.horovod_accelerator import HorovodAccelerator
from pytorch_lightning.accelerators.ddp_slurm_accelerator import DDPSLURMAccelerator
from pytorch_lightning.accelerators.ddp_torchelastic_accelerator import DDPTorchElasticAccelerator
from pytorch_lightning.accelerators.ddp_cpu_torchelastic_accelerator import DDPCPUTorchElasticAccelerator
from pytorch_lightning.accelerators.ddp_cpu_slurm_accelerator import DDPCPUSLURMAccelerator
from pytorch_lightning.accelerators.accelerator import Accelerator
| 77.466667
| 105
| 0.927711
| 120
| 1,162
| 8.683333
| 0.241667
| 0.147793
| 0.268714
| 0.429942
| 0.243762
| 0.109405
| 0
| 0
| 0
| 0
| 0
| 0.001808
| 0.048193
| 1,162
| 14
| 106
| 83
| 0.940326
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
27ea81f2eb13c280be1e41e97920669ca9a18136
| 56
|
py
|
Python
|
correios/webservices/__init__.py
|
ramon/correios-py
|
fd48ccf002200db5224c8c6c707bd6eea205d227
|
[
"MIT"
] | null | null | null |
correios/webservices/__init__.py
|
ramon/correios-py
|
fd48ccf002200db5224c8c6c707bd6eea205d227
|
[
"MIT"
] | null | null | null |
correios/webservices/__init__.py
|
ramon/correios-py
|
fd48ccf002200db5224c8c6c707bd6eea205d227
|
[
"MIT"
] | null | null | null |
from .freight import Freight
from .websro import Websro
| 18.666667
| 28
| 0.821429
| 8
| 56
| 5.75
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 56
| 2
| 29
| 28
| 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
| 1
| 0
|
0
| 5
|
fd66900ca798de3430dced42330fd483070a4bca
| 231
|
py
|
Python
|
src/5songs_with_title/auto_5songs_title.py
|
CompetitionDataResearch/recsys-spotify-challenge
|
7468e82fcc69c45b46fd23ad924446d31f729a2e
|
[
"Apache-2.0"
] | 7
|
2018-07-02T07:03:41.000Z
|
2020-12-01T08:07:25.000Z
|
src/5songs_with_title/auto_5songs_title.py
|
CompetitionDataResearch/recsys-spotify-challenge
|
7468e82fcc69c45b46fd23ad924446d31f729a2e
|
[
"Apache-2.0"
] | null | null | null |
src/5songs_with_title/auto_5songs_title.py
|
CompetitionDataResearch/recsys-spotify-challenge
|
7468e82fcc69c45b46fd23ad924446d31f729a2e
|
[
"Apache-2.0"
] | 3
|
2018-07-23T04:21:26.000Z
|
2021-07-06T19:33:20.000Z
|
import os
os.system("python main.py")
os.system("python lgb_train_features.py")
os.system("python lgb_train.py")
os.system("python prediction.py 3 5")
os.system("python lgb_test_features.py")
os.system("python lgb_predict.py 3")
| 23.1
| 41
| 0.761905
| 41
| 231
| 4.146341
| 0.341463
| 0.282353
| 0.494118
| 0.376471
| 0.488235
| 0.488235
| 0
| 0
| 0
| 0
| 0
| 0.014151
| 0.082251
| 231
| 9
| 42
| 25.666667
| 0.787736
| 0
| 0
| 0
| 0
| 0
| 0.584416
| 0.090909
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.142857
| 0
| 0.142857
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
fd6de77972445aea13ca61c9905d5e31fc697701
| 15,445
|
py
|
Python
|
rest_framework/tests/fields.py
|
w-/django-rest-framework
|
da76bd704726830b0b76aabe7aef91b2deb72b02
|
[
"Unlicense"
] | null | null | null |
rest_framework/tests/fields.py
|
w-/django-rest-framework
|
da76bd704726830b0b76aabe7aef91b2deb72b02
|
[
"Unlicense"
] | null | null | null |
rest_framework/tests/fields.py
|
w-/django-rest-framework
|
da76bd704726830b0b76aabe7aef91b2deb72b02
|
[
"Unlicense"
] | 1
|
2021-12-28T06:50:52.000Z
|
2021-12-28T06:50:52.000Z
|
"""
General serializer field tests.
"""
from __future__ import unicode_literals
import datetime
from django.db import models
from django.test import TestCase
from django.core import validators
from rest_framework import serializers
class TimestampedModel(models.Model):
added = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
class CharPrimaryKeyModel(models.Model):
id = models.CharField(max_length=20, primary_key=True)
class TimestampedModelSerializer(serializers.ModelSerializer):
class Meta:
model = TimestampedModel
class CharPrimaryKeyModelSerializer(serializers.ModelSerializer):
class Meta:
model = CharPrimaryKeyModel
class TimeFieldModel(models.Model):
clock = models.TimeField()
class TimeFieldModelSerializer(serializers.ModelSerializer):
class Meta:
model = TimeFieldModel
class BasicFieldTests(TestCase):
def test_auto_now_fields_read_only(self):
"""
auto_now and auto_now_add fields should be read_only by default.
"""
serializer = TimestampedModelSerializer()
self.assertEqual(serializer.fields['added'].read_only, True)
def test_auto_pk_fields_read_only(self):
"""
AutoField fields should be read_only by default.
"""
serializer = TimestampedModelSerializer()
self.assertEqual(serializer.fields['id'].read_only, True)
def test_non_auto_pk_fields_not_read_only(self):
"""
PK fields other than AutoField fields should not be read_only by default.
"""
serializer = CharPrimaryKeyModelSerializer()
self.assertEqual(serializer.fields['id'].read_only, False)
class DateFieldTest(TestCase):
"""
Tests for the DateFieldTest from_native() and to_native() behavior
"""
def test_from_native_string(self):
"""
Make sure from_native() accepts default iso input formats.
"""
f = serializers.DateField()
result_1 = f.from_native('1984-07-31')
self.assertEqual(datetime.date(1984, 7, 31), result_1)
def test_from_native_datetime_date(self):
"""
Make sure from_native() accepts a datetime.date instance.
"""
f = serializers.DateField()
result_1 = f.from_native(datetime.date(1984, 7, 31))
self.assertEqual(result_1, datetime.date(1984, 7, 31))
def test_from_native_custom_format(self):
"""
Make sure from_native() accepts custom input formats.
"""
f = serializers.DateField(input_formats=['%Y -- %d'])
result = f.from_native('1984 -- 31')
self.assertEqual(datetime.date(1984, 1, 31), result)
def test_from_native_invalid_default_on_custom_format(self):
"""
Make sure from_native() don't accept default formats if custom format is preset
"""
f = serializers.DateField(input_formats=['%Y -- %d'])
try:
f.from_native('1984-07-31')
except validators.ValidationError as e:
self.assertEqual(e.messages, ["Date has wrong format. Use one of these formats instead: YYYY -- DD"])
else:
self.fail("ValidationError was not properly raised")
def test_from_native_empty(self):
"""
Make sure from_native() returns None on empty param.
"""
f = serializers.DateField()
result = f.from_native('')
self.assertEqual(result, None)
def test_from_native_none(self):
"""
Make sure from_native() returns None on None param.
"""
f = serializers.DateField()
result = f.from_native(None)
self.assertEqual(result, None)
def test_from_native_invalid_date(self):
"""
Make sure from_native() raises a ValidationError on passing an invalid date.
"""
f = serializers.DateField()
try:
f.from_native('1984-13-31')
except validators.ValidationError as e:
self.assertEqual(e.messages, ["Date has wrong format. Use one of these formats instead: YYYY[-MM[-DD]]"])
else:
self.fail("ValidationError was not properly raised")
def test_from_native_invalid_format(self):
"""
Make sure from_native() raises a ValidationError on passing an invalid format.
"""
f = serializers.DateField()
try:
f.from_native('1984 -- 31')
except validators.ValidationError as e:
self.assertEqual(e.messages, ["Date has wrong format. Use one of these formats instead: YYYY[-MM[-DD]]"])
else:
self.fail("ValidationError was not properly raised")
def test_to_native(self):
"""
Make sure to_native() returns isoformat as default.
"""
f = serializers.DateField()
result_1 = f.to_native(datetime.date(1984, 7, 31))
self.assertEqual('1984-07-31', result_1)
def test_to_native_custom_format(self):
"""
Make sure to_native() returns correct custom format.
"""
f = serializers.DateField(format="%Y - %m.%d")
result_1 = f.to_native(datetime.date(1984, 7, 31))
self.assertEqual('1984 - 07.31', result_1)
def test_to_native_none(self):
"""
Make sure from_native() returns None on None param.
"""
f = serializers.DateField(required=False)
self.assertEqual(None, f.to_native(None))
class DateTimeFieldTest(TestCase):
"""
Tests for the DateTimeField from_native() and to_native() behavior
"""
def test_from_native_string(self):
"""
Make sure from_native() accepts default iso input formats.
"""
f = serializers.DateTimeField()
result_1 = f.from_native('1984-07-31 04:31')
result_2 = f.from_native('1984-07-31 04:31:59')
result_3 = f.from_native('1984-07-31 04:31:59.000200')
self.assertEqual(datetime.datetime(1984, 7, 31, 4, 31), result_1)
self.assertEqual(datetime.datetime(1984, 7, 31, 4, 31, 59), result_2)
self.assertEqual(datetime.datetime(1984, 7, 31, 4, 31, 59, 200), result_3)
def test_from_native_datetime_datetime(self):
"""
Make sure from_native() accepts a datetime.datetime instance.
"""
f = serializers.DateTimeField()
result_1 = f.from_native(datetime.datetime(1984, 7, 31, 4, 31))
result_2 = f.from_native(datetime.datetime(1984, 7, 31, 4, 31, 59))
result_3 = f.from_native(datetime.datetime(1984, 7, 31, 4, 31, 59, 200))
self.assertEqual(result_1, datetime.datetime(1984, 7, 31, 4, 31))
self.assertEqual(result_2, datetime.datetime(1984, 7, 31, 4, 31, 59))
self.assertEqual(result_3, datetime.datetime(1984, 7, 31, 4, 31, 59, 200))
def test_from_native_custom_format(self):
"""
Make sure from_native() accepts custom input formats.
"""
f = serializers.DateTimeField(input_formats=['%Y -- %H:%M'])
result = f.from_native('1984 -- 04:59')
self.assertEqual(datetime.datetime(1984, 1, 1, 4, 59), result)
def test_from_native_invalid_default_on_custom_format(self):
"""
Make sure from_native() don't accept default formats if custom format is preset
"""
f = serializers.DateTimeField(input_formats=['%Y -- %H:%M'])
try:
f.from_native('1984-07-31 04:31:59')
except validators.ValidationError as e:
self.assertEqual(e.messages, ["Datetime has wrong format. Use one of these formats instead: YYYY -- hh:mm"])
else:
self.fail("ValidationError was not properly raised")
def test_from_native_empty(self):
"""
Make sure from_native() returns None on empty param.
"""
f = serializers.DateTimeField()
result = f.from_native('')
self.assertEqual(result, None)
def test_from_native_none(self):
"""
Make sure from_native() returns None on None param.
"""
f = serializers.DateTimeField()
result = f.from_native(None)
self.assertEqual(result, None)
def test_from_native_invalid_datetime(self):
"""
Make sure from_native() raises a ValidationError on passing an invalid datetime.
"""
f = serializers.DateTimeField()
try:
f.from_native('04:61:59')
except validators.ValidationError as e:
self.assertEqual(e.messages, ["Datetime has wrong format. Use one of these formats instead: "
"YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HHMM|-HHMM|Z]"])
else:
self.fail("ValidationError was not properly raised")
def test_from_native_invalid_format(self):
"""
Make sure from_native() raises a ValidationError on passing an invalid format.
"""
f = serializers.DateTimeField()
try:
f.from_native('04 -- 31')
except validators.ValidationError as e:
self.assertEqual(e.messages, ["Datetime has wrong format. Use one of these formats instead: "
"YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HHMM|-HHMM|Z]"])
else:
self.fail("ValidationError was not properly raised")
def test_to_native(self):
"""
Make sure to_native() returns isoformat as default.
"""
f = serializers.DateTimeField()
result_1 = f.to_native(datetime.datetime(1984, 7, 31))
result_2 = f.to_native(datetime.datetime(1984, 7, 31, 4, 31))
result_3 = f.to_native(datetime.datetime(1984, 7, 31, 4, 31, 59))
result_4 = f.to_native(datetime.datetime(1984, 7, 31, 4, 31, 59, 200))
self.assertEqual('1984-07-31T00:00:00', result_1)
self.assertEqual('1984-07-31T04:31:00', result_2)
self.assertEqual('1984-07-31T04:31:59', result_3)
self.assertEqual('1984-07-31T04:31:59.000200', result_4)
def test_to_native_custom_format(self):
"""
Make sure to_native() returns correct custom format.
"""
f = serializers.DateTimeField(format="%Y - %H:%M")
result_1 = f.to_native(datetime.datetime(1984, 7, 31))
result_2 = f.to_native(datetime.datetime(1984, 7, 31, 4, 31))
result_3 = f.to_native(datetime.datetime(1984, 7, 31, 4, 31, 59))
result_4 = f.to_native(datetime.datetime(1984, 7, 31, 4, 31, 59, 200))
self.assertEqual('1984 - 00:00', result_1)
self.assertEqual('1984 - 04:31', result_2)
self.assertEqual('1984 - 04:31', result_3)
self.assertEqual('1984 - 04:31', result_4)
def test_to_native_none(self):
"""
Make sure from_native() returns None on None param.
"""
f = serializers.DateTimeField(required=False)
self.assertEqual(None, f.to_native(None))
class TimeFieldTest(TestCase):
"""
Tests for the TimeField from_native() and to_native() behavior
"""
def test_from_native_string(self):
"""
Make sure from_native() accepts default iso input formats.
"""
f = serializers.TimeField()
result_1 = f.from_native('04:31')
result_2 = f.from_native('04:31:59')
result_3 = f.from_native('04:31:59.000200')
self.assertEqual(datetime.time(4, 31), result_1)
self.assertEqual(datetime.time(4, 31, 59), result_2)
self.assertEqual(datetime.time(4, 31, 59, 200), result_3)
def test_from_native_datetime_time(self):
"""
Make sure from_native() accepts a datetime.time instance.
"""
f = serializers.TimeField()
result_1 = f.from_native(datetime.time(4, 31))
result_2 = f.from_native(datetime.time(4, 31, 59))
result_3 = f.from_native(datetime.time(4, 31, 59, 200))
self.assertEqual(result_1, datetime.time(4, 31))
self.assertEqual(result_2, datetime.time(4, 31, 59))
self.assertEqual(result_3, datetime.time(4, 31, 59, 200))
def test_from_native_custom_format(self):
"""
Make sure from_native() accepts custom input formats.
"""
f = serializers.TimeField(input_formats=['%H -- %M'])
result = f.from_native('04 -- 31')
self.assertEqual(datetime.time(4, 31), result)
def test_from_native_invalid_default_on_custom_format(self):
"""
Make sure from_native() don't accept default formats if custom format is preset
"""
f = serializers.TimeField(input_formats=['%H -- %M'])
try:
f.from_native('04:31:59')
except validators.ValidationError as e:
self.assertEqual(e.messages, ["Time has wrong format. Use one of these formats instead: hh -- mm"])
else:
self.fail("ValidationError was not properly raised")
def test_from_native_empty(self):
"""
Make sure from_native() returns None on empty param.
"""
f = serializers.TimeField()
result = f.from_native('')
self.assertEqual(result, None)
def test_from_native_none(self):
"""
Make sure from_native() returns None on None param.
"""
f = serializers.TimeField()
result = f.from_native(None)
self.assertEqual(result, None)
def test_from_native_invalid_time(self):
"""
Make sure from_native() raises a ValidationError on passing an invalid time.
"""
f = serializers.TimeField()
try:
f.from_native('04:61:59')
except validators.ValidationError as e:
self.assertEqual(e.messages, ["Time has wrong format. Use one of these formats instead: "
"hh:mm[:ss[.uuuuuu]]"])
else:
self.fail("ValidationError was not properly raised")
def test_from_native_invalid_format(self):
"""
Make sure from_native() raises a ValidationError on passing an invalid format.
"""
f = serializers.TimeField()
try:
f.from_native('04 -- 31')
except validators.ValidationError as e:
self.assertEqual(e.messages, ["Time has wrong format. Use one of these formats instead: "
"hh:mm[:ss[.uuuuuu]]"])
else:
self.fail("ValidationError was not properly raised")
def test_to_native(self):
"""
Make sure to_native() returns isoformat as default.
"""
f = serializers.TimeField()
result_1 = f.to_native(datetime.time(4, 31))
result_2 = f.to_native(datetime.time(4, 31, 59))
result_3 = f.to_native(datetime.time(4, 31, 59, 200))
self.assertEqual('04:31:00', result_1)
self.assertEqual('04:31:59', result_2)
self.assertEqual('04:31:59.000200', result_3)
def test_to_native_custom_format(self):
"""
Make sure to_native() returns correct custom format.
"""
f = serializers.TimeField(format="%H - %S [%f]")
result_1 = f.to_native(datetime.time(4, 31))
result_2 = f.to_native(datetime.time(4, 31, 59))
result_3 = f.to_native(datetime.time(4, 31, 59, 200))
self.assertEqual('04 - 00 [000000]', result_1)
self.assertEqual('04 - 59 [000000]', result_2)
self.assertEqual('04 - 59 [000200]', result_3)
| 34.707865
| 120
| 0.62033
| 1,932
| 15,445
| 4.798137
| 0.081263
| 0.091694
| 0.041424
| 0.044876
| 0.879288
| 0.838835
| 0.804423
| 0.750162
| 0.666127
| 0.638943
| 0
| 0.062879
| 0.263775
| 15,445
| 444
| 121
| 34.786036
| 0.752352
| 0.15403
| 0
| 0.582278
| 0
| 0
| 0.131799
| 0.009502
| 0
| 0
| 0
| 0
| 0.223629
| 1
| 0.147679
| false
| 0
| 0.025316
| 0
| 0.244726
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
fd969f6c81a225a7d09b02e87d67b39c7bcb4039
| 120
|
py
|
Python
|
dist/Basilisk/simulation/mag_meter/__init__.py
|
ian-cooke/basilisk_mag
|
a8b1e37c31c1287549d6fd4d71fcaa35b6fc3f14
|
[
"0BSD"
] | null | null | null |
dist/Basilisk/simulation/mag_meter/__init__.py
|
ian-cooke/basilisk_mag
|
a8b1e37c31c1287549d6fd4d71fcaa35b6fc3f14
|
[
"0BSD"
] | 1
|
2019-03-13T20:52:22.000Z
|
2019-03-13T20:52:22.000Z
|
dist/Basilisk/simulation/mag_meter/__init__.py
|
ian-cooke/basilisk_mag
|
a8b1e37c31c1287549d6fd4d71fcaa35b6fc3f14
|
[
"0BSD"
] | null | null | null |
# This __init__.py file for the mag_meter package is automatically generated by the build system
from mag_meter import *
| 60
| 96
| 0.825
| 20
| 120
| 4.65
| 0.85
| 0.172043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15
| 120
| 2
| 97
| 60
| 0.911765
| 0.783333
| 0
| 0
| 1
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
fdf7800c794ca2f6eb979559c68fa77527aa722b
| 223
|
py
|
Python
|
utils/io_helper.py
|
OneMoreSecond/LifeCNN
|
8c270fdb5b5a3d0764ab90e101647a9bfc942d91
|
[
"MIT"
] | null | null | null |
utils/io_helper.py
|
OneMoreSecond/LifeCNN
|
8c270fdb5b5a3d0764ab90e101647a9bfc942d91
|
[
"MIT"
] | null | null | null |
utils/io_helper.py
|
OneMoreSecond/LifeCNN
|
8c270fdb5b5a3d0764ab90e101647a9bfc942d91
|
[
"MIT"
] | null | null | null |
import json
def load_json(path):
with open(path, 'r', encoding='utf-8') as f:
return json.load(f)
def save_json(path, obj):
with open(path, 'w', encoding='utf-8') as f:
json.dump(obj, f, indent=4)
| 22.3
| 48
| 0.605381
| 39
| 223
| 3.410256
| 0.512821
| 0.120301
| 0.180451
| 0.210526
| 0.225564
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017341
| 0.224215
| 223
| 9
| 49
| 24.777778
| 0.751445
| 0
| 0
| 0
| 0
| 0
| 0.053812
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0.142857
| 0
| 0.571429
| 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
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
fdf8c551274b98e6cd75815f8c64d2fc5b00f5c3
| 39
|
py
|
Python
|
helper/__init__.py
|
iotalabs/git-enhance
|
21f28c0e8c6860afcee32c329e4ca69af421585d
|
[
"Unlicense",
"MIT"
] | 1
|
2016-05-31T05:11:27.000Z
|
2016-05-31T05:11:27.000Z
|
helper/__init__.py
|
iotalabs/git-enhance
|
21f28c0e8c6860afcee32c329e4ca69af421585d
|
[
"Unlicense",
"MIT"
] | null | null | null |
helper/__init__.py
|
iotalabs/git-enhance
|
21f28c0e8c6860afcee32c329e4ca69af421585d
|
[
"Unlicense",
"MIT"
] | null | null | null |
from gitlab_helper import GitlabHelper
| 19.5
| 38
| 0.897436
| 5
| 39
| 6.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.102564
| 39
| 1
| 39
| 39
| 0.971429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
a902424d0dd0fafe66415d5ea647a4541ba98a74
| 96
|
py
|
Python
|
brole/__init__.py
|
matthew-brett/brole
|
f35dab0e68e0bed9c850985cebbb4ebd1bd414d7
|
[
"BSD-3-Clause-Clear"
] | 1
|
2017-07-19T07:11:36.000Z
|
2017-07-19T07:11:36.000Z
|
brole/__init__.py
|
matthew-brett/brole
|
f35dab0e68e0bed9c850985cebbb4ebd1bd414d7
|
[
"BSD-3-Clause-Clear"
] | null | null | null |
brole/__init__.py
|
matthew-brett/brole
|
f35dab0e68e0bed9c850985cebbb4ebd1bd414d7
|
[
"BSD-3-Clause-Clear"
] | null | null | null |
# init for brole package
from .utils import get_static, get_templates
from .role import setup
| 16
| 44
| 0.791667
| 15
| 96
| 4.933333
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 96
| 5
| 45
| 19.2
| 0.925
| 0.229167
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
e32c2dfb5d239b266a76d16501a0764619c3a102
| 184
|
py
|
Python
|
mmedit/models/backbones/generation_backbones/__init__.py
|
Jian137/mmediting-1
|
e1ac6c93441ec96696d0b530f040b91b809015b6
|
[
"Apache-2.0"
] | 1,884
|
2020-07-09T18:53:43.000Z
|
2022-03-31T12:06:18.000Z
|
mmedit/models/backbones/generation_backbones/__init__.py
|
Jian137/mmediting-1
|
e1ac6c93441ec96696d0b530f040b91b809015b6
|
[
"Apache-2.0"
] | 622
|
2020-07-09T18:52:27.000Z
|
2022-03-31T14:41:09.000Z
|
mmedit/models/backbones/generation_backbones/__init__.py
|
Jian137/mmediting-1
|
e1ac6c93441ec96696d0b530f040b91b809015b6
|
[
"Apache-2.0"
] | 361
|
2020-07-09T19:21:47.000Z
|
2022-03-31T09:58:27.000Z
|
# Copyright (c) OpenMMLab. All rights reserved.
from .resnet_generator import ResnetGenerator
from .unet_generator import UnetGenerator
__all__ = ['UnetGenerator', 'ResnetGenerator']
| 30.666667
| 47
| 0.809783
| 19
| 184
| 7.526316
| 0.684211
| 0.20979
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108696
| 184
| 5
| 48
| 36.8
| 0.871951
| 0.244565
| 0
| 0
| 0
| 0
| 0.20438
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 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
| 1
| 0
|
0
| 5
|
e340350b8b9305464632dfe464ae1fb853c58599
| 202
|
py
|
Python
|
django_profile/fields.py
|
millerthegorilla/django_profile
|
9860022a8c442901c955c4e3c7500f338b958d16
|
[
"MIT"
] | null | null | null |
django_profile/fields.py
|
millerthegorilla/django_profile
|
9860022a8c442901c955c4e3c7500f338b958d16
|
[
"MIT"
] | null | null | null |
django_profile/fields.py
|
millerthegorilla/django_profile
|
9860022a8c442901c955c4e3c7500f338b958d16
|
[
"MIT"
] | null | null | null |
from crispy_forms import layout
class FloatingField(layout.Field):
template = 'fields/profile_floating_field.html'
class FileInput(layout.Field):
template = 'fields/profile_file_input.html'
| 20.2
| 51
| 0.782178
| 25
| 202
| 6.12
| 0.64
| 0.143791
| 0.248366
| 0.326797
| 0.418301
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.128713
| 202
| 9
| 52
| 22.444444
| 0.869318
| 0
| 0
| 0
| 0
| 0
| 0.316832
| 0.316832
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
e38311d71a588d745cbe0ffa221ed4f28c1934ff
| 75
|
py
|
Python
|
app/__main__.py
|
RikardOledal/Guestlist
|
e6bc795ffc3ac5141505c3dab835a8f840bbccff
|
[
"MIT"
] | null | null | null |
app/__main__.py
|
RikardOledal/Guestlist
|
e6bc795ffc3ac5141505c3dab835a8f840bbccff
|
[
"MIT"
] | null | null | null |
app/__main__.py
|
RikardOledal/Guestlist
|
e6bc795ffc3ac5141505c3dab835a8f840bbccff
|
[
"MIT"
] | null | null | null |
from __init__ import app, welcome_message
print(welcome_message)
app.run()
| 18.75
| 41
| 0.826667
| 11
| 75
| 5.090909
| 0.727273
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.093333
| 75
| 4
| 42
| 18.75
| 0.823529
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
8b7ed56623519d87bd67283bbda8dc359059cc5d
| 82
|
py
|
Python
|
presidio-analyzer/tests/mocks/__init__.py
|
gitcarbs/presidio
|
b547eb154212aea43e398bf533b2f9ef435cc6bb
|
[
"MIT"
] | null | null | null |
presidio-analyzer/tests/mocks/__init__.py
|
gitcarbs/presidio
|
b547eb154212aea43e398bf533b2f9ef435cc6bb
|
[
"MIT"
] | 1
|
2020-01-17T01:05:46.000Z
|
2020-01-17T17:37:11.000Z
|
presidio-analyzer/tests/mocks/__init__.py
|
gitcarbs/presidio
|
b547eb154212aea43e398bf533b2f9ef435cc6bb
|
[
"MIT"
] | 1
|
2021-03-14T12:31:06.000Z
|
2021-03-14T12:31:06.000Z
|
from .nlp_engine_mock import MockNlpEngine
from tests.mocks import app_tracer_mock
| 41
| 42
| 0.890244
| 13
| 82
| 5.307692
| 0.769231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.085366
| 82
| 2
| 43
| 41
| 0.92
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
8b91cbbe11050e335295d9f8a1bd13201bbbfefa
| 126
|
py
|
Python
|
api/admin.py
|
brt32/rest-api-django
|
1d7604e00f416b87befd8fcde65be0bf8e028c62
|
[
"MIT"
] | null | null | null |
api/admin.py
|
brt32/rest-api-django
|
1d7604e00f416b87befd8fcde65be0bf8e028c62
|
[
"MIT"
] | null | null | null |
api/admin.py
|
brt32/rest-api-django
|
1d7604e00f416b87befd8fcde65be0bf8e028c62
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from api import models
# Register your models here.
admin.site.register(models.UserProfile)
| 21
| 39
| 0.81746
| 18
| 126
| 5.722222
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119048
| 126
| 6
| 39
| 21
| 0.927928
| 0.206349
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
8bc5ef0a1018818bb9e12d6e58134e966f0b6ef2
| 390
|
py
|
Python
|
pypeman/tests/test_imports.py
|
jrmi/pypeman
|
30097ae6f3200450b52959a4df1d3181976b6776
|
[
"Apache-2.0"
] | 1
|
2021-01-09T10:44:45.000Z
|
2021-01-09T10:44:45.000Z
|
pypeman/tests/test_imports.py
|
jrmi/pypeman
|
30097ae6f3200450b52959a4df1d3181976b6776
|
[
"Apache-2.0"
] | null | null | null |
pypeman/tests/test_imports.py
|
jrmi/pypeman
|
30097ae6f3200450b52959a4df1d3181976b6776
|
[
"Apache-2.0"
] | null | null | null |
import unittest
class ImportTests(unittest.TestCase):
def test_ftp_import(self):
import pypeman.contrib.ftp
def test_hl7_import(self):
import pypeman.contrib.hl7
def test_http_import(self):
import pypeman.contrib.http
def test_time_import(self):
import pypeman.contrib.time
def test_xml_import(self):
import pypeman.contrib.xml
| 26
| 37
| 0.705128
| 51
| 390
| 5.196078
| 0.294118
| 0.132075
| 0.301887
| 0.433962
| 0.566038
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006579
| 0.220513
| 390
| 14
| 38
| 27.857143
| 0.865132
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.416667
| false
| 0
| 1
| 0
| 1.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
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
8bcc4b0a237355d8646b5871673d1165bbd131f3
| 962
|
py
|
Python
|
test/solution_tests/CHK_R1/test_checkout_solution.py
|
DPNT-Sourcecode/CHK-lkqa01
|
f1e14b9ba48a42ab77bd4457b793278216094ed5
|
[
"Apache-2.0"
] | null | null | null |
test/solution_tests/CHK_R1/test_checkout_solution.py
|
DPNT-Sourcecode/CHK-lkqa01
|
f1e14b9ba48a42ab77bd4457b793278216094ed5
|
[
"Apache-2.0"
] | null | null | null |
test/solution_tests/CHK_R1/test_checkout_solution.py
|
DPNT-Sourcecode/CHK-lkqa01
|
f1e14b9ba48a42ab77bd4457b793278216094ed5
|
[
"Apache-2.0"
] | null | null | null |
import pytest
from lib.solutions.CHK.checkout_solution import checkout
def test_correct_checkout_no_discount():
assert checkout('AABCD') == 165
def test_correct_checkout_with_discount():
assert checkout('AAABBBCD') == 240
def test_correct_checkout_with_discount_two():
assert checkout('AAAAABBBCD') == 310
def test_correct_checkout_with_discount_three():
assert checkout('EEB') == 80
def test_correct_checkout_with_discount_four():
assert checkout('EEEEBB') == 160
def test_correct_checkout_with_discount_five():
assert checkout('STZ') == 45
def test_correct_checkout_with_discount_five():
assert checkout('ZSTZ') == 65
def test_correct_checkout_with_discount_six():
assert checkout('SSS') == 45
def test_correct_checkout_with_discount_six():
assert checkout('TTT') == 45
def test_wrong_items():
assert checkout('AAArBBBCD') == -1
def test_wrong_input():
with pytest.raises(TypeError):
checkout(10)
| 26
| 56
| 0.753638
| 125
| 962
| 5.416
| 0.352
| 0.113737
| 0.186115
| 0.292467
| 0.511078
| 0.511078
| 0.310192
| 0.304284
| 0.304284
| 0
| 0
| 0.030193
| 0.139293
| 962
| 36
| 57
| 26.722222
| 0.78744
| 0
| 0
| 0.16
| 0
| 0
| 0.056133
| 0
| 0
| 0
| 0
| 0
| 0.4
| 1
| 0.44
| true
| 0
| 0.08
| 0
| 0.52
| 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
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
474661dae630873fb0cc3cf41cd31cbc28bcdca7
| 86
|
py
|
Python
|
src/python/manifold_learning/__init__.py
|
Lamzigit/manifold_learning
|
f699fe4f25dbabdbc2dc9635c4e654b59806e17d
|
[
"MIT"
] | 10
|
2017-06-14T08:04:44.000Z
|
2021-07-06T07:13:16.000Z
|
src/python/manifold_learning/__init__.py
|
Lamzigit/manifold_learning
|
f699fe4f25dbabdbc2dc9635c4e654b59806e17d
|
[
"MIT"
] | 1
|
2020-11-18T13:08:43.000Z
|
2020-11-18T13:12:39.000Z
|
src/python/manifold_learning/__init__.py
|
Lamzigit/manifold_learning
|
f699fe4f25dbabdbc2dc9635c4e654b59806e17d
|
[
"MIT"
] | 3
|
2017-06-14T08:04:53.000Z
|
2019-11-18T13:21:15.000Z
|
from .lpp import LocalityPreservingProjections
from .se import SchroedingerEigenmaps
| 21.5
| 46
| 0.872093
| 8
| 86
| 9.375
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.104651
| 86
| 3
| 47
| 28.666667
| 0.974026
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
477f5f2eae8c28baf978c97193b44518d940405d
| 86
|
py
|
Python
|
lesion_detection_quantification/__init__.py
|
rsjones94/lesion_detection_quantification
|
2126d0b3ec023657991c76f57465ff900fc934d9
|
[
"MIT"
] | null | null | null |
lesion_detection_quantification/__init__.py
|
rsjones94/lesion_detection_quantification
|
2126d0b3ec023657991c76f57465ff900fc934d9
|
[
"MIT"
] | null | null | null |
lesion_detection_quantification/__init__.py
|
rsjones94/lesion_detection_quantification
|
2126d0b3ec023657991c76f57465ff900fc934d9
|
[
"MIT"
] | null | null | null |
from mask_quantification import *
from mask_generation import *
from helpers import *
| 21.5
| 33
| 0.825581
| 11
| 86
| 6.272727
| 0.545455
| 0.231884
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139535
| 86
| 4
| 34
| 21.5
| 0.932432
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
47e13389f060a77e18836634f997c1250e0b8bfa
| 54
|
py
|
Python
|
template/app/base/permissions.py
|
iYasha/django-template-generator
|
954d3ffda328390118993ef5016a6811d6fe306d
|
[
"MIT"
] | null | null | null |
template/app/base/permissions.py
|
iYasha/django-template-generator
|
954d3ffda328390118993ef5016a6811d6fe306d
|
[
"MIT"
] | null | null | null |
template/app/base/permissions.py
|
iYasha/django-template-generator
|
954d3ffda328390118993ef5016a6811d6fe306d
|
[
"MIT"
] | null | null | null |
from rest_framework.permissions import BasePermission
| 27
| 53
| 0.907407
| 6
| 54
| 8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.074074
| 54
| 1
| 54
| 54
| 0.96
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
d072ac3329573414b8463c88cf2f3f03e82c8fe9
| 3,281
|
py
|
Python
|
boardLogic.py
|
Connor-Frank/15-112-term-project
|
4d8b8c90d97bcc318f867bc08c5ba1bc07407ff7
|
[
"MIT"
] | null | null | null |
boardLogic.py
|
Connor-Frank/15-112-term-project
|
4d8b8c90d97bcc318f867bc08c5ba1bc07407ff7
|
[
"MIT"
] | null | null | null |
boardLogic.py
|
Connor-Frank/15-112-term-project
|
4d8b8c90d97bcc318f867bc08c5ba1bc07407ff7
|
[
"MIT"
] | null | null | null |
################################################################################
# boardLogic.py
#
# This file contains all of the logic needed to generate the board. Originally,
# the board was hardcoded, but there was a very strong attempt to convert the
# board generation to use a modified Kruskal's algorithm. If the board is still
# hardcoded, that means the attempt fell short.
#
# Name: Connor Frank
# Andrew ID: connorf
################################################################################
import boardObjs
def genBoard(board):
pacmanStart = int(board.rows * (4 / 5)), board.cols // 2
ghostStart = int(board.rows * (2 / 5)), board.cols // 2
ghostStart = 5, 8
hardcoded = [
[-1] * 17,
[-1, 2, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 2, -1],
[-1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1],
[-1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1],
[-1, 2, 1, 1, 1, 1, -1, -1, 0, -1, -1, 1, 1, 1, 1, 2, -1],
[-1, -1, 1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 1, -1, -1],
[-1, -1, 1, 0, 0, 0, -1, -1, -1, -1, -1, 0, 0, 0, 1, -1, -1],
[-1, -1, 1, -1, -1, 0, -1, 0, 0, 0, -1, 0, -1, -1, 1, -1, -1],
[42, 0, 1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 42],
[-1, -1, 1, -1, -1, 0, -1, -1, -1, -1, -1, 0, -1, -1, 1, -1, -1],
[-1, -1, 1, -1, -1, 0, 0, 0, 3, 0, 0, 0, -1, -1, 1, -1, -1],
[-1, 2, 1, 1, -1, 0, -1, -1, -1, -1, -1, 0, -1, 1, 1, 2, -1],
[-1, 1, -1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, -1, 1, -1],
[-1, 1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, 1, -1],
[-1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, -1],
[-1] * 17,
]
for i in range(board.rows):
if i not in board.adjList:
board.adjList[i] = dict()
row = []
for j in range(board.cols):
val = hardcoded[i][j]
if val >= 0:
if j not in board.adjList[i]:
board.adjList[i][j] = set()
for dRow in range(-1, 2):
for dCol in range(-1, 2):
if (dRow == 0 and dCol == 0) or (
dRow != 0 and dCol != 0
):
continue
try:
if hardcoded[i + dRow][j + dCol] >= 0:
board.adjList[i][j].add((i + dRow, j + dCol))
except IndexError:
# needed b/c the teleportation point val is 42
pass
if val == 42:
row.append(boardObjs.Teleportation())
elif val == -1:
row.append(boardObjs.Wall(board))
elif val == 0:
row.append(boardObjs.Empty())
elif val == 1:
row.append(boardObjs.Food(board))
board.foodCount += 1
elif val == 2:
row.append(boardObjs.MagicFood(board))
board.foodCount += 1
elif val == 3:
row.append(boardObjs.Fruit(board))
board.board.append(row)
# returns starting row/col for pacman and ghosts
return pacmanStart, ghostStart
| 43.171053
| 80
| 0.38982
| 488
| 3,281
| 2.620902
| 0.202869
| 0.237686
| 0.30258
| 0.334636
| 0.320563
| 0.267396
| 0.183737
| 0.175919
| 0.175919
| 0.172791
| 0
| 0.135401
| 0.380981
| 3,281
| 75
| 81
| 43.746667
| 0.494338
| 0.128315
| 0
| 0.067797
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.016949
| false
| 0.016949
| 0.016949
| 0
| 0.050847
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
d08d083db3de21a45ffb2f67f9db3535dc7d5ad6
| 908
|
py
|
Python
|
src/PyxelSpec.py
|
ytyaru/Python.Pyxel.TileMap.Api.Random.20200404104810
|
35efce78c1ef978ed2ede928e9d4a36b8bf0bc4c
|
[
"CC0-1.0"
] | null | null | null |
src/PyxelSpec.py
|
ytyaru/Python.Pyxel.TileMap.Api.Random.20200404104810
|
35efce78c1ef978ed2ede928e9d4a36b8bf0bc4c
|
[
"CC0-1.0"
] | null | null | null |
src/PyxelSpec.py
|
ytyaru/Python.Pyxel.TileMap.Api.Random.20200404104810
|
35efce78c1ef978ed2ede928e9d4a36b8bf0bc4c
|
[
"CC0-1.0"
] | null | null | null |
#!/usr/bin/env python3
# coding: utf8
import string
VERSION = '1.3.1'
class Window:
@property
def Size(self): return (256, 256)
class Image:
@property
def Quantity(self): return 3
@property
def Size(self): return (256, 256)
class Color:
@property
def Quantity(self): return 16
class Tile:
@property
def Quantity(self): return 1024
@property
def Size(self): return (8, 8)
class Map:
@property
def Quantity(self): return 8
@property
def Size(self): return (256, 256)
class Sound:
@property
def Quantity(self): return 64
class Music:
@property
def Quantity(self): return 8
@property
def HasChannelQuantity(self): return 4
class Channel:
@property
def HasSoundQuantity(self): return 32
Window = Window()
Image = Image()
Color = Color()
Tile = Tile()
Map = Map()
Sound = Sound()
Music = Music()
Channel = Channel()
| 19.319149
| 42
| 0.651982
| 120
| 908
| 4.933333
| 0.291667
| 0.222973
| 0.192568
| 0.233108
| 0.540541
| 0.302365
| 0.302365
| 0.302365
| 0
| 0
| 0
| 0.056034
| 0.23348
| 908
| 46
| 43
| 19.73913
| 0.79454
| 0.037445
| 0
| 0.404762
| 0
| 0
| 0.005741
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0.02381
| 0.285714
| 0.5
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 5
|
ef1a9e3bc971fcf2165679e901000d8cae2e5bc6
| 76
|
py
|
Python
|
py3k-sympy/sympy/statistics/__init__.py
|
cielavenir/sympy
|
ada04faf48a4eb6c1529e8a5d49a6f2f9ce2616e
|
[
"BSD-3-Clause"
] | null | null | null |
py3k-sympy/sympy/statistics/__init__.py
|
cielavenir/sympy
|
ada04faf48a4eb6c1529e8a5d49a6f2f9ce2616e
|
[
"BSD-3-Clause"
] | null | null | null |
py3k-sympy/sympy/statistics/__init__.py
|
cielavenir/sympy
|
ada04faf48a4eb6c1529e8a5d49a6f2f9ce2616e
|
[
"BSD-3-Clause"
] | null | null | null |
"""
SymPy statistics module
"""
from .distributions import Normal, Uniform
| 12.666667
| 42
| 0.75
| 8
| 76
| 7.125
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.144737
| 76
| 5
| 43
| 15.2
| 0.876923
| 0.302632
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
ef55c41c52b7325dc63936ba9f4c7c4f5a3cbe7a
| 252
|
py
|
Python
|
flask_sk_testing/sk_string.py
|
saktika/flask_sk_testing
|
35ad97ffee4b6d732d10bd4cddadd49b8d05f53c
|
[
"MIT"
] | null | null | null |
flask_sk_testing/sk_string.py
|
saktika/flask_sk_testing
|
35ad97ffee4b6d732d10bd4cddadd49b8d05f53c
|
[
"MIT"
] | null | null | null |
flask_sk_testing/sk_string.py
|
saktika/flask_sk_testing
|
35ad97ffee4b6d732d10bd4cddadd49b8d05f53c
|
[
"MIT"
] | null | null | null |
class SkString:
def __init__(self, text):
self.text = text
def to_upper(self):
return self.text.upper()
def to_lower(self):
return self.text.lower()
def to_title(self):
return self.text.title()
| 21
| 40
| 0.579365
| 33
| 252
| 4.212121
| 0.333333
| 0.28777
| 0.302158
| 0.388489
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.309524
| 252
| 12
| 40
| 21
| 0.798851
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.444444
| false
| 0
| 0
| 0.333333
| 0.888889
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 5
|
ef56a51d4f63994bfc542016b6b54ad32943e322
| 141
|
py
|
Python
|
minigest/docfisc/helpers/__init__.py
|
ctrlmaniac/minigest
|
2bfceb57e41c872e4112e24d0e6991164846888b
|
[
"MIT"
] | null | null | null |
minigest/docfisc/helpers/__init__.py
|
ctrlmaniac/minigest
|
2bfceb57e41c872e4112e24d0e6991164846888b
|
[
"MIT"
] | 1
|
2021-09-22T19:10:20.000Z
|
2021-09-22T19:10:20.000Z
|
minigest/docfisc/helpers/__init__.py
|
ctrlmaniac/minigest
|
2bfceb57e41c872e4112e24d0e6991164846888b
|
[
"MIT"
] | null | null | null |
from .scadenzario import scadenzario
from .updirs import distinte_dir, fatture_dir
__all__ = ["fatture_dir", "distinte_dir", "scadenzario"]
| 28.2
| 56
| 0.794326
| 17
| 141
| 6.117647
| 0.470588
| 0.211538
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.106383
| 141
| 4
| 57
| 35.25
| 0.825397
| 0
| 0
| 0
| 0
| 0
| 0.241135
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 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
| 1
| 0
|
0
| 5
|
ef57c714365dbb7e0e940ab68e509f791267ab90
| 95
|
py
|
Python
|
django101/todos_app/admin.py
|
EmilianStoyanov/python-web
|
60ddb1f0cc4c5bb1615317967c4da33c4171b27b
|
[
"MIT"
] | 3
|
2021-01-19T18:54:38.000Z
|
2022-01-05T17:28:41.000Z
|
django101/todos_app/admin.py
|
EmilianStoyanov/python-web
|
60ddb1f0cc4c5bb1615317967c4da33c4171b27b
|
[
"MIT"
] | null | null | null |
django101/todos_app/admin.py
|
EmilianStoyanov/python-web
|
60ddb1f0cc4c5bb1615317967c4da33c4171b27b
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from todos_app.models import Todo
admin.site.register(Todo)
| 15.833333
| 33
| 0.821053
| 15
| 95
| 5.133333
| 0.733333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115789
| 95
| 5
| 34
| 19
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
324375f499c9e12338ae5f303dc72d359e115ca6
| 49
|
py
|
Python
|
identifier/__init__.py
|
coolman565/blu_two
|
5c7626145b3644570be99ff0267f88bd61b9806c
|
[
"MIT"
] | null | null | null |
identifier/__init__.py
|
coolman565/blu_two
|
5c7626145b3644570be99ff0267f88bd61b9806c
|
[
"MIT"
] | 1
|
2021-06-01T21:57:23.000Z
|
2021-06-01T21:57:23.000Z
|
identifier/__init__.py
|
coolman565/blu_two
|
5c7626145b3644570be99ff0267f88bd61b9806c
|
[
"MIT"
] | null | null | null |
from .__main__ import CLI
from .tvdb import TVDB
| 16.333333
| 25
| 0.795918
| 8
| 49
| 4.375
| 0.625
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.163265
| 49
| 2
| 26
| 24.5
| 0.853659
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
3270f6e0065952e9e62267de08af0d577f06fc29
| 36
|
py
|
Python
|
saliency/__init__.py
|
sotanodroid/saliency-client
|
9b46fd2584a21883256a179bf2537eb8dfb3fef9
|
[
"Apache-2.0"
] | null | null | null |
saliency/__init__.py
|
sotanodroid/saliency-client
|
9b46fd2584a21883256a179bf2537eb8dfb3fef9
|
[
"Apache-2.0"
] | null | null | null |
saliency/__init__.py
|
sotanodroid/saliency-client
|
9b46fd2584a21883256a179bf2537eb8dfb3fef9
|
[
"Apache-2.0"
] | null | null | null |
from .saliency import SaliencyClient
| 36
| 36
| 0.888889
| 4
| 36
| 8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 36
| 1
| 36
| 36
| 0.969697
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
3271101b48d65ff80e71883ca9c515821d1a27d3
| 82
|
py
|
Python
|
ruby/imf.py
|
hypergravity/ruby
|
1f43122c6fb18cacc48f1b6031f2fb6f25a5a28a
|
[
"MIT"
] | null | null | null |
ruby/imf.py
|
hypergravity/ruby
|
1f43122c6fb18cacc48f1b6031f2fb6f25a5a28a
|
[
"MIT"
] | null | null | null |
ruby/imf.py
|
hypergravity/ruby
|
1f43122c6fb18cacc48f1b6031f2fb6f25a5a28a
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
def salpeter(m, ksi0=1.0):
return ksi0 * m ** -2.35
| 13.666667
| 28
| 0.512195
| 14
| 82
| 3
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.129032
| 0.243902
| 82
| 5
| 29
| 16.4
| 0.548387
| 0.256098
| 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
| 1
| 0
|
0
| 5
|
3280c0656a5a96fd8ee7cb827d2fdfd7ec815c16
| 356
|
py
|
Python
|
forms.py
|
jiangyihan7/sayhello
|
3ccc1679e30c1877b143a6b6fa358e989832fe19
|
[
"MIT"
] | null | null | null |
forms.py
|
jiangyihan7/sayhello
|
3ccc1679e30c1877b143a6b6fa358e989832fe19
|
[
"MIT"
] | null | null | null |
forms.py
|
jiangyihan7/sayhello
|
3ccc1679e30c1877b143a6b6fa358e989832fe19
|
[
"MIT"
] | null | null | null |
#表单
from flask_wtf import FlaskForm
from wtforms import StringField,SubmitField,TextAreaField
from wtforms.validators import DataRequired,Length
class HelloForm(FlaskForm):
name = StringField('Name',validators=[DataRequired(),Length(1,20)])
body = TextAreaField('Body',validators=[DataRequired(),Length(1,200)])
submit = SubmitField('submit')
| 35.6
| 74
| 0.775281
| 40
| 356
| 6.875
| 0.525
| 0.196364
| 0.203636
| 0.210909
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.021944
| 0.103933
| 356
| 9
| 75
| 39.555556
| 0.840125
| 0.005618
| 0
| 0
| 0
| 0
| 0.03966
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
32b7c5e71fa96a35bb3b6423674b5759c4640848
| 85
|
py
|
Python
|
tccli/services/cii/__init__.py
|
zqfan/tencentcloud-cli
|
b6ad9fced2a2b340087e4e5522121d405f68b615
|
[
"Apache-2.0"
] | 47
|
2018-05-31T11:26:25.000Z
|
2022-03-08T02:12:45.000Z
|
tccli/services/cii/__init__.py
|
zqfan/tencentcloud-cli
|
b6ad9fced2a2b340087e4e5522121d405f68b615
|
[
"Apache-2.0"
] | 23
|
2018-06-14T10:46:30.000Z
|
2022-02-28T02:53:09.000Z
|
tccli/services/cii/__init__.py
|
zqfan/tencentcloud-cli
|
b6ad9fced2a2b340087e4e5522121d405f68b615
|
[
"Apache-2.0"
] | 22
|
2018-10-22T09:49:45.000Z
|
2022-03-30T08:06:04.000Z
|
# -*- coding: utf-8 -*-
from tccli.services.cii.cii_client import action_caller
| 21.25
| 55
| 0.694118
| 12
| 85
| 4.75
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014085
| 0.164706
| 85
| 4
| 56
| 21.25
| 0.788732
| 0.247059
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
0866522a74b4004bd62ffe8d60affb14fb47fd21
| 133
|
py
|
Python
|
lambdata_echiyembekeza/check_null.py
|
echiyembekeza/lambdata-echiyembekeza
|
5863ce35f04b2f7c904e46dc0dc33504ba331f1c
|
[
"MIT"
] | null | null | null |
lambdata_echiyembekeza/check_null.py
|
echiyembekeza/lambdata-echiyembekeza
|
5863ce35f04b2f7c904e46dc0dc33504ba331f1c
|
[
"MIT"
] | null | null | null |
lambdata_echiyembekeza/check_null.py
|
echiyembekeza/lambdata-echiyembekeza
|
5863ce35f04b2f7c904e46dc0dc33504ba331f1c
|
[
"MIT"
] | null | null | null |
"""
lambdata - A collection of Data Science helper functions.
"""
import pandas as pd
def is_null(df):
pd.DataFrame.isnull(df)
| 14.777778
| 57
| 0.706767
| 20
| 133
| 4.65
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.180451
| 133
| 8
| 58
| 16.625
| 0.853211
| 0.428571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
088e3eec7848e06e9e9da7135cdf585e55307d57
| 2,260
|
py
|
Python
|
utils/errors.py
|
marvenlee2486/vaccinationvc
|
dd9ffb69f1a9e8cba4d8099c327e6d0cebcdc7e3
|
[
"MIT"
] | null | null | null |
utils/errors.py
|
marvenlee2486/vaccinationvc
|
dd9ffb69f1a9e8cba4d8099c327e6d0cebcdc7e3
|
[
"MIT"
] | null | null | null |
utils/errors.py
|
marvenlee2486/vaccinationvc
|
dd9ffb69f1a9e8cba4d8099c327e6d0cebcdc7e3
|
[
"MIT"
] | null | null | null |
from telegram import Update
from telegram.ext import CallbackContext
from functools import wraps
import logging
class ValidationError(Exception):
def __init__(self, details: str, message: str="Missing or Invalid Fields"):
self.details = details
self.message = message
return super().__init__(self.message)
class BackendError(Exception):
def __init__(self, details: str, message: str="Server error, please try again later"):
self.details = details
self.message = message
return super().__init__(self.message)
def catch_error(f):
@wraps(f)
def wrap(update: Update, context: CallbackContext):
try:
return f(update, context)
except ValidationError as e:
logging.info(f"Client Side Information: {update.message}")
logging.error(e.details)
update.message.reply_text(e.message)
except Exception as e:
# Add info to error tracking in sentry
# client.user_context({
# "username": update.message.from_user.username,
# "message": update.message.text
# })
# client.captureException()
logging.info(f"Client Side Information: {update.message}")
logging.error(str(e))
update.message.reply_text("Internal Server Error")
return wrap
def catch_error_callback_query(f):
@wraps(f)
def wrap(update: Update, context: CallbackContext):
try:
return f(update, context)
except ValidationError as e:
logging.info(f"Client Side Information: {update.message}")
logging.error(e.details)
update.callback_query.message.reply_text(e.message)
except Exception as e:
# Add info to error tracking in sentry
# client.user_context({
# "username": update.message.from_user.username,
# "message": update.message.text
# })
# client.captureException()
logging.info(f"Client Side Information: {update.callback_query}")
logging.error(str(e))
update.callback_query.message.reply_text("Internal Server Error")
return wrap
| 31.830986
| 90
| 0.617699
| 246
| 2,260
| 5.54878
| 0.223577
| 0.085714
| 0.035165
| 0.052747
| 0.825641
| 0.806593
| 0.78315
| 0.78315
| 0.658608
| 0.658608
| 0
| 0
| 0.287611
| 2,260
| 71
| 91
| 31.830986
| 0.847826
| 0.15354
| 0
| 0.642857
| 0
| 0
| 0.144135
| 0.012099
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0.095238
| 0
| 0.428571
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
3eb524a247dc93845f4a713fafb2b3f6f364f91a
| 57
|
py
|
Python
|
msr/knn_retriever/__init__.py
|
real-tesco/Multi-Step-Reasoning
|
12c57714c490c5ef5aea9ecabce2143ca89d90b2
|
[
"Apache-2.0"
] | null | null | null |
msr/knn_retriever/__init__.py
|
real-tesco/Multi-Step-Reasoning
|
12c57714c490c5ef5aea9ecabce2143ca89d90b2
|
[
"Apache-2.0"
] | null | null | null |
msr/knn_retriever/__init__.py
|
real-tesco/Multi-Step-Reasoning
|
12c57714c490c5ef5aea9ecabce2143ca89d90b2
|
[
"Apache-2.0"
] | null | null | null |
from msr.knn_retriever.two_tower_bert import TwoTowerBert
| 57
| 57
| 0.912281
| 9
| 57
| 5.444444
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.052632
| 57
| 1
| 57
| 57
| 0.907407
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
3ec57eaf4655deaab13bcc5e79ae47f48a3c5863
| 287
|
py
|
Python
|
lambdata/__init__.py
|
kayla-felts/lambdata-25
|
42337dc68672ad4228dbef9b60b59087fdf4d113
|
[
"MIT"
] | null | null | null |
lambdata/__init__.py
|
kayla-felts/lambdata-25
|
42337dc68672ad4228dbef9b60b59087fdf4d113
|
[
"MIT"
] | null | null | null |
lambdata/__init__.py
|
kayla-felts/lambdata-25
|
42337dc68672ad4228dbef9b60b59087fdf4d113
|
[
"MIT"
] | null | null | null |
print('this i sthe first thing ran on importing lambdada')
import pandas
import numpy
def df_cleaner(df):
'''Clead pd.DataFrame'''
# TODO - Implement
pass
COLORS = ['Blue', 'Mauve', 'Cyan', 'Teal']
def increment(x):
return x + 1
print('Lambdata was just imported')
| 15.944444
| 58
| 0.658537
| 40
| 287
| 4.7
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004405
| 0.209059
| 287
| 18
| 59
| 15.944444
| 0.823789
| 0.125436
| 0
| 0
| 0
| 0
| 0.373984
| 0
| 0
| 0
| 0
| 0.055556
| 0
| 1
| 0.222222
| false
| 0.111111
| 0.444444
| 0.111111
| 0.777778
| 0.222222
| 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
| 1
| 1
| 1
| 0
| 0
|
0
| 5
|
3ee629a8f339f14a9eb7db7ca4c010b500059a23
| 512
|
py
|
Python
|
core/utils/network.py
|
cmu-db/cmdbac
|
1f981e6f110728e51ba4ffdb90ff2d4ce091057a
|
[
"Apache-2.0"
] | 31
|
2016-04-07T04:54:29.000Z
|
2021-11-30T02:30:57.000Z
|
core/utils/network.py
|
cmu-db/db-webcrawler
|
1f981e6f110728e51ba4ffdb90ff2d4ce091057a
|
[
"Apache-2.0"
] | 22
|
2015-12-19T14:49:18.000Z
|
2021-09-07T23:48:24.000Z
|
core/utils/network.py
|
cmu-db/dbac
|
1f981e6f110728e51ba4ffdb90ff2d4ce091057a
|
[
"Apache-2.0"
] | 7
|
2016-05-13T01:02:01.000Z
|
2019-10-06T16:52:54.000Z
|
import os
import json
import time
import requests
import logging
from run import run_command
def query(url, auth = None):
if auth == None:
response = requests.get(url, verify=False)
else:
response = requests.get(url, auth=(auth['user'], auth['pass']), verify=False)
return response
def kill_port(port):
return run_command('fuser -n tcp -k {}'.format(port))
def block_network():
return run_command('ufw enable')
def unblock_network():
return run_command('ufw disable')
| 22.26087
| 85
| 0.6875
| 72
| 512
| 4.791667
| 0.5
| 0.115942
| 0.13913
| 0.127536
| 0.150725
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.191406
| 512
| 23
| 86
| 22.26087
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0.091618
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0.055556
| 0.333333
| 0.166667
| 0.777778
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 1
| 1
| 0
|
0
| 5
|
f5cdc57d3076b82c7cc5bcb2e69bd1732ab7ea48
| 160
|
py
|
Python
|
tests/unitary/test_drop.py
|
pacdao/bonus-nft
|
a4a6dfa590dc2356eaf1172a499cf28f4fc9d692
|
[
"MIT"
] | null | null | null |
tests/unitary/test_drop.py
|
pacdao/bonus-nft
|
a4a6dfa590dc2356eaf1172a499cf28f4fc9d692
|
[
"MIT"
] | null | null | null |
tests/unitary/test_drop.py
|
pacdao/bonus-nft
|
a4a6dfa590dc2356eaf1172a499cf28f4fc9d692
|
[
"MIT"
] | null | null | null |
from brownie import ZERO_ADDRESS, PACDaoBonus1
def test_non_beneficiary_can_deploy(alice, bob):
PACDaoBonus1.deploy(alice, [ZERO_ADDRESS], {"from": bob})
| 26.666667
| 61
| 0.78125
| 21
| 160
| 5.666667
| 0.666667
| 0.184874
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014085
| 0.1125
| 160
| 5
| 62
| 32
| 0.823944
| 0
| 0
| 0
| 0
| 0
| 0.025
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
f5dfe760d4ca172c4b62a0787e613cdf91629950
| 245
|
py
|
Python
|
contact/forms.py
|
farshadz1997/real-estate-project
|
982d620788c2e08c7b193b661ecb9eb2be4c6242
|
[
"MIT"
] | null | null | null |
contact/forms.py
|
farshadz1997/real-estate-project
|
982d620788c2e08c7b193b661ecb9eb2be4c6242
|
[
"MIT"
] | null | null | null |
contact/forms.py
|
farshadz1997/real-estate-project
|
982d620788c2e08c7b193b661ecb9eb2be4c6242
|
[
"MIT"
] | null | null | null |
from django import forms
class ContactForm(forms.Form):
name = forms.CharField(max_length=255)
email = forms.EmailField(max_length=255)
subject = forms.CharField(max_length=255)
message = forms.CharField(widget = forms.Textarea)
| 35
| 54
| 0.75102
| 32
| 245
| 5.65625
| 0.5625
| 0.232044
| 0.198895
| 0.254144
| 0.287293
| 0
| 0
| 0
| 0
| 0
| 0
| 0.043062
| 0.146939
| 245
| 7
| 54
| 35
| 0.822967
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.166667
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
eb172a4477bd1f241f9c1a8c561f06ebb530ac32
| 22,588
|
py
|
Python
|
app/doctor/tests/test_doctor_api.py
|
pks9862728888/curesio
|
2f6eb18f3aa9a404f1ae6db3044c65d3440dfd0f
|
[
"Apache-2.0"
] | null | null | null |
app/doctor/tests/test_doctor_api.py
|
pks9862728888/curesio
|
2f6eb18f3aa9a404f1ae6db3044c65d3440dfd0f
|
[
"Apache-2.0"
] | null | null | null |
app/doctor/tests/test_doctor_api.py
|
pks9862728888/curesio
|
2f6eb18f3aa9a404f1ae6db3044c65d3440dfd0f
|
[
"Apache-2.0"
] | null | null | null |
import tempfile
from PIL import Image
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
from core.models import UserProfile, Languages, Speciality
# Creating urls for making various api calls
DOCTOR_SIGNUP_URL = reverse("doctor:doctor-signup")
TOKEN_URL = reverse("doctor:token")
ME_URL = reverse("doctor:me")
def create_doctor_image_upload_url():
"""Creates url for uploading image for doctor"""
return reverse('doctor:doctor-image-upload')
def create_new_doctor(**kwargs):
"""Creates a new doctor"""
doctor = get_user_model().objects.create_doctor(**kwargs)
doctor.is_active = True
doctor.save()
doctor.refresh_from_db()
return doctor
class PublicUserApiTests(TestCase):
"""Test the doctors api"""
def setUp(self):
self.client = APIClient()
self.speciality = Speciality.objects.create(name='lol')
def test_create_valid_doctor_success(self):
"""Test that creating doctor with valid credential success"""
payload = {
'email': 'test@curesio.com',
'password': 'Appis@404wrong',
'username': 'testusername',
'profile': {
'first_name': 'first_name',
'last_name': 'last name',
'city': 'Tamil Nadu',
'country': 'IN',
'primary_language': Languages.ENGLISH
},
'doctor_profile': {
'qualification': 'MBBS',
'speciality1': [self.speciality.pk]
}
}
res = self.client.post(DOCTOR_SIGNUP_URL, payload, format='json')
profile_data = dict(res.data['profile'])
doc_profile = dict(res.data['doctor_profile'])
self.assertEqual(res.status_code, status.HTTP_201_CREATED)
self.assertEqual(res.data['email'], payload['email'])
self.assertEqual(res.data['username'], payload['username'])
self.assertEqual(profile_data['first_name'],
payload['profile']['first_name'])
self.assertEqual(profile_data['last_name'],
payload['profile']['last_name'])
self.assertEqual(profile_data['city'],
payload['profile']['city'])
self.assertEqual(profile_data['country'],
payload['profile']['country'])
self.assertEqual(profile_data['primary_language'],
payload['profile']['primary_language'])
self.assertEqual(doc_profile['qualification'],
payload['doctor_profile']['qualification'])
self.assertEqual(doc_profile['speciality1'],
payload['doctor_profile']['speciality1'])
self.assertEqual(doc_profile['speciality2'], [])
doctor = get_user_model().objects.get(email=res.data['email'])
self.assertTrue(doctor.check_password(payload['password']))
self.assertNotIn('password', res.data)
self.assertTrue(doctor.is_doctor)
self.assertFalse(doctor.is_active)
self.assertFalse(doctor.is_staff)
def test_create_valid_doctor_full_details_success(self):
"""Test that creating doctor with full credential success"""
payload = {
'email': 'test@curesio.com',
'password': 'Appis@404wrong',
'username': 'testusername',
'profile': {
'first_name': 'first_name',
'last_name': 'last name',
'city': 'Tamil Nadu',
'country': 'IN',
'primary_language': Languages.ENGLISH
},
'doctor_profile': {
'qualification': 'MBBS',
'experience': 3.0,
'highlights': 'test',
'speciality1': [self.speciality.pk],
'speciality2': [self.speciality.pk],
'speciality3': [self.speciality.pk],
'speciality4': [self.speciality.pk]
}
}
res = self.client.post(
DOCTOR_SIGNUP_URL,
payload,
format='json'
)
profile_data = dict(res.data['profile'])
doc_profile_data = dict(res.data['doctor_profile'])
self.assertEqual(res.status_code, status.HTTP_201_CREATED)
self.assertEqual(profile_data['first_name'],
payload['profile']['first_name'])
self.assertEqual(doc_profile_data['qualification'],
payload['doctor_profile']['qualification'])
self.assertEqual(doc_profile_data['experience'],
str(payload['doctor_profile']['experience']))
self.assertEqual(doc_profile_data['highlights'],
payload['doctor_profile']['highlights'])
self.assertEqual(doc_profile_data['speciality1'],
payload['doctor_profile']['speciality1'])
self.assertEqual(doc_profile_data['speciality2'],
payload['doctor_profile']['speciality2'])
self.assertEqual(doc_profile_data['speciality3'],
payload['doctor_profile']['speciality3'])
self.assertEqual(doc_profile_data['speciality4'],
payload['doctor_profile']['speciality4'])
def test_doctor_exists_fails(self):
"""Test that creating new doctor which already exists fails"""
payload = {
'email': 'abck22@gmail.com',
'password': 'Test@123lifeisabitch',
'username': 'testdoctor4'
}
create_new_doctor(**payload)
res = self.client.post(DOCTOR_SIGNUP_URL, payload)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_create_token_valid_doctor(self):
"""Test that token is created for doctor"""
payload = {
'email': 'test@gmail.com',
'password': 'test@1234is_very_bad',
'username': 'testusername'
}
create_new_doctor(**payload)
payload.pop('username')
res = self.client.post(TOKEN_URL, payload)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertIn('token', res.data)
def test_create_token_invalid_credentials(self):
"""Test that no token is created invalid credentials"""
payload = {
'email': 'test@gmail.com',
'password': 'test@1234is_very_bad',
'username': 'testusername'
}
create_new_doctor(**payload)
res = self.client.post(TOKEN_URL, {'email': 'test@gmail.com',
'password': 'wrong'})
self.assertNotIn('token', res.data)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_create_token_no_password(self):
"""Test that no token is created if no password is provided"""
payload = {
'email': 'test@gmail.com',
'password': 'test@1234fk',
'username': 'testusername'
}
create_new_doctor(**payload)
res = self.client.post(
TOKEN_URL, {'email': 'test@gmail.com', 'password': ''})
self.assertNotIn('token', res.data)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_create_token_no_email(self):
"""Test that no token is created if no email is provided"""
payload = {
'email': 'test@gmail.com',
'password': 'test@122443d',
'username': 'testdoctor'
}
create_new_doctor(**payload)
res = self.client.post(
TOKEN_URL, {'email': '', 'password': 'test@122443d'})
self.assertNotIn('token', res.data)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_create_token_no_doctor_fails(self):
"""Test that no token is generated if no doctor is registered"""
res = self.client.post(
TOKEN_URL, {'email': 'test@gmail.com', 'password': 'test@562ddg'})
self.assertNotIn('token', res.data)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_create_token_inactive_doctor_fails(self):
"""Test that creating token for inactive doctor fails"""
payload = {
'email': 'test@curesio.com',
'password': 'Appis@404wrong',
'username': 'testusername',
'profile': {
'first_name': 'first_name',
'last_name': 'last name',
'city': 'Tamil Nadu',
'country': 'IN',
'primary_language': Languages.ENGLISH
},
'doctor_profile': {
'qualification': 'MBBS',
}
}
self.client.post(DOCTOR_SIGNUP_URL, payload, format='json')
res = self.client.post(
TOKEN_URL, {'email': payload['email'],
'password': payload['password']}
)
self.assertNotIn('token', res.data)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_get_not_allowed_on_doctor_signup_url(self):
"""Test that retrieving profile details of others fails"""
create_new_doctor(**{
'email': 'temp@curesio.com',
'password': 'testpass@123df',
'username': 'tempusername'
})
res = self.client.get(DOCTOR_SIGNUP_URL)
self.assertEqual(res.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
def test_retrieve_doctor_unauthorized(self):
"""Test that authentication is required for doctor"""
res = self.client.get(ME_URL)
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
class PrivateUserApiTests(TestCase):
"""Test API requests that requires authentication"""
def setUp(self):
self.doctor = create_new_doctor(**{
'email': 'test@curesio.com',
'password': 'testpass@1234',
'username': 'testdoctor'
})
self.doctor.is_active = True
self.doctor.save()
self.doctor.refresh_from_db()
self.profile = UserProfile.objects.get(user=self.doctor)
self.profile.last_name = 'Lastname'
self.profile.save()
self.profile.refresh_from_db()
self.client = APIClient()
self.client.force_authenticate(user=self.doctor)
def test_get_not_allowed_on_doctor_signup_url(self):
"""Test that retrieving profile details of others fails"""
create_new_doctor(**{
'email': 'temp@curesio.com',
'password': 'testpass@123df',
'username': 'testdoctor12'
})
res = self.client.get(DOCTOR_SIGNUP_URL)
self.assertEqual(res.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
def test_retrieve_profile_success(self):
"""Test that retrieving doctor profile success"""
res = self.client.get(ME_URL)
res_profile = dict(res.data['profile'])
res_doc_profile = dict(res.data['doctor_profile'])
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(res.data['email'], str(self.doctor))
self.assertIn('created_date', res.data)
self.assertEqual(res_profile['first_name'], self.profile.first_name)
self.assertEqual(res_profile['last_name'], self.profile.last_name)
self.assertEqual(res_profile['phone'], self.profile.phone)
self.assertEqual(res_profile['date_of_birth'],
self.profile.date_of_birth)
self.assertEqual(res_profile['city'], self.profile.city)
self.assertEqual(res_profile['country'], self.profile.country)
self.assertEqual(res_profile['postal_code'], self.profile.postal_code)
self.assertEqual(res_profile['address'], self.profile.address)
self.assertEqual(res_profile['primary_language'], None)
self.assertEqual(res_profile['secondary_language'], None)
self.assertEqual(res_profile['tertiary_language'], None)
self.assertEqual(res_doc_profile['qualification'], '')
self.assertEqual(res_doc_profile['experience'], None),
self.assertEqual(res_doc_profile['highlights'], '')
self.assertEqual(res_doc_profile['speciality1'], [])
self.assertEqual(res_doc_profile['speciality2'], [])
self.assertEqual(res_doc_profile['speciality3'], [])
self.assertEqual(res_doc_profile['speciality4'], [])
def test_post_me_not_allowed(self):
"""Test that post is not allowed on me url"""
res = self.client.post(ME_URL, {})
self.assertEqual(res.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
def test_partial_update_doctor_profile(self):
"""Test updating the doctor for authenticated doctor"""
payload = {
'username': 'newusername',
'profile': {
'first_name': 'DarkKnight',
'last_name': 'lastname',
'country': "NZ",
'date_of_birth': '1997-12-23',
'postal_code': '799250',
'primary_language': Languages.HINDI,
'secondary_language': Languages.BENGALI
}
}
res = self.client.patch(ME_URL, payload, format='json')
res_profile = dict(res.data['profile'])
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(self.doctor.username, payload['username'])
self.assertIn('created_date', res.data)
self.assertEqual(res_profile['first_name'],
payload['profile']['first_name'])
self.assertEqual(res_profile['date_of_birth'],
payload['profile']['date_of_birth'])
self.assertEqual(res_profile['country'],
payload['profile']['country'])
self.assertEqual(res_profile['postal_code'],
payload['profile']['postal_code'])
self.assertEqual(res_profile['primary_language'],
payload['profile']['primary_language'])
self.assertEqual(res_profile['secondary_language'],
payload['profile']['secondary_language'])
self.assertEqual(res_profile['tertiary_language'],
None)
def test_cannot_update_email_on_manage_user_url(self):
"""Test that email cannot be changed on manage user url"""
payload = {
'email': 'otherdoctoremail@gmail.com',
}
res = self.client.patch(ME_URL, payload)
self.assertFalse(res.data['email'] == payload['email'])
class DoctorImageUploadTests(TestCase):
"""Tests for uploading doctor profile picture"""
def setUp(self):
"""Setup for running all the tests"""
self.doctor = get_user_model().objects.create_doctor(
email='temp@curesio.com',
password='testpass@4',
username='tempdoctor4'
)
self.doctor.is_active = True
self.doctor.save()
self.doctor.refresh_from_db()
self.client = APIClient()
self.client.force_authenticate(self.doctor)
def tearDown(self):
"""Clean up code after running the tests"""
self.doctor.profile.image.delete()
def test_doctor_profile_picture_upload(self):
"""Test that uploading profile picture is successful"""
image_upload_url = create_doctor_image_upload_url()
with tempfile.NamedTemporaryFile(suffix='.jpg') as ntf:
img = Image.new('RGB', (10, 10))
img.save(ntf, format='JPEG')
ntf.seek(0)
res = self.client.post(
image_upload_url,
{'image': ntf},
format="multipart"
)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertIn('image', res.data)
def test_doctor_profile_picture_invalid_image_fails(self):
"""Test that invalid image upload fails"""
image_upload_url = create_doctor_image_upload_url()
res = self.client.post(
image_upload_url,
{'image': 'invalid image'},
format="multipart"
)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
class PrivateDotorAPITests(TestCase):
"""Tests for private doctor api"""
def setUp(self):
self.client = APIClient()
self.doctor = get_user_model().objects.create_doctor(
email='doctor@curesio.com',
password='testpass@1234',
username='testusername'
)
self.doctor.is_active = True
self.doctor.save()
self.doctor.refresh_from_db()
self.profile = UserProfile.objects.get(user=self.doctor)
self.profile.last_name = 'Lastname'
self.profile.save()
self.profile.refresh_from_db()
self.client.force_authenticate(user=self.doctor)
def test_retrieve_doctor_profile_success(self):
"""Test that retrieving doctor profile success"""
res = self.client.get(ME_URL)
res_profile = dict(res.data['profile'])
res_doctor_profile = dict(res.data['doctor_profile'])
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(res.data['email'], str(self.doctor))
self.assertIn('created_date', res.data)
self.assertEqual(res_profile['first_name'], self.profile.first_name)
self.assertEqual(res_profile['last_name'], self.profile.last_name)
self.assertEqual(res_profile['phone'], self.profile.phone)
self.assertEqual(res_profile['date_of_birth'],
self.profile.date_of_birth)
self.assertEqual(res_profile['city'], self.profile.city)
self.assertEqual(res_profile['country'], self.profile.country)
self.assertEqual(res_profile['postal_code'], self.profile.postal_code)
self.assertEqual(res_profile['address'], self.profile.address)
self.assertEqual(res_profile['primary_language'], None)
self.assertEqual(res_profile['secondary_language'], None)
self.assertEqual(res_profile['tertiary_language'], None)
# Doctor specific tests
self.assertEqual(res_doctor_profile['qualification'], '')
self.assertEqual(res_doctor_profile['highlights'], '')
self.assertEqual(res_doctor_profile['experience'], None)
self.assertEqual(res_doctor_profile['speciality1'], [])
self.assertEqual(res_doctor_profile['speciality2'], [])
self.assertEqual(res_doctor_profile['speciality3'], [])
self.assertEqual(res_doctor_profile['speciality4'], [])
def test_partial_update_doctor_profile(self):
"""Test updating the doctor for authenticated doctor"""
payload = {
'username': 'newusername',
'profile': {
'first_name': 'DarkKnight',
'country': "NZ",
'date_of_birth': '1997-12-23',
'postal_code': '799250',
'primary_language': Languages.HINDI,
'secondary_language': Languages.BENGALI
},
'doctor_profile': {
'experience': 5.5,
'qualification': 'MBBS',
'highlights': 'Achieved award'
}
}
res = self.client.patch(ME_URL, payload, format='json')
res_profile = dict(res.data['profile'])
res_doctor_profile = dict(res.data['doctor_profile'])
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(self.doctor.username, payload['username'])
self.assertIn('created_date', res.data)
self.assertEqual(res_profile['first_name'],
payload['profile']['first_name'])
self.assertEqual(res_profile['date_of_birth'],
payload['profile']['date_of_birth'])
self.assertEqual(res_profile['country'],
payload['profile']['country'])
self.assertEqual(res_profile['postal_code'],
payload['profile']['postal_code'])
self.assertEqual(res_profile['primary_language'],
payload['profile']['primary_language'])
self.assertEqual(res_profile['secondary_language'],
payload['profile']['secondary_language'])
self.assertEqual(res_profile['tertiary_language'],
None)
self.assertEqual(res_doctor_profile['experience'],
str(payload['doctor_profile']['experience']))
self.assertEqual(res_doctor_profile['qualification'],
payload['doctor_profile']['qualification'])
self.assertEqual(res_doctor_profile['highlights'],
payload['doctor_profile']['highlights'])
self.assertEqual(res_doctor_profile['speciality1'], [])
class DoctorUserImageUploadTests(TestCase):
"""Tests for uploading doctor profile picture"""
def setUp(self):
"""Setup for running all the tests"""
self.doctor = get_user_model().objects.create_doctor(
email='temp@curesio.com',
password='testpass@4',
username='tempuser4'
)
self.client = APIClient()
self.client.force_authenticate(self.doctor)
def tearDown(self):
"""Clean up code after running the tests"""
self.doctor.profile.image.delete()
def test_doctor_user_profile_picture_upload(self):
"""Test that uploading profile picture is successful"""
image_upload_url = create_doctor_image_upload_url()
with tempfile.NamedTemporaryFile(suffix='.jpg') as ntf:
img = Image.new('RGB', (10, 10))
img.save(ntf, format='JPEG')
ntf.seek(0)
res = self.client.post(
image_upload_url,
{'image': ntf},
format="multipart"
)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertIn('image', res.data)
def test_user_profile_picture_invalid_image_fails(self):
"""Test that invalid image upload fails"""
image_upload_url = create_doctor_image_upload_url()
res = self.client.post(
image_upload_url,
{'image': 'invalid image'},
format="multipart"
)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
| 38.744425
| 78
| 0.604569
| 2,358
| 22,588
| 5.566158
| 0.09754
| 0.110857
| 0.108343
| 0.068571
| 0.83101
| 0.765486
| 0.738971
| 0.719086
| 0.687314
| 0.628267
| 0
| 0.011663
| 0.271206
| 22,588
| 582
| 79
| 38.810997
| 0.785628
| 0.068089
| 0
| 0.639198
| 0
| 0
| 0.175693
| 0.00249
| 0
| 0
| 0
| 0
| 0.256125
| 1
| 0.069042
| false
| 0.048998
| 0.017817
| 0
| 0.10245
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
eb38022ea85598a443ef7b113884b530378c5ef9
| 1,763
|
py
|
Python
|
MyWork/OldFiles/Beginner/UnderstandingDataTypes/TypeError_Checking_Conversion.py
|
minefarmer/100-Days-Python
|
b80b28d299342b490082ac301a0d8b176419f8f9
|
[
"Unlicense"
] | null | null | null |
MyWork/OldFiles/Beginner/UnderstandingDataTypes/TypeError_Checking_Conversion.py
|
minefarmer/100-Days-Python
|
b80b28d299342b490082ac301a0d8b176419f8f9
|
[
"Unlicense"
] | null | null | null |
MyWork/OldFiles/Beginner/UnderstandingDataTypes/TypeError_Checking_Conversion.py
|
minefarmer/100-Days-Python
|
b80b28d299342b490082ac301a0d8b176419f8f9
|
[
"Unlicense"
] | null | null | null |
# len(4837) # Traceback (most recent call last):
# File "/home/rich/Desktop/CarlsHub/100-Days-Python/MyWork/UnderstandingDataTypes/TypeError_Checking_Conversion.py", line 1, in <module>
# len(4837)
# TypeError: object of type 'int' has no len()
# num_char = len(input("What is your name?")) # Rich
# print("Your name has " + num_char + " characters.") # Traceback (most recent call last):
# Traceback (most recent call last):
# File "/home/rich/Desktop/CarlsHub/100-Days-Python/MyWork/UnderstandingDataTypes/TypeError_Checking_Conversion.py", line 8, in <module>
# print("Your name has " + num_char + " characters.")
# TypeError: can only concatenate str (not "int") to str
# num_char = len(input("What is your name?")) # Rich
# # print("Your name has " + num_char + " characters.")
# print(type(num_char)) # <class 'int'>
# num_char = len(input("What is your name? ")) # Rich
# # print("Your name has " + num_char + " characters.")
# new_num_char = str(num_char)
# print("Your name has " + new_num_char + " characters.") # Your name has 4 characters.
# a = 123
# print(type(a)) # <class 'int'>
# a = str(123)
# print(type(a)) # <class 'str'>
# a = float(123)
# print(type(a)) # <class 'float'>
# print(70 + float("100.5")) # 170.5
# a = 123
# print(type(a))
# print(str(70) + str(100))
# len(4837) # Traceback (most recent call last):
# File "/home/rich/Desktop/CarlsHub/100-Days-Python/MyWork/UnderstandingDataTypes/TypeError_Checking_Conversion.py", line 49, in <module>
# len(4837)
# TypeError: object of type 'int' has no len()
| 32.648148
| 164
| 0.595576
| 227
| 1,763
| 4.54185
| 0.251101
| 0.074685
| 0.064016
| 0.077595
| 0.794374
| 0.701261
| 0.701261
| 0.669253
| 0.669253
| 0.669253
| 0
| 0.043379
| 0.25468
| 1,763
| 53
| 165
| 33.264151
| 0.741248
| 0.839478
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 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
| 5
|
eb460c462b2bafb6bcd74d3469ad0315b3b26721
| 418
|
py
|
Python
|
src/exceptions.py
|
dgnball/loan-item-api
|
81ea836a10829bf78c30b5af5ae35d72fde686ec
|
[
"MIT"
] | null | null | null |
src/exceptions.py
|
dgnball/loan-item-api
|
81ea836a10829bf78c30b5af5ae35d72fde686ec
|
[
"MIT"
] | null | null | null |
src/exceptions.py
|
dgnball/loan-item-api
|
81ea836a10829bf78c30b5af5ae35d72fde686ec
|
[
"MIT"
] | 1
|
2020-08-16T12:11:34.000Z
|
2020-08-16T12:11:34.000Z
|
class NotAllowedException(Exception):
pass
class CannotDeleteLoadedItem(Exception):
pass
class UnknownUserException(Exception):
pass
class UnknownLoanItemException(Exception):
pass
class InitialAdminRoleException(Exception):
pass
class InvalidTokenException(Exception):
pass
class InvalidRequestException(Exception):
pass
class UserAlreadyExistsException(Exception):
pass
| 13.483871
| 44
| 0.77512
| 32
| 418
| 10.125
| 0.34375
| 0.320988
| 0.388889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.167464
| 418
| 30
| 45
| 13.933333
| 0.931034
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 0
| 0
| 1
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
de20582387caa8596c9dbddc5abaa012939c344b
| 52
|
py
|
Python
|
CL_Python/prog02.py
|
UWashington-Astro300/Astro300-A20
|
edc0097c4ef326c07b3155f20d63b636a50eb3ec
|
[
"MIT"
] | 2
|
2020-02-06T03:05:59.000Z
|
2021-06-03T22:55:57.000Z
|
CL_Python/prog02.py
|
UWashington-Astro300/Astro300-A20
|
edc0097c4ef326c07b3155f20d63b636a50eb3ec
|
[
"MIT"
] | null | null | null |
CL_Python/prog02.py
|
UWashington-Astro300/Astro300-A20
|
edc0097c4ef326c07b3155f20d63b636a50eb3ec
|
[
"MIT"
] | 3
|
2019-01-15T01:03:17.000Z
|
2021-04-09T23:11:58.000Z
|
#!/usr/bin/env python
import sys
print (sys.argv)
| 8.666667
| 21
| 0.692308
| 9
| 52
| 4
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.153846
| 52
| 5
| 22
| 10.4
| 0.818182
| 0.384615
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0.5
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
|
0
| 5
|
de353b927de87d2c6b92608c62f3a20c1ac11c4f
| 83
|
py
|
Python
|
prml/nn/io/__init__.py
|
brunomaga/PRML
|
47d9830b39e91690cedb27003934df85cfb8c5c7
|
[
"MIT"
] | 11,017
|
2017-07-03T03:06:25.000Z
|
2022-03-30T18:47:20.000Z
|
prml/nn/io/__init__.py
|
brunomaga/PRML
|
47d9830b39e91690cedb27003934df85cfb8c5c7
|
[
"MIT"
] | 21
|
2017-08-13T01:35:41.000Z
|
2022-03-21T06:25:09.000Z
|
prml/nn/io/__init__.py
|
brunomaga/PRML
|
47d9830b39e91690cedb27003934df85cfb8c5c7
|
[
"MIT"
] | 3,417
|
2017-07-05T12:55:52.000Z
|
2022-03-30T18:47:27.000Z
|
from prml.nn.io.io import save_parameter, load_parameter, save_object, load_object
| 41.5
| 82
| 0.843373
| 14
| 83
| 4.714286
| 0.642857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.084337
| 83
| 1
| 83
| 83
| 0.868421
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
de63eaa99b5866572e649ed70613b636083cc1dd
| 199
|
py
|
Python
|
scalyr_agent/third_party/pysmi/codegen/base.py
|
code-sauce/scalyr-agent-2
|
41023d5c1272186193dd02900782b150dda5f38e
|
[
"Apache-2.0"
] | 67
|
2015-02-03T00:35:33.000Z
|
2022-03-23T10:14:26.000Z
|
scalyr_agent/third_party/pysmi/codegen/base.py
|
code-sauce/scalyr-agent-2
|
41023d5c1272186193dd02900782b150dda5f38e
|
[
"Apache-2.0"
] | 578
|
2015-04-09T08:58:56.000Z
|
2022-03-30T12:13:21.000Z
|
scalyr_agent/third_party/pysmi/codegen/base.py
|
code-sauce/scalyr-agent-2
|
41023d5c1272186193dd02900782b150dda5f38e
|
[
"Apache-2.0"
] | 58
|
2015-01-15T22:00:43.000Z
|
2022-02-18T15:48:31.000Z
|
class AbstractCodeGen(object):
def genCode(self, ast, symbolTable, **kwargs):
raise NotImplementedError()
def genIndex(self, mibsMap, **kwargs):
raise NotImplementedError()
| 24.875
| 50
| 0.683417
| 18
| 199
| 7.555556
| 0.722222
| 0.161765
| 0.441176
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.20603
| 199
| 7
| 51
| 28.428571
| 0.860759
| 0
| 0
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
de785a6a80b94b14f7327e02e70d18b788b50eca
| 37
|
py
|
Python
|
main/zlib/update.py
|
RoastVeg/cports
|
803c7f07af341eb32f791b6ec1f237edb2764bd5
|
[
"BSD-2-Clause"
] | 46
|
2021-06-10T02:27:32.000Z
|
2022-03-27T11:33:24.000Z
|
main/zlib/update.py
|
RoastVeg/cports
|
803c7f07af341eb32f791b6ec1f237edb2764bd5
|
[
"BSD-2-Clause"
] | 58
|
2021-07-03T13:58:20.000Z
|
2022-03-13T16:45:35.000Z
|
main/zlib/update.py
|
RoastVeg/cports
|
803c7f07af341eb32f791b6ec1f237edb2764bd5
|
[
"BSD-2-Clause"
] | 6
|
2021-07-04T10:46:40.000Z
|
2022-01-09T00:03:59.000Z
|
pattern = r"<B>\ zlib\ ([\d.]+)</B>"
| 18.5
| 36
| 0.405405
| 6
| 37
| 2.5
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.135135
| 37
| 1
| 37
| 37
| 0.46875
| 0
| 0
| 0
| 0
| 0
| 0.621622
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
de8ccf5a333e0af50a66873e82473b4babedb149
| 132
|
py
|
Python
|
app/utils/url.py
|
coolexplorer/py-session
|
86ffbd3f1744df18d2deeaa77eebe5dd9980c6ae
|
[
"MIT"
] | 2
|
2021-08-17T07:15:46.000Z
|
2021-08-17T07:18:15.000Z
|
app/utils/url.py
|
coolexplorer/py-session
|
86ffbd3f1744df18d2deeaa77eebe5dd9980c6ae
|
[
"MIT"
] | 1
|
2022-02-24T06:52:08.000Z
|
2022-02-24T06:52:08.000Z
|
app/utils/url.py
|
coolexplorer/py-session
|
86ffbd3f1744df18d2deeaa77eebe5dd9980c6ae
|
[
"MIT"
] | null | null | null |
def create_url(protocol: str, address: str, version: int, path: str):
return protocol + "://" + address + f"/v{version}" + path
| 44
| 69
| 0.643939
| 18
| 132
| 4.666667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.174242
| 132
| 3
| 70
| 44
| 0.770642
| 0
| 0
| 0
| 0
| 0
| 0.106061
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
de960619d1de278e7d2f46150e578e947d1af5c1
| 44
|
py
|
Python
|
tests/components/crownstone/__init__.py
|
MrDelik/core
|
93a66cc357b226389967668441000498a10453bb
|
[
"Apache-2.0"
] | 30,023
|
2016-04-13T10:17:53.000Z
|
2020-03-02T12:56:31.000Z
|
tests/components/crownstone/__init__.py
|
MrDelik/core
|
93a66cc357b226389967668441000498a10453bb
|
[
"Apache-2.0"
] | 31,101
|
2020-03-02T13:00:16.000Z
|
2022-03-31T23:57:36.000Z
|
tests/components/crownstone/__init__.py
|
MrDelik/core
|
93a66cc357b226389967668441000498a10453bb
|
[
"Apache-2.0"
] | 11,956
|
2016-04-13T18:42:31.000Z
|
2020-03-02T09:32:12.000Z
|
"""Tests for the Crownstone integration."""
| 22
| 43
| 0.727273
| 5
| 44
| 6.4
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.113636
| 44
| 1
| 44
| 44
| 0.820513
| 0.840909
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
dea36aaacee97997c5c48e02bb3e5da43e522b6d
| 7,266
|
py
|
Python
|
monitoring/prober/rid/v2/test_isa_validation.py
|
interuss/InterUSS-Platform
|
099abaa1159c4c143f8f1fde6b88956c86608281
|
[
"Apache-2.0"
] | null | null | null |
monitoring/prober/rid/v2/test_isa_validation.py
|
interuss/InterUSS-Platform
|
099abaa1159c4c143f8f1fde6b88956c86608281
|
[
"Apache-2.0"
] | null | null | null |
monitoring/prober/rid/v2/test_isa_validation.py
|
interuss/InterUSS-Platform
|
099abaa1159c4c143f8f1fde6b88956c86608281
|
[
"Apache-2.0"
] | null | null | null |
"""ISA input validation tests:
- check we can't create the ISA with a huge area
- check we can't create the ISA with missing fields
- check we can't create the ISA with a time_start in the past
- check we can't create the ISA with a time_start after time_end
"""
import datetime
from monitoring.monitorlib.infrastructure import default_scope
from monitoring.monitorlib import rid_v2
from monitoring.monitorlib.rid_v2 import SCOPE_DP, SCOPE_SP, ISA_PATH
from monitoring.prober.infrastructure import register_resource_type
from . import common
ISA_TYPE = register_resource_type(366, 'ISA')
BASE_URL = 'https://example.com/rid/v2'
def test_ensure_clean_workspace(ids, session_ridv2):
resp = session_ridv2.get('{}/{}'.format(ISA_PATH, ids(ISA_TYPE)), scope=SCOPE_DP)
if resp.status_code == 200:
version = resp.json()["service_area"]['version']
resp = session_ridv2.delete('{}/{}/{}'.format(ISA_PATH, ids(ISA_TYPE), version), scope=SCOPE_SP)
assert resp.status_code == 200, resp.content
elif resp.status_code == 404:
# As expected.
pass
else:
assert False, resp.content
@default_scope(SCOPE_SP)
def test_isa_huge_area(ids, session_ridv2):
time_start = datetime.datetime.utcnow()
time_end = time_start + datetime.timedelta(minutes=60)
resp = session_ridv2.put(
'{}/{}'.format(ISA_PATH, ids(ISA_TYPE)),
json={
'extents': {
'volume': {
'outline_polygon': {
'vertices': common.HUGE_VERTICES,
},
'altitude_lower': rid_v2.Altitude.make(20),
'altitude_upper': rid_v2.Altitude.make(400),
},
'time_start': rid_v2.Time.make(time_start),
'time_end': rid_v2.Time.make(time_end),
},
'uss_base_url': BASE_URL,
})
assert resp.status_code == 400, resp.content
assert 'too large' in resp.json()['message']
@default_scope(SCOPE_SP)
def test_isa_empty_vertices(ids, session_ridv2):
time_start = datetime.datetime.utcnow()
time_end = time_start + datetime.timedelta(minutes=60)
resp = session_ridv2.put(
'{}/{}'.format(ISA_PATH, ids(ISA_TYPE)),
json={
'extents': {
'volume': {
'outline_polygon': {
'vertices': [],
},
'altitude_lower': rid_v2.Altitude.make(20),
'altitude_upper': rid_v2.Altitude.make(400),
},
'time_start': rid_v2.Time.make(time_start),
'time_end': rid_v2.Time.make(time_end),
},
'uss_base_url': BASE_URL,
})
assert resp.status_code == 400, resp.content
assert 'Not enough points in polygon' in resp.json()['message']
@default_scope(SCOPE_SP)
def test_isa_missing_outline(ids, session_ridv2):
time_start = datetime.datetime.utcnow()
time_end = time_start + datetime.timedelta(minutes=60)
resp = session_ridv2.put(
'{}/{}'.format(ISA_PATH, ids(ISA_TYPE)),
json={
'extents': {
'volume': {
'altitude_lower': rid_v2.Altitude.make(20),
'altitude_upper': rid_v2.Altitude.make(400),
},
'time_start': rid_v2.Time.make(time_start),
'time_end': rid_v2.Time.make(time_end),
},
'uss_base_url': BASE_URL,
})
assert resp.status_code == 400, resp.content
assert 'Error parsing Volume4D' in resp.json()['message']
@default_scope(SCOPE_SP)
def test_isa_missing_volume(ids, session_ridv2):
time_start = datetime.datetime.utcnow()
time_end = time_start + datetime.timedelta(minutes=60)
resp = session_ridv2.put(
'{}/{}'.format(ISA_PATH, ids(ISA_TYPE)),
json={
'extents': {
'time_start': rid_v2.Time.make(time_start),
'time_end': rid_v2.Time.make(time_end),
},
'uss_base_url': BASE_URL,
})
assert resp.status_code == 400, resp.content
assert 'Error parsing Volume4D' in resp.json()['message']
@default_scope(SCOPE_SP)
def test_isa_missing_extents(ids, session_ridv2):
resp = session_ridv2.put(
'{}/{}'.format(ISA_PATH, ids(ISA_TYPE)),
json={
'uss_base_url': BASE_URL,
})
assert resp.status_code == 400, resp.content
assert resp.json()['message'] == 'Missing required extents'
@default_scope(SCOPE_SP)
def test_isa_start_time_in_past(ids, session_ridv2):
time_start = datetime.datetime.utcnow() - datetime.timedelta(minutes=10)
time_end = time_start + datetime.timedelta(minutes=60)
resp = session_ridv2.put(
'{}/{}'.format(ISA_PATH, ids(ISA_TYPE)),
json={
'extents': {
'volume': {
'outline_polygon': {
'vertices': common.VERTICES,
},
'altitude_lower': rid_v2.Altitude.make(20),
'altitude_upper': rid_v2.Altitude.make(400),
},
'time_start': rid_v2.Time.make(time_start),
'time_end': rid_v2.Time.make(time_end),
},
'uss_base_url': BASE_URL,
})
assert resp.status_code == 400, resp.content
assert resp.json()['message'] == 'IdentificationServiceArea time_start must not be in the past'
@default_scope(SCOPE_SP)
def test_isa_start_time_after_time_end(ids, session_ridv2):
time_start = datetime.datetime.utcnow() + datetime.timedelta(minutes=10)
time_end = time_start - datetime.timedelta(minutes=5)
resp = session_ridv2.put(
'{}/{}'.format(ISA_PATH, ids(ISA_TYPE)),
json={
'extents': {
'volume': {
'outline_polygon': {
'vertices': common.VERTICES,
},
'altitude_lower': rid_v2.Altitude.make(20),
'altitude_upper': rid_v2.Altitude.make(400),
},
'time_start': rid_v2.Time.make(time_start),
'time_end': rid_v2.Time.make(time_end),
},
'uss_base_url': BASE_URL,
})
assert resp.status_code == 400, resp.content
assert resp.json()['message'] == 'IdentificationServiceArea time_end must be after time_start'
@default_scope(SCOPE_SP)
def test_isa_not_on_earth(ids, session_ridv2):
time_start = datetime.datetime.utcnow()
time_end = time_start + datetime.timedelta(minutes=60)
resp = session_ridv2.put(
'{}/{}'.format(ISA_PATH, ids(ISA_TYPE)),
json={
'extents': {
'volume': {
'outline_polygon': {
'vertices': [
{'lat': 130.6205, 'lng': -23.6558},
{'lat': 130.6301, 'lng': -23.6898},
{'lat': 130.6700, 'lng': -23.6709},
{'lat': 130.6466, 'lng': -23.6407},
],
},
'altitude_lower': rid_v2.Altitude.make(20),
'altitude_upper': rid_v2.Altitude.make(400),
},
'time_start': rid_v2.Time.make(time_start),
'time_end': rid_v2.Time.make(time_end),
},
'uss_base_url': BASE_URL,
})
assert resp.status_code == 400, resp.content
| 34.112676
| 100
| 0.59166
| 876
| 7,266
| 4.636986
| 0.138128
| 0.070901
| 0.058592
| 0.044806
| 0.792713
| 0.792713
| 0.770064
| 0.755785
| 0.749138
| 0.723535
| 0
| 0.035158
| 0.275805
| 7,266
| 212
| 101
| 34.273585
| 0.736792
| 0.037159
| 0
| 0.657143
| 0
| 0
| 0.141527
| 0.007162
| 0
| 0
| 0
| 0
| 0.097143
| 1
| 0.051429
| false
| 0.005714
| 0.034286
| 0
| 0.085714
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
dee1ffcf19b7c85fcd832d75e9377fc51de35444
| 52
|
py
|
Python
|
formative/__init__.py
|
jaap3/django-formative
|
0f6bd2dc8a78e59a842513b49efc7768d1ffc3a3
|
[
"MIT"
] | null | null | null |
formative/__init__.py
|
jaap3/django-formative
|
0f6bd2dc8a78e59a842513b49efc7768d1ffc3a3
|
[
"MIT"
] | null | null | null |
formative/__init__.py
|
jaap3/django-formative
|
0f6bd2dc8a78e59a842513b49efc7768d1ffc3a3
|
[
"MIT"
] | null | null | null |
from formative.registry import autodiscover # NOQA
| 26
| 51
| 0.826923
| 6
| 52
| 7.166667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134615
| 52
| 1
| 52
| 52
| 0.955556
| 0.076923
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
def164e1f370ae580ecfc571252010d26318d416
| 136
|
py
|
Python
|
ndms2_client/__init__.py
|
alryaz/python_ndms2_client
|
1dd8cfd9336e79154cdc0b9dba10f64702b2c4b9
|
[
"MIT"
] | 3
|
2020-01-04T17:28:50.000Z
|
2020-02-10T16:18:15.000Z
|
ndms2_client/__init__.py
|
alryaz/python_ndms2_client
|
1dd8cfd9336e79154cdc0b9dba10f64702b2c4b9
|
[
"MIT"
] | 3
|
2019-05-05T12:53:55.000Z
|
2021-08-29T20:44:21.000Z
|
ndms2_client/__init__.py
|
alryaz/python_ndms2_client
|
1dd8cfd9336e79154cdc0b9dba10f64702b2c4b9
|
[
"MIT"
] | 4
|
2018-10-22T21:45:57.000Z
|
2021-03-07T16:39:06.000Z
|
from .connection import Connection, ConnectionException, TelnetConnection
from .client import Client, Device, RouterInfo, InterfaceInfo
| 45.333333
| 73
| 0.852941
| 13
| 136
| 8.923077
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095588
| 136
| 2
| 74
| 68
| 0.943089
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
722070e0a08442a9729dcede953cdb2edd7932ac
| 77
|
py
|
Python
|
oalvays/__init__.py
|
oalvay/oalvays
|
b71ecc40a175874bfb360f233c802d3db88c7723
|
[
"MIT"
] | null | null | null |
oalvays/__init__.py
|
oalvay/oalvays
|
b71ecc40a175874bfb360f233c802d3db88c7723
|
[
"MIT"
] | null | null | null |
oalvays/__init__.py
|
oalvay/oalvays
|
b71ecc40a175874bfb360f233c802d3db88c7723
|
[
"MIT"
] | null | null | null |
__all__ = ['general', 'kaggle']
import oalvays.general
import oalvays.kaggle
| 19.25
| 31
| 0.766234
| 9
| 77
| 6.111111
| 0.555556
| 0.472727
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103896
| 77
| 4
| 32
| 19.25
| 0.797101
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 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
| 1
| 0
|
0
| 5
|
722b8af953d2dcb5415d67ace55a84ae84f2a15d
| 27,574
|
py
|
Python
|
generate/generate/customer_phases.py
|
trigger-corp/libreforge
|
3da17f1d26fabe3b9df6518b4e96473fd078def1
|
[
"MIT"
] | 4
|
2021-12-08T16:04:42.000Z
|
2021-12-17T20:09:31.000Z
|
generate/generate/customer_phases.py
|
trigger-corp/forge
|
3da17f1d26fabe3b9df6518b4e96473fd078def1
|
[
"MIT"
] | 103
|
2019-01-29T07:54:37.000Z
|
2021-12-02T07:40:50.000Z
|
generate/generate/customer_phases.py
|
trigger-corp/libreforge
|
3da17f1d26fabe3b9df6518b4e96473fd078def1
|
[
"MIT"
] | null | null | null |
"Tasks that might be run on the customers's machine"
from time import gmtime
from calendar import timegm
# where the customer code exists inside the apps
locations_normal = {
'android': 'development/android/assets/src',
'android_bundle': 'development/android_bundle/base/assets/src',
'ios': 'development/ios/*/assets/src',
'ios-native': 'development/ios-native/ForgeInspector/assets/src',
'osx': 'development/osx/Forge.app/Contents/Resources/assets/src',
'web': 'development/web/src',
'reload': 'development/reload/src',
}
locations_debug = {
'ios': 'ios/app/ForgeInspector/assets/src',
'ios-native': 'ios/native/ForgeInspector/assets/src',
'android': 'android/ForgeInspector/assets/src',
'osx': 'development/osx/Forge.app/Contents/Resources/assets/src',
'web': 'development/web/src',
'reload': 'development/reload/src',
}
def validate_user_source(src='src'):
'''Check for any issues with the user source, i.e. no where to include all.js'''
return [
{'do': {'check_index_html': (src,)}}
]
def copy_user_source_to_tempdir(ignore_patterns=None, tempdir=None):
return [
{'do': {'copy_files': {'from': 'src', 'to': tempdir, 'ignore_patterns': ignore_patterns}}},
]
def delete_tempdir(tempdir=None):
return [
{'do': {'remove_files': tempdir}},
]
def run_hook(hook=None, dir=None):
return [
{'do': {'run_hook': {'hook': hook, 'dir': dir}}},
]
def copy_user_source_to_template(ignore_patterns=None, src='src', debug=False):
if not debug:
locations = locations_normal
else:
locations = locations_debug
return [
{'when': {'platform_is': 'android'}, 'do': {'copy_files': { 'from': src, 'to': locations["android"], 'ignore_patterns': ignore_patterns }}},
{'when': {'platform_is': 'android'}, 'do': {'copy_files': { 'from': src, 'to': locations["android_bundle"], 'ignore_patterns': ignore_patterns }}},
{'when': {'platform_is': 'ios'}, 'do': {'copy_files': { 'from': src, 'to': locations["ios"], 'ignore_patterns': ignore_patterns }}},
{'when': {'platform_is': 'ios-native'}, 'do': {'copy_files': { 'from': src, 'to': locations["ios-native"], 'ignore_patterns': ignore_patterns }}},
{'when': {'platform_is': 'osx'}, 'do': {'copy_files': { 'from': src, 'to': locations["osx"], 'ignore_patterns': ignore_patterns }}},
{'when': {'platform_is': 'web'}, 'do': {'copy_files': { 'from': src, 'to': locations["web"], 'ignore_patterns': ignore_patterns }}},
{'do': {'copy_files': { 'from': src, 'to': locations["reload"], 'ignore_patterns': ignore_patterns }}},
]
def include_platform_in_html(debug=False):
if not debug:
locations = locations_normal
else:
locations = locations_debug
return [
{'when': {'platform_is': 'android'}, 'do': {'find_and_replace_in_dir': {
"root_dir": locations["android"],
"find": "<head>",
"replace": "<head><script src='%{back_to_parent}%forge/app_config.js'></script><script src='%{back_to_parent}%forge/all.js'></script>"
}}},
{'when': {'platform_is': 'android'}, 'do': {'find_and_replace_in_dir': {
"root_dir": locations["android_bundle"],
"find": "<head>",
"replace": "<head><script src='%{back_to_parent}%forge/app_config.js'></script><script src='%{back_to_parent}%forge/all.js'></script>"
}}},
{'when': {'platform_is': 'ios'}, 'do': {'find_and_replace_in_dir': {
"root_dir": locations["ios"],
"find": "<head>",
"replace": "<head><script src='%{back_to_parent}%forge/app_config.js'></script><script src='%{back_to_parent}%forge/all.js'></script>"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'find_and_replace_in_dir': {
"root_dir": locations["ios-native"],
"find": "<head>",
"replace": "<head><script src='%{back_to_parent}%forge/app_config.js'></script><script src='%{back_to_parent}%forge/all.js'></script>"
}}},
{'when': {'platform_is': 'osx'}, 'do': {'find_and_replace_in_dir': {
"root_dir": locations["osx"],
"find": "<head>",
"replace": "<head><script src='%{back_to_parent}%forge/app_config.js'></script><script src='%{back_to_parent}%forge/all.js'></script>"
}}},
{'when': {'platform_is': 'web'}, 'do': {'find_and_replace_in_dir': {
"root_dir": locations["web"],
"find": "<head>",
"replace": "<head><script src='%{back_to_parent}%_forge/app_config.js'></script><script src='%{back_to_parent}%_forge/all.js'></script>"
}}},
{'do': {'find_and_replace_in_dir': {
"root_dir": locations["reload"],
"find": "<head>",
"replace": "<head><script src='%{back_to_parent}%forge/app_config.js'></script><script src='%{back_to_parent}%forge/all.js'></script>"
}}},
{'do': {'find_and_replace_in_dir': {
"root_dir": locations["reload"],
"find": "<head>",
"replace": """<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script>
function window$forge$_receive(result) {
try {
window.forge._receive(JSON.parse(result));
} catch (e) {
forge.logging.error("window$forge$_receive -> " + e);
}
}
</script>"""
}}},
]
def include_name(build):
json_safe_name = build.config["name"].replace('"', '\\"')
xml_safe_name = build.config["name"].replace('"', '\\"').replace("'", "\\'")
return [
{'when': {'platform_is': 'ios'}, 'do': {'set_in_biplist': {
"filename": 'development/ios/*/Info.plist',
"key": "CFBundleName",
"value": "${name}"
}}},
{'when': {'platform_is': 'ios'}, 'do': {'set_in_biplist': {
"filename": 'development/ios/*/Info.plist',
"key": "CFBundleDisplayName",
"value": "${name}"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'set_in_biplist': {
"filename": 'development/ios-native/dist/*.app/Info.plist',
"key": "CFBundleName",
"value": "${name}"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'set_in_biplist': {
"filename": 'development/ios-native/dist/*.app/Info.plist',
"key": "CFBundleDisplayName",
"value": "${name}"
}}},
{'when': {'platform_is': 'osx'}, 'do': {'set_in_biplist': {
"filename": 'development/osx/Forge.app/Contents/Info.plist',
"key": "CFBundleName",
"value": "${name}"
}}},
{'when': {'platform_is': 'osx'}, 'do': {'set_in_biplist': {
"filename": 'development/osx/Forge.app/Contents/Info.plist',
"key": "CFBundleDisplayName",
"value": "${name}"
}}},
]
def include_requirements():
return [
{'when': {'platform_is': 'ios', 'config_property_exists': 'core.ios.minimum_version'}, 'do': {'set_in_biplist': {
"filename": 'development/ios/*/Info.plist',
"key": "MinimumOSVersion",
"value": "${core.ios.minimum_version}"
}}},
{'when': {'platform_is': 'ios-native', 'config_property_exists': 'core.ios.minimum_version'}, 'do': {'set_in_biplist': {
"filename": 'development/ios-native/dist/*.app/Info.plist',
"key": "MinimumOSVersion",
"value": "${core.ios.minimum_version}"
}}},
]
def include_uuid():
return [
{'do': {'populate_package_names': ()}},
{'when': {'platform_is': 'ios'}, 'do': {'set_in_biplist': {
"filename": 'development/ios/*/Info.plist',
"key": "CFBundleIdentifier", "value": "${core.ios.package_name}"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'set_in_biplist': {
"filename": 'development/ios-native/dist/*.app/Info.plist',
"key": "CFBundleIdentifier", "value": "${core.ios.package_name}"
}}},
{'when': {'platform_is': 'osx'}, 'do': {'set_in_biplist': {
"filename": 'development/osx/Forge.app/Contents/Info.plist',
"key": "CFBundleIdentifier",
"value": "${core.osx.package_name}"
}}},
]
def include_author():
return [
{'when': {'platform_is': 'osx'}, 'do': {'set_in_biplist': {
"filename": 'development/osx/Forge.app/Contents/Info.plist',
"key": "NSHumanReadableCopyright",
"value": "${author}"
}}},
]
def include_description():
return [
]
def include_version(build):
build_number = str(int(timegm(gmtime())))
target = iter(build.enabled_platforms).next()
if "build_number" in build.config and target in build.config["build_number"]:
build_number = str(build.config["build_number"][target])
return [
{'when': {'platform_is': 'ios'}, 'do': {'set_in_biplist': {
"filename": 'development/ios/*/Info.plist',
"key": "CFBundleVersion", "value": build_number
}}},
{'when': {'platform_is': 'ios'}, 'do': {'set_in_biplist': {
"filename": 'development/ios/*/Info.plist',
"key": "CFBundleShortVersionString", "value": "${version}"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'set_in_biplist': {
"filename": 'development/ios-native/dist/*.app/Info.plist',
"key": "CFBundleVersion", "value": build_number
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'set_in_biplist': {
"filename": 'development/ios-native/dist/*.app/Info.plist',
"key": "CFBundleShortVersionString", "value": "${version}"
}}},
{'when': {'platform_is': 'osx'}, 'do': {'set_in_biplist': {
"filename": 'development/osx/Forge.app/Contents/Info.plist',
"key": "CFBundleVersion",
"value": build_number
}}},
{'when': {'platform_is': 'osx'}, 'do': {'set_in_biplist': {
"filename": 'development/osx/Forge.app/Contents/Info.plist',
"key": "CFBundleShortVersionString",
"value": "${version}"
}}},
{'do': {'set_in_config': {
"key": "version_code",
"value": build_number
}}},
]
def include_reload():
return [
{'do': {'populate_trigger_domain': ()}},
{'do': {'set_in_config': {
"key": "trigger_domain",
"value": "${trigger_domain}"
}}},
{'do': {'set_in_config': {
"key": "config_hash",
"value": "${config_hash}"
}}},
{'when': {'platform_is': 'android'}, 'do': {'generate_sha1_manifest': {
"input_folder": "development/android/assets/src",
"output_file": "development/android/assets/hash_to_file.json"
}}},
{'when': {'platform_is': 'android'}, 'do': {'generate_sha1_manifest': {
"input_folder": "development/android_bundle/base/assets/src",
"output_file": "development/android_bundle/base/assets/hash_to_file.json"
}}},
{'when': {'platform_is': 'ios'}, 'do': {'generate_sha1_manifest': {
"input_folder": "development/ios/device-ios.app/assets/src",
"output_file": "development/ios/device-ios.app/assets/hash_to_file.json"
}}},
{'when': {'platform_is': 'ios'}, 'do': {'generate_sha1_manifest': {
"input_folder": "development/ios/simulator-ios.app/assets/src",
"output_file": "development/ios/simulator-ios.app/assets/hash_to_file.json"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'generate_sha1_manifest': {
"input_folder": "development/ios-native/dist/device-ios.app/assets/src",
"output_file": "development/ios-native/dist/device-ios.app/assets/hash_to_file.json"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'generate_sha1_manifest': {
"input_folder": "development/ios-native/dist/simulator-ios.app/assets/src",
"output_file": "development/ios-native/dist/simulator-ios.app/assets/hash_to_file.json"
}}},
{'when': {'platform_is': 'osx'}, 'do': {'generate_sha1_manifest': {
"input_folder": "development/osx/Forge.app/Contents/Resources/assets/src",
"output_file": "development/osx/Forge.app/Contents/Resources/assets/hash_to_file.json"
}}},
]
def include_config(debug=False):
if debug:
return [
{'when': {'platform_is': 'android'}, 'do': {'write_config': {
"filename": 'android/ForgeInspector/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'android'}, 'do': {'write_config': {
"filename": 'android/ForgeInspector/assets/forge/app_config.js',
"mapping_file": 'android/ForgeInspector/assets/module_mapping.json',
"content": "window.forge = {}; window.forge.config = ${config}; window.forge.module_mapping = ${module_mapping}; window.forge.config.development = false;"
}}},
{'when': {'platform_is': 'ios'}, 'do': {'write_config': {
"filename": 'ios/app/ForgeInspector/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'ios'}, 'do': {'write_config': {
"filename": 'ios/app/ForgeInspector/assets/forge/app_config.js',
"mapping_file": 'ios/app/ForgeInspector/assets/module_mapping.json',
"content": "window.forge = {}; window.forge.config = ${config};"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'write_config': {
"filename": 'ios/native/ForgeInspector/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'write_config': {
"filename": 'ios/native/ForgeInspector/assets/forge/app_config.js',
"mapping_file": 'ios/native/ForgeInspector/assets/module_mapping.json',
"content": "window.forge = {}; window.forge.config = ${config};"
}}},
]
else:
return [
{'when': {'platform_is': 'android'}, 'do': {'write_config': {
"filename": 'development/android/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'android'}, 'do': {'write_config': {
"filename": 'development/android/assets/forge/app_config.js',
"mapping_file": 'development/android/assets/module_mapping.json',
"content": "window.forge = {}; window.forge.config = ${config}; window.forge.module_mapping = ${module_mapping}; window.forge.config.development = false;"
}}},
{'when': {'platform_is': 'android'}, 'do': {'write_config': {
"filename": 'development/android_bundle/base/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'android'}, 'do': {'write_config': {
"filename": 'development/android_bundle/base/assets/forge/app_config.js',
"mapping_file": 'development/android/assets/module_mapping.json',
"content": "window.forge = {}; window.forge.config = ${config}; window.forge.module_mapping = ${module_mapping}; window.forge.config.development = false;"
}}},
{'when': {'platform_is': 'ios'}, 'do': {'write_config': {
"filename": 'development/ios/device-ios.app/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'ios'}, 'do': {'write_config': {
"filename": 'development/ios/simulator-ios.app/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'ios'}, 'do': {'write_config': {
"filename": 'development/ios/device-ios.app/assets/forge/app_config.js',
"mapping_file": 'development/ios/device-ios.app/assets/module_mapping.json',
"content": "window.forge = {}; window.forge.config = ${config}; window.forge.module_mapping = ${module_mapping}; window.forge.config.development = false;"
}}},
{'when': {'platform_is': 'ios'}, 'do': {'write_config': {
"filename": 'development/ios/simulator-ios.app/assets/forge/app_config.js',
"mapping_file": 'development/ios/simulator-ios.app/assets/module_mapping.json',
"content": "window.forge = {}; window.forge.config = ${config}; window.forge.module_mapping = ${module_mapping}; window.forge.config.development = false;"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'write_config': {
"filename": 'development/ios-native/ForgeInspector/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'write_config': {
"filename": 'development/ios-native/ForgeInspector/assets/forge/app_config.js',
"mapping_file": 'development/ios-native/ForgeInspector/assets/module_mapping.json',
"content": "window.forge = {}; window.forge.config = ${config}; window.forge.module_mapping = ${module_mapping}; window.forge.config.development = false;"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'write_config': {
"filename": 'development/ios-native/dist/device-ios.app/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'write_config': {
"filename": 'development/ios-native/dist/simulator-ios.app/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'write_config': {
"filename": 'development/ios-native/dist/device-ios.app/assets/forge/app_config.js',
"mapping_file": 'development/ios-native/dist/device-ios.app/assets/module_mapping.json',
"content": "window.forge = {}; window.forge.config = ${config}; window.forge.module_mapping = ${module_mapping}; window.forge.config.development = false;"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'write_config': {
"filename": 'development/ios-native/dist/simulator-ios.app/assets/forge/app_config.js',
"mapping_file": 'development/ios-native/dist/simulator-ios.app/assets/module_mapping.json',
"content": "window.forge = {}; window.forge.config = ${config}; window.forge.module_mapping = ${module_mapping}; window.forge.config.development = false;"
}}},
{'when': {'platform_is': 'osx'}, 'do': {'write_config': {
"filename": 'development/osx/Forge.app/Contents/Resources/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'osx'}, 'do': {'write_config': {
"filename": 'development/osx/Forge.app/Contents/Resources/assets/forge/app_config.js',
"content": "window.forge = {}; window.forge.config = ${config};"
}}},
{'when': {'platform_is': 'web'}, 'do': {'write_config': {
"filename": 'development/web/forge/app_config.js',
"content": "window.forge = {}; window.forge.config = ${config};"
}}},
]
def compile_ios_native_app():
from os import path
return [
{'when': {'platform_is': 'ios-native'}, 'do': { 'xcode_build': (path.abspath(path.join('development', 'ios-native'))) }},
{'when': {'platform_is': 'ios-native'}, 'do': {'write_config': {
"filename": 'development/ios-native/dist/device-ios.app/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'write_config': {
"filename": 'development/ios-native/dist/device-ios.app/assets/forge/app_config.js',
"mapping_file": 'development/ios-native/dist/device-ios.app/assets/module_mapping.json',
"content": "window.forge = {}; window.forge.config = ${config}; window.forge.module_mapping = ${module_mapping}; window.forge.config.development = false;"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'write_config': {
"filename": 'development/ios-native/dist/simulator-ios.app/assets/app_config.json',
"content": "${config}"
}}},
{'when': {'platform_is': 'ios-native'}, 'do': {'write_config': {
"filename": 'development/ios-native/dist/simulator-ios.app/assets/forge/app_config.js',
"mapping_file": 'development/ios-native/dist/simulator-ios.app/assets/module_mapping.json',
"content": "window.forge = {}; window.forge.config = ${config}; window.forge.module_mapping = ${module_mapping}; window.forge.config.development = false;"
}}},
]
def run_module_build_steps(build):
return [
{'when': {'platform_is': 'android'}, 'do': {
'run_module_build_steps': {
'steps_path': 'development/android/build_steps',
'src_path': 'development/android/assets/src',
'project_path': 'development/android'
}
}},
{'when': {'platform_is': 'android'}, 'do': {
'run_module_build_steps': {
'steps_path': 'development/android/build_steps',
'src_path': 'development/android_bundle/base/assets/src',
'project_path': 'development/android_bundle/base'
}
}},
{'when': {'platform_is': 'ios'}, 'do': {
'run_module_build_steps': {
'steps_path': 'development/ios/build_steps',
'src_path': 'development/ios/device-ios.app/assets/src',
'project_path': 'development/ios/device-ios.app'
}
}},
{'when': {'platform_is': 'ios'}, 'do': {
'run_module_build_steps': {
'steps_path': 'development/ios/build_steps',
'src_path': 'development/ios/simulator-ios.app/assets/src',
'project_path': 'development/ios/simulator-ios.app'
}
}},
{'when': {'platform_is': 'ios-native'}, 'do': {
'run_module_build_steps': {
'steps_path': 'development/ios-native/dist/build_steps',
'src_path': 'development/ios-native/dist/device-ios.app/assets/src',
'project_path': 'development/ios-native/dist/device-ios.app'
}
}},
{'when': {'platform_is': 'ios-native'}, 'do': {
'run_module_build_steps': {
'steps_path': 'development/ios-native/dist/build_steps',
'src_path': 'development/ios-native/dist/simulator-ios.app/assets/src',
'project_path': 'development/ios-native/dist/simulator-ios.app'
}
}},
{'when': {'platform_is': 'osx'}, 'do': {
'run_module_build_steps': {
'steps_path': 'development/osx/build_steps',
'src_path': 'development/osx/Forge.app/Contents/Resources/assets/src',
'project_path': 'development/osx/Forge.app'
}
}}
# Delete build steps folder?
]
def resolve_urls():
return [
{'do': {'resolve_urls': (
'modules.activations.config.activations.[].scripts.[]',
'modules.activations.config.activations.[].styles.[]',
'modules.launchimage.config.android',
'modules.launchimage.config.android-landscape',
'modules.button.config.default_icon',
'modules.button.config.default_popup',
'modules.button.config.default_icons.*'
)}},
]
def run_android_phase(build_type_dir, sdk, device, interactive, purge=False):
return [
{'when': {'platform_is': 'android'}, 'do': {'run_android': (build_type_dir, sdk, device, interactive, purge)}},
]
def run_ios_phase(device):
return [
{'when': {'platform_is': 'ios'}, 'do': {'run_ios': (device,)}},
]
def run_ios_native_phase(device):
return [
{'when': {'platform_is': 'ios-native'}, 'do': {'run_ios': (device,)}},
]
def run_osx_phase():
return [
{'when': {'platform_is': 'osx'}, 'do': {'run_osx': ()}},
]
def run_web_phase():
return [
{'when': {'platform_is': 'web'}, 'do': {'run_web': ()}},
]
def package(build_type_dir):
return [
{'when': {'platform_is': 'android'}, 'do': {'package_android': ()}},
{'when': {'platform_is': 'android'}, 'do': {'bundle_android': ()}},
{'when': {'platform_is': 'ios'}, 'do': {'package_ios': ()}},
{'when': {'platform_is': 'ios-native'}, 'do': {'package_ios_native': ()}},
{'when': {'platform_is': 'osx'}, 'do': {'package_osx': ()}},
{'when': {'platform_is': 'web'}, 'do': {'package_web': ()}},
]
def serve(build_type_dir):
return [
{'when': {'platform_is': 'android'}, 'do': {'serve_android': ()}},
{'when': {'platform_is': 'ios'}, 'do': {'serve_ios': ()}},
{'when': {'platform_is': 'osx'}, 'do': {'serve_osx': ()}},
{'when': {'platform_is': 'web'}, 'do': {'serve_web': ()}},
]
def make_installers():
return [
]
def check_javascript():
return [
{'do': {'lint_javascript': ()}},
]
def check_local_config_schema():
return [
{'do': {'check_local_config_schema': ()}},
]
def clean_phase():
return [
{'when': {'platform_is': 'android'}, 'do': {'clean_android': ()}},
{'when': {'platform_is': 'web'}, 'do': {'clean_web': ()}},
]
def inject_local_assets():
"""only ever run from forge-generate"""
return [
{'when': {'platform_is': 'ios'}, 'do': {'inject_local_assets': ()}},
{'when': {'platform_is': 'android'}, 'do': {'inject_local_assets': ()}},
]
def set_is_development(is_development = False):
to_str = lambda b: "true" if b else "false"
return [
{'when': {'platform_is': 'ios'}, 'do': {'find_and_replace': {
"in": ("development/ios/*/assets/forge/app_config.js",),
"find": "window.forge.config.development = %s;" % to_str(not is_development),
"replace": "window.forge.config.development = %s;" % to_str(is_development)
}}},
{'when': {'platform_is': 'android'}, 'do': {'find_and_replace': {
"in": ("development/android/assets/forge/app_config.js",),
"find": "window.forge.config.development = %s;" % to_str(not is_development),
"replace": "window.forge.config.development = %s;" % to_str(is_development)
}}},
]
| 47.459552
| 170
| 0.552187
| 2,825
| 27,574
| 5.180885
| 0.071504
| 0.07625
| 0.088959
| 0.058076
| 0.844903
| 0.811902
| 0.761888
| 0.72144
| 0.696912
| 0.647308
| 0
| 0.000628
| 0.248966
| 27,574
| 580
| 171
| 47.541379
| 0.706118
| 0.008486
| 0
| 0.557875
| 0
| 0.041746
| 0.549837
| 0.281457
| 0
| 0
| 0
| 0
| 0
| 1
| 0.056926
| false
| 0
| 0.005693
| 0.039848
| 0.121442
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
7246484daf324deb6be94912ab23599bf10e7b16
| 124
|
py
|
Python
|
bot_api/__init__.py
|
chinosk114514/QQ-official-guild-bot
|
7913504374f12ff43cd581f3c96c940863b9fcf6
|
[
"MIT"
] | 18
|
2021-12-04T09:10:44.000Z
|
2022-03-12T05:10:45.000Z
|
bot_api/__init__.py
|
chinosk114514/QQ-official-guild-bot
|
7913504374f12ff43cd581f3c96c940863b9fcf6
|
[
"MIT"
] | 8
|
2021-12-05T15:55:38.000Z
|
2022-03-07T14:10:19.000Z
|
bot_api/__init__.py
|
chinosk114514/QQ-official-guild-bot
|
7913504374f12ff43cd581f3c96c940863b9fcf6
|
[
"MIT"
] | 4
|
2021-12-29T09:22:24.000Z
|
2022-01-29T10:18:29.000Z
|
from .sdk_main import *
from . import api
from . import models
from . import structs
from .models import BotCallingAPIError
| 20.666667
| 38
| 0.790323
| 17
| 124
| 5.705882
| 0.470588
| 0.309278
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16129
| 124
| 5
| 39
| 24.8
| 0.932692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
a0e8527b13bc8c75e7fe094894e9cb9fcebbea68
| 15,170
|
py
|
Python
|
mythic-docker/app/api/crypto_api.py
|
xorrior/Mythic
|
ea348b66e1d96e88e0e7fbabff182945cbdf12b6
|
[
"BSD-3-Clause"
] | 2
|
2021-01-28T19:35:46.000Z
|
2021-04-08T12:01:48.000Z
|
mythic-docker/app/api/crypto_api.py
|
xorrior/Mythic
|
ea348b66e1d96e88e0e7fbabff182945cbdf12b6
|
[
"BSD-3-Clause"
] | null | null | null |
mythic-docker/app/api/crypto_api.py
|
xorrior/Mythic
|
ea348b66e1d96e88e0e7fbabff182945cbdf12b6
|
[
"BSD-3-Clause"
] | 2
|
2020-12-29T02:34:13.000Z
|
2021-06-24T04:07:38.000Z
|
from app import db_objects
from app.database_models.model import StagingInfo
import base64
import app.crypto as crypt
import ujson as js
from sanic.log import logger
from uuid import uuid4
async def decrypt_agent_message(request, callback):
try:
if callback.encryption_type != "" and callback.encryption_type is not None:
if callback.encryption_type == "AES256":
# now handle the decryption
decrypted_message = await crypt.decrypt_AES256(
data=base64.b64decode(request.body),
key=base64.b64decode(callback.decryption_key),
)
return js.loads(decrypted_message.decode("utf-8"))
return None
return request.json
except Exception as e:
print("Failed to decrypt in decrypt_agent_message: {}".format(str(e)))
return None
async def encrypt_agent_message(message, callback):
try:
if callback.encryption_type != "" and callback.encryption_type is not None:
# encrypt the message before returning it
if callback.encryption_type == "AES256":
raw_encrypted = await crypt.encrypt_AES256(
data=message.encode(), key=base64.b64decode(callback.encryption_key)
)
return base64.b64encode(raw_encrypted)
return None
return message.encode()
except Exception as e:
print("failed to encrypt in encrypt_agent_message: {}".format(str(e)))
return None
async def staging_rsa(decrypted_message_json, UUID):
if (
"session_id" not in decrypted_message_json
or "pub_key" not in decrypted_message_json
):
logger.exception(
'Failed to get "session_id" or "pub_key" from message in staging_rsa'
)
return None, None
# generate random AES256 key
session_key_encoded = await crypt.create_key_AES256()
# print("created base64 encoded session key: " + session_key_encoded)
# Save session_key and SESSIONID into database
temp_uuid = str(uuid4())
try:
stage_info = await db_objects.create(
StagingInfo,
session_id=decrypted_message_json["session_id"],
session_key=session_key_encoded,
payload_uuid=UUID,
staging_uuid=temp_uuid,
)
except Exception as e:
logger.exception("Issue creating staging info for a new callback: " + str(e))
return None, None
# encrypt a nonce and the session_key_encoded with the message['PUB'] public key from the agent
session_key_encoded = await crypt.encrypt_pub_key(
data=base64.b64decode(session_key_encoded),
key=base64.b64decode(decrypted_message_json["pub_key"]),
)
response = {
"uuid": temp_uuid,
"session_key": base64.b64encode(session_key_encoded).decode(),
"action": "staging_rsa",
"session_id": decrypted_message_json["session_id"],
}
# print("created response: " + js.dumps(response))
for k in decrypted_message_json:
if k not in ["session_id", "pub_key", "action", "delegates"]:
response[k] = decrypted_message_json[k]
return response, stage_info
async def staging_dh(decrypted_message_json, UUID):
if (
"session_id" not in decrypted_message_json
or "pub_key" not in decrypted_message_json
):
logger.exception(
'Failed to get "session_id" or "pub_key" from message in staging_dh'
)
return None, None
# generate random AES256 key
dh = DiffieHellman()
# print(dh.publicKey)
dh.genKey(decrypted_message_json["pub_key"])
session_key_encoded = base64.b64encode(dh.getKey()).decode("utf-8")
# print("created base64 encoded session key: " + session_key_encoded)
# Save session_key and SESSIONID into database
temp_uuid = str(uuid4())
try:
stage_info = await db_objects.create(
StagingInfo,
session_id=decrypted_message_json["session_id"],
session_key=session_key_encoded,
payload_uuid=UUID,
staging_uuid=temp_uuid,
)
except Exception as e:
logger.exception("Issue creating staging info for a new callback: " + str(e))
return None, None
# encrypt a nonce and the session_key_encoded with the message['PUB'] public key from the agent
response = {
"uuid": temp_uuid,
"session_key": dh.publicKey,
"action": "staging_dh",
"session_id": decrypted_message_json["session_id"],
}
# print("created response: " + js.dumps(response))
for k in decrypted_message_json:
if k not in ["session_id", "pub_key", "action", "delegates"]:
response[k] = decrypted_message_json[k]
return response, stage_info
""" Implements Diffie-Hellman as a standalone python file. Taken from Empire
DH code from: https://github.com/lowazo/pyDHE """
import os
import hashlib
# If a secure random number generator is unavailable, exit with an error.
try:
import ssl
random_function = ssl.RAND_bytes
random_provider = "Python SSL"
except:
random_function = os.urandom
random_provider = "os.urandom"
class DiffieHellman(object):
"""
A reference implementation of the Diffie-Hellman protocol.
By default, this class uses the 6144-bit MODP Group (Group 17) from RFC 3526.
This prime is sufficient to generate an AES 256 key when used with
a 540+ bit exponent.
"""
def __init__(self, generator=2, group=17, keyLength=540):
"""
Generate the public and private keys.
"""
min_keyLength = 180
default_generator = 2
valid_generators = [2, 3, 5, 7]
# Sanity check fors generator and keyLength
if generator not in valid_generators:
print("Error: Invalid generator. Using default.")
self.generator = default_generator
else:
self.generator = generator
if keyLength < min_keyLength:
print("Error: keyLength is too small. Setting to minimum.")
self.keyLength = min_keyLength
else:
self.keyLength = keyLength
self.prime = self.getPrime(group)
self.privateKey = self.genPrivateKey(keyLength)
self.publicKey = self.genPublicKey()
def getPrime(self, group=17):
"""
Given a group number, return a prime.
"""
default_group = 17
primes = {
5: 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF,
14: 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF,
15: 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF,
16: 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199FFFFFFFFFFFFFFFF,
17: 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C93402849236C3FAB4D27C7026C1D4DCB2602646DEC9751E763DBA37BDF8FF9406AD9E530EE5DB382F413001AEB06A53ED9027D831179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1BDB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF5983CA01C64B92ECF032EA15D1721D03F482D7CE6E74FEF6D55E702F46980C82B5A84031900B1C9E59E7C97FBEC7E8F323A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AACC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE32806A1D58BB7C5DA76F550AA3D8A1FBFF0EB19CCB1A313D55CDA56C9EC2EF29632387FE8D76E3C0468043E8F663F4860EE12BF2D5B0B7474D6E694F91E6DCC4024FFFFFFFFFFFFFFFF,
18: 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C93402849236C3FAB4D27C7026C1D4DCB2602646DEC9751E763DBA37BDF8FF9406AD9E530EE5DB382F413001AEB06A53ED9027D831179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1BDB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF5983CA01C64B92ECF032EA15D1721D03F482D7CE6E74FEF6D55E702F46980C82B5A84031900B1C9E59E7C97FBEC7E8F323A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AACC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE32806A1D58BB7C5DA76F550AA3D8A1FBFF0EB19CCB1A313D55CDA56C9EC2EF29632387FE8D76E3C0468043E8F663F4860EE12BF2D5B0B7474D6E694F91E6DBE115974A3926F12FEE5E438777CB6A932DF8CD8BEC4D073B931BA3BC832B68D9DD300741FA7BF8AFC47ED2576F6936BA424663AAB639C5AE4F5683423B4742BF1C978238F16CBE39D652DE3FDB8BEFC848AD922222E04A4037C0713EB57A81A23F0C73473FC646CEA306B4BCBC8862F8385DDFA9D4B7FA2C087E879683303ED5BDD3A062B3CF5B3A278A66D2A13F83F44F82DDF310EE074AB6A364597E899A0255DC164F31CC50846851DF9AB48195DED7EA1B1D510BD7EE74D73FAF36BC31ECFA268359046F4EB879F924009438B481C6CD7889A002ED5EE382BC9190DA6FC026E479558E4475677E9AA9E3050E2765694DFC81F56E880B96E7160C980DD98EDD3DFFFFFFFFFFFFFFFFF,
}
if group in primes.keys():
return primes[group]
else:
print("Error: No prime with group %i. Using default." % group)
return primes[default_group]
def genRandom(self, bits):
"""
Generate a random number with the specified number of bits
"""
_rand = 0
_bytes = bits // 8 + 8
while len(bin(_rand)) - 2 < bits:
try:
_rand = int.from_bytes(random_function(_bytes), byteorder="big")
except:
_rand = int(random_function(_bytes).encode("hex"), 16)
return _rand
def genPrivateKey(self, bits):
"""
Generate a private key using a secure random number generator.
"""
return self.genRandom(bits)
def genPublicKey(self):
"""
Generate a public key X with g**x % p.
"""
return pow(self.generator, self.privateKey, self.prime)
def checkPublicKey(self, otherKey):
"""
Check the other party's public key to make sure it's valid.
Since a safe prime is used, verify that the Legendre symbol == 1
"""
if otherKey > 2 and otherKey < self.prime - 1:
if pow(otherKey, (self.prime - 1) // 2, self.prime) == 1:
return True
return False
def genSecret(self, privateKey, otherKey):
"""
Check to make sure the public key is valid, then combine it with the
private key to generate a shared secret.
"""
if self.checkPublicKey(otherKey) is True:
sharedSecret = pow(otherKey, privateKey, self.prime)
return sharedSecret
else:
raise Exception("Invalid public key.")
def genKey(self, otherKey):
"""
Derive the shared secret, then hash it to obtain the shared key.
"""
self.sharedSecret = self.genSecret(self.privateKey, otherKey)
# print("Shared secret:")
# print(self.sharedSecret)
s = hashlib.sha256()
s.update(bytes(str(self.sharedSecret).encode()))
self.key = s.digest()
def getKey(self):
"""
Return the shared secret key
"""
return self.key
| 57.030075
| 2,067
| 0.775544
| 1,067
| 15,170
| 10.875351
| 0.229616
| 0.016374
| 0.027577
| 0.011375
| 0.185453
| 0.166322
| 0.161151
| 0.149431
| 0.149431
| 0.142537
| 0
| 0.31251
| 0.172709
| 15,170
| 265
| 2,068
| 57.245283
| 0.612112
| 0.105867
| 0
| 0.384181
| 0
| 0
| 0.057551
| 0.003341
| 0
| 1
| 0.477109
| 0
| 0
| 1
| 0.050847
| false
| 0
| 0.056497
| 0
| 0.242938
| 0.028249
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
9d1bf9cdc1ca28b8e77d175d4a3244f468997967
| 155
|
py
|
Python
|
services/jobs/jobs/dependencies/templates/__init__.py
|
eodcgmbh/openeo-openshift-driver
|
c4f256a6cd3eac358cbe32f6fcc734dc69c7b115
|
[
"Apache-2.0"
] | null | null | null |
services/jobs/jobs/dependencies/templates/__init__.py
|
eodcgmbh/openeo-openshift-driver
|
c4f256a6cd3eac358cbe32f6fcc734dc69c7b115
|
[
"Apache-2.0"
] | 5
|
2021-02-08T20:29:22.000Z
|
2022-03-11T23:44:17.000Z
|
services/jobs/jobs/dependencies/templates/__init__.py
|
eodcgmbh/openeo-openshift-driver
|
c4f256a6cd3eac358cbe32f6fcc734dc69c7b115
|
[
"Apache-2.0"
] | null | null | null |
from .imagestream import ImageStream
from .configmap import ConfigMap
from .pvc import PersistentVolumeClaim
from .build import Build
from .job import Job
| 25.833333
| 38
| 0.83871
| 20
| 155
| 6.5
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.129032
| 155
| 5
| 39
| 31
| 0.962963
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
9d241b6d9fa4dcd8ed60a1b3f452717fc9a5e7cf
| 52
|
py
|
Python
|
python/Pi/__init__.py
|
EliHarper/PiCopy_LightController
|
60583fde8aeed0d074d844c58202a26c5d5ec694
|
[
"BSD-2-Clause"
] | 1
|
2021-12-02T05:57:38.000Z
|
2021-12-02T05:57:38.000Z
|
python/Pi/__init__.py
|
EliHarper/PiCopy_LightController
|
60583fde8aeed0d074d844c58202a26c5d5ec694
|
[
"BSD-2-Clause"
] | null | null | null |
python/Pi/__init__.py
|
EliHarper/PiCopy_LightController
|
60583fde8aeed0d074d844c58202a26c5d5ec694
|
[
"BSD-2-Clause"
] | null | null | null |
from .light import *
from .executor_server import *
| 17.333333
| 30
| 0.769231
| 7
| 52
| 5.571429
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.153846
| 52
| 2
| 31
| 26
| 0.886364
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
9d38c07a1dae641097d4e1f01faf75e0e8eca16d
| 145
|
py
|
Python
|
socialregistration/contrib/instagram/admin.py
|
nypublicradio/legacy-publisher-django-socialregistration
|
181f75d152f553f77fa899dac895c4276108204f
|
[
"MIT"
] | 63
|
2015-01-27T16:52:03.000Z
|
2021-08-29T04:23:51.000Z
|
socialregistration/contrib/instagram/admin.py
|
jairtrejo/django-socialregistration
|
c52b1db00bb7cfed2e0a44e587c3da6d2f5499c4
|
[
"MIT"
] | 3
|
2016-05-26T07:46:53.000Z
|
2022-02-16T15:25:16.000Z
|
socialregistration/contrib/instagram/admin.py
|
jairtrejo/django-socialregistration
|
c52b1db00bb7cfed2e0a44e587c3da6d2f5499c4
|
[
"MIT"
] | 23
|
2015-02-02T13:33:46.000Z
|
2020-10-25T20:02:53.000Z
|
from django.contrib import admin
from socialregistration.contrib.instagram.models import InstagramProfile
admin.site.register(InstagramProfile)
| 29
| 72
| 0.875862
| 16
| 145
| 7.9375
| 0.6875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.068966
| 145
| 4
| 73
| 36.25
| 0.940741
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
c22249b72b964e1787c23c253cfeeae316669f20
| 161
|
py
|
Python
|
script.py
|
SaumyaRai2010/algoexpert-data-structures-algorithms
|
bcafd8d7798661bf86c2d6234221d764c68fc19f
|
[
"MIT"
] | 152
|
2021-07-15T02:56:17.000Z
|
2022-03-31T08:59:52.000Z
|
script.py
|
deepakgarg08/algoexpert-data-structures-algorithms
|
2264802bce971e842c616b1eaf9238639d73915f
|
[
"MIT"
] | 2
|
2021-07-18T22:01:28.000Z
|
2022-02-17T03:55:04.000Z
|
script.py
|
deepakgarg08/algoexpert-data-structures-algorithms
|
2264802bce971e842c616b1eaf9238639d73915f
|
[
"MIT"
] | 74
|
2021-07-16T11:55:30.000Z
|
2022-03-31T14:48:06.000Z
|
import os
message = input("Enter commit message: ")
os.system("git add .")
os.system("git commit -m \"" + message + "\"")
os.system("git push -u origin master")
| 26.833333
| 46
| 0.652174
| 24
| 161
| 4.375
| 0.583333
| 0.228571
| 0.314286
| 0.342857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.149068
| 161
| 5
| 47
| 32.2
| 0.766423
| 0
| 0
| 0
| 0
| 0
| 0.521739
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 0
| 0.2
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
dfb10175fc1b59080c856bdb4d38abd72434309a
| 171
|
py
|
Python
|
answers/Utkarsh Srivastava/Day 14/Question 1.py
|
arc03/30-DaysOfCode-March-2021
|
6d6e11bf70280a578113f163352fa4fa8408baf6
|
[
"MIT"
] | 22
|
2021-03-16T14:07:47.000Z
|
2021-08-13T08:52:50.000Z
|
answers/Utkarsh Srivastava/Day 14/Question 1.py
|
arc03/30-DaysOfCode-March-2021
|
6d6e11bf70280a578113f163352fa4fa8408baf6
|
[
"MIT"
] | 174
|
2021-03-16T21:16:40.000Z
|
2021-06-12T05:19:51.000Z
|
answers/Utkarsh Srivastava/Day 14/Question 1.py
|
arc03/30-DaysOfCode-March-2021
|
6d6e11bf70280a578113f163352fa4fa8408baf6
|
[
"MIT"
] | 135
|
2021-03-16T16:47:12.000Z
|
2021-06-27T14:22:38.000Z
|
def duplicate(s):
if(len(s)<=1):
return s
if s[0]==s[1]:
return duplicate(s[1:])
return s[0]+duplicate(s[1:])
s = input()
print(duplicate(s))
| 19
| 32
| 0.526316
| 29
| 171
| 3.103448
| 0.344828
| 0.444444
| 0.266667
| 0.2
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.047244
| 0.25731
| 171
| 8
| 33
| 21.375
| 0.661417
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| false
| 0
| 0
| 0
| 0.5
| 0.125
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
dfc7e10e833ae06c006ac157e4f5bed2a2d3d0de
| 653
|
py
|
Python
|
src/yomiel/log.py
|
guendto/jomiel-yomiel
|
3acf7a1f3babac1c32a70e412d22fbc30353395f
|
[
"Apache-2.0"
] | null | null | null |
src/yomiel/log.py
|
guendto/jomiel-yomiel
|
3acf7a1f3babac1c32a70e412d22fbc30353395f
|
[
"Apache-2.0"
] | null | null | null |
src/yomiel/log.py
|
guendto/jomiel-yomiel
|
3acf7a1f3babac1c32a70e412d22fbc30353395f
|
[
"Apache-2.0"
] | null | null | null |
#
# jomiel-yomiel
#
# Copyright
# 2019 Toni Gündoğdu
#
#
# SPDX-License-Identifier: Apache-2.0
#
"""TODO."""
def lg():
"""Returns the logger instance used to print to the logging
subsystem to record new events.
The subsystem is configured via a separate logger YAML configuration
file. The configuration supports different logger identities.
To use this function (lg):
from jomiel import lg
lg().debug('foo=%s' % foo)
Returns
The logger instance
"""
from yomiel.cache import opts
import logging as lg
return lg.getLogger(opts.logger_ident)
# vim: set ts=4 sw=4 tw=72 expandtab:
| 18.138889
| 72
| 0.666156
| 89
| 653
| 4.876404
| 0.674157
| 0.046083
| 0.073733
| 0.110599
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.020284
| 0.245023
| 653
| 35
| 73
| 18.657143
| 0.860041
| 0.707504
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.028571
| 0
| 1
| 0.25
| true
| 0
| 0.5
| 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
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
5f2cbec78f31a04c15115ff14217bd0592b952ff
| 343
|
py
|
Python
|
src/backend/tests/test_root.py
|
rropen/rrflow
|
61bc4b0be4efbd840af8f7ad442922052d3e449c
|
[
"MIT"
] | 3
|
2021-09-13T18:20:23.000Z
|
2022-02-07T16:13:07.000Z
|
src/backend/tests/test_root.py
|
rropen/rrflow
|
61bc4b0be4efbd840af8f7ad442922052d3e449c
|
[
"MIT"
] | 48
|
2021-08-30T14:17:14.000Z
|
2022-02-14T14:54:16.000Z
|
src/backend/tests/test_root.py
|
rropen/rrflow
|
61bc4b0be4efbd840af8f7ad442922052d3e449c
|
[
"MIT"
] | 1
|
2021-10-30T12:06:42.000Z
|
2021-10-30T12:06:42.000Z
|
# Test the connection to the database
def test_ping(client):
response = client.get("/ping")
assert response.status_code == 200
assert response.json() == {"ping": "pong!"}
def test_root(client):
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"Message": "Try /docs or /redoc"}
| 28.583333
| 64
| 0.655977
| 44
| 343
| 5.022727
| 0.5
| 0.253394
| 0.180995
| 0.208145
| 0.40724
| 0.40724
| 0.40724
| 0.40724
| 0
| 0
| 0
| 0.021505
| 0.186589
| 343
| 11
| 65
| 31.181818
| 0.770609
| 0.102041
| 0
| 0.25
| 0
| 0
| 0.133987
| 0
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0.25
| false
| 0
| 0
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
a02bddcfa378ef4935e172492ed91637fa02cbc8
| 39
|
py
|
Python
|
src/tclr/__init__.py
|
lcford2/rtree-lr-combo
|
7931c95a99021ca2e9c9c30d39ccf168211745f4
|
[
"MIT"
] | null | null | null |
src/tclr/__init__.py
|
lcford2/rtree-lr-combo
|
7931c95a99021ca2e9c9c30d39ccf168211745f4
|
[
"MIT"
] | 4
|
2022-02-01T01:45:36.000Z
|
2022-02-01T02:16:30.000Z
|
src/tclr/__init__.py
|
lcford2/rtree-lr-combo
|
7931c95a99021ca2e9c9c30d39ccf168211745f4
|
[
"MIT"
] | null | null | null |
from .tree_combo_lr import TreeComboLR
| 19.5
| 38
| 0.871795
| 6
| 39
| 5.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.102564
| 39
| 1
| 39
| 39
| 0.914286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
a041cdc93ed47206f6634a17b9626e9fedcccfe2
| 182
|
py
|
Python
|
Implement_google_AdaptiveFL/mypkg/myio/PathSetting.py
|
kuihao/KuihaoFL
|
69c9161497f2a82ab8ef2d785a0c7e2e6975a328
|
[
"Apache-2.0"
] | 4
|
2021-12-13T06:03:35.000Z
|
2022-03-22T05:12:41.000Z
|
Implement_google_AdaptiveFL/mypkg/myio/PathSetting.py
|
kuihao/KuihaoFL
|
69c9161497f2a82ab8ef2d785a0c7e2e6975a328
|
[
"Apache-2.0"
] | null | null | null |
Implement_google_AdaptiveFL/mypkg/myio/PathSetting.py
|
kuihao/KuihaoFL
|
69c9161497f2a82ab8ef2d785a0c7e2e6975a328
|
[
"Apache-2.0"
] | null | null | null |
import os
# os.path.join(path1,path2,file)
def secure_mkdir(forder_parh)->str:
''' check exist before mkdir '''
os.makedirs(forder_parh, exist_ok=True)
return forder_parh
| 30.333333
| 43
| 0.725275
| 28
| 182
| 4.535714
| 0.714286
| 0.23622
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012903
| 0.148352
| 182
| 6
| 44
| 30.333333
| 0.806452
| 0.313187
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
a0536d482d9300b4c979eb4857023a11281772f2
| 2,185
|
py
|
Python
|
tests/sps/test_front_journal_meta.py
|
rafaelpezzuto/packtools
|
5153ed128a877ba56c289f7904dea73081426750
|
[
"BSD-2-Clause"
] | null | null | null |
tests/sps/test_front_journal_meta.py
|
rafaelpezzuto/packtools
|
5153ed128a877ba56c289f7904dea73081426750
|
[
"BSD-2-Clause"
] | null | null | null |
tests/sps/test_front_journal_meta.py
|
rafaelpezzuto/packtools
|
5153ed128a877ba56c289f7904dea73081426750
|
[
"BSD-2-Clause"
] | null | null | null |
"""<article>
<front>
<journal-meta>
<journal-id journal-id-type="publisher-id">ram</journal-id>
<journal-title-group>
<journal-title>RAM. Revista de Administração Mackenzie</journal-title>
<abbrev-journal-title abbrev-type="publisher">RAM, Rev. Adm. Mackenzie</abbrev-journal-title>
</journal-title-group>
<issn pub-type="epub">1678-6971</issn>
<issn pub-type="ppub">0213-6971</issn>
<publisher>
<publisher-name>Editora Mackenzie; Universidade Presbiteriana Mackenzie</publisher-name>
</publisher>
</journal-meta>
</article>
"""
from unittest import TestCase
from lxml import etree
from packtools.sps.models import front_journal_meta
def _get_xmltree(issns=None):
issns = issns or (
"""
<issn pub-type="epub">1678-6971</issn>
<issn pub-type="ppub">0213-6971</issn>
"""
)
xml = (
f"""
<article>
<front>
<journal-meta>
<journal-id journal-id-type="publisher-id">ram</journal-id>
<journal-title-group>
<journal-title>RAM. Revista de Administração Mackenzie</journal-title>
<abbrev-journal-title abbrev-type="publisher">RAM, Rev. Adm. Mackenzie</abbrev-journal-title>
</journal-title-group>
{issns}
<publisher>
<publisher-name>Editora Mackenzie; Universidade Presbiteriana Mackenzie</publisher-name>
</publisher>
</journal-meta>
</front></article>
"""
)
xmltree = etree.fromstring(xml)
return xmltree
class IssnTest(TestCase):
def test_data(self):
expected = [
{"type": "epub", "value": "1678-6971"},
{"type": "ppub", "value": "0213-6971"},
]
issns = front_journal_meta.ISSN(_get_xmltree())
self.assertEqual(expected, issns.data)
def test_epub(self):
issns = front_journal_meta.ISSN(_get_xmltree())
self.assertEqual("1678-6971", issns.epub)
def test_ppub(self):
issns = front_journal_meta.ISSN(_get_xmltree())
self.assertEqual("0213-6971", issns.ppub)
| 30.347222
| 109
| 0.599085
| 238
| 2,185
| 5.420168
| 0.231092
| 0.111628
| 0.074419
| 0.048837
| 0.730233
| 0.730233
| 0.730233
| 0.730233
| 0.730233
| 0.691473
| 0
| 0.039555
| 0.259497
| 2,185
| 71
| 110
| 30.774648
| 0.757726
| 0.272311
| 0
| 0.075
| 0
| 0.025
| 0.482361
| 0.166214
| 0
| 0
| 0
| 0
| 0.075
| 1
| 0.1
| false
| 0
| 0.075
| 0
| 0.225
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
a05820090bdfaa135bbf3f07a7ef2fa26f7f53ec
| 7,742
|
py
|
Python
|
pydemic_ui/components/ui.py
|
GCES-Pydemic/pydemic-ui
|
8e3d8bc9f73887edf6bd8ab78a4ead29fe8239ed
|
[
"MIT"
] | 1
|
2020-09-30T13:02:53.000Z
|
2020-09-30T13:02:53.000Z
|
pydemic_ui/components/ui.py
|
GCES-Pydemic/pydemic-ui
|
8e3d8bc9f73887edf6bd8ab78a4ead29fe8239ed
|
[
"MIT"
] | 29
|
2020-10-03T02:10:38.000Z
|
2020-12-07T22:19:13.000Z
|
pydemic_ui/components/ui.py
|
GCES-Pydemic/pydemic-ui
|
8e3d8bc9f73887edf6bd8ab78a4ead29fe8239ed
|
[
"MIT"
] | null | null | null |
__package__ = "pydemic_ui.ui"
from ..components import asset, twin_component, html
from ..i18n import _
import streamlit as st
@twin_component()
def css(where=st, keep_menu=False):
"""
Inject Pydemic CSS. Should always be the first command in script.
"""
if not keep_menu:
html(asset("hide_menu.html"), where=where)
html(asset("custom.html"), where=where)
@twin_component()
def logo(title=_("COVID-19"), subtitle=_("Epidemic Calculator"), where=st):
st = f"""
<div id="sidebar-icon">
<img src="data:image/svg+xml;base64,
PD94bWwgdmVyc2lvbj0iMS4wIiA
/PjxzdmcgaWQ9Il94MzFfLW91dGxpbmUtZXhwYW5kIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA2NCA2NDsiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDY0IDY0IiB4bWw6c3BhY2U9InByZXNlcnZlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiMzQTQyNDk7fQo8L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00Ni4yLDI2LjZjLTAuOS0xLjMtMi40LTAuOC0zLjMtMC42Yy0wLjIsMC4xLTAuNCwwLjEtMC42LDAuMmMwLTAuMiwwLjEtMC40LDAuMi0wLjZjMC4zLTEsMC44LTIuNC0wLjUtMy4zICBjLTEuMi0wLjgtMi40LDAuMS0zLjIsMC43Yy0wLjEsMC4xLTAuMywwLjItMC40LDAuM2MwLTAuMiwwLTAuNCwwLTAuNWMwLTAuOS0wLjEtMi41LTEuNi0yLjljLTEuNC0wLjMtMi4yLDEtMi44LDEuOCAgYy0wLjEsMC4xLTAuMiwwLjMtMC4zLDAuNGMtMC4xLTAuMi0wLjEtMC4zLTAuMi0wLjVjLTAuNC0wLjktMC45LTIuMy0yLjUtMi4yYy0xLjUsMC4yLTEuOCwxLjctMiwyLjZjMCwwLjEtMC4xLDAuMy0wLjEsMC41ICBjLTAuMS0wLjEtMC4yLTAuMy0wLjMtMC40Yy0wLjctMC44LTEuNy0xLjktMy4xLTEuM2MtMS4zLDAuNy0xLjEsMi4yLTEsMy4yYzAsMC4yLDAuMSwwLjQsMC4xLDAuNmMtMC4yLTAuMS0wLjMtMC4yLTAuNS0wLjIgIGMtMC44LTAuNC0yLjMtMS4yLTMuNC0wLjFjLTEsMS4xLTAuMywyLjQsMC4yLDMuM2MwLjEsMC4yLDAuMiwwLjUsMC4zLDAuN2MtMC4yLDAtMC41LDAtMC43LDBjLTEtMC4xLTIuNi0wLjItMy4yLDEuMyAgYy0wLjIsMC41LDAsMS4xLDAuNSwxLjNjMC41LDAuMiwxLjEsMCwxLjMtMC41YzAuMS0wLjIsMC44LTAuMSwxLjItMC4xYzAuOSwwLjEsMiwwLjEsMi42LTAuOGMwLjYtMC45LDAuMS0yLTAuMy0yLjggIGMtMC4xLTAuMy0wLjQtMC44LTAuNC0xYzAuMiwwLDAuNywwLjMsMSwwLjRjMC44LDAuNCwxLjgsMC45LDIuNywwLjNjMC45LTAuNiwwLjgtMS44LDAuNi0yLjdjMC0wLjMtMC4xLTAuOC0wLjEtMSAgYzAuMiwwLjIsMC41LDAuNSwwLjcsMC43YzAuNiwwLjcsMS40LDEuNSwyLjQsMS4yYzEuMS0wLjMsMS4zLTEuNCwxLjUtMi4zYzAuMS0wLjMsMC4yLTAuNywwLjItMC45YzAuMSwwLjIsMC4zLDAuNiwwLjQsMC45ICBjMC4zLDAuOSwwLjgsMS45LDEuOCwyYzEuMSwwLjEsMS43LTAuOSwyLjItMS42YzAuMS0wLjIsMC40LTAuNiwwLjUtMC44YzAuMSwwLjMsMC4xLDAuNywwLjEsMWMwLDAuOSwwLjEsMi4xLDEuMSwyLjUgIGMxLDAuNSwxLjktMC4yLDIuNi0wLjhjMC4yLTAuMiwwLjYtMC41LDAuOC0wLjZjMCwwLjMtMC4yLDAuNy0wLjMsMWMtMC4zLDAuOS0wLjYsMiwwLjEsMi43YzAuOCwwLjgsMS45LDAuNSwyLjcsMC4zICBjMC4zLTAuMSwxLTAuMywxLjEtMC4zYzAsMC4yLTAuNCwwLjctMC42LDFjLTAuNSwwLjctMS4zLDEuNy0wLjgsMi43YzAuMiwwLjQsMC41LDAuNiwwLjksMC42YzAuMSwwLDAuMywwLDAuNC0wLjEgIGMwLjUtMC4yLDAuNy0wLjcsMC41LTEuMmMwLjEtMC4yLDAuMy0wLjYsMC41LTAuOEM0Ni4xLDI5LjEsNDcsMjcuOSw0Ni4yLDI2LjZ6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTU2LjksNDIuOWMtMS4xLTAuNy0yLjUtMC41LTMuNCwwLjNsLTIuOC0xLjZjMS0yLDEuNy00LjEsMi4xLTYuNGw0LDAuNGwwLjItMmwtNC0wLjRjMC0wLjQsMC4xLTAuOCwwLjEtMS4yICBzMC0wLjgtMC4xLTEuMmw0LTAuNGwtMC4yLTJsLTQsMC40Yy0wLjMtMi4zLTEuMS00LjQtMi4xLTYuNGwyLjgtMS42YzAuOSwwLjgsMi4zLDEsMy40LDAuM2MxLjQtMC44LDEuOS0yLjcsMS4xLTQuMSAgcy0yLjctMS45LTQuMS0xLjFjLTEuMSwwLjctMS43LDEuOS0xLjQsMy4xbC0yLjgsMS42Yy0xLjItMS45LTIuOC0zLjYtNC41LTVsMi40LTMuM2wtMS42LTEuMmwtMi40LDMuM2MtMC43LTAuNC0xLjQtMC44LTIuMS0xLjIgIGwxLjYtMy43bC0xLjgtMC44bC0xLjYsMy43Yy0yLjEtMC44LTQuMy0xLjMtNi42LTEuNFY3LjhjMS4yLTAuNCwyLTEuNSwyLTIuOGMwLTEuNy0xLjMtMy0zLTNzLTMsMS4zLTMsM2MwLDEuMywwLjgsMi40LDIsMi44djMuMiAgYy0yLjMsMC4xLTQuNSwwLjYtNi42LDEuNGwtMS42LTMuN2wtMS44LDAuOGwxLjYsMy43Yy0wLjcsMC40LTEuNCwwLjgtMi4xLDEuMmwtMi40LTMuM2wtMS42LDEuMmwyLjQsMy4zYy0xLjgsMS40LTMuMywzLjEtNC41LDUgIEwxMS42LDE5YzAuMi0xLjItMC4zLTIuNS0xLjQtMy4xQzguNywxNS4xLDYuOCwxNS42LDYsMTdzLTAuMywzLjMsMS4xLDQuMWMxLjEsMC43LDIuNSwwLjUsMy40LTAuM2wyLjgsMS42Yy0xLDItMS43LDQuMS0yLjEsNi40ICBsLTQtMC40bC0wLjIsMmw0LDAuNGMwLDAuNC0wLjEsMC44LTAuMSwxLjJzMCwwLjgsMC4xLDEuMmwtNCwwLjRsMC4yLDJsNC0wLjRjMC4zLDIuMywxLjEsNC40LDIuMSw2LjRsLTIuOCwxLjYgIGMtMC45LTAuOC0yLjMtMS0zLjQtMC4zQzUuNyw0My43LDUuMiw0NS42LDYsNDdzMi43LDEuOSw0LjEsMS4xYzEuMS0wLjcsMS43LTEuOSwxLjQtMy4xbDIuOC0xLjZjMS4yLDEuOSwyLjgsMy42LDQuNSw1bC0yLjQsMy4zICBsMS42LDEuMmwyLjQtMy4zYzAuNywwLjQsMS40LDAuOCwyLjEsMS4ybC0xLjYsMy43bDEuOCwwLjhsMS42LTMuN2MyLjEsMC44LDQuMywxLjMsNi42LDEuNHYzLjJjLTEuMiwwLjQtMiwxLjUtMiwyLjggIGMwLDEuNywxLjMsMywzLDNzMy0xLjMsMy0zYzAtMS4zLTAuOC0yLjQtMi0yLjh2LTMuMmMyLjMtMC4xLDQuNS0wLjYsNi42LTEuNGwxLjYsMy43bDEuOC0wLjhsLTEuNi0zLjdjMC43LTAuNCwxLjQtMC44LDIuMS0xLjIgIGwyLjQsMy4zbDEuNi0xLjJsLTIuNC0zLjNjMS44LTEuNCwzLjMtMy4xLDQuNS01bDIuOCwxLjZjLTAuMiwxLjIsMC4zLDIuNSwxLjQsMy4xYzEuNCwwLjgsMy4zLDAuMyw0LjEtMS4xUzU4LjMsNDMuNyw1Ni45LDQyLjl6ICAgTTQ0LDQ2LjhsLTEuMi0xLjZsLTEuNiwxLjJsMS4yLDEuNmMtMC42LDAuNC0xLjEsMC43LTEuNywxbC0wLjgtMS44TDM4LDQ3LjlsMC44LDEuOEMzNyw1MC40LDM1LDUwLjgsMzMsNTAuOVY0OWgtMnYxLjkgIGMtMi0wLjEtNC0wLjUtNS44LTEuMmwwLjgtMS44bC0xLjgtMC44bC0wLjgsMS44Yy0wLjYtMC4zLTEuMi0wLjYtMS43LTFsMS4yLTEuNmwtMS42LTEuMkwyMCw0Ni44Yy0xLjUtMS4zLTIuOS0yLjctNC00LjRsMS43LTEgIGwtMS0xLjdsLTEuNywxYy0wLjktMS43LTEuNS0zLjYtMS44LTUuNmwxLjktMC4ybC0wLjItMkwxMy4xLDMzYzAtMC4zLTAuMS0wLjctMC4xLTFzMC0wLjcsMC4xLTFsMS45LDAuMmwwLjItMkwxMy4zLDI5ICBjMC4zLTIsMC45LTMuOSwxLjgtNS42bDEuNywxbDEtMS43bC0xLjctMWMxLjEtMS43LDIuNC0zLjIsNC00LjRsMS4yLDEuNmwxLjYtMS4ybC0xLjItMS42YzAuNi0wLjQsMS4xLTAuNywxLjctMWwwLjgsMS44bDEuOC0wLjggIGwtMC44LTEuOGMxLjgtMC43LDMuOC0xLjEsNS44LTEuMlYxNWgydi0xLjljMiwwLjEsNCwwLjUsNS44LDEuMkwzOCwxNi4xbDEuOCwwLjhsMC44LTEuOGMwLjYsMC4zLDEuMiwwLjYsMS43LDFsLTEuMiwxLjZsMS42LDEuMiAgbDEuMi0xLjZjMS41LDEuMywyLjksMi43LDQsNC40bC0xLjcsMWwxLDEuN2wxLjctMWMwLjksMS43LDEuNSwzLjYsMS44LDUuNmwtMS45LDAuMmwwLjIsMmwxLjktMC4yYzAsMC4zLDAuMSwwLjcsMC4xLDEgIHMwLDAuNy0wLjEsMUw0OSwzMi44bC0wLjIsMmwxLjksMC4yYy0wLjMsMi0wLjksMy45LTEuOCw1LjZsLTEuNy0xbC0xLDEuN2wxLjcsMUM0Ni44LDQ0LDQ1LjUsNDUuNSw0NCw0Ni44eiIvPjwvc3ZnPg==">
<span>{title}<br>{subtitle}</span>
</div>"""
return html(st, where=where)
@twin_component()
def footnote_disclaimer(lang="en_US", where=st, **kwargs):
"""
Renders the footnote text for given language.
"""
md = asset(f"footnote_disclaimer.{lang}.md")
md = md.format(**kwargs)
return where.markdown(md)
@twin_component()
def footnotes(where=st):
"""
Write footnotes.
"""
template = '<a href="{href}">{name}</a>'
path_href = _("https://www.paho.org/hq/index.php?lang=en")
fiocruz_href = "http://www.matogrossodosul.fiocruz.br/"
institutions = [
template.format(href=path_href, name=_("PAHO")),
template.format(href="https://saude.gov.br/", name="MS/SVS"),
template.format(href="https://lappis.rocks", name="UnB/LAPPIS"),
template.format(href="http://medicinatropical.unb.br/", name="UnB/NMT"),
template.format(href="http://fce.unb.br/", name="UnB/FCE"),
template.format(href="http://www.butantan.gov.br/", name="Butantã"),
template.format(href=fiocruz_href, name="Fiocruz"),
template.format(href="https://famed.ufms.br/", name="FAMED"),
]
ack_institutions = [template.format(href="http://brasil.io", name="Brasil.io")]
links = _("Support: {institutions}").format(institutions=", ".join(institutions))
styles = "text-align: center; margin: 2rem 0 1rem 0;"
html(f'<div style="{styles}">{links}</div>', where=where)
links = _("Acknowledgements: {institutions}").format(
institutions=", ".join(ack_institutions)
)
html(f'<div style="{styles}">{links}</div>', where=where)
if __name__ == "__main__":
import streamlit as st
css()
st.header("Components")
st.subheader("icon()")
st.markdown("(See the sidebar)")
logo("Pydemic", "Sub-title", where=st.sidebar)
st.subheader("footnote_disclaimer()")
footnote_disclaimer(mortality=0.006, fatality=0.012, infected=0.25, symptomatic=0.14)
st.subheader("footnotes()")
footnotes()
| 91.082353
| 5,131
| 0.881168
| 333
| 7,742
| 20.369369
| 0.396396
| 0.018576
| 0.023883
| 0.012974
| 0.018576
| 0.01091
| 0.01091
| 0.01091
| 0.01091
| 0
| 0
| 0.094425
| 0.054766
| 7,742
| 84
| 5,132
| 92.166667
| 0.832468
| 0.016533
| 0
| 0.137931
| 0
| 0
| 0.785544
| 0.707849
| 0
| 1
| 0
| 0
| 0
| 1
| 0.068966
| false
| 0
| 0.068966
| 0
| 0.172414
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
a0586e53785839ab679a13b020223e66b03aa458
| 95
|
py
|
Python
|
sync.py
|
gleenn/dfplayer
|
dd390a6f54b3bd8b2a3397fddd6caacfba01b29d
|
[
"MIT"
] | null | null | null |
sync.py
|
gleenn/dfplayer
|
dd390a6f54b3bd8b2a3397fddd6caacfba01b29d
|
[
"MIT"
] | null | null | null |
sync.py
|
gleenn/dfplayer
|
dd390a6f54b3bd8b2a3397fddd6caacfba01b29d
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python
#
import subprocess
import sys
subprocess.check_call(['gclient', 'sync'])
| 10.555556
| 42
| 0.715789
| 12
| 95
| 5.583333
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115789
| 95
| 8
| 43
| 11.875
| 0.797619
| 0.168421
| 0
| 0
| 0
| 0
| 0.144737
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
a07754082374b931c726b68295c3215e705047b1
| 224
|
py
|
Python
|
plotly/validators/pointcloud/marker/__init__.py
|
gnestor/plotly.py
|
a8ae062795ddbf9867b8578fe6d9e244948c15ff
|
[
"MIT"
] | 12
|
2020-04-18T18:10:22.000Z
|
2021-12-06T10:11:15.000Z
|
plotly/validators/pointcloud/marker/__init__.py
|
gnestor/plotly.py
|
a8ae062795ddbf9867b8578fe6d9e244948c15ff
|
[
"MIT"
] | 27
|
2020-04-28T21:23:12.000Z
|
2021-06-25T15:36:38.000Z
|
plotly/validators/pointcloud/marker/__init__.py
|
gnestor/plotly.py
|
a8ae062795ddbf9867b8578fe6d9e244948c15ff
|
[
"MIT"
] | 6
|
2020-04-18T23:07:08.000Z
|
2021-11-18T07:53:06.000Z
|
from ._sizemin import SizeminValidator
from ._sizemax import SizemaxValidator
from ._opacity import OpacityValidator
from ._color import ColorValidator
from ._border import BorderValidator
from ._blend import BlendValidator
| 32
| 38
| 0.866071
| 24
| 224
| 7.833333
| 0.583333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107143
| 224
| 6
| 39
| 37.333333
| 0.94
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
26143424094b49352b622c93cacb9808bf3b83b6
| 66
|
py
|
Python
|
examples/datasets/__init__.py
|
haihabi/NormFlowPy
|
a15ea6a704254a925f25dc94b22459ca2e0beaf5
|
[
"MIT"
] | null | null | null |
examples/datasets/__init__.py
|
haihabi/NormFlowPy
|
a15ea6a704254a925f25dc94b22459ca2e0beaf5
|
[
"MIT"
] | null | null | null |
examples/datasets/__init__.py
|
haihabi/NormFlowPy
|
a15ea6a704254a925f25dc94b22459ca2e0beaf5
|
[
"MIT"
] | null | null | null |
from experiments.datasets.factory import get_dataset, DatasetType
| 33
| 65
| 0.878788
| 8
| 66
| 7.125
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.075758
| 66
| 1
| 66
| 66
| 0.934426
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
2639aec81c72f81daab9875d5f1e5699848c0ad0
| 128
|
py
|
Python
|
pages/urls.py
|
surajsjain/social-media-analytics-app
|
1f310dcf2f79c9f80edee80dd59d8c63f827f04a
|
[
"MIT"
] | null | null | null |
pages/urls.py
|
surajsjain/social-media-analytics-app
|
1f310dcf2f79c9f80edee80dd59d8c63f827f04a
|
[
"MIT"
] | 8
|
2020-06-05T20:49:10.000Z
|
2022-02-10T00:37:59.000Z
|
pages/urls.py
|
surajsjain/social-media-analytics-app
|
1f310dcf2f79c9f80edee80dd59d8c63f827f04a
|
[
"MIT"
] | 3
|
2020-01-26T10:48:25.000Z
|
2020-08-25T17:47:54.000Z
|
version https://git-lfs.github.com/spec/v1
oid sha256:db9f81a823a3e59ebdb87f29ab5b65372d150a7b08f072ce33d586130bb6d082
size 225
| 32
| 75
| 0.882813
| 13
| 128
| 8.692308
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.385246
| 0.046875
| 128
| 3
| 76
| 42.666667
| 0.540984
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
264dbbc00e19dc1ebe4e9fd0843e92cc03d81afe
| 40
|
py
|
Python
|
lang/Python/find-limit-of-recursion-2.py
|
ethansaxenian/RosettaDecode
|
8ea1a42a5f792280b50193ad47545d14ee371fb7
|
[
"MIT"
] | 5
|
2021-01-29T20:08:05.000Z
|
2022-03-22T06:16:05.000Z
|
lang/Python/find-limit-of-recursion-2.py
|
ethansaxenian/RosettaDecode
|
8ea1a42a5f792280b50193ad47545d14ee371fb7
|
[
"MIT"
] | null | null | null |
lang/Python/find-limit-of-recursion-2.py
|
ethansaxenian/RosettaDecode
|
8ea1a42a5f792280b50193ad47545d14ee371fb7
|
[
"MIT"
] | 1
|
2021-04-13T04:19:31.000Z
|
2021-04-13T04:19:31.000Z
|
import sys
sys.setrecursionlimit(12345)
| 13.333333
| 28
| 0.85
| 5
| 40
| 6.8
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.135135
| 0.075
| 40
| 2
| 29
| 20
| 0.783784
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
2650eaa003feafc79f009f61e0bccb64ea52e4f4
| 249
|
py
|
Python
|
coding-challenges/firecode/unique-chars-in-string.py
|
acfromspace/infinitygauntlet
|
8d0d3c7229d6adabdfea6147a47ca5509c2946fd
|
[
"MIT"
] | 3
|
2018-12-28T21:11:46.000Z
|
2021-04-03T05:19:56.000Z
|
coding-challenges/firecode/unique-chars-in-string.py
|
acfromspace/infinitygauntlet
|
8d0d3c7229d6adabdfea6147a47ca5509c2946fd
|
[
"MIT"
] | 4
|
2019-07-11T21:52:55.000Z
|
2020-07-21T20:18:51.000Z
|
coding-challenges/firecode/unique-chars-in-string.py
|
acfromspace/infinitygauntlet
|
8d0d3c7229d6adabdfea6147a47ca5509c2946fd
|
[
"MIT"
] | null | null | null |
"""
@author: acfromspace
"""
def unique_chars_in_string(input_string):
return len(set(input_string)) == len(input_string)
input_string = str(input("Input a string: "))
print("unique_chars_in_string():", unique_chars_in_string(input_string))
| 20.75
| 72
| 0.746988
| 35
| 249
| 4.914286
| 0.4
| 0.319767
| 0.226744
| 0.331395
| 0.348837
| 0.348837
| 0
| 0
| 0
| 0
| 0
| 0
| 0.104418
| 249
| 11
| 73
| 22.636364
| 0.7713
| 0.080321
| 0
| 0
| 0
| 0
| 0.18552
| 0.113122
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0.25
| 0.5
| 0.25
| 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
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 5
|
2655849845668952507d978c6a1626edf63e2109
| 225
|
py
|
Python
|
pgmax/fgroup/__init__.py
|
NishanthJKumar/PGMax
|
7c71b1456cd84e40b4974649adbf6eecaf0276a7
|
[
"MIT"
] | 45
|
2021-11-18T15:54:01.000Z
|
2022-03-31T01:28:06.000Z
|
pgmax/fgroup/__init__.py
|
NishanthJKumar/PGMax
|
7c71b1456cd84e40b4974649adbf6eecaf0276a7
|
[
"MIT"
] | 54
|
2021-11-07T03:49:21.000Z
|
2022-03-30T23:19:22.000Z
|
pgmax/fgroup/__init__.py
|
NishanthJKumar/PGMax
|
7c71b1456cd84e40b4974649adbf6eecaf0276a7
|
[
"MIT"
] | 7
|
2021-11-03T18:25:52.000Z
|
2022-03-10T02:55:12.000Z
|
"""A sub-package defining different types of groups of factors."""
from .enum import EnumFactorGroup, PairwiseFactorGroup
from .fgroup import FactorGroup, SingleFactorGroup
from .logical import ANDFactorGroup, ORFactorGroup
| 37.5
| 66
| 0.826667
| 25
| 225
| 7.44
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 225
| 5
| 67
| 45
| 0.93
| 0.266667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
2665bd362fd9b23948771c98a866f15a96722a8f
| 60
|
py
|
Python
|
rebelykos/core/teamserver/contexts/__init__.py
|
Takahiro-Yoko/rebelykos
|
3b58d11f733b20eee2ddd318068c76ced109cc90
|
[
"MIT"
] | 1
|
2022-01-31T23:32:21.000Z
|
2022-01-31T23:32:21.000Z
|
rebelykos/core/teamserver/contexts/__init__.py
|
Takahiro-Yoko/rebelykos
|
3b58d11f733b20eee2ddd318068c76ced109cc90
|
[
"MIT"
] | null | null | null |
rebelykos/core/teamserver/contexts/__init__.py
|
Takahiro-Yoko/rebelykos
|
3b58d11f733b20eee2ddd318068c76ced109cc90
|
[
"MIT"
] | null | null | null |
from .modules import Modules
from .profiles import Profiles
| 20
| 30
| 0.833333
| 8
| 60
| 6.25
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.133333
| 60
| 2
| 31
| 30
| 0.961538
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
267c5593ca2237d266c1437caf5528a1a688ac07
| 20,343
|
py
|
Python
|
treehmm/plot.py
|
uci-cbcl/tree-hmm
|
e401f5f0fc107d89c03638695db79319db411d48
|
[
"BSD-3-Clause"
] | 21
|
2015-04-22T19:04:14.000Z
|
2022-03-17T13:52:56.000Z
|
treehmm/plot.py
|
uci-cbcl/tree-hmm
|
e401f5f0fc107d89c03638695db79319db411d48
|
[
"BSD-3-Clause"
] | 1
|
2015-05-16T01:37:46.000Z
|
2016-11-04T15:09:46.000Z
|
treehmm/plot.py
|
uci-cbcl/tree-hmm
|
e401f5f0fc107d89c03638695db79319db411d48
|
[
"BSD-3-Clause"
] | 7
|
2015-04-23T13:42:30.000Z
|
2020-12-03T16:06:24.000Z
|
import os
from math import ceil
import matplotlib
from matplotlib import pyplot
import scipy as sp
from treehmm.static import valid_species, valid_marks
def plot_energy_comparison(args):
"""Plot energy trajectories for comparison"""
outfile = (args.out_params + '.png').format(param='cmp_free_energy', **args.__dict__)
pyplot.figure()
names = args.cmp_energy.keys()
vals = -sp.array([args.cmp_energy[n] for n in names]).T
print names
print vals
lines = pyplot.plot(vals)
line_types = ['--','-.',':','-','steps'] * 3
[pyplot.setp(l, linestyle=t) for l,t in zip(lines, line_types)]
pyplot.legend(names,loc='lower right')
#pyplot.title('Free energy learning with %s' % args.approx)
formatter = pyplot.ScalarFormatter(useMathText=True)
formatter.set_scientific(True)
formatter.set_powerlimits((-3,3))
pyplot.gca().yaxis.set_major_formatter(formatter)
pyplot.xlabel("Iteration")
pyplot.ylabel('-Free Energy')
pyplot.savefig(os.path.join(args.out_dir, outfile))
pyplot.close('all')
def plot_energy(args):
#outfile = 'free_energy_{approx}.png'.format(**args.__dict__)
outfile = (args.out_params + '.png').format(param='free_energy', **args.__dict__)
pyplot.savefig(os.path.join(args.out_dir, outfile))
pyplot.figure()
pyplot.title('Free energy for %s' % args.approx)
pyplot.plot([-f for f in args.free_energy], label='Current run')
pyplot.xlabel("iteration")
pyplot.ylabel('-Free Energy')
pyplot.savefig(os.path.join(args.out_dir, outfile))
pyplot.close('all')
if hasattr(args, 'prev_free_energy'):
pyplot.figure()
pyplot.title('Free energy for %s' % args.approx)
pyplot.plot(range(len(args.prev_free_energy)), [-f for f in args.prev_free_energy], linestyle='-', label='Previous run')
pyplot.plot(range(len(args.prev_free_energy), len(args.free_energy) + len(args.prev_free_energy)), [-f for f in args.free_energy], label='Current run')
pyplot.legend(loc='lower left')
pyplot.xlabel("iteration")
pyplot.ylabel('-Free Energy')
pyplot.savefig(os.path.join(args.out_dir, (args.out_params + 'vs_previous.png').format(param='free_energy', **args.__dict__)))
pyplot.close('all')
def plot_Q(args):
"""Plot Q distribution"""
outfile = (args.out_params + '_it{iteration}.png').format(param='Q', **args.__dict__)
print outfile
I,T,K = args.Q.shape
I,T,L = args.X.shape
fig, axs = pyplot.subplots(I+1, 1, sharex=True, sharey=True, squeeze=False)
for i in xrange(I):
axs[i,0].plot(args.Q[i,:,:])
mark_total = args.X.sum(axis=2).T
axs[I,0].plot(mark_total / float(L))
fig.suptitle("Q distribution for {approx} at iteration {iteration}".
format(approx=args.approx, iteration=args.iteration))
fig.suptitle("chromosome bin", x=.5, y=.02)
fig.suptitle("species", x=.02, y=.5, verticalalignment='center', rotation=90)
#fig.savefig(os.path.join(args.out_dir, 'Q_dist_%s.png' % args.iteration))
fig.savefig(os.path.join(args.out_dir, outfile))
pyplot.close('all')
def plot_data(args):
"""Plot X as an interpolated image"""
outfile = (args.out_params + '.png').format(param='X_colors', **args.__dict__)
#fig, axs = pyplot.subplots(args.I+1, 1, sharex=True, sharey=True, squeeze=False)
fig, axs = pyplot.subplots(args.I, 1, sharex=True, sharey=True, squeeze=False)
fig.set_size_inches(24,20)
I,T,L = args.X.shape
extent = [0, T, 0, L]
#extent = [0, 100, 0, 5]
for i in xrange(args.I):
im = axs[i,0].imshow(sp.flipud(args.X[i,:,:].T), interpolation='sinc', vmin=0, vmax=1, extent=extent, aspect='auto')
im.set_cmap('spectral')
axs[i,0].set_yticks(sp.linspace(0, L, L, endpoint=False) + .5)
axs[i,0].set_yticklabels(valid_marks[:L])
axs[i,0].text(T/2, L+1, valid_species[i], horizontalalignment='center', verticalalignment='top')
fig.savefig(os.path.join(args.out_dir, outfile), dpi=120)
pyplot.close('all')
def plot_params(args):
"""Plot alpha, theta, and the emission probabilities"""
old_err = sp.seterr(under='ignore')
oldsize = matplotlib.rcParams['font.size']
K, L = args.emit_probs.shape if not args.continuous_observations else args.means.shape
# alpha
#matplotlib.rcParams['font.size'] = 12
pyplot.figure()
_, xedges, yedges = sp.histogram2d([0,K], [0,K], bins=[K,K])
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
pyplot.imshow(args.alpha.astype(sp.float64), extent=extent, interpolation='nearest',
vmin=0, vmax=1, cmap='OrRd', origin='lower')
pyplot.xticks(sp.arange(K) + .5, sp.arange(K)+1)
pyplot.gca().set_xticks(sp.arange(K)+1, minor=True)
pyplot.yticks(sp.arange(K) + .5, sp.arange(K)+1)
pyplot.gca().set_yticks(sp.arange(K)+1, minor=True)
pyplot.grid(which='minor', alpha=.2)
for line in pyplot.gca().yaxis.get_ticklines() + pyplot.gca().xaxis.get_ticklines() + pyplot.gca().xaxis.get_ticklines(minor=True) + pyplot.gca().yaxis.get_ticklines(minor=True):
# label is a Text instance
line.set_markersize(0)
pyplot.ylabel('Horizontal parent state')
pyplot.xlabel('Node state')
pyplot.title(r"Top root transition ($\alpha$) for {approx} iteration {iteration}".
format(approx=args.approx, iteration=args.iteration))
b = pyplot.colorbar(shrink=.9)
b.set_label("Probability")
outfile = (args.out_params + '_it{iteration}.png').format(param='alpha', **args.__dict__)
pyplot.savefig(os.path.join(args.out_dir, outfile), dpi=240)
# beta
pyplot.figure()
_, xedges, yedges = sp.histogram2d([0,K], [0,K], bins=[K,K])
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
pyplot.clf()
pyplot.imshow(args.beta.astype(sp.float64), extent=extent, interpolation='nearest',
vmin=0, vmax=1, cmap='OrRd', origin='lower')
pyplot.xticks(sp.arange(K) + .5, sp.arange(K)+1)
pyplot.gca().set_xticks(sp.arange(K)+1, minor=True)
pyplot.yticks(sp.arange(K) + .5, sp.arange(K)+1)
pyplot.gca().set_yticks(sp.arange(K)+1, minor=True)
pyplot.grid(which='minor', alpha=.2)
for line in pyplot.gca().yaxis.get_ticklines() + pyplot.gca().xaxis.get_ticklines() + pyplot.gca().xaxis.get_ticklines(minor=True) + pyplot.gca().yaxis.get_ticklines(minor=True):
# label is a Text instance
line.set_markersize(0)
pyplot.ylabel('Vertical parent state')
pyplot.xlabel('Node state')
pyplot.title(r"Left root transition ($\beta$) for {approx} iteration {iteration}".
format(approx=args.approx, iteration=args.iteration))
b = pyplot.colorbar(shrink=.9)
b.set_label("Probability")
outfile = (args.out_params + '_it{iteration}.png').format(param='beta', **args.__dict__)
pyplot.savefig(os.path.join(args.out_dir, outfile), dpi=240)
# theta
if args.separate_theta:
theta_tmp = args.theta
for i in range((args.theta.shape)[0]):
setattr(args, 'theta_%s'%(i+1), args.theta[i,:,:,:])
for theta_name in ['theta'] + ['theta_%s' % i for i in range(20)]:
#print 'trying', theta_name
if not hasattr(args, theta_name):
#print 'missing', theta_name
continue
_, xedges, yedges = sp.histogram2d([0,K], [0,K], bins=[K,K])
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
if K == 18:
numx_plots = 6
numy_plots = 3
elif K == 15:
numx_plots = 5
numy_plots = 3
else:
numx_plots = int(ceil(sp.sqrt(K)))
numy_plots = int(ceil(sp.sqrt(K)))
matplotlib.rcParams['font.size'] = 8
fig, axs = pyplot.subplots(numy_plots, numx_plots, sharex=True, sharey=True, figsize=(numx_plots*2.5,numy_plots*2.5))
for k in xrange(K):
pltx, plty = k // numx_plots, k % numx_plots
#axs[pltx,plty].imshow(args.theta[k,:,:], extent=extent, interpolation='nearest',
axs[pltx,plty].imshow(getattr(args, theta_name)[:,k,:].astype(sp.float64), extent=extent, interpolation='nearest',
vmin=0, vmax=1, cmap='OrRd', aspect='auto', origin='lower')
#if k < numx_plots:
#axs[pltx,plty].text(0 + .5, K - .5, 'vp=%s' % (k+1), horizontalalignment='left', verticalalignment='top', fontsize=10)
axs[pltx,plty].text(0 + .5, K - .5, 'hp=%s' % (k+1), horizontalalignment='left', verticalalignment='top', fontsize=10)
#axs[pltx,plty].xticks(sp.arange(K) + .5, sp.arange(K))
#axs[pltx,plty].yticks(sp.arange(K) + .5, sp.arange(K))
axs[pltx,plty].set_xticks(sp.arange(K) + .5)
axs[pltx,plty].set_xticks(sp.arange(K)+1, minor=True)
axs[pltx,plty].set_xticklabels(sp.arange(K) + 1)
axs[pltx,plty].set_yticks(sp.arange(K) + .5)
axs[pltx,plty].set_yticks(sp.arange(K)+1, minor=True)
axs[pltx,plty].set_yticklabels(sp.arange(K) + 1)
for line in axs[pltx,plty].yaxis.get_ticklines() + axs[pltx,plty].xaxis.get_ticklines() + axs[pltx,plty].yaxis.get_ticklines(minor=True) + axs[pltx,plty].xaxis.get_ticklines(minor=True):
line.set_markersize(0)
axs[pltx,plty].grid(True, which='minor', alpha=.2)
#fig.suptitle(r"$\Theta$ with fixed parents for {approx} iteration {iteration}".
# format(approx=args.approx, iteration=args.iteration),
# fontsize=14, verticalalignment='top')
fig.suptitle('Node state', y=.03, fontsize=14, verticalalignment='center')
#fig.suptitle('Horizontal parent state', y=.5, x=.02, rotation=90,
fig.suptitle('Vertical parent state', y=.5, x=.02, rotation=90,
verticalalignment='center', fontsize=14)
matplotlib.rcParams['font.size'] = 6.5
fig.subplots_adjust(wspace=.05, hspace=.05, left=.05, right=.95)
#b = fig.colorbar(shrink=.9)
#b.set_label("Probability")
outfile = (args.out_params + '_vertparent_it{iteration}.png').format(param=theta_name, **args.__dict__)
pyplot.savefig(os.path.join(args.out_dir, outfile), dpi=240)
fig, axs = pyplot.subplots(numy_plots, numx_plots, sharex=True, sharey=True, figsize=(numx_plots*2.5,numy_plots*2.5))
for k in xrange(K):
pltx, plty = k // numx_plots, k % numx_plots
axs[pltx,plty].imshow(getattr(args, theta_name)[k,:,:].astype(sp.float64), extent=extent, interpolation='nearest',
#axs[pltx,plty].imshow(args.theta[:,k,:], extent=extent, interpolation='nearest',
vmin=0, vmax=1, cmap='OrRd', aspect='auto', origin='lower')
#if k < numx_plots:
axs[pltx,plty].text(0 + .5, K - .5, 'vp=%s' % (k+1), horizontalalignment='left', verticalalignment='top', fontsize=10)
#axs[pltx,plty].xticks(sp.arange(K) + .5, sp.arange(K))
#axs[pltx,plty].yticks(sp.arange(K) + .5, sp.arange(K))
axs[pltx,plty].set_xticks(sp.arange(K) + .5)
axs[pltx,plty].set_xticks(sp.arange(K)+1, minor=True)
axs[pltx,plty].set_xticklabels(sp.arange(K) + 1)
axs[pltx,plty].set_yticks(sp.arange(K) + .5)
axs[pltx,plty].set_yticks(sp.arange(K)+1, minor=True)
axs[pltx,plty].set_yticklabels(sp.arange(K) + 1)
for line in axs[pltx,plty].yaxis.get_ticklines() + axs[pltx,plty].xaxis.get_ticklines() + axs[pltx,plty].yaxis.get_ticklines(minor=True) + axs[pltx,plty].xaxis.get_ticklines(minor=True):
line.set_markersize(0)
axs[pltx,plty].grid(True, which='minor', alpha=.2)
#fig.suptitle(r"$\Theta$ with fixed parents for {approx} iteration {iteration}".
# format(approx=args.approx, iteration=args.iteration),
# fontsize=14, verticalalignment='top')
fig.suptitle('Node state', y=.03, fontsize=14, verticalalignment='center')
fig.suptitle('Horizontal parent state', y=.5, x=.02, rotation=90,
#fig.suptitle('Vertical parent state', y=.5, x=.02, rotation=90,
verticalalignment='center', fontsize=14)
matplotlib.rcParams['font.size'] = 6.5
fig.subplots_adjust(wspace=.05, hspace=.05, left=.05, right=.95)
#b = fig.colorbar(shrink=.9)
#b.set_label("Probability")
outfile = (args.out_params + '_it{iteration}.png').format(param=theta_name, **args.__dict__)
pyplot.savefig(os.path.join(args.out_dir, outfile), dpi=240)
# emission probabilities
if args.continuous_observations:
# plot mean values
matplotlib.rcParams['font.size'] = 8
pyplot.figure(figsize=(max(1,round(L/3.)),max(1, round(K/3.))))
print (max(1,round(L/3.)),max(1, round(K/3.)))
pyplot.imshow(args.means.astype(sp.float64), interpolation='nearest', aspect='auto',
vmin=0, vmax=args.means.max(), cmap='OrRd', origin='lower')
for k in range(K):
for l in range(L):
pyplot.text(l, k, '%.1f' % (args.means[k,l]), horizontalalignment='center', verticalalignment='center', fontsize=5)
pyplot.yticks(sp.arange(K), sp.arange(K)+1)
pyplot.gca().set_yticks(sp.arange(K)+.5, minor=True)
pyplot.xticks(sp.arange(L), valid_marks, rotation=30, horizontalalignment='right')
pyplot.gca().set_xticks(sp.arange(L)+.5, minor=True)
pyplot.grid(which='minor', alpha=.2)
for line in pyplot.gca().yaxis.get_ticklines() + pyplot.gca().xaxis.get_ticklines() + pyplot.gca().xaxis.get_ticklines(minor=True) + pyplot.gca().yaxis.get_ticklines(minor=True):
# label is a Text instance
line.set_markersize(0)
pyplot.ylabel('Hidden State')
pyplot.title("Emission Mean")
#b = pyplot.colorbar(shrink=.7)
#b.set_label("Probability")
outfile = (args.out_params + '_it{iteration}.png').format(param='emission_means', **args.__dict__)
pyplot.savefig(os.path.join(args.out_dir, outfile), dpi=240)
# plot variances
pyplot.figure(figsize=(max(1,round(L/3.)),max(1, round(K/3.))))
print (L/3,K/3.)
pyplot.imshow(args.variances.astype(sp.float64), interpolation='nearest', aspect='auto',
vmin=0, vmax=args.variances.max(), cmap='OrRd', origin='lower')
for k in range(K):
for l in range(L):
pyplot.text(l, k, '%.1f' % (args.variances[k,l]), horizontalalignment='center', verticalalignment='center', fontsize=5)
pyplot.yticks(sp.arange(K), sp.arange(K)+1)
pyplot.gca().set_yticks(sp.arange(K)+.5, minor=True)
pyplot.xticks(sp.arange(L), valid_marks, rotation=30, horizontalalignment='right')
pyplot.gca().set_xticks(sp.arange(L)+.5, minor=True)
pyplot.grid(which='minor', alpha=.2)
for line in pyplot.gca().yaxis.get_ticklines() + pyplot.gca().xaxis.get_ticklines() + pyplot.gca().xaxis.get_ticklines(minor=True) + pyplot.gca().yaxis.get_ticklines(minor=True):
# label is a Text instance
line.set_markersize(0)
pyplot.ylabel('Hidden State')
pyplot.title("Emission Variance")
#b = pyplot.colorbar(shrink=.7)
#b.set_label("Probability")
outfile = (args.out_params + '_it{iteration}.png').format(param='emission_variances', **args.__dict__)
pyplot.savefig(os.path.join(args.out_dir, outfile), dpi=240)
else:
matplotlib.rcParams['font.size'] = 8
pyplot.figure(figsize=(max(1,round(L/3.)),max(1, round(K/3.))))
print (L/3,K/3.)
pyplot.imshow(args.emit_probs.astype(sp.float64), interpolation='nearest', aspect='auto',
vmin=0, vmax=1, cmap='OrRd', origin='lower')
for k in range(K):
for l in range(L):
pyplot.text(l, k, '%2.0f' % (args.emit_probs[k,l] * 100), horizontalalignment='center', verticalalignment='center')
pyplot.yticks(sp.arange(K), sp.arange(K)+1)
pyplot.gca().set_yticks(sp.arange(K)+.5, minor=True)
pyplot.xticks(sp.arange(L), valid_marks, rotation=30, horizontalalignment='right')
pyplot.gca().set_xticks(sp.arange(L)+.5, minor=True)
pyplot.grid(which='minor', alpha=.2)
for line in pyplot.gca().yaxis.get_ticklines() + pyplot.gca().xaxis.get_ticklines() + pyplot.gca().xaxis.get_ticklines(minor=True) + pyplot.gca().yaxis.get_ticklines(minor=True):
# label is a Text instance
line.set_markersize(0)
pyplot.ylabel('Hidden State')
pyplot.title("Emission probabilities")
#b = pyplot.colorbar(shrink=.7)
#b.set_label("Probability")
outfile = (args.out_params + '_it{iteration}.png').format(param='emission', **args.__dict__)
pyplot.savefig(os.path.join(args.out_dir, outfile), dpi=240)
#broad_paper_enrichment = sp.array([[16,2,2,6,17,93,99,96,98,2],
# [12,2,6,9,53,94,95,14,44,1],
# [13,72,0,9,48,78,49,1,10,1],
# [11,1,15,11,96,99,75,97,86,4],
# [5,0,10,3,88,57,5,84,25,1],
# [7,1,1,3,58,75,8,6,5,1],
# [2,1,2,1,56,3,0,6,2,1],
# [92,2,1,3,6,3,0,0,1,1],
# [5,0,43,43,37,11,2,9,4,1],
# [1,0,47,3,0,0,0,0,0,1],
# [0,0,3,2,0,0,0,0,0,0],
# [1,27,0,2,0,0,0,0,0,0],
# [0,0,0,0,0,0,0,0,0,0],
# [22,28,19,41,6,5,26,5,13,37],
# [85,85,91,88,76,77,91,73,85,78],
# [float('nan'), float('nan'),float('nan'),float('nan'),float('nan'),float('nan'),float('nan'),float('nan'),float('nan'),float('nan')]
# ]) / 100.
#mapping_from_broad = dict(zip(range(K), (5,2,0,14,4,6,9,1,12,-1,3,12,8,7,10,12,11,13)))
#broad_paper_enrichment = broad_paper_enrichment[tuple(mapping_from_broad[i] for i in range(K)), :]
#broad_names = ['Active promoter', 'Weak promoter', 'Inactive/poised promoter', 'Strong enhancer',
# 'Strong enhancer', 'weak/poised enhancer', 'Weak/poised enhancer', 'Insulator',
# 'Transcriptional transition', 'Transcriptional elongation', 'Weak transcribed',
# 'Polycomb repressed', 'Heterochrom; low signal', 'Repetitive/CNV', 'Repetitive/CNV',
# 'NA', 'NA', 'NA']
#pyplot.figure(figsize=(L/3,K/3.))
#print (L/3,K/3.)
#pyplot.imshow(broad_paper_enrichment, interpolation='nearest', aspect='auto',
# vmin=0, vmax=1, cmap='OrRd', origin='lower')
#for k in range(K):
# for l in range(L):
# pyplot.text(l, k, '%2.0f' % (broad_paper_enrichment[k,l] * 100), horizontalalignment='center', verticalalignment='center')
# pyplot.text(L, k, broad_names[mapping_from_broad[k]], horizontalalignment='left', verticalalignment='center', fontsize=6)
#pyplot.yticks(sp.arange(K), sp.arange(K)+1)
#pyplot.gca().set_yticks(sp.arange(K)+.5, minor=True)
#pyplot.xticks(sp.arange(L), valid_marks, rotation=30, horizontalalignment='right')
#pyplot.gca().set_xticks(sp.arange(L)+.5, minor=True)
#pyplot.grid(which='minor', alpha=.2)
#for line in pyplot.gca().yaxis.get_ticklines() + pyplot.gca().xaxis.get_ticklines() + pyplot.gca().xaxis.get_ticklines(minor=True) + pyplot.gca().yaxis.get_ticklines(minor=True):
## label is a Text instance
# line.set_markersize(0)
#pyplot.ylabel('Hidden State')
#pyplot.title("Broad paper Emission probabilities")
##b = pyplot.colorbar(shrink=.7)
##b.set_label("Probability")
#pyplot.subplots_adjust(right=.7)
#outfile = (args.out_params + '_broadpaper.png').format(param='emission', **args.__dict__)
#pyplot.savefig(os.path.join(args.out_dir, outfile), dpi=240)
pyplot.close('all')
sp.seterr(**old_err)
matplotlib.rcParams['font.size'] = oldsize
| 54.981081
| 198
| 0.610185
| 2,847
| 20,343
| 4.260625
| 0.114858
| 0.034295
| 0.032646
| 0.016488
| 0.75202
| 0.74155
| 0.735697
| 0.72399
| 0.699918
| 0.67263
| 0
| 0.035268
| 0.213882
| 20,343
| 369
| 199
| 55.130081
| 0.723237
| 0.239788
| 0
| 0.565574
| 0
| 0
| 0.086676
| 0.001907
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.02459
| null | null | 0.02459
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
cd10088b4df690e09f5f3aea8d6da487237c16c4
| 5,202
|
py
|
Python
|
src/drf_cloudstorage/tests.py
|
inabhi9/drf-cloudstorage
|
7f5e1b1e721208c5682f1f1e443a13af73d039bc
|
[
"MIT"
] | null | null | null |
src/drf_cloudstorage/tests.py
|
inabhi9/drf-cloudstorage
|
7f5e1b1e721208c5682f1f1e443a13af73d039bc
|
[
"MIT"
] | null | null | null |
src/drf_cloudstorage/tests.py
|
inabhi9/drf-cloudstorage
|
7f5e1b1e721208c5682f1f1e443a13af73d039bc
|
[
"MIT"
] | null | null | null |
import os
import tempfile
from django.test import TestCase
from rest_framework import status
from example.models import Example
class CloudinaryTestCase(TestCase):
ENDPOINT = '/cloudfiles'
def test_create(self):
f = open(os.path.dirname(__file__) + '/fixtures/sample.jpg', 'rb')
data = {
'file': f,
'target': 'example.Example.image_file',
}
resp = self.client.post(self.ENDPOINT, data=data, format='multipart')
self.assertEqual(resp.status_code, status.HTTP_201_CREATED, resp.data)
def test_create_invalid_mime(self):
f = open(os.path.dirname(__file__) + '/fixtures/sample.txt', 'rb')
data = {
'file': f,
'target': 'example.Example.image_file'
}
resp = self.client.post(self.ENDPOINT, data=data, format='multipart')
self.assertEqual(resp.status_code, status.HTTP_400_BAD_REQUEST, resp.data)
def test_create_when_not_mime_defined(self):
f = self._get_file_with_size(1 * 1024 * 1024, suffix='.random')
data = {
'file': f,
'target': 'example.Example.all_file',
}
resp = self.client.post(self.ENDPOINT, data=data, format='multipart')
self.assertEqual(resp.status_code, status.HTTP_201_CREATED, resp.data)
def test_create_invalid_filesize(self):
f = self._get_file_with_size(3 * 1024 * 1024)
data = {
'file': f,
'target': 'example.Example.image_file',
}
resp = self.client.post(self.ENDPOINT, data=data, format='multipart')
self.assertEqual(resp.status_code, status.HTTP_400_BAD_REQUEST, resp.data)
def test_link_file(self):
f = open(os.path.dirname(__file__) + '/fixtures/sample.jpg', 'rb')
data = {
'file': f,
'target': 'example.Example.image_file',
}
resp = self.client.post(self.ENDPOINT, data=data, format='multipart')
_id = resp.data['id']
resp = self.client.post('/examples', data={'image_file': _id})
print(resp.data)
self.assertEqual(resp.status_code, status.HTTP_201_CREATED)
def test_create_many_to_many_files(self):
f = open(os.path.dirname(__file__) + '/fixtures/sample.jpg', 'rb')
data = {
'file': f,
'target': 'example.Example.attachments',
}
resp = self.client.post(self.ENDPOINT, data=data, format='multipart')
_id = resp.data['id']
resp = self.client.post('/examples', data={'attachments': [_id]}, format='json')
print(resp.data)
self.assertEqual(resp.status_code, status.HTTP_201_CREATED)
def test_create_many_to_many_files_invalid_file_size(self):
f = self._get_file_with_size(3 * 1024 * 1024)
data = {
'file': f,
'target': 'example.Example.attachments',
}
resp = self.client.post(self.ENDPOINT, data=data, format='multipart')
self.assertEqual(resp.status_code, status.HTTP_400_BAD_REQUEST, resp.data)
def test_back_link_foreign_key(self):
""" Ensures when target object id is provided, it populate target model field """
example = Example.objects.create(all_file=None, image_file=None)
f = self._get_image_file()
data = {
'file': f,
'target': 'example.Example.image_file',
'object_id': example.id
}
resp = self.client.post(self.ENDPOINT, data=data, format='multipart')
example.refresh_from_db()
self.assertIsNotNone(example.image_file)
self.assertEqual(example.image_file.id, resp.data['id'])
self.assertEqual(resp.status_code, status.HTTP_201_CREATED, resp.data)
def test_back_link_many_to_many_key(self):
""" Ensures when object id is provided, it populate target model many to many field """
example = Example.objects.create(all_file=None, image_file=None)
f = self._get_image_file()
data = {
'file': f,
'target': 'example.Example.attachments',
'object_id': example.id
}
resp = self.client.post(self.ENDPOINT, data=data, format='multipart')
example.refresh_from_db()
self.assertGreater(example.attachments.count(), 0)
self.assertEqual(list(example.attachments.values_list('id', flat=True)), [resp.data['id']])
self.assertEqual(resp.status_code, status.HTTP_201_CREATED, resp.data)
def test_back_link_invalid_foreign_key(self):
f = self._get_image_file()
data = {
'file': f,
'target': 'example.Example.attachments',
'object_id': 0
}
resp = self.client.post(self.ENDPOINT, data=data, format='multipart')
self.assertEqual(resp.status_code, status.HTTP_400_BAD_REQUEST, resp.data)
def _get_file_with_size(self, filesize, suffix='.jpg'):
t = tempfile.NamedTemporaryFile(suffix=suffix)
t.seek(filesize - 1)
t.write(b"\0")
t.seek(0)
return t
def _get_image_file(self):
return open(os.path.dirname(__file__) + '/fixtures/sample.jpg', 'rb')
| 32.111111
| 99
| 0.620915
| 639
| 5,202
| 4.820031
| 0.153365
| 0.040909
| 0.054545
| 0.07013
| 0.782792
| 0.780844
| 0.768831
| 0.761039
| 0.732792
| 0.706818
| 0
| 0.015885
| 0.249712
| 5,202
| 161
| 100
| 32.310559
| 0.773251
| 0.029604
| 0
| 0.589286
| 0
| 0
| 0.1323
| 0.052046
| 0
| 0
| 0
| 0
| 0.125
| 1
| 0.107143
| false
| 0
| 0.044643
| 0.008929
| 0.1875
| 0.017857
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
cd534556ec5ec23a6124b26f8bfb0518bdaf5f5e
| 40
|
py
|
Python
|
checker/automaticallyRunChecks.py
|
1adog1/eve-overseer
|
c678f34f46e519728c320a7af6031480c500af03
|
[
"MIT"
] | null | null | null |
checker/automaticallyRunChecks.py
|
1adog1/eve-overseer
|
c678f34f46e519728c320a7af6031480c500af03
|
[
"MIT"
] | null | null | null |
checker/automaticallyRunChecks.py
|
1adog1/eve-overseer
|
c678f34f46e519728c320a7af6031480c500af03
|
[
"MIT"
] | 1
|
2020-04-17T12:16:14.000Z
|
2020-04-17T12:16:14.000Z
|
import checker
checker.automateChecks()
| 13.333333
| 24
| 0.85
| 4
| 40
| 8.5
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.075
| 40
| 3
| 24
| 13.333333
| 0.918919
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
26961adde01a7fa398cb2cbcf3e88131da7d18a2
| 52
|
py
|
Python
|
pytools/modules/succulentquery/__init__.py
|
maopucheng/pytools
|
7d42b0fb1ef539559d931db7b70ef6725d32617a
|
[
"MIT"
] | 757
|
2018-08-25T07:59:26.000Z
|
2021-12-20T12:44:11.000Z
|
pytools/modules/succulentquery/__init__.py
|
junyang-zhou/pytools
|
eca4dbace589ba74a95628d1c285e75e20ea7d1e
|
[
"MIT"
] | 7
|
2020-02-19T00:42:44.000Z
|
2021-09-04T07:42:51.000Z
|
pytools/modules/succulentquery/__init__.py
|
junyang-zhou/pytools
|
eca4dbace589ba74a95628d1c285e75e20ea7d1e
|
[
"MIT"
] | 485
|
2018-08-25T13:53:51.000Z
|
2021-12-21T05:11:08.000Z
|
'''初始化'''
from .succulentquery import SucculentQuery
| 26
| 42
| 0.788462
| 5
| 52
| 8.2
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.076923
| 52
| 2
| 42
| 26
| 0.854167
| 0.057692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
26a52c7297e918da1edc26fc2c29aab2050f7dd9
| 59
|
py
|
Python
|
src/gui.py
|
ieuan-jones/pytafl
|
731b9ec771074ccd3b2a6341bd823e6789b752ad
|
[
"MIT"
] | null | null | null |
src/gui.py
|
ieuan-jones/pytafl
|
731b9ec771074ccd3b2a6341bd823e6789b752ad
|
[
"MIT"
] | null | null | null |
src/gui.py
|
ieuan-jones/pytafl
|
731b9ec771074ccd3b2a6341bd823e6789b752ad
|
[
"MIT"
] | null | null | null |
class Button:
def __init__(self,pos,size):
pass
| 19.666667
| 32
| 0.627119
| 8
| 59
| 4.125
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.271186
| 59
| 3
| 33
| 19.666667
| 0.767442
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0.333333
| 0
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
26b6ea5d100e0a9ba888bab2fd97ebc25f28cf49
| 20
|
py
|
Python
|
noisefilter/noisefilter/__init__.py
|
itsMagondu/IoTNeuralNetworks
|
7ba2098866966a55541019028b16301cfcf94b6b
|
[
"MIT"
] | null | null | null |
noisefilter/noisefilter/__init__.py
|
itsMagondu/IoTNeuralNetworks
|
7ba2098866966a55541019028b16301cfcf94b6b
|
[
"MIT"
] | 1
|
2021-06-11T04:40:55.000Z
|
2021-06-11T04:40:55.000Z
|
noisefilter/noisefilter/__init__.py
|
itsMagondu/IoTNeuralNetworks
|
7ba2098866966a55541019028b16301cfcf94b6b
|
[
"MIT"
] | null | null | null |
""" noisefilter """
| 10
| 19
| 0.55
| 1
| 20
| 11
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15
| 20
| 1
| 20
| 20
| 0.647059
| 0.55
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
f850feff3f34420b62de781bbba05ac0aa56b492
| 125
|
py
|
Python
|
match/admin.py
|
AerysNan/ChallengeHub
|
3ddf1131a01149c2589ef63130deee19030857db
|
[
"MIT"
] | 1
|
2020-09-17T02:05:38.000Z
|
2020-09-17T02:05:38.000Z
|
match/admin.py
|
youkaichao/ChallengeHub
|
3ddf1131a01149c2589ef63130deee19030857db
|
[
"MIT"
] | null | null | null |
match/admin.py
|
youkaichao/ChallengeHub
|
3ddf1131a01149c2589ef63130deee19030857db
|
[
"MIT"
] | 1
|
2019-01-04T07:55:34.000Z
|
2019-01-04T07:55:34.000Z
|
from django.contrib import admin
from match.models import Message
# Register your models here.
admin.site.register(Message)
| 20.833333
| 32
| 0.816
| 18
| 125
| 5.666667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12
| 125
| 5
| 33
| 25
| 0.927273
| 0.208
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
f8545fe4c29c010dd056baed2299f2bb08e0de25
| 1,968
|
py
|
Python
|
AudioSeparator/test_train.py
|
EnriqueNueve/RickSage
|
e85c887df254bd82a69c784db1b91a4afb5863cf
|
[
"MIT"
] | null | null | null |
AudioSeparator/test_train.py
|
EnriqueNueve/RickSage
|
e85c887df254bd82a69c784db1b91a4afb5863cf
|
[
"MIT"
] | null | null | null |
AudioSeparator/test_train.py
|
EnriqueNueve/RickSage
|
e85c887df254bd82a69c784db1b91a4afb5863cf
|
[
"MIT"
] | null | null | null |
# python3 test_train.py
#########################################
#///////////////////////////////////////#
#########################################
import unittest
import argparse, yaml
from train import *
from model import *
from data import *
#########################################
#///////////////////////////////////////#
#########################################
class TestTrain(unittest.TestCase):
def setUp(self):
self.AUTOTUNE = tf.data.experimental.AUTOTUNE
def tearDown(self):
pass
def test_fuss_train_rha(self):
configs = get_configs(yaml_test_overide='configs/rha_train_default.yaml')
# Get fuss dataset
dataset = getData(configs,self.AUTOTUNE,"eval")
for sample in dataset.take(1):
mix_data, source = sample
self.assertEqual(mix_data.shape,(configs['batch_size'],79872))
self.assertEqual(source.shape,(configs['batch_size'],4,79872))
# Get model
model = getModel(configs,print_model=False)
# Train
history = model.fit(mix_data, source, epochs=configs['epochs'],batch_size=configs['batch_size'],verbose=0)
def test_fuss_train_dm_rha(self):
configs = get_configs(yaml_test_overide='configs/rha_train_dm_default.yaml')
# Get fuss dataset
dataset = getData(configs,self.AUTOTUNE,"train")
for sample in dataset.take(1):
mix_data, source = sample
self.assertEqual(mix_data.shape,(configs['batch_size'],79872))
self.assertEqual(source.shape,(configs['batch_size'],4,79872))
# Get model
model = getModel(configs,print_model=False)
# Train
history = model.fit(mix_data, source, epochs=configs['epochs'],batch_size=configs['batch_size'],verbose=0)
#########################################
#///////////////////////////////////////#
#########################################
if __name__ == "__main__":
unittest.main()
| 28.114286
| 114
| 0.53811
| 200
| 1,968
| 5.08
| 0.28
| 0.070866
| 0.094488
| 0.082677
| 0.744094
| 0.744094
| 0.744094
| 0.744094
| 0.744094
| 0.744094
| 0
| 0.01676
| 0.181402
| 1,968
| 69
| 115
| 28.521739
| 0.613904
| 0.103659
| 0
| 0.4
| 0
| 0
| 0.101064
| 0.041888
| 0
| 0
| 0
| 0
| 0.133333
| 1
| 0.133333
| false
| 0.033333
| 0.166667
| 0
| 0.333333
| 0.066667
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
f85d55264bb52629b331992f52d03d6cecbbf217
| 725
|
py
|
Python
|
delegaracesso.py
|
andrezzadede/Curso-de-Python-POO
|
7b3f892b78271e53543451e2896da5e47e79f87f
|
[
"MIT"
] | null | null | null |
delegaracesso.py
|
andrezzadede/Curso-de-Python-POO
|
7b3f892b78271e53543451e2896da5e47e79f87f
|
[
"MIT"
] | null | null | null |
delegaracesso.py
|
andrezzadede/Curso-de-Python-POO
|
7b3f892b78271e53543451e2896da5e47e79f87f
|
[
"MIT"
] | null | null | null |
#Delegar acesso a atributos
class A:
def fazer_algo(self):
pass
def outro_metodo(self):
pass
def algum_metodo(self, nome):
print(nome)
class B:
def __init__(self):
self.a = A() # Instancia da classe A
def fazer_algo(self):
#delega para self.a
return self.a.fazer_algo() # Ele vai pergar o fazer algo da classe A
def outro_metodo(self):
#delega para self.a
return self.a.outro_metodo()
def __getattr__(self, nome):
return getattr(self.a, nome)
b = B()
b.fazer_algo() #Chama B.fazer_algo() (existe em B)
b.algum_metodo('Python') # chama B.__getattr__('algum metodo) e delega para a A.algum_metodo
| 20.138889
| 92
| 0.613793
| 107
| 725
| 3.943925
| 0.308411
| 0.127962
| 0.042654
| 0.061611
| 0.21327
| 0.14218
| 0.14218
| 0.14218
| 0
| 0
| 0
| 0
| 0.285517
| 725
| 35
| 93
| 20.714286
| 0.814672
| 0.308966
| 0
| 0.315789
| 0
| 0
| 0.012146
| 0
| 0
| 0
| 0
| 0.028571
| 0
| 1
| 0.368421
| false
| 0.105263
| 0
| 0.157895
| 0.631579
| 0.052632
| 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
| 1
| 0
| 1
| 1
| 0
|
0
| 5
|
f86d71130aa992920060b06273ff8b7548ec9176
| 558
|
py
|
Python
|
data/test/python/f86d71130aa992920060b06273ff8b7548ec9176fabfile.py
|
harshp8l/deep-learning-lang-detection
|
2a54293181c1c2b1a2b840ddee4d4d80177efb33
|
[
"MIT"
] | 84
|
2017-10-25T15:49:21.000Z
|
2021-11-28T21:25:54.000Z
|
data/test/python/f86d71130aa992920060b06273ff8b7548ec9176fabfile.py
|
vassalos/deep-learning-lang-detection
|
cbb00b3e81bed3a64553f9c6aa6138b2511e544e
|
[
"MIT"
] | 5
|
2018-03-29T11:50:46.000Z
|
2021-04-26T13:33:18.000Z
|
data/test/python/f86d71130aa992920060b06273ff8b7548ec9176fabfile.py
|
vassalos/deep-learning-lang-detection
|
cbb00b3e81bed3a64553f9c6aa6138b2511e544e
|
[
"MIT"
] | 24
|
2017-11-22T08:31:00.000Z
|
2022-03-27T01:22:31.000Z
|
from fabric.api import local
def test():
local('./manage.py test business', capture=False)
local('./manage.py test common', capture=False)
local('./manage.py test ecommerce', capture=False)
local('./manage.py test invoices', capture=False)
local('./manage.py test orders', capture=False)
local('./manage.py test party', capture=False)
local('./manage.py test products', capture=False)
def package():
local('tar -cv --exclude-vcs --exclude build --exclude-backups -f /tmp/bizondemand.tgz .', capture=False)
def prepare_deploy():
test()
package()
| 31
| 106
| 0.713262
| 78
| 558
| 5.089744
| 0.397436
| 0.241814
| 0.229219
| 0.299748
| 0.438287
| 0.438287
| 0
| 0
| 0
| 0
| 0
| 0
| 0.112903
| 558
| 17
| 107
| 32.823529
| 0.80202
| 0
| 0
| 0
| 0
| 0.071429
| 0.448029
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.214286
| true
| 0
| 0.071429
| 0
| 0.285714
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
f89441ba9204ea1f7de2a148a011cbac28dc3bcd
| 200
|
py
|
Python
|
code/gameConfig.py
|
Majowicz24/Discord-MiniCasinoBot
|
73f40d186e00c4819e3ac782580d0803fcac226f
|
[
"MIT"
] | 1
|
2021-08-18T19:32:15.000Z
|
2021-08-18T19:32:15.000Z
|
code/gameConfig.py
|
Majowicz24/Discord-MiniCasinoBot
|
73f40d186e00c4819e3ac782580d0803fcac226f
|
[
"MIT"
] | 4
|
2021-08-09T17:33:24.000Z
|
2021-08-18T18:27:06.000Z
|
code/gameConfig.py
|
Majowicz24/Discord-MiniCasinoBot
|
73f40d186e00c4819e3ac782580d0803fcac226f
|
[
"MIT"
] | 1
|
2021-09-01T22:40:20.000Z
|
2021-09-01T22:40:20.000Z
|
import discord
from discord.ext import commands
PREFIX = '-'
bot = commands.Bot(command_prefix=PREFIX, description="Gambling Bot")
client = commands.Bot(command_prefix="-")
TOKEN = 'YOUR_TOKEN_HERE'
| 25
| 69
| 0.77
| 26
| 200
| 5.769231
| 0.538462
| 0.146667
| 0.24
| 0.32
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105
| 200
| 7
| 70
| 28.571429
| 0.837989
| 0
| 0
| 0
| 0
| 0
| 0.145
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
f8c001699ac4364b63b80d86400212dd7f3d050d
| 74
|
py
|
Python
|
py_tdlib/constructors/call_discard_reason_declined.py
|
Mr-TelegramBot/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 24
|
2018-10-05T13:04:30.000Z
|
2020-05-12T08:45:34.000Z
|
py_tdlib/constructors/call_discard_reason_declined.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 3
|
2019-06-26T07:20:20.000Z
|
2021-05-24T13:06:56.000Z
|
py_tdlib/constructors/call_discard_reason_declined.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 5
|
2018-10-05T14:29:28.000Z
|
2020-08-11T15:04:10.000Z
|
from ..factory import Type
class callDiscardReasonDeclined(Type):
pass
| 12.333333
| 38
| 0.797297
| 8
| 74
| 7.375
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.135135
| 74
| 5
| 39
| 14.8
| 0.921875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.333333
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
|
0
| 5
|
6ef5de448c4076a5ac6ad4d5dc872cb0503d0344
| 155
|
py
|
Python
|
python/dynamic_graph/sot/torque_control/talos/base_estimator_sim_conf.py
|
Hugo-L3174/talos-torque-control
|
14faafcc06c93b57c972e92c1684b006667ff32e
|
[
"BSD-2-Clause"
] | 3
|
2020-06-12T15:36:32.000Z
|
2021-04-07T20:12:11.000Z
|
python/dynamic_graph/sot/torque_control/talos/base_estimator_sim_conf.py
|
Hugo-L3174/talos-torque-control
|
14faafcc06c93b57c972e92c1684b006667ff32e
|
[
"BSD-2-Clause"
] | 5
|
2018-07-20T08:22:37.000Z
|
2020-07-31T14:41:42.000Z
|
python/dynamic_graph/sot/torque_control/talos/base_estimator_sim_conf.py
|
Hugo-L3174/talos-torque-control
|
14faafcc06c93b57c972e92c1684b006667ff32e
|
[
"BSD-2-Clause"
] | 4
|
2018-07-02T12:34:53.000Z
|
2020-05-25T12:46:28.000Z
|
''' *********************** USER-PARAMETERS OF BASE ESTIMATOR *********************** '''
from base_estimator_conf import *
K = 6*(1e7,);
| 51.666667
| 89
| 0.406452
| 13
| 155
| 4.692308
| 0.846154
| 0.42623
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02439
| 0.206452
| 155
| 3
| 90
| 51.666667
| 0.471545
| 0.522581
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
6ef874652e34bc1300e64b7e295a9ce2cc3b5f6e
| 810
|
py
|
Python
|
sdk/turing/generated/__init__.py
|
LeonLnj/turing
|
93817f5cfb40d056a707bd85e9265b5cafdaeb94
|
[
"Apache-2.0"
] | 57
|
2020-10-21T10:36:11.000Z
|
2022-03-11T17:50:25.000Z
|
sdk/turing/generated/__init__.py
|
LeonLnj/turing
|
93817f5cfb40d056a707bd85e9265b5cafdaeb94
|
[
"Apache-2.0"
] | 82
|
2020-10-21T08:24:51.000Z
|
2022-03-31T07:08:29.000Z
|
sdk/turing/generated/__init__.py
|
LeonLnj/turing
|
93817f5cfb40d056a707bd85e9265b5cafdaeb94
|
[
"Apache-2.0"
] | 18
|
2020-10-21T08:07:50.000Z
|
2022-03-20T18:20:54.000Z
|
# flake8: noqa
"""
Turing Minimal Openapi Spec for SDK
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 0.0.1
Generated by: https://openapi-generator.tech
"""
__version__ = "1.0.0"
# import ApiClient
from turing.generated.api_client import ApiClient
# import Configuration
from turing.generated.configuration import Configuration
# import exceptions
from turing.generated.exceptions import OpenApiException
from turing.generated.exceptions import ApiAttributeError
from turing.generated.exceptions import ApiTypeError
from turing.generated.exceptions import ApiValueError
from turing.generated.exceptions import ApiKeyError
from turing.generated.exceptions import ApiException
| 28.928571
| 124
| 0.811111
| 97
| 810
| 6.721649
| 0.402062
| 0.122699
| 0.233129
| 0.266871
| 0.322086
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014104
| 0.124691
| 810
| 27
| 125
| 30
| 0.905501
| 0.390123
| 0
| 0
| 1
| 0
| 0.010707
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.888889
| 0
| 0.888889
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
3e0910c87bea2b35c57a2b52d8ff6de79bb278b0
| 239
|
py
|
Python
|
floppyforms/tests/models.py
|
osmeld/Django
|
62e7d1bf20b1f80b6b278c4df0913ca0ec179ede
|
[
"BSD-3-Clause"
] | 3
|
2019-07-15T17:14:38.000Z
|
2021-01-21T12:20:32.000Z
|
floppyforms/tests/models.py
|
osmeld/Django
|
62e7d1bf20b1f80b6b278c4df0913ca0ec179ede
|
[
"BSD-3-Clause"
] | 1
|
2021-02-24T01:27:08.000Z
|
2021-02-24T01:27:08.000Z
|
floppyforms/tests/models.py
|
osmeld/Django
|
62e7d1bf20b1f80b6b278c4df0913ca0ec179ede
|
[
"BSD-3-Clause"
] | 5
|
2017-12-28T04:31:02.000Z
|
2021-01-07T09:14:36.000Z
|
from django.db import models
class Registration(models.Model):
firstname = models.CharField(max_length=50)
lastname = models.CharField(max_length=50)
username = models.CharField(max_length=50)
age = models.IntegerField()
| 26.555556
| 47
| 0.748954
| 30
| 239
| 5.866667
| 0.566667
| 0.255682
| 0.306818
| 0.409091
| 0.443182
| 0
| 0
| 0
| 0
| 0
| 0
| 0.029557
| 0.150628
| 239
| 8
| 48
| 29.875
| 0.837438
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.166667
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
3e204e42cd8e71566058ad55b8c27e6a9d6326e4
| 122
|
py
|
Python
|
ai_handlers/predictions_handler.py
|
iyuvalk/pensu
|
66a5ccd72712d04af8221505e775422d24d03a91
|
[
"MIT"
] | null | null | null |
ai_handlers/predictions_handler.py
|
iyuvalk/pensu
|
66a5ccd72712d04af8221505e775422d24d03a91
|
[
"MIT"
] | null | null | null |
ai_handlers/predictions_handler.py
|
iyuvalk/pensu
|
66a5ccd72712d04af8221505e775422d24d03a91
|
[
"MIT"
] | null | null | null |
class PredictionsHandler:
def __init__(self):
pass
def get_prediction(self, current_value):
pass
| 17.428571
| 44
| 0.655738
| 13
| 122
| 5.692308
| 0.769231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.278689
| 122
| 6
| 45
| 20.333333
| 0.840909
| 0
| 0
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0.4
| 0
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
3e355616ec0dc8b59e8bd89f1a22a76a4660cb94
| 140
|
py
|
Python
|
topside/plumbing/exceptions.py
|
roguextech/Waterloo-Rocketry-topside
|
345e7d47efdac04c2c5f70d55f83bd77acdbb511
|
[
"MIT"
] | 4
|
2020-04-18T00:40:55.000Z
|
2021-06-10T04:04:09.000Z
|
topside/plumbing/exceptions.py
|
roguextech/Waterloo-Rocketry-topside
|
345e7d47efdac04c2c5f70d55f83bd77acdbb511
|
[
"MIT"
] | 82
|
2020-04-15T21:26:04.000Z
|
2022-02-04T04:50:07.000Z
|
topside/plumbing/exceptions.py
|
roguextech/Waterloo-Rocketry-topside
|
345e7d47efdac04c2c5f70d55f83bd77acdbb511
|
[
"MIT"
] | 8
|
2020-04-21T17:54:36.000Z
|
2022-02-28T16:14:21.000Z
|
class BadInputError(Exception):
pass
class InvalidComponentError(Exception):
pass
class InvalidEngineError(Exception):
pass
| 12.727273
| 39
| 0.757143
| 12
| 140
| 8.833333
| 0.5
| 0.367925
| 0.339623
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.178571
| 140
| 10
| 40
| 14
| 0.921739
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
3e4cdad77c1985db2cf3723016c172ffd4977e46
| 68
|
py
|
Python
|
pydbrepo/helpers/sqlite/__init__.py
|
danteay/pydbrepo
|
665ad5fe64a00697128f9943e0fc831ae485f136
|
[
"MIT"
] | 2
|
2021-09-03T10:54:01.000Z
|
2022-01-08T18:48:20.000Z
|
pydbrepo/helpers/sqlite/__init__.py
|
danteay/pydbrepo
|
665ad5fe64a00697128f9943e0fc831ae485f136
|
[
"MIT"
] | null | null | null |
pydbrepo/helpers/sqlite/__init__.py
|
danteay/pydbrepo
|
665ad5fe64a00697128f9943e0fc831ae485f136
|
[
"MIT"
] | 1
|
2021-12-28T17:34:40.000Z
|
2021-12-28T17:34:40.000Z
|
"""Export resources."""
from .sqlite import last_inserted_id_query
| 17
| 42
| 0.779412
| 9
| 68
| 5.555556
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.102941
| 68
| 3
| 43
| 22.666667
| 0.819672
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
3e6d3aa9d70541a2dc715f5c0bf28456e1e1a128
| 1,216
|
py
|
Python
|
tests/test_detector_configuration.py
|
datascopeanalytics/scrubadub
|
ab199f0b3cc3ca11f646aabb05ebe124d2757ea5
|
[
"Apache-2.0"
] | 190
|
2015-12-03T01:31:36.000Z
|
2020-09-02T23:46:38.000Z
|
tests/test_detector_configuration.py
|
vishalbelsare/scrubadub
|
ab199f0b3cc3ca11f646aabb05ebe124d2757ea5
|
[
"Apache-2.0"
] | 54
|
2020-09-10T14:46:14.000Z
|
2022-03-10T06:03:00.000Z
|
tests/test_detector_configuration.py
|
datascopeanalytics/scrubadub
|
ab199f0b3cc3ca11f646aabb05ebe124d2757ea5
|
[
"Apache-2.0"
] | 57
|
2016-04-04T18:37:38.000Z
|
2020-08-18T22:59:03.000Z
|
import unittest
import catalogue
import scrubadub
import scrubadub.detectors.catalogue
class DetectorConfigTestCase(unittest.TestCase):
def test_register_detector(self):
class NewDetector(scrubadub.detectors.Detector):
name = 'new_detector'
scrubadub.detectors.catalogue.register_detector(NewDetector, autoload=False)
self.assertTrue(NewDetector.name in scrubadub.detectors.catalogue.detector_catalogue)
self.assertFalse(NewDetector.autoload)
self.assertEqual(scrubadub.detectors.catalogue.detector_catalogue.get(NewDetector.name), NewDetector)
scrubadub.detectors.catalogue.remove_detector(NewDetector)
with self.assertRaises(catalogue.RegistryError):
scrubadub.detectors.catalogue.detector_catalogue.get(NewDetector.name)
scrubadub.detectors.catalogue.register_detector(NewDetector, autoload=True)
self.assertTrue(NewDetector.name in scrubadub.detectors.catalogue.detector_catalogue)
self.assertTrue(NewDetector.autoload)
self.assertEqual(scrubadub.detectors.catalogue.detector_catalogue.get(NewDetector.name), NewDetector)
scrubadub.detectors.catalogue.remove_detector(NewDetector)
| 43.428571
| 109
| 0.78125
| 118
| 1,216
| 7.949153
| 0.237288
| 0.211087
| 0.287846
| 0.186567
| 0.705757
| 0.705757
| 0.705757
| 0.573561
| 0.507463
| 0.507463
| 0
| 0
| 0.13898
| 1,216
| 27
| 110
| 45.037037
| 0.895893
| 0
| 0
| 0.3
| 0
| 0
| 0.009868
| 0
| 0
| 0
| 0
| 0
| 0.35
| 1
| 0.05
| false
| 0
| 0.2
| 0
| 0.35
| 0
| 0
| 0
| 0
| null | 1
| 1
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
e420076c766573fe102026eea24ee9f5ebd1398e
| 57
|
py
|
Python
|
FunctionalX/src/TailCallOptimization/__init__.py
|
FunctionalX/FunctionalX.py
|
7ee938c49e0ed8ad30f7adf3c14134987de58c5b
|
[
"MIT"
] | null | null | null |
FunctionalX/src/TailCallOptimization/__init__.py
|
FunctionalX/FunctionalX.py
|
7ee938c49e0ed8ad30f7adf3c14134987de58c5b
|
[
"MIT"
] | null | null | null |
FunctionalX/src/TailCallOptimization/__init__.py
|
FunctionalX/FunctionalX.py
|
7ee938c49e0ed8ad30f7adf3c14134987de58c5b
|
[
"MIT"
] | null | null | null |
from ._Tail import Tail
from ._Recursive import Recursive
| 28.5
| 33
| 0.842105
| 8
| 57
| 5.75
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.122807
| 57
| 2
| 33
| 28.5
| 0.92
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
900629cf1bafd30912e9846583fd78ae0c1ea94f
| 2,519
|
py
|
Python
|
tests/app/brief_utils/test_check_lds.py
|
ArenaNetworks/dto-digitalmarketplace-api
|
d0d58924719d889503ed112b0d5801b528b0398c
|
[
"MIT"
] | 6
|
2017-06-09T03:38:53.000Z
|
2021-12-22T02:42:15.000Z
|
tests/app/brief_utils/test_check_lds.py
|
ArenaNetworks/dto-digitalmarketplace-api
|
d0d58924719d889503ed112b0d5801b528b0398c
|
[
"MIT"
] | 47
|
2016-08-02T05:21:31.000Z
|
2022-03-28T01:14:17.000Z
|
tests/app/brief_utils/test_check_lds.py
|
AusDTO/dto-digitalmarketplace-api
|
937843c9c01a71518cf4688b4daa55bbe7df1965
|
[
"MIT"
] | 7
|
2016-09-13T13:07:18.000Z
|
2021-02-17T10:16:21.000Z
|
from app.brief_utils import check_lds
from app.models import Brief, Lot
def test_when_what_training_and_details_not_set():
brief_data = {
'whatTraining': ['other', 'content design', 'user research']
}
lot = Lot(name='Training', one_service_limit=True)
brief = Brief(lot=lot, data=brief_data)
required_fields = [
'trainingDetailType',
'trainingDetailCover',
'ldsContentDesignProposalOrLds',
'ldsUserResearchProposalOrLds']
errors = check_lds(brief, required_fields)
assert errors is not []
assert len(errors) == len(required_fields)
for c in range(len(errors)):
error = errors[c]
required_field = required_fields[c]
assert error[required_field] == 'answer_required'
def test_when_what_training_and_details_is_set():
brief_data = {
'whatTraining': ['other', 'content design', 'user research'],
'ldsContentDesignProposalOrLds': 'ldsUnits',
'ldsUserResearchProposalOrLds': 'specify',
'trainingDetailType': 'foo',
'trainingDetailCover': 'bar'
}
lot = Lot(name='Training', one_service_limit=True)
brief = Brief(lot=lot, data=brief_data)
required_fields = [
'trainingDetailType',
'trainingDetailCover',
'ldsContentDesignProposalOrLds',
'ldsContentDesignUnits',
'ldsUserResearchProposalOrLds',
'ldsUserResearchTrainingNeeds']
errors = check_lds(brief, required_fields)
assert errors is not []
assert len(errors) == 2
assert errors[0]['ldsContentDesignUnits'] == 'answer_required'
assert errors[1]['ldsUserResearchTrainingNeeds'] == 'answer_required'
def test_when_what_training_and_details_is_all_set():
brief_data = {
'whatTraining': ['other', 'content design', 'user research'],
'ldsContentDesignProposalOrLds': 'ldsUnits',
'ldsContentDesignUnits': ['anything'],
'ldsUserResearchProposalOrLds': 'specify',
'ldsUserResearchTrainingNeeds': 'foo',
'trainingDetailType': 'foo',
'trainingDetailCover': 'bar'
}
lot = Lot(name='Training', one_service_limit=True)
brief = Brief(lot=lot, data=brief_data)
required_fields = [
'trainingDetailType',
'trainingDetailCover',
'ldsContentDesignProposalOrLds',
'ldsContentDesignUnits',
'ldsUserResearchProposalOrLds',
'ldsUserResearchTrainingNeeds']
errors = check_lds(brief, required_fields)
assert len(errors) == 0
| 31.886076
| 73
| 0.670504
| 224
| 2,519
| 7.308036
| 0.258929
| 0.068418
| 0.020159
| 0.027489
| 0.7416
| 0.7416
| 0.7416
| 0.721442
| 0.721442
| 0.688454
| 0
| 0.002026
| 0.216356
| 2,519
| 78
| 74
| 32.294872
| 0.827254
| 0
| 0
| 0.666667
| 0
| 0
| 0.365224
| 0.190949
| 0
| 0
| 0
| 0
| 0.126984
| 1
| 0.047619
| false
| 0
| 0.031746
| 0
| 0.079365
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.