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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c6403f9f5b577048b5881d32cd0119e9c2c8d062 | 184 | py | Python | del_from_cache.py | mratsim/home-credit-default-risk | 66bbe05d8a9345f4ba93f00bc8c4456244208503 | [
"FSFAP"
] | 78 | 2018-08-30T07:52:43.000Z | 2022-02-24T20:58:22.000Z | del_from_cache.py | mratsim/home-credit-default-risk | 66bbe05d8a9345f4ba93f00bc8c4456244208503 | [
"FSFAP"
] | 1 | 2018-08-31T03:05:46.000Z | 2018-08-31T06:45:04.000Z | del_from_cache.py | mratsim/home-credit-default-risk | 66bbe05d8a9345f4ba93f00bc8c4456244208503 | [
"FSFAP"
] | 21 | 2018-08-30T13:16:03.000Z | 2022-01-16T10:18:51.000Z | # Delete a key from the cache file
from src.cache import del_from_cache
del_from_cache('./cache.db',
[
'fte_missed_installments_train',
'fte_missed_installments_test'
])
| 18.4 | 36 | 0.73913 | 27 | 184 | 4.666667 | 0.592593 | 0.111111 | 0.190476 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168478 | 184 | 9 | 37 | 20.444444 | 0.823529 | 0.173913 | 0 | 0 | 0 | 0 | 0.446667 | 0.38 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.166667 | 0 | 0.166667 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
d666d0ec075cfe7a5056d9d089083d748f5112c9 | 161 | py | Python | msd/tickets/urls.py | rsg33/msd | b6b5cf2edb4b0e99d87a8e93ed714141a0ed96a8 | [
"MIT"
] | null | null | null | msd/tickets/urls.py | rsg33/msd | b6b5cf2edb4b0e99d87a8e93ed714141a0ed96a8 | [
"MIT"
] | null | null | null | msd/tickets/urls.py | rsg33/msd | b6b5cf2edb4b0e99d87a8e93ed714141a0ed96a8 | [
"MIT"
] | null | null | null | from django.urls import path
from .views import *
urlpatterns = [
path('', index, name='home'),
path('add-ticket/', add_ticket, name='add_ticket'),
]
| 16.1 | 55 | 0.645963 | 21 | 161 | 4.857143 | 0.571429 | 0.264706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.180124 | 161 | 9 | 56 | 17.888889 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0.15528 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
d6cafac74ba970e0f66f07a9e48dc7b26a91cc39 | 843 | py | Python | src_py/legal_gamer.py | poulter7/spudplayer | 4937586a232c06ad3c896a14636f0626607bb52e | [
"BSD-3-Clause"
] | null | null | null | src_py/legal_gamer.py | poulter7/spudplayer | 4937586a232c06ad3c896a14636f0626607bb52e | [
"BSD-3-Clause"
] | null | null | null | src_py/legal_gamer.py | poulter7/spudplayer | 4937586a232c06ad3c896a14636f0626607bb52e | [
"BSD-3-Clause"
] | null | null | null | '''
Created on Apr 2, 2010
@author: evancox
'''
from util.statemachine import MachineState
from util.statemachine.implementation.prover import ProverStateMachine
from player.gamer.statemachine import StateMachineGamer
from player.gamer.statemachine.reflex.event import ReflexMoveSelectionEvent
class LegalGamer(StateMachineGamer):
def getName(self):
return "LegalGamer (Python)"
def stateMachineMetaGame(self, timeout):
pass
def stateMachineSelectMove(self, timeout):
moves = self.getStateMachine().getLegalMoves(self.getCurrentState(), self.getRole())
selection = moves[0]
self.notifyObservers(ReflexMoveSelectionEvent(moves, selection, 1))
return selection
def getInitialStateMachine(self):
return ProverStateMachine() | 30.107143 | 93 | 0.711744 | 75 | 843 | 8 | 0.56 | 0.026667 | 0.066667 | 0.09 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010511 | 0.209964 | 843 | 28 | 94 | 30.107143 | 0.89039 | 0.04745 | 0 | 0 | 0 | 0 | 0.024707 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.0625 | 0.25 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 4 |
d6eab9275ca719d08b8b75995aacef919051b123 | 209 | py | Python | mmcls/models/utils/augment/__init__.py | ZwwWayne/mmclassification | 2ccc55ce4f783ca34892fe7d91f247d18906a994 | [
"Apache-2.0"
] | 2 | 2021-05-21T04:56:52.000Z | 2021-06-21T04:26:13.000Z | mmcls/models/utils/augment/__init__.py | ZwwWayne/mmclassification | 2ccc55ce4f783ca34892fe7d91f247d18906a994 | [
"Apache-2.0"
] | null | null | null | mmcls/models/utils/augment/__init__.py | ZwwWayne/mmclassification | 2ccc55ce4f783ca34892fe7d91f247d18906a994 | [
"Apache-2.0"
] | 2 | 2021-05-08T11:13:26.000Z | 2021-05-25T02:46:28.000Z | from .augments import Augments
from .cutmix import BatchCutMixLayer
from .identity import Identity
from .mixup import BatchMixupLayer
__all__ = ['Augments', 'BatchCutMixLayer', 'Identity', 'BatchMixupLayer']
| 29.857143 | 73 | 0.803828 | 21 | 209 | 7.809524 | 0.428571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.110048 | 209 | 6 | 74 | 34.833333 | 0.88172 | 0 | 0 | 0 | 0 | 0 | 0.22488 | 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 | 1 | 0 | 0 | 4 |
243acfa80bc373e91694ee999c05e986741bb850 | 90 | py | Python | lib/loss/__init__.py | yaopengUSTC/mbit-skin-cancer | a82a87b2abebaf724dbe2a7b7e833c434c1b56a0 | [
"MIT"
] | 3 | 2022-01-23T05:27:43.000Z | 2022-03-08T07:29:25.000Z | lib/loss/__init__.py | yaopengUSTC/mbit-skin-cancer | a82a87b2abebaf724dbe2a7b7e833c434c1b56a0 | [
"MIT"
] | null | null | null | lib/loss/__init__.py | yaopengUSTC/mbit-skin-cancer | a82a87b2abebaf724dbe2a7b7e833c434c1b56a0 | [
"MIT"
] | null | null | null | from .loss import CrossEntropy, LDAMLoss, FocalLoss, LOWLoss, GHMCLoss, CCELoss, MWNLoss
| 45 | 89 | 0.8 | 10 | 90 | 7.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122222 | 90 | 1 | 90 | 90 | 0.911392 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
243fa8c2fba7f353f401a015843fea097ea35161 | 108 | py | Python | tests/testcase/__init__.py | caputomarcos/mongorest | 57d6b28d75e18afed5cef7160522958153b5be15 | [
"BSD-3-Clause"
] | 16 | 2015-04-18T02:51:09.000Z | 2020-12-15T18:05:16.000Z | tests/testcase/__init__.py | caputomarcos/mongorest | 57d6b28d75e18afed5cef7160522958153b5be15 | [
"BSD-3-Clause"
] | 8 | 2015-11-24T23:06:03.000Z | 2016-07-21T17:57:59.000Z | tests/testcase/__init__.py | caputomarcos/mongorest | 57d6b28d75e18afed5cef7160522958153b5be15 | [
"BSD-3-Clause"
] | 2 | 2015-12-04T13:45:32.000Z | 2016-06-11T13:44:53.000Z | # -*- encoding: UTF-8 -*-
from __future__ import absolute_import, unicode_literals
from .testcase import *
| 21.6 | 56 | 0.75 | 13 | 108 | 5.769231 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010753 | 0.138889 | 108 | 4 | 57 | 27 | 0.795699 | 0.212963 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
2468608bacb8aff12b7ac2e200bb8cf78463e4a8 | 503 | py | Python | battery.py | dedeibel/humtemp | f50d1a97209895c21affd7390bddab2d03007143 | [
"MIT"
] | null | null | null | battery.py | dedeibel/humtemp | f50d1a97209895c21affd7390bddab2d03007143 | [
"MIT"
] | null | null | null | battery.py | dedeibel/humtemp | f50d1a97209895c21affd7390bddab2d03007143 | [
"MIT"
] | null | null | null | from configuration import *
from machine import ADC
from log import *
adc = None
def init_battery():
global adc
adc = ADC(0) # first an only analog pin
log_debug("battery measuring initialized adc_factor: " + str(ADC_FACTOR_ONE_OVER) + " battery_factor_one_over: "+ str(BATTERY_FACTOR_ONE_OVER))
# in mV
def read_voltage_raw():
return adc.read() * ADC_FACTOR_ONE_OVER + ADC_OFFSET_MV
# in mV
def raw_to_battery_voltage(raw_voltage):
return raw_voltage * BATTERY_FACTOR_ONE_OVER
| 25.15 | 147 | 0.753479 | 78 | 503 | 4.512821 | 0.410256 | 0.127841 | 0.184659 | 0.170455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002392 | 0.168986 | 503 | 19 | 148 | 26.473684 | 0.839713 | 0.071571 | 0 | 0 | 0 | 0 | 0.147186 | 0.051948 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.166667 | 0.666667 | 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 | 1 | 0 | 0 | 0 | 4 |
79e9e708ffccfefc847727717c852f4033b18b80 | 32 | py | Python | lib/rdflib_jsonld/__init__.py | DmPo/Schemaorg_CivicOS | 289b669d592a2b429402b19a7661b13631940daa | [
"Apache-2.0"
] | 2 | 2017-05-08T13:24:52.000Z | 2021-01-16T18:15:42.000Z | lib/rdflib_jsonld/__init__.py | jesman/schemaorg | 6649c41e56a9724eaeed25dedf67736258f922bf | [
"Apache-2.0"
] | 6 | 2019-08-27T07:28:58.000Z | 2020-08-26T15:58:43.000Z | lib/rdflib_jsonld/__init__.py | jesman/schemaorg | 6649c41e56a9724eaeed25dedf67736258f922bf | [
"Apache-2.0"
] | 9 | 2017-12-13T08:07:48.000Z | 2019-06-18T14:30:12.000Z | """
"""
__version__ = "0.3-dev"
| 8 | 23 | 0.5 | 4 | 32 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074074 | 0.15625 | 32 | 3 | 24 | 10.666667 | 0.37037 | 0 | 0 | 0 | 0 | 0 | 0.28 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
79efe963b38e42e7c6e780ca0785946fa7694aa3 | 44 | py | Python | src/__init__.py | andreydelpozo2/breadcrumbs | ab8d3cea897771b81cf202b4cb89150a56e0355a | [
"MIT"
] | null | null | null | src/__init__.py | andreydelpozo2/breadcrumbs | ab8d3cea897771b81cf202b4cb89150a56e0355a | [
"MIT"
] | null | null | null | src/__init__.py | andreydelpozo2/breadcrumbs | ab8d3cea897771b81cf202b4cb89150a56e0355a | [
"MIT"
] | null | null | null | __author__ = 'adelpozo'
from . import config | 22 | 23 | 0.772727 | 5 | 44 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 44 | 2 | 24 | 22 | 0.789474 | 0 | 0 | 0 | 0 | 0 | 0.177778 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
0318986119a91d3ce90d56f60b7188328baa5787 | 263 | py | Python | gars_field/__init__.py | corteva/gars-field | cc158e4131422c879553f984876dad514c2eb4b9 | [
"BSD-3-Clause"
] | 1 | 2021-11-29T16:10:49.000Z | 2021-11-29T16:10:49.000Z | gars_field/__init__.py | corteva/gars-field | cc158e4131422c879553f984876dad514c2eb4b9 | [
"BSD-3-Clause"
] | null | null | null | gars_field/__init__.py | corteva/gars-field | cc158e4131422c879553f984876dad514c2eb4b9 | [
"BSD-3-Clause"
] | null | null | null | """
GARS Field is a toolkit for generating Global Area Reference grids
"""
from .edgarsgrid import EDGARSGrid # noqa: F401
from .field import GARSField # noqa: F401
from .garsgrid import GARSGrid # noqa: F401
from .gedgarsgrid import GEDGARSGrid # noqa: F401
| 32.875 | 66 | 0.760456 | 35 | 263 | 5.714286 | 0.542857 | 0.16 | 0.18 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.055046 | 0.171103 | 263 | 7 | 67 | 37.571429 | 0.862385 | 0.422053 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
0320f1d0e3ffe77b343c93cdde7369b99f1c1f56 | 45 | py | Python | Ex09.py | CarlosDouradoPGR/EstruturaDeRepet | f9127bfeca439fe68a79e5a63dc66f55587f2c80 | [
"MIT"
] | null | null | null | Ex09.py | CarlosDouradoPGR/EstruturaDeRepet | f9127bfeca439fe68a79e5a63dc66f55587f2c80 | [
"MIT"
] | null | null | null | Ex09.py | CarlosDouradoPGR/EstruturaDeRepet | f9127bfeca439fe68a79e5a63dc66f55587f2c80 | [
"MIT"
] | null | null | null | for c in range(1,51,2):
print(c, end=' ') | 22.5 | 23 | 0.533333 | 10 | 45 | 2.4 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114286 | 0.222222 | 45 | 2 | 24 | 22.5 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0.021739 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
032cef22dd0501e04e17229ed6fe8f14d633daf4 | 211 | py | Python | pytest_splunk_addon/helmut/splunk/__init__.py | monishshah18/pytest-splunk-addon | 1600f2c7d30ec304e9855642e63511780556b406 | [
"Apache-2.0"
] | null | null | null | pytest_splunk_addon/helmut/splunk/__init__.py | monishshah18/pytest-splunk-addon | 1600f2c7d30ec304e9855642e63511780556b406 | [
"Apache-2.0"
] | null | null | null | pytest_splunk_addon/helmut/splunk/__init__.py | monishshah18/pytest-splunk-addon | 1600f2c7d30ec304e9855642e63511780556b406 | [
"Apache-2.0"
] | null | null | null | """
This module contains everything regarding a Splunk installation.
@author: Nicklas Ansman-Giertz
@contact: U{ngiertz@splunk.com<mailto:ngiertz@splunk.com>}
@since: 2011-11-23
"""
__all__ = ["local", "ssh"]
| 21.1 | 64 | 0.734597 | 28 | 211 | 5.392857 | 0.857143 | 0.172185 | 0.211921 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042553 | 0.109005 | 211 | 9 | 65 | 23.444444 | 0.760638 | 0.824645 | 0 | 0 | 0 | 0 | 0.275862 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 1 | 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 | 4 |
033e7be589cc8c5f249509353d9a5d1934a470d1 | 51 | py | Python | url_api/app/config.py | jmackown/url_shortener | e504872a8748deffce78cbf8f1df46025109854d | [
"MIT"
] | null | null | null | url_api/app/config.py | jmackown/url_shortener | e504872a8748deffce78cbf8f1df46025109854d | [
"MIT"
] | 1 | 2022-03-04T10:05:14.000Z | 2022-03-04T10:05:14.000Z | url_api/app/config.py | jmackown/url_shortener | e504872a8748deffce78cbf8f1df46025109854d | [
"MIT"
] | null | null | null | class Config:
BASE_URL = "http://0.0.0.0:8004"
| 17 | 36 | 0.607843 | 10 | 51 | 3 | 0.7 | 0.2 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190476 | 0.176471 | 51 | 2 | 37 | 25.5 | 0.52381 | 0 | 0 | 0 | 0 | 0 | 0.372549 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
034b3e4c05fa0f581c4e399f15bb46550c4fe11c | 298 | py | Python | Python/sort/Selection_Sort.py | zhcet19/NeoAlgo-1 | c534a23307109280bda0e4867d6e8e490002a4ee | [
"MIT"
] | 7 | 2020-07-26T08:37:02.000Z | 2020-10-30T10:22:51.000Z | Python/sort/Selection_Sort.py | zhcet19/NeoAlgo-1 | c534a23307109280bda0e4867d6e8e490002a4ee | [
"MIT"
] | 8 | 2021-03-17T11:21:14.000Z | 2021-06-14T00:57:23.000Z | Python/sort/Selection_Sort.py | zhcet19/NeoAlgo-1 | c534a23307109280bda0e4867d6e8e490002a4ee | [
"MIT"
] | 5 | 2020-07-11T14:33:33.000Z | 2021-03-01T19:41:43.000Z | def selection_sort(nums):
for i in range(len(nums)):
lowest_value_index = i
for j in range(i + 1, len(nums)):
if nums[j] < nums[lowest_value_index]:
lowest_value_index = j
nums[i], nums[lowest_value_index] = nums[lowest_value_index], nums[i]
| 37.25 | 77 | 0.604027 | 45 | 298 | 3.755556 | 0.333333 | 0.325444 | 0.473373 | 0.473373 | 0.260355 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004673 | 0.281879 | 298 | 7 | 78 | 42.571429 | 0.785047 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.142857 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
03732152766411ff4c529d9c084b953d1a812611 | 374 | py | Python | addamh/equal_sides_of_an_array/equal_sides_of_an_array.py | richcontext/katas | bd14bba0814307bb91cb994966edb423bd13d64f | [
"MIT"
] | null | null | null | addamh/equal_sides_of_an_array/equal_sides_of_an_array.py | richcontext/katas | bd14bba0814307bb91cb994966edb423bd13d64f | [
"MIT"
] | null | null | null | addamh/equal_sides_of_an_array/equal_sides_of_an_array.py | richcontext/katas | bd14bba0814307bb91cb994966edb423bd13d64f | [
"MIT"
] | null | null | null | def find_even_index(arr):
for i in range(len(arr)):
if sum(arr[:i]) == sum(arr[i+1:]):
return i
return -1
if __name__ == "__main__":
print(find_even_index([1,2,3,4,3,2,1]) == 3)
print(find_even_index([10,-80,10,10,15,35,20]) == 6)
print(find_even_index([20,10,-80,10,10,15,35]) == 0)
print(find_even_index([1,2,3,4,5,6]) == -1)
| 28.769231 | 54 | 0.566845 | 73 | 374 | 2.657534 | 0.383562 | 0.206186 | 0.335052 | 0.371134 | 0.350515 | 0.350515 | 0.226804 | 0.226804 | 0 | 0 | 0 | 0.157718 | 0.203209 | 374 | 12 | 55 | 31.166667 | 0.493289 | 0 | 0 | 0 | 0 | 0 | 0.02139 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0 | 0 | 0.3 | 0.4 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
300069d8e05aad54c852903bb04e370a808031f9 | 474 | py | Python | 40_champernowne's_constant.py | matt-oak/euler | c314534d32fcdcb3da86b9e7e07334b7fff8b97b | [
"MIT"
] | null | null | null | 40_champernowne's_constant.py | matt-oak/euler | c314534d32fcdcb3da86b9e7e07334b7fff8b97b | [
"MIT"
] | null | null | null | 40_champernowne's_constant.py | matt-oak/euler | c314534d32fcdcb3da86b9e7e07334b7fff8b97b | [
"MIT"
] | null | null | null | #Project Euler Problem #40
#Champernowne's Constant
num_sequence = ""
for i in range(1, 200000):
num_sequence = num_sequence + str(i)
nums = []
nums.append(int(num_sequence[0]))
nums.append(int(num_sequence[9]))
nums.append(int(num_sequence[99]))
nums.append(int(num_sequence[999]))
nums.append(int(num_sequence[9999]))
nums.append(int(num_sequence[99999]))
nums.append(int(num_sequence[999999]))
prod = 1
for i in range(0, len(nums)):
prod = prod * nums[i]
print prod | 22.571429 | 38 | 0.732068 | 79 | 474 | 4.265823 | 0.367089 | 0.32641 | 0.27003 | 0.332344 | 0.498516 | 0 | 0 | 0 | 0 | 0 | 0 | 0.077647 | 0.103376 | 474 | 21 | 39 | 22.571429 | 0.715294 | 0.099156 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.066667 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
065188640a3a2eb1fd9f2a55d2c0175aa71f26c3 | 102 | py | Python | appointment/apps.py | LokeshBolisetty/Webapp-django | 51fd6d3224dfd4295e7688b8fa6c88f1c11dfe9a | [
"MIT"
] | null | null | null | appointment/apps.py | LokeshBolisetty/Webapp-django | 51fd6d3224dfd4295e7688b8fa6c88f1c11dfe9a | [
"MIT"
] | null | null | null | appointment/apps.py | LokeshBolisetty/Webapp-django | 51fd6d3224dfd4295e7688b8fa6c88f1c11dfe9a | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class AppointmentConfig(AppConfig):
name = 'appointment'
| 17 | 36 | 0.735294 | 10 | 102 | 7.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.196078 | 102 | 5 | 37 | 20.4 | 0.914634 | 0 | 0 | 0 | 0 | 0 | 0.113402 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
065cdfc2f06c0326ac2063bd73c5702b5f2814c8 | 256 | py | Python | src/clamnotif/default.py | pisoftmacao/clamnotif | 8e76859c9fcaef76c6eb10c3af357a5310ac7f4e | [
"MIT"
] | 1 | 2021-11-12T20:58:18.000Z | 2021-11-12T20:58:18.000Z | src/clamnotif/default.py | pisoftmacao/clamnotif | 8e76859c9fcaef76c6eb10c3af357a5310ac7f4e | [
"MIT"
] | null | null | null | src/clamnotif/default.py | pisoftmacao/clamnotif | 8e76859c9fcaef76c6eb10c3af357a5310ac7f4e | [
"MIT"
] | null | null | null | import os
class DefaultValues(object):
def cfg_path(self):
return os.path.expanduser("~/.clamnotif/clamnotif.cfg")
def lastlog_path(self):
return os.path.expanduser("~/.clamnotif/lastlog.json")
default_values = DefaultValues()
| 19.692308 | 63 | 0.695313 | 30 | 256 | 5.833333 | 0.533333 | 0.091429 | 0.16 | 0.182857 | 0.445714 | 0.445714 | 0.445714 | 0 | 0 | 0 | 0 | 0 | 0.171875 | 256 | 12 | 64 | 21.333333 | 0.825472 | 0 | 0 | 0 | 0 | 0 | 0.199219 | 0.199219 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0.285714 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
0664447a3d8f1d5ccb606fccfbd4df5551aad060 | 118 | py | Python | Advance/Exceptional Handling/i07_ii_init_main.py | AmanDhimanD/Python_CompleteCode | 5af7afaa189fdab56ffc21ed53b998f4a07252ed | [
"Adobe-Glyph"
] | 2 | 2021-05-29T17:22:40.000Z | 2021-06-07T09:32:53.000Z | Advance/Exceptional Handling/i07_ii_init_main.py | AmanDhimanD/Python_CompleteCode | 5af7afaa189fdab56ffc21ed53b998f4a07252ed | [
"Adobe-Glyph"
] | null | null | null | Advance/Exceptional Handling/i07_ii_init_main.py | AmanDhimanD/Python_CompleteCode | 5af7afaa189fdab56ffc21ed53b998f4a07252ed | [
"Adobe-Glyph"
] | null | null | null | import i06_i_init_main
#__name__
print(__name__)
x=str(input("Enter Your name :- "))
i06_i_init_main.greet(x) | 16.857143 | 36 | 0.720339 | 20 | 118 | 3.55 | 0.65 | 0.112676 | 0.225352 | 0.338028 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04 | 0.152542 | 118 | 7 | 37 | 16.857143 | 0.67 | 0.067797 | 0 | 0 | 0 | 0 | 0.184466 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
0665096154bd58cbc38c6182d901ce66bd1818cb | 265 | py | Python | tests/test_common.py | tresoldi/panphylo | 58ee5f77f00db86f4b088c06401f9795d93ba9b8 | [
"MIT"
] | null | null | null | tests/test_common.py | tresoldi/panphylo | 58ee5f77f00db86f4b088c06401f9795d93ba9b8 | [
"MIT"
] | 9 | 2021-12-01T15:15:09.000Z | 2021-12-07T18:32:51.000Z | tests/test_common.py | tresoldi/panphylo | 58ee5f77f00db86f4b088c06401f9795d93ba9b8 | [
"MIT"
] | null | null | null | """
Test methods in the `common` module.
"""
# Import the library for testing
import panphylo
# TODO: add empty, add single, add out of order
def test_indexes2ranges():
indexes = [1, 2, 3, 5, 8, 9]
assert panphylo.indexes2ranges(indexes) == "1-3, 5, 8-9"
| 22.083333 | 60 | 0.667925 | 41 | 265 | 4.292683 | 0.682927 | 0.238636 | 0.25 | 0.045455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.061033 | 0.196226 | 265 | 11 | 61 | 24.090909 | 0.765258 | 0.430189 | 0 | 0 | 0 | 0 | 0.077465 | 0 | 0 | 0 | 0 | 0.090909 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
06a88f62d6b10db8b23d57c1db433c0e59d4818c | 83 | py | Python | amos/apps.py | amoskipz/instagram | 120e5ef1213567297689e04d5b8620508ce18fea | [
"MIT"
] | null | null | null | amos/apps.py | amoskipz/instagram | 120e5ef1213567297689e04d5b8620508ce18fea | [
"MIT"
] | null | null | null | amos/apps.py | amoskipz/instagram | 120e5ef1213567297689e04d5b8620508ce18fea | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class amosConfig(AppConfig):
name = 'amos'
| 13.833333 | 33 | 0.73494 | 10 | 83 | 6.1 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.180723 | 83 | 5 | 34 | 16.6 | 0.897059 | 0 | 0 | 0 | 0 | 0 | 0.048193 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
ebf078eff74d268e804c82fc562be22f774b9a5c | 90 | py | Python | hello_world.py | Hmorg1671/csws-week1 | 2136db5dd9a96a0984b667bb21469105bd394d23 | [
"Apache-2.0"
] | null | null | null | hello_world.py | Hmorg1671/csws-week1 | 2136db5dd9a96a0984b667bb21469105bd394d23 | [
"Apache-2.0"
] | null | null | null | hello_world.py | Hmorg1671/csws-week1 | 2136db5dd9a96a0984b667bb21469105bd394d23 | [
"Apache-2.0"
] | null | null | null | print("Hello Python World!")
message = "Hello Python Crash Course World!"
print(message)
| 18 | 44 | 0.744444 | 12 | 90 | 5.583333 | 0.583333 | 0.328358 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 90 | 4 | 45 | 22.5 | 0.858974 | 0 | 0 | 0 | 0 | 0 | 0.566667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.666667 | 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 | 1 | 0 | 4 |
ebfe3cb6057bda2161c13129d0184912099bdfc8 | 654 | bzl | Python | source/bazel/deps/gecode/get.bzl | luxe/CodeLang-compiler | 78837d90bdd09c4b5aabbf0586a5d8f8f0c1e76a | [
"MIT"
] | 1 | 2019-01-06T08:45:46.000Z | 2019-01-06T08:45:46.000Z | source/bazel/deps/gecode/get.bzl | luxe/CodeLang-compiler | 78837d90bdd09c4b5aabbf0586a5d8f8f0c1e76a | [
"MIT"
] | 264 | 2015-11-30T08:34:00.000Z | 2018-06-26T02:28:41.000Z | source/bazel/deps/gecode/get.bzl | UniLang/compiler | c338ee92994600af801033a37dfb2f1a0c9ca897 | [
"MIT"
] | null | null | null | # Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
def gecode():
http_archive(
name = "gecode",
build_file = "//bazel/deps/gecode:build.BUILD",
sha256 = "21b00fb7aade37d57051c3eed4fb9bbcd76f8a28fae5dfbf32e385df4c7a8ad6",
strip_prefix = "gecode-027c57889d66dd26ad8e1a419c2cda22ab0cf305",
urls = [
"https://github.com/Unilang/gecode/archive/027c57889d66dd26ad8e1a419c2cda22ab0cf305.tar.gz",
],
)
| 38.470588 | 104 | 0.711009 | 67 | 654 | 6.791045 | 0.61194 | 0.03956 | 0.061538 | 0.083516 | 0.189011 | 0.189011 | 0.189011 | 0.189011 | 0.189011 | 0.189011 | 0 | 0.148352 | 0.165138 | 654 | 16 | 105 | 40.875 | 0.684982 | 0.154434 | 0 | 0 | 1 | 0 | 0.629091 | 0.418182 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | true | 0 | 0 | 0 | 0.083333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
23191b15f26e3b4e31c8abb9cf9040dc3f2987d2 | 73 | py | Python | whist/__init__.py | Whist-Team/Whist-Core | b0130c6988592ba2094c7e1384362daabaefb3f4 | [
"MIT"
] | 1 | 2021-07-01T09:11:35.000Z | 2021-07-01T09:11:35.000Z | whist/__init__.py | Whist-Team/Whist-Core | b0130c6988592ba2094c7e1384362daabaefb3f4 | [
"MIT"
] | 156 | 2021-04-20T10:01:21.000Z | 2022-03-29T21:20:25.000Z | whist/__init__.py | Whist-Team/Whist-Core | b0130c6988592ba2094c7e1384362daabaefb3f4 | [
"MIT"
] | 2 | 2021-04-18T21:26:22.000Z | 2022-03-20T17:41:13.000Z | """Whist Core"""
__import__('pkg_resources').declare_namespace(__name__)
| 24.333333 | 55 | 0.780822 | 8 | 73 | 5.875 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041096 | 73 | 2 | 56 | 36.5 | 0.671429 | 0.136986 | 0 | 0 | 0 | 0 | 0.22807 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
232b18f1324a1d8b413f16870e5ffcb02504f40f | 1,521 | py | Python | test/req.py | liaohongdong/novel-scrapy | f73afef5b5abcc961279f1cd30136a0257281cb7 | [
"MIT"
] | null | null | null | test/req.py | liaohongdong/novel-scrapy | f73afef5b5abcc961279f1cd30136a0257281cb7 | [
"MIT"
] | null | null | null | test/req.py | liaohongdong/novel-scrapy | f73afef5b5abcc961279f1cd30136a0257281cb7 | [
"MIT"
] | null | null | null | import requests
# from test import testRun
import pymysql
if __name__ == '__main__':
# asd = '123.117.254.56:8060'
# d = requests.get('http://www.baidu.com/', proxies={"http": "http://111.13.134.22:80"}, timeout=10)
# d = requests.get('https://www.qidian.com/', proxies={"http": asd}, timeout=5)
# d = requests.get('http://httpbin.org/ip', proxies={"http": asd}, timeout=5)
# d = requests.get(
# 'https://www.qidian.com/finish?action=hidden&orderId=&style=1&pageSize=20&siteid=1&pubflag=0&hiddenField=2&page=3',
# proxies={"http": asd}, timeout=5)
# print(d)
# t = testRun()
# requests.get('http://www.baidu.com/', proxies={"http": "http://112.91.224.33:9069"})
# requests.get('http://www.baidu.com/', proxies={"http": "http://123.117.32.145:8359"})
# requests.get('http://www.baidu.com/', proxies={"http": "http://40.73.36.247:8411"})
# requests.get('http://www.baidu.com/', proxies={"http": "http://123.139.56.238:8510"})
# requests.get('http://www.baidu.com/', proxies={"http": "http://39.137.69.10:8968"})
# requests.get('http://www.baidu.com/', proxies={"http": "http://218.60.8.99:8825"})
# requests.get('http://www.baidu.com/', proxies={"http": "http://124.250.26.129:9011"})
# requests.get('http://www.baidu.com/', proxies={"http": "http://39.137.77.66:8086"})
# requests.get('http://www.baidu.com/', proxies={"http": "http://39.137.69.7:9036"})
a = "aaa\n ' /n "
d = pymysql.escape_string(a + ' " hha')
print(d)
| 50.7 | 125 | 0.60092 | 228 | 1,521 | 3.969298 | 0.407895 | 0.158011 | 0.18232 | 0.198895 | 0.630939 | 0.60663 | 0.60663 | 0.555801 | 0.480663 | 0.254144 | 0 | 0.122248 | 0.134122 | 1,521 | 29 | 126 | 52.448276 | 0.56492 | 0.83169 | 0 | 0 | 0 | 0 | 0.122881 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.166667 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
2339aad471d1a528e09032aed64bc539b9b4110b | 230 | py | Python | messari/nfts/__init__.py | messari/messari-python-api-private | b027b691b570bc804e4b55a95cf1046ed1dbde86 | [
"MIT"
] | 2 | 2022-03-16T06:28:57.000Z | 2022-03-22T19:48:22.000Z | messari/nfts/__init__.py | messari/messari-python-api-private | b027b691b570bc804e4b55a95cf1046ed1dbde86 | [
"MIT"
] | 2 | 2022-01-06T07:28:23.000Z | 2022-01-31T03:55:20.000Z | messari/nfts/__init__.py | messari/messari-python-api-private | b027b691b570bc804e4b55a95cf1046ed1dbde86 | [
"MIT"
] | 2 | 2022-03-16T06:29:00.000Z | 2022-03-25T09:03:20.000Z | """Module to handle initialization, imports, for nft classes"""
# Localize imports of nft apis
from .upshot import Upshot
from .nftpricefloor import NFTPriceFloor
from .nonfungible import NonFungible
from .opensea import OpenSea
| 28.75 | 63 | 0.808696 | 29 | 230 | 6.413793 | 0.586207 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134783 | 230 | 7 | 64 | 32.857143 | 0.934673 | 0.378261 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
233e80e35e7306fa968fa8318e2696ffa2aab29a | 261 | py | Python | dive/__init__.py | lukaszhapy/dive | da9882e291920c66c8881b21f471a9a2852c39cb | [
"MIT"
] | 2 | 2021-12-07T22:38:14.000Z | 2022-02-01T14:49:51.000Z | dive/__init__.py | lukaszhapy/dive | da9882e291920c66c8881b21f471a9a2852c39cb | [
"MIT"
] | null | null | null | dive/__init__.py | lukaszhapy/dive | da9882e291920c66c8881b21f471a9a2852c39cb | [
"MIT"
] | 2 | 2021-12-15T00:01:43.000Z | 2021-12-16T17:13:39.000Z | """
dive is a Python package for Bayesian analysis of DEER data.
"""
from .constants import *
from .utils import *
from .deerload import deerload
from .models import *
from .deer import *
from .plotting import *
from .samplers import *
from .test_data import * | 21.75 | 60 | 0.743295 | 37 | 261 | 5.216216 | 0.540541 | 0.310881 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172414 | 261 | 12 | 61 | 21.75 | 0.893519 | 0.229885 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
88e0d8fcb4cb61203eead7b343fe0d9f6908aa72 | 157 | py | Python | setup.py | agururajvais/allennlp-server | 3d6f7e64f47b3c406e3b3f0a52d0dc5eed420756 | [
"Apache-2.0"
] | null | null | null | setup.py | agururajvais/allennlp-server | 3d6f7e64f47b3c406e3b3f0a52d0dc5eed420756 | [
"Apache-2.0"
] | null | null | null | setup.py | agururajvais/allennlp-server | 3d6f7e64f47b3c406e3b3f0a52d0dc5eed420756 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""See https://github.com/allenai/allennlp/blob/master/setup.py to create a package for PyPI."""
from setuptools import setup
setup()
| 26.166667 | 96 | 0.745223 | 25 | 157 | 4.68 | 0.92 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101911 | 157 | 5 | 97 | 31.4 | 0.829787 | 0.707006 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
88fd68eb8756b11175d6f9d2269671de4be6b627 | 1,387 | py | Python | federatedscope/register.py | alibaba/FederatedScope | fcf6d237624769ea094cfd68803901622f14fc23 | [
"Apache-2.0"
] | 9 | 2022-03-24T07:59:37.000Z | 2022-03-31T06:47:52.000Z | federatedscope/register.py | alibaba/FederatedScope | fcf6d237624769ea094cfd68803901622f14fc23 | [
"Apache-2.0"
] | 1 | 2022-03-28T13:52:17.000Z | 2022-03-28T13:52:17.000Z | federatedscope/register.py | alibaba/FederatedScope | fcf6d237624769ea094cfd68803901622f14fc23 | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import logging
logger = logging.getLogger(__name__)
def register(key, module, module_dict):
if key in module_dict:
logger.warning(
'Key {} is already pre-defined, overwritten.'.format(key))
module_dict[key] = module
data_dict = {}
def register_data(key, module):
register(key, module, data_dict)
model_dict = {}
def register_model(key, module):
register(key, module, model_dict)
trainer_dict = {}
def register_trainer(key, module):
register(key, module, trainer_dict)
config_dict = {}
def register_config(key, module):
register(key, module, config_dict)
metric_dict = {}
def register_metric(key, module):
register(key, module, metric_dict)
criterion_dict = {}
def register_criterion(key, module):
register(key, module, criterion_dict)
regularizer_dict = {}
def register_regularizer(key, module):
register(key, module, regularizer_dict)
auxiliary_data_loader_PIA_dict = {}
def register_auxiliary_data_loader_PIA(key, module):
register(key, module, auxiliary_data_loader_PIA_dict)
splitter_dict = {}
def register_splitter(key, module):
register(key, module, splitter_dict)
transform_dict = {}
def register_transform(key, module):
register(key, module, transform_dict)
| 16.317647 | 70 | 0.731074 | 174 | 1,387 | 5.482759 | 0.212644 | 0.216981 | 0.196017 | 0.209644 | 0.327044 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170872 | 1,387 | 84 | 71 | 16.511905 | 0.829565 | 0 | 0 | 0 | 0 | 0 | 0.031002 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.275 | false | 0 | 0.1 | 0 | 0.375 | 0.025 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
0018b66bc27c15b4396598f925644fdb3721209b | 39 | py | Python | vns_web3/auto/__init__.py | AMTcommunity/vns-web3.py | 9966be02be9f33c0341cf0abad59b7bf61e1ca92 | [
"MIT"
] | null | null | null | vns_web3/auto/__init__.py | AMTcommunity/vns-web3.py | 9966be02be9f33c0341cf0abad59b7bf61e1ca92 | [
"MIT"
] | null | null | null | vns_web3/auto/__init__.py | AMTcommunity/vns-web3.py | 9966be02be9f33c0341cf0abad59b7bf61e1ca92 | [
"MIT"
] | null | null | null | from vns_web3 import Web3
w3 = Web3()
| 9.75 | 25 | 0.717949 | 7 | 39 | 3.857143 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129032 | 0.205128 | 39 | 3 | 26 | 13 | 0.741935 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
cc578ea0c388beba7b43b87bb18949c92c24ad82 | 148 | py | Python | src/utils/functions/printLogo.py | kori-lab/Violet | 304b47439ac7f72474fa83021634d2c477ed9f9f | [
"MIT"
] | 3 | 2021-08-18T03:31:45.000Z | 2021-08-30T11:04:24.000Z | src/utils/functions/printLogo.py | kori-lab/Violet | 304b47439ac7f72474fa83021634d2c477ed9f9f | [
"MIT"
] | null | null | null | src/utils/functions/printLogo.py | kori-lab/Violet | 304b47439ac7f72474fa83021634d2c477ed9f9f | [
"MIT"
] | null | null | null | def run() -> None:
ref_arquivo = open("logo.txt","r");
print('\033[1;31m'+ ref_arquivo.read() +'テロ \033[0;0m\n');
ref_arquivo.close(); | 24.666667 | 62 | 0.574324 | 24 | 148 | 3.416667 | 0.791667 | 0.365854 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.089431 | 0.168919 | 148 | 6 | 63 | 24.666667 | 0.577236 | 0 | 0 | 0 | 0 | 0 | 0.221477 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.25 | 0.25 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
cc5e684bdbc4fb271cbeaa442cb0bedfdf4e5179 | 198 | py | Python | src/certitude/__init__.py | Lukasa/certitude | 33845ae0a6b123f084f10c7dd27f11485dd73ca6 | [
"MIT"
] | 22 | 2015-12-23T22:30:13.000Z | 2019-02-09T02:49:53.000Z | src/certitude/__init__.py | Lukasa/certitude | 33845ae0a6b123f084f10c7dd27f11485dd73ca6 | [
"MIT"
] | 12 | 2015-12-23T22:31:15.000Z | 2020-10-27T21:05:34.000Z | src/certitude/__init__.py | Lukasa/certitude | 33845ae0a6b123f084f10c7dd27f11485dd73ca6 | [
"MIT"
] | 1 | 2016-04-25T13:12:31.000Z | 2016-04-25T13:12:31.000Z | # -*- coding: utf-8 -*-
"""
The certitude public API.
This module exposes only the platform-specific parts of certitude.
"""
from .api import validate_cert_chain
__all__ = ['validate_cert_chain']
| 19.8 | 66 | 0.732323 | 27 | 198 | 5.074074 | 0.777778 | 0.175182 | 0.248175 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005917 | 0.146465 | 198 | 9 | 67 | 22 | 0.804734 | 0.585859 | 0 | 0 | 0 | 0 | 0.256757 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
cc66a9afdfdf25b02160b9bbfbb64fbe34f83a97 | 330 | py | Python | lib/user/contrib/template imports/processes.py | DanWoodrich/INSTINCT | bb9206fed738d40c131ed4bb229dbe46338487f2 | [
"MIT"
] | 5 | 2021-08-24T02:00:20.000Z | 2022-03-11T01:43:00.000Z | lib/user/contrib/template imports/processes.py | DanWoodrich/INSTINCT | bb9206fed738d40c131ed4bb229dbe46338487f2 | [
"MIT"
] | null | null | null | lib/user/contrib/template imports/processes.py | DanWoodrich/INSTINCT | bb9206fed738d40c131ed4bb229dbe46338487f2 | [
"MIT"
] | null | null | null | #can choose to import in global namespace
from classes import INSTINCT_process,Split_process,SplitRun_process,Unify_process,INSTINCT_userprocess
from getglobals import PARAMSET_GLOBALS
from misc import file_peek,get_difftime,get_param_names
from pipe_shapes import *
from .contrib.instinct_afsc_mml_acoustics.processes import *
| 36.666667 | 102 | 0.875758 | 47 | 330 | 5.851064 | 0.680851 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.087879 | 330 | 8 | 103 | 41.25 | 0.913621 | 0.121212 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
cc71da262d26fa182f8ad75c7fa60fb391e2349b | 131 | py | Python | ABC/179/e.py | fumiyanll23/AtCoder | 362ca9fcacb5415c1458bc8dee5326ba2cc70b65 | [
"MIT"
] | null | null | null | ABC/179/e.py | fumiyanll23/AtCoder | 362ca9fcacb5415c1458bc8dee5326ba2cc70b65 | [
"MIT"
] | null | null | null | ABC/179/e.py | fumiyanll23/AtCoder | 362ca9fcacb5415c1458bc8dee5326ba2cc70b65 | [
"MIT"
] | null | null | null | N, X, M = map(int, input().split())
A = [0 for i in range(N)]
A[0] = X
for i in range(N-1):
A[i+1] = (A[i]**2) % M
print(sum(A)) | 18.714286 | 35 | 0.496183 | 33 | 131 | 1.969697 | 0.515152 | 0.061538 | 0.184615 | 0.338462 | 0.369231 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048544 | 0.21374 | 131 | 7 | 36 | 18.714286 | 0.582524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.166667 | 0 | 0 | 1 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
cc87697b83617e2e758193b1a3aebe7571281ace | 69 | py | Python | fastfold/utils/__init__.py | hpcaitech/FastFold | a65d5009279ef84c1518081344db5c02213c387a | [
"Apache-2.0"
] | 303 | 2022-03-03T01:59:47.000Z | 2022-03-31T07:46:42.000Z | fastfold/utils/__init__.py | hpcaitech/FastFold | a65d5009279ef84c1518081344db5c02213c387a | [
"Apache-2.0"
] | 6 | 2022-03-03T22:17:03.000Z | 2022-03-17T06:09:11.000Z | fastfold/utils/__init__.py | hpcaitech/FastFold | a65d5009279ef84c1518081344db5c02213c387a | [
"Apache-2.0"
] | 35 | 2022-03-03T01:58:56.000Z | 2022-03-29T21:21:06.000Z | from .inject_fastnn import inject_fastnn
__all__ = ['inject_fastnn'] | 23 | 40 | 0.811594 | 9 | 69 | 5.444444 | 0.555556 | 0.734694 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101449 | 69 | 3 | 41 | 23 | 0.790323 | 0 | 0 | 0 | 0 | 0 | 0.185714 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
cccbd05e7274fa6536caa85b2f2816ece296bc6f | 271 | py | Python | t01primeshcflcm_lcm2.py | CherryNoddles/y1math | 877b87ee60e7569b4fed4abdcb53a03df3d02ac3 | [
"MIT"
] | 1 | 2020-10-01T04:03:44.000Z | 2020-10-01T04:03:44.000Z | t01primeshcflcm_lcm2.py | CherryNoddles/y1math | 877b87ee60e7569b4fed4abdcb53a03df3d02ac3 | [
"MIT"
] | 4 | 2019-10-20T03:52:11.000Z | 2019-10-24T07:13:58.000Z | t01primeshcflcm_lcm2.py | CherryNoddles/y1math | 877b87ee60e7569b4fed4abdcb53a03df3d02ac3 | [
"MIT"
] | 403 | 2019-10-17T05:30:21.000Z | 2020-10-28T10:33:07.000Z | # To find LCM, we can use prime factorisation.
# Step 1: Obtain the prime factorisation of each number
# Step 2: Identify the common prime factors
# Step 3: The LCM of the two numbers is the product of the common prime factors
# and all the other prime factors
| 38.714286 | 80 | 0.738007 | 46 | 271 | 4.347826 | 0.586957 | 0.18 | 0.14 | 0.21 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014286 | 0.225092 | 271 | 6 | 81 | 45.166667 | 0.938095 | 0.95572 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
ccd4808170fd62718ae1d355903cc81fb8046e69 | 157 | py | Python | seqpos/lib/python2.7/site-packages/hgext3rd/__init__.py | guanjue/seqpos | ab9308ad128547ca968a1d944490710e583703bc | [
"MIT"
] | 1 | 2019-12-19T01:53:13.000Z | 2019-12-19T01:53:13.000Z | hgext3rd/__init__.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | hgext3rd/__init__.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | # name space package to host third party extensions
from __future__ import absolute_import
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
| 31.4 | 51 | 0.840764 | 21 | 157 | 5.428571 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121019 | 157 | 4 | 52 | 39.25 | 0.826087 | 0.312102 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
aea6bbffe05ae98f8271cb698401727eb23f0908 | 47 | py | Python | earthvision/datasets/l8biome.py | kokoedwin/earth-vision | 9617480ac537ec4f769e0979afcf0a45aee5e3c5 | [
"MIT"
] | null | null | null | earthvision/datasets/l8biome.py | kokoedwin/earth-vision | 9617480ac537ec4f769e0979afcf0a45aee5e3c5 | [
"MIT"
] | null | null | null | earthvision/datasets/l8biome.py | kokoedwin/earth-vision | 9617480ac537ec4f769e0979afcf0a45aee5e3c5 | [
"MIT"
] | null | null | null | class L8Biome():
raise NotImplementedError
| 15.666667 | 29 | 0.765957 | 4 | 47 | 9 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025641 | 0.170213 | 47 | 2 | 30 | 23.5 | 0.897436 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0.5 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
aecbae01fef7b59c17c86210ea5721e0f77bc0dd | 170 | py | Python | py3algs/__init__.py | nitsas/py3algs | ec34d80c15e32c96e25bb7a72b77faac80c5c772 | [
"MIT"
] | null | null | null | py3algs/__init__.py | nitsas/py3algs | ec34d80c15e32c96e25bb7a72b77faac80c5c772 | [
"MIT"
] | null | null | null | py3algs/__init__.py | nitsas/py3algs | ec34d80c15e32c96e25bb7a72b77faac80c5c772 | [
"MIT"
] | null | null | null | from . import algorithms
from . import datastructs
from .algorithms import *
from .datastructs import *
__all__ = algorithms.__all__
__all__.extend(datastructs.__all__)
| 21.25 | 35 | 0.805882 | 19 | 170 | 6.368421 | 0.315789 | 0.165289 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.123529 | 170 | 7 | 36 | 24.285714 | 0.812081 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
4e034df4538b226307f8d7ccb859903375e085d4 | 436 | py | Python | oscommands.py | swaroop9ai9/problemsolving | 48b9092a1671d391c0a7a2615a423fdba7f59b9c | [
"MIT"
] | 1 | 2020-08-05T14:29:50.000Z | 2020-08-05T14:29:50.000Z | oscommands.py | swaroop9ai9/problemsolving | 48b9092a1671d391c0a7a2615a423fdba7f59b9c | [
"MIT"
] | null | null | null | oscommands.py | swaroop9ai9/problemsolving | 48b9092a1671d391c0a7a2615a423fdba7f59b9c | [
"MIT"
] | null | null | null | # Os module functions
# rename(?current-name?,?new-name?) , used to rename the file
import os
os.rename("Text.txt","text.txt")
#remove(?file-name?) , used to remove the file
#mkdir(?directory-name?) ,used to create new directory
os.mkdir("basics")
#chdir("new-directory") ,used to change the current working directory
#getcwd() ,to get the current working directory
#rmdir(?directory-name?) ,to remove the current working directory
| 29.066667 | 69 | 0.738532 | 66 | 436 | 4.878788 | 0.378788 | 0.074534 | 0.093168 | 0.242236 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126147 | 436 | 14 | 70 | 31.142857 | 0.845144 | 0.81422 | 0 | 0 | 0 | 0 | 0.30137 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
4e0b22e3ddbdde714752af0202bca6948048bdc3 | 3,062 | py | Python | where/apriori/satellites/gps.py | ingridfausk/where | b65398911075b7ddef3a3a1146efa428eae498fe | [
"MIT"
] | 16 | 2018-08-31T10:31:11.000Z | 2022-03-15T16:07:24.000Z | where/apriori/satellites/gps.py | ingridfausk/where | b65398911075b7ddef3a3a1146efa428eae498fe | [
"MIT"
] | 5 | 2018-07-13T14:04:24.000Z | 2021-06-17T02:14:44.000Z | where/apriori/satellites/gps.py | ingridfausk/where | b65398911075b7ddef3a3a1146efa428eae498fe | [
"MIT"
] | 15 | 2018-06-07T05:45:24.000Z | 2022-03-15T16:07:27.000Z | """General information about GPS satellites
Description:
"""
# Standard library imports
import math
# External library imports
import numpy as np
# Midgard imports
from midgard.dev import plugins
# Where imports
from where import apriori
from where.apriori.satellites import satellite
class Gps:
"""General properties of GPS satellites
This class should be used as a mixin together with satellite.Satellite. That is, any GPS-satellite object should
inherit from both Gps and satellite.Satellite (in that order).
"""
area = math.pi * 0.30 ** 2
mass = 40.965
def initial_posvel(self, initial_dt):
"""Calculate initial position and velocity for GPS satellites
"""
orb = apriori.get("gnss_orbit", rundate=initial_dt)[self.name]["pos"]
pos = orb.gcrs[0]
vel = (orb.gcrs[1] - orb.gcrs[0]) / (orb.utc_dt[1] - orb.utc_dt[0]).total_seconds()
return np.hstack((pos, vel))
@plugins.register
class G01(Gps, satellite.Satellite):
pass
@plugins.register
class G02(Gps, satellite.Satellite):
pass
@plugins.register
class G03(Gps, satellite.Satellite):
pass
@plugins.register
class G04(Gps, satellite.Satellite):
pass
@plugins.register
class G05(Gps, satellite.Satellite):
pass
@plugins.register
class G06(Gps, satellite.Satellite):
pass
@plugins.register
class G07(Gps, satellite.Satellite):
pass
@plugins.register
class G08(Gps, satellite.Satellite):
pass
@plugins.register
class G09(Gps, satellite.Satellite):
pass
@plugins.register
class G10(Gps, satellite.Satellite):
pass
@plugins.register
class G11(Gps, satellite.Satellite):
pass
@plugins.register
class G12(Gps, satellite.Satellite):
pass
@plugins.register
class G13(Gps, satellite.Satellite):
pass
@plugins.register
class G14(Gps, satellite.Satellite):
pass
@plugins.register
class G15(Gps, satellite.Satellite):
pass
@plugins.register
class G16(Gps, satellite.Satellite):
pass
@plugins.register
class G17(Gps, satellite.Satellite):
pass
@plugins.register
class G18(Gps, satellite.Satellite):
pass
@plugins.register
class G19(Gps, satellite.Satellite):
pass
@plugins.register
class G20(Gps, satellite.Satellite):
pass
@plugins.register
class G21(Gps, satellite.Satellite):
pass
@plugins.register
class G22(Gps, satellite.Satellite):
pass
@plugins.register
class G23(Gps, satellite.Satellite):
pass
@plugins.register
class G24(Gps, satellite.Satellite):
pass
@plugins.register
class G25(Gps, satellite.Satellite):
pass
@plugins.register
class G26(Gps, satellite.Satellite):
pass
@plugins.register
class G27(Gps, satellite.Satellite):
pass
@plugins.register
class G28(Gps, satellite.Satellite):
pass
@plugins.register
class G29(Gps, satellite.Satellite):
pass
@plugins.register
class G30(Gps, satellite.Satellite):
pass
@plugins.register
class G31(Gps, satellite.Satellite):
pass
@plugins.register
class G32(Gps, satellite.Satellite):
pass
| 15.386935 | 116 | 0.714892 | 389 | 3,062 | 5.609255 | 0.277635 | 0.280477 | 0.293309 | 0.366636 | 0.639322 | 0.639322 | 0.639322 | 0 | 0 | 0 | 0 | 0.0311 | 0.180928 | 3,062 | 198 | 117 | 15.464646 | 0.838915 | 0.136186 | 0 | 0.587156 | 0 | 0 | 0.004983 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.009174 | false | 0.293578 | 0.045872 | 0 | 0.385321 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
4e34652657681d3f8770e4adf44dce4780f03aef | 664 | py | Python | samples/WebApplication/test_offline.py | jproudlo/PyModel | 2ab0e2cf821807206725adaa425409b0c28929b7 | [
"BSD-3-Clause"
] | 61 | 2015-01-29T16:18:51.000Z | 2021-09-28T10:14:02.000Z | samples/WebApplication/test_offline.py | vikstr/PyModel | 4fff616fe0fd8342c91a42d9db5d4097a179dff8 | [
"BSD-3-Clause"
] | 2 | 2015-02-04T11:57:53.000Z | 2021-07-18T20:59:55.000Z | samples/WebApplication/test_offline.py | vikstr/PyModel | 4fff616fe0fd8342c91a42d9db5d4097a179dff8 | [
"BSD-3-Clause"
] | 34 | 2015-02-04T12:00:29.000Z | 2022-03-14T07:41:25.000Z | """
WebApplication offline test generation
"""
cases = [
('Generate a test suite with three runs',
'pmt -n 10 -c 3 -s 3 -r 3 WebModel -o WebModelTest_n10_c3_s3_r3'),
('Show the generated test suite',
'more WebModelTest_n10_c3_s3_r3.py') # 'more' is the same in Unix and Windows
# Now you can run the generated test suite:
# pmt WebModelTest_n10_c3_s3_r3
# check the generated test suite agains the model:
# pmt WebModelTest_n10_c3_s3_r3 WebModel
# execute the generated test suite on the web application:
# wsgirunner webapp # start the web application on localhost
# pmt WebModelTest_n10_c3_s3_r3 -i Stepper
]
| 33.2 | 82 | 0.709337 | 102 | 664 | 4.421569 | 0.519608 | 0.099778 | 0.18847 | 0.210643 | 0.252772 | 0.159645 | 0 | 0 | 0 | 0 | 0 | 0.05814 | 0.222892 | 664 | 19 | 83 | 34.947368 | 0.815891 | 0.599398 | 0 | 0 | 1 | 0 | 0.644 | 0.212 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
4e379fe41f32fe9f235ffaee36cf95629eb62822 | 357 | py | Python | models/user.py | dlitvakb/horrible_dad_jokes_bot | d42f35d042f8726b0c6c5839e503d2fb458df105 | [
"Unlicense"
] | 3 | 2018-04-03T23:49:25.000Z | 2018-09-17T00:34:06.000Z | models/user.py | dlitvakb/horrible_dad_jokes_bot | d42f35d042f8726b0c6c5839e503d2fb458df105 | [
"Unlicense"
] | 1 | 2021-06-01T22:01:08.000Z | 2021-06-01T22:01:08.000Z | models/user.py | dlitvakb/horrible_dad_jokes_bot | d42f35d042f8726b0c6c5839e503d2fb458df105 | [
"Unlicense"
] | null | null | null | from .base_model import BaseModel
class User(BaseModel):
__CONTENT_TYPE__ = 'registeredUser'
__SEARCH_FIELD__ = 'chatId'
def __init__(self, chat_id):
self.chat_id = chat_id
def _search_field(self):
return self.chat_id
def _create_fields(self):
return {
'chatId': {'en-US': self.chat_id}
}
| 21 | 45 | 0.627451 | 43 | 357 | 4.651163 | 0.534884 | 0.15 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.27451 | 357 | 16 | 46 | 22.3125 | 0.772201 | 0 | 0 | 0 | 0 | 0 | 0.086835 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.083333 | 0.166667 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
9d6fe92a9804a810dcb8a74ce2276dc51e8562a4 | 607 | py | Python | config.py | NarayanAdithya/CELIS_hyperhack | 4a24cbbe03767d91ee24c90d717e9699b416384e | [
"MIT"
] | null | null | null | config.py | NarayanAdithya/CELIS_hyperhack | 4a24cbbe03767d91ee24c90d717e9699b416384e | [
"MIT"
] | null | null | null | config.py | NarayanAdithya/CELIS_hyperhack | 4a24cbbe03767d91ee24c90d717e9699b416384e | [
"MIT"
] | null | null | null | import os
basedir=os.path.abspath(os.path.dirname(__file__))
class config(object):
SECRET_KEY= os.environ.get('SECRET_KEY') or '334nadnj&&89Ydau89YAd98adbszmdi3*&&923kln'
SQLALCHEMY_DATABASE_URI=os.environ.get('DATABASE_URL') or \
'sqlite:///'+os.path.join(basedir,'app.db')
SQLALCHEMY_TRACK_MODIFICATIONS=False
MAIL_SERVER=os.environ.get('MAIL_SERVER')
MAIL_PASSWORD=os.environ.get('MAIL_PASSWORD')
MAIL_USE_TLS=os.environ.get('MAIL_USE_TLS')
MAIL_PORT=os.environ.get('MAIL_PORT')
MAIL_USERNAME=os.environ.get('MAIL_USERNAME')
ADMINS=['aravindhari11@gmail.com'] | 43.357143 | 91 | 0.742998 | 85 | 607 | 5.035294 | 0.470588 | 0.147196 | 0.196262 | 0.186916 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027624 | 0.105437 | 607 | 14 | 92 | 43.357143 | 0.760589 | 0 | 0 | 0 | 0 | 0 | 0.263158 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.076923 | 0.076923 | 0 | 0.846154 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 4 |
9d9cc46822894cfc24fcf4366a1b402469cd4807 | 192 | py | Python | problems/calculate_average_.py | stereoabuse/codewars | d6437afaef38c3601903891b8b9cb0f84c108c54 | [
"MIT"
] | null | null | null | problems/calculate_average_.py | stereoabuse/codewars | d6437afaef38c3601903891b8b9cb0f84c108c54 | [
"MIT"
] | null | null | null | problems/calculate_average_.py | stereoabuse/codewars | d6437afaef38c3601903891b8b9cb0f84c108c54 | [
"MIT"
] | null | null | null | ## Calculate average
## 8 kyu
## https://www.codewars.com//kata/57a2013acf1fa5bfc4000921
def find_average(array):
total = sum([i for i in array])
return total / len(array) | 24 | 60 | 0.65625 | 25 | 192 | 5 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.10596 | 0.213542 | 192 | 8 | 61 | 24 | 0.721854 | 0.427083 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
9dac886a906dcdb1decfd37d8fc9726d1e366a1e | 63 | py | Python | versions_tests/__init__.py | DocTocToc/cleanerversion | becadbab5d7b474a0e9a596b99e97682402d2f2c | [
"Apache-2.0"
] | 121 | 2015-01-03T05:08:55.000Z | 2021-01-28T16:54:05.000Z | versions_tests/__init__.py | DocTocToc/cleanerversion | becadbab5d7b474a0e9a596b99e97682402d2f2c | [
"Apache-2.0"
] | 115 | 2015-01-06T14:04:24.000Z | 2019-02-07T05:15:51.000Z | versions_tests/__init__.py | DocTocToc/cleanerversion | becadbab5d7b474a0e9a596b99e97682402d2f2c | [
"Apache-2.0"
] | 57 | 2015-01-06T11:34:41.000Z | 2022-01-14T10:59:52.000Z | default_app_config = 'versions_tests.apps.VersionsTestsConfig'
| 31.5 | 62 | 0.873016 | 7 | 63 | 7.428571 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047619 | 63 | 1 | 63 | 63 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0.619048 | 0.619048 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
9ded5d6f8eebc114fe54c770becc4bb51aac2616 | 180 | py | Python | hero/serializers.py | BobsProgrammingAcademy/Portfolio-Website-Deployment | e3122f6fa0376f64b1580e03b8cb43da6dc85a1a | [
"MIT"
] | null | null | null | hero/serializers.py | BobsProgrammingAcademy/Portfolio-Website-Deployment | e3122f6fa0376f64b1580e03b8cb43da6dc85a1a | [
"MIT"
] | null | null | null | hero/serializers.py | BobsProgrammingAcademy/Portfolio-Website-Deployment | e3122f6fa0376f64b1580e03b8cb43da6dc85a1a | [
"MIT"
] | null | null | null | from rest_framework import serializers
from .models import Hero
class HeroSerializer(serializers.ModelSerializer):
class Meta:
model = Hero
fields = '__all__' | 22.5 | 50 | 0.727778 | 19 | 180 | 6.631579 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.216667 | 180 | 8 | 51 | 22.5 | 0.893617 | 0 | 0 | 0 | 0 | 0 | 0.038674 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
d197b5c9732106cdb59e0bb2474ab1134947eb4b | 144 | py | Python | src/__main__.py | Karma1-1-1-1/Guess_who | 94239f5cfa3e2ea1b3c307462dee1f735276ca88 | [
"MIT"
] | null | null | null | src/__main__.py | Karma1-1-1-1/Guess_who | 94239f5cfa3e2ea1b3c307462dee1f735276ca88 | [
"MIT"
] | null | null | null | src/__main__.py | Karma1-1-1-1/Guess_who | 94239f5cfa3e2ea1b3c307462dee1f735276ca88 | [
"MIT"
] | null | null | null | """
Title: Guess Who [Human VS Computer]
Contributors: Check on GitHub
"""
def main():
pass
if __name__ == "__main__":
main()
| 13.090909 | 40 | 0.597222 | 17 | 144 | 4.588235 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.263889 | 144 | 10 | 41 | 14.4 | 0.735849 | 0.458333 | 0 | 0 | 0 | 0 | 0.129032 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 0.25 | 0 | 0 | 0.25 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
d1aeb13fced7364176fcf92b0698f1f2fe984008 | 290 | py | Python | order/SizeConverter/test.py | LandyGuo/brosbespoke | 642fda249d01ed30b7e3b711f1521f22e88312bb | [
"Apache-2.0"
] | 1 | 2016-03-31T03:22:47.000Z | 2016-03-31T03:22:47.000Z | order/SizeConverter/test.py | LandyGuo/brosbespoke | 642fda249d01ed30b7e3b711f1521f22e88312bb | [
"Apache-2.0"
] | null | null | null | order/SizeConverter/test.py | LandyGuo/brosbespoke | 642fda249d01ed30b7e3b711f1521f22e88312bb | [
"Apache-2.0"
] | null | null | null | # mysetup.py
from distutils.core import setup
import py2exe
setup(console=[r"E:\workspace\SizeConverter\main.py",],
data_files=[("data",
[r"E:\workspace\SizeConverter\data\coat.txt",
r"E:\workspace\SizeConverter\data\trou.txt"]),],
) | 29 | 68 | 0.603448 | 34 | 290 | 5.117647 | 0.558824 | 0.034483 | 0.189655 | 0.413793 | 0.321839 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004525 | 0.237931 | 290 | 10 | 69 | 29 | 0.782805 | 0.034483 | 0 | 0 | 0 | 0 | 0.422939 | 0.408602 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.285714 | 0 | 0.285714 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
ae2821f75a1a4ccdfdc72cf6fd0bc59c067127ac | 17 | py | Python | cloudlift/version/__init__.py | thulasi-ram/cloudlift | 5c1826e4dce237bb92896976d610efc8d59de73a | [
"MIT"
] | 19 | 2019-03-04T08:38:18.000Z | 2022-03-25T04:48:38.000Z | cloudlift/version/__init__.py | thulasi-ram/cloudlift | 5c1826e4dce237bb92896976d610efc8d59de73a | [
"MIT"
] | 28 | 2020-01-19T07:16:02.000Z | 2022-02-24T06:58:27.000Z | cloudlift/version/__init__.py | thulasi-ram/cloudlift | 5c1826e4dce237bb92896976d610efc8d59de73a | [
"MIT"
] | 10 | 2019-07-29T12:21:03.000Z | 2021-11-17T15:52:54.000Z | VERSION = '1.4.8' | 17 | 17 | 0.588235 | 4 | 17 | 2.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 0.117647 | 17 | 1 | 17 | 17 | 0.466667 | 0 | 0 | 0 | 0 | 0 | 0.277778 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
ae4103ed534dd83880c2dab347bf36b310067c4b | 16,182 | py | Python | cogs/others/football.py | zz-xx/robox86 | 55bb2a763bd178771271b1ca8abe848d18ad0507 | [
"MIT"
] | null | null | null | cogs/others/football.py | zz-xx/robox86 | 55bb2a763bd178771271b1ca8abe848d18ad0507 | [
"MIT"
] | null | null | null | cogs/others/football.py | zz-xx/robox86 | 55bb2a763bd178771271b1ca8abe848d18ad0507 | [
"MIT"
] | null | null | null | import json
import ast
import discord
from discord.ext import commands
from x86 import helpers
BASE_API_URL = 'http://api.football-data.org/v1/competitions'
class Soccer:
"""Commands associated with fetching Soccer related data"""
@commands.command()
@commands.cooldown(6,12)
async def table(self, ctx, *args):
"""Fetch standings of given league"""
raw_data = await helpers.make_request(ctx, BASE_API_URL)
data = json.loads(raw_data.decode('utf-8'))
prem_league = data[1]
prem_teams_url = prem_league['_links']['leagueTable']['href']
print(prem_teams_url)
raw_data = await helpers.make_request(ctx, prem_teams_url)
data = json.loads(raw_data.decode('utf-8'))
data_embed=discord.Embed(title=f"Matchday {data['matchday']}", description="-------------------------------------------------------------------------------", colour=discord.Color(value=await helpers.get_color()))
data_embed.set_author(name=data['leagueCaption'])
count = 0
for team in data['standing']:
data_embed.add_field(name='\u200b', value='\u200b', inline=True)
data_embed.add_field(name=f"{team['position']}. {team['teamName']}" , value=f"Played: {team['playedGames']} Points: {team['points']} Wins: {team['wins']} Draws: {team['draws']} Losses: {team['losses']} GF: {team['goals']} GA: {team['goalsAgainst']} GD: {team['goalDifference']}", inline=True)
count+=1
if count == 10: break
await ctx.send(embed=data_embed)
@commands.command()
@commands.cooldown(6,60)
async def wc(self, ctx, *args):
"Command associated with Fifa World Cup 2018"
api_url = BASE_API_URL + '/467'
raw_data = await helpers.make_request(ctx, api_url)
#got the solution from stack overflow
#converts the byte to dictionary
#apparently it's `byte` object so this must be done
#this is first time i am facing such problem with api
raw_data = raw_data.decode('utf-8')
data = ast.literal_eval(raw_data)
if not args:
print('Working')
embed = discord.Embed(description='------------------------------------', color=await helpers.get_color())
embed.set_author(name=data['caption'], icon_url='https://image.jimcdn.com/app/cms/image/transf/dimension=641x10000:format=png/path/s6d54c624f88c95ec/image/i34d2e10b38f67263/version/1490980233/fifa-world-cup.png')
embed.set_thumbnail(url='http://www.yordes.com/wp-content/uploads/edd/2017/09/world-cup-2018-logo-700x525.jpg')
embed.add_field(name='Current match day', value=data['currentMatchday'])
embed.add_field(name='Number of teams', value=data['numberOfTeams'])
embed.add_field(name='Number of games', value=data['numberOfGames'])
embed.add_field(name='Number of matchdays', value=data['numberOfMatchdays'])
embed.set_footer(text=f"last updated on {data['lastUpdated'].split('T')[0]} at {data['lastUpdated'].split('T')[1][:-1]} UTC")
await ctx.send(embed=embed)
if args:
#making request on league table api endpoint and converting it into dict
leagueTable_url = data['_links']['leagueTable']['href']
leagueTable_data = await helpers.make_request(ctx, leagueTable_url)
leagueTable_data = leagueTable_data.decode('utf-8')
leagueTable_data = ast.literal_eval(leagueTable_data)
#not proud of this but this works so
#standings by group
if args[0] in ['g','group','G','Group'] and args[1] in ['a','A']:
embed = discord.Embed(title='\u200b', description='**`Group A`**', color=await helpers.get_color())#, description='------------------------------------')
embed.set_author(name=data['caption'], icon_url='https://image.jimcdn.com/app/cms/image/transf/dimension=641x10000:format=png/path/s6d54c624f88c95ec/image/i34d2e10b38f67263/version/1490980233/fifa-world-cup.png')
embed.set_thumbnail(url='http://www.yordes.com/wp-content/uploads/edd/2017/09/world-cup-2018-logo-700x525.jpg')
embed.set_footer(text=f"last updated on {data['lastUpdated'].split('T')[0]} at {data['lastUpdated'].split('T')[1][:-1]} UTC")
for team in leagueTable_data['standings']['A']:
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
embed.add_field(name=f"{team['rank']}. {team['team']}" , value=f"Played: {team['playedGames']} Points: {team['points']} GF: {team['goals']} GA: {team['goalsAgainst']} GD: {team['goalDifference']}", inline=True)
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
await ctx.send(embed=embed)
elif args[0] in ['g','group','G','Group'] and args[1] in ['b','B']:
embed = discord.Embed(title='\u200b', description='**`Group B`**', color=await helpers.get_color())#, description='------------------------------------')
embed.set_author(name=data['caption'], icon_url='https://image.jimcdn.com/app/cms/image/transf/dimension=641x10000:format=png/path/s6d54c624f88c95ec/image/i34d2e10b38f67263/version/1490980233/fifa-world-cup.png')
embed.set_thumbnail(url='http://www.yordes.com/wp-content/uploads/edd/2017/09/world-cup-2018-logo-700x525.jpg')
embed.set_footer(text=f"last updated on {data['lastUpdated'].split('T')[0]} at {data['lastUpdated'].split('T')[1][:-1]} UTC")
for team in leagueTable_data['standings']['B']:
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
embed.add_field(name=f"{team['rank']}. {team['team']}" , value=f"Played: {team['playedGames']} Points: {team['points']} GF: {team['goals']} GA: {team['goalsAgainst']} GD: {team['goalDifference']}", inline=True)
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
await ctx.send(embed=embed)
elif args[0] in ['g','group','G','Group'] and args[1] in ['c','C']:
embed = discord.Embed(title='\u200b', description='**`Group C`**', color=await helpers.get_color())#, description='------------------------------------')
embed.set_author(name=data['caption'], icon_url='https://image.jimcdn.com/app/cms/image/transf/dimension=641x10000:format=png/path/s6d54c624f88c95ec/image/i34d2e10b38f67263/version/1490980233/fifa-world-cup.png')
embed.set_thumbnail(url='http://www.yordes.com/wp-content/uploads/edd/2017/09/world-cup-2018-logo-700x525.jpg')
embed.set_footer(text=f"last updated on {data['lastUpdated'].split('T')[0]} at {data['lastUpdated'].split('T')[1][:-1]} UTC")
for team in leagueTable_data['standings']['C']:
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
embed.add_field(name=f"{team['rank']}. {team['team']}" , value=f"Played: {team['playedGames']} Points: {team['points']} GF: {team['goals']} GA: {team['goalsAgainst']} GD: {team['goalDifference']}", inline=True)
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
await ctx.send(embed=embed)
elif args[0] in ['g','group','G','Group'] and args[1] in ['d','D']:
embed = discord.Embed(title='\u200b', description='**`Group D`**', color=await helpers.get_color())#, description='------------------------------------')
embed.set_author(name=data['caption'], icon_url='https://image.jimcdn.com/app/cms/image/transf/dimension=641x10000:format=png/path/s6d54c624f88c95ec/image/i34d2e10b38f67263/version/1490980233/fifa-world-cup.png')
embed.set_thumbnail(url='http://www.yordes.com/wp-content/uploads/edd/2017/09/world-cup-2018-logo-700x525.jpg')
embed.set_footer(text=f"last updated on {data['lastUpdated'].split('T')[0]} at {data['lastUpdated'].split('T')[1][:-1]} UTC")
for team in leagueTable_data['standings']['D']:
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
embed.add_field(name=f"{team['rank']}. {team['team']}" , value=f"Played: {team['playedGames']} Points: {team['points']} GF: {team['goals']} GA: {team['goalsAgainst']} GD: {team['goalDifference']}", inline=True)
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
await ctx.send(embed=embed)
elif args[0] in ['g','group','G','Group'] and args[1] in ['e','E']:
embed = discord.Embed(title='\u200b', description='**`Group E`**', color=await helpers.get_color())#, description='------------------------------------')
embed.set_author(name=data['caption'], icon_url='https://image.jimcdn.com/app/cms/image/transf/dimension=641x10000:format=png/path/s6d54c624f88c95ec/image/i34d2e10b38f67263/version/1490980233/fifa-world-cup.png')
embed.set_thumbnail(url='http://www.yordes.com/wp-content/uploads/edd/2017/09/world-cup-2018-logo-700x525.jpg')
embed.set_footer(text=f"last updated on {data['lastUpdated'].split('T')[0]} at {data['lastUpdated'].split('T')[1][:-1]} UTC")
for team in leagueTable_data['standings']['E']:
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
embed.add_field(name=f"{team['rank']}. {team['team']}" , value=f"Played: {team['playedGames']} Points: {team['points']} GF: {team['goals']} GA: {team['goalsAgainst']} GD: {team['goalDifference']}", inline=True)
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
await ctx.send(embed=embed)
elif args[0] in ['g','group','G','Group'] and args[1] in ['f','F']:
embed = discord.Embed(title='\u200b', description='**`Group F`**', color=await helpers.get_color())#, description='------------------------------------')
embed.set_author(name=data['caption'], icon_url='https://image.jimcdn.com/app/cms/image/transf/dimension=641x10000:format=png/path/s6d54c624f88c95ec/image/i34d2e10b38f67263/version/1490980233/fifa-world-cup.png')
embed.set_thumbnail(url='http://www.yordes.com/wp-content/uploads/edd/2017/09/world-cup-2018-logo-700x525.jpg')
embed.set_footer(text=f"last updated on {data['lastUpdated'].split('T')[0]} at {data['lastUpdated'].split('T')[1][:-1]} UTC")
for team in leagueTable_data['standings']['F']:
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
embed.add_field(name=f"{team['rank']}. {team['team']}" , value=f"Played: {team['playedGames']} Points: {team['points']} GF: {team['goals']} GA: {team['goalsAgainst']} GD: {team['goalDifference']}", inline=True)
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
await ctx.send(embed=embed)
elif args[0] in ['g','group','G','Group'] and args[1] in ['g','G']:
embed = discord.Embed(title='\u200b', description='**`Group G`**', color=await helpers.get_color())#, description='------------------------------------')
embed.set_author(name=data['caption'], icon_url='https://image.jimcdn.com/app/cms/image/transf/dimension=641x10000:format=png/path/s6d54c624f88c95ec/image/i34d2e10b38f67263/version/1490980233/fifa-world-cup.png')
embed.set_thumbnail(url='http://www.yordes.com/wp-content/uploads/edd/2017/09/world-cup-2018-logo-700x525.jpg')
embed.set_footer(text=f"last updated on {data['lastUpdated'].split('T')[0]} at {data['lastUpdated'].split('T')[1][:-1]} UTC")
for team in leagueTable_data['standings']['G']:
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
embed.add_field(name=f"{team['rank']}. {team['team']}" , value=f"Played: {team['playedGames']} Points: {team['points']} GF: {team['goals']} GA: {team['goalsAgainst']} GD: {team['goalDifference']}", inline=True)
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
await ctx.send(embed=embed)
elif args[0] in ['g','group','G','Group'] and args[1] in ['h','H']:
embed = discord.Embed(title='\u200b', description='**`Group H`**', color=await helpers.get_color())#, description='------------------------------------')
embed.set_author(name=data['caption'], icon_url='https://image.jimcdn.com/app/cms/image/transf/dimension=641x10000:format=png/path/s6d54c624f88c95ec/image/i34d2e10b38f67263/version/1490980233/fifa-world-cup.png')
embed.set_thumbnail(url='http://www.yordes.com/wp-content/uploads/edd/2017/09/world-cup-2018-logo-700x525.jpg')
embed.set_footer(text=f"last updated on {data['lastUpdated'].split('T')[0]} at {data['lastUpdated'].split('T')[1][:-1]} UTC")
for team in leagueTable_data['standings']['H']:
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
embed.add_field(name=f"{team['rank']}. {team['team']}" , value=f"Played: {team['playedGames']} Points: {team['points']} GF: {team['goals']} GA: {team['goalsAgainst']} GD: {team['goalDifference']}", inline=True)
embed.add_field(value='_ _', name='---------------------------------------------------------', inline=True)
await ctx.send(embed=embed)
@commands.command(aliases=['get_channel_list()'])
async def channel_list(self, ctx):
"Get list of channels in guild with their id's"
channels = ctx.guild.channels
for channel in channels:
embed = discord.Embed(description=f'**Channel Name :** *__{channel.name}__*\n **Channel Id:** *__{channel.id}__*', color=await helpers.get_color())
await ctx.send(embed=embed)
#purge bots last n messages
@commands.command(aliases=['purge'], is_owner=True)
async def delete_messages(self, ctx, n:int):
def is_bot(m):
return m.author == ctx.bot.user
deleted = await ctx.channel.purge(limit=n, check=is_bot, bulk=False)
await ctx.channel.send(f'Deleted {len(deleted)} messages.')
@commands.command(aliases=['get_all_emotes()'], is_owner=True)
async def all_emotes(self, ctx):
emojis = ctx.guild.emojis
for emoji in emojis:
if emoji.animated:
description = f'<a:{emoji.name}:{emoji.id}>\n```ini\nEmoji name : [{emoji.name}]\nEmoji id : [<a:{emoji.name}:{emoji.id}>]```'
else:
description = f'<:{emoji.name}:{emoji.id}>\n```ini\nEmoji name : [{emoji.name}]\nEmoji id : [<:{emoji.name}:{emoji.id}>]```'
embed = discord.Embed(description=description, color=await helpers.get_color())
await ctx.send(embed=embed)
def setup(bot):
bot.add_cog(Soccer()) | 78.173913 | 325 | 0.555308 | 1,874 | 16,182 | 4.697439 | 0.126467 | 0.027263 | 0.044303 | 0.04294 | 0.780075 | 0.758605 | 0.735999 | 0.685675 | 0.680791 | 0.673293 | 0 | 0.046422 | 0.198616 | 16,182 | 207 | 326 | 78.173913 | 0.632403 | 0.049314 | 0 | 0.425806 | 0 | 0.251613 | 0.461808 | 0.166325 | 0 | 0 | 0 | 0 | 0 | 1 | 0.012903 | false | 0 | 0.032258 | 0.006452 | 0.058065 | 0.012903 | 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 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
ae4a4d2fd7d883128d0d12aa57d9c92254576d9d | 84 | py | Python | python/testData/multipleArgumentsCompletion/argumentParameter.py | 06needhamt/intellij-community | 63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b | [
"Apache-2.0"
] | null | null | null | python/testData/multipleArgumentsCompletion/argumentParameter.py | 06needhamt/intellij-community | 63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b | [
"Apache-2.0"
] | null | null | null | python/testData/multipleArgumentsCompletion/argumentParameter.py | 06needhamt/intellij-community | 63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b | [
"Apache-2.0"
] | null | null | null | def foo(bar, baz):
pass
def main(bar):
for baz in []:
foo(<caret>) | 12 | 20 | 0.5 | 13 | 84 | 3.230769 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 84 | 7 | 20 | 12 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.2 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
ae4e03a1f7e5ebf0121918400fe30160046b8ba1 | 90 | py | Python | celery_task/__init__.py | lishulong16/mokitou | 96c5af6f86b2786ffda203f023b4a5f11015853f | [
"MIT"
] | 1 | 2018-04-25T01:32:15.000Z | 2018-04-25T01:32:15.000Z | celery_task/__init__.py | lishulong16/mokitou | 96c5af6f86b2786ffda203f023b4a5f11015853f | [
"MIT"
] | null | null | null | celery_task/__init__.py | lishulong16/mokitou | 96c5af6f86b2786ffda203f023b4a5f11015853f | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
@contact: lishulong.never@gmail.com
@time: 2018/4/2 下午7:18
""" | 18 | 35 | 0.6 | 14 | 90 | 3.857143 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126582 | 0.122222 | 90 | 5 | 36 | 18 | 0.556962 | 0.9 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
ae610686aab958b1b4293bb8a0f36476117eaa08 | 172 | py | Python | python/Chapter-3/09_pr_05.py | sparshanurag/Python-Development | 19d58b47d507f30544d304277e2460af1023aeb1 | [
"MIT"
] | null | null | null | python/Chapter-3/09_pr_05.py | sparshanurag/Python-Development | 19d58b47d507f30544d304277e2460af1023aeb1 | [
"MIT"
] | null | null | null | python/Chapter-3/09_pr_05.py | sparshanurag/Python-Development | 19d58b47d507f30544d304277e2460af1023aeb1 | [
"MIT"
] | null | null | null | letter = "Dear Sparsh, This Python course in nice! Thanks!"
print(letter)
formatted_letter = "Dear Sparsh,\n\tThis Python course is nice!\nThanks!"
print(formatted_letter) | 34.4 | 73 | 0.773256 | 25 | 172 | 5.24 | 0.6 | 0.152672 | 0.244275 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116279 | 172 | 5 | 74 | 34.4 | 0.861842 | 0 | 0 | 0 | 0 | 0 | 0.578035 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
ae64efa8c35c253714b385b47a74c5c1fb762d45 | 3,509 | py | Python | tests/test_marker.py | tnahs/anki-marker | c458c1a43964faa6572334ea8606f17ec7d1c056 | [
"MIT"
] | null | null | null | tests/test_marker.py | tnahs/anki-marker | c458c1a43964faa6572334ea8606f17ec7d1c056 | [
"MIT"
] | 1 | 2021-07-03T18:49:10.000Z | 2021-07-03T18:49:10.000Z | tests/test_marker.py | tnahs/anki-marker | c458c1a43964faa6572334ea8606f17ec7d1c056 | [
"MIT"
] | null | null | null | import pytest
from addon.src.helpers import InvalidMarkup, Key
from addon.src.marker import Marker
def test__valid_basic(marker: Marker) -> None:
marked = " *Style0* **Style1** ~Style2~ ~~Style3~~ "
unmarked = " Style0 Style1 Style2 Style3 "
rendered = (
f' <{Key.MARKER} class="parent-style style0">Style0</{Key.MARKER}>'
f' <{Key.MARKER} class="parent-style style1">Style1</{Key.MARKER}>'
f' <{Key.MARKER} class="parent-style style2">Style2</{Key.MARKER}>'
f' <{Key.MARKER} class="parent-style style3">Style3</{Key.MARKER}>'
f" "
)
assert rendered == marker.render(string=marked)
assert unmarked == marker.unmark(string=marked)
def test__valid_with_tags(marker: Marker) -> None:
marked = " *ABC* <div><p><strong>ABC</strong></p></div> *ABC* "
unmarked = " ABC <div><p><strong>ABC</strong></p></div> ABC "
rendered = (
f' <{Key.MARKER} class="parent-style style0">ABC</{Key.MARKER}>'
f" <div><p><strong>ABC</strong></p></div>"
f' <{Key.MARKER} class="parent-style style0">ABC</{Key.MARKER}>'
f" "
)
assert rendered == marker.render(string=marked)
assert unmarked == marker.unmark(string=marked)
def test__valid_with_entities(marker: Marker) -> None:
marked = " *ABC* *&* *&* *&* *ABC* "
unmarked = " ABC & & & ABC "
rendered = (
f' <{Key.MARKER} class="parent-style style0">ABC</{Key.MARKER}>'
f' <{Key.MARKER} class="parent-style style0">&</{Key.MARKER}>'
f' <{Key.MARKER} class="parent-style style0">&</{Key.MARKER}>'
f' <{Key.MARKER} class="parent-style style0">&</{Key.MARKER}>'
f' <{Key.MARKER} class="parent-style style0">ABC</{Key.MARKER}>'
f" "
)
assert rendered == marker.render(string=marked)
assert unmarked == marker.unmark(string=marked)
def test__valid_with_linebreak(marker: Marker) -> None:
marked = " *ABC*\n*ABC* "
unmarked = " ABC\nABC "
rendered = (
f' <{Key.MARKER} class="parent-style style0">ABC</{Key.MARKER}>'
f'\n<{Key.MARKER} class="parent-style style0">ABC</{Key.MARKER}>'
f" "
)
assert rendered == marker.render(string=marked)
assert unmarked == marker.unmark(string=marked)
def test__valid_with_paragraph1(marker: Marker) -> None:
marked = " start <p>*ABC*</p> end "
unmarked = " start <p>ABC</p> end "
rendered = f' start <p><{Key.MARKER} class="parent-style style0">ABC</{Key.MARKER}></p> end '
assert rendered == marker.render(string=marked)
assert unmarked == marker.unmark(string=marked)
def test__valid_with_paragraph2(marker: Marker) -> None:
marked = "<p>ABC *ABC* ABC</p>"
unmarked = "<p>ABC ABC ABC</p>"
rendered = (
f'<p>ABC <{Key.MARKER} class="parent-style style0">ABC</{Key.MARKER}> ABC</p>'
)
assert rendered == marker.render(string=marked)
assert unmarked == marker.unmark(string=marked)
def test__invalid_with_linebreak(marker: Marker) -> None:
marked = " *ABC\nABC* "
with pytest.raises(InvalidMarkup):
marker.render(string=marked)
with pytest.raises(InvalidMarkup):
marker.unmark(string=marked)
def test__invalid_with_paragraph(marker: Marker) -> None:
marked = "<p>ABC *ABC ABC</p><p>ABC ABC* ABC</p>"
with pytest.raises(InvalidMarkup):
marker.render(string=marked)
with pytest.raises(InvalidMarkup):
marker.unmark(string=marked)
| 29.991453 | 97 | 0.623824 | 446 | 3,509 | 4.838565 | 0.109865 | 0.125116 | 0.097312 | 0.139018 | 0.822521 | 0.768304 | 0.768304 | 0.726135 | 0.645505 | 0.493049 | 0 | 0.014539 | 0.196352 | 3,509 | 116 | 98 | 30.25 | 0.750709 | 0 | 0 | 0.453333 | 0 | 0.04 | 0.400114 | 0.150185 | 0 | 0 | 0 | 0 | 0.16 | 1 | 0.106667 | false | 0 | 0.04 | 0 | 0.146667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
ae79882c76e83402ccdf45538dd99b843eaf1354 | 1,396 | py | Python | porridge/exceptions.py | thusoy/porridge | f332b67f29bcbc19b7bb7da2f68ad3af35a9cd4d | [
"MIT"
] | 13 | 2017-07-26T14:20:27.000Z | 2021-07-12T17:17:21.000Z | porridge/exceptions.py | thusoy/porridge | f332b67f29bcbc19b7bb7da2f68ad3af35a9cd4d | [
"MIT"
] | 1 | 2017-03-25T23:37:01.000Z | 2017-04-23T18:43:41.000Z | porridge/exceptions.py | thusoy/porridge | f332b67f29bcbc19b7bb7da2f68ad3af35a9cd4d | [
"MIT"
] | 1 | 2018-08-02T07:48:40.000Z | 2018-08-02T07:48:40.000Z | """
Porridge raises two kinds of exceptions, some you can catch and some you
shouldn't try to catch. Operational errors (PorridgeError) can happen
during normal operation (out of memory under high load, can't spawn more
threads) can be caught, because if this happens you might ask the user to
retry, or spin up more servers, or delegate the operation to another server.
The other set of errors are usage errors, which shouldn't be attempted caught,
since there's nothing you can do to recover apart from fixing your code. Thus
these should crash your app to ensure they are caught by monitoring and are
super loud.
"""
class PorridgeError(Exception):
"""
Superclass of all porridge exceptions you should try to catch.
"""
class MissingKeyError(KeyError):
"""
Raised if trying to verify a password boiled with a key we don't have.
The missing key id is in ``args[0]``.
"""
class ParameterError(ValueError):
"""
Raised if the Porridge constructor is called with an invalid combination of
parameters.
This is raised at construction time instead of at boiling time to ensure
fail-fast behavior.
"""
class EncodedPasswordError(ValueError):
"""
Raised if :meth:`verify` is given a boiled password that's either on an
invalid format or has parameter significantly greater than what we're
currently configured with.
"""
| 31.022222 | 79 | 0.734957 | 210 | 1,396 | 4.885714 | 0.62381 | 0.023392 | 0.019493 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.000903 | 0.20702 | 1,396 | 44 | 80 | 31.727273 | 0.925926 | 0.813754 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.25 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 4 |
ae7fe0000783ce202cd2e8925ff350d8a63ba7e7 | 1,181 | py | Python | thinc/neural/_classes/weights.py | EnjoyLifeFund/py36pkgs | 0ac677fbbfa7b6d8c527fe2c759ba05117b07fd2 | [
"MIT",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | thinc/neural/_classes/weights.py | EnjoyLifeFund/py36pkgs | 0ac677fbbfa7b6d8c527fe2c759ba05117b07fd2 | [
"MIT",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | thinc/neural/_classes/weights.py | EnjoyLifeFund/py36pkgs | 0ac677fbbfa7b6d8c527fe2c759ba05117b07fd2 | [
"MIT",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | def affine():
pass
def backprop_affine():
pass
def reshape():
pass
def Linear(allocate, nO, nI, nP):
(W, b), (dW, db) = allocate((nO, nI), (nO,), dtype='f', gradient=True)
def linear_forward(X, out=None):
Y = out or allocate('f', (X.shape[0], nO))
def linear_backward(dY, out=None):
dY = out or allocate('f', (dX.shape[0], nI))
backprop_affine(dX,
dW, db, dY, X)
return dX
affine(Y,
W, b, X)
return Y, linear_backward
return Model(linear_forward)
def Linear3d(allocate, nI, nO, nP):
(W, b), (dW, db) = allocate((nO * nP, nI), (nO * nP,), dtype='f', gradient=True)
def linear_forward(X, out=None):
Y = out or allocate('f', (X.shape[0], nO * nP))
def linear_backward(dY, out=None):
dY = reshape(dY, (dY.shape[0], nO, nP))
dX = out or allocate('f', (dX.shape[0], nI))
backprop_affine(dX,
dW, db, dY, X)
return dX
affine(Y,
W, b, X)
Y = reshape(Y, (Y.shape[0], nO, nP))
return Y, linear_backward
return Model(linear_forward)
| 25.12766 | 84 | 0.511431 | 169 | 1,181 | 3.508876 | 0.189349 | 0.060708 | 0.08769 | 0.094435 | 0.748735 | 0.748735 | 0.748735 | 0.593592 | 0.441821 | 0.441821 | 0 | 0.008838 | 0.329382 | 1,181 | 46 | 85 | 25.673913 | 0.739899 | 0 | 0 | 0.617647 | 0 | 0 | 0.00508 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.264706 | false | 0.088235 | 0 | 0 | 0.441176 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
ae9ea1b9593fb010fae9cdd57b5f460ed1fb015f | 682 | py | Python | appendix/torch_nsolt/__init__.py | msiplab/SaivDr | 7015dea02e955c71337db6e7b29bb8c35294fa0e | [
"BSD-2-Clause"
] | 7 | 2018-11-26T08:49:24.000Z | 2021-09-15T08:46:35.000Z | appendix/torch_nsolt/__init__.py | msiplab/SaivDr | 7015dea02e955c71337db6e7b29bb8c35294fa0e | [
"BSD-2-Clause"
] | 11 | 2019-12-02T11:20:18.000Z | 2022-02-14T05:17:11.000Z | appendix/torch_nsolt/__init__.py | msiplab/SaivDr | 7015dea02e955c71337db6e7b29bb8c35294fa0e | [
"BSD-2-Clause"
] | 7 | 2019-06-05T07:45:20.000Z | 2021-09-15T08:46:36.000Z | __all__ = [
'nsoltAnalysis2dNetwork',
'nsoltAtomExtension2dLayer',
'nsoltBlockDct2dLayer',
'nsoltBlockDct3dLayer',
'nsoltBlockIdct2dLayer',
'nsoltBlockIdct3dLayer',
'nsoltChannelConcatenation2dLayer',
'nsoltChannelSeparation2dLayer',
'nsoltFinalRotation2dLayer',
'nsoltInitialRotation2dLayer',
'nsoltIntermediateRotation2dLayer',
'nsoltLayerExceptions',
'nsoltSubbandDeserialization2dLayer',
'nsoltSubbandSerialization2dLayer',
'nsoltSynthesis2dNetwork',
'nsoltUtility',
'orthonormalTransform'
]
from nsoltAnalysis2dNetwork import NsoltAnalysis2dNetwork
from nsoltSynthesis2dNetwork import NsoltSynthesis2dNetwork
| 31 | 59 | 0.780059 | 26 | 682 | 20.307692 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030769 | 0.142229 | 682 | 21 | 60 | 32.47619 | 0.871795 | 0 | 0 | 0 | 0 | 0 | 0.608504 | 0.473607 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.095238 | 0 | 0.095238 | 0 | 1 | 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 | 4 |
8848526fdc629ab66f4807af0db61d45b353cd55 | 353 | py | Python | src/CGPython/Commands/CreateMethodCommand.py | BlackBeard98/Code-Generation | 769ef8fd9162c0fae6326dc9d08e20bb5d20c067 | [
"MIT"
] | 1 | 2021-11-03T01:24:21.000Z | 2021-11-03T01:24:21.000Z | src/CGPython/Commands/CreateMethodCommand.py | BlackBeard98/Code-Generation | 769ef8fd9162c0fae6326dc9d08e20bb5d20c067 | [
"MIT"
] | null | null | null | src/CGPython/Commands/CreateMethodCommand.py | BlackBeard98/Code-Generation | 769ef8fd9162c0fae6326dc9d08e20bb5d20c067 | [
"MIT"
] | null | null | null | import sys
sys.path.append("..")
from ..Modifiers import WithName,DecoratedBy,WithBody,Append,WithArg
from CodeGenerationCore import Command
from .utils import CommandOn , ABCWithSTMTBody
@CommandOn(ABCWithSTMTBody)
class CreateMethodCommand(Command,WithName.WithName,DecoratedBy.DecoratedBy,WithBody.WithBody,Append.Append,WithArg.WithArg):
pass
| 32.090909 | 125 | 0.832861 | 38 | 353 | 7.736842 | 0.473684 | 0.129252 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076487 | 353 | 10 | 126 | 35.3 | 0.90184 | 0 | 0 | 0 | 0 | 0 | 0.005682 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.125 | 0.5 | 0 | 0.625 | 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 | 1 | 1 | 0 | 1 | 0 | 0 | 4 |
8881ee670315d3c1f424bb08612e7e7c046129fa | 207 | py | Python | game/story/elements/terrain/cave.py | slalom/slaloms-and-dragons | 3ae6a6ec3feb188d767983ab9277668baab18533 | [
"MIT"
] | 7 | 2019-03-28T15:56:21.000Z | 2021-11-08T09:02:05.000Z | game/story/elements/terrain/cave.py | slalom/slaloms-and-dragons | 3ae6a6ec3feb188d767983ab9277668baab18533 | [
"MIT"
] | 2 | 2019-05-16T02:00:22.000Z | 2021-06-08T19:49:46.000Z | game/story/elements/terrain/cave.py | slalom/slaloms-and-dragons | 3ae6a6ec3feb188d767983ab9277668baab18533 | [
"MIT"
] | 4 | 2019-04-02T17:49:30.000Z | 2019-04-04T00:38:54.000Z | def build():
return {
"type": "cave",
"cave": {
"greeting": "You have arrived at the deepest darkest cave, DEATH cave. Will you enter?"
},
"view": "🕳 ",
}
| 23 | 99 | 0.463768 | 22 | 207 | 4.409091 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.381643 | 207 | 8 | 100 | 25.875 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0.478261 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | true | 0 | 0 | 0.125 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 4 |
889b63e4cbf42d7b68b36d2d6da1f4e392611880 | 1,850 | py | Python | Ranmath/MatrixSamplers/MatrixSamplerAdapter.py | pawel-ta/ranmath | f52a15b10bdb5830a50c43da11fed5f182026587 | [
"MIT"
] | null | null | null | Ranmath/MatrixSamplers/MatrixSamplerAdapter.py | pawel-ta/ranmath | f52a15b10bdb5830a50c43da11fed5f182026587 | [
"MIT"
] | null | null | null | Ranmath/MatrixSamplers/MatrixSamplerAdapter.py | pawel-ta/ranmath | f52a15b10bdb5830a50c43da11fed5f182026587 | [
"MIT"
] | null | null | null |
from .RollingWindowSampler import RollingWindowSampler
from .GlobalSampler import GlobalSampler
from weakref import ReferenceType
class MatrixSamplerAdapter:
def __init__(self, matrix_reference: ReferenceType):
self.matrix_reference = matrix_reference
def rw_autocorrelation_eigenvalues(self, sample_size: int, out_of_sample_size: int, verbose=False):
sampler = RollingWindowSampler(sample_size, out_of_sample_size)
return sampler.autocorrelation_eigenvalues(self.matrix_reference(), verbose=verbose)
def rw_autocorrelation_eigenvectors(self, sample_size: int, out_of_sample_size: int, verbose=False):
sampler = RollingWindowSampler(sample_size, out_of_sample_size)
return sampler.autocorrelation_eigenvectors(self.matrix_reference(), verbose=verbose)
def rw_sample_estimator_cubes(self, sample_size: int, out_of_sample_size: int, verbose=False):
sampler = RollingWindowSampler(sample_size, out_of_sample_size)
return sampler.sample_estimator_cubes(self.matrix_reference(), verbose=verbose)
def rw_data_cubes(self, sample_size: int, out_of_sample_size: int, verbose=False):
sampler = RollingWindowSampler(sample_size, out_of_sample_size)
return sampler.data_cubes(self.matrix_reference(), verbose=verbose)
def global_eigenvalues(self, verbose=False):
sampler = GlobalSampler()
return sampler.autocorrelation_eigenvalues(self.matrix_reference(), verbose=verbose)
def global_eigenvectors(self, verbose=False):
sampler = GlobalSampler()
return sampler.autocorrelation_eigenvectors(self.matrix_reference(), verbose=verbose)
def global_sample_estimator_cube(self, verbose=False):
sampler = GlobalSampler()
return sampler.sample_estimator_cube(self.matrix_reference(), verbose=verbose) | 40.217391 | 104 | 0.775135 | 209 | 1,850 | 6.5311 | 0.148325 | 0.117216 | 0.125275 | 0.087912 | 0.728205 | 0.704029 | 0.704029 | 0.590476 | 0.537729 | 0.537729 | 0 | 0 | 0.148108 | 1,850 | 46 | 105 | 40.217391 | 0.866117 | 0 | 0 | 0.407407 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.296296 | false | 0 | 0.111111 | 0 | 0.703704 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
88a53801c03c8ec2d272b1c6ac6be0378b6717e2 | 88 | py | Python | source_dir/qonic_misc/__init__.py | Qonic-Team/qonic-misc | 03154781df6a35e4689b57052e579beb9990626a | [
"Apache-2.0"
] | 1 | 2022-01-26T18:41:01.000Z | 2022-01-26T18:41:01.000Z | source_dir/qonic_misc/__init__.py | Qonic-Team/qonic-misc | 03154781df6a35e4689b57052e579beb9990626a | [
"Apache-2.0"
] | null | null | null | source_dir/qonic_misc/__init__.py | Qonic-Team/qonic-misc | 03154781df6a35e4689b57052e579beb9990626a | [
"Apache-2.0"
] | 1 | 2022-01-26T18:41:15.000Z | 2022-01-26T18:41:15.000Z | from .RotationConversions import *
from .OperatorChecker import *
__version__ = '0.0.8'
| 22 | 34 | 0.772727 | 10 | 88 | 6.4 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038961 | 0.125 | 88 | 3 | 35 | 29.333333 | 0.792208 | 0 | 0 | 0 | 0 | 0 | 0.056818 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
31f2e025d3e82b0936c97e4d8271591fc6bca8a5 | 59 | py | Python | swiper/__init__.py | Ei-mago/pro_community | 291f8a4543223696f05163e16303915ff4a8eb9c | [
"MIT"
] | null | null | null | swiper/__init__.py | Ei-mago/pro_community | 291f8a4543223696f05163e16303915ff4a8eb9c | [
"MIT"
] | null | null | null | swiper/__init__.py | Ei-mago/pro_community | 291f8a4543223696f05163e16303915ff4a8eb9c | [
"MIT"
] | null | null | null | import pymysql
#伪装成mysqldb
pymysql.install_as_MySQLdb() | 14.75 | 28 | 0.813559 | 7 | 59 | 6.571429 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.118644 | 59 | 4 | 28 | 14.75 | 0.884615 | 0.169492 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
31fa327faa46cf2025c0c3b119288056c09d0b32 | 279 | py | Python | math/0x00-linear_algebra/7-gettin_cozy.py | kyeeh/holbertonschool-machine_learning | 8e4894c2b036ec7f4750de5bf99b95aee5b94449 | [
"MIT"
] | null | null | null | math/0x00-linear_algebra/7-gettin_cozy.py | kyeeh/holbertonschool-machine_learning | 8e4894c2b036ec7f4750de5bf99b95aee5b94449 | [
"MIT"
] | null | null | null | math/0x00-linear_algebra/7-gettin_cozy.py | kyeeh/holbertonschool-machine_learning | 8e4894c2b036ec7f4750de5bf99b95aee5b94449 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""
Module with function to concatenates two matrices along a specific axis:
"""
def cat_matrices2D(mat1, mat2, axis=0):
"""
Function to concatenates two matrices along a specific axis:
Returns the a new matrix
"""
return mat1 + mat2
| 21.461538 | 72 | 0.688172 | 39 | 279 | 4.897436 | 0.666667 | 0.104712 | 0.230366 | 0.26178 | 0.534031 | 0.534031 | 0.534031 | 0.534031 | 0.534031 | 0 | 0 | 0.03211 | 0.218638 | 279 | 12 | 73 | 23.25 | 0.844037 | 0.645161 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
ee03aef6d8301deb73ab1e5ecf01d30390bfdc3e | 6,715 | py | Python | src/gui/layers_menu/pooling_layers.py | jeremiahws/DLAE | 5005d1c275279cc283c59f226732f073cf340a52 | [
"Apache-2.0"
] | 2 | 2021-05-25T12:23:23.000Z | 2021-06-20T11:40:40.000Z | src/gui/layers_menu/pooling_layers.py | jeremiahws/DLAE | 5005d1c275279cc283c59f226732f073cf340a52 | [
"Apache-2.0"
] | null | null | null | src/gui/layers_menu/pooling_layers.py | jeremiahws/DLAE | 5005d1c275279cc283c59f226732f073cf340a52 | [
"Apache-2.0"
] | 4 | 2019-10-16T07:52:41.000Z | 2021-11-20T17:28:25.000Z | # Copyright 2019 Jeremiah Sanders.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""src/gui/layers_menu/pooling_layers.py"""
import tkinter as tk
class PoolingLayers:
def __init__(self, controller):
self.controller = controller
self.button_heights = 1
self.button_widths = 15
self.label_heights = 1
self.label_widths = 15
self.entry_widths = 15
self.tl_pool_layers = tk.Toplevel()
self.tl_pool_layers.title('Pooling layers')
self.tl_pool_layers.resizable(width=False, height=False)
self.tl_pool_layers.wm_protocol('WM_DELETE_WINDOW', self.tl_pool_layers.withdraw)
self.b_max_pool_2D = tk.Button(self.tl_pool_layers, text='2D Maximum Pooling', command=self.b_2D_max_pool).grid(row=0, column=0, sticky=tk.N+tk.S+tk.E+tk.W)
self.b_max_pool_3D = tk.Button(self.tl_pool_layers, text='3D Maximum Pooling', command=self.b_3D_max_pool).grid(row=0, column=1, sticky=tk.N+tk.S+tk.E+tk.W)
self.b_avg_pool_2D = tk.Button(self.tl_pool_layers, text='2D Average Pooling', command=self.b_2D_avg_pool).grid(row=1, column=0, sticky=tk.N+tk.S+tk.E+tk.W)
self.b_avg_pool_3D = tk.Button(self.tl_pool_layers, text='3D Average Pooling', command=self.b_3D_avg_pool).grid(row=1, column=1, sticky=tk.N+tk.S+tk.E+tk.W)
self.b_global_max_pool_2D = tk.Button(self.tl_pool_layers, text='2D Global Maximum Pooling', command=self.b_2D_global_max_pool).grid(row=2, column=0, sticky=tk.N+tk.S+tk.E+tk.W)
self.b_global_max_pool_3D = tk.Button(self.tl_pool_layers, text='3D Global Maximum Pooling', command=self.b_3D_global_max_pool).grid(row=2, column=1, sticky=tk.N+tk.S+tk.E+tk.W)
self.b_global_avg_pool_2D = tk.Button(self.tl_pool_layers, text='2D Global Average Pooling', command=self.b_2D_global_avg_pool).grid(row=3, column=0, sticky=tk.N+tk.S+tk.E+tk.W)
self.b_global_avg_pool_3D = tk.Button(self.tl_pool_layers, text='3D Global Average Pooling', command=self.b_3D_global_avg_pool).grid(row=3, column=1, sticky=tk.N+tk.S+tk.E+tk.W)
self.l_pool_size = tk.Label(self.tl_pool_layers, text='Pooling size:').grid(row=0, column=2, sticky=tk.N+tk.S+tk.E+tk.W)
self.e_pool_size = tk.Entry(self.tl_pool_layers, textvariable=self.controller.layers_menu.s_pool_size).grid(row=0, column=3, sticky=tk.N+tk.S+tk.E+tk.W)
self.l_pool_stride = tk.Label(self.tl_pool_layers, text='Stride:').grid(row=1, column=2)
self.e_pool_stride = tk.Entry(self.tl_pool_layers, textvariable=self.controller.layers_menu.s_pool_stride).grid(row=1, column=3, sticky=tk.N+tk.S+tk.E+tk.W)
self.tl_pool_layers.withdraw()
def show(self):
self.tl_pool_layers.deiconify()
def b_2D_max_pool(self):
if any(self.controller.layers_list_box.get(0)) is False or self.controller.layers_list_box.get(0).split(':')[0] != 'Input':
self.controller.errors_list_box.insert(tk.END, 'Level2Error:FirstLayerMustBeInput')
else:
layer = ':'.join(['Max pooling 2D', self.controller.layers_menu.s_pool_size.get(), self.controller.layers_menu.s_pool_stride.get()])
self.controller.layers_list_box.insert(tk.END, layer)
def b_3D_max_pool(self):
if any(self.controller.layers_list_box.get(0)) is False or self.controller.layers_list_box.get(0).split(':')[0] != 'Input':
self.controller.errors_list_box.insert(tk.END, 'Level2Error:FirstLayerMustBeInput')
else:
layer = ':'.join(['Max pooling 3D', self.controller.layers_menu.s_pool_size.get(), self.controller.layers_menu.s_pool_stride.get()])
self.controller.layers_list_box.insert(tk.END, layer)
def b_2D_avg_pool(self):
if any(self.controller.layers_list_box.get(0)) is False or self.controller.layers_list_box.get(0).split(':')[0] != 'Input':
self.controller.errors_list_box.insert(tk.END, 'Level2Error:FirstLayerMustBeInput')
else:
layer = ':'.join(['Average pooling 2D', self.controller.layers_menu.s_pool_size.get(), self.controller.layers_menu.s_pool_stride.get()])
self.controller.layers_list_box.insert(tk.END, layer)
def b_3D_avg_pool(self):
if any(self.controller.layers_list_box.get(0)) is False or self.controller.layers_list_box.get(0).split(':')[0] != 'Input':
self.controller.errors_list_box.insert(tk.END, 'Level2Error:FirstLayerMustBeInput')
else:
layer = ':'.join(['Average pooling 3D', self.controller.layers_menu.s_pool_size.get(), self.controller.layers_menu.s_pool_stride.get()])
self.controller.layers_list_box.insert(tk.END, layer)
def b_2D_global_max_pool(self):
if any(self.controller.layers_list_box.get(0)) is False or self.controller.layers_list_box.get(0).split(':')[0] != 'Input':
self.controller.errors_list_box.insert(tk.END, 'Level2Error:FirstLayerMustBeInput')
else:
layer = 'Global max pooling 2D'
self.controller.layers_list_box.insert(tk.END, layer)
def b_3D_global_max_pool(self):
if any(self.controller.layers_list_box.get(0)) is False or self.controller.layers_list_box.get(0).split(':')[0] != 'Input':
self.controller.errors_list_box.insert(tk.END, 'Level2Error:FirstLayerMustBeInput')
else:
layer = 'Global max pooling 3D'
self.controller.layers_list_box.insert(tk.END, layer)
def b_2D_global_avg_pool(self):
if any(self.controller.layers_list_box.get(0)) is False or self.controller.layers_list_box.get(0).split(':')[0] != 'Input':
self.controller.errors_list_box.insert(tk.END, 'Level2Error:FirstLayerMustBeInput')
else:
layer = 'Global average pooling 2D'
self.controller.layers_list_box.insert(tk.END, layer)
def b_3D_global_avg_pool(self):
if any(self.controller.layers_list_box.get(0)) is False or self.controller.layers_list_box.get(0).split(':')[0] != 'Input':
self.controller.errors_list_box.insert(tk.END, 'Level2Error:FirstLayerMustBeInput')
else:
layer = 'Global average pooling 3D'
self.controller.layers_list_box.insert(tk.END, layer)
| 62.757009 | 185 | 0.705436 | 1,071 | 6,715 | 4.200747 | 0.127918 | 0.136919 | 0.151145 | 0.128028 | 0.804846 | 0.783063 | 0.719938 | 0.687042 | 0.687042 | 0.687042 | 0 | 0.019862 | 0.160238 | 6,715 | 106 | 186 | 63.349057 | 0.777975 | 0.08831 | 0 | 0.421053 | 0 | 0 | 0.113696 | 0.04325 | 0 | 0 | 0 | 0 | 0 | 1 | 0.131579 | false | 0 | 0.013158 | 0 | 0.157895 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
ee25fee7505d623e0bc2864f2b6ea033ddbb245d | 135 | py | Python | sheets/python/benchmark.py | zgmarx/cheatsheet | b29e43a55c5c0fae8763a855025d77a8f46e1208 | [
"MIT"
] | 1 | 2020-03-31T11:26:05.000Z | 2020-03-31T11:26:05.000Z | sheets/python/benchmark.py | zgmarx/cheatsheet | b29e43a55c5c0fae8763a855025d77a8f46e1208 | [
"MIT"
] | null | null | null | sheets/python/benchmark.py | zgmarx/cheatsheet | b29e43a55c5c0fae8763a855025d77a8f46e1208 | [
"MIT"
] | null | null | null | timeit.repeat(lambda: foo(x, y))
# timeit.repeat(stmt='pass', setup='pass', timer=<built-in function time>, repeat=3, number=1000000)
| 33.75 | 100 | 0.711111 | 21 | 135 | 4.571429 | 0.809524 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065041 | 0.088889 | 135 | 3 | 101 | 45 | 0.715447 | 0.725926 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
ee4361e44978a2888aee0913b7c4e21081abf594 | 162 | py | Python | codingbat.com/Warmup-2/string_match.py | ahmedelq/PythonicAlgorithms | ce10dbb6e1fd0ea5c922a932b0f920236aa411bf | [
"MIT"
] | null | null | null | codingbat.com/Warmup-2/string_match.py | ahmedelq/PythonicAlgorithms | ce10dbb6e1fd0ea5c922a932b0f920236aa411bf | [
"MIT"
] | null | null | null | codingbat.com/Warmup-2/string_match.py | ahmedelq/PythonicAlgorithms | ce10dbb6e1fd0ea5c922a932b0f920236aa411bf | [
"MIT"
] | null | null | null | def string_match(a, b):
two_splitter = lambda s: [s[i:i+2] for i in range(len(s) - 1)]
return sum(1 for x,y in zip(two_splitter(a),two_splitter(b)) if x == y) | 54 | 73 | 0.654321 | 37 | 162 | 2.756757 | 0.594595 | 0.323529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022222 | 0.166667 | 162 | 3 | 73 | 54 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
ee43e13472ad5d413583a7dd3fc767a84e4752d1 | 93 | py | Python | dwfsearch/apps.py | ADACS-Australia/SS19A-JCooke | 4b4a54f612a5322fd7b00e3603e3847319a04799 | [
"MIT"
] | null | null | null | dwfsearch/apps.py | ADACS-Australia/SS19A-JCooke | 4b4a54f612a5322fd7b00e3603e3847319a04799 | [
"MIT"
] | 6 | 2020-02-27T02:51:29.000Z | 2021-06-10T19:50:09.000Z | dwfsearch/apps.py | ADACS-Australia/SS19A-JCooke | 4b4a54f612a5322fd7b00e3603e3847319a04799 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class DwfsearchConfig(AppConfig):
name = 'dwfsearch'
| 15.5 | 33 | 0.763441 | 10 | 93 | 7.1 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16129 | 93 | 5 | 34 | 18.6 | 0.910256 | 0 | 0 | 0 | 0 | 0 | 0.096774 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
ee56c17169c52c1e54bf94b3b3d7223bbbe6ebbc | 40 | py | Python | test.py | Vassago55/SomeAlgorithm | 8c3b82472d7a1e2cc7cd211fdc593dc78526dfdf | [
"MIT"
] | null | null | null | test.py | Vassago55/SomeAlgorithm | 8c3b82472d7a1e2cc7cd211fdc593dc78526dfdf | [
"MIT"
] | null | null | null | test.py | Vassago55/SomeAlgorithm | 8c3b82472d7a1e2cc7cd211fdc593dc78526dfdf | [
"MIT"
] | null | null | null | for i in range(999, 0, -1):
print(i) | 20 | 27 | 0.55 | 9 | 40 | 2.444444 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 0.25 | 40 | 2 | 28 | 20 | 0.566667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
ee5c5c21032f536809fe80352e9a9e60805057e9 | 12,240 | py | Python | tests/unit/test_transform.py | transferwise/pipelinewise-transform-field | eeb40015aed62002541b665f6f3e5993f7c53550 | [
"Apache-2.0"
] | 12 | 2019-07-16T09:50:10.000Z | 2021-09-17T09:57:41.000Z | tests/unit/test_transform.py | transferwise/pipelinewise-transform-field | eeb40015aed62002541b665f6f3e5993f7c53550 | [
"Apache-2.0"
] | 17 | 2019-09-23T13:35:18.000Z | 2022-03-14T09:05:52.000Z | tests/unit/test_transform.py | transferwise/pipelinewise-transform-field | eeb40015aed62002541b665f6f3e5993f7c53550 | [
"Apache-2.0"
] | 7 | 2019-08-23T00:31:30.000Z | 2021-09-14T16:16:18.000Z | import unittest
import hashlib
from transform_field import transform
class TestTransform(unittest.TestCase):
"""
Unit Tests for the transform module
"""
def setUp(self) -> None:
self.config = {}
def test_set_null(self):
"""TEST SET-NULL transformation"""
self.assertEqual(
transform.do_transform({"col_1": "John"}, "col_1", "SET-NULL"),
None
)
def test_hash(self):
"""Test HASH transformation"""
self.assertEqual(
transform.do_transform({"col_1": "John"}, "col_1", "HASH"),
hashlib.sha256("John".encode('utf-8')).hexdigest()
)
def test_mask_date(self):
"""Test MASK-DATE transformation"""
self.assertEqual(
transform.do_transform({"col_1": "2019-05-21"}, "col_1", "MASK-DATE"),
"2019-01-01T00:00:00"
)
# Mask date should keep the time elements
self.assertEqual(
transform.do_transform({"col_1": "2019-05-21T13:34:11"}, "col_1", "MASK-DATE"),
"2019-01-01T13:34:11"
)
# Mask date should keep the time elements, date is invalid
self.assertEqual(
transform.do_transform({"col_1": "2019-05-21T13:34:99"}, "col_1", "MASK-DATE"),
"2019-05-21T13:34:99"
)
def test_mask_number(self):
"""Test MASK-NUMBER transformation"""
self.assertEqual(
transform.do_transform({"col_1": "1234567890"}, "col_1", "MASK-NUMBER"),
0
)
def test_mask_hidden(self):
"""Test MASK-HIDDEN transformation"""
self.assertEqual(
transform.do_transform({"col_1": "abakadabra123"}, "col_1", "MASK-HIDDEN"),
'hidden'
)
def test_mask_string_skip_ends_case1(self):
"""Test MASK-STRING-SKIP-ENDS transformation with n=3"""
self.assertEqual(
transform.do_transform({"col_1": "do!maskme!"}, "col_1", "MASK-STRING-SKIP-ENDS-3"),
'do!****me!'
)
def test_mask_string_skip_ends_case2(self):
"""Test MASK-STRING-SKIP-ENDS transformation with n=2"""
self.assertEqual(
transform.do_transform({"col_1": "nomask"}, "col_1", "MASK-STRING-SKIP-ENDS-2"),
'no**sk'
)
def test_mask_string_skip_ends_case3(self):
"""Test MASK-STRING-SKIP-ENDS transformation where string length equals to 2 * mask_length"""
self.assertEqual(
transform.do_transform({"col_1": "nomask"}, "col_1", "MASK-STRING-SKIP-ENDS-3"),
'******'
)
def test_mask_string_skip_ends_case4(self):
"""Test MASK-STRING-SKIP-ENDS transformation where string length less than 2 * mask_length"""
self.assertEqual(
transform.do_transform({"col_1": "shortmask"}, "col_1", "MASK-STRING-SKIP-ENDS-5"),
'*********'
)
def test_unknown_transformation_type(self):
"""Test not existing transformation type"""
# Should return the original value
self.assertEqual(
transform.do_transform({"col_1": "John"}, "col_1", "NOT-EXISTING-TRANSFORMATION-TYPE"),
"John"
)
def test_conditions(self):
"""Test conditional transformations"""
# Matching condition: Should transform to NULL
self.assertEqual(
transform.do_transform(
# Record:
{"col_1": "random value", "col_2": "passwordHash", "col_3": "lkj"},
# Column to transform:
"col_3",
# Transform method:
"SET-NULL",
# Conditions when to transform:
[
{'column': 'col_1', 'equals': "random value"},
{'column': 'col_2', 'equals': "passwordHash"},
]
),
# Expected output:
None
)
# Not matching condition: Should keep the original value
self.assertEqual(
transform.do_transform(
# Record:
{"col_1": "random value", "col_2": "id", "col_3": "123456789"},
# Column to transform:
"col_3",
# Transform method:
"SET-NULL",
# Conditions when to transform:
[
{'column': 'col_1', 'equals': "random value"},
{'column': 'col_2', 'equals': "passwordHash"},
]
),
# Expected output:
"123456789"
)
def test_transform_field_in_json_col(self):
"""Test transformation of a field in a json column with no conditions"""
expected_value = {'id': 1, 'info': {'last_name': 'hidden', 'first_name': 'John'}}
return_value = transform.do_transform(
# Record:
{
"col_1": "random value",
"col_2": "passwordHash",
"col_3": "lkj",
'col_4': {'id': 1, 'info': {'last_name': 'Smith', 'first_name': 'John'}}
},
# Column to transform:
"col_4",
# Transform method:
"MASK-HIDDEN",
# Conditions when to transform:
None,
['info/last_name']
)
self.assertDictEqual(expected_value, return_value)
def test_transform_field_in_json_col_with_conditions(self):
"""Test transformation of a field in a json column with conditions"""
expected_value = {'id': 1, 'info': {'last_name': 'hidden', 'first_name': 'John'}}
return_value = transform.do_transform(
# Record:
{
"col_1": "random value",
"col_2": "passwordHash",
"col_3": "lkj",
'col_4': {'id': 1, 'info': {'last_name': 'Smith', 'first_name': 'John'}}
},
# Column to transform:
"col_4",
# Transform method:
"MASK-HIDDEN",
# Conditions when to transform:
[
{'column': 'col_2', 'equals': "passwordHash"},
],
['info/last_name']
)
self.assertDictEqual(expected_value, return_value)
def test_transform_fields_in_json_col(self):
"""Test transformation of multiple fields in a json column with no conditions"""
expected_value = {'id': 1, 'info': {'last_name': 'hidden', 'first_name': 'hidden', 'age': 25}}
return_value = transform.do_transform(
# Record:
{
"col_1": "random value",
"col_2": "passwordHash",
"col_3": "lkj",
'col_4': {'id': 1, 'info': {'last_name': 'Smith', 'first_name': 'John', 'age': 25}}
},
# Column to transform:
"col_4",
# Transform method:
"MASK-HIDDEN",
# Conditions when to transform:
None,
['info/last_name', 'info/first_name']
)
self.assertDictEqual(expected_value, return_value)
def test_transform_col_with_condition_on_json_field(self):
"""Test transformation of a column with condition on a field in a json"""
record = {
"col_1": "random value",
"col_2": "passwordHash",
"col_3": "323df43983dfs",
'col_4': {'id': 1, 'info': {'last_name': 'Smith', 'first_name': 'John', 'phone': '6573930'}}
}
self.assertEqual(
'hidden',
transform.do_transform(
# Record:
record,
# Column to transform:
"col_3",
# Transform method:
"MASK-HIDDEN",
# Conditions when to transform:
[
{'column': 'col_4', 'field_path': 'info/last_name', 'equals': 'Smith'},
]
)
)
def test_transform_field_in_json_col_with_condition_on_field(self):
"""Test transformation of a field in a json column with condition on a field in json, condition will be met"""
record = {
"col_1": "random value",
"col_2": "passwordHash",
"col_3": "lkj",
'col_4': {'id': 1, 'info': {'last_name': 'Smith', 'first_name': 'John', 'phone': '6573930'}}
}
self.assertDictEqual(
{'id': 1, 'info': {'first_name': 'John', 'last_name': None, 'phone': '6573930'}},
transform.do_transform(
# Record:
record,
# Column to transform:
"col_4",
# Transform method:
"SET-NULL",
# Conditions when to transform:
[
{'column': 'col_4', 'field_path': 'info/phone', 'equals': '6573930'},
],
['info/last_name']
)
)
def test_transform_field_in_json_col_with_condition_on_field_2(self):
"""Test transformation of a field in a json column with condition on a field in json,
the condition will not be met"""
record = {
"col_1": "random value",
"col_2": "passwordHash",
"col_3": "lkj",
'col_4': {'id': 1, 'info': {'last_name': 'Smith', 'first_name': 'John', 'phone': '6573930'}}
}
# not transformed
self.assertEqual(
{'id': 1, 'info': {'last_name': 'Smith', 'first_name': 'John', 'phone': '6573930'}},
transform.do_transform(
# Record:
record,
# Column to transform:
"col_4",
# Transform method:
"SET-NULL",
# Conditions when to transform:
[
{'column': 'col_4', 'field_path': 'info/phone', 'regex_match': '.*6573955.*'},
],
['info/last_name']
)
)
def test_transform_multiple_conditions_all_success(self):
"""Test conditional transformation, all the conditions will be met and transformation should happen"""
record = {
"col_1": "random value",
"col_2": "passwordHash",
"col_3": "lkj",
'col_4': {'id': 1, 'info': {'last_name': 'Smith', 'first_name': 'John', 'phone': '6573930'}},
'col_5': '2021-11-30T16:40:07'
}
self.assertEqual(
'2021-01-01T16:40:07',
transform.do_transform(
# Record:
record,
# Column to transform:
"col_5",
# Transform method:
"MASK-DATE",
# Conditions when to transform:
[
{'column': 'col_4', 'field_path': 'info/last_name', 'equals': 'Smith'},
{'column': 'col_4', 'field_path': 'id', 'equals': 1},
{'column': 'col_3', 'regex_match': '.*lkj.*'},
]
)
)
def test_transform_multiple_conditions_one_fails(self):
"""Test conditional transformation, one of the conditions will not be met and transformation should not happen"""
record = {
"col_1": "random value",
"col_2": "passwordHash",
"col_3": "lkj",
'col_4': {'id': 1, 'info': {'last_name': 'Smith', 'first_name': 'John', 'phone': '6573930'}},
'col_5': '2021-11-30T16:40:07'
}
# not transformed
self.assertEqual(
'2021-11-30T16:40:07',
transform.do_transform(
# Record:
record,
# Column to transform:
"col_5",
# Transform method:
"MASK-DATE",
# Conditions when to transform:
[
{'column': 'col_4', 'field_path': 'info/last_name', 'equals': 'Smith'},
{'column': 'col_4', 'field_path': 'id', 'equals': 2},
{'column': 'col_3', 'regex_match': '.*lkj.*'},
]
)
)
| 34.382022 | 121 | 0.496078 | 1,228 | 12,240 | 4.736156 | 0.11645 | 0.024759 | 0.075653 | 0.062586 | 0.792297 | 0.762724 | 0.715612 | 0.677442 | 0.648212 | 0.616059 | 0 | 0.046413 | 0.364542 | 12,240 | 355 | 122 | 34.478873 | 0.701337 | 0.187582 | 0 | 0.504274 | 0 | 0 | 0.240385 | 0.012684 | 0 | 0 | 0 | 0 | 0.094017 | 1 | 0.08547 | false | 0.051282 | 0.012821 | 0 | 0.102564 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
ee8e32fc537177eaaa6e574b7f57377ab52d8240 | 8,920 | py | Python | bootstrap.py | 732jhy/cdstools | a1658ddc4b19cd227aff47e9e1a066f5466eb4ba | [
"MIT"
] | 4 | 2020-11-17T09:22:17.000Z | 2022-01-17T02:06:25.000Z | bootstrap.py | 732jhy/cdstools | a1658ddc4b19cd227aff47e9e1a066f5466eb4ba | [
"MIT"
] | 1 | 2021-02-08T14:29:47.000Z | 2021-02-08T14:29:47.000Z | bootstrap.py | 732jhy/cdstools | a1658ddc4b19cd227aff47e9e1a066f5466eb4ba | [
"MIT"
] | 2 | 2021-08-20T20:40:32.000Z | 2022-02-08T23:39:14.000Z | import numpy as np
import scipy.optimize as optim
import scipy.interpolate as polate
def CDS_bootstrap(cds_spreads, yield_curve, cds_tenor, yield_tenor, prem_per_year, R):
'''
Bootstraps a credit curve from CDS spreads of varying maturities. Returns the hazard
rate values and survival probabilities corresponding to the CDS maturities.
Args:
cds_spreads : vector of CDS spreads
yield_curve : vector of risk-free bond yields
cds_tenor : vector of maturities corresponding to the given CDS spreads
yield_tenor : vector of risk-free bond yield tenor matching yield_curve
prem_per_year : premiums paid per year on the CDS (i.e. annualy=1, semiannually=2, quarterly=4, monthly=12)
R : recovery rate
'''
# Checks
if len(cds_spreads) != len(cds_tenor):
print("CDS spread array does match CDS tenor array.")
return None
if len(yield_curve) != len(yield_tenor):
print("Yield curve array does not match yield tenor.")
return None
# Interpolation/Extrapolation function
interp = polate.interp1d(yield_tenor, yield_curve,'linear', fill_value='extrapolate')
# The bootstrap function
def bootstrap(h, given_haz, s, cds_tenor, yield_curve, prem_per_year, R):
'''
Returns the difference between values of payment leg and default leg.
'''
a = 1/prem_per_year
maturities = [0] + list(cds_tenor)
pmnt = 0; dflt = 0; auc = 0
# 1. Calculate value of payments for given hazard rate curve values
for i in range(1, len(maturities)-1):
num_points = int((maturities[i]-maturities[i-1])*prem_per_year + 1)
t = np.linspace(maturities[i-1], maturities[i], num_points)
r = interp(t)
for j in range(1, len(t)):
surv_prob_prev = np.exp(-given_haz[i-1]*(t[j-1]-t[0]) - auc)
surv_prob_curr = np.exp(-given_haz[i-1]*(t[j]-t[0]) - auc)
pmnt += s*a*np.exp(-r[j]*t[j])*0.5*(surv_prob_prev + surv_prob_curr)
dflt += np.exp(-r[j]*t[j])*(1-R)*(surv_prob_prev - surv_prob_curr)
auc += (t[-1] - t[0])*given_haz[i-1]
# 2. Set up calculations for payments with the unknown hazard rate value
num_points = int((maturities[-1]-maturities[-2])*prem_per_year + 1)
t = np.linspace(maturities[-2], maturities[-1], num_points)
r = interp(t)
for i in range(1, len(t)):
surv_prob_prev = np.exp(-h*(t[i-1]-t[0]) - auc)
surv_prob_curr = np.exp(-h*(t[i]-t[0]) - auc)
pmnt += s*a*np.exp(-r[i]*t[i])*0.5*(surv_prob_prev + surv_prob_curr)
dflt += np.exp(-r[i]*t[i])*(1-R)*(surv_prob_prev - surv_prob_curr)
return abs(pmnt-dflt)
haz_rates = []
surv_prob = []
t = [0] + list(cds_tenor)
for i in range(len(cds_spreads)):
get_haz = lambda x: bootstrap(x, haz_rates, cds_spreads[i], cds_tenor[0:i+1], yield_curve[0:i+1], prem_per_year, R)
haz = round(optim.minimize(get_haz, cds_spreads[i]/(1-R), method='SLSQP', tol = 1e-10).x[0],8)
cond_surv = (t[i+1]-t[i])*haz
haz_rates.append(haz)
surv_prob.append(cond_surv)
return haz_rates, np.exp(-np.cumsum(surv_prob))
def CDS_spread(credit_curve, yield_curve, credit_curve_tenor, yield_tenor, prem_per_year, R, maturity):
'''
Returns the spread of a CDS using a yield curve and credit curve
Args:
credit_curve : vector of hazard rates that correspond to CDSs of different maturities
yield_curve : vector of yields for risk-free bonds
credit_curve_tenor : vector of maturities for CDS contracts corresponding to credit_curve
yield_tenor : vector of risk-free bond yield maturities corresponding to yield_curve
prem_per_year : number of premiums paid per year (i.e. annually=1, semiannually=2, quarterly=4, monthly=12)
R : recovery rate
maturity : desired CDS maturity
'''
# Checks
if len(yield_curve) != len(yield_tenor):
print('Yield curve does not match the yield tenor')
return None
if len(credit_curve) != len(credit_curve_tenor):
print('Credit curve does not match the credit curve tenor')
return None
# I. Get survival probabilities and default probabilities using hazard rate curve
a = 1/prem_per_year
num_points = int(credit_curve_tenor[-1]/a + 1)
t = np.linspace(0, credit_curve_tenor[-1], num_points)
h = []
index = 0; t_index = credit_curve_tenor[index]
for i in range(len(t)):
if t[i] <= t_index:
h.append(credit_curve[index])
else:
index += 1
t_index = credit_curve_tenor[index]
h.append(credit_curve[index])
surv_prob = [1.0]
for i in range(1,len(t)):
surv_prob.append(a*h[i])
surv_prob = np.exp(-np.cumsum(surv_prob))
default_prob = np.asarray([0] + list(-np.diff(surv_prob)))
# II. Interpolate/Extrapolate yield curve values corresponding to payment times and default times
interp = polate.interp1d(yield_tenor, yield_curve, 'linear',fill_value='extrapolate')
pay_periods = np.linspace(0, credit_curve_tenor[-1], num_points)
mid_periods = np.linspace(a/2, credit_curve_tenor[-1]-a/2, num_points-1)
yield1 = interp(pay_periods)
yield2 = interp(mid_periods)
# III. Solve
PV_pmnt = [np.exp(-yield1[i]*pay_periods[i])*surv_prob[i] for i in range(1,len(pay_periods))] #This works
PV_payoff = [(1-R)*default_prob[i+1]*np.exp(-yield2[i]*mid_periods[i]) for i in range(len(mid_periods))]
PV_accrual = [np.exp(-yield2[i]*mid_periods[i])*0.5*a*default_prob[i+1] for i in range(len(mid_periods))]
return sum(PV_payoff)/(sum(PV_pmnt) + sum(PV_accrual))
def binary_CDS_spread(credit_curve, yield_curve, credit_curve_tenor, yield_tenor, prem_per_year, default_payout, maturity):
'''
Returns the spread of a binary CDS using a yield curve and credit curve
Args:
credit_curve : vector of hazard rates that correspond to CDSs of different maturities
yield_curve : vector of yields for risk-free bonds
credit_curve_tenor : vector of maturities for CDS contracts corresponding to credit_curve
yield_tenor : vector of risk-free bond yield maturities corresponding to yield_curve
prem_per_year : number of premiums paid per year (i.e. annually=1, semiannually=2, quarterly=4, monthly=12)
default_payout : amount paid in the event of a default as % of principal
maturity : desired CDS maturity
'''
# Checks
if len(yield_curve) != len(yield_tenor):
print('Yield curve does not match the yield tenor')
return None
if len(credit_curve) != len(credit_curve_tenor):
print('Credit curve does not match the credit curve tenor')
return None
# I. Get survival probabilities and default probabilities using hazard rate curve
a = 1/prem_per_year
num_points = int(credit_curve_tenor[-1]/a + 1)
t = np.linspace(0, credit_curve_tenor[-1], num_points)
h = []
index = 0; t_index = credit_curve_tenor[index]
for i in range(len(t)):
if t[i] <= t_index:
h.append(credit_curve[index])
else:
index += 1
t_index = credit_curve_tenor[index]
h.append(credit_curve[index])
surv_prob = [1.0]
for i in range(1,len(t)):
surv_prob.append(a*h[i])
surv_prob = np.exp(-np.cumsum(surv_prob))
default_prob = np.asarray([0] + list(-np.diff(surv_prob)))
# II. Interpolate/Extrapolate yield curve values corresponding to payment times and default times
interp = polate.interp1d(yield_tenor, yield_curve, 'linear',fill_value='extrapolate')
pay_periods = np.linspace(0, credit_curve_tenor[-1], num_points)
mid_periods = np.linspace(a/2, credit_curve_tenor[-1]-a/2, num_points-1)
yield1 = interp(pay_periods)
yield2 = interp(mid_periods)
# III. Solve
PV_pmnt = [np.exp(-yield1[i]*pay_periods[i])*surv_prob[i] for i in range(1,len(pay_periods))]
PV_payoff = [default_payout*default_prob[i+1]*np.exp(-yield2[i]*mid_periods[i]) for i in range(len(mid_periods))]
PV_accrual = [np.exp(-yield2[i]*mid_periods[i])*0.5*a*default_prob[i+1] for i in range(len(mid_periods))]
return sum(PV_payoff)/(sum(PV_pmnt) + sum(PV_accrual))
| 44.158416 | 124 | 0.620628 | 1,307 | 8,920 | 4.057383 | 0.126243 | 0.076749 | 0.060343 | 0.026966 | 0.752404 | 0.731661 | 0.70545 | 0.70017 | 0.666792 | 0.650952 | 0 | 0.01859 | 0.270291 | 8,920 | 201 | 125 | 44.378109 | 0.796128 | 0.279596 | 0 | 0.636364 | 0 | 0 | 0.054416 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.036364 | false | 0 | 0.027273 | 0 | 0.154545 | 0.054545 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
c9f4f20fbc04980252d55cf794363509776cbe3e | 187 | py | Python | blogproject/blogapp/admin.py | recall704/django-r3call-blog | 9ba915af0087b31d98f8e51b341d71ff3a3e4555 | [
"Apache-2.0"
] | null | null | null | blogproject/blogapp/admin.py | recall704/django-r3call-blog | 9ba915af0087b31d98f8e51b341d71ff3a3e4555 | [
"Apache-2.0"
] | null | null | null | blogproject/blogapp/admin.py | recall704/django-r3call-blog | 9ba915af0087b31d98f8e51b341d71ff3a3e4555 | [
"Apache-2.0"
] | null | null | null | #coding:utf-8
from django.contrib import admin
from .models import Post, Category, FriendLink
admin.site.register(Post)
admin.site.register(Category)
admin.site.register(FriendLink)
| 15.583333 | 46 | 0.796791 | 26 | 187 | 5.730769 | 0.538462 | 0.181208 | 0.342282 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005952 | 0.101604 | 187 | 11 | 47 | 17 | 0.880952 | 0.064171 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
a01ae37c3b00f592b0b31d3208fce9730c303907 | 275 | py | Python | app.py | xii1/image-classifier-service | 01d5f2d6ca1436cefa9e3b978caebcc614b9ed34 | [
"MIT"
] | null | null | null | app.py | xii1/image-classifier-service | 01d5f2d6ca1436cefa9e3b978caebcc614b9ed34 | [
"MIT"
] | null | null | null | app.py | xii1/image-classifier-service | 01d5f2d6ca1436cefa9e3b978caebcc614b9ed34 | [
"MIT"
] | null | null | null | from __init__ import app
from api.classifier import classifier
from api.detector import detector
app.register_blueprint(classifier, url_prefix='/classifier')
app.register_blueprint(detector, url_prefix='/detector')
if __name__ == "__main__":
app.run('localhost', 8080)
| 27.5 | 60 | 0.792727 | 35 | 275 | 5.771429 | 0.485714 | 0.069307 | 0.19802 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016194 | 0.101818 | 275 | 9 | 61 | 30.555556 | 0.801619 | 0 | 0 | 0 | 0 | 0 | 0.134545 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.428571 | 0 | 0.428571 | 0.285714 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
a020a7fdadbe2d70423b5175b6d87bee424cb4dc | 199 | py | Python | poradnia/keys/utils.py | efefre/poradnia | 8bf9c88888d538cf4d1224431355c850d31ef252 | [
"MIT"
] | 23 | 2015-07-20T01:10:52.000Z | 2021-01-12T10:05:48.000Z | poradnia/keys/utils.py | efefre/poradnia | 8bf9c88888d538cf4d1224431355c850d31ef252 | [
"MIT"
] | 710 | 2015-07-12T13:19:14.000Z | 2022-03-29T12:38:18.000Z | poradnia/keys/utils.py | efefre/poradnia | 8bf9c88888d538cf4d1224431355c850d31ef252 | [
"MIT"
] | 20 | 2015-07-21T00:45:34.000Z | 2021-01-31T12:48:18.000Z | import random
import string
def make_random_password(length=75):
return "".join(
random.SystemRandom().choice(string.ascii_letters + string.digits)
for _ in range(length)
)
| 19.9 | 74 | 0.688442 | 24 | 199 | 5.541667 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012739 | 0.211055 | 199 | 9 | 75 | 22.111111 | 0.834395 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.142857 | 0.285714 | 0.142857 | 0.571429 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 4 |
4e6d83d88fc2b171d19f9f32903e6aef17da26e5 | 174 | py | Python | paper_admin/patches/dal/apps.py | dldevinc/paper_admin | ef90605cabdbd2bf966a7b11d5a0a69b72a3dd87 | [
"BSD-3-Clause"
] | 8 | 2021-03-01T00:12:01.000Z | 2022-01-18T10:54:20.000Z | paper_admin/patches/dal/apps.py | dldevinc/paper_admin | ef90605cabdbd2bf966a7b11d5a0a69b72a3dd87 | [
"BSD-3-Clause"
] | 7 | 2020-02-11T21:54:07.000Z | 2022-03-16T15:22:35.000Z | paper_admin/patches/dal/apps.py | dldevinc/paper_admin | ef90605cabdbd2bf966a7b11d5a0a69b72a3dd87 | [
"BSD-3-Clause"
] | null | null | null | from django.apps import AppConfig
class Config(AppConfig):
name = "paper_admin.patches.dal"
label = "paper_dal"
def ready(self):
from . import widgets
| 17.4 | 36 | 0.672414 | 22 | 174 | 5.227273 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.235632 | 174 | 9 | 37 | 19.333333 | 0.864662 | 0 | 0 | 0 | 0 | 0 | 0.183908 | 0.132184 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
4e90977d6e3c31d1a752ac74d2013318b26bf420 | 1,309 | py | Python | Incidences/migrations/0003_auto_20191110_1914.py | MizanUrp11/geodjango-project | 5c7646bcce3cfdbf800225fb17663e852c20bbdd | [
"MIT"
] | null | null | null | Incidences/migrations/0003_auto_20191110_1914.py | MizanUrp11/geodjango-project | 5c7646bcce3cfdbf800225fb17663e852c20bbdd | [
"MIT"
] | null | null | null | Incidences/migrations/0003_auto_20191110_1914.py | MizanUrp11/geodjango-project | 5c7646bcce3cfdbf800225fb17663e852c20bbdd | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-11-10 19:14
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Incidences', '0002_areas'),
]
operations = [
migrations.RemoveField(
model_name='areas',
name='area_m2',
),
migrations.RemoveField(
model_name='areas',
name='area_sqkm',
),
migrations.RemoveField(
model_name='areas',
name='deviation',
),
migrations.RemoveField(
model_name='areas',
name='location',
),
migrations.RemoveField(
model_name='areas',
name='name',
),
migrations.RemoveField(
model_name='areas',
name='package',
),
migrations.RemoveField(
model_name='areas',
name='pressure',
),
migrations.RemoveField(
model_name='areas',
name='project',
),
migrations.RemoveField(
model_name='areas',
name='status',
),
migrations.RemoveField(
model_name='areas',
name='zone',
),
]
| 23.375 | 48 | 0.498854 | 106 | 1,309 | 5.990566 | 0.386792 | 0.330709 | 0.409449 | 0.472441 | 0.626772 | 0.626772 | 0.135433 | 0 | 0 | 0 | 0 | 0.027261 | 0.383499 | 1,309 | 55 | 49 | 23.8 | 0.759603 | 0.051948 | 0 | 0.625 | 1 | 0 | 0.112278 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.041667 | 0 | 0.104167 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
4e92fc8cb5ab670bf80c414342f1cdd2e31a79d9 | 110 | py | Python | website/aurora_application/apps.py | ec500-software-engineering/project-aurora_borealis_classification | cbc057dd5cf07a057fc15d29b9f5c427431d28b9 | [
"MIT"
] | null | null | null | website/aurora_application/apps.py | ec500-software-engineering/project-aurora_borealis_classification | cbc057dd5cf07a057fc15d29b9f5c427431d28b9 | [
"MIT"
] | null | null | null | website/aurora_application/apps.py | ec500-software-engineering/project-aurora_borealis_classification | cbc057dd5cf07a057fc15d29b9f5c427431d28b9 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class AuroraApplicationConfig(AppConfig):
name = 'aurora_application'
| 18.333333 | 41 | 0.8 | 11 | 110 | 7.909091 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 110 | 5 | 42 | 22 | 0.915789 | 0 | 0 | 0 | 0 | 0 | 0.163636 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
4e9831d1452ffa24ec3d6cf6661f921098933c6f | 880 | py | Python | backend/model_init_config.py | kehuo/myweb | 3c03cfb0e2380e5dc4e627e3d7decf9e07f7572f | [
"MIT"
] | null | null | null | backend/model_init_config.py | kehuo/myweb | 3c03cfb0e2380e5dc4e627e3d7decf9e07f7572f | [
"MIT"
] | null | null | null | backend/model_init_config.py | kehuo/myweb | 3c03cfb0e2380e5dc4e627e3d7decf9e07f7572f | [
"MIT"
] | null | null | null | # @File: model_init_config
# @Author: Kevin Huo
# @LastUpdate: 3/9/2020 4:01 PM
# from views.introduction_to_algorithms.init_model_func import introduction_to_algorithms_init_func
#
#
# global_init_func_dict = {
# "introduction_to_algorithms": [introduction_to_algorithms_init_func]
# }
# todo 前后端分离后的新配置 -- 所有后台模块都在 core/ 下.
from core.auth.init_model_func import auth_init_func
from core.welcome.init_model_func import welcome_init_func
from core.introduction_to_algorithms.init_model_func import introduction_to_algorithms_init_func
from core.ml.init_model_func import ml_init_func
from core.comment.init_model_func import comment_init_func
global_init_func_dict = {
"auth": [auth_init_func],
"welcome": [welcome_init_func],
"introduction_to_algorithms": [introduction_to_algorithms_init_func],
"ml": [ml_init_func],
"comment": [comment_init_func]
}
| 32.592593 | 99 | 0.804545 | 127 | 880 | 5.102362 | 0.251969 | 0.17284 | 0.296296 | 0.259259 | 0.472222 | 0.472222 | 0.404321 | 0.404321 | 0.231481 | 0.231481 | 0 | 0.011494 | 0.110227 | 880 | 26 | 100 | 33.846154 | 0.816092 | 0.351136 | 0 | 0 | 0 | 0 | 0.082143 | 0.046429 | 0 | 0 | 0 | 0.038462 | 0 | 1 | 0 | false | 0 | 0.416667 | 0 | 0.416667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
4ea1880aa5455557c3fd2eb134ae3738ada07d87 | 49,304 | py | Python | tests/_string/test_docstring_util.py | ynsnf/apysc | b10ffaf76ec6beb187477d0a744fca00e3efc3fb | [
"MIT"
] | null | null | null | tests/_string/test_docstring_util.py | ynsnf/apysc | b10ffaf76ec6beb187477d0a744fca00e3efc3fb | [
"MIT"
] | null | null | null | tests/_string/test_docstring_util.py | ynsnf/apysc | b10ffaf76ec6beb187477d0a744fca00e3efc3fb | [
"MIT"
] | null | null | null | import inspect
import os
from inspect import Signature
from random import randint
from typing import Callable
from typing import List
from retrying import retry
from apysc._file import file_util
from apysc._string import docstring_util
from apysc._string.docstring_util import _DocstringCallableNotExistsError
from apysc._string.docstring_util import _DocstringPathNotFoundError
from apysc._string.docstring_util import _Example
from apysc._string.docstring_util import _Parameter
from apysc._string.docstring_util import _ParamOrRtnBase
from apysc._string.docstring_util import _Raise
from apysc._string.docstring_util import _Reference
from apysc._string.docstring_util import _Return
from apysc._string.docstring_util import _SectionPattern
from tests.testing_helper import assert_attrs
from tests.testing_helper import assert_raises
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__get_docstring_path_comment_matches() -> None:
matches: List[str] = docstring_util._get_docstring_path_comment_matches(
md_txt=(
'# Test title'
'\n<!-- Docstring: apysc._display.sprite.Sprite.__init__ -->'
'\n## Sub heading'
'\n<!-- Docstring:apysc._display.sprite.Sprite.add_child-->'
))
assert matches == [
'<!-- Docstring: apysc._display.sprite.Sprite.__init__ -->',
'<!-- Docstring:apysc._display.sprite.Sprite.add_child-->',
]
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__extract_docstring_path_specification_comment_from_line() -> None:
docstring_path_specification_comment: str = docstring_util.\
_extract_docstring_path_specification_comment_from_line(
line='<!-- Docstring: apysc._display.sprite.Sprite.add_child -->',
matches=[
'<!-- Docstring: apysc._display.sprite.Sprite.__init__ -->',
'<!-- Docstring: apysc._display.sprite.Sprite.add_child -->',
])
assert docstring_path_specification_comment == \
'<!-- Docstring: apysc._display.sprite.Sprite.add_child -->'
docstring_path_specification_comment = docstring_util.\
_extract_docstring_path_specification_comment_from_line(
line='## Test sub heading',
matches=[
'<!-- Docstring: apysc._display.sprite.Sprite.__init__ -->',
'<!-- Docstring: apysc._display.sprite.Sprite.add_child -->',
])
assert docstring_path_specification_comment == ''
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__remove_replaced_docstring_section_from_md_txt() -> None:
md_txt: str = (
'# Test title'
'\n\nLorem ipsum dolor sit amet.'
'\n\n## Sub heading 1'
'\n\n<!-- Docstring: apysc._display.sprite.Sprite.__init__ -->'
'\n\n**Parameters**'
'\n\n- a: str'
'\n\n## Sub heading 2'
'\n\nLorem ipsum dolor sit amet.'
'\n\n## Sub heading 3'
'\n\n<!-- Docstring: apysc._display.sprite.Sprite.add_child -->'
'\n\n**Parameters**'
'\n\n- b: str'
'\n\n## Sub heading 4'
'\n\nLorem ipsum dolor sit amet.'
)
md_txt = docstring_util._remove_replaced_docstring_section_from_md_txt(
md_txt=md_txt,
matches=[
'<!-- Docstring: apysc._display.sprite.Sprite.__init__ -->',
'<!-- Docstring: apysc._display.sprite.Sprite.add_child -->',
])
expected: str = (
'# Test title'
'\n\nLorem ipsum dolor sit amet.'
'\n\n## Sub heading 1'
'\n\n<!-- Docstring: apysc._display.sprite.Sprite.__init__ -->'
'\n\n## Sub heading 2'
'\n\nLorem ipsum dolor sit amet.'
'\n\n## Sub heading 3'
'\n\n<!-- Docstring: apysc._display.sprite.Sprite.add_child -->'
'\n\n## Sub heading 4'
'\n\nLorem ipsum dolor sit amet.'
)
assert md_txt == expected
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_reset_replaced_docstring_section() -> None:
tmp_md_file_path: str = './tmp/test_docstring_util_1.md'
os.makedirs('./tmp/', exist_ok=True)
file_util.remove_file_if_exists(file_path=tmp_md_file_path)
with open(tmp_md_file_path, 'w') as f:
f.write(
'# Test title'
'\n\nLorem ipsum dolor sit amet.'
)
is_executed = docstring_util.reset_replaced_docstring_section(
md_file_path=tmp_md_file_path)
assert not is_executed
with open(tmp_md_file_path, 'w') as f:
f.write(
'# Test title'
'\n\nLorem ipsum dolor sit amet.'
'\n\n## Sub heading 1'
'\n\n<!-- Docstring: apysc._display.sprite.Sprite.__init__ -->'
'\n\n**Parameters**'
'\n\n- a: str'
'\n\n## Sub heading 2'
'\n\nLorem ipsum dolor sit amet.'
'\n\n## Sub heading 3'
'\n\n<!-- Docstring: apysc._display.sprite.Sprite.add_child -->'
'\n\n**Parameters**'
'\n\n- b: str'
'\n\n## Sub heading 4'
'\n\nLorem ipsum dolor sit amet.'
)
is_executed = docstring_util.reset_replaced_docstring_section(
md_file_path=tmp_md_file_path)
assert is_executed
saved_md_txt: str = file_util.read_txt(file_path=tmp_md_file_path)
expected: str = (
'# Test title'
'\n\nLorem ipsum dolor sit amet.'
'\n\n## Sub heading 1'
'\n\n<!-- Docstring: apysc._display.sprite.Sprite.__init__ -->'
'\n\n## Sub heading 2'
'\n\nLorem ipsum dolor sit amet.'
'\n\n## Sub heading 3'
'\n\n<!-- Docstring: apysc._display.sprite.Sprite.add_child -->'
'\n\n## Sub heading 4'
'\n\nLorem ipsum dolor sit amet.'
)
assert saved_md_txt == expected
file_util.remove_file_if_exists(file_path=tmp_md_file_path)
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__extract_path_from_docstring_comment() -> None:
path: str = docstring_util._extract_path_from_docstring_comment(
docstring_path_comment='# Test title')
assert path == ''
path = docstring_util._extract_path_from_docstring_comment(
docstring_path_comment=(
'<!-- Docstring: apysc._display.sprite.Sprite.add_child -->'))
assert path == 'apysc._display.sprite.Sprite.add_child'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__extract_package_path_and_callable_name_from_path() -> None:
module_or_class_package_path: str
callable_name: str
module_or_class_package_path, callable_name = \
docstring_util._extract_package_path_and_callable_name_from_path(
docstring_path_comment='# Test title')
assert module_or_class_package_path == ''
assert callable_name == ''
module_or_class_package_path, callable_name = \
docstring_util._extract_package_path_and_callable_name_from_path(
docstring_path_comment=(
'<!-- Docstring: apysc._display.sprite.Sprite.add_child -->'))
assert module_or_class_package_path == 'apysc._display.sprite.Sprite'
assert callable_name == 'add_child'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__is_section_line() -> None:
result: bool = docstring_util._is_section_line(
line=' Parameters')
assert result
result = docstring_util._is_section_line(
line=' Parameters')
assert result
result = docstring_util._is_section_line(
line=' Returns')
assert result
result = docstring_util._is_section_line(
line='Test function.')
assert not result
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__extract_summary_from_docstring() -> None:
summary: str = docstring_util._extract_summary_from_docstring(
docstring=_TEST_DOCSTRING)
assert summary == (
'Lorem ipsum dolor sit amet, consectetur '
'adipiscing elit, sed do eiusmod tempor incididunt '
'ut labore et dolore magna aliqua.'
)
docstring: str = (
'Lorem ipsum dolor sit amet, consectetur adipiscing'
'\n elit, sed do eiusmod tempor incididunt ut.'
'\n Parameters'
'\n ----------'
'\n a : int'
)
summary = docstring_util._extract_summary_from_docstring(
docstring=docstring)
assert summary == (
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, '
'sed do eiusmod tempor incididunt ut.'
)
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__is_target_section_pattern_line() -> None:
result: bool = docstring_util._is_target_section_pattern_line(
line=' Parameters',
section_pattern=_SectionPattern.PARAMETERS)
assert result
result = docstring_util._is_target_section_pattern_line(
line=' a : str',
section_pattern=_SectionPattern.PARAMETERS)
assert not result
result = docstring_util._is_target_section_pattern_line(
line=' Returns',
section_pattern=_SectionPattern.PARAMETERS)
assert not result
result = docstring_util._is_target_section_pattern_line(
line=' Returns',
section_pattern=_SectionPattern.RETURNS)
assert result
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__is_hyphens_line() -> None:
line: str = ' Parameters'
result: bool = docstring_util._is_hyphens_line(line=line)
assert not result
line = ' ----------'
result = docstring_util._is_hyphens_line(line=line)
assert result
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__get_value_name_and_type_from_line() -> None:
value_name: str
type_name: str
value_name, type_name = docstring_util._get_value_name_and_type_from_line(
line=' Lorem ipsum dolor sit')
assert value_name == ''
assert type_name == ''
value_name, type_name = docstring_util._get_value_name_and_type_from_line(
line=' any_value : int')
assert value_name == 'any_value'
assert type_name == 'int'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__get_indent_num_from_line() -> None:
indent_num: int = docstring_util._get_indent_num_from_line(
line=' any_value : int')
assert indent_num == 1
indent_num = docstring_util._get_indent_num_from_line(
line=' any_value : int')
assert indent_num == 2
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__remove_line_breaks_and_unnecessary_spaces() -> None:
text: str = docstring_util._remove_line_breaks_and_unnecessary_spaces(
text=(
' Lorem ipsum dolor sit amet, consectetur '
'\nadipiscing elit, sed do eiusmod tempor incididunt '
'\nut labore et dolore magna aliqua. '
))
assert text == (
'Lorem ipsum dolor sit amet, consectetur adipiscing '
'elit, sed do eiusmod tempor incididunt ut labore et '
'dolore magna aliqua.'
)
_TEST_DOCSTRING: str = (
'\n Lorem ipsum dolor sit amet, consectetur '
'\n adipiscing elit, sed do eiusmod tempor incididunt '
'\n ut labore et dolore magna aliqua.'
'\n'
'\n Parameters'
'\n ----------'
'\n test_param_1 : int'
'\n Ut enim ad minim veniam, quis nostrud exercitation'
'\n ullamco laboris nisi.'
'\n test_param_2 : str, optional'
'\n Ut aliquip ex ea commodo consequat.'
'\n Duis aute irure dolor in reprehenderit in'
'\n voluptate velit esse cillum dolore.'
'\n'
'\n Omnis dolor repellendus. Temporibus autem quibusdam.'
'\n'
'\n Returns'
'\n -------'
'\n test_return_val_1 : bool or int'
'\n Fugiat nulla pariatur. Excepteur sint occaecat '
'\n cupidatat non proident, sunt in culpa qui '
'\n officia deserunt mollit anim id est laborum.'
'\n'
'\n Omnis dolor repellendus. Temporibus autem quibusdam.'
'\n test_return_val_2 : Sprite'
'\n Officiis debitis aut rerum necessitatibus saepe eveniet.'
'\n'
'\n Notes'
'\n -----'
'\n At vero eos et accusamus et iusto odio dignissimos'
'\n ducimus, qui blanditiis praesentium voluptatum'
'\n deleniti atque corrupt.'
'\n'
'\n Raises'
'\n ------'
'\n ValueError'
'\n Quos dolores et quas molestias excepturi sint,'
'\n obcaecati.'
'\n ImportError'
'\n Cupiditate non provident, similique sunt in culpa.'
'\n'
'\n Examples'
'\n --------'
'\n >>> test_value_1: int = 10'
'\n >>> test_value_1'
'\n 10'
'\n'
'\n >>> test_value_2: int = test_function('
'\n ... any_arg=10)'
'\n >>> test_value_2'
'\n 30'
'\n'
'\n >>> test_value_3: int = x + 10'
'\n'
'\n References'
'\n ----------'
'\n - Test interface1 document'
'\n - https://en.wikipedia.org/test_page_1.html'
'\n - Test interface2 document'
'\n - https://en.wikipedia.org/test_page_2.html'
)
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__extract_param_or_rtn_values_from_docstring() -> None:
param_values: List[_Parameter] = docstring_util.\
_extract_param_or_rtn_values_from_docstring(
target_type=_Parameter,
docstring=_TEST_DOCSTRING)
assert len(param_values) == 2
for parameter_ in param_values:
assert isinstance(parameter_, _Parameter)
parameter: _Parameter = _Parameter(
name='test_param_1',
type_str='int',
description=(
'Ut enim ad minim veniam, quis nostrud exercitation '
'ullamco laboris nisi.'
))
assert param_values[0] == parameter
parameter = _Parameter(
name='test_param_2',
type_str='str, optional',
description=(
'Ut aliquip ex ea commodo consequat. '
'Duis aute irure dolor in reprehenderit in '
'voluptate velit esse cillum dolore. '
'Omnis dolor repellendus. Temporibus autem quibusdam.'
))
assert param_values[1] == parameter
return_values: List[_Return] = docstring_util.\
_extract_param_or_rtn_values_from_docstring(
target_type=_Return,
docstring=_TEST_DOCSTRING)
assert len(return_values) == 2
for return__ in return_values:
assert isinstance(return__, _Return)
return_: _Return = _Return(
name='test_return_val_1',
type_str='bool or int',
description=(
'Fugiat nulla pariatur. Excepteur sint occaecat '
'cupidatat non proident, sunt in culpa qui '
'officia deserunt mollit anim id est laborum. '
'Omnis dolor repellendus. Temporibus autem quibusdam.'
))
assert return_values[0] == return_
return_ = _Return(
name='test_return_val_2',
type_str='Sprite',
description=(
'Officiis debitis aut rerum necessitatibus saepe eveniet.'
))
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__make_prm_or_rtn_description_and_append_to_list() -> None:
parameters: List[_Parameter] = []
docstring_util._make_prm_or_rtn_description_and_append_to_list(
target_type=_Parameter,
param_or_rtn_values=parameters,
value_name='test_value',
value_type_str='int',
description_lines=[])
assert parameters == []
description_lines: List[str] = [
' At vero eos et accusamus et iusto odio dignissimos'
' ducimus, qui blanditiis praesentium voluptatum.'
]
docstring_util._make_prm_or_rtn_description_and_append_to_list(
target_type=_Parameter,
param_or_rtn_values=parameters,
value_name='test_value',
value_type_str='int',
description_lines=description_lines)
parameter: _Parameter = _Parameter(
name='test_value',
type_str='int',
description=(
'At vero eos et accusamus et iusto odio dignissimos '
'ducimus, qui blanditiis praesentium voluptatum.'
))
assert parameters == [parameter]
assert isinstance(parameters[0], _Parameter)
assert description_lines == []
class Test_ParamOrRtnBase:
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test___init__(self) -> None:
param_or_rtn: _ParamOrRtnBase = _ParamOrRtnBase(
name='test_value', type_str='int',
description='Lorem ipsum dolor sit.')
assert_attrs(
expected_attrs={
'_name': 'test_value',
'_type_str': 'int',
'_description': 'Lorem ipsum dolor sit.',
},
any_obj=param_or_rtn)
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test___eq__(self) -> None:
param_or_rtn: _ParamOrRtnBase = _ParamOrRtnBase(
name='test_value', type_str='int',
description='Lorem ipsum dolor sit.')
result: bool = param_or_rtn == 10
assert not result
other: _ParamOrRtnBase = _ParamOrRtnBase(
name='test_value_2', type_str='int',
description='Lorem ipsum dolor sit.')
result = param_or_rtn == other
assert not result
other = _ParamOrRtnBase(
name='test_value', type_str='str',
description='Lorem ipsum dolor sit.')
result = param_or_rtn == other
assert not result
other = _ParamOrRtnBase(
name='test_value', type_str='int',
description='Lorem ipsum dolor.')
result = param_or_rtn == other
assert not result
other = _ParamOrRtnBase(
name='test_value', type_str='int',
description='Lorem ipsum dolor sit.')
result = param_or_rtn == other
assert result
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_name(self) -> None:
param_or_rtn: _ParamOrRtnBase = _ParamOrRtnBase(
name='test_value', type_str='int',
description='Lorem ipsum dolor sit.')
assert param_or_rtn.name == 'test_value'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_type_str(self) -> None:
param_or_rtn: _ParamOrRtnBase = _ParamOrRtnBase(
name='test_value', type_str='int',
description='Lorem ipsum dolor sit.')
assert param_or_rtn.type_str == 'int'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_description(self) -> None:
param_or_rtn: _ParamOrRtnBase = _ParamOrRtnBase(
name='test_value', type_str='int',
description='Lorem ipsum dolor sit.')
assert param_or_rtn.description == 'Lorem ipsum dolor sit.'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__get_params_or_rtns_section_pattern_by_type() -> None:
pattern: _SectionPattern = docstring_util.\
_get_params_or_rtns_section_pattern_by_type(
target_type=_Parameter)
assert pattern == _SectionPattern.PARAMETERS
pattern = docstring_util._get_params_or_rtns_section_pattern_by_type(
target_type=_Return)
assert pattern == _SectionPattern.RETURNS
assert_raises(
expected_error_class=ValueError,
func_or_method=docstring_util.
_get_params_or_rtns_section_pattern_by_type,
kwargs={'target_type': 10},
match='Invalid type argument is provided: ',
)
class Test_Raise:
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test___init__(self) -> None:
raise_: _Raise = _Raise(
err_class_name='ValueError',
description='Lorem ipsum dolor sit.')
assert_attrs(
expected_attrs={
'_err_class_name': 'ValueError',
'_description': 'Lorem ipsum dolor sit.'
},
any_obj=raise_)
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_err_class_name(self) -> None:
raise_: _Raise = _Raise(
err_class_name='ValueError',
description='Lorem ipsum dolor sit.')
assert raise_.err_class_name == 'ValueError'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_description(self) -> None:
raise_: _Raise = _Raise(
err_class_name='ValueError',
description='Lorem ipsum dolor sit.')
assert raise_.description == 'Lorem ipsum dolor sit.'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test___eq__(self) -> None:
raise_: _Raise = _Raise(
err_class_name='ValueError',
description='Lorem ipsum dolor sit.')
result: bool = raise_ == 10
assert not result
other: _Raise = _Raise(
err_class_name='ImportError',
description='Lorem ipsum dolor sit.')
result = raise_ == other
assert not result
other = _Raise(
err_class_name='ValueError',
description='Lorem ipsum dolor.')
result = raise_ == other
assert not result
other = _Raise(
err_class_name='ValueError',
description='Lorem ipsum dolor sit.')
result = raise_ == other
assert result
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__make_raise_description_and_append_to_list() -> None:
raise_values: List[_Raise] = []
docstring_util._make_raise_description_and_append_to_list(
raise_values=raise_values,
err_class_name='ValueError',
description_lines=[])
assert raise_values == []
docstring_util._make_raise_description_and_append_to_list(
raise_values=raise_values,
err_class_name='ValueError',
description_lines=[
' Lorem ipsum dolor sit amet, consectetur adipiscing ',
' elit, sed do eiusmod tempor incididunt ut labore ',
' et dolore magna aliqua. '
])
expected_raise: _Raise = _Raise(
err_class_name='ValueError',
description=(
'Lorem ipsum dolor sit amet, consectetur adipiscing '
'elit, sed do eiusmod tempor incididunt ut labore '
'et dolore magna aliqua.'
))
assert raise_values == [expected_raise]
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__extract_raise_values_from_docstring() -> None:
raise_values: List[_Raise] = docstring_util.\
_extract_raise_values_from_docstring(docstring=_TEST_DOCSTRING)
assert len(raise_values) == 2
expected_raise: _Raise = _Raise(
err_class_name='ValueError',
description=(
'Quos dolores et quas molestias excepturi sint, '
'obcaecati.'
))
assert raise_values[0] == expected_raise
expected_raise = _Raise(
err_class_name='ImportError',
description=(
'Cupiditate non provident, similique sunt in culpa.'
))
assert raise_values[1] == expected_raise
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__get_base_indent_num_if_not_set() -> None:
base_indent_num: int = docstring_util._get_base_indent_num_if_not_set(
line=' test_value : int',
base_indent_num=1)
assert base_indent_num == 1
base_indent_num = docstring_util._get_base_indent_num_if_not_set(
line=' Lorem ipsum dolor sit.',
base_indent_num=0)
assert base_indent_num == 1
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__remove_blank_lines_from_list() -> None:
result_lines: List[str] = docstring_util._remove_blank_lines_from_list(
lines=[
' Lorem ipsum dolor sit amet, consectetur adipiscing',
'',
' ',
' elit, sed do eiusmod tempor incididunt ut.',
])
assert result_lines == [
' Lorem ipsum dolor sit amet, consectetur adipiscing',
' elit, sed do eiusmod tempor incididunt ut.',
]
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__is_skip_target_line() -> None:
result: bool = docstring_util._is_skip_target_line(
is_target_section_range=False,
line=' any_value : int')
assert result
result = docstring_util._is_skip_target_line(
is_target_section_range=True,
line=' ------')
assert result
result = docstring_util._is_skip_target_line(
is_target_section_range=True,
line=' any_value : int')
assert not result
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__extract_notes_from_docstring() -> None:
notes: str = docstring_util._extract_notes_from_docstring(
docstring=_TEST_DOCSTRING)
assert notes == (
'At vero eos et accusamus et iusto odio dignissimos '
'ducimus, qui blanditiis praesentium voluptatum '
'deleniti atque corrupt.'
)
class Test_Reference:
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test___init__(self) -> None:
reference: _Reference = _Reference(
page_label='Sprite document',
url='https://simon-ritchie.github.io/apysc/sprite.html')
assert_attrs(
expected_attrs={
'_page_label': 'Sprite document',
'_url': 'https://simon-ritchie.github.io/apysc/sprite.html',
},
any_obj=reference)
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_page_label(self) -> None:
reference: _Reference = _Reference(
page_label='Sprite document',
url='https://simon-ritchie.github.io/apysc/sprite.html')
assert reference.page_label == 'Sprite document'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_url(self) -> None:
reference: _Reference = _Reference(
page_label='Sprite document',
url='https://simon-ritchie.github.io/apysc/sprite.html')
assert reference.url == \
'https://simon-ritchie.github.io/apysc/sprite.html'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test___eq__(self) -> None:
reference: _Reference = _Reference(
page_label='Sprite document',
url='https://simon-ritchie.github.io/apysc/sprite.html')
result: bool = reference == 10
assert not result
other: _Reference = _Reference(
page_label='DisplayObject document',
url='https://simon-ritchie.github.io/apysc/sprite.html')
result = reference == other
assert not result
other = _Reference(
page_label='Sprite document',
url='https://simon-ritchie.github.io/apysc/display_object.html')
result = reference == other
assert not result
other = _Reference(
page_label='Sprite document',
url='https://simon-ritchie.github.io/apysc/sprite.html')
result = reference == other
assert result
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__remove_unnecessary_markdown_list_from_line() -> None:
line: str = docstring_util._remove_unnecessary_markdown_list_from_line(
line=' - Sprite document')
assert line == 'Sprite document'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__make_reference_and_append_to_list() -> None:
reference_values: List[_Reference] = []
docstring_util._make_reference_and_append_to_list(
reference_values=reference_values,
page_label='Sprite document',
url='')
assert reference_values == []
docstring_util._make_reference_and_append_to_list(
reference_values=reference_values,
page_label='Sprite document',
url='https://simon-ritchie.github.io/apysc/sprite.html')
expected_reference: _Reference = _Reference(
page_label='Sprite document',
url='https://simon-ritchie.github.io/apysc/sprite.html')
assert reference_values == [expected_reference]
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__extract_reference_values_from_docstring() -> None:
reference_values: List[_Reference] = docstring_util.\
_extract_reference_values_from_docstring(
docstring=_TEST_DOCSTRING)
assert len(reference_values) == 2
expected_reference: _Reference = _Reference(
page_label='Test interface1 document',
url='https://en.wikipedia.org/test_page_1.html')
assert reference_values[0] == expected_reference
expected_reference = _Reference(
page_label='Test interface2 document',
url='https://en.wikipedia.org/test_page_2.html')
assert reference_values[1] == expected_reference
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__append_params_or_rtns_to_markdown() -> None:
markdown: str = '## add_child interface api document'
markdown = docstring_util._append_params_or_rtns_to_markdown(
markdown=markdown, params_or_rtns=[])
assert markdown == '## add_child interface api document'
parameters: List[_Parameter] = [
_Parameter(
name='test_param_1', type_str='int',
description='Lorem ipsum dolor sit.'),
_Parameter(
name='test_param_2', type_str='str, optional',
description='Amet, consectetur adipiscing elit.'),
]
markdown = docstring_util._append_params_or_rtns_to_markdown(
markdown=markdown, params_or_rtns=parameters)
expected: str = (
'## add_child interface api document'
'\n\n**[Parameters]**'
'\n\n- `test_param_1`: int'
'\n - Lorem ipsum dolor sit.'
'\n- `test_param_2`: str, optional'
'\n - Amet, consectetur adipiscing elit.'
'\n\n<hr>'
)
assert markdown == expected
returns: List[_Return] = [
_Return(
name='test_return_value',
type_str='int',
description='Lorem ipsum dolor sit.'),
]
markdown = docstring_util._append_params_or_rtns_to_markdown(
markdown=markdown, params_or_rtns=returns)
expected = (
'## add_child interface api document'
'\n\n**[Parameters]**'
'\n\n- `test_param_1`: int'
'\n - Lorem ipsum dolor sit.'
'\n- `test_param_2`: str, optional'
'\n - Amet, consectetur adipiscing elit.'
'\n\n<hr>'
'\n\n**[Returns]**'
'\n\n- `test_return_value`: int'
'\n - Lorem ipsum dolor sit.'
'\n\n<hr>'
)
assert markdown == expected
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__append_raises_to_markdown() -> None:
markdown: str = '## add_child interface api document'
markdown = docstring_util._append_raises_to_markdown(
markdown=markdown,
raises=[])
assert markdown == '## add_child interface api document'
raises: List[_Raise] = [
_Raise(
err_class_name='ValueError',
description='Lorem ipsum dolor sit.'),
_Raise(
err_class_name='ImportError',
description='Amet, consectetur adipiscing elit.'),
]
markdown = docstring_util._append_raises_to_markdown(
markdown=markdown, raises=raises)
expected: str = (
'## add_child interface api document'
'\n\n**[Raises]**'
'\n\n- ValueError: Lorem ipsum dolor sit.'
'\n- ImportError: Amet, consectetur adipiscing elit.'
'\n\n<hr>'
)
assert markdown == expected
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__append_notes_to_markdown() -> None:
markdown: str = '## add_child interface api document'
markdown = docstring_util._append_notes_to_markdown(
markdown=markdown,
notes='')
assert markdown == '## add_child interface api document'
markdown = docstring_util._append_notes_to_markdown(
markdown=markdown,
notes='Lorem ipsum dolor sit.')
assert markdown == (
'## add_child interface api document'
'\n\n**[Notes]**'
'\n\nLorem ipsum dolor sit.<hr>'
)
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__append_references_to_markdown() -> None:
markdown: str = '## add_child interface api document'
markdown = docstring_util._append_references_to_markdown(
markdown=markdown, references=[])
assert markdown == '## add_child interface api document'
references: List[_Reference] = [
_Reference(
page_label='Sprite document',
url='https://simon-ritchie.github.io/apysc/sprite.html'),
_Reference(
page_label='DisplayObject document',
url='https://simon-ritchie.github.io/apysc/display_object.html')
]
markdown = docstring_util._append_references_to_markdown(
markdown=markdown, references=references)
markdown = docstring_util._append_references_to_markdown(
markdown=markdown, references=[])
expected: str = (
'## add_child interface api document'
'\n\n**[References]**'
'\n\n- [Sprite document]'
'(https://simon-ritchie.github.io/apysc/sprite.html)'
'\n- [DisplayObject document]'
'(https://simon-ritchie.github.io/apysc/display_object.html)'
'\n\n<hr>'
)
assert markdown == expected
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__append_summary_to_markdown() -> None:
markdown: str = '## add_child interface api document'
markdown = docstring_util._append_summary_to_markdown(
markdown=markdown, summary='')
assert markdown == '## add_child interface api document'
markdown = docstring_util._append_summary_to_markdown(
markdown=markdown,
summary='Lorem ipsum dolor sit.')
assert markdown == (
'## add_child interface api document'
'\n\n**[Interface summary]** '
'Lorem ipsum dolor sit.<hr>'
)
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__convert_docstring_to_markdown() -> None:
signature: Signature = inspect.signature(
test__convert_docstring_to_markdown)
markdown: str = docstring_util._convert_docstring_to_markdown(
docstring=_TEST_DOCSTRING,
signature=signature,
callable_name='test_func',
md_file_path='./docs_src/source/test_document.md')
markdown_lines: List[str] = markdown.splitlines()
expected_lines: List[str] = [
'<span class="inconspicuous-txt">Note: the document '
'build script generates and updates this '
'API document section automatically. Maybe this section '
'is duplicated compared with previous sections.</span>',
'',
'**[Interface signature]** '
'`test_func() -> None`<hr>',
'',
'**[Interface summary]** '
'Lorem ipsum dolor sit amet, consectetur '
'adipiscing elit, sed do eiusmod tempor incididunt '
'ut labore et dolore magna aliqua.<hr>',
'',
'**[Parameters]**',
'',
'- `test_param_1`: int',
' - Ut enim ad minim veniam, quis nostrud exercitation '
'ullamco laboris nisi.',
'- `test_param_2`: str, optional',
' - Ut aliquip ex ea commodo consequat. '
'Duis aute irure dolor in reprehenderit in '
'voluptate velit esse cillum dolore. '
'Omnis dolor repellendus. Temporibus autem quibusdam.',
'',
'<hr>',
'',
'**[Returns]**',
'',
'- `test_return_val_1`: bool or int',
' - Fugiat nulla pariatur. Excepteur sint occaecat '
'cupidatat non proident, sunt in culpa qui '
'officia deserunt mollit anim id est laborum. '
'Omnis dolor repellendus. Temporibus autem quibusdam.',
'- `test_return_val_2`: Sprite',
' - Officiis debitis aut rerum necessitatibus saepe eveniet.',
'',
'<hr>',
'',
'**[Raises]**',
'',
'- ValueError: Quos dolores et quas molestias excepturi sint, '
'obcaecati.',
'- ImportError: Cupiditate non provident, similique sunt in culpa.',
'',
'<hr>',
'',
'**[Notes]**',
'',
'At vero eos et accusamus et iusto odio dignissimos '
'ducimus, qui blanditiis praesentium voluptatum '
'deleniti atque corrupt.<hr>',
'',
'**[Examples]**',
'',
'```py',
'>>> test_value_1: int = 10',
'>>> test_value_1',
'10',
'',
'>>> test_value_2: int = test_function(',
'... any_arg=10)',
'>>> test_value_2',
'30',
'',
'>>> test_value_3: int = x + 10',
'```',
'',
'<hr>',
'',
'**[References]**',
'',
'- [Test interface1 document]'
'(https://en.wikipedia.org/test_page_1.html)',
'- [Test interface2 document]'
'(https://en.wikipedia.org/test_page_2.html)',
]
for i, expected_line in enumerate(expected_lines):
assert markdown_lines[i] == expected_line
assert len(markdown_lines) == len(expected_lines)
_PATH_COMMENT_KEYWORD: str = \
docstring_util._DOCSTRING_PATH_COMMENT_KEYWORD
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__convert_docstring_path_comment_to_markdown_format() -> None:
markdown_format_docstring: str = docstring_util.\
_convert_docstring_path_comment_to_markdown_format(
docstring_path_comment=(
f'<!-- {_PATH_COMMENT_KEYWORD}'
' tests._string.test_docstring_util.'
'test__convert_docstring_path_comment_to_markdown_format'
' -->'
),
md_file_path='./docs_src/source/test_document.md')
assert markdown_format_docstring == ''
markdown_format_docstring = docstring_util.\
_convert_docstring_path_comment_to_markdown_format(
docstring_path_comment=(
f'<!-- {_PATH_COMMENT_KEYWORD} '
'apysc._display.sprite.Sprite.__init__ -->'
),
md_file_path='./docs_src/source/test_document.md')
assert '**[Interface summary]**' in markdown_format_docstring
assert 'Basic display object that can be parent.' \
in markdown_format_docstring
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_replace_docstring_path_specification() -> None:
tmp_dir_path: str = './tmp/'
os.makedirs(tmp_dir_path, exist_ok=True)
tmp_md_path: str = os.path.join(
tmp_dir_path, 'tmp_md_path.md')
with open(tmp_md_path, 'w') as f:
f.write(
'# Test document'
'\n\nLorem ipsum dolor sit amet.'
'\n\n## Constructor interface API'
f'\n\n<!-- {_PATH_COMMENT_KEYWORD} '
'apysc._display.sprite.Sprite.__init__ -->'
)
file_util.save_plain_txt(
txt=(
'# Test document'
'\n\nLorem ipsum dolor sit amet.'
'\n\n## Constructor API'
f'\n\n<!-- {_PATH_COMMENT_KEYWORD} '
'apysc._display.sprite.Sprite.__init__ -->'
),
file_path=tmp_md_path)
docstring_util.replace_docstring_path_specification(
md_file_path=tmp_md_path)
md_txt: str = file_util.read_txt(file_path=tmp_md_path)
assert md_txt.startswith('# Test document')
assert (
f'\n\n<!-- {_PATH_COMMENT_KEYWORD} '
'apysc._display.sprite.Sprite.__init__ -->') in md_txt
assert '**[Interface summary]**' in md_txt
file_util.remove_file_if_exists(file_path=tmp_md_path)
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__get_callable_from_package_path_and_callable_name() -> None:
assert_raises(
expected_error_class=_DocstringPathNotFoundError,
func_or_method=docstring_util.
_get_callable_from_package_path_and_callable_name,
kwargs={
'module_or_class_package_path': 'not.existing.package.path',
'callable_name': '__init__',
},
match='Module or class package path: not.existing.package.path')
assert_raises(
expected_error_class=_DocstringCallableNotExistsError,
func_or_method=docstring_util.
_get_callable_from_package_path_and_callable_name,
kwargs={
'module_or_class_package_path': 'apysc._display.sprite.Sprite',
'callable_name': 'not_existing_method',
},
match='Callable name: not_existing_method')
callable_: Callable = docstring_util.\
_get_callable_from_package_path_and_callable_name(
module_or_class_package_path='apysc._display.sprite.Sprite',
callable_name='__init__')
assert callable_.__name__ == '__init__'
class Test_Example:
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test___init__(self) -> None:
example: _Example = _Example(
input_code_block='x = 10\nx',
expected_output='10')
assert_attrs(
expected_attrs={
'_input_code_block': 'x = 10\nx',
'_expected_output': '10',
},
any_obj=example)
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_input_code_block(self) -> None:
example: _Example = _Example(
input_code_block='x = 10\nx',
expected_output='10')
assert example.input_code_block == 'x = 10\nx'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_expected_output(self) -> None:
example: _Example = _Example(
input_code_block='x = 10\nx',
expected_output='10')
assert example.expected_output == '10'
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test___eq__(self) -> None:
example: _Example = _Example(
input_code_block='x = 10\nx',
expected_output='10')
result: bool = example == 10
assert not result
other: _Example = _Example(
input_code_block='x = 10', expected_output='10')
result = example == other
assert not result
other = _Example(
input_code_block='x = 10\nx', expected_output='20')
result = example == other
assert not result
other = _Example(
input_code_block='x = 10\nx', expected_output='10')
result = example == other
assert result
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__is_example_output_line() -> None:
result: bool = docstring_util._is_example_output_line(
line=' >>> x = 10')
assert not result
result = docstring_util._is_example_output_line(
line=' ... x=10,')
assert not result
result = docstring_util._is_example_output_line(
line=' 10')
assert result
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__make_example_and_append_to_list() -> None:
example_values: List[_Example] = []
docstring_util._make_example_and_append_to_list(
example_values=example_values,
input_code_block_lines=[],
expected_output=' 10')
assert example_values == []
input_code_block_lines: List[str] = [
' >>> x = 10',
' >>> x',
]
docstring_util._make_example_and_append_to_list(
example_values=example_values,
input_code_block_lines=input_code_block_lines,
expected_output=' 10')
assert input_code_block_lines == []
assert example_values == [
_Example(
input_code_block='>>> x = 10\n>>> x',
expected_output='10')
]
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__extract_example_values_from_docstring() -> None:
example_values: List[_Example] = docstring_util.\
_extract_example_values_from_docstring(docstring=_TEST_DOCSTRING)
assert len(example_values) == 3
assert example_values[0] == _Example(
input_code_block=(
'>>> test_value_1: int = 10'
'\n>>> test_value_1'
),
expected_output='10')
assert example_values[1] == _Example(
input_code_block=(
'>>> test_value_2: int = test_function('
'\n... any_arg=10)'
'\n>>> test_value_2'
),
expected_output='30')
assert example_values[2] == _Example(
input_code_block=(
'>>> test_value_3: int = x + 10'
),
expected_output='')
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__append_examples_to_markdown() -> None:
markdown: str = '## add_child interface api document'
markdown = docstring_util._append_examples_to_markdown(
markdown=markdown,
examples=[])
assert markdown == '## add_child interface api document'
examples: List[_Example] = [
_Example(
input_code_block=(
'>>> x = 10'
'\n>>> x'
),
expected_output='10'),
_Example(
input_code_block=(
'>>> y = x + 10'
),
expected_output='')
]
markdown = docstring_util._append_examples_to_markdown(
markdown=markdown, examples=examples)
expected_lines: List[str] = [
'## add_child interface api document',
'',
'**[Examples]**',
'',
'```py',
'>>> x = 10',
'>>> x',
'10',
'',
'>>> y = x + 10',
'```',
'',
'<hr>'
]
lines: List[str] = markdown.splitlines()
for i, line in enumerate(lines):
assert line == expected_lines[i]
assert len(lines) == len(expected_lines)
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__slice_references_by_md_file_path() -> None:
references: List[_Reference] = [
_Reference(
page_label='test document 1',
url='https://simon-ritchie.github.io/apysc/sprite.html'),
_Reference(
page_label='test document 1',
url='https://simon-ritchie.github.io/apysc/display_object.html'),
]
sliced_references: List[_Reference] = docstring_util.\
_slice_references_by_md_file_path(
references=references,
md_file_path='./docs_src/source/sprite.md')
assert sliced_references == [
_Reference(
page_label='test document 1',
url='https://simon-ritchie.github.io/apysc/display_object.html')
]
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_get_docstring_src_module_paths() -> None:
module_paths: List[str] = docstring_util.get_docstring_src_module_paths(
md_file_path='./docs_src/source/int_and_number.md')
assert './apysc/_type/int.py' in module_paths
assert './apysc/_type/number.py' in module_paths
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test__remove_trailing_hr_tag() -> None:
markdown: str = docstring_util._remove_trailing_hr_tag(
markdown='Lorem ipsum dolor sit.\n\n<hr>\n')
assert markdown == 'Lorem ipsum dolor sit.'
| 36.95952 | 79 | 0.619828 | 5,643 | 49,304 | 5.048201 | 0.059011 | 0.041528 | 0.026925 | 0.038684 | 0.844771 | 0.795591 | 0.741637 | 0.674588 | 0.636396 | 0.603503 | 0 | 0.018283 | 0.27225 | 49,304 | 1,333 | 80 | 36.987247 | 0.775647 | 0 | 0 | 0.551337 | 0 | 0 | 0.28634 | 0.035042 | 0 | 0 | 0 | 0 | 0.11648 | 1 | 0.050043 | false | 0 | 0.022433 | 0 | 0.075928 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
4ed1d3ba7f2b3f7a972250a6e47331f266fcd7e9 | 39 | py | Python | HW9.py | stevenkyritsis/NJIT-CS100 | 9466489c4de80610cadb5c1eac4d87fd81bfb6d3 | [
"MIT"
] | null | null | null | HW9.py | stevenkyritsis/NJIT-CS100 | 9466489c4de80610cadb5c1eac4d87fd81bfb6d3 | [
"MIT"
] | null | null | null | HW9.py | stevenkyritsis/NJIT-CS100 | 9466489c4de80610cadb5c1eac4d87fd81bfb6d3 | [
"MIT"
] | null | null | null | #1
def file_copy(infile, outFile):
| 13 | 31 | 0.666667 | 6 | 39 | 4.166667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032258 | 0.205128 | 39 | 3 | 32 | 13 | 0.774194 | 0.025641 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
14d4a50931f0c797e13aa6c6e5fb8cd6292485e1 | 354 | py | Python | qaforum/admin.py | UREDDY616/IIITVforum | ad377f26a2869761a998062202b584fc03f78cfa | [
"MIT"
] | null | null | null | qaforum/admin.py | UREDDY616/IIITVforum | ad377f26a2869761a998062202b584fc03f78cfa | [
"MIT"
] | null | null | null | qaforum/admin.py | UREDDY616/IIITVforum | ad377f26a2869761a998062202b584fc03f78cfa | [
"MIT"
] | null | null | null | from django.contrib import admin
from django_markdown.admin import MarkdownModelAdmin
from qaforum.models import (QaAnswer, QaAnswerComment, QaQuestion,
QaQuestionComment)
admin.site.register(QaQuestion)
admin.site.register(QaAnswer, MarkdownModelAdmin)
admin.site.register(QaAnswerComment)
admin.site.register(QaQuestionComment)
| 35.4 | 66 | 0.805085 | 36 | 354 | 7.888889 | 0.416667 | 0.126761 | 0.239437 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.124294 | 354 | 9 | 67 | 39.333333 | 0.916129 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.375 | 0 | 0.375 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
14ff8c37e8b8b8b4d0020e79cc181f403d7d9c79 | 113 | py | Python | fefu_admission/fefu/__init__.py | ada0l/fefu_admission | e8a48c46be94003217c30902f5dfa6ed204fb22b | [
"MIT"
] | null | null | null | fefu_admission/fefu/__init__.py | ada0l/fefu_admission | e8a48c46be94003217c30902f5dfa6ed204fb22b | [
"MIT"
] | null | null | null | fefu_admission/fefu/__init__.py | ada0l/fefu_admission | e8a48c46be94003217c30902f5dfa6ed204fb22b | [
"MIT"
] | null | null | null | from .department import FefuDepartment
from .university import FefuUniversity
from .settings import FefuSettings
| 28.25 | 38 | 0.867257 | 12 | 113 | 8.166667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106195 | 113 | 3 | 39 | 37.666667 | 0.970297 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
14ffe9ec375cb3911837a1fc4aff7dc2d62b0631 | 204 | py | Python | utils/docker-gpu/test.py | pietroppeter/nixtla | 74e4560f1bdb6bf64445f3c45005fe74c0a0a427 | [
"MIT"
] | 176 | 2021-10-16T21:53:30.000Z | 2022-03-31T22:34:13.000Z | utils/docker-gpu/test.py | valeman/nixtla | 8991230491b16b0c7eb5d0dccd2fe64022ad8796 | [
"MIT"
] | 7 | 2021-11-18T00:24:11.000Z | 2022-03-18T17:02:17.000Z | utils/docker-gpu/test.py | valeman/nixtla | 8991230491b16b0c7eb5d0dccd2fe64022ad8796 | [
"MIT"
] | 18 | 2021-11-03T18:49:40.000Z | 2022-03-31T22:34:54.000Z | import torch
assert torch.cuda.is_available()
assert torch.cuda.device_count() >= 1
print(f'Device name: {torch.cuda.get_device_name(0)} \n')
print(f'Current device: {torch.cuda.current_device()} \n')
| 22.666667 | 58 | 0.740196 | 33 | 204 | 4.424242 | 0.484848 | 0.246575 | 0.205479 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010811 | 0.093137 | 204 | 8 | 59 | 25.5 | 0.778378 | 0 | 0 | 0 | 0 | 0 | 0.465686 | 0.294118 | 0 | 0 | 0 | 0 | 0.4 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0.4 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
092bda385fcc06c7eaa98caa7951b0db7b0931eb | 32,827 | py | Python | venv/lib/python3.8/site-packages/spaceone/api/secret/v1/secret_group_pb2.py | choonho/plugin-prometheus-mon-webhook | afa7d65d12715fd0480fb4f92a9c62da2d6128e0 | [
"Apache-2.0"
] | null | null | null | venv/lib/python3.8/site-packages/spaceone/api/secret/v1/secret_group_pb2.py | choonho/plugin-prometheus-mon-webhook | afa7d65d12715fd0480fb4f92a9c62da2d6128e0 | [
"Apache-2.0"
] | null | null | null | venv/lib/python3.8/site-packages/spaceone/api/secret/v1/secret_group_pb2.py | choonho/plugin-prometheus-mon-webhook | afa7d65d12715fd0480fb4f92a9c62da2d6128e0 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: spaceone/api/secret/v1/secret_group.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.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
from spaceone.api.core.v1 import query_pb2 as spaceone_dot_api_dot_core_dot_v1_dot_query__pb2
from spaceone.api.secret.v1 import secret_pb2 as spaceone_dot_api_dot_secret_dot_v1_dot_secret__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='spaceone/api/secret/v1/secret_group.proto',
package='spaceone.api.secret.v1',
syntax='proto3',
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n)spaceone/api/secret/v1/secret_group.proto\x12\x16spaceone.api.secret.v1\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1cgoogle/api/annotations.proto\x1a spaceone/api/core/v1/query.proto\x1a#spaceone/api/secret/v1/secret.proto\"b\n\x18\x43reateSecretGroupRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12%\n\x04tags\x18\x02 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x11\n\tdomain_id\x18\x03 \x01(\t\"{\n\x18UpdateSecretGroupRequest\x12\x17\n\x0fsecret_group_id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12%\n\x04tags\x18\x03 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x11\n\tdomain_id\x18\x04 \x01(\t\"@\n\x12SecretGroupRequest\x12\x17\n\x0fsecret_group_id\x18\x01 \x01(\t\x12\x11\n\tdomain_id\x18\x02 \x01(\t\"Q\n\x15GetSecretGroupRequest\x12\x17\n\x0fsecret_group_id\x18\x01 \x01(\t\x12\x11\n\tdomain_id\x18\x02 \x01(\t\x12\x0c\n\x04only\x18\x03 \x03(\t\"Y\n\x18SecretGroupSecretRequest\x12\x17\n\x0fsecret_group_id\x18\x01 \x01(\t\x12\x11\n\tsecret_id\x18\x02 \x01(\t\x12\x11\n\tdomain_id\x18\x05 \x01(\t\"\x8b\x01\n\x10SecretGroupQuery\x12*\n\x05query\x18\x01 \x01(\x0b\x32\x1b.spaceone.api.core.v1.Query\x12\x17\n\x0fsecret_group_id\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x11\n\tsecret_id\x18\x04 \x01(\t\x12\x11\n\tdomain_id\x18\x05 \x01(\t\"\xa7\x01\n\x15SecretGroupSecretInfo\x12\x42\n\x11secret_group_info\x18\x01 \x01(\x0b\x32\'.spaceone.api.secret.v1.SecretGroupInfo\x12\x37\n\x0bsecret_info\x18\x02 \x01(\x0b\x32\".spaceone.api.secret.v1.SecretInfo\x12\x11\n\tdomain_id\x18\x05 \x01(\t\"\x86\x01\n\x0fSecretGroupInfo\x12\x17\n\x0fsecret_group_id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12%\n\x04tags\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x11\n\tdomain_id\x18\x05 \x01(\t\x12\x12\n\ncreated_at\x18\x06 \x01(\t\"a\n\x10SecretGroupsInfo\x12\x38\n\x07results\x18\x01 \x03(\x0b\x32\'.spaceone.api.secret.v1.SecretGroupInfo\x12\x13\n\x0btotal_count\x18\x02 \x01(\x05\"_\n\x14SecretGroupStatQuery\x12\x34\n\x05query\x18\x01 \x01(\x0b\x32%.spaceone.api.core.v1.StatisticsQuery\x12\x11\n\tdomain_id\x18\x02 \x01(\t2\xa7\t\n\x0bSecretGroup\x12\x85\x01\n\x06\x63reate\x12\x30.spaceone.api.secret.v1.CreateSecretGroupRequest\x1a\'.spaceone.api.secret.v1.SecretGroupInfo\" \x82\xd3\xe4\x93\x02\x1a\"\x18/secret/v1/secret-groups\x12\x96\x01\n\x06update\x12\x30.spaceone.api.secret.v1.UpdateSecretGroupRequest\x1a\'.spaceone.api.secret.v1.SecretGroupInfo\"1\x82\xd3\xe4\x93\x02+\x1a)/secret/v1/secret-group/{secret_group_id}\x12\xa8\x01\n\nadd_secret\x12\x30.spaceone.api.secret.v1.SecretGroupSecretRequest\x1a-.spaceone.api.secret.v1.SecretGroupSecretInfo\"9\x82\xd3\xe4\x93\x02\x33\"1/secret/v1/secret-group/{secret_group_id}/secrets\x12\x9f\x01\n\rremove_secret\x12\x30.spaceone.api.secret.v1.SecretGroupSecretRequest\x1a\x16.google.protobuf.Empty\"D\x82\xd3\xe4\x93\x02>*</secret/v1/secret-group/{secret_group_id}/secret/{secret_id}\x12\x7f\n\x06\x64\x65lete\x12*.spaceone.api.secret.v1.SecretGroupRequest\x1a\x16.google.protobuf.Empty\"1\x82\xd3\xe4\x93\x02+*)/secret/v1/secret-group/{secret_group_id}\x12\x90\x01\n\x03get\x12-.spaceone.api.secret.v1.GetSecretGroupRequest\x1a\'.spaceone.api.secret.v1.SecretGroupInfo\"1\x82\xd3\xe4\x93\x02+\x12)/secret/v1/secret-group/{secret_group_id}\x12\x9f\x01\n\x04list\x12(.spaceone.api.secret.v1.SecretGroupQuery\x1a(.spaceone.api.secret.v1.SecretGroupsInfo\"C\x82\xd3\xe4\x93\x02=\x12\x18/secret/v1/secret-groupsZ!\"\x1f/secret/v1/secret-groups/search\x12t\n\x04stat\x12,.spaceone.api.secret.v1.SecretGroupStatQuery\x1a\x17.google.protobuf.Struct\"%\x82\xd3\xe4\x93\x02\x1f\"\x1d/secret/v1/secret-groups/statb\x06proto3'
,
dependencies=[google_dot_protobuf_dot_empty__pb2.DESCRIPTOR,google_dot_protobuf_dot_struct__pb2.DESCRIPTOR,google_dot_api_dot_annotations__pb2.DESCRIPTOR,spaceone_dot_api_dot_core_dot_v1_dot_query__pb2.DESCRIPTOR,spaceone_dot_api_dot_secret_dot_v1_dot_secret__pb2.DESCRIPTOR,])
_CREATESECRETGROUPREQUEST = _descriptor.Descriptor(
name='CreateSecretGroupRequest',
full_name='spaceone.api.secret.v1.CreateSecretGroupRequest',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='spaceone.api.secret.v1.CreateSecretGroupRequest.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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='tags', full_name='spaceone.api.secret.v1.CreateSecretGroupRequest.tags', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='domain_id', full_name='spaceone.api.secret.v1.CreateSecretGroupRequest.domain_id', index=2,
number=3, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=229,
serialized_end=327,
)
_UPDATESECRETGROUPREQUEST = _descriptor.Descriptor(
name='UpdateSecretGroupRequest',
full_name='spaceone.api.secret.v1.UpdateSecretGroupRequest',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='secret_group_id', full_name='spaceone.api.secret.v1.UpdateSecretGroupRequest.secret_group_id', 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='name', full_name='spaceone.api.secret.v1.UpdateSecretGroupRequest.name', index=1,
number=2, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='tags', full_name='spaceone.api.secret.v1.UpdateSecretGroupRequest.tags', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='domain_id', full_name='spaceone.api.secret.v1.UpdateSecretGroupRequest.domain_id', index=3,
number=4, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=329,
serialized_end=452,
)
_SECRETGROUPREQUEST = _descriptor.Descriptor(
name='SecretGroupRequest',
full_name='spaceone.api.secret.v1.SecretGroupRequest',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='secret_group_id', full_name='spaceone.api.secret.v1.SecretGroupRequest.secret_group_id', 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='domain_id', full_name='spaceone.api.secret.v1.SecretGroupRequest.domain_id', index=1,
number=2, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=454,
serialized_end=518,
)
_GETSECRETGROUPREQUEST = _descriptor.Descriptor(
name='GetSecretGroupRequest',
full_name='spaceone.api.secret.v1.GetSecretGroupRequest',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='secret_group_id', full_name='spaceone.api.secret.v1.GetSecretGroupRequest.secret_group_id', 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='domain_id', full_name='spaceone.api.secret.v1.GetSecretGroupRequest.domain_id', index=1,
number=2, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='only', full_name='spaceone.api.secret.v1.GetSecretGroupRequest.only', index=2,
number=3, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=520,
serialized_end=601,
)
_SECRETGROUPSECRETREQUEST = _descriptor.Descriptor(
name='SecretGroupSecretRequest',
full_name='spaceone.api.secret.v1.SecretGroupSecretRequest',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='secret_group_id', full_name='spaceone.api.secret.v1.SecretGroupSecretRequest.secret_group_id', 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='secret_id', full_name='spaceone.api.secret.v1.SecretGroupSecretRequest.secret_id', index=1,
number=2, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='domain_id', full_name='spaceone.api.secret.v1.SecretGroupSecretRequest.domain_id', index=2,
number=5, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=603,
serialized_end=692,
)
_SECRETGROUPQUERY = _descriptor.Descriptor(
name='SecretGroupQuery',
full_name='spaceone.api.secret.v1.SecretGroupQuery',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='query', full_name='spaceone.api.secret.v1.SecretGroupQuery.query', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='secret_group_id', full_name='spaceone.api.secret.v1.SecretGroupQuery.secret_group_id', index=1,
number=2, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='name', full_name='spaceone.api.secret.v1.SecretGroupQuery.name', index=2,
number=3, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='secret_id', full_name='spaceone.api.secret.v1.SecretGroupQuery.secret_id', index=3,
number=4, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='domain_id', full_name='spaceone.api.secret.v1.SecretGroupQuery.domain_id', index=4,
number=5, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=695,
serialized_end=834,
)
_SECRETGROUPSECRETINFO = _descriptor.Descriptor(
name='SecretGroupSecretInfo',
full_name='spaceone.api.secret.v1.SecretGroupSecretInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='secret_group_info', full_name='spaceone.api.secret.v1.SecretGroupSecretInfo.secret_group_info', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='secret_info', full_name='spaceone.api.secret.v1.SecretGroupSecretInfo.secret_info', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='domain_id', full_name='spaceone.api.secret.v1.SecretGroupSecretInfo.domain_id', index=2,
number=5, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=837,
serialized_end=1004,
)
_SECRETGROUPINFO = _descriptor.Descriptor(
name='SecretGroupInfo',
full_name='spaceone.api.secret.v1.SecretGroupInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='secret_group_id', full_name='spaceone.api.secret.v1.SecretGroupInfo.secret_group_id', 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='name', full_name='spaceone.api.secret.v1.SecretGroupInfo.name', index=1,
number=2, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='tags', full_name='spaceone.api.secret.v1.SecretGroupInfo.tags', index=2,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='domain_id', full_name='spaceone.api.secret.v1.SecretGroupInfo.domain_id', index=3,
number=5, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='created_at', full_name='spaceone.api.secret.v1.SecretGroupInfo.created_at', index=4,
number=6, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1007,
serialized_end=1141,
)
_SECRETGROUPSINFO = _descriptor.Descriptor(
name='SecretGroupsInfo',
full_name='spaceone.api.secret.v1.SecretGroupsInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='results', full_name='spaceone.api.secret.v1.SecretGroupsInfo.results', index=0,
number=1, type=11, cpp_type=10, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='total_count', full_name='spaceone.api.secret.v1.SecretGroupsInfo.total_count', index=1,
number=2, type=5, cpp_type=1, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1143,
serialized_end=1240,
)
_SECRETGROUPSTATQUERY = _descriptor.Descriptor(
name='SecretGroupStatQuery',
full_name='spaceone.api.secret.v1.SecretGroupStatQuery',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='query', full_name='spaceone.api.secret.v1.SecretGroupStatQuery.query', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='domain_id', full_name='spaceone.api.secret.v1.SecretGroupStatQuery.domain_id', index=1,
number=2, 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=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1242,
serialized_end=1337,
)
_CREATESECRETGROUPREQUEST.fields_by_name['tags'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT
_UPDATESECRETGROUPREQUEST.fields_by_name['tags'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT
_SECRETGROUPQUERY.fields_by_name['query'].message_type = spaceone_dot_api_dot_core_dot_v1_dot_query__pb2._QUERY
_SECRETGROUPSECRETINFO.fields_by_name['secret_group_info'].message_type = _SECRETGROUPINFO
_SECRETGROUPSECRETINFO.fields_by_name['secret_info'].message_type = spaceone_dot_api_dot_secret_dot_v1_dot_secret__pb2._SECRETINFO
_SECRETGROUPINFO.fields_by_name['tags'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT
_SECRETGROUPSINFO.fields_by_name['results'].message_type = _SECRETGROUPINFO
_SECRETGROUPSTATQUERY.fields_by_name['query'].message_type = spaceone_dot_api_dot_core_dot_v1_dot_query__pb2._STATISTICSQUERY
DESCRIPTOR.message_types_by_name['CreateSecretGroupRequest'] = _CREATESECRETGROUPREQUEST
DESCRIPTOR.message_types_by_name['UpdateSecretGroupRequest'] = _UPDATESECRETGROUPREQUEST
DESCRIPTOR.message_types_by_name['SecretGroupRequest'] = _SECRETGROUPREQUEST
DESCRIPTOR.message_types_by_name['GetSecretGroupRequest'] = _GETSECRETGROUPREQUEST
DESCRIPTOR.message_types_by_name['SecretGroupSecretRequest'] = _SECRETGROUPSECRETREQUEST
DESCRIPTOR.message_types_by_name['SecretGroupQuery'] = _SECRETGROUPQUERY
DESCRIPTOR.message_types_by_name['SecretGroupSecretInfo'] = _SECRETGROUPSECRETINFO
DESCRIPTOR.message_types_by_name['SecretGroupInfo'] = _SECRETGROUPINFO
DESCRIPTOR.message_types_by_name['SecretGroupsInfo'] = _SECRETGROUPSINFO
DESCRIPTOR.message_types_by_name['SecretGroupStatQuery'] = _SECRETGROUPSTATQUERY
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
CreateSecretGroupRequest = _reflection.GeneratedProtocolMessageType('CreateSecretGroupRequest', (_message.Message,), {
'DESCRIPTOR' : _CREATESECRETGROUPREQUEST,
'__module__' : 'spaceone.api.secret.v1.secret_group_pb2'
# @@protoc_insertion_point(class_scope:spaceone.api.secret.v1.CreateSecretGroupRequest)
})
_sym_db.RegisterMessage(CreateSecretGroupRequest)
UpdateSecretGroupRequest = _reflection.GeneratedProtocolMessageType('UpdateSecretGroupRequest', (_message.Message,), {
'DESCRIPTOR' : _UPDATESECRETGROUPREQUEST,
'__module__' : 'spaceone.api.secret.v1.secret_group_pb2'
# @@protoc_insertion_point(class_scope:spaceone.api.secret.v1.UpdateSecretGroupRequest)
})
_sym_db.RegisterMessage(UpdateSecretGroupRequest)
SecretGroupRequest = _reflection.GeneratedProtocolMessageType('SecretGroupRequest', (_message.Message,), {
'DESCRIPTOR' : _SECRETGROUPREQUEST,
'__module__' : 'spaceone.api.secret.v1.secret_group_pb2'
# @@protoc_insertion_point(class_scope:spaceone.api.secret.v1.SecretGroupRequest)
})
_sym_db.RegisterMessage(SecretGroupRequest)
GetSecretGroupRequest = _reflection.GeneratedProtocolMessageType('GetSecretGroupRequest', (_message.Message,), {
'DESCRIPTOR' : _GETSECRETGROUPREQUEST,
'__module__' : 'spaceone.api.secret.v1.secret_group_pb2'
# @@protoc_insertion_point(class_scope:spaceone.api.secret.v1.GetSecretGroupRequest)
})
_sym_db.RegisterMessage(GetSecretGroupRequest)
SecretGroupSecretRequest = _reflection.GeneratedProtocolMessageType('SecretGroupSecretRequest', (_message.Message,), {
'DESCRIPTOR' : _SECRETGROUPSECRETREQUEST,
'__module__' : 'spaceone.api.secret.v1.secret_group_pb2'
# @@protoc_insertion_point(class_scope:spaceone.api.secret.v1.SecretGroupSecretRequest)
})
_sym_db.RegisterMessage(SecretGroupSecretRequest)
SecretGroupQuery = _reflection.GeneratedProtocolMessageType('SecretGroupQuery', (_message.Message,), {
'DESCRIPTOR' : _SECRETGROUPQUERY,
'__module__' : 'spaceone.api.secret.v1.secret_group_pb2'
# @@protoc_insertion_point(class_scope:spaceone.api.secret.v1.SecretGroupQuery)
})
_sym_db.RegisterMessage(SecretGroupQuery)
SecretGroupSecretInfo = _reflection.GeneratedProtocolMessageType('SecretGroupSecretInfo', (_message.Message,), {
'DESCRIPTOR' : _SECRETGROUPSECRETINFO,
'__module__' : 'spaceone.api.secret.v1.secret_group_pb2'
# @@protoc_insertion_point(class_scope:spaceone.api.secret.v1.SecretGroupSecretInfo)
})
_sym_db.RegisterMessage(SecretGroupSecretInfo)
SecretGroupInfo = _reflection.GeneratedProtocolMessageType('SecretGroupInfo', (_message.Message,), {
'DESCRIPTOR' : _SECRETGROUPINFO,
'__module__' : 'spaceone.api.secret.v1.secret_group_pb2'
# @@protoc_insertion_point(class_scope:spaceone.api.secret.v1.SecretGroupInfo)
})
_sym_db.RegisterMessage(SecretGroupInfo)
SecretGroupsInfo = _reflection.GeneratedProtocolMessageType('SecretGroupsInfo', (_message.Message,), {
'DESCRIPTOR' : _SECRETGROUPSINFO,
'__module__' : 'spaceone.api.secret.v1.secret_group_pb2'
# @@protoc_insertion_point(class_scope:spaceone.api.secret.v1.SecretGroupsInfo)
})
_sym_db.RegisterMessage(SecretGroupsInfo)
SecretGroupStatQuery = _reflection.GeneratedProtocolMessageType('SecretGroupStatQuery', (_message.Message,), {
'DESCRIPTOR' : _SECRETGROUPSTATQUERY,
'__module__' : 'spaceone.api.secret.v1.secret_group_pb2'
# @@protoc_insertion_point(class_scope:spaceone.api.secret.v1.SecretGroupStatQuery)
})
_sym_db.RegisterMessage(SecretGroupStatQuery)
_SECRETGROUP = _descriptor.ServiceDescriptor(
name='SecretGroup',
full_name='spaceone.api.secret.v1.SecretGroup',
file=DESCRIPTOR,
index=0,
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_start=1340,
serialized_end=2531,
methods=[
_descriptor.MethodDescriptor(
name='create',
full_name='spaceone.api.secret.v1.SecretGroup.create',
index=0,
containing_service=None,
input_type=_CREATESECRETGROUPREQUEST,
output_type=_SECRETGROUPINFO,
serialized_options=b'\202\323\344\223\002\032\"\030/secret/v1/secret-groups',
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='update',
full_name='spaceone.api.secret.v1.SecretGroup.update',
index=1,
containing_service=None,
input_type=_UPDATESECRETGROUPREQUEST,
output_type=_SECRETGROUPINFO,
serialized_options=b'\202\323\344\223\002+\032)/secret/v1/secret-group/{secret_group_id}',
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='add_secret',
full_name='spaceone.api.secret.v1.SecretGroup.add_secret',
index=2,
containing_service=None,
input_type=_SECRETGROUPSECRETREQUEST,
output_type=_SECRETGROUPSECRETINFO,
serialized_options=b'\202\323\344\223\0023\"1/secret/v1/secret-group/{secret_group_id}/secrets',
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='remove_secret',
full_name='spaceone.api.secret.v1.SecretGroup.remove_secret',
index=3,
containing_service=None,
input_type=_SECRETGROUPSECRETREQUEST,
output_type=google_dot_protobuf_dot_empty__pb2._EMPTY,
serialized_options=b'\202\323\344\223\002>*</secret/v1/secret-group/{secret_group_id}/secret/{secret_id}',
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='delete',
full_name='spaceone.api.secret.v1.SecretGroup.delete',
index=4,
containing_service=None,
input_type=_SECRETGROUPREQUEST,
output_type=google_dot_protobuf_dot_empty__pb2._EMPTY,
serialized_options=b'\202\323\344\223\002+*)/secret/v1/secret-group/{secret_group_id}',
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='get',
full_name='spaceone.api.secret.v1.SecretGroup.get',
index=5,
containing_service=None,
input_type=_GETSECRETGROUPREQUEST,
output_type=_SECRETGROUPINFO,
serialized_options=b'\202\323\344\223\002+\022)/secret/v1/secret-group/{secret_group_id}',
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='list',
full_name='spaceone.api.secret.v1.SecretGroup.list',
index=6,
containing_service=None,
input_type=_SECRETGROUPQUERY,
output_type=_SECRETGROUPSINFO,
serialized_options=b'\202\323\344\223\002=\022\030/secret/v1/secret-groupsZ!\"\037/secret/v1/secret-groups/search',
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='stat',
full_name='spaceone.api.secret.v1.SecretGroup.stat',
index=7,
containing_service=None,
input_type=_SECRETGROUPSTATQUERY,
output_type=google_dot_protobuf_dot_struct__pb2._STRUCT,
serialized_options=b'\202\323\344\223\002\037\"\035/secret/v1/secret-groups/stat',
create_key=_descriptor._internal_create_key,
),
])
_sym_db.RegisterServiceDescriptor(_SECRETGROUP)
DESCRIPTOR.services_by_name['SecretGroup'] = _SECRETGROUP
# @@protoc_insertion_point(module_scope)
| 47.233094 | 3,666 | 0.771286 | 4,184 | 32,827 | 5.732075 | 0.062141 | 0.03736 | 0.043114 | 0.073677 | 0.776675 | 0.721303 | 0.703957 | 0.644915 | 0.613351 | 0.584998 | 0 | 0.040826 | 0.104609 | 32,827 | 694 | 3,667 | 47.301153 | 0.775117 | 0.032077 | 0 | 0.664567 | 1 | 0.015748 | 0.23027 | 0.195408 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.014173 | 0 | 0.014173 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 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 | 4 |
095e5804a66616f8f6279113e8d2696b7eff8150 | 27,316 | py | Python | tests/test_token_lib.py | kichinosukey/bbc1-lib-tokens | 891e108bd4a429d3fe82f846dfe25b0efce3dffc | [
"Apache-2.0"
] | null | null | null | tests/test_token_lib.py | kichinosukey/bbc1-lib-tokens | 891e108bd4a429d3fe82f846dfe25b0efce3dffc | [
"Apache-2.0"
] | null | null | null | tests/test_token_lib.py | kichinosukey/bbc1-lib-tokens | 891e108bd4a429d3fe82f846dfe25b0efce3dffc | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import sys
import time
sys.path.extend(["../"])
from bbc1.app import id_lib, token_lib
from bbc1.core import bbc_app
from bbc1.core import bbclib
from bbc1.core.bbc_config import DEFAULT_CORE_PORT
domain_id = None
mint_id = None
idPubkeyMap = None
keypairs = None
def setup():
global domain_id
global mint_id
global idPubkeyMap
global keypairs
domain_id = bbclib.get_new_id("test_token_lib", include_timestamp=False)
tmpclient = bbc_app.BBcAppClient(port=DEFAULT_CORE_PORT, loglevel="all")
tmpclient.domain_setup(domain_id, "simple_cluster")
tmpclient.callback.synchronize()
tmpclient.unregister_from_core()
idPubkeyMap = id_lib.BBcIdPublickeyMap(domain_id)
(mint_id, keypairs) = idPubkeyMap.create_user_id(num_pubkeys=1)
def test_fraction():
frac = token_lib.Fraction(2, 3)
assert frac.numerator == 2
assert frac.denominator == 3
assert frac.is_positive_or_zero() == True
frac = token_lib.Fraction('-1/100')
assert frac.numerator == -1
assert frac.denominator == 100
assert frac.is_positive_or_zero() == False
dat = frac.serialize()
idx, frac = token_lib.Fraction.from_serialized_data(0, dat)
assert idx == 1 + 2 + 2
assert frac.numerator == -1
assert frac.denominator == 100
frac = token_lib.Fraction(4, 5)
dat = frac.serialize()
_, frac = token_lib.Fraction.from_serialized_data(0, dat)
assert frac.numerator == 4
assert frac.denominator == 5
frac = frac * token_lib.Fraction(2, 3)
assert frac.numerator == 8
assert frac.denominator == 15
v = frac * 100
assert v == 53
try:
v = frac * '100'
except TypeError:
v = 1
assert v == 1
frac = frac + 1
assert frac.numerator == 23
assert frac.denominator == 15
frac = frac ** 2
assert frac.numerator == 529
assert frac.denominator == 225
try:
frac = frac ** '100'
except TypeError:
v = 10
assert v == 10
def test_variation():
rate = token_lib.Fraction(-1, 10)
rate_to_stop = token_lib.Fraction(1, 2)
time_unit = 60 * 60 * 24 * 7
expire_after = 60 * 60 * 24 * 30
vari = token_lib.Variation(0, token_lib.Variation.T_SIMPLE, rate,
rate_to_stop, time_unit, expire_after)
vari0 = vari
dat = vari.serialize()
idx, vari = token_lib.Variation.from_serialized_data(0, dat)
assert idx == 1 + 1 + 5 + 5 + 8 + 8
assert vari.condition == 0
assert vari.type == token_lib.Variation.T_SIMPLE
assert vari.rate == rate
assert vari.rate_to_stop == rate_to_stop
assert vari.time_unit == time_unit
assert vari.expire_after == expire_after
assert vari == vari0
def test_value_asset_body():
rate = token_lib.Fraction(-1, 100)
rate_to_stop = token_lib.Fraction(1, 3)
time_unit = 60 * 60 * 24 * 30
expire_after = 60 * 60 * 24 * 180
vari = token_lib.Variation(0, token_lib.Variation.T_SIMPLE, rate,
rate_to_stop, time_unit, expire_after)
body = token_lib.ValueAssetBody(100, 12345, [vari])
dat = body.serialize()
_, body = token_lib.BaseAssetBody.from_serialized_data(0, dat)
assert body.type == token_lib.BaseAssetBody.T_VALUE
assert body.value_specified == 100
assert body.time_of_origin == 12345
assert body.variation_specs[0].condition == vari.condition
assert body.variation_specs[0].type == vari.type
assert body.variation_specs[0].rate == vari.rate
assert body.variation_specs[0].rate_to_stop == vari.rate_to_stop
assert body.variation_specs[0].time_unit == vari.time_unit
assert body.variation_specs[0].expire_after == vari.expire_after
def test_asset_body_types():
rate = token_lib.Fraction(-1, 100)
rate_to_stop = token_lib.Fraction(1, 3)
time_unit = 60 * 60 * 24 * 30
expire_after = 60 * 60 * 24 * 180
vari = token_lib.Variation(0, token_lib.Variation.T_SIMPLE, rate,
rate_to_stop, time_unit, expire_after)
body = token_lib.ValueAssetBody(100, 12345, [vari])
dat = body.serialize()
_, body = token_lib.BaseAssetBody.from_serialized_data(0, dat)
assert body.type == token_lib.BaseAssetBody.T_VALUE
body = token_lib.ChangeAssetBody(100, 12345, [vari])
dat = body.serialize()
_, body = token_lib.BaseAssetBody.from_serialized_data(0, dat)
assert body.type == token_lib.BaseAssetBody.T_CHANGE
body = token_lib.IssuedAssetBody(100, 12345, [vari])
dat = body.serialize()
_, body = token_lib.BaseAssetBody.from_serialized_data(0, dat)
assert body.type == token_lib.BaseAssetBody.T_ISSUED
def test_effective_value():
rate = token_lib.Fraction(-1, 10)
rate_to_stop = token_lib.Fraction(1, 2)
time_unit = 100
expire_after = 0
vari = token_lib.Variation(0, token_lib.Variation.T_SIMPLE, rate,
rate_to_stop, time_unit, expire_after)
body = token_lib.ValueAssetBody(100, 10, [vari])
assert body.get_effective_value(0) == 100
assert body.get_effective_value(100) == 100
assert body.get_effective_value(110) == 90
assert body.get_effective_value(120) == 90
assert body.get_effective_value(510) == 50
assert body.get_effective_value(520) == 50
assert body.get_effective_value(610) == 50
assert body.get_effective_value(10000) == 50
rate = token_lib.Fraction(1, 10)
rate_to_stop = token_lib.Fraction(2, 1)
vari = token_lib.Variation(0, token_lib.Variation.T_SIMPLE, rate,
rate_to_stop, time_unit, expire_after)
body = token_lib.ValueAssetBody(100, 10, [vari])
assert body.get_effective_value(0) == 100
assert body.get_effective_value(100) == 100
assert body.get_effective_value(110) == 110
assert body.get_effective_value(120) == 110
assert body.get_effective_value(1010) == 200
assert body.get_effective_value(1020) == 200
assert body.get_effective_value(1110) == 200
assert body.get_effective_value(10000) == 200
rate = token_lib.Fraction(-1, 10)
rate_to_stop = token_lib.Fraction(0, 1)
vari = token_lib.Variation(0, token_lib.Variation.T_SIMPLE, rate,
rate_to_stop, time_unit, expire_after)
body = token_lib.ValueAssetBody(100, 10, [vari])
assert body.get_effective_value(0) == 100
assert body.get_effective_value(100) == 100
assert body.get_effective_value(110) == 90
assert body.get_effective_value(120) == 90
assert body.get_effective_value(1010) == 0
assert body.get_effective_value(1020) == 0
assert body.get_effective_value(1110) == 0
assert body.get_effective_value(10000) == 0
vari = token_lib.Variation(0, token_lib.Variation.T_COMPOUND, rate,
rate_to_stop, time_unit, expire_after)
body = token_lib.ValueAssetBody(100, 10, [vari])
assert body.get_effective_value(0) == 100
assert body.get_effective_value(100) == 100
assert body.get_effective_value(110) == 90
assert body.get_effective_value(120) == 90
assert body.get_effective_value(210) == 81
assert body.get_effective_value(310) == 72
assert body.get_effective_value(410) == 65
vari = token_lib.Variation()
body = token_lib.ValueAssetBody(100, 10, [vari])
assert body.get_effective_value(0) == 100
assert body.get_effective_value(100) == 100
assert body.get_effective_value(110) == 100
assert body.get_effective_value(120) == 100
assert body.get_effective_value(10000) == 100
vari = token_lib.Variation(type=token_lib.Variation.T_COMPOUND)
body = token_lib.ValueAssetBody(100, 10, [vari])
assert body.get_effective_value(0) == 100
assert body.get_effective_value(100) == 100
assert body.get_effective_value(110) == 100
assert body.get_effective_value(120) == 100
assert body.get_effective_value(10000) == 100
vari = token_lib.Variation(expire_after=500)
body = token_lib.ValueAssetBody(100, 10, [vari])
assert body.get_effective_value(0) == 100
assert body.get_effective_value(100) == 100
assert body.get_effective_value(110) == 100
assert body.get_effective_value(120) == 100
assert body.get_effective_value(509) == 100
assert body.get_effective_value(510) == 0
assert body.get_effective_value(10000) == 0
body = token_lib.ValueAssetBody(100, 10, [])
assert body.get_effective_value(0) == 100
assert body.get_effective_value(510) == 100
assert body.get_effective_value(10000) == 100
# FIXME: test_next_update_time
# FIXME: test_expected_loss_or_gain
def test_currency_spec():
rate = token_lib.Fraction(-1, 10)
rate_to_stop = token_lib.Fraction(1, 2)
time_unit = 100
expire_after = 0
name = "Japanese Yen"
symbol = "JPY"
decimal = 2
currency_spec_dict = {
'name': name,
'symbol': symbol,
'decimal': decimal,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "0",
'rate_to_stop': "1/1",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
},
{
'condition': 1,
'variation_type': "simple",
'rate': "-1/100",
'rate_to_stop': "0",
'time_unit': 60*60*24*30,
'expire_after': 60*60*24*180,
},
],
'option_witnesses_required': True,
'option_expiration_rebased': True,
'option_conditions_irreversible': False,
}
spec = token_lib.CurrencySpec(currency_spec_dict)
assert spec.name == name
assert spec.symbol == symbol
assert spec.decimal == decimal
assert len(spec.variation_specs) == 2
assert spec.variation_specs[0].condition == 0
assert spec.variation_specs[0].type == token_lib.Variation.T_SIMPLE
assert spec.variation_specs[0].rate == 0
assert spec.variation_specs[0].rate_to_stop == 1
assert spec.variation_specs[0].time_unit == 0x7fffffffffffffff
assert spec.variation_specs[0].expire_after == 0
assert spec.variation_specs[1].condition == 1
assert spec.variation_specs[1].type == token_lib.Variation.T_SIMPLE
assert spec.variation_specs[1].rate == token_lib.Fraction("-1/100")
assert spec.variation_specs[1].rate_to_stop == 0
assert spec.variation_specs[1].time_unit == 60*60*24*30
assert spec.variation_specs[1].expire_after == 60*60*24*180
assert spec.option_witnesses_required == True
assert spec.option_expiration_rebased == True
assert spec.option_conditions_irreversible == False
spec1 = token_lib.CurrencySpec(currency_spec_dict)
assert spec1 == spec
dat = spec1.serialize()
_, spec2 = token_lib.CurrencySpec.from_serialized_data(0, dat)
assert spec2 == spec1 == spec
currency_spec_dict = {
'name': "Whatever",
'symbol': "WTV",
}
spec = token_lib.CurrencySpec(currency_spec_dict)
assert not spec2 == spec
assert spec.decimal == 0
assert len(spec.variation_specs) == 0
assert spec.option_witnesses_required == False
assert spec.option_expiration_rebased == False
assert spec.option_conditions_irreversible == True
currency_spec_dict = {
'name': 123,
'symbol': symbol,
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 10
assert spec == 10
currency_spec_dict = {
'name': "US Dollar",
'symbol': 31,
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 1
assert spec == 1
currency_spec_dict = {
'name': "US Dollar",
'symbol': "USD",
'decimal': "2",
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 13
assert spec == 13
currency_spec_dict = {
'name': "US Dollar",
'symbol': "USD",
'decimal': -1,
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 14
assert spec == 14
currency_spec_dict = {
'name': "US Dollar",
'symbol': "USD",
'decimal': 13,
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 15
assert spec == 15
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "0",
'rate_to_stop': "1/1",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 16
assert not spec == 16
assert len(spec.variation_specs) == 1
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': "0",
'variation_type': "simple",
'rate': "0",
'rate_to_stop': "1/1",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 17
assert spec == 17
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': -1,
'variation_type': "simple",
'rate': "0",
'rate_to_stop': "1/1",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 18
assert spec == 18
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 128,
'variation_type': "simple",
'rate': "0",
'rate_to_stop': "1/1",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 19
assert spec == 19
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': 4,
'rate': "0",
'rate_to_stop': "1/1",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 20
assert spec == 20
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': "exact",
'rate': "0",
'rate_to_stop': "1/1",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 21
assert spec == 21
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "1/32768",
'rate_to_stop': "1/1",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 22
assert spec == 22
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "32768/32761",
'rate_to_stop': "1/1",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 23
assert spec == 23
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "1/100",
'rate_to_stop': "32768/32761",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 24
assert spec == 24
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "-1/100",
'rate_to_stop': "2/1",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 25
assert spec == 25
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "-1/100",
'rate_to_stop': "32761/32768",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 26
assert spec == 26
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "1/100",
'rate_to_stop': "1/2",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 27
assert spec == 27
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "-1/100",
'rate_to_stop': "1/2",
'time_unit': 0x8fffffffffffffff,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 28
assert spec == 28
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "-1/100",
'rate_to_stop': "1/2",
'time_unit': -1,
'expire_after': 0,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 29
assert spec == 29
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "-1/100",
'rate_to_stop': "1/2",
'time_unit': 0x7fffffffffffffff,
'expire_after': -1,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 30
assert spec == 30
currency_spec_dict = {
'name': name,
'symbol': symbol,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "-1/100",
'rate_to_stop': "1/2",
'time_unit': 0x7fffffffffffffff,
'expire_after': 0x8000000000000000,
}
],
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 31
assert spec == 31
currency_spec_dict = {
'name': name,
'symbol': symbol,
'option_witnesses_required': "yes",
'option_expiration_rebased': True,
'option_conditions_irreversible': False,
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 31.5
assert spec == 31.5
currency_spec_dict = {
'name': name,
'symbol': symbol,
'option_witnesses_required': "yes",
'option_expiration_rebased': "yes",
'option_conditions_irreversible': False,
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 32
assert spec == 32
currency_spec_dict = {
'name': name,
'symbol': symbol,
'option_witnesses_required': True,
'option_expiration_rebased': True,
'option_conditions_irreversible': "no",
}
try:
spec = token_lib.CurrencySpec(currency_spec_dict)
except TypeError:
spec = 33
assert spec == 33
def test_condition_asset_body():
condition = 30
body = token_lib.ConditionAssetBody(condition)
dat = body.serialize()
idx, body = token_lib.ConditionAssetBody.from_serialized_data(0, dat)
assert idx == 1
assert body.condition == condition
def test_store():
(mint_id, keypairs) = idPubkeyMap.create_user_id(num_pubkeys=1)
app = bbc_app.BBcAppClient(port=DEFAULT_CORE_PORT, loglevel="all")
app.set_user_id(mint_id)
app.set_domain_id(domain_id)
app.set_callback(bbc_app.Callback())
ret = app.register_to_core()
store = token_lib.Store(domain_id, mint_id, app)
currency_spec = token_lib.CurrencySpec({
'name': "Japanese Yen",
'symbol': "JPY",
})
store.set_condition(0, keypair=keypairs[0], idPublickeyMap=idPubkeyMap)
store.set_currency_spec(currency_spec, keypair=keypairs[0],
idPublickeyMap=idPubkeyMap)
assert store.get_condition() == 0
assert store.get_currency_spec() == currency_spec
def test_mint():
currency_spec = token_lib.CurrencySpec({
'name': "BBc Point",
'symbol': "BBP",
})
mint = token_lib.BBcMint(domain_id, mint_id, mint_id, idPubkeyMap)
mint.set_condition(0, keypair=keypairs[0])
mint.set_currency_spec(currency_spec, keypair=keypairs[0])
assert mint.get_condition() == 0
assert mint.get_currency_spec() == currency_spec
(user_a_id, keypairs_a) = idPubkeyMap.create_user_id(num_pubkeys=1)
(user_b_id, keypairs_b) = idPubkeyMap.create_user_id(num_pubkeys=1)
mint.issue(user_a_id, 1000, keypair=keypairs[0])
assert mint.get_balance_of(user_a_id) == 1000
assert mint.get_balance_of(user_b_id) == 0
mint.transfer(user_a_id, user_b_id, 100,
keypair_from=keypairs_a[0], keypair_mint=keypairs[0])
assert mint.get_balance_of(user_a_id) == 900
assert mint.get_balance_of(user_b_id) == 100
mint.issue(user_a_id, 10, keypair=keypairs[0])
assert mint.get_balance_of(user_a_id) == 910
assert mint.get_balance_of(user_b_id) == 100
mint.transfer(user_a_id, user_b_id, 100,
keypair_from=keypairs_a[0], keypair_mint=keypairs[0])
assert mint.get_balance_of(user_a_id) == 810
assert mint.get_balance_of(user_b_id) == 200
def test_mint_depreciation():
currency_spec = token_lib.CurrencySpec({
'name': 'BBc X',
'symbol': 'BBX',
'decimal': 2,
'variation_specs': [
{
'condition': 0,
'variation_type': "simple",
'rate': "-1/100",
'rate_to_stop': 0,
'time_unit': 4,
'expire_after': 0,
}
],
})
mint = token_lib.BBcMint(domain_id, mint_id, mint_id, idPubkeyMap)
mint.set_condition(0, keypair=keypairs[0])
mint.set_currency_spec(currency_spec, keypair=keypairs[0])
assert mint.get_condition() == 0
assert mint.get_currency_spec() == currency_spec
(user_a_id, keypairs_a) = idPubkeyMap.create_user_id(num_pubkeys=1)
(user_b_id, keypairs_b) = idPubkeyMap.create_user_id(num_pubkeys=1)
mint.issue(user_a_id, 100000, keypair=keypairs[0])
assert mint.get_balance_of(user_a_id) == 100000
assert mint.get_balance_of(user_b_id) == 0
print("\n5-second interval.")
time.sleep(5)
assert mint.get_balance_of(user_a_id) == 99000
assert mint.get_balance_of(user_b_id) == 0
mint.transfer(user_a_id, user_b_id, 10000,
keypair_from=keypairs_a[0], keypair_mint=keypairs[0])
assert mint.get_balance_of(user_a_id) == 88999
assert mint.get_balance_of(user_b_id) == 10000
mint.issue(user_a_id, 1000, keypair=keypairs[0])
assert mint.get_balance_of(user_a_id) == 89999
assert mint.get_balance_of(user_b_id) == 10000
mint.transfer(user_a_id, user_b_id, 10000,
keypair_from=keypairs_a[0], keypair_mint=keypairs[0])
assert mint.get_balance_of(user_a_id) == 79998
assert mint.get_balance_of(user_b_id) == 20000
def test_mint_sign_requested():
currency_spec = token_lib.CurrencySpec({
'name': "BBc Point",
'symbol': "BBP",
})
mint = token_lib.BBcMint(domain_id, mint_id, mint_id, idPubkeyMap)
mint.set_condition(0, keypair=keypairs[0])
mint.set_currency_spec(currency_spec, keypair=keypairs[0])
assert mint.get_condition() == 0
assert mint.get_currency_spec() == currency_spec
(user_a_id, keypairs_a) = idPubkeyMap.create_user_id(num_pubkeys=1)
(user_b_id, keypairs_b) = idPubkeyMap.create_user_id(num_pubkeys=1)
mint_a = token_lib.BBcMint(domain_id, mint_id, user_a_id, idPubkeyMap)
mint_a.store.set_db_online(False)
mint.set_keypair(keypairs[0])
mint.issue(user_a_id, 1000, keypair=keypairs[0])
assert mint.get_balance_of(user_a_id) == 1000
assert mint.get_balance_of(user_b_id) == 0
mint_a.transfer(user_a_id, user_b_id, 100,
keypair_from=keypairs_a[0])
assert mint.get_balance_of(user_a_id) == 900
assert mint.get_balance_of(user_b_id) == 100
mint.issue(user_a_id, 10, keypair=keypairs[0])
assert mint.get_balance_of(user_a_id) == 910
assert mint.get_balance_of(user_b_id) == 100
mint_a.transfer(user_a_id, user_b_id, 100,
keypair_from=keypairs_a[0])
assert mint.get_balance_of(user_a_id) == 810
assert mint.get_balance_of(user_b_id) == 200
# end of tests/test_token_lib.py
| 26.912315 | 76 | 0.593059 | 3,269 | 27,316 | 4.670236 | 0.071276 | 0.055021 | 0.055545 | 0.073492 | 0.819283 | 0.764394 | 0.711142 | 0.694766 | 0.66444 | 0.642169 | 0 | 0.057898 | 0.294992 | 27,316 | 1,014 | 77 | 26.938856 | 0.734863 | 0.00421 | 0 | 0.586873 | 0 | 0 | 0.092992 | 0.011766 | 0 | 0 | 0.011914 | 0.000986 | 0.230373 | 1 | 0.015444 | false | 0 | 0.007722 | 0 | 0.023166 | 0.001287 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
11845c2c62fa3aaef0c51c5aaf1b2b06a0d0c4ad | 155 | py | Python | malcolm/modules/profiling/parts/__init__.py | hir12111/pymalcolm | 689542711ff903ee99876c40fc0eae8015e13314 | [
"Apache-2.0"
] | 11 | 2016-10-04T23:11:39.000Z | 2022-01-25T15:44:43.000Z | malcolm/modules/profiling/parts/__init__.py | hir12111/pymalcolm | 689542711ff903ee99876c40fc0eae8015e13314 | [
"Apache-2.0"
] | 153 | 2016-06-01T13:31:02.000Z | 2022-03-31T11:17:18.000Z | malcolm/modules/profiling/parts/__init__.py | hir12111/pymalcolm | 689542711ff903ee99876c40fc0eae8015e13314 | [
"Apache-2.0"
] | 16 | 2016-06-10T13:45:27.000Z | 2020-10-24T13:45:04.000Z | # Expose a nice namespace
from malcolm.core import submodule_all
from .profilingviewerpart import ProfilingViewerPart
__all__ = submodule_all(globals())
| 22.142857 | 52 | 0.832258 | 18 | 155 | 6.833333 | 0.666667 | 0.195122 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116129 | 155 | 6 | 53 | 25.833333 | 0.89781 | 0.148387 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
1190991bc23b44f11aa31897035de1f8fb808a6f | 89 | py | Python | drivers/python/__init__.py | towardsautonomy/JetPilot | 08902d0749b121496e9f828253b24f44827a1bee | [
"MIT"
] | null | null | null | drivers/python/__init__.py | towardsautonomy/JetPilot | 08902d0749b121496e9f828253b24f44827a1bee | [
"MIT"
] | null | null | null | drivers/python/__init__.py | towardsautonomy/JetPilot | 08902d0749b121496e9f828253b24f44827a1bee | [
"MIT"
] | null | null | null | import os
import sys
sys.path.append(os.path.abspath('.'))
from .gamepad import Joystick | 17.8 | 37 | 0.764045 | 14 | 89 | 4.857143 | 0.642857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101124 | 89 | 5 | 38 | 17.8 | 0.85 | 0 | 0 | 0 | 0 | 0 | 0.011111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.75 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
11a97e2224b2bda920ec60d5973788fd97322970 | 1,036 | py | Python | Project-Directory/scanner/models.py | RonBulaon/AlumniChecker | e18ec1e6458fbff6c272e7c7fe11e6d36564f1ae | [
"Apache-2.0"
] | null | null | null | Project-Directory/scanner/models.py | RonBulaon/AlumniChecker | e18ec1e6458fbff6c272e7c7fe11e6d36564f1ae | [
"Apache-2.0"
] | null | null | null | Project-Directory/scanner/models.py | RonBulaon/AlumniChecker | e18ec1e6458fbff6c272e7c7fe11e6d36564f1ae | [
"Apache-2.0"
] | null | null | null | from django.db import models
from django.db.models.deletion import CASCADE
class Visitor(models.Model):
name = models.CharField(max_length=100)
email = models.CharField(max_length=100)
barcode = models.CharField(max_length=100)
def __str__(self):
return self.barcode
class Visit(models.Model):
barcode = models.CharField(max_length=100)
membership = models.CharField(max_length=100)
name = models.CharField(max_length=100, default='')
email = models.CharField(max_length=100, default='')
status = models.BooleanField(default=True)
date = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.barcode
class PeakHours(models.Model):
hour = models.CharField(max_length=100)
def __str__(self):
return self.hour
class Configuration(models.Model):
api = models.CharField(max_length=300)
visits_pagination = models.PositiveSmallIntegerField(default=100, blank=False, null=False)
def __str__(self):
return self.api | 27.263158 | 94 | 0.718147 | 130 | 1,036 | 5.507692 | 0.330769 | 0.188547 | 0.226257 | 0.301676 | 0.511173 | 0.445531 | 0.192737 | 0.131285 | 0.131285 | 0.131285 | 0 | 0.035211 | 0.177606 | 1,036 | 38 | 95 | 27.263158 | 0.805164 | 0 | 0 | 0.307692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.076923 | 0.153846 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
11cb01449d1d80ea97db21d60ddf3dc8285a421b | 485 | py | Python | lib/util.py | aliteke/Tango | ea74145fabf3b9e9561f715760ba2bf7f2af7ecf | [
"MIT"
] | 2 | 2021-03-12T19:23:20.000Z | 2021-12-10T10:41:11.000Z | lib/util.py | aliteke/Tango | ea74145fabf3b9e9561f715760ba2bf7f2af7ecf | [
"MIT"
] | null | null | null | lib/util.py | aliteke/Tango | ea74145fabf3b9e9561f715760ba2bf7f2af7ecf | [
"MIT"
] | null | null | null | import hashlib
from uuid import uuid4
class Util:
def __init__(self, *args):
pass
def hash(self, str_input):
return hashlib.sha256(str_input.encode()).hexdigest()
'''
1. Generate a globally unique identifier for this node
2. Pass the identify to the a constructor to create the object instance
'''
def unique_gen(self):
return str(uuid4()).replace('-', '')
def str_join(self, *args):
return ''.join(map(str, args)) | 24.25 | 75 | 0.63299 | 65 | 485 | 4.6 | 0.615385 | 0.053512 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019284 | 0.251546 | 485 | 20 | 76 | 24.25 | 0.804408 | 0 | 0 | 0 | 0 | 0 | 0.002959 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.363636 | false | 0.090909 | 0.181818 | 0.272727 | 0.909091 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 4 |
11d9fee7b3146d4099cc744dc0ea65ccae7d6e82 | 23 | py | Python | app/__init__.py | ONSdigital/sdx-downstream | 1608b5b33fd2bd6fde3444619107f01ad79e8247 | [
"MIT"
] | 1 | 2022-02-10T06:47:13.000Z | 2022-02-10T06:47:13.000Z | ummon/__version__.py | matherm/ummon3 | 08476d21ce17cc95180525d48202a1690dfc8a08 | [
"BSD-3-Clause"
] | 90 | 2016-06-20T12:53:19.000Z | 2021-02-04T12:04:49.000Z | ummon/__version__.py | matherm/ummon3 | 08476d21ce17cc95180525d48202a1690dfc8a08 | [
"BSD-3-Clause"
] | 1 | 2021-04-11T07:55:19.000Z | 2021-04-11T07:55:19.000Z | __version__ = "3.15.0"
| 11.5 | 22 | 0.652174 | 4 | 23 | 2.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 0.130435 | 23 | 1 | 23 | 23 | 0.35 | 0 | 0 | 0 | 0 | 0 | 0.26087 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
11ee0f7a742720ac9ade61c68a174b0062b8932c | 70 | py | Python | src/snakeoil/dist/__init__.py | Arusekk/snakeoil | aad28a50118223766e5308452b369f2c72b971b2 | [
"BSD-3-Clause"
] | null | null | null | src/snakeoil/dist/__init__.py | Arusekk/snakeoil | aad28a50118223766e5308452b369f2c72b971b2 | [
"BSD-3-Clause"
] | null | null | null | src/snakeoil/dist/__init__.py | Arusekk/snakeoil | aad28a50118223766e5308452b369f2c72b971b2 | [
"BSD-3-Clause"
] | null | null | null | """Various packaging, testing, and dist bits for pkgcore projects."""
| 35 | 69 | 0.742857 | 9 | 70 | 5.777778 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128571 | 70 | 1 | 70 | 70 | 0.852459 | 0.9 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
eeb3bbe2edaf4852d27db5cb338d9ff830ec9279 | 908 | py | Python | src/ia/boardInfo.py | Epichess/chess-AI | 63e59a29eeb41513a8d7a343ddbb8d99d47ac892 | [
"MIT"
] | null | null | null | src/ia/boardInfo.py | Epichess/chess-AI | 63e59a29eeb41513a8d7a343ddbb8d99d47ac892 | [
"MIT"
] | 1 | 2021-08-29T17:38:46.000Z | 2021-08-29T17:38:46.000Z | src/ia/boardInfo.py | Epichess/chess-AI | 63e59a29eeb41513a8d7a343ddbb8d99d47ac892 | [
"MIT"
] | null | null | null | class BoardInfo:
can_en_passant: bool
en_passant_sqr: int # sqr
can_white_queen_side_castle: bool
can_black_queen_side_castle: bool
can_white_king_side_castle: bool
can_black_king_side_castle: bool
half_move_clock: int
us: bool
def __init__(self, can_en_passant, en_passant_sqr, can_white_queen_side_castle, can_black_queen_side_castle,
can_white_king_side_castle, can_black_king_side_castle, half_move_clock, us):
self.can_en_passant = can_en_passant
self.en_passant_sqr = en_passant_sqr
self.can_white_queen_side_castle = can_white_queen_side_castle
self.can_white_king_side_castle = can_white_king_side_castle
self.can_black_king_side_castle = can_black_king_side_castle
self.can_black_queen_side_castle = can_black_queen_side_castle
self.half_move_clock = half_move_clock
self.us = us
| 43.238095 | 112 | 0.768722 | 142 | 908 | 4.267606 | 0.147887 | 0.264026 | 0.19802 | 0.112211 | 0.636964 | 0.473597 | 0.310231 | 0.244224 | 0 | 0 | 0 | 0 | 0.190529 | 908 | 20 | 113 | 45.4 | 0.82449 | 0.003304 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0.263158 | 0 | 0 | 0.526316 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 4 |
eec410cf99f080e1fef3a8c38219a18402d55bc6 | 1,299 | py | Python | rsx/weighted_reservoir/sequential_poisson.py | gstamatelat/rsx | 93a8da78bf950b9987fc79bbd1e8eeeae0a27973 | [
"MIT"
] | null | null | null | rsx/weighted_reservoir/sequential_poisson.py | gstamatelat/rsx | 93a8da78bf950b9987fc79bbd1e8eeeae0a27973 | [
"MIT"
] | null | null | null | rsx/weighted_reservoir/sequential_poisson.py | gstamatelat/rsx | 93a8da78bf950b9987fc79bbd1e8eeeae0a27973 | [
"MIT"
] | null | null | null | r"""
Implementation of the sequential Poisson order sampling algorithm by Ohlsson in [1]_.
This algorithm does not satisfy the ratio estimator property but is an approximation of it. The weights accepted by this
implementation are in the range :math:`(0, \infty)`. This is an implementation of :class:`OrderSampling
<rsx.weighted_reservoir.order_sampling.OrderSampling>` where the keys are equal to
.. math::
\frac{w}{r}.
The default weight is :math:`1.0`.
References
----------
.. [1] Esbjörn Ohlsson.
Sequential Sampling from a Business Register and its Application to the Swedish Consumer Price Index (1990).
"""
from math import isfinite
from random import Random
from rsx.utils.helper import random_exclusive
from rsx.weighted_reservoir.order_sampling import OrderSampling
class SequentialPoissonSampling(OrderSampling):
r"""
Implementation of the sequential Poisson order sampling algorithm by Ohlsson as a class.
The space complexity of this class is :math:`\mathcal{O}(k)`, where :math:`k` is the sample size.
"""
def _key(self, weight: float, rng: Random):
return weight / random_exclusive(rng)
def _is_weight_legal(self, weight: float):
return isfinite(weight) and weight > 0
def _default_weight(self):
return 1.0
| 30.928571 | 120 | 0.735951 | 181 | 1,299 | 5.209945 | 0.447514 | 0.055143 | 0.036055 | 0.042418 | 0.21421 | 0.144221 | 0.144221 | 0.144221 | 0.144221 | 0.144221 | 0 | 0.011225 | 0.177059 | 1,299 | 41 | 121 | 31.682927 | 0.870907 | 0.622787 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.307692 | 0.230769 | 0.846154 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 4 |
eecdbc4745ab246d33831688923e5ab76392a744 | 771 | py | Python | Air_Ng/exceptions.py | aunghtet008900/Air-Ng | 62f907803a3b4c672f7b16b79acebb4157de2458 | [
"Apache-2.0"
] | 1 | 2020-04-05T18:09:27.000Z | 2020-04-05T18:09:27.000Z | Air_Ng/exceptions.py | aunghtet008900/Air-Ng | 62f907803a3b4c672f7b16b79acebb4157de2458 | [
"Apache-2.0"
] | null | null | null | Air_Ng/exceptions.py | aunghtet008900/Air-Ng | 62f907803a3b4c672f7b16b79acebb4157de2458 | [
"Apache-2.0"
] | 1 | 2020-04-05T18:09:28.000Z | 2020-04-05T18:09:28.000Z | #-*- coding: utf-8 -*-
class air_Exception(Exception):
def __init__(self,msg=' air-ng Exception'):
self._msg = msg
def __str__(self):
return self._msg
class air_ConnectionError(air_Exception):
def __init__(self,msg='Internet Connection Error'):
super().__init__(msg)
def __str__(self):
return self._msg
class air_ErrorSchema(air_Exception):
def __init__(self,msg='No Scheme is Used'):
super().__init__(msg)
def __str__(self):
return self._msg
class air_ConnectionTimeout(air_Exception):
def __init__(self,msg="Internet Connection Timeout"):
super().__init__(msg)
def __str__(self):
return self._msg
| 22.676471 | 59 | 0.603113 | 87 | 771 | 4.701149 | 0.287356 | 0.154034 | 0.156479 | 0.195599 | 0.713936 | 0.657702 | 0.594132 | 0.594132 | 0.378973 | 0.210269 | 0 | 0.001825 | 0.289235 | 771 | 34 | 60 | 22.676471 | 0.744526 | 0.027237 | 0 | 0.55 | 0 | 0 | 0.114667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0.2 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
eee3c0c71d71bff8eaa0f50c94701946bb272200 | 177 | py | Python | torchtable/__init__.py | keitakurita/torchtable | e3ae98b5c5b2e809a43787a111bb30ca7f0240b9 | [
"MIT"
] | 2 | 2019-05-14T13:23:58.000Z | 2020-01-16T03:50:24.000Z | torchtable/__init__.py | keitakurita/torchtable | e3ae98b5c5b2e809a43787a111bb30ca7f0240b9 | [
"MIT"
] | null | null | null | torchtable/__init__.py | keitakurita/torchtable | e3ae98b5c5b2e809a43787a111bb30ca7f0240b9 | [
"MIT"
] | 1 | 2019-04-28T20:13:43.000Z | 2019-04-28T20:13:43.000Z | from .custom_types import *
from . import utils
from . import operator
from . import field
from . import dataset
from . import loader
from . import model
__version__ = '0.1.0'
| 17.7 | 27 | 0.745763 | 26 | 177 | 4.884615 | 0.5 | 0.472441 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02069 | 0.180791 | 177 | 9 | 28 | 19.666667 | 0.855172 | 0 | 0 | 0 | 0 | 0 | 0.028249 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.875 | 0 | 0.875 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
e12905fbf53581bda64526154f8b394b26e9f62f | 1,082 | py | Python | starfish/core/image/Filter/__init__.py | haoxusci/starfish | d7bd856024c75f2ce41504406f2a663566c3814b | [
"MIT"
] | 164 | 2018-03-21T21:52:56.000Z | 2022-03-23T17:14:39.000Z | starfish/core/image/Filter/__init__.py | lbgbox/starfish | 0e879d995d5c49b6f5a842e201e3be04c91afc7e | [
"MIT"
] | 1,728 | 2018-03-15T23:16:09.000Z | 2022-03-12T00:09:18.000Z | starfish/core/image/Filter/__init__.py | lbgbox/starfish | 0e879d995d5c49b6f5a842e201e3be04c91afc7e | [
"MIT"
] | 66 | 2018-03-25T17:21:15.000Z | 2022-01-16T09:17:11.000Z | from ._base import FilterAlgorithm
from .bandpass import Bandpass
from .clip import Clip
from .clip_percentile_to_zero import ClipPercentileToZero
from .clip_value_to_zero import ClipValueToZero
from .element_wise_mult import ElementWiseMultiply
from .gaussian_high_pass import GaussianHighPass
from .gaussian_low_pass import GaussianLowPass
from .ilastik_pre_trained_probability import IlastikPretrainedProbability
from .laplace import Laplace
from .linear_unmixing import LinearUnmixing
from .map import Map
from .match_histograms import MatchHistograms
from .mean_high_pass import MeanHighPass
from .reduce import Reduce
from .richardson_lucy_deconvolution import DeconvolvePSF
from .white_tophat import WhiteTophat
from .zero_by_channel_magnitude import ZeroByChannelMagnitude
# autodoc's automodule directive only captures the modules explicitly listed in __all__.
__all__ = list(set(
implementation_name
for implementation_name, implementation_cls in locals().items()
if isinstance(implementation_cls, type) and issubclass(implementation_cls, FilterAlgorithm)
))
| 41.615385 | 95 | 0.860444 | 132 | 1,082 | 6.757576 | 0.560606 | 0.026906 | 0.026906 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.104436 | 1,082 | 25 | 96 | 43.28 | 0.920537 | 0.079482 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04 | 0 | 1 | 0 | false | 0.173913 | 0.782609 | 0 | 0.782609 | 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 | 1 | 1 | 0 | 1 | 0 | 0 | 4 |
0110c6bcea851006e42593f2d2a36159e696acf4 | 1,536 | py | Python | tutorial/basic/ex2.py | SalAlba/matplotlib | f73ff4e77074152fb9abc400d66f56111e656687 | [
"MIT"
] | null | null | null | tutorial/basic/ex2.py | SalAlba/matplotlib | f73ff4e77074152fb9abc400d66f56111e656687 | [
"MIT"
] | null | null | null | tutorial/basic/ex2.py | SalAlba/matplotlib | f73ff4e77074152fb9abc400d66f56111e656687 | [
"MIT"
] | null | null | null | import numpy as np
import matplotlib.pyplot as plt
from sal_timer import timer
def plot_1():
plt.plot([1, 2, 3, 4], [1, 4, 9, 16], 'ro')
plt.axis([0, 6, 0, 20])
plt.show()
def plot_2_1():
a = np.arange(0., 5., 0.2)
plt.plot(a, a, 'r-')
plt.plot(a, a**2, 'b--')
plt.plot(a, a**3, 'g-.')
plt.plot(a, a**4, 'c:')
plt.plot(a, a**5, '^m:')
plt.show()
def plot_2_2():
a = np.arange(0., 5., 0.2)
plt.plot(a, a, 'm*')
plt.plot(a, a**2, 'b^')
plt.plot(a, a**3, 'go')
plt.show()
def plot_2_3():
a = np.arange(0., 5., 0.2)
plt.plot(a, a, 'm+')
plt.plot(a, a**2, 'bx')
plt.show()
def plot_2():
a = np.arange(0., 5., 0.2)
plt.subplot(131)
plt.plot(a, a, 'r-')
plt.plot(a, a**2, 'b--')
plt.plot(a, a**3, 'g-.')
plt.plot(a, a**4, 'c:')
plt.subplot(132)
plt.plot(a, a, 'm*')
plt.plot(a, a**2, 'b^')
plt.plot(a, a**3, '^k:')
plt.subplot(133)
plt.plot(a, a, 'm+')
plt.plot(a, a**2, 'rx')
plt.plot(a, a**3, 'go')
plt.show()
@timer
def main():
# plot_1() # Formatting the style of your plot
plot_2()
# plot_2_1() # list of line styles
# plot_2_2() # list of line styles
# plot_2_3() # list of line styles
if __name__ == '__main__':
print('========================================== START ==========================================')
#...
main()
print('========================================== END ============================================') | 18.962963 | 104 | 0.426432 | 252 | 1,536 | 2.5 | 0.214286 | 0.233333 | 0.253968 | 0.285714 | 0.592063 | 0.509524 | 0.442857 | 0.442857 | 0.398413 | 0.369841 | 0 | 0.059637 | 0.246745 | 1,536 | 81 | 105 | 18.962963 | 0.484875 | 0.092448 | 0 | 0.510204 | 0 | 0 | 0.171841 | 0.122744 | 0 | 0 | 0 | 0 | 0 | 1 | 0.122449 | false | 0 | 0.061224 | 0 | 0.183673 | 0.040816 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
011552a300321fc080ef82971ba0f2c2f00de901 | 331 | py | Python | meerk40t/kernel/__init__.py | joerlane/meerk40t | a75d78848ff1682640e112111fb6ac4e23e08616 | [
"MIT"
] | null | null | null | meerk40t/kernel/__init__.py | joerlane/meerk40t | a75d78848ff1682640e112111fb6ac4e23e08616 | [
"MIT"
] | null | null | null | meerk40t/kernel/__init__.py | joerlane/meerk40t | a75d78848ff1682640e112111fb6ac4e23e08616 | [
"MIT"
] | null | null | null | """Standalone kernel enabling sophisticated console / UI applications."""
from .channel import *
from .context import *
from .exceptions import *
from .functions import *
from .jobs import *
from .kernel import *
from .lifecycles import *
from .module import *
from .service import *
from .settings import *
from .states import *
| 23.642857 | 73 | 0.749245 | 40 | 331 | 6.2 | 0.475 | 0.403226 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.160121 | 331 | 13 | 74 | 25.461538 | 0.892086 | 0.202417 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
012beb220d482b09d62dbc1c0e6a4cefddc8d60f | 936 | py | Python | ufdl-core-app/src/ufdl/core_app/views/mixins/__init__.py | waikato-ufdl/ufdl-backend | 776fc906c61eba6c2f2e6324758e7b8a323e30d7 | [
"Apache-2.0"
] | null | null | null | ufdl-core-app/src/ufdl/core_app/views/mixins/__init__.py | waikato-ufdl/ufdl-backend | 776fc906c61eba6c2f2e6324758e7b8a323e30d7 | [
"Apache-2.0"
] | 85 | 2020-07-24T00:04:28.000Z | 2022-02-10T10:35:15.000Z | ufdl-core-app/src/ufdl/core_app/views/mixins/__init__.py | waikato-ufdl/ufdl-backend | 776fc906c61eba6c2f2e6324758e7b8a323e30d7 | [
"Apache-2.0"
] | null | null | null | """
Package of mixin functionality for view-sets.
"""
from ._AcquireJobViewSet import AcquireJobViewSet
from ._AddJobOutputViewSet import AddJobOutputViewSet
from ._ClearDatasetViewSet import ClearDatasetViewSet
from ._CopyableViewSet import CopyableViewSet
from ._CreateJobViewSet import CreateJobViewSet
from ._DownloadableViewSet import DownloadableViewSet
from ._FileContainerViewSet import FileContainerViewSet
from ._GetByNameViewSet import GetByNameViewSet
from ._GetHardwareGenerationViewSet import GetHardwareGenerationViewSet
from ._ImportTemplateViewSet import ImportTemplateViewSet
from ._LicenceSubdescriptorViewSet import LicenceSubdescriptorViewSet
from ._MembershipViewSet import MembershipViewSet
from ._MergeViewSet import MergeViewSet
from ._PingNodeViewSet import PingNodeViewSet
from ._RoutedViewSet import RoutedViewSet
from ._SetFileViewSet import SetFileViewSet
from ._SoftDeleteViewSet import SoftDeleteViewSet
| 44.571429 | 71 | 0.892094 | 75 | 936 | 10.906667 | 0.346667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081197 | 936 | 20 | 72 | 46.8 | 0.951163 | 0.048077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
01549da620043d67db945d29bf298a33ff14bb86 | 307 | py | Python | eemeter/weather/__init__.py | tsennott/eemeter | a12c5f610f295d09827c1261c386ee2efadb1474 | [
"Apache-2.0"
] | null | null | null | eemeter/weather/__init__.py | tsennott/eemeter | a12c5f610f295d09827c1261c386ee2efadb1474 | [
"Apache-2.0"
] | null | null | null | eemeter/weather/__init__.py | tsennott/eemeter | a12c5f610f295d09827c1261c386ee2efadb1474 | [
"Apache-2.0"
] | null | null | null | from .base import WeatherSourceBase
from .noaa import GSODWeatherSource, ISDWeatherSource
from .tmy3 import TMY3WeatherSource
from .cz2010 import CZ2010WeatherSource
__all__ = [
'WeatherSourceBase',
'GSODWeatherSource',
'ISDWeatherSource',
'TMY3WeatherSource',
'CZ2010WeatherSource',
]
| 23.615385 | 53 | 0.771987 | 23 | 307 | 10.130435 | 0.521739 | 0.283262 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.057692 | 0.153094 | 307 | 12 | 54 | 25.583333 | 0.838462 | 0 | 0 | 0 | 0 | 0 | 0.28013 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.363636 | 0 | 0.363636 | 0 | 1 | 0 | 1 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.