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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5cca422e34c437c692389415e97bb2cb3c5e5a51 | 411 | py | Python | src/config_manager.py | comp-physics/PyQBMMlib | ab53f49bd797b147a75e38bd7b64217940b5af8b | [
"MIT"
] | 4 | 2021-09-27T07:57:37.000Z | 2022-03-26T17:29:53.000Z | src/config_manager.py | sbryngelson/PyQBMMlib | ab53f49bd797b147a75e38bd7b64217940b5af8b | [
"MIT"
] | 2 | 2020-11-18T03:10:14.000Z | 2020-12-13T05:31:19.000Z | src/config_manager.py | comp-physics/PyQBMMlib | ab53f49bd797b147a75e38bd7b64217940b5af8b | [
"MIT"
] | 2 | 2021-09-27T08:00:03.000Z | 2021-11-06T22:00:51.000Z | import yaml
class config_manager:
def __init__(self, config_file):
iret = self.load_config(config_file)
return
def load_config(self, config_file):
print("config_mgr: Loading config from %s" % config_file)
with open(config_file) as cf:
self.config = yaml.load(cf, Loader=yaml.Loader)
return
def get_config(self):
return self.config
| 19.571429 | 65 | 0.63747 | 54 | 411 | 4.592593 | 0.425926 | 0.201613 | 0.112903 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.277372 | 411 | 20 | 66 | 20.55 | 0.835017 | 0 | 0 | 0.166667 | 0 | 0 | 0.082725 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.083333 | 0.083333 | 0.666667 | 0.083333 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
7a20856cf3793b648c2d598e32452552369a91fd | 90 | py | Python | serializer_ext/otree_extensions/admin.py | christianzihlmann/otree_tools | d07aa506322aeb17bebe3b55e283ea66ff6524e9 | [
"MIT"
] | null | null | null | serializer_ext/otree_extensions/admin.py | christianzihlmann/otree_tools | d07aa506322aeb17bebe3b55e283ea66ff6524e9 | [
"MIT"
] | null | null | null | serializer_ext/otree_extensions/admin.py | christianzihlmann/otree_tools | d07aa506322aeb17bebe3b55e283ea66ff6524e9 | [
"MIT"
] | null | null | null | from serializer_ext.views import AllSessionsList
data_export_views = [ AllSessionsList]
| 22.5 | 49 | 0.844444 | 10 | 90 | 7.3 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 90 | 3 | 50 | 30 | 0.9125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7a49b91d90b470d24289c6769ef6f334fb215010 | 164 | py | Python | chap02/list0218.py | ytianjin/GitTest | a657f46098728ad90f7140fadad356e8561c9a7a | [
"MIT"
] | null | null | null | chap02/list0218.py | ytianjin/GitTest | a657f46098728ad90f7140fadad356e8561c9a7a | [
"MIT"
] | null | null | null | chap02/list0218.py | ytianjin/GitTest | a657f46098728ad90f7140fadad356e8561c9a7a | [
"MIT"
] | null | null | null | # 计算圆的周长和面积(其二:用变量表示圆周率)
PI = 3.14159 # 圆周率
r = float(input('半径:'))
print('圆的周长是', 2 * PI * r, '。')
print('面积是', PI * r * r, '。')
| 20.5 | 37 | 0.420732 | 21 | 164 | 3.285714 | 0.714286 | 0.086957 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066038 | 0.353659 | 164 | 7 | 38 | 23.428571 | 0.584906 | 0.170732 | 0 | 0 | 0 | 0 | 0.104839 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
7a5499ac11fadd3aa100fce609f1fc45e2eef655 | 102 | py | Python | src/rpdk/core/__init__.py | mumblepins/cloudformation-cli | 36cbf02f4a588445709b7b6fea32891d169e3246 | [
"Apache-2.0"
] | null | null | null | src/rpdk/core/__init__.py | mumblepins/cloudformation-cli | 36cbf02f4a588445709b7b6fea32891d169e3246 | [
"Apache-2.0"
] | null | null | null | src/rpdk/core/__init__.py | mumblepins/cloudformation-cli | 36cbf02f4a588445709b7b6fea32891d169e3246 | [
"Apache-2.0"
] | null | null | null | import logging
__version__ = "0.2.24"
logging.getLogger(__name__).addHandler(logging.NullHandler())
| 17 | 61 | 0.784314 | 12 | 102 | 6 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042553 | 0.078431 | 102 | 5 | 62 | 20.4 | 0.723404 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7a58aec6e9128ebfcef9ff6743746222a03358a4 | 743 | py | Python | mot/encode/encode.py | linkinpark213/online-mot-by-detection | 3bde45cc68815f84fa73bec816a557349e5a33fd | [
"MIT"
] | null | null | null | mot/encode/encode.py | linkinpark213/online-mot-by-detection | 3bde45cc68815f84fa73bec816a557349e5a33fd | [
"MIT"
] | null | null | null | mot/encode/encode.py | linkinpark213/online-mot-by-detection | 3bde45cc68815f84fa73bec816a557349e5a33fd | [
"MIT"
] | null | null | null | import numpy as np
from typing import List
from abc import ABCMeta, abstractmethod
from mot.utils import Registry
from mot.structures import Detection
__all__ = ['Encoder', 'ENCODER_REGISTRY', 'build_encoder']
ENCODER_REGISTRY = Registry('encoders')
class Encoder(metaclass=ABCMeta):
def __init__(self, name: str = None, **kwargs):
self.name: str = name if name is not None else 'encoding'
def __call__(self, detections: List[Detection], img: np.ndarray) -> List[object]:
return self.encode(detections, img)
@abstractmethod
def encode(self, detections: List[Detection], img: np.ndarray) -> List[object]:
pass
def build_encoder(cfg):
return ENCODER_REGISTRY.get(cfg.type)(**(cfg.to_dict()))
| 27.518519 | 85 | 0.713324 | 97 | 743 | 5.278351 | 0.474227 | 0.087891 | 0.085938 | 0.105469 | 0.191406 | 0.191406 | 0.191406 | 0.191406 | 0.191406 | 0 | 0 | 0 | 0.170929 | 743 | 26 | 86 | 28.576923 | 0.831169 | 0 | 0 | 0 | 0 | 0 | 0.069987 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0.058824 | 0.294118 | 0.117647 | 0.705882 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 |
7a6dcdce1f7488f07a954b1ee715a793d8d97935 | 87 | py | Python | Renter/apps.py | Hyped-247/rp | 9e3c6287ec2a183998f6ddadc20153736bbefaf3 | [
"MIT"
] | null | null | null | Renter/apps.py | Hyped-247/rp | 9e3c6287ec2a183998f6ddadc20153736bbefaf3 | [
"MIT"
] | null | null | null | Renter/apps.py | Hyped-247/rp | 9e3c6287ec2a183998f6ddadc20153736bbefaf3 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class RenterConfig(AppConfig):
name = 'Renter'
| 14.5 | 33 | 0.747126 | 10 | 87 | 6.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172414 | 87 | 5 | 34 | 17.4 | 0.902778 | 0 | 0 | 0 | 0 | 0 | 0.068966 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7a879ef3e64a12dabc771ab62f2b126b48a0b6f4 | 459 | py | Python | tests/test_constants.py | mitchute/Open-GHX | 7a88872c36200c620cfd07994119cfb243a998c9 | [
"MIT"
] | 4 | 2017-10-09T21:08:44.000Z | 2020-11-18T11:09:56.000Z | tests/test_constants.py | mitchute/Open-GHX | 7a88872c36200c620cfd07994119cfb243a998c9 | [
"MIT"
] | 1 | 2017-08-18T01:44:13.000Z | 2017-08-18T02:23:21.000Z | tests/test_constants.py | mitchute/Open-GHX | 7a88872c36200c620cfd07994119cfb243a998c9 | [
"MIT"
] | 3 | 2016-09-08T14:57:21.000Z | 2021-06-29T08:42:08.000Z | import unittest
from ghx.constants import ConstantClass
class TestConstantClass(unittest.TestCase):
def test_init(self):
"""
Test initialization
"""
curr_tst = ConstantClass()
self.assertEqual(curr_tst.months_in_year, 12)
self.assertEqual(curr_tst.hours_in_month, 730)
self.assertEqual(curr_tst.hours_in_year, 8760)
self.assertEqual(curr_tst.celsius_to_kelvin, 273.15)
| 25.5 | 61 | 0.666667 | 53 | 459 | 5.509434 | 0.566038 | 0.119863 | 0.260274 | 0.30137 | 0.19863 | 0.19863 | 0 | 0 | 0 | 0 | 0 | 0.040698 | 0.250545 | 459 | 17 | 62 | 27 | 0.80814 | 0.041394 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | 1 | 0.111111 | false | 0 | 0.222222 | 0 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7a95e2df2e60d6a68d98e43dbdf4420f839b284e | 260 | py | Python | psx/_dump_/17/_dump_ida_/overlay_3/set_vars.py | maoa3/scalpel | 2e7381b516cded28996d290438acc618d00b2aa7 | [
"Unlicense"
] | 15 | 2018-06-28T01:11:25.000Z | 2021-09-27T15:57:18.000Z | psx/_dump_/17/_dump_ida_/overlay_3/set_vars.py | maoa3/scalpel | 2e7381b516cded28996d290438acc618d00b2aa7 | [
"Unlicense"
] | 7 | 2018-06-29T04:08:23.000Z | 2019-10-17T13:57:22.000Z | psx/_dump_/17/_dump_ida_/overlay_3/set_vars.py | maoa3/scalpel | 2e7381b516cded28996d290438acc618d00b2aa7 | [
"Unlicense"
] | 7 | 2018-06-28T01:11:34.000Z | 2020-05-23T09:21:48.000Z | del_items(0x8009E2A0)
SetType(0x8009E2A0, "char StrDate[12]")
del_items(0x8009E2AC)
SetType(0x8009E2AC, "char StrTime[9]")
del_items(0x8009E2B8)
SetType(0x8009E2B8, "char *Words[117]")
del_items(0x8009E48C)
SetType(0x8009E48C, "struct MONTH_DAYS MonDays[12]")
| 28.888889 | 52 | 0.792308 | 34 | 260 | 5.911765 | 0.529412 | 0.159204 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.255144 | 0.065385 | 260 | 8 | 53 | 32.5 | 0.572016 | 0 | 0 | 0 | 0 | 0 | 0.292308 | 0 | 0 | 0 | 0.307692 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7ab56b768fb504770c755e8ce5a1dfb37c4382b7 | 92 | py | Python | config/gunicorn_conf.py | iamjackwachira/wwfh | 74c20a4a5e0a771dfb288714602aece789330c6c | [
"MIT"
] | null | null | null | config/gunicorn_conf.py | iamjackwachira/wwfh | 74c20a4a5e0a771dfb288714602aece789330c6c | [
"MIT"
] | null | null | null | config/gunicorn_conf.py | iamjackwachira/wwfh | 74c20a4a5e0a771dfb288714602aece789330c6c | [
"MIT"
] | null | null | null | workers = 2
timeout = 120
reload = True
limit_request_field_size = 0
limit_request_line = 0
| 15.333333 | 28 | 0.782609 | 15 | 92 | 4.466667 | 0.8 | 0.358209 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.077922 | 0.163043 | 92 | 5 | 29 | 18.4 | 0.792208 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8fac817fdd8757d3996116011fa7a97b0af11ac1 | 387 | py | Python | examples/views.py | mozillazg/-bustard | bd7b47f3ba5440cf6ea026c8b633060fedeb80b7 | [
"MIT"
] | 55 | 2015-11-05T15:56:38.000Z | 2021-03-30T09:07:01.000Z | examples/views.py | mozillazg/-bustard | bd7b47f3ba5440cf6ea026c8b633060fedeb80b7 | [
"MIT"
] | null | null | null | examples/views.py | mozillazg/-bustard | bd7b47f3ba5440cf6ea026c8b633060fedeb80b7 | [
"MIT"
] | 6 | 2016-02-26T19:23:58.000Z | 2018-01-10T03:27:34.000Z | # -*- coding: utf-8 -*-
from bustard.app import Bustard
from bustard.views import View
app = Bustard(__name__)
class IndexView(View):
def get(self, request, name):
return name
def post(self, request, name):
return '{} post'.format(name)
app.add_url_rule('/hello/(?P<name>\w+)', IndexView.as_view())
if __name__ == '__main__':
app.run(host='0.0.0.0')
| 17.590909 | 61 | 0.635659 | 56 | 387 | 4.125 | 0.553571 | 0.025974 | 0.12987 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016026 | 0.193798 | 387 | 21 | 62 | 18.428571 | 0.724359 | 0.054264 | 0 | 0 | 0 | 0 | 0.115385 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.181818 | 0.181818 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
8fbdaf17beaeb531ba3c6ae3e82abbbaaadda3ee | 544 | py | Python | Dataset/Leetcode/train/3/596.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/3/596.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/3/596.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | class Solution:
def XXX(self, s: str) -> int:
tmp_list = []
max_len = 0
for i in range(len(s)):
if s[i] not in tmp_list:
tmp_list.append(s[i])
else:
if max_len < len(tmp_list): max_len = len(tmp_list)
ind = tmp_list.index(s[i])
tmp_list = tmp_list[ind+1:]
tmp_list.append(s[i])
if i == len(s) - 1:
if max_len < len(tmp_list): max_len = len(tmp_list)
return max_len
| 30.222222 | 67 | 0.457721 | 79 | 544 | 2.936709 | 0.316456 | 0.331897 | 0.155172 | 0.206897 | 0.422414 | 0.293103 | 0.293103 | 0.293103 | 0.293103 | 0.293103 | 0 | 0.009646 | 0.428309 | 544 | 17 | 68 | 32 | 0.736334 | 0 | 0 | 0.266667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8fe3b06a53ce29ed847642ec954caa7144f33032 | 1,365 | py | Python | tests/test_indexlist.py | D2KLab/sequeval | 71e1b40fa728492bef52a2ec0fb0353dce32602d | [
"MIT"
] | 10 | 2018-09-11T10:32:04.000Z | 2021-12-14T07:03:32.000Z | tests/test_indexlist.py | D2KLab/sequeval | 71e1b40fa728492bef52a2ec0fb0353dce32602d | [
"MIT"
] | null | null | null | tests/test_indexlist.py | D2KLab/sequeval | 71e1b40fa728492bef52a2ec0fb0353dce32602d | [
"MIT"
] | 2 | 2018-12-11T02:59:01.000Z | 2019-11-23T13:23:51.000Z | import unittest
import sequeval
class IndexListTestSuite(unittest.TestCase):
def test_setitem(self):
indexlist = sequeval.IndexList()
indexlist.append(None)
indexlist[0] = 'Zero'
self.assertEqual(indexlist[0], 'Zero')
self.assertEqual(indexlist.index('Zero'), 0)
def test_append(self):
indexlist = sequeval.IndexList()
indexlist.append('Zero')
indexlist.append('One')
indexlist.append('Zero')
self.assertEqual(indexlist[0], 'Zero')
self.assertEqual(indexlist[1], 'One')
self.assertEqual(indexlist.index('Zero'), 0)
self.assertEqual(indexlist.index('One'), 1)
def test_delete(self):
indexlist = sequeval.IndexList()
indexlist.append('Zero')
del indexlist[0]
self.assertEqual(indexlist[0], 'Zero')
self.assertEqual(indexlist.index('Zero'), 0)
def test_len(self):
indexlist = sequeval.IndexList()
indexlist.append('Zero')
indexlist.append('One')
indexlist.append('Zero')
self.assertEqual(len(indexlist), 2)
def test_insert(self):
indexlist = sequeval.IndexList()
indexlist.insert(1, 'Zero')
self.assertEqual(indexlist[0], 'Zero')
self.assertEqual(indexlist.index('Zero'), 0)
if __name__ == '__main__':
unittest.main()
| 28.4375 | 52 | 0.624908 | 142 | 1,365 | 5.915493 | 0.190141 | 0.196429 | 0.285714 | 0.233333 | 0.747619 | 0.70119 | 0.595238 | 0.536905 | 0.536905 | 0.491667 | 0 | 0.013436 | 0.23663 | 1,365 | 47 | 53 | 29.042553 | 0.792706 | 0 | 0 | 0.540541 | 0 | 0 | 0.058608 | 0 | 0 | 0 | 0 | 0 | 0.297297 | 1 | 0.135135 | false | 0 | 0.054054 | 0 | 0.216216 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8ff077d1dab32bb6bb924355f08946a7f035570e | 374 | py | Python | image_vision/plugins/visualizers/image.py | IvanKosik/ImageVision | 038b2b3948a16adc4c2abb3bc8c1c32f62aa4319 | [
"BSD-3-Clause"
] | null | null | null | image_vision/plugins/visualizers/image.py | IvanKosik/ImageVision | 038b2b3948a16adc4c2abb3bc8c1c32f62aa4319 | [
"BSD-3-Clause"
] | null | null | null | image_vision/plugins/visualizers/image.py | IvanKosik/ImageVision | 038b2b3948a16adc4c2abb3bc8c1c32f62aa4319 | [
"BSD-3-Clause"
] | null | null | null | from .base import DataVisualizerPlugin
from .registry import DataVisualizerRegistryPlugin
from extensions.visualizers.image import FlatImageVisualizer
class FlatImageVisualizerPlugin(DataVisualizerPlugin):
def __init__(self, visualizers_registry_plugin: DataVisualizerRegistryPlugin):
super().__init__(visualizers_registry_plugin, FlatImageVisualizer)
| 41.555556 | 83 | 0.839572 | 30 | 374 | 10.066667 | 0.566667 | 0.125828 | 0.165563 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.112299 | 374 | 8 | 84 | 46.75 | 0.909639 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.5 | 0 | 0.833333 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
64f71b659ffe44f6b0fc8994b14104fca9e5f3b3 | 241 | py | Python | exercicios/Repeticao/ex02.py | mferoc/Uniprojecao-Topicos-Avancados-em-Analise-e-Desenvolvimento-de-Sistemas | 41aec22c7e9f402bd60522aa6ed29ec1a4ecf024 | [
"MIT"
] | 1 | 2020-02-20T16:56:05.000Z | 2020-02-20T16:56:05.000Z | exercicios/Repeticao/ex02.py | mferoc/Uniprojecao-Topicos-Avancados-em-Analise-e-Desenvolvimento-de-Sistemas | 41aec22c7e9f402bd60522aa6ed29ec1a4ecf024 | [
"MIT"
] | null | null | null | exercicios/Repeticao/ex02.py | mferoc/Uniprojecao-Topicos-Avancados-em-Analise-e-Desenvolvimento-de-Sistemas | 41aec22c7e9f402bd60522aa6ed29ec1a4ecf024 | [
"MIT"
] | null | null | null | usuario = input("Informe o nome de usuario: ")
senha = input("Informe a senha: ")
while usuario == senha:
print("Usuario deve ser diferente da senha!\n")
senha = input("Informe uma nova senha: ")
else:
print("Dados confirmados") | 30.125 | 51 | 0.676349 | 33 | 241 | 4.939394 | 0.606061 | 0.220859 | 0.208589 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190871 | 241 | 8 | 52 | 30.125 | 0.835897 | 0 | 0 | 0 | 0 | 0 | 0.508264 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.285714 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8f0ddbac8973607c6841c18f78f7097971a79396 | 138 | py | Python | key_plantilla.py | herrera-lu/meteocat-api-client | c5ff627c954123786543a0712c82181f76e87d7c | [
"MIT"
] | null | null | null | key_plantilla.py | herrera-lu/meteocat-api-client | c5ff627c954123786543a0712c82181f76e87d7c | [
"MIT"
] | null | null | null | key_plantilla.py | herrera-lu/meteocat-api-client | c5ff627c954123786543a0712c82181f76e87d7c | [
"MIT"
] | 1 | 2022-03-16T13:28:32.000Z | 2022-03-16T13:28:32.000Z | # Canviar el nom d'aquest fitxer a key.py si volem
# utilitzar el fitxer d'exemple sense fer cap modificació
KEY = "{token_api_meteocat}"
| 34.5 | 57 | 0.768116 | 24 | 138 | 4.333333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15942 | 138 | 3 | 58 | 46 | 0.896552 | 0.753623 | 0 | 0 | 0 | 0 | 0.645161 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8f31d8531c2816907401301e6fd390be372476e9 | 945 | py | Python | webapp/StaticPageApp/views.py | AdaFactor/RamaProject | 4da35480e2e7185a6d07f00cc8cdbf51898a7bb7 | [
"MIT"
] | null | null | null | webapp/StaticPageApp/views.py | AdaFactor/RamaProject | 4da35480e2e7185a6d07f00cc8cdbf51898a7bb7 | [
"MIT"
] | 7 | 2018-02-16T11:18:24.000Z | 2019-04-23T17:49:04.000Z | webapp/StaticPageApp/views.py | AdaFactor/RamaProject | 4da35480e2e7185a6d07f00cc8cdbf51898a7bb7 | [
"MIT"
] | 1 | 2018-01-29T05:15:13.000Z | 2018-01-29T05:15:13.000Z | from django.shortcuts import render, redirect
from django.http import HttpResponse
# from .models import Member
# from .forms import MemberForm
from datetime import date
def index(request):
return render(request, 'StaticPageApp/index.html')
def landing(request):
return render(request, 'StaticPageApp/landing.html')
def demo(request):
return render(request, 'StaticPageApp/demo_tree.html')
def adminmenu(request):
return render(request, 'StaticPageApp/admin_menu.html')
# def new_member(request):
# if request.POST:
# form = MemberForm(request, data=request.POST)
# if form.is_valid():
# new_member = form.save(commit=False)
# new_member.expiry_date = new_member.cal_expiry_date()
# new_member.save()
# return redirect('landing')
# form = MemberForm(request)
# return render(request, 'StaticPageApp/new_member.html', {'form': form}) | 29.53125 | 77 | 0.685714 | 111 | 945 | 5.72973 | 0.342342 | 0.084906 | 0.149371 | 0.204403 | 0.306604 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.203175 | 945 | 32 | 77 | 29.53125 | 0.844622 | 0.502646 | 0 | 0 | 0 | 0 | 0.233624 | 0.233624 | 0 | 0 | 0 | 0 | 0 | 1 | 0.363636 | false | 0 | 0.272727 | 0.363636 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
8f3b0d2731a4279e25145f70155104b727e433ab | 215 | py | Python | ast/testdata/if_expr.py | MaxTurchin/pycopy-lib | d7a69fc2a28031e2ca475c29239f715c1809d8cc | [
"PSF-2.0"
] | 126 | 2019-07-19T14:42:41.000Z | 2022-03-21T22:22:19.000Z | ast/testdata/if_expr.py | MaxTurchin/pycopy-lib | d7a69fc2a28031e2ca475c29239f715c1809d8cc | [
"PSF-2.0"
] | 38 | 2019-08-28T01:46:31.000Z | 2022-03-17T05:46:51.000Z | ast/testdata/if_expr.py | MaxTurchin/pycopy-lib | d7a69fc2a28031e2ca475c29239f715c1809d8cc | [
"PSF-2.0"
] | 55 | 2019-08-02T09:32:33.000Z | 2021-12-22T11:25:51.000Z | [b'z' if foldnuls and not word else
b'y' if foldspaces and word == 0x20202020 else
(chars2[word // 614125] +
chars2[word // 85 % 7225] +
chars[word % 85])
]
| 30.714286 | 60 | 0.483721 | 26 | 215 | 4 | 0.615385 | 0.192308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195313 | 0.404651 | 215 | 6 | 61 | 35.833333 | 0.617188 | 0 | 0 | 0 | 0 | 0 | 0.009302 | 0 | 0 | 0 | 0.046512 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8f4503a801a9dbd57e1b152aa8a9c514d67155bd | 765 | py | Python | 2019_04_10/dojo_test.py | samisafatli/dojo | 3751f8413e70da84e928e037193e8cb03f6b3e65 | [
"MIT"
] | 114 | 2015-03-10T22:17:42.000Z | 2022-03-09T17:49:48.000Z | 2019_04_10/dojo_test.py | samisafatli/dojo | 3751f8413e70da84e928e037193e8cb03f6b3e65 | [
"MIT"
] | 9 | 2018-09-04T12:49:59.000Z | 2019-11-17T21:29:51.000Z | 2019_04_10/dojo_test.py | samisafatli/dojo | 3751f8413e70da84e928e037193e8cb03f6b3e65 | [
"MIT"
] | 39 | 2015-01-29T01:20:56.000Z | 2022-02-17T16:26:25.000Z | import unittest
from dojo import *
class DojoTest(unittest.TestCase):
def test_equal_arrays_1(self):
self.assertEqual(main([1, 2], [1]), [2])
def test_equal_arrays_2(self):
self.assertEqual(main([1, 2, 3], [1]), [2, 3])
def test_getcount_with_numbers_1(self):
self.assertEqual(getcount([1]), {1: 1})
def test_getcount_with_numbers_2(self):
self.assertEqual(getcount([1, 1]), {1: 2})
def test_dictdiff(self):
self.assertEqual(dictdiff({1: 1}, {1: 2}), [1])
def test_dictdiff_2(self):
self.assertEqual(dictdiff({1: 2, 2: 1}, {1: 1}), [1, 2])
def test_dictdiff_3(self):
self.assertEqual(dictdiff({1: 1}, {1: 2, 2: 1}), [1, 2])
if __name__ == '__main__':
unittest.main()
| 25.5 | 64 | 0.606536 | 113 | 765 | 3.867257 | 0.20354 | 0.05492 | 0.304348 | 0.036613 | 0.670481 | 0.473684 | 0.359268 | 0.141876 | 0 | 0 | 0 | 0.07309 | 0.213072 | 765 | 29 | 65 | 26.37931 | 0.652824 | 0 | 0 | 0 | 0 | 0 | 0.010458 | 0 | 0 | 0 | 0 | 0 | 0.368421 | 1 | 0.368421 | false | 0 | 0.105263 | 0 | 0.526316 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
8f6c4c169eebdf37755ec734915aa0fc32407486 | 151 | py | Python | 70_readline.py | AmreshTripathy/Python | e86420fef7f52da393be5b50ac2f13bddfeb3306 | [
"Apache-2.0"
] | 4 | 2021-05-27T05:06:09.000Z | 2021-06-12T17:12:47.000Z | 70_readline.py | AmreshTripathy/Python | e86420fef7f52da393be5b50ac2f13bddfeb3306 | [
"Apache-2.0"
] | null | null | null | 70_readline.py | AmreshTripathy/Python | e86420fef7f52da393be5b50ac2f13bddfeb3306 | [
"Apache-2.0"
] | null | null | null | f = open('69_sample.txt')
# read 1st line
data = f.readline()
print (data)
# read second line
data = f.readline()
print (data)
f.close()
| 13.727273 | 26 | 0.609272 | 23 | 151 | 3.956522 | 0.565217 | 0.164835 | 0.197802 | 0.373626 | 0.571429 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0.026087 | 0.238411 | 151 | 10 | 27 | 15.1 | 0.765217 | 0.198676 | 0 | 0.666667 | 0 | 0 | 0.12037 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8f7b1545d394e3160981a1dc5e6d7fe879a67f32 | 752 | py | Python | what_apps/power/views.py | SlashRoot/WHAT | 69e78d01065142446234e77ea7c8c31e3482af29 | [
"MIT"
] | null | null | null | what_apps/power/views.py | SlashRoot/WHAT | 69e78d01065142446234e77ea7c8c31e3482af29 | [
"MIT"
] | null | null | null | what_apps/power/views.py | SlashRoot/WHAT | 69e78d01065142446234e77ea7c8c31e3482af29 | [
"MIT"
] | null | null | null | import struct, sys, getpass, os
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import render
from django.http import HttpResponse
from models import X10Module, X10ModuleCategory
import twilio
from django.contrib.auth.decorators import login_required
@csrf_exempt
def change(request):
command = request.POST['command']
module_id = request.POST['module_id']
module = X10Module.objects.get(id=module_id)
os.system('ssh -i /home/power/.ssh/id_rsa power@10.0.0.127 -o StrictHostKeyChecking=no "heyu ' + command + ' %s"' % (module.housecode))
return HttpResponse('llamas')
@login_required
def switch(request):
modules = X10Module.objects.all()
return render(request, 'power/switch.html', locals() ) | 35.809524 | 139 | 0.755319 | 101 | 752 | 5.544554 | 0.534653 | 0.071429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022971 | 0.131649 | 752 | 21 | 140 | 35.809524 | 0.834609 | 0 | 0 | 0 | 0 | 0.055556 | 0.166003 | 0.062417 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0.055556 | 0.388889 | 0 | 0.611111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
56f19dc086a698856445a4c613e4e529562ceb5b | 13,863 | py | Python | bugs/xmalloc-bad-decompilation-quality/test.py | xbabka01/retdec-regression-tests | 1ac40cca5165740364e6f7fb72b20820eac9bc7c | [
"MIT"
] | 8 | 2017-12-14T14:25:17.000Z | 2019-03-09T03:29:12.000Z | bugs/xmalloc-bad-decompilation-quality/test.py | xbabka01/retdec-regression-tests | 1ac40cca5165740364e6f7fb72b20820eac9bc7c | [
"MIT"
] | 10 | 2019-06-14T09:12:55.000Z | 2021-10-01T12:15:43.000Z | bugs/xmalloc-bad-decompilation-quality/test.py | xbabka01/retdec-regression-tests | 1ac40cca5165740364e6f7fb72b20820eac9bc7c | [
"MIT"
] | 8 | 2019-05-10T14:59:48.000Z | 2022-03-07T16:34:23.000Z |
from regression_tests import *
class Test(Test):
settings = TestSettings(
input='x86-elf-gcc4.6.3-O0-g--cat',
args='-k'
)
def test_check_for_all_currently_detected_strings(self):
assert self.out_c.has_string_literal( '' )
assert self.out_c.has_string_literal( ' --help display this help and exit\\n' )
assert self.out_c.has_string_literal( ' --version output version information and exit\\n' )
assert self.out_c.has_string_literal( ' -t equivalent to -vT\\n -T, --show-tabs display TAB characters as ^I\\n -u (ignored)\\n -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB\\n' )
assert self.out_c.has_string_literal( '%50s %50s' )
assert self.out_c.has_string_literal( '%s' )
assert self.out_c.has_string_literal( '%s %s\\n' )
assert self.out_c.has_string_literal( '%s (%s)' )
assert self.out_c.has_string_literal( '%s (%s) %s\\n' )
assert self.out_c.has_string_literal( '%s home page: <%s>\\n' )
assert self.out_c.has_string_literal( '%s home page: <http://www.gnu.org/software/%s/>\\n' )
assert self.out_c.has_string_literal( '%s: %s' )
assert self.out_c.has_string_literal( '(C)' )
assert self.out_c.has_string_literal( "*iter->cur.ptr == '\\\\0'" )
assert self.out_c.has_string_literal( '/.libs/' )
assert self.out_c.has_string_literal( '/usr/local/lib' )
assert self.out_c.has_string_literal( '/usr/local/share/locale' )
assert self.out_c.has_string_literal( 'A NULL argv[0] was passed through an exec system call.\\n' )
assert self.out_c.has_string_literal( 'ASCII' )
assert self.out_c.has_string_literal( 'CHARSETALIASDIR' )
assert self.out_c.has_string_literal( 'Concatenate FILE(s), or standard input, to standard output.\\n\\n -A, --show-all equivalent to -vET\\n -b, --number-nonblank number nonempty output lines, overrides -n\\n -e equivalent to -vE\\n -E, --show-ends display $ at end of each line\\n -n, --number number all output lines\\n -s, --squeeze-blank suppress repeated empty output lines\\n' )
assert self.out_c.has_string_literal( 'Copyright %s %d Free Software Foundation, Inc.' )
assert self.out_c.has_string_literal( "For complete documentation, run: info coreutils '%s invocation'\\n" )
assert self.out_c.has_string_literal( 'GNU coreutils' )
assert self.out_c.has_string_literal( 'General help using GNU software: <http://www.gnu.org/gethelp/>\\n' )
assert self.out_c.has_string_literal( 'Report %s translation bugs to <http://translationproject.org/team/>\\n' )
assert self.out_c.has_string_literal( 'Torbjorn Granlund' )
assert self.out_c.has_string_literal( "Try `%s --help' for more information.\\n" )
assert self.out_c.has_string_literal( 'UTF-8' )
assert self.out_c.has_string_literal( 'Usage: %s [OPTION]... [FILE]...\\n' )
assert self.out_c.has_string_literal( 'Written by %s and %s.\\n' )
assert self.out_c.has_string_literal( 'Written by %s, %s, %s,\\n%s, %s, %s, %s,\\n%s, %s, and others.\\n' )
assert self.out_c.has_string_literal( 'Written by %s, %s, %s,\\n%s, %s, %s, %s,\\n%s, and %s.\\n' )
assert self.out_c.has_string_literal( 'Written by %s, %s, %s,\\n%s, %s, %s, %s,\\nand %s.\\n' )
assert self.out_c.has_string_literal( 'Written by %s, %s, %s,\\n%s, %s, %s, and %s.\\n' )
assert self.out_c.has_string_literal( 'Written by %s, %s, %s,\\n%s, %s, and %s.\\n' )
assert self.out_c.has_string_literal( 'Written by %s, %s, %s,\\n%s, and %s.\\n' )
assert self.out_c.has_string_literal( 'Written by %s, %s, %s,\\nand %s.\\n' )
assert self.out_c.has_string_literal( 'Written by %s, %s, and %s.\\n' )
assert self.out_c.has_string_literal( 'Written by %s.\\n' )
assert self.out_c.has_string_literal( "\\nExamples:\\n %s f - g Output f's contents, then standard input, then g's contents.\\n %s Copy standard input to standard output.\\n" )
assert self.out_c.has_string_literal( '\\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\\nThis is free software: you are free to change and redistribute it.\\nThere is NO WARRANTY, to the extent permitted by law.\\n\\n' )
assert self.out_c.has_string_literal( '\\nReport %s bugs to %s\\n' )
assert self.out_c.has_string_literal( '\\nReport bugs to: %s\\n' )
assert self.out_c.has_string_literal( '\\nWith no FILE, or when FILE is -, read standard input.\\n' )
assert self.out_c.has_string_literal( 'benstuvAET' )
assert self.out_c.has_string_literal( 'cannot do ioctl on %s' )
assert self.out_c.has_string_literal( 'cat' )
assert self.out_c.has_string_literal( 'closing standard input' )
assert self.out_c.has_string_literal( 'coreutils' )
assert self.out_c.has_string_literal( 'en_' )
assert self.out_c.has_string_literal( 'iter->cur.wc == 0' )
assert self.out_c.has_string_literal( 'lt-' )
assert self.out_c.has_string_literal( 'mbiter.h' )
assert self.out_c.has_string_literal( 'mbiter_multi_next' )
assert self.out_c.has_string_literal( 'mbsinit (&iter->state)' )
assert self.out_c.has_string_literal( 'mbuiter.h' )
assert self.out_c.has_string_literal( 'mbuiter_multi_next' )
assert self.out_c.has_string_literal( 'memory exhausted' )
assert self.out_c.has_string_literal( 'standard output' )
assert self.out_c.has_string_literal( 'write error' )
def test_check_for_all_currently_detected_functions(self):
assert self.out_c.has_func( '_init' ) #
assert self.out_c.has_func( '_start' ) #
assert self.out_c.has_func( '__do_global_dtors_aux' ) #
assert self.out_c.has_func( 'frame_dummy' ) #
assert self.out_c.has_func( 'ptr_align' ) #
assert self.out_c.has_func( 'emit_ancillary_info' ) #
assert self.out_c.has_func( 'io_blksize' ) #
assert self.out_c.has_func( 'usage' ) #
assert self.out_c.has_func( 'next_line_num' ) #
assert self.out_c.has_func( 'simple_cat' ) #
assert self.out_c.has_func( 'write_pending' ) #
assert self.out_c.has_func( 'cat' ) #
assert self.out_c.has_func( 'main' ) #
assert self.out_c.has_func( 'ignore_value' ) #
assert self.out_c.has_func( 'fdadvise' ) #
assert self.out_c.has_func( 'fadvise' ) #
assert self.out_c.has_func( 'full_write' ) #
assert self.out_c.has_func( 'set_program_name' ) #
assert self.out_c.has_func( 'is_basic' ) #
assert self.out_c.has_func( 'mbuiter_multi_next' ) #
assert self.out_c.has_func( 'mbsstr_trimmed_wordbounded' ) #
assert self.out_c.has_func( 'proper_name' ) #
assert self.out_c.has_func( 'proper_name_utf8' ) #
assert self.out_c.has_func( 'strnlen1' ) #
assert self.out_c.has_func( 'is_basic2' ) #
assert self.out_c.has_func( 'mbiter_multi_next' ) #
assert self.out_c.has_func( 'trim2' ) #
assert self.out_c.has_func( 'version_etc_arn' ) #
assert self.out_c.has_func( 'version_etc_ar' ) #
assert self.out_c.has_func( 'version_etc_va' ) #
assert self.out_c.has_func( 'version_etc' ) #
assert self.out_c.has_func( 'emit_bug_reporting_address' ) #
assert self.out_c.has_func( 'xalloc_die' ) #
assert self.out_c.has_func( 'xmem_cd_iconv' ) #
assert self.out_c.has_func( 'xstr_cd_iconv' ) #
assert self.out_c.has_func( 'xstr_iconv' ) #
assert self.out_c.has_func( 'last_component' ) #
assert self.out_c.has_func( 'base_len' ) #
assert self.out_c.has_func( 'close_stdout_set_file_name' ) #
assert self.out_c.has_func( 'close_stdout_set_ignore_EPIPE' ) #
assert self.out_c.has_func( 'close_stdout' ) #
assert self.out_c.has_func( 'quote_n' ) #
assert self.out_c.has_func( 'quote' ) #
assert self.out_c.has_func( 'xcharalloc' ) #
assert self.out_c.has_func( 'clone_quoting_options' ) #
assert self.out_c.has_func( 'get_quoting_style' ) #
assert self.out_c.has_func( 'set_quoting_style' ) #
assert self.out_c.has_func( 'set_char_quoting' ) #
assert self.out_c.has_func( 'set_quoting_flags' ) #
assert self.out_c.has_func( 'set_custom_quoting' ) #
assert self.out_c.has_func( 'quoting_options_from_style' ) #
assert self.out_c.has_func( 'gettext_quote' ) #
assert self.out_c.has_func( 'quotearg_buffer_restyled' ) #
assert self.out_c.has_func( 'quotearg_buffer' ) #
assert self.out_c.has_func( 'quotearg_alloc' ) #
assert self.out_c.has_func( 'quotearg_alloc_mem' ) #
assert self.out_c.has_func( 'quotearg_free' ) #
assert self.out_c.has_func( 'quotearg_n_options' ) #
assert self.out_c.has_func( 'quotearg_n' ) #
assert self.out_c.has_func( 'quotearg_n_mem' ) #
assert self.out_c.has_func( 'quotearg' ) #
assert self.out_c.has_func( 'quotearg_mem' ) #
assert self.out_c.has_func( 'quotearg_n_style' ) #
assert self.out_c.has_func( 'quotearg_n_style_mem' ) #
assert self.out_c.has_func( 'quotearg_style' ) #
assert self.out_c.has_func( 'quotearg_style_mem' ) #
assert self.out_c.has_func( 'quotearg_char_mem' ) #
assert self.out_c.has_func( 'quotearg_char' ) #
assert self.out_c.has_func( 'quotearg_colon' ) #
assert self.out_c.has_func( 'quotearg_colon_mem' ) #
assert self.out_c.has_func( 'quotearg_n_custom' ) #
assert self.out_c.has_func( 'quotearg_n_custom_mem' ) #
assert self.out_c.has_func( 'quotearg_custom' ) #
assert self.out_c.has_func( 'quotearg_custom_mem' ) #
assert self.out_c.has_func( 'safe_read' ) #
assert self.out_c.has_func( 'safe_write' ) #
assert self.out_c.has_func( 'x2nrealloc' ) #
assert self.out_c.has_func( 'xmalloc' ) #
assert self.out_c.has_func( 'xrealloc' ) #
assert self.out_c.has_func( 'x2realloc' ) #
assert self.out_c.has_func( 'xzalloc' ) #
assert self.out_c.has_func( 'xcalloc' ) #
assert self.out_c.has_func( 'xmemdup' ) #
assert self.out_c.has_func( 'xstrdup' ) #
assert self.out_c.has_func( 'c_strcasecmp' ) #
assert self.out_c.has_func( 'get_charset_aliases' ) #
assert self.out_c.has_func( 'locale_charset' ) #
assert self.out_c.has_func( 'mb_copy' ) #
assert self.out_c.has_func( 'is_basic3' ) #
assert self.out_c.has_func( 'is_basic4' ) #
assert self.out_c.has_func( 'mbuiter_multi_next2' ) #
assert self.out_c.has_func( 'mbuiter_multi_next3' ) #
assert self.out_c.has_func( 'knuth_morris_pratt_unibyte' ) #
assert self.out_c.has_func( 'knuth_morris_pratt_multibyte' ) #
assert self.out_c.has_func( 'mbsstr' ) #
assert self.out_c.has_func( 'mem_cd_iconv' ) #
assert self.out_c.has_func( 'str_cd_iconv' ) #
assert self.out_c.has_func( 'str_iconv' ) #
assert self.out_c.has_func( 'close_stream' ) #
assert self.out_c.has_func( 'c_isascii' ) #
assert self.out_c.has_func( 'c_isalnum' ) #
assert self.out_c.has_func( 'c_isalpha' ) #
assert self.out_c.has_func( 'c_isblank' ) #
assert self.out_c.has_func( 'c_iscntrl' ) #
assert self.out_c.has_func( 'c_isdigit' ) #
assert self.out_c.has_func( 'c_islower' ) #
assert self.out_c.has_func( 'c_isgraph' ) #
assert self.out_c.has_func( 'c_isprint' ) #
assert self.out_c.has_func( 'c_ispunct' ) #
assert self.out_c.has_func( 'c_isspace' ) #
assert self.out_c.has_func( 'c_isupper' ) #
assert self.out_c.has_func( 'c_isxdigit' ) #
assert self.out_c.has_func( 'c_tolower' ) #
assert self.out_c.has_func( 'c_toupper' ) #
assert self.out_c.has_func( 'mmalloca' ) #
assert self.out_c.has_func( 'freea' ) #
assert self.out_c.has_func( 'mbslen' ) #
assert self.out_c.has_func( '__libc_csu_init' ) #
assert self.out_c.has_func( '__libc_csu_fini' ) #
assert self.out_c.has_func( '__i686_get_pc_thunk_bx' ) #
assert self.out_c.has_func( '__do_global_ctors_aux' ) #
assert self.out_c.has_func( '_fini' ) #
def test_problem_reported_in_1177_xmalloc(self):
xmalloc = self.out_c.funcs['xmalloc']
assert xmalloc.calls('malloc', 'xalloc_die')
assert xmalloc.has_just_params('n')
assert xmalloc.params['n'].type.is_int(32)
assert xmalloc.return_type.is_pointer()
assert xmalloc.return_type.pointed_type.is_char()
assert xmalloc.has_var_def_stmts('int * mem = malloc(n)')
assert xmalloc.has_return_stmts('return (char *)mem')
def test_the_same_problem_from_xmalloc_in_xrealloc(self):
xrealloc = self.out_c.funcs['xrealloc']
assert xrealloc.calls('realloc', 'xalloc_die')
assert xrealloc.has_just_params('p', 'n')
assert xrealloc.params['p'].type.is_pointer()
assert xrealloc.params['p'].type.pointed_type.is_char()
assert xrealloc.params['n'].type.is_int(32)
assert xrealloc.return_type.is_pointer()
assert xrealloc.return_type.pointed_type.is_char()
assert xrealloc.has_var_def_stmts('int * mem = realloc((int *) p, n)')
assert xrealloc.has_return_stmts('return (char *)mem')
| 61.888393 | 460 | 0.641131 | 2,066 | 13,863 | 3.982575 | 0.163601 | 0.157389 | 0.179874 | 0.311376 | 0.733228 | 0.719494 | 0.620442 | 0.416626 | 0.217064 | 0.107316 | 0 | 0.003451 | 0.226719 | 13,863 | 223 | 461 | 62.165919 | 0.764086 | 0 | 0 | 0 | 0 | 0.042654 | 0.302693 | 0.026638 | 0 | 0 | 0 | 0 | 0.943128 | 1 | 0.018957 | false | 0.004739 | 0.004739 | 0 | 0.033175 | 0.009479 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
56ff10347be7921192573012907055a82d163a53 | 1,420 | py | Python | src/encoded/tests/test_audit_genetic_modification.py | KCL-ORG/encoded | 5a1904e948bfd652e8a8d52c6717d7fc0b56b681 | [
"MIT"
] | null | null | null | src/encoded/tests/test_audit_genetic_modification.py | KCL-ORG/encoded | 5a1904e948bfd652e8a8d52c6717d7fc0b56b681 | [
"MIT"
] | null | null | null | src/encoded/tests/test_audit_genetic_modification.py | KCL-ORG/encoded | 5a1904e948bfd652e8a8d52c6717d7fc0b56b681 | [
"MIT"
] | null | null | null | import pytest
@pytest.fixture
def gm_characterization(testapp, award, lab, construct_genetic_modification_N, attachment):
item = {
'characterizes': construct_genetic_modification_N['@id'],
'award': award['@id'],
'lab': lab['@id'],
'attachment': attachment,
}
return testapp.post_json('/genetic_modification_characterization', item).json['@graph'][0]
def test_audit_tagging_gm_characterization(testapp,
construct_genetic_modification_N,
construct_genetic_modification,
gm_characterization):
res = testapp.get(construct_genetic_modification_N['@id'] + '@@index-data')
errors = res.json['audit']
errors_list = []
for error_type in errors:
errors_list.extend(errors[error_type])
assert all(error['category'] != 'missing genetic modification characterization' for error in errors_list)
testapp.patch_json(gm_characterization['@id'], {'characterizes': construct_genetic_modification['@id']})
res = testapp.get(construct_genetic_modification_N['@id'] + '@@index-data')
errors = res.json['audit']
errors_list = []
for error_type in errors:
errors_list.extend(errors[error_type])
assert any(error['category'] == 'missing genetic modification characterization' for error in errors_list)
| 41.764706 | 109 | 0.653521 | 148 | 1,420 | 6 | 0.283784 | 0.213964 | 0.220721 | 0.163288 | 0.51464 | 0.47973 | 0.47973 | 0.47973 | 0.47973 | 0.47973 | 0 | 0.000917 | 0.23169 | 1,420 | 33 | 110 | 43.030303 | 0.813016 | 0 | 0 | 0.37037 | 0 | 0 | 0.175476 | 0.026779 | 0 | 0 | 0 | 0 | 0.074074 | 1 | 0.074074 | false | 0 | 0.037037 | 0 | 0.148148 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
71141aeb37e742a8e842190b18be03d091e4a98c | 335 | py | Python | Dataset/Leetcode/train/1/659.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/1/659.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/1/659.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | class Solution(object):
def XXX(self, nums, target):
# 暴力解法
for key, value in enumerate(nums):
temp = target - value
for key1, value in enumerate(nums):
if key1 <= key:
continue
elif temp == value:
return [key, key1]
| 27.916667 | 47 | 0.459701 | 34 | 335 | 4.529412 | 0.588235 | 0.090909 | 0.207792 | 0.25974 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016484 | 0.456716 | 335 | 11 | 48 | 30.454545 | 0.82967 | 0.01194 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
712f212842a3aeccd62c6f048fcc6a0c7e53410a | 178 | py | Python | pyyawl/operators/pythonops.py | davidegazze/pyyawl | 87e34281d5ef44025951ac59d90c3e7a2f8be706 | [
"Apache-2.0"
] | null | null | null | pyyawl/operators/pythonops.py | davidegazze/pyyawl | 87e34281d5ef44025951ac59d90c3e7a2f8be706 | [
"Apache-2.0"
] | null | null | null | pyyawl/operators/pythonops.py | davidegazze/pyyawl | 87e34281d5ef44025951ac59d90c3e7a2f8be706 | [
"Apache-2.0"
] | null | null | null | __all__ = ['call_echo']
import subprocess
from ..namedregistry import export
@export(name='python')
def call_echo(value, verbose=False):
subprocess.run(['python', value])
| 17.8 | 37 | 0.730337 | 22 | 178 | 5.636364 | 0.681818 | 0.129032 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.123596 | 178 | 9 | 38 | 19.777778 | 0.794872 | 0 | 0 | 0 | 0 | 0 | 0.117978 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
713b6903949d951fb74f19588d13fb218f7d9662 | 365 | py | Python | Dataset/Leetcode/train/121/455.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/121/455.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/121/455.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | class Solution:
def XXX(self, prices: List[int]) -> int:
if len(prices) <= 1:
return 0
lo, hi, maxv = 0, 1, 0
while hi < len(prices):
if prices[hi] - prices[lo] >= 0:
maxv = max(maxv, prices[hi] - prices[lo])
hi += 1
else:
lo = hi
return maxv
| 26.071429 | 57 | 0.416438 | 45 | 365 | 3.377778 | 0.422222 | 0.078947 | 0.184211 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035533 | 0.460274 | 365 | 13 | 58 | 28.076923 | 0.736041 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8567e584c87a15932b42e4256719185ddc782e73 | 1,306 | py | Python | books/models.py | asommer70/bookpila | 6ed7b6ee1866daeb3820e958a5d8115d76e9269d | [
"MIT"
] | 1 | 2020-04-14T01:14:30.000Z | 2020-04-14T01:14:30.000Z | books/models.py | asommer70/bookpila | 6ed7b6ee1866daeb3820e958a5d8115d76e9269d | [
"MIT"
] | null | null | null | books/models.py | asommer70/bookpila | 6ed7b6ee1866daeb3820e958a5d8115d76e9269d | [
"MIT"
] | null | null | null | from django.db import models
from django.utils import timezone
class Book(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True, editable=True)
title = models.CharField(max_length=255, unique=True)
author = models.CharField(max_length=255, blank=True, null=True)
about = models.TextField(max_length=1024, blank=True, null=True)
isbn = models.CharField(max_length=100, blank=True, null=True)
current_loc = models.CharField(max_length=255, blank=True, null=True, default="")
current_loc_folio = models.CharField(max_length=255, blank=True, null=True, default="")
upload = models.FileField(null=True, blank=True)
cover = models.CharField(max_length=255, blank=True, null=True, default="")
cover_image = models.ImageField(blank=True, null=True)
tags = models.ManyToManyField('Tag')
class Meta:
ordering = ['-updated_at',]
def __str__(self):
return self.title
def save(self, *args, **kwargs):
return super(Book, self).save(*args, **kwargs)
class Tag(models.Model):
name = models.CharField(max_length=255, unique=True)
books = models.ManyToManyField(Book)
class Meta:
ordering = ['name',]
def __str__(self):
return self.name
| 34.368421 | 91 | 0.699847 | 173 | 1,306 | 5.132948 | 0.32948 | 0.081081 | 0.141892 | 0.189189 | 0.413288 | 0.30518 | 0.30518 | 0.221847 | 0.221847 | 0.172297 | 0 | 0.023127 | 0.172282 | 1,306 | 37 | 92 | 35.297297 | 0.798335 | 0 | 0 | 0.142857 | 0 | 0 | 0.013783 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.107143 | false | 0 | 0.071429 | 0.107143 | 0.928571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
856e0945f4d79691bc7febdcf6d2581e0a8be4ca | 118 | py | Python | src/10_Tuplas/03_tuplas.py | UltiRequiem/W3Schools-Python-Exercises | 34d10d48d7ce7b9e50466cd8537a8aece0426ce8 | [
"MIT"
] | 5 | 2021-05-29T23:30:50.000Z | 2022-01-15T16:35:20.000Z | src/10_Tuplas/03_tuplas.py | UltiRequiem/W3Schools-Python-Exercises | 34d10d48d7ce7b9e50466cd8537a8aece0426ce8 | [
"MIT"
] | null | null | null | src/10_Tuplas/03_tuplas.py | UltiRequiem/W3Schools-Python-Exercises | 34d10d48d7ce7b9e50466cd8537a8aece0426ce8 | [
"MIT"
] | 4 | 2021-03-18T17:48:06.000Z | 2021-07-22T19:32:36.000Z | # Use negative indexing to print the last item in the tuple.
fruits = ("apple", "banana", "cherry")
print(fruits[-1])
| 29.5 | 60 | 0.694915 | 18 | 118 | 4.555556 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01 | 0.152542 | 118 | 3 | 61 | 39.333333 | 0.81 | 0.491525 | 0 | 0 | 0 | 0 | 0.293103 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
85a08692a8c70e87ba394d247065457b7e792e9a | 525 | py | Python | hackerrank_algorithm_path/Implementation/magic-square-forming.py | saisankargochhayat/algo_quest | a24f9a22c019ab31d56bd5a7ca5ba790d54ce5dc | [
"Apache-2.0"
] | 3 | 2017-02-15T20:55:04.000Z | 2018-09-26T18:48:24.000Z | hackerrank_algorithm_path/Implementation/magic-square-forming.py | saisankargochhayat/algo_quest | a24f9a22c019ab31d56bd5a7ca5ba790d54ce5dc | [
"Apache-2.0"
] | 4 | 2017-10-07T18:59:20.000Z | 2019-10-08T05:43:25.000Z | hackerrank_algorithm_path/Implementation/magic-square-forming.py | saisankargochhayat/algo_quest | a24f9a22c019ab31d56bd5a7ca5ba790d54ce5dc | [
"Apache-2.0"
] | 1 | 2017-10-08T06:52:21.000Z | 2017-10-08T06:52:21.000Z | s = [[int(i) for i in input().split(' ')] for j in range(3)]
n = [s[i][j] for i in range(3) for j in range(3)]
all_n = [[8,1,6,3,5,7,4,9,2],[6,1,8,7,5,3,2,9,4],[4,9,2,3,5,7,8,1,6],[2,9,4,7,5,3,6,1,8],[8,3,4,1,5,9,6,7,2],[4,3,8,9,5,1,2,7,6],[6,7,2,1,5,9,8,3,4],[2,7,6,9,5,1,4,3,8]]
allsum=[]
for l in all_n:
summ=0
for i in range(9):
summ+=abs(n[i]-l[i])
allsum.append(summ)
# print([abs(n[i]-l[i]) for i in range(9)])
# allsum.append(sum([abs(n[i]-l[i]) for i in range(9)]))
print(min(allsum)) | 43.75 | 169 | 0.51619 | 150 | 525 | 1.793333 | 0.193333 | 0.156134 | 0.111524 | 0.163569 | 0.301115 | 0.141264 | 0.141264 | 0.141264 | 0.141264 | 0.141264 | 0 | 0.17833 | 0.15619 | 525 | 12 | 170 | 43.75 | 0.428894 | 0.182857 | 0 | 0 | 0 | 0 | 0.002342 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.1 | 0 | 0 | 1 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
85a442219f8270a6ceafd95f90d04369b6d8a2e0 | 279 | py | Python | scup/__init__.py | gdmachado/scup-python | 696f8d6e79c52ea6e0c8a4bbddd73778d019115d | [
"MIT"
] | 1 | 2016-01-13T13:23:05.000Z | 2016-01-13T13:23:05.000Z | scup/__init__.py | gdmachado/scup-python | 696f8d6e79c52ea6e0c8a4bbddd73778d019115d | [
"MIT"
] | null | null | null | scup/__init__.py | gdmachado/scup-python | 696f8d6e79c52ea6e0c8a4bbddd73778d019115d | [
"MIT"
] | null | null | null | from scup.exceptions import (
ScupPythonError,
ScupError,
ScupClientError,
HTTPError,
HTTPTimeoutError
)
from scup.scup_api import ScupAPI
__all__ = [
ScupPythonError,
ScupError,
ScupClientError,
HTTPError,
HTTPTimeoutError,
ScupAPI
] | 16.411765 | 33 | 0.698925 | 22 | 279 | 8.636364 | 0.545455 | 0.084211 | 0.410526 | 0.505263 | 0.673684 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.243728 | 279 | 17 | 34 | 16.411765 | 0.900474 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.125 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
85ac99ddd83a2f74fef0f88cd1acb7f00b693275 | 630 | py | Python | ashrae/leaderboard.py | eschmidt42/ashrae | c5f8443c6432c7789efab1f09126ce8409ef7fc6 | [
"Apache-2.0"
] | null | null | null | ashrae/leaderboard.py | eschmidt42/ashrae | c5f8443c6432c7789efab1f09126ce8409ef7fc6 | [
"Apache-2.0"
] | null | null | null | ashrae/leaderboard.py | eschmidt42/ashrae | c5f8443c6432c7789efab1f09126ce8409ef7fc6 | [
"Apache-2.0"
] | null | null | null | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/leaderboard.ipynb (unless otherwise specified).
__all__ = ['get_leaderboard_distribution']
# Cell
import pandas as pd
import os
import plotly.graph_objects as go
import plotly.express as px
import typing
from fastcore.all import *
from ashrae import loading
# Cell
@typed
def get_leaderboard_distribution(df:pd.DataFrame):
return (df.sort_values('Score')
.groupby('Score')
.size()
.to_frame('Count')
.reset_index()
.assign(**{'Cumulative share (%)': lambda x: 100 * x['Count'].cumsum()/x['Count'].sum()})) | 28.636364 | 104 | 0.65873 | 79 | 630 | 5.101266 | 0.683544 | 0.069479 | 0.129032 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006073 | 0.215873 | 630 | 22 | 104 | 28.636364 | 0.809717 | 0.163492 | 0 | 0 | 1 | 0 | 0.139313 | 0.053435 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0 | 0.4375 | 0.0625 | 0.5625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a413ed0e83635414de9ecd3c68991f6c9cb49c78 | 263 | py | Python | example_sendmessage.py | MIsrarUnifiedFX/automationfx-python | d70684e75166bb3196b092252f7e9093c8bd0d00 | [
"MIT"
] | null | null | null | example_sendmessage.py | MIsrarUnifiedFX/automationfx-python | d70684e75166bb3196b092252f7e9093c8bd0d00 | [
"MIT"
] | null | null | null | example_sendmessage.py | MIsrarUnifiedFX/automationfx-python | d70684e75166bb3196b092252f7e9093c8bd0d00 | [
"MIT"
] | null | null | null | from automationfx import *
# This will send 'Message1' to the phones in a filter called 'TestPhones'
# In order to use this example create a message and filter in the AutomationFX admin interface with the corresponding names
sendMessage("Message1","TestPhones")
| 43.833333 | 123 | 0.794677 | 38 | 263 | 5.5 | 0.710526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008969 | 0.152091 | 263 | 5 | 124 | 52.6 | 0.928251 | 0.73384 | 0 | 0 | 0 | 0 | 0.268657 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a419b079a7ffd9a9d74c7362abfdf8311c551ffa | 133 | py | Python | tests/fixture_data/build/lambdas/post-batch/lambda_function.py | kave/cirrus-geo | cc10a6df55c5e124d87663e9c32b53b871216a62 | [
"Apache-2.0"
] | null | null | null | tests/fixture_data/build/lambdas/post-batch/lambda_function.py | kave/cirrus-geo | cc10a6df55c5e124d87663e9c32b53b871216a62 | [
"Apache-2.0"
] | null | null | null | tests/fixture_data/build/lambdas/post-batch/lambda_function.py | kave/cirrus-geo | cc10a6df55c5e124d87663e9c32b53b871216a62 | [
"Apache-2.0"
] | null | null | null | from cirruslib import Catalog
def lambda_handler(payload, context):
catalog = Catalog.from_payload(payload)
return catalog
| 19 | 43 | 0.774436 | 16 | 133 | 6.3125 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.165414 | 133 | 6 | 44 | 22.166667 | 0.90991 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a42d56659487bee332ce164b0eae4c14c5129096 | 592 | py | Python | app/dummies.py | spacecode-live/notebook-api | 5f9a74ad2579ea885fe63a9a410507f64ebd89ad | [
"MIT"
] | 1 | 2020-05-22T15:16:29.000Z | 2020-05-22T15:16:29.000Z | app/dummies.py | spacecode-live/notebook-api | 5f9a74ad2579ea885fe63a9a410507f64ebd89ad | [
"MIT"
] | null | null | null | app/dummies.py | spacecode-live/notebook-api | 5f9a74ad2579ea885fe63a9a410507f64ebd89ad | [
"MIT"
] | null | null | null | from bson.objectid import ObjectId
dummies = {
'notebook': [
{
'_id': ObjectId('569ba781e138232929c00a86'),
'slug': 'custom-slug',
'notes': [
{
'id': '469ba781e138232929c00afa',
'resume': 'Hello World'
}
]
}
],
'note': [
{
'_id': ObjectId('469ba781e138232929c00afa'),
'resume': 'Hello World',
'contents': 'Hello World',
'notebook': ObjectId('569ba781e138232929c00a86')
}
]
}
| 23.68 | 60 | 0.429054 | 32 | 592 | 7.875 | 0.53125 | 0.119048 | 0.277778 | 0.31746 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.216216 | 0.4375 | 592 | 24 | 61 | 24.666667 | 0.540541 | 0 | 0 | 0 | 0 | 0 | 0.33277 | 0.162162 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.043478 | 0 | 0.043478 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a45115b4058f2baf30ca4537db7449a61e1fb6dc | 804 | py | Python | classes/Card.py | Atrus619/DeckOfCards | bf0668ea26041e7faab2b88a03d42ba6887d054a | [
"MIT"
] | 1 | 2019-06-27T12:14:38.000Z | 2019-06-27T12:14:38.000Z | classes/Card.py | Atrus619/DeckOfCards | bf0668ea26041e7faab2b88a03d42ba6887d054a | [
"MIT"
] | 18 | 2019-07-14T17:40:22.000Z | 2019-11-11T01:54:07.000Z | classes/Card.py | Atrus619/DeckOfCards | bf0668ea26041e7faab2b88a03d42ba6887d054a | [
"MIT"
] | null | null | null | from classes.Value import Value
from util.Constants import Constants as cs
class Card:
def __init__(self, value, suit):
self.value = value.upper()
self.suit = suit.upper()
self.numeric_value = cs.STANDARD_CARDS_VALUE[self.value]
if self.value == cs.JOKER:
assert self.suit is None, "Joker should have suit of None."
else:
assert self.suit in cs.SUITS, "Please use a valid suit."
assert self.value in Value.allowed, "Please use a valid value."
def __len__(self):
return 1
def __eq__(self, other):
return (self.value, self.suit) == (other.value, other.suit)
def __str__(self):
return self.value + " of " + self.suit
def __hash__(self):
return hash((self.value, self.suit))
| 26.8 | 71 | 0.621891 | 111 | 804 | 4.297297 | 0.369369 | 0.150943 | 0.0587 | 0.062893 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001709 | 0.272388 | 804 | 29 | 72 | 27.724138 | 0.813675 | 0 | 0 | 0 | 0 | 0 | 0.104478 | 0 | 0 | 0 | 0 | 0 | 0.15 | 1 | 0.25 | false | 0 | 0.1 | 0.2 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
a463dcdfa75023f55b5e0b436b7a80dac19d3195 | 1,035 | py | Python | objects/haunted_bus.py | pythonfluente/example-code | c1e50e44777b13e7b3009b4cd55d89a42ab42557 | [
"MIT"
] | 7 | 2015-04-02T12:57:55.000Z | 2022-01-15T14:12:23.000Z | objects/haunted_bus.py | pythonfluente/example-code | c1e50e44777b13e7b3009b4cd55d89a42ab42557 | [
"MIT"
] | null | null | null | objects/haunted_bus.py | pythonfluente/example-code | c1e50e44777b13e7b3009b4cd55d89a42ab42557 | [
"MIT"
] | 3 | 2020-08-10T19:12:07.000Z | 2022-02-14T15:43:33.000Z | """
>>> bus1 = HountedBus(['Alice', 'Bill'])
>>> bus1.passengers
['Alice', 'Bill']
>>> bus1.pick('Charlie')
>>> bus1.drop('Alice')
>>> bus1.passengers
['Bill', 'Charlie']
>>> bus2 = HountedBus()
>>> bus2.pick('Carrie')
>>> bus2.passengers
['Carrie']
>>> bus3 = HountedBus()
>>> bus3.passengers
['Carrie']
>>> bus3.pick('Dave')
>>> bus2.passengers
['Carrie', 'Dave']
>>> bus2.passengers is bus3.passengers
True
>>> bus1.passengers
['Bill', 'Charlie']
>>> dir(HountedBus.__init__) # doctest: +ELLIPSIS
['__annotations__', '__call__', ..., '__defaults__', ...]
>>> HountedBus.__init__.__defaults__
(['Carrie', 'Dave'],)
>>> HountedBus.__init__.__defaults__[0] is bus2.passengers
True
"""
# BEGIN HAUNTED_BUS_CLASS
class HountedBus:
"""A bus model hounted by ghost passengers"""
def __init__(self, passengers=[]): # <1>
self.passengers = passengers # <2>
def pick(self, name):
self.passengers.append(name) # <3>
def drop(self, name):
self.passengers.remove(name)
# END HAUNTED_BUS_CLASS
| 21.5625 | 58 | 0.635749 | 112 | 1,035 | 5.517857 | 0.357143 | 0.090615 | 0.042071 | 0.080906 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022753 | 0.150725 | 1,035 | 47 | 59 | 22.021277 | 0.680319 | 0.751691 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.428571 | false | 0.571429 | 0 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
a467213bd688e1321fc286eba058351a6b254e96 | 2,798 | py | Python | src/kyoto_reader/sentence.py | kevin3314/kyoto-reader | ee8f94376df6d1abcafbbd253265f4ff79c4444e | [
"MIT"
] | null | null | null | src/kyoto_reader/sentence.py | kevin3314/kyoto-reader | ee8f94376df6d1abcafbbd253265f4ff79c4444e | [
"MIT"
] | null | null | null | src/kyoto_reader/sentence.py | kevin3314/kyoto-reader | ee8f94376df6d1abcafbbd253265f4ff79c4444e | [
"MIT"
] | null | null | null | import logging
from collections import ChainMap
from typing import List, Dict, Optional, Iterator
from pyknp import BList, Morpheme
from .base_phrase import BasePhrase
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
class Sentence:
""" KWDLC(または Kyoto Corpus)の1文書を扱うクラス
Attributes:
blist (BList): KNPのBListオブジェクト
doc_id (str): 文書ID
bps (List[BasePhrase]): 含まれる基本句のリスト
"""
def __init__(self,
knp_string: str,
dtid_offset: int,
dmid_offset: int,
doc_id: str,
) -> None:
"""
Args:
knp_string(str): 1文についてのKNPのtab出力
dtid_offset (int): 文書中でこの文が始まるまでの文書レベル基本句ID
dmid_offset (int): 文書中でこの文が始まるまでの文書レベル形態素ID
doc_id(str): 文書ID
"""
self.blist = BList(knp_string)
self.doc_id: str = doc_id
self.bps: List[BasePhrase] = []
dtid = dtid_offset
dmid = dmid_offset
for tag in self.blist.tag_list():
base_phrase = BasePhrase(tag, dmid, dtid, self.blist.sid, doc_id)
self.bps.append(base_phrase)
dtid += 1
dmid += len(base_phrase)
self._mrph2dmid: Dict[Morpheme, int] = dict(ChainMap(*(bp.mrph2dmid for bp in self.bps)))
for bp in self.bps:
if bp.tag.parent_id >= 0:
bp.parent = self.bps[bp.tag.parent_id]
for child in bp.tag.children:
bp.children.append(self.bps[child.tag_id])
@property
def sid(self) -> str:
"""文ID"""
return self.blist.sid
@property
def dtids(self) -> List[int]:
return [bp.dtid for bp in self.bps]
@property
def mrph2dmid(self) -> Dict[Morpheme, int]:
"""形態素とその文書レベルIDを紐付ける辞書"""
return self._mrph2dmid
@property
def surf(self) -> str:
"""表層表現"""
return ''.join(bp.surf for bp in self.bps)
def bnst_list(self):
return self.blist.bnst_list()
def tag_list(self):
return self.blist.tag_list()
def mrph_list(self):
return self.blist.mrph_list()
def __len__(self) -> int:
"""含まれる基本句の数"""
return len(self.bps)
def __getitem__(self, tid: int) -> Optional[BasePhrase]:
if 0 <= tid < len(self):
return self.bps[tid]
else:
logger.error(f'base phrase: {tid} out of range')
return None
def __iter__(self) -> Iterator[BasePhrase]:
return iter(self.bps)
def __eq__(self, other: 'Sentence') -> bool:
return self.sid == other.sid
def __str__(self) -> str:
return self.surf
def __repr__(self) -> str:
return f'Sentence(\'{self.surf}\', sid: {self.sid})'
| 26.396226 | 97 | 0.571837 | 333 | 2,798 | 4.615616 | 0.264264 | 0.050098 | 0.02082 | 0.028627 | 0.081327 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004688 | 0.313796 | 2,798 | 105 | 98 | 26.647619 | 0.795833 | 0.12366 | 0 | 0.0625 | 0 | 0 | 0.028535 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.21875 | false | 0 | 0.078125 | 0.125 | 0.53125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
a4682098f5bca1f0dcf1459c31a70bcb75d86127 | 236 | py | Python | artigos/serializers.py | BrenoRezende/DjangoBlog | f237d831a3dfcf006aaf50ba4aa66c89312bb389 | [
"MIT"
] | null | null | null | artigos/serializers.py | BrenoRezende/DjangoBlog | f237d831a3dfcf006aaf50ba4aa66c89312bb389 | [
"MIT"
] | null | null | null | artigos/serializers.py | BrenoRezende/DjangoBlog | f237d831a3dfcf006aaf50ba4aa66c89312bb389 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from .models import Artigo
class ArtigoSerializer(serializers.ModelSerializer):
class Meta:
model = Artigo
depth = 1
fields = ['id', 'titulo', 'texto', 'data', 'autor'] | 29.5 | 59 | 0.669492 | 25 | 236 | 6.28 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005464 | 0.224576 | 236 | 8 | 59 | 29.5 | 0.852459 | 0 | 0 | 0 | 0 | 0 | 0.092827 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
a479ce7f4028005a16cb8fc8e8dd376c1ce61fc4 | 515 | py | Python | api/management/commands/drown_negativity.py | eiling/SchoolIdolAPI | a05980fdb33b143dbe2febfc1ad6cf723f025c8d | [
"Apache-2.0"
] | 65 | 2017-12-29T12:28:11.000Z | 2022-03-15T06:42:26.000Z | api/management/commands/drown_negativity.py | eiling/SchoolIdolAPI | a05980fdb33b143dbe2febfc1ad6cf723f025c8d | [
"Apache-2.0"
] | 31 | 2017-12-18T02:03:09.000Z | 2022-01-13T00:43:35.000Z | api/management/commands/drown_negativity.py | eiling/SchoolIdolAPI | a05980fdb33b143dbe2febfc1ad6cf723f025c8d | [
"Apache-2.0"
] | 7 | 2018-08-27T15:11:01.000Z | 2021-08-16T05:15:13.000Z | from django.core.management.base import BaseCommand, CommandError
from api import models
from django.utils import timezone
from dateutil.relativedelta import relativedelta
from django.db.models import Q, F
class Command(BaseCommand):
can_import_settings = True
def handle(self, *args, **options):
models.Activity.objects.filter(Q(message_data__icontains='eunice') | Q(message_data__icontains='astin') | Q(message_data__icontains='suici')).update(creation=(timezone.now() - relativedelta(days=2)))
| 42.916667 | 207 | 0.782524 | 67 | 515 | 5.850746 | 0.61194 | 0.076531 | 0.091837 | 0.160714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002179 | 0.108738 | 515 | 11 | 208 | 46.818182 | 0.851852 | 0 | 0 | 0 | 0 | 0 | 0.031068 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.666667 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a4961f1435e8a8de04ca6fbf8141aa9b8d1a6b63 | 3,827 | py | Python | arithmetic_arranger.py | jmacdonald2010/arithmetic-formatter | 8f66803ea7889a230f451e8c5617710dc4326fca | [
"MIT"
] | null | null | null | arithmetic_arranger.py | jmacdonald2010/arithmetic-formatter | 8f66803ea7889a230f451e8c5617710dc4326fca | [
"MIT"
] | null | null | null | arithmetic_arranger.py | jmacdonald2010/arithmetic-formatter | 8f66803ea7889a230f451e8c5617710dc4326fca | [
"MIT"
] | null | null | null | def arithmetic_arranger(problems, answer=False):
# check to see if the list is too long
num_problems = len(problems)
answers_list = []
top_operand = []
operator = []
bottom_operand = []
# calculate answers, create a list of answers
# check to see if there are too many problems
if num_problems > 5:
return "Error: Too many problems."
for problem in problems:
problem_list = problem.split()
# if too many problems, return error
if (len(problem_list[0]) > 4) or (len(problem_list[2]) > 4):
return "Error: Numbers cannot be more than four digits."
# try/except to look for ValueErrors
try:
if problem_list[1] == '+':
result = int(problem_list[0]) + int(problem_list[2])
elif problem_list[1] == '-':
result = int(problem_list[0]) - int(problem_list[2])
# return error if wrong operator
else:
return "Error: Operator must be '+' or '-'."
except ValueError:
return "Error: Numbers must only contain digits."
answers_list.append(str(result))
top_operand.append(problem_list[0])
operator.append(problem_list[1])
bottom_operand.append(problem_list[2])
# determine lengths
# get lengths of all operands, append to list, then determine which to use for spacing purposes
top_lengths = []
bottom_lengths = []
actual_lengths = []
for value in top_operand:
top_lengths.append(len(value))
for value in bottom_operand:
bottom_lengths.append(len(value))
# determine which to use for spacing purposes
for i in range(0, len(top_lengths)):
if top_lengths[i] >= bottom_lengths[i]:
actual_lengths.append(top_lengths[i])
else:
actual_lengths.append(bottom_lengths[i])
actual_length_int = (int(actual_lengths[i]) + 2) # is for space/operator
actual_lengths[i] = actual_length_int
# build string
arranged_problems = ""
# top row
i = 0
for value in top_lengths:
space_length = actual_lengths[i] - value
spacing = " " * space_length
arranged_problems = arranged_problems + spacing
arranged_problems = arranged_problems + top_operand[i]
arranged_problems = arranged_problems + " "
i += 1
arranged_problems = arranged_problems.rstrip()
arranged_problems = arranged_problems + "\n"
# bottom operands and operators
i = 0
for value in bottom_lengths:
arranged_problems = arranged_problems + operator[i] + " "
space_length = (actual_lengths[i] - 2) - value
if space_length > 0:
spacing = " " * space_length
arranged_problems = arranged_problems + spacing
arranged_problems = arranged_problems + bottom_operand[i]
arranged_problems = arranged_problems + " "
i += 1
arranged_problems = arranged_problems.rstrip()
arranged_problems = arranged_problems + "\n"
# dashes
i = 0
for value in actual_lengths:
arranged_problems = arranged_problems + ("-" * actual_lengths[i])
arranged_problems = arranged_problems + " "
i += 1
arranged_problems = arranged_problems.rstrip()
if answer is True:
arranged_problems = arranged_problems + "\n"
i = 0
for answer in answers_list:
space_length = actual_lengths[i] - len(answer)
arranged_problems = arranged_problems + (" " * space_length)
arranged_problems = arranged_problems + answer
arranged_problems = arranged_problems + " "
i += 1
arranged_problems = arranged_problems.rstrip()
return arranged_problems | 35.435185 | 99 | 0.619545 | 442 | 3,827 | 5.142534 | 0.201357 | 0.281566 | 0.200616 | 0.267488 | 0.472503 | 0.33524 | 0.316322 | 0.283766 | 0.283766 | 0.283766 | 0 | 0.009623 | 0.293964 | 3,827 | 108 | 100 | 35.435185 | 0.831606 | 0.12046 | 0 | 0.316456 | 0 | 0 | 0.052506 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.012658 | false | 0 | 0 | 0 | 0.075949 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8ef9ecbe650f1215ae03531d7ea48fc9465c58fa | 1,573 | py | Python | tests/test_dockercomposeexecutor.py | Toilal/pytest-docker | 043e39c8215e0ab10b78ccce957a7c8369002701 | [
"MIT"
] | 2 | 2018-07-24T16:57:10.000Z | 2020-02-17T21:44:17.000Z | tests/test_dockercomposeexecutor.py | Toilal/pytest-docker | 043e39c8215e0ab10b78ccce957a7c8369002701 | [
"MIT"
] | null | null | null | tests/test_dockercomposeexecutor.py | Toilal/pytest-docker | 043e39c8215e0ab10b78ccce957a7c8369002701 | [
"MIT"
] | 2 | 2017-12-01T15:06:36.000Z | 2022-03-24T01:36:52.000Z | # -*- coding: utf-8 -*-
import mock
import subprocess
import py
from pytest_docker import DockerComposeExecutor
def test_execute():
docker_compose = DockerComposeExecutor("docker-compose.yml", "pytest123")
with mock.patch('subprocess.check_output') as check_output:
docker_compose.execute("up")
assert check_output.call_args_list == [
mock.call(
'docker-compose -f "docker-compose.yml" -p "pytest123" up',
shell=True, stderr=subprocess.STDOUT,
),
]
def test_pypath_compose_files():
compose_file = py.path.local('/tmp/docker-compose.yml')
docker_compose = DockerComposeExecutor(compose_file, "pytest123")
with mock.patch('subprocess.check_output') as check_output:
docker_compose.execute("up")
assert check_output.call_args_list == [
mock.call(
'docker-compose -f "/tmp/docker-compose.yml"'
' -p "pytest123" up',
shell=True, stderr=subprocess.STDOUT,
),
]
def test_multiple_compose_files():
docker_compose = DockerComposeExecutor(
["docker-compose.yml", "other-compose.yml"], "pytest123")
with mock.patch('subprocess.check_output') as check_output:
docker_compose.execute("up")
assert check_output.call_args_list == [
mock.call(
'docker-compose -f "docker-compose.yml" -f "other-compose.yml"'
' -p "pytest123" up',
shell=True, stderr=subprocess.STDOUT,
),
]
| 32.770833 | 79 | 0.615385 | 169 | 1,573 | 5.544379 | 0.242604 | 0.208111 | 0.102455 | 0.070438 | 0.744931 | 0.744931 | 0.648879 | 0.648879 | 0.648879 | 0.648879 | 0 | 0.01645 | 0.265734 | 1,573 | 47 | 80 | 33.468085 | 0.794805 | 0.01335 | 0 | 0.526316 | 0 | 0.026316 | 0.24129 | 0.075484 | 0 | 0 | 0 | 0 | 0.078947 | 1 | 0.078947 | false | 0 | 0.105263 | 0 | 0.184211 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f1069e273a7a93b5c7639cc543cab693ca1d614a | 109 | py | Python | PYTHON/Aula 6/Ex002.py | B1linha/ADS---Mackenzie | 0dc53418ff7580836f6a64c5370e204e8841d1a9 | [
"MIT"
] | null | null | null | PYTHON/Aula 6/Ex002.py | B1linha/ADS---Mackenzie | 0dc53418ff7580836f6a64c5370e204e8841d1a9 | [
"MIT"
] | null | null | null | PYTHON/Aula 6/Ex002.py | B1linha/ADS---Mackenzie | 0dc53418ff7580836f6a64c5370e204e8841d1a9 | [
"MIT"
] | null | null | null | ''' Este programa mostra, em ordem crescente, os números de 1 a 10'''
for num in range(1,11):
print(num) | 27.25 | 69 | 0.669725 | 20 | 109 | 3.65 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068966 | 0.201835 | 109 | 4 | 70 | 27.25 | 0.770115 | 0.568807 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
f113b0120585ad4911ce4b92c8c44ef0aa0e30f8 | 239 | py | Python | core/config.py | apexsodomy/CredSniper | f52461bff24dad2b0c81ce0bc02baa7124d0d54b | [
"Apache-2.0"
] | 1,163 | 2017-10-31T19:30:00.000Z | 2022-03-22T02:57:10.000Z | core/config.py | apexsodomy/CredSniper | f52461bff24dad2b0c81ce0bc02baa7124d0d54b | [
"Apache-2.0"
] | 26 | 2017-11-01T16:42:37.000Z | 2022-03-15T22:19:14.000Z | core/config.py | apexsodomy/CredSniper | f52461bff24dad2b0c81ce0bc02baa7124d0d54b | [
"Apache-2.0"
] | 295 | 2017-10-31T19:24:22.000Z | 2022-03-23T04:09:15.000Z | class Config():
def __init__(self):
self.api_token = None
self.module_name = None
self.port = None
self.enable_2fa = None
self.creds = None
self.seen = set()
self.verbose = False
| 23.9 | 31 | 0.552301 | 29 | 239 | 4.310345 | 0.62069 | 0.32 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006494 | 0.355649 | 239 | 9 | 32 | 26.555556 | 0.805195 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0 | 0 | 0.222222 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f12655b63bd33b4a9bb27d538c13b5a852dcd190 | 230 | py | Python | core/views/utils.py | LorenzSelv/pinned | f0df31dc68d6e2e5fdd13f2999a62d188df908f1 | [
"MIT"
] | 1 | 2017-11-21T13:46:09.000Z | 2017-11-21T13:46:09.000Z | core/views/utils.py | LorenzSelv/pinned | f0df31dc68d6e2e5fdd13f2999a62d188df908f1 | [
"MIT"
] | null | null | null | core/views/utils.py | LorenzSelv/pinned | f0df31dc68d6e2e5fdd13f2999a62d188df908f1 | [
"MIT"
] | null | null | null | from ..models import UserNotification
def get_user_notifications(user):
notifications = UserNotification.objects.filter(user=user)
result = [notification.content_object for notification in notifications]
return result | 38.333333 | 76 | 0.804348 | 25 | 230 | 7.28 | 0.68 | 0.186813 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 230 | 6 | 77 | 38.333333 | 0.91 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
f138402eb9c2879086725b17b79e8d403b5795d3 | 618 | py | Python | src/compas_blender/ui/__init__.py | yijiangh/compas | a9e86edf6b602f47ca051fccedcaa88a5e5d3600 | [
"MIT"
] | 1 | 2019-03-27T22:46:29.000Z | 2019-03-27T22:46:29.000Z | src/compas_blender/ui/__init__.py | yijiangh/compas | a9e86edf6b602f47ca051fccedcaa88a5e5d3600 | [
"MIT"
] | null | null | null | src/compas_blender/ui/__init__.py | yijiangh/compas | a9e86edf6b602f47ca051fccedcaa88a5e5d3600 | [
"MIT"
] | 1 | 2022-01-16T02:32:43.000Z | 2022-01-16T02:32:43.000Z |
"""
********************************************************************************
compas_blender.ui
********************************************************************************
.. currentmodule:: compas_blender.ui
.. autosummary::
:toctree: generated/
"""
from __future__ import absolute_import
from .bui import *
from .button import *
from .command import *
from .controller import *
from .mouse import *
from .bui import __all__ as a
from .button import __all__ as b
from .command import __all__ as c
from .controller import __all__ as d
from .mouse import __all__ as e
__all__ = a + b + c + d + e
| 22.071429 | 80 | 0.535599 | 66 | 618 | 4.545455 | 0.348485 | 0.2 | 0.183333 | 0.126667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142395 | 618 | 27 | 81 | 22.888889 | 0.566038 | 0.420712 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.916667 | 0 | 0.916667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f141fb9705866e0e121be2cd24f11f8a70eb6833 | 87 | py | Python | dash_tree_checklist/_imports_.py | sgratzl/dash-tree-checklist | 0499a3ed082d3e4982e02d59b40e9be47e6f134f | [
"Apache-2.0"
] | 1 | 2021-08-14T11:27:51.000Z | 2021-08-14T11:27:51.000Z | dash_tree_checklist/_imports_.py | sgratzl/dash-tree-checklist | 0499a3ed082d3e4982e02d59b40e9be47e6f134f | [
"Apache-2.0"
] | null | null | null | dash_tree_checklist/_imports_.py | sgratzl/dash-tree-checklist | 0499a3ed082d3e4982e02d59b40e9be47e6f134f | [
"Apache-2.0"
] | null | null | null | from .DashTreeChecklist import DashTreeChecklist
__all__ = [
"DashTreeChecklist"
] | 17.4 | 48 | 0.781609 | 6 | 87 | 10.666667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149425 | 87 | 5 | 49 | 17.4 | 0.864865 | 0 | 0 | 0 | 0 | 0 | 0.193182 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
74c6aac8f00bb4a89767790f3d0a3d3c47b2db8f | 142 | py | Python | 001257DFedorovPythonBasics/pythonOrgDataStructuresSet_20200502.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | 001257DFedorovPythonBasics/pythonOrgDataStructuresSet_20200502.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | 001257DFedorovPythonBasics/pythonOrgDataStructuresSet_20200502.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | # https://docs.python.org/3/tutorial/datastructures.html#sets
basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
print(basket)
| 35.5 | 65 | 0.690141 | 18 | 142 | 5.444444 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007634 | 0.077465 | 142 | 3 | 66 | 47.333333 | 0.740458 | 0.408451 | 0 | 0 | 0 | 0 | 0.395062 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
74d2d68395925a614818563d0f2aa04fba9ed2ee | 139 | py | Python | acmicpc/5363.py | juseongkr/BOJ | 8f10a2bf9a7d695455493fbe7423347a8b648416 | [
"Apache-2.0"
] | 7 | 2020-02-03T10:00:19.000Z | 2021-11-16T11:03:57.000Z | acmicpc/5363.py | juseongkr/Algorithm-training | 8f10a2bf9a7d695455493fbe7423347a8b648416 | [
"Apache-2.0"
] | 1 | 2021-01-03T06:58:24.000Z | 2021-01-03T06:58:24.000Z | acmicpc/5363.py | juseongkr/Algorithm-training | 8f10a2bf9a7d695455493fbe7423347a8b648416 | [
"Apache-2.0"
] | 1 | 2020-01-22T14:34:03.000Z | 2020-01-22T14:34:03.000Z | for _ in range(int(input())):
s = input().split()
for i in range(2, len(s)):
print(s[i], end=' ')
print(s[0]+' '+s[1])
| 23.166667 | 30 | 0.467626 | 24 | 139 | 2.666667 | 0.583333 | 0.21875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 0.266187 | 139 | 5 | 31 | 27.8 | 0.598039 | 0 | 0 | 0 | 0 | 0 | 0.014388 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
74d7a62ed3189bc3b62328e09c789eef6ff7072b | 8,210 | py | Python | tests/test_fixes/test_propose_fixes.py | roocs/dachar | 687b6acb535f634791d13a435cded5f97cae8e76 | [
"BSD-3-Clause"
] | 2 | 2020-05-01T11:17:06.000Z | 2020-11-23T10:37:24.000Z | tests/test_fixes/test_propose_fixes.py | roocs/dachar | 687b6acb535f634791d13a435cded5f97cae8e76 | [
"BSD-3-Clause"
] | 69 | 2020-03-26T15:39:26.000Z | 2022-01-14T14:34:39.000Z | tests/test_fixes/test_propose_fixes.py | roocs/dachar | 687b6acb535f634791d13a435cded5f97cae8e76 | [
"BSD-3-Clause"
] | null | null | null | import os
import shutil
import subprocess
from unittest.mock import Mock
import mock
import pytest
from dachar.fixes import generate_proposals
from dachar.utils.common import now_string
from tests._stores_for_tests import _TestFixProposalStore
prop_store = None
cwd = os.getcwd()
def clear_store():
fp_dr = _TestFixProposalStore.config["local.base_dir"]
if os.path.isdir(fp_dr):
shutil.rmtree(fp_dr)
def setup_module():
clear_store()
global prop_store
prop_store = _TestFixProposalStore()
def test_generate_proposal_json():
file = [f"{cwd}/tests/test_fixes/decadal_fixes/decadal.json"]
generate_proposals.get_fix_prop_store = Mock(return_value=prop_store)
generate_proposals.generate_fix_proposals(file)
record = prop_store.get_proposed_fix_by_id(
"CMIP6.DCPP.MOHC.HadGEM3-GC31-MM.dcppA-hindcast.s2004-r3i1p1f2.Amon.pr.gn.v20200417"
)
assert record[0]["this_fix"]["fix"]["fix_id"] == "VarAttrFix"
clear_store()
def test_generate_proposal_json_2_fixes():
file = [
{
"dataset_id": "CMIP6.DCPP.MOHC.HadGEM3-GC31-MM.dcppA-hindcast.s2004-r3i1p1f2.Amon.pr.gn.v20200417",
"fixes": [
{
"fix_id": "VarAttrFix",
"operands": {
"var_id": "time",
"attrs": {"long_name": "valid_time"},
},
"source": {
"name": "ceda",
"version": "",
"comments": "",
"url": "https://github.com/cp4cds/c3s34g_master/tree/master/Decadal",
},
},
{
"fix_id": "GlobalAttrFix",
"operands": {
"attrs": {
"forcing_description": "Free text describing the forcings",
"physics_description": "Free text describing the physics method",
"initialization_description": "Free text describing the initialization method",
"startdate": "s200411",
"sub_experiment_id": "s200411",
}
},
"source": {
"name": "ceda",
"version": "",
"comments": "",
"url": "https://github.com/cp4cds/c3s34g_master/tree/master/Decadal",
},
},
],
}
]
generate_proposals.get_fix_prop_store = Mock(return_value=prop_store)
generate_proposals.generate_fix_proposals(file)
record = prop_store.get_proposed_fix_by_id(
"CMIP6.DCPP.MOHC.HadGEM3-GC31-MM.dcppA-hindcast.s2004-r3i1p1f2.Amon.pr.gn.v20200417"
)
assert record[0]["this_fix"]["fix"]["fix_id"] == "VarAttrFix"
assert record[1]["this_fix"]["fix"]["fix_id"] == "GlobalAttrFix"
clear_store()
def test_generate_proposal_template():
ds_list = f"{cwd}/tests/test_fixes/decadal_fixes/decadal_fix_list.txt"
template = f"{cwd}/tests/test_fixes/decadal_fixes/decadal_template.json"
generate_proposals.get_fix_prop_store = Mock(return_value=prop_store)
generate_proposals.generate_proposal_from_template(template, ds_list)
record = prop_store.get_proposed_fix_by_id(
"CMIP6.DCPP.MOHC.HadGEM3-GC31-MM.dcppA-hindcast.s2004-r3i1p1f2.Amon.pr.gn.v20200417"
)
assert record[0]["this_fix"]["fix"]["fix_id"] == "VarAttrFix"
def test_generate_proposal_when_one_already_exists():
file = [
{
"dataset_id": "CMIP6.DCPP.MOHC.HadGEM3-GC31-MM.dcppA-hindcast.s2004-r3i1p1f2.Amon.pr.gn.v20200417",
"fixes": [
{
"fix_id": "CheckAddGlobalAttrFix",
"operands": {"attrs": {"test": "test"}},
"source": {
"name": "ceda",
"version": "",
"comments": "",
"url": "https://github.com/cp4cds/c3s34g_master/tree/master/Decadal",
},
}
],
}
]
generate_proposals.get_fix_prop_store = Mock(return_value=prop_store)
generate_proposals.generate_fix_proposals(file)
record = prop_store.get_proposed_fix_by_id(
"CMIP6.DCPP.MOHC.HadGEM3-GC31-MM.dcppA-hindcast.s2004-r3i1p1f2.Amon.pr.gn.v20200417"
)
assert record[0]["this_fix"]["fix"]["fix_id"] == "VarAttrFix"
assert record[-1]["this_fix"]["fix"]["fix_id"] == "CheckAddGlobalAttrFix"
def test_unexpected_operands():
file = [
{
"dataset_id": "CMIP6.DCPP.MOHC.HadGEM3-GC31-MM.dcppA-hindcast.s2004-r3i1p1f2.Amon.pr.gn.v20200417",
"fixes": [
{
"fix_id": "VarAttrFix",
"operands": {"var_id": "pr", "attrs": {}, "test": "not_real"},
"source": {
"name": "ceda",
"version": "",
"comments": "",
"url": "https://github.com/cp4cds/c3s34g_master/tree/master/Decadal",
},
}
],
}
]
generate_proposals.get_fix_prop_store = Mock(return_value=prop_store)
with pytest.raises(KeyError) as exc:
generate_proposals.generate_fix_proposals(file)
assert exc.value.args[0] == "Invalid keyword arguments received: {'test'}"
def test_missing_operands():
file = [
{
"dataset_id": "CMIP6.DCPP.MOHC.HadGEM3-GC31-MM.dcppA-hindcast.s2004-r3i1p1f2.Amon.pr.gn.v20200417",
"fixes": [
{
"fix_id": "VarAttrFix",
"operands": {"var_id": "pr", "test": "not_real"},
"source": {
"name": "ceda",
"version": "",
"comments": "",
"url": "https://github.com/cp4cds/c3s34g_master/tree/master/Decadal",
},
}
],
}
]
generate_proposals.get_fix_prop_store = Mock(return_value=prop_store)
with pytest.raises(KeyError) as exc:
generate_proposals.generate_fix_proposals(file)
assert exc.value.args[0] == "Required keyword argument(s) not provided: {'attrs'}"
def test_invalid_fields():
file = [
{
"dataset_id": "CMIP6.DCPP.MOHC.HadGEM3-GC31-MM.dcppA-hindcast.s2004-r3i1p1f2.Amon.pr.gn.v20200417",
"fixes": [
{
"fox_id": "VarAttrFix",
"operands": {"test": "not_real"},
"source": {
"name": "ceda",
"version": "",
"comments": "",
"url": "https://github.com/cp4cds/c3s34g_master/tree/master/Decadal",
},
}
],
}
]
generate_proposals.get_fix_prop_store = Mock(return_value=prop_store)
with pytest.raises(KeyError) as exc:
generate_proposals.generate_fix_proposals(file)
assert exc.value.args[0] == "Required fields not provided: {'fix_id'}"
def test_missing_fields():
file = [
{
"dataset_id": "cmip5.output1.MOHC.HadGEM2-CC.historical.yr.ocnBgchem.Oyr.r1i1p1.latest.o2",
"fixes": [
{
"fix_id": "MainVarAttrFix",
"source": {
"name": "ceda",
"version": "",
"comments": "",
"url": "https://github.com/cp4cds/c3s34g_master/tree/master/Decadal",
},
}
],
}
]
generate_proposals.get_fix_prop_store = Mock(return_value=prop_store)
with pytest.raises(KeyError) as exc:
generate_proposals.generate_fix_proposals(file)
assert exc.value.args[0] == "Required fields not provided: {'operands'}"
def teardown_module():
# pass
clear_store()
| 33.786008 | 111 | 0.528989 | 800 | 8,210 | 5.1825 | 0.19 | 0.049928 | 0.023878 | 0.032562 | 0.743367 | 0.712735 | 0.696816 | 0.696816 | 0.670043 | 0.670043 | 0 | 0.044033 | 0.341657 | 8,210 | 242 | 112 | 33.92562 | 0.723034 | 0.000487 | 0 | 0.494949 | 1 | 0.050505 | 0.314481 | 0.127255 | 0 | 0 | 0 | 0 | 0.050505 | 1 | 0.055556 | false | 0 | 0.045455 | 0 | 0.10101 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
74e9df97be9889d989c5c577ed8cbe235bedd5dc | 384 | py | Python | tests/import/subpkg/sub1.py | ktok07b6/polyphony | 657c5c7440520db6b4985970bd50547407693ac4 | [
"MIT"
] | 83 | 2015-11-30T09:59:13.000Z | 2021-08-03T09:12:28.000Z | tests/import/subpkg/sub1.py | jesseclin/polyphony | 657c5c7440520db6b4985970bd50547407693ac4 | [
"MIT"
] | 4 | 2017-02-10T01:43:11.000Z | 2020-07-14T03:52:25.000Z | tests/import/subpkg/sub1.py | jesseclin/polyphony | 657c5c7440520db6b4985970bd50547407693ac4 | [
"MIT"
] | 11 | 2016-11-18T14:39:15.000Z | 2021-02-23T10:05:20.000Z | from .subsubpkg.subsub1 import func1 as sub_f1
SUB1_GLOBAL = 111
SUB1_GLOBAL_ARRAY = [1, 2, 3, 4]
SUB1_GLOBAL_TUPLE = (5, 6, 7, 8)
def func1(x):
return x + 1
def func2(x):
return sub_f1(x)
def get_v(c):
return c.v()
class SubC:
VALUE1 = 1234
VALUE2 = (1, 2, 3, 4)
def __init__(self, x):
self.x = x * x
def v(self):
return self.x
| 13.241379 | 46 | 0.578125 | 68 | 384 | 3.088235 | 0.514706 | 0.142857 | 0.028571 | 0.038095 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114391 | 0.294271 | 384 | 28 | 47 | 13.714286 | 0.660517 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.294118 | false | 0 | 0.058824 | 0.235294 | 0.764706 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
74f30d068ac2e2166e9038aaa006b1c3dd37b611 | 288 | py | Python | rl/configs/AdamConfig.py | mahkons/Lottery-ticket-hypothesis | 96ec399fdfc4138a37feecb24a63b3cdb8e50e1e | [
"MIT"
] | 7 | 2020-10-08T04:59:51.000Z | 2021-12-03T06:12:39.000Z | rl/configs/AdamConfig.py | mahkons/Lottery-ticket-hypothesis | 96ec399fdfc4138a37feecb24a63b3cdb8e50e1e | [
"MIT"
] | null | null | null | rl/configs/AdamConfig.py | mahkons/Lottery-ticket-hypothesis | 96ec399fdfc4138a37feecb24a63b3cdb8e50e1e | [
"MIT"
] | null | null | null | import torch.optim
from configs.Config import OptimizerConfig
class AdamConfig(OptimizerConfig):
def __init__(self, lr: float):
super(AdamConfig, self)
self.lr = lr
def create_optimizer(self, parameters):
return torch.optim.Adam(parameters, lr=self.lr)
| 24 | 55 | 0.708333 | 35 | 288 | 5.685714 | 0.571429 | 0.090452 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.201389 | 288 | 11 | 56 | 26.181818 | 0.865217 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
2d2da09da7fc20b84e6ac0dbf742117c2fc61e21 | 150 | py | Python | face_recognition/scripts/train_face_recognition.py | JamesUnicomb/face_recognition | f28c3ef023cbfaaa1daf73f3aa1f2a341793b91f | [
"MIT"
] | 3 | 2017-10-14T08:39:32.000Z | 2018-06-07T18:19:48.000Z | face_recognition/scripts/train_face_recognition.py | JamesUnicomb/face_recognition | f28c3ef023cbfaaa1daf73f3aa1f2a341793b91f | [
"MIT"
] | 3 | 2018-06-14T00:51:43.000Z | 2021-01-25T00:52:59.000Z | face_recognition/scripts/train_face_recognition.py | JamesUnicomb/face_recognition | f28c3ef023cbfaaa1daf73f3aa1f2a341793b91f | [
"MIT"
] | 1 | 2017-10-14T08:39:34.000Z | 2017-10-14T08:39:34.000Z | #!/usr/bin/env python
import numpy as np
from face_recognition import FaceRecognition
fr = FaceRecognition(load_model = False)
fr.train_network()
| 15 | 44 | 0.786667 | 21 | 150 | 5.47619 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 150 | 9 | 45 | 16.666667 | 0.884615 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2d3388f427827d32a7c6207d5d401526496dfb6e | 4,740 | py | Python | tests/libs/io_peripherals/test_pwm.py | izm51/obniz-python-sdk | 40a738b5fe2c0a415cdc09f46d28c143982bfb07 | [
"MIT"
] | 11 | 2019-03-22T12:02:11.000Z | 2021-01-21T04:57:18.000Z | tests/libs/io_peripherals/test_pwm.py | izm51/obniz-python-sdk | 40a738b5fe2c0a415cdc09f46d28c143982bfb07 | [
"MIT"
] | 5 | 2019-03-02T08:28:25.000Z | 2021-02-02T22:06:37.000Z | tests/libs/io_peripherals/test_pwm.py | izm51/obniz-python-sdk | 40a738b5fe2c0a415cdc09f46d28c143982bfb07 | [
"MIT"
] | 3 | 2019-07-20T06:55:09.000Z | 2019-12-04T05:05:00.000Z | import pytest
from ...utils import assert_finished, assert_send
class TestPeripheralPWM:
def test_getpwm(self, obniz):
pwm = obniz.get_free_pwm()
assert_finished(obniz)
assert pwm == obniz.pwm0
def test_getpwm_double(self, obniz):
pwm1 = obniz.get_free_pwm()
pwm2 = obniz.get_free_pwm()
assert_finished(obniz)
assert pwm1 == obniz.pwm0
assert pwm2 == obniz.pwm1
def test_getpwm_released(self, obniz):
pwm1 = obniz.get_free_pwm()
assert pwm1 == obniz.pwm0
pwm1.start({"io": 11})
assert_send(obniz, [{"io11": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io11": {"pull_type": "float"}}])
assert_send(obniz, [{"pwm0": {"io": 11}}])
pwm1.end()
assert_send(obniz, [{"pwm0": None}])
pwm2 = obniz.get_free_pwm()
assert pwm2 == obniz.pwm0
assert_finished(obniz)
def test_start_io(self, obniz):
pwm = obniz.get_free_pwm()
pwm.start({"io": 11})
assert_send(obniz, [{"io11": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io11": {"pull_type": "float"}}])
assert_send(obniz, [{"pwm0": {"io": 11}}])
assert_finished(obniz)
assert pwm == obniz.pwm0
def test_start_io_with_drive_pull(self, obniz):
pwm = obniz.get_free_pwm()
pwm.start({"io": 11, "drive": "open-drain", "pull": "5v"})
assert_send(obniz, [{"io11": {"output_type": "open-drain"}}])
assert_send(obniz, [{"io11": {"pull_type": "pull-up5v"}}])
assert_send(obniz, [{"pwm0": {"io": 11}}])
assert_finished(obniz)
assert pwm == obniz.pwm0
def test_start_io_invalid(self, obniz):
pwm = obniz.get_free_pwm()
with pytest.raises(Exception, match="io 15 is not valid io"):
pwm.start({"io": 15})
assert_finished(obniz)
assert pwm == obniz.pwm0
def test_freq(self, obniz):
pwm = obniz.get_free_pwm()
pwm.start({"io": 10})
assert_send(obniz, [{"io10": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io10": {"pull_type": "float"}}])
assert_send(obniz, [{"pwm0": {"io": 10}}])
pwm.freq(1000)
assert_send(obniz, [{"pwm0": {"freq": 1000}}])
assert_finished(obniz)
assert pwm == obniz.pwm0
def test_pulse(self, obniz):
pwm = obniz.get_free_pwm()
pwm.start({"io": 9})
assert_send(obniz, [{"io9": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io9": {"pull_type": "float"}}])
assert_send(obniz, [{"pwm0": {"io": 9}}])
pwm.freq(500)
assert_send(obniz, [{"pwm0": {"freq": 500}}])
pwm.pulse(0.5)
assert_send(obniz, [{"pwm0": {"pulse": 0.5}}])
assert_finished(obniz)
assert pwm == obniz.pwm0
def test_duty(self, obniz):
pwm = obniz.get_free_pwm()
pwm.start({"io": 9})
assert_send(obniz, [{"io9": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io9": {"pull_type": "float"}}])
assert_send(obniz, [{"pwm0": {"io": 9}}])
pwm.freq(500)
assert_send(obniz, [{"pwm0": {"freq": 500}}])
pwm.duty(0.5)
assert_send(obniz, [{"pwm0": {"pulse": 0.01}}])
assert_finished(obniz)
assert pwm == obniz.pwm0
def test_modulate(self, obniz):
pwm = obniz.get_free_pwm()
pwm.start({"io": 11}) # start pwm. output at io11
assert_send(obniz, [{"io11": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io11": {"pull_type": "float"}}])
assert_send(obniz, [{"pwm0": {"io": 11}}])
pwm.freq(38000) # set pwm frequency to 38khz
assert_send(obniz, [{"pwm0": {"freq": 38000}}])
# signal for room heater's remote signal
arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
pwm.modulate("am", 0.07, arr) # am modulate. symbol length = 70usec.
assert_send(
obniz,
[
{
"pwm0": {
"modulate": {"data": arr, "symbol_length": 0.07, "type": "am"}
}
}
],
)
assert_finished(obniz)
assert pwm == obniz.pwm0
def test_end(self, obniz):
pwm = obniz.get_free_pwm()
pwm.start({"io": 11})
assert_send(obniz, [{"io11": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io11": {"pull_type": "float"}}])
assert_send(obniz, [{"pwm0": {"io": 11}}])
pwm.end()
assert_send(obniz, [{"pwm0": None}])
assert_finished(obniz)
assert pwm == obniz.pwm0
| 33.380282 | 86 | 0.53692 | 584 | 4,740 | 4.171233 | 0.138699 | 0.139573 | 0.203202 | 0.132594 | 0.752053 | 0.730706 | 0.674466 | 0.605911 | 0.543514 | 0.43514 | 0 | 0.053896 | 0.279747 | 4,740 | 141 | 87 | 33.617021 | 0.659637 | 0.027004 | 0 | 0.575221 | 0 | 0 | 0.120252 | 0 | 0 | 0 | 0 | 0 | 0.513274 | 1 | 0.097345 | false | 0 | 0.017699 | 0 | 0.123894 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2d34d02331d899ea46204d9df1dcefbbad132bc2 | 186 | py | Python | tests/utils.py | wy-z/openapi-type | bd5ec745f6bc8de388acbf86832411a16dc30d7e | [
"MIT"
] | 10 | 2021-01-18T06:14:16.000Z | 2022-03-18T23:15:44.000Z | tests/utils.py | wy-z/openapi-type | bd5ec745f6bc8de388acbf86832411a16dc30d7e | [
"MIT"
] | 22 | 2020-12-27T09:23:58.000Z | 2021-04-29T20:43:30.000Z | tests/utils.py | wy-z/openapi-type | bd5ec745f6bc8de388acbf86832411a16dc30d7e | [
"MIT"
] | 2 | 2021-03-30T10:25:59.000Z | 2021-11-05T23:36:15.000Z | import json
from pathlib import Path
from openapi_type import OpenAPI, parse_spec
def load_spec(s: Path) -> OpenAPI:
with s.open() as fd:
return parse_spec(json.load(fd))
| 18.6 | 44 | 0.715054 | 30 | 186 | 4.3 | 0.566667 | 0.139535 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.198925 | 186 | 9 | 45 | 20.666667 | 0.865772 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.5 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2d3c50f204e2d847bf17cc8fb2717afc78c92dad | 248 | py | Python | codechef/ltime27_mnmx.py | knuu/competitive-programming | 16bc68fdaedd6f96ae24310d697585ca8836ab6e | [
"MIT"
] | 1 | 2018-11-12T15:18:55.000Z | 2018-11-12T15:18:55.000Z | codechef/ltime27_mnmx.py | knuu/competitive-programming | 16bc68fdaedd6f96ae24310d697585ca8836ab6e | [
"MIT"
] | null | null | null | codechef/ltime27_mnmx.py | knuu/competitive-programming | 16bc68fdaedd6f96ae24310d697585ca8836ab6e | [
"MIT"
] | null | null | null | def read_list(t): return [t(x) for x in input().split()]
def read_line(t): return t(input())
def read_lines(t, N): return [t(input()) for _ in range(N)]
for i in range(read_line(int)):
N = read_line(int)
print(min(read_list(int)) * (N-1))
| 31 | 59 | 0.641129 | 49 | 248 | 3.102041 | 0.387755 | 0.138158 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004808 | 0.16129 | 248 | 7 | 60 | 35.428571 | 0.725962 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 0.5 | 0.166667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
2d4355da53f98a88424922d06deb8ddf79c51b32 | 125 | py | Python | ruts/datasets/__init__.py | AlexeyVatolin/ruTS | 687b69bfaf9e46d072483dd433fbac626de89ada | [
"MIT"
] | 72 | 2019-12-22T09:45:33.000Z | 2022-03-29T11:39:57.000Z | ruts/datasets/__init__.py | AlexeyVatolin/ruTS | 687b69bfaf9e46d072483dd433fbac626de89ada | [
"MIT"
] | 6 | 2020-01-09T13:37:28.000Z | 2022-03-12T01:06:01.000Z | ruts/datasets/__init__.py | AlexeyVatolin/ruTS | 687b69bfaf9e46d072483dd433fbac626de89ada | [
"MIT"
] | 16 | 2019-12-29T13:01:37.000Z | 2021-08-30T12:34:37.000Z | from .sov_chrest_lit import SovChLit
from .stalin_works import StalinWorks
__all__ = [
"SovChLit",
"StalinWorks",
]
| 15.625 | 37 | 0.728 | 14 | 125 | 6 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.184 | 125 | 7 | 38 | 17.857143 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0.152 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7436da5f52188ed9b2ce406b656c5e2591ca8736 | 768 | py | Python | elasticai/creator/brevitas/translation_functions/quantizers.py | es-ude/elastic-ai.creator | 329f779e97bcb9e175409564b733f7a756996143 | [
"MIT"
] | 1 | 2022-02-02T14:11:26.000Z | 2022-02-02T14:11:26.000Z | elasticai/creator/brevitas/translation_functions/quantizers.py | es-ude/elastic-ai.creator | 329f779e97bcb9e175409564b733f7a756996143 | [
"MIT"
] | 50 | 2021-12-16T15:57:28.000Z | 2022-03-28T13:29:46.000Z | elasticai/creator/brevitas/translation_functions/quantizers.py | es-ude/elastic-ai.creator | 329f779e97bcb9e175409564b733f7a756996143 | [
"MIT"
] | 1 | 2021-12-17T11:55:53.000Z | 2021-12-17T11:55:53.000Z | import brevitas.nn as bnn
import elasticai.creator.brevitas.brevitas_quantizers as bquant
from elasticai.creator.qat.layers import Binarize, Ternarize
def translate_binarize_layer(layer: Binarize) -> bnn.QuantIdentity:
"""
translates a qtorch binarize layer into a brevitas binarize layer
Args:
layer (Binarize): qtorch layer
Returns:
brevitas layer
"""
return bnn.QuantIdentity(act_quant=bquant.BinaryActivation)
def translate_ternarize_layer(layer: Ternarize) -> bnn.QuantIdentity:
"""
translates a qtorch ternarize layer into a brevitas ternarize layer
Args:
layer (Ternarize): qtorch layer
Returns:
brevitas layer
"""
return bnn.QuantIdentity(act_quant=bquant.TernaryActivation)
| 28.444444 | 71 | 0.731771 | 87 | 768 | 6.37931 | 0.333333 | 0.115315 | 0.093694 | 0.097297 | 0.36036 | 0.241441 | 0.241441 | 0.241441 | 0.241441 | 0.241441 | 0 | 0 | 0.197917 | 768 | 26 | 72 | 29.538462 | 0.900974 | 0.354167 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.428571 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
74404e56da971e471fc6e63b5777c9a00f2d80d5 | 14 | py | Python | src/spaceone/core/__init__.py | choonho/python-core | 1b174e9fe56b75b2706a9d78e947010514e90f6d | [
"Apache-2.0"
] | 14 | 2020-06-01T08:17:43.000Z | 2022-01-13T22:37:50.000Z | src/spaceone/core/__init__.py | choonho/python-core | 1b174e9fe56b75b2706a9d78e947010514e90f6d | [
"Apache-2.0"
] | 7 | 2020-08-11T23:05:59.000Z | 2022-01-12T05:08:49.000Z | src/spaceone/core/__init__.py | choonho/python-core | 1b174e9fe56b75b2706a9d78e947010514e90f6d | [
"Apache-2.0"
] | 11 | 2020-06-01T08:17:49.000Z | 2021-11-25T08:26:37.000Z | name = 'core'
| 7 | 13 | 0.571429 | 2 | 14 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.214286 | 14 | 1 | 14 | 14 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
744277d23349ba5f72388bec9d5ee2540c350e69 | 421 | py | Python | __init__.py | maksim-shaidulin/todo | ae15beb0ac3acfe9114ef312b2bf44cd9269dd46 | [
"MIT"
] | 1 | 2020-06-15T12:08:05.000Z | 2020-06-15T12:08:05.000Z | __init__.py | maksim-shaidulin/todo-flask-sqlalchemy | ae15beb0ac3acfe9114ef312b2bf44cd9269dd46 | [
"MIT"
] | null | null | null | __init__.py | maksim-shaidulin/todo-flask-sqlalchemy | ae15beb0ac3acfe9114ef312b2bf44cd9269dd46 | [
"MIT"
] | null | null | null | from flask import Flask
from .models import db
from . import config
def create_app():
app = Flask(__name__)
app.secret_key = "Secret Key"
# app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///todo.db'
app.config['SQLALCHEMY_DATABASE_URI'] = config.DATABASE_URI
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.app_context().push()
db.init_app(app)
db.create_all()
return app
| 24.764706 | 65 | 0.700713 | 57 | 421 | 4.894737 | 0.438596 | 0.064516 | 0.204301 | 0.193548 | 0.215054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178147 | 421 | 16 | 66 | 26.3125 | 0.806358 | 0.140143 | 0 | 0 | 0 | 0 | 0.175 | 0.147222 | 0 | 0 | 0 | 0.0625 | 0 | 1 | 0.083333 | false | 0 | 0.25 | 0 | 0.416667 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7452b91c3c019fa40f0c700694ccb1e916b0b9d0 | 4,071 | py | Python | net.py | ioComk/DNN | b890e9014ebb1900885ae532321f9620b1240bf8 | [
"MIT"
] | null | null | null | net.py | ioComk/DNN | b890e9014ebb1900885ae532321f9620b1240bf8 | [
"MIT"
] | null | null | null | net.py | ioComk/DNN | b890e9014ebb1900885ae532321f9620b1240bf8 | [
"MIT"
] | null | null | null | import numpy as np
import torch.nn as nn
import torch as t
class ConvModel(nn.Module):
def __init__(self):
super().__init__()
def calc_out_size(self, in_size, kernel_size, stride, padding):
return int(np.floor(((in_size + (2*padding) - (kernel_size-1) - 1) // stride) + 1))
def forward(self, x):
x = self.conv(x) # conv.
x = t.flatten(x, 1) # flatten
x = self.dense(x) # dense
return x
class Conv1dModel(ConvModel):
def __init__(self, out_dim, p=0):
super().__init__()
input_size = 448
hidden1 = 256
hidden2 = 128
hidden3 = 64
hidden4 = 32
self.conv = nn.Sequential(
nn.Conv1d(in_channels=3, out_channels=8, kernel_size=5, stride=3),
nn.BatchNorm1d(8),
nn.ReLU(),
nn.MaxPool1d(kernel_size=2, stride=2),
nn.Conv1d(in_channels=8, out_channels=16, kernel_size=5, stride=3),
nn.BatchNorm1d(16),
nn.ReLU(),
nn.MaxPool1d(kernel_size=2, stride=2),
nn.Conv1d(in_channels=16, out_channels=32, kernel_size=5, stride=3),
nn.BatchNorm1d(32),
nn.ReLU(),
nn.MaxPool1d(kernel_size=2, stride=2),
)
self.dense = nn.Sequential(
nn.Linear(input_size, hidden1),
nn.BatchNorm1d(hidden1),
nn.ReLU(),
nn.Dropout(p),
nn.Linear(hidden1, hidden2),
nn.BatchNorm1d(hidden2),
nn.ReLU(),
nn.Dropout(p),
nn.Linear(hidden2, hidden2),
nn.BatchNorm1d(hidden2),
nn.ReLU(),
nn.Dropout(p),
nn.Linear(hidden2, hidden3),
nn.BatchNorm1d(hidden3),
nn.ReLU(),
nn.Dropout(p),
nn.Linear(hidden3, out_dim),
)
class Conv2dModel(ConvModel):
def __init__(self, out_dim, p=0):
super().__init__()
input_size = 2240
hidden1 = 512
hidden2 = 512
out_channels = [16, 32, 64, 64]
self.conv = nn.Sequential(
nn.Conv2d(in_channels=3, out_channels=out_channels[0], kernel_size=[3, 3], stride=[1, 1], padding=[1, 1]),
nn.BatchNorm2d(out_channels[0]),
nn.Mish(),
nn.MaxPool2d(kernel_size=3, stride=1, padding=1),
nn.Dropout2d(p=0.5),
nn.Conv2d(in_channels=out_channels[0], out_channels=out_channels[1], kernel_size=[3, 3], stride=[1, 1], padding=[1, 1]),
nn.BatchNorm2d(out_channels[1]),
nn.Mish(),
nn.MaxPool2d(kernel_size=3, stride=1, padding=1),
nn.Dropout2d(p=0.5),
nn.Conv2d(in_channels=out_channels[1], out_channels=out_channels[2], kernel_size=[3, 3], stride=[1, 1], padding=[0, 0]),
nn.BatchNorm2d(out_channels[2]),
nn.Mish(),
nn.MaxPool2d(kernel_size=2, padding=0),
nn.Dropout2d(p=0.5),
nn.Conv2d(in_channels=out_channels[2], out_channels=out_channels[3], kernel_size=[2, 2], stride=[1, 1], padding=[0, 0]),
nn.BatchNorm2d(out_channels[3]),
nn.Mish(),
nn.MaxPool2d(kernel_size=2, padding=0),
nn.Dropout2d(p=0.5),
nn.Conv2d(in_channels=out_channels[2], out_channels=out_channels[3], kernel_size=[2, 2], stride=[1, 1], padding=[0, 0]),
nn.BatchNorm2d(out_channels[3]),
nn.Mish(),
nn.MaxPool2d(kernel_size=2, padding=0),
nn.Dropout2d(p=0.5),
)
self.dense = nn.Sequential(
nn.Linear(input_size, hidden1),
nn.BatchNorm1d(hidden1),
nn.Mish(),
nn.Dropout(p),
nn.Linear(hidden1, hidden2),
nn.BatchNorm1d(hidden2),
nn.Mish(),
nn.Dropout(p),
nn.Linear(hidden2, hidden2),
nn.BatchNorm1d(hidden2),
nn.Mish(),
nn.Dropout(p),
nn.Linear(hidden2, out_dim),
) | 31.315385 | 132 | 0.532547 | 511 | 4,071 | 4.076321 | 0.127202 | 0.121459 | 0.082093 | 0.040326 | 0.74748 | 0.705233 | 0.705233 | 0.645223 | 0.639462 | 0.62266 | 0 | 0.071377 | 0.325473 | 4,071 | 130 | 133 | 31.315385 | 0.687181 | 0.004667 | 0 | 0.582524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.048544 | false | 0 | 0.029126 | 0.009709 | 0.126214 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
746f07d0cf9116e90708413ffb94a4fe42c876b3 | 707 | py | Python | testCase.py | Ayeeta/SLC-UG02 | 101b50f1a29b3cb384283b467e48cfd28b09b274 | [
"MIT"
] | null | null | null | testCase.py | Ayeeta/SLC-UG02 | 101b50f1a29b3cb384283b467e48cfd28b09b274 | [
"MIT"
] | null | null | null | testCase.py | Ayeeta/SLC-UG02 | 101b50f1a29b3cb384283b467e48cfd28b09b274 | [
"MIT"
] | null | null | null | import unittest
from number_gen import prime_gen
class PrimesTestCase(unittest.TestCase):
def test_negative_input(self):
self.assertFalse(prime_gen(-1),msg = 'should not be negative')
def test_alphabetical_input(self):
self.assertFalse(prime_gen('a'),msg = 'should be positive number')
def test_float_value_input(self):
self.assertFalse(prime_gen(2.0),msg = 'should be positive int')
def test_list_input(self):
self.assertFalse(prime_gen([2]), msg = 'Should not be a list')
def test_set_input(self):
self.assertFalse(prime_gen({-1}),msg = 'should be negative')
if __name__ == '__main__':
unittest.main()
| 28.28 | 80 | 0.663366 | 94 | 707 | 4.712766 | 0.351064 | 0.108352 | 0.146727 | 0.27088 | 0.410835 | 0.410835 | 0.3386 | 0.189616 | 0.189616 | 0 | 0 | 0.009091 | 0.222065 | 707 | 24 | 81 | 29.458333 | 0.796364 | 0 | 0 | 0 | 0 | 0 | 0.164074 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0.333333 | false | 0 | 0.133333 | 0 | 0.533333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
7478d6e39e6c9dc6b0ef1ac02b471bf48fdcf355 | 351 | py | Python | coffea/nanoevents/util.py | bfis/coffea | e5e67d410e86faee1172fcc864774d7024d97653 | [
"BSD-3-Clause"
] | 77 | 2019-06-09T14:23:33.000Z | 2022-03-22T21:34:01.000Z | coffea/nanoevents/util.py | bfis/coffea | e5e67d410e86faee1172fcc864774d7024d97653 | [
"BSD-3-Clause"
] | 353 | 2019-06-05T23:54:39.000Z | 2022-03-31T21:21:47.000Z | coffea/nanoevents/util.py | bfis/coffea | e5e67d410e86faee1172fcc864774d7024d97653 | [
"BSD-3-Clause"
] | 71 | 2019-06-07T02:04:11.000Z | 2022-03-05T21:03:45.000Z | import urllib.parse
def quote(x):
return urllib.parse.quote(x, safe="")
def unquote(x):
return urllib.parse.unquote(x)
def concat(*keys):
return quote(",".join(unquote(k) for k in keys))
def tuple_to_key(tup):
return "/".join(quote(x) for x in tup)
def key_to_tuple(key):
return tuple(unquote(x) for x in key.split("/"))
| 15.954545 | 52 | 0.652422 | 59 | 351 | 3.813559 | 0.338983 | 0.146667 | 0.115556 | 0.16 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.185185 | 351 | 21 | 53 | 16.714286 | 0.786713 | 0 | 0 | 0 | 0 | 0 | 0.008547 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.454545 | false | 0 | 0.090909 | 0.454545 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
747abc90288c7dd4831a921b920527131d6ae443 | 331 | py | Python | test.py | tcbutler320/CVE-2021-3441-check | f6e8c479c9ea475347afe7d76de1e2ac2bf87ae6 | [
"MIT"
] | 1 | 2021-08-20T12:10:27.000Z | 2021-08-20T12:10:27.000Z | test.py | tcbutler320/CVE-2021-3441-check | f6e8c479c9ea475347afe7d76de1e2ac2bf87ae6 | [
"MIT"
] | null | null | null | test.py | tcbutler320/CVE-2021-3441-check | f6e8c479c9ea475347afe7d76de1e2ac2bf87ae6 | [
"MIT"
] | null | null | null | from lib.core.module_parser import parser
paths = parser('./modules/hp-officejet-4630.yml','paths')
tags = parser('./modules/hp-officejet-4630.yml','tags')
print('{!} Atomic IoCs:',len(paths[0]))
for atomic_IoC_id in paths[0]:
print('{!} IoC ID:',atomic_IoC_id,'Path:',paths[0][atomic_IoC_id],'Tag:',tags[0][atomic_IoC_id])
| 33.1 | 100 | 0.697885 | 54 | 331 | 4.111111 | 0.444444 | 0.112613 | 0.198198 | 0.216216 | 0.279279 | 0.279279 | 0 | 0 | 0 | 0 | 0 | 0.039474 | 0.081571 | 331 | 9 | 101 | 36.777778 | 0.690789 | 0 | 0 | 0 | 0 | 0 | 0.324242 | 0.187879 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.333333 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
74801f9b5a9c782f5fc430f376ddcd5c6c37f246 | 708 | py | Python | petisco/base/domain/message/command_bus.py | alice-biometrics/petisco | b96e697cc875f67a28e60b4fc0d9ed9fc646cd86 | [
"MIT"
] | 19 | 2019-11-01T09:27:17.000Z | 2021-12-15T10:52:31.000Z | petisco/base/domain/message/command_bus.py | alice-biometrics/petisco | b96e697cc875f67a28e60b4fc0d9ed9fc646cd86 | [
"MIT"
] | 68 | 2020-01-15T06:55:00.000Z | 2022-02-22T15:57:24.000Z | petisco/base/domain/message/command_bus.py | alice-biometrics/petisco | b96e697cc875f67a28e60b4fc0d9ed9fc646cd86 | [
"MIT"
] | 2 | 2019-11-19T10:40:25.000Z | 2019-11-28T07:12:07.000Z | from abc import abstractmethod
from petisco.base.domain.message.message_bus import MessageBus
from petisco.base.domain.message.command import Command
class CommandBus(MessageBus):
@abstractmethod
def dispatch(self, command: Command):
raise NotImplementedError
def publish(self, command: Command):
self.dispatch(command)
def retry_publish_only_on_store_queue(self, command: Command):
pass
def _check_is_command(self, command: Command):
if not command or not issubclass(command.__class__, Command):
raise TypeError("CommandBus only publishes DomainEvent objects")
@abstractmethod
def close(self):
raise NotImplementedError
| 28.32 | 76 | 0.734463 | 80 | 708 | 6.3375 | 0.45 | 0.086785 | 0.142012 | 0.08284 | 0.110454 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.19774 | 708 | 24 | 77 | 29.5 | 0.892606 | 0 | 0 | 0.235294 | 0 | 0 | 0.063559 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.294118 | false | 0.058824 | 0.176471 | 0 | 0.529412 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
7495a36aaf8e54588251ce6d7c8de63d75457f7f | 140 | py | Python | _data/weapons/_weapon_groups.py | Eurydia/pso2ngs-augment-planner | 096e0d1d5d0b96b9720abe41ca76649df3264ca2 | [
"MIT"
] | null | null | null | _data/weapons/_weapon_groups.py | Eurydia/pso2ngs-augment-planner | 096e0d1d5d0b96b9720abe41ca76649df3264ca2 | [
"MIT"
] | null | null | null | _data/weapons/_weapon_groups.py | Eurydia/pso2ngs-augment-planner | 096e0d1d5d0b96b9720abe41ca76649df3264ca2 | [
"MIT"
] | null | null | null | from enum import Enum
class WeaponGroup(str, Enum):
"""Enum for weapon groups."""
ELEMENTRAL = "ELEMENTAL"
NORMAL = "NORMAL"
| 15.555556 | 33 | 0.65 | 16 | 140 | 5.6875 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.228571 | 140 | 8 | 34 | 17.5 | 0.842593 | 0.164286 | 0 | 0 | 0 | 0 | 0.135135 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
74a1ecdfa352fa4c21897693d8fd08737044fc14 | 147 | py | Python | scmver/__main__.py | hattya/scmver | ed27aad17737531fb174ca4621f547eed7dc9d2e | [
"MIT"
] | 3 | 2019-02-24T12:16:52.000Z | 2019-02-28T10:07:54.000Z | scmver/__main__.py | hattya/scmver | ed27aad17737531fb174ca4621f547eed7dc9d2e | [
"MIT"
] | null | null | null | scmver/__main__.py | hattya/scmver | ed27aad17737531fb174ca4621f547eed7dc9d2e | [
"MIT"
] | null | null | null | #
# scmver.__main__
#
# Copyright (c) 2019 Akinori Hattori <hattya@gmail.com>
#
# SPDX-License-Identifier: MIT
#
from . import cli
cli.run()
| 12.25 | 57 | 0.673469 | 19 | 147 | 5 | 0.947368 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033333 | 0.183673 | 147 | 11 | 58 | 13.363636 | 0.758333 | 0.693878 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
74a68d9927fe10e182c6b3494dce1f5c7e49f4a1 | 304 | py | Python | Jumpscale/data/serializers/SerializerPickle.py | Dinaamagdy/jumpscale_core | dec5d42e368ab2b5b2e40837b71d27a59cb501ab | [
"Apache-2.0"
] | null | null | null | Jumpscale/data/serializers/SerializerPickle.py | Dinaamagdy/jumpscale_core | dec5d42e368ab2b5b2e40837b71d27a59cb501ab | [
"Apache-2.0"
] | 162 | 2018-07-31T14:40:33.000Z | 2019-04-03T06:31:20.000Z | Jumpscale/data/serializers/SerializerPickle.py | Dinaamagdy/jumpscale_core | dec5d42e368ab2b5b2e40837b71d27a59cb501ab | [
"Apache-2.0"
] | 2 | 2018-07-31T12:42:02.000Z | 2018-11-21T09:40:22.000Z |
import pickle
from .SerializerBase import SerializerBase
from jumpscale import j
class SerializerPickle(SerializerBase):
def __init__(self):
SerializerBase.__init__(self)
def dumps(self, obj):
return pickle.dumps(obj)
def loads(self, s):
return pickle.loads(s)
| 16.888889 | 42 | 0.697368 | 35 | 304 | 5.828571 | 0.457143 | 0.078431 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.223684 | 304 | 17 | 43 | 17.882353 | 0.864407 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0.3 | 0.2 | 0.9 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
74aa60de503e13ff4acaef22ffa5f07424c846b0 | 2,812 | py | Python | ggpy/cruft/autocode/ProverQueryBuilder.py | hobson/ggpy | 4e6e6e876c3a4294cd711647051da2d9c1836b60 | [
"MIT"
] | 1 | 2015-01-26T19:07:45.000Z | 2015-01-26T19:07:45.000Z | ggpy/cruft/autocode/ProverQueryBuilder.py | hobson/ggpy | 4e6e6e876c3a4294cd711647051da2d9c1836b60 | [
"MIT"
] | null | null | null | ggpy/cruft/autocode/ProverQueryBuilder.py | hobson/ggpy | 4e6e6e876c3a4294cd711647051da2d9c1836b60 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
""" generated source for module ProverQueryBuilder """
# package: org.ggp.base.util.statemachine.implementation.prover.query
import java.util.HashSet
import java.util.List
import java.util.Set
import org.ggp.base.util.gdl.grammar.GdlConstant
import org.ggp.base.util.gdl.grammar.GdlPool
import org.ggp.base.util.gdl.grammar.GdlProposition
import org.ggp.base.util.gdl.grammar.GdlRelation
import org.ggp.base.util.gdl.grammar.GdlSentence
import org.ggp.base.util.gdl.grammar.GdlTerm
import org.ggp.base.util.gdl.grammar.GdlVariable
import org.ggp.base.util.statemachine.MachineState
import org.ggp.base.util.statemachine.Move
import org.ggp.base.util.statemachine.Role
class ProverQueryBuilder(object):
""" generated source for class ProverQueryBuilder """
DOES = GdlPool.getConstant("does")
GOAL = GdlPool.getConstant("goal")
INIT_QUERY = GdlPool.getRelation(GdlPool.getConstant("init"), [None]*)
LEGAL = GdlPool.getConstant("legal")
NEXT_QUERY = GdlPool.getRelation(GdlPool.getConstant("next"), [None]*)
ROLE_QUERY = GdlPool.getRelation(GdlPool.getConstant("role"), [None]*)
TERMINAL_QUERY = GdlPool.getProposition(GdlPool.getConstant("terminal"))
VARIABLE = GdlPool.getVariable("?x")
@classmethod
@overloaded
def getContext(cls, state):
""" generated source for method getContext """
return state.getContents()
@classmethod
@getContext.register(object, MachineState, List, List)
def getContext_0(cls, state, roles, moves):
""" generated source for method getContext_0 """
context = HashSet(state.getContents())
i = 0
while i < len(roles):
context.add(toDoes(roles.get(i), moves.get(i)))
i += 1
return context
@classmethod
def getGoalQuery(cls, role):
""" generated source for method getGoalQuery """
return GdlPool.getRelation(cls.GOAL, [None]*)
@classmethod
def getInitQuery(cls):
""" generated source for method getInitQuery """
return cls.INIT_QUERY
@classmethod
def getLegalQuery(cls, role):
""" generated source for method getLegalQuery """
return GdlPool.getRelation(cls.LEGAL, [None]*)
@classmethod
def getNextQuery(cls):
""" generated source for method getNextQuery """
return cls.NEXT_QUERY
@classmethod
def getRoleQuery(cls):
""" generated source for method getRoleQuery """
return cls.ROLE_QUERY
@classmethod
def getTerminalQuery(cls):
""" generated source for method getTerminalQuery """
return cls.TERMINAL_QUERY
@classmethod
def toDoes(cls, role, move):
""" generated source for method toDoes """
return GdlPool.getRelation(cls.DOES, [None]*)
| 30.236559 | 76 | 0.690256 | 320 | 2,812 | 6.034375 | 0.240625 | 0.085448 | 0.102538 | 0.079751 | 0.358881 | 0.190575 | 0.108752 | 0 | 0 | 0 | 0 | 0.001764 | 0.193457 | 2,812 | 92 | 77 | 30.565217 | 0.849647 | 0.031294 | 0 | 0.160714 | 1 | 0 | 0.016018 | 0 | 0 | 0 | 0 | 0.01087 | 0 | 0 | null | null | 0 | 0.232143 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7763dd019efe2b6bf0a9b3367296cfc0060af045 | 913 | py | Python | tests/test_helpers_methods.py | Jexan/ProjectEulerSolutions | 1c71dcc2ac4ac09c6bef4b09137d7d4cd2ef2ecd | [
"MIT"
] | null | null | null | tests/test_helpers_methods.py | Jexan/ProjectEulerSolutions | 1c71dcc2ac4ac09c6bef4b09137d7d4cd2ef2ecd | [
"MIT"
] | null | null | null | tests/test_helpers_methods.py | Jexan/ProjectEulerSolutions | 1c71dcc2ac4ac09c6bef4b09137d7d4cd2ef2ecd | [
"MIT"
] | null | null | null | from src.helpers import *
import unittest
class HelpersTests(unittest.TestCase):
def test_generate_fibonacci(self):
first_fib = (1, 1, 2, 3, 5, 8, 13, 21)
self.assertEqual(tuple(take(8, generate_fibonacci())), first_fib)
def test_primes_until_works_ok(self):
first_primes = (2, 3, 5, 7, 11, 13, 17, 19)
self.assertEqual(tuple(primes_until(20)), first_primes)
def test_is_palindrome(self):
self.assertTrue(is_palindrome(12321))
self.assertTrue(is_palindrome(123321))
self.assertTrue(is_palindrome(11))
self.assertTrue(is_palindrome(12388321))
self.assertFalse(is_palindrome(1234))
self.assertFalse(is_palindrome(-123))
self.assertFalse(is_palindrome(10))
def test_mcm(self):
self.assertEqual(mcm(2, 4, 6), 12)
self.assertEqual(mcm(1, 3), 3)
self.assertEqual(mcm(1, 2, 3, 4, 5), 60) | 35.115385 | 73 | 0.659365 | 125 | 913 | 4.64 | 0.392 | 0.165517 | 0.110345 | 0.17931 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097222 | 0.211391 | 913 | 26 | 74 | 35.115385 | 0.708333 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | 1 | 0.190476 | false | 0 | 0.095238 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
77668977a8514896282a668bd2aed53c6aee3f64 | 21 | py | Python | Chapter07/change_variable.py | PacktPublishing/Secret-Recipes-of-the-Python-Ninja | 805d00c7a54927ba94c9077e9a580508ee3c5e56 | [
"MIT"
] | 13 | 2018-06-21T01:44:49.000Z | 2021-12-01T10:49:53.000Z | Chapter07/change_variable.py | PacktPublishing/Secret-Recipes-of-the-Python-Ninja | 805d00c7a54927ba94c9077e9a580508ee3c5e56 | [
"MIT"
] | null | null | null | Chapter07/change_variable.py | PacktPublishing/Secret-Recipes-of-the-Python-Ninja | 805d00c7a54927ba94c9077e9a580508ee3c5e56 | [
"MIT"
] | 6 | 2018-10-05T08:29:24.000Z | 2022-01-11T14:49:50.000Z | x = 2
x = "a_string"
| 7 | 14 | 0.52381 | 5 | 21 | 2 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 0.285714 | 21 | 2 | 15 | 10.5 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0.380952 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
77722b3d9ce3c8a851962a7d8df6c18e7e3ef3ac | 4,393 | py | Python | viscid/readers/__init__.py | jimgreen/Viscid | 41e19fee8576c5e3fa9c758c48731bc25e1db1b9 | [
"BSD-2-Clause"
] | null | null | null | viscid/readers/__init__.py | jimgreen/Viscid | 41e19fee8576c5e3fa9c758c48731bc25e1db1b9 | [
"BSD-2-Clause"
] | null | null | null | viscid/readers/__init__.py | jimgreen/Viscid | 41e19fee8576c5e3fa9c758c48731bc25e1db1b9 | [
"BSD-2-Clause"
] | 1 | 2019-11-16T18:55:48.000Z | 2019-11-16T18:55:48.000Z | """Package for the various data readers"""
# To add a new file type, subclass VFile and import the module here.
# This registers the file type class as a subclass of VFile, and
# it automatically becomes part of the file detection cascade...
# Note that subclasses are given precedence in type detection, so
# care must be taken when crafting the detector regex.
# Also, look at csv for an example of overriding detect_type(...)
import viscid
# import vfile
from viscid.readers.vfile import VFile
from viscid.readers import vfile_bucket
# these imports are necessary to register file types
from viscid.readers import xdmf
from viscid.readers import hdf5
from viscid.readers import numpy_binary
from viscid.readers import ascii
# these imports register convenience readers for data from
# specific sim packages
from viscid.readers import ggcm_xdmf
from viscid.readers import ggcm_fortbin
from viscid.readers import psc
from viscid.readers import gkeyll
from viscid.readers import athena_bin
from viscid.readers import athena_tab
from viscid.readers import athena_hst
from viscid.readers import athena_xdmf
from viscid.readers import ggcm_jrrle
__all__ = ['load_file', 'load_files', 'unload_file', 'unload_all_files',
'reload_file', 'get_file', 'save_grid', 'save_field', 'save_fields']
__filebucket__ = vfile_bucket.VFileBucket()
def load(fnames):
"""Generic load
Dispatches to :meth:`load_file` or :meth:`load_files`. This
function is deprecated.
Parameters:
fnames: One or many file names
Returns:
one or many VFiles
"""
# this is not a deprecated warning since by default those aren't shown
# and i want this to be a loud and clear do not use :)
viscid.logger.warn("readers.load is deprecated in favor of load_file or "
"load_files")
files = load_files(fnames)
if isinstance(fnames, (list, tuple)):
return files
else:
return files[0]
def load_file(fname, force_reload=False, **kwargs):
"""Load a file
Parameters:
fnames (list): single file name, or list of files that are part
of the same time series. Glob patterns and slices are
accepted, see :doc:`/tips_and_tricks` for more info.
fname (str): a file name, relative to CWD
force_reload (bool): Force reload if file is already in memory
**kwargs: passed to the VFile constructor
See Also:
* :doc:`/tips_and_tricks`
Returns:
A VFile instance
"""
return __filebucket__.load_file(fname, force_reload=force_reload, **kwargs)
def load_files(fnames, force_reload=False, **kwargs):
"""Load a list of files
Parameters:
fnames (list): list of file names. Glob patterns and slices are
accepted, see :doc:`/tips_and_tricks` for more info.
force_reload (bool): Force reload if file is already in memory
**kwargs: passed to the VFile constructor
See Also:
* :doc:`/tips_and_tricks`
Returns:
A list of VFile instances. The length may not be the same
as the length of fnames, and the order may not be the same
in order to accommodate globs and file grouping.
"""
return __filebucket__.load_files(fnames, force_reload=force_reload,
**kwargs)
def unload_file(handle):
"""call unload on the handle in the bucket"""
__filebucket__[handle].unload()
def reload_file(handle):
"""call reload on the handle in the bucket"""
__filebucket__[handle].reload()
def get_file(handle):
""" return a file that's already been loaded by either
number (as in nth file loaded), of file name
"""
return __filebucket__[handle]
def save_grid(fname, grd, **kwargs):
""" save a grid, filetype is inferred from fname
"""
ftype = VFile.detect_type(fname)
ftype.save_grid(fname, grd, **kwargs)
def save_field(fname, fld, **kwargs):
""" save a field, filetype is inferred from fname"""
ftype = VFile.detect_type(fname)
ftype.save_field(fname, fld, **kwargs)
def save_fields(fname, flds, **kwargs):
""" save a list of fields, filetype is inferred from fname
"""
ftype = VFile.detect_type(fname, mode='w')
ftype.save_fields(fname, flds, **kwargs)
def unload_all_files():
"""Hammer-of-Thor the cache"""
__filebucket__.remove_all_items()
| 32.301471 | 79 | 0.694059 | 625 | 4,393 | 4.728 | 0.3008 | 0.050761 | 0.086294 | 0.108968 | 0.413536 | 0.263283 | 0.203046 | 0.203046 | 0.177327 | 0.177327 | 0 | 0.000585 | 0.222172 | 4,393 | 135 | 80 | 32.540741 | 0.864208 | 0.492602 | 0 | 0.040816 | 0 | 0 | 0.07814 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.204082 | false | 0 | 0.326531 | 0 | 0.632653 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
777eaf0d8abc2e50bad3d2af88f4f33403fc1f6b | 209 | py | Python | izunadsp/parts/equal_loudness.py | keyboardbear/IzunaDSP | 2e4a93dc1e09775f23aebec70e2f51f8706a7635 | [
"MIT"
] | null | null | null | izunadsp/parts/equal_loudness.py | keyboardbear/IzunaDSP | 2e4a93dc1e09775f23aebec70e2f51f8706a7635 | [
"MIT"
] | 4 | 2018-04-24T18:14:02.000Z | 2018-05-28T12:13:02.000Z | izunadsp/parts/equal_loudness.py | keyboardbear/IzunaDSP | 2e4a93dc1e09775f23aebec70e2f51f8706a7635 | [
"MIT"
] | 3 | 2018-02-22T14:47:02.000Z | 2019-11-01T03:34:43.000Z | # External Libraries
from essentia.standard import EqualLoudness as EL
# IzunaDSP
from izunadsp import FunctionPart
class EqualLoudness(FunctionPart):
def __init__(self):
super().__init__(EL())
| 19 | 49 | 0.755981 | 23 | 209 | 6.521739 | 0.695652 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167464 | 209 | 10 | 50 | 20.9 | 0.862069 | 0.129187 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
778cd44c7d07f2a77f4b8563a849357a9b80c720 | 152 | py | Python | app/accounts/urls.py | Telomeraz/stock-tracking-app | c8827dd47cc3a8d141e23c7e43abe6a2893439e6 | [
"MIT"
] | null | null | null | app/accounts/urls.py | Telomeraz/stock-tracking-app | c8827dd47cc3a8d141e23c7e43abe6a2893439e6 | [
"MIT"
] | null | null | null | app/accounts/urls.py | Telomeraz/stock-tracking-app | c8827dd47cc3a8d141e23c7e43abe6a2893439e6 | [
"MIT"
] | null | null | null | from django.urls import path
from .views import *
urlpatterns = [
path('giris/', LoginView.as_view()),
path('cikis/', LogoutView.as_view()),
] | 19 | 41 | 0.664474 | 19 | 152 | 5.210526 | 0.684211 | 0.121212 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164474 | 152 | 8 | 42 | 19 | 0.779528 | 0 | 0 | 0 | 0 | 0 | 0.078431 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
779784dd9e8cc400165645b9ca38592d486d6df5 | 321 | py | Python | harpoon/src/plugins/Config/commands/EnableMessageLogging.py | xezzz/Harpoon | 4a0bdea10a6e961013738598726a4205a5cc4c91 | [
"MIT"
] | null | null | null | harpoon/src/plugins/Config/commands/EnableMessageLogging.py | xezzz/Harpoon | 4a0bdea10a6e961013738598726a4205a5cc4c91 | [
"MIT"
] | null | null | null | harpoon/src/plugins/Config/commands/EnableMessageLogging.py | xezzz/Harpoon | 4a0bdea10a6e961013738598726a4205a5cc4c91 | [
"MIT"
] | null | null | null |
async def run(plugin, ctx, channel):
plugin.db.configs.update(ctx.guild.id, "message_logging", True)
plugin.db.configs.update(ctx.guild.id, "message_log_channel", f"{channel.id}")
await ctx.send(plugin.t(ctx.guild, "enabled_module_channel", _emote="YES", module="Message Logging", channel=channel.mention)) | 45.857143 | 130 | 0.735202 | 47 | 321 | 4.893617 | 0.510638 | 0.104348 | 0.130435 | 0.182609 | 0.330435 | 0.330435 | 0.330435 | 0.330435 | 0 | 0 | 0 | 0 | 0.099688 | 321 | 7 | 130 | 45.857143 | 0.795848 | 0 | 0 | 0 | 0 | 0 | 0.269592 | 0.068966 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
779a564bd1d0ff38268d8fbcdb9a69e21d031ab7 | 90 | py | Python | bite-sized-bears/Website/irc_chat/apps.py | Vthechamp22/summer-code-jam-2021 | 0a8bf1f22f6c73300891fd779da36efd8e1304c1 | [
"MIT"
] | 40 | 2020-08-02T07:38:22.000Z | 2021-07-26T01:46:50.000Z | bite-sized-bears/Website/irc_chat/apps.py | Vthechamp22/summer-code-jam-2021 | 0a8bf1f22f6c73300891fd779da36efd8e1304c1 | [
"MIT"
] | 134 | 2020-07-31T12:15:45.000Z | 2020-12-13T04:42:19.000Z | bite-sized-bears/Website/irc_chat/apps.py | Vthechamp22/summer-code-jam-2021 | 0a8bf1f22f6c73300891fd779da36efd8e1304c1 | [
"MIT"
] | 101 | 2020-07-31T12:00:47.000Z | 2021-11-01T09:06:58.000Z | from django.apps import AppConfig
class IrcChatConfig(AppConfig):
name = 'irc_chat'
| 15 | 33 | 0.755556 | 11 | 90 | 6.090909 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 90 | 5 | 34 | 18 | 0.893333 | 0 | 0 | 0 | 0 | 0 | 0.088889 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
77a8288c09407734d305fad4b11acdd8c20ddb58 | 85 | py | Python | helpp/apps.py | utk-dev/Storyteller | 4c15daada1948698a5169275e544e714b836a404 | [
"MIT"
] | 3 | 2020-11-02T09:13:47.000Z | 2020-11-07T06:02:10.000Z | helpp/apps.py | utk-dev/Storyteller | 4c15daada1948698a5169275e544e714b836a404 | [
"MIT"
] | null | null | null | helpp/apps.py | utk-dev/Storyteller | 4c15daada1948698a5169275e544e714b836a404 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class HelppConfig(AppConfig):
name = 'helpp'
| 14.166667 | 33 | 0.741176 | 10 | 85 | 6.3 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 85 | 5 | 34 | 17 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
77dd40a18916417ff8115e8fcec6145b4d25dd0b | 678 | py | Python | grplot/features/sep/statdesc_sep/statdesc_sep_data_def.py | ghiffaryr/grplot | 43ea08febac4ffecbce0a6a3d679850f5013aa28 | [
"BSD-3-Clause"
] | null | null | null | grplot/features/sep/statdesc_sep/statdesc_sep_data_def.py | ghiffaryr/grplot | 43ea08febac4ffecbce0a6a3d679850f5013aa28 | [
"BSD-3-Clause"
] | null | null | null | grplot/features/sep/statdesc_sep/statdesc_sep_data_def.py | ghiffaryr/grplot | 43ea08febac4ffecbce0a6a3d679850f5013aa28 | [
"BSD-3-Clause"
] | null | null | null | from pandas.api.types import is_numeric_dtype
from grplot.features.sep.statdesc_sep.statdesc_sep_def import statdesc_sep_def
def statdesc_sep_data_def(num, stat_label, sep):
if is_numeric_dtype(type(num)) == True:
if stat_label in ['count', 'unique count']:
if sep in [',c', ',cL']:
num = statdesc_sep_def(num=num, sep=',')
elif sep in ['.c', '.cL']:
num = statdesc_sep_def(num=num, sep='.')
else:
num = statdesc_sep_def(num=num, sep=sep)
else:
num = statdesc_sep_def(num=num, sep=sep)
else:
raise Exception('Unsupported data type!')
return num | 37.666667 | 78 | 0.59587 | 94 | 678 | 4.06383 | 0.329787 | 0.230366 | 0.219895 | 0.17801 | 0.361257 | 0.361257 | 0.361257 | 0.361257 | 0.361257 | 0.361257 | 0 | 0 | 0.280236 | 678 | 18 | 79 | 37.666667 | 0.782787 | 0 | 0 | 0.3125 | 0 | 0 | 0.07511 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0 | 0.125 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
77e33a19b3cbde9d939d5d40dd70fac1fe2e7089 | 517 | py | Python | basicdevice/migrations/0004_auto_20210520_1841.py | CRLTeam/iot_device | afde149e3d94f456c32d2f3c8ef3d4002042f017 | [
"Apache-2.0"
] | 1 | 2021-02-10T23:50:41.000Z | 2021-02-10T23:50:41.000Z | basicdevice/migrations/0004_auto_20210520_1841.py | CRLTeam/iot_device | afde149e3d94f456c32d2f3c8ef3d4002042f017 | [
"Apache-2.0"
] | null | null | null | basicdevice/migrations/0004_auto_20210520_1841.py | CRLTeam/iot_device | afde149e3d94f456c32d2f3c8ef3d4002042f017 | [
"Apache-2.0"
] | null | null | null | # Generated by Django 2.2.10 on 2021-05-20 18:41
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('basicdevice', '0003_remove_simulation_order'),
]
operations = [
migrations.DeleteModel(
name='Log',
),
migrations.DeleteModel(
name='Setting',
),
migrations.DeleteModel(
name='Simulation',
),
migrations.DeleteModel(
name='Status',
),
]
| 19.884615 | 56 | 0.547389 | 44 | 517 | 6.363636 | 0.659091 | 0.3 | 0.357143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0.34236 | 517 | 25 | 57 | 20.68 | 0.764706 | 0.088975 | 0 | 0.421053 | 1 | 0 | 0.138593 | 0.059701 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.052632 | 0 | 0.210526 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
77e6860eab0cc0f47edffd48b525f53ca0336473 | 1,853 | py | Python | google/cloud/gsuiteaddons/v1/google-cloud-workspace-add-ons-v1-py/google/cloud/workspace_add_ons_v1/__init__.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 7 | 2021-02-21T10:39:41.000Z | 2021-12-07T07:31:28.000Z | google/cloud/gsuiteaddons/v1/google-cloud-workspace-add-ons-v1-py/google/cloud/workspace_add_ons_v1/__init__.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 6 | 2021-02-02T23:46:11.000Z | 2021-11-15T01:46:02.000Z | google/cloud/gsuiteaddons/v1/google-cloud-workspace-add-ons-v1-py/google/cloud/workspace_add_ons_v1/__init__.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 4 | 2021-01-28T23:25:45.000Z | 2021-08-30T01:55:16.000Z | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from .services.g_suite_add_ons import GSuiteAddOnsClient
from .services.g_suite_add_ons import GSuiteAddOnsAsyncClient
from .types.gsuiteaddons import AddOns
from .types.gsuiteaddons import Authorization
from .types.gsuiteaddons import CreateDeploymentRequest
from .types.gsuiteaddons import DeleteDeploymentRequest
from .types.gsuiteaddons import Deployment
from .types.gsuiteaddons import GetAuthorizationRequest
from .types.gsuiteaddons import GetDeploymentRequest
from .types.gsuiteaddons import GetInstallStatusRequest
from .types.gsuiteaddons import InstallDeploymentRequest
from .types.gsuiteaddons import InstallStatus
from .types.gsuiteaddons import ListDeploymentsRequest
from .types.gsuiteaddons import ListDeploymentsResponse
from .types.gsuiteaddons import ReplaceDeploymentRequest
from .types.gsuiteaddons import UninstallDeploymentRequest
__all__ = (
'GSuiteAddOnsAsyncClient',
'AddOns',
'Authorization',
'CreateDeploymentRequest',
'DeleteDeploymentRequest',
'Deployment',
'GSuiteAddOnsClient',
'GetAuthorizationRequest',
'GetDeploymentRequest',
'GetInstallStatusRequest',
'InstallDeploymentRequest',
'InstallStatus',
'ListDeploymentsRequest',
'ListDeploymentsResponse',
'ReplaceDeploymentRequest',
'UninstallDeploymentRequest',
)
| 34.962264 | 74 | 0.824069 | 196 | 1,853 | 7.739796 | 0.469388 | 0.083059 | 0.193804 | 0.249176 | 0.039552 | 0.039552 | 0.039552 | 0 | 0 | 0 | 0 | 0.005432 | 0.105774 | 1,853 | 52 | 75 | 35.634615 | 0.910078 | 0.30707 | 0 | 0 | 0 | 0 | 0.247634 | 0.184543 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.470588 | 0 | 0.470588 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
77ecf435f0746f6f9356dd4e0b6d37570fcb76d6 | 371 | py | Python | server/models/step.py | Synergize-Southwest-Detroit/api | 78a1f1da80e3b3e506fbeb84f477bcc2d54377a4 | [
"MIT"
] | null | null | null | server/models/step.py | Synergize-Southwest-Detroit/api | 78a1f1da80e3b3e506fbeb84f477bcc2d54377a4 | [
"MIT"
] | null | null | null | server/models/step.py | Synergize-Southwest-Detroit/api | 78a1f1da80e3b3e506fbeb84f477bcc2d54377a4 | [
"MIT"
] | null | null | null | """This module contains the Step class."""
from server.models.db import db
class Step(db.Model):
"""SQLAlchemy model definition for the event class."""
__tablename__ = 'steps'
id = db.Column(db.Integer, primary_key=True)
number = db.Column(db.Integer)
title = db.Column(db.Text)
description = db.Column(db.Text)
image = db.Column(db.Text)
| 24.733333 | 58 | 0.67655 | 53 | 371 | 4.641509 | 0.54717 | 0.162602 | 0.203252 | 0.170732 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.188679 | 371 | 14 | 59 | 26.5 | 0.817276 | 0.229111 | 0 | 0 | 0 | 0 | 0.018182 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
77fadc4bc16785b959dbea28ae4a3dbc058394a0 | 164 | py | Python | 9marzo/ejemplos.py | chrigarc/computo_evolutivo_20212 | 9a67173d1194063678788e1638e0a548985d77a2 | [
"MIT"
] | null | null | null | 9marzo/ejemplos.py | chrigarc/computo_evolutivo_20212 | 9a67173d1194063678788e1638e0a548985d77a2 | [
"MIT"
] | null | null | null | 9marzo/ejemplos.py | chrigarc/computo_evolutivo_20212 | 9a67173d1194063678788e1638e0a548985d77a2 | [
"MIT"
] | null | null | null | import numpy as np
import time
r = np.random.RandomState((int)(time.time()))
print(r.randint(19))
print(r.randint(0,2, 10))
print(r.permutation(19))
# 1 0 0 1
# | 14.909091 | 45 | 0.676829 | 31 | 164 | 3.580645 | 0.548387 | 0.162162 | 0.234234 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084507 | 0.134146 | 164 | 11 | 46 | 14.909091 | 0.697183 | 0.042683 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.5 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 3 |
7af51bfa4e632ccda00b2ffdac2e8c3606d7784e | 1,523 | py | Python | test_app/app/models.py | GemeenteUtrecht/gemma-drc-cmis | ea71cb3bc3c673cc1e49306ef241481db3bc9d91 | [
"MIT"
] | null | null | null | test_app/app/models.py | GemeenteUtrecht/gemma-drc-cmis | ea71cb3bc3c673cc1e49306ef241481db3bc9d91 | [
"MIT"
] | 1 | 2019-05-14T11:29:55.000Z | 2019-05-14T11:29:55.000Z | test_app/app/models.py | GemeenteUtrecht/gemma-drc-cmis | ea71cb3bc3c673cc1e49306ef241481db3bc9d91 | [
"MIT"
] | 1 | 2020-04-10T09:12:31.000Z | 2020-04-10T09:12:31.000Z | from uuid import uuid4
from django.db import models
class EnkelvoudigInformatieObject(models.Model):
uuid = models.UUIDField(unique=True, default=uuid4)
identificatie = models.CharField(max_length=40, default=uuid4)
bronorganisatie = models.CharField(max_length=9)
creatiedatum = models.DateField()
titel = models.CharField(max_length=200)
vertrouwelijkheidaanduiding = models.CharField(max_length=200)
auteur = models.CharField(max_length=200)
status = models.CharField(max_length=20)
beschrijving = models.TextField(max_length=1000)
ontvangstdatum = models.DateField(null=True, blank=True)
verzenddatum = models.DateField(null=True, blank=True)
indicatie_gebruiksrecht = models.NullBooleanField(blank=True, default=None)
ondertekening_soort = models.CharField(max_length=10, blank=True)
ondertekening_datum = models.DateField(blank=True, null=True)
informatieobjecttype = models.URLField()
formaat = models.CharField(max_length=255, blank=True)
taal = models.CharField(max_length=255, blank=True)
bestandsnaam = models.CharField(max_length=255, blank=True)
inhoud = models.FileField(upload_to="uploads/%Y/%m/")
link = models.URLField(max_length=200, blank=True)
integriteit_algoritme = models.CharField(max_length=20, blank=True)
integriteit_waarde = models.CharField(max_length=128, blank=True)
integriteit_datum = models.DateField(null=True, blank=True)
def __str__(self) -> str:
return str(self.identificatie)
| 46.151515 | 79 | 0.758372 | 183 | 1,523 | 6.174863 | 0.360656 | 0.111504 | 0.19115 | 0.254867 | 0.29823 | 0.180531 | 0.095575 | 0 | 0 | 0 | 0 | 0.030395 | 0.135916 | 1,523 | 32 | 80 | 47.59375 | 0.828267 | 0 | 0 | 0 | 0 | 0 | 0.009192 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.035714 | false | 0 | 0.071429 | 0.035714 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
bb22479649efce908bc1424a3d44d5315d708437 | 527 | py | Python | tests/unit/helpers/test_boxes.py | thoughteer/edera | c4ddb5d8a25906c3bd773c91afb3260fc0b704f2 | [
"MIT"
] | 3 | 2018-11-27T15:45:19.000Z | 2018-12-21T20:32:10.000Z | tests/unit/helpers/test_boxes.py | thoughteer/edera | c4ddb5d8a25906c3bd773c91afb3260fc0b704f2 | [
"MIT"
] | 18 | 2018-12-02T18:38:59.000Z | 2020-02-05T22:09:37.000Z | tests/unit/helpers/test_boxes.py | thoughteer/edera | c4ddb5d8a25906c3bd773c91afb3260fc0b704f2 | [
"MIT"
] | null | null | null | from edera.helpers import MultiBox
from edera.helpers import SimpleBox
def test_multibox_works_correctly():
key = 1
box = MultiBox(lambda: key)
assert box.get() is None
box.put(1)
assert box.get() == 1
key = 2
assert box.get() is None
box.put(2)
assert box.get() == 2
box.put(None)
assert box.get() is None
def test_simple_box_works_correctly():
box = SimpleBox()
assert box.get() is None
box.put(1)
assert box.get() == 1
box.put(2)
assert box.get() == 2
| 20.269231 | 38 | 0.624288 | 82 | 527 | 3.926829 | 0.256098 | 0.223602 | 0.298137 | 0.173913 | 0.47205 | 0.416149 | 0.416149 | 0.236025 | 0.236025 | 0.236025 | 0 | 0.025445 | 0.254269 | 527 | 25 | 39 | 21.08 | 0.793893 | 0 | 0 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.380952 | 1 | 0.095238 | false | 0 | 0.095238 | 0 | 0.190476 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2471835112f97c7ef16dbae2ed362207d204447e | 131 | py | Python | postflight/admin.py | tjhobbs1/python-final | 3b0828f95195e4cf36286331962a1f769eab8ebc | [
"MIT"
] | null | null | null | postflight/admin.py | tjhobbs1/python-final | 3b0828f95195e4cf36286331962a1f769eab8ebc | [
"MIT"
] | null | null | null | postflight/admin.py | tjhobbs1/python-final | 3b0828f95195e4cf36286331962a1f769eab8ebc | [
"MIT"
] | null | null | null | from django.contrib import admin
# Register your models here.
from .models import PostFlight
admin.site.register(PostFlight)
| 11.909091 | 32 | 0.78626 | 17 | 131 | 6.058824 | 0.647059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152672 | 131 | 10 | 33 | 13.1 | 0.927928 | 0.198473 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2488b2750e7a26e8fa0c1858a010fa4190ba5657 | 213 | py | Python | tests/feeds/test_uspce_feed.py | tellor-io/telliot-feed-examples | 3f825c90ad372f42c89eee0f5b54250f22ec0728 | [
"MIT"
] | 7 | 2021-11-10T21:14:57.000Z | 2022-03-26T07:27:23.000Z | tests/feeds/test_uspce_feed.py | tellor-io/telliot-feed-examples | 3f825c90ad372f42c89eee0f5b54250f22ec0728 | [
"MIT"
] | 86 | 2021-11-09T13:12:58.000Z | 2022-03-31T17:28:56.000Z | tests/feeds/test_uspce_feed.py | tellor-io/telliot-feed-examples | 3f825c90ad372f42c89eee0f5b54250f22ec0728 | [
"MIT"
] | 2 | 2021-11-27T12:51:22.000Z | 2022-03-12T16:38:00.000Z | import yaml
from telliot_feed_examples.feeds.uspce_feed import uspce_feed
def test_manual_uspce_feed():
"""Test USPCE feed."""
feed = uspce_feed
print(yaml.dump(feed.get_state(), sort_keys=False))
| 19.363636 | 61 | 0.741784 | 32 | 213 | 4.625 | 0.5625 | 0.304054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150235 | 213 | 10 | 62 | 21.3 | 0.81768 | 0.075117 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.6 | 0.2 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
24aaa80be2be72b1ac6262eb3595463b56ebd7d5 | 788 | py | Python | restapi/endpoint/models.py | equilibrium-catalyst/yadayada-rest-api | c08b61757c0d6ff820a6e6b4501bc790993025bb | [
"Apache-2.0"
] | null | null | null | restapi/endpoint/models.py | equilibrium-catalyst/yadayada-rest-api | c08b61757c0d6ff820a6e6b4501bc790993025bb | [
"Apache-2.0"
] | null | null | null | restapi/endpoint/models.py | equilibrium-catalyst/yadayada-rest-api | c08b61757c0d6ff820a6e6b4501bc790993025bb | [
"Apache-2.0"
] | null | null | null | """Persistence classes for the REST endpoint."""
from django.db import models
from jsonfield import JSONField
class Recording(models.Model):
"""Model for recorded files."""
date = models.DateTimeField(auto_now=True)
clip = models.FileField(null=True)
categories = models.CharField(max_length=1000, default="")
transcript = models.CharField(default="", max_length=5000)
# Emotions
happy = models.DecimalField(default=0, decimal_places=4, max_digits=10)
neutral = models.DecimalField(default=0, decimal_places=4, max_digits=10)
sad = models.DecimalField(default=0, decimal_places=4, max_digits=10)
angry = models.DecimalField(default=0, decimal_places=4, max_digits=10)
fear = models.DecimalField(default=0, decimal_places=4, max_digits=10)
| 37.52381 | 77 | 0.742386 | 104 | 788 | 5.5 | 0.442308 | 0.157343 | 0.218531 | 0.227273 | 0.445804 | 0.445804 | 0.445804 | 0.445804 | 0.445804 | 0.445804 | 0 | 0.041298 | 0.139594 | 788 | 20 | 78 | 39.4 | 0.80236 | 0.098985 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
24b1c6dd966b3f0f89b1062acce52ecf63a1fa10 | 248 | py | Python | events/admin.py | KenThumi/neighborhood | 070a9e78a2958485090be8667bb0fd34294c41f8 | [
"MIT"
] | null | null | null | events/admin.py | KenThumi/neighborhood | 070a9e78a2958485090be8667bb0fd34294c41f8 | [
"MIT"
] | null | null | null | events/admin.py | KenThumi/neighborhood | 070a9e78a2958485090be8667bb0fd34294c41f8 | [
"MIT"
] | null | null | null | from events.models import Business, Neighborhood, Post, Profile
from django.contrib import admin
# Register your models here.
admin.site.register(Profile)
admin.site.register(Neighborhood)
admin.site.register(Business)
admin.site.register(Post) | 22.545455 | 63 | 0.814516 | 33 | 248 | 6.121212 | 0.454545 | 0.178218 | 0.336634 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.092742 | 248 | 11 | 64 | 22.545455 | 0.897778 | 0.104839 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
24b430becd3096388ce69368168103fb13629606 | 168 | py | Python | python/dice.py | cl33per/java-baby | 05febea73f9ea78c6d3f88b066a14542fbcdb163 | [
"MIT"
] | null | null | null | python/dice.py | cl33per/java-baby | 05febea73f9ea78c6d3f88b066a14542fbcdb163 | [
"MIT"
] | null | null | null | python/dice.py | cl33per/java-baby | 05febea73f9ea78c6d3f88b066a14542fbcdb163 | [
"MIT"
] | null | null | null | from random import randint
dieSides = [1,2,3,4,5,6]
def rolldice(dieSides):
diceroll = dieSides[randint(0,5)]
return diceroll
print (f'{rolldice(dieSides)}') | 18.666667 | 37 | 0.696429 | 25 | 168 | 4.68 | 0.72 | 0.273504 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.056338 | 0.154762 | 168 | 9 | 38 | 18.666667 | 0.767606 | 0 | 0 | 0 | 0 | 0 | 0.118343 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.5 | 0.166667 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
24bdf96ab2316bd9177902a6d493c03933ef186c | 715 | py | Python | csim/base_component.py | J-Obog/circuit-sim | f2cbd29727df84f7c753bacd3fa82d68ffe77cce | [
"MIT"
] | null | null | null | csim/base_component.py | J-Obog/circuit-sim | f2cbd29727df84f7c753bacd3fa82d68ffe77cce | [
"MIT"
] | null | null | null | csim/base_component.py | J-Obog/circuit-sim | f2cbd29727df84f7c753bacd3fa82d68ffe77cce | [
"MIT"
] | null | null | null | from _typeshed import Self
from typing import Tuple
class BaseComponent:
def __init__(self, x: int, y: int, w: int, h: int, label: str):
self._x: int = x
self._y: int = y
self._w: int = w
self._h: int = h
self._label: str = label
def setBounds(self, w: int, h: int):
self._w = w
self._h = h
def getBounds(self) -> Tuple[int, int]:
return (self._w, self._h)
def setPos(self, x: int, y: int):
self._x = x
self._y = y
def getPos(self) -> Tuple[int, int]:
return (self._x, self._y)
def setLabel(self, label: str):
self._label = label
def getLabel(self) -> str:
return self._label | 23.833333 | 67 | 0.546853 | 106 | 715 | 3.5 | 0.226415 | 0.067385 | 0.06469 | 0.048518 | 0.199461 | 0.134771 | 0 | 0 | 0 | 0 | 0 | 0 | 0.327273 | 715 | 30 | 68 | 23.833333 | 0.77131 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.304348 | false | 0 | 0.086957 | 0.130435 | 0.565217 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
24c783b79d8826c857779183ef77e340ab891bf5 | 1,254 | py | Python | tests/test_translator.py | stunstunstun/navertrans | 97b35fb8768aefb478f1a70752179dd2f7ab3601 | [
"Unlicense",
"MIT"
] | 27 | 2017-07-14T15:05:13.000Z | 2022-01-10T14:39:42.000Z | tests/test_translator.py | stunstunstun/navertrans | 97b35fb8768aefb478f1a70752179dd2f7ab3601 | [
"Unlicense",
"MIT"
] | 1 | 2018-01-01T02:46:36.000Z | 2018-01-01T21:29:26.000Z | tests/test_translator.py | stunstunstun/navertrans | 97b35fb8768aefb478f1a70752179dd2f7ab3601 | [
"Unlicense",
"MIT"
] | 5 | 2017-07-17T00:43:29.000Z | 2021-08-20T18:16:50.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
from papago.translator import Translator
class TestTranslator(unittest.TestCase):
def setUp(self):
"""
setup your application client keys
- https://developers.naver.com/docs/common/apicall/
"""
self.translator = Translator(os.environ['CLIENT_ID'], os.environ['CLIENT_SECRET'])
pass
def test_translate(self):
"""
Test that say hello translate to english
"""
response = self.translator.translate('안녕하세요')
self.assertEqual(response.text, 'Hello.')
def test_translate_with_source(self):
"""
Test that source language translate to target language
"""
response = self.translator.translate('안녕하세요', 'ko', 'ja')
self.assertIsNotNone(response.text)
def test_translate_invalid_source(self):
"""
Test that invalid source languages
"""
self.assertRaises(ValueError, self.translator.translate, 'مرحبا', 'ar', 'en')
def test_translate_invalid_target(self):
"""
Test that invalid target languages
"""
self.assertRaises(ValueError, self.translator.translate, 'Hello', 'en', 'ar')
| 29.857143 | 90 | 0.629984 | 133 | 1,254 | 5.849624 | 0.443609 | 0.089974 | 0.082262 | 0.079692 | 0.241645 | 0.1491 | 0.1491 | 0 | 0 | 0 | 0 | 0.001063 | 0.249601 | 1,254 | 41 | 91 | 30.585366 | 0.825717 | 0.235247 | 0 | 0 | 0 | 0 | 0.071942 | 0 | 0 | 0 | 0 | 0 | 0.235294 | 1 | 0.294118 | false | 0.058824 | 0.176471 | 0 | 0.529412 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
24cb167d637b8558764cd9fd432147da54cd4078 | 375 | py | Python | clge/Behaviour/World.py | RafayelGardishyan/CLGE | 12afb3612963c7631406c3693cdcff4442379c1c | [
"MIT"
] | 2 | 2018-02-20T06:13:44.000Z | 2019-10-31T21:55:00.000Z | clge/Behaviour/World.py | RafayelGardishyan/CLGE | 12afb3612963c7631406c3693cdcff4442379c1c | [
"MIT"
] | 6 | 2018-02-03T12:33:35.000Z | 2018-09-10T17:27:57.000Z | clge/Behaviour/World.py | RafayelGardishyan/CLGE | 12afb3612963c7631406c3693cdcff4442379c1c | [
"MIT"
] | 1 | 2018-02-13T14:02:28.000Z | 2018-02-13T14:02:28.000Z | class World:
def __init__(self):
self.children = []
def addChild(self, child):
child.world = self
self.children.append(child)
def getChildByName(self, name):
for child in self.children:
if child.name == name:
return name
return None
def getAllChildren(self):
return self.children
| 22.058824 | 35 | 0.573333 | 41 | 375 | 5.146341 | 0.414634 | 0.227488 | 0.151659 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.341333 | 375 | 16 | 36 | 23.4375 | 0.854251 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0 | 0 | 0.076923 | 0.615385 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
24e21254390c306a67794f45bda741d776ff032f | 115 | py | Python | aiida_node_shell/__init__.py | giovannipizzi/aiida-node-shell | 55cfd48f32ee7130ab747f8b966890f04fec5a89 | [
"MIT"
] | 6 | 2020-03-07T10:39:45.000Z | 2021-12-11T04:55:06.000Z | aiida_node_shell/__init__.py | giovannipizzi/aiida-node-shell | 55cfd48f32ee7130ab747f8b966890f04fec5a89 | [
"MIT"
] | 10 | 2020-04-25T10:55:18.000Z | 2020-10-23T06:38:43.000Z | aiida_node_shell/__init__.py | giovannipizzi/aiida-node-shell | 55cfd48f32ee7130ab747f8b966890f04fec5a89 | [
"MIT"
] | 1 | 2020-04-25T10:21:41.000Z | 2020-04-25T10:21:41.000Z | """A proof of concept of a `verdi node shell` command."""
from .shell import AiiDANodeShell
__version__ = "0.1.0"
| 23 | 57 | 0.713043 | 18 | 115 | 4.333333 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030928 | 0.156522 | 115 | 4 | 58 | 28.75 | 0.773196 | 0.443478 | 0 | 0 | 0 | 0 | 0.086207 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
701ab90ef07b12c16584994f364b3e2395535fe1 | 430 | py | Python | pytorch_utils.py | AntreasAntoniou/FewShotContinualLearning | 819b9cc26ef9d2360a040c51f17958e1b8dba8fd | [
"MIT"
] | 34 | 2020-04-16T06:19:45.000Z | 2022-02-10T02:02:59.000Z | pytorch_utils.py | AntreasAntoniou/FewShotContinualLearning | 819b9cc26ef9d2360a040c51f17958e1b8dba8fd | [
"MIT"
] | 3 | 2020-08-13T03:41:43.000Z | 2020-08-25T11:24:33.000Z | pytorch_utils.py | AntreasAntoniou/FewShotContinualLearning | 819b9cc26ef9d2360a040c51f17958e1b8dba8fd | [
"MIT"
] | 4 | 2020-06-23T02:50:59.000Z | 2021-07-12T01:47:06.000Z | import torch
import torch.functional as F
import torch.nn as nn
import numpy as np
def int_to_one_hot(int_labels):
num_output_units = torch.max(int_labels).long() + 1
labels_one_hot = torch.zeros(int_labels.shape[0], num_output_units).long().to(int_labels.device)
labels_one_hot.scatter_(1, int_labels.unsqueeze(dim=1), 1)
labels_one_hot = labels_one_hot.view((-1, num_output_units))
return labels_one_hot
| 28.666667 | 100 | 0.760465 | 75 | 430 | 4.026667 | 0.386667 | 0.119205 | 0.198676 | 0.086093 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016129 | 0.134884 | 430 | 14 | 101 | 30.714286 | 0.795699 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.4 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
702b31704058f5231d19fa7a9df8197b238bbd74 | 6,584 | py | Python | Creator.py | FredHappyface/Python.ScritchAssembler | 4f29682d1d396509d30e3a15f2765ae88d98ff7b | [
"MIT"
] | null | null | null | Creator.py | FredHappyface/Python.ScritchAssembler | 4f29682d1d396509d30e3a15f2765ae88d98ff7b | [
"MIT"
] | null | null | null | Creator.py | FredHappyface/Python.ScritchAssembler | 4f29682d1d396509d30e3a15f2765ae88d98ff7b | [
"MIT"
] | null | null | null | from PIL import Image
#functions = {0: nop, 1: push, 2: pop, 3: add, 4: sub,
# 5: jump, 6: condjump, 7: ret, 8: condkill,
# 9: transform, 10: inp, 11: dup, 12: mul,
# 13: emptykill, 14: reverse, 15: rot, 16: over,
# 17: swap, 18: drop, 19: inpint, 20: waitfor,
# 21: singlekill, 22:runifonly}
# 1111 = WSEN
im = Image.open('blank.png')
pix = im.load()
##Asks for int input,
pix[0,0] = (1,0,2)
pix[1,0] = (19,0,2)
pix[2,0] = (19,0,2)
pix[3,0] = (1,5,2) ##generator coords
pix[4,0] = (1,0,2) ## ^^^^^
pix[5,0] = (5,0,0)
##Subtract divisor and repeat main loop
pix[6,0] = (0,0,2)
pix[7,0] = (1,254,2)
pix[8,0] = (0,0,2)
pix[9,0] = (18,0,4)
pix[9,1] = (18,0,2)
pix[10,1] = (0,0,1)
pix[10,0] = (18,0,2)
pix[11,0] = (11,0,2)
pix[12,0] = (15,0,2)
pix[13,0] = (4,0,2)
pix[14,0] = (17,0,2)
pix[15,0] = (15,0,2)
pix[16,0] = (3,1,2)
pix[17,0] = (15,0,2)
pix[18,0] = (15,0,2)
pix[19,0] = (1,5,2)
pix[20,0] = (1,0,2)
pix[21,0] = (5,0,0)
##Modifies stack to have a copy seperated by dollar sign
pix[0,5] = (16,0,2)
pix[1,5] = (16,0,2)
pix[2,5] = (4,1,2)
pix[3,5] = (1,255,2)
pix[4,5] = (15,0,2)
pix[5,5] = (15,0,2)
##
pix[6,5] = (11,0,2) #dup
pix[7,5] = (4,1,2) #sub
pix[8,5] = (11,0,2) #dup
pix[9,5] = (1,10,2) #y
pix[10,5] = (1,0,2) #x
pix[11,5] = (15,0,2) #rot
pix[12,5] = (6,0,4) #condjump on 0
pix[12,6] = (1,253,8)#push %
pix[11,6] = (0,0,8)
pix[10,6] = (8,254,8) ##Program has 2 time steps to display & on stack to kill exec on this branch.
pix[9,6] = (15,0,8) #rot again for some reason?
pix[8,6] = (17,0,8) #swap
pix[7,6] = (0,0,8)
pix[6,6] = (0,0,1)
pix[0,10] = (0,0,2)
pix[1,10] = (1,254,2)
pix[2,10] = (0,0,2)
pix[3,10] = (18,0,2) #Kills other branch, Fixes stack
pix[4,10] = (15,0,2) #rot
pix[5,10] = (17,0,2) #swap
pix[6,10] = (16,0,2) #over
pix[7,10] = (4,0,2) #sub
pix[8,10] = (1,15,2) #y
pix[9,10] = (1,0,2)#x
pix[10,10] = (15,0,4)#rot
pix[10,11] = (6,0,8)#jump on 0
pix[9,11] = (1,253,8) #push 253
pix[8,11] = (0,0,8)
pix[7,11] = (8,254,8)#kill if 254
pix[6,11] = (16,0,4) #over
pix[6,12] = (1,0,4)
pix[6,13] = (1,6,8) #push 6,0
pix[5,13] = (15,0,8) #rot
pix[4,13] = (6,255,8) #jump if bottom reached
pix[3,13] = (1,253,1) #push 153
pix[3,12] = (0,0,1)
pix[3,11] = (8,254,2) #kill if 254
pix[4,11] = (0,0,2)
pix[5,11] = (0,0,1)
##
pix[0,15] = (0,0,2)
pix[1,15] = (1,254,2)
pix[2,15] = (0,0,2)
pix[3,15] = (18,0,2)
pix[4,15] = (2,0,4) ##Remainder.
pix[4,16] = (1,ord('r'),4)
pix[4,17] = (1,ord('e'),2)
pix[5,17] = (1,ord('d'),2)
pix[6,17] = (1,ord('n'),2)
pix[7,17] = (1,ord('i'),2)
pix[8,17] = (1,ord('a'),2)
pix[9,17] = (1,ord('m'),2)
pix[10,17] = (1,ord('e'),2)
pix[11,17] = (1,ord('r'),2)
pix[12,17] = (1,ord(' '),2)
pix[13,17] = (1,ord('e'),2)
pix[14,17] = (1,ord('h'),2)
pix[15,17] = (1,ord('t'),2)
pix[16,17] = (1,ord(' '),2)
pix[17,17] = (1,ord('s'),2)
pix[18,17] = (1,ord('i'),2)
pix[19,17] = (1,ord(' '),2)
pix[20,17] = (2,1,1)
pix[20,16] = (2,1,8)
pix[19,16] = (2,1,8)
pix[18,16] = (2,1,8)
pix[17,16] = (2,1,8)
pix[16,16] = (2,1,8)
pix[15,16] = (2,1,8)
pix[14,16] = (2,1,8)
pix[13,16] = (2,1,8)
pix[12,16] = (2,1,8)
pix[11,16] = (2,1,8)
pix[10,16] = (2,1,8)
pix[9,16] = (2,1,8)
pix[8,16] = (2,1,8)
pix[7,16] = (2,1,8)
pix[6,16] = (2,1,8)
pix[5,16] = (2,1,1)
pix[5,15] = (1,20,2)
pix[6,15] = (1,0,2)
pix[7,15] = (5,0,2)
pix[8,15] = (22,0,2)
pix[9,15] = (18,0,2)
pix[10,15] = (18,0,2)
pix[11,15] = (18,0,2)
pix[12,15] = (1,ord(' '),2)
pix[13,15] = (1,ord('.'),2)
pix[14,15] = (2,1,2)
pix[15,15] = (2,1,2)
pix[16,15] = (2,0,2) ##Output the integer divison
pix[17,15] = (1,ord('.'),2)
pix[18,15] = (1,ord('r'),2)
pix[19,15] = (1,ord('o'),2)
pix[20,15] = (1,ord('o'),2)
pix[21,15] = (1,ord('l'),2)
pix[22,15] = (1,ord('f'),2)
pix[23,15] = (1,ord(' '),2)
pix[24,15] = (1,ord('e'),2)
pix[25,15] = (1,ord('h'),2)
pix[26,15] = (1,ord('t'),2)
pix[27,15] = (1,ord(' '),2)
pix[28,15] = (1,ord('s'),2)
pix[29,15] = (1,ord('i'),2)
pix[30,15] = (1,ord(' '),2)
pix[31,15] = (2,1,2)
pix[32,15] = (2,1,2)
pix[33,15] = (2,1,2)
pix[34,15] = (2,1,2)
pix[35,15] = (2,1,2)
pix[36,15] = (2,1,2)
pix[37,15] = (2,1,2)
pix[38,15] = (2,1,2)
pix[39,15] = (2,1,2)
pix[40,15] = (2,1,2)
pix[41,15] = (2,1,2)
pix[42,15] = (2,1,2)
pix[43,15] = (2,1,2)
pix[44,15] = (2,1,0)
pix[0,20] = (11,0,2)
pix[1,20] = (8,255,4)
pix[1,21] = (18,0,8)
pix[0,21] = (0,0,1)
im.save('test.png',quality = 95)
''' Hello World
pix[1,3] = (1,ord('h'),4)
pix[2,2] = (1,ord('e'),0)
pix[1,2] = (1,ord('l'),6)
pix[2,1] = (1,ord('l'),0)
pix[0,2] = (1,ord('o'),2)
pix[1,1] = (1,ord('w'),2)
pix[2,0] = (1,ord('o'),0)
pix[0,1] = (1,ord('r'),6)
pix[1,0] = (1,ord('l'),2)
pix[0,0] = (1,ord('d'),6)
pix[1,4] = (2,1,14)
pix[0,4] = (2,20,0)
pix[2,4] = (2,20,0)
pix[1,5] = (2,20,14)
pix[0,5] = (2,30,4)
pix[2,5] = (2,30,6)
pix[1,6] = (2,30,0)
pix[0,6] = (2,40,0)
pix[2,6] = (2,40,0)
pix[3,5] = (2,40,0)
'''
'''
#Repeats users string back to them
pix[0,0] = (10,255,2)
pix[1,0] = (11,0,2)
pix[2,0] = (11,0,2)
pix[3,0] = (1,5,4)
pix[3,1] = (1,0,8)
pix[2,1] = (15,255,8)
pix[1,1] = (6,ord(' '),8)
pix[0,1] = (8,ord(' '),1)
pix[0,5] = (0,0,2)
pix[1,5] = (14,0,2)
pix[2,5] = (2,255,2)
pix[3,5] = (13,0,4)
pix[3,6] = (0,0,8)
pix[2,6] = (0,0,1)
'''
'''
Factorial
pix[0,0] = (1,32,2)
pix[1,0] = (1,32,2)
pix[2,0] = (5,0,2)
pix[3,0] = (22,0,2)
pix[4,0] = (0,0,6)
pix[4,1] = (22,0,4)
pix[4,2] = (2,0,0)
pix[5,0] = (21,0,2)
pix[6,0] = (12,0,4)
pix[6,1] = (0,0,8)
pix[5,1] = (0,0,1)
pix[32,32] = (0,0,4)
pix[32,33] = (19,0,14)
pix[31,33] = (0,0,8)
pix[30,33] = (11,0,8)
pix[29,33] = (4,1,8)
pix[28,33] = (11,0,4)
pix[28,34] = (8,0,2)
pix[29,34] = (11,0,2)
pix[30,34] = (8,1,2)
pix[31,34] = (0,0,1)
pix[33,33] = (11,0,2)
pix[34,33] = (4,1,2)
pix[35,33] = (0,0,2)
pix[36,33] = (11,0,4)
pix[36,34] = (8,0,8)
pix[35,34] = (11,0,8)
pix[34,34] = (8,1,8)
pix[33,34] = (0,0,1)
pix[32,34] = (20,1,4)
pix[32,35] = (0,0,4)
pix[32,36] = (0,0,4)
pix[32,37] = (0,0,4)
pix[32,38] = (18,0,0)
'''
'''Fibonnacci
pix[0,0] = (19,0,2)
pix[1,0] = (4,1,2)
pix[2,0] = (4,1,2)
pix[3,0] = (1,1,2)
pix[4,0] = (1,1,2)
pix[5,0] = (1,32,2)
pix[6,0] = (1,32,2)
pix[7,0] = (5,0,2)
pix[8,0] = (22,0,2)
pix[9,0] = (18,0,2)
pix[10,0] = (17,0,2)
pix[11,0] = (1,ord(' '),2)
pix[12,0] = (2,1,2)
pix[13,0] = (2,0,2)
pix[14,0] = (1,ord(' '),2)
pix[15,0] = (2,1,2)
pix[16,0] = (2,0,0)
pix[32,32] = (16,0,2)
pix[33,32] = (16,0,4)
pix[33,33] = (3,0,2)
pix[34,33] = (15,0,4)
pix[34,34] = (2,0,8)
pix[33,34] = (15,0,4)
pix[33,35] = (4,1,8)
pix[32,35] = (11,0,1)
pix[32,34] = (8,0,8)
pix[31,34] = (15,0,8)
pix[30,34] = (1,ord(' '),1)
pix[30,33] = (2,1,2)
pix[31,33] = (15,0,2)
pix[32,33] = (0,0,1)
'''
| 20.968153 | 99 | 0.483445 | 1,709 | 6,584 | 1.862493 | 0.093622 | 0.160855 | 0.083255 | 0.03393 | 0.398052 | 0.043041 | 0.011938 | 0 | 0 | 0 | 0 | 0.296844 | 0.157807 | 6,584 | 313 | 100 | 21.035144 | 0.277187 | 0.117102 | 0 | 0 | 0 | 0 | 0.014148 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.00641 | 0 | 0.00641 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
702fafa7c140a3e585f0dcaef68faf102c88f473 | 615 | py | Python | a3dUtils.py | adressaparken/Raspberry-Pi-Python-App | 05f65d2ca121779a74fe0f4189621278e304a496 | [
"Unlicense",
"MIT"
] | null | null | null | a3dUtils.py | adressaparken/Raspberry-Pi-Python-App | 05f65d2ca121779a74fe0f4189621278e304a496 | [
"Unlicense",
"MIT"
] | null | null | null | a3dUtils.py | adressaparken/Raspberry-Pi-Python-App | 05f65d2ca121779a74fe0f4189621278e304a496 | [
"Unlicense",
"MIT"
] | null | null | null | #!/usr/bin/python
import sys
import signal
import time
import socket
#------------------------------------------/
#---/get local ip address
def get_ip_address( server_ip ):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((server_ip, 80))
ip = s.getsockname()[0]
s.close()
return ip
#------------------------------------------/
#---/ get current time in milliseconds
def current_milli_time():
return int(round(time.time() * 1000))
#------------------------------------------/
#---/get RPi ID
def get_ID( server_ip ):
return get_ip_address( server_ip ).split('.')[-1]
| 21.964286 | 56 | 0.526829 | 74 | 615 | 4.202703 | 0.486486 | 0.102894 | 0.07717 | 0.115756 | 0.128617 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015209 | 0.144715 | 615 | 27 | 57 | 22.777778 | 0.576046 | 0.357724 | 0 | 0 | 0 | 0 | 0.002577 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.285714 | 0.142857 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
70418a10d049ea2a22081246c6abc5081f6913a8 | 3,930 | py | Python | livestyled/schemas/__init__.py | Edvinas9/python-sdk | e24413b337f7d2232e28944b93ded7a430df0293 | [
"MIT"
] | null | null | null | livestyled/schemas/__init__.py | Edvinas9/python-sdk | e24413b337f7d2232e28944b93ded7a430df0293 | [
"MIT"
] | 1 | 2021-07-09T10:59:21.000Z | 2021-07-09T10:59:21.000Z | livestyled/schemas/__init__.py | Edvinas9/python-sdk | e24413b337f7d2232e28944b93ded7a430df0293 | [
"MIT"
] | 3 | 2021-02-01T10:13:36.000Z | 2022-02-11T17:47:30.000Z | from livestyled.schemas.app import AppSchema, CurrencySchema
from livestyled.schemas.audience import AudienceSchema
from livestyled.schemas.audience_device import AudienceDeviceSchema
from livestyled.schemas.booking import BookingSchema
from livestyled.schemas.cohort import CohortSchema
from livestyled.schemas.competition import CompetitionSchema
from livestyled.schemas.device import DeviceSchema
from livestyled.schemas.device_consent import DeviceConsentSchema
from livestyled.schemas.device_form_data import DeviceFormDataSchema
from livestyled.schemas.device_preference import DevicePreferenceSchema
from livestyled.schemas.device_reality import DeviceRealitySchema
from livestyled.schemas.device_token import DeviceTokenSchema
from livestyled.schemas.event import EventSchema
from livestyled.schemas.event_category import EventCategorySchema
from livestyled.schemas.event_integration import EventIntegrationSchema
from livestyled.schemas.event_stage import EventStageSchema
from livestyled.schemas.fixture import FixtureSchema
from livestyled.schemas.fulfilment_point import FulfilmentPointSchema
from livestyled.schemas.league_table import LeagueTableGroupSchema, LeagueTableSchema
from livestyled.schemas.location import LocationSchema
from livestyled.schemas.magic_field import MagicFieldSchema
from livestyled.schemas.news import NewsSchema
from livestyled.schemas.order import OrderSchema
from livestyled.schemas.payment import (
MerchantAccountFulfilmentPointPspTokenSchema,
MerchantAccountFulfilmentPointSchema,
MerchantAccountSchema,
PaymentCustomerSchema,
PaymentGatewaySchema,
PaymentIntentSchema,
PaymentSourceSchema
)
from livestyled.schemas.product import (
ProductCategorySchema,
ProductModifierItemSchema,
ProductModifierListSchema,
ProductSchema,
ProductVariantSchema,
ProductVariantStockSchema
)
from livestyled.schemas.push_broadcast import PushBroadcastSchema
from livestyled.schemas.push_consent import PushConsentSchema
from livestyled.schemas.reality import RealitySchema, RealityTypeSchema
from livestyled.schemas.season import SeasonSchema
from livestyled.schemas.sport_venue import SportVenueSchema
from livestyled.schemas.storage import ExportSchema
from livestyled.schemas.team import TeamSchema
from livestyled.schemas.ticket import TicketSchema
from livestyled.schemas.ticket_auth import TicketAuthSchema
from livestyled.schemas.ticket_integration import TicketIntegrationSchema
from livestyled.schemas.user import UserCreateSchema, UserEmailSchema, UserInfoSchema, UserSchema, UserSSOSchema
from livestyled.schemas.venue import VenueSchema
__all__ = [
AppSchema,
AudienceSchema,
AudienceDeviceSchema,
BookingSchema,
CohortSchema,
CompetitionSchema,
CurrencySchema,
DeviceSchema,
DeviceConsentSchema,
DeviceFormDataSchema,
DevicePreferenceSchema,
DeviceRealitySchema,
DeviceTokenSchema,
EventSchema,
EventCategorySchema,
EventIntegrationSchema,
EventStageSchema,
ExportSchema,
FixtureSchema,
FulfilmentPointSchema,
LeagueTableSchema,
LeagueTableGroupSchema,
LocationSchema,
MagicFieldSchema,
MerchantAccountSchema,
MerchantAccountFulfilmentPointSchema,
MerchantAccountFulfilmentPointPspTokenSchema,
NewsSchema,
OrderSchema,
PaymentCustomerSchema,
PaymentGatewaySchema,
PaymentIntentSchema,
PaymentSourceSchema,
ProductCategorySchema,
ProductModifierItemSchema,
ProductModifierListSchema,
ProductSchema,
ProductVariantSchema,
ProductVariantStockSchema,
PushBroadcastSchema,
PushConsentSchema,
RealitySchema,
RealityTypeSchema,
SeasonSchema,
SportVenueSchema,
TeamSchema,
TicketAuthSchema,
TicketIntegrationSchema,
TicketSchema,
UserCreateSchema,
UserEmailSchema,
UserInfoSchema,
UserSchema,
UserSSOSchema,
VenueSchema,
]
| 35.405405 | 112 | 0.833079 | 314 | 3,930 | 10.356688 | 0.312102 | 0.159287 | 0.23893 | 0.049816 | 0.121156 | 0.079336 | 0 | 0 | 0 | 0 | 0 | 0 | 0.127735 | 3,930 | 110 | 113 | 35.727273 | 0.948658 | 0 | 0 | 0.201835 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.33945 | 0 | 0.33945 | 0 | 0 | 0 | 1 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7055bf61d343d347cb66107a7aa5fddd5dcd9f83 | 238 | py | Python | Python/dictionary.py | vermayash7980/Hacktoberfest2021 | 66e190608c5e3f9ad983ba8f707e499ca5bc6da0 | [
"MIT"
] | 39 | 2021-10-03T05:40:26.000Z | 2021-10-31T18:09:23.000Z | Python/dictionary.py | vermayash7980/Hacktoberfest2021 | 66e190608c5e3f9ad983ba8f707e499ca5bc6da0 | [
"MIT"
] | 26 | 2021-10-03T04:50:47.000Z | 2021-10-16T07:39:22.000Z | Python/dictionary.py | vermayash7980/Hacktoberfest2021 | 66e190608c5e3f9ad983ba8f707e499ca5bc6da0 | [
"MIT"
] | 215 | 2021-10-03T04:35:47.000Z | 2021-10-31T17:37:42.000Z | d={
"Aligarh":"It is the city in UP ",
"bharatpur":"it is the city in Rajasthan",
"delhi ":"it is the capital of India",
"Mumbai":"it is the city in Maharashtra"
}
print("enter the name which you want to search ")
n1=input()
print(d[n1])
| 23.8 | 49 | 0.680672 | 43 | 238 | 3.767442 | 0.604651 | 0.098765 | 0.17284 | 0.203704 | 0.240741 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01005 | 0.163866 | 238 | 9 | 50 | 26.444444 | 0.80402 | 0 | 0 | 0 | 0 | 0 | 0.718487 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.222222 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5622afdb2de7f805adc786900fe36d7d5785a562 | 669 | py | Python | server/database/database.py | ansnadeem/yawe | 27aa20c743a624e4cfeacb47bd0ee41d2835fb9a | [
"MIT"
] | null | null | null | server/database/database.py | ansnadeem/yawe | 27aa20c743a624e4cfeacb47bd0ee41d2835fb9a | [
"MIT"
] | null | null | null | server/database/database.py | ansnadeem/yawe | 27aa20c743a624e4cfeacb47bd0ee41d2835fb9a | [
"MIT"
] | null | null | null | import psycopg2
import json
from database import configure
class UnitOfWork:
def __init__(self):
configurations = configure.getDatabaseConfigurations()
self.conn = psycopg2.connect("dbname={} user={} password={}".format(configurations['databaseName'], configurations['userName'], configurations['password']))
self.cur = self.conn.cursor()
def execute(self, query):
self.cur.execute(query)
def executeAndFetch(self, query):
self.cur.execute(query)
return self.cur.fetchall()
def commit(self):
self.conn.commit()
def __del__(self):
self.cur.close()
self.conn.close() | 29.086957 | 164 | 0.654709 | 70 | 669 | 6.142857 | 0.442857 | 0.081395 | 0.060465 | 0.074419 | 0.130233 | 0.130233 | 0 | 0 | 0 | 0 | 0 | 0.003824 | 0.218236 | 669 | 23 | 165 | 29.086957 | 0.818356 | 0 | 0 | 0.111111 | 0 | 0 | 0.085075 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0.055556 | 0.166667 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
562ed7f28ae2fc943aa885ba0436f3cb20f0f2a1 | 1,006 | py | Python | corkus/objects/partial_online_player.py | MrBartusek/corkus.py | 031c11e3e251f0bddbcb67415564357460fe7fea | [
"MIT"
] | 5 | 2021-09-10T14:20:15.000Z | 2022-01-09T11:27:49.000Z | corkus/objects/partial_online_player.py | MrBartusek/corkus.py | 031c11e3e251f0bddbcb67415564357460fe7fea | [
"MIT"
] | 11 | 2021-08-15T09:39:09.000Z | 2022-01-12T14:11:24.000Z | corkus/objects/partial_online_player.py | MrBartusek/corkus.py | 031c11e3e251f0bddbcb67415564357460fe7fea | [
"MIT"
] | 2 | 2021-12-01T23:33:14.000Z | 2022-01-12T11:08:18.000Z | from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Literal
from .partial_player import PartialPlayer
if TYPE_CHECKING:
from corkus import Corkus
from .uuid import CorkusUUID
from .server import Server
class PartialOnlinePlayer(PartialPlayer):
"""Represents a :py:class:`PartialPlayer` that is currently online."""
def __init__(self, corkus: Corkus, server: Server, *, uuid: Optional[CorkusUUID] = None, username: Optional[str] = None):
super().__init__(corkus, uuid = uuid, username = username)
self._server = server
@property
def online(self) -> Literal[True]:
"""Is player online right now, always ``True`` obviously."""
return True
@property
def server(self) -> Server:
"""The server that this player is currently on."""
return self._server
def __repr__(self) -> str:
return super().__repr__().replace("PartialPlayer", f"PartialOnlinePlayer server={self._server.name!r}")
| 33.533333 | 125 | 0.689861 | 116 | 1,006 | 5.758621 | 0.413793 | 0.05988 | 0.047904 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.201789 | 1,006 | 29 | 126 | 34.689655 | 0.83188 | 0.163022 | 0 | 0.105263 | 0 | 0 | 0.07385 | 0.033898 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0 | 0.315789 | 0.052632 | 0.736842 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
5668bbe5fc9827007028673f24e5c8afd3062a8c | 22 | py | Python | news/constants.py | trojsten/news | aa1dfb4ee31a7f810dcd484eecafd49659292d76 | [
"BSD-3-Clause"
] | null | null | null | news/constants.py | trojsten/news | aa1dfb4ee31a7f810dcd484eecafd49659292d76 | [
"BSD-3-Clause"
] | 6 | 2016-07-10T00:22:02.000Z | 2021-12-23T22:43:41.000Z | news/constants.py | trojsten/news | aa1dfb4ee31a7f810dcd484eecafd49659292d76 | [
"BSD-3-Clause"
] | 2 | 2019-04-30T20:20:38.000Z | 2021-02-16T18:41:01.000Z | NEWS_PAGINATE_BY = 10
| 11 | 21 | 0.818182 | 4 | 22 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.105263 | 0.136364 | 22 | 1 | 22 | 22 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
566f5bb5bc6f4245b798404f319c3a824fb763b3 | 323 | py | Python | pyso3/check.py | hoj201/pyso3 | e6888dba39a54740bff41a8bfec88d85b2285380 | [
"MIT"
] | null | null | null | pyso3/check.py | hoj201/pyso3 | e6888dba39a54740bff41a8bfec88d85b2285380 | [
"MIT"
] | null | null | null | pyso3/check.py | hoj201/pyso3 | e6888dba39a54740bff41a8bfec88d85b2285380 | [
"MIT"
] | null | null | null | def isSO(R, tol=1e-6):
import numpy as np
error = np.dot(R, R.transpose()) - np.eye(3)
t1 = max(abs(error.flatten())) < tol
t2 = abs(np.linalg.det(R)-1.0) < tol**(1.0/3.0)
return t1 and t2
def isAntiSym(omega, tol=1e-6):
error = omega + omega.transpose()
return max(abs(error.flatten())) < tol
| 29.363636 | 51 | 0.594427 | 58 | 323 | 3.310345 | 0.482759 | 0.052083 | 0.0625 | 0.1875 | 0.21875 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0.210526 | 323 | 10 | 52 | 32.3 | 0.694118 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.