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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d3dface6d8741b343b6db341016e57418a6b53a7 | 962 | py | Python | CursoemVideoPython/teste0J.py | Beebruna/Python | bdbe10ea76acca1b417f5960db0aae8be44e0af3 | [
"MIT"
] | null | null | null | CursoemVideoPython/teste0J.py | Beebruna/Python | bdbe10ea76acca1b417f5960db0aae8be44e0af3 | [
"MIT"
] | null | null | null | CursoemVideoPython/teste0J.py | Beebruna/Python | bdbe10ea76acca1b417f5960db0aae8be44e0af3 | [
"MIT"
] | null | null | null | print('\033[31mOlá, Mundo!')
print('\033[31;43mOlá, Mundo!')
print('\033[1;31;43mOlá, Mundo!')
print('\033[1;31;43mOlá, Mundo!\033[m')
print('\033[4;30;45mOlá, Mundo!\033[m')
print('\033[30mOlá, Mundo!\033[m')
print('\033[37mOlá, Mundo!\033[m')
print('\033[7;30mOlá, Mundo!\033[m')
print('\033[0;33;44mOlá, Mundo!\033[m')
print('\033[7;33;44mOlá, Mundo!\033[m')
a = 3
b = 5
print(f'Os valores são {a} e {b}')
print(f'Os valores são \033[32m{a} e \033[31m{b}\033[m')
print(f'Os valores são \033[32m{a}\033[m e \033[31m{b}\033[m!!!')
print(f'Os valores são \033[32;44m{a}\033[m e \033[31;44m{b}\033[m!!!')
nome = 'Guanabara'
print('Olá, Muito prazer em te conhecer, {}{}{}!!!'.format('\033[4;34m', nome, '\033[m'))
#Dicionário
cores = {'limpar':'\033[m',
'azul':'\033[34m',
'amarelo':'\033[33m',
'pretoebranco':'\033[7;30m'}
print('Olá, Muito prazer em te conhecer, {}{}{}!!!'.format(cores['pretoebranco'], nome, cores['limpar']))
| 31.032258 | 105 | 0.608108 | 170 | 962 | 3.441176 | 0.282353 | 0.095727 | 0.123077 | 0.14359 | 0.671795 | 0.526496 | 0.386325 | 0.386325 | 0.210256 | 0.112821 | 0 | 0.197415 | 0.115385 | 962 | 30 | 106 | 32.066667 | 0.490012 | 0.010395 | 0 | 0 | 0 | 0.130435 | 0.670873 | 0.024185 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.695652 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
d3e15f19dcce55de3cc492dd27e11e13d6c0cbdc | 355 | py | Python | packages.py | akshaym91/python-training | 797c2ac3078765b1de015ca8a16e02b3a8ba7380 | [
"MIT"
] | null | null | null | packages.py | akshaym91/python-training | 797c2ac3078765b1de015ca8a16e02b3a8ba7380 | [
"MIT"
] | null | null | null | packages.py | akshaym91/python-training | 797c2ac3078765b1de015ca8a16e02b3a8ba7380 | [
"MIT"
] | null | null | null | # Package is a collection of modules contained in a folder
# All related files must be inside a single folder.
# There must be a mandatory file __init__.py
# __init__.py COULD include any content that might be useful.
# __init__.py COULD be empty.
# Can be imported by using the name of the folder.
# On importing the package the __init__.py is exceuted.
| 44.375 | 61 | 0.774648 | 61 | 355 | 4.245902 | 0.622951 | 0.092664 | 0.084942 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.180282 | 355 | 7 | 62 | 50.714286 | 0.890034 | 0.957746 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d3e3c5b8af3f6a68aba267add573481f15af0ed5 | 290 | py | Python | projects/byblog/pages/post_detail_page.py | bobjiangps/python3_test_framework | cfcdc10f5bcf96bb31e417b800d829c61fbba07f | [
"MIT"
] | 2 | 2019-06-28T07:33:36.000Z | 2020-01-12T12:47:20.000Z | projects/byblog/pages/post_detail_page.py | bobjiangps/python3_test_framework | cfcdc10f5bcf96bb31e417b800d829c61fbba07f | [
"MIT"
] | null | null | null | projects/byblog/pages/post_detail_page.py | bobjiangps/python3_test_framework | cfcdc10f5bcf96bb31e417b800d829c61fbba07f | [
"MIT"
] | null | null | null | from .common_component import CommonComponent
class PostDetailPage(CommonComponent):
# assertions below
def blog_post_title_equals(self, text):
self.log.info(f"Check the blog post title should be {text}")
self.element("blog_post_title").check_text(text)
| 29 | 69 | 0.717241 | 37 | 290 | 5.432432 | 0.648649 | 0.119403 | 0.19403 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.196552 | 290 | 9 | 70 | 32.222222 | 0.862661 | 0.055172 | 0 | 0 | 0 | 0 | 0.21673 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d3f328a6b45191ef197fdadb79b0169a049fb154 | 169 | py | Python | selectinf/tests/flags.py | TianXie1999/selective-inference | ca02bbd84af5f5597944c75bde8337db9c69066a | [
"BSD-3-Clause"
] | 51 | 2016-03-31T16:34:15.000Z | 2022-01-16T04:32:58.000Z | selectinf/tests/flags.py | TianXie1999/selective-inference | ca02bbd84af5f5597944c75bde8337db9c69066a | [
"BSD-3-Clause"
] | 11 | 2016-04-07T00:19:58.000Z | 2021-10-03T18:31:14.000Z | selectinf/tests/flags.py | TianXie1999/selective-inference | ca02bbd84af5f5597944c75bde8337db9c69066a | [
"BSD-3-Clause"
] | 14 | 2015-10-28T17:29:05.000Z | 2021-08-16T21:04:30.000Z | import os
SMALL_SAMPLES = False
SET_SEED = False
if "USE_SMALL_SAMPLES" in os.environ:
SMALL_SAMPLES = True
if "USE_TEST_SEED" in os.environ:
SET_SEED = True
| 15.363636 | 37 | 0.733728 | 28 | 169 | 4.142857 | 0.464286 | 0.310345 | 0.189655 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195266 | 169 | 10 | 38 | 16.9 | 0.852941 | 0 | 0 | 0 | 0 | 0 | 0.177515 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
310277de00937564a861a584a339dc154a86f9f0 | 645 | py | Python | venv/Lib/site-packages/IPython/nbformat.py | ajayiagbebaku/NFL-Model | afcc67a85ca7138c58c3334d45988ada2da158ed | [
"MIT"
] | 6,989 | 2017-07-18T06:23:18.000Z | 2022-03-31T15:58:36.000Z | venv/Lib/site-packages/IPython/nbformat.py | ajayiagbebaku/NFL-Model | afcc67a85ca7138c58c3334d45988ada2da158ed | [
"MIT"
] | 1,978 | 2017-07-18T09:17:58.000Z | 2022-03-31T14:28:43.000Z | venv/Lib/site-packages/IPython/nbformat.py | ajayiagbebaku/NFL-Model | afcc67a85ca7138c58c3334d45988ada2da158ed | [
"MIT"
] | 1,228 | 2017-07-18T09:03:13.000Z | 2022-03-29T05:57:40.000Z | """
Shim to maintain backwards compatibility with old IPython.nbformat imports.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import sys
from warnings import warn
from IPython.utils.shimmodule import ShimModule, ShimWarning
warn("The `IPython.nbformat` package has been deprecated since IPython 4.0. "
"You should import from nbformat instead.", ShimWarning)
# Unconditionally insert the shim into sys.modules so that further import calls
# trigger the custom attribute access above
sys.modules['IPython.nbformat'] = ShimModule(
src='IPython.nbformat', mirror='nbformat')
| 32.25 | 79 | 0.778295 | 84 | 645 | 5.97619 | 0.654762 | 0.119522 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003623 | 0.144186 | 645 | 19 | 80 | 33.947368 | 0.905797 | 0.454264 | 0 | 0 | 0 | 0 | 0.439883 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.571429 | 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 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
3105cd38da6a38e901fb8d19f3e6769bef5e5d5b | 174 | py | Python | SharingMyLinkFrontEnd/apps.py | archit-kawale/SharingMyLink | b423f976c74293bd379ec75f8b2c698bc457aea1 | [
"MIT"
] | null | null | null | SharingMyLinkFrontEnd/apps.py | archit-kawale/SharingMyLink | b423f976c74293bd379ec75f8b2c698bc457aea1 | [
"MIT"
] | null | null | null | SharingMyLinkFrontEnd/apps.py | archit-kawale/SharingMyLink | b423f976c74293bd379ec75f8b2c698bc457aea1 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class SharingmylinkfrontendConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'SharingMyLinkFrontEnd'
| 24.857143 | 56 | 0.798851 | 17 | 174 | 8.058824 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126437 | 174 | 6 | 57 | 29 | 0.901316 | 0 | 0 | 0 | 0 | 0 | 0.287356 | 0.287356 | 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 |
31379f044b95a69cc6fac32c90d0dcd5280cf75d | 166 | py | Python | scripts/kwargs.py | arifulhaqueuc/python-algorithm-excersice | 7f2c93be7f87cbe2a8527f4edbf6c45f01e0597e | [
"MIT"
] | null | null | null | scripts/kwargs.py | arifulhaqueuc/python-algorithm-excersice | 7f2c93be7f87cbe2a8527f4edbf6c45f01e0597e | [
"MIT"
] | 4 | 2018-05-16T23:06:49.000Z | 2018-10-26T22:47:52.000Z | scripts/kwargs.py | arifulhaqueuc/python-algorithm-excersice | 7f2c93be7f87cbe2a8527f4edbf6c45f01e0597e | [
"MIT"
] | null | null | null |
def me(**kwargs):
for key, value in kwargs.items():
print("{0}=={1}". format(key, value))
me(name="Rahim", ID=18)
me(name="Ariful", age=109)
me(age=10)
| 18.444444 | 45 | 0.578313 | 28 | 166 | 3.428571 | 0.714286 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065693 | 0.174699 | 166 | 8 | 46 | 20.75 | 0.635037 | 0 | 0 | 0 | 0 | 0 | 0.115152 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | true | 0 | 0 | 0 | 0.166667 | 0.166667 | 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 |
3154e7836d09dc90cb1722e49d7095b37360e79c | 172 | py | Python | blog/apps.py | dijiudu/django_blog-django2.0.3 | b18889c4b9053b2a39c734c10a3bed84554d4303 | [
"MIT"
] | null | null | null | blog/apps.py | dijiudu/django_blog-django2.0.3 | b18889c4b9053b2a39c734c10a3bed84554d4303 | [
"MIT"
] | 8 | 2020-02-12T00:09:27.000Z | 2022-03-11T23:17:53.000Z | blog/apps.py | dijiudu/django_blog-django2.0.3 | b18889c4b9053b2a39c734c10a3bed84554d4303 | [
"MIT"
] | null | null | null | # coding: utf-8
from __future__ import unicode_literals
from django.apps import AppConfig
class BlogConfig(AppConfig):
name = 'blog'
verbose_name = "菜单折叠"
| 12.285714 | 39 | 0.715116 | 21 | 172 | 5.571429 | 0.809524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007353 | 0.209302 | 172 | 13 | 40 | 13.230769 | 0.852941 | 0.075581 | 0 | 0 | 0 | 0 | 0.051948 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
31572fac7d5b717249cfce36bb92d44a61734c38 | 153 | py | Python | Aulas2-31/Aula9/aula9.3.py | matheusschuetz/TrabalhoPython | 953957898de633f8f2776681a45a1a15b68e80b9 | [
"MIT"
] | 1 | 2020-01-21T11:43:12.000Z | 2020-01-21T11:43:12.000Z | Aulas2-31/Aula9/aula9.3.py | matheusschuetz/TrabalhoPython | 953957898de633f8f2776681a45a1a15b68e80b9 | [
"MIT"
] | null | null | null | Aulas2-31/Aula9/aula9.3.py | matheusschuetz/TrabalhoPython | 953957898de633f8f2776681a45a1a15b68e80b9 | [
"MIT"
] | null | null | null | from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def inicio():
return render_template('inicio.html')
app.run() | 13.909091 | 41 | 0.686275 | 20 | 153 | 4.95 | 0.65 | 0.282828 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.169935 | 153 | 11 | 42 | 13.909091 | 0.779528 | 0 | 0 | 0 | 0 | 0 | 0.077922 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0.166667 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
3161a4571815c4e4de0d42ee6b1c54540738506b | 213 | py | Python | midas_web_solution/midas_web_solution/settings/partials/database.py | jupiny/MIDASWebSolution | c6250bb7aeab815b3c759ae4f7b419da50c26b1c | [
"MIT"
] | null | null | null | midas_web_solution/midas_web_solution/settings/partials/database.py | jupiny/MIDASWebSolution | c6250bb7aeab815b3c759ae4f7b419da50c26b1c | [
"MIT"
] | null | null | null | midas_web_solution/midas_web_solution/settings/partials/database.py | jupiny/MIDASWebSolution | c6250bb7aeab815b3c759ae4f7b419da50c26b1c | [
"MIT"
] | null | null | null | # Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
import os
import dj_database_url
DATABASES = {}
DATABASES['default'] = dj_database_url.config(default=os.environ.get('DATABASE_URL'))
| 21.3 | 85 | 0.769953 | 30 | 213 | 5.3 | 0.633333 | 0.207547 | 0.163522 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015306 | 0.079812 | 213 | 9 | 86 | 23.666667 | 0.795918 | 0.328639 | 0 | 0 | 0 | 0 | 0.136691 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
31634021a2c6c0b596e6c64bc4327dc98a2bbb01 | 8,224 | py | Python | tayuya/constants.py | vipul-sharma20/tayuya | 793d6a4d6ae19d82a27cb4de402e6678d6240174 | [
"MIT"
] | 56 | 2019-09-14T18:12:00.000Z | 2021-11-14T19:27:45.000Z | tayuya/constants.py | vipul-sharma20/tayuya | 793d6a4d6ae19d82a27cb4de402e6678d6240174 | [
"MIT"
] | 1 | 2019-10-13T10:26:07.000Z | 2019-10-13T11:05:37.000Z | tayuya/constants.py | vipul-sharma20/tayuya | 793d6a4d6ae19d82a27cb4de402e6678d6240174 | [
"MIT"
] | 10 | 2019-09-17T14:31:07.000Z | 2021-05-15T13:31:04.000Z | # Standard tuning of each string
GUITAR_STAFF: dict = {0: 'E', 1: 'A', 2: 'D', 3: 'G', 4: 'B', 5: 'E'}
UKULELE_STAFF: dict = {0: 'G', 1: 'C', 2: 'E', 3: 'A'}
# Number of strings
GUITAR_STRING = 6
UKULELE_STRING = 4
# MIDI metadata
TIME_SIGNATURE = 'time_signature'
NOTE_ON = 'note_on'
NOTE_OFF = 'note_off'
HALF_NOTE = 'half'
WHOLE_NOTE = 'whole'
QUARTER_NOTE = 'quarter'
EIGHTH_NOTE = 'eighth'
SIXTEENTH_NOTE = 'sixteenth'
# Note type to note name mappings
NUM_TO_NOTES = {1: WHOLE_NOTE, 2: HALF_NOTE, 4: QUARTER_NOTE,
8: EIGHTH_NOTE, 16: SIXTEENTH_NOTE}
# Notes on all strings and fret of a guitar
# This is unused. Can remove
FRET_NOTES = \
[['F4', 'F#4', 'G4', 'Ab4', 'A4', 'Bb4', 'B4', 'C5', 'C#5', 'D5', 'Eb5', 'E5', 'F5', 'F#5', 'G5', 'Ab5', 'A5', 'Bb5', 'B5', 'C6', 'C#6', 'D6'], # E
['C4', 'C#4', 'D4', 'Eb4', 'E4', 'F4', 'F#4', 'G4', 'Ab4', 'A4', 'Bb4', 'B4', 'C5', 'C#5', 'D5', 'Eb5', 'E5', 'F5', 'F#5', 'G5', 'Ab5', 'A5'], # B
['Ab3', 'A3', 'Bb3', 'B3', 'C4', 'C#4', 'D4', 'Eb4', 'E4', 'F4', 'F#4', 'G4', 'Ab4', 'A4', 'Bb4', 'B4', 'C5', 'C#5', 'D5', 'Eb5', 'E5', 'F5'], # G
['Eb3', 'E3', 'F3', 'F#3', 'G3', 'Ab3', 'A3', 'Bb3', 'B3', 'C4', 'C#4', 'D4', 'Eb4', 'E4', 'F4', 'F#4', 'G4', 'Ab4', 'A4', 'Bb4', 'B4', 'C5'], # D
['Bb2', 'B2', 'C3', 'C#3', 'D3', 'Eb3', 'E3', 'F3', 'F#3', 'G3', 'Ab3', 'A3', 'Bb3', 'B3', 'C4', 'C#4', 'D4', 'Eb4', 'E4', 'F4', 'F#4', 'G4'], # A
['F2', 'F#2', 'G2', 'Ab2', 'A2', 'Bb2', 'B2', 'C3', 'C#3', 'D3', 'Eb3', 'E3', 'F3', 'F#3', 'G3', 'Ab3', 'A3', 'Bb3', 'B3', 'C4', 'C#4', 'D4']] # E
# 3 5 7 9 12 15 17 19 21
TRACK_ERROR_MESSAGE = 'No track with string instrument found'
# MIDI value to notes mapping
MIDI_TO_NOTES = {
0: [''],
1: [''],
10: [''],
100: ['E7'],
101: ['F7'],
102: ['F#7', 'Gb7'],
103: ['G7'],
104: ['G#7', 'Ab7'],
105: ['A7'],
106: ['A#7', 'Bb7'],
107: ['B7'],
108: ['C8'],
109: ['C#8', 'Db8'],
11: [''],
110: ['D8'],
111: ['D#8', 'Eb8'],
112: ['E8'],
113: ['F8'],
114: ['F#8', 'Gb8'],
115: ['G8'],
116: ['G#8', 'Ab8'],
117: ['A8'],
118: ['A#8', 'Bb8'],
119: ['B8'],
12: [''],
120: ['C9'],
121: ['C#9', 'Db9'],
122: ['D9'],
123: ['D#9', 'Eb9'],
124: ['E9'],
125: ['F9'],
126: ['F#9', 'Gb9'],
127: ['G9'],
13: [''],
14: [''],
15: [''],
16: [''],
17: [''],
18: [''],
19: [''],
2: [''],
20: [''],
21: ['A0'],
22: ['A#0', 'Bb0'],
23: ['B0'],
24: ['C1'],
25: ['C#1', 'Db1'],
26: ['D1'],
27: ['D#1', 'Eb1'],
28: ['E1'],
29: ['F1'],
3: [''],
30: ['F#1', 'Gb1'],
31: ['G1'],
32: ['G#1', 'Ab1'],
33: ['A1'],
34: ['A#1', 'Bb1'],
35: ['B1'],
36: ['C2'],
37: ['C#2', 'Db2'],
38: ['D2'],
39: ['D#2', 'Eb2'],
4: [''],
40: ['E2'],
41: ['F2'],
42: ['F#2', 'Gb2'],
43: ['G2'],
44: ['G#2', 'Ab2'],
45: ['A2'],
46: ['A#2', 'Bb2'],
47: ['B2'],
48: ['C3'],
49: ['C#3', 'Db3'],
5: [''],
50: ['D3'],
51: ['D#3', 'Eb3'],
52: ['E3'],
53: ['F3'],
54: ['F#3', 'Gb3'],
55: ['G3'],
56: ['G#3', 'Ab3'],
57: ['A3'],
58: ['A#3', 'Bb3'],
59: ['B3'],
6: [''],
60: ['C4'],
61: ['C#4', 'Db4'],
62: ['D4'],
63: ['D#4', 'Eb4'],
64: ['E4'],
65: ['F4'],
66: ['F#4', 'Gb4'],
67: ['G4'],
68: ['G#4', 'Ab4'],
69: ['A4'],
7: [''],
70: ['A#4', 'Bb4'],
71: ['B4'],
72: ['C5'],
73: ['C#5', 'Db5'],
74: ['D5'],
75: ['D#5', 'Eb5'],
76: ['E5'],
77: ['F5'],
78: ['F#5', 'Gb5'],
79: ['G5'],
8: [''],
80: ['G#5', 'Ab5'],
81: ['A5'],
82: ['A#5', 'Bb5'],
83: ['B5'],
84: ['C6'],
85: ['C#6', 'Db6'],
86: ['D6'],
87: ['D#6', 'Eb6'],
88: ['E6'],
89: ['F6'],
9: [''],
90: ['F#6', 'Gb6'],
91: ['G6'],
92: ['G#6', 'Ab6'],
93: ['A6'],
94: ['A#6', 'Bb6'],
95: ['B6'],
96: ['C7'],
97: ['C#7', 'Db7'],
98: ['D7'],
99: ['D#7', 'Eb7']
}
# Note to string and fret mappings
NOTE_TO_STRING = \
{'F4': {1: 1, 2: 6, 3: 10, 4: 15, 5: 20, 6: ''},
'F#4': {1: 2, 2: 7, 3: 11, 4: 16, 5: 21, 6: ''},
'G4': {1: 3, 2: 8, 3: 12, 4: 17, 5: 22, 6: ''},
'Ab4': {1: 4, 2: 9, 3: 13, 4: 18, 5: '', 6: ''},
'G#4': {1: 4, 2: 9, 3: 13, 4: 18, 5: '', 6: ''},
'A4': {1: 5, 2: 10, 3: 14, 4: 19, 5: '', 6: ''},
'Bb4': {1: 6, 2: 11, 3: 15, 4: 20, 5: '', 6: ''},
'A#4': {1: 6, 2: 11, 3: 15, 4: 20, 5: '', 6: ''},
'B4': {1: 7, 2: 12, 3: 16, 4: 21, 5: '', 6: ''},
'C5': {1: 8, 2: 13, 3: 17, 4: 22, 5: '', 6: ''},
'C#5': {1: 9, 2: 14, 3: 18, 4: '', 5: '', 6: ''},
'D5': {1: 10, 2: 15, 3: 19, 4: '', 5: '', 6: ''},
'Eb5': {1: 11, 2: 16, 3: 20, 4: '', 5: '', 6: ''},
'D#5': {1: 11, 2: 16, 3: 20, 4: '', 5: '', 6: ''},
'E5': {1: 12, 2: 17, 3: 21, 4: '', 5: '', 6: ''},
'F5': {1: 13, 2: 18, 3: 22, 4: '', 5: '', 6: ''},
'F#5': {1: 14, 2: 19, 3: '', 4: '', 5: '', 6: ''},
'G5': {1: 15, 2: 20, 3: '', 4: '', 5: '', 6: ''},
'Ab5': {1: 16, 2: 21, 3: '', 4: '', 5: '', 6: ''},
'G#5': {1: 16, 2: 21, 3: '', 4: '', 5: '', 6: ''},
'A5': {1: 17, 2: 22, 3: '', 4: '', 5: '', 6: ''},
'Bb5': {1: 18, 2: '', 3: '', 4: '', 5: '', 6: ''},
'A#5': {1: 18, 2: '', 3: '', 4: '', 5: '', 6: ''},
'B5': {1: 19, 2: '', 3: '', 4: '', 5: '', 6: ''},
'C6': {1: 20, 2: '', 3: '', 4: '', 5: '', 6: ''},
'C#6': {1: 21, 2: '', 3: '', 4: '', 5: '', 6: ''},
'D6': {1: 22, 2: '', 3: '', 4: '', 5: '', 6: ''},
'C4': {1: '', 2: 1, 3: 5, 4: 10, 5: 15, 6: 20},
'C#4': {1: '', 2: 2, 3: 6, 4: 11, 5: 16, 6: 21},
'D4': {1: '', 2: 3, 3: 7, 4: 12, 5: 17, 6: 22},
'Eb4': {1: '', 2: 4, 3: 8, 4: 13, 5: 18, 6: ''},
'D#4': {1: '', 2: 4, 3: 8, 4: 13, 5: 18, 6: ''},
'E4': {1: '', 2: 5, 3: 9, 4: 14, 5: 19, 6: ''},
'Ab3': {1: '', 2: '', 3: 1, 4: 6, 5: 11, 6: 16},
'G#3': {1: '', 2: '', 3: 1, 4: 6, 5: 11, 6: 16},
'A3': {1: '', 2: '', 3: 2, 4: 7, 5: 12, 6: 17},
'Bb3': {1: '', 2: '', 3: 3, 4: 8, 5: 13, 6: 18},
'A#3': {1: '', 2: '', 3: 3, 4: 8, 5: 13, 6: 18},
'B3': {1: '', 2: '', 3: 4, 4: 9, 5: 14, 6: 19},
'Eb3': {1: '', 2: '', 3: '', 4: 1, 5: 6, 6: 11},
'D#3': {1: '', 2: '', 3: '', 4: 1, 5: 6, 6: 11},
'E3': {1: '', 2: '', 3: '', 4: 2, 5: 7, 6: 12},
'F3': {1: '', 2: '', 3: '', 4: 3, 5: 8, 6: 13},
'F#3': {1: '', 2: '', 3: '', 4: 4, 5: 9, 6: 14},
'G3': {1: '', 2: '', 3: '', 4: 5, 5: 10, 6: 15},
'Bb2': {1: '', 2: '', 3: '', 4: '', 5: 1, 6: 6},
'A#2': {1: '', 2: '', 3: '', 4: '', 5: 1, 6: 6},
'B2': {1: '', 2: '', 3: '', 4: '', 5: 2, 6: 7},
'C3': {1: '', 2: '', 3: '', 4: '', 5: 3, 6: 8},
'C#3': {1: '', 2: '', 3: '', 4: '', 5: 4, 6: 9},
'D3': {1: '', 2: '', 3: '', 4: '', 5: 5, 6: 10},
'F2': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 1},
'F#2': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 2},
'G2': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 3},
'Ab2': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 4},
'G#2': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 4},
'A2': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 5},
'B1': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 5}}
# Max length of tablature in CLI mode
MAX_RENDER_COLUMNS = 70
TAB_LINE_CHAR = '-'
FILLER_TEXT = """
********************************
* NEXT TAB *
********************************
"""
# Common scale an steps mappings
SCALE = {
'major': [2, 2, 1, 2, 2, 2, 1],
'ionian': [2, 2, 1, 2, 2, 2, 1],
'dorian': [2, 1, 2, 2, 2, 1, 2],
'phrygian': [1, 2, 2, 2, 1, 2, 2],
'lydian': [2, 2, 2, 1, 2, 2, 1],
'mixolydian': [2, 2, 1, 2, 2, 1, 2],
'locrian': [1, 2, 2, 1, 2, 2, 2],
'minor': [2, 1, 2, 2, 1, 2, 2],
'aeolian': [2, 1, 2, 2, 1, 2, 2],
'jazz_minor': [2, 1, 2, 2, 2, 2, 1],
}
MAJOR = 'major'
IONIAN = 'ionian'
DORIAN = 'dorian'
PHRYGIAN = 'phrygian'
LYDIAN = 'lydian'
LOCRIAN = 'locrian'
MINOR = 'minor'
AEOLIAN = 'aeolian'
JAZZ_MINOR = 'jazz_minor'
| 31.151515 | 152 | 0.317972 | 1,342 | 8,224 | 1.921013 | 0.235469 | 0.038014 | 0.030256 | 0.031032 | 0.263382 | 0.238945 | 0.215671 | 0.184639 | 0.170675 | 0.153607 | 0 | 0.232942 | 0.306785 | 8,224 | 263 | 153 | 31.269962 | 0.21926 | 0.052894 | 0 | 0.008368 | 0 | 0 | 0.153391 | 0.008236 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 |
317511059bad10a05f711cf3d16551a3529ded7c | 15,447 | py | Python | google/ads/google_ads/v6/proto/resources/google_ads_field_pb2.py | arammaliachi/google-ads-python | a4fe89567bd43eb784410523a6306b5d1dd9ee67 | [
"Apache-2.0"
] | null | null | null | google/ads/google_ads/v6/proto/resources/google_ads_field_pb2.py | arammaliachi/google-ads-python | a4fe89567bd43eb784410523a6306b5d1dd9ee67 | [
"Apache-2.0"
] | null | null | null | google/ads/google_ads/v6/proto/resources/google_ads_field_pb2.py | arammaliachi/google-ads-python | a4fe89567bd43eb784410523a6306b5d1dd9ee67 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v6/resources/google_ads_field.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from google.ads.google_ads.v6.proto.enums import google_ads_field_category_pb2 as google_dot_ads_dot_googleads_dot_v6_dot_enums_dot_google__ads__field__category__pb2
from google.ads.google_ads.v6.proto.enums import google_ads_field_data_type_pb2 as google_dot_ads_dot_googleads_dot_v6_dot_enums_dot_google__ads__field__data__type__pb2
from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2
from google.api import resource_pb2 as google_dot_api_dot_resource__pb2
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='google/ads/googleads/v6/resources/google_ads_field.proto',
package='google.ads.googleads.v6.resources',
syntax='proto3',
serialized_options=b'\n%com.google.ads.googleads.v6.resourcesB\023GoogleAdsFieldProtoP\001ZJgoogle.golang.org/genproto/googleapis/ads/googleads/v6/resources;resources\242\002\003GAA\252\002!Google.Ads.GoogleAds.V6.Resources\312\002!Google\\Ads\\GoogleAds\\V6\\Resources\352\002%Google::Ads::GoogleAds::V6::Resources',
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n8google/ads/googleads/v6/resources/google_ads_field.proto\x12!google.ads.googleads.v6.resources\x1a=google/ads/googleads/v6/enums/google_ads_field_category.proto\x1a>google/ads/googleads/v6/enums/google_ads_field_data_type.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1cgoogle/api/annotations.proto\"\x80\x06\n\x0eGoogleAdsField\x12\x46\n\rresource_name\x18\x01 \x01(\tB/\xe0\x41\x03\xfa\x41)\n\'googleads.googleapis.com/GoogleAdsField\x12\x16\n\x04name\x18\x15 \x01(\tB\x03\xe0\x41\x03H\x00\x88\x01\x01\x12g\n\x08\x63\x61tegory\x18\x03 \x01(\x0e\x32P.google.ads.googleads.v6.enums.GoogleAdsFieldCategoryEnum.GoogleAdsFieldCategoryB\x03\xe0\x41\x03\x12\x1c\n\nselectable\x18\x16 \x01(\x08\x42\x03\xe0\x41\x03H\x01\x88\x01\x01\x12\x1c\n\nfilterable\x18\x17 \x01(\x08\x42\x03\xe0\x41\x03H\x02\x88\x01\x01\x12\x1a\n\x08sortable\x18\x18 \x01(\x08\x42\x03\xe0\x41\x03H\x03\x88\x01\x01\x12\x1c\n\x0fselectable_with\x18\x19 \x03(\tB\x03\xe0\x41\x03\x12 \n\x13\x61ttribute_resources\x18\x1a \x03(\tB\x03\xe0\x41\x03\x12\x14\n\x07metrics\x18\x1b \x03(\tB\x03\xe0\x41\x03\x12\x15\n\x08segments\x18\x1c \x03(\tB\x03\xe0\x41\x03\x12\x18\n\x0b\x65num_values\x18\x1d \x03(\tB\x03\xe0\x41\x03\x12h\n\tdata_type\x18\x0c \x01(\x0e\x32P.google.ads.googleads.v6.enums.GoogleAdsFieldDataTypeEnum.GoogleAdsFieldDataTypeB\x03\xe0\x41\x03\x12\x1a\n\x08type_url\x18\x1e \x01(\tB\x03\xe0\x41\x03H\x04\x88\x01\x01\x12\x1d\n\x0bis_repeated\x18\x1f \x01(\x08\x42\x03\xe0\x41\x03H\x05\x88\x01\x01:P\xea\x41M\n\'googleads.googleapis.com/GoogleAdsField\x12\"googleAdsFields/{google_ads_field}B\x07\n\x05_nameB\r\n\x0b_selectableB\r\n\x0b_filterableB\x0b\n\t_sortableB\x0b\n\t_type_urlB\x0e\n\x0c_is_repeatedB\x80\x02\n%com.google.ads.googleads.v6.resourcesB\x13GoogleAdsFieldProtoP\x01ZJgoogle.golang.org/genproto/googleapis/ads/googleads/v6/resources;resources\xa2\x02\x03GAA\xaa\x02!Google.Ads.GoogleAds.V6.Resources\xca\x02!Google\\Ads\\GoogleAds\\V6\\Resources\xea\x02%Google::Ads::GoogleAds::V6::Resourcesb\x06proto3'
,
dependencies=[google_dot_ads_dot_googleads_dot_v6_dot_enums_dot_google__ads__field__category__pb2.DESCRIPTOR,google_dot_ads_dot_googleads_dot_v6_dot_enums_dot_google__ads__field__data__type__pb2.DESCRIPTOR,google_dot_api_dot_field__behavior__pb2.DESCRIPTOR,google_dot_api_dot_resource__pb2.DESCRIPTOR,google_dot_api_dot_annotations__pb2.DESCRIPTOR,])
_GOOGLEADSFIELD = _descriptor.Descriptor(
name='GoogleAdsField',
full_name='google.ads.googleads.v6.resources.GoogleAdsField',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='resource_name', full_name='google.ads.googleads.v6.resources.GoogleAdsField.resource_name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003\372A)\n\'googleads.googleapis.com/GoogleAdsField', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='name', full_name='google.ads.googleads.v6.resources.GoogleAdsField.name', index=1,
number=21, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='category', full_name='google.ads.googleads.v6.resources.GoogleAdsField.category', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='selectable', full_name='google.ads.googleads.v6.resources.GoogleAdsField.selectable', index=3,
number=22, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='filterable', full_name='google.ads.googleads.v6.resources.GoogleAdsField.filterable', index=4,
number=23, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='sortable', full_name='google.ads.googleads.v6.resources.GoogleAdsField.sortable', index=5,
number=24, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='selectable_with', full_name='google.ads.googleads.v6.resources.GoogleAdsField.selectable_with', index=6,
number=25, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='attribute_resources', full_name='google.ads.googleads.v6.resources.GoogleAdsField.attribute_resources', index=7,
number=26, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='metrics', full_name='google.ads.googleads.v6.resources.GoogleAdsField.metrics', index=8,
number=27, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='segments', full_name='google.ads.googleads.v6.resources.GoogleAdsField.segments', index=9,
number=28, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='enum_values', full_name='google.ads.googleads.v6.resources.GoogleAdsField.enum_values', index=10,
number=29, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='data_type', full_name='google.ads.googleads.v6.resources.GoogleAdsField.data_type', index=11,
number=12, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='type_url', full_name='google.ads.googleads.v6.resources.GoogleAdsField.type_url', index=12,
number=30, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='is_repeated', full_name='google.ads.googleads.v6.resources.GoogleAdsField.is_repeated', index=13,
number=31, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=b'\340A\003', file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=b'\352AM\n\'googleads.googleapis.com/GoogleAdsField\022\"googleAdsFields/{google_ads_field}',
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
_descriptor.OneofDescriptor(
name='_name', full_name='google.ads.googleads.v6.resources.GoogleAdsField._name',
index=0, containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[]),
_descriptor.OneofDescriptor(
name='_selectable', full_name='google.ads.googleads.v6.resources.GoogleAdsField._selectable',
index=1, containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[]),
_descriptor.OneofDescriptor(
name='_filterable', full_name='google.ads.googleads.v6.resources.GoogleAdsField._filterable',
index=2, containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[]),
_descriptor.OneofDescriptor(
name='_sortable', full_name='google.ads.googleads.v6.resources.GoogleAdsField._sortable',
index=3, containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[]),
_descriptor.OneofDescriptor(
name='_type_url', full_name='google.ads.googleads.v6.resources.GoogleAdsField._type_url',
index=4, containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[]),
_descriptor.OneofDescriptor(
name='_is_repeated', full_name='google.ads.googleads.v6.resources.GoogleAdsField._is_repeated',
index=5, containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[]),
],
serialized_start=313,
serialized_end=1081,
)
_GOOGLEADSFIELD.fields_by_name['category'].enum_type = google_dot_ads_dot_googleads_dot_v6_dot_enums_dot_google__ads__field__category__pb2._GOOGLEADSFIELDCATEGORYENUM_GOOGLEADSFIELDCATEGORY
_GOOGLEADSFIELD.fields_by_name['data_type'].enum_type = google_dot_ads_dot_googleads_dot_v6_dot_enums_dot_google__ads__field__data__type__pb2._GOOGLEADSFIELDDATATYPEENUM_GOOGLEADSFIELDDATATYPE
_GOOGLEADSFIELD.oneofs_by_name['_name'].fields.append(
_GOOGLEADSFIELD.fields_by_name['name'])
_GOOGLEADSFIELD.fields_by_name['name'].containing_oneof = _GOOGLEADSFIELD.oneofs_by_name['_name']
_GOOGLEADSFIELD.oneofs_by_name['_selectable'].fields.append(
_GOOGLEADSFIELD.fields_by_name['selectable'])
_GOOGLEADSFIELD.fields_by_name['selectable'].containing_oneof = _GOOGLEADSFIELD.oneofs_by_name['_selectable']
_GOOGLEADSFIELD.oneofs_by_name['_filterable'].fields.append(
_GOOGLEADSFIELD.fields_by_name['filterable'])
_GOOGLEADSFIELD.fields_by_name['filterable'].containing_oneof = _GOOGLEADSFIELD.oneofs_by_name['_filterable']
_GOOGLEADSFIELD.oneofs_by_name['_sortable'].fields.append(
_GOOGLEADSFIELD.fields_by_name['sortable'])
_GOOGLEADSFIELD.fields_by_name['sortable'].containing_oneof = _GOOGLEADSFIELD.oneofs_by_name['_sortable']
_GOOGLEADSFIELD.oneofs_by_name['_type_url'].fields.append(
_GOOGLEADSFIELD.fields_by_name['type_url'])
_GOOGLEADSFIELD.fields_by_name['type_url'].containing_oneof = _GOOGLEADSFIELD.oneofs_by_name['_type_url']
_GOOGLEADSFIELD.oneofs_by_name['_is_repeated'].fields.append(
_GOOGLEADSFIELD.fields_by_name['is_repeated'])
_GOOGLEADSFIELD.fields_by_name['is_repeated'].containing_oneof = _GOOGLEADSFIELD.oneofs_by_name['_is_repeated']
DESCRIPTOR.message_types_by_name['GoogleAdsField'] = _GOOGLEADSFIELD
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
GoogleAdsField = _reflection.GeneratedProtocolMessageType('GoogleAdsField', (_message.Message,), {
'DESCRIPTOR' : _GOOGLEADSFIELD,
'__module__' : 'google.ads.googleads.v6.resources.google_ads_field_pb2'
# @@protoc_insertion_point(class_scope:google.ads.googleads.v6.resources.GoogleAdsField)
})
_sym_db.RegisterMessage(GoogleAdsField)
DESCRIPTOR._options = None
_GOOGLEADSFIELD.fields_by_name['resource_name']._options = None
_GOOGLEADSFIELD.fields_by_name['name']._options = None
_GOOGLEADSFIELD.fields_by_name['category']._options = None
_GOOGLEADSFIELD.fields_by_name['selectable']._options = None
_GOOGLEADSFIELD.fields_by_name['filterable']._options = None
_GOOGLEADSFIELD.fields_by_name['sortable']._options = None
_GOOGLEADSFIELD.fields_by_name['selectable_with']._options = None
_GOOGLEADSFIELD.fields_by_name['attribute_resources']._options = None
_GOOGLEADSFIELD.fields_by_name['metrics']._options = None
_GOOGLEADSFIELD.fields_by_name['segments']._options = None
_GOOGLEADSFIELD.fields_by_name['enum_values']._options = None
_GOOGLEADSFIELD.fields_by_name['data_type']._options = None
_GOOGLEADSFIELD.fields_by_name['type_url']._options = None
_GOOGLEADSFIELD.fields_by_name['is_repeated']._options = None
_GOOGLEADSFIELD._options = None
# @@protoc_insertion_point(module_scope)
| 66.012821 | 2,049 | 0.791351 | 2,094 | 15,447 | 5.477077 | 0.112703 | 0.046299 | 0.051269 | 0.068009 | 0.786032 | 0.728137 | 0.589677 | 0.541547 | 0.496905 | 0.460807 | 0 | 0.047538 | 0.08759 | 15,447 | 233 | 2,050 | 66.296137 | 0.766213 | 0.021752 | 0 | 0.446009 | 1 | 0.014085 | 0.225894 | 0.172517 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.042254 | 0 | 0.042254 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
31821ac2170ce761dfd9a50c05dc1d40073ef1b0 | 669 | py | Python | 1701-1800/1704-Range Sum of BST/1704-Range Sum of BST.py | jiadaizhao/LintCode | a8aecc65c47a944e9debad1971a7bc6b8776e48b | [
"MIT"
] | 77 | 2017-12-30T13:33:37.000Z | 2022-01-16T23:47:08.000Z | 1701-1800/1704-Range Sum of BST/1704-Range Sum of BST.py | jxhangithub/LintCode-1 | a8aecc65c47a944e9debad1971a7bc6b8776e48b | [
"MIT"
] | 1 | 2018-05-14T14:15:40.000Z | 2018-05-14T14:15:40.000Z | 1701-1800/1704-Range Sum of BST/1704-Range Sum of BST.py | jxhangithub/LintCode-1 | a8aecc65c47a944e9debad1971a7bc6b8776e48b | [
"MIT"
] | 39 | 2017-12-07T14:36:25.000Z | 2022-03-10T23:05:37.000Z | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: the root node
@param L: an integer
@param R: an integer
@return: the sum
"""
def rangeSumBST(self, root, L, R):
# write your code here.
if root is None:
return 0
if root.val < L:
return self.rangeSumBST(root.right, L, R)
elif root.val > R:
return self.rangeSumBST(root.left, L, R)
else:
return root.val + self.rangeSumBST(root.left, L, R) + self.rangeSumBST(root.right, L, R)
| 25.730769 | 100 | 0.559043 | 90 | 669 | 4.111111 | 0.355556 | 0.027027 | 0.205405 | 0.135135 | 0.275676 | 0.275676 | 0 | 0 | 0 | 0 | 0 | 0.002217 | 0.325859 | 669 | 25 | 101 | 26.76 | 0.818182 | 0.363229 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04 | 0 | 1 | 0.1 | false | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
318c5bbfb54e5cd787bdcaccdcf5fc844c7100e1 | 510 | py | Python | tests/graph_bloch.py | Qulacs-Osaka/scikit-qulacs | f13d6a36ef0dae1e7d4fdda6f01bcb2346f3cb3e | [
"MIT"
] | 4 | 2021-07-02T03:53:44.000Z | 2022-03-18T02:05:44.000Z | tests/graph_bloch.py | Qulacs-Osaka/scikit-qulacs | f13d6a36ef0dae1e7d4fdda6f01bcb2346f3cb3e | [
"MIT"
] | 109 | 2021-07-01T07:10:24.000Z | 2022-03-30T08:26:57.000Z | tests/graph_bloch.py | Qulacs-Osaka/scikit-qulacs | f13d6a36ef0dae1e7d4fdda6f01bcb2346f3cb3e | [
"MIT"
] | 2 | 2021-11-10T07:01:11.000Z | 2021-12-25T21:29:30.000Z | from qulacs import QuantumState
from qulacs.gate import CNOT, RY, H
from skqulacs.circuit import show_blochsphere
def test_bloch():
n = 3
state = QuantumState(n)
state.set_computational_basis(0b000)
H(0).update_quantum_state(state)
show_blochsphere(state, 0)
RY(0, 0.1).update_quantum_state(state)
show_blochsphere(state, 0)
CNOT(0, 1).update_quantum_state(state)
show_blochsphere(state, 0)
show_blochsphere(state, 1)
show_blochsphere(state, 2)
| 26.842105 | 46 | 0.705882 | 71 | 510 | 4.859155 | 0.380282 | 0.26087 | 0.289855 | 0.2 | 0.394203 | 0.394203 | 0.394203 | 0.394203 | 0.266667 | 0.266667 | 0 | 0.039312 | 0.201961 | 510 | 18 | 47 | 28.333333 | 0.808354 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0.2 | 0 | 0.266667 | 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 |
319b08a7b3de542e2349709cb6ba02cd15a12895 | 4,314 | py | Python | pinry/core/models.py | arctelix/pinimatic | a7d2495b25efbf9cf8f173276f1d4e67b000b32f | [
"BSD-2-Clause",
"Unlicense"
] | 12 | 2015-08-16T19:53:58.000Z | 2022-02-15T14:27:28.000Z | pinry/core/models.py | arctelix/pinimatic | a7d2495b25efbf9cf8f173276f1d4e67b000b32f | [
"BSD-2-Clause",
"Unlicense"
] | null | null | null | pinry/core/models.py | arctelix/pinimatic | a7d2495b25efbf9cf8f173276f1d4e67b000b32f | [
"BSD-2-Clause",
"Unlicense"
] | 1 | 2022-01-04T07:15:13.000Z | 2022-01-04T07:15:13.000Z | #from pinry.core.admins import *
#handle signals from third party apps
from django.contrib.auth.models import User
from ..pins.models import Pin
from django.contrib.comments.models import Comment
from django.db.models.signals import post_save
from follow.signals import followed
from django.contrib.comments.signals import comment_was_posted, comment_was_flagged
from django.contrib.sites.models import Site
from django.conf import settings
from django.dispatch import receiver
from django.core.mail import send_mail
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
from django.template import Context
#prevent syncdb errors
try:
site = Site.objects.get_current()
site_name = site.name
site_url = 'http://%s/' % site.domain
except:
from django.db import connection
connection.close()
#REFERENCE: notification.send(users, label, extra_context=None, sender=None)
# send_observation_notices_for(observed, label, xcontext=None, exclude=None)
# observe(observed, observer, labels)
#TODO: when notification is imported before functions with DEBUG=Flase on heroku we get an import error
#but works with DEBUG=T/F on dev server?
@receiver(followed, sender=User, dispatch_uid='follow.user')
def user_follow_handler(user, target, instance, **kwargs):
'''
user: the user who acted
target: the user that has been followed
instance: the follow object
'''
from notification import models as notification
notification.send_observation_notices_for(target, "followed", {"from_user": user, "owner": target}, [user])
if user != target:
notification.send([target], "followed", {"from_user": user}, sender=user)
notification.observe(target, user, "followed")
notification.observe(target, user, "new")
notification.observe(target, user, "favorited")
notification.observe(target, user, "commented")
@receiver(followed, sender=Pin, dispatch_uid='follow.pin')
def pin_favorite_handler(user, target, instance, **kwargs):
'''
user: the user who acted
target: the pin that has been followed
instance: the follow object
'''
from notification import models as notification
#notify pin's followers
notification.send_observation_notices_for(target, "favorited", {"from_user": user, "owner": target.submitter}, [user])
#notify user's followers
notification.send_observation_notices_for(user, "favorited", {"from_user": user, "owner": target.submitter}, [user], sender=target)
if user != target.submitter:
#notify pin's owner
notification.send([target.submitter], "favorited", {"from_user": user}, sender=target)
#make user observe new comments
notification.observe(target, user, "commented")
#make user observe new favorites
notification.observe(target, user, "favorited")
#TODO:get signal for unfollow pin & user to unobserve the pin favs and comments or is this handles automatically?
@receiver(post_save, sender=Comment, dispatch_uid='comment.user')
def pin_comment_handler(sender, *args, **kwargs):
comment = kwargs.pop('instance', None)
print comment
user = comment.user
target = comment.content_object
from notification import models as notification
#notify pin followers
notification.send_observation_notices_for(target, "commented", {"from_user": user, "owner":target.submitter}, [user])
#notify user's followers
notification.send_observation_notices_for(user, "commented", {"from_user": user, "alter_desc":True, "owner":target.submitter}, [user], sender=target)
if user != target.submitter:
#notify pin's owner
notification.send([target.submitter], "commented", {"from_user": user}, sender=target)
#make comment user observe new comments
notification.observe(target, user, "commented")
@receiver(post_save, sender=Pin, dispatch_uid='id')
def new_pin_handler(sender, *args, **kwargs):
pin = kwargs.pop('instance', None)
user = pin.submitter
target = pin
from notification import models as notification
#notify user's followers
notification.send_observation_notices_for(user, "new", {"from_user": user, "owner": target.submitter}, [user], sender=target)
| 43.575758 | 153 | 0.728095 | 546 | 4,314 | 5.648352 | 0.24359 | 0.038911 | 0.035019 | 0.056744 | 0.483787 | 0.425097 | 0.375486 | 0.327821 | 0.321984 | 0.242218 | 0 | 0 | 0.165971 | 4,314 | 99 | 154 | 43.575758 | 0.857143 | 0.184052 | 0 | 0.189655 | 0 | 0 | 0.095078 | 0 | 0 | 0 | 0 | 0.020202 | 0 | 0 | null | null | 0 | 0.310345 | null | null | 0.017241 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
319db73892abc8eb079da19ca0ac4d3811b441a0 | 149 | py | Python | bench_utils/__init__.py | drkostas/bench-utils | 0ec976238175ee8137a54101e679f0faf58996b9 | [
"Apache-2.0"
] | 3 | 2021-12-22T14:29:17.000Z | 2022-01-26T21:21:36.000Z | bench_utils/__init__.py | drkostas/bench-utils | 0ec976238175ee8137a54101e679f0faf58996b9 | [
"Apache-2.0"
] | null | null | null | bench_utils/__init__.py | drkostas/bench-utils | 0ec976238175ee8137a54101e679f0faf58996b9 | [
"Apache-2.0"
] | null | null | null | from .timeit import timeit
from .profileit import profileit
__author__ = "drkostas"
__email__ = "georgiou.kostas94@gmail.com"
__version__ = "0.0.1"
| 21.285714 | 41 | 0.771812 | 19 | 149 | 5.421053 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038168 | 0.120805 | 149 | 6 | 42 | 24.833333 | 0.748092 | 0 | 0 | 0 | 0 | 0 | 0.268456 | 0.181208 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
31a10df8f86d7f09acb1bf55bb56d172856d3f49 | 25,247 | py | Python | Control Characters.py | FEDER-CO/Glyphs-Scripts | 0f1a37fc4e1a1751291a109702e2123c44fb429e | [
"Apache-2.0"
] | null | null | null | Control Characters.py | FEDER-CO/Glyphs-Scripts | 0f1a37fc4e1a1751291a109702e2123c44fb429e | [
"Apache-2.0"
] | null | null | null | Control Characters.py | FEDER-CO/Glyphs-Scripts | 0f1a37fc4e1a1751291a109702e2123c44fb429e | [
"Apache-2.0"
] | null | null | null | #MenuTitle: Control Characters
# -*- coding: utf-8 -*-
__doc__="""
Creates a new tab with selected glyphs between control characters.
"""
Font = Glyphs.font
tab = ''
# supports latin, greek and cyrillic
uppercase = ["A", "Aacute", "Abreve", "Abreveacute", "Abrevedotbelow", "Abrevegrave", "Abrevehookabove", "Abrevetilde", "Acaron", "Acircumflex", "Acircumflexacute", "Acircumflexdotbelow", "Acircumflexgrave", "Acircumflexhookabove", "Acircumflextilde", "Adieresis", "Adieresismacron", "Adotbelow", "Agrave", "Ahookabove", "Alpha-latin", "Amacron", "Aogonek", "Aring", "Atilde", "AE", "AEacute", "AEmacron", "B", "Bdotbelow", "Bhook", "Bstroke", "C", "Cacute", "Ccaron", "Ccedilla", "Ccircumflex", "Cdotaccent", "Chook", "D", "DZ", "DZcaron", "Eth", "Dcaron", "Dcircumflexbelow", "Dcroat", "Ddotbelow", "Dhook", "Dmacronbelow", "Dtail", "Dz", "Dzcaron", "E", "Eacute", "Ebreve", "Ecaron", "Ecedilla", "Ecircumflex", "Ecircumflexacute", "Ecircumflexdotbelow", "Ecircumflexgrave", "Ecircumflexhookabove", "Ecircumflextilde", "Edieresis", "Edotaccent", "Edotbelow", "Egrave", "Ehookabove", "Emacron", "Eogonek", "Eopen", "Ereversed", "Esh", "Etilde", "Ezh", "Ezhcaron", "F", "Fhook", "G", "Gbreve", "Gcaron", "Gcircumflex", "Gcommaaccent", "Gdotaccent", "Ghook", "Gmacron", "Gstroke", "H", "Hbar", "Hbrevebelow", "Hcircumflex", "Hdotbelow", "Hhook", "Hturned", "I", "IJ", "Iacute", "Ibreve", "Icaron", "Icircumflex", "Idieresis", "Idieresisacute", "Idotaccent", "Idotbelow", "Igrave", "Ihookabove", "Imacron", "Iogonek", "Iota-latin", "Istroke", "Itilde", "J", "Jacute", "Jcircumflex", "K", "Kcaron", "Kcommaaccent", "Khook", "Kmacronbelow", "L", "Lacute", "Lcaron", "Lcircumflexbelow", "Lcommaaccent", "Ldot", "Ldotbelow", "Ldotbelowmacron", "Lmacronbelow", "Lslash", "M", "Macute", "Mdotaccent", "Mdotbelow", "N", "Nacute", "Ncaron", "Ncircumflexbelow", "Ncommaaccent", "Ndotaccent", "Ndotbelow", "Nhookleft", "Nmacronbelow", "Ntilde", "Eng", "O", "Oacute", "Obreve", "Ocaron", "Ocircumflex", "Ocircumflexacute", "Ocircumflexdotbelow", "Ocircumflexgrave", "Ocircumflexhookabove", "Ocircumflextilde", "Odieresis", "Odieresismacron", "Odotbelow", "Ograve", "Ohookabove", "Ohorn", "Ohornacute", "Ohorndotbelow", "Ohorngrave", "Ohornhookabove", "Ohorntilde", "Ohungarumlaut", "Omacron", "Omacronacute", "Omacrongrave", "Oogonek", "Oopen", "Oslash", "Oslashacute", "Otilde", "Otildeacute", "OE", "P", "Phook", "Thorn", "Q", "R", "Racute", "Rcaron", "Rcommaaccent", "Rdotbelowmacron", "Rmacronbelow", "Rstroke", "Rtail", "S", "Sacute", "Saltillo", "Scaron", "Scedilla", "Scircumflex", "Scommaaccent", "Sdotbelow", "Germandbls", "Schwa", "T", "Tbar", "Tcaron", "Tcedilla", "Tcircumflexbelow", "Tcommaaccent", "Tdotbelow", "Thook", "Tmacronbelow", "Tretroflexhook", "U", "Uacute", "Ubar", "Ubreve", "Ucaron", "Ucircumflex", "Udieresis", "Udieresisacute", "Udieresiscaron", "Udieresisgrave", "Udieresismacron", "Udotbelow", "Ugrave", "Uhookabove", "Uhorn", "Uhornacute", "Uhorndotbelow", "Uhorngrave", "Uhornhookabove", "Uhorntilde", "Uhungarumlaut", "Umacron", "Uogonek", "Upsilon-latin", "Uring", "Utilde", "V", "Gamma-latin", "Vhook", "Vturned", "W", "Wacute", "Wcircumflex", "Wdieresis", "Wgrave", "Whook", "X", "Y", "Yacute", "Ycircumflex", "Ydieresis", "Ydotaccent", "Ydotbelow", "Ygrave", "Yhook", "Yhookabove", "Ymacron", "Ytilde", "Z", "Zacute", "Zcaron", "Zdotaccent", "Zdotbelow", "Zmacronbelow", "Lcommaaccent.loclMAH", "Ncommaaccent.loclMAH", "A-cy", "Be-cy", "Ve-cy", "Ge-cy", "Gje-cy", "Geupturn-cy", "Gedescender-cy", "Gestroke-cy", "Gemiddlehook-cy", "De-cy", "Ie-cy", "Iegrave-cy", "Io-cy", "Zhe-cy", "Ze-cy", "Ii-cy", "Iishort-cy", "Iigrave-cy", "Ka-cy", "Kje-cy", "El-cy", "Em-cy", "En-cy", "O-cy", "Pe-cy", "Er-cy", "Es-cy", "Te-cy", "U-cy", "Ushort-cy", "Ef-cy", "Ha-cy", "Che-cy", "Tse-cy", "Sha-cy", "Shcha-cy", "Dzhe-cy", "Softsign-cy", "Yeru-cy", "Hardsign-cy", "Lje-cy", "Nje-cy", "Dze-cy", "E-cy", "Ereversed-cy", "I-cy", "Yi-cy", "Je-cy", "Tshe-cy", "Yu-cy", "Ya-cy", "Dje-cy", "Yat-cy", "Yusbig-cy", "Fita-cy", "Izhitsa-cy", "Zhedescender-cy", "Zedescender-cy", "Kadescender-cy", "Kaverticalstroke-cy", "Kastroke-cy", "Kabashkir-cy", "Endescender-cy", "EnGe-cy", "Pemiddlehook-cy", "Pedescender-cy", "Haabkhasian-cy", "Esdescender-cy", "Tedescender-cy", "Ustraight-cy", "Ustraightstroke-cy", "Hadescender-cy", "Tetse-cy", "Chedescender-cy", "Cheverticalstroke-cy", "Shha-cy", "Shhadescender-cy", "Cheabkhasian-cy", "Chedescenderabkhasian-cy", "Palochka-cy", "Zhebreve-cy", "Kahook-cy", "Eltail-cy", "Enhook-cy", "Entail-cy", "Chekhakassian-cy", "Emtail-cy", "Abreve-cy", "Adieresis-cy", "Aie-cy", "Iebreve-cy", "Schwa-cy", "Schwadieresis-cy", "Zhedieresis-cy", "Zedieresis-cy", "Dzeabkhasian-cy", "Imacron-cy", "Idieresis-cy", "Odieresis-cy", "Obarred-cy", "Obarreddieresis-cy", "Edieresis-cy", "Umacron-cy", "Udieresis-cy", "Uhungarumlaut-cy", "Chedieresis-cy", "Yerudieresis-cy", "Hahook-cy", "Reversedze-cy", "Elhook-cy", "We-cy", "De-cy.loclBGR", "El-cy.loclBGR", "Ef-cy.loclBGR", "Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda", "Mu", "Nu", "Xi", "Omicron", "Pi", "Rho", "Sigma", "Tau", "Upsilon", "Phi", "Chi", "Psi", "Omega", "Alphatonos", "Epsilontonos", "Etatonos", "Iotatonos", "Omicrontonos", "Upsilontonos", "Omegatonos", "Iotadieresis", "Upsilondieresis", "Heta", "Archaicsampi", "Pamphyliandigamma", "KoppaArchaic", "Stigma", "Digamma", "Koppa", "Sampi", "KaiSymbol", "Sho", "San", "Alphapsili", "Alphadasia", "Alphapsilivaria", "Alphadasiavaria", "Alphapsilioxia", "Alphadasiaoxia", "Alphapsiliperispomeni", "Alphadasiaperispomeni", "Alphavaria", "Alphaoxia", "Alphavrachy", "Alphamacron", "Alphaprosgegrammeni", "Alphapsiliprosgegrammeni", "Alphadasiaprosgegrammeni", "Alphapsilivariaprosgegrammeni", "Alphadasiavariaprosgegrammeni", "Alphapsilioxiaprosgegrammeni", "Alphadasiaoxiaprosgegrammeni", "Alphapsiliperispomeniprosgegrammeni", "Alphadasiaperispomeniprosgegrammeni", "Epsilonpsili", "Epsilondasia", "Epsilonpsilivaria", "Epsilondasiavaria", "Epsilonpsilioxia", "Epsilondasiaoxia", "Epsilonvaria", "Epsilonoxia", "Etapsili", "Etadasia", "Etapsilivaria", "Etadasiavaria", "Etapsilioxia", "Etadasiaoxia", "Etapsiliperispomeni", "Etadasiaperispomeni", "Etavaria", "Etaoxia", "Etaprosgegrammeni", "Etapsiliprosgegrammeni", "Etadasiaprosgegrammeni", "Etapsilivariaprosgegrammeni", "Etadasiavariaprosgegrammeni", "Etapsilioxiaprosgegrammeni", "Etadasiaoxiaprosgegrammeni", "Etapsiliperispomeniprosgegrammeni", "Etadasiaperispomeniprosgegrammeni", "Iotapsili", "Iotadasia", "Iotapsilivaria", "Iotadasiavaria", "Iotapsilioxia", "Iotadasiaoxia", "Iotapsiliperispomeni", "Iotadasiaperispomeni", "Iotavaria", "Iotaoxia", "Iotavrachy", "Iotamacron", "Omicronpsili", "Omicrondasia", "Omicronpsilivaria", "Omicrondasiavaria", "Omicronpsilioxia", "Omicrondasiaoxia", "Omicronvaria", "Omicronoxia", "Rhodasia", "Upsilondasia", "Upsilondasiavaria", "Upsilondasiaoxia", "Upsilondasiaperispomeni", "Upsilonvaria", "Upsilonoxia", "Upsilonvrachy", "Upsilonmacron", "Omegapsili", "Omegadasia", "Omegapsilivaria", "Omegadasiavaria", "Omegapsilioxia", "Omegadasiaoxia", "Omegapsiliperispomeni", "Omegadasiaperispomeni", "Omegavaria", "Omegaoxia", "Omegaprosgegrammeni", "Omegapsiliprosgegrammeni", "Omegadasiaprosgegrammeni", "Omegapsilivariaprosgegrammeni", "Omegadasiavariaprosgegrammeni", "Omegapsilioxiaprosgegrammeni", "Omegadasiaoxiaprosgegrammeni", "Omegapsiliperispomeniprosgegrammeni", "Omegadasiaperispomeniprosgegrammeni", "Alfa-coptic", "Vida-coptic", "Gamma-coptic", "Dalda-coptic", "Eie-coptic", "Sou-coptic", "Zata-coptic", "Hate-coptic", "Thethe-coptic", "Iauda-coptic", "Kapa-coptic", "Laula-coptic", "Mi-coptic", "Ni-coptic", "Ksi-coptic", "O-coptic", "Pi-coptic", "Ro-coptic", "Sima-coptic", "Tau-coptic", "Ua-coptic", "Fi-coptic", "Khi-coptic", "Psi-coptic", "Oou-coptic", "Cryptogrammiceie-coptic", "dialectPkapa-coptic", "dialectPni-coptic", "Cryptogrammicni-coptic", "OouOld-coptic", "Sampi-coptic", "Shei-coptic", "SheiOld-coptic", "EshOld-coptic", "Fei-coptic", "Khei-coptic", "KheiAkhmimic-coptic", "Hori-coptic", "HoriDialectP-coptic", "HoriOld-coptic", "HaOld-coptic", "HaLshaped-coptic", "HeiOld-coptic", "HatOld-coptic", "Gangia-coptic", "GangiaOld-coptic", "Shima-coptic", "DjaOld-coptic", "ShimaOld-coptic", "Shima-nubian", "Dei-coptic", "AlefDialectP-coptic", "AinOld-coptic", "Ngi-nubian", "Nyi-nubian", "Wau-nubian"]
lowercase = ["Bsmall", "Gsmall", "Gsmallhook", "Hsmall", "Ismall", "Lsmall", "Nsmall", "OEsmall", "Rsmall", "Rsmallinverted", "Ysmall", "a", "aacute", "abreve", "abreveacute", "abrevedotbelow", "abrevegrave", "abrevehookabove", "abrevetilde", "acaron", "acircumflex", "acircumflexacute", "acircumflexdotbelow", "acircumflexgrave", "acircumflexhookabove", "acircumflextilde", "adieresis", "adieresismacron", "adotbelow", "agrave", "ahookabove", "alpha-latin", "alphaturned-latin", "amacron", "aogonek", "aring", "atilde", "aturned", "ae", "aeacute", "aemacron", "b", "bdotbelow", "bhook", "bidentalpercussive", "bilabialclick", "bilabialpercussive", "bmiddletilde", "c", "cacute", "ccaron", "ccedilla", "ccircumflex", "ccurl", "cdotaccent", "chi-latin", "chook", "d", "eth", "dcaron", "dcircumflexbelow", "dcroat", "ddotbelow", "dezh", "dhook", "dmacronbelow", "dmiddletilde", "dtail", "dz", "dzaltone", "dzcaron", "dzcurl", "e", "eacute", "ebreve", "ecaron", "ecedilla", "ecircumflex", "ecircumflexacute", "ecircumflexdotbelow", "ecircumflexgrave", "ecircumflexhookabove", "ecircumflextilde", "edieresis", "edotaccent", "edotbelow", "egrave", "ehookabove", "emacron", "eogonek", "eopen", "eopenreversed", "eopenreversedclosed", "eopenreversedhook", "ereversed", "esh", "etilde", "eturned", "schwa", "schwahook", "ezh", "ezhcaron", "f", "fengdigraph", "fmiddletilde", "g", "gamma-latin", "gbreve", "gcaron", "gcircumflex", "gcommaaccent", "gdotaccent", "ghook", "glottalstop", "glottalstopreversed", "glottalstopsmall", "glottalstopstroke", "glottalstopstrokereversed", "gmacron", "gsingle", "gstroke", "h", "hbar", "hbrevebelow", "hcircumflex", "hdotbelow", "henghook", "hhook", "hmacronbelow", "hturned", "i", "idotless", "iacute", "ibreve", "icaron", "icircumflex", "idieresis", "idieresisacute", "idotaccent", "idotbelow", "igrave", "ihookabove", "ij", "imacron", "iogonek", "iota-latin", "istroke", "itilde", "j", "jdotless", "jacute", "jcircumflex", "jcrossedtail", "jdotlessstroke", "jdotlessstrokehook", "k", "kcaron", "kcommaaccent", "kgreenlandic", "khook", "kmacronbelow", "kturned", "l", "lacute", "lbelt", "lcaron", "lcircumflexbelow", "lcommaaccent", "ldot", "ldotbelow", "ldotbelowmacron", "lezh", "lhookretroflex", "lmacronbelow", "lmiddletilde", "lsdigraph", "lslash", "lzdigraph", "m", "macute", "mdotaccent", "mdotbelow", "mhook", "mlonglegturned", "mmiddletilde", "mturned", "n", "nacute", "ncaron", "ncircumflexbelow", "ncommaaccent", "ndotaccent", "ndotbelow", "nhookleft", "nhookretroflex", "nmacronbelow", "nmiddletilde", "ntilde", "eng", "o", "oacute", "obarred", "obreve", "ocaron", "ocircumflex", "ocircumflexacute", "ocircumflexdotbelow", "ocircumflexgrave", "ocircumflexhookabove", "ocircumflextilde", "odieresis", "odieresismacron", "odotbelow", "ograve", "ohookabove", "ohorn", "ohornacute", "ohorndotbelow", "ohorngrave", "ohornhookabove", "ohorntilde", "ohungarumlaut", "omacron", "omacronacute", "omacrongrave", "oogonek", "oopen", "oslash", "oslashacute", "otilde", "otildeacute", "oe", "p", "phi-latin", "phook", "thorn", "pmiddletilde", "q", "qhook", "qhooktail", "r", "racute", "ramshorn", "rcaron", "rcommaaccent", "rdotbelowmacron", "rfishhook", "rfishhookmiddletilde", "rhookturned", "rlonglegturned", "rmacronbelow", "rmiddletilde", "rtail", "rturned", "s", "sacute", "saltillo", "scaron", "scedilla", "scircumflex", "scommaaccent", "sdotbelow", "germandbls", "shook", "smiddletilde", "longs", "t", "tbar", "tcaron", "tccurl", "tcedilla", "tcircumflexbelow", "tcommaaccent", "tdieresis", "tdotbelow", "tesh", "thook", "tmacronbelow", "tmiddletilde", "tretroflexhook", "ts", "u", "uacute", "ubar", "ubreve", "ucaron", "ucircumflex", "udieresis", "udieresisacute", "udieresiscaron", "udieresisgrave", "udieresismacron", "udotbelow", "ugrave", "uhookabove", "uhorn", "uhornacute", "uhorndotbelow", "uhorngrave", "uhornhookabove", "uhorntilde", "uhungarumlaut", "umacron", "uogonek", "upsilon-latin", "uring", "utilde", "v", "vhook", "vturned", "w", "wacute", "wcircumflex", "wdieresis", "wgrave", "whook", "wturned", "x", "y", "yacute", "ycircumflex", "ydieresis", "ydotaccent", "ydotbelow", "ygrave", "yhook", "yhookabove", "ymacron", "ytilde", "yturned", "z", "zacute", "zcaron", "zcurl", "zdotaccent", "zdotbelow", "zmacronbelow", "zmiddletilde", "zretroflexhook", "lcommaaccent.loclMAH", "ncommaaccent.loclMAH", "a.ordn", "b.ordn", "c.ordn", "d.ordn", "e.ordn", "f.ordn", "g.ordn", "h.ordn", "i.ordn", "j.ordn", "k.ordn", "l.ordn", "m.ordn", "n.ordn", "o.ordn", "p.ordn", "q.ordn", "r.ordn", "s.ordn", "t.ordn", "u.ordn", "v.ordn", "w.ordn", "x.ordn", "y.ordn", "z.ordn", "fi", "fl", "f_b.liga", "f_f.liga", "f_f_b.liga", "f_f_h.liga", "f_f_i.liga", "f_f_idieresis.liga", "f_f_j.liga", "f_f_k.liga", "f_f_l.liga", "f_h.liga", "f_j.liga", "f_k.liga", "a-cy", "be-cy", "ve-cy", "ge-cy", "gje-cy", "geupturn-cy", "gedescender-cy", "gestroke-cy", "gemiddlehook-cy", "de-cy", "ie-cy", "iegrave-cy", "io-cy", "zhe-cy", "ze-cy", "ii-cy", "iishort-cy", "iigrave-cy", "ka-cy", "kje-cy", "el-cy", "em-cy", "en-cy", "o-cy", "pe-cy", "er-cy", "es-cy", "te-cy", "u-cy", "ushort-cy", "ef-cy", "ha-cy", "che-cy", "tse-cy", "sha-cy", "shcha-cy", "dzhe-cy", "softsign-cy", "yeru-cy", "hardsign-cy", "lje-cy", "nje-cy", "dze-cy", "e-cy", "ereversed-cy", "i-cy", "yi-cy", "je-cy", "tshe-cy", "yu-cy", "ya-cy", "dje-cy", "yat-cy", "yusbig-cy", "fita-cy", "izhitsa-cy", "zhedescender-cy", "zedescender-cy", "kadescender-cy", "kaverticalstroke-cy", "kastroke-cy", "kabashkir-cy", "endescender-cy", "enge-cy", "pedescender-cy", "pemiddlehook-cy", "haabkhasian-cy", "esdescender-cy", "tedescender-cy", "ustraight-cy", "ustraightstroke-cy", "hadescender-cy", "tetse-cy", "chedescender-cy", "cheverticalstroke-cy", "shha-cy", "shhadescender-cy", "cheabkhasian-cy", "chedescenderabkhasian-cy", "palochka-cy", "zhebreve-cy", "kahook-cy", "eltail-cy", "enhook-cy", "entail-cy", "chekhakassian-cy", "emtail-cy", "abreve-cy", "adieresis-cy", "aie-cy", "iebreve-cy", "schwa-cy", "schwadieresis-cy", "zhedieresis-cy", "zedieresis-cy", "dzeabkhasian-cy", "imacron-cy", "idieresis-cy", "odieresis-cy", "obarred-cy", "obarreddieresis-cy", "edieresis-cy", "umacron-cy", "udieresis-cy", "uhungarumlaut-cy", "chedieresis-cy", "yerudieresis-cy", "hahook-cy", "reversedze-cy", "elhook-cy", "we-cy", "ve-cy.loclBGR", "ge-cy.loclBGR", "de-cy.loclBGR", "zhe-cy.loclBGR", "ze-cy.loclBGR", "ii-cy.loclBGR", "iishort-cy.loclBGR", "iigrave-cy.loclBGR", "ka-cy.loclBGR", "el-cy.loclBGR", "pe-cy.loclBGR", "te-cy.loclBGR", "tse-cy.loclBGR", "sha-cy.loclBGR", "shcha-cy.loclBGR", "softsign-cy.loclBGR", "hardsign-cy.loclBGR", "yu-cy.loclBGR", "be-cy.loclSRB", "ge-cy.loclSRB", "de-cy.loclSRB", "pe-cy.loclSRB", "te-cy.loclSRB", "sha-cy.loclSRB", "alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta", "iota", "kappa", "lambda", "mu", "nu", "xi", "omicron", "pi", "rho", "sigmafinal", "sigma", "tau", "upsilon", "phi", "chi", "psi", "omega", "iotatonos", "iotadieresis", "iotadieresistonos", "upsilontonos", "upsilondieresis", "upsilondieresistonos", "omicrontonos", "omegatonos", "alphatonos", "epsilontonos", "etatonos", "heta", "archaicsampi", "pamphyliandigamma", "koppaArchaic", "stigma", "digamma", "koppa", "sampi", "kaiSymbol", "sho", "san", "alphapsili", "alphadasia", "alphapsilivaria", "alphadasiavaria", "alphapsilioxia", "alphadasiaoxia", "alphapsiliperispomeni", "alphadasiaperispomeni", "alphavaria", "alphaoxia", "alphaperispomeni", "alphavrachy", "alphamacron", "alphaypogegrammeni", "alphavariaypogegrammeni", "alphaoxiaypogegrammeni", "alphapsiliypogegrammeni", "alphadasiaypogegrammeni", "alphapsilivariaypogegrammeni", "alphadasiavariaypogegrammeni", "alphapsilioxiaypogegrammeni", "alphadasiaoxiaypogegrammeni", "alphapsiliperispomeniypogegrammeni", "alphadasiaperispomeniypogegrammeni", "alphaperispomeniypogegrammeni", "epsilonpsili", "epsilondasia", "epsilonpsilivaria", "epsilondasiavaria", "epsilonpsilioxia", "epsilondasiaoxia", "epsilonvaria", "epsilonoxia", "etapsili", "etadasia", "etapsilivaria", "etadasiavaria", "etapsilioxia", "etadasiaoxia", "etapsiliperispomeni", "etadasiaperispomeni", "etavaria", "etaoxia", "etaperispomeni", "etaypogegrammeni", "etavariaypogegrammeni", "etaoxiaypogegrammeni", "etapsiliypogegrammeni", "etadasiaypogegrammeni", "etapsilivariaypogegrammeni", "etadasiavariaypogegrammeni", "etapsilioxiaypogegrammeni", "etadasiaoxiaypogegrammeni", "etapsiliperispomeniypogegrammeni", "etadasiaperispomeniypogegrammeni", "etaperispomeniypogegrammeni", "iotapsili", "iotadasia", "iotapsilivaria", "iotadasiavaria", "iotapsilioxia", "iotadasiaoxia", "iotapsiliperispomeni", "iotadasiaperispomeni", "iotavaria", "iotaoxia", "iotaperispomeni", "iotavrachy", "iotamacron", "iotadialytikavaria", "iotadialytikaoxia", "iotadialytikaperispomeni", "omicronpsili", "omicrondasia", "omicronpsilivaria", "omicrondasiavaria", "omicronpsilioxia", "omicrondasiaoxia", "omicronvaria", "omicronoxia", "rhopsili", "rhodasia", "upsilonpsili", "upsilondasia", "upsilonpsilivaria", "upsilondasiavaria", "upsilonpsilioxia", "upsilondasiaoxia", "upsilonpsiliperispomeni", "upsilondasiaperispomeni", "upsilonvaria", "upsilonoxia", "upsilonperispomeni", "upsilonvrachy", "upsilonmacron", "upsilondialytikavaria", "upsilondialytikaoxia", "upsilondialytikaperispomeni", "omegapsili", "omegadasia", "omegapsilivaria", "omegadasiavaria", "omegapsilioxia", "omegadasiaoxia", "omegapsiliperispomeni", "omegadasiaperispomeni", "omegavaria", "omegaoxia", "omegaperispomeni", "omegaypogegrammeni", "omegavariaypogegrammeni", "omegaoxiaypogegrammeni", "omegapsiliypogegrammeni", "omegadasiaypogegrammeni", "omegapsilivariaypogegrammeni", "omegadasiavariaypogegrammeni", "omegapsilioxiaypogegrammeni", "omegadasiaoxiaypogegrammeni", "omegapsiliperispomeniypogegrammeni", "omegadasiaperispomeniypogegrammeni", "omegaperispomeniypogegrammeni", "alfa-coptic", "vida-coptic", "gamma-coptic", "dalda-coptic", "eie-coptic", "sou-coptic", "zata-coptic", "hate-coptic", "thethe-coptic", "iauda-coptic", "kapa-coptic", "laula-coptic", "mi-coptic", "ni-coptic", "ksi-coptic", "o-coptic", "pi-coptic", "ro-coptic", "sima-coptic", "tau-coptic", "ua-coptic", "fi-coptic", "khi-coptic", "psi-coptic", "oou-coptic", "cryptogrammiceie-coptic", "dialectpkapa-coptic", "dialectpni-coptic", "cryptogrammicni-coptic", "oouOld-coptic", "sampi-coptic", "shei-coptic", "sheiCrossed-coptic", "sheiCrossed-coptic", "sheiOld-coptic", "eshOld-coptic", "fei-coptic", "khei-coptic", "kheiAkhmimic-coptic", "hori-coptic", "horiDialectP-coptic", "horiOld-coptic", "haOld-coptic", "haLshaped-coptic", "heiOld-coptic", "hatOld-coptic", "gangia-coptic", "gangiaOld-coptic", "shima-coptic", "djaOld-coptic", "shimaOld-coptic", "shima-nubian", "dei-coptic", "alefDialectP-coptic", "ainOld-coptic", "ngi-nubian", "nyi-nubian", "wau-nubian", "prosgegrammeni"]
number = ["onehalf-coptic", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "zero.zero", "eight.osf", "five.osf", "four.osf", "zero.lf", "one.lf", "two.lf", "three.lf", "four.lf", "five.lf", "six.lf", "seven.lf", "eight.lf", "nine.lf", "nine.osf", "one.osf", "seven.osf", "six.osf", "three.osf", "two.osf", "zero.osf", "zero.osf.zero", "zero.subs", "one.subs", "two.subs", "three.subs", "four.subs", "five.subs", "six.subs", "seven.subs", "eight.subs", "nine.subs", "zero.dnom", "one.dnom", "two.dnom", "three.dnom", "four.dnom", "five.dnom", "six.dnom", "seven.dnom", "eight.dnom", "nine.dnom", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "zero.numr", "one.numr", "two.numr", "three.numr", "four.numr", "five.numr", "six.numr", "seven.numr", "eight.numr", "nine.numr", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "fraction", "onehalf", "onethird", "twothirds", "onequarter", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths"]
separator = ["space-han", "mediumspace-math", "CR", "lefttorightmark", "righttoleftmark", "zerowidthjoiner", "zerowidthnonjoiner", ".null", "emquad", "emspace", "enquad", "enspace", "figurespace", "fourperemspace", "hairspace", "narrownbspace", "punctuationspace", "sixperemspace", "space", "nbspace", "thinspace", "threeperemspace", "zerowidthspace", ".notdef"]
punctuation = ["anoteleia", "questiongreek", "fullstop-nubian", "directquestion-nubian", "indirectquestion-nubian", "versedivider-nubian", "fullstop-coptic", "morphologicaldivider-coptic", "dblverticalbar", "undertie", "hyphen", "softhyphen", "endash", "emdash", "underscore", "hyphen.case", "emdash.case", "endash.case", "parenleftinferior", "parenrightinferior", "parenleft", "parenright", "braceleft", "braceright", "bracketleft", "bracketright", "braceleft.case", "braceright.case", "bracketleft.case", "bracketright.case", "parenleft.case", "parenright.case", "parenleft.subs", "parenright.subs", "parenleft.sups", "parenright.sups", "parenleft.tf", "parenright.tf", "braceleft.tf", "braceright.tf", "bracketleft.tf", "bracketright.tf", "quotesinglbase", "quotedblbase", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "guillemetleft", "guillemetright", "guilsinglleft", "guilsinglright", "quotedbl", "quotesingle", "guillemetleft.case", "guillemetright.case", "guilsinglleft.case", "guilsinglright.case", "quotedbl.tf", "quotesingle.tf", "period", "comma", "colon", "semicolon", "ellipsis", "exclam", "exclamdown", "question", "questiondown", "periodcentered", "bullet", "asterisk", "numbersign", "slash", "backslash", "exclamdown.case", "periodcentered.loclCAT", "periodcentered.case", "questiondown.case", "period.subs", "comma.subs", "period.sups", "comma.sups", "period.tf", "comma.tf", "colon.tf", "semicolon.tf", "periodcentered.loclCAT.case"]
symbol = ["numero_s", "gammamod-latin", "florin", "numeral-greek", "lowernumeral-greek", "kai-coptic", "miro-coptic", "piro-coptic", "stauros-coptic", "tauro-coptic", "khiro-coptic", "shimasima-coptic", "baht", "diamondBlackSuit", "heavyBlackHeart", "published", "brokenbar", "numero", "lowringmod", "rhotichookmod", "tonebarextrahighmod", "tonebarextralowmod", "tonebarhighmod", "tonebarlowmod", "tonebarmidmod", "unaspiratedmod", "voicingmod", "bitcoin", "cent", "colonsign", "currency", "dollar", "dong", "euro", "kip", "lira", "liraTurkish", "ruble", "rupeeIndian", "sheqel", "sterling", "tugrik", "won", "yen", "divisionslash", "plus", "minus", "multiply", "divide", "equal", "notequal", "greater", "less", "greaterequal", "lessequal", "plusminus", "approxequal", "asciitilde", "logicalnot", "asciicircum", "emptyset", "infinity", "integral", "increment", "product", "summation", "radical", "micro", "partialdiff", "percent", "perthousand", "plus.subs", "minus.subs", "equal.subs", "plus.sups", "minus.sups", "equal.sups", "upArrow", "northEastArrow", "rightArrow", "southEastArrow", "downArrow", "southWestArrow", "leftArrow", "northWestArrow", "leftRightArrow", "upDownArrow", "blackCircle", "dottedCircle", "blackDiamond", "lozenge", "blackSquare", "upBlackTriangle", "rightBlackTriangle", "downBlackTriangle", "leftBlackTriangle", "rightBlackPointer", "leftBlackPointer", "at", "ampersand", "paragraph", "section", "copyright", "registered", "trademark", "degree", "bar", "dagger", "daggerdbl", "degree.tf"]
tabular = ["eight.tf", "eight.tosf", "five.tf", "five.tosf", "four.tf", "four.tosf", "nine.tf", "nine.tosf", "one.tf", "one.tosf", "seven.tf", "seven.tosf", "six.tf", "six.tosf", "three.tf", "three.tosf", "two.tf", "two.tosf", "zero.tf", "zero.tosf", "zero.tf.zero", "zero.tosf.zero", "parenleft.tf", "parenright.tf", "braceleft.tf", "braceright.tf", "bracketleft.tf", "bracketright.tf", "quotedbl.tf", "quotesingle.tf", "period.tf", "comma.tf", "colon.tf", "semicolon.tf", "degree.tf"]
for glyph in Font.selection:
if glyph.name in uppercase:
tab += "/H/H/%s/H/O/%s/O/O\n" % (glyph.name, glyph.name)
elif glyph.name in lowercase:
tab += "/n/n/%s/n/o/%s/o/o\n" % (glyph.name, glyph.name)
elif glyph.name in number:
tab += "/zero/zero/%s/zero/eight/%s/eight/eight\n" % (glyph.name, glyph.name)
elif glyph.name in separator:
tab += "/H/H/%s/H/O/%s/O/n/%s/n/o/%s/o/o\n" % (glyph.name, glyph.name, glyph.name, glyph.name)
elif glyph.name in punctuation:
tab += "/H/H/%s/H/O/%s/O/n/%s/n/o/%s/o/o\n" % (glyph.name, glyph.name, glyph.name, glyph.name)
elif glyph.name in symbol:
tab += "/H/H/%s/H/O/%s/O/O\n" % (glyph.name, glyph.name)
elif glyph.name in tabular:
tab += "/zero/zero/%s/zero/eight/%s/eight/eight\n" % (glyph.name, glyph.name)
else:
tab += "/.notdef/%s/.notdef\n" % (glyph.name)
# open new tab with text
Font.newTab(tab) | 631.175 | 10,843 | 0.693429 | 2,492 | 25,247 | 7.01565 | 0.380819 | 0.013384 | 0.008809 | 0.011325 | 0.521078 | 0.499113 | 0.477721 | 0.470171 | 0.439856 | 0.430876 | 0 | 0.000043 | 0.07494 | 25,247 | 40 | 10,844 | 631.175 | 0.748534 | 0.004317 | 0 | 0.2 | 0 | 0.066667 | 0.702606 | 0.091307 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
31b2a2d2febcfe79d10f45bf9ba150fdb531828a | 445 | py | Python | spacy/tests/test_architectures.py | g4brielvs/spaCy | cca8651fc8133172ebaa9d9fc438ed1fbf34fb33 | [
"BSD-3-Clause",
"MIT"
] | 2 | 2017-06-23T20:54:31.000Z | 2022-01-06T08:11:49.000Z | spacy/tests/test_architectures.py | g4brielvs/spaCy | cca8651fc8133172ebaa9d9fc438ed1fbf34fb33 | [
"BSD-3-Clause",
"MIT"
] | 1 | 2021-03-01T19:01:37.000Z | 2021-03-01T19:01:37.000Z | spacy/tests/test_architectures.py | g4brielvs/spaCy | cca8651fc8133172ebaa9d9fc438ed1fbf34fb33 | [
"BSD-3-Clause",
"MIT"
] | 1 | 2021-06-21T07:17:48.000Z | 2021-06-21T07:17:48.000Z | import pytest
from spacy import registry
from thinc.api import Linear
from catalogue import RegistryError
@registry.architectures.register("my_test_function")
def create_model(nr_in, nr_out):
return Linear(nr_in, nr_out)
def test_get_architecture():
arch = registry.architectures.get("my_test_function")
assert arch is create_model
with pytest.raises(RegistryError):
registry.architectures.get("not_an_existing_key")
| 26.176471 | 57 | 0.78427 | 61 | 445 | 5.47541 | 0.540984 | 0.188623 | 0.203593 | 0.053892 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137079 | 445 | 16 | 58 | 27.8125 | 0.869792 | 0 | 0 | 0 | 0 | 0 | 0.114607 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 1 | 0.166667 | false | 0 | 0.333333 | 0.083333 | 0.583333 | 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 |
31cb02371faa1d6684f8d85cec4fbda3959ffd47 | 483 | py | Python | IVTa/2014/BRONNIKOV_I_S/task_2_50.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | IVTa/2014/BRONNIKOV_I_S/task_2_50.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | IVTa/2014/BRONNIKOV_I_S/task_2_50.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | # Задача 2. Вариант 50
# Напишите программу, которая будет выводить на экран наиболее понравившееся
# вам высказывание, автором которого является Иларион (Алфеев) .
# Не забудьте о том, что автор должен быть упомянут на отдельной строке.
# Bronnikov I.S.
# 24.05.2016
print("«Нельзя «лезть в душу» человека, ибо душа – это святое святых, и туда можно войти только если вам отворят и пригласят внутрь.""
"\nИларион (Алфеев)")
input("\n\nНажмите Enter для выхода.")
| 40.25 | 135 | 0.728778 | 72 | 483 | 4.944444 | 0.930556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027919 | 0.184265 | 483 | 11 | 136 | 43.909091 | 0.865482 | 0.52795 | 0 | 0 | 0 | 0.333333 | 0.819048 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.333333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
31d89da3acfe5525ae3254d00324d2a3498ef8b4 | 4,183 | py | Python | stubs.min/Autodesk/Revit/DB/Structure/__init___parts/Truss.py | denfromufa/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | 1 | 2017-07-07T11:15:45.000Z | 2017-07-07T11:15:45.000Z | stubs.min/Autodesk/Revit/DB/Structure/__init___parts/Truss.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | null | null | null | stubs.min/Autodesk/Revit/DB/Structure/__init___parts/Truss.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | null | null | null | class Truss(Element,IDisposable):
""" Represents all kinds of Trusses. """
def AttachChord(self,attachToElement,location,forceRemoveSketch):
"""
AttachChord(self: Truss,attachToElement: Element,location: TrussChordLocation,forceRemoveSketch: bool)
Attach a truss's specific chord to a specified element,the element should be a
roof or floor.
attachToElement: The element to which the truss's chord will attach. The element should be a
roof or floor.
location: The chord need to be attached.
forceRemoveSketch: Whether to detach the original sketch if there is one.
"""
pass
@staticmethod
def Create(document,trussTypeId,sketchPlaneId,curve):
"""
Create(document: Document,trussTypeId: ElementId,sketchPlaneId: ElementId,curve: Curve) -> Truss
Creates a new Truss.
document: The document in which the new Truss is created.
trussTypeId: Element id of the truss type.
sketchPlaneId: Element id of a SketchPlane.
curve: The curve of the truss element.
It must be a line,must not be a vertical
line,and must be within the sketch plane.
"""
pass
def DetachChord(self,location):
"""
DetachChord(self: Truss,location: TrussChordLocation)
Detach a truss's specific chord from the element to which it is attached.
location: The chord.
"""
pass
def Dispose(self):
""" Dispose(self: Element,A_0: bool) """
pass
@staticmethod
def DropTruss(truss):
"""
DropTruss(truss: Truss)
Drop truss Family,it will disassociate all members from the truss and delete
the truss.
truss: The truss to be dropped.
"""
pass
def getBoundingBox(self,*args):
""" getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """
pass
def GetTrussMemberInfo(self,elemId):
"""
GetTrussMemberInfo(self: Truss,elemId: ElementId) -> TrussMemberInfo
Query if a given element is a member of a truss,its lock status and its usage,
etc.
elemId: The querying element.
Returns: A struct TrussMemberInfo that contains the querying element's host truss,
whether to lock to the truss,usage type,etc.
"""
pass
def ReleaseUnmanagedResources(self,*args):
""" ReleaseUnmanagedResources(self: Element,disposing: bool) """
pass
def RemoveProfile(self):
"""
RemoveProfile(self: Truss)
Remove the profile of a truss.
"""
pass
def setElementType(self,*args):
""" setElementType(self: Element,type: ElementType,incompatibleExceptionMessage: str) """
pass
def SetProfile(self,topChords,bottomChords):
"""
SetProfile(self: Truss,topChords: CurveArray,bottomChords: CurveArray)
Add or modify the profile of a truss.
topChords: The curves serving as top chords of the truss.
bottomChords: The curves serving as bottom chords of the truss.
"""
pass
def TogglePinMember(self,elemId):
"""
TogglePinMember(self: Truss,elemId: ElementId)
Pin/Unpin a truss member.
elemId: The member element is going to pin/unpin.
"""
pass
def __enter__(self,*args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self,*args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
Curves=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get all the truss curves.
Get: Curves(self: Truss) -> CurveArray
"""
Members=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get all the members of truss.
Get: Members(self: Truss) -> ICollection[ElementId]
"""
TrussType=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Retrieve/set an object that represents the type of the truss.
Get: TrussType(self: Truss) -> TrussType
Set: TrussType(self: Truss)=value
"""
| 31.931298 | 215 | 0.685871 | 519 | 4,183 | 5.412331 | 0.28131 | 0.029904 | 0.0178 | 0.020292 | 0.151655 | 0.1246 | 0.1246 | 0.1246 | 0.10324 | 0.10324 | 0 | 0.000304 | 0.213961 | 4,183 | 130 | 216 | 32.176923 | 0.854015 | 0.600287 | 0 | 0.472222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.416667 | false | 0.416667 | 0 | 0 | 0.527778 | 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 |
9edbe0bb1f74cf589901cb2afef6462b5c6a9dc6 | 322 | py | Python | Level1/Lessons12943/mianri - 12943.py | StudyForCoding/ProgrammersLevel | dc957b1c02cc4383a93b8cbf3d739e6c4d88aa25 | [
"MIT"
] | null | null | null | Level1/Lessons12943/mianri - 12943.py | StudyForCoding/ProgrammersLevel | dc957b1c02cc4383a93b8cbf3d739e6c4d88aa25 | [
"MIT"
] | null | null | null | Level1/Lessons12943/mianri - 12943.py | StudyForCoding/ProgrammersLevel | dc957b1c02cc4383a93b8cbf3d739e6c4d88aa25 | [
"MIT"
] | 1 | 2021-04-05T07:35:59.000Z | 2021-04-05T07:35:59.000Z | # 콜라츠 추측
```python
def solution(num):
answer = 0
while num>1:
#1-1
if num%2 == 0:
answer += 1
num = num/2
#1-2
else:
answer += 1
num = (num*3) + 1
if answer >= 500:
return -1
return answer
```
| 14.636364 | 29 | 0.357143 | 38 | 322 | 3.026316 | 0.421053 | 0.034783 | 0.173913 | 0.226087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111842 | 0.52795 | 322 | 21 | 30 | 15.333333 | 0.644737 | 0.037267 | 0 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 |
9ef010788e1e0f1c3d30e9e6576b2c5f524ebf12 | 360 | py | Python | lecture_01/hw/task05.py | DKudrik/epam_python_autumn_2020 | f805a2df4ec993760d32c755482f2cff13b89549 | [
"MIT"
] | 37 | 2020-10-29T16:52:06.000Z | 2022-03-08T18:21:04.000Z | lecture_01/hw/task05.py | DKudrik/epam_python_autumn_2020 | f805a2df4ec993760d32c755482f2cff13b89549 | [
"MIT"
] | 3 | 2020-10-29T21:41:31.000Z | 2020-11-26T12:25:42.000Z | lecture_01/hw/task05.py | DKudrik/epam_python_autumn_2020 | f805a2df4ec993760d32c755482f2cff13b89549 | [
"MIT"
] | 118 | 2020-10-29T20:59:28.000Z | 2022-03-10T12:31:19.000Z | """
Given a list of integers numbers "nums".
You need to find a sub-array with length less equal to "k", with maximal sum.
The written function should return the sum of this sub-array.
Examples:
nums = [1, 3, -1, -3, 5, 3, 6, 7], k = 3
result = 16
"""
from typing import List
def find_maximal_subarray_sum(nums: List[int], k: int) -> int:
...
| 21.176471 | 77 | 0.652778 | 63 | 360 | 3.68254 | 0.634921 | 0.068966 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039286 | 0.222222 | 360 | 16 | 78 | 22.5 | 0.789286 | 0.705556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
9ef15ec570f5f455a86588c388c3f8b82150fc89 | 344 | py | Python | utils/onnx_util.py | xuguozhi/Peppa-Facial-Landmark-PyTorch | 238063317fd31c4c21c5c43692e6a5d769970370 | [
"Apache-2.0"
] | 163 | 2020-02-27T12:37:23.000Z | 2022-03-21T08:10:03.000Z | utils/onnx_util.py | smilemakc/Peppa-Facial-Landmark-PyTorch | 238063317fd31c4c21c5c43692e6a5d769970370 | [
"Apache-2.0"
] | 16 | 2020-03-18T05:16:32.000Z | 2021-11-24T14:53:24.000Z | utils/onnx_util.py | xuguozhi/Peppa-Facial-Landmark-PyTorch | 238063317fd31c4c21c5c43692e6a5d769970370 | [
"Apache-2.0"
] | 48 | 2020-03-05T11:02:31.000Z | 2022-03-14T08:19:24.000Z | import torch
import torch.onnx
from models.slim import Slim
x = torch.randn(1, 3, 160, 160)
model = Slim()
model.load_state_dict(torch.load("../pretrained_weights/slim_160_latest.pth", map_location="cpu"))
model.eval()
torch.onnx.export(model, x, "../pretrained_weights/slim_160_latest.onnx", input_names=["input1"], output_names=['output1'])
| 34.4 | 123 | 0.758721 | 53 | 344 | 4.716981 | 0.54717 | 0.088 | 0.168 | 0.192 | 0.24 | 0 | 0 | 0 | 0 | 0 | 0 | 0.050314 | 0.075581 | 344 | 9 | 124 | 38.222222 | 0.735849 | 0 | 0 | 0 | 0 | 0 | 0.287791 | 0.241279 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7305c356684d26bb94e2ea34b6c4b4f3b6e36ecd | 3,378 | py | Python | pycqed/analysis_v2/measurement_analysis.py | ZW7436/PycQED_py3 | dcc19dbaedd226112a2f98a7985dcf2bab2c9734 | [
"MIT"
] | 1 | 2019-07-05T13:41:51.000Z | 2019-07-05T13:41:51.000Z | pycqed/analysis_v2/measurement_analysis.py | ball199578/PycQED_py3 | dcc19dbaedd226112a2f98a7985dcf2bab2c9734 | [
"MIT"
] | null | null | null | pycqed/analysis_v2/measurement_analysis.py | ball199578/PycQED_py3 | dcc19dbaedd226112a2f98a7985dcf2bab2c9734 | [
"MIT"
] | null | null | null | """
This file imports all the relevant classes for daily use.
"""
# This snippet ensures all submodules get reloaded properly as we like to
# modify things when using it.
from importlib import reload
import pycqed.analysis_v2.base_analysis as ba
reload(ba)
import pycqed.analysis_v2.simple_analysis as sa
reload(sa)
import pycqed.analysis_v2.timedomain_analysis as ta
reload(ta)
import pycqed.analysis_v2.readout_analysis as ra
reload(ra)
import pycqed.analysis_v2.syndrome_analysis as synda
reload(sa)
# only one of these two files should exist in the end
import pycqed.analysis_v2.cryo_scope_analysis as csa
reload(csa)
import pycqed.analysis_v2.cryo_spectrumanalyzer_analysis as csa
reload(csa)
import pycqed.analysis_v2.distortions_analysis as da
import pycqed.analysis_v2.optimization_analysis as oa
reload(da)
import pycqed.analysis_v2.coherence_analysis as cs
reload(cs)
import pycqed.analysis_v2.spectroscopy_analysis as sa
reload(sa)
import pycqed.analysis_v2.dac_scan_analysis as da
reload(da)
import pycqed.analysis_v2.quantum_efficiency_analysis as qea
reload(qea)
import pycqed.analysis_v2.cross_dephasing_analysis as cda
reload(cda)
import pycqed.analysis_v2.randomized_benchmarking_analysis as rba
reload(rba)
import pycqed.analysis_v2.gate_set_tomography_analysis as gsa
reload(gsa)
from pycqed.analysis_v2.base_analysis import *
from pycqed.analysis_v2.simple_analysis import (
Basic1DAnalysis, Basic1DBinnedAnalysis,
Basic2DAnalysis, Basic2DInterpolatedAnalysis)
from pycqed.analysis_v2.timedomain_analysis import (
FlippingAnalysis, Intersect_Analysis, CZ_1QPhaseCal_Analysis,
Oscillation_Analysis,
Conditional_Oscillation_Analysis, Idling_Error_Rate_Analyisis,
Grovers_TwoQubitAllStates_Analysis)
from pycqed.analysis_v2.readout_analysis import Singleshot_Readout_Analysis, \
Multiplexed_Readout_Analysis
from pycqed.analysis_v2.syndrome_analysis import (
Single_Qubit_RoundsToEvent_Analysis, One_Qubit_Paritycheck_Analysis)
from pycqed.analysis_v2.cryo_scope_analysis import RamZFluxArc, \
SlidingPulses_Analysis, Cryoscope_Analysis
from pycqed.analysis_v2.cryo_spectrumanalyzer_analysis import Cryospec_Analysis
from pycqed.analysis_v2.distortions_analysis import Scope_Trace_analysis
from pycqed.analysis_v2.optimization_analysis import OptimizationAnalysis
from pycqed.analysis_v2.timing_cal_analysis import Timing_Cal_Flux_Coarse, Timing_Cal_Flux_Fine
from pycqed.analysis_v2.coherence_analysis import CoherenceTimesAnalysis, \
CoherenceTimesAnalysisSingle, AliasedCoherenceTimesAnalysisSingle
from pycqed.analysis_v2.spectroscopy_analysis import Spectroscopy, ResonatorSpectroscopy, VNA_analysis, complex_spectroscopy
from pycqed.analysis_v2.dac_scan_analysis import FluxFrequency
from pycqed.analysis_v2.quantum_efficiency_analysis import QuantumEfficiencyAnalysis, DephasingAnalysisSingleScans, DephasingAnalysisSweep, SSROAnalysisSingleScans, SSROAnalysisSweep, QuantumEfficiencyAnalysisTWPA
from pycqed.analysis_v2.cross_dephasing_analysis import CrossDephasingAnalysis
from pycqed.analysis_v2.randomized_benchmarking_analysis import (
RandomizedBenchmarking_SingleQubit_Analysis,
RandomizedBenchmarking_TwoQubit_Analysis,
UnitarityBenchmarking_TwoQubit_Analysis)
from pycqed.analysis_v2.gate_set_tomography_analysis import \
GST_SingleQubit_DataExtraction, GST_TwoQubit_DataExtraction
| 44.447368 | 213 | 0.870337 | 423 | 3,378 | 6.650118 | 0.309693 | 0.164237 | 0.1877 | 0.120867 | 0.47636 | 0.263064 | 0.090295 | 0.061145 | 0.061145 | 0 | 0 | 0.01231 | 0.086146 | 3,378 | 75 | 214 | 45.04 | 0.898931 | 0.062463 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.539683 | 0 | 0.539683 | 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 |
7339d8bcd77f165e1acaf084c36362f0caedda26 | 445 | py | Python | qclib/__init__.py | dylanljones/qclib | 91e63b642f57fee6eff0b3ff1d696880a66509c3 | [
"MIT"
] | 2 | 2021-10-31T11:14:51.000Z | 2021-11-17T13:39:50.000Z | qclib/__init__.py | dylanljones/qclib | 91e63b642f57fee6eff0b3ff1d696880a66509c3 | [
"MIT"
] | null | null | null | qclib/__init__.py | dylanljones/qclib | 91e63b642f57fee6eff0b3ff1d696880a66509c3 | [
"MIT"
] | 1 | 2021-10-31T11:15:00.000Z | 2021-10-31T11:15:00.000Z | # coding: utf-8
#
# This code is part of qclib.
#
# Copyright (c) 2021, Dylan Jones
from ._logging import logger
from ._utils import Cache, cache, cachekey
from .math import *
# from .circuit import (
# Qubit, Clbit, AncillaQubit,
# QuantumRegister, ClassicalRegister, AncillaRegister,
# QuantumCircuit, Result, run, init_backend, transpile, run_transpiled, measure, measure_all
# )
# from .vqe import VariationalSolver, VQEFitter
| 27.8125 | 96 | 0.737079 | 52 | 445 | 6.211538 | 0.788462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01355 | 0.170787 | 445 | 15 | 97 | 29.666667 | 0.861789 | 0.739326 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
735b7d7a256c69e867154412685450aaa0d817f8 | 319 | py | Python | setup.py | mattwthompson/mbuild_ONA | 900c96d59c0b8be86a5df508d76fded82b10be67 | [
"MIT"
] | 1 | 2020-11-08T23:51:14.000Z | 2020-11-08T23:51:14.000Z | setup.py | mattwthompson/mbuild_ONA | 900c96d59c0b8be86a5df508d76fded82b10be67 | [
"MIT"
] | 1 | 2020-06-18T18:26:50.000Z | 2020-06-18T18:45:37.000Z | setup.py | mattwthompson/mbuild_ONA | 900c96d59c0b8be86a5df508d76fded82b10be67 | [
"MIT"
] | null | null | null | from setuptools import setup
setup(
name="mbuild_ONA",
install_requires="mbuild",
entry_points={
"mbuild.plugins":[ "ONA_box = mbuild_ONA.mbuild_ONA:ONA_box"
]
},
py_modules=["mbuild_ONA"],
)
| 26.583333 | 80 | 0.454545 | 27 | 319 | 5.037037 | 0.555556 | 0.264706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.448276 | 319 | 11 | 81 | 29 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0.247649 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.1 | 0 | 0.1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
735d05d84556f63b0f827b4e599f522fa53dba55 | 3,345 | py | Python | RecoTracker/Configuration/python/RecoTrackerP5_EventContent_cff.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 852 | 2015-01-11T21:03:51.000Z | 2022-03-25T21:14:00.000Z | RecoTracker/Configuration/python/RecoTrackerP5_EventContent_cff.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 30,371 | 2015-01-02T00:14:40.000Z | 2022-03-31T23:26:05.000Z | RecoTracker/Configuration/python/RecoTrackerP5_EventContent_cff.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 3,240 | 2015-01-02T05:53:18.000Z | 2022-03-31T17:24:21.000Z | import FWCore.ParameterSet.Config as cms
#Tracks without extra and hits
#AOD content
RecoTrackerAOD = cms.PSet(
outputCommands = cms.untracked.vstring(
'keep recoTracks_ctfWithMaterialTracksP5_*_*',
'keep recoTracks_ctfWithMaterialTracksP5LHCNavigation_*_*',
'keep recoTracks_rsWithMaterialTracksP5_*_*',
'keep recoTracks_cosmictrackfinderP5_*_*',
'keep recoTracks_beamhaloTracks_*_*',
'keep recoTracks_splittedTracksP5_*_*',
'keep recoTracks_ctfWithMaterialTracksP5Top_*_*',
'keep recoTracks_rsWithMaterialTracksP5Top_*_*',
'keep recoTracks_cosmictrackfinderP5Top_*_*',
'keep recoTracks_ctfWithMaterialTracksP5Bottom_*_*',
'keep recoTracks_rsWithMaterialTracksP5Bottom_*_*',
'keep recoTracks_cosmictrackfinderP5Bottom_*_*',
'keep recoTracks_regionalCosmicTracks_*_*',
'keep *_dedxHitInfo_*_*',
'keep *_dedxHarmonic2_*_*',
'keep *_dedxHitInfoCTF_*_*',
'keep *_dedxHarmonic2CTF_*_*',
'keep *_dedxHitInfoCosmicTF_*_*',
'keep *_dedxHarmonic2CosmicTF_*_*')
)
#RECO content
RecoTrackerRECO = cms.PSet(
outputCommands = cms.untracked.vstring(
'keep recoTrackExtras_ctfWithMaterialTracksP5_*_*',
'keep TrackingRecHitsOwned_ctfWithMaterialTracksP5_*_*',
'keep recoTrackExtras_ctfWithMaterialTracksP5LHCNavigation_*_*',
'keep TrackingRecHitsOwned_ctfWithMaterialTracksP5LHCNavigation_*_*',
'keep recoTrackExtras_rsWithMaterialTracksP5_*_*',
'keep TrackingRecHitsOwned_rsWithMaterialTracksP5_*_*',
'keep recoTrackExtras_cosmictrackfinderP5_*_*',
'keep TrackingRecHitsOwned_cosmictrackfinderP5_*_*',
'keep recoTrackExtras_beamhaloTracks_*_*',
'keep TrackingRecHitsOwned_beamhaloTracks_*_*',
'keep recoTrackExtras_splittedTracksP5_*_*',
'keep TrackingRecHitsOwned_splittedTracksP5_*_*',
'keep recoTrackExtras_ctfWithMaterialTracksP5Top_*_*',
'keep TrackingRecHitsOwned_ctfWithMaterialTracksP5Top_*_*',
'keep recoTrackExtras_rsWithMaterialTracksP5Top_*_*',
'keep TrackingRecHitsOwned_rsWithMaterialTracksP5Top_*_*',
'keep recoTrackExtras_cosmictrackfinderP5Top_*_*',
'keep TrackingRecHitsOwned_cosmictrackfinderP5Top_*_*',
'keep recoTrackExtras_ctfWithMaterialTracksP5Bottom_*_*',
'keep TrackingRecHitsOwned_ctfWithMaterialTracksP5Bottom_*_*',
'keep recoTrackExtras_rsWithMaterialTracksP5Bottom_*_*',
'keep TrackingRecHitsOwned_rsWithMaterialTracksP5Bottom_*_*',
'keep recoTrackExtras_cosmictrackfinderP5Bottom_*_*',
'keep TrackingRecHitsOwned_cosmictrackfinderP5Bottom_*_*',
'keep recoTrackExtras_regionalCosmicTracks_*_*',
'keep TrackingRecHitsOwned_regionalCosmicTracks_*_*',
'keep *_dedxTruncated40_*_*',
'keep *_dedxTruncated40CTF_*_*',
'keep *_dedxTruncated40CosmicTF_*_*',
'keep recoTracks_cosmicDCTracks_*_*',
'keep recoTrackExtras_cosmicDCTracks_*_*',
'keep TrackingRecHitsOwned_cosmicDCTracks_*_*')
)
RecoTrackerRECO.outputCommands.extend(RecoTrackerAOD.outputCommands)
#Full Event content
RecoTrackerFEVT = cms.PSet(
outputCommands = cms.untracked.vstring()
)
RecoTrackerFEVT.outputCommands.extend(RecoTrackerRECO.outputCommands)
| 47.112676 | 77 | 0.742003 | 193 | 3,345 | 12.067358 | 0.264249 | 0.084156 | 0.02705 | 0.030915 | 0.054959 | 0.054959 | 0.037784 | 0 | 0 | 0 | 0 | 0.01507 | 0.166816 | 3,345 | 70 | 78 | 47.785714 | 0.820596 | 0.020927 | 0 | 0.031746 | 0 | 0 | 0.689908 | 0.594801 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.015873 | 0 | 0.015873 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7df5a08d6f2f56e8c17e3a85e771c3f7685671ed | 1,772 | py | Python | desktop_local_tests/test_packet_capture_disrupt_vpn_connection.py | UAEKondaya1/expressvpn_leak_testing | 9e4cee899ac04f7820ac351fa55efdc0c01370ba | [
"MIT"
] | 219 | 2017-12-12T09:42:46.000Z | 2022-03-13T08:25:13.000Z | desktop_local_tests/test_packet_capture_disrupt_vpn_connection.py | UAEKondaya1/expressvpn_leak_testing | 9e4cee899ac04f7820ac351fa55efdc0c01370ba | [
"MIT"
] | 11 | 2017-12-14T08:14:51.000Z | 2021-08-09T18:37:45.000Z | desktop_local_tests/test_packet_capture_disrupt_vpn_connection.py | UAEKondaya1/expressvpn_leak_testing | 9e4cee899ac04f7820ac351fa55efdc0c01370ba | [
"MIT"
] | 45 | 2017-12-14T07:26:36.000Z | 2022-03-11T09:36:56.000Z | from desktop_local_tests.local_packet_capture_test_case_with_disrupter import LocalPacketCaptureTestCaseWithDisrupter
from desktop_local_tests.vpn_connection_disrupter import VPNConnectionDisrupter
class TestPacketCaptureDisruptVPNConnection(LocalPacketCaptureTestCaseWithDisrupter):
'''Summary:
Tests whether traffic leaving the user's device leaks outside of the VPN tunnel when the VPN
server becomes unreachable.
Details:
This test will connect to VPN then put up firewall rules which block connectivity to the VPN
server. The test looks for leaking traffic once the interface has been disabled.
Discussion:
Connectivity drops to the VPN server are very real world threats. This could happen for a
variety of reasons:
* Server goes down
* Server is deliberately taken out of rotation for maintenance etc..
* Blocking
* Bad routes
In all cases a firewall adequately represents these connectivity drops.
Weaknesses:
Packet capture tests can be noisy. Traffic can be detected as a leak but in actual fact may not
be. For example, traffic might go to a server owned by the VPN provider to re-establish
connections. In general this test is best used for manual exploring leaks rather than for
automation.
With some systems/VPN applications, a firewall on the test device might not adequately block the
VPN server. For such setups, a secondary device is needed e.g.
* Firewall on a router
* Firewall on host if the test device is a VM.
Scenarios:
No restrictions.
TODO:
Implement multi-device test with firewall off device
'''
def __init__(self, devices, parameters):
super().__init__(VPNConnectionDisrupter, devices, parameters)
| 32.814815 | 117 | 0.759029 | 240 | 1,772 | 5.520833 | 0.583333 | 0.02717 | 0.036226 | 0.031698 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.207675 | 1,772 | 53 | 118 | 33.433962 | 0.943732 | 0.704289 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018868 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
7dfcd5013d51f708cd6b5d86c9ad49c20f62523a | 981 | py | Python | src/yellowdog_client/model/account_allowance.py | yellowdog/yellowdog-sdk-python-public | da69a7d6e45c92933e34fefcaef8b5d98dcd6036 | [
"Apache-2.0"
] | null | null | null | src/yellowdog_client/model/account_allowance.py | yellowdog/yellowdog-sdk-python-public | da69a7d6e45c92933e34fefcaef8b5d98dcd6036 | [
"Apache-2.0"
] | null | null | null | src/yellowdog_client/model/account_allowance.py | yellowdog/yellowdog-sdk-python-public | da69a7d6e45c92933e34fefcaef8b5d98dcd6036 | [
"Apache-2.0"
] | null | null | null | from dataclasses import dataclass, field
from datetime import datetime
from typing import List, Optional
from .allowance import Allowance
from .allowance_limit_enforcement import AllowanceLimitEnforcement
from .allowance_reset_type import AllowanceResetType
from .instance_status import InstanceStatus
@dataclass
class AccountAllowance(Allowance):
type: str = field(default="co.yellowdog.platform.model.AccountAllowance", init=False)
id: Optional[str] = field(default=None, init=False)
createdById: Optional[str] = field(default=None, init=False)
effectiveFrom: datetime
resetType: AllowanceResetType
limitEnforcement: AllowanceLimitEnforcement
monitoredStatuses: List[InstanceStatus]
description: Optional[str] = None
effectiveUntil: Optional[datetime] = None
allowedHours: int = 0
remainingHours: float = 0
boostHours: Optional[int] = None
resetInterval: Optional[int] = None
hardLimitGraceMinutes: Optional[int] = None
| 36.333333 | 89 | 0.781855 | 101 | 981 | 7.544554 | 0.455446 | 0.051181 | 0.059055 | 0.060367 | 0.094488 | 0.094488 | 0.094488 | 0 | 0 | 0 | 0 | 0.002387 | 0.14577 | 981 | 26 | 90 | 37.730769 | 0.906921 | 0 | 0 | 0 | 0 | 0 | 0.044852 | 0.044852 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.304348 | 0 | 0.956522 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
7dfd18fd052a7940e41576e52c4b043ba022b4fb | 304 | py | Python | geotrek/maintenance/urls.py | pierreloicq/Geotrek-admin | 00cd29f29843f2cc25e5a3c7372fcccf14956887 | [
"BSD-2-Clause"
] | 50 | 2016-10-19T23:01:21.000Z | 2022-03-28T08:28:34.000Z | geotrek/maintenance/urls.py | pierreloicq/Geotrek-admin | 00cd29f29843f2cc25e5a3c7372fcccf14956887 | [
"BSD-2-Clause"
] | 1,422 | 2016-10-27T10:39:40.000Z | 2022-03-31T13:37:10.000Z | geotrek/maintenance/urls.py | pierreloicq/Geotrek-admin | 00cd29f29843f2cc25e5a3c7372fcccf14956887 | [
"BSD-2-Clause"
] | 46 | 2016-10-27T10:59:10.000Z | 2022-03-22T15:55:56.000Z | from django.conf import settings
from mapentity.registry import registry
from . import models
app_name = 'maintenance'
urlpatterns = registry.register(models.Intervention, menu=settings.INTERVENTION_MODEL_ENABLED)
urlpatterns += registry.register(models.Project, menu=settings.PROJECT_MODEL_ENABLED)
| 27.636364 | 94 | 0.835526 | 36 | 304 | 6.916667 | 0.5 | 0.15261 | 0.216867 | 0.26506 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.088816 | 304 | 10 | 95 | 30.4 | 0.898917 | 0 | 0 | 0 | 0 | 0 | 0.036184 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
b40b7f0e012fcd7782751fd036fa56ea2c1282b0 | 377 | py | Python | tudo/ex019.py | Ramon-Erik/Exercicios-Python | 158a7f1846dd3d486aa0517fa337d46d73aab649 | [
"MIT"
] | 1 | 2021-07-08T00:35:57.000Z | 2021-07-08T00:35:57.000Z | tudo/ex019.py | Ramon-Erik/Exercicios-Python | 158a7f1846dd3d486aa0517fa337d46d73aab649 | [
"MIT"
] | null | null | null | tudo/ex019.py | Ramon-Erik/Exercicios-Python | 158a7f1846dd3d486aa0517fa337d46d73aab649 | [
"MIT"
] | null | null | null | from random import choice
a1 = int(input('>Número de chamada do aluno 1: '))
a2 = int(input('>Número de chamada do aluno 2: '))
a3 = int(input('>Número de chamada do aluno 3: '))
a4 = int(input('>Número de chamada do aluno 4: '))
print('(Ser o primeiro aluno ou 4° nao influenciará)')
lista = [a1, a2, a3, a4]
escolha = (choice(lista))
print(f'O aluno sorteado foi: {escolha}') | 41.888889 | 54 | 0.676393 | 65 | 377 | 3.938462 | 0.492308 | 0.125 | 0.21875 | 0.25 | 0.46875 | 0.46875 | 0.46875 | 0 | 0 | 0 | 0 | 0.041139 | 0.161804 | 377 | 9 | 55 | 41.888889 | 0.765823 | 0 | 0 | 0 | 0 | 0 | 0.529101 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.111111 | 0.222222 | 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 |
b428280e07a51621562bff78da1a767fc97af942 | 68 | py | Python | regipy/__init__.py | pombredanne/regipy | a6bcdab2fd9e71b19af94125cbfb5f23789f319b | [
"MIT"
] | 190 | 2019-03-06T09:13:08.000Z | 2022-03-19T14:43:34.000Z | regipy/__init__.py | pombredanne/regipy | a6bcdab2fd9e71b19af94125cbfb5f23789f319b | [
"MIT"
] | 117 | 2019-05-15T12:22:46.000Z | 2022-03-30T10:43:03.000Z | regipy/__init__.py | pombredanne/regipy | a6bcdab2fd9e71b19af94125cbfb5f23789f319b | [
"MIT"
] | 37 | 2019-03-12T14:46:12.000Z | 2022-01-12T11:07:10.000Z | from .registry import *
__title__ = 'regipy'
__version__ = '2.2.0'
| 13.6 | 23 | 0.691176 | 9 | 68 | 4.333333 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.052632 | 0.161765 | 68 | 4 | 24 | 17 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0.161765 | 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 |
b4593517f7652feaa31c4fb8e7e2d0d3c0e139ef | 104 | py | Python | django_full_stack/user_dashboard/apps/dashboard_users/apps.py | gfhuertac/coding_dojo_python | 4d17bb63fb2b9669216a0f60326d4a4b9055af7e | [
"MIT"
] | null | null | null | django_full_stack/user_dashboard/apps/dashboard_users/apps.py | gfhuertac/coding_dojo_python | 4d17bb63fb2b9669216a0f60326d4a4b9055af7e | [
"MIT"
] | 6 | 2020-06-06T01:50:21.000Z | 2022-02-10T11:33:02.000Z | django_full_stack/user_dashboard/apps/dashboard_users/apps.py | gfhuertac/coding_dojo_python | 4d17bb63fb2b9669216a0f60326d4a4b9055af7e | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class DashboardUsersConfig(AppConfig):
name = 'dashboard_users'
| 17.333333 | 38 | 0.788462 | 11 | 104 | 7.363636 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144231 | 104 | 5 | 39 | 20.8 | 0.910112 | 0 | 0 | 0 | 0 | 0 | 0.144231 | 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 |
b47f445ea7a77c85dafe9fa21a68a77cf197d101 | 391 | py | Python | svr/services/provider.py | paulc00/mybooks | cd7753c06a6f317293a5edd779266810feff367d | [
"MIT"
] | null | null | null | svr/services/provider.py | paulc00/mybooks | cd7753c06a6f317293a5edd779266810feff367d | [
"MIT"
] | null | null | null | svr/services/provider.py | paulc00/mybooks | cd7753c06a6f317293a5edd779266810feff367d | [
"MIT"
] | null | null | null | from injector import provider
class ItemsProvider(object):
def __init__(self, items: list = []):
self._items = items
@provider
def get(self, number_of_items: int = 5) -> list:
if not self._items:
return []
if number_of_items > len(self._items):
number_of_items = len(self._items)
return self._items[0:number_of_items] | 23 | 52 | 0.616368 | 50 | 391 | 4.48 | 0.44 | 0.241071 | 0.232143 | 0.142857 | 0.223214 | 0.223214 | 0 | 0 | 0 | 0 | 0 | 0.007143 | 0.283887 | 391 | 17 | 53 | 23 | 0.792857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.090909 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
b485f497cc2c0c462095de7a153eab79f84d1058 | 176 | py | Python | cloudcms/error/invalid_qname_error.py | gitana/cloudcms-python-driver | 8685c634880c1a6af6f359f1a25de42dcf49f319 | [
"Apache-2.0"
] | null | null | null | cloudcms/error/invalid_qname_error.py | gitana/cloudcms-python-driver | 8685c634880c1a6af6f359f1a25de42dcf49f319 | [
"Apache-2.0"
] | null | null | null | cloudcms/error/invalid_qname_error.py | gitana/cloudcms-python-driver | 8685c634880c1a6af6f359f1a25de42dcf49f319 | [
"Apache-2.0"
] | null | null | null | class InvalidQNameError(RuntimeError):
def __init__(self, qname):
message = "Invalid qname: " + qname
super(InvalidQNameError, self).__init__(message)
| 29.333333 | 56 | 0.676136 | 16 | 176 | 6.9375 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.221591 | 176 | 5 | 57 | 35.2 | 0.810219 | 0 | 0 | 0 | 0 | 0 | 0.085227 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c303820ade5b90d73b66bbf6584cede379d92796 | 6,569 | py | Python | tests/test_github_pr_queries.py | surfaceowl/python_weekly_dir_detail | 7648afef600000f82af1a6b9d65d937671add2b6 | [
"MIT"
] | null | null | null | tests/test_github_pr_queries.py | surfaceowl/python_weekly_dir_detail | 7648afef600000f82af1a6b9d65d937671add2b6 | [
"MIT"
] | null | null | null | tests/test_github_pr_queries.py | surfaceowl/python_weekly_dir_detail | 7648afef600000f82af1a6b9d65d937671add2b6 | [
"MIT"
] | null | null | null | """
test GitHub queries for specific results we know were reported on various
weekly Developer In Residence Reports
15 Nov - 21 Nov 2021: https://lukasz.langa.pl/4f7c2091-2a74-48ab-99d7-8521c4fa8363/
30 Aug - 5 Sept 2021: https://lukasz.langa.pl/94b5086c-81df-498a-9f8b-f9e06f5d9538/
Tests can take some time since PyGitHub does not enable limit all queries by date and
cpython/cpython is a large repo (e.g. query for PR pulls from entire repo unlike
Issues API, where you can spec a "since" date). Ideally we'd only like PRs modified
between date ranges to pull less, but that is client-side responsibility
"""
import datetime
from config import developer_ids
from config import repo
from weekly_pr_summary import filter_prs_from_date_range
from utilities import check_github_rate_limit
def test_get_one_closed_pr29537():
"""
Tuesday 16 Nov - one PR was closed per dev blog at:
https://lukasz.langa.pl/4f7c2091-2a74-48ab-99d7-8521c4fa8363/
expected PR: https://github.com/python/cpython/pull/29537
"""
# set dates for this test
start_date = datetime.datetime(2021, 11, 16, 00, 00, 00)
end_date = datetime.datetime(2021, 11, 16, 23, 59, 59)
list_with_pull_report_29537 = [repo.get_pull(29537)]
closed_pr_we_care_about, pull_requests_reviewed = filter_prs_from_date_range(
list_with_pull_report_29537, developer_ids, start_date, end_date
)
assert closed_pr_we_care_about[0].number == 29537
def test_get_one_authored_pr28044():
"""
Monday 30 Aug - one PR was authored per dev blog at:
https://lukasz.langa.pl/94b5086c-81df-498a-9f8b-f9e06f5d9538/
expected PR: https://github.com/python/cpython/pull/28044
"""
# set dates for this test
start_date = datetime.datetime(2021, 8, 30, 00, 00, 00)
end_date = datetime.datetime(2021, 8, 30, 23, 59, 59)
list_with_pull_report = [repo.get_pull(28044)]
authored_pr_we_care_about, pull_requests_reviewed = filter_prs_from_date_range(
list_with_pull_report, developer_ids, start_date, end_date
)
assert authored_pr_we_care_about[0].number == 28044
def test_get_one_reviewed_pr28089():
"""
Tuesday 31 Aug - one PR was reviewed per dev blog at:
https://lukasz.langa.pl/94b5086c-81df-498a-9f8b-f9e06f5d9538/
expected PR: https://github.com/python/cpython/pull/28089
"""
# set dates for this test
start_date = datetime.datetime(2021, 8, 31, 00, 00, 00)
end_date = datetime.datetime(2021, 8, 31, 23, 59, 59)
list_with_pull_report = [repo.get_pull(28089)]
authored_pr_we_care_about, pull_requests_reviewed = filter_prs_from_date_range(
list_with_pull_report, developer_ids, start_date, end_date
)
assert authored_pr_we_care_about[0].number == 28089
def test_get_one_reviewed_pr29440():
"""
Tuesday 16 Aug - one PR was reviewed per dev blog at:
https://lukasz.langa.pl/4f7c2091-2a74-48ab-99d7-8521c4fa8363/
expected PR: https://github.com/python/cpython/pull/29440
"""
# set dates for this test
start_date = datetime.datetime(2021, 11, 15, 00, 00, 00)
end_date = datetime.datetime(2021, 11, 21, 23, 59, 59)
list_with_pull_report = [repo.get_pull(29440)]
authored_pr_we_care_about, pull_requests_reviewed = filter_prs_from_date_range(
list_with_pull_report, developer_ids, start_date, end_date
)
assert authored_pr_we_care_about[0].number == 29440
def test_difficult_to_find_prs_on_16nov_search_by_list_of_pr():
"""
several PRs in this set are difficult to find due to metadata available
Tuesday 16 Nov 2021 - 15 PR total cited (14 closed, 1 reviewed) per dev blog at
https://lukasz.langa.pl/4f7c2091-2a74-48ab-99d7-8521c4fa8363/
"""
# set dates for this test
start_date = datetime.datetime(2021, 11, 16, 00, 00, 00)
end_date = datetime.datetime(2021, 11, 16, 23, 59, 59)
pr_we_expect_to_find = [29583, 29584, 29603, 29604, 29589, 29601]
# reviewed_pr_expected = [29601]
# assemble subset of targeted pr objects for faster testing
pull_requests_targeted = [
pull_request
for pull_request in [
repo.get_pull(target_pr_number) for target_pr_number in pr_we_expect_to_find
]
]
# pull results using our functions
pr_we_care_about, pull_requests_reviewed = filter_prs_from_date_range(
pull_requests_targeted, developer_ids, start_date, end_date
)
pr_numbers_found = [pr.number for pr in pr_we_care_about]
pr_not_found_but_expected = [
pr for pr in pr_we_expect_to_find if pr not in pr_numbers_found
]
# human unable to find PR 29583 due to available metadata
# despite extensive analysis
assert len(pr_not_found_but_expected) <= 1
def test_all_prs_on_16nov_search_by_list_of_pr():
"""
Tuesday 16 Nov 2021 - 15 PR total cited (14 closed, 1 reviewed) per dev blog at
https://lukasz.langa.pl/4f7c2091-2a74-48ab-99d7-8521c4fa8363/
"""
# set dates for this test
start_date = datetime.datetime(2021, 11, 16, 00, 00, 00)
end_date = datetime.datetime(2021, 11, 16, 23, 59, 59)
pr_we_expect_to_find = [
29596,
29598,
29597,
29600,
29590,
29586,
29585,
29571,
29583,
29584,
29603,
29604,
29589,
29602,
29601,
]
# reviewed_pr_expected = [29601]
# assemble subset of targeted pr objects for faster testing
pull_requests_targeted = [
pull_request
for pull_request in [
repo.get_pull(target_pr_number) for target_pr_number in pr_we_expect_to_find
]
]
# pull results using our functions
pr_we_care_about, pull_requests_reviewed = filter_prs_from_date_range(
pull_requests_targeted, developer_ids, start_date, end_date
)
pr_numbers_found = [pr.number for pr in pr_we_care_about]
pr_not_found_but_expected = [
pr for pr in pr_we_expect_to_find if pr not in pr_numbers_found
]
# test below will fail until we have perfect 100% PR discovery
# all_expected_prs_found = bool(set(pr_numbers_found) == set(pr_we_expect_to_find))
# all_expected_reviewed_prs_found = bool(
# pull_requests_reviewed == reviewed_pr_expected)
# assert all_expected_prs_found and all_expected_reviewed_prs_found
# alternate approach
# have been unable to find PR 29583 due to available metadata
# despite extensive analysis
check_github_rate_limit()
assert len(pr_not_found_but_expected) <= 1
| 34.573684 | 88 | 0.712285 | 995 | 6,569 | 4.41407 | 0.20603 | 0.017304 | 0.054645 | 0.065574 | 0.75888 | 0.710155 | 0.70378 | 0.69194 | 0.665984 | 0.619763 | 0 | 0.118315 | 0.208708 | 6,569 | 189 | 89 | 34.756614 | 0.726626 | 0.38636 | 0 | 0.355556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 1 | 0.066667 | false | 0 | 0.055556 | 0 | 0.122222 | 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 |
c304ba71475e19664bbf2d169ef17f9389617a9f | 198 | py | Python | .cheat/data/snippets/python/special_chars.py | Kevin-De-Koninck/dotfiles | b40d695d023e581d8bffcc7800d31ccbb8087211 | [
"MIT"
] | 3 | 2020-10-04T09:51:19.000Z | 2021-02-06T03:29:59.000Z | .cheat/data/snippets/python/special_chars.py | Kevin-De-Koninck/dotfiles | b40d695d023e581d8bffcc7800d31ccbb8087211 | [
"MIT"
] | null | null | null | .cheat/data/snippets/python/special_chars.py | Kevin-De-Koninck/dotfiles | b40d695d023e581d8bffcc7800d31ccbb8087211 | [
"MIT"
] | 1 | 2021-04-23T16:24:29.000Z | 2021-04-23T16:24:29.000Z | print repr("test test\n") # Also prints the \n
print "test test\n".rstrip() # strips all special chars from the string
print " test test ".strip() # strips all trailing and leading white spaces
| 49.5 | 77 | 0.717172 | 32 | 198 | 4.4375 | 0.625 | 0.169014 | 0.126761 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 198 | 3 | 78 | 66 | 0.876543 | 0.525253 | 0 | 0 | 0 | 0 | 0.388889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
c30d871a10d7e1e73b41b083feacf88844e73157 | 3,635 | py | Python | boto3_type_annotations/boto3_type_annotations/route53domains/client.py | cowboygneox/boto3_type_annotations | 450dce1de4e066b939de7eac2ec560ed1a7ddaa2 | [
"MIT"
] | 119 | 2018-12-01T18:20:57.000Z | 2022-02-02T10:31:29.000Z | boto3_type_annotations/boto3_type_annotations/route53domains/client.py | cowboygneox/boto3_type_annotations | 450dce1de4e066b939de7eac2ec560ed1a7ddaa2 | [
"MIT"
] | 15 | 2018-11-16T00:16:44.000Z | 2021-11-13T03:44:18.000Z | boto3_type_annotations/boto3_type_annotations/route53domains/client.py | cowboygneox/boto3_type_annotations | 450dce1de4e066b939de7eac2ec560ed1a7ddaa2 | [
"MIT"
] | 11 | 2019-05-06T05:26:51.000Z | 2021-09-28T15:27:59.000Z | from typing import Optional
from botocore.client import BaseClient
from typing import Dict
from typing import Union
from botocore.paginate import Paginator
from datetime import datetime
from botocore.waiter import Waiter
from typing import List
class Client(BaseClient):
def can_paginate(self, operation_name: str = None):
pass
def check_domain_availability(self, DomainName: str, IdnLangCode: str = None) -> Dict:
pass
def check_domain_transferability(self, DomainName: str, AuthCode: str = None) -> Dict:
pass
def delete_tags_for_domain(self, DomainName: str, TagsToDelete: List) -> Dict:
pass
def disable_domain_auto_renew(self, DomainName: str) -> Dict:
pass
def disable_domain_transfer_lock(self, DomainName: str) -> Dict:
pass
def enable_domain_auto_renew(self, DomainName: str) -> Dict:
pass
def enable_domain_transfer_lock(self, DomainName: str) -> Dict:
pass
def generate_presigned_url(self, ClientMethod: str = None, Params: Dict = None, ExpiresIn: int = None, HttpMethod: str = None):
pass
def get_contact_reachability_status(self, domainName: str = None) -> Dict:
pass
def get_domain_detail(self, DomainName: str) -> Dict:
pass
def get_domain_suggestions(self, DomainName: str, SuggestionCount: int, OnlyAvailable: bool) -> Dict:
pass
def get_operation_detail(self, OperationId: str) -> Dict:
pass
def get_paginator(self, operation_name: str = None) -> Paginator:
pass
def get_waiter(self, waiter_name: str = None) -> Waiter:
pass
def list_domains(self, Marker: str = None, MaxItems: int = None) -> Dict:
pass
def list_operations(self, SubmittedSince: datetime = None, Marker: str = None, MaxItems: int = None) -> Dict:
pass
def list_tags_for_domain(self, DomainName: str) -> Dict:
pass
def register_domain(self, DomainName: str, DurationInYears: int, AdminContact: Dict, RegistrantContact: Dict, TechContact: Dict, IdnLangCode: str = None, AutoRenew: bool = None, PrivacyProtectAdminContact: bool = None, PrivacyProtectRegistrantContact: bool = None, PrivacyProtectTechContact: bool = None) -> Dict:
pass
def renew_domain(self, DomainName: str, CurrentExpiryYear: int, DurationInYears: int = None) -> Dict:
pass
def resend_contact_reachability_email(self, domainName: str = None) -> Dict:
pass
def retrieve_domain_auth_code(self, DomainName: str) -> Dict:
pass
def transfer_domain(self, DomainName: str, DurationInYears: int, AdminContact: Dict, RegistrantContact: Dict, TechContact: Dict, IdnLangCode: str = None, Nameservers: List = None, AuthCode: str = None, AutoRenew: bool = None, PrivacyProtectAdminContact: bool = None, PrivacyProtectRegistrantContact: bool = None, PrivacyProtectTechContact: bool = None) -> Dict:
pass
def update_domain_contact(self, DomainName: str, AdminContact: Dict = None, RegistrantContact: Dict = None, TechContact: Dict = None) -> Dict:
pass
def update_domain_contact_privacy(self, DomainName: str, AdminPrivacy: bool = None, RegistrantPrivacy: bool = None, TechPrivacy: bool = None) -> Dict:
pass
def update_domain_nameservers(self, DomainName: str, Nameservers: List, FIAuthKey: str = None) -> Dict:
pass
def update_tags_for_domain(self, DomainName: str, TagsToUpdate: List = None) -> Dict:
pass
def view_billing(self, Start: datetime = None, End: datetime = None, Marker: str = None, MaxItems: int = None) -> Dict:
pass
| 38.263158 | 365 | 0.699587 | 424 | 3,635 | 5.853774 | 0.212264 | 0.076148 | 0.101934 | 0.078566 | 0.533441 | 0.458501 | 0.395246 | 0.335616 | 0.330782 | 0.259065 | 0 | 0 | 0.209904 | 3,635 | 94 | 366 | 38.670213 | 0.864206 | 0 | 0 | 0.430769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.430769 | false | 0.430769 | 0.123077 | 0 | 0.569231 | 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 |
c320acac59b6be97b7838e2bfa11931c92ab6bf9 | 1,080 | py | Python | test/test_keys.py | zydmayday/pamda | 6740d0294f3bedbeeef3bbc3042a43dceb3239b2 | [
"MIT"
] | 1 | 2022-03-14T07:35:13.000Z | 2022-03-14T07:35:13.000Z | test/test_keys.py | zydmayday/pamda | 6740d0294f3bedbeeef3bbc3042a43dceb3239b2 | [
"MIT"
] | 3 | 2022-03-24T02:30:18.000Z | 2022-03-31T07:46:04.000Z | test/test_keys.py | zydmayday/pamda | 6740d0294f3bedbeeef3bbc3042a43dceb3239b2 | [
"MIT"
] | null | null | null |
import unittest
import ramda as R
"""
https://github.com/ramda/ramda/blob/master/test/keys.js
"""
obj = {'a': 100, 'b': [1, 2, 3], 'c': {'x': 200, 'y': 300}, 'd': 'D', 'e': None}
class A:
def __init__(self):
self.a = 'a'
class B(A):
def __init__(self):
self.b = 'b'
class C(A):
def __init__(self):
super().__init__()
self.c = 'c'
class TestKeys(unittest.TestCase):
def test_returns_an_array_of_the_given_object_own_keys(self):
self.assertEqual(['a', 'b', 'c', 'd', 'e'], R.keys(obj))
def test_works_with_attribute_override(self):
a, b, c = A(), B(), C()
self.assertEqual(['a'], R.keys(a))
self.assertEqual(['b'], R.keys(b))
self.assertEqual(['a', 'c'], R.keys(c))
def test_works_with_primitives(self):
self.assertEqual([], R.keys(None))
self.assertEqual([], R.keys(55))
self.assertEqual([], R.keys('foo'))
self.assertEqual([], R.keys(True))
self.assertEqual([], R.keys(False))
self.assertEqual([], R.keys([]))
self.assertEqual([], R.keys({}))
if __name__ == '__main__':
unittest.main()
| 21.176471 | 80 | 0.596296 | 162 | 1,080 | 3.728395 | 0.345679 | 0.273179 | 0.18543 | 0.231788 | 0.05298 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015713 | 0.175 | 1,080 | 50 | 81 | 21.6 | 0.662177 | 0 | 0 | 0.096774 | 0 | 0 | 0.030512 | 0 | 0 | 0 | 0 | 0 | 0.354839 | 1 | 0.193548 | false | 0 | 0.064516 | 0 | 0.387097 | 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 |
c330e784330c39013feebaab317341baa7c97aa9 | 22,232 | py | Python | PyFin/tests/Analysis/testCrossSectionValueHolders.py | rpatil524/Finance-Python | 687538015eb597575b872cd652aada5047e84ef3 | [
"MIT"
] | 325 | 2017-11-02T19:08:46.000Z | 2022-03-22T21:00:45.000Z | PyFin/tests/Analysis/testCrossSectionValueHolders.py | smileboy510/Finance-Python | 96d9984f1a9bb7b02c057c8e056a993b1c211945 | [
"MIT"
] | 6 | 2019-05-22T07:23:02.000Z | 2021-06-23T11:27:57.000Z | PyFin/tests/Analysis/testCrossSectionValueHolders.py | smileboy510/Finance-Python | 96d9984f1a9bb7b02c057c8e056a993b1c211945 | [
"MIT"
] | 78 | 2017-11-27T01:27:48.000Z | 2022-03-26T15:34:09.000Z | # -*- coding: utf-8 -*-
u"""
Created on 2017-1-6
@author: cheng.li
"""
import unittest
import numpy as np
import pandas as pd
from PyFin.Enums import Factors
from PyFin.Analysis.SecurityValueHolders import SecurityLatestValueHolder
from PyFin.Analysis.CrossSectionValueHolders import CSRankedSecurityValueHolder
from PyFin.Analysis.CrossSectionValueHolders import CSTopNSecurityValueHolder
from PyFin.Analysis.CrossSectionValueHolders import CSBottomNSecurityValueHolder
from PyFin.Analysis.CrossSectionValueHolders import CSTopNPercentileSecurityValueHolder
from PyFin.Analysis.CrossSectionValueHolders import CSBottomNPercentileSecurityValueHolder
from PyFin.Analysis.CrossSectionValueHolders import CSAverageSecurityValueHolder
from PyFin.Analysis.CrossSectionValueHolders import CSAverageAdjustedSecurityValueHolder
from PyFin.Analysis.CrossSectionValueHolders import CSZScoreSecurityValueHolder
from PyFin.Analysis.CrossSectionValueHolders import CSFillNASecurityValueHolder
from PyFin.Analysis.CrossSectionValueHolders import CSPercentileSecurityValueHolder
from PyFin.Analysis.CrossSectionValueHolders import CSResidueSecurityValueHolder
class TestCrossSectionValueHolder(unittest.TestCase):
def setUp(self):
np.random.seed(0)
sample1 = np.random.randn(1000, 6)
sample2 = np.random.randn(1000, 6)
self.datas = {'aapl': {'close': sample1[:, 0], 'open': sample1[:, 1]},
'ibm': {'close': sample2[:, 0], 'open': sample2[:, 1]},
'goog': {'close': sample1[:, 2], 'open': sample1[:, 3]},
'baba': {'close': sample2[:, 2], 'open': sample2[:, 3]},
'tela': {'close': sample1[:, 4], 'open': sample1[:, 5]},
'nflx': {'close': sample2[:, 4], 'open': sample2[:, 5]}
}
def testCSRankedSecurityValueHolderWithSymbolName(self):
benchmark = SecurityLatestValueHolder(x='close')
rankHolder = CSRankedSecurityValueHolder('close')
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i]},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i]}}
benchmark.push(data)
rankHolder.push(data)
benchmarkValues = benchmark.value
np.testing.assert_array_almost_equal(benchmarkValues.rank().values, rankHolder.value.values)
def testCSRankedSecurityValueHolder(self):
benchmark = SecurityLatestValueHolder(x='close')
rankHolder = CSRankedSecurityValueHolder(benchmark)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i]},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i]}}
benchmark.push(data)
rankHolder.push(data)
benchmarkValues = benchmark.value
np.testing.assert_array_almost_equal(benchmarkValues.rank().values, rankHolder.value.values)
def testCSTopNSecurityValueHolder(self):
benchmark = SecurityLatestValueHolder(x='close')
n = 2
topnHolder = CSTopNSecurityValueHolder(benchmark, n)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i]},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i]},
'goog': {Factors.CLOSE: self.datas['goog'][Factors.CLOSE][i],
Factors.OPEN: self.datas['goog'][Factors.OPEN][i]},
'baba': {Factors.CLOSE: self.datas['baba'][Factors.CLOSE][i],
Factors.OPEN: self.datas['baba'][Factors.OPEN][i]}}
benchmark.push(data)
topnHolder.push(data)
benchmarkValues = benchmark.value
np.testing.assert_array_almost_equal((-benchmarkValues).rank().values <= n, topnHolder.value.values)
def testCSBottomNSecurityValueHolder(self):
benchmark = SecurityLatestValueHolder(x='close')
n = 2
topnHolder = CSBottomNSecurityValueHolder(benchmark, n)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i]},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i]},
'goog': {Factors.CLOSE: self.datas['goog'][Factors.CLOSE][i],
Factors.OPEN: self.datas['goog'][Factors.OPEN][i]},
'baba': {Factors.CLOSE: self.datas['baba'][Factors.CLOSE][i],
Factors.OPEN: self.datas['baba'][Factors.OPEN][i]}}
benchmark.push(data)
topnHolder.push(data)
benchmarkValues = benchmark.value
np.testing.assert_array_almost_equal(benchmarkValues.rank().values <= n, topnHolder.value.values)
def testCSRankedSecurityValueHolderWithGroups(self):
benchmark = SecurityLatestValueHolder(x='close')
groups = SecurityLatestValueHolder(x='ind')
rankHolder = CSRankedSecurityValueHolder(benchmark, groups)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i],
'ind': 1.},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i],
'ind': 1.},
'goog': {Factors.CLOSE: self.datas['goog'][Factors.CLOSE][i],
Factors.OPEN: self.datas['goog'][Factors.OPEN][i],
'ind': 2.},
'baba': {Factors.CLOSE: self.datas['baba'][Factors.CLOSE][i],
Factors.OPEN: self.datas['baba'][Factors.OPEN][i],
'ind': 2.}}
benchmark.push(data)
rankHolder.push(data)
benchmarkValues = benchmark.value
groups = {'aapl': 1., 'ibm': 1., 'goog': 2., 'baba': 2.}
expected_rank = pd.Series(benchmarkValues.to_dict()).groupby(groups).rank().values
np.testing.assert_array_almost_equal(expected_rank, rankHolder.value.values)
def testCSAverageSecurityValueHolder(self):
benchmark = SecurityLatestValueHolder(x='close')
meanHolder = CSAverageSecurityValueHolder(benchmark)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i]},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i]}}
benchmark.push(data)
meanHolder.push(data)
benchmarkValues = benchmark.value
np.testing.assert_array_almost_equal(benchmarkValues.values.mean(), meanHolder.value.values)
def testCSAverageSecurityValueHolderWithGroup(self):
benchmark = SecurityLatestValueHolder(x='close')
groups = SecurityLatestValueHolder(x='ind')
meanHolder = CSAverageSecurityValueHolder(benchmark, groups)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i],
'ind': 1.},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i],
'ind': 1.},
'goog': {Factors.CLOSE: self.datas['goog'][Factors.CLOSE][i],
Factors.OPEN: self.datas['goog'][Factors.OPEN][i],
'ind': 2.},
'baba': {Factors.CLOSE: self.datas['baba'][Factors.CLOSE][i],
Factors.OPEN: self.datas['baba'][Factors.OPEN][i],
'ind': 2.}}
benchmark.push(data)
meanHolder.push(data)
benchmarkValues = benchmark.value
groups = {'aapl': 1., 'ibm': 1., 'goog': 2., 'baba': 2.}
expected_mean = pd.Series(benchmarkValues.to_dict()).groupby(groups).mean()
calculated_mean = meanHolder.value
for name in calculated_mean.index():
if name in ['aapl', 'ibm']:
self.assertAlmostEqual(calculated_mean[name], expected_mean[1])
else:
self.assertAlmostEqual(calculated_mean[name], expected_mean[2])
def testCSPercentileSecurityValueHolder(self):
benchmark = SecurityLatestValueHolder(x='close')
perHolder = CSPercentileSecurityValueHolder(benchmark)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i]},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i]},
'goog': {Factors.CLOSE: self.datas['goog'][Factors.CLOSE][i],
Factors.OPEN: self.datas['goog'][Factors.OPEN][i]},
'baba': {Factors.CLOSE: self.datas['baba'][Factors.CLOSE][i],
Factors.OPEN: self.datas['baba'][Factors.OPEN][i]}
}
benchmark.push(data)
perHolder.push(data)
benchmarkValues = benchmark.value
np.testing.assert_array_almost_equal(benchmarkValues.rank().values / len(data), perHolder.value.values)
def testCSTopNPercentileSecurityValueHolder(self):
benchmark = SecurityLatestValueHolder(x='close')
n = 0.3
perHolder = CSTopNPercentileSecurityValueHolder(benchmark, n)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i]},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i]},
'goog': {Factors.CLOSE: self.datas['goog'][Factors.CLOSE][i],
Factors.OPEN: self.datas['goog'][Factors.OPEN][i]},
'baba': {Factors.CLOSE: self.datas['baba'][Factors.CLOSE][i],
Factors.OPEN: self.datas['baba'][Factors.OPEN][i]}
}
benchmark.push(data)
perHolder.push(data)
benchmarkValues = benchmark.value
np.testing.assert_array_almost_equal(((-benchmarkValues).rank().values / len(data)) <= n,
perHolder.value.values)
def testCSBottomNPercentileSecurityValueHolder(self):
benchmark = SecurityLatestValueHolder(x='close')
n = 0.3
perHolder = CSBottomNPercentileSecurityValueHolder(benchmark, n)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i]},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i]},
'goog': {Factors.CLOSE: self.datas['goog'][Factors.CLOSE][i],
Factors.OPEN: self.datas['goog'][Factors.OPEN][i]},
'baba': {Factors.CLOSE: self.datas['baba'][Factors.CLOSE][i],
Factors.OPEN: self.datas['baba'][Factors.OPEN][i]}
}
benchmark.push(data)
perHolder.push(data)
benchmarkValues = benchmark.value
np.testing.assert_array_almost_equal((benchmarkValues.rank().values / len(data)) <= n,
perHolder.value.values)
def testCSPercentileSecurityValueHolderWithGroups(self):
benchmark = SecurityLatestValueHolder(x='close')
groups = SecurityLatestValueHolder(x='ind')
perHolder = CSPercentileSecurityValueHolder(benchmark, groups)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i],
'ind': 1.},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i],
'ind': 1.},
'goog': {Factors.CLOSE: self.datas['goog'][Factors.CLOSE][i],
Factors.OPEN: self.datas['goog'][Factors.OPEN][i],
'ind': 2.},
'baba': {Factors.CLOSE: self.datas['baba'][Factors.CLOSE][i],
Factors.OPEN: self.datas['baba'][Factors.OPEN][i],
'ind': 2.}}
benchmark.push(data)
perHolder.push(data)
benchmarkValues = benchmark.value
groups = {'aapl': 1., 'ibm': 1., 'goog': 2., 'baba': 2.}
expected_rank = pd.Series(benchmarkValues.to_dict()).groupby(groups) \
.transform(lambda x: x.rank().values / len(x))
np.testing.assert_array_almost_equal(expected_rank, perHolder.value.values)
def testCSAverageAdjustedSecurityValueHolder(self):
benchmark = SecurityLatestValueHolder(x='close')
meanAdjustedHolder = CSAverageAdjustedSecurityValueHolder(benchmark)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i]},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i]},
}
benchmark.push(data)
meanAdjustedHolder.push(data)
benchmarkValues = benchmark.value
np.testing.assert_array_almost_equal((benchmarkValues - benchmarkValues.mean()).values, meanAdjustedHolder.value.values)
def testCSAverageAdjustedSecurityValueHolderWithGroups(self):
benchmark = SecurityLatestValueHolder(x='close')
groups = SecurityLatestValueHolder(x='ind')
meanAdjustedHolder = CSAverageAdjustedSecurityValueHolder(benchmark, groups)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i],
'ind': 1.},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i],
'ind': 1.},
'goog': {Factors.CLOSE: self.datas['goog'][Factors.CLOSE][i],
Factors.OPEN: self.datas['goog'][Factors.OPEN][i],
'ind': 2.},
'baba': {Factors.CLOSE: self.datas['baba'][Factors.CLOSE][i],
Factors.OPEN: self.datas['baba'][Factors.OPEN][i],
'ind': 2.}}
benchmark.push(data)
meanAdjustedHolder.push(data)
benchmarkValues = benchmark.value
groups = {'aapl': 1., 'ibm': 1., 'goog': 2., 'baba': 2.}
expected_rank = pd.Series(benchmarkValues.to_dict()).groupby(groups) \
.transform(lambda x: x - x.mean())
np.testing.assert_array_almost_equal(expected_rank, meanAdjustedHolder.value.values)
def testCSZscoreSecurityValueHolder(self):
keys = list(range(1, 11))
values = list(range(10, 0, -1))
data = {}
for i, k in enumerate(keys):
data[k] = {}
data[k]['close'] = values[i]
quantile_value = CSZScoreSecurityValueHolder('close')
quantile_value.push(data)
calculated = quantile_value.value
data = np.linspace(10., 1., 10)
expected = (data - data.mean()) / data.std()
np.testing.assert_array_almost_equal(expected, calculated.values)
def testCSFillNASecurityValueHolder(self):
benchmark = SecurityLatestValueHolder(x='close')
groups = SecurityLatestValueHolder(x='ind')
meanAdjustedHolder = CSFillNASecurityValueHolder(benchmark, groups)
def cal_func(x):
x[np.isnan(x)] = np.nanmean(x)
return x
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i],
'ind': 1.},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i],
'ind': 1.},
'tela': {Factors.CLOSE: np.nan,
Factors.OPEN: self.datas['tela'][Factors.OPEN][i],
'ind': 1.},
'goog': {Factors.CLOSE: self.datas['goog'][Factors.CLOSE][i],
Factors.OPEN: self.datas['goog'][Factors.OPEN][i],
'ind': 2.},
'baba': {Factors.CLOSE: np.nan,
Factors.OPEN: self.datas['baba'][Factors.OPEN][i],
'ind': 2.},
'nflx': {Factors.CLOSE: self.datas['nflx'][Factors.CLOSE][i],
Factors.OPEN: self.datas['nflx'][Factors.OPEN][i],
'ind': 2.}
}
benchmark.push(data)
meanAdjustedHolder.push(data)
benchmarkValues = benchmark.value
groups = {'aapl': 1., 'ibm': 1., 'tela': 1., 'goog': 2., 'baba': 2., 'nflx': 2.}
expected_rank = pd.Series(benchmarkValues.to_dict()).groupby(groups) \
.transform(cal_func)
np.testing.assert_array_almost_equal(expected_rank, meanAdjustedHolder.value.values)
def testCSZscoreSecurityValueHolderWithGroups(self):
benchmark = SecurityLatestValueHolder(x='close')
groups = SecurityLatestValueHolder(x='ind')
meanAdjustedHolder = CSZScoreSecurityValueHolder(benchmark, groups)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i],
'ind': 1.},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i],
'ind': 1.},
'goog': {Factors.CLOSE: self.datas['goog'][Factors.CLOSE][i],
Factors.OPEN: self.datas['goog'][Factors.OPEN][i],
'ind': 2.},
'baba': {Factors.CLOSE: self.datas['baba'][Factors.CLOSE][i],
Factors.OPEN: self.datas['baba'][Factors.OPEN][i],
'ind': 2.}}
benchmark.push(data)
meanAdjustedHolder.push(data)
benchmarkValues = benchmark.value
groups = {'aapl': 1., 'ibm': 1., 'goog': 2., 'baba': 2.}
expected_rank = pd.Series(benchmarkValues.to_dict()).groupby(groups) \
.transform(lambda x: (x - x.mean()) / x.std(ddof=0))
np.testing.assert_array_almost_equal(expected_rank, meanAdjustedHolder.value.values)
def testCSZResidueSecurityValueHolder(self):
y = SecurityLatestValueHolder(x='close')
x = SecurityLatestValueHolder(x='open')
res = CSResidueSecurityValueHolder(y, x)
for i in range(len(self.datas['aapl']['close'])):
data = {'aapl': {Factors.CLOSE: self.datas['aapl'][Factors.CLOSE][i],
Factors.OPEN: self.datas['aapl'][Factors.OPEN][i]},
'ibm': {Factors.CLOSE: self.datas['ibm'][Factors.CLOSE][i],
Factors.OPEN: self.datas['ibm'][Factors.OPEN][i]}}
y.push(data)
x.push(data)
res.push(data)
calculated = res.value.values
y_values = y.value.values
x_values = x.value.values
x_values = np.concatenate([np.ones(shape=(len(x_values), 1)), x_values.reshape(-1, 1)], axis=1)
beta = np.dot(np.linalg.inv(np.dot(x_values.T, x_values)), np.dot(x_values.T, y_values.reshape(-1, 1)))
expected = y_values - np.dot(x_values, beta).flatten()
np.testing.assert_array_almost_equal(calculated, expected)
| 54.092457 | 132 | 0.554111 | 2,169 | 22,232 | 5.639465 | 0.069156 | 0.093443 | 0.068672 | 0.091563 | 0.767086 | 0.706099 | 0.703564 | 0.672662 | 0.653041 | 0.61985 | 0 | 0.007883 | 0.298174 | 22,232 | 410 | 133 | 54.22439 | 0.776069 | 0.002744 | 0 | 0.657303 | 0 | 0 | 0.051302 | 0 | 0 | 0 | 0 | 0 | 0.050562 | 1 | 0.053371 | false | 0 | 0.044944 | 0 | 0.103933 | 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 |
c3517f3c964c4b6cd2d4ae2fb1f67ffdeb6a2fa7 | 1,205 | py | Python | screens.py | scarletspider616/setup-wizard | 48e306ba7af30f26e402a845c62c1f9ab52a5727 | [
"MIT"
] | null | null | null | screens.py | scarletspider616/setup-wizard | 48e306ba7af30f26e402a845c62c1f9ab52a5727 | [
"MIT"
] | null | null | null | screens.py | scarletspider616/setup-wizard | 48e306ba7af30f26e402a845c62c1f9ab52a5727 | [
"MIT"
] | null | null | null | #############################################################################
# screens.py
#
# By: Joey-Michael Fallone
#
# This contains class declarations for screen types used in Wizard.py
# as well as some internal operations
#
#############################################################################
from kivy.uix.screenmanager import Screen
from kivy.graphics.vertex_instructions import Line
from kivy.graphics.context_instructions import Color
from kivy.uix.progressbar import ProgressBar
class WelcomeScreen(Screen):
welcome_label_text = "Click next to get started"
def on_exit(self):
pass # shutdown code will go here eventually
def on_next(self):
pass
class InputScreen(Screen):
input_label_text = "Please enter the following information"
def on_back(self):
pass
def on_next(self):
pass
class ProgressScreen(Screen):
pb = ProgressBar(max=1000)
pb.value = 500
def on_back(self):
pass
def on_next(self):
pass
class TextScreen(Screen):
text_label_text = "Enter the text to display here"
def on_back(self):
pass
def on_next(self):
pass
class FinalScreen(Screen):
final_label_text = "Finsihed!"
def on_back(self):
pass
def on_exit(self):
pass | 20.083333 | 77 | 0.657261 | 156 | 1,205 | 4.948718 | 0.461538 | 0.064767 | 0.046632 | 0.067358 | 0.246114 | 0.208549 | 0.180052 | 0.151554 | 0.151554 | 0.151554 | 0 | 0.006796 | 0.145228 | 1,205 | 60 | 78 | 20.083333 | 0.742718 | 0.146888 | 0 | 0.571429 | 0 | 0 | 0.117919 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.285714 | 0.114286 | 0 | 0.685714 | 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 |
c353f9720cf1f3e7014acf5b034ce332e2dae58d | 137 | py | Python | torchinfo/__init__.py | e-dorigatti/torchinfo | 9fa0e677fb7002e89afd5b1bb372fe8c1dd813d6 | [
"MIT"
] | 1 | 2021-03-14T06:25:39.000Z | 2021-03-14T06:25:39.000Z | torchinfo/__init__.py | e-dorigatti/torchinfo | 9fa0e677fb7002e89afd5b1bb372fe8c1dd813d6 | [
"MIT"
] | null | null | null | torchinfo/__init__.py | e-dorigatti/torchinfo | 9fa0e677fb7002e89afd5b1bb372fe8c1dd813d6 | [
"MIT"
] | null | null | null | """ torchinfo """
from .model_statistics import ModelStatistics
from .torchinfo import summary
__all__ = ("ModelStatistics", "summary")
| 22.833333 | 45 | 0.766423 | 13 | 137 | 7.692308 | 0.615385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116788 | 137 | 5 | 46 | 27.4 | 0.826446 | 0.065693 | 0 | 0 | 0 | 0 | 0.183333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
c362e72154d2dd19a12e6f8e0180900f68bc8223 | 2,664 | py | Python | generated/uasyncio/__init__.py | cpwood/Pico-Stub | 176af2962b4701805c81afed2e540d39e1adad82 | [
"Apache-2.0"
] | 19 | 2021-01-25T23:56:09.000Z | 2022-02-21T13:55:16.000Z | generated/uasyncio/__init__.py | cpwood/Pico-Stub | 176af2962b4701805c81afed2e540d39e1adad82 | [
"Apache-2.0"
] | 18 | 2021-02-06T09:03:09.000Z | 2021-10-04T16:36:35.000Z | generated/uasyncio/__init__.py | cpwood/Pico-Stub | 176af2962b4701805c81afed2e540d39e1adad82 | [
"Apache-2.0"
] | 6 | 2021-01-26T08:41:47.000Z | 2021-04-27T11:33:33.000Z | """
Module: 'uasyncio.__init__' on micropython-rp2-1.15
"""
# MCU: {'family': 'micropython', 'sysname': 'rp2', 'version': '1.15.0', 'build': '', 'mpy': 5637, 'port': 'rp2', 'platform': 'rp2', 'name': 'micropython', 'arch': 'armv7m', 'machine': 'Raspberry Pi Pico with RP2040', 'nodename': 'rp2', 'ver': '1.15', 'release': '1.15.0'}
# Stubber: 1.3.9
class CancelledError:
''
class Event:
''
def clear():
pass
def is_set():
pass
def set():
pass
wait = None
class IOQueue:
''
def _dequeue():
pass
def _enqueue():
pass
def queue_read():
pass
def queue_write():
pass
def remove():
pass
def wait_io_event():
pass
class Lock:
''
acquire = None
def locked():
pass
def release():
pass
class Loop:
''
_exc_handler = None
def call_exception_handler():
pass
def close():
pass
def create_task():
pass
def default_exception_handler():
pass
def get_exception_handler():
pass
def run_forever():
pass
def run_until_complete():
pass
def set_exception_handler():
pass
def stop():
pass
class SingletonGenerator:
''
class StreamReader:
''
aclose = None
awrite = None
awritestr = None
def close():
pass
drain = None
def get_extra_info():
pass
read = None
readexactly = None
readline = None
wait_closed = None
def write():
pass
class StreamWriter:
''
aclose = None
awrite = None
awritestr = None
def close():
pass
drain = None
def get_extra_info():
pass
read = None
readexactly = None
readline = None
wait_closed = None
def write():
pass
class Task:
''
class TaskQueue:
''
def peek():
pass
def pop_head():
pass
def push_head():
pass
def push_sorted():
pass
def remove():
pass
class ThreadSafeFlag:
''
def ioctl():
pass
def set():
pass
wait = None
class TimeoutError:
''
_attrs = None
def create_task():
pass
def current_task():
pass
gather = None
def get_event_loop():
pass
def new_event_loop():
pass
open_connection = None
def run():
pass
def run_until_complete():
pass
select = None
def sleep():
pass
def sleep_ms():
pass
start_server = None
sys = None
def ticks():
pass
def ticks_add():
pass
def ticks_diff():
pass
wait_for = None
def wait_for_ms():
pass
| 13.058824 | 271 | 0.541667 | 303 | 2,664 | 4.594059 | 0.349835 | 0.135776 | 0.057471 | 0.066092 | 0.306034 | 0.277299 | 0.238506 | 0.199713 | 0.199713 | 0.199713 | 0 | 0.017796 | 0.346096 | 2,664 | 203 | 272 | 13.123153 | 0.781286 | 0.126502 | 0 | 0.638298 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.319149 | false | 0.319149 | 0 | 0 | 0.546099 | 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 |
c36c8528e3f3e2f0d4c81f6bbc0aff410f6310e6 | 1,638 | py | Python | py_client/aidm/aidm_table_classes.py | sma-software/openviriato.algorithm-platform.py-client | 73d4cf89aa6f4d02ab15b5504d92107848742325 | [
"Apache-2.0"
] | 2 | 2021-06-21T06:50:29.000Z | 2021-06-30T15:58:02.000Z | py_client/aidm/aidm_table_classes.py | sma-software/openviriato.algorithm-platform.py-client | 73d4cf89aa6f4d02ab15b5504d92107848742325 | [
"Apache-2.0"
] | null | null | null | py_client/aidm/aidm_table_classes.py | sma-software/openviriato.algorithm-platform.py-client | 73d4cf89aa6f4d02ab15b5504d92107848742325 | [
"Apache-2.0"
] | null | null | null | from typing import List
from py_client.aidm.aidm_table_cell_classes import TableCellDataType, _TableCell
class TableColumnDefinition:
__key: str
__header: _TableCell
__header_data_type: TableCellDataType
__column_data_type: TableCellDataType
def __init__(self,
key: str,
header: _TableCell,
header_data_type: TableCellDataType,
column_data_type: TableCellDataType):
self.__key = key
self.__header = header
self.__column_data_type = column_data_type
self.__header_data_type = header_data_type
@property
def key(self) -> str:
return self.__key
@property
def header(self) -> _TableCell:
return self.__header
@property
def header_data_type(self) -> TableCellDataType:
return self.__header_data_type
@property
def column_data_type(self) -> TableCellDataType:
return self.__column_data_type
class TableDefinition:
__columns: List[TableColumnDefinition]
__name: str
def __init__(self, name: str, columns: List[TableColumnDefinition]):
self.__name = name
self.__columns = columns
@property
def name(self) -> str:
return self.__name
@property
def columns(self) -> List[TableColumnDefinition]:
return self.__columns
class TableRow:
__cells: List[_TableCell]
def __init__(self, cells: List[_TableCell]):
self.__cells = cells
@property
def cells(self) -> List[_TableCell]:
return self.__cells
| 25.2 | 81 | 0.641636 | 165 | 1,638 | 5.830303 | 0.181818 | 0.099792 | 0.087318 | 0.043659 | 0.305613 | 0.253638 | 0.172557 | 0.172557 | 0.172557 | 0.172557 | 0 | 0 | 0.290598 | 1,638 | 64 | 82 | 25.59375 | 0.827883 | 0 | 0 | 0.148936 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.212766 | false | 0 | 0.042553 | 0.148936 | 0.617021 | 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 |
c378d1401b2f15148cb6606fea32e0cc0e1ed36f | 342 | py | Python | common/utils/manopth/test/test_demo.py | Alan-delete/I2L-MeshNet_RELEASE | 22d63becc6f6e558e5180a8718dbaa8dde1cc6e5 | [
"MIT"
] | 544 | 2020-07-15T08:44:01.000Z | 2022-03-31T07:53:38.000Z | common/utils/manopth/test/test_demo.py | CV-IP/I2L-MeshNet_RELEASE | 2749441e03ae77d42837a4d8f0287e537d5e768c | [
"MIT"
] | 110 | 2020-08-11T19:22:31.000Z | 2022-03-21T10:54:34.000Z | common/utils/manopth/test/test_demo.py | CV-IP/I2L-MeshNet_RELEASE | 2749441e03ae77d42837a4d8f0287e537d5e768c | [
"MIT"
] | 127 | 2020-08-11T05:12:19.000Z | 2022-03-24T02:42:59.000Z | import torch
from manopth.demo import generate_random_hand
def test_generate_random_hand():
batch_size = 3
hand_info = generate_random_hand(batch_size=batch_size, ncomps=6)
verts = hand_info['verts']
joints = hand_info['joints']
assert verts.shape == (batch_size, 778, 3)
assert joints.shape == (batch_size, 21, 3)
| 26.307692 | 69 | 0.722222 | 50 | 342 | 4.64 | 0.44 | 0.193966 | 0.232759 | 0.198276 | 0.232759 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031915 | 0.175439 | 342 | 12 | 70 | 28.5 | 0.79078 | 0 | 0 | 0 | 1 | 0 | 0.032164 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 1 | 0.111111 | false | 0 | 0.222222 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5edf634879d357bb0cd5272590fb39f1c497592d | 124 | py | Python | mttools/Core.py | nog642/MathTools | 46486a56992dfff3b33d52bea6f6dec5d5c0c3cf | [
"MIT"
] | 8 | 2020-07-24T20:32:55.000Z | 2020-08-01T16:53:13.000Z | mttools/Core.py | nog642/MathTools | 46486a56992dfff3b33d52bea6f6dec5d5c0c3cf | [
"MIT"
] | 10 | 2019-12-23T19:28:26.000Z | 2020-09-04T15:48:07.000Z | mttools/Core.py | nog642/MathTools | 46486a56992dfff3b33d52bea6f6dec5d5c0c3cf | [
"MIT"
] | 5 | 2020-07-24T19:34:47.000Z | 2020-08-01T13:19:44.000Z | from math import inf
def check_inf(val):
if abs(val) == 9.999999999999999e29:
return inf * val
return val
| 15.5 | 40 | 0.645161 | 18 | 124 | 4.388889 | 0.666667 | 0.151899 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 0.274194 | 124 | 7 | 41 | 17.714286 | 0.677778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
5ee32a60baea5edb5d1560ef282789e5d22555c8 | 248 | py | Python | html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/resources/slow.py | meyerweb/wpt | f04261533819893c71289614c03434c06856c13e | [
"BSD-3-Clause"
] | 14,668 | 2015-01-01T01:57:10.000Z | 2022-03-31T23:33:32.000Z | html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/resources/slow.py | meyerweb/wpt | f04261533819893c71289614c03434c06856c13e | [
"BSD-3-Clause"
] | 7,642 | 2018-05-28T09:38:03.000Z | 2022-03-31T20:55:48.000Z | html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/resources/slow.py | meyerweb/wpt | f04261533819893c71289614c03434c06856c13e | [
"BSD-3-Clause"
] | 5,941 | 2015-01-02T11:32:21.000Z | 2022-03-31T16:35:46.000Z | # Like /common/slow.py except with text/html content-type so that it won't
# trigger strange parts of the <iframe> navigate algorithm.
import time
def main(request, response):
time.sleep(2)
return 200, [["Content-Type", "text/html"]], b''
| 31 | 74 | 0.705645 | 39 | 248 | 4.487179 | 0.871795 | 0.091429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019231 | 0.16129 | 248 | 7 | 75 | 35.428571 | 0.822115 | 0.524194 | 0 | 0 | 0 | 0 | 0.182609 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
5ef938ae17a62504ea937333810371f5c70dc958 | 622 | py | Python | python_modules/libraries/dagster-aws/dagster_aws/s3/__init__.py | bitdotioinc/dagster | 4fe395a37b206b1a48b956fa5dd72bf698104cca | [
"Apache-2.0"
] | 2 | 2021-06-21T17:50:26.000Z | 2021-06-21T19:14:23.000Z | python_modules/libraries/dagster-aws/dagster_aws/s3/__init__.py | bitdotioinc/dagster | 4fe395a37b206b1a48b956fa5dd72bf698104cca | [
"Apache-2.0"
] | 7 | 2022-03-16T06:55:04.000Z | 2022-03-18T07:03:25.000Z | python_modules/libraries/dagster-aws/dagster_aws/s3/__init__.py | bitdotioinc/dagster | 4fe395a37b206b1a48b956fa5dd72bf698104cca | [
"Apache-2.0"
] | 1 | 2021-08-18T17:21:57.000Z | 2021-08-18T17:21:57.000Z | from .compute_log_manager import S3ComputeLogManager
from .file_cache import S3FileCache, s3_file_cache
from .file_manager import S3FileHandle, S3FileManager
from .intermediate_storage import S3IntermediateStorage
from .object_store import S3ObjectStore
from .resources import s3_file_manager, s3_resource
from .s3_fake_resource import S3FakeSession, create_s3_fake_resource
from .solids import S3Coordinate, file_handle_to_s3
from .system_storage import (
s3_intermediate_storage,
s3_plus_default_intermediate_storage_defs,
s3_plus_default_storage_defs,
s3_system_storage,
)
from .utils import S3Callback
| 38.875 | 68 | 0.860129 | 81 | 622 | 6.197531 | 0.407407 | 0.113546 | 0.055777 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034173 | 0.106109 | 622 | 15 | 69 | 41.466667 | 0.868705 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
5eff83ec8067bbdbbc11c447f0e6eac0a558bb30 | 5,811 | py | Python | faker/providers/phone_number/__init__.py | jacksmith15/faker | bc5dda1983e4d055aa2698ccf0806a462cb8370e | [
"MIT"
] | 1 | 2022-02-16T23:14:19.000Z | 2022-02-16T23:14:19.000Z | faker/providers/phone_number/__init__.py | jacksmith15/faker | bc5dda1983e4d055aa2698ccf0806a462cb8370e | [
"MIT"
] | 33 | 2020-12-09T16:49:15.000Z | 2022-01-04T22:03:10.000Z | faker/providers/phone_number/__init__.py | jacksmith15/faker | bc5dda1983e4d055aa2698ccf0806a462cb8370e | [
"MIT"
] | 3 | 2022-02-07T18:18:54.000Z | 2022-03-11T22:09:01.000Z | from .. import BaseProvider, ElementsType
# Data source
#
# The country codes in this provider comes from the following source:
# List of country calling codes
# https://en.wikipedia.org/wiki/List_of_country_calling_codes
#
# Data was collected from the alphabetical listing by country or region
localized = True
class Provider(BaseProvider):
country_calling_codes: ElementsType = (
"+93",
"+358 18",
"+355",
"+213",
"+1 684",
"+376",
"+244",
"+1 264",
"+1 268",
"+54",
"+374",
"+297",
"+247",
"+61",
"+672 1",
"+672",
"+43",
"+994",
"+1 242",
"+973",
"+880",
"+1 246",
"+1 268",
"+375",
"+32",
"+501",
"+229",
"+1 441",
"+975",
"+591",
"+599 7",
"+387",
"+267",
"+55",
"+246",
"+1 284",
"+673",
"+359",
"+226",
"+257",
"+855",
"+237",
"+1",
"+238",
"+599 3",
"+599 4",
"+599 7",
"+1 345",
"+236",
"+235",
"+64",
"+56",
"+86",
"+61 89164",
"+61 89162",
"+57",
"+269",
"+242",
"+243",
"+682",
"+506",
"+385",
"+53",
"+599 9",
"+357",
"+420",
"+45",
"+246",
"+253",
"+1 767",
"+1 809",
"+1 829",
"+1 849",
"+670",
"+56",
"+593",
"+20",
"+503",
"+881 2",
"+881 3",
"+882 13",
"+240",
"+291",
"+372",
"+268",
"+251",
"+500",
"+298",
"+679",
"+358",
"+33",
"+596",
"+594",
"+689",
"+241",
"+220",
"+995",
"+49",
"+233",
"+350",
"+881",
"+881 8",
"+881 9",
"+30",
"+299",
"+1 473",
"+590",
"+1 671",
"+502",
"+44 1481",
"+44 7781",
"+44 7839",
"+44 7911",
"+224",
"+245",
"+592",
"+509",
"+504",
"+852",
"+36",
"+354",
"+881 0",
"+881 1",
"+91",
"+62",
"+870",
"+800",
"+882",
"+883",
"+979",
"+808",
"+98",
"+964",
"+353",
"+881 6",
"+881 7",
"+44 1624",
"+44 7524",
"+44 7624",
"+44 7924",
"+972",
"+39",
"+225",
"+1 876",
"+47 79",
"+81",
"+44 1534",
"+962",
"+7 6",
"+7 7",
"+254",
"+686",
"+850",
"+82",
"+383",
"+965",
"+996",
"+856",
"+371",
"+961",
"+266",
"+231",
"+218",
"+423",
"+370",
"+352",
"+853",
"+261",
"+265",
"+60",
"+960",
"+223",
"+356",
"+692",
"+596",
"+222",
"+230",
"+262 269",
"+262 639",
"+52",
"+691",
"+1 808",
"+373",
"+377",
"+976",
"+382",
"+1 664",
"+212",
"+258",
"+95",
"+374 47",
"+374 97",
"+264",
"+674",
"+977",
"+31",
"+1 869",
"+687",
"+64",
"+505",
"+227",
"+234",
"+683",
"+672 3",
"+389",
"+90 392",
"+44 28",
"+1 670",
"+47",
"+968",
"+92",
"+680",
"+970",
"+507",
"+675",
"+595",
"+51",
"+63",
"+64",
"+48",
"+351",
"+1 787",
"+1 939",
"+974",
"+262",
"+40",
"+7",
"+250",
"+599 4",
"+590",
"+290",
"+1 869",
"+1 758",
"+590",
"+508",
"+1 784",
"+685",
"+378",
"+239",
"+966",
"+221",
"+381",
"+248",
"+232",
"+65",
"+599 3",
"+1 721",
"+421",
"+386",
"+677",
"+252",
"+27",
"+500",
"+995 34",
"+211",
"+34",
"+94",
"+249",
"+597",
"+47 79",
"+46",
"+41",
"+963",
"+886",
"+992",
"+255",
"+888",
"+66",
"+882 16",
"+228",
"+690",
"+676",
"+373 2",
"+373 5",
"+1 868",
"+290 8",
"+216",
"+90",
"+993",
"+1 649",
"+688",
"+256",
"+380",
"+971",
"+44",
"+1",
"+878",
"+598",
"+1 340",
"+998",
"+678",
"+39 06 698",
"+379",
"+58",
"+84",
"+1 808",
"+681",
"+967",
"+260",
"+255 24",
"+263",
)
formats: ElementsType = ("###-###-###",)
msisdn_formats: ElementsType = ("#############",)
def phone_number(self) -> str:
return self.numerify(self.random_element(self.formats))
def country_calling_code(self) -> str:
return self.random_element(self.country_calling_codes)
def msisdn(self) -> str:
"""https://en.wikipedia.org/wiki/MSISDN"""
return self.numerify(self.random_element(self.msisdn_formats))
| 17.45045 | 71 | 0.268628 | 482 | 5,811 | 3.205394 | 0.645228 | 0.045307 | 0.049191 | 0.040777 | 0.112621 | 0.050485 | 0.050485 | 0 | 0 | 0 | 0 | 0.334609 | 0.505249 | 5,811 | 332 | 72 | 17.503012 | 0.202783 | 0.047668 | 0 | 0.095541 | 0 | 0 | 0.247193 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.009554 | false | 0 | 0.003185 | 0.006369 | 0.035032 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 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 |
6f1eb4ca4b8d13e3fd37a6e964c8fd0d868be3be | 142 | py | Python | tests/test_petpy.py | lawrencegwm/petpy | ee0f7dc08f0c80095b3abb0de72743ea729428fa | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | tests/test_petpy.py | lawrencegwm/petpy | ee0f7dc08f0c80095b3abb0de72743ea729428fa | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | tests/test_petpy.py | lawrencegwm/petpy | ee0f7dc08f0c80095b3abb0de72743ea729428fa | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | from petpy import gardner
import numpy as np
def test_gardner():
rhob = gardner(2000) #2073
assert np.isclose(rhob, 2073.09494543)
| 17.75 | 42 | 0.71831 | 21 | 142 | 4.809524 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175439 | 0.197183 | 142 | 7 | 43 | 20.285714 | 0.710526 | 0.028169 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.2 | false | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
6f289e7507db9d4d99d4694d363b135afd26445e | 1,668 | py | Python | caller.py | hanuniv/Cython-Example | 901d76673e0b82daac41c9cf22cb97aef568163b | [
"MIT"
] | null | null | null | caller.py | hanuniv/Cython-Example | 901d76673e0b82daac41c9cf22cb97aef568163b | [
"MIT"
] | null | null | null | caller.py | hanuniv/Cython-Example | 901d76673e0b82daac41c9cf22cb97aef568163b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 12:12:23 2015
@author: Han
"""
import numpy as np
from wrapper import first2double, first2elements,first2elements_contiguous,first2elements_contiguous_2d
a = np.array([1+1j,2+2j,3+3j, 4+4j], dtype = np.complex128)
b = np.array([-1,-2,-3,-4], dtype = np.double)
first2double(a) #actually the real and image part of first element
first2double(a[::2]) #same as above, because no contiguity check
first2double(b) #correct
first2double(b[::2]) #same as above, because no contiguity check
print('--------------------')
first2elements(a) #correct
first2elements(a[::2]) #same as above, because no contiguity check
first2elements(b) #correct
first2elements(b[::2]) #same as above, because no contiguity check
print('--------------------')
first2elements_contiguous(a) #correct
first2elements_contiguous(a[::2]) #correct
first2elements_contiguous(b) #correct
first2elements_contiguous(b[::2]) #correct
print('----------------------')
a = np.array([[1+1j,2+2j],[3+3j, 4+4j],[5+5j,6+6j]], dtype = np.complex128)
b = np.array([[-1,-2],[-3,-4],[-5,-6]], dtype = np.double)
first2elements_contiguous_2d(a) #correct
first2elements_contiguous_2d(a[::2]) #correct
first2elements_contiguous(a[:,0]) #correct
first2elements_contiguous_2d(a[:,0:1])#correct
first2elements_contiguous_2d(a[::2,0:1])#correct
first2elements_contiguous_2d(b) #correct
first2elements_contiguous_2d(b[::2]) #correct
first2elements_contiguous(b[:,0]) #correct
first2elements_contiguous_2d(b[:,0:1])#correct
first2elements_contiguous_2d(b[::2,0:1])#correct | 34.040816 | 104 | 0.673861 | 225 | 1,668 | 4.884444 | 0.262222 | 0.349409 | 0.33849 | 0.210191 | 0.574158 | 0.422202 | 0.323931 | 0.258417 | 0.258417 | 0.191083 | 0 | 0.072423 | 0.139089 | 1,668 | 49 | 105 | 34.040816 | 0.692897 | 0.244604 | 0 | 0.064516 | 0 | 0 | 0.052409 | 0.018597 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.064516 | 0 | 0.064516 | 0.096774 | 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 |
6f30b7e956f1cdc3d6077e628ac18e9ced224b70 | 8,233 | py | Python | unit_tests/test_std_map_data.py | abraker95/ultimate_osu_analyzer | bea58c997d13c3f461ccbe682f52799f0f88fdea | [
"MIT"
] | 23 | 2019-02-27T06:20:15.000Z | 2022-03-31T22:54:11.000Z | unit_tests/test_std_map_data.py | abraker95/ultimate_osu_analyzer | bea58c997d13c3f461ccbe682f52799f0f88fdea | [
"MIT"
] | 38 | 2019-03-03T17:35:39.000Z | 2021-08-23T20:43:34.000Z | unit_tests/test_std_map_data.py | abraker95/ultimate_osu_analyzer | bea58c997d13c3f461ccbe682f52799f0f88fdea | [
"MIT"
] | 4 | 2020-03-30T20:43:14.000Z | 2022-03-06T19:40:15.000Z | import unittest
import pandas as pd
from osu.local.beatmap.beatmapIO import BeatmapIO
from analysis.osu.std.map_data import StdMapData
class TestStdMapData(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.beatmap = BeatmapIO.open_beatmap('unit_tests\\maps\\osu\\test\\abraker - unknown (abraker) [250ms].osu')
map_data = [
pd.DataFrame(
[
[ 100, 0, 0, StdMapData.TYPE_PRESS, StdMapData.TYPE_SLIDER ],
[ 200, 0, 0, StdMapData.TYPE_HOLD, StdMapData.TYPE_SLIDER ],
[ 300, 0, 0, StdMapData.TYPE_HOLD, StdMapData.TYPE_SLIDER ],
[ 400, 0, 0, StdMapData.TYPE_RELEASE, StdMapData.TYPE_SLIDER ],
],
columns=['time', 'x', 'y', 'type', 'object']),
pd.DataFrame(
[
[ 1100, 0, 0, StdMapData.TYPE_PRESS, StdMapData.TYPE_CIRCLE ],
[ 1101, 0, 0, StdMapData.TYPE_RELEASE, StdMapData.TYPE_CIRCLE ],
],
columns=['time', 'x', 'y', 'type', 'object']),
pd.DataFrame(
[
[ 2100, 0, 0, StdMapData.TYPE_PRESS, StdMapData.TYPE_CIRCLE ],
[ 2101, 0, 0, StdMapData.TYPE_RELEASE, StdMapData.TYPE_CIRCLE ],
],
columns=['time', 'x', 'y', 'type', 'object']),
]
cls.map_data = pd.concat(map_data, axis=0, keys=range(len(map_data)), names=[ 'hitobject', 'aimpoint' ])
@classmethod
def tearDown(cls):
pass
def test_std_hitobject_to_aimpoints(self):
for hitobject in self.beatmap.hitobjects:
aimpoint_data = StdMapData.std_hitobject_to_aimpoints(hitobject)
def test_get_map_data(self):
map_data = StdMapData.get_map_data(self.beatmap.hitobjects)
def test_get_num_hitobjects(self):
map_data = StdMapData.get_map_data(self.beatmap.hitobjects)
num_hitobjects = StdMapData.get_num_hitobjects(map_data)
def test_get_presses(self):
map_data = StdMapData.get_map_data(self.beatmap.hitobjects)
presses = StdMapData.get_presses(map_data)
def test_get_releases(self):
map_data = StdMapData.get_map_data(self.beatmap.hitobjects)
presses = StdMapData.get_releases(map_data)
def test_get_scorepoint_before(self):
# Time: Before start
scorepoint_data = StdMapData.get_scorepoint_before(self.map_data, 0)
self.assertEqual(scorepoint_data, None)
# Time: At first aimpoint
scorepoint_data = StdMapData.get_scorepoint_before(self.map_data, 100)
self.assertEqual(scorepoint_data, None)
# Time: At second aimpoint
scorepoint_data = StdMapData.get_scorepoint_before(self.map_data, 200)
self.assertEqual(scorepoint_data['time'], 100)
# Time: At slider release
scorepoint_data = StdMapData.get_scorepoint_before(self.map_data, 400)
self.assertEqual(scorepoint_data['time'], 300)
# Time: At 2nd hitobject
scorepoint_data = StdMapData.get_scorepoint_before(self.map_data, 1100)
self.assertEqual(scorepoint_data['time'], 400)
# Time: At last hitobject
scorepoint_data = StdMapData.get_scorepoint_before(self.map_data, 2100)
self.assertEqual(scorepoint_data['time'], 1101)
# Time: After last hitobject
scorepoint_data = StdMapData.get_scorepoint_before(self.map_data, 2200)
self.assertEqual(scorepoint_data['time'], 2101)
def test_get_scorepoint_after(self):
# Time: Before start
scorepoint_data = StdMapData.get_scorepoint_after(self.map_data, 0)
self.assertEqual(scorepoint_data['time'], 100)
# Time: At first aimpoint
scorepoint_data = StdMapData.get_scorepoint_after(self.map_data, 100)
self.assertEqual(scorepoint_data['time'], 200)
# Time: At second aimpoint
scorepoint_data = StdMapData.get_scorepoint_after(self.map_data, 200)
self.assertEqual(scorepoint_data['time'], 300)
# Time: At slider release
scorepoint_data = StdMapData.get_scorepoint_after(self.map_data, 400)
self.assertEqual(scorepoint_data['time'], 1100)
# Time: At 2nd hitobject
scorepoint_data = StdMapData.get_scorepoint_after(self.map_data, 1100)
self.assertEqual(scorepoint_data['time'], 1101)
# Time: At last hitobject
scorepoint_data = StdMapData.get_scorepoint_after(self.map_data, 2100)
self.assertEqual(scorepoint_data['time'], 2101)
# Time: After last hitobject
scorepoint_data = StdMapData.get_scorepoint_after(self.map_data, 2200)
self.assertEqual(scorepoint_data, None)
'''
def test_get_next_hitobject_idx(self):
beatmap = BeatmapIO.open_beatmap('unit_tests\\maps\\osu\\playable\\Within Temptation - The Unforgiving (Armin) [Marathon].osu')
map_data = StdMapData.get_map_data(beatmap.hitobjects)
idx = -1
while idx != None:
idx = StdMapData.get_next_hitobject_idx(map_data, idx)
'''
def test_get_visible_at(self):
for time in range(-1000, 10000, 100):
visible = StdMapData.get_visible_at(self.map_data, time, 400)
def test_get_note_before(self):
# Time: Before start
hitobject_data = StdMapData.get_note_before(self.map_data, 0)
self.assertEqual(hitobject_data, None)
# Time: At first aimpoint
hitobject_data = StdMapData.get_note_before(self.map_data, 100)
self.assertEqual(hitobject_data, None)
# Time: At second aimpoint
hitobject_data = StdMapData.get_note_before(self.map_data, 200)
self.assertEqual(hitobject_data.iloc[0]['time'], 100)
# Time: At slider release
hitobject_data = StdMapData.get_note_before(self.map_data, 400)
self.assertEqual(hitobject_data.iloc[0]['time'], 100)
# Time: At 2nd hitobject
hitobject_data = StdMapData.get_note_before(self.map_data, 1100)
self.assertEqual(hitobject_data.iloc[0]['time'], 100)
# Time: At last hitobject
hitobject_data = StdMapData.get_note_before(self.map_data, 2100)
self.assertEqual(hitobject_data.iloc[0]['time'], 1100)
# Time: After last hitobject
hitobject_data = StdMapData.get_note_before(self.map_data, 2101)
self.assertEqual(hitobject_data.iloc[0]['time'], 2100)
def test_get_note_after(self):
# Time: Before start
hitobject_data = StdMapData.get_note_after(self.map_data, 0)
self.assertEqual(hitobject_data.iloc[0]['time'], 100)
# Time: At first aimpoint
hitobject_data = StdMapData.get_note_after(self.map_data, 100)
self.assertEqual(hitobject_data.iloc[0]['time'], 1100)
# Time: At second aimpoint
hitobject_data = StdMapData.get_note_after(self.map_data, 200)
self.assertEqual(hitobject_data.iloc[0]['time'], 1100)
# Time: At slider release
hitobject_data = StdMapData.get_note_after(self.map_data, 400)
self.assertEqual(hitobject_data.iloc[0]['time'], 1100)
# Time: At 2nd hitobject
hitobject_data = StdMapData.get_note_after(self.map_data, 1100)
self.assertEqual(hitobject_data.iloc[0]['time'], 2100)
# Time: At last hitobject
hitobject_data = StdMapData.get_note_after(self.map_data, 2100)
self.assertEqual(hitobject_data, None)
# Time: After last hitobject
hitobject_data = StdMapData.get_note_after(self.map_data, 2101)
self.assertEqual(hitobject_data, None)
def test_time_slice(self):
map_data = StdMapData.get_map_data(self.beatmap.hitobjects)
map_data = StdMapData.time_slice(map_data, 1000, 2000, True)
self.assertGreaterEqual(map_data['time'].values[0], 1000)
self.assertLessEqual(map_data['time'].values[0], 2000)
def test_start_times(self):
map_data = StdMapData.get_map_data(self.beatmap.hitobjects)
start_times = StdMapData.start_times(map_data)
def test_end_times(self):
map_data = StdMapData.get_map_data(self.beatmap.hitobjects)
end_times = StdMapData.end_times(map_data) | 37.422727 | 135 | 0.666586 | 1,006 | 8,233 | 5.198807 | 0.106362 | 0.081644 | 0.075717 | 0.072275 | 0.785277 | 0.762141 | 0.753155 | 0.734799 | 0.60478 | 0.411855 | 0 | 0.040694 | 0.229928 | 8,233 | 220 | 136 | 37.422727 | 0.784227 | 0.08053 | 0 | 0.352459 | 0 | 0 | 0.03135 | 0.005016 | 0 | 0 | 0 | 0 | 0.245902 | 1 | 0.122951 | false | 0.008197 | 0.032787 | 0 | 0.163934 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6f3da7da92259d0d6ea8723c281330703fdcbc57 | 2,927 | py | Python | src/config/__sql__.py | fatihzkaratana/wapc | 2d70946bc89e9b18434d6b7a8da204c0b0dd80eb | [
"BSD-3-Clause"
] | null | null | null | src/config/__sql__.py | fatihzkaratana/wapc | 2d70946bc89e9b18434d6b7a8da204c0b0dd80eb | [
"BSD-3-Clause"
] | null | null | null | src/config/__sql__.py | fatihzkaratana/wapc | 2d70946bc89e9b18434d6b7a8da204c0b0dd80eb | [
"BSD-3-Clause"
] | 1 | 2021-11-17T09:57:08.000Z | 2021-11-17T09:57:08.000Z | __author__ = 'fatih'
class SQL():
"""
This class includes all using database commands such as insert, remove, select etc.
Only need to do is you will write your sql command and format it into running command by given values
"""
#insert commands
SQL_INSERT_CONFIG = "INSERT INTO apc_config(name, description, ip, radius_config_id, ssid, vlan_id, channel, channel_freq, date_added, date_modified) "\
"VALUES('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}') RETURNING id;"
#(config_name, description, ip, radius_config_id, ssid, vlan_id, channel, channel_freq, date_added, date_modified)
SQL_INSERT_DEVICE = "INSERT INTO apc_device(name, ip, config_id, username, password, date_added, date_modified) "\
"VALUES('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}') RETURNING id;"
#(nick, ip, config_id, username, password, date_added, date_modified)
SQL_INSERT_GROUP = "INSERT INTO apc_groups(name, config_id) VALUES('{0}','{1}') RETURNING id;" #insert group to the database
SQL_INSERT_VLAN_CONFIG = "INSERT INTO apc_vlan(name, ip, subnet, number, interface) " \
"VALUES('{0}','{1}','{2}','{3}','{4}')" #insert vlan config values to the database
#remove commands
SQL_REMOVE_CONFIG = "DELETE FROM apc_config WHERE name = '{0}';"
SQL_REMOVE_DEVICE = "DELETE FROM apc_device WHERE name = '{0}' AND id = {1};"
SQL_REMOVE_GROUP = "DELETE FROM apc_groups WHERE name = '{0}' AND id = {1};"
SQL_REMOVE_VLAN = "DELETE FROM apc_vlan WHERE name = '{0}' AND id = {1};"
SQL_REMOVE_DEVICE_FROM_GROUP = "DELETE FROM apc_device_group WHERE device_id = {0} AND group_id = {1};"
#select queries
#select device records
SQL_SELECT_DEVICE = "SELECT * FROM apc_device d WHERE d.name IS NOT NULL AND d.id = {0};"
SQL_SELECT_DEVICE_CONFIG = "SELECT * FROM apc_device d LEFT JOIN apc_config c ON d.config_id = c.id WHERE d.id = {0};"
SQL_SELECT_DEVICE_ALL = "SELECT * FROM apc_device AS d WHERE d.name IS NOT NULL ORDER BY DATE(date_added) ASC;"
#select config records
SQL_SELECT_CONFIG = "SELECT * FROM apc_config c WHERE c.name IS NOT NULL ORDER BY date_added ASC;"
SQL_SELECT_CONFIG_DETAIL = "SELECT * FROM apc_config AS c WHERE c.name IS NOT NULL AND c.name IS '{0}';"
SQL_SELECT_GROUP_DETAIL = "SELECT * FROM apc_groups g WHERE g.name IS NOT NULL AND g.id = {0};"
SQL_SELECT_GROUP_ALL = "SELECT * FROM apc_groups d WHERE d.name IS NOT NULL ORDER BY date_added ASC;"
SQL_SELECT_GROUP_DEVICE = "SELECT * FROM apc_device d LEFT JOIN apc_group g ON d.config_id = g.id WHERE d.id = {0};"
SQL_SELECT_VLAN = "SELECT * FROM apc_vlan v WHERE v.id IS NOT NULL ORDER BY date_added ASC;"
SQL_SELECT_VLAN_DETAIL = "SELECT * FROM apc_config AS c WHERE c.name IS NOT NULL AND c.name IS '{0}';"
| 63.630435 | 156 | 0.658012 | 459 | 2,927 | 3.973856 | 0.187364 | 0.057566 | 0.071272 | 0.04989 | 0.478618 | 0.468202 | 0.421601 | 0.384868 | 0.309759 | 0.269737 | 0 | 0.017016 | 0.216946 | 2,927 | 45 | 157 | 65.044444 | 0.778796 | 0.17834 | 0 | 0 | 0 | 0.333333 | 0.674124 | 0.015618 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.041667 | 0 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
6f63dedffe6b19d73ce1b2d3ef89bcc943380590 | 171 | py | Python | env.example.py | dylmye/superfeedr-discord | af62a8ce446c9dd03d2c5720549961115ce12963 | [
"0BSD"
] | 1 | 2022-03-28T16:37:45.000Z | 2022-03-28T16:37:45.000Z | env.example.py | dylmye/superfeedr-discord | af62a8ce446c9dd03d2c5720549961115ce12963 | [
"0BSD"
] | null | null | null | env.example.py | dylmye/superfeedr-discord | af62a8ce446c9dd03d2c5720549961115ce12963 | [
"0BSD"
] | null | null | null | DISCORD_WEBHOOK_URL = 'https://discord.com/api/webhooks/<<GUILDID>>/<<HOOK_KEY>>'
DISCORD_ROLE_ID = '810000000000000000' # Set this to 'everyone' if you want to @everyone
| 57 | 88 | 0.754386 | 24 | 171 | 5.166667 | 0.833333 | 0.16129 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116129 | 0.093567 | 171 | 2 | 89 | 85.5 | 0.683871 | 0.274854 | 0 | 0 | 0 | 0 | 0.614754 | 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 |
6f6f6cc71d40d92bff09f53cbf6d0f01ef4c3858 | 321 | py | Python | py_recommendation/utils.py | kashy750/RecoSystem | 2b18357417675bffa998f9c925f3d57c34e0d02f | [
"MIT"
] | null | null | null | py_recommendation/utils.py | kashy750/RecoSystem | 2b18357417675bffa998f9c925f3d57c34e0d02f | [
"MIT"
] | null | null | null | py_recommendation/utils.py | kashy750/RecoSystem | 2b18357417675bffa998f9c925f3d57c34e0d02f | [
"MIT"
] | null | null | null | #!/usr/bin/env python
from py_recommendation.constants import STOPWORDS
from re import sub
class Utils(object):
"""Helper class for main api classes"""
@staticmethod
def cleanText(text_list):
return [" ".join(sub(r"(?!(?<=\d)\.(?=\d))[^a-zA-Z0-9 ]"," ",each).lower().split()) for each in text_list]
| 22.928571 | 111 | 0.641745 | 46 | 321 | 4.413043 | 0.804348 | 0.078818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007435 | 0.161994 | 321 | 13 | 112 | 24.692308 | 0.747212 | 0.168224 | 0 | 0 | 0 | 0 | 0.130268 | 0.114943 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.166667 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
489844e97aa7c22f434aa2c7304d5ca1c912cd13 | 941 | py | Python | dynamicCannyEdgeDetection.py | Siddharth2016/Opencv-Python-Computer-Vision | 92f6f23d94e5631899accfbd8968f051d7459f6a | [
"MIT"
] | 5 | 2020-12-05T15:53:42.000Z | 2021-09-30T00:05:57.000Z | dynamicCannyEdgeDetection.py | Siddharth2016/Opencv-Python-Computer-Vision | 92f6f23d94e5631899accfbd8968f051d7459f6a | [
"MIT"
] | null | null | null | dynamicCannyEdgeDetection.py | Siddharth2016/Opencv-Python-Computer-Vision | 92f6f23d94e5631899accfbd8968f051d7459f6a | [
"MIT"
] | 3 | 2021-10-31T13:52:23.000Z | 2022-01-20T17:52:49.000Z | # Dynamic Variation in Canny Edge Detection - by Changing threshold values
import cv2
import numpy as np
def nothing():
pass
img = cv2.imread("cube.jpg", 0) #Take the input image in GrayScale
cv2.namedWindow("Cube Canny Edge Detection") #Get a named window
#Set minimum and maximum value trackbar
cv2.createTrackbar("Min Value", "Cube Canny Edge Detection", 0, 100, nothing)
cv2.createTrackbar("Max Value", "Cube Canny Edge Detection", 0, 200, nothing)
while(True):
#Get trackbar value from the respective trackbar
minV = cv2.getTrackbarPos("Min Value", "Cube Canny Edge Detection")
maxV = cv2.getTrackbarPos("Max Value", "Cube Canny Edge Detection")
#Apply Canny Edge Detection on obtained minV and maxV
res = cv2.Canny(img, minV, maxV)
cv2.imshow("Cube Canny Edge Detection", res)
#Break when "q" key is pressed
if cv2.waitKey(1) & 0xff == ord('q'):
break
cv2.destroyAllWindows()
| 29.40625 | 78 | 0.70882 | 134 | 941 | 4.977612 | 0.507463 | 0.107946 | 0.215892 | 0.197901 | 0.182909 | 0.182909 | 0 | 0 | 0 | 0 | 0 | 0.028871 | 0.190223 | 941 | 31 | 79 | 30.354839 | 0.846457 | 0.30712 | 0 | 0 | 0 | 0 | 0.302795 | 0 | 0 | 0 | 0.006211 | 0 | 0 | 1 | 0.0625 | false | 0.0625 | 0.125 | 0 | 0.1875 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
489b9965a48475a0792c80020020d56406030b9c | 154 | py | Python | Interview.playground/Pages/RunLoop.xcplaygroundpage/Sources/Dog.py | susuyan/blog-code | def48a763793b033ef563ce20d8ab8b5e96dbf9a | [
"MIT"
] | null | null | null | Interview.playground/Pages/RunLoop.xcplaygroundpage/Sources/Dog.py | susuyan/blog-code | def48a763793b033ef563ce20d8ab8b5e96dbf9a | [
"MIT"
] | null | null | null | Interview.playground/Pages/RunLoop.xcplaygroundpage/Sources/Dog.py | susuyan/blog-code | def48a763793b033ef563ce20d8ab8b5e96dbf9a | [
"MIT"
] | null | null | null | class Dog:
def __init__(self, name):
self.name = name
self.tricks = []
def add_trick(self, trick):
self.tricks.append(trick)
return self
| 17.111111 | 29 | 0.655844 | 22 | 154 | 4.363636 | 0.5 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.220779 | 154 | 8 | 30 | 19.25 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
48a196cda8336d0a3ae1f07b020b5e0d5a461605 | 547 | py | Python | xfdlfw_testcases/test_data.py | vkola-lab/multi-GPU | d50cff0d587b640fb3af94329102d3eacdd70aa5 | [
"MIT"
] | null | null | null | xfdlfw_testcases/test_data.py | vkola-lab/multi-GPU | d50cff0d587b640fb3af94329102d3eacdd70aa5 | [
"MIT"
] | null | null | null | xfdlfw_testcases/test_data.py | vkola-lab/multi-GPU | d50cff0d587b640fb3af94329102d3eacdd70aa5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 17 11:25:20 2021
@author: Iluva
"""
import torch
import numpy as np
class RandomDataset(torch.utils.data.Dataset):
def __init__(self):
self.x = np.random.randn(100, 1, 182, 218, 182).astype(np.float32)
self.y = np.random.randint(0, 2, 100).astype(np.int64)
def __len__(self):
return len(self.x)
def __getitem__(self, idx):
return self.x[idx, :, :, :, :], self.y[idx] | 18.862069 | 75 | 0.517367 | 71 | 547 | 3.816901 | 0.633803 | 0.055351 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096685 | 0.338208 | 547 | 29 | 76 | 18.862069 | 0.651934 | 0.135283 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0.2 | 0.2 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
48a661d0d0e981ed76cc2c443d4a388a57a35bea | 3,346 | py | Python | tests/functional/CrudTests.py | idle-code/ContextShell | a8e71e73d23134db0d02d93a0b297dc01a9161f3 | [
"MIT"
] | null | null | null | tests/functional/CrudTests.py | idle-code/ContextShell | a8e71e73d23134db0d02d93a0b297dc01a9161f3 | [
"MIT"
] | 12 | 2018-10-13T14:05:30.000Z | 2018-10-21T12:12:42.000Z | tests/functional/CrudTests.py | idle-code/ContextShell | a8e71e73d23134db0d02d93a0b297dc01a9161f3 | [
"MIT"
] | null | null | null | import unittest
from tests.functional.ShellTestsBase import NodeTreeTestsBase
from tests.functional.TestExecutor import script_test
class CrudTestsBase(NodeTreeTestsBase):
pass
class CreateTests(CrudTestsBase):
@script_test
def test_create(self):
"""
$ .: create foo
$ .: contains foo
True
"""
@script_test
def test_create_many_parts(self):
"""
$ .: create foo.bar
$ .: contains foo.bar
True
"""
@unittest.skip("Check when type system will be working")
@script_test
def test_create_int_type(self):
"""
$ .: create.int i 3
$ .i: get
3
"""
class ContainsTests(CrudTestsBase):
@script_test
def test_nonexistent(self):
"""
$ .: contains unknown
False
"""
class GetTests(CrudTestsBase):
@script_test
def test_get_existing(self):
"""
$ .: create foo 1
$ .foo: get
1
"""
@script_test
def test_get_nonexistent(self):
"""
$ .foo: get
NameError: '.foo' doesn't exists
"""
class SetTests(CrudTestsBase):
@script_test
def test_set_existing(self):
"""
$ .: create foo 1
$ .foo: set 2
$ .foo: get
2
"""
@script_test
def test_set_nonexistent(self):
"""
$ .foo: set 1
NameError: '.foo' doesn't exists
"""
@script_test
def test_set_no_new_value(self):
"""
$ .: create foo 1
$ .foo: set
TypeError: set_action() missing 1 required positional argument: 'new_value'
"""
@script_test
def test_set_different_type(self):
"""
$ .: create foo 2
$ .foo: set "rabarbar"
TypeError: Cannot assign value with type 'str' to 'int' node
"""
class ListTests(CrudTestsBase):
@script_test
def test_list_empty(self):
"""
$ .: create foo
$ .foo: list
"""
@script_test
def test_list_in_creation_order(self):
"""
$ .: create foo.Z_first
$ .: create foo.A_second
$ .foo: list
Z_first
A_second
"""
@script_test
def test_list_only_attributes(self):
"""
$ .: create .test.@attr
$ .: create .test.key
$ .test: list.attributes
@attr
"""
@script_test
def test_list_all(self):
"""
$ .: create .test.@attr
$ .: create .test.key
$ .test: list.all
@attr
key
"""
@script_test
def test_list_only_normal(self):
"""
$ .: create .test.@attr
$ .: create .test.key
$ .test: list
key
"""
@script_test
def test_list_actions(self):
"""
$ .: list.actions
create
contains
get
set
list
remove
find
"""
class RemoveTests(CrudTestsBase):
@script_test
def test_remove_existing(self):
"""
$ .: create foo
$ .foo: remove
$ .: contains foo
False
"""
@script_test
def test_remove_nonexistent(self):
"""
$ .foo: remove
NameError: '.foo' doesn't exists
"""
| 19.229885 | 83 | 0.506874 | 333 | 3,346 | 4.888889 | 0.258258 | 0.116708 | 0.143735 | 0.187961 | 0.449631 | 0.164005 | 0.071867 | 0.071867 | 0.071867 | 0 | 0 | 0.005311 | 0.381052 | 3,346 | 173 | 84 | 19.34104 | 0.780782 | 0.301255 | 0 | 0.375 | 0 | 0 | 0.024188 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0.020833 | 0.0625 | 0 | 0.583333 | 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 |
48af0f8deb746c0a69237c0211552abb726ac315 | 1,856 | py | Python | build/plugins/flatc.py | ibr11/catboost | 842a25b4fb856a61564b163b16a3f49ba35fdc14 | [
"Apache-2.0"
] | 2 | 2019-07-10T10:49:09.000Z | 2020-06-19T11:40:04.000Z | build/plugins/flatc.py | ibr11/catboost | 842a25b4fb856a61564b163b16a3f49ba35fdc14 | [
"Apache-2.0"
] | null | null | null | build/plugins/flatc.py | ibr11/catboost | 842a25b4fb856a61564b163b16a3f49ba35fdc14 | [
"Apache-2.0"
] | null | null | null | import os
import _import_wrapper as iw
import _common as common
class FlatcBase(iw.CustomCommand):
def __init__(self, path, unit):
self._path = path
self._incl_dirs = ['$S', '$B']
def input(self):
return common.make_tuples([self._path, '$S/build/scripts/stdout2stderr.py'])
def output(self):
base_path = common.tobuilddir(common.stripext(self._path))
return [
(base_path + self.extension(), []),
(base_path + self.schema_extension(), ['noauto'])]
def run(self, binary):
return self.do_run(binary, self._path)
def do_run(self, binary, path):
def incls():
for x in self._incl_dirs:
yield '-I'
yield self.resolve_path(x)
output_dir = os.path.dirname(self.resolve_path(common.get(self.output, 0)))
cmd = common.get_interpreter_path() + ['$S/build/scripts/stdout2stderr.py', binary, '--cpp', '--keep-prefix', '--gen-mutable', '--schema', '-b'] + list(incls()) + ['-o', output_dir, path]
self.call(cmd)
class Flatc(FlatcBase):
def __init__(self, path, unit):
super(Flatc, self).__init__(path, unit)
def descr(self):
return 'FL', self._path, 'light-green'
def tools(self):
return ['contrib/tools/flatc']
def extension(self):
return ".fbs.h"
def schema_extension(self):
return ".bfbs"
class Flatc64(FlatcBase):
def __init__(self, path, unit):
super(Flatc64, self).__init__(path, unit)
def descr(self):
return 'FL64', self._path, 'light-green'
def tools(self):
return ['contrib/tools/flatc64']
def extension(self):
return ".fbs64.h"
def schema_extension(self):
return ".bfbs64"
def init():
iw.addrule('fbs', Flatc)
iw.addrule('fbs64', Flatc64)
| 24.746667 | 195 | 0.598599 | 230 | 1,856 | 4.621739 | 0.317391 | 0.067733 | 0.071496 | 0.042333 | 0.349012 | 0.331138 | 0.216369 | 0.15428 | 0.09031 | 0.09031 | 0 | 0.013669 | 0.251078 | 1,856 | 74 | 196 | 25.081081 | 0.751079 | 0 | 0 | 0.22449 | 0 | 0 | 0.120151 | 0.046875 | 0 | 0 | 0 | 0 | 0 | 1 | 0.346939 | false | 0 | 0.061224 | 0.204082 | 0.693878 | 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 |
48b678eaaec43e13bed5a4e13f4b3433c3e5e009 | 6,355 | py | Python | panda/tests/safety/test_honda.py | Orbbec-3DPG/openpilot | 27e0adc434906e37fd7674160a0a8c2dd5c3c180 | [
"MIT"
] | 41 | 2018-07-30T17:36:37.000Z | 2021-04-05T13:24:19.000Z | panda/tests/safety/test_honda.py | Orbbec-3DPG/openpilot | 27e0adc434906e37fd7674160a0a8c2dd5c3c180 | [
"MIT"
] | 14 | 2018-06-18T17:47:59.000Z | 2019-01-10T00:18:00.000Z | panda/tests/safety/test_honda.py | Orbbec-3DPG/openpilot | 27e0adc434906e37fd7674160a0a8c2dd5c3c180 | [
"MIT"
] | 29 | 2018-07-31T07:43:25.000Z | 2020-08-30T16:44:27.000Z | #!/usr/bin/env python2
import unittest
import numpy as np
import libpandasafety_py
class TestHondaSafety(unittest.TestCase):
@classmethod
def setUp(cls):
cls.safety = libpandasafety_py.libpandasafety
cls.safety.honda_init(0)
cls.safety.init_tests_honda()
def _speed_msg(self, speed):
to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *')
to_send[0].RIR = 0x158 << 21
to_send[0].RDLR = speed
return to_send
def _button_msg(self, buttons, msg):
to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *')
to_send[0].RIR = msg << 21
to_send[0].RDLR = buttons << 5
return to_send
def _brake_msg(self, brake):
to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *')
to_send[0].RIR = 0x17C << 21
to_send[0].RDHR = 0x200000 if brake else 0
return to_send
def _alt_brake_msg(self, brake):
to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *')
to_send[0].RIR = 0x1BE << 21
to_send[0].RDLR = 0x10 if brake else 0
return to_send
def _gas_msg(self, gas):
to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *')
to_send[0].RIR = 0x17C << 21
to_send[0].RDLR = 1 if gas else 0
return to_send
def _send_brake_msg(self, brake):
to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *')
to_send[0].RIR = 0x1FA << 21
to_send[0].RDLR = brake
return to_send
def _send_gas_msg(self, gas):
to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *')
to_send[0].RIR = 0x200 << 21
to_send[0].RDLR = gas
return to_send
def _send_steer_msg(self, steer):
to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *')
to_send[0].RIR = 0xE4 << 21
to_send[0].RDLR = steer
return to_send
def test_default_controls_not_allowed(self):
self.assertFalse(self.safety.get_controls_allowed())
def test_resume_button(self):
RESUME_BTN = 4
self.safety.set_controls_allowed(0)
self.safety.honda_rx_hook(self._button_msg(RESUME_BTN, 0x1A6))
self.assertTrue(self.safety.get_controls_allowed())
def test_set_button(self):
SET_BTN = 3
self.safety.set_controls_allowed(0)
self.safety.honda_rx_hook(self._button_msg(SET_BTN, 0x1A6))
self.assertTrue(self.safety.get_controls_allowed())
def test_cancel_button(self):
CANCEL_BTN = 2
self.safety.set_controls_allowed(1)
self.safety.honda_rx_hook(self._button_msg(CANCEL_BTN, 0x1A6))
self.assertFalse(self.safety.get_controls_allowed())
def test_sample_speed(self):
self.assertEqual(0, self.safety.get_ego_speed())
self.safety.honda_rx_hook(self._speed_msg(100))
self.assertEqual(100, self.safety.get_ego_speed())
def test_prev_brake(self):
self.assertFalse(self.safety.get_brake_prev())
self.safety.honda_rx_hook(self._brake_msg(True))
self.assertTrue(self.safety.get_brake_prev())
def test_disengage_on_brake(self):
self.safety.set_controls_allowed(1)
self.safety.honda_rx_hook(self._brake_msg(1))
self.assertFalse(self.safety.get_controls_allowed())
def test_alt_disengage_on_brake(self):
self.safety.set_honda_alt_brake_msg(1)
self.safety.set_controls_allowed(1)
self.safety.honda_rx_hook(self._alt_brake_msg(1))
self.assertFalse(self.safety.get_controls_allowed())
self.safety.set_honda_alt_brake_msg(0)
self.safety.set_controls_allowed(1)
self.safety.honda_rx_hook(self._alt_brake_msg(1))
self.assertTrue(self.safety.get_controls_allowed())
def test_allow_brake_at_zero_speed(self):
# Brake was already pressed
self.safety.honda_rx_hook(self._brake_msg(True))
self.safety.set_controls_allowed(1)
self.safety.honda_rx_hook(self._brake_msg(True))
self.assertTrue(self.safety.get_controls_allowed())
self.safety.honda_rx_hook(self._brake_msg(False)) # reset no brakes
def test_not_allow_brake_when_moving(self):
# Brake was already pressed
self.safety.honda_rx_hook(self._brake_msg(True))
self.safety.honda_rx_hook(self._speed_msg(100))
self.safety.set_controls_allowed(1)
self.safety.honda_rx_hook(self._brake_msg(True))
self.assertFalse(self.safety.get_controls_allowed())
def test_prev_gas(self):
self.assertFalse(self.safety.get_gas_prev())
self.safety.honda_rx_hook(self._gas_msg(True))
self.assertTrue(self.safety.get_gas_prev())
def test_disengage_on_gas(self):
self.safety.set_controls_allowed(1)
self.safety.honda_rx_hook(self._gas_msg(1))
self.assertFalse(self.safety.get_controls_allowed())
def test_allow_engage_with_gas_pressed(self):
self.safety.honda_rx_hook(self._gas_msg(1))
self.safety.set_controls_allowed(1)
self.safety.honda_rx_hook(self._gas_msg(1))
self.assertTrue(self.safety.get_controls_allowed())
def test_brake_safety_check(self):
self.assertTrue(self.safety.honda_tx_hook(self._send_brake_msg(0x0000)))
self.assertFalse(self.safety.honda_tx_hook(self._send_brake_msg(0x1000)))
self.safety.set_controls_allowed(1)
self.assertTrue(self.safety.honda_tx_hook(self._send_brake_msg(0x1000)))
self.assertFalse(self.safety.honda_tx_hook(self._send_brake_msg(0x00F0)))
def test_gas_safety_check(self):
self.safety.set_controls_allowed(0)
self.assertTrue(self.safety.honda_tx_hook(self._send_gas_msg(0x0000)))
self.assertFalse(self.safety.honda_tx_hook(self._send_gas_msg(0x1000)))
def test_steer_safety_check(self):
self.safety.set_controls_allowed(0)
self.assertTrue(self.safety.honda_tx_hook(self._send_steer_msg(0x0000)))
self.assertFalse(self.safety.honda_tx_hook(self._send_steer_msg(0x1000)))
def test_spam_cancel_safety_check(self):
RESUME_BTN = 4
SET_BTN = 3
CANCEL_BTN = 2
BUTTON_MSG = 0x296
self.safety.set_bosch_hardware(1)
self.safety.set_controls_allowed(0)
self.assertTrue(self.safety.honda_tx_hook(self._button_msg(CANCEL_BTN, BUTTON_MSG)))
self.assertFalse(self.safety.honda_tx_hook(self._button_msg(RESUME_BTN, BUTTON_MSG)))
self.assertFalse(self.safety.honda_tx_hook(self._button_msg(SET_BTN, BUTTON_MSG)))
# do not block resume if we are engaged already
self.safety.set_controls_allowed(1)
self.assertTrue(self.safety.honda_tx_hook(self._button_msg(RESUME_BTN, BUTTON_MSG)))
if __name__ == "__main__":
unittest.main()
| 34.166667 | 89 | 0.750433 | 984 | 6,355 | 4.47561 | 0.113821 | 0.147593 | 0.10218 | 0.069482 | 0.799046 | 0.750227 | 0.723206 | 0.690282 | 0.659173 | 0.621026 | 0 | 0.029337 | 0.136428 | 6,355 | 185 | 90 | 34.351351 | 0.773141 | 0.021243 | 0 | 0.442857 | 0 | 0 | 0.033467 | 0.029606 | 0 | 0 | 0.018343 | 0 | 0.207143 | 1 | 0.185714 | false | 0 | 0.021429 | 0 | 0.271429 | 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 |
48c4dbecc42d024adc85d401e95a3b050b196ba5 | 302 | py | Python | python/p024.py | Martin-Gong/euler | dc29cb99c0e5f9916428de624edc375d9d5b4543 | [
"MIT"
] | null | null | null | python/p024.py | Martin-Gong/euler | dc29cb99c0e5f9916428de624edc375d9d5b4543 | [
"MIT"
] | null | null | null | python/p024.py | Martin-Gong/euler | dc29cb99c0e5f9916428de624edc375d9d5b4543 | [
"MIT"
] | null | null | null | # 24
from math import factorial
n = list(range(10))
f = []
left = 1000000
for i in range(9):
if left % factorial(9 - i) == 0:
f += [n.pop(int(left / factorial(9 - i)) - 1)]
else:
f += [n.pop(int(left / factorial(9 - i)))]
left = left % factorial(9 - i)
f += n
print(f) | 15.894737 | 54 | 0.519868 | 50 | 302 | 3.14 | 0.46 | 0.33121 | 0.356688 | 0.382166 | 0.292994 | 0.292994 | 0.292994 | 0.292994 | 0 | 0 | 0 | 0.084112 | 0.291391 | 302 | 19 | 55 | 15.894737 | 0.649533 | 0.006623 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.083333 | 0 | 0.083333 | 0.083333 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
48c84acd8763eb16714ea15a9471892e094ab869 | 888 | py | Python | Python_Basics/Exam/03_Energy_Booster.py | Dochko0/Python | e9612c4e842cfd3d9a733526cc7485765ef2238f | [
"MIT"
] | null | null | null | Python_Basics/Exam/03_Energy_Booster.py | Dochko0/Python | e9612c4e842cfd3d9a733526cc7485765ef2238f | [
"MIT"
] | null | null | null | Python_Basics/Exam/03_Energy_Booster.py | Dochko0/Python | e9612c4e842cfd3d9a733526cc7485765ef2238f | [
"MIT"
] | null | null | null | fruit = input()
size_set = input()
count_sets = float(input())
price_set = 0
if fruit == 'Watermelon':
if size_set == 'small':
price_set = count_sets * 56 * 2
elif size_set == 'big':
price_set = count_sets * 28.7 * 5
elif fruit == 'Mango':
if size_set == 'small':
price_set = count_sets * 36.66 * 2
elif size_set == 'big':
price_set = count_sets * 19.60 * 5
elif fruit == 'Pineapple':
if size_set == 'small':
price_set = count_sets * 42.1 * 2
elif size_set == 'big':
price_set = count_sets * 24.8 * 5
elif fruit == 'Raspberry':
if size_set == 'small':
price_set = count_sets * 20 * 2
elif size_set == 'big':
price_set = count_sets * 15.2 * 5
if 400 <= price_set <= 1000:
price_set = price_set * 0.85
elif price_set > 1000:
price_set = price_set * 0.5
print(f'{price_set:.2f} lv.')
| 26.909091 | 42 | 0.584459 | 137 | 888 | 3.540146 | 0.284672 | 0.263918 | 0.214433 | 0.280412 | 0.639175 | 0.639175 | 0.639175 | 0.639175 | 0.263918 | 0 | 0 | 0.077761 | 0.275901 | 888 | 32 | 43 | 27.75 | 0.676516 | 0 | 0 | 0.275862 | 0 | 0 | 0.094595 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.034483 | 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 |
48cfb0457eef296ee556c1ec98ad3d3379784f30 | 201 | py | Python | NewsTrader/__init__.py | zrxbeijing/NewsTrader | 06818f2891bc17f419743d0a4089b5935e74b6ac | [
"MIT"
] | null | null | null | NewsTrader/__init__.py | zrxbeijing/NewsTrader | 06818f2891bc17f419743d0a4089b5935e74b6ac | [
"MIT"
] | null | null | null | NewsTrader/__init__.py | zrxbeijing/NewsTrader | 06818f2891bc17f419743d0a4089b5935e74b6ac | [
"MIT"
] | null | null | null | """
NewsTrader - a framework of news trading for individual investors
This package is inspired by many other awesome Python packages
"""
# Shortcuts for key modules or functions
__VERSION__ = "0.0.1"
| 25.125 | 65 | 0.771144 | 29 | 201 | 5.206897 | 0.931034 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017857 | 0.164179 | 201 | 7 | 66 | 28.714286 | 0.880952 | 0.835821 | 0 | 0 | 0 | 0 | 0.2 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
48d856ebfb38992f23ead9020ce04f05248c8405 | 2,811 | py | Python | tests/xfdnn/test_xfdnn_compiler_caffe.py | Saums/ml-suite | 8a2b52763b0c1406abc4400302977d8354d74e11 | [
"Apache-2.0"
] | 1 | 2018-11-22T01:59:26.000Z | 2018-11-22T01:59:26.000Z | tests/xfdnn/test_xfdnn_compiler_caffe.py | Saums/ml-suite | 8a2b52763b0c1406abc4400302977d8354d74e11 | [
"Apache-2.0"
] | null | null | null | tests/xfdnn/test_xfdnn_compiler_caffe.py | Saums/ml-suite | 8a2b52763b0c1406abc4400302977d8354d74e11 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
#
# // SPDX-License-Identifier: BSD-3-CLAUSE
#
# (C) Copyright 2018, Xilinx, Inc.
#
import os,sys
from xfdnn.tools.compile.bin.xfdnn_compiler_caffe import CaffeFrontend as xfdnnCompiler
def test_xfdnn_compiler_caffe():
print "Testing xfdnn_compiler_caffe..."
prototxt_list = [ \
"models/caffe/bvlc_googlenet_without_lrn/fp32/bvlc_googlenet_without_lrn_deploy.prototxt", \
"models/caffe/inception_v3/fp32/inception_v3_without_bn_deploy.prototxt", \
"models/caffe/aiotlabs/fp32/resnet18_baseline_without_bn_deploy.prototxt", \
"models/caffe/aiotlabs/fp32/resnet18_emdnn_without_bn_deploy.prototxt", \
"models/caffe/deephi/fp32/resnet50_pruned_deploy.prototxt", \
"models/caffe/resnet/fp32/resnet50_without_bn_deploy.prototxt", \
"models/caffe/resnet/fp32/resnet101_without_bn_deploy.prototxt", \
"models/caffe/resnet/fp32/resnet152_without_bn_deploy.prototxt", \
"models/caffe/squeezenet/fp32/squeezenet_deploy.prototxt", \
"models/caffe/mobilenet/fp32/mobilenet_without_bn_deploy.prototxt", \
"models/caffe/vgg16/fp32/vgg16_deploy.prototxt", \
"models/yolov2/caffe/fp32/yolo_deploy_224.prototxt", \
"models/yolov2/caffe/fp32/yolo_deploy_416.prototxt", \
"models/yolov2/caffe/fp32/yolo_deploy_608.prototxt", \
]
caffemodel_list = [ \
"models/caffe/bvlc_googlenet_without_lrn/fp32/bvlc_googlenet_without_lrn.caffemodel", \
"models/caffe/inception_v3/fp32/inception_v3_without_bn.caffemodel", \
"models/caffe/aiotlabs/fp32/resnet18_baseline_without_bn.caffemodel", \
"models/caffe/aiotlabs/fp32/resnet18_emdnn_without_bn.caffemodel", \
"models/caffe/deephi/fp32/resnet50_pruned.caffemodel", \
"models/caffe/resnet/int8/resnet50_without_bn_quantized.caffemodel", \
"models/caffe/resnet/fp32/resnet101_without_bn.caffemodel", \
"models/caffe/resnet/fp32/resnet152_without_bn.caffemodel", \
"models/caffe/squeezenet/fp32/squeezenet.caffemodel", \
"models/caffe/mobilenet/fp32/mobilenet_without_bn.caffemodel", \
"models/caffe/vgg16/fp32/vgg16.caffemodel", \
"models/yolov2/caffe/fp32/yolov2.caffemodel", \
"models/yolov2/caffe/fp32/yolov2.caffemodel", \
"models/yolov2/caffe/fp32/yolov2.caffemodel", \
]
dsp_list = [28, 56, 96]
mem_list = [4, 6, 9]
for prototxt, caffemodel in zip(prototxt_list,caffemodel_list):
for dsp,mem in zip(dsp_list,mem_list):
print("Testing:\n prototxt %s\n caffemodel %s\n dsp %s\n mem %s\n" % (prototxt,caffemodel,dsp,mem))
compiler = xfdnnCompiler(
networkfile=prototxt,
weights=caffemodel,
dsp=dsp,
memory=mem,
generatefile="work/fpga.cmds",
anew="work/optimized_model"
)
SUCCESS,_ = compiler.compile()
assert(SUCCESS)
del compiler
| 41.955224 | 109 | 0.737816 | 352 | 2,811 | 5.650568 | 0.255682 | 0.121669 | 0.110608 | 0.125691 | 0.647562 | 0.573152 | 0.488185 | 0.334339 | 0.222222 | 0.126194 | 0 | 0.052113 | 0.133049 | 2,811 | 66 | 110 | 42.590909 | 0.764054 | 0.03344 | 0 | 0.057692 | 0 | 0.019231 | 0.646125 | 0.607749 | 0 | 0 | 0 | 0 | 0.019231 | 0 | null | null | 0 | 0.038462 | null | null | 0.038462 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
48db5aa5d04c134617e7d65a810aa21309512042 | 67 | py | Python | flowgraph/integration_tests/data/numpy_ufunc.py | Bhaskers-Blu-Org1/pyflowgraph | 0a08a978fcab124a27fdb660048d417a80fb082c | [
"Apache-2.0"
] | 17 | 2019-01-01T02:03:35.000Z | 2021-11-18T15:34:50.000Z | flowgraph/integration_tests/data/numpy_ufunc.py | Bhaskers-Blu-Org1/pyflowgraph | 0a08a978fcab124a27fdb660048d417a80fb082c | [
"Apache-2.0"
] | 25 | 2018-08-11T03:49:36.000Z | 2021-11-08T17:26:39.000Z | flowgraph/integration_tests/data/numpy_ufunc.py | IBM/pyflowgraph | 0a08a978fcab124a27fdb660048d417a80fb082c | [
"Apache-2.0"
] | 5 | 2018-08-09T21:26:37.000Z | 2021-07-06T02:58:41.000Z | import numpy as np
x = np.linspace(0, 2*np.pi, 100)
y = np.sin(x)
| 13.4 | 32 | 0.626866 | 16 | 67 | 2.625 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.092593 | 0.19403 | 67 | 4 | 33 | 16.75 | 0.685185 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
48e3cd444b99628ea6a6983b0130aa389aa384c7 | 5,895 | py | Python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/__init__.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 2,728 | 2015-01-09T10:19:32.000Z | 2022-03-31T14:50:33.000Z | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/__init__.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 17,773 | 2015-01-05T15:57:17.000Z | 2022-03-31T23:50:25.000Z | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/models/__init__.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 1,916 | 2015-01-19T05:05:41.000Z | 2022-03-31T19:36:44.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
try:
from ._models_py3 import AccessUri
from ._models_py3 import ApiError
from ._models_py3 import ApiErrorBase
from ._models_py3 import CreationData
from ._models_py3 import Disk
from ._models_py3 import DiskAccess
from ._models_py3 import DiskAccessList
from ._models_py3 import DiskAccessUpdate
from ._models_py3 import DiskEncryptionSet
from ._models_py3 import DiskEncryptionSetList
from ._models_py3 import DiskEncryptionSetUpdate
from ._models_py3 import DiskList
from ._models_py3 import DiskSku
from ._models_py3 import DiskUpdate
from ._models_py3 import Encryption
from ._models_py3 import EncryptionSetIdentity
from ._models_py3 import EncryptionSettingsCollection
from ._models_py3 import EncryptionSettingsElement
from ._models_py3 import GrantAccessData
from ._models_py3 import ImageDiskReference
from ._models_py3 import InnerError
from ._models_py3 import KeyVaultAndKeyReference
from ._models_py3 import KeyVaultAndSecretReference
from ._models_py3 import PrivateEndpoint
from ._models_py3 import PrivateEndpointConnection
from ._models_py3 import PrivateLinkResource
from ._models_py3 import PrivateLinkResourceListResult
from ._models_py3 import PrivateLinkServiceConnectionState
from ._models_py3 import Resource
from ._models_py3 import ResourceUriList
from ._models_py3 import ShareInfoElement
from ._models_py3 import Snapshot
from ._models_py3 import SnapshotList
from ._models_py3 import SnapshotSku
from ._models_py3 import SnapshotUpdate
from ._models_py3 import SourceVault
except (SyntaxError, ImportError):
from ._models import AccessUri # type: ignore
from ._models import ApiError # type: ignore
from ._models import ApiErrorBase # type: ignore
from ._models import CreationData # type: ignore
from ._models import Disk # type: ignore
from ._models import DiskAccess # type: ignore
from ._models import DiskAccessList # type: ignore
from ._models import DiskAccessUpdate # type: ignore
from ._models import DiskEncryptionSet # type: ignore
from ._models import DiskEncryptionSetList # type: ignore
from ._models import DiskEncryptionSetUpdate # type: ignore
from ._models import DiskList # type: ignore
from ._models import DiskSku # type: ignore
from ._models import DiskUpdate # type: ignore
from ._models import Encryption # type: ignore
from ._models import EncryptionSetIdentity # type: ignore
from ._models import EncryptionSettingsCollection # type: ignore
from ._models import EncryptionSettingsElement # type: ignore
from ._models import GrantAccessData # type: ignore
from ._models import ImageDiskReference # type: ignore
from ._models import InnerError # type: ignore
from ._models import KeyVaultAndKeyReference # type: ignore
from ._models import KeyVaultAndSecretReference # type: ignore
from ._models import PrivateEndpoint # type: ignore
from ._models import PrivateEndpointConnection # type: ignore
from ._models import PrivateLinkResource # type: ignore
from ._models import PrivateLinkResourceListResult # type: ignore
from ._models import PrivateLinkServiceConnectionState # type: ignore
from ._models import Resource # type: ignore
from ._models import ResourceUriList # type: ignore
from ._models import ShareInfoElement # type: ignore
from ._models import Snapshot # type: ignore
from ._models import SnapshotList # type: ignore
from ._models import SnapshotSku # type: ignore
from ._models import SnapshotUpdate # type: ignore
from ._models import SourceVault # type: ignore
from ._compute_management_client_enums import (
AccessLevel,
DiskCreateOption,
DiskEncryptionSetIdentityType,
DiskEncryptionSetType,
DiskState,
DiskStorageAccountTypes,
EncryptionType,
HyperVGeneration,
NetworkAccessPolicy,
OperatingSystemTypes,
PrivateEndpointConnectionProvisioningState,
PrivateEndpointServiceConnectionStatus,
SnapshotStorageAccountTypes,
)
__all__ = [
'AccessUri',
'ApiError',
'ApiErrorBase',
'CreationData',
'Disk',
'DiskAccess',
'DiskAccessList',
'DiskAccessUpdate',
'DiskEncryptionSet',
'DiskEncryptionSetList',
'DiskEncryptionSetUpdate',
'DiskList',
'DiskSku',
'DiskUpdate',
'Encryption',
'EncryptionSetIdentity',
'EncryptionSettingsCollection',
'EncryptionSettingsElement',
'GrantAccessData',
'ImageDiskReference',
'InnerError',
'KeyVaultAndKeyReference',
'KeyVaultAndSecretReference',
'PrivateEndpoint',
'PrivateEndpointConnection',
'PrivateLinkResource',
'PrivateLinkResourceListResult',
'PrivateLinkServiceConnectionState',
'Resource',
'ResourceUriList',
'ShareInfoElement',
'Snapshot',
'SnapshotList',
'SnapshotSku',
'SnapshotUpdate',
'SourceVault',
'AccessLevel',
'DiskCreateOption',
'DiskEncryptionSetIdentityType',
'DiskEncryptionSetType',
'DiskState',
'DiskStorageAccountTypes',
'EncryptionType',
'HyperVGeneration',
'NetworkAccessPolicy',
'OperatingSystemTypes',
'PrivateEndpointConnectionProvisioningState',
'PrivateEndpointServiceConnectionStatus',
'SnapshotStorageAccountTypes',
]
| 39.039735 | 94 | 0.731637 | 516 | 5,895 | 8.133721 | 0.199612 | 0.171551 | 0.111508 | 0.162974 | 0.352633 | 0.135811 | 0.135811 | 0.135811 | 0.135811 | 0.135811 | 0 | 0.007715 | 0.186429 | 5,895 | 150 | 95 | 39.3 | 0.867389 | 0.156064 | 0 | 0 | 0 | 0 | 0.171973 | 0.088015 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.528571 | 0 | 0.528571 | 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 |
48e4d5c704d1291bde3c382eeef2989aa1ba1856 | 292 | py | Python | service/causality-detection/Python_R_wrapper/run_this.py | ramongduraes/causality-detection | ab8aba6780006d8b7d5150add8cac6361e0b4cbb | [
"MIT"
] | null | null | null | service/causality-detection/Python_R_wrapper/run_this.py | ramongduraes/causality-detection | ab8aba6780006d8b7d5150add8cac6361e0b4cbb | [
"MIT"
] | null | null | null | service/causality-detection/Python_R_wrapper/run_this.py | ramongduraes/causality-detection | ab8aba6780006d8b7d5150add8cac6361e0b4cbb | [
"MIT"
] | null | null | null | from granger_causality import granger_causality
import pandas as pd
import numpy as np
our_data = pd.read_csv("natural_data2.csv")
our_data = our_data[np.where(our_data['Year'] == 1880)[0][0]:]
print(granger_causality(our_data, ['Ozone', 'WMGHG'], 'Temperature', lags=3, our_type='trend'))
| 32.444444 | 95 | 0.75 | 47 | 292 | 4.425532 | 0.574468 | 0.168269 | 0.211538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030303 | 0.09589 | 292 | 8 | 96 | 36.5 | 0.757576 | 0 | 0 | 0 | 0 | 0 | 0.160959 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0.166667 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
48f3eb2ad1126bf05f8801e2ec2b208e65000c72 | 2,997 | py | Python | TBranch.py | Dymaxion00/octotrike | be671b3b9f3e478168385e685fc7bd965a881b1c | [
"MIT"
] | 6 | 2015-08-26T03:28:37.000Z | 2020-02-28T02:15:03.000Z | TBranch.py | Dymaxion00/octotrike | be671b3b9f3e478168385e685fc7bd965a881b1c | [
"MIT"
] | null | null | null | TBranch.py | Dymaxion00/octotrike | be671b3b9f3e478168385e685fc7bd965a881b1c | [
"MIT"
] | null | null | null | #FIXME exceptions
#FIXME serialization
class TBranch(object):
def __init__(self, model, leafID, name = None):
self.model = model
self._ID = GUID()
self._leafID = leafID
self._rootID = None
self._name = name
self.model.branches.register(self._ID, self)
if self._name is not None:
self.model.branches.registerName(self._name, self._ID)
self.resetRoot()
pass
def getID(self):
pass
def getLeafID(self):
pass
def setLeaf(self, newLeafID):
if self.model.changes.get(newLeafID).isDescendant(self._leafID): #If the new leaf is below, extend
self._leafID = newLeafID
self.model.changes.get(newLeafID).addBranch(self._ID)
else:
if self.model.changes.get(newLeafID).isAncestor(self._leafID): #If the new leaf is above, contract
for child in self.model.changes.get(newLeafID):
child.deleteBranch(self._ID)
self._leafID = newLeafID
else: #New leaf is in an entirely different tree
self.model.changes.get(self._leafID).deleteBranch(self._ID)
self.model.changes.get(newLeafID).addBranch(self._ID)
self._leafID = newLeafID
self._rootID = self.model.changes.get(newLeafID).getRoot()
pass
def getRootID(self):
pass
def resetRoot(self):
"""We never explicitly set the root of a branch. If we've pruned the
changeset, we tell all branches to find their current root instead,
which prevents the tree pointers getting out of sync."""
self._rootID = self.model.changes.get(self._leafID).getRoot()
pass
def undoBefore(self, changeID):
"""Creates a new unnamed branch with the same state as our current
leaf, then sets our leaf to the parent of the change we're undoing."""
self.model.branches.branchFrom(self._leafID)
self.setLeaf(self.model.changes.get(changeID).getParent())
pass
#FIXME exeptions
def redo(self, changeID):
if not self.model.changes.get(self._leafID).isDescendant(changeID):
raise pass #Fails unless changeID descends from branchID->leafID
self.setLeaf(changeID)
pass
#FIXME serialization
def serialize(self):
pass
def delete(self):
self.model.changes.get(self._leafID).deleteBranch(self._ID)
self.model.changes.get(self._rootID).findFirstOnlyInDown(self._ID).delete()
self.model.branches.unregister(self._ID)
if self._name is not None:
self.model.branches.unregisterName(self._name)
pass
def deleteBranchOnly(self):
self.model.changes.get(self._leafID).deleteBranch(self._ID)
self.model.branches.unregister(self._ID)
if self._name is not None:
self.model.branches.unregisterName(self._name)
pass
| 36.108434 | 110 | 0.630631 | 365 | 2,997 | 5.071233 | 0.290411 | 0.106969 | 0.112372 | 0.133441 | 0.415991 | 0.37007 | 0.285251 | 0.259319 | 0.223123 | 0.203674 | 0 | 0 | 0.274274 | 2,997 | 82 | 111 | 36.54878 | 0.851034 | 0.076076 | 0 | 0.466667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02439 | 0 | 0 | null | null | 0.2 | 0 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
d28ca03ae6c62400d1f51a6a1d24a511a8fc9e2d | 214 | py | Python | djstripe/__init__.py | alecdalelio/dj-stripe | 24c1116c0809b338ab9c11707936bd95bbccdeaf | [
"MIT"
] | null | null | null | djstripe/__init__.py | alecdalelio/dj-stripe | 24c1116c0809b338ab9c11707936bd95bbccdeaf | [
"MIT"
] | null | null | null | djstripe/__init__.py | alecdalelio/dj-stripe | 24c1116c0809b338ab9c11707936bd95bbccdeaf | [
"MIT"
] | null | null | null | # todo remove in next major release as we no longer support django < 3.2 anyway. Note this would make dj-stripe unuseable for djang0 < 3.2
# for django < 3.2
default_app_config = "djstripe.apps.DjstripeAppConfig"
| 42.8 | 138 | 0.766355 | 36 | 214 | 4.5 | 0.833333 | 0.037037 | 0.098765 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039106 | 0.163551 | 214 | 4 | 139 | 53.5 | 0.865922 | 0.714953 | 0 | 0 | 0 | 0 | 0.534483 | 0.534483 | 0 | 0 | 0 | 0.25 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d2b3f59fe063b550aed8f4f999f91027ff899264 | 11,625 | py | Python | magpie/alembic/versions/2012-07-07_20671b28c538_change_all_linking_k.py | Ouranosinc/Magpie | 24c4ec2d3f98eb71fba7b199281882dbc62b6693 | [
"Apache-2.0"
] | null | null | null | magpie/alembic/versions/2012-07-07_20671b28c538_change_all_linking_k.py | Ouranosinc/Magpie | 24c4ec2d3f98eb71fba7b199281882dbc62b6693 | [
"Apache-2.0"
] | 366 | 2017-10-04T14:58:52.000Z | 2022-03-16T21:44:07.000Z | magpie/alembic/versions/2012-07-07_20671b28c538_change_all_linking_k.py | Ouranosinc/Magpie | 24c4ec2d3f98eb71fba7b199281882dbc62b6693 | [
"Apache-2.0"
] | 3 | 2018-09-05T13:46:04.000Z | 2021-02-05T14:52:15.000Z | """
change all linking keys from chars to id's.
Revision ID: 20671b28c538
Revises: 4c10d97c509
Create Date: 2012-07-07 21:49:21.906150
"""
from __future__ import unicode_literals
import sqlalchemy as sa
from alembic import op
from alembic.context import get_context # noqa: F401
from sqlalchemy.dialects.mysql.base import MySQLDialect
from sqlalchemy.engine.reflection import Inspector
# revision identifiers, used by Alembic.
revision = "20671b28c538"
down_revision = "4c10d97c509"
def upgrade():
c = get_context()
insp = Inspector.from_engine(c.connection.engine)
# existing migration
# pre naming convention keys
groups_permissions_pkey = "groups_permissions_pkey"
groups_pkey = "groups_pkey"
groups_resources_permissions_pkey = "groups_resources_permissions_pkey"
users_groups_pkey = "users_groups_pkey"
users_permissions_pkey = "users_permissions_pkey"
users_resources_permissions_pkey = "users_resources_permissions_pkey"
# inspected keys
groups_permissions_pkey = insp.get_pk_constraint("groups_permissions")["name"]
groups_pkey = insp.get_pk_constraint("groups")["name"]
groups_resources_permissions_pkey = insp.get_pk_constraint("groups_resources_permissions")["name"]
users_groups_pkey = insp.get_pk_constraint("users_groups")["name"]
users_permissions_pkey = insp.get_pk_constraint("users_permissions")["name"]
users_resources_permissions_pkey = insp.get_pk_constraint("users_resources_permissions")["name"]
op.drop_constraint("groups_pkey", "groups", type_="primary")
if isinstance(c.connection.engine.dialect, MySQLDialect):
op.add_column("groups", sa.Column("id", sa.Integer, primary_key=True,
autoincrement=False))
op.create_primary_key(groups_pkey, "groups", cols=["id"])
op.alter_column("groups", "id", type_=sa.Integer,
existing_type=sa.Integer, autoincrement=True,
existing_autoincrement=False, nullable=False)
else:
op.add_column("groups", sa.Column("id", sa.Integer, primary_key=True,
autoincrement=True))
op.create_primary_key(groups_pkey, "groups", cols=["id"])
if isinstance(c.connection.engine.dialect, MySQLDialect):
for t in ["groups_permissions", "groups_resources_permissions",
"users_groups"]:
for constraint in insp.get_foreign_keys(t):
if constraint["referred_columns"] == ["group_name"]:
op.drop_constraint(constraint["name"], t,
type_="foreignkey")
for t in ["users_resources_permissions", "users_permissions",
"users_groups"]:
for constraint in insp.get_foreign_keys(t):
if constraint["referred_columns"] == ["user_name"]:
op.drop_constraint(constraint["name"], t,
type_="foreignkey")
for constraint in insp.get_foreign_keys("resources"):
if constraint["referred_columns"] in [["user_name"],
["group_name"]]:
op.drop_constraint(constraint["name"], "resources",
type_="foreignkey")
op.add_column("resources", sa.Column("owner_user_id", sa.Integer(),
sa.ForeignKey("users.id",
onupdate="CASCADE",
ondelete="SET NULL")))
op.add_column("resources", sa.Column("owner_group_id", sa.Integer(),
sa.ForeignKey("groups.id",
onupdate="CASCADE",
ondelete="SET NULL")))
# update the data
op.execute("update resources set owner_user_id = (select id from users where users.user_name=owner_user_name)")
op.execute("update resources set owner_group_id = (select id from users where users.user_name=owner_group_name)")
# mysql is stupid as usual so we cant create FKEY and add PKEY later,
# need to set PKEY first and then set FKEY
if isinstance(c.connection.engine.dialect, MySQLDialect):
op.add_column("groups_permissions", sa.Column("group_id", sa.Integer()))
else:
op.add_column("groups_permissions", sa.Column("group_id", sa.Integer(),
sa.ForeignKey("groups.id",
onupdate="CASCADE",
ondelete="CASCADE")))
op.execute("""
update groups_permissions set group_id =
(select id from groups where groups.group_name=groups_permissions.group_name)""")
op.drop_constraint(groups_permissions_pkey, "groups_permissions",
type_="primary")
op.create_primary_key(groups_permissions_pkey, "groups_permissions",
cols=["group_id", "perm_name"])
if isinstance(c.connection.engine.dialect, MySQLDialect):
op.create_foreign_key(None, "groups_permissions", "groups",
remote_cols=["id"],
local_cols=["group_id"], onupdate="CASCADE",
ondelete="CASCADE")
if isinstance(c.connection.engine.dialect, MySQLDialect):
op.add_column("groups_resources_permissions",
sa.Column("group_id", sa.Integer()))
else:
op.add_column("groups_resources_permissions",
sa.Column("group_id", sa.Integer(),
sa.ForeignKey("groups.id", onupdate="CASCADE",
ondelete="CASCADE")))
op.execute("""
update groups_resources_permissions set group_id =
(select id from groups where groups.group_name=groups_resources_permissions.group_name)""")
op.drop_constraint(groups_resources_permissions_pkey,
"groups_resources_permissions",
type_="primary")
op.create_primary_key(groups_resources_permissions_pkey,
"groups_resources_permissions",
cols=["group_id", "resource_id", "perm_name"])
if isinstance(c.connection.engine.dialect, MySQLDialect):
op.create_foreign_key(None, "groups_resources_permissions", "groups",
remote_cols=["id"],
local_cols=["group_id"], onupdate="CASCADE",
ondelete="CASCADE")
if isinstance(c.connection.engine.dialect, MySQLDialect):
op.add_column("users_groups", sa.Column("group_id", sa.Integer()))
else:
op.add_column("users_groups", sa.Column("group_id", sa.Integer(),
sa.ForeignKey("groups.id",
onupdate="CASCADE",
ondelete="CASCADE")))
op.execute("""
update users_groups set group_id =
(select id from groups where groups.group_name=users_groups.group_name)""")
if isinstance(c.connection.engine.dialect, MySQLDialect):
op.add_column("users_groups", sa.Column("user_id", sa.Integer()))
else:
op.add_column("users_groups", sa.Column("user_id", sa.Integer(),
sa.ForeignKey("users.id",
onupdate="CASCADE",
ondelete="CASCADE")))
op.execute("""
update users_groups set user_id =
(select id from users where users.user_name=users_groups.user_name)""")
op.drop_constraint(users_groups_pkey, "users_groups", type="primary")
op.create_primary_key(users_groups_pkey, "users_groups",
cols=["user_id", "group_id"])
if isinstance(c.connection.engine.dialect, MySQLDialect):
op.create_foreign_key(None, "users_groups", "groups",
remote_cols=["id"],
local_cols=["group_id"], onupdate="CASCADE",
ondelete="CASCADE")
op.create_foreign_key(None, "users_groups", "users",
remote_cols=["id"],
local_cols=["user_id"], onupdate="CASCADE",
ondelete="CASCADE")
if isinstance(c.connection.engine.dialect, MySQLDialect):
op.add_column("users_permissions", sa.Column("user_id", sa.Integer()))
else:
op.add_column("users_permissions", sa.Column("user_id", sa.Integer(),
sa.ForeignKey("users.id",
onupdate="CASCADE",
ondelete="CASCADE")))
op.execute("""
update users_permissions set user_id =
(select id from groups where groups.group_name=users_permissions.user_name)""")
op.drop_constraint(users_permissions_pkey, "users_permissions",
type="primary")
op.create_primary_key(users_permissions_pkey, "users_permissions",
cols=["user_id", "perm_name"])
if isinstance(c.connection.engine.dialect, MySQLDialect):
op.create_foreign_key(None, "users_permissions", "users",
remote_cols=["id"],
local_cols=["user_id"], onupdate="CASCADE",
ondelete="CASCADE")
if isinstance(c.connection.engine.dialect, MySQLDialect):
op.add_column("users_resources_permissions",
sa.Column("user_id", sa.Integer()))
else:
op.add_column("users_resources_permissions",
sa.Column("user_id", sa.Integer(),
sa.ForeignKey("users.id", onupdate="CASCADE",
ondelete="CASCADE")))
op.execute("""
update users_resources_permissions set user_id =
(select id from users where users.user_name=users_resources_permissions.user_name)""")
op.drop_constraint(users_resources_permissions_pkey,
"users_resources_permissions",
type="primary")
op.create_primary_key(users_resources_permissions_pkey,
"users_resources_permissions",
cols=["user_id", "resource_id", "perm_name"])
if isinstance(c.connection.engine.dialect, MySQLDialect):
op.create_foreign_key(None, "users_resources_permissions", "users",
remote_cols=["id"],
local_cols=["user_id"], onupdate="CASCADE",
ondelete="CASCADE")
op.drop_column("resources", "owner_user_name")
op.drop_column("resources", "owner_group_name")
op.drop_column("groups_permissions", "group_name")
op.drop_column("groups_resources_permissions", "group_name")
op.drop_column("users_resources_permissions", "user_name")
op.drop_column("users_groups", "group_name")
op.drop_column("users_groups", "user_name")
op.drop_column("users_permissions", "user_name")
def downgrade():
pass
| 50.986842 | 117 | 0.573161 | 1,168 | 11,625 | 5.420377 | 0.10274 | 0.094772 | 0.025272 | 0.055284 | 0.816617 | 0.762281 | 0.708261 | 0.558522 | 0.519033 | 0.505765 | 0 | 0.007464 | 0.32 | 11,625 | 227 | 118 | 51.211454 | 0.793422 | 0.031656 | 0 | 0.475936 | 0 | 0 | 0.268991 | 0.085127 | 0 | 0 | 0 | 0 | 0 | 1 | 0.010695 | false | 0.005348 | 0.032086 | 0 | 0.042781 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d2b8aee47018418c8c1b30efc704065fa9743200 | 215 | py | Python | parsifal/reviews/metaanalysis/urls.py | glauberferreira/parsifal-mec | 66f85e0d48a270bddd1170caa2131bc74872462d | [
"MIT"
] | 1 | 2019-06-13T16:09:26.000Z | 2019-06-13T16:09:26.000Z | parsifal/reviews/metaanalysis/urls.py | glauberferreira/parsifal-mec | 66f85e0d48a270bddd1170caa2131bc74872462d | [
"MIT"
] | null | null | null | parsifal/reviews/metaanalysis/urls.py | glauberferreira/parsifal-mec | 66f85e0d48a270bddd1170caa2131bc74872462d | [
"MIT"
] | 3 | 2019-10-05T04:16:59.000Z | 2021-04-20T05:00:50.000Z | # coding: utf-8
from django.conf.urls import patterns, include, url
urlpatterns = patterns('parsifal.reviews.metaanalysis.views',
url(r'^save_metaanalysis/$', 'save_metaanalysis', name='save_metaanalysis'),
)
| 26.875 | 80 | 0.753488 | 26 | 215 | 6.115385 | 0.730769 | 0.301887 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005181 | 0.102326 | 215 | 7 | 81 | 30.714286 | 0.818653 | 0.060465 | 0 | 0 | 0 | 0 | 0.445 | 0.175 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 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 |
d2d512145c1d154c644dc5e5b1bd7c99d5f9af19 | 202 | py | Python | device/actuator/EWF/act_server/actions/deny.py | seanbrhn3/openc2-oif-device | 805c55e44f59f7c86c5bf347a6fc3787e6903df4 | [
"Apache-2.0"
] | null | null | null | device/actuator/EWF/act_server/actions/deny.py | seanbrhn3/openc2-oif-device | 805c55e44f59f7c86c5bf347a6fc3787e6903df4 | [
"Apache-2.0"
] | null | null | null | device/actuator/EWF/act_server/actions/deny.py | seanbrhn3/openc2-oif-device | 805c55e44f59f7c86c5bf347a6fc3787e6903df4 | [
"Apache-2.0"
] | null | null | null | """
Deny Target functions
"""
from ..utils import Dispatch, exceptions
Deny = Dispatch("deny")
@Deny.register
def default(*extra_args, **extra_kwargs):
return exceptions.target_not_implemented()
| 16.833333 | 46 | 0.742574 | 24 | 202 | 6.083333 | 0.708333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128713 | 202 | 11 | 47 | 18.363636 | 0.829545 | 0.10396 | 0 | 0 | 0 | 0 | 0.023121 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 0.6 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
d2e35750ae775348c9f6ba6dfffd716ebae9279a | 269 | py | Python | tests/conftest.py | sonic182/json_validator | f7a2f862a88715f589725467cb7608087c04bf0b | [
"MIT"
] | 5 | 2017-09-23T09:14:32.000Z | 2017-09-25T11:59:46.000Z | tests/conftest.py | sonic182/json_validator | f7a2f862a88715f589725467cb7608087c04bf0b | [
"MIT"
] | 2 | 2018-01-20T09:55:16.000Z | 2018-01-31T18:35:31.000Z | tests/conftest.py | sonic182/json_validator | f7a2f862a88715f589725467cb7608087c04bf0b | [
"MIT"
] | null | null | null |
import pytest
@pytest.fixture
def validator():
"""Return validator fixture."""
from json_validator import JsonValidator
return JsonValidator
@pytest.fixture
def dumps():
"""Return json dumps fixture."""
from json import dumps
return dumps
| 14.944444 | 44 | 0.698885 | 30 | 269 | 6.233333 | 0.333333 | 0.139037 | 0.171123 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.211896 | 269 | 17 | 45 | 15.823529 | 0.882075 | 0.193309 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | true | 0 | 0.333333 | 0 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
9605906e0096f2f88742a833678c0ed3e6a23e0c | 64 | py | Python | test/support/hpa.py | ankane/tomoto | b38811d21f5fa025aeaed4caf0dfe33d1ecea73b | [
"MIT"
] | 41 | 2020-10-09T23:01:41.000Z | 2021-09-17T15:26:02.000Z | test/support/hpa.py | ankane/tomoto-ruby | 664a427f28c211278f5a4359d7a19ba27a933c50 | [
"MIT"
] | 3 | 2020-10-09T23:53:33.000Z | 2021-08-18T21:41:28.000Z | test/support/hpa.py | ankane/tomoto-ruby | 664a427f28c211278f5a4359d7a19ba27a933c50 | [
"MIT"
] | 1 | 2021-04-20T04:22:16.000Z | 2021-04-20T04:22:16.000Z | import tomotopy as tp
model = tp.HPAModel()
print(model.alpha)
| 12.8 | 21 | 0.75 | 10 | 64 | 4.8 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140625 | 64 | 4 | 22 | 16 | 0.872727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
9618fab06a63d0bee0e979db3f5d0d96144f777f | 254 | py | Python | styleguide_example/common/types.py | HackSoftware/Django-Styleguide-Example | 5cb309cc2ffc9d552be89d417d84a82d3f25d6a2 | [
"MIT"
] | 72 | 2021-12-07T09:21:26.000Z | 2022-03-29T12:35:29.000Z | styleguide_example/common/types.py | gelfik/Django-Styleguide-Example | 40d1532f761624238e62325eb87f57b214af1a82 | [
"MIT"
] | 21 | 2021-12-13T13:34:43.000Z | 2022-03-28T09:07:42.000Z | styleguide_example/common/types.py | gelfik/Django-Styleguide-Example | 40d1532f761624238e62325eb87f57b214af1a82 | [
"MIT"
] | 11 | 2021-12-09T16:52:40.000Z | 2022-03-10T11:45:15.000Z | from typing import TypeVar
from django.db import models
# Generic type for a Django model
# Reference: https://mypy.readthedocs.io/en/stable/kinds_of_types.html#the-type-of-class-objects
DjangoModelType = TypeVar('DjangoModelType', bound=models.Model)
| 31.75 | 96 | 0.80315 | 37 | 254 | 5.459459 | 0.756757 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.094488 | 254 | 7 | 97 | 36.285714 | 0.878261 | 0.492126 | 0 | 0 | 0 | 0 | 0.12 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 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 |
824d6f4c4ccd4cda0298b559d279b4fa06cc4b81 | 1,018 | py | Python | tronx/helpers/datavars/userconfig.py | TronUb/Tron | 55b5067a34cf2849913647533d7d035cab64568e | [
"MIT"
] | 4 | 2022-03-07T07:27:04.000Z | 2022-03-29T05:59:57.000Z | tronx/helpers/datavars/userconfig.py | TronUb/Tron | 55b5067a34cf2849913647533d7d035cab64568e | [
"MIT"
] | null | null | null | tronx/helpers/datavars/userconfig.py | TronUb/Tron | 55b5067a34cf2849913647533d7d035cab64568e | [
"MIT"
] | 3 | 2022-03-05T15:24:51.000Z | 2022-03-14T08:48:05.000Z |
USERDV = [
"USER_NAME",
"USER_USERNAME",
"USER_ID",
"USER_PIC",
"USER_BIO"
]
class UserConfig(object):
def UserName(self):
"""returns name of user"""
return self.getdv("USER_NAME") or self.USER_NAME or self.name or None
def UserUsername(self):
"""returns username of user"""
return self.getdv("USER_USERNAME") or self.USER_USERNAME or self.username or None
def UserMention(self):
"""returns mention of user"""
return self.MentionMarkdown(self.UserId(), self.UserName()) if self.UserName() and self.UserId() else None
def UserId(self):
"""returns telegram id of user"""
return self.getdv("USER_ID") or self.USER_ID or self.id or None
def UserDc(self):
"""returns telegram dc id of user"""
return self.getdv("DC_ID") or self.dc_id or None
def UserPic(self):
"""returns pic of user"""
return self.getdv("USER_PIC") or self.USER_PIC or self.pic or None
def UserBio(self):
"""returns bio of user"""
return self.getdv("USER_BIO") or self.USER_BIO or self.bio or None
| 22.130435 | 108 | 0.697446 | 162 | 1,018 | 4.277778 | 0.191358 | 0.095238 | 0.121212 | 0.161616 | 0.21645 | 0.21645 | 0 | 0 | 0 | 0 | 0 | 0 | 0.165029 | 1,018 | 45 | 109 | 22.622222 | 0.815294 | 0.165029 | 0 | 0 | 0 | 0 | 0.116851 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.318182 | false | 0 | 0 | 0 | 0.681818 | 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 |
8258548b39290091213afc8a749bd58e66f795cd | 597 | py | Python | app/bruteForce/python/bubbleSort.py | hossamelmansy/theory-of-algorithms | 985170843ba741547e9884b280d7e515670c402e | [
"MIT"
] | null | null | null | app/bruteForce/python/bubbleSort.py | hossamelmansy/theory-of-algorithms | 985170843ba741547e9884b280d7e515670c402e | [
"MIT"
] | 3 | 2021-01-28T20:10:15.000Z | 2022-03-25T18:52:46.000Z | app/bruteForce/python/bubbleSort.py | hossamelmansy/computer-algorithms | 985170843ba741547e9884b280d7e515670c402e | [
"MIT"
] | null | null | null | import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--list')
args = parser.parse_args()
alist = eval('[' + args.list + ']')
for i in range(len(alist) - 1):
for j in range(0, len(alist)-i-1):
if alist[j] > alist[j+1]:
print alist,
print ">> Since (%s > %s) then Swap %s <--> %s" % (alist[j], alist[j+1], alist[j], alist[j+1])
alist[j], alist[j+1] = alist[j+1], alist[j]
else:
print alist,
print ">> Since (%s <= %s) then Keep" % (alist[j], alist[j+1])
print ""
print "Sorted Array:", alist
| 28.428571 | 106 | 0.527638 | 88 | 597 | 3.556818 | 0.329545 | 0.230032 | 0.134185 | 0.191693 | 0.43131 | 0.408946 | 0.309904 | 0.14377 | 0.14377 | 0.14377 | 0 | 0.02069 | 0.271357 | 597 | 20 | 107 | 29.85 | 0.698851 | 0 | 0 | 0.125 | 0 | 0 | 0.149079 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.0625 | null | null | 0.375 | 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 |
8284ef219e169575f9463bed9da5176fb231129b | 192 | py | Python | herder/tests/functional/test_language.py | cc-archive/i18nedit | 05de6cc0ac033b486b72991823b7660b8f894da8 | [
"MIT"
] | null | null | null | herder/tests/functional/test_language.py | cc-archive/i18nedit | 05de6cc0ac033b486b72991823b7660b8f894da8 | [
"MIT"
] | null | null | null | herder/tests/functional/test_language.py | cc-archive/i18nedit | 05de6cc0ac033b486b72991823b7660b8f894da8 | [
"MIT"
] | null | null | null | from herder.tests import *
class TestLanguageController(TestController):
def test_index(self):
response = self.app.get(url_for(controller='language'))
# Test response...
| 24 | 63 | 0.697917 | 21 | 192 | 6.285714 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1875 | 192 | 7 | 64 | 27.428571 | 0.846154 | 0.083333 | 0 | 0 | 0 | 0 | 0.045977 | 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 |
82c3d920f6ee1178c79b5063d36b477d61ac0305 | 6,857 | py | Python | modules/mute.py | AlexanderBaransky/PilotTelegramBot-telebot | 009a99334e56c7129230106dc717358bcd894a85 | [
"Apache-2.0"
] | null | null | null | modules/mute.py | AlexanderBaransky/PilotTelegramBot-telebot | 009a99334e56c7129230106dc717358bcd894a85 | [
"Apache-2.0"
] | null | null | null | modules/mute.py | AlexanderBaransky/PilotTelegramBot-telebot | 009a99334e56c7129230106dc717358bcd894a85 | [
"Apache-2.0"
] | null | null | null | import telebot
import config
from translation import tw
import time
bot = telebot.TeleBot(config.token)
# Мут навсегда
def mute(message):
trans = tw.get_translation(message)
if trans == 1:
return
try:
member = bot.get_chat_member(chat_id=message.chat.id,
user_id=message.from_user.id)
if member.status == 'creator' or member.status == 'administrator':
if len(message.text.split()) > 1:
words = message.text.split()
timeout = words[1]
timeout_units = timeout[-1:]
timeout_numbers = timeout[:-1]
if timeout_units == 's' and int(timeout_numbers) < 30:
bot.send_message(chat_id=message.chat.id,
text=trans['mute']['tmute_too_few'])
return
final_timeout = None
timeout_text = None
if str(type(tw.get_translation(message)['global']['time']['seconds'])) == "<class 'list'>":
if timeout_units == 's':
final_timeout = int(timeout_numbers)
if int(timeout_numbers[-1:]) == 1:
text = trans['global']['time']['seconds'][0]
elif 2 <= int(timeout_numbers) <= 4:
text = trans['global']['time']['seconds'][1]
else:
text = trans['global']['time']['seconds'][2]
timeout_text = timeout_numbers + ' ' + text
elif timeout_units == 'm':
final_timeout = int(timeout_numbers) * 60
if int(timeout_numbers[-1:]) == 1:
text = trans['global']['time']['minutes'][0]
elif 2 <= int(timeout_numbers) <= 4:
text = trans['global']['time']['minutes'][1]
else:
text = trans['global']['time']['minutes'][2]
timeout_text = timeout_numbers + ' ' + text
elif timeout_units == 'h':
final_timeout = int(timeout_numbers) * 3600
if int(timeout_numbers) == 1:
text = trans['global']['time']['hours'][0]
elif 2 <= int(timeout_numbers) <= 4:
text = trans['global']['time']['hours'][1]
else:
text = trans['global']['time']['hours'][2]
timeout_text = timeout_numbers + ' ' + text
elif timeout_units == 'd':
final_timeout = int(timeout_numbers) * 86400
if int(timeout_numbers) == 1:
text = trans['global']['time']['days'][0]
elif 2 <= int(timeout_numbers[-1:]) <= 4:
text = trans['global']['time']['days'][1]
else:
text = trans['global']['time']['days'][2]
timeout_text = timeout_numbers + ' ' + text
else:
if timeout_units == 's':
final_timeout = int(timeout_numbers)
text = trans['global']['time']['seconds']
timeout_text = timeout_numbers + ' ' + text
elif timeout_units == 'm':
final_timeout = int(timeout_numbers) * 60
text = trans['global']['time']['minutes']
timeout_text = timeout_numbers + ' ' + text
elif timeout_units == 'h':
final_timeout = int(timeout_numbers) * 3600
text = trans['global']['time']['hours']
timeout_text = timeout_numbers + ' ' + text
elif timeout_units == 'd':
final_timeout = int(timeout_numbers) * 86400
text = trans['global']['time']['days']
timeout_text = timeout_numbers + ' ' + text
bot.restrict_chat_member(chat_id=message.chat.id,
user_id=message.reply_to_message.from_user.id,
can_send_messages=False,
until_date=int(time.time()) + final_timeout)
bot.send_message(chat_id=message.chat.id,
text=trans['mute']['tmute'].format(
username=str(message.reply_to_message.from_user.username),
time=timeout_text))
else:
bot.restrict_chat_member(chat_id=message.chat.id,
user_id=message.reply_to_message.from_user.id,
can_send_messages=False,
until_date=0)
bot.send_message(chat_id=message.chat.id,
text=trans['mute']['mute'].format(username=str(message.reply_to_message.from_user.username)))
else:
bot.reply_to(message, trans['global']['errors']['admin'])
except Exception:
bot.reply_to(message, trans['global']['errors']['default'])
# Размут
def unmute(message):
trans = tw.get_translation(message)
if trans == 1:
return
try:
member = bot.get_chat_member(chat_id=message.chat.id,
user_id=message.from_user.id)
if member.status == 'creator' or member.status == 'administrator':
chat = bot.get_chat(chat_id=message.chat.id)
perms = chat.permissions
bot.restrict_chat_member(chat_id=message.chat.id,
user_id=message.reply_to_message.from_user.id,
can_send_messages=True,
can_send_media_messages=perms.can_send_media_messages,
can_send_polls=perms.can_send_polls,
can_send_other_messages=perms.can_send_other_messages,
can_add_web_page_previews=perms.can_add_web_page_previews,
until_date=0)
bot.send_message(chat_id=message.chat.id,
text=trans['mute']['unmute'].format(username=str(message.reply_to_message.from_user.username)))
else:
bot.reply_to(message, trans['global']['errors']['admin'])
except Exception:
bot.reply_to(message, trans['global']['errors']['default'])
| 50.419118 | 126 | 0.466093 | 652 | 6,857 | 4.674847 | 0.141104 | 0.119423 | 0.094816 | 0.099738 | 0.81168 | 0.720472 | 0.671588 | 0.671588 | 0.671588 | 0.616142 | 0 | 0.014847 | 0.420446 | 6,857 | 135 | 127 | 50.792593 | 0.752139 | 0.002771 | 0 | 0.61157 | 0 | 0 | 0.066715 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.016529 | false | 0 | 0.033058 | 0 | 0.07438 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 |
82e7c0ab262beffea7f4aae39c09881d1a70b127 | 712 | py | Python | tests/conftest.py | gsong/interactor | c89bf2a8aa628f8abdbf80769fdedb5096f9790b | [
"MIT"
] | null | null | null | tests/conftest.py | gsong/interactor | c89bf2a8aa628f8abdbf80769fdedb5096f9790b | [
"MIT"
] | 11 | 2016-11-28T17:08:36.000Z | 2016-12-02T01:52:39.000Z | tests/conftest.py | gsong/interactor | c89bf2a8aa628f8abdbf80769fdedb5096f9790b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from pathlib import Path
import pytest
import yaml
from interdiagram.models.diagram import Diagram
HERE = Path(__file__).parent
INPUT1 = HERE / 'data/data1.yaml'
INPUT2 = HERE / 'data/data2.yaml'
def _load(p):
with p.open() as f:
content = yaml.load(f)
return content
@pytest.fixture
def diagram(input1_data, input2_data):
d = Diagram()
d.process_spec(input1_data)
d.process_spec(input2_data)
return d
@pytest.fixture
def input1():
return INPUT1.as_posix()
@pytest.fixture
def input1_data():
return _load(INPUT1)
@pytest.fixture
def input2():
return INPUT2.as_posix()
@pytest.fixture
def input2_data():
return _load(INPUT2)
| 15.148936 | 47 | 0.692416 | 99 | 712 | 4.808081 | 0.343434 | 0.136555 | 0.168067 | 0.092437 | 0.096639 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029514 | 0.191011 | 712 | 46 | 48 | 15.478261 | 0.796875 | 0.029494 | 0 | 0.172414 | 0 | 0 | 0.043541 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.206897 | false | 0 | 0.137931 | 0.137931 | 0.551724 | 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 |
82e8fca64c98b4c25e5907bd899b0bf96180f54a | 121 | py | Python | lab/src/bombe/cli/__main__.py | techiaith/docker-marian-nmt | 1d16cbd16422f45ac388b748713ee5cccd3e58fb | [
"MIT"
] | null | null | null | lab/src/bombe/cli/__main__.py | techiaith/docker-marian-nmt | 1d16cbd16422f45ac388b748713ee5cccd3e58fb | [
"MIT"
] | null | null | null | lab/src/bombe/cli/__main__.py | techiaith/docker-marian-nmt | 1d16cbd16422f45ac388b748713ee5cccd3e58fb | [
"MIT"
] | null | null | null | import click
from . import session, tasks
cli = click.Group(commands=dict(tasks=tasks.cli, session=session.cli))
cli()
| 17.285714 | 70 | 0.752066 | 18 | 121 | 5.055556 | 0.5 | 0.175824 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115702 | 121 | 6 | 71 | 20.166667 | 0.850467 | 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 |
7d576d99ffdbed65a4bac3a88937eae8acd1ad2e | 510 | py | Python | hello.py | lsykanade/cgi-lab | c06df89f3b731465ada7cd471f80c6daf85e0090 | [
"Apache-2.0"
] | null | null | null | hello.py | lsykanade/cgi-lab | c06df89f3b731465ada7cd471f80c6daf85e0090 | [
"Apache-2.0"
] | null | null | null | hello.py | lsykanade/cgi-lab | c06df89f3b731465ada7cd471f80c6daf85e0090 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
import os
import json
import templates
print('Content-Type: application/json')
print()
print(json.dumps(dict(os.environ), indent=2))
# print('Content-Type: text/html')
# print()
# print("""<!DOCTYPE html>
# <html>
# <body>
# <h1>HELLO I AM HTML</h1>
# """)
# print("<ul>")
# print(f"<p> QUERY_STRING={os.environ['QUERY_STRING']} </p >")
# print(f"<p> HTTP_USER_AGENT={os.environ['HTTP_USER_AGENT']} </p>")
# print("""
# </ul>
# """)
# print("""
# </ul>
# </body>
# </html>
# """)
| 16.451613 | 68 | 0.598039 | 71 | 510 | 4.211268 | 0.464789 | 0.090301 | 0.107023 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009009 | 0.129412 | 510 | 30 | 69 | 17 | 0.664414 | 0.652941 | 0 | 0 | 0 | 0 | 0.191083 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 3 |
7d8d2ae47a7bb442c5d1b66341984d47437032e8 | 364 | py | Python | pyhanabi/common_utils/__init__.py | ravihammond/hanabi-convention-adaptation | 5dafa91742de8e8d5810e8213e0e2771818b2f54 | [
"MIT"
] | 1 | 2022-03-24T19:41:22.000Z | 2022-03-24T19:41:22.000Z | pyhanabi/common_utils/__init__.py | ravihammond/hanabi-convention-adaptation | 5dafa91742de8e8d5810e8213e0e2771818b2f54 | [
"MIT"
] | null | null | null | pyhanabi/common_utils/__init__.py | ravihammond/hanabi-convention-adaptation | 5dafa91742de8e8d5810e8213e0e2771818b2f54 | [
"MIT"
] | null | null | null | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from .assert_utils import *
from .helper import *
from .logger import *
from .saver import *
from .multi_counter import MultiCounter
from .stopwatch import Stopwatch
| 28 | 61 | 0.769231 | 53 | 364 | 5.245283 | 0.679245 | 0.143885 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167582 | 364 | 12 | 62 | 30.333333 | 0.917492 | 0.508242 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
7d8f8d9f27ab1cc134ec374260916ceba3f8c00f | 10,182 | py | Python | multichaindb/backend/query.py | mamaeo/multichaindb | 7791f5fc935be40482f101b6cba3000d065ee136 | [
"CC-BY-3.0",
"CC0-1.0",
"CC-BY-4.0"
] | null | null | null | multichaindb/backend/query.py | mamaeo/multichaindb | 7791f5fc935be40482f101b6cba3000d065ee136 | [
"CC-BY-3.0",
"CC0-1.0",
"CC-BY-4.0"
] | null | null | null | multichaindb/backend/query.py | mamaeo/multichaindb | 7791f5fc935be40482f101b6cba3000d065ee136 | [
"CC-BY-3.0",
"CC0-1.0",
"CC-BY-4.0"
] | null | null | null | # Copyright © 2020 Interplanetary Database Association e.V.,
# BigchainDB and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
"""Query interfaces for backends."""
from functools import singledispatch
from multichaindb.backend.exceptions import OperationError
@singledispatch
def store_asset(connection, asset):
"""Write an asset to the asset table.
Args:
asset (dict): the asset.
Returns:
The result of the operation.
"""
raise NotImplementedError
@singledispatch
def store_assets(connection, assets):
"""Write a list of assets to the assets table.
Args:
assets (list): a list of assets to write.
Returns:
The database response.
"""
raise NotImplementedError
@singledispatch
def store_metadatas(connection, metadata):
"""Write a list of metadata to metadata table.
Args:
metadata (list): list of metadata.
Returns:
The result of the operation.
"""
raise NotImplementedError
@singledispatch
def store_transactions(connection, signed_transactions):
"""Store the list of transactions."""
raise NotImplementedError
@singledispatch
def get_transaction(connection, transaction_id):
"""Get a transaction from the transactions table.
Args:
transaction_id (str): the id of the transaction.
Returns:
The result of the operation.
"""
raise NotImplementedError
@singledispatch
def get_transactions(connection, transaction_ids):
"""Get transactions from the transactions table.
Args:
transaction_ids (list): list of transaction ids to fetch
Returns:
The result of the operation.
"""
raise NotImplementedError
@singledispatch
def get_asset(connection, asset_id):
"""Get a transaction from the transactions table.
Args:
asset_id (str): the id of the asset
Returns:
The result of the operation.
"""
raise NotImplementedError
@singledispatch
def get_spent(connection, transaction_id, condition_id):
"""Check if a `txid` was already used as an input.
A transaction can be used as an input for another transaction. Bigchain
needs to make sure that a given `txid` is only used once.
Args:
transaction_id (str): The id of the transaction.
condition_id (int): The index of the condition in the respective
transaction.
Returns:
The transaction that used the `txid` as an input else `None`
"""
raise NotImplementedError
@singledispatch
def get_spending_transactions(connection, inputs):
"""Return transactions which spend given inputs
Args:
inputs (list): list of {txid, output}
Returns:
Iterator of (block_ids, transaction) for transactions that
spend given inputs.
"""
raise NotImplementedError
@singledispatch
def get_owned_ids(connection, owner):
"""Retrieve a list of `txids` that can we used has inputs.
Args:
owner (str): base58 encoded public key.
Returns:
Iterator of (block_id, transaction) for transactions
that list given owner in conditions.
"""
raise NotImplementedError
@singledispatch
def get_block(connection, block_id):
"""Get a block from the bigchain table.
Args:
block_id (str): block id of the block to get
Returns:
block (dict): the block or `None`
"""
raise NotImplementedError
@singledispatch
def get_block_with_transaction(connection, txid):
"""Get a block containing transaction id `txid`
Args:
txid (str): id of transaction to be searched.
Returns:
block_id (int): the block id or `None`
"""
raise NotImplementedError
@singledispatch
def get_metadata(connection, transaction_ids):
"""Get a list of metadata from the metadata table.
Args:
transaction_ids (list): a list of ids for the metadata to be retrieved from
the database.
Returns:
metadata (list): the list of returned metadata.
"""
raise NotImplementedError
@singledispatch
def get_assets(connection, asset_ids):
"""Get a list of assets from the assets table.
Args:
asset_ids (list): a list of ids for the assets to be retrieved from
the database.
Returns:
assets (list): the list of returned assets.
"""
raise NotImplementedError
@singledispatch
def get_txids_filtered(connection, asset_id, operation=None):
"""Return all transactions for a particular asset id and optional operation.
Args:
asset_id (str): ID of transaction that defined the asset
operation (str) (optional): Operation to filter on
"""
raise NotImplementedError
@singledispatch
def text_search(conn, search, *, language='english', case_sensitive=False,
diacritic_sensitive=False, text_score=False, limit=0, table=None):
"""Return all the assets that match the text search.
The results are sorted by text score.
For more information about the behavior of text search on MongoDB see
https://docs.mongodb.com/manual/reference/operator/query/text/#behavior
Args:
search (str): Text search string to query the text index
language (str, optional): The language for the search and the rules for
stemmer and tokenizer. If the language is ``None`` text search uses
simple tokenization and no stemming.
case_sensitive (bool, optional): Enable or disable case sensitive
search.
diacritic_sensitive (bool, optional): Enable or disable case sensitive
diacritic search.
text_score (bool, optional): If ``True`` returns the text score with
each document.
limit (int, optional): Limit the number of returned documents.
Returns:
:obj:`list` of :obj:`dict`: a list of assets
Raises:
OperationError: If the backend does not support text search
"""
raise OperationError('This query is only supported when running '
'BigchainDB with MongoDB as the backend.')
@singledispatch
def get_latest_block(conn):
"""Get the latest commited block i.e. block with largest height"""
raise NotImplementedError
@singledispatch
def store_block(conn, block):
"""Write a new block to the `blocks` table
Args:
block (dict): block with current height and block hash.
Returns:
The result of the operation.
"""
raise NotImplementedError
@singledispatch
def store_unspent_outputs(connection, unspent_outputs):
"""Store unspent outputs in ``utxo_set`` table."""
raise NotImplementedError
@singledispatch
def delete_unspent_outputs(connection, unspent_outputs):
"""Delete unspent outputs in ``utxo_set`` table."""
raise NotImplementedError
@singledispatch
def delete_transactions(conn, txn_ids):
"""Delete transactions from database
Args:
txn_ids (list): list of transaction ids
Returns:
The result of the operation.
"""
raise NotImplementedError
@singledispatch
def get_unspent_outputs(connection, *, query=None):
"""Retrieves unspent outputs.
Args:
query (dict): An optional parameter to filter the result set.
Defaults to ``None``, which means that all UTXO records
will be returned.
Returns:
Generator yielding unspent outputs (UTXO set) according to the
given query.
"""
raise NotImplementedError
@singledispatch
def store_pre_commit_state(connection, state):
"""Store pre-commit state.
Args:
state (dict): pre-commit state.
Returns:
The result of the operation.
"""
raise NotImplementedError
@singledispatch
def get_pre_commit_state(connection):
"""Get pre-commit state.
Returns:
Document representing the pre-commit state.
"""
raise NotImplementedError
@singledispatch
def store_validator_set(conn, validator_update):
"""Store updated validator set"""
raise NotImplementedError
@singledispatch
def delete_validator_set(conn, height):
"""Delete the validator set at the given height."""
raise NotImplementedError
@singledispatch
def store_election(conn, election_id, height, is_concluded):
"""Store election record"""
raise NotImplementedError
@singledispatch
def store_elections(conn, elections):
"""Store election records in bulk"""
raise NotImplementedError
@singledispatch
def delete_elections(conn, height):
"""Delete all election records at the given height"""
raise NotImplementedError
@singledispatch
def get_validator_set(conn, height):
"""Get validator set for a given `height`, if `height` is not specified
then return the latest validator set
"""
raise NotImplementedError
@singledispatch
def get_election(conn, election_id):
"""Return the election record
"""
raise NotImplementedError
@singledispatch
def get_asset_tokens_for_public_key(connection, asset_id, public_key):
"""Retrieve a list of tokens of type `asset_id` that are owned by the `public_key`.
Args:
asset_id (str): Id of the token.
public_key (str): base58 encoded public key
Returns:
Iterator of transaction that list given owner in conditions.
"""
raise NotImplementedError
@singledispatch
def store_abci_chain(conn, height, chain_id, is_synced=True):
"""Create or update an ABCI chain at the given height.
Usually invoked in the beginning of the ABCI communications (height=0)
or when ABCI client (like Tendermint) is migrated (any height).
Args:
is_synced: True if the chain is known by both ABCI client and server
"""
raise NotImplementedError
@singledispatch
def delete_abci_chain(conn, height):
"""Delete the ABCI chain at the given height."""
raise NotImplementedError
@singledispatch
def get_latest_abci_chain(conn):
"""Returns the ABCI chain stored at the biggest height, if any,
None otherwise.
"""
raise NotImplementedError
| 23.62413 | 87 | 0.690532 | 1,242 | 10,182 | 5.57649 | 0.193237 | 0.085908 | 0.181057 | 0.195351 | 0.403119 | 0.313457 | 0.238088 | 0.213543 | 0.172394 | 0.130811 | 0 | 0.002311 | 0.235121 | 10,182 | 430 | 88 | 23.67907 | 0.886877 | 0.552642 | 0 | 0.633028 | 0 | 0 | 0.023188 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.321101 | false | 0 | 0.018349 | 0 | 0.33945 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7d99299b15b0a27aee77abd7bda439298733b1f4 | 434 | py | Python | other/dingding/dingtalk/api/rest/OapiAttendanceApproveCancelRequest.py | hth945/pytest | 83e2aada82a2c6a0fdd1721320e5bf8b8fd59abc | [
"Apache-2.0"
] | null | null | null | other/dingding/dingtalk/api/rest/OapiAttendanceApproveCancelRequest.py | hth945/pytest | 83e2aada82a2c6a0fdd1721320e5bf8b8fd59abc | [
"Apache-2.0"
] | null | null | null | other/dingding/dingtalk/api/rest/OapiAttendanceApproveCancelRequest.py | hth945/pytest | 83e2aada82a2c6a0fdd1721320e5bf8b8fd59abc | [
"Apache-2.0"
] | null | null | null | '''
Created by auto_sdk on 2021.03.03
'''
from dingtalk.api.base import RestApi
class OapiAttendanceApproveCancelRequest(RestApi):
def __init__(self,url=None):
RestApi.__init__(self,url)
self.approve_id = None
self.dingtalk_approve_id = None
self.sub_type = None
self.tag_name = None
self.userid = None
def getHttpMethod(self):
return 'POST'
def getapiname(self):
return 'dingtalk.oapi.attendance.approve.cancel'
| 22.842105 | 50 | 0.75576 | 60 | 434 | 5.233333 | 0.566667 | 0.101911 | 0.070064 | 0.10828 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02139 | 0.138249 | 434 | 18 | 51 | 24.111111 | 0.818182 | 0.076037 | 0 | 0 | 0 | 0 | 0.109415 | 0.099237 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.076923 | 0.153846 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
7da9ae92fff5e2ec092a5379cdd062b7ac51f36e | 181 | py | Python | CGSearchRace/Referee.py | ApfelPresse/CGSearchRace | 10f92d55b087bc038f42a5a461c1e7a05fdbeeab | [
"MIT"
] | 1 | 2021-02-27T21:11:26.000Z | 2021-02-27T21:11:26.000Z | CGSearchRace/Referee.py | ApfelPresse/CGSearchRace | 10f92d55b087bc038f42a5a461c1e7a05fdbeeab | [
"MIT"
] | null | null | null | CGSearchRace/Referee.py | ApfelPresse/CGSearchRace | 10f92d55b087bc038f42a5a461c1e7a05fdbeeab | [
"MIT"
] | null | null | null | from CGSearchRace.Game import Game
class Referee:
def __init__(self, user_input):
self.game = Game(user_input)
def game_turn(self):
self.game.on_round()
| 16.454545 | 36 | 0.668508 | 25 | 181 | 4.52 | 0.56 | 0.159292 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.237569 | 181 | 10 | 37 | 18.1 | 0.818841 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.166667 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
7daf426ded9534061aac6e75f88a6d152f6b4f1d | 838 | py | Python | bfg9000/builtins/path.py | thomasrockhu/bfg9000 | 1cd1226eab9bed2fc2ec6acccf7864fdcf2ed31a | [
"BSD-3-Clause"
] | 1 | 2020-05-15T07:24:43.000Z | 2020-05-15T07:24:43.000Z | bfg9000/builtins/path.py | thomasrockhu/bfg9000 | 1cd1226eab9bed2fc2ec6acccf7864fdcf2ed31a | [
"BSD-3-Clause"
] | null | null | null | bfg9000/builtins/path.py | thomasrockhu/bfg9000 | 1cd1226eab9bed2fc2ec6acccf7864fdcf2ed31a | [
"BSD-3-Clause"
] | null | null | null | import re
from . import builtin
from .. import path as _path
from ..iterutils import map_iterable
for i in (_path.Root, _path.InstallRoot):
builtin.default(context='*')(i)
builtin.default(context='*', name='Path')(_path.Path)
@builtin.function(context=('build', 'options'))
def relpath(context, path, strict=False):
return _path.Path.ensure(path, context.path.parent(), strict=strict)
def relname(context, name):
return map_iterable(lambda i: context['relpath'](i).suffix, name)
def buildpath(context, path, strict=False):
base = context.path.parent().reroot()
return _path.Path.ensure(path, base, strict=strict)
def within_directory(path, directory):
suffix = path.relpath(directory.parent(), localize=False)
suffix = re.sub(r'(^|/)..(?=/|$)', r'\1PAR', suffix)
return directory.append(suffix)
| 27.032258 | 72 | 0.701671 | 110 | 838 | 5.263636 | 0.363636 | 0.055268 | 0.072539 | 0.075993 | 0.082902 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001374 | 0.131265 | 838 | 30 | 73 | 27.933333 | 0.793956 | 0 | 0 | 0 | 0 | 0 | 0.052506 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0 | 0.210526 | 0.105263 | 0.631579 | 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 |
7dc16f009d7a433429dde9c4afca2c9f8678705d | 226 | py | Python | sniffer/protocols/icmp.py | simonlovgren/nwtools | af1f2e45162f5898f8ee91a2a82f5d324ac5d77e | [
"MIT"
] | 1 | 2021-04-25T22:17:16.000Z | 2021-04-25T22:17:16.000Z | sniffer/protocols/icmp.py | simonlovgren/nwtools | af1f2e45162f5898f8ee91a2a82f5d324ac5d77e | [
"MIT"
] | null | null | null | sniffer/protocols/icmp.py | simonlovgren/nwtools | af1f2e45162f5898f8ee91a2a82f5d324ac5d77e | [
"MIT"
] | null | null | null | #! /usr/bin/env python
import socket
import os
import platform
import sys
import getopt
import struct
from ctypes import *
class ICMP(Structure):
_fields_ = [
#("error", c_int),
#("msg", nlmsghdr)
]
| 13.294118 | 26 | 0.641593 | 28 | 226 | 5.071429 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.247788 | 226 | 16 | 27 | 14.125 | 0.835294 | 0.243363 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.7 | 0 | 0.9 | 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 |
7dcbda16b217a7593bb5ddc50d9419a99cc46aa9 | 242 | py | Python | src/presentation/controllers/__init__.py | panda-coder/py-clean-flask | e7b8af5056178cd1dc6161f52a909f8043dc4b66 | [
"MIT"
] | null | null | null | src/presentation/controllers/__init__.py | panda-coder/py-clean-flask | e7b8af5056178cd1dc6161f52a909f8043dc4b66 | [
"MIT"
] | null | null | null | src/presentation/controllers/__init__.py | panda-coder/py-clean-flask | e7b8af5056178cd1dc6161f52a909f8043dc4b66 | [
"MIT"
] | null | null | null | __all__ = ['SumController', 'SubtractController', 'MultiplyController', 'DivideController']
from .sum import SumController
from .subtract import SubtractController
from .multiply import MultiplyController
from .divide import DivideController | 40.333333 | 91 | 0.834711 | 21 | 242 | 9.428571 | 0.52381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 242 | 6 | 92 | 40.333333 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0.26749 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7de42d64d9fcd83a41caaed7515c0f1a12c29918 | 184 | py | Python | profiles/apps.py | mlutok/portal_backend | d463e4e146714c58daf530bc102608affd397205 | [
"Apache-2.0"
] | 1 | 2019-05-04T11:34:44.000Z | 2019-05-04T11:34:44.000Z | profiles/apps.py | mlutok/portal_backend | d463e4e146714c58daf530bc102608affd397205 | [
"Apache-2.0"
] | 18 | 2019-06-19T15:06:56.000Z | 2021-06-10T17:55:00.000Z | profiles/apps.py | mlutok/portal_backend | d463e4e146714c58daf530bc102608affd397205 | [
"Apache-2.0"
] | 6 | 2019-06-11T11:02:06.000Z | 2020-10-04T11:05:41.000Z | from django.apps import AppConfig
class ProfilesConfig(AppConfig):
name = "profiles"
verbose_name = "Profiles of Players"
def ready(self):
from . import signals
| 18.4 | 40 | 0.690217 | 21 | 184 | 6 | 0.761905 | 0.190476 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.233696 | 184 | 9 | 41 | 20.444444 | 0.893617 | 0 | 0 | 0 | 0 | 0 | 0.146739 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7ded69feb03cc39a6ff723da10e13f8c336fa24e | 617 | py | Python | src/036/p036.py | fredericojordan/polyglot-euler | 9eb75c04db11705def4971fdbb02a6e84c71bef5 | [
"MIT"
] | 3 | 2018-01-09T01:15:12.000Z | 2020-07-14T07:45:52.000Z | src/036/p036.py | fredericojordan/polyglot-euler | 9eb75c04db11705def4971fdbb02a6e84c71bef5 | [
"MIT"
] | null | null | null | src/036/p036.py | fredericojordan/polyglot-euler | 9eb75c04db11705def4971fdbb02a6e84c71bef5 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
def palindrome(x):
return str(x) == str(x)[::-1]
def number_palindrome(n, base):
if base == 2:
binary = bin(n)[2:]
return palindrome(binary)
if base == 10:
return palindrome(n)
return False
def double_base_palindrome(x):
return number_palindrome(x, 10) and number_palindrome(x, 2)
def sum_double_palindrome_numbers_below(limit):
return sum((x for x in range(1, limit) if double_base_palindrome(x)))
def solve():
return sum_double_palindrome_numbers_below(1000000)
if __name__ == '__main__':
result = solve()
print(result)
| 19.28125 | 73 | 0.666126 | 88 | 617 | 4.409091 | 0.375 | 0.141753 | 0.087629 | 0.108247 | 0.159794 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034979 | 0.212318 | 617 | 31 | 74 | 19.903226 | 0.763374 | 0.034036 | 0 | 0 | 0 | 0 | 0.013445 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0 | 0 | 0.222222 | 0.666667 | 0.055556 | 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 |
815488d9d053c2320c7c6ef79528a332d4b15cb2 | 196 | py | Python | install/install.py | calixo888/wordgen | 4ccf9ee1e83c423a6d20ebcee1f264ca28c1724a | [
"Apache-2.0"
] | 1 | 2020-01-19T19:37:24.000Z | 2020-01-19T19:37:24.000Z | install/install.py | calixo888/wordgen | 4ccf9ee1e83c423a6d20ebcee1f264ca28c1724a | [
"Apache-2.0"
] | null | null | null | install/install.py | calixo888/wordgen | 4ccf9ee1e83c423a6d20ebcee1f264ca28c1724a | [
"Apache-2.0"
] | null | null | null | import subprocess
subprocess.call("curl https://bootstrap.pypa.io/get-pip.py | python",shell=True)
subprocess.call("pip install tqdm",shell=True)
print('[+] All packages successfully installed')
| 32.666667 | 80 | 0.770408 | 27 | 196 | 5.592593 | 0.777778 | 0.18543 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076531 | 196 | 5 | 81 | 39.2 | 0.834254 | 0 | 0 | 0 | 0 | 0 | 0.535714 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
815785e088c3afe205097a829f79ad66ec67e431 | 628 | py | Python | utf/utf32.py | t-mart/utf | 016d2eed4256a4476de623a2efd9f2533117cf47 | [
"MIT"
] | null | null | null | utf/utf32.py | t-mart/utf | 016d2eed4256a4476de623a2efd9f2533117cf47 | [
"MIT"
] | null | null | null | utf/utf32.py | t-mart/utf | 016d2eed4256a4476de623a2efd9f2533117cf47 | [
"MIT"
] | null | null | null | import struct
_byteorder_structs = {
'little': struct.Struct('<I'),
'big': struct.Struct('>I'),
}
def _encode_utf32(s: str, byteorder: str):
return b''.join(_byteorder_structs[byteorder].pack(ord(c)) for c in s)
def encode_utf32le(s: str):
return _encode_utf32(s, 'little')
def encode_utf32be(s: str):
return _encode_utf32(s, 'big')
def _decode_utf32(b: bytes, byteorder: str):
return "".join(chr(c[0]) for c in _byteorder_structs[byteorder].iter_unpack(b))
def decode_utf32le(b: bytes):
return _decode_utf32(b, 'little')
def decode_utf32be(b: bytes):
return _decode_utf32(b, 'big')
| 20.258065 | 83 | 0.684713 | 93 | 628 | 4.376344 | 0.301075 | 0.088452 | 0.088452 | 0.078624 | 0.226044 | 0.226044 | 0 | 0 | 0 | 0 | 0 | 0.039848 | 0.160828 | 628 | 30 | 84 | 20.933333 | 0.732448 | 0 | 0 | 0 | 0 | 0 | 0.049363 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.352941 | false | 0 | 0.058824 | 0.352941 | 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 |
815c62a66e317023e2ef0bdfc0fa5f92ecba0445 | 2,265 | py | Python | user.py | hwang123/groupme_stats | 0eadfb1fc4db93cf2b22b010dd4fd7ea1bff6c08 | [
"MIT"
] | null | null | null | user.py | hwang123/groupme_stats | 0eadfb1fc4db93cf2b22b010dd4fd7ea1bff6c08 | [
"MIT"
] | null | null | null | user.py | hwang123/groupme_stats | 0eadfb1fc4db93cf2b22b010dd4fd7ea1bff6c08 | [
"MIT"
] | null | null | null | import numpy
from matplotlib import pyplot as plt
class User:
"""
A class used to represent a single user
...
Attributes
----------
user_id: String
A unique user identifier
messages: [String]
A list of message texts
usernames: [String]
A list of usernames, sorted oldest first
popular_posts: [(String, int)]
A list of popular posts by the user (>10 likes), stored as tuple
containing the message text and the number of likes
likes_received: int
Number of total likes received
likes_given: int
Number of total likes given
word_count: int
Number of total words posted by the user
likes: {String: int}
Methods
-------
says(sound=None)
Prints the animals name and what sound it makes
"""
def __init__(self, user_id):
# String
self.user_id = user_id
# [String]
self.messages = []
self.usernames = []
# Tuple (String text, int num_likes)
self.popular_posts = []
# Int
self.likes_received = 0
self.likes_given = 0
self.word_count = 0
# Map{string:Int}
self.likes = {}
def get_user_id(self):
return self.user_id
## Username
def add_username(self, username):
if username not in self.usernames:
self.usernames.append(username)
def get_usernames(self):
return self.usernames
def get_most_recent_username(self):
return self.usernames[-1]
## Messages
def add_message(self, message, num_likes, timestamp):
self.messages.append(message)
self.increment_likes_received(num_likes)
if num_likes > 10:
self.popular_posts.append((message, num_likes))
def get_messages(self):
return self.messages
def get_num_messages(self):
return len(self.messages)
def get_popular_messages(self):
return self.popular_posts
## Likes
def increment_likes_given(self, user_id, num_likes=1):
self.likes_given += num_likes
if user_id not in self.likes:
self.likes[user_id] = 1
else:
self.likes[user_id] = self.likes[user_id] + 1
def get_likes_given(self):
return self.likes_given
def increment_likes_received(self, num_likes=1):
self.likes_received += num_likes
def get_likes_received(self):
return self.likes_received
def get_like_map(self):
return self.likes
## Plotting
| 21.571429 | 72 | 0.69713 | 329 | 2,265 | 4.610942 | 0.246201 | 0.071193 | 0.07383 | 0.031641 | 0.072512 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006711 | 0.210596 | 2,265 | 104 | 73 | 21.778846 | 0.841723 | 0.350552 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.304348 | false | 0 | 0.043478 | 0.195652 | 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 |
8166598f3553d3ded682cd25bb086ecc9f61558e | 316 | py | Python | janggoCompany/board/admin.py | jangheeseung/janggo_system | d251ad88483aa4a4ca43183cdb5d72ff98213540 | [
"MIT"
] | null | null | null | janggoCompany/board/admin.py | jangheeseung/janggo_system | d251ad88483aa4a4ca43183cdb5d72ff98213540 | [
"MIT"
] | null | null | null | janggoCompany/board/admin.py | jangheeseung/janggo_system | d251ad88483aa4a4ca43183cdb5d72ff98213540 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Board
from .models import Board, Comments
# Register your models here.
class BaordAdmin(admin.ModelAdmin):
list_display = ['id', 'title', 'author']
list_display_links = ['id', 'title']
admin.site.register(Board, BaordAdmin)
admin.site.register(Comments) | 28.727273 | 44 | 0.75 | 41 | 316 | 5.707317 | 0.512195 | 0.08547 | 0.136752 | 0.179487 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129747 | 316 | 11 | 45 | 28.727273 | 0.850909 | 0.082278 | 0 | 0 | 0 | 0 | 0.069204 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.75 | 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 |
816ad581d7ba678706a672f0b280709c4f0c4bb7 | 1,377 | py | Python | ROSSi_workspace/rossi_plugin/src/rossi_plugin/Ros2UI/UI/Editors/RosNodeEditor/GraphEntities/RosCodeVariableGraphEntity.py | isse-augsburg/ROSSi | 66a23b6c133069325096d6e199e53d293e42d61b | [
"MIT"
] | null | null | null | ROSSi_workspace/rossi_plugin/src/rossi_plugin/Ros2UI/UI/Editors/RosNodeEditor/GraphEntities/RosCodeVariableGraphEntity.py | isse-augsburg/ROSSi | 66a23b6c133069325096d6e199e53d293e42d61b | [
"MIT"
] | null | null | null | ROSSi_workspace/rossi_plugin/src/rossi_plugin/Ros2UI/UI/Editors/RosNodeEditor/GraphEntities/RosCodeVariableGraphEntity.py | isse-augsburg/ROSSi | 66a23b6c133069325096d6e199e53d293e42d61b | [
"MIT"
] | null | null | null | from typing import Dict
from PyQt5 import QtCore
from PyQt5.QtCore import QRectF
from .....utils import fullname
from ....BaseGraphEntities.AbstractGraphEntity import DataObject
from ....BaseGraphEntities.StandartGraphEntity import StandartGraphEntity
class RosCodeVariableGraphEntity(StandartGraphEntity):
def __init__(self, x: float, y: float, width: float, height: float, name: str = "var", parent=None, id: int = -1):
super(RosCodeVariableGraphEntity, self).__init__(parent, id, x, y, width, height)
self.name = name
def paint(self, painter, option, widget):
super(RosCodeVariableGraphEntity, self).paint(painter, option, widget)
painter.drawText(QRectF(0, 0, self.width, self.height/2), QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft, self.name)
def getData(self) -> DataObject:
key = fullname(self)
values = {
"name": self.name
}
self.data = DataObject(key, values)
return self.data
@staticmethod
def getObjectFromData(data: DataObject) -> 'StandartGraphEntity':
item = RosCodeVariableGraphEntity(0, 0, data.values["width"], data.values["height"])
item.name = data.values["name"]
return item
def _toDict(self) -> Dict:
pass
def toCode(self, intendLevel: int = 0):
pass
def getProperties(self):
pass
| 31.295455 | 120 | 0.669572 | 151 | 1,377 | 6.046358 | 0.364238 | 0.026287 | 0.07667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008364 | 0.218591 | 1,377 | 43 | 121 | 32.023256 | 0.840149 | 0 | 0 | 0.096774 | 0 | 0 | 0.029797 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.225806 | false | 0.096774 | 0.193548 | 0 | 0.516129 | 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 |
816baa45e14987fe7f65a8ec91df8939c7a4fd9c | 3,829 | py | Python | src/unicon/plugins/tests/test_plugin_iosxe_cat8k.py | DataKnox/unicon.plugins | 3b0cdf2c41fdbc087a3cfb428c12c2afb1b46d52 | [
"Apache-2.0"
] | null | null | null | src/unicon/plugins/tests/test_plugin_iosxe_cat8k.py | DataKnox/unicon.plugins | 3b0cdf2c41fdbc087a3cfb428c12c2afb1b46d52 | [
"Apache-2.0"
] | null | null | null | src/unicon/plugins/tests/test_plugin_iosxe_cat8k.py | DataKnox/unicon.plugins | 3b0cdf2c41fdbc087a3cfb428c12c2afb1b46d52 | [
"Apache-2.0"
] | null | null | null | """
Unittests for iosxe/cat8k plugin
"""
import unittest
import unicon
from unicon import Connection
from unicon.plugins.tests.mock.mock_device_iosxe_cat8k import MockDeviceTcpWrapperIOSXECat8k
from unicon.core.errors import SubCommandFailure
unicon.settings.Settings.POST_DISCONNECT_WAIT_SEC = 0
unicon.settings.Settings.GRACEFUL_DISCONNECT_WAIT_SEC = 0.2
class TestIosXeCat8kPlugin(unittest.TestCase):
def test_connect(self):
d = Connection(hostname='Router',
start=['mock_device_cli --os iosxe --state c8k_login'],
os='iosxe',
platform='cat8k',
credentials=dict(default=dict(username='admin', password='cisco')),
settings=dict(POST_DISCONNECT_WAIT_SEC=0, GRACEFUL_DISCONNECT_WAIT_SEC=0.2),
log_buffer=True
)
d.connect()
d.disconnect()
def test_connect_learn_hostname(self):
d = Connection(hostname='Router',
start=['mock_device_cli --os iosxe --state c8k_login --hostname WLC'],
os='iosxe',
platform='cat8k',
credentials=dict(default=dict(username='admin', password='cisco')),
settings=dict(POST_DISCONNECT_WAIT_SEC=0, GRACEFUL_DISCONNECT_WAIT_SEC=0.2),
learn_hostname=True,
log_buffer=True
)
d.connect()
d.disconnect()
class TestIosXECat8kPluginSwitchover(unittest.TestCase):
def test_switchover(self):
md = MockDeviceTcpWrapperIOSXECat8k(port=0, state='c8k_login')
md.start()
c = Connection(
hostname='Switch',
start=['telnet 127.0.0.1 {}'.format(md.ports[0])],
os='iosxe',
platform='cat8k',
settings=dict(POST_DISCONNECT_WAIT_SEC=0, GRACEFUL_DISCONNECT_WAIT_SEC=0.2, POST_HA_RELOAD_CONFIG_SYNC_WAIT=1),
credentials=dict(default=dict(username='admin', password='cisco')),
mit=True,
)
try:
c.connect()
c.switchover()
self.assertEqual(c.state_machine.current_state, 'enable')
finally:
c.disconnect()
md.stop()
def test_switchover_failure_device_not_in_HA_mode(self):
md = MockDeviceTcpWrapperIOSXECat8k(port=0, state='c8k_login2')
md.start()
c = Connection(
hostname='Switch',
start=['telnet 127.0.0.1 {}'.format(md.ports[0])],
os='iosxe',
platform='cat8k',
settings=dict(POST_DISCONNECT_WAIT_SEC=0, GRACEFUL_DISCONNECT_WAIT_SEC=0.2),
credentials=dict(default=dict(username='admin', password='cisco')),
mit=True,
)
try:
c.connect()
with self.assertRaises(SubCommandFailure):
c.switchover()
finally:
c.disconnect()
md.stop()
def test_switchover_failure_standby_sync_timeout(self):
md = MockDeviceTcpWrapperIOSXECat8k(port=0, state='c8k_login3')
md.start()
c = Connection(
hostname='Switch',
start=['telnet 127.0.0.1 {}'.format(md.ports[0])],
os='iosxe',
platform='cat8k',
settings=dict(POST_DISCONNECT_WAIT_SEC=0, GRACEFUL_DISCONNECT_WAIT_SEC=0.2, POST_HA_RELOAD_CONFIG_SYNC_WAIT=1),
credentials=dict(default=dict(username='admin', password='cisco')),
mit=True,
)
try:
c.connect()
with self.assertRaises(Exception):
c.switchover()
finally:
c.disconnect()
md.stop()
if __name__ == '__main__':
unittest.main()
| 33.884956 | 123 | 0.577174 | 397 | 3,829 | 5.345088 | 0.231738 | 0.079171 | 0.096136 | 0.101791 | 0.724788 | 0.71442 | 0.701697 | 0.580584 | 0.580584 | 0.535344 | 0 | 0.024261 | 0.311047 | 3,829 | 112 | 124 | 34.1875 | 0.780136 | 0.008357 | 0 | 0.67033 | 0 | 0 | 0.087886 | 0 | 0 | 0 | 0 | 0 | 0.032967 | 1 | 0.054945 | false | 0.054945 | 0.054945 | 0 | 0.131868 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
818eb7e9828b26f9639133843d042e04b954c399 | 1,184 | py | Python | example_app/views.py | ferdinand-hoffmann/django-questionnaire-core | 8ae73d142a3a622a1bea6a68f6be52fd8493c810 | [
"MIT"
] | null | null | null | example_app/views.py | ferdinand-hoffmann/django-questionnaire-core | 8ae73d142a3a622a1bea6a68f6be52fd8493c810 | [
"MIT"
] | null | null | null | example_app/views.py | ferdinand-hoffmann/django-questionnaire-core | 8ae73d142a3a622a1bea6a68f6be52fd8493c810 | [
"MIT"
] | null | null | null | from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils.http import urlencode
from questionnaire_core.models import Questionnaire, QuestionnaireResult
from questionnaire_core.views.generic import QuestionnaireFormView
class BasicQuestionnaireView(QuestionnaireFormView):
template_name = 'questionnaire_form.html'
def get_questionnaire(self):
return Questionnaire.objects.get(pk=self.kwargs.get('pk'))
def get_questionnaire_result_set(self):
if self.request.GET.get('result_set'):
return QuestionnaireResult.objects.get(pk=self.request.GET.get('result_set'))
return QuestionnaireResult(questionnaire=self.get_questionnaire())
def get_success_url(self):
return reverse('basic_questionnaire_form', args=(self.kwargs.get('pk'),))
def form_valid(self, form):
# Add current result set to the url (allows editing of the result)
redirect = super(BasicQuestionnaireView, self).form_valid(form)
url_params = urlencode({'result_set': form.current_result_set.pk})
return HttpResponseRedirect('{url}?{params}'.format(url=redirect.url, params=url_params))
| 42.285714 | 97 | 0.755912 | 141 | 1,184 | 6.191489 | 0.347518 | 0.061856 | 0.04811 | 0.036655 | 0.158076 | 0.116838 | 0.116838 | 0.116838 | 0 | 0 | 0 | 0 | 0.146115 | 1,184 | 27 | 98 | 43.851852 | 0.863501 | 0.054054 | 0 | 0 | 0 | 0 | 0.084973 | 0.042039 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0 | 0.263158 | 0.105263 | 0.842105 | 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 |
81be3773f1e6372f6a8830595370de65299a4012 | 824 | py | Python | lib/vrd/vr/wsd/debug_layer.py | yjy941124/PPR-FCN | 1eba5515b37e7b32413efdf14bb0c22a2e46fee9 | [
"MIT"
] | 20 | 2017-10-16T18:12:51.000Z | 2021-12-23T02:34:20.000Z | lib/vrd/vr/wsd/debug_layer.py | yjy941124/PPR-FCN | 1eba5515b37e7b32413efdf14bb0c22a2e46fee9 | [
"MIT"
] | 1 | 2018-11-10T04:59:48.000Z | 2021-01-21T04:51:31.000Z | lib/vrd/vr/wsd/debug_layer.py | yjy941124/PPR-FCN | 1eba5515b37e7b32413efdf14bb0c22a2e46fee9 | [
"MIT"
] | 5 | 2017-10-17T00:54:42.000Z | 2018-04-08T15:09:40.000Z | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""The data layer used during training to train a Fast R-CNN network.
RoIDataLayer implements a Caffe Python layer.
"""
import caffe
class ICCVDebugLayer(caffe.Layer):
def setup(self, bottom, top):
pass
def forward(self, bottom, top):
#do manual computation
# check if same
btn = bottom
pass
def backward(self, top, propagate_down, bottom):
"""This layer does not propagate gradients."""
pass
def reshape(self, bottom, top):
"""Reshaping happens during the call to forward."""
pass
| 26.580645 | 69 | 0.56068 | 92 | 824 | 5.01087 | 0.652174 | 0.065076 | 0.084599 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006289 | 0.228155 | 824 | 30 | 70 | 27.466667 | 0.718553 | 0.572816 | 0 | 0.363636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.363636 | false | 0.363636 | 0.090909 | 0 | 0.545455 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.