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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
47c7ee324c762d85e146cce680e1d27dab07ca7e | 219 | py | Python | freezegame/ladder.py | mattfister/pybacon | c864e5f5c872f92b3c694f0ef83feb0f20f93193 | [
"MIT"
] | 2 | 2017-02-06T14:49:48.000Z | 2021-03-20T08:19:01.000Z | freezegame/ladder.py | mattfister/pybacon | c864e5f5c872f92b3c694f0ef83feb0f20f93193 | [
"MIT"
] | null | null | null | freezegame/ladder.py | mattfister/pybacon | c864e5f5c872f92b3c694f0ef83feb0f20f93193 | [
"MIT"
] | 2 | 2017-11-04T10:13:59.000Z | 2020-04-24T05:15:33.000Z | from freezegame.sprite import Sprite
class Ladder(Sprite):
def __init__(self, x, y, state):
Sprite.__init__(self, x, y, [0, 0, 32, 32], state, 'tileSet', [0, 160, 32, 32], state.batch, state.ladder_group)
| 31.285714 | 120 | 0.657534 | 34 | 219 | 3.970588 | 0.529412 | 0.118519 | 0.133333 | 0.148148 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078212 | 0.182648 | 219 | 6 | 121 | 36.5 | 0.675978 | 0 | 0 | 0 | 0 | 0 | 0.031963 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
47de90ccb81d9e53366bae7e288742ccd559ea5d | 328 | py | Python | tests/test_protein.py | kalekundert/autosnapgene | cc019b89f7ab8842d95fd268c24987aabbe1c0b6 | [
"MIT"
] | null | null | null | tests/test_protein.py | kalekundert/autosnapgene | cc019b89f7ab8842d95fd268c24987aabbe1c0b6 | [
"MIT"
] | null | null | null | tests/test_protein.py | kalekundert/autosnapgene | cc019b89f7ab8842d95fd268c24987aabbe1c0b6 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import pytest
import autosnapgene as snap
def test_getters(parse_and_write):
for dna in parse_and_write('flag_tag.prot'):
assert dna.sequence == 'DYKDDDDK'
assert dna.protein_sequence == 'DYKDDDDK'
def test_setters():
dna = snap.SnapGene()
dna.protein_sequence = 'DYKDDDDK'
| 23.428571 | 49 | 0.707317 | 44 | 328 | 5.068182 | 0.613636 | 0.215247 | 0.116592 | 0.233184 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003745 | 0.185976 | 328 | 13 | 50 | 25.230769 | 0.831461 | 0.064024 | 0 | 0 | 0 | 0 | 0.120915 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 1 | 0.222222 | false | 0 | 0.222222 | 0 | 0.444444 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
47e13e680106c821ea95e6afefa8c3825aa0febc | 97 | py | Python | holagit.py | fvenya7/practica1 | 2c7084629f0c5e3788a377f8c9d916c28fe188f4 | [
"MIT"
] | null | null | null | holagit.py | fvenya7/practica1 | 2c7084629f0c5e3788a377f8c9d916c28fe188f4 | [
"MIT"
] | null | null | null | holagit.py | fvenya7/practica1 | 2c7084629f0c5e3788a377f8c9d916c28fe188f4 | [
"MIT"
] | null | null | null | print("aprendiendo git")
a=12
print("ya quedó")
print("actualizacion 1")
print("catualizacion 2") | 19.4 | 24 | 0.742268 | 14 | 97 | 5.142857 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044944 | 0.082474 | 97 | 5 | 25 | 19.4 | 0.764045 | 0 | 0 | 0 | 0 | 0 | 0.540816 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.8 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
9a014ede8ba8180a42bf7abbdb2da472afc22d73 | 228 | py | Python | pynemo/core/base/property/string.py | SSripilaipong/pynemo | f4dedd2599ec78b2ffe73f55b1d2b8b5da1b1e7f | [
"MIT"
] | null | null | null | pynemo/core/base/property/string.py | SSripilaipong/pynemo | f4dedd2599ec78b2ffe73f55b1d2b8b5da1b1e7f | [
"MIT"
] | null | null | null | pynemo/core/base/property/string.py | SSripilaipong/pynemo | f4dedd2599ec78b2ffe73f55b1d2b8b5da1b1e7f | [
"MIT"
] | null | null | null | from pynemo.core.base.abstract.property import Property
class StringProperty(Property):
@classmethod
def validate(cls, v):
return str(v)
@classmethod
def to_cypher(cls, v):
return repr(str(v))
| 19 | 55 | 0.666667 | 29 | 228 | 5.206897 | 0.655172 | 0.18543 | 0.13245 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.232456 | 228 | 11 | 56 | 20.727273 | 0.862857 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.25 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
9a163185c3befcd4de02a4c3e143213f59c12c77 | 117 | py | Python | first_request.py | sgriffith3/2021_05_10_pyna | d732e1dd0fa03f1cef8f72fc9dcc09ec947f31a5 | [
"MIT"
] | null | null | null | first_request.py | sgriffith3/2021_05_10_pyna | d732e1dd0fa03f1cef8f72fc9dcc09ec947f31a5 | [
"MIT"
] | null | null | null | first_request.py | sgriffith3/2021_05_10_pyna | d732e1dd0fa03f1cef8f72fc9dcc09ec947f31a5 | [
"MIT"
] | null | null | null | import urllib.request
url = "https://google.com"
data = urllib.request.urlopen(url)
print(data)
print(data.read())
| 14.625 | 34 | 0.726496 | 17 | 117 | 5 | 0.647059 | 0.305882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.102564 | 117 | 7 | 35 | 16.714286 | 0.809524 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.4 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9a2995b77fe8a7759abd5fe12be41e28897fa1b0 | 112 | py | Python | output/models/ms_data/regex/letterlike_symbols_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/ms_data/regex/letterlike_symbols_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/ms_data/regex/letterlike_symbols_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.ms_data.regex.letterlike_symbols_xsd.letterlike_symbols import Doc
__all__ = [
"Doc",
]
| 18.666667 | 85 | 0.776786 | 15 | 112 | 5.266667 | 0.8 | 0.43038 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 112 | 5 | 86 | 22.4 | 0.806122 | 0 | 0 | 0 | 0 | 0 | 0.026786 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9a4f44e640692a4adea1bc6d6ea01c4fe9188da3 | 644 | py | Python | main.py | DanTheBow/Fibonacci | 6b2b694174041c59c1cc151f775772056d88749b | [
"Unlicense"
] | 1 | 2022-01-02T19:50:55.000Z | 2022-01-02T19:50:55.000Z | main.py | DanTheBow/Fibonacci | 6b2b694174041c59c1cc151f775772056d88749b | [
"Unlicense"
] | null | null | null | main.py | DanTheBow/Fibonacci | 6b2b694174041c59c1cc151f775772056d88749b | [
"Unlicense"
] | null | null | null | # Die Fibonacci-Folge ist die unendliche Folge natürlicher Zahlen, die (ursprünglich) mit zweimal der Zahl 1 beginnt
# oder (häufig, in moderner Schreibweise) zusätzlich mit einer führenden Zahl 0 versehen ist.
# Im Anschluss ergibt jeweils die Summe zweier aufeinanderfolgender Zahlen die unmittelbar danach folgende Zahl:
# 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 -> Hier fangen wir mit der 0 an zu zählen.
# 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 -> Hier fangen wir mit der 1 an zu zählen.
def fib(n):
if n < 2:
return n
return fib(n-2) + fib(n-1) # Hier ruft sich die Funktion selbst auf (Rekursion), bis die Bedingung erfüllt ist.
| 58.545455 | 116 | 0.706522 | 111 | 644 | 4.099099 | 0.558559 | 0.026374 | 0.013187 | 0.017582 | 0.145055 | 0.145055 | 0.145055 | 0.145055 | 0.145055 | 0.145055 | 0 | 0.07045 | 0.206522 | 644 | 10 | 117 | 64.4 | 0.819961 | 0.861801 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.75 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d001b6743e397b1ed7c3a5a49549452902031c2c | 150 | py | Python | integrate/test/test_samples/sample_norun.py | Requirement-Engineers/default-coding-Bo2 | f51e4e17af4fff077aebe2f3611c363da9ed9871 | [
"Unlicense"
] | null | null | null | integrate/test/test_samples/sample_norun.py | Requirement-Engineers/default-coding-Bo2 | f51e4e17af4fff077aebe2f3611c363da9ed9871 | [
"Unlicense"
] | null | null | null | integrate/test/test_samples/sample_norun.py | Requirement-Engineers/default-coding-Bo2 | f51e4e17af4fff077aebe2f3611c363da9ed9871 | [
"Unlicense"
] | null | null | null | import json
def dummy_function():
return []
def test_norun():
this shall not run
if __name__ == '__main__':
test_norun()
| 11.538462 | 27 | 0.593333 | 18 | 150 | 4.333333 | 0.833333 | 0.230769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.306667 | 150 | 12 | 28 | 12.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0.057971 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.142857 | null | null | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d0089b5c467aacb771cc69018d2b7e9da7c6f7d7 | 3,377 | py | Python | Giveme5W1H/extractor/tools/timex.py | bkrrr/Giveme5W | 657738781fe387d76e6e0da35ed009ccf81f4290 | [
"Apache-2.0"
] | 410 | 2018-05-02T12:53:02.000Z | 2022-03-28T16:11:34.000Z | Giveme5W1H/extractor/tools/timex.py | bkrrr/Giveme5W | 657738781fe387d76e6e0da35ed009ccf81f4290 | [
"Apache-2.0"
] | 51 | 2018-05-02T13:53:19.000Z | 2022-03-22T00:16:39.000Z | Giveme5W1H/extractor/tools/timex.py | TU-Berlin/Giveme5W1H | b1586328393a50acde86015d22f78a4c15bf2f34 | [
"Apache-2.0"
] | 81 | 2018-05-29T14:03:27.000Z | 2022-02-08T08:59:38.000Z | from datetime import datetime
from dateutil.relativedelta import relativedelta
class Timex:
"""
Simply represents a Timex object. Main reason for this class is that the datetime class (and other Python
equivalents) do not allow to reflect a month or a day but only a single point in time.
"""
_date_format_month = '%Y-%m'
_date_format_week = '%Y-W%W' + '-%w'
_date_format_day = '%Y-%m-%d'
_date_format_time_nosecs = '%Y-%m-%dT%H:%M'
# _log = logging.getLogger('GiveMe5W')
def __init__(self, start_datetime, end_datetime):
self._start_date = start_datetime
self._end_date = end_datetime
def __str__(self):
return 'Timex(' + str(self._start_date) + ', ' + str(self._end_date) + ')'
@staticmethod
def _get_date_distance_in_seconds(date1, date2):
return abs((date2 - date1).total_seconds())
def get_start_date(self):
return self._start_date
def get_end_date(self):
return self._end_date
def get_duration(self):
return self._end_date - self._start_date
def is_entailed_in(self, other_timex):
return other_timex.get_start_date() <= self._start_date and self.get_end_date() <= other_timex._end_date
def get_min_distance_in_seconds_to_datetime(self, other_datetime):
return min(Timex._get_date_distance_in_seconds(self._start_date, other_datetime),
Timex._get_date_distance_in_seconds(self._end_date, other_datetime))
def get_json(self):
"""
return a serializable representation of this object.
:return:
"""
return {
'start_date': self._start_date.isoformat(),
'end_date': self._end_date.isoformat()
}
@staticmethod
def from_timex_text(text):
# month (2017-11)
try:
start_date = datetime.strptime(text, Timex._date_format_month)
end_date = start_date + relativedelta(months=1) - relativedelta(seconds=1)
return Timex(start_date, end_date)
except ValueError as verr:
pass
# week (2017-W45)
try:
default_day = '-0' # https://stackoverflow.com/a/17087427/1455800
start_date = datetime.strptime(text + default_day, Timex._date_format_week)
end_date = start_date + relativedelta(weeks=1) - relativedelta(seconds=1)
return Timex(start_date, end_date)
except ValueError as verr:
pass
# day (2017-11-01)
try:
start_date = datetime.strptime(text, Timex._date_format_day)
end_date = start_date + relativedelta(days=1) - relativedelta(seconds=1)
return Timex(start_date, end_date)
except ValueError as verr:
pass
# datetime without seconds (2017-02-04T13:55)
try:
start_date = datetime.strptime(text, Timex._date_format_time_nosecs)
end_date = start_date + relativedelta(minutes=1) - relativedelta(seconds=1)
return Timex(start_date, end_date)
except ValueError as verr:
pass
# Timex._log.error('could not parse "' + text + '" to Timex')
# print('could not parse "' + text + '" to Timex')
# we cannot parse the following things
# could not parse "2017-SU" to Timex: This summer
return None
| 35.547368 | 112 | 0.638733 | 429 | 3,377 | 4.715618 | 0.261072 | 0.097874 | 0.044983 | 0.049432 | 0.400395 | 0.274345 | 0.250618 | 0.217993 | 0.217993 | 0.148295 | 0 | 0.026231 | 0.266213 | 3,377 | 94 | 113 | 35.925532 | 0.790153 | 0.184779 | 0 | 0.305085 | 0 | 0 | 0.024137 | 0 | 0.016949 | 0 | 0 | 0 | 0 | 1 | 0.169492 | false | 0.067797 | 0.033898 | 0.118644 | 0.508475 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 3 |
d03a2031481c07546efab82527c1c70cce0c1ac7 | 641 | py | Python | 30_day_leetcoding_challenge/2021_02/24-Score_of_Parentheses.py | QuenLo/leecode | ce861103949510dc54fd5cb336bd992c40748de2 | [
"MIT"
] | 6 | 2018-06-13T06:48:42.000Z | 2020-11-25T10:48:13.000Z | 30_day_leetcoding_challenge/2021_02/24-Score_of_Parentheses.py | QuenLo/leecode | ce861103949510dc54fd5cb336bd992c40748de2 | [
"MIT"
] | null | null | null | 30_day_leetcoding_challenge/2021_02/24-Score_of_Parentheses.py | QuenLo/leecode | ce861103949510dc54fd5cb336bd992c40748de2 | [
"MIT"
] | null | null | null | class Solution:
def scoreOfParentheses(self, S: str) -> int:
stack, score = [], 0
for s in S:
if s == '(':
stack.append("(")
else:
last = stack[-1]
if last == '(':
stack.pop()
stack.append(1)
# nothing to match
else:
count = 0
while stack[-1] != '(':
count += stack.pop()
stack.pop()
stack.append( count*2 )
return sum(stack)
| 27.869565 | 48 | 0.318253 | 51 | 641 | 4 | 0.529412 | 0.161765 | 0.191176 | 0.186275 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021978 | 0.574103 | 641 | 22 | 49 | 29.136364 | 0.725275 | 0.024961 | 0 | 0.222222 | 0 | 0 | 0.006421 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0 | 0 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d053e208c7d7b16075409089cf697fffe7f24a16 | 2,147 | py | Python | try_test.py | olvitar/python_training | 4c2ca819b1781fc785dc634f4e13e88fc0b45fc2 | [
"Apache-2.0"
] | null | null | null | try_test.py | olvitar/python_training | 4c2ca819b1781fc785dc634f4e13e88fc0b45fc2 | [
"Apache-2.0"
] | null | null | null | try_test.py | olvitar/python_training | 4c2ca819b1781fc785dc634f4e13e88fc0b45fc2 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
success = True
wd = webdriver.Firefox()
wait = WebDriverWait(wd, 22)
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
try:
wd.get("https://www.python.org/")
wd.find_element_by_css_selector("button").click()
wd.find_element_by_link_text("Success Stories").click()
wd.find_element_by_css_selector("button").click()
wd.find_element_by_link_text("About").click()
wd.find_element_by_css_selector("button").click()
wd.find_element_by_link_text("Docs").click()
wd.find_element_by_link_text("Audio/Visual Talks").click()
wd.find_element_by_css_selector("button").click()
wd.find_element_by_link_text("PyPI").click()
wd.find_element_by_link_text("Log in").click()
wd.find_element_by_id("username").click()
wd.find_element_by_id("username").clear()
wd.find_element_by_id("username").send_keys("oliver")
wd.find_element_by_id("password").click()
wd.find_element_by_id("password").clear()
wd.find_element_by_id("password").send_keys("Vbhjy_30")
wd.find_element_by_css_selector("input.button.button--primary").click()
wd.find_element_by_id("search").click()
wd.find_element_by_id("search").clear()
wd.find_element_by_id("search").send_keys("python")
wd.find_element_by_css_selector("button.search-form__button").click()
wd.find_element_by_xpath("//form[@id='classifiers']//button[.='Topic']").click()
wd.find_element_by_xpath("//form[@id='classifiers']//button[.='Topic']").click()
wd.find_element_by_id("search").click()
wd.find_element_by_id("search").clear()
wd.find_element_by_id("search").send_keys("pytest")
wd.find_element_by_css_selector("button.search-form__button").click()
wd.find_element_by_css_selector("button.horizontal-menu__link.dropdown__trigger").click()
wd.find_element_by_css_selector("button.dropdown__link").click()
print("Everything is Ok")
finally:
wd.quit()
if not success:
raise Exception("Test failed.")
| 40.509434 | 93 | 0.723335 | 315 | 2,147 | 4.546032 | 0.257143 | 0.121508 | 0.263268 | 0.303771 | 0.678771 | 0.678771 | 0.580307 | 0.499302 | 0.461592 | 0.461592 | 0 | 0.00264 | 0.117839 | 2,147 | 52 | 94 | 41.288462 | 0.753432 | 0.009781 | 0 | 0.297872 | 0 | 0 | 0.222222 | 0.11064 | 0 | 0 | 0 | 0 | 0 | 1 | 0.021277 | false | 0.06383 | 0.042553 | 0 | 0.106383 | 0.021277 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
d05800ed78f8e4d54ffdbd820c4452051fa6d0a1 | 195 | py | Python | location/admin.py | GDG2021hackathon/modoogym-backend-dj | 1af8c4132a8979bf333b725b73c3e5eab3e228b5 | [
"MIT"
] | null | null | null | location/admin.py | GDG2021hackathon/modoogym-backend-dj | 1af8c4132a8979bf333b725b73c3e5eab3e228b5 | [
"MIT"
] | null | null | null | location/admin.py | GDG2021hackathon/modoogym-backend-dj | 1af8c4132a8979bf333b725b73c3e5eab3e228b5 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Location
class LocationAdmin(admin.ModelAdmin):
list_display = ["id", "city", "region"]
admin.site.register(Location, LocationAdmin)
| 17.727273 | 44 | 0.753846 | 23 | 195 | 6.347826 | 0.73913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 195 | 10 | 45 | 19.5 | 0.863905 | 0 | 0 | 0 | 0 | 0 | 0.061538 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
d05e365d3bba6c56cbc2fec6fc272d72dc471554 | 1,071 | py | Python | plotmass/statistics.py | QUT-Motorsport/QUTMS_VehicleSim | 5c69a76beb889f3e1fb8a157751f5b6dc12d6d10 | [
"MIT"
] | 2 | 2020-05-10T13:44:05.000Z | 2021-11-30T14:59:26.000Z | plotmass/statistics.py | QUT-Motorsport/QUTMS_VehicleSim | 5c69a76beb889f3e1fb8a157751f5b6dc12d6d10 | [
"MIT"
] | 24 | 2020-01-12T14:12:26.000Z | 2020-07-22T02:34:53.000Z | plotmass/statistics.py | QUT-Motorsport/QUTMS_VehicleSim | 5c69a76beb889f3e1fb8a157751f5b6dc12d6d10 | [
"MIT"
] | 2 | 2020-01-13T06:51:31.000Z | 2021-12-30T16:45:43.000Z | from datetime import timedelta
class Statistics:
def __init__(self, velocity, dist):
# Calculate time
self.lap_time = 0
dist_travelled = []
self.time = []
for i in range(len(velocity)):
dist_travelled.append(0)
self.time.append(0)
if i != 0:
dist_travelled[i] = dist[i] - dist[i - 1]
self.time[i] = dist_travelled[i]/velocity[i]
self.lap_time += self.time[i]
self.fastest_lap = str(timedelta(seconds=round(self.lap_time, 2)))[:-4]
# Calculate max and min speeds in km/h
self.max_speed = round(max(velocity) * 3.6, 2)
self.min_speed = round(min(velocity) * 3.6, 2)
def get_t(self):
return self.time
def get_time(self):
return self.get_t()
def get_fastest_lap(self):
return self.fastest_lap
def get_lap_time(self):
return self.lap_time
def get_max_speed(self):
return self.max_speed
def get_min_speed(self):
return self.min_speed | 25.5 | 79 | 0.577965 | 149 | 1,071 | 3.959732 | 0.281879 | 0.061017 | 0.142373 | 0.037288 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017687 | 0.313725 | 1,071 | 42 | 80 | 25.5 | 0.785034 | 0.047619 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.035714 | 0.214286 | 0.535714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d084098c117233a70fe62aa538d6aad7c2570d51 | 577 | py | Python | operations/plus.py | Ootmann/einmaleins | aeb986cf40b7638d14ad69b68fc12b1445cf3c9a | [
"MIT"
] | null | null | null | operations/plus.py | Ootmann/einmaleins | aeb986cf40b7638d14ad69b68fc12b1445cf3c9a | [
"MIT"
] | null | null | null | operations/plus.py | Ootmann/einmaleins | aeb986cf40b7638d14ad69b68fc12b1445cf3c9a | [
"MIT"
] | null | null | null | import random
from operations import abstract_operation
class Plus(abstract_operation.AbstractOperation):
a = 0
b = 0
def __init__(self):
super().__init__("+", "Addieren")
def get_question(self):
return "{} + {}".format(str(self.a), str(self.b))
def solve(self):
return int(self.a + self.b)
def update(self):
r1n = random.randint(0, 1000)
r2n = random.randint(0, 1000)
r12 = [max(r1n, r2n) - min(r1n, r2n), min(r1n, r2n)]
random.shuffle(r12)
self.a = r12[0]
self.b = r12[1]
| 22.192308 | 60 | 0.573657 | 77 | 577 | 4.155844 | 0.441558 | 0.046875 | 0.05 | 0.1125 | 0.075 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071942 | 0.277296 | 577 | 25 | 61 | 23.08 | 0.695444 | 0 | 0 | 0 | 0 | 0 | 0.02773 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0.111111 | 0.611111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d0974c0fc40e9d8831ae2a7987183cbff51e0997 | 110 | py | Python | scripts/item/consume_2430769.py | Snewmy/swordie | ae01ed4ec0eb20a18730e8cd209eea0b84a8dd17 | [
"MIT"
] | 9 | 2021-04-26T11:59:29.000Z | 2021-12-20T13:15:27.000Z | scripts/item/consume_2430769.py | Snewmy/swordie | ae01ed4ec0eb20a18730e8cd209eea0b84a8dd17 | [
"MIT"
] | null | null | null | scripts/item/consume_2430769.py | Snewmy/swordie | ae01ed4ec0eb20a18730e8cd209eea0b84a8dd17 | [
"MIT"
] | 6 | 2021-07-14T06:32:05.000Z | 2022-02-06T02:32:56.000Z | if sm.getSlotsLeftToAddByInvType(2) < 8:
sm.dispose()
sm.addInventorySlotsByInvType(8, 2)
sm.consumeItem() | 27.5 | 40 | 0.763636 | 13 | 110 | 6.461538 | 0.615385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040404 | 0.1 | 110 | 4 | 41 | 27.5 | 0.808081 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d0a76a2ccea01e9241f0631317ad97ebe4b3a680 | 86 | py | Python | dai10shou/code10-1.py | naoshige314/workshop01 | 5c7be08f99eb164b7901628de26cecfd04fa926f | [
"MIT"
] | null | null | null | dai10shou/code10-1.py | naoshige314/workshop01 | 5c7be08f99eb164b7901628de26cecfd04fa926f | [
"MIT"
] | null | null | null | dai10shou/code10-1.py | naoshige314/workshop01 | 5c7be08f99eb164b7901628de26cecfd04fa926f | [
"MIT"
] | 2 | 2021-06-10T11:53:02.000Z | 2021-06-20T15:43:39.000Z | #頂点数
n=7
#隣接リスト表現
G=[[] for _ in range(n)]
G[0]=[1,2]
G[1]=[0,3]
G[2]=[0,4,5]
#etc.
| 7.818182 | 24 | 0.476744 | 23 | 86 | 1.73913 | 0.652174 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152778 | 0.162791 | 86 | 10 | 25 | 8.6 | 0.402778 | 0.162791 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d0aa2fe0ec18a3eff28a11f7344074671b7a9434 | 452 | py | Python | src/glitchygames/movement/vertical.py | terrysimons/ghettogames | 23773119d1994251b43c42db39c1c99c08386c24 | [
"BSD-3-Clause"
] | 1 | 2019-07-06T02:01:27.000Z | 2019-07-06T02:01:27.000Z | src/glitchygames/movement/vertical.py | terrysimons/ghettogames | 23773119d1994251b43c42db39c1c99c08386c24 | [
"BSD-3-Clause"
] | 4 | 2021-12-31T04:18:01.000Z | 2022-03-29T13:40:32.000Z | src/glitchygames/movement/vertical.py | terrysimons/glitchygames | 23773119d1994251b43c42db39c1c99c08386c24 | [
"BSD-3-Clause"
] | 1 | 2019-07-12T19:41:09.000Z | 2019-07-12T19:41:09.000Z | """
Vertical:
Adds movement functions along the vertical (Y) axis to a game object
"""
class Vertical:
def __init__(self, speed):
self.speed = speed
self.current_speed = self.speed.y
def _change_speed(self, value):
self.current_speed = value
def up(self):
self._change_speed(-self.speed.y)
def down(self):
self._change_speed(self.speed.y)
def stop(self):
self._change_speed(0)
| 18.833333 | 68 | 0.634956 | 62 | 452 | 4.403226 | 0.387097 | 0.197802 | 0.205128 | 0.164835 | 0.300366 | 0.234432 | 0.234432 | 0.234432 | 0 | 0 | 0 | 0.002976 | 0.256637 | 452 | 23 | 69 | 19.652174 | 0.809524 | 0.172566 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.416667 | false | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d0d82bd9b120db172a8b9b2c6622284777e11985 | 442 | py | Python | l8.py | snowleung/mypychallenge | 9482e267906a23fc10041f49f7d308c596447f16 | [
"MIT"
] | null | null | null | l8.py | snowleung/mypychallenge | 9482e267906a23fc10041f49f7d308c596447f16 | [
"MIT"
] | null | null | null | l8.py | snowleung/mypychallenge | 9482e267906a23fc10041f49f7d308c596447f16 | [
"MIT"
] | null | null | null | # coding:utf-8
'''
from http://www.pythonchallenge.com/pc/def/integrity.html
'''
un = 'BZh91AY&SYA\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3M\x07<]\xc9\x14\xe1BA\x06\xbe\x084'
pw = 'BZh91AY&SY\x94$|\x0e\x00\x00\x00\x81\x00\x03$ \x00!\x9ah3M\x13<]\xc9\x14\xe1BBP\x91\xf08'
def bz2_un():
return un.decode('bz2')
def bz2_pw():
return pw.decode('bz2')
if __name__ == '__main__':
print bz2_un()
print bz2_pw()
| 23.263158 | 110 | 0.665158 | 78 | 442 | 3.615385 | 0.615385 | 0.085106 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.189258 | 0.115385 | 442 | 18 | 111 | 24.555556 | 0.531969 | 0.027149 | 0 | 0 | 0 | 0.222222 | 0.564738 | 0.520661 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.222222 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d0e03d5a5825d11b0df50f5373fcf12a4e9bb5fb | 114 | py | Python | rev_powersystems/__init__.py | NREL-SIIP/reV-PowerSystems | 39e2577082743f638426f14c8b01a1576a985558 | [
"BSD-3-Clause"
] | null | null | null | rev_powersystems/__init__.py | NREL-SIIP/reV-PowerSystems | 39e2577082743f638426f14c8b01a1576a985558 | [
"BSD-3-Clause"
] | null | null | null | rev_powersystems/__init__.py | NREL-SIIP/reV-PowerSystems | 39e2577082743f638426f14c8b01a1576a985558 | [
"BSD-3-Clause"
] | null | null | null | __version__ = "0.0.1"
from .revx_output_siip import SIIPTimeSeriesMetadata, concat, max_fiber_size, match_points
| 28.5 | 90 | 0.824561 | 16 | 114 | 5.3125 | 0.9375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029126 | 0.096491 | 114 | 3 | 91 | 38 | 0.796117 | 0 | 0 | 0 | 0 | 0 | 0.04386 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d0f7870601183663c27b2407e2c8458ad2ea5542 | 4,050 | py | Python | src/ekpmeasure/experiments/ferroelectric/_tester/_wfs.py | cjfinnell/ekpmeasure | e6611c053cad28e06f4f8a94764ebe3805cddb15 | [
"MIT"
] | null | null | null | src/ekpmeasure/experiments/ferroelectric/_tester/_wfs.py | cjfinnell/ekpmeasure | e6611c053cad28e06f4f8a94764ebe3805cddb15 | [
"MIT"
] | null | null | null | src/ekpmeasure/experiments/ferroelectric/_tester/_wfs.py | cjfinnell/ekpmeasure | e6611c053cad28e06f4f8a94764ebe3805cddb15 | [
"MIT"
] | null | null | null | import numpy as np
__all__ = (
"standard_bipolar_sine",
"double_bipolar_sine",
"standard_bipolar",
"double_bipolar",
"semicircle",
"double_semicircle",
"gaussian",
"double_gaussian",
)
def semicircle(a, T):
"""Return semicircle bipolar wave with amplitude a (units of V) and period T (units of ms)
args:
a (float): Amplitude in Volts
T (float): Period in ms
"""
if T < 0.01:
raise ValueError("limit of Ferroelectric Tester")
count = int(T * 1000)
int_amp = int(2047 * a / 10)
wf = []
for i in range(count):
if i <= count / 2:
wf.append(np.sqrt(1 - ((i - count / 4) / (count / 4)) ** 2))
else:
wf.append(
-1 * np.sqrt(1 - ((i - count / 2 - count / 4) / (count / 4)) ** 2)
)
wf = np.array([int_amp * i + 2047 for i in wf])
return wf
def double_semicircle(a, T):
"""Return double semicircle bipolar wave with amplitude a (units of V) and period T (units of ms)
args:
a (float): Amplitude in Volts
T (float): Period in ms
"""
wf = np.concatenate((semicircle(a, T / 2), semicircle(a, T / 2)))
return wf
def gaussian(a, T, sigma="default"):
if T < 0.01:
raise ValueError("limit of Ferroelectric Tester")
count = int(T * 1000)
int_amp = int(2047 * a / 10)
if sigma == "default":
sigma = count / 20
# sigma = (1/(a*np.sqrt(2*np.pi)))
mu = count / 4
wf = []
for i in range(count):
if i <= count / 2:
# wf.append((1/(sigma*np.sqrt(2*np.pi)))*np.exp(-(i-mu)**2/(2*sigma**2)))
wf.append((a) * np.exp(-((i - mu) ** 2) / (2 * sigma ** 2)))
else:
wf.append(-(a) * np.exp(-((i - count / 2 - mu) ** 2) / (2 * sigma ** 2)))
wf = np.array([int_amp * i + 2047 for i in wf])
return wf
def double_gaussian(a, T, sigma="default"):
wf = np.concatenate((gaussian(a, T / 2, sigma), gaussian(a, T / 2, sigma)))
return wf
def standard_bipolar(a, T):
"""Return standard bipolar triangle wave with amplitude a (units of V) and period T (units of ms)
args:
a (float): Amplitude in Volts
T (float): Period in ms
"""
if T < 0.01:
raise ValueError("limit of Ferroelectric Tester")
count = int(T * 1000)
int_amp = int(2047 * a / 10)
step = 4 / (count)
wf = []
for i in range(count):
if i <= count / 4:
wf.append(i * step)
elif i > count / 4 and i <= 3 * count / 4:
wf.append(wf[i - 1] - step)
else:
wf.append(wf[i - 1] + step)
wf = np.array([int_amp * i + 2047 for i in wf])
return wf
def double_bipolar(a, T):
"""Return double bipolar triangle wave with amplitude a (units of V) and period T (units of ms)
args:
a (float): Amplitude in Volts
T (float): Period in ms
"""
wf = np.concatenate((standard_bipolar(a, T / 2), standard_bipolar(a, T / 2)))
return wf
def standard_bipolar_sine(a, T):
"""Return standard bipolar sine wave with amplitude a (units of V) and period T (units of ms)
args:
a (float): Amplitude in Volts
T (float): Period in ms
"""
if T < 0.01:
raise ValueError("limit of Ferroelectric Tester")
count = int(T * 1000)
int_amp = int(2047 * a / 10)
wf = np.array(
[int_amp * np.sin(2 * np.pi * i / (count)) + 2047 for i in range(count)]
)
return wf
def double_bipolar_sine(a, T):
"""Return standard bipolar sine wave with amplitude a (units of V) and period T (units of ms)
args:
a (float): Amplitude in Volts
T (float): Period in ms
"""
if T < 0.01:
raise ValueError("limit of Ferroelectric Tester")
count = int(T * 1000)
int_amp = int(2047 * a / 10)
wf = np.array(
[int_amp * np.sin(4 * np.pi * i / (count)) + 2047 for i in range(count)]
)
return wf
| 23.546512 | 101 | 0.536049 | 598 | 4,050 | 3.576923 | 0.108696 | 0.01309 | 0.02244 | 0.050491 | 0.836372 | 0.722768 | 0.679289 | 0.679289 | 0.664329 | 0.652174 | 0 | 0.047166 | 0.324691 | 4,050 | 171 | 102 | 23.684211 | 0.734918 | 0.276543 | 0 | 0.517647 | 0 | 0 | 0.102436 | 0.007521 | 0 | 0 | 0 | 0 | 0 | 1 | 0.094118 | false | 0 | 0.011765 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1904779111ad03b3fcf85f5ea88241c74cfe55ac | 200 | py | Python | tushare/bond/bonds.py | li-yong/tushare | 26da8129fb770e26128b9c2cebc7ef72c9491243 | [
"BSD-3-Clause"
] | 12,490 | 2015-01-11T09:49:07.000Z | 2022-03-31T15:03:16.000Z | tushare/bond/bonds.py | li-yong/tushare | 26da8129fb770e26128b9c2cebc7ef72c9491243 | [
"BSD-3-Clause"
] | 1,532 | 2015-02-05T11:20:59.000Z | 2022-03-29T13:30:26.000Z | tushare/bond/bonds.py | li-yong/tushare | 26da8129fb770e26128b9c2cebc7ef72c9491243 | [
"BSD-3-Clause"
] | 4,867 | 2015-01-07T08:18:09.000Z | 2022-03-31T07:03:53.000Z | # -*- coding:utf-8 -*-
"""
投资参考数据接口
Created on 2017/10/01
@author: Jimmy Liu
@group : waditu
@contact: jimmysoa@sina.cn
"""
def get_bond_info(code):
pass
if __name__ == '__main__':
pass | 11.764706 | 26 | 0.635 | 28 | 200 | 4.178571 | 0.964286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05625 | 0.2 | 200 | 17 | 27 | 11.764706 | 0.675 | 0.575 | 0 | 0.5 | 0 | 0 | 0.103896 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.5 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
190774ef04a1a93a7a9832bb8db9d5fd37d72396 | 533 | py | Python | k8s/images/codalab/apps/chahub/provider.py | abdulari/codalab-competitions | fdfbb77ac62d56c6b4b9439935037f97ffcd1423 | [
"Apache-2.0"
] | 333 | 2015-12-29T22:49:40.000Z | 2022-03-27T12:01:57.000Z | k8s/images/codalab/apps/chahub/provider.py | abdulari/codalab-competitions | fdfbb77ac62d56c6b4b9439935037f97ffcd1423 | [
"Apache-2.0"
] | 1,572 | 2015-12-28T21:54:00.000Z | 2022-03-31T13:00:32.000Z | k8s/images/codalab/apps/chahub/provider.py | abdulari/codalab-competitions | fdfbb77ac62d56c6b4b9439935037f97ffcd1423 | [
"Apache-2.0"
] | 107 | 2016-01-08T03:46:07.000Z | 2022-03-16T08:43:57.000Z | from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class ChaHubAccount(ProviderAccount):
pass
class ChaHubProvider(OAuth2Provider):
"""Chahub OAuth authentication backend"""
id = 'chahub'
name = 'ChaHub'
account_class = ChaHubAccount
package = 'apps.chahub'
def get_default_scope(self):
return ['read', 'write']
providers.registry.register(ChaHubProvider)
| 23.173913 | 74 | 0.75985 | 53 | 533 | 7.584906 | 0.622642 | 0.08209 | 0.179104 | 0.164179 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006667 | 0.155722 | 533 | 22 | 75 | 24.227273 | 0.886667 | 0.065666 | 0 | 0 | 0 | 0 | 0.065041 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0.076923 | 0.230769 | 0.076923 | 0.846154 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
ef85c06ba18faf8168c199da975507a6176f5a0a | 174 | py | Python | Richard.py | Jpowell10/firstrepo | c41ac4a0526b6e56449df5adaa448091d930f731 | [
"CC0-1.0"
] | null | null | null | Richard.py | Jpowell10/firstrepo | c41ac4a0526b6e56449df5adaa448091d930f731 | [
"CC0-1.0"
] | null | null | null | Richard.py | Jpowell10/firstrepo | c41ac4a0526b6e56449df5adaa448091d930f731 | [
"CC0-1.0"
] | null | null | null | List1 = [1, 2, 3, 4]
List2 = ['I', 'tripped', 'over', 'and', 'hit', 'the', 'floor']
print(List1 + List2)
List3 = List1 + List2
print(List3)
fibs = (0, 1, 2, 3)
print(fibs[3]) | 24.857143 | 62 | 0.563218 | 29 | 174 | 3.37931 | 0.586207 | 0.040816 | 0.061224 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.118056 | 0.172414 | 174 | 7 | 63 | 24.857143 | 0.5625 | 0 | 0 | 0 | 0 | 0 | 0.148571 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.428571 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
efae6e71bf3ea6317e5681aeac0b15d509089b29 | 2,044 | py | Python | legos/input_type.py | kamongi/legos | 0b4b5b1300af6677ae4e9c642a211ba3c96726a9 | [
"MIT"
] | null | null | null | legos/input_type.py | kamongi/legos | 0b4b5b1300af6677ae4e9c642a211ba3c96726a9 | [
"MIT"
] | null | null | null | legos/input_type.py | kamongi/legos | 0b4b5b1300af6677ae4e9c642a211ba3c96726a9 | [
"MIT"
] | null | null | null | import os, urllib, datetime, time, sys
import getpass
from franz.openrdf.sail.allegrographserver import AllegroGraphServer
from franz.openrdf.repository.repository import Repository
from franz.miniclient import repository
from franz.openrdf.query.query import QueryLanguage
from franz.openrdf.model import URI
from franz.openrdf.vocabulary.rdf import RDF
from franz.openrdf.vocabulary.rdfs import RDFS
from franz.openrdf.vocabulary.owl import OWL
from franz.openrdf.vocabulary.xmlschema import XMLSchema
from franz.openrdf.query.dataset import Dataset
from franz.openrdf.rio.rdfformat import RDFFormat
from franz.openrdf.rio.rdfwriter import NTriplesWriter
from franz.openrdf.rio.rdfxmlwriter import RDFXMLWriter
class Inputs(object):
""" This class service our legos tool cmd line inputs. """
def __init__(self):
""" Set important default parameters to use throughout this project. """
self.username = ""
self.password = ""
self.agHostIp = ""
self.agPort = 10035 # Default
self.repoName = ""
self.conn = None
def createRepo(self):
"""
Repository.ACCESS opens an existing repository, or
creates a new one if the repository is not found.
"""
print "\n-------\nPrelude\n-------\n"
try:
print "Defining connnection to AllegroGraph server -- host:'%s' port:%s" % (self.agHostIp, self.agPort)
server = AllegroGraphServer(self.agHostIp, self.agPort, self.username, self.password)
catalog = server.openCatalog()
myRepository = catalog.getRepository(self.repoName, Repository.ACCESS)
myRepository.initialize()
connection = myRepository.getConnection()
print "Repository <%s> is up! It contains <%i> statements.\n" % (myRepository.getDatabaseName(), connection.size())
self.conn = connection
return 0 # All is well.
except:
print "\n***Oops ... :(\n"
return -1 # Oops
def recycleConns(self):
""" Close any open AllegroGraph connection """
self.conn.close()
connRepository = self.conn.repository
connRepository.shutDown()
return "\nRecycling is done.\n" | 31.9375 | 119 | 0.741683 | 252 | 2,044 | 6 | 0.448413 | 0.077381 | 0.126984 | 0.068783 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004028 | 0.149706 | 2,044 | 64 | 120 | 31.9375 | 0.865938 | 0.012231 | 0 | 0 | 0 | 0 | 0.108595 | 0.016841 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.069767 | 0.348837 | null | null | 0.093023 | 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 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
efe17a7b9267d6d10ac42dd61070b721d1c277ec | 751 | py | Python | src/handler/quit.py | junhg0211/Kreylin | aae5e1e5ba5cfaadfab6708cb0bf26a75c6dcb7a | [
"Apache-2.0"
] | 1 | 2019-09-11T12:02:53.000Z | 2019-09-11T12:02:53.000Z | src/handler/quit.py | junhg0211/Kreylin | aae5e1e5ba5cfaadfab6708cb0bf26a75c6dcb7a | [
"Apache-2.0"
] | 8 | 2019-09-11T12:06:54.000Z | 2020-02-09T04:42:13.000Z | src/handler/quit.py | junhg0211/Kreylin | aae5e1e5ba5cfaadfab6708cb0bf26a75c6dcb7a | [
"Apache-2.0"
] | 1 | 2021-05-24T12:43:07.000Z | 2021-05-24T12:43:07.000Z | from sys import platform
import pygame
from handler.handler import Handler
class Quit(Handler):
def __init__(self, keyboard_manager, shutdown):
self.keyboard_manager = keyboard_manager
self.shutdown = shutdown
def tick(self):
if self.keyboard_manager.is_start(pygame.K_F4):
if platform == 'win32':
if self.keyboard_manager.is_pressed(pygame.K_LALT) or self.keyboard_manager.is_pressed(pygame.K_RALT):
self.shutdown()
if self.keyboard_manager.is_start(pygame.K_q):
if platform == 'darwin':
if self.keyboard_manager.is_pressed(pygame.K_LMETA) or self.keyboard_manager.is_pressed(pygame.K_RMETA):
self.shutdown()
| 34.136364 | 120 | 0.663116 | 95 | 751 | 4.978947 | 0.305263 | 0.285412 | 0.321353 | 0.266385 | 0.460888 | 0.460888 | 0.460888 | 0.460888 | 0 | 0 | 0 | 0.005319 | 0.249001 | 751 | 21 | 121 | 35.761905 | 0.833333 | 0 | 0 | 0.125 | 0 | 0 | 0.014647 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.1875 | 0 | 0.375 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4bfa32e39dba78be88b0f520adb14e8e58f436e8 | 938 | py | Python | test/hlt/pytest/python/com/huawei/iotplatform/client/dto/DeviceServiceB.py | yuanyi-thu/AIOT- | 27f67d98324593c4c6c66bbd5e2a4aa7b9a4ac1e | [
"BSD-3-Clause"
] | 128 | 2018-10-29T04:11:47.000Z | 2022-03-07T02:19:14.000Z | test/hlt/pytest/python/com/huawei/iotplatform/client/dto/DeviceServiceB.py | yuanyi-thu/AIOT- | 27f67d98324593c4c6c66bbd5e2a4aa7b9a4ac1e | [
"BSD-3-Clause"
] | 40 | 2018-11-02T00:40:48.000Z | 2021-12-07T09:33:56.000Z | test/hlt/pytest/python/com/huawei/iotplatform/client/dto/DeviceServiceB.py | yuanyi-thu/AIOT- | 27f67d98324593c4c6c66bbd5e2a4aa7b9a4ac1e | [
"BSD-3-Clause"
] | 118 | 2018-10-29T08:43:57.000Z | 2022-01-07T06:49:25.000Z | class DeviceServiceB(object):
def __init__(self):
self.serviceId = None
self.reportedProps = None
self.desiredProps = None
self.eventTime = None
self.serviceType = None
def getServiceId(self):
return self.serviceId
def setServiceId(self, serviceId):
self.serviceId = serviceId
def getReportedProps(self):
return self.reportedProps
def setReportedProps(self, reportedProps):
self.reportedProps = reportedProps
def getDesiredProps(self):
return self.desiredProps
def setDesiredProps(self, desiredProps):
self.desiredProps = desiredProps
def getEventTime(self):
return self.eventTime
def setEventTime(self, eventTime):
self.eventTime = eventTime
def getServiceType(self):
return self.serviceType
def setServiceType(self, serviceType):
self.serviceType = serviceType
| 24.051282 | 46 | 0.66951 | 86 | 938 | 7.255814 | 0.267442 | 0.080128 | 0.112179 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.260128 | 938 | 38 | 47 | 24.684211 | 0.899135 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.407407 | false | 0 | 0 | 0.185185 | 0.62963 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ef066c9d7e1e24986e561e37f408aef403cdc52a | 127 | py | Python | learning_sets.py | guppikan/PythonLearning | b1674b7187c783b682da26c2190e2b47938faa16 | [
"MIT"
] | null | null | null | learning_sets.py | guppikan/PythonLearning | b1674b7187c783b682da26c2190e2b47938faa16 | [
"MIT"
] | null | null | null | learning_sets.py | guppikan/PythonLearning | b1674b7187c783b682da26c2190e2b47938faa16 | [
"MIT"
] | null | null | null | # this file describe sets data structures on python
thisSet={"Car","Bike","Truk"}
# Printing sets on terminal
print(thisSet) | 21.166667 | 52 | 0.740157 | 18 | 127 | 5.222222 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.141732 | 127 | 6 | 53 | 21.166667 | 0.862385 | 0.598425 | 0 | 0 | 0 | 0 | 0.22449 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
ef191d6989e1e630c43331526ecc6be3b87686af | 331 | py | Python | tests/test_models.py | kajigga/dj-pylti | 2388719ee799b3033a9ab7ccf28667e69bcd8cd6 | [
"BSD-3-Clause"
] | null | null | null | tests/test_models.py | kajigga/dj-pylti | 2388719ee799b3033a9ab7ccf28667e69bcd8cd6 | [
"BSD-3-Clause"
] | null | null | null | tests/test_models.py | kajigga/dj-pylti | 2388719ee799b3033a9ab7ccf28667e69bcd8cd6 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_dj-pylti
------------
Tests for `dj-pylti` models module.
"""
from django.test import TestCase
from dj_pylti import models
class TestDj_pylti(TestCase):
def setUp(self):
pass
def test_something(self):
pass
def tearDown(self):
pass
| 12.730769 | 35 | 0.607251 | 43 | 331 | 4.581395 | 0.604651 | 0.106599 | 0.111675 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003984 | 0.241692 | 331 | 25 | 36 | 13.24 | 0.780876 | 0.320242 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0.333333 | 0.222222 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
ef4114aeaf1e0c3215bf5aee9d278bc0e2171dca | 338 | py | Python | apps/permissions/router.py | yhkl-dev/JAutoOps | e42342fc6d814813dcac2e0154cd5dfdc1adf4c1 | [
"MIT"
] | null | null | null | apps/permissions/router.py | yhkl-dev/JAutoOps | e42342fc6d814813dcac2e0154cd5dfdc1adf4c1 | [
"MIT"
] | null | null | null | apps/permissions/router.py | yhkl-dev/JAutoOps | e42342fc6d814813dcac2e0154cd5dfdc1adf4c1 | [
"MIT"
] | null | null | null | from rest_framework.routers import DefaultRouter
from .views import PermissionsViewset, GroupPermissionsViewset
permission_router = DefaultRouter()
permission_router.register(r'permissions', PermissionsViewset, basename="permissions")
permission_router.register(r'grouppermissions', GroupPermissionsViewset, basename="grouppermissions") | 48.285714 | 101 | 0.866864 | 30 | 338 | 9.633333 | 0.533333 | 0.16609 | 0.16609 | 0.17301 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.056213 | 338 | 7 | 101 | 48.285714 | 0.905956 | 0 | 0 | 0 | 0 | 0 | 0.159292 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ef4351fb100c957415ebe720f79b5a02ebc2c300 | 9,324 | py | Python | tests/webtests/test_admin.py | zodman/ZoomFoundry | 87a69f519a2ab6b63aeec0a564ce41259e64f88d | [
"MIT"
] | 8 | 2017-04-10T09:53:15.000Z | 2020-08-16T09:53:14.000Z | tests/webtests/test_admin.py | zodman/ZoomFoundry | 87a69f519a2ab6b63aeec0a564ce41259e64f88d | [
"MIT"
] | 49 | 2017-04-13T22:51:48.000Z | 2019-08-15T22:53:25.000Z | tests/webtests/test_admin.py | zodman/ZoomFoundry | 87a69f519a2ab6b63aeec0a564ce41259e64f88d | [
"MIT"
] | 12 | 2017-04-11T04:16:47.000Z | 2019-08-10T21:41:54.000Z |
# -*- coding: utf-8 -*-
"""
zoom.tests.webdriver_tests.test_admin
test admin app functions
"""
from zoom.testing.webtest import AdminTestCase
class SystemTests(AdminTestCase):
"""MyApp system tests"""
def add_user(self, first_name, last_name, email, username):
self.get('/admin')
self.get('/admin/users')
self.get('/admin/users/new')
self.fill(
dict(
first_name=first_name,
last_name=last_name,
email=email,
username=username,
)
)
self.chosen('memberships', ['managers'])
self.click('create_button')
def delete_user(self, username):
self.get('/admin')
self.get('/admin/users')
self.click_link(username)
self.click('id=delete-action')
self.click('name=delete_button')
def add_group(self, name, description):
self.get('/admin/groups/new')
self.fill(
dict(
name=name,
)
)
element = self.find('//*[@id="description"]')
element.send_keys(description)
self.click('create_button')
def delete_group(self, name):
self.get('/admin/groups')
self.click_link(name)
self.click('id=delete-action')
self.click('name=delete_button')
def test_admin_add_remove_user(self):
self.get('/admin/users')
self.assertDoesNotContain('sally')
self.add_user('Sally', 'Jones', 'sally@testco.com', 'sally')
self.get('/admin/users')
self.assertContains('sally')
self.delete_user('sally')
self.get('/admin/users')
self.assertDoesNotContain('sally')
def test_deactivate_activate_user(self):
self.get('/admin/users')
self.assertDoesNotContain('sally')
try:
self.add_user('Sally', 'Jones', 'sally@testco.com', 'sally')
self.assertContains('sally')
self.get('/admin/users/sally')
self.assertContains('sally@testco.com')
self.assertContains('Deactivate')
self.click('Deactivate')
self.assertNotContains('Deactivate')
self.assertContains('sally@testco.com')
self.assertContains('Activate')
self.click('Activate')
self.assertNotContains('Activate')
self.assertContains('Deactivate')
finally:
self.delete_user('sally')
self.get('/admin/users')
self.assertDoesNotContain('sally')
def test_index_search(self):
self.get('/admin')
self.fill(dict(q='sally'))
self.click('search-button')
self.assertContains('no records found')
self.add_user('Sally', 'Jones', 'sally@testco.com', 'sally')
self.get('/admin')
self.fill(dict(q='sally'))
self.click('search-button')
self.assertNotContains('no records found')
self.assertContains('sally@testco.com')
self.delete_user('sally')
self.get('/admin')
self.fill(dict(q='sally'))
self.click('search-button')
self.assertContains('no records found')
def test_change_group_admin(self):
self.get('/admin/groups')
self.assertDoesNotContain('special_group')
self.add_group('special_group', 'special test group')
try:
self.get('/admin/groups')
self.assertContains('special_group')
self.get('/admin/groups')
self.find('//*[@name="link-to-special_group"]').click()
self.find('//*[@name="link-to-administrators"]')
self.find('//*[@id="edit-action"]').click()
self.click("//select[@id='admin_group_id']/option[text()='users']")
self.click('save_button')
self.find('//*[@name="link-to-users"]')
self.find('//*[@id="edit-action"]').click()
self.click("//select[@id='admin_group_id']/option[text()='administrators']")
self.click('save_button')
self.find('//*[@name="link-to-administrators"]')
finally:
self.delete_group('special_group')
self.get('/admin/groups')
self.assertDoesNotContain('special_group')
def test_add_remove_subgroup(self):
self.get('/admin')
# group 5 = content managers
self.get('/admin/groups')
self.assertContains('link-to-guests')
self.get('/admin/groups/5')
self.assertDoesNotContain('link-to-guests')
self.get('/admin/groups/5/edit')
self.assertDoesNotContain('link-to-guests')
try:
self.get('/admin/groups/5/edit')
self.chosen('subgroups', ['guests'])
self.click('id=save_button')
self.assertContains('link-to-guests')
finally:
# remove the subgroup we just added
self.get('/admin/groups/5/edit')
element = self.find('//*[@id="subgroups_chosen"]/ul/li[2]/a')
element.click()
self.click('id=save_button')
self.get('/admin/groups/5')
self.assertDoesNotContain('link-to-guests')
def test_add_remove_role(self):
self.get('/admin')
# group 5 = content managers
self.get('/admin/groups')
self.assertContains('link-to-guests')
self.get('/admin/groups/5')
self.assertDoesNotContain('link-to-guests')
self.get('/admin/groups/5/edit')
self.assertDoesNotContain('link-to-guests')
try:
self.get('/admin/groups/5/edit')
self.chosen('subgroups', ['guests'])
self.click('id=save_button')
self.assertContains('link-to-guests')
finally:
# remove the role we just added
self.get('/admin/groups/5/edit')
element = self.find('//*[@id="subgroups_chosen"]/ul/li[2]/a')
element.click()
self.click('id=save_button')
self.get('/admin/groups/5')
self.assertDoesNotContain('link-to-guests')
def test_add_remove_app(self):
# group 5 = content managers
self.get('/admin/groups/5')
self.assertDoesNotContain('Register')
try:
self.get('/admin/groups/5/edit')
self.chosen('apps', ['Register'])
self.click('id=save_button')
self.assertContains('Register')
finally:
# remove the app we just added
self.get('/admin/groups/5/edit')
element = self.find('//*[@id="apps_chosen"]/ul/li[1]/a')
element.click()
self.click('id=save_button')
self.get('/admin/groups/5')
self.assertDoesNotContain('Register')
def test_add_remove_several_apps(self):
# group 5 = content managers
self.get('/admin/groups/5')
self.assertDoesNotContain('Register')
# add an app
self.get('/admin/groups/5/edit')
self.chosen('apps', ['Register'])
self.click('id=save_button')
self.assertContains('Register')
# add anpther app
self.get('/admin/groups/5/edit')
self.chosen('apps', ['Forgot'])
self.click('id=save_button')
self.assertContains('Register')
self.assertContains('Forgot')
# add one more app
self.get('/admin/groups/5/edit')
self.chosen('apps', ['Sample'])
self.click('id=save_button')
self.assertContains('Register')
self.assertContains('Forgot')
self.assertContains('Sample')
# remove one of the apps we just added
self.get('/admin/groups/5/edit')
element = self.find('//*[@id="apps_chosen"]/ul/li[2]/a')
element.click()
self.click('id=save_button')
self.assertContains('Forgot')
self.assertDoesNotContain('Register')
self.assertContains('Sample')
# remove another one of the apps we just added
self.get('/admin/groups/5/edit')
element = self.find('//*[@id="apps_chosen"]/ul/li[2]/a')
element.click()
self.click('id=save_button')
self.assertContains('Forgot')
self.assertDoesNotContain('Register')
self.assertDoesNotContain('Sample')
# remove final app added
self.get('/admin/groups/5/edit')
element = self.find('//*[@id="apps_chosen"]/ul/li[1]/a')
element.click()
self.click('id=save_button')
self.assertDoesNotContain('Forgot')
self.assertDoesNotContain('Register')
self.assertDoesNotContain('Sample')
def test_add_remove_user(self):
# group 5 = content managers
self.get('/admin/groups/5')
self.assertDoesNotContain('link-to-guest')
try:
self.get('/admin/groups/5/edit')
self.chosen('users', ['guest'])
self.click('id=save_button')
self.assertContains('link-to-guest')
finally:
# remove the user we just added
self.get('/admin/groups/5/edit')
element = self.find('//*[@id="users_chosen"]/ul/li[1]/a')
element.click()
self.click('id=save_button')
self.get('/admin/groups/5')
self.assertDoesNotContain('link-to-guests')
| 30.976744 | 88 | 0.569284 | 1,025 | 9,324 | 5.092683 | 0.102439 | 0.065709 | 0.112644 | 0.113793 | 0.77682 | 0.765134 | 0.730077 | 0.681418 | 0.659195 | 0.591379 | 0 | 0.005608 | 0.273273 | 9,324 | 300 | 89 | 31.08 | 0.764758 | 0.054912 | 0 | 0.755869 | 0 | 0 | 0.278094 | 0.063027 | 0 | 0 | 0 | 0 | 0.244131 | 1 | 0.061033 | false | 0 | 0.004695 | 0 | 0.070423 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ef5eca1f199c276a6c88e8c9f58fbad72f2074cb | 1,340 | py | Python | sim/cell.py | raalesir/sim | 9bd994b1dedd05ca88ab9f25cbca3bc28cadc04b | [
"MIT"
] | null | null | null | sim/cell.py | raalesir/sim | 9bd994b1dedd05ca88ab9f25cbca3bc28cadc04b | [
"MIT"
] | null | null | null | sim/cell.py | raalesir/sim | 9bd994b1dedd05ca88ab9f25cbca3bc28cadc04b | [
"MIT"
] | null | null | null |
class CubicCell:
"""
represents confining cell for the polymer
"""
def __init__(self, a,b,c):
"""
init the cell
:param a: ``OX`` dimension
:type a: int
:param b: ``OY`` dimension
:type b: int
:param c: ``OZ`` dimension
:type c: int
"""
self.A = a
self.B = b
self.C = c
self.center = self.set_center()
def __str__(self):
return "the cell is a parallelogram with the size (X,Y,Z) = (%i, %i, %i)"%(self.A, self.B, self.C)
def set_center(self):
"""
calculates the center of the cell
:return: list of 3 numbers
:rtype: list
"""
return [self.A//2, self.B//2, self.C//2]
def get_center(self):
"""
returns the center of the cell
:return: list of integers
:rtype: list
"""
return self.center
class ForceCubicCell(CubicCell):
"""
cubic cell with force field
"""
def __init__(self, a,b ,c, f_f):
self.f_f = f_f
super().__init__(a,b,c)
def __str__(self):
return """the cell is a parallelogram with the size (X,Y,Z) = (%i, %i, %i) and %s force field with the origin at: %s"""\
%(self.A, self.B, self.C, self.f_f, self.f_f.origin)
| 20.30303 | 129 | 0.506716 | 188 | 1,340 | 3.462766 | 0.281915 | 0.046083 | 0.013825 | 0.036866 | 0.37788 | 0.353303 | 0.264209 | 0.264209 | 0.172043 | 0.172043 | 0 | 0.004646 | 0.357463 | 1,340 | 65 | 130 | 20.615385 | 0.751452 | 0.263433 | 0 | 0.105263 | 0 | 0.105263 | 0.212687 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.315789 | false | 0 | 0 | 0.105263 | 0.631579 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
322c5954da97025867a532a5c2f025836a221df3 | 944 | py | Python | evolute/operators/mate.py | ysglh/evolute | ea868e5d04e6bb59760a9b6dec709303637b9f10 | [
"MIT"
] | 174 | 2018-08-15T21:48:30.000Z | 2022-03-13T01:34:48.000Z | evolute/operators/mate.py | ysglh/evolute | ea868e5d04e6bb59760a9b6dec709303637b9f10 | [
"MIT"
] | null | null | null | evolute/operators/mate.py | ysglh/evolute | ea868e5d04e6bb59760a9b6dec709303637b9f10 | [
"MIT"
] | 27 | 2018-05-16T16:25:36.000Z | 2021-11-02T20:51:38.000Z | import numpy as np
class MateBase:
def apply(self, ind1, ind2):
pass
def __call__(self, ind1, ind2):
return self.apply(ind1, ind2)
class LambdaMate(MateBase):
def __init__(self, function_ref, **kw):
self.kwargs = kw
self.apply = lambda ind1, ind2: function_ref(ind1, ind2, **self.kwargs)
class RandomPickMate(MateBase):
def apply(self, ind1, ind2):
return np.where(np.random.uniform(size=ind1.shape) < 0.5, ind1, ind2)
class SmoothMate(MateBase):
def apply(self, ind1, ind2):
return np.mean((ind1, ind2), axis=0)
DefaultMate = RandomPickMate
class ScatterMateWrapper(MateBase):
def __init__(self, base=DefaultMate, stdev=1.):
if isinstance(base, type):
base = base()
self.base = base
self.stdev = stdev
def apply(self, ind1, ind2):
return self.base(ind1, ind2) + np.random.randn(*ind1.shape) * self.stdev
| 20.977778 | 80 | 0.635593 | 122 | 944 | 4.803279 | 0.336066 | 0.150171 | 0.102389 | 0.109215 | 0.259386 | 0.215017 | 0.122867 | 0.122867 | 0 | 0 | 0 | 0.039106 | 0.241525 | 944 | 44 | 81 | 21.454545 | 0.77933 | 0 | 0 | 0.16 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.28 | false | 0.04 | 0.04 | 0.16 | 0.68 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
326587ea3dd2af6a3849b34225b40c151ddc17b4 | 532 | py | Python | tikplay/provider/tests/retriever_test.py | tietokilta-saato/tikplay | 8061451c21f06bd07129a8a42543ea86b7518d4a | [
"MIT"
] | 2 | 2015-01-15T14:14:50.000Z | 2015-10-23T05:37:34.000Z | tikplay/provider/tests/retriever_test.py | tietokilta-saato/tikplay | 8061451c21f06bd07129a8a42543ea86b7518d4a | [
"MIT"
] | 8 | 2015-01-12T10:27:27.000Z | 2015-05-11T12:05:03.000Z | tikplay/provider/tests/retriever_test.py | tietokilta-saato/tikplay | 8061451c21f06bd07129a8a42543ea86b7518d4a | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# Part of tikplay
# Yes, this is a bit of a non-test.
from nose.tools import *
from tikplay.provider.retriever import Retriever
class TestRetriever(object):
def __init__(self):
self.retriever = Retriever({})
@raises(NotImplementedError)
def test_handles(self):
self.retriever.handles_url("")
@raises(NotImplementedError)
def test_get(self):
self.retriever.get("")
def test_str(self):
assert str(self.retriever) == "URL retriever 'Unnamed retriever'" | 25.333333 | 73 | 0.682331 | 66 | 532 | 5.378788 | 0.515152 | 0.146479 | 0.143662 | 0.180282 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.201128 | 532 | 21 | 73 | 25.333333 | 0.835294 | 0.131579 | 0 | 0.153846 | 0 | 0 | 0.071739 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 1 | 0.307692 | false | 0 | 0.153846 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
328382e2d62ec49094cab44e02a8b760c1f9a700 | 4,756 | py | Python | all_words.py | secureterminal/100-Days-of-Code | 04383ae541938d8a551b5aac9a0dad3348a6ef23 | [
"MIT"
] | 1 | 2022-01-28T13:55:39.000Z | 2022-01-28T13:55:39.000Z | Day 7/all_words.py | secureterminal/100-Days-of-Code | 04383ae541938d8a551b5aac9a0dad3348a6ef23 | [
"MIT"
] | 1 | 2022-02-02T00:13:18.000Z | 2022-02-03T11:32:53.000Z | Day 7/all_words.py | secureterminal/100-Days-of-Code | 04383ae541938d8a551b5aac9a0dad3348a6ef23 | [
"MIT"
] | 2 | 2022-02-07T20:49:36.000Z | 2022-02-19T21:22:15.000Z | word_list = ['pseudolamellibranchiate',
'microcolorimetrically',
'pancreaticoduodenostomy',
'theologicoastronomical',
'pancreatoduodenectomy',
'tetraiodophenolphthalein',
'choledocholithotripsy',
'hematospectrophotometer',
'deintellectualization',
'pharyngoepiglottidean',
'psychophysiologically',
'pathologicopsychological',
'pseudomonocotyledonous',
'philosophicohistorical',
'Pseudolamellibranchia',
'chlamydobacteriaceous',
'cholecystoduodenostomy',
'anemometrographically',
'duodenopancreatectomy',
'dacryocystoblennorrhea',
'thymolsulphonephthalein',
'aminoacetophenetidine',
'ureterocystanastomosis',
'undistinguishableness',
'disestablishmentarian',
'cryptocrystallization',
'scientificogeographical',
'chemicopharmaceutical',
'overindustrialization',
'counterinterpretation',
'superincomprehensible',
'dacryocystorhinostomy',
'choledochoduodenostomy',
'cholecystogastrostomy',
'photochronographically',
'philosophicoreligious',
'scleroticochoroiditis',
'pyopneumocholecystitis',
'crystalloluminescence',
'phoneticohieroglyphic',
'historicogeographical',
'counterreconnaissance',
'pathologicoanatomical',
'omnirepresentativeness',
'establishmentarianism',
'glossolabiopharyngeal',
'pseudohermaphroditism',
'anthropoclimatologist',
'cholecystojejunostomy',
'epididymodeferentectomy',
'pericardiomediastinitis',
'cholecystolithotripsy',
'tessarescaedecahedron',
'electrotelethermometer',
'pharmacoendocrinology',
'poliencephalomyelitis',
'duodenocholedochotomy',
'cholecystonephrostomy',
'formaldehydesulphoxylate',
'dacryocystosyringotomy',
'counterpronunciamento',
'cholecystenterorrhaphy',
'deanthropomorphization',
'microseismometrograph',
'pseudoparthenogenesis',
'Pseudolamellibranchiata',
'ureteropyelonephritis',
'electroencephalography',
'anticonstitutionalist',
'electroencephalograph',
'hypsidolichocephalism',
'mandibulosuspensorial',
'acetylphenylhydrazine',
'hexanitrodiphenylamine',
'historicocabbalistical',
'hexachlorocyclohexane',
'anatomicophysiological',
'pseudoanthropological',
'microcryptocrystalline',
'lymphangioendothelioma',
'nonrepresentationalism',
'blepharoconjunctivitis',
'hydropneumopericardium',
'stereoroentgenography',
'otorhinolaryngologist',
'scientificohistorical',
'phenolsulphonephthalein',
'mechanicointellectual',
'counterexcommunication',
'duodenocholecystostomy',
'noninterchangeability',
'thermophosphorescence',
'naphthylaminesulphonic',
'polioencephalomyelitis',
'stereophotomicrograph',
'philosophicotheological',
'theologicometaphysical',
'benzalphenylhydrazone',
'scleroticochorioiditis',
'anthropomorphologically',
'thyroparathyroidectomize',
'disproportionableness',
'heterotransplantation',
'membranocartilaginous',
'scientificophilosophical',
'thyroparathyroidectomy',
'enterocholecystostomy',
'Prorhipidoglossomorpha',
'constitutionalization',
'poluphloisboiotatotic',
'anatomicopathological',
'zoologicoarchaeologist',
'protransubstantiation',
'labioglossopharyngeal',
'pneumohydropericardium',
'choledochoenterostomy',
'zygomaticoauricularis',
'anthropomorphological',
'stereophotomicrography',
'aquopentamminecobaltic',
'hexamethylenetetramine',
'macracanthrorhynchiasis',
'palaeodendrologically',
'intertransformability',
'hyperconscientiousness',
'laparocolpohysterotomy',
'indistinguishableness',
'formaldehydesulphoxylic',
'blepharosphincterectomy',
'transubstantiationalist',
'transubstantiationite',
'prostatovesiculectomy',
'pathologicohistological',
'platydolichocephalous',
'pneumoventriculography',
'photochromolithograph',
'gastroenteroanastomosis',
'chromophotolithograph',
'pentamethylenediamine',
'historicophilosophica',
'intellectualistically',
'gastroenterocolostomy',
'pancreaticogastrostomy',
'appendorontgenography',
'photospectroheliograph']
stages = ['''
+---+
| |
O |
/|\ |
/ \ |
|
=========
''', '''
+---+
| |
O |
/|\ |
/ |
|
=========
''', '''
+---+
| |
O |
/|\ |
|
|
=========
''', '''
+---+
| |
O |
/| |
|
|
=========''', '''
+---+
| |
O |
| |
|
|
=========
''', '''
+---+
| |
O |
|
|
|
=========
''', '''
+---+
| |
|
|
|
|
=========
''']
logo = '''
_
| |
| |__ __ _ _ __ __ _ _ __ ___ __ _ _ __
| '_ \ / _` | '_ \ / _` | '_ ` _ \ / _` | '_ \
| | | | (_| | | | | (_| | | | | | | (_| | | | |
|_| |_|\__,_|_| |_|\__, |_| |_| |_|\__,_|_| |_|
__/ |
|___/
''' | 21.716895 | 47 | 0.676409 | 155 | 4,756 | 20.380645 | 0.967742 | 0.003166 | 0.003799 | 0.003799 | 0.001899 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.171152 | 4,756 | 219 | 48 | 21.716895 | 0.80137 | 0 | 0 | 0.170616 | 0 | 0.014218 | 0.826571 | 0.659029 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
32aa7faedb604f995e124967e180cd9dc0c8087d | 2,245 | py | Python | credentials.py | Ken-mbira/Trust_Password_Protector | 7d4d25e6d10582c21cc84ce0ffdffe45d45c0d63 | [
"MIT"
] | null | null | null | credentials.py | Ken-mbira/Trust_Password_Protector | 7d4d25e6d10582c21cc84ce0ffdffe45d45c0d63 | [
"MIT"
] | null | null | null | credentials.py | Ken-mbira/Trust_Password_Protector | 7d4d25e6d10582c21cc84ce0ffdffe45d45c0d63 | [
"MIT"
] | 1 | 2021-09-07T05:08:02.000Z | 2021-09-07T05:08:02.000Z | import random
import string
class Cred:
"""
This is a class that makes the user credentials for their different accounts
"""
def __init__(self,account_name,user_name,email,password):
"""
This will construct an instance of the credentials class
"""
self.account_name = account_name
self.user_name = user_name
self.email = email
self.password = password
credential_list = []
def save_credential(self):
"""
This will add a newly created credential to the credentials list
"""
Cred.credential_list.append(self)
def delete_credential(self):
"""
This method will delete a credential from the credential list
"""
Cred.credential_list.remove(self)
@classmethod
def display_credentials(cls):
"""
This will display all the credentials in the credentials list
"""
return Cred.credential_list
@classmethod
def find_account(cls,account):
"""
This will return the credentials after being given an account name
Args:
account_name: This is the account of the credentials that will be used to locate the credential
"""
for credential in cls.credential_list:
if credential.account_name == account:
return credential
@classmethod
def credential_found(cls,account):
"""
This is a method that returns a boolean on finding or not finding a credential
Args:
account: This is the name of the account that is used to find the credential
"""
for credential in cls.credential_list:
if credential.account_name == account:
return True
return False
@classmethod
def password_generator(cls,length):
"""
this method generates a random password with letters, symbols and digits
Args:
length: This is the desired length of the password
"""
characters = string.ascii_letters + string.ascii_lowercase + string.ascii_uppercase + string.digits + string.punctuation
return "".join(random.choice(characters) for i in range(length)) | 32.071429 | 128 | 0.632962 | 264 | 2,245 | 5.276515 | 0.314394 | 0.055276 | 0.038765 | 0.031587 | 0.116296 | 0.116296 | 0.116296 | 0.116296 | 0.116296 | 0.116296 | 0 | 0 | 0.304677 | 2,245 | 70 | 129 | 32.071429 | 0.892377 | 0.354566 | 0 | 0.258065 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.225806 | false | 0.096774 | 0.064516 | 0 | 0.516129 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
32b80da9076a6963ab2a24a72478920a41611e59 | 181 | py | Python | src/keys_management/secret_key/types.py | nielsen-oss/keys-management | ddeeceb19dae68516272fe13dfc6521dcbe295f2 | [
"Apache-2.0"
] | 6 | 2021-06-25T17:21:18.000Z | 2021-07-13T17:31:28.000Z | src/keys_management/secret_key/types.py | nielsen-oss/keys-management | ddeeceb19dae68516272fe13dfc6521dcbe295f2 | [
"Apache-2.0"
] | null | null | null | src/keys_management/secret_key/types.py | nielsen-oss/keys-management | ddeeceb19dae68516272fe13dfc6521dcbe295f2 | [
"Apache-2.0"
] | null | null | null | from typing import Callable, Tuple, Union
StrOrBytes = Union[str, bytes]
StrOrBytesPair = Tuple[StrOrBytes, StrOrBytes]
KeysStore = Callable[[], Union[StrOrBytes, StrOrBytesPair]]
| 30.166667 | 59 | 0.78453 | 19 | 181 | 7.473684 | 0.578947 | 0.211268 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.110497 | 181 | 5 | 60 | 36.2 | 0.881988 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
32bb0cd05fa6989d453a40177c162d1a6d206545 | 10,866 | py | Python | datafiles/migrations/0001_initial.py | ChalkLab/SciFlow | 5bf021007d6184402ebfe6cefc2111d99160cb69 | [
"MIT"
] | 1 | 2021-04-26T20:03:11.000Z | 2021-04-26T20:03:11.000Z | datafiles/migrations/0001_initial.py | ChalkLab/SciFlow | 5bf021007d6184402ebfe6cefc2111d99160cb69 | [
"MIT"
] | 17 | 2021-04-23T16:51:59.000Z | 2021-12-13T21:17:41.000Z | datafiles/migrations/0001_initial.py | ChalkLab/SciFlow | 5bf021007d6184402ebfe6cefc2111d99160cb69 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.8 on 2021-10-12 15:54
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AspectActlog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('activitycode', models.CharField(max_length=16)),
('comment', models.CharField(max_length=256)),
('updated', models.DateTimeField()),
],
options={
'db_table': 'aspect_actlog',
'managed': False,
},
),
migrations.CreateModel(
name='AspectErrors',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('errorcode', models.CharField(max_length=16)),
('comment', models.CharField(max_length=256)),
('updated', models.DateTimeField()),
],
options={
'db_table': 'aspect_errors',
'managed': False,
},
),
migrations.CreateModel(
name='AspectFiles',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('file', models.TextField()),
('type', models.CharField(max_length=32)),
('version', models.IntegerField()),
('updated', models.DateTimeField()),
],
options={
'db_table': 'aspect_files',
'managed': False,
},
),
migrations.CreateModel(
name='AspectLookup',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uniqueid', models.CharField(max_length=128)),
('title', models.CharField(max_length=256)),
('type', models.CharField(max_length=16)),
('graphname', models.CharField(max_length=256)),
('currentversion', models.IntegerField()),
('auth_user_id', models.PositiveIntegerField()),
('updated', models.DateTimeField()),
],
options={
'db_table': 'aspect_lookup',
'managed': False,
},
),
migrations.CreateModel(
name='Datasets',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(default='', max_length=64)),
('sourcecode', models.CharField(max_length=16, null=True)),
('source', models.CharField(default='', max_length=64)),
('sourceurl', models.CharField(default='', max_length=256)),
('datasetname', models.CharField(max_length=16, null=True)),
('uniqueidformat', models.CharField(max_length=128, null=True)),
('protected', models.CharField(choices=[('yes', 'Yes'), ('no', 'No')], default='no', max_length=16)),
('count', models.IntegerField(default=0)),
],
options={
'db_table': 'datasets',
'managed': False,
},
),
migrations.CreateModel(
name='FacetActlog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('activitycode', models.CharField(max_length=16)),
('comment', models.CharField(max_length=256)),
('updated', models.DateTimeField()),
],
options={
'db_table': 'facet_actlog',
'managed': False,
},
),
migrations.CreateModel(
name='FacetErrors',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('errorcode', models.CharField(max_length=16)),
('comment', models.CharField(max_length=256)),
('updated', models.DateTimeField()),
],
options={
'db_table': 'facet_errors',
'managed': False,
},
),
migrations.CreateModel(
name='FacetFiles',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('file', models.TextField()),
('type', models.CharField(max_length=32)),
('version', models.IntegerField()),
('updated', models.DateTimeField()),
],
options={
'db_table': 'facet_files',
'managed': False,
},
),
migrations.CreateModel(
name='FacetLookup',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uniqueid', models.CharField(max_length=128)),
('title', models.CharField(max_length=256)),
('type', models.CharField(max_length=16)),
('graphname', models.CharField(max_length=256)),
('currentversion', models.IntegerField()),
('auth_user_id', models.PositiveIntegerField()),
('updated', models.DateTimeField()),
],
options={
'db_table': 'facet_lookup',
'managed': False,
},
),
migrations.CreateModel(
name='JsonActlog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('session', models.CharField(default=None, max_length=24)),
('activitylog', models.CharField(default='', max_length=2048)),
('comment', models.CharField(default=None, max_length=256)),
('updated', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'json_actlog',
'managed': False,
},
),
migrations.CreateModel(
name='JsonAspects',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('updated', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'json_aspects',
'managed': False,
},
),
migrations.CreateModel(
name='JsonErrors',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('session', models.CharField(default=None, max_length=24)),
('errorcode', models.CharField(default='', max_length=128)),
('comment', models.CharField(default=None, max_length=256)),
('updated', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'json_errors',
'managed': False,
},
),
migrations.CreateModel(
name='JsonFacets',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('updated', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'json_facets',
'managed': False,
},
),
migrations.CreateModel(
name='JsonFiles',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('file', models.TextField(default='')),
('type', models.CharField(default='', max_length=32)),
('version', models.IntegerField(default='')),
('jhash', models.CharField(blank=True, max_length=52, null=True)),
('comments', models.CharField(blank=True, max_length=32, null=True)),
('updated', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'json_files',
'managed': False,
},
),
migrations.CreateModel(
name='JsonLookup',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uniqueid', models.CharField(default='', max_length=128, unique=True)),
('title', models.CharField(default='', max_length=256)),
('graphname', models.CharField(default='', max_length=256)),
('currentversion', models.IntegerField(default=0)),
('auth_user_id', models.IntegerField(default='')),
('updated', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'json_lookup',
'managed': False,
},
),
migrations.CreateModel(
name='References',
fields=[
('id', models.SmallAutoField(primary_key=True, serialize=False)),
('journal', models.CharField(blank=True, max_length=256, null=True)),
('authors', models.CharField(blank=True, max_length=2048, null=True)),
('aulist', models.CharField(blank=True, max_length=1024, null=True)),
('year', models.PositiveSmallIntegerField(blank=True, null=True)),
('volume', models.CharField(blank=True, max_length=12, null=True)),
('issue', models.CharField(blank=True, max_length=16, null=True)),
('startpage', models.CharField(blank=True, max_length=16, null=True)),
('endpage', models.CharField(blank=True, max_length=16, null=True)),
('title', models.CharField(blank=True, max_length=512, null=True)),
('url', models.CharField(blank=True, max_length=256, null=True)),
('doi', models.CharField(max_length=256)),
('count', models.SmallIntegerField(blank=True, null=True)),
('updated', models.DateTimeField()),
],
options={
'db_table': 'references',
'managed': False,
},
),
]
| 43.119048 | 117 | 0.510307 | 921 | 10,866 | 5.87405 | 0.137894 | 0.130314 | 0.073198 | 0.097597 | 0.83512 | 0.786691 | 0.594455 | 0.577819 | 0.577819 | 0.537708 | 0 | 0.019457 | 0.342536 | 10,866 | 251 | 118 | 43.290837 | 0.737822 | 0.004141 | 0 | 0.639344 | 1 | 0 | 0.113874 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.004098 | 0 | 0.020492 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0869ba6e18dfa77decb88cf8144acde0c451215e | 49 | py | Python | src/titiler/application/titiler/application/__init__.py | kalxas/titiler | 5e4e497f1033eb64b65315068c094abe8259cd8c | [
"MIT"
] | null | null | null | src/titiler/application/titiler/application/__init__.py | kalxas/titiler | 5e4e497f1033eb64b65315068c094abe8259cd8c | [
"MIT"
] | null | null | null | src/titiler/application/titiler/application/__init__.py | kalxas/titiler | 5e4e497f1033eb64b65315068c094abe8259cd8c | [
"MIT"
] | null | null | null | """titiler.application"""
__version__ = "0.6.0"
| 12.25 | 25 | 0.653061 | 6 | 49 | 4.666667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068182 | 0.102041 | 49 | 3 | 26 | 16.333333 | 0.568182 | 0.387755 | 0 | 0 | 0 | 0 | 0.208333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0883de75e3222b2bd0245697a6613a014446c4c7 | 252 | py | Python | packages/regression_model/regression_model/__init__.py | abdurrehman11/deploying-machine-learning-models | 93872e4c197df2543e492af3df718bdad1817752 | [
"BSD-3-Clause"
] | null | null | null | packages/regression_model/regression_model/__init__.py | abdurrehman11/deploying-machine-learning-models | 93872e4c197df2543e492af3df718bdad1817752 | [
"BSD-3-Clause"
] | null | null | null | packages/regression_model/regression_model/__init__.py | abdurrehman11/deploying-machine-learning-models | 93872e4c197df2543e492af3df718bdad1817752 | [
"BSD-3-Clause"
] | null | null | null | import logging
from regression_model.config import config
from regression_model.config import logging_config
VERSION_PATH = config.PACKAGE_ROOT / 'VERSION'
with open(VERSION_PATH, 'r') as version_file:
__version__ = version_file.read().strip() | 25.2 | 50 | 0.797619 | 34 | 252 | 5.558824 | 0.5 | 0.137566 | 0.201058 | 0.26455 | 0.328042 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.123016 | 252 | 10 | 51 | 25.2 | 0.855204 | 0 | 0 | 0 | 0 | 0 | 0.031621 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
08af1415b9293340224b8360402e471dbf0548c7 | 5,716 | py | Python | django_geoip/south_migrations/0001_initial.py | mandalay-rp/django-geoip | 2608cb15cdd7678c2ff923aff2437b1a861b8e6b | [
"MIT"
] | 38 | 2015-01-10T06:44:12.000Z | 2021-11-16T10:53:43.000Z | django_geoip/south_migrations/0001_initial.py | mandalay-rp/django-geoip | 2608cb15cdd7678c2ff923aff2437b1a861b8e6b | [
"MIT"
] | 28 | 2015-01-11T08:44:06.000Z | 2019-07-25T19:04:10.000Z | django_geoip/south_migrations/0001_initial.py | mandalay-rp/django-geoip | 2608cb15cdd7678c2ff923aff2437b1a861b8e6b | [
"MIT"
] | 56 | 2015-01-11T08:30:57.000Z | 2021-10-01T05:57:00.000Z | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Country'
db.create_table('django_geoip_country', (
('code', self.gf('django.db.models.fields.CharField')(max_length=2, primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
))
db.send_create_signal('django_geoip', ['Country'])
# Adding model 'Region'
db.create_table('django_geoip_region', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('country', self.gf('django.db.models.fields.related.ForeignKey')(related_name='regions', to=orm['django_geoip.Country'])),
('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
))
db.send_create_signal('django_geoip', ['Region'])
# Adding unique constraint on 'Region', fields ['country', 'name']
db.create_unique('django_geoip_region', ['country_id', 'name'])
# Adding model 'City'
db.create_table('django_geoip_city', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('region', self.gf('django.db.models.fields.related.ForeignKey')(related_name='cities', to=orm['django_geoip.Region'])),
('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
('latitude', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=9, decimal_places=6, blank=True)),
('longitude', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=9, decimal_places=6, blank=True)),
))
db.send_create_signal('django_geoip', ['City'])
# Adding unique constraint on 'City', fields ['region', 'name']
db.create_unique('django_geoip_city', ['region_id', 'name'])
# Adding model 'IpRange'
db.create_table('django_geoip_iprange', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('start_ip', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)),
('end_ip', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)),
('country', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['django_geoip.Country'])),
('region', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['django_geoip.Region'], null=True)),
('city', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['django_geoip.City'], null=True)),
))
db.send_create_signal('django_geoip', ['IpRange'])
def backwards(self, orm):
# Removing unique constraint on 'City', fields ['region', 'name']
db.delete_unique('django_geoip_city', ['region_id', 'name'])
# Removing unique constraint on 'Region', fields ['country', 'name']
db.delete_unique('django_geoip_region', ['country_id', 'name'])
# Deleting model 'Country'
db.delete_table('django_geoip_country')
# Deleting model 'Region'
db.delete_table('django_geoip_region')
# Deleting model 'City'
db.delete_table('django_geoip_city')
# Deleting model 'IpRange'
db.delete_table('django_geoip_iprange')
models = {
'django_geoip.city': {
'Meta': {'unique_together': "(('region', 'name'),)", 'object_name': 'City'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'latitude': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '9', 'decimal_places': '6', 'blank': 'True'}),
'longitude': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '9', 'decimal_places': '6', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'region': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'cities'", 'to': "orm['django_geoip.Region']"})
},
'django_geoip.country': {
'Meta': {'object_name': 'Country'},
'code': ('django.db.models.fields.CharField', [], {'max_length': '2', 'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
},
'django_geoip.iprange': {
'Meta': {'object_name': 'IpRange'},
'city': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['django_geoip.City']", 'null': 'True'}),
'country': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['django_geoip.Country']"}),
'end_ip': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'region': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['django_geoip.Region']", 'null': 'True'}),
'start_ip': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'})
},
'django_geoip.region': {
'Meta': {'unique_together': "(('country', 'name'),)", 'object_name': 'Region'},
'country': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'regions'", 'to': "orm['django_geoip.Country']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
}
}
complete_apps = ['django_geoip']
| 53.420561 | 147 | 0.601645 | 652 | 5,716 | 5.105828 | 0.115031 | 0.079303 | 0.134575 | 0.19225 | 0.794233 | 0.736558 | 0.729348 | 0.664464 | 0.612797 | 0.519976 | 0 | 0.006529 | 0.196116 | 5,716 | 106 | 148 | 53.924528 | 0.717954 | 0.079951 | 0 | 0.162162 | 0 | 0 | 0.47245 | 0.250143 | 0 | 0 | 0 | 0 | 0 | 1 | 0.027027 | false | 0 | 0.054054 | 0 | 0.121622 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
08bee3076eef6096e40c84d40b43d0ef450a6e30 | 895 | py | Python | utils/randomdata.py | M1d0r1/py_mantis | 8d2b05601b9240e76e2e07b50770e39df5bcade9 | [
"Apache-2.0"
] | null | null | null | utils/randomdata.py | M1d0r1/py_mantis | 8d2b05601b9240e76e2e07b50770e39df5bcade9 | [
"Apache-2.0"
] | null | null | null | utils/randomdata.py | M1d0r1/py_mantis | 8d2b05601b9240e76e2e07b50770e39df5bcade9 | [
"Apache-2.0"
] | null | null | null | import random
import string
class RandomData:
def __init__(self):
pass
@staticmethod
def get_random_bool():
i = random.randrange(2)
if i == 0:
return True
else:
return False
@staticmethod
def get_random_list_value(list):
i = random.randrange(len(list))
return list[i]
# noinspection PyUnusedLocal
@staticmethod
def get_random_string():
ind = random.randrange(20)
s = ''.join([random.choice(string.ascii_letters + string.digits + " ") for i in range(ind)])
return s
@staticmethod
def get_random_phone():
return str(random.randrange(1000000, 9999999))
@staticmethod
def get_random_multistring():
return "%s\n%s\n%s" % (
RandomData.get_random_string(), RandomData.get_random_string(), RandomData.get_random_string())
| 22.948718 | 107 | 0.61676 | 103 | 895 | 5.145631 | 0.417476 | 0.135849 | 0.169811 | 0.226415 | 0.141509 | 0.141509 | 0.141509 | 0.141509 | 0 | 0 | 0 | 0.027994 | 0.281564 | 895 | 38 | 108 | 23.552632 | 0.796268 | 0.02905 | 0 | 0.178571 | 0 | 0 | 0.012687 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0.035714 | 0.071429 | 0.071429 | 0.535714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
08d4af28a19751f94bb0827b79075eb4b7ae0ea7 | 234 | py | Python | tests/test_print_as_discovered.py | acardos/git_inspector | ee194a62606ddb882ce0736618bae053e6b8521d | [
"MIT"
] | 4 | 2021-12-06T15:35:19.000Z | 2022-01-23T23:17:38.000Z | tests/test_print_as_discovered.py | acardos/git_inspector | ee194a62606ddb882ce0736618bae053e6b8521d | [
"MIT"
] | 12 | 2021-03-31T09:14:40.000Z | 2022-01-31T10:01:25.000Z | tests/test_print_as_discovered.py | acardos/git_inspector | ee194a62606ddb882ce0736618bae053e6b8521d | [
"MIT"
] | 1 | 2022-01-22T11:37:08.000Z | 2022-01-22T11:37:08.000Z |
from git import Repo
from git_inspector import find_git_directories
def test_find_git_directories(repo: Repo):
generator = find_git_directories(search_paths=[repo.working_dir])
assert next(generator) == repo.working_dir
| 19.5 | 69 | 0.794872 | 33 | 234 | 5.30303 | 0.484848 | 0.12 | 0.308571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136752 | 234 | 11 | 70 | 21.272727 | 0.866337 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
3eb626e1df9d6b1845d27917297cdbee245c41fb | 5,008 | py | Python | protos/gen/python/protos/public/modeldb/Lineage_pb2_grpc.py | CaptEmulation/modeldb | 78b10aca553e386554f9740db63466b1cf013a1a | [
"Apache-2.0"
] | 835 | 2017-02-08T20:14:24.000Z | 2020-03-12T17:37:49.000Z | protos/gen/python/protos/public/modeldb/Lineage_pb2_grpc.py | CaptEmulation/modeldb | 78b10aca553e386554f9740db63466b1cf013a1a | [
"Apache-2.0"
] | 651 | 2019-04-18T12:55:07.000Z | 2022-03-31T23:45:09.000Z | protos/gen/python/protos/public/modeldb/Lineage_pb2_grpc.py | CaptEmulation/modeldb | 78b10aca553e386554f9740db63466b1cf013a1a | [
"Apache-2.0"
] | 170 | 2017-02-13T14:49:22.000Z | 2020-02-19T17:59:12.000Z | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from ..modeldb import Lineage_pb2 as modeldb_dot_Lineage__pb2
class LineageServiceStub(object):
# missing associated documentation comment in .proto file
pass
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.addLineage = channel.unary_unary(
'/ai.verta.modeldb.LineageService/addLineage',
request_serializer=modeldb_dot_Lineage__pb2.AddLineage.SerializeToString,
response_deserializer=modeldb_dot_Lineage__pb2.AddLineage.Response.FromString,
)
self.deleteLineage = channel.unary_unary(
'/ai.verta.modeldb.LineageService/deleteLineage',
request_serializer=modeldb_dot_Lineage__pb2.DeleteLineage.SerializeToString,
response_deserializer=modeldb_dot_Lineage__pb2.DeleteLineage.Response.FromString,
)
self.findAllInputs = channel.unary_unary(
'/ai.verta.modeldb.LineageService/findAllInputs',
request_serializer=modeldb_dot_Lineage__pb2.FindAllInputs.SerializeToString,
response_deserializer=modeldb_dot_Lineage__pb2.FindAllInputs.Response.FromString,
)
self.findAllOutputs = channel.unary_unary(
'/ai.verta.modeldb.LineageService/findAllOutputs',
request_serializer=modeldb_dot_Lineage__pb2.FindAllOutputs.SerializeToString,
response_deserializer=modeldb_dot_Lineage__pb2.FindAllOutputs.Response.FromString,
)
self.findAllInputsOutputs = channel.unary_unary(
'/ai.verta.modeldb.LineageService/findAllInputsOutputs',
request_serializer=modeldb_dot_Lineage__pb2.FindAllInputsOutputs.SerializeToString,
response_deserializer=modeldb_dot_Lineage__pb2.FindAllInputsOutputs.Response.FromString,
)
class LineageServiceServicer(object):
# missing associated documentation comment in .proto file
pass
def addLineage(self, request, context):
# missing associated documentation comment in .proto file
pass
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def deleteLineage(self, request, context):
# missing associated documentation comment in .proto file
pass
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def findAllInputs(self, request, context):
# missing associated documentation comment in .proto file
pass
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def findAllOutputs(self, request, context):
# missing associated documentation comment in .proto file
pass
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def findAllInputsOutputs(self, request, context):
# missing associated documentation comment in .proto file
pass
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_LineageServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'addLineage': grpc.unary_unary_rpc_method_handler(
servicer.addLineage,
request_deserializer=modeldb_dot_Lineage__pb2.AddLineage.FromString,
response_serializer=modeldb_dot_Lineage__pb2.AddLineage.Response.SerializeToString,
),
'deleteLineage': grpc.unary_unary_rpc_method_handler(
servicer.deleteLineage,
request_deserializer=modeldb_dot_Lineage__pb2.DeleteLineage.FromString,
response_serializer=modeldb_dot_Lineage__pb2.DeleteLineage.Response.SerializeToString,
),
'findAllInputs': grpc.unary_unary_rpc_method_handler(
servicer.findAllInputs,
request_deserializer=modeldb_dot_Lineage__pb2.FindAllInputs.FromString,
response_serializer=modeldb_dot_Lineage__pb2.FindAllInputs.Response.SerializeToString,
),
'findAllOutputs': grpc.unary_unary_rpc_method_handler(
servicer.findAllOutputs,
request_deserializer=modeldb_dot_Lineage__pb2.FindAllOutputs.FromString,
response_serializer=modeldb_dot_Lineage__pb2.FindAllOutputs.Response.SerializeToString,
),
'findAllInputsOutputs': grpc.unary_unary_rpc_method_handler(
servicer.findAllInputsOutputs,
request_deserializer=modeldb_dot_Lineage__pb2.FindAllInputsOutputs.FromString,
response_serializer=modeldb_dot_Lineage__pb2.FindAllInputsOutputs.Response.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'ai.verta.modeldb.LineageService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
| 43.547826 | 103 | 0.76877 | 501 | 5,008 | 7.367265 | 0.139721 | 0.059604 | 0.096722 | 0.11379 | 0.752371 | 0.752371 | 0.551883 | 0.297209 | 0.297209 | 0.297209 | 0 | 0.005216 | 0.157748 | 5,008 | 114 | 104 | 43.929825 | 0.869844 | 0.101238 | 0 | 0.306818 | 1 | 0 | 0.12648 | 0.059441 | 0 | 0 | 0 | 0 | 0 | 1 | 0.079545 | false | 0.079545 | 0.022727 | 0 | 0.125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
3ed9dea01e0c68f96f2ada5e7ccd8ced87c473be | 329 | py | Python | legiti_challenge/feature_store_pipelines/user/__init__.py | rafaelleinio/legiti-challenge | 5f15cb759d13e23292dffd103bc63583c934bf8b | [
"MIT"
] | 1 | 2021-04-01T19:55:51.000Z | 2021-04-01T19:55:51.000Z | legiti_challenge/feature_store_pipelines/user/__init__.py | rafaelleinio/legiti-challenge | 5f15cb759d13e23292dffd103bc63583c934bf8b | [
"MIT"
] | null | null | null | legiti_challenge/feature_store_pipelines/user/__init__.py | rafaelleinio/legiti-challenge | 5f15cb759d13e23292dffd103bc63583c934bf8b | [
"MIT"
] | null | null | null | """Module containing imports for user entity feature set pipelines."""
from legiti_challenge.feature_store_pipelines.user.user_chargebacks import (
UserChargebacksPipeline,
)
from legiti_challenge.feature_store_pipelines.user.user_orders import UserOrdersPipeline
__all__ = ["UserChargebacksPipeline", "UserOrdersPipeline"]
| 41.125 | 88 | 0.841945 | 34 | 329 | 7.794118 | 0.558824 | 0.075472 | 0.143396 | 0.196226 | 0.362264 | 0.362264 | 0.362264 | 0.362264 | 0 | 0 | 0 | 0 | 0.085106 | 329 | 7 | 89 | 47 | 0.880399 | 0.194529 | 0 | 0 | 0 | 0 | 0.158301 | 0.088803 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3eecb6e97ffd929b50cc81c0b14af95a02561e17 | 150 | py | Python | 1015.py | gabzin/beecrowd | 177bdf3f87bacfd924bd031a973b8db877379fe5 | [
"MIT"
] | 3 | 2021-12-15T20:27:14.000Z | 2022-03-01T12:30:08.000Z | 1015.py | gabzin/uri | 177bdf3f87bacfd924bd031a973b8db877379fe5 | [
"MIT"
] | null | null | null | 1015.py | gabzin/uri | 177bdf3f87bacfd924bd031a973b8db877379fe5 | [
"MIT"
] | null | null | null | from math import sqrt
x1,y1=map(float,input().split())
x2,y2=map(float,input().split())
p1=x2-x1
p2=y2-y1
res=sqrt((p1*p1)+(p2*p2))
print("%.4f"%res)
| 18.75 | 32 | 0.66 | 31 | 150 | 3.193548 | 0.548387 | 0.161616 | 0.262626 | 0.363636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.107143 | 0.066667 | 150 | 7 | 33 | 21.428571 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0.026667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0.142857 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3ef53bdde39e3c5144f18bd2ee63f39dd48f0058 | 1,568 | py | Python | simdigree/dummy.py | aryakaul/simdigree | 403e0130771c400b7687179363c7eba5ed9feeb2 | [
"MIT"
] | 1 | 2018-11-12T19:41:14.000Z | 2018-11-12T19:41:14.000Z | simdigree/dummy.py | aryakaul/simdigree | 403e0130771c400b7687179363c7eba5ed9feeb2 | [
"MIT"
] | null | null | null | simdigree/dummy.py | aryakaul/simdigree | 403e0130771c400b7687179363c7eba5ed9feeb2 | [
"MIT"
] | null | null | null | class Dummy:
"""
Class for use when given a pedigree to model.
I create a 'dummy' for each individual with key information about that
individual
"""
def __init__(self, parents, founder, children=[]):
self.parents = parents
self.founder = founder
self.children = children
def __str__(self):
return("Parents: %s\nFounder?: %s\n Children: %s\n" % (self.get_parents(), self.is_founder(), self.get_children()))
def is_founder(self):
return self.founder
def get_parents(self):
return self.parents
def get_children(self):
return self.children
def add_child(self, child):
copy = list(self.children)
copy.append(child)
self.children = copy
class DummyPair:
"""
Class for use when given a pedigree to model.
I create a 'DummyPair' for each married pair found in the original
pedigree
"""
def __init__(self, parents, children=[]):
self.pair = parents
self.children = children
def __eq__(self, other):
if self.pair == other.pair:
return True
return False
def __str__(self):
return("Pair: %s\tNo.Children: %s" % (self.get_pair(), self.get_num_children()))
def get_num_children(self):
return len(self.get_children())
def get_children(self):
return self.children
def add_child(self, child):
copy = list(self.children)
copy.append(child)
self.children = copy
def get_pair(self):
return self.pair
| 24.5 | 123 | 0.616071 | 199 | 1,568 | 4.673367 | 0.261307 | 0.103226 | 0.075269 | 0.032258 | 0.324731 | 0.324731 | 0.324731 | 0.324731 | 0.324731 | 0.324731 | 0 | 0 | 0.279337 | 1,568 | 63 | 124 | 24.888889 | 0.823009 | 0.158801 | 0 | 0.432432 | 0 | 0 | 0.052673 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.351351 | false | 0 | 0 | 0.216216 | 0.621622 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
41141320d4d129bb735e6489daf0039fbb723f89 | 300 | py | Python | Python Files/count_down.py | gerryjenkinslb/cs22-slides-and-py-files | 9474f7a2e50d57afa13edc3b13c008f7295da747 | [
"MIT"
] | 28 | 2019-07-05T04:00:45.000Z | 2022-02-16T09:43:50.000Z | Python Files/count_down.py | gerryjenkinslb/cs22-slides-and-py-files | 9474f7a2e50d57afa13edc3b13c008f7295da747 | [
"MIT"
] | null | null | null | Python Files/count_down.py | gerryjenkinslb/cs22-slides-and-py-files | 9474f7a2e50d57afa13edc3b13c008f7295da747 | [
"MIT"
] | 22 | 2018-10-24T04:42:05.000Z | 2022-02-04T08:17:27.000Z | # simple recursions
def count_down(n): # print n, n-1, n-2, ... , 3, 2, 1
print(n, end=" ")
if n > 1: # check for end case
count_down(n-1) # do smaller problem
print("-"*5, "count down from 10")
count_down(10)
print()
print("-"*5, "count down from 5")
count_down(5)
print()
| 20 | 54 | 0.576667 | 52 | 300 | 3.25 | 0.403846 | 0.319527 | 0.177515 | 0.177515 | 0.224852 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065789 | 0.24 | 300 | 14 | 55 | 21.428571 | 0.675439 | 0.293333 | 0 | 0.2 | 0 | 0 | 0.183575 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0 | 0 | 0.1 | 0.5 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
4116fb09afbe45f7f25e769dc8cd6a9b1dcfa4fc | 1,513 | py | Python | src/activations.py | saman-codes/dldojo | 9fd828f1902ba3d46e9bb5f554ef37d07335b29e | [
"MIT"
] | null | null | null | src/activations.py | saman-codes/dldojo | 9fd828f1902ba3d46e9bb5f554ef37d07335b29e | [
"MIT"
] | null | null | null | src/activations.py | saman-codes/dldojo | 9fd828f1902ba3d46e9bb5f554ef37d07335b29e | [
"MIT"
] | null | null | null | # Standard Python
import copy
# Thirdparty
import numpy as np
class Activation():
'''
Base class for an activation layer
Inspired by
https://github.com/eriklindernoren/ML-From-Scratch/blob/master/mlfromscratch/deep_learning/activation_functions.py
'''
def __call__(self, x):
return
def derivative(self, x):
return
class Relu(Activation):
def __call__(self, x):
return np.absolute(x * (x > 0))
def derivative(self, x):
return np.absolute(1. * (x > 0))
class LeakyRelu(Activation):
def __init__(self, mu=0.05):
self.mu = mu
return
def __call__(self, x):
return np.maximum(self.mu*x, x)
def derivative(self, x):
x[x>=0] = 1
x[x<1] = self.mu
return x
class Linear(Activation):
def __call__(self, x):
return x
def derivative(self, x):
return 1
class Sigmoid(Activation):
def __call__(self, x):
return 1./(1.+np.nan_to_num((np.exp(-x))))
def derivative(self, x):
return self.__call__(x)*(1.-self.__call__(x))
class Softmax(Activation):
def __call__(self, x):
# Using normalised x for numerical stability
norm_x = x - np.max(x, axis=0)
return np.exp(norm_x) / np.exp(norm_x).sum(axis=0, keepdims=True)
def derivative(self, x):
batch_jacobian = np.apply_along_axis(
lambda col: np.diag(col) - np.outer(col, col), 0, self.__call__(x))
return batch_jacobian
| 19.649351 | 118 | 0.604759 | 211 | 1,513 | 4.094787 | 0.331754 | 0.069444 | 0.114583 | 0.083333 | 0.325231 | 0.180556 | 0 | 0 | 0 | 0 | 0 | 0.014453 | 0.268341 | 1,513 | 76 | 119 | 19.907895 | 0.766034 | 0.153999 | 0 | 0.425 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.325 | false | 0 | 0.05 | 0.225 | 0.85 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
412303d786bf1234fa947a471b024bc73e098561 | 173 | py | Python | Python/Programming Fundamentals/Exams/72. Ad Astra Second.py | teodoramilcheva/softuni-software-engineering | 98dc9faa66f42570f6538fd7ef186d2bd1d39bff | [
"MIT"
] | null | null | null | Python/Programming Fundamentals/Exams/72. Ad Astra Second.py | teodoramilcheva/softuni-software-engineering | 98dc9faa66f42570f6538fd7ef186d2bd1d39bff | [
"MIT"
] | null | null | null | Python/Programming Fundamentals/Exams/72. Ad Astra Second.py | teodoramilcheva/softuni-software-engineering | 98dc9faa66f42570f6538fd7ef186d2bd1d39bff | [
"MIT"
] | null | null | null | Python 3.9.2 (v3.9.2:1a79785e3e, Feb 19 2021, 09:06:10)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
>>> | 43.25 | 72 | 0.66474 | 32 | 173 | 3.59375 | 0.875 | 0.034783 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.22 | 0.132948 | 173 | 4 | 73 | 43.25 | 0.546667 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f5ae7c5fd10eb5c3a55627538569669fa5235f04 | 399 | py | Python | cpdb/popup/factories.py | invinst/CPDBv2_backend | b4e96d620ff7a437500f525f7e911651e4a18ef9 | [
"Apache-2.0"
] | 25 | 2018-07-20T22:31:40.000Z | 2021-07-15T16:58:41.000Z | cpdb/popup/factories.py | invinst/CPDBv2_backend | b4e96d620ff7a437500f525f7e911651e4a18ef9 | [
"Apache-2.0"
] | 13 | 2018-06-18T23:08:47.000Z | 2022-02-10T07:38:25.000Z | cpdb/popup/factories.py | invinst/CPDBv2_backend | b4e96d620ff7a437500f525f7e911651e4a18ef9 | [
"Apache-2.0"
] | 6 | 2018-05-17T21:59:43.000Z | 2020-11-17T00:30:26.000Z | import factory
from faker import Faker
from popup.models import Popup
fake = Faker()
class PopupFactory(factory.django.DjangoModelFactory):
class Meta:
model = Popup
name = factory.LazyFunction(lambda: fake.word())
page = factory.LazyFunction(lambda: fake.word())
title = factory.LazyFunction(lambda: fake.word())
text = factory.LazyFunction(lambda: fake.text(512))
| 23.470588 | 55 | 0.719298 | 47 | 399 | 6.106383 | 0.446809 | 0.264808 | 0.348432 | 0.404181 | 0.344948 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009091 | 0.172932 | 399 | 16 | 56 | 24.9375 | 0.860606 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.272727 | 0 | 0.818182 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f5dc231bdf053f390dc67dc11fbefb6147ad20d2 | 188 | py | Python | setup.py | wicrep/triplet-reid | 251c24d828e223de75b45ae65aa3f38171f9676b | [
"MIT"
] | null | null | null | setup.py | wicrep/triplet-reid | 251c24d828e223de75b45ae65aa3f38171f9676b | [
"MIT"
] | null | null | null | setup.py | wicrep/triplet-reid | 251c24d828e223de75b45ae65aa3f38171f9676b | [
"MIT"
] | null | null | null | from setuptools import find_packages, setup
setup(
name="triplet-reid",
version="0.1.0",
description="Triplet-based Person Re-Identification",
packages=find_packages(),
)
| 20.888889 | 57 | 0.712766 | 23 | 188 | 5.73913 | 0.73913 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018987 | 0.159574 | 188 | 8 | 58 | 23.5 | 0.816456 | 0 | 0 | 0 | 0 | 0 | 0.292553 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.142857 | 0 | 0.142857 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
eb1c6dbf88d8c9f286de25fdab3e7030a01a795a | 10,209 | py | Python | python/gameduino/base.py | Godzil/gameduino | 3a9d04b9820ca7edb04df4583fa14300e913fdb9 | [
"BSD-3-Clause"
] | 17 | 2016-09-13T09:11:03.000Z | 2020-09-30T03:31:15.000Z | python/gameduino/base.py | lambdamikel/gameduino | 3a9d04b9820ca7edb04df4583fa14300e913fdb9 | [
"BSD-3-Clause"
] | null | null | null | python/gameduino/base.py | lambdamikel/gameduino | 3a9d04b9820ca7edb04df4583fa14300e913fdb9 | [
"BSD-3-Clause"
] | 12 | 2017-07-03T21:57:41.000Z | 2021-11-02T17:47:23.000Z | import struct
ascii_glyphs = [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00,
0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x7f, 0x36, 0x7f, 0x36, 0x36, 0x00,
0x0c, 0x3f, 0x68, 0x3e, 0x0b, 0x7e, 0x18, 0x00, 0x60, 0x66, 0x0c, 0x18, 0x30, 0x66, 0x06, 0x00,
0x38, 0x6c, 0x6c, 0x38, 0x6d, 0x66, 0x3b, 0x00, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0c, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00,
0x00, 0x18, 0x7e, 0x3c, 0x7e, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00,
0x3c, 0x66, 0x6e, 0x7e, 0x76, 0x66, 0x3c, 0x00, 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00,
0x3c, 0x66, 0x06, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x3c, 0x66, 0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00,
0x0c, 0x1c, 0x3c, 0x6c, 0x7e, 0x0c, 0x0c, 0x00, 0x7e, 0x60, 0x7c, 0x06, 0x06, 0x66, 0x3c, 0x00,
0x1c, 0x30, 0x60, 0x7c, 0x66, 0x66, 0x3c, 0x00, 0x7e, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x00,
0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c, 0x00, 0x3c, 0x66, 0x66, 0x3e, 0x06, 0x0c, 0x38, 0x00,
0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30,
0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00,
0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x3c, 0x66, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x00,
0x3c, 0x66, 0x6e, 0x6a, 0x6e, 0x60, 0x3c, 0x00, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00,
0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x7c, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x00,
0x78, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0x78, 0x00, 0x7e, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x7e, 0x00,
0x7e, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x00, 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3c, 0x00,
0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00,
0x3e, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38, 0x00, 0x66, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00,
0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00, 0x63, 0x77, 0x7f, 0x6b, 0x6b, 0x63, 0x63, 0x00,
0x66, 0x66, 0x76, 0x7e, 0x6e, 0x66, 0x66, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x6a, 0x6c, 0x36, 0x00,
0x7c, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x00, 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00,
0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x63, 0x63, 0x6b, 0x6b, 0x7f, 0x77, 0x63, 0x00,
0x66, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00,
0x7e, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00, 0x7c, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7c, 0x00,
0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x3e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x3e, 0x00,
0x18, 0x3c, 0x66, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0x1c, 0x36, 0x30, 0x7c, 0x30, 0x30, 0x7e, 0x00, 0x00, 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x3e, 0x00,
0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x66, 0x3c, 0x00,
0x06, 0x06, 0x3e, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00,
0x1c, 0x30, 0x30, 0x7c, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x06, 0x3c,
0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x00, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00,
0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x70, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0x00,
0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x36, 0x7f, 0x6b, 0x6b, 0x63, 0x00,
0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00,
0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x06, 0x07,
0x00, 0x00, 0x6c, 0x76, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x3e, 0x60, 0x3c, 0x06, 0x7c, 0x00,
0x30, 0x30, 0x7c, 0x30, 0x30, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00,
0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x00,
0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c,
0x00, 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x0c, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0c, 0x00,
0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, 0x30, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x30, 0x00,
0x31, 0x6b, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
]
from gameduino.registers import *
# BaseGameduino is the common base for the Gameduino objects in remote and sim
class BaseGameduino(object):
def coldstart(self):
self.wr(J1_RESET, 1)
self.fill(RAM_PIC, 0, 10 * 1024)
for i in range(512):
self.sprite(i, 400, 400, 0, 0, 0)
self.wr16(SPR_DISABLE, 0)
self.wr16(SPR_PAGE, 0)
self.wr16(JK_MODE, 0)
self.wr16(SCROLL_X, 0)
self.wr16(SCROLL_Y, 0)
self.wr16(BG_COLOR, 0)
self.wr16(SAMPLE_L, 0)
self.wr16(SAMPLE_R, 0)
self.wr16(SCREENSHOT_Y, 0)
def dump(self, a, l):
""" Dump ``l`` bytes memory starting at address ``a`` """
for i in range(0, l, 16):
d16 = self.rdstr(a + i, 16)
print "%04x %s" % (a + i, " ".join(["%02x" % ord(c) for c in d16]))
def wr(self, a, v):
""" Write a single byte ``v`` to address ``a``. """
self.wrstr(a, chr(v))
def fill(self, a, v, c):
""" Fill ``c`` bytes of memory at address ``a`` with value ``v`` """
self.wrstr(a, chr(v) * c)
def putstr(self, x, y, v):
""" Write string ``v`` at screen position (x,y) """
a = y * 64 + x
self.wrstr(a, v)
def rd16(self, a):
return struct.unpack("<H", self.rdstr(a, 2))[0]
def rd32(self, a):
return struct.unpack("<L", self.rdstr(a, 4))[0]
def wr16(self, a, v):
""" Write 16-bit value ``v`` at to address ``a`` """
self.wrstr(a, struct.pack("<H", v))
def wr32(self, a, v):
""" Write 32-bit value ``v`` at to address ``a`` """
self.wrstr(a, struct.pack("<L", v))
def setpal(self, pal, rgb):
self.wr16(RAM_PAL + (pal << 1), rgb);
def ascii(self):
stretch = [
0x00, 0x03, 0x0c, 0x0f,
0x30, 0x33, 0x3c, 0x3f,
0xc0, 0xc3, 0xcc, 0xcf,
0xf0, 0xf3, 0xfc, 0xff ]
gstr = ""
for i in range(768):
b = ascii_glyphs[i]
h = stretch[b >> 4]
l = stretch[b & 0xf]
gstr += chr(h)
gstr += chr(l)
self.wrstr(0x1000 + (16 * ord(' ')), gstr)
for i in range(0x20, 0x80):
self.setpal(4 * i + 0, TRANSPARENT);
self.setpal(4 * i + 3, RGB(255,255,255));
self.fill(RAM_PIC, ord(' '), 4096);
def voice(self, v, wave, freq, lamp, ramp = None):
"""
Set the state of a voice.
:param v: voice number 0-63
:type v: int
:param wave: wave type, 0 for sine 1 for noise
:type wave: int
:param freq: frequency control, in quarter-hertz
:type freq: int
:param lamp: left amplitude 0-255
:type lamp: int
:param ramp: right amplitude 0-255, defaults to same ``lamp``
:type ramp: int
"""
if ramp is None:
ramp = lamp
self.wr32(VOICES + (4 * v), freq | (wave << 15) | (lamp << 16) | (ramp << 24))
def silence(self):
""" Switch all voices off """
for i in range(64):
self.voice(i, 0, 4 * 440, 0, 0)
def copy(self, a, v):
self.wrstr(a, v)
def microcode(self, src):
"""
Halt coprocessor, load microprogram, restart coprocessor
:param src: the microprogram, as a string, expressed
:type src: string
The string is loaded into the Gameduino's microprogram area,
and can be up to 256 bytes. For example, to load the
:ref:`splitscreen` microprogram::
splitscreen_code = open("splitscreen.binle", "b").read()
gd.microcode(splitscreen_code)
"""
self.wr(J1_RESET, 1)
self.copy(J1_CODE, src)
self.wr(J1_RESET, 0)
def sprite(self, spr, x, y, image, palette, rot, jk = 0):
"""
Set the state of a hardware sprite
:param spr: sprite number 0-511
:param x: x coordinate
:param y: y coordinate
:param image: sprite source image 0-63
:param palette: sprite palette select, 0-15, see below
:param rot: sprite rotate control 0-7, see :ref:`rotate`
:param jk: collision class control, 0-1
Palette select controls the number of colors used for the sprite, the source palette, and which data bits
to use as source.
"""
self.wr32(RAM_SPR + (4 * spr),
(x & 511) | ((rot & 7) << 9) | ((palette & 15) << 12) | ((y & 511) << 16) | ((image & 63) << 25) | ((jk & 1) << 31))
def im(self):
"""
Return the current screen as a 400x300 RGB PIL Image::
>>> import gameduino.sim
>>> gd = gameduino.sim.Gameduino()
>>> gd.im().save("screenshot.png")
"""
return self._im()
| 49.081731 | 134 | 0.54687 | 1,450 | 10,209 | 3.835172 | 0.168276 | 0.130912 | 0.120842 | 0.083438 | 0.37763 | 0.241324 | 0.152131 | 0.055745 | 0.044237 | 0.037044 | 0 | 0.329834 | 0.309531 | 10,209 | 207 | 135 | 49.318841 | 0.459072 | 0.007444 | 0 | 0.032258 | 0 | 0 | 0.002822 | 0 | 0 | 0 | 0.386871 | 0 | 0 | 0 | null | null | 0 | 0.016129 | null | null | 0.008065 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
de188ec6c9675e889154db140be0ba41e013c1c2 | 835 | py | Python | shc/__init__.py | fabaff/smarthomeconnect | 611cd0f372d03b5fc5798a2a9a5f962d1da72799 | [
"Apache-2.0"
] | 5 | 2021-07-02T21:48:45.000Z | 2021-12-12T21:55:42.000Z | shc/__init__.py | fabaff/smarthomeconnect | 611cd0f372d03b5fc5798a2a9a5f962d1da72799 | [
"Apache-2.0"
] | 49 | 2020-09-18T20:05:55.000Z | 2022-03-05T19:51:33.000Z | shc/__init__.py | fabaff/smarthomeconnect | 611cd0f372d03b5fc5798a2a9a5f962d1da72799 | [
"Apache-2.0"
] | 1 | 2021-12-10T14:50:43.000Z | 2021-12-10T14:50:43.000Z | # Copyright 2020 Michael Thies <mail@mhthies.de>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
from . import base
from . import supervisor
from . import variables
from . import datatypes
from . import conversion
from . import timer
from .base import handler, blocking_handler
from .variables import Variable
from .supervisor import main
| 34.791667 | 120 | 0.777246 | 125 | 835 | 5.184 | 0.624 | 0.092593 | 0.040123 | 0.049383 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011478 | 0.165269 | 835 | 23 | 121 | 36.304348 | 0.918221 | 0.68024 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
de27afb959d2cb13e74aaad06b80a65da178a7e6 | 170 | py | Python | Language Skills/Python/Unit 08 Loops/01 Loops/Step Up 'For's/While Loops/3-While You're at it.py | rhyep/Python_tutorials | f5c8a64b91802b005dfe7dd9035f8d8daae8c3e3 | [
"MIT"
] | 346 | 2016-02-22T20:21:10.000Z | 2022-01-27T20:55:53.000Z | Language Skills/Python/Unit 8/1-Loops/While Loops/3-While You're at it.py | vpstudios/Codecademy-Exercise-Answers | ebd0ee8197a8001465636f52c69592ea6745aa0c | [
"MIT"
] | 55 | 2016-04-07T13:58:44.000Z | 2020-06-25T12:20:24.000Z | Language Skills/Python/Unit 8/1-Loops/While Loops/3-While You're at it.py | vpstudios/Codecademy-Exercise-Answers | ebd0ee8197a8001465636f52c69592ea6745aa0c | [
"MIT"
] | 477 | 2016-02-21T06:17:02.000Z | 2021-12-22T10:08:01.000Z | num = 1
while num <= 10: # Fill in the condition
x = num ** 2# Print num squared
num = num + 1# Increment num (make sure to do this!)
print x
print num
| 21.25 | 56 | 0.594118 | 29 | 170 | 3.482759 | 0.62069 | 0.079208 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043103 | 0.317647 | 170 | 7 | 57 | 24.285714 | 0.827586 | 0.452941 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
de2edc2bbe1eee14e878fa5bd6b3104c3a6af8ad | 144 | py | Python | test/test_sum_up.py | marco-a-wagner/nirvana | 325756ec5f208994767b4909ed217ce716f5fcfb | [
"CC0-1.0"
] | null | null | null | test/test_sum_up.py | marco-a-wagner/nirvana | 325756ec5f208994767b4909ed217ce716f5fcfb | [
"CC0-1.0"
] | null | null | null | test/test_sum_up.py | marco-a-wagner/nirvana | 325756ec5f208994767b4909ed217ce716f5fcfb | [
"CC0-1.0"
] | null | null | null | from src.sum_up import *
def test_sum_up():
x = 1
y = 2
assert sum_up(x,y) == 3
def test_sum_up3():
assert sum_up3(1,2,3) == 6 | 16 | 30 | 0.583333 | 30 | 144 | 2.566667 | 0.5 | 0.194805 | 0.25974 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.085714 | 0.270833 | 144 | 9 | 30 | 16 | 0.647619 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | 1 | 0.285714 | false | 0 | 0.142857 | 0 | 0.428571 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
de37ff05a0046e06ac61cbc292e777a426c175fb | 525 | py | Python | graphsaint/setup.py | alexs131/GraphSAINT | 20ac0dce1bdad0505b98ab117aaca84d1aa0bcd8 | [
"MIT"
] | null | null | null | graphsaint/setup.py | alexs131/GraphSAINT | 20ac0dce1bdad0505b98ab117aaca84d1aa0bcd8 | [
"MIT"
] | null | null | null | graphsaint/setup.py | alexs131/GraphSAINT | 20ac0dce1bdad0505b98ab117aaca84d1aa0bcd8 | [
"MIT"
] | null | null | null | # cython: language_level=3
from distutils.core import setup, Extension
from Cython.Build import cythonize
import numpy
# import cython_utils
import os
os.environ["CC"] = "/opt/homebrew/Cellar/gcc/11.2.0_3/bin/g++-11"
os.environ["CXX"] = "/opt/homebrew/Cellar/gcc/11.2.0_3/bin/g++-11"
setup(ext_modules=cythonize(["graphsaint/cython_sampler.pyx", "graphsaint/cython_utils.pyx",
"graphsaint/norm_aggr.pyx"]), include_dirs=[numpy.get_include()])
# to compile: python graphsaint/setup.py build_ext --inplace
| 37.5 | 93 | 0.737143 | 80 | 525 | 4.7 | 0.525 | 0.058511 | 0.090426 | 0.106383 | 0.164894 | 0.164894 | 0.164894 | 0.164894 | 0.164894 | 0.164894 | 0 | 0.032051 | 0.108571 | 525 | 13 | 94 | 40.384615 | 0.771368 | 0.19619 | 0 | 0 | 0 | 0 | 0.42716 | 0.414815 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
de3d6c63aa40e3dc9ff43cbc7c4deca001d8d40e | 172 | py | Python | runserver.py | revalo/hush.mit.edu | e47c28c934dcfb94c52f6e12367869389e8ed7a8 | [
"MIT"
] | 21 | 2017-10-30T20:55:48.000Z | 2021-09-03T14:06:58.000Z | runserver.py | revalo/hush.mit.edu | e47c28c934dcfb94c52f6e12367869389e8ed7a8 | [
"MIT"
] | 1 | 2021-11-08T02:05:34.000Z | 2021-11-08T06:54:41.000Z | runserver.py | revalo/hush.mit.edu | e47c28c934dcfb94c52f6e12367869389e8ed7a8 | [
"MIT"
] | 3 | 2017-11-15T23:18:00.000Z | 2018-01-01T06:44:03.000Z | from confess import app
from confess.config import PORT, DEBUG
if __name__ == '__main__':
app.run(
host='0.0.0.0',
port=PORT,
debug=DEBUG
) | 19.111111 | 38 | 0.593023 | 24 | 172 | 3.916667 | 0.541667 | 0.06383 | 0.06383 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032787 | 0.290698 | 172 | 9 | 39 | 19.111111 | 0.737705 | 0 | 0 | 0 | 0 | 0 | 0.086705 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 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 | 0 | 0 | 0 | 0 | 3 |
de87df11dbf3b3a221e585a21372627cd71cbf40 | 173 | py | Python | aula3/ola/urls.py | Danilo-Xaxa/django_cs50w | 5ae2e076f35a8c32a4e445f8cfd1c66500fbc496 | [
"MIT"
] | null | null | null | aula3/ola/urls.py | Danilo-Xaxa/django_cs50w | 5ae2e076f35a8c32a4e445f8cfd1c66500fbc496 | [
"MIT"
] | null | null | null | aula3/ola/urls.py | Danilo-Xaxa/django_cs50w | 5ae2e076f35a8c32a4e445f8cfd1c66500fbc496 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('<str:nome>', views.cumprimentar, name='cumprimentar'),
] | 24.714286 | 64 | 0.676301 | 21 | 173 | 5.571429 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150289 | 173 | 7 | 65 | 24.714286 | 0.795918 | 0 | 0 | 0 | 0 | 0 | 0.155172 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
de88b285c3b2ad75dee639aa1cc273972692cd58 | 619 | py | Python | MinersArchers/game/game_data/cells/Cell_pygame.py | ea-evdokimov/MinersArchers | 2e2830d3723b66cbd0e8829092124e30f8b4c854 | [
"MIT"
] | null | null | null | MinersArchers/game/game_data/cells/Cell_pygame.py | ea-evdokimov/MinersArchers | 2e2830d3723b66cbd0e8829092124e30f8b4c854 | [
"MIT"
] | null | null | null | MinersArchers/game/game_data/cells/Cell_pygame.py | ea-evdokimov/MinersArchers | 2e2830d3723b66cbd0e8829092124e30f8b4c854 | [
"MIT"
] | null | null | null | import pygame
from game.game_data.cells.Cell import Cell
from game.pygame_ import PICS_pygame, CELL_SIZE
from game.pygame_.Object import Object
class PyGCell(Object, Cell):
# TODO не передавать лишнее
def __init__(self, id__, cell: Cell, x_: int, y_: int):
Object.__init__(self, id__, *self.create_coordinates(x_, y_), CELL_SIZE, CELL_SIZE)
image = pygame.image.load(PICS_pygame["cell2"])
self.load_image(image)
Cell.__init__(self, x=x_, y=y_, relief=cell._relief)
def create_coordinates(self, x: int, y: int) -> (int, int):
return CELL_SIZE * x, CELL_SIZE * y
| 30.95 | 91 | 0.691438 | 93 | 619 | 4.215054 | 0.322581 | 0.102041 | 0.071429 | 0.040816 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002004 | 0.193861 | 619 | 19 | 92 | 32.578947 | 0.783567 | 0.040388 | 0 | 0 | 0 | 0 | 0.008446 | 0 | 0 | 0 | 0 | 0.052632 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.083333 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
de9c334f30690be489dc54509a0861d269ca08ea | 111 | py | Python | output/models/ms_data/additional/member_type021_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/ms_data/additional/member_type021_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/ms_data/additional/member_type021_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.ms_data.additional.member_type021_xsd.member_type021 import Root
__all__ = [
"Root",
]
| 18.5 | 83 | 0.774775 | 15 | 111 | 5.2 | 0.8 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.061856 | 0.126126 | 111 | 5 | 84 | 22.2 | 0.742268 | 0 | 0 | 0 | 0 | 0 | 0.036036 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
deaa58029f2b553b02dbaa81816ff5ce9e456f8a | 3,424 | py | Python | dispatchlib/types.py | ryxcommar/dispatchlib | bf3b6e5617af41579b240a7733cd9cc86a8a38ed | [
"MIT"
] | null | null | null | dispatchlib/types.py | ryxcommar/dispatchlib | bf3b6e5617af41579b240a7733cd9cc86a8a38ed | [
"MIT"
] | null | null | null | dispatchlib/types.py | ryxcommar/dispatchlib | bf3b6e5617af41579b240a7733cd9cc86a8a38ed | [
"MIT"
] | null | null | null | from typing import Any
from typing import Callable
from typing import Iterable
def _create_getter_and_setter(name: str):
def getter(self):
return getattr(self.func, name)
getter.__name__ = name
prop = property(getter)
def setter(self, value):
setattr(self.func, name, value)
setter.__name__ = name
prop = prop.setter(setter)
return prop
class _PrioritySortable:
priority: int
def __init__(self, priority: int = 100):
self.priority = priority
def __lt__(self, other): return self.priority < other.priority
def __le__(self, other): return self.priority <= other.priority
def __gt__(self, other): return self.priority > other.priority
def __ge__(self, other): return self.priority >= other.priority
def __eq__(self, other): return self.priority == other.priority
class FunctionMixin(object):
"""Mixin for making classes look like functions.
This class isn't too fancy: if you store random non-standard attributes
inside your function then they are not directly accessible at the top-level
of the the subclass. The attributes this mixin provides are pre-defined.
"""
def __init__(self, func: callable):
self.func = func
for name in [
'__annotations__',
'__closure__',
'__code__',
'__defaults__',
'__kwdefaults__',
'__name__'
]:
locals()[name] = _create_getter_and_setter(name)
@property
def __funcdoc__(self):
return self.func.__doc__
@__funcdoc__.setter
def __funcdoc__(self, value):
self.func.__doc__ = value
@property
def __globals__(self):
return self.func.__globals__
def __call__(self, *args, **kwargs):
return self.func(*args, **kwargs)
class NextDispatch(Exception):
pass
class DispatcherType(type):
def __instancecheck__(cls, instance):
return (
callable(instance)
and hasattr(instance, 'register')
and hasattr(instance, 'registry')
and callable(instance.register)
and hasattr(instance.registry, '__iter__')
)
class Dispatcher(FunctionMixin, metaclass=DispatcherType):
dispatch: callable
register: callable
registry: Iterable
def __new__(cls, func: callable = None, metadispatcher: callable = None):
from .core import dispatch
return dispatch(func, metadispatcher=metadispatcher)
def __call__(self, *args, **kwargs):
raise NotImplementedError
class MetaDispatcher(FunctionMixin, metaclass=DispatcherType):
dispatch: callable
register: callable
registry: Iterable
def __new__(cls, func: callable = None):
from .core import metadispatch
return metadispatch(func)
def __call__(self, *args, **kwargs):
raise NotImplementedError
class DispatchedCallable(FunctionMixin, _PrioritySortable):
def __init__(
self,
func: callable,
validate: Callable[[Any], bool],
priority: int = 100
):
self.validate = validate
FunctionMixin.__init__(self, func)
_PrioritySortable.__init__(self, priority)
def __repr__(self):
content = ', '.join(
f'{attr}={getattr(self, attr)!r}'
for attr in ('func', 'validate', 'priority')
)
return f'{self.__class__.__name__}({content})'
| 26.96063 | 79 | 0.651285 | 365 | 3,424 | 5.69589 | 0.317808 | 0.03848 | 0.036075 | 0.045695 | 0.370851 | 0.295334 | 0.25493 | 0.23569 | 0.104858 | 0.104858 | 0 | 0.002349 | 0.254089 | 3,424 | 126 | 80 | 27.174603 | 0.811668 | 0.077687 | 0 | 0.144444 | 0 | 0 | 0.057416 | 0.018182 | 0 | 0 | 0 | 0 | 0 | 1 | 0.233333 | false | 0.011111 | 0.055556 | 0.111111 | 0.544444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
deba5b19ee11e4b42757cf8302210ae77f1c6474 | 295 | py | Python | 01-data_types/d13.py | philiphinton/learn_python | 6ddfe3c7818d6c919bfa49bd6302c75ee761b6a4 | [
"MIT"
] | null | null | null | 01-data_types/d13.py | philiphinton/learn_python | 6ddfe3c7818d6c919bfa49bd6302c75ee761b6a4 | [
"MIT"
] | 3 | 2022-01-17T22:55:09.000Z | 2022-01-26T07:26:13.000Z | 01-data_types/d13.py | philiphinton/learn_python | 6ddfe3c7818d6c919bfa49bd6302c75ee761b6a4 | [
"MIT"
] | 1 | 2021-12-14T01:33:21.000Z | 2021-12-14T01:33:21.000Z |
shopping_list = {
'Tomatoes': 6,
'Bananas': 5,
'Crackers': 2,
'Sugar': 1,
'Icecream': 1,
'Bread': 3,
'Chocolate': 2
}
# Just the keys
print(shopping_list.keys())
# Just the values
# print(shopping_list.values())
# Both keys and values
# print(shopping_list.items())
| 17.352941 | 31 | 0.610169 | 38 | 295 | 4.631579 | 0.578947 | 0.272727 | 0.289773 | 0.261364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030435 | 0.220339 | 295 | 16 | 32 | 18.4375 | 0.734783 | 0.369492 | 0 | 0 | 0 | 0 | 0.27933 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
deebcfc8092fc857d0a9f335ddd1bffc49d0f520 | 2,371 | py | Python | fixture/orm.py | NovikovMA/python_training_mantis | c8de0ec193e2ec644d8053f8e1b7fc1ee8fb1525 | [
"Apache-2.0"
] | null | null | null | fixture/orm.py | NovikovMA/python_training_mantis | c8de0ec193e2ec644d8053f8e1b7fc1ee8fb1525 | [
"Apache-2.0"
] | null | null | null | fixture/orm.py | NovikovMA/python_training_mantis | c8de0ec193e2ec644d8053f8e1b7fc1ee8fb1525 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
__author__ = 'M.Novikov'
from model.project import Project # Проекты Mantis
from pony.orm import * # Работа с базой данных
from pymysql.converters import decoders # Преобразование данных
class ORMFixture:
db = Database()
# Структура объектов, привязываемых к базе данных
class ORMProject(db.Entity): # Проект Mantis
_table_ = "mantis_project_table" # Наименование связываемой таблицы базы данных
id = PrimaryKey(int, column="id") # Идентификатор
name = Optional(str, column="name") # Название
description = Optional(str, column="description") # Описание
# Создание фикстуры работы с базой данных
def __init__(self, host, name, user, password):
self.db.bind("mysql", host=host, database=name, user=user, password=password, conv=decoders) # Подключение к базе данных с разрешением преобразования данных в извесные форматы
self.db.generate_mapping() # Сопоставление объектов класса и таблиц базы данных
#sql_debug(True) # Вывод формируемых sql-запросов в консоль
# Уничтожение фикстуры работы с базой данных
def destroy(self):
pass
# Преобразование объектов ORMGroup (текущий формат) к формату объектов model (общий формат)
def convert_project_to_model(self, projects):
def convert(project): # Преобразование одного ORM-объекта проекта Mantis в формат модели проекта Mantis
return Project(id=project.id, name=project.name, description=project.description)
return list(map(convert, projects)) # Преобразованный список проектов
# Получение списка проектов
@db_session # Метка выполнения функции в рамках единой сессии
def get_project_list(self):
return self.convert_project_to_model(select(p for p in ORMFixture.ORMProject)) # Получение (запрос к базе) списка проектов
| 59.275 | 186 | 0.567693 | 226 | 2,371 | 5.853982 | 0.517699 | 0.013605 | 0.027211 | 0.030234 | 0.04384 | 0.04384 | 0 | 0 | 0 | 0 | 0 | 0.000672 | 0.371995 | 2,371 | 39 | 187 | 60.794872 | 0.887844 | 0.363138 | 0 | 0 | 0 | 0 | 0.034297 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217391 | false | 0.130435 | 0.130435 | 0.086957 | 0.608696 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
def8fdb574ef8e8309feae4ee72edbfe9a0a3beb | 926 | py | Python | schematics_proto3/unset.py | mlga/schematics-proto3 | 588fe5bc212e203688166638a1c52dfeda931403 | [
"MIT"
] | null | null | null | schematics_proto3/unset.py | mlga/schematics-proto3 | 588fe5bc212e203688166638a1c52dfeda931403 | [
"MIT"
] | 11 | 2020-04-09T13:33:54.000Z | 2020-08-19T17:38:26.000Z | schematics_proto3/unset.py | mlga/schematics-proto3 | 588fe5bc212e203688166638a1c52dfeda931403 | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
"""
Test module docstring.
"""
import threading
from typing import Type
class UnsetType:
"""
Test docstring.
"""
__slots__ = []
_instance: 'UnsetType' = None
_lock: threading.Lock = threading.Lock()
def __str__(self):
return 'Unset'
def __repr__(self):
return 'Unset'
def __eq__(self, other):
return self is other
def __ne__(self, other):
return self is not other
def __len__(self):
return 0
def __bool__(self):
return False
def __hash__(self):
return hash(self._lock)
__nonzero__ = __bool__
def __new__(cls: Type['UnsetType']):
if cls._instance is None:
with cls._lock:
if cls._instance is None:
cls._instance = super().__new__(cls)
return cls._instance
Unset = UnsetType() # pylint: disable=invalid-name
| 17.807692 | 56 | 0.580994 | 103 | 926 | 4.679612 | 0.417476 | 0.103734 | 0.070539 | 0.074689 | 0.165975 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00315 | 0.314255 | 926 | 51 | 57 | 18.156863 | 0.755906 | 0.096112 | 0 | 0.142857 | 0 | 0 | 0.03444 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.071429 | 0.25 | 0.821429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
7224268eb003eeb3fc96967b78416eccf0509110 | 491 | py | Python | lclpy/aidfunc/logging.py | nobody1570/lspy | 1cf6efbafbbf8ddb54ba7a875e82c562f010edd1 | [
"MIT"
] | 3 | 2021-11-27T22:11:38.000Z | 2022-02-10T11:42:06.000Z | lclpy/aidfunc/logging.py | nobody1570/lspy | 1cf6efbafbbf8ddb54ba7a875e82c562f010edd1 | [
"MIT"
] | null | null | null | lclpy/aidfunc/logging.py | nobody1570/lspy | 1cf6efbafbbf8ddb54ba7a875e82c562f010edd1 | [
"MIT"
] | null | null | null |
def log_improvement(value):
"""function to log improvements to the command line.
Parameters
----------
value : int or float
The value for the improvement
"""
print("Improvement : " + str(value))
def log_passed_worse(value):
"""function to log the passing of worse solutions to the command line.
Parameters
----------
value : int or float
The value for the improvement
"""
print("Passed worse: " + str(value))
| 18.185185 | 74 | 0.592668 | 58 | 491 | 4.965517 | 0.37931 | 0.041667 | 0.104167 | 0.125 | 0.493056 | 0.493056 | 0.493056 | 0.493056 | 0.493056 | 0.493056 | 0 | 0 | 0.289206 | 491 | 26 | 75 | 18.884615 | 0.825215 | 0.572301 | 0 | 0 | 0 | 0 | 0.183007 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0.5 | 0 | 0 | 0.5 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 3 |
a0e9473241e626ba8085d5563079fd7bc9d6eeb6 | 1,111 | py | Python | var/app_template/views.py | michailbrynard/django-skeleton | 772cd579cad1b8853ed6f1a2c14cbacac2ba41da | [
"MIT"
] | null | null | null | var/app_template/views.py | michailbrynard/django-skeleton | 772cd579cad1b8853ed6f1a2c14cbacac2ba41da | [
"MIT"
] | null | null | null | var/app_template/views.py | michailbrynard/django-skeleton | 772cd579cad1b8853ed6f1a2c14cbacac2ba41da | [
"MIT"
] | null | null | null | # LOGGING
# ---------------------------------------------------------------------------------------------------------------------#
import logging
logger = logging.getLogger('django')
# IMPORTS
# ---------------------------------------------------------------------------------------------------------------------#
# shortcuts
from django.shortcuts import render
# contrib.auth
from django.contrib.auth.decorators import login_required
# views.generic
from django.views.generic import DetailView
#
from .models import *
# GENERIC CLASS BASED VIEWS
# ---------------------------------------------------------------------------------------------------------------------#
class BasicModelView(DetailView):
model = BasicModel
# CUSTOM VIEWS
# ---------------------------------------------------------------------------------------------------------------------#
@login_required
def about(request):
# Context variables to pass on to template
context = {
'val1': 'Hello',
'val2': 'World!'
}
# Render the template
return render(request, 'app_name/about_page.html', context) | 32.676471 | 120 | 0.407741 | 75 | 1,111 | 5.986667 | 0.573333 | 0.066815 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002028 | 0.112511 | 1,111 | 34 | 121 | 32.676471 | 0.453347 | 0.562556 | 0 | 0 | 0 | 0 | 0.104701 | 0.051282 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0.333333 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a0fde969f3e2acaa6481f6fe003e765cdca46b4c | 1,686 | py | Python | alpha_zero/NeuralNet.py | blekinge/alpha-zero-general | 7cc33e9b2e40602549b59fe753956e69a56f51f1 | [
"MIT"
] | null | null | null | alpha_zero/NeuralNet.py | blekinge/alpha-zero-general | 7cc33e9b2e40602549b59fe753956e69a56f51f1 | [
"MIT"
] | null | null | null | alpha_zero/NeuralNet.py | blekinge/alpha-zero-general | 7cc33e9b2e40602549b59fe753956e69a56f51f1 | [
"MIT"
] | null | null | null | from typing import List, Tuple
import numpy as np
from alpha_zero.Board import Board
class NeuralNet():
"""
This class specifies the base NeuralNet class. To define your own neural
network, subclass this class and implement the functions below. The neural
network does not consider the current player, and instead only deals with
the canonical form of the board.
See othello/NNet.py for an example implementation.
"""
def __init__(self, game):
pass
def train(self, examples: List[Tuple[Board,List[float],List[int]]]):
"""
This function trains the neural network with examples obtained from
self-play.
:param examples: a list of training examples, where each example is of form
(board, pi, v). pi is the MCTS informed policy vector for
the given board, and v is its value. The examples has
board in its canonical form.
"""
pass
def predict(self, board: Board) -> Tuple[np.array,float]:
"""
:param board: current board in its canonical form.
:returns pi: a policy vector for the current board- a numpy array of length game.getActionSize
:returns v: a float in [-1,1] that gives the value of the current board
"""
pass
def save_checkpoint(self, folder: str, filename:str):
"""
Saves the current neural network (with its parameters) in
folder/filename
"""
pass
def load_checkpoint(self, folder: str, filename:str):
"""
Loads parameters of the neural network from folder/filename
"""
pass
| 31.222222 | 102 | 0.6293 | 222 | 1,686 | 4.747748 | 0.427928 | 0.06167 | 0.045541 | 0.034156 | 0.108159 | 0.064516 | 0 | 0 | 0 | 0 | 0 | 0.001698 | 0.301305 | 1,686 | 53 | 103 | 31.811321 | 0.893039 | 0.591934 | 0 | 0.357143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.357143 | false | 0.357143 | 0.214286 | 0 | 0.642857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
9d0e38af685d991cde1a6a41f4c243ad673af7b8 | 1,839 | py | Python | tests/test_basic.py | nk412/companycase | 5b93478a79293a4bc93112b805eff56c44756f18 | [
"MIT"
] | 7 | 2016-09-08T15:25:33.000Z | 2022-02-01T13:21:40.000Z | tests/test_basic.py | nk412/companycase | 5b93478a79293a4bc93112b805eff56c44756f18 | [
"MIT"
] | 1 | 2016-07-12T10:36:02.000Z | 2016-07-12T10:36:02.000Z | tests/test_basic.py | nk412/companycase | 5b93478a79293a4bc93112b805eff56c44756f18 | [
"MIT"
] | 2 | 2016-09-17T17:41:28.000Z | 2020-02-29T22:58:09.000Z | # coding=utf-8
import unittest
from companycase import CompanyCase
class TestEnglishCCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.ccase = CompanyCase()
def test_simple(self):
self.assertEqual(self.ccase.apply("foobar ltd"), "Foobar LTD")
self.assertEqual(self.ccase.apply("hsbc bank (uk) ltd"), "HSBC Bank (UK) LTD")
self.assertEqual(self.ccase.apply("AXA INSURANCE"), "AXA Insurance")
def test_abbreviations(self):
s = 'ltd plc llc and of'
expected = 'LTD PLC LLC and of'
self.assertEqual(self.ccase.apply(s, 0.0), expected)
self.assertEqual(self.ccase.apply(s, 1.0), expected)
def test_threshold(self):
s = 'hello there nk'
self.assertEqual(self.ccase.apply(s), "Hello There NK")
self.assertEqual(self.ccase.apply(s, 0.0), "Hello There Nk")
self.assertEqual(self.ccase.apply(s, 1.0), "HELLO THERE NK")
def test_force_case(self):
self.ccase.force_case_for_words(['fOO', 'bAr'])
s = 'foo bar limited plc ltd'
self.assertEqual(self.ccase.apply(s), "fOO bAr Limited PLC LTD")
self.assertEqual(self.ccase.apply(s, 0.0), "fOO bAr Limited PLC LTD")
self.assertEqual(self.ccase.apply(s, 1.0), "fOO bAr LIMITED PLC LTD")
def test_unicode(self):
self.assertEqual(self.ccase.apply(u"foobar ltd"), "Foobar LTD")
self.assertEqual(self.ccase.apply(u"hsbc bank (uk) ltd"), "HSBC Bank (UK) LTD")
self.assertEqual(self.ccase.apply(u"AXA INSURANCE"), "AXA Insurance")
self.assertEqual(self.ccase.apply(u"tromsø, arctic explorers plc"), u'Tromsø, Arctic Explorers PLC')
self.assertEqual(self.ccase.apply(u"tromsø, arctic explorers plc", 1.0), u'TROMSØ, ARCTIC EXPLORERS PLC')
if __name__ == '__main__':
unittest.main()
| 39.12766 | 113 | 0.659598 | 259 | 1,839 | 4.617761 | 0.212355 | 0.127926 | 0.254181 | 0.32107 | 0.689799 | 0.624582 | 0.552676 | 0.551003 | 0.490803 | 0.37709 | 0 | 0.01019 | 0.199565 | 1,839 | 46 | 114 | 39.978261 | 0.80231 | 0.006525 | 0 | 0 | 0 | 0 | 0.259868 | 0 | 0 | 0 | 0 | 0 | 0.470588 | 1 | 0.176471 | false | 0 | 0.058824 | 0 | 0.264706 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9d3e62b9c9792273ad0f8b50076e62ff7aa9fb5b | 566 | py | Python | tests/test_combinator.py | BrunoSanchez/capsule_N1 | a5ee3b74afc27de1a954ae2f9f96c278a4723226 | [
"BSD-3-Clause"
] | 12 | 2017-04-13T06:49:42.000Z | 2019-11-19T09:27:43.000Z | tests/test_combinator.py | BrunoSanchez/capsule_N1 | a5ee3b74afc27de1a954ae2f9f96c278a4723226 | [
"BSD-3-Clause"
] | 56 | 2017-09-05T16:00:57.000Z | 2020-11-20T18:02:58.000Z | tests/test_combinator.py | BrunoSanchez/capsule_N1 | a5ee3b74afc27de1a954ae2f9f96c278a4723226 | [
"BSD-3-Clause"
] | 5 | 2017-10-08T16:55:40.000Z | 2020-09-22T14:04:53.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test_combinator.py
#
# Copyright 2020 QuatroPe
#
# This file is part of ProperImage (https://github.com/quatrope/ProperImage)
# License: BSD-3-Clause
# Full Text: https://github.com/quatrope/ProperImage/blob/master/LICENSE.txt
#
"""
test_combinator module from ProperImage
for analysis of astronomical images
Written by Bruno SANCHEZ
PhD of Astromoy - UNC
bruno@oac.unc.edu.ar
Instituto de Astronomia Teorica y Experimental (IATE) UNC
Cordoba - Argentina
Of 301
"""
class CombinatorBase(object):
pass
| 17.151515 | 76 | 0.740283 | 78 | 566 | 5.346154 | 0.782051 | 0.067146 | 0.067146 | 0.105516 | 0.158273 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018672 | 0.14841 | 566 | 32 | 77 | 17.6875 | 0.846473 | 0.869258 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 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 | 0 | 0 | 0 | 3 |
9d55833e8ac84841e916071829ab4546156cae04 | 2,810 | py | Python | django_ocr_server/conf.py | shmakovpn/django_ocr_server | 4d694629c39c18a6c13bcdfafdb8258b78e5a859 | [
"Apache-2.0"
] | 17 | 2019-12-04T03:14:56.000Z | 2022-03-27T07:05:19.000Z | django_ocr_server/conf.py | shmakovpn/django_ocr_server | 4d694629c39c18a6c13bcdfafdb8258b78e5a859 | [
"Apache-2.0"
] | 1 | 2020-04-17T07:32:30.000Z | 2020-04-17T07:32:30.000Z | django_ocr_server/conf.py | shmakovpn/django_ocr_server | 4d694629c39c18a6c13bcdfafdb8258b78e5a859 | [
"Apache-2.0"
] | 5 | 2020-03-16T10:43:03.000Z | 2021-07-14T14:43:49.000Z | """
django_ocr_server/conf.py
+++++++++++++++++++++++++
The settings manager for **django_ocr_server**.
Usage:
.. code-block:: python
from django_ocr_server.conf import ocr_settings
# Next line will print a value of **OCR_TESSERACT_LANG**
# using the variable from the Django's *settings.py* file
# if the variable is set there.
# Or the default value of **OCR_TESSERACT_LANG** from
# *django_ocr_server/default_settings.py* otherwise.
print(ocr_settings.OCR_TESSERACT_LANG)
| Author: shmakovpn <shmakovpn@yandex.ru>
| Date: 2021-01-20
"""
from typing import List
from datetime import timedelta
from django.conf import settings as _s
import django_ocr_server.default_settings as _ds
class DjangoOcrSettings:
"""The settings manager of **django_ocr_server**"""
@property
def OCR_STORE_FILES(_) -> bool:
return bool(getattr(_s, 'OCR_STORE_FILES', _ds.OCR_STORE_FILES))
@property
def OCR_FILE_PREVIEW(_) -> bool:
return bool(getattr(_s, 'OCR_FILE_PREVIEW', _ds.OCR_FILE_PREVIEW))
@property
def OCR_TESSERACT_LANG(_) -> str:
return str(getattr(_s, 'OCR_TESSERACT_LANG', _ds.OCR_TESSERACT_LANG))
@property
def OCR_STORE_PDF(_) -> bool:
return bool(getattr(_s, 'OCR_STORE_PDF', _ds.OCR_STORE_PDF))
@property
def OCR_STORE_FILES_DISABLED_LABEL(_) -> str:
return str(
getattr(_s, 'OCR_STORE_FILES_LABEL',
_ds.OCR_STORE_FILES_DISABLED_LABEL))
@property
def OCR_STORE_PDF_DISABLED_LABEL(_) -> str:
return str(
getattr(_s, 'OCR_FILE_REMOVED_LABEL', _ds.OCR_FILE_REMOVED_LABEL))
@property
def OCR_FILE_REMOVED_LABEL(_) -> str:
return str(
getattr(_s, 'OCR_FILE_REMOVED_LABEL', _ds.OCR_FILE_REMOVED_LABEL))
@property
def OCR_PDF_REMOVED_LABEL(_) -> str:
return str(
getattr(_s, 'OCR_PDF_REMOVED_LABEL', _ds.OCR_PDF_REMOVED_LABEL))
@property
def OCR_ALLOWED_FILE_TYPES(_) -> List[str]:
return list(
getattr(_s, 'OCR_ALLOWED_FILE_TYPES', _ds.OCR_ALLOWED_FILE_TYPES))
@property
def OCR_FILES_UPLOAD_TO(_) -> str:
return str(getattr(_s, 'OCR_FILES_UPLOAD_TO', _ds.OCR_FILES_UPLOAD_TO))
@property
def OCR_PDF_UPLOAD_TO(_) -> str:
return str(getattr(_s, 'OCR_PDF_UPLOAD_TO', _ds.OCR_PDF_UPLOAD_TO))
@property
def OCR_FILES_TTL(_) -> timedelta:
return getattr(_s, 'OCR_FILES_TTL', _ds.OCR_FILES_TTL)
@property
def OCR_PDF_TTL(_) -> timedelta:
return getattr(_s, 'ocr_pdf_ttl', _ds.OCR_PDF_TTL)
@property
def OCR_TTL(_) -> timedelta:
return getattr(_s, 'OCR_TTL', _ds.OCR_TTL)
ocr_settings: DjangoOcrSettings = DjangoOcrSettings()
"""The instance of settings manager of **django_ocr_server**""" | 29.893617 | 79 | 0.687544 | 383 | 2,810 | 4.590078 | 0.182768 | 0.0876 | 0.11149 | 0.075654 | 0.500569 | 0.324801 | 0.211604 | 0.174061 | 0.089875 | 0.089875 | 0 | 0.003562 | 0.200712 | 2,810 | 94 | 80 | 29.893617 | 0.779163 | 0.209609 | 0 | 0.37037 | 0 | 0 | 0.110438 | 0.050326 | 0 | 0 | 0 | 0 | 0 | 1 | 0.259259 | false | 0 | 0.074074 | 0.259259 | 0.611111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
19d3c2532fdc242dd0fdaf80342fa01cfdf2a61d | 5,401 | py | Python | janaganana/tables.py | deshetti/janaganana | f29ced95fc9f8b98f77560d9afdbd999510dd497 | [
"MIT"
] | 11 | 2017-02-16T20:45:54.000Z | 2021-12-31T01:08:40.000Z | janaganana/tables.py | deshetti/janaganana | f29ced95fc9f8b98f77560d9afdbd999510dd497 | [
"MIT"
] | 18 | 2017-02-15T20:24:29.000Z | 2022-03-29T21:54:36.000Z | janaganana/tables.py | deshetti/janaganana | f29ced95fc9f8b98f77560d9afdbd999510dd497 | [
"MIT"
] | 13 | 2017-02-16T20:45:25.000Z | 2020-09-23T21:40:57.000Z | from wazimap.data.tables import FieldTable
# Define our tables so the data API can discover them.
# Household tables
FieldTable(['rural population'], universe='Population', table_per_level=False)
FieldTable(['area', 'sex'], universe='Population', table_per_level=False)
FieldTable(['census_year', 'measure'], universe='A2-Decadal Variation', table_per_level=False)
FieldTable(['census_year', 'sex_vis'], universe='VISUAL', table_per_level=False)
FieldTable(['area', 'sex', 'literacy'], universe='Population', table_per_level=False)
FieldTable(['area','village_town_comparison'], universe='A3APPENDIX', table_per_level=False)
FieldTable(['religion', 'area', 'sex'], universe='Religion', table_per_level=False)
FieldTable(['age', 'area', 'sex'], universe='Age', table_per_level=False)
FieldTable(['village_town_measures','area'], universe='A1-', table_per_level=False)
FieldTable(['education', 'area', 'sex'], universe='Education', table_per_level=False)
FieldTable(['houseless_population','area', 'sex'], universe='A7-Houseless', table_per_level=False)
FieldTable(['sc_houseless_population','area', 'sex'], universe='A8-SC_Houseless', table_per_level=False)
FieldTable(['st_houseless_population','area', 'sex'], universe='A9-ST_Houseless', table_per_level=False)
FieldTable(['village_measures','population_range'], universe='A3-Inhabited Villages', table_per_level=False)
FieldTable(['maritalstatus', 'area', 'sex'], universe='Relation', table_per_level=False)
FieldTable(['workertype','age_group','area','sex'], universe='B1-Workerstype', table_per_level=False)
FieldTable(['sc_workertype','age_group','area','sex'], universe='B1SC-Workerstype', table_per_level=False)
FieldTable(['st_workertype','age_group','area','sex'], universe='B1ST-Workerstype', table_per_level=False)
FieldTable(['workers', 'area', 'workerssex'], universe='Workers', table_per_level=False)
FieldTable(['workertype','education_level', 'area', 'sex'], universe='B3', table_per_level=False)
FieldTable(['education_level', 'area', 'sex_vis'], universe='VISUAL', table_per_level=False)
FieldTable(['sc_workertype','education_level', 'area', 'sex'], universe='B3SC', table_per_level=False)
FieldTable(['st_workertype','education_level', 'area', 'sex'], universe='B3ST', table_per_level=False)
FieldTable(['nonworkertype', 'age_group','area','sex'], universe='B13', table_per_level=False)
FieldTable(['nonworkertype_vis', 'age_group','area','sex'], universe='VISUAL', table_per_level=False)
FieldTable(['sc_nonworkertype', 'age_group','area','sex'], universe='B13SC', table_per_level=False)
FieldTable(['st_nonworkertype', 'age_group','area','sex'], universe='B13ST', table_per_level=False)
FieldTable(['religion','nonworkertype','age_group','area', 'sex'], universe='B14', table_per_level=False)
FieldTable(['religion','area', 'sex'], universe='C1', table_per_level=False)
FieldTable(['religious_community','area', 'sex'], universe='C1APPENDIX', table_per_level=False)
FieldTable(['age_group','marital_status','area', 'sex'], universe='C2', table_per_level=False)
FieldTable(['religion','marital_status','area', 'sex'], universe='C3', table_per_level=False)
FieldTable(['mother_tongue_vis','area', 'sex'], universe='VISUAL', table_per_level=False)
FieldTable(['disability','age_group','area', 'sex'], universe='c20', table_per_level=False)
FieldTable(['mother_tongue','area', 'sex'], universe='c16', table_per_level=False)
FieldTable(['educational_institution','age','area', 'sex'], universe='c10', table_per_level=False)
FieldTable(['sc_educational_institution','age','area', 'sex'], universe='c10sc', table_per_level=False)
FieldTable(['st_educational_institution','age','area', 'sex'], universe='c10st', table_per_level=False)
FieldTable(['economic_activity','age','area', 'sex'], universe='c12', table_per_level=False)
FieldTable(['marriage_duration','age','area', 'sex'], universe='c4', table_per_level=False)
FieldTable(['parity','age','area'], universe='F1', table_per_level=False)
FieldTable(['sc_parity','age','area'], universe='F1sc', table_per_level=False)
FieldTable(['st_parity','age','area'], universe='F1st', table_per_level=False)
FieldTable(['parity_vis','age','area'], universe='VISUAL', table_per_level=False)
FieldTable(['surviving_children','age','area'], universe='F5', table_per_level=False)
FieldTable(['sc_surviving_children','age','area'], universe='F5SC', table_per_level=False)
FieldTable(['st_surviving_children','age','area'], universe='F5ST', table_per_level=False)
FieldTable(['household_size','area'], universe='HH1', table_per_level=False)
FieldTable(['household_size_vis','area'], universe='VISUAL', table_per_level=False)
FieldTable(['sc_household_size','area'], universe='HH1SC', table_per_level=False)
FieldTable(['st_household_size','area'], universe='HH1ST', table_per_level=False)
FieldTable(['household_workers','workers_in_household','area'], universe='HH11', table_per_level=False)
FieldTable(['household_size','available_for_work','area'], universe='HH12', table_per_level=False)
FieldTable(['sevenyearsandabove','literates_in_household','area'], universe='HH08', table_per_level=False)
FieldTable(['age','area', 'head','household_marital_status'], universe='HH06', table_per_level=False)
FieldTable(['houseless_households','area'], universe='HH02', table_per_level=False)
FieldTable(['households_size','aged_persons','area'], universe='HH05', table_per_level=False)
| 66.679012 | 108 | 0.755601 | 686 | 5,401 | 5.667638 | 0.1793 | 0.117284 | 0.190586 | 0.263889 | 0.733539 | 0.61214 | 0.257459 | 0.127058 | 0.076132 | 0 | 0 | 0.011467 | 0.047399 | 5,401 | 80 | 109 | 67.5125 | 0.744218 | 0.012775 | 0 | 0 | 0 | 0 | 0.344225 | 0.047512 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.017241 | 0 | 0.017241 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
19ddf831a5a3b46c86717f74ec094bf9d7bcc0cd | 757 | py | Python | homeworks/hw05/tests/q3b1.py | cwakamiya/ieor135 | 084490380f265225927d11b43d948c1206b0aab8 | [
"Apache-2.0"
] | 28 | 2020-06-15T23:53:36.000Z | 2022-03-19T09:27:02.000Z | homeworks/hw05/tests/q3b1.py | cwakamiya/ieor135 | 084490380f265225927d11b43d948c1206b0aab8 | [
"Apache-2.0"
] | 4 | 2020-06-24T22:20:31.000Z | 2022-02-28T01:37:36.000Z | homeworks/hw05/tests/q3b1.py | cwakamiya/ieor135 | 084490380f265225927d11b43d948c1206b0aab8 | [
"Apache-2.0"
] | 78 | 2020-06-19T09:41:01.000Z | 2022-02-05T00:13:29.000Z | test = { 'name': 'q3b1',
'points': 2,
'suites': [ { 'cases': [ { 'code': '>>> 4 <= '
"sum(list(X1.describe().loc['mean'])) "
'<= 9\n'
'True',
'hidden': False,
'locked': False},
{ 'code': '>>> len(X1) == 768\nTrue',
'hidden': False,
'locked': False}],
'scored': True,
'setup': '',
'teardown': '',
'type': 'doctest'}]}
| 47.3125 | 86 | 0.211361 | 37 | 757 | 4.324324 | 0.783784 | 0.1375 | 0.2125 | 0.275 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036765 | 0.640687 | 757 | 15 | 87 | 50.466667 | 0.551471 | 0 | 0 | 0.133333 | 0 | 0 | 0.220608 | 0.047556 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
19e32a5576ac8d30a109ed4090fee43e0912beb9 | 3,050 | py | Python | scanpy/api/__init__.py | gioelelm/scanpy | 97391a0e7908b9644b2d6640c8e26d37bdc7811e | [
"BSD-3-Clause"
] | null | null | null | scanpy/api/__init__.py | gioelelm/scanpy | 97391a0e7908b9644b2d6640c8e26d37bdc7811e | [
"BSD-3-Clause"
] | null | null | null | scanpy/api/__init__.py | gioelelm/scanpy | 97391a0e7908b9644b2d6640c8e26d37bdc7811e | [
"BSD-3-Clause"
] | 1 | 2019-02-18T07:39:59.000Z | 2019-02-18T07:39:59.000Z | """Scanpy's high-level API provides an overview of all features relevant to pratical use::
import scanpy.api as sc
.. raw:: html
<h3>Preprocessing tools</h3>
Filtering of highly-variable genes, batch-effect correction, per-cell (UMI) normalization, preprocessing recipes.
.. raw:: html
<h4>Basic Preprocessing</h4>
.. autosummary::
:toctree: .
pp.filter_cells
pp.filter_genes
pp.filter_genes_dispersion
pp.log1p
pp.pca
pp.normalize_per_cell
pp.regress_out
pp.scale
pp.subsample
.. raw:: html
<h4>Recipes</h4>
.. autosummary::
:toctree: .
pp.recipe_zheng17
pp.recipe_weinreb16
.. raw:: html
<h3>Machine Learning and Statistics tools<h3>
.. raw:: html
<h4>Visualization</h4>
.. autosummary::
:toctree: .
tl.pca
tl.tsne
tl.diffmap
tl.draw_graph
.. raw:: html
<h4>Branching trajectories and pseudotime, clustering, differential expression</h4>
.. autosummary::
:toctree: .
tl.aga
tl.louvain
tl.dpt
tl.rank_genes_groups
.. raw:: html
<h4>Simulations</h4>
.. autosummary::
:toctree: .
tl.sim
.. raw:: html
<h3>Generic methods</h3>
.. raw:: html
<h4>Reading and Writing</h4>
.. autosummary::
:toctree: .
read
write
read_10x_h5
.. raw:: html
<h4>Data Structures</h4>
.. autosummary::
:toctree: .
AnnData
DataGraph
.. raw:: html
<h3>Plotting</h3>
.. raw:: html
<h4>Generic plotting with AnnData</h4>
.. autosummary::
:toctree: .
pl.scatter
pl.violin
pl.ranking
.. raw:: html
<h4>Plotting tool results</h4>
Methods that extract and visualize tool-specific annotation in an AnnData object.
.. raw:: html
<h5>Visualization</h5>
.. autosummary::
:toctree: .
pl.pca
pl.pca_loadings
pl.pca_scatter
pl.pca_variance_ratio
pl.tsne
pl.diffmap
pl.draw_graph
.. raw:: html
<h5>Branching trajectories and pseudotime, clustering, differential expression</h5>
.. autosummary::
:toctree: .
pl.aga
pl.aga_graph
pl.aga_path
pl.louvain
pl.dpt
pl.dpt_scatter
pl.dpt_groups_pseudotime
pl.dpt_timeseries
pl.rank_genes_groups
pl.rank_genes_groups_violin
.. raw:: html
<h5>Simulations</h5>
.. autosummary::
:toctree: .
pl.sim
.. raw:: html
<h4>Builtin datasets</h4>
Simple functions that provide annotated datasets for benchmarking. See
`here <https://scanpy.readthedocs.io/en/latest/examples.html>`_ for extensive
documented tutorials and use cases.
All of these functions return an Annotated Data object.
.. autosummary::
:toctree: .
datasets.paul15
datasets.toggleswitch
datasets.krumsiek11
datasets.blobs
datasets.moignard15
"""
from .. import __version__
from .. import settings
from .. import logging
from . import tl
tools = tl
from . import pl
plotting = pl
from . import pp
preprocessing = pp
from ..readwrite import read, read_10x_h5, write, read_params, write_params
from . import datasets
from ..data_structs import AnnData, DataGraph
from .. import utils
| 14.95098 | 113 | 0.679016 | 392 | 3,050 | 5.181122 | 0.364796 | 0.058592 | 0.044313 | 0.016248 | 0.064993 | 0.064993 | 0.064993 | 0 | 0 | 0 | 0 | 0.021083 | 0.206885 | 3,050 | 203 | 114 | 15.024631 | 0.81852 | 0.886557 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.769231 | 0 | 0.769231 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
19f803a96ec5d364efd732c5edf09bf82c3dfe31 | 124 | py | Python | library_homework/my_project/my_program.py | Tommy3121173/tommy | 429aefb377f84a1d49e85f825a32ac2c160ebc85 | [
"MIT"
] | null | null | null | library_homework/my_project/my_program.py | Tommy3121173/tommy | 429aefb377f84a1d49e85f825a32ac2c160ebc85 | [
"MIT"
] | null | null | null | library_homework/my_project/my_program.py | Tommy3121173/tommy | 429aefb377f84a1d49e85f825a32ac2c160ebc85 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Wed May 23 16:56:57 2018
@author: tommy_mizuki
"""
import my_library
my_func(1,2) | 11.272727 | 35 | 0.645161 | 22 | 124 | 3.5 | 0.954545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147059 | 0.177419 | 124 | 11 | 36 | 11.272727 | 0.607843 | 0.653226 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
19fb9cf0c33a5df90f7ff935997f2b53b4510673 | 1,234 | py | Python | paralleldomain/model/annotation/polygon_2d.py | parallel-domain/pd-sdk | 20e3d052a5cb612a2dd84bda7b1b5487a6a60edc | [
"Apache-2.0"
] | 10 | 2021-11-17T17:23:49.000Z | 2022-03-18T09:51:23.000Z | paralleldomain/model/annotation/polygon_2d.py | parallel-domain/pd-sdk | 20e3d052a5cb612a2dd84bda7b1b5487a6a60edc | [
"Apache-2.0"
] | 3 | 2021-12-02T17:16:20.000Z | 2022-01-07T12:47:13.000Z | paralleldomain/model/annotation/polygon_2d.py | parallel-domain/pd-sdk | 20e3d052a5cb612a2dd84bda7b1b5487a6a60edc | [
"Apache-2.0"
] | 2 | 2022-03-09T07:03:54.000Z | 2022-03-23T15:53:48.000Z | from dataclasses import dataclass
from typing import List
from paralleldomain.model.annotation.common import Annotation
from paralleldomain.model.annotation.polyline_2d import Polyline2D
@dataclass
class Polygon2D(Polyline2D):
"""A closed polygon made a collection of 2D Lines.
Args:
lines: :attr:`~.Polygon2D.lines`
class_id: :attr:`~.Polygon2D.class_id`
instance_id: :attr:`~.Polygon2D.instance_id`
attributes: :attr:`~.Polygon2D.attributes`
Attributes:
lines: Ordered list of :obj:`Line2D` instances
class_id: Class ID of the polygon. Can be used to lookup more details in :obj:`ClassMap`.
instance_id: Instance ID of annotated object. Can be used to cross-reference with
other instance annotation types, e.g., :obj:`InstanceSegmentation2D` or :obj:`InstanceSegmentation3D`.
If unknown defaults to -1.
attributes: Dictionary of arbitrary object attributes.
"""
...
@dataclass
class Polygons2D(Annotation):
"""Collection of 2D Polygons
Args:
polygons: :attr:`~.Polygons2D.polygons`
Attributes:
polygons: Ordered list of :obj:`Polygon2D` instances
"""
polygons: List[Polygon2D]
| 29.380952 | 114 | 0.691248 | 142 | 1,234 | 5.957746 | 0.429577 | 0.061466 | 0.054374 | 0.078014 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018614 | 0.21637 | 1,234 | 41 | 115 | 30.097561 | 0.856256 | 0.669368 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.4 | 0 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
c230e009f1c0351446c02fccceb30b7ead29e784 | 138 | py | Python | randomselection.py | Ristinoa/cs257 | e7c31f995d08661114d868a55448c628b4cc9327 | [
"MIT"
] | null | null | null | randomselection.py | Ristinoa/cs257 | e7c31f995d08661114d868a55448c628b4cc9327 | [
"MIT"
] | null | null | null | randomselection.py | Ristinoa/cs257 | e7c31f995d08661114d868a55448c628b4cc9327 | [
"MIT"
] | null | null | null | "randompicker.py"
import random
"A very short practice program designed
to spit out a random, user-determined
sample of input names"
| 13.8 | 39 | 0.775362 | 21 | 138 | 5.095238 | 0.904762 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 138 | 9 | 40 | 15.333333 | 0.938596 | 0 | 0 | 0 | 0 | 0 | 0.110294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.2 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c236c320912188a01c92278b510292a2d1855a42 | 249 | py | Python | tests/accounts/model/test_social_security_number.py | Hyaxia/Bank-DDD-CQRS-ES | 116e3eb3e93d549c1da53e6d506ab47667d77445 | [
"MIT"
] | 8 | 2020-10-27T09:46:20.000Z | 2022-01-27T12:16:48.000Z | tests/accounts/model/test_social_security_number.py | Hyaxia/Bank-DDD-CQRS-ES | 116e3eb3e93d549c1da53e6d506ab47667d77445 | [
"MIT"
] | null | null | null | tests/accounts/model/test_social_security_number.py | Hyaxia/Bank-DDD-CQRS-ES | 116e3eb3e93d549c1da53e6d506ab47667d77445 | [
"MIT"
] | 2 | 2021-05-29T08:11:48.000Z | 2021-07-26T04:44:53.000Z | import pytest
from bank_ddd_es_cqrs.accounts import SocialSecurityNumber
def test_social_security_number_throws_app_exception_with_status_422_if_too_much_digits():
with pytest.raises(ValueError) as e:
SocialSecurityNumber(1324352351)
| 27.666667 | 90 | 0.84739 | 33 | 249 | 5.909091 | 0.878788 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0.11245 | 249 | 8 | 91 | 31.125 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0 | 0.4 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
c2416fc1e551162c64c074b04f41a960aa792575 | 712 | py | Python | core/departments/urls.py | IvanRch/bsuphys | 105715cde8fc8e9a42019ed4b650fe00b94fa132 | [
"Apache-2.0"
] | 1 | 2022-01-04T07:04:46.000Z | 2022-01-04T07:04:46.000Z | core/departments/urls.py | IvanRch/bsuphys | 105715cde8fc8e9a42019ed4b650fe00b94fa132 | [
"Apache-2.0"
] | 1 | 2020-02-17T19:06:03.000Z | 2020-02-17T19:06:03.000Z | core/departments/urls.py | IvanRch/bsuphys | 105715cde8fc8e9a42019ed4b650fe00b94fa132 | [
"Apache-2.0"
] | 1 | 2021-07-08T13:21:04.000Z | 2021-07-08T13:21:04.000Z | from django.urls import path, re_path
from . import views
app_name = "departments"
urlpatterns = [path("", views.departmentList, name="energy department"),
path(
"<slug:department>/",
views.department_detail,
name="department_detail",
),
path(
"<slug:department>/staff/",
views.department_detail_staff,
name="department_detail",
),
path(
"<slug:department>/thesis/",
views.department_detail_thesis,
name="department_detail",
),
path(
"<slug:department>/directions/",
views.department_detail_directions,
name="department_detail",
),
] | 25.428571 | 72 | 0.573034 | 62 | 712 | 6.370968 | 0.306452 | 0.324051 | 0.182278 | 0.182278 | 0.288608 | 0.288608 | 0 | 0 | 0 | 0 | 0 | 0 | 0.304775 | 712 | 28 | 73 | 25.428571 | 0.79798 | 0 | 0 | 0.48 | 0 | 0 | 0.269285 | 0.109397 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.08 | 0 | 0.08 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c2478e02ca506e0323d992197336faa1570d5c97 | 2,460 | py | Python | plugin_hide_run_panel/__init__.py | Holt59/modorganizer-python_plugins | f3404b1c3d9b8f5a6aa2133b47f7fc0218c18dc9 | [
"MIT"
] | null | null | null | plugin_hide_run_panel/__init__.py | Holt59/modorganizer-python_plugins | f3404b1c3d9b8f5a6aa2133b47f7fc0218c18dc9 | [
"MIT"
] | null | null | null | plugin_hide_run_panel/__init__.py | Holt59/modorganizer-python_plugins | f3404b1c3d9b8f5a6aa2133b47f7fc0218c18dc9 | [
"MIT"
] | null | null | null | # -*- encoding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication
from PyQt5.QtWidgets import QMainWindow, QFrame
import mobase
class HideRunPanelPlugin(mobase.IPlugin):
_runFrame: QFrame
def __init__(self):
super().__init__()
def init(self, organizer: mobase.IOrganizer):
""" For a IPlugin, the only place where things can be done is in init(). """
self._organizer = organizer
# mobase.IOrganizer has a few callbacks available:
# onUserInterfaceInitialized is called when the UI has been initialized, so
# we can use it to retrieve the actual run frame from the main window. Trying
# to access the main window in init() would not work since the main window is
# not yet created.
self._organizer.onUserInterfaceInitialized(self._onUiInit)
# We add a callback when plugin change to hide/show the run frame depending
# on the setting.
self._organizer.onPluginSettingChanged(self._onPluginSettingChanged)
return True
def _onUiInit(self, mainWindow: QMainWindow):
self._runFrame = mainWindow.findChild(QFrame, "startGroup") # type: ignore
self._onPluginSettingChanged(
self.name(),
"visible",
None,
self._organizer.pluginSetting(self.name(), "visible"),
)
def _onPluginSettingChanged(
self, pluginName: str, pluginKey: str, oldValue, newValue
):
""" Note: oldValue and newValue are Union type (mobase.MoVariant), but
MovVariant is not actually in mobase, so we cannot specify it currently. """
if pluginName == self.name() and pluginKey == "visible":
self._runFrame.setVisible(newValue) # type: ignore
def name(self):
return "Hide Run Panel"
def author(self):
return "Holt59"
def description(self):
return self._tr("Hide the run panel")
def version(self):
return mobase.VersionInfo(1, 0, 0, mobase.ReleaseType.final)
def isActive(self):
return True
def settings(self):
# We have a single setting indicating if the run frame should be visible or
# not. We use this in _onPluginSettingChanged.
return [mobase.PluginSetting("visible", "run frame visible", False)]
def _tr(self, str):
return QCoreApplication.translate("HideRunPanelPlugin", str)
def createPlugin():
return HideRunPanelPlugin()
| 31.948052 | 85 | 0.660976 | 281 | 2,460 | 5.704626 | 0.44484 | 0.040549 | 0.024329 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00436 | 0.254065 | 2,460 | 76 | 86 | 32.368421 | 0.86921 | 0.309756 | 0 | 0.04878 | 0 | 0 | 0.066627 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.292683 | false | 0 | 0.073171 | 0.195122 | 0.634146 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
dfe1a99576a2d37093ebe1a9717fd7144a854d6e | 1,870 | py | Python | bindings/python/test/test_objects.py | open-space-collective/open-space-toolkit-mathematics | 4b97f97f4aaa87bff848381a3519c6f764461378 | [
"Apache-2.0"
] | 5 | 2020-05-11T02:22:05.000Z | 2022-02-02T15:26:35.000Z | bindings/python/test/test_objects.py | open-space-collective/open-space-toolkit-mathematics | 4b97f97f4aaa87bff848381a3519c6f764461378 | [
"Apache-2.0"
] | 6 | 2020-01-05T20:18:18.000Z | 2021-10-14T09:36:44.000Z | bindings/python/test/test_objects.py | open-space-collective/open-space-toolkit-mathematics | 4b97f97f4aaa87bff848381a3519c6f764461378 | [
"Apache-2.0"
] | 2 | 2020-03-05T18:18:13.000Z | 2020-04-07T17:42:24.000Z | ################################################################################################################################################################
# @project Open Space Toolkit ▸ Mathematics
# @file bindings/python/test/test_objects.py
# @author Lucas Brémond <lucas@loftorbital.com>
# @license Apache License 2.0
################################################################################################################################################################
import ostk.mathematics as mathematics
################################################################################################################################################################
Angle = mathematics.geometry.Angle
Point2d = mathematics.geometry.d2.objects.Point
Polygon2d = mathematics.geometry.d2.objects.Polygon
Transformation2d = mathematics.geometry.d2.Transformation
Point3d = mathematics.geometry.d3.objects.Point
PointSet3d = mathematics.geometry.d3.objects.PointSet
Line3d = mathematics.geometry.d3.objects.Line
Ray3d = mathematics.geometry.d3.objects.Ray
Segment3d = mathematics.geometry.d3.objects.Segment
Plane = mathematics.geometry.d3.objects.Plane
Polygon3d = mathematics.geometry.d3.objects.Polygon
Cuboid = mathematics.geometry.d3.objects.Cuboid
Sphere = mathematics.geometry.d3.objects.Sphere
Ellipsoid = mathematics.geometry.d3.objects.Ellipsoid
Transformation3d = mathematics.geometry.d3.Transformation
Quaternion = mathematics.geometry.d3.transformations.rotations.Quaternion
RotationVector = mathematics.geometry.d3.transformations.rotations.RotationVector
RotationMatrix = mathematics.geometry.d3.transformations.rotations.RotationMatrix
################################################################################################################################################################
| 53.428571 | 160 | 0.535294 | 136 | 1,870 | 7.360294 | 0.397059 | 0.341658 | 0.293706 | 0.27972 | 0.134865 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016581 | 0.064706 | 1,870 | 34 | 161 | 55 | 0.555174 | 0.101604 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.052632 | 0 | 0.052632 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a03c291ae4978fabfb123a70eed6e3604690f22e | 319 | py | Python | python/cowSum.py | TenType/competition | 1715c79c88992e4603b327f962f44eb5bffcb801 | [
"MIT"
] | 1 | 2022-02-05T02:11:37.000Z | 2022-02-05T02:11:37.000Z | python/cowSum.py | TenType/competition | 1715c79c88992e4603b327f962f44eb5bffcb801 | [
"MIT"
] | null | null | null | python/cowSum.py | TenType/competition | 1715c79c88992e4603b327f962f44eb5bffcb801 | [
"MIT"
] | null | null | null | n, t = map(int, input().split())
f = []
results = [-1, -1, -1, -1]
for i in range(0, n):
f.append(list(map(int, input().split())))
# print(f)
for j in range(0, n):
if t in range(f[j][4], f[j][5]):
for k in range(0, 4):
if f[j][k] > results[k]:
results[k] = f[j][k]
for m in range(0, 4):
print(results[m])
| 19.9375 | 42 | 0.526646 | 69 | 319 | 2.434783 | 0.333333 | 0.208333 | 0.190476 | 0.190476 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047244 | 0.203762 | 319 | 15 | 43 | 21.266667 | 0.614173 | 0.025078 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.083333 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a040b6c0982b77309717ef74a52f2c7e1c8af890 | 1,276 | py | Python | tests/test_command_line.py | cwithmichael/breakzip | 3c81bd2a081b47f2e57d1b72f2b0fe6b76e613b3 | [
"MIT"
] | 5 | 2020-08-15T11:40:17.000Z | 2021-03-22T15:15:37.000Z | tests/test_command_line.py | cwithmichael/breakzip | 3c81bd2a081b47f2e57d1b72f2b0fe6b76e613b3 | [
"MIT"
] | null | null | null | tests/test_command_line.py | cwithmichael/breakzip | 3c81bd2a081b47f2e57d1b72f2b0fe6b76e613b3 | [
"MIT"
] | null | null | null | from breakzip import command_line
import pytest
import os
@pytest.fixture
def enc_zip(rootdir):
"""Returns an EncryptedZipFile instance with a test zip"""
test_zip = os.path.join(rootdir, "cats.zip")
return test_zip
def test_reading_file(enc_zip, mocker):
mocker.patch.object(command_line.sys, "argv")
mocker.patch.object(command_line.breakzip, "get_info")
mocker.patch.object(command_line.breakzip, "find_password")
command_line.sys.argv = ["", enc_zip, "jpg"]
command_line.main()
assert command_line.breakzip.get_info.called_once()
assert command_line.breakzip.find_password.called_once()
def test_reading_file_not_found(mocker):
mocker.patch.object(command_line.sys, "argv")
command_line.sys.argv = ["", "", "jpg"]
with pytest.raises(SystemExit):
command_line.main()
def test_reading_ext_not_found(enc_zip, mocker):
mocker.patch.object(command_line.sys, "argv")
command_line.sys.argv = ["", enc_zip, "drwho"]
with pytest.raises(SystemExit):
command_line.main()
def test_insufficient_input(mocker):
mocker.patch.object(command_line.sys, "argv")
command_line.sys.argv = ["", ""]
with pytest.raises(SystemExit) as e:
command_line.main()
assert e.value.code == 2
| 29.674419 | 63 | 0.71395 | 176 | 1,276 | 4.9375 | 0.295455 | 0.21519 | 0.128884 | 0.165708 | 0.579977 | 0.49252 | 0.375144 | 0.375144 | 0.375144 | 0.264672 | 0 | 0.000929 | 0.15674 | 1,276 | 42 | 64 | 30.380952 | 0.806691 | 0.040752 | 0 | 0.322581 | 0 | 0 | 0.045977 | 0 | 0 | 0 | 0 | 0 | 0.096774 | 1 | 0.16129 | false | 0.064516 | 0.096774 | 0 | 0.290323 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
a05cc4dfec88f66003f8b833c676b2a3c02c79c3 | 4,066 | py | Python | markov.py | garybake/markov_lyrics | 816043acd849b77097aa5bd504b123c6b306b801 | [
"MIT"
] | null | null | null | markov.py | garybake/markov_lyrics | 816043acd849b77097aa5bd504b123c6b306b801 | [
"MIT"
] | null | null | null | markov.py | garybake/markov_lyrics | 816043acd849b77097aa5bd504b123c6b306b801 | [
"MIT"
] | null | null | null | # https://realpython.com/blog/python/lyricize-a-flask-app-to-create-lyrics-using-markov-chains/
from random import choice
import sys
def generateModel(text, order):
model = {}
for i in range(0, len(text) - order):
fragment = text[i:i+order]
next_letter = text[i+order]
if fragment not in model:
model[fragment] = {}
if next_letter not in model[fragment]:
model[fragment][next_letter] = 1
else:
model[fragment][next_letter] += 1
return model
def getNextCharacter(model, fragment):
letters = []
for letter in model[fragment].keys():
for times in range(0, model[fragment][letter]):
letters.append(letter)
return choice(letters)
def generateText(text, order, length):
model = generateModel(text, order)
currentFragment = text[0:order]
output = ""
for i in range(0, length-order):
newCharacter = getNextCharacter(model, currentFragment)
output += newCharacter
currentFragment = currentFragment[1:] + newCharacter
print output
text = "some sample text"
text = """
An old man turned ninety-eight
He won the lottery and died the next day
It's a black fly in your Chardonnay
It's a death row pardon two minutes too late
And isn't it ironic... don't you think
It's like rain on your wedding day
It's a free ride when you've already paid
It's the good advice that you just didn't take
Who would've thought... it figures
Mr. Play It Safe was afraid to fly
He packed his suitcase and kissed his kids goodbye
He waited his whole damn life to take that flight
And as the plane crashed down he thought
"Well isn't this nice..."
And isn't it ironic... don't you think
It's like rain on your wedding day
It's a free ride when you've already paid
It's the good advice that you just didn't take
Who would've thought... it figures
Well life has a funny way of sneaking up on you
When you think everything's okay and everything's going right
And life has a funny way of helping you out when
You think everything's gone wrong and everything blows up
In your face
A traffic jam when you're already late
A no-smoking sign on your cigarette break
It's like ten thousand spoons when all you need is a knife
It's meeting the man of my dreams
And then meeting his beautiful wife
And isn't it ironic...don't you think
A little too ironic...and, yeah, I really do think...
It's like rain on your wedding day
It's a free ride when you've already paid
It's the good advice that you just didn't take
Who would've thought... it figures
Life has a funny way of sneaking up on you
Life has a funny, funny way of helping you out
Helping you out
I recommend getting your heart trampled on to anyone
I recommend walking around naked in your living room
Swallow it down (what a jagged little pill)
It feels so good (swimming in your stomach)
Wait until the dust settles
You live you learn
You love you learn
You cry you learn
You lose you learn
You bleed you learn
You scream you learn
I recommend biting off more then you can chew to anyone
I certainly do
I recommend sticking your foot in your mouth at any time
Feel free
Throw it down (the caution blocks you from the wind)
Hold it up (to the rays)
You wait and see when the smoke clears
You live you learn
You love you learn
You cry you learn
You lose you learn
You bleed you learn
You scream you learn
Wear it out (the way a three-year-old would do)
Melt it down (you're gonna have to eventually anyway)
The fire trucks are coming up around the bend
You live you learn
You love you learn
You cry you learn
You lose you learn
You bleed you learn
You scream you learn
You grieve you learn
You choke you learn
You laugh you learn
You choose you learn
You pray you learn
You ask you learn
You live you learn
"""
# text = "For now, well generate sample text via the very scientific method of throwing a string directly into the code based on some copied & pasted Alanis Morisette lyrics."
if __name__ == "__main__":
generateText(text, int(sys.argv[1]), int(sys.argv[2])) | 30.571429 | 175 | 0.734629 | 722 | 4,066 | 4.120499 | 0.358726 | 0.067227 | 0.081345 | 0.009412 | 0.323697 | 0.284034 | 0.265882 | 0.265882 | 0.265882 | 0.256807 | 0 | 0.00279 | 0.206591 | 4,066 | 133 | 176 | 30.571429 | 0.919405 | 0.065667 | 0 | 0.303571 | 1 | 0 | 0.710824 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.017857 | null | null | 0.008929 | 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 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a05d8bd7f43816678e051cbb74ff64ee556b6710 | 1,545 | py | Python | curriculum_tools/curriculum_tools/NamedEnv.py | darpa-l2m/meta-arcade | 9c9539c1feef89e9d1d55507bf4f75c965a25038 | [
"MIT"
] | 2 | 2021-12-17T19:54:41.000Z | 2021-12-20T06:08:31.000Z | curriculum_tools/curriculum_tools/NamedEnv.py | darpa-l2m/meta-arcade | 9c9539c1feef89e9d1d55507bf4f75c965a25038 | [
"MIT"
] | 1 | 2021-12-17T20:45:07.000Z | 2021-12-21T16:30:24.000Z | curriculum_tools/curriculum_tools/NamedEnv.py | darpa-l2m/meta-arcade | 9c9539c1feef89e9d1d55507bf4f75c965a25038 | [
"MIT"
] | null | null | null | """
Copyright © 2021 The Johns Hopkins University Applied Physics Laboratory LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
import gym
import copy
class NamedEnv(gym.Wrapper):
def __init__(self, env, name):
super().__init__(env)
self._name = name
@property
def name(self):
return copy.deepcopy(self._name)
@property
def unwrapped(self):
return self
def reset(self, **kwargs):
return self.env.reset(**kwargs)
def step(self, action):
return self.env.step(action)
| 33.586957 | 82 | 0.741748 | 226 | 1,545 | 5.030973 | 0.522124 | 0.077397 | 0.022867 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003241 | 0.201295 | 1,545 | 45 | 83 | 34.333333 | 0.917342 | 0.721036 | 0 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3125 | false | 0 | 0.125 | 0.25 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
a0b73f136f5ae88a402fa6be43272da9242cdedc | 642 | py | Python | MINI_WEB/mini_web/framework/mini_frame_4.py | GalphaXie/LaoX | b7e8f9744292dc052c870e4d873052e9bfec19ee | [
"MIT"
] | null | null | null | MINI_WEB/mini_web/framework/mini_frame_4.py | GalphaXie/LaoX | b7e8f9744292dc052c870e4d873052e9bfec19ee | [
"MIT"
] | 12 | 2020-03-24T17:39:25.000Z | 2022-03-12T00:01:24.000Z | MINI_WEB/mini_web/framework/mini_frame_4.py | GalphaXie/LaoX | b7e8f9744292dc052c870e4d873052e9bfec19ee | [
"MIT"
] | null | null | null | #!/usr/bin/python3
# file: mini_frame.py
# Created by Guang at 19-7-19
# description:
# *-* coding:utf8 *-*
import time
def login():
return "Welcome xxx login website! %s" % time.ctime()
def register():
return "Welcome xxx register on our website! %s" % time.ctime()
def profile():
return "你来到了一片荒原之上..."
def application(env, start_response):
start_response('200 OK', [('Content-Type', 'text/html'), ("Content-Type", "text/html;charset=utf-8")])
if env["FILE_PATH"] == "/login.py":
return login()
elif env["FILE_PATH"] == "/register.py":
return register()
else:
return profile()
| 21.4 | 106 | 0.619938 | 84 | 642 | 4.678571 | 0.571429 | 0.066158 | 0.081425 | 0.086514 | 0.101781 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021526 | 0.20405 | 642 | 29 | 107 | 22.137931 | 0.747554 | 0.152648 | 0 | 0 | 0 | 0 | 0.341373 | 0.042672 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.066667 | 0.2 | 0.733333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
a0bd4d5ee3152479bb0efe0eaded5fd65042adf4 | 1,904 | py | Python | backend/src/users/models.py | moatom/alistice | 222217928d9634b14e3c192abedc8c7d419ab868 | [
"MIT"
] | null | null | null | backend/src/users/models.py | moatom/alistice | 222217928d9634b14e3c192abedc8c7d419ab868 | [
"MIT"
] | null | null | null | backend/src/users/models.py | moatom/alistice | 222217928d9634b14e3c192abedc8c7d419ab868 | [
"MIT"
] | null | null | null | from src.extentions import db
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
import datetime as dt
# https://help.twitter.com/en/managing-your-account/twitter-username-rules
# https://office-hack.com/gmail/password/
class User(UserMixin, db.Model):
__tablename__ = 'user'
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(100), unique=True, nullable=False, index=True)
username = db.Column(db.String(15), unique=True, nullable=False, index=True)
name = db.Column(db.String(50), nullable=False, default="Anonymous")
password = db.Column(db.String(128), nullable=False)
root_id = db.Column(db.String(24))
# root_id = db.Column(db.Integer, db.ForeignKey('bookmark.id', ondelete='CASCADE'))
# https://stackoverflow.com/questions/414952/sqlalchemy-datetime-timezone
created_at = db.Column(db.DateTime, nullable=False, default=dt.datetime.utcnow)
# updated_at = Column(db.DateTime, nullable=False, default=dt.datetime.utcnow)
# bio = Column(db.String(300), nullable=True)
# root = db.relationship('Bookmark',
# cascade="all, delete-orphan",
# single_parent=True,
# foreign_keys=[root_id],
# backref=db.backref('root_s_owner',
# cascade="all, delete-orphan",
# passive_deletes=True,
# uselist=False)
# )
def set_password(self, password):
self.password = generate_password_hash(password)
def check_password(self, value):
return check_password_hash(self.password, value)
def __repr__(self):
"""Represent instance as a unique string."""
return '<User({!r})>'.format(self.username)
| 46.439024 | 87 | 0.628151 | 223 | 1,904 | 5.2287 | 0.426009 | 0.068611 | 0.068611 | 0.068611 | 0.193825 | 0.144082 | 0.089194 | 0.089194 | 0.089194 | 0 | 0 | 0.014665 | 0.247899 | 1,904 | 41 | 88 | 46.439024 | 0.799581 | 0.445378 | 0 | 0 | 1 | 0 | 0.024108 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.157895 | false | 0.315789 | 0.210526 | 0.052632 | 0.947368 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
a0c2eb12b9028951da45c66cf06efe7db3fad008 | 520 | py | Python | redis/redismq/redismq.py | dineshkumar2509/learning-python | e8af11ff0b396da4c3f2cfe21d14131bae4b2adb | [
"MIT"
] | 86 | 2015-06-13T16:53:55.000Z | 2022-03-24T20:56:42.000Z | redis/redismq/redismq.py | pei-zheng-yi/learning-python | 55e350dfe44cf04f7d4408e76e72d2f467bd42ce | [
"MIT"
] | 9 | 2015-05-27T07:52:44.000Z | 2022-03-29T21:52:40.000Z | redis/redismq/redismq.py | pei-zheng-yi/learning-python | 55e350dfe44cf04f7d4408e76e72d2f467bd42ce | [
"MIT"
] | 124 | 2015-12-10T01:17:18.000Z | 2021-11-08T04:03:38.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import redis
rc = redis.StrictRedis(host='localhost', port=6379, db=0)
def fifo_push(q, data):
rc.lpush(q, data)
def fifo_pop(q):
return rc.rpop(q)
def filo_push(q, data):
rc.lpush(q, data)
def filo_pop(q):
return rc.lpop(q)
def safe_fifo_push(q, data):
rc.lpush(q, data)
def safe_fifo_pop(q, cache):
msg = rc.rpoplpush(q, cache)
# check and do something on msg
rc.lrem(cache, 1) # remove the msg in cache list.
return msg
| 15.294118 | 57 | 0.634615 | 91 | 520 | 3.538462 | 0.472527 | 0.093168 | 0.083851 | 0.102484 | 0.248447 | 0.248447 | 0.248447 | 0.248447 | 0.173913 | 0 | 0 | 0.017199 | 0.217308 | 520 | 33 | 58 | 15.757576 | 0.773956 | 0.196154 | 0 | 0.1875 | 0 | 0 | 0.021739 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0 | 0.0625 | 0.125 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
260aad7a8e1f7dc10f9fc0b29cb23cbf4ba1d39e | 221 | py | Python | smart-chatbot-zero/Rerank/data_preprocess1.py | WenRichard/Customer-Chatbot | 48508c40574ffac8ced414a5bea799e2c85341ca | [
"MIT"
] | 268 | 2019-07-26T01:40:43.000Z | 2022-03-28T14:54:57.000Z | xiaotian-chatbot1.0/Rerank/data_preprocess1.py | abc668/Customer-Chatbot | 48508c40574ffac8ced414a5bea799e2c85341ca | [
"MIT"
] | 7 | 2019-08-13T04:17:55.000Z | 2020-08-06T08:57:34.000Z | xiaotian-chatbot1.0/Rerank/data_preprocess1.py | abc668/Customer-Chatbot | 48508c40574ffac8ced414a5bea799e2c85341ca | [
"MIT"
] | 113 | 2019-07-26T01:40:47.000Z | 2022-03-18T13:22:44.000Z | # -*- coding: utf-8 -*-
# @Time : 2019/5/25 16:09
# @Author : Alan
# @Email : xiezhengwen2013@163.com
# @File : data_preprocess2.py
# @Software: PyCharm
# 自己写一个生成词表的函数
def read(stopword_file, in_file):
pass | 20.090909 | 36 | 0.638009 | 29 | 221 | 4.758621 | 0.931034 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113636 | 0.20362 | 221 | 11 | 37 | 20.090909 | 0.670455 | 0.733032 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
261aa67b18ad9245d7a07ef83e4b670e255e83ff | 98 | py | Python | src/db.py | jpocentek/flask-project-template | 0ba32002d847b04243181485d3c2ec146beb991b | [
"MIT"
] | null | null | null | src/db.py | jpocentek/flask-project-template | 0ba32002d847b04243181485d3c2ec146beb991b | [
"MIT"
] | null | null | null | src/db.py | jpocentek/flask-project-template | 0ba32002d847b04243181485d3c2ec146beb991b | [
"MIT"
] | null | null | null | """Database class."""
from flask_sqlalchemy import SQLAlchemy # type: ignore
db = SQLAlchemy()
| 16.333333 | 55 | 0.72449 | 11 | 98 | 6.363636 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153061 | 98 | 5 | 56 | 19.6 | 0.843373 | 0.295918 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2624bc257e8f901aa965ba0e22d2dad3a916b18b | 312 | py | Python | assignments/assignment2/solutions/Jlopezjlx/src/src/account/forms.py | Jlopezjlx/python-mentorship | d104205bb9330ed5fc0ade433fb9a5aae5df4585 | [
"Apache-2.0"
] | 1 | 2019-04-07T12:26:20.000Z | 2019-04-07T12:26:20.000Z | assignments/assignment2/solutions/Jlopezjlx/src/src/account/forms.py | Jlopezjlx/python-mentorship | d104205bb9330ed5fc0ade433fb9a5aae5df4585 | [
"Apache-2.0"
] | null | null | null | assignments/assignment2/solutions/Jlopezjlx/src/src/account/forms.py | Jlopezjlx/python-mentorship | d104205bb9330ed5fc0ade433fb9a5aae5df4585 | [
"Apache-2.0"
] | null | null | null | from django.contrib.auth import get_user_model
from .models import Account
from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
User = get_user_model()
class CustomCreateUser(UserCreationForm):
class Meta:
model = Account
fields = ('username',) | 22.285714 | 70 | 0.759615 | 37 | 312 | 6.297297 | 0.486486 | 0.128755 | 0.145923 | 0.180258 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173077 | 312 | 14 | 71 | 22.285714 | 0.903101 | 0 | 0 | 0 | 0 | 0 | 0.025559 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.444444 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2624f3ec627e513d71eae77da294d30a7ee77f1c | 489 | py | Python | pygame_gui/elements/__init__.py | jtiai/pygame_gui | 3da0e1f2c4c60a2780c798d5592f2603ba786b34 | [
"MIT"
] | null | null | null | pygame_gui/elements/__init__.py | jtiai/pygame_gui | 3da0e1f2c4c60a2780c798d5592f2603ba786b34 | [
"MIT"
] | null | null | null | pygame_gui/elements/__init__.py | jtiai/pygame_gui | 3da0e1f2c4c60a2780c798d5592f2603ba786b34 | [
"MIT"
] | null | null | null | from .ui_image import UIImage
from .ui_button import UIButton
from .ui_horizontal_slider import UIHorizontalSlider
from .ui_vertical_scroll_bar import UIVerticalScrollBar
from .ui_label import UILabel
from .ui_screen_space_health_bar import UIScreenSpaceHealthBar
from .ui_tool_tip import UITooltip
from .ui_drop_down_menu import UIDropDownMenu
from .ui_text_box import UITextBox
from .ui_world_space_health_bar import UIWorldSpaceHealthBar
from .ui_text_entry_line import UITextEntryLine
| 40.75 | 62 | 0.887526 | 70 | 489 | 5.828571 | 0.5 | 0.161765 | 0.068627 | 0.098039 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08998 | 489 | 11 | 63 | 44.454545 | 0.916854 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2636d97a76008661a130b2893ade3f12667ed659 | 361 | py | Python | soxs/background/__init__.py | gb-heimaf/lynx-x-ray-observatory | a1e5a17cab3763975e0d3dc0840f0359de8c8087 | [
"BSD-3-Clause"
] | 10 | 2020-05-08T01:38:18.000Z | 2021-09-30T16:55:49.000Z | soxs/background/__init__.py | gb-heimaf/lynx-x-ray-observatory | a1e5a17cab3763975e0d3dc0840f0359de8c8087 | [
"BSD-3-Clause"
] | 7 | 2018-10-03T11:56:01.000Z | 2021-08-12T17:54:51.000Z | soxs/background/__init__.py | gb-heimaf/lynx-x-ray-observatory | a1e5a17cab3763975e0d3dc0840f0359de8c8087 | [
"BSD-3-Clause"
] | 6 | 2016-11-17T21:15:22.000Z | 2021-04-10T11:42:24.000Z | from .foreground import make_foreground
from .point_sources import make_ptsrc_background, \
make_point_sources_file, make_point_source_list
from .instrument import make_instrument_background
from .spectra import BackgroundSpectrum, \
ConvolvedBackgroundSpectrum
from .events import add_background_from_file
from .instrument import InstrumentalBackground | 45.125 | 51 | 0.869806 | 42 | 361 | 7.119048 | 0.428571 | 0.100334 | 0.133779 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099723 | 361 | 8 | 52 | 45.125 | 0.92 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.75 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
263e270fa7c082211ad5f457c9821af9b682d010 | 91 | py | Python | contract-event-listener/src/config/__init__.py | xcantera/demo-provide-baseline | 985f391973fa6ca0761104b55077fded28f152fc | [
"CC0-1.0"
] | 3 | 2020-11-17T23:19:20.000Z | 2021-03-29T15:08:56.000Z | contract-event-listener/src/config/__init__.py | xcantera/demo-provide-baseline | 985f391973fa6ca0761104b55077fded28f152fc | [
"CC0-1.0"
] | null | null | null | contract-event-listener/src/config/__init__.py | xcantera/demo-provide-baseline | 985f391973fa6ca0761104b55077fded28f152fc | [
"CC0-1.0"
] | 1 | 2020-12-11T00:26:33.000Z | 2020-12-11T00:26:33.000Z | from .schema import ( # noqa
Config,
SQSReceiver,
LogReceiver,
Receiver
)
| 13 | 29 | 0.615385 | 8 | 91 | 7 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | 91 | 6 | 30 | 15.166667 | 0.888889 | 0.043956 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.166667 | 0 | 0.166667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
264442fc8af628ec3988bcd2a6d680b881abb966 | 1,327 | py | Python | Ejercicio1.py | Rauulito/EjercicioPOO | 400ebbe4395548541b5023d8a410ddfa283f88f7 | [
"Apache-2.0"
] | null | null | null | Ejercicio1.py | Rauulito/EjercicioPOO | 400ebbe4395548541b5023d8a410ddfa283f88f7 | [
"Apache-2.0"
] | null | null | null | Ejercicio1.py | Rauulito/EjercicioPOO | 400ebbe4395548541b5023d8a410ddfa283f88f7 | [
"Apache-2.0"
] | null | null | null | class Libro():
#Creamos el constructor
def __init__(self, titulo,autor,editorial,precioBase, genero, nPaginas):
self.titulo = titulo
self.autor= autor
self.editorial= editorial
self.precioBase= precioBase
self.genero= genero
self.nPaginas= nPaginas
#Metodos get y set
def setTitulo(self,titulo):
self.titulo= titulo
def setAutor(self,autor):
self.autor= autor
def setEditorial(self,editorial):
self.editorial= editorial
def setPrecioBase(self,precioBase):
self.precioBase= precioBase
def setGenero(self,genero):
self.genero= genero
def setNPaginas(self,nPaginas):
self.nPaginas= nPaginas
def getTitulo(self):
return self.titulo
def getAutor(self):
return self.autor
def getEditorial(self,editorial):
return self.editorial
def getPrecioBase(self,precioBase):
return self.precioBase
def getGenero(self):
return self.genero
def getNPaginas(self):
return self.nPaginas
libro = Libro("El Palomo","Carlos Rodriguez","Edelvives","180","Aventuras","330")
print("Titulo:"+libro.titulo,"Autor:"+libro.autor, "Editorial:"+libro.editorial,"Precio base:"+libro.precioBase,"Género:"+libro.genero,"Número de páginas:"+libro.nPaginas) | 33.175 | 171 | 0.669932 | 148 | 1,327 | 5.97973 | 0.304054 | 0.067797 | 0.063277 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005803 | 0.220799 | 1,327 | 40 | 171 | 33.175 | 0.850097 | 0.02939 | 0 | 0.352941 | 0 | 0 | 0.084693 | 0 | 0 | 0 | 0 | 0.025 | 0 | 1 | 0.382353 | false | 0 | 0 | 0.176471 | 0.588235 | 0.029412 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
264a808d413bbf67e35dd4e04d0a267eaeacb3ac | 200 | py | Python | thinkpython_allen_downey/exercise_12_1.py | alirkaya/programming-textbook-solutions | 7362dce474b8a881d654f95604e09d1d0e76aec2 | [
"MIT"
] | null | null | null | thinkpython_allen_downey/exercise_12_1.py | alirkaya/programming-textbook-solutions | 7362dce474b8a881d654f95604e09d1d0e76aec2 | [
"MIT"
] | null | null | null | thinkpython_allen_downey/exercise_12_1.py | alirkaya/programming-textbook-solutions | 7362dce474b8a881d654f95604e09d1d0e76aec2 | [
"MIT"
] | null | null | null | def sumall(*args):
count = 0
for arg in args:
count += arg
return count
print(sumall(1,2,3,4,4,5,6,7))
print(sumall(1,2,34))
numbers = 1,2,3,4,5,6,6,7,8,9
print(sumall(*numbers))
| 18.181818 | 30 | 0.595 | 42 | 200 | 2.833333 | 0.5 | 0.277311 | 0.201681 | 0.218487 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144654 | 0.205 | 200 | 10 | 31 | 20 | 0.603774 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0 | 0 | 0.222222 | 0.333333 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2655d6c7fb66b3c5d656b8a6666cd3a7c01d406b | 271 | py | Python | plus-minus.py | saketsuman07/hacker-rank-solutions | 9055acf2e710b1a9caefe542b2b5e39b050e59fb | [
"MIT"
] | null | null | null | plus-minus.py | saketsuman07/hacker-rank-solutions | 9055acf2e710b1a9caefe542b2b5e39b050e59fb | [
"MIT"
] | null | null | null | plus-minus.py | saketsuman07/hacker-rank-solutions | 9055acf2e710b1a9caefe542b2b5e39b050e59fb | [
"MIT"
] | null | null | null | n = float(raw_input())
v = map(int, raw_input().strip().split())
pos = float(len(filter(lambda x: x > 0, v))) / n
neg = float(len(filter(lambda x: x < 0, v))) /n
zer = float(len(filter(lambda x: x == 0, v))) / n
print "%.3f" % pos
print "%.3f" % neg
print "%.3f" % zer
| 24.636364 | 49 | 0.571956 | 50 | 271 | 3.06 | 0.38 | 0.156863 | 0.27451 | 0.392157 | 0.490196 | 0.490196 | 0.490196 | 0.490196 | 0.490196 | 0 | 0 | 0.027149 | 0.184502 | 271 | 10 | 50 | 27.1 | 0.665158 | 0 | 0 | 0 | 0 | 0 | 0.04428 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.375 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
cd36ecd76329e8d74ce6fdd1bc24ac05a02cc921 | 101 | py | Python | Darlington/phase2/LIST/day 41 solution/qtn2.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 6 | 2020-05-23T19:53:25.000Z | 2021-05-08T20:21:30.000Z | Darlington/phase2/LIST/day 41 solution/qtn2.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 8 | 2020-05-14T18:53:12.000Z | 2020-07-03T00:06:20.000Z | Darlington/phase2/LIST/day 41 solution/qtn2.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 39 | 2020-05-10T20:55:02.000Z | 2020-09-12T17:40:59.000Z | #program to find the index of an item in a specified list.
num =[10, 30, 4, -6]
print(num.index(30))
| 25.25 | 58 | 0.683168 | 21 | 101 | 3.285714 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096386 | 0.178218 | 101 | 3 | 59 | 33.666667 | 0.73494 | 0.564356 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
cd4856841cf209c6c31d8cf4b1d4a02e1669fe87 | 1,051 | py | Python | adi_study_watch/nrf5_sdk_15.2.0/adi_study_watch/cli/m2m2/inc/master_definitions/led_interface.py | ArrowElectronics/Vital-Signs-Monitoring | ba43fe9a116d94170561433910fd7bffba5726e7 | [
"Unlicense"
] | 5 | 2021-06-13T17:11:19.000Z | 2021-12-01T18:20:38.000Z | adi_study_watch/nrf5_sdk_15.2.0/adi_study_watch/cli/m2m2/inc/master_definitions/led_interface.py | ArrowElectronics/Vital-Signs-Monitoring | ba43fe9a116d94170561433910fd7bffba5726e7 | [
"Unlicense"
] | null | null | null | adi_study_watch/nrf5_sdk_15.2.0/adi_study_watch/cli/m2m2/inc/master_definitions/led_interface.py | ArrowElectronics/Vital-Signs-Monitoring | ba43fe9a116d94170561433910fd7bffba5726e7 | [
"Unlicense"
] | 1 | 2022-01-08T15:01:44.000Z | 2022-01-08T15:01:44.000Z | #!/usr/bin/env python3
from ctypes import *
import m2m2_core
class M2M2_LED_COMMAND_ENUM_t(c_uint8):
M2M2_LED_COMMAND_GET = 0x0
M2M2_LED_COMMAND_SET = 0x1
class M2M2_LED_PATTERN_ENUM_t(c_uint8):
M2M2_LED_PATTERN_OFF = 0x0
M2M2_LED_PATTERN_SLOW_BLINK_DC_12 = 0x1
M2M2_LED_PATTERN_SLOW_BLINK_DC_12_N = 0xFE
M2M2_LED_PATTERN_FAST_BLINK_DC_50 = 0xAA
M2M2_LED_PATTERN_FAST_BLINK_DC_50_N = 0x55
M2M2_LED_PATTERN_MED_BLINK_DC_50 = 0xCC
M2M2_LED_PATTERN_SLOW_BLINK_DC_50 = 0xF0
M2M2_LED_PATTERN_ON = 0xFF
class M2M2_LED_PRIORITY_ENUM_t(c_uint8):
M2M2_LED_PRIORITY_LOW = 0x0
M2M2_LED_PRIORITY_MED = 0x1
M2M2_LED_PRIORITY_HIGH = 0x2
M2M2_LED_PRIORITY_CRITICAL = 0x3
class m2m2_led_ctrl_t(Structure):
fields = [
("command", M2M2_LED_COMMAND_ENUM_t),
("priority", M2M2_LED_PRIORITY_ENUM_t),
("r_pattern", M2M2_LED_PATTERN_ENUM_t),
("g_pattern", M2M2_LED_PATTERN_ENUM_t),
("b_pattern", M2M2_LED_PATTERN_ENUM_t),
]
| 30.028571 | 53 | 0.726927 | 164 | 1,051 | 4.02439 | 0.29878 | 0.243939 | 0.254545 | 0.109091 | 0.525758 | 0.401515 | 0.163636 | 0 | 0 | 0 | 0 | 0.107358 | 0.211227 | 1,051 | 34 | 54 | 30.911765 | 0.688782 | 0.019981 | 0 | 0 | 0 | 0 | 0.040816 | 0 | 0 | 0 | 0.046647 | 0 | 0 | 1 | 0 | false | 0 | 0.074074 | 0 | 0.777778 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
cd4c852bd50c3ecb65653b4479673255f18bc5fa | 8,170 | py | Python | test/filters_iso_test.py | todofixthis/filters-iso | da6052b49a2f71a3b3d6b66e2633debbb64f5b16 | [
"MIT"
] | null | null | null | test/filters_iso_test.py | todofixthis/filters-iso | da6052b49a2f71a3b3d6b66e2633debbb64f5b16 | [
"MIT"
] | null | null | null | test/filters_iso_test.py | todofixthis/filters-iso | da6052b49a2f71a3b3d6b66e2633debbb64f5b16 | [
"MIT"
] | null | null | null | import filters as f
from filters.test import BaseFilterTestCase
# noinspection PyProtectedMember
from iso3166 import Country, countries_by_alpha3
from language_tags import tags
from language_tags.Tag import Tag
from moneyed import Currency, get_currency
class CountryTestCase(BaseFilterTestCase):
filter_type = f.ext.Country
def test_pass_none(self):
"""
``None`` always passes this filter.
Use ``Required | Country`` if you want to reject ``None``.
"""
self.assertFilterPasses(None)
def test_pass_valid_alpha_3(self):
"""
The incoming value is a valid ISO-3316-1 alpha-3 country code.
"""
filtered = self._filter('FRA')
self.assertFilterPasses(filtered, self.skip_value_check)
country = filtered.cleaned_data
self.assertIsInstance(country, Country)
self.assertEqual(country.name, 'France')
def test_pass_valid_alpha_2(self):
"""
The incoming value is a valid ISO-3166-1 alpha-2 country code.
"""
filtered = self._filter('IE')
self.assertFilterPasses(filtered, self.skip_value_check)
country = filtered.cleaned_data
self.assertIsInstance(country, Country)
self.assertEqual(country.name, 'Ireland')
def test_pass_case_insensitive(self):
"""
The incoming value is basically valid, but it has the wrong
case.
"""
filtered = self._filter('arg')
self.assertFilterPasses(filtered, self.skip_value_check)
country = filtered.cleaned_data
self.assertIsInstance(country, Country)
self.assertEqual(country.name, 'Argentina')
def test_fail_invalid_code(self):
"""
The incoming value is not a valid ISO-3316-1 country code.
"""
# Surrender is not an option!
self.assertFilterErrors('\u2690', [f.ext.Country.CODE_INVALID])
def test_fail_subdivision(self):
"""
Subdivisions are not accepted, even though certain ones are
technically part of ISO-3166-1.
After all, the filter is named ``Country``, not ``ISO_3166_1``!
"""
self.assertFilterErrors('IE-L', [f.ext.Country.CODE_INVALID])
def test_fail_wrong_type(self):
"""
The incoming value is not a string.
"""
self.assertFilterErrors(['CHN', 'JPN'], [f.Type.CODE_WRONG_TYPE])
def test_pass_country_object(self):
"""
The incoming value is already a :py:class:`Country` object.
"""
self.assertFilterPasses(countries_by_alpha3.get('USA'))
class CurrencyTestCase(BaseFilterTestCase):
filter_type = f.ext.Currency
def test_pass_none(self):
"""
``None`` always passes this filter.
Use ``Required | Currency`` if you do want to reject ``None``.
"""
self.assertFilterPasses(None)
def test_pass_valid_code(self):
"""
The incoming value is a valid ISO-4217 currency code.
"""
filtered = self._filter('PEN')
self.assertFilterPasses(filtered, self.skip_value_check)
currency = filtered.cleaned_data
self.assertIsInstance(currency, Currency)
self.assertEqual(currency.name, 'Nuevo Sol')
def test_pass_case_insensitive(self):
"""
The incoming value is basically valid, but it has the wrong
case.
"""
filtered = self._filter('ars')
self.assertFilterPasses(filtered, self.skip_value_check)
currency = filtered.cleaned_data
self.assertIsInstance(currency, Currency)
self.assertEqual(currency.name, 'Argentine Peso')
def test_fail_invalid_code(self):
"""
The incoming value is not a valid ISO-4217 currency code.
"""
# You can't use the currency symbol, silly!
self.assertFilterErrors('\u00a3', [f.ext.Currency.CODE_INVALID])
def test_fail_wrong_type(self):
"""
The incoming value is not a string.
"""
self.assertFilterErrors(['USD', 'CNY'], [f.Type.CODE_WRONG_TYPE])
def test_pass_currency_object(self):
"""
The incoming value is already a :py:class:`moneyed.Currency`
object.
"""
self.assertFilterPasses(get_currency(code='USD'))
class LocaleTestCase(BaseFilterTestCase):
"""
Note that unit tests will focus on the functionality of the Filter
rather than the underlying library; the variety of formats and
values that the Locale Filter accepts FAR exceeds the scope
demonstrated in these tests.
References:
- http://r12a.github.io/apps/subtags/
- https://pypi.python.org/pypi/language-tags
- https://github.com/mattcg/language-tags
"""
filter_type = f.ext.Locale
def test_pass_none(self):
"""
``None`` always passes this filter.
Use `Required | Locale` if you want to reject `None`.
"""
self.assertFilterPasses(None)
def test_valid_locale(self):
"""
Valid locale string is valid.
"""
# There are a LOT of possible values that can go here.
# http://r12a.github.io/apps/subtags/
filtered = self._filter('en-cmn-Hant-HK')
self.assertFilterPasses(filtered, self.skip_value_check)
tag = filtered.cleaned_data
self.assertIsInstance(tag, Tag)
self.assertTrue(tag.valid)
#
# Language tags have LOTS of attributes.
# We will check a few of them to make sure the Filter returned
# the correct tag, but you should be aware that there is a
# LOT of information available in the value returned by the
# Locale Filter.
#
# For more information, check out the repo for the Javascript
# version of the underlying `language_tags` library (the
# Python version is a port with the same API... and no usage
# documentation of its own).
# https://github.com/mattcg/language-tags
#
self.assertEqual(str(tag), 'en-cmn-Hant-HK')
self.assertEqual(str(tag.language), 'en')
self.assertEqual(str(tag.region), 'HK')
self.assertEqual(str(tag.script), 'Hant')
def test_pass_case_insensitive(self):
"""
The incoming value is basically valid, except it uses the wrong
case.
"""
filtered = self._filter('Az-ArAb-Ir')
self.assertFilterPasses(filtered, self.skip_value_check)
tag = filtered.cleaned_data
self.assertIsInstance(tag, Tag)
self.assertTrue(tag.valid)
self.assertEqual(str(tag), 'az-Arab-IR')
self.assertEqual(str(tag.language), 'az')
self.assertEqual(str(tag.region), 'IR')
self.assertEqual(str(tag.script), 'Arab')
def test_fail_invalid_value(self):
"""
The incoming value generates parsing errors.
"""
# noinspection SpellCheckingInspection
filtered = self._filter(
'sl-Cyrl-YU-rozaj-solba-1994-b-1234-a-Foobar-x-b-1234-a-Foobar'
)
self.assertFilterErrors(filtered, [f.ext.Locale.CODE_INVALID])
# Parse errors included here for demonstration purposes.
self.assertListEqual(
filtered.filter_messages[''][0].context.get('parse_errors'),
[
# Sorry about the magic values.
# These are defined in the Tag initializer, so they're
# a bit tricky to get at without complicating the
# test.
# :py:meth:`Tag.__init__`
(11, "The subtag 'YU' is deprecated."),
(8, "Duplicate variant subtag 'solba' found."),
(8, "Duplicate variant subtag '1994' found."),
],
)
def test_fail_wrong_type(self):
"""
The incoming value is not a string.
"""
self.assertFilterErrors(['en', 'US'], [f.Type.CODE_WRONG_TYPE])
def test_pass_tag_object(self):
"""
The incoming value is already a Tag object.
"""
self.assertFilterPasses(tags.tag('en-cmn-Hant-HK'))
| 31.914063 | 75 | 0.623745 | 968 | 8,170 | 5.144628 | 0.260331 | 0.028112 | 0.045181 | 0.060241 | 0.557028 | 0.482932 | 0.445984 | 0.445984 | 0.393775 | 0.393775 | 0 | 0.012643 | 0.273929 | 8,170 | 255 | 76 | 32.039216 | 0.826871 | 0.3153 | 0 | 0.373737 | 0 | 0.010101 | 0.071085 | 0.012215 | 0 | 0 | 0 | 0 | 0.434343 | 1 | 0.20202 | false | 0.252525 | 0.060606 | 0 | 0.323232 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
cd537e30b909d9612963bfa8b8f1c4d920b60f98 | 1,584 | py | Python | grailapp-osc-6a60f9376f69/setup.py | yuan7407/TD_OpenCV_PythonOSC | f4424b1f7155f7942397212b97183cb749612f50 | [
"MIT"
] | 20 | 2018-12-06T21:35:10.000Z | 2022-02-08T23:22:35.000Z | grailapp-osc-6a60f9376f69/setup.py | phoebezhung/TD_OpenCV_PythonOSC | f4424b1f7155f7942397212b97183cb749612f50 | [
"MIT"
] | null | null | null | grailapp-osc-6a60f9376f69/setup.py | phoebezhung/TD_OpenCV_PythonOSC | f4424b1f7155f7942397212b97183cb749612f50 | [
"MIT"
] | 4 | 2019-02-27T08:13:45.000Z | 2021-11-02T15:14:41.000Z | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
setup
~~~~~
Setup Script
Run the build process by running the command 'python setup.py build'
:copyright: (c) 2018 by Oleksii Lytvyn.
:license: MIT, see LICENSE for more details.
"""
import osc.osc as osc
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='osc',
version=osc.__version__,
author='Oleksii Lytvyn',
author_email='grailapplication@gmail.com',
description='OSC implementation in pure Python',
long_description=open('README.rst').read(),
url='https://bitbucket.org/grailapp/osc',
download_url='https://bitbucket.org/grailapp/osc/get/default.zip',
platforms='any',
packages=['osc'],
keywords=['osc', 'protocol', 'utilities', 'osc-1.0', 'network', 'communication', 'udp'],
zip_safe=False,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3',
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Multimedia :: Sound/Audio',
'Topic :: System :: Networking',
'License :: OSI Approved :: MIT License'
],
install_requires=[]
)
| 31.058824 | 92 | 0.621212 | 173 | 1,584 | 5.635838 | 0.595376 | 0.155897 | 0.205128 | 0.186667 | 0.118974 | 0.06359 | 0 | 0 | 0 | 0 | 0 | 0.01634 | 0.227273 | 1,584 | 50 | 93 | 31.68 | 0.780229 | 0.140783 | 0 | 0 | 0 | 0 | 0.544428 | 0.019578 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.114286 | 0 | 0.114286 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.